Location: PHPKode > projects > PhpMyForum > phpmyforum_4_1_1/functions.php
<?php
define('PMF_INCLUDE', 1);
require('head.php');

#
#
### Abo's
if ($_GET['action'] == 'readabo') {
    // nicht Eingeloggt ?
    if (!$_user['id']) msg('error_access');
    // alles gelesen markieren
    $_db->u_query('UPDATE `'.$_cfg['DB_PREFIX'].'user` SET last_login = last_action, last_action='.PMF_TIME.' WHERE id = '.$_user['id']);
    cookie('pmfTopics', serialize(array()));
    msg('error_abo_read', 'index.php?'.$_sess['url']);
    

    
#
#
### Foren-Abo's
} elseif ($_GET['action'] == 'forumabo') {
    require($_cfg['MAIN'].'/lib/post.inc.php');
    // nicht Eingeloggt ?
    if (!$_user['id']) msg('error_access');
    // folge-Seite ... ?
    if (preg_match('/.*'.str_replace('/', '\\/', quotemeta($_cfg['SITE'])).'.*/i', $_SERVER['HTTP_REFERER'])) {
        $goto = $_SERVER['HTTP_REFERER'];
    } else {
        $goto = 'user.php?action=abo&'.$_sess['url'];
    }
    // hinzufügen / löschen
    msg( forum_abo( intval($_GET['id'])), $goto);
    
    
    
#
#
### Themen - Abo's
} elseif ($_GET['action'] == 'topicabo') {
    require($_cfg['MAIN'].'/lib/post.inc.php');
    // nicht Eingeloggt ?
    if (!$_user['id']) msg('error_access');
    // folge-Seite ... ?
    if (preg_match('/.*'.str_replace('/','\\/', quotemeta($_cfg['SITE'])).'.*/i', $_SERVER['HTTP_REFERER'])) {
        $goto = $_SERVER['HTTP_REFERER'];
    } else {
        $goto = 'user.php?action=abo&'.$_sess['url'];
    }
    // hinzufügen / löschen
    msg( topic_abo( intval($_GET['id'])), $goto);



#
#
### Smilie - Popup Liste
} elseif ($_GET['action'] == 'smilies') {
    $result = $_db->query('SELECT * FROM `'.$_cfg['DB_PREFIX'].'smilie` WHERE `view` = 1 ORDER BY name');
    $smilie_lines = '';
    while ($Daten = $_db->fetch_array ($result)) {
        $Daten['filename'] = str_replace('%images%', $_style->cfg['images'].'/smilies', $Daten['filename']);
        $smilie_lines .= eval ('return ("'.$_style->get('smilie_popup_line').'");');
    }
    eval ('echo "'.$_style->get('smilie_popup').'";');



#
#
### Board - Code Liste
} elseif ($_GET['action'] == 'bbcodes') {
    require($_cfg['MAIN'].'/lib/bbcode.inc.php');
    # alle Codes anzeigen
    if (!$_GET['id']) {
        $result = $_db->query('SELECT * FROM `'.$_cfg['DB_PREFIX'].'bbcode` ORDER BY name');
        $c = 1;
        $bbcode_lines = '';
        while ($Daten = $_db->fetch_array($result)) {
            $bbcode_lines .= eval ('return ("'.$_style->get('bbcodes_popup_line_'.$c).'");');
            $c = ($c < 2) ? 2 : 1;
        }
        eval ('echo "'.$_style->get('bbcodes_popup').'";');
        
    # nur ausgew�hlten Anzeigen
    } else {
        $_bbcode = new pmf_bbcode();
        $Daten = $_db->fetch_array( $_db->query('SELECT * FROM `'.$_cfg['DB_PREFIX'].'bbcode` WHERE id = '.intval($_GET['id'])));
        $Daten['convert'] = $_bbcode->parse($Daten['example'], 1, 1, 0, 0, 1);
        eval ('echo "'.$_style->get('bbcodes_popup_detail').'";');
    }
     

    
#
#
### Weiterleitung ("Gehe zu:")
} elseif ($_GET['action'] == 'goto') {
    $goto = !empty($_GET['go']) ? $_GET['go'] : $_POST['go'];
    # Goto !!!
    list ($Typ, $Text) = split ('-', $goto);
    if (!empty($Typ) && !empty($Text)) {
        //-> Forum
        if ($Typ == 'b') {
            header('Location: board.php?id='.$Text.'&'.$_sess['url']);
        //-> Web-Seiten
        } elseif ($Typ == 'w') {
            header('Location: '.$Text);
        }
        exit();
    # Seite nicht gefunden !!!
    } else {
        msg('error_footer_list_fault', 'back()');
    }



#
#
### Popup für PN's
} elseif ($_GET['action'] == 'pm_popup') {
    $status = $_db->fetch_first('SELECT COUNT(`id`) AS `anz`
                                 FROM `'.$_cfg['DB_PREFIX'].'private`
                                 WHERE `to_id` = '.intval($_user['id']).'
                                   AND `view` = 0
                                   AND `del` <> 1');
    eval ('echo "'.$_style->get('pm_popup_status').'";');



#
#
### Member - Such-Popup
} elseif ($_GET['action'] == 'member_search') {
    # Ergebnis
    if (!empty($_POST['search'])) {
        $result = $_db->query('SELECT name FROM `'.$_cfg['DB_PREFIX'].'user` WHERE name LIKE \'%'.gpc_addslashes($_POST['search']).'%\'');
        $result_lines = '';
        while ($Daten = $_db->fetch_array($result)) {
            $result_lines .= '<option value="'.$Daten['name'].'">'.$Daten['name'].'</option>';
        }
        
    # nur Formular
    } else {
        $_style->del('member_search_result');
    }
    eval ('echo "'.$_style->get('member_search').'";');



#
#
### IP-Addy eines Beitrags
} elseif ($_GET['action'] == 'mod_ip') {
    $Daten = $_db->fetch_first('SELECT p.`ip`,
                                       p.`post_date`,
                                       u.`name` AS `user_name`,
                                       t.`board_id`
                                FROM `'.$_cfg['DB_PREFIX'].'post` AS p,
                                     `'.$_cfg['DB_PREFIX'].'user` AS u,
                                     `'.$_cfg['DB_PREFIX'].'topic` AS t
                                WHERE p.`id` = '.intval($_GET['id']).'
                                  AND p.`user_id` = u.`id`
                                  AND t.`id` = p.`topic_id`');
    // neue Foren-Rechte ?
    $_user = get_user_info(null, $Daten['board_id']);
    
    if (!empty($_user['access']['mod_edit']) || !empty($_user['access']['mod_del'])) {
        $Daten['post_time'] = pmf_time($Daten['post_date']);
        $Daten['post_date'] = pmf_date($Daten['post_date']);
        eval ('echo "'.$_style->get('mod_ip').'";');
    
    } else {
        eval ('echo "'.$_style->get('mod_ip_fault').'";');
    }
    
    
    
#
#
### Who Posted
} elseif ($_GET['action'] == 'who') {
    $result = $_db->query('SELECT u.id AS user_id,
                                  u.name AS user_name,
                                  COUNT(*) AS posts
                           FROM `'.$_cfg['DB_PREFIX'].'user` AS u,
                                `'.$_cfg['DB_PREFIX'].'post` AS p
                           WHERE p.topic_id = '.intval($_GET['id']).'
                             AND u.id = p.user_id
                           GROUP BY p.user_id
                           ORDER BY u.name');
    $who_lines = '';
    while ($Daten = $_db->fetch_array($result)) {
        $who_lines .= eval ('return ("'.$_style->get('who_line').'");');
    }
    eval ('echo "'.$_style->get('who').'";');
    
    
    
#
#
### Reg. Aktivierung
} elseif ($_GET['action'] == 'activation') {
    $_db->u_query('UPDATE `'.$_cfg['DB_PREFIX'].'user`
                 SET `group_id` = '.$_config['DEFAULT_USER_GROUP'].',
                     `last_login` = '.PMF_TIME.',
                     `last_action` = '.PMF_TIME.'
                 WHERE `id` = '.intval($_GET['id']).'
                   AND `last_login` = 0');
    if ($_db->affected_rows() == 1) {
        msg('error_activation', 'index.php?'.$_sess['url']);
    } else {
        msg('error_activation_fault', 'back()');
    }
}
?>
Return current item: PhpMyForum