示例#1
0
        }
        $checkboxes[] = array('name' => 'subscribe', 'checked' => $subscr_checked ? true : false, 'title' => $is_subscribed ? $lang_post['Stay subscribed'] : $lang_post['Subscribe']);
    }
} else {
    if ($panther_config['o_smilies'] == '1') {
        $checkboxes[] = array('name' => 'hide_smilies', 'checked' => isset($_POST['hide_smilies']) ? true : false, 'title' => $lang_post['Hide smilies']);
    }
}
// Check to see if the topic review is to be displayed
$posts = array();
if ($tid && $panther_config['o_topic_review'] != '0') {
    require_once PANTHER_ROOT . 'include/parser.php';
    $data = array(':id' => $tid);
    $ps = $db->run('SELECT p.poster, p.message, p.hide_smilies, p.posted, u.group_id FROM ' . $db->prefix . 'posts AS p LEFT JOIN ' . $db->prefix . 'users AS u ON (p.poster=u.username) WHERE p.topic_id=:id ORDER BY p.id DESC LIMIT ' . $panther_config['o_topic_review'], $data);
    foreach ($ps as $cur_post) {
        $posts[] = array('username' => colourize_group($cur_post['poster'], $cur_post['group_id']), 'posted' => format_time($cur_post['posted']), 'message' => $parser->parse_message($cur_post['message'], $cur_post['hide_smilies']));
    }
}
$render = array('lang_common' => $lang_common, 'lang_post' => $lang_post, 'posts' => $posts, 'errors' => $errors, 'index_link' => panther_link($panther_url['index']), 'forum_link' => panther_link($panther_url['forum'], array($cur_posting['id'], url_friendly($cur_posting['forum_name']))), 'cur_posting' => $cur_posting, 'POST' => $_POST, 'action' => $action, 'fid' => $fid, 'tid' => $tid, 'csrf_token' => generate_csrf_token(), 'panther_config' => $panther_config, 'message' => isset($_POST['req_message']) ? $orig_message : (isset($quote) ? $quote : ''), 'panther_user' => $panther_user, 'can_upload' => $can_upload, 'checkboxes' => $checkboxes, 'quickpost_links' => array('bbcode' => panther_link($panther_url['help'], array('bbcode')), 'url' => panther_link($panther_url['help'], array('url')), 'img' => panther_link($panther_url['help'], array('img')), 'smilies' => panther_link($panther_url['help'], array('smilies'))));
if (isset($cur_posting['subject'])) {
    $render['topic_link'] = panther_link($panther_url['topic'], array($tid, url_friendly($cur_posting['subject'])));
}
if (isset($_POST['preview'])) {
    require_once PANTHER_ROOT . 'include/parser.php';
    $render['preview'] = $parser->parse_message($message, $hide_smilies);
}
if ($panther_user['is_guest']) {
    $email_form_name = $panther_config['p_force_guest_email'] == '1' ? 'req_email' : 'email';
    $render['username'] = isset($username) ? $username : '';
    $render['email'] = isset($_POST[$email_form_name]) ? $email : '';
    $render['email_form_name'] = $email_form_name;
示例#2
0
     $p = !isset($_GET['p']) || !is_numeric($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages ? 1 : $_GET['p'];
     $start_from = 50 * ($p - 1);
     $data = array(':start' => $start_from);
     $ps = $db->run('SELECT w.id, w.user_id, w.type_id, w.post_id, w.title AS custom_title, w.points, w.date_issued, w.date_expire, w.issued_by, t.title, u.username AS issued_by_username, u.group_id AS issuer_gid, v.username AS username, v.group_id AS user_gid FROM ' . $db->prefix . 'warnings as w LEFT JOIN ' . $db->prefix . 'warning_types AS t ON t.id=w.type_id LEFT JOIN ' . $db->prefix . 'users AS u ON u.id=w.issued_by LEFT JOIN ' . $db->prefix . 'users AS v ON v.id=w.user_id ORDER BY w.date_issued DESC LIMIT :start, 50', $data);
     $warnings = array();
     foreach ($ps as $active_warnings) {
         if ($active_warnings['custom_title'] != '') {
             $warning_title = sprintf($lang_warnings['Custom warning'], $active_warnings['custom_title']);
         } else {
             if ($active_warnings['title'] != '') {
                 $warning_title = $active_warnings['title'];
             } else {
                 $warning_title = '';
             }
         }
         $warnings[] = array('title' => $warning_title, 'issued' => format_time($active_warnings['date_issued']), 'points' => $active_warnings['points'], 'username' => $active_warnings['username'] != '' ? colourize_group($active_warnings['username'], $active_warnings['user_gid'], $active_warnings['user_id']) : '', 'issuer' => $active_warnings['issued_by_username'] != '' ? colourize_group($active_warnings['issued_by_username'], $active_warnings['issuer_gid'], $active_warnings['issued_by']) : '', 'details_link' => panther_link($panther_url['warning_details'], array($active_warnings['id'])));
     }
     define('PANTHER_ACTIVE_PAGE', 'index');
     require PANTHER_ROOT . 'header.php';
     $tpl = load_template('recent_warnings.tpl');
     echo $tpl->render(array('lang_warnings' => $lang_warnings, 'lang_common' => $lang_common, 'warnings' => $warnings, 'num_pages' => $num_pages, 'pagination' => paginate($num_pages, $p, $panther_url['warnings_recent'])));
 } else {
     $ps = $db->select('warning_types', 'id, title, description, points, expiration_time', array(), '', 'points, id');
     $ps1 = $db->select('warning_levels', 'id, points, period', array(), '', 'points, id');
     // If neither have been configured
     if (!$ps->rowCount() && !$ps1->rowCount()) {
         message($lang_common['Bad request']);
     }
     $warning_types = array();
     foreach ($ps as $cur_type) {
         $warning_types[] = array('title' => $cur_type['title'], 'description' => $cur_type['description'], 'points' => $cur_type['points']);
示例#3
0
    // Display all the categories and forums
    $categories = $forums = array();
    $ps = $db->run('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM ' . $db->prefix . 'categories AS c INNER JOIN ' . $db->prefix . 'forums AS f ON c.id=f.cat_id WHERE f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position');
    foreach ($ps as $cur_forum) {
        if (!isset($categories[$cur_forum['cid']])) {
            $categories[$cur_forum['cid']] = array('cat_name' => $cur_forum['cat_name'], 'id' => $cur_forum['cid']);
        }
        $forums[] = array('id' => $cur_forum['fid'], 'forum_name' => $cur_forum['forum_name'], 'category_id' => $cur_forum['cid'], 'selected' => in_array($cur_forum['fid'], $id_list) ? true : false);
    }
    $tpl = load_template('edit_announcement.tpl');
    echo $tpl->render(array('lang_admin_announcements' => $lang_admin_announcements, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['admin_announcements']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/announcements.php'), 'id' => $id, 'action' => $action, 'cur_announce' => $cur_announcement, 'help_link' => panther_link($panther_url['help'], array('bbcode')), 'categories' => $categories, 'forums' => $forums));
} elseif ($action == 'delete' && $id > 0) {
    $tpl = load_template('delete_announcement.tpl');
    echo $tpl->render(array('lang_admin_announcements' => $lang_admin_announcements, 'lang_common' => $lang_common, 'lang_admin_common' => $lang_admin_common, 'form_action' => panther_link($panther_url['delete_announcement'], array($id)), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/announcements.php'), 'id' => $id));
} else {
    $announcements = array();
    $ps = $db->run('SELECT a.subject, a.forum_id, a.user_id, u.username, u.group_id, a.id FROM ' . $db->prefix . 'announcements AS a INNER JOIN ' . $db->prefix . 'users AS u ON a.user_id=u.id ORDER BY a.id DESC LIMIT :start, :limit', $data);
    foreach ($ps as $announcement) {
        $forum_names = array();
        $ids = explode(',', $announcement['forum_id']);
        foreach ($ids as $id) {
            $data = array(':id' => $id);
            $ps1 = $db->select('forums', 'forum_name', $data, 'id=:id');
            $forum_names[] = $ps1->fetchColumn();
        }
        $announcements[] = array('edit_link' => panther_link($panther_url['edit_announcement'], array($announcement['id'])), 'delete_link' => panther_link($panther_url['delete_announcement'], array($announcement['id'])), 'subject' => $announcement['subject'], 'poster' => colourize_group($announcement['username'], $announcement['group_id'], $announcement['user_id']));
    }
    $tpl = load_template('admin_announcements.tpl');
    echo $tpl->render(array('lang_admin_common' => $lang_admin_common, 'lang_admin_announcements' => $lang_admin_announcements, 'lang_common' => $lang_common, 'pagination' => paginate($num_pages, $page, $panther_url['admin_announcements']), 'add_link' => panther_link($panther_url['add_announcement']), 'announcements' => $announcements));
}
require PANTHER_ROOT . 'footer.php';
示例#4
0
             $id = intval(key($_POST['remove']));
             $data = array(':id' => $id, ':uid' => $panther_user['id']);
             // Before we do anything, check we blocked this user
             $ps = $db->select('blocks', 1, $data, 'id=:id AND user_id=:uid');
             if (!$ps->rowCount()) {
                 message($lang_common['No permission']);
             }
             $db->delete('blocks', 'id=:id AND user_id=:uid', $data);
             redirect(panther_link($panther_url['pms_blocked']), $lang_pm['Block del redirect']);
         }
     }
     $data = array(':uid' => $panther_user['id']);
     $ps = $db->run('SELECT b.id, b.block_id, u.username, u.group_id FROM ' . $db->prefix . 'blocks AS b INNER JOIN ' . $db->prefix . 'users AS u ON b.block_id=u.id WHERE b.user_id=:uid', $data);
     $users = array();
     foreach ($ps as $cur_block) {
         $users[] = array('name' => colourize_group($cur_block['username'], $cur_block['group_id'], $cur_block['block_id']), 'id' => $cur_block['id']);
     }
     $required_fields = array('req_username' => $lang_common['Username']);
     $focus_element = array('block', 'req_username');
     ($hook = get_extensions('pms_blocked_before_header')) ? eval($hook) : null;
     $page_title = array($panther_config['o_board_title'], $lang_common['PM'], $lang_pm['My blocked']);
     define('PANTHER_ALLOW_INDEX', 1);
     define('PANTHER_ACTIVE_PAGE', 'pm');
     require PANTHER_ROOT . 'header.php';
     $tpl = load_template('blocked_users.tpl');
     echo $tpl->render(array('errors' => $errors, 'lang_pm' => $lang_pm, 'lang_common' => $lang_common, 'pm_menu' => generate_pm_menu('blocked'), 'form_action' => panther_link($panther_url['pms_blocked']), 'username' => isset($username) ? $username : '', 'users' => $users));
     require PANTHER_ROOT . 'footer.php';
 } else {
     if ($action == 'folders') {
         $errors = array();
         if (isset($_POST['add_folder'])) {
示例#5
0
     $reputation = array();
     foreach ($ps as $cur_row) {
         if ($cur_row['username'] == '') {
             $cur_row['username'] = $lang_profile['Deleted user'];
             $cur_row['group_id'] = PANTHER_GUEST;
         }
         if ($cur_row['given_by'] == '') {
             $cur_row['given_by'] = PANTHER_GUEST;
         }
         if ($cur_row['given_to'] == '') {
             $cur_row['given_to'] = PANTHER_GUEST;
         }
         if ($section == 'rep_received') {
             $username = colourize_group($cur_row['username'], $cur_row['group_id'], $cur_row['given_by']);
         } else {
             $username = colourize_group($cur_row['username'], $cur_row['group_id'], $cur_row['given_to']);
         }
         $reputation[] = array('given' => format_time($cur_row['time_given']), 'user' => $username, 'vote' => $cur_row['vote'], 'id' => $cur_row['id'], 'subject' => $cur_row['subject'], 'link' => panther_link($panther_url['post'], array($cur_row['post_id'])));
     }
     $tpl = load_template('profile_reputation.tpl');
     echo $tpl->render(array('lang_profile' => $lang_profile, 'lang_common' => $lang_common, 'panther_config' => $panther_config, 'index_link' => panther_link($panther_url['index']), 'profile_link' => panther_link($panther_url['profile'], array($id, url_friendly($user['username']))), 'user' => $user, 'rep_section' => $lang_profile[ucfirst($section)], 'pagination' => paginate($num_pages, $page, $panther_url['profile_' . strtolower($section)], array($id)), 'section' => $section, 'panther_user' => $panther_user, 'id' => $id, 'page' => $page, 'reputation' => $reputation));
 } else {
     if ($section == 'privacy') {
         $page_title = array($panther_config['o_board_title'], $lang_common['Profile'], $lang_profile['Section privacy']);
         define('PANTHER_ACTIVE_PAGE', 'profile');
         require PANTHER_ROOT . 'header.php';
         generate_profile_menu('privacy');
         $tpl = load_template('profile_privacy.tpl');
         echo $tpl->render(array('lang_profile' => $lang_profile, 'lang_common' => $lang_common, 'lang_prof_reg' => $lang_prof_reg, 'csrf_token' => generate_csrf_token(), 'form_action' => panther_link($panther_url['profile_privacy'], array($id)), 'panther_config' => $panther_config, 'panther_user' => $panther_user, 'user' => $user));
     } else {
         if ($section == 'admin') {
示例#6
0
$start_from = $panther_user['disp_posts'] * ($p - 1);
($hook = get_extensions('online_before_header')) ? eval($hook) : null;
$page_title = array($panther_config['o_board_title'], $lang_online['viewing online']);
define('PANTHER_ACTIVE_PAGE', 'online');
require PANTHER_ROOT . 'header.php';
$bots = $online = array();
$ps = $db->run('SELECT o.user_id, o.ident, o.currently, o.logged, u.group_id FROM ' . $db->prefix . 'online AS o INNER JOIN ' . $db->prefix . 'users AS u ON o.user_id=u.id WHERE o.idle=0');
foreach ($ps as $panther_user_online) {
    if (strpos($panther_user_online['ident'], '[Bot]') !== false) {
        $name = explode('[Bot]', $panther_user_online['ident']);
        if (empty($bots[$name[1]])) {
            $bots[$name[1]] = 1;
        } else {
            ++$bots[$name[1]];
        }
        foreach ($bots as $online_name => $online_id) {
            $ident = $online_name . ' [Bot]';
        }
    } else {
        if ($panther_user_online['user_id'] == 1) {
            $ident = $lang_common['Guest'];
        } else {
            $ident = $panther_user_online['ident'];
        }
    }
    $online[] = array('username' => colourize_group($ident, $panther_user_online['group_id'], $panther_user_online['user_id']), 'location' => generate_user_location($panther_user_online['currently']), 'last_active' => format_time_difference($panther_user_online['logged'], $lang_online));
}
$tpl = load_template('online.tpl');
echo $tpl->render(array('pagination' => paginate($num_pages, $p, $panther_url['online']), 'lang_online' => $lang_online, 'lang_common' => $lang_common, 'users_online' => $online, 'num_pages' => $num_pages));
($hook = get_extensions('online_after_display')) ? eval($hook) : null;
require PANTHER_ROOT . 'footer.php';
示例#7
0
function generate_user_location($url)
{
    global $db, $panther_user, $lang_online, $panther_url;
    static $perms;
    if (!defined('PANTHER_FP_LOADED')) {
        $perms = array();
        if (file_exists(FORUM_CACHE_DIR . 'cache_perms.php')) {
            require FORUM_CACHE_DIR . 'cache_perms.php';
        } else {
            if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
                require PANTHER_ROOT . 'include/cache.php';
            }
            generate_perms_cache();
            require FORUM_CACHE_DIR . 'cache_perms.php';
        }
    }
    switch ($url) {
        case null:
            $location = $lang_online['bot'];
            break;
        case 'index.php':
            $location = $lang_online['viewing index'];
            break;
        case stristr($url, 'userlist.php'):
            $location = $lang_online['viewing userlist'];
            break;
        case 'online.php':
            $location = $lang_online['viewing online'];
            break;
        case 'misc.php?action=rules':
            $location = $lang_online['viewing rules'];
            break;
        case stristr($url, 'search'):
            $location = $lang_online['searching'];
            break;
        case stristr($url, 'help'):
            $location = $lang_online['bbcode help'];
            break;
        case stristr($url, 'profile'):
            $id = filter_var($url, FILTER_SANITIZE_NUMBER_INT);
            $data = array(':id' => $id);
            $ps = $db->select('users', 'username, group_id', $data, 'id=:id');
            $user = $ps->fetch();
            $username = colourize_group($user['username'], $user['group_id'], $id);
            $location = sprintf($lang_online['viewing profile'], $username);
            break;
        case stristr($url, 'pms_'):
            $location = $lang_online['private messaging'];
            break;
        case stristr($url, 'admin'):
            $location = $lang_online['administration'];
            break;
        case stristr($url, 'login'):
            $location = $lang_online['login'];
            break;
        case stristr($url, 'viewforum.php'):
            if (strpos($url, '&p=') !== false) {
                preg_match('~&p=(.*)~', $url, $replace);
                $url = str_replace($replace[0], '', $url);
            }
            $id = filter_var($url, FILTER_SANITIZE_NUMBER_INT);
            $data = array(':id' => $id);
            $ps = $db->select('forums', 'forum_name', $data, 'id=:id');
            $forum_name = $ps->fetchColumn();
            if (!isset($perms[$panther_user['g_id'] . '_' . $id])) {
                $perms[$panther_user['g_id'] . '_' . $id] = $perms['_'];
            }
            if ($perms[$panther_user['g_id'] . '_' . $id]['read_forum'] == '1' || is_null($perms[$panther_user['g_id'] . '_' . $id]['read_forum'])) {
                $location = array('href' => panther_link($panther_url['forum'], array($id, url_friendly($forum_name))), 'name' => $forum_name, 'lang' => $lang_online['viewing forum']);
            } else {
                $location = $lang_online['in hidden forum'];
            }
            break;
        case stristr($url, 'viewtopic.php?pid'):
            //Now for the nasty part =)
            $pid = filter_var($url, FILTER_SANITIZE_NUMBER_INT);
            $data = array(':id' => $pid);
            $ps = $db->run('SELECT t.subject, t.forum_id AS fid FROM ' . $db->prefix . 'posts AS p INNER JOIN ' . $db->prefix . 'topics AS t ON p.topic_id=t.id WHERE p.id=:id', $data);
            $info = $ps->fetch();
            if (!isset($perms[$panther_user['g_id'] . '_' . $info['fid']])) {
                $perms[$panther_user['g_id'] . '_' . $info['fid']] = $perms['_'];
            }
            if ($perms[$panther_user['g_id'] . '_' . $info['fid']]['read_forum'] == '1' || is_null($perms[$panther_user['g_id'] . '_' . $info['fid']]['read_forum'])) {
                $location = array('href' => panther_link($panther_url['post'], array($pid)), 'name' => $info['subject'], 'lang' => $lang_online['viewing topic']);
            } else {
                $location = $lang_online['in hidden forum'];
            }
            break;
        case stristr($url, 'viewtopic.php?id'):
            if (strpos($url, '&p=') !== false) {
                preg_match('~&p=(.*)~', $url, $replace);
                $url = str_replace($replace[0], '', $url);
            }
            $id = filter_var($url, FILTER_SANITIZE_NUMBER_INT);
            $data = array(':id' => $id);
            $ps = $db->select('topics', 'subject, forum_id AS fid', $data, 'id=:id');
            $info = $ps->fetch();
            if (!isset($perms[$panther_user['g_id'] . '_' . $info['fid']])) {
                $perms[$panther_user['g_id'] . '_' . $info['fid']] = $perms['_'];
            }
            if ($perms[$panther_user['g_id'] . '_' . $info['fid']]['read_forum'] == '1' || is_null($perms[$panther_user['g_id'] . '_' . $info['fid']]['read_forum'])) {
                $location = array('href' => panther_link($panther_url['topic'], array($id, url_friendly($info['subject']))), 'name' => $info['subject'], 'lang' => $lang_online['viewing topic']);
            } else {
                $location = $lang_online['in hidden forum'];
            }
            break;
        case stristr($url, 'post.php?action=post'):
            $location = $lang_online['posting'];
            break;
        case stristr($url, 'post.php?fid'):
            $fid = filter_var($url, FILTER_SANITIZE_NUMBER_INT);
            $data = array(':id' => $fid);
            $ps = $db->select('forums', 'forum_name', $data, 'id=:id');
            $forum_name = $ps->fetchColumn();
            if (!isset($perms[$panther_user['g_id'] . '_' . $fid])) {
                $perms[$panther_user['g_id'] . '_' . $fid] = $perms['_'];
            }
            if ($perms[$panther_user['g_id'] . '_' . $fid]['read_forum'] == '1' || is_null($perms[$panther_user['g_id'] . '_' . $fid]['read_forum'])) {
                $location = array('href' => panther_link($panther_url['forum'], array($fid, url_friendly($forum_name))), 'lang' => $forum_name, 'lang' => $lang_online['posting topic']);
            } else {
                $location = $lang_online['in hidden forum'];
            }
            break;
        case stristr($url, 'post.php?tid'):
            $tid = filter_var($url, FILTER_SANITIZE_NUMBER_INT);
            $data = array(':id' => $tid);
            $ps = $db->select('topics', 'subject, forum_id AS fid', $data, 'id=:id');
            $info = $ps->fetch();
            if (!isset($perms[$panther_user['g_id'] . '_' . $info['fid']])) {
                $perms[$panther_user['g_id'] . '_' . $info['fid']] = $perms['_'];
            }
            if ($perms[$panther_user['g_id'] . '_' . $info['fid']]['read_forum'] == '1' || is_null($perms[$panther_user['g_id'] . '_' . $info['fid']]['read_forum'])) {
                $location = array('href' => panther_link($panther_url['topic'], array($tid, url_friendly($info['subject']))), 'name' => $info['subject'], 'lang' => $lang_online['replying to topic']);
            } else {
                $location = $lang_online['in hidden forum'];
            }
            break;
        case stristr($url, 'edit.php?id'):
            $id = filter_var($url, FILTER_SANITIZE_NUMBER_INT);
            $data = array(':id' => $id);
            $ps = $db->run('SELECT t.subject, t.forum_id AS fid FROM ' . $db->prefix . 'posts AS p INNER JOIN ' . $db->prefix . 'topics AS t ON p.topic_id=t.id WHERE p.id=:id', $data);
            $info = $ps->fetch();
            if (!isset($perms[$panther_user['g_id'] . '_' . $info['fid']])) {
                $perms[$panther_user['g_id'] . '_' . $info['fid']] = $perms['_'];
            }
            if ($perms[$panther_user['g_id'] . '_' . $info['fid']]['read_forum'] == '1' || is_null($perms[$panther_user['g_id'] . '_' . $info['fid']]['read_forum'])) {
                $location = array('href' => panther_link($panther_url['post'], array($id)), 'name' => $info['subject'], 'lang' => $lang_online['editing topic']);
            } else {
                $location = $lang_online['in hidden forum'];
            }
            break;
        case stristr($url, 'delete.php?id'):
            $id = filter_var($url, FILTER_SANITIZE_NUMBER_INT);
            $data = array(':id' => $id);
            $ps = $db->run('SELECT t.subject, t.forum_id AS fid FROM ' . $db->prefix . 'posts AS p INNER JOIN ' . $db->prefix . 'topics AS t ON p.topic_id=t.id WHERE p.id=:id', $data);
            $info = $ps->fetch();
            if (!isset($perms[$panther_user['g_id'] . '_' . $info['fid']])) {
                $perms[$panther_user['g_id'] . '_' . $info['fid']] = $perms['_'];
            }
            if ($perms[$panther_user['g_id'] . '_' . $info['fid']]['read_forum'] == '1' || is_null($perms[$panther_user['g_id'] . '_' . $info['fid']]['read_forum'])) {
                $location = array('href' => panther_link($panther_url['post'], array($id)), 'name' => $info['subject'], 'lang' => $lang_online['deleting post']);
            } else {
                $location = $lang_online['in hidden forum'];
            }
            break;
        case stristr($url, 'moderate.php'):
            $location = $lang_online['moderating'];
            break;
        case stristr($url, 'register.php'):
            $location = $lang_online['register'];
            break;
        case stristr($url, 'misc.php?action=leaders'):
            $location = $lang_online['viewing team'];
            break;
        case '-':
            $location = $lang_online['not online'];
            break;
        default:
            $location = $url;
            break;
    }
    return $location;
}
示例#8
0
 * License: http://www.gnu.org/licenses/gpl.html GPL version 3 or higher
 */
if (!defined('PANTHER')) {
    define('PANTHER_ROOT', __DIR__ . '/');
    require PANTHER_ROOT . 'include/common.php';
}
if ($panther_user['g_read_board'] == '0') {
    message($lang_common['No view'], false, '403 Forbidden');
}
// Load the help.php language file
require PANTHER_ROOT . 'lang/' . $panther_user['language'] . '/help.php';
$page_title = array($panther_config['o_board_title'], $lang_help['Help']);
define('PANTHER_ACTIVE_PAGE', 'help');
require PANTHER_ROOT . 'header.php';
// Display the smiley set
require PANTHER_ROOT . 'include/parser.php';
$smiley_groups = array();
foreach ($parser->smilies as $smiley_text => $smiley_img) {
    $smiley_groups[$smiley_img][] = $smiley_text;
}
($hook = get_extensions('help_before_display')) ? eval($hook) : null;
$ps = $db->select('topics', 'subject, id', array(), '', 'id ASC LIMIT 1');
$cur_topic = $ps->fetch();
$ps = $db->select('posts', 'id', array(), '', 'id ASC LIMIT 1');
$cur_post = $ps->fetchColumn();
$ps = $db->select('users', 'id, username, group_id', array(), 'id>1', 'id ASC LIMIT 1');
$user = $ps->fetch();
$forum = $panther_forums[key($panther_forums)];
$tpl = load_template('help.tpl');
echo $tpl->render(array('lang_help' => $lang_help, 'panther_config' => $panther_config, 'lang_common' => $lang_common, 'base_url' => panther_link($panther_url['index']), 'help_page' => panther_link($panther_url['help'], array('url')), 'topic_link' => panther_link($panther_url['topic'], array($cur_topic['id'], url_friendly($cur_topic['subject']))), 'topic_id' => $cur_topic['id'], 'post_id' => $cur_post, 'post_link' => panther_link($panther_url['post'], array($cur_post)), 'forum_id' => $forum['id'], 'forum_link' => panther_link($panther_url['forum'], array($forum['id'], url_friendly($forum['forum_name']))), 'formatted_username' => colourize_group($user['username'], $user['group_id'], $user['id']), 'username' => $user['username'], 'smiley_path' => $panther_config['o_smilies_dir'] != '' ? $panther_config['o_smilies_dir'] : get_base_url() . '/' . $panther_config['o_smilies_path'] . '/', 'smiley_groups' => $smiley_groups));
$db->end_transaction();
示例#9
0
            $type = 'positive';
            break;
        case $cur_announcement['reputation'] < '0':
            $type = 'negative';
            break;
        default:
            $type = 'zero';
            break;
    }
    $cur_announcement['reputation'] = array('type' => $type, 'title' => sprintf($lang_topic['reputation'], forum_number_format($cur_announcement['reputation'])));
}
if ($cur_announcement['g_image'] != '') {
    $image_dir = $panther_config['o_image_group_dir'] != '' ? $panther_config['o_image_group_dir'] : get_base_url() . '/' . $panther_config['o_image_group_path'] . '/';
    $img_size = @getimagesize($panther_config['o_image_group_path'] . '/' . $cur_announcement['group_id'] . '.' . $cur_announcement['g_image']);
    $group_image = array('src' => $image_dir . $cur_announcement['group_id'] . '.' . $cur_announcement['g_image'], 'size' => $img_size[3], 'alt' => $cur_announcement['g_user_title']);
} else {
    $group_image = array();
}
$announcement_type = $afid != '0' ? 'announcement_fid' : 'announcement';
($hook = get_extensions('announcement_before_header')) ? eval($hook) : null;
$page_title = array($panther_config['o_board_title'], $cur_announcement['forum_name'], $cur_announcement['subject']);
define('PANTHER_ACTIVE_PAGE', 'index');
require PANTHER_ROOT . 'header.php';
$render = array('index_link' => panther_link($panther_url['index']), 'lang_common' => $lang_common, 'forum_link' => panther_link($panther_url['forum'], array($cur_announcement['fid'], url_friendly($cur_announcement['forum_name']))), 'announce_link' => panther_link($panther_url[$announcement_type], array($id, $cur_announcement['fid'], url_friendly($cur_announcement['subject']))), 'cur_announcement' => $cur_announcement, 'username' => colourize_group($cur_announcement['username'], $cur_announcement['group_id'], $cur_announcement['user_id']), 'user_title' => get_title($cur_announcement), 'user_avatar' => $user_avatar, 'message' => $parser->parse_message($cur_announcement['message'], 0), 'panther_config' => $panther_config, 'post_actions' => $post_actions, 'user_info' => $user_info, 'user_contacts' => $user_contacts, 'group_image' => $group_image);
if ($cur_announcement['parent']) {
    $render['parent_link'] = panther_link($panther_url['forum'], array($cur_announcement['parent_forum'], url_friendly($cur_announcement['parent'])));
}
$tpl = load_template('announcement.tpl');
echo $tpl->render($render);
($hook = get_extensions('announcement_after_display')) ? eval($hook) : null;
require PANTHER_ROOT . 'footer.php';
示例#10
0
$status_info = array();
if ($panther_user['g_read_board'] == '1' && $panther_user['g_search'] == '1') {
    if (!$panther_user['is_guest']) {
        $status_info[] = array('link' => panther_link($panther_url['search_replies']), 'title' => $lang_common['Show posted topics'], 'display' => $lang_common['Posted topics']);
        $status_info[] = array('link' => panther_link($panther_url['search_new']), 'title' => $lang_common['Show new posts'], 'display' => $lang_common['New posts header']);
    }
    $status_info[] = array('link' => panther_link($panther_url['search_recent']), 'title' => $lang_common['Show active topics'], 'display' => $lang_common['Active topics']);
    $status_info[] = array('link' => panther_link($panther_url['search_unanswered']), 'title' => $lang_common['Show unanswered topics'], 'display' => $lang_common['Unanswered topics']);
}
if (isset($required_fields)) {
    $element = '';
    $tpl_temp = count($required_fields);
    foreach ($required_fields as $elem_orig => $elem_trans) {
        $element .= "\t\t\"" . $elem_orig . '": "' . addslashes(str_replace('&#160;', ' ', $elem_trans));
        if (--$tpl_temp) {
            $element .= "\",\n";
        } else {
            $element .= "\"\n\t};\n";
        }
    }
} else {
    $element = '';
}
ob_start();
($hook = get_extensions('header_before_output')) ? eval($hook) : null;
$style_path = ($panther_config['o_style_path'] != 'style' ? $panther_config['o_style_path'] : PANTHER_ROOT . $panther_config['o_style_path']) . '/' . $panther_user['style'] . '/templates/';
$tpl = defined('PANTHER_ADMIN_CONSOLE') && (file_exists($style_path . 'admin_header.tpl') || $panther_user['style'] == $panther_config['o_default_style'] && !file_exists($style_path)) ? 'admin_header.tpl' : 'header.tpl';
$tpl = load_template($tpl);
echo $tpl->render(array('panther_config' => $panther_config, 'panther_user' => $panther_user, 'username' => colourize_group($panther_user['username'], $panther_user['group_id'], $panther_user['id']), 'last_visit' => format_time($panther_user['last_visit']), 'lang_common' => $lang_common, 'page_title' => generate_page_title($page_title, $p), 'stylesheet' => ($panther_config['o_style_dir'] != '' ? $panther_config['o_style_dir'] : get_base_url() . '/style/') . $panther_user['style'], 'favicon' => $panther_config['o_image_dir'] . $panther_config['o_favicon'], 'page' => basename($_SERVER['PHP_SELF'], '.php'), 'index_url' => panther_link($panther_url['index']), 'links' => $links, 'inbox_link' => panther_link($panther_url['inbox']), 'maintenance_link' => panther_link($panther_url['admin_options_direct'], array('maintenance')), 'status_info' => $status_info, 'reports' => $reports, 'admin_style' => $style_root, 'smiley_path' => $panther_config['o_smilies_dir'] != '' ? $panther_config['o_smilies_dir'] : get_base_url() . '/' . $panther_config['o_smilies_path'] . '/', 'jquery' => defined('JQUERY_REQUIRED') || defined('POSTING') && $panther_config['o_use_editor'] == '1' && $panther_user['use_editor'] == '1' || defined('REPUTATION') ? '1' : '0', 'reputation' => defined('REPUTATION') ? '1' : '0', 'posting' => defined('POSTING') && $panther_config['o_use_editor'] == '1' && $panther_user['use_editor'] == '1' ? '1' : '0', 'admin_index' => defined('ADMIN_INDEX') ? '1' : '0', 'required_fields' => $element, 'focus_element' => isset($focus_element) ? $focus_element : array(), 'page_head' => !empty($page_head) ? $page_head : array(), 'allow_index' => defined('PANTHER_ALLOW_INDEX') ? '1' : '0', 'common' => defined('COMMON_JAVASCRIPT') ? true : false));
($hook = get_extensions('header_after_output')) ? eval($hook) : null;
define('PANTHER_HEADER', 1);
示例#11
0
    $sql .= $where_cond;
    $sql1 .= $where_cond;
}
// Fetch user count
$ps = $db->run($sql, $data);
$num_users = $ps->fetchColumn();
// Determine the user offset (based on $_GET['p'])
$num_pages = ceil($num_users / 50);
$p = !isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages ? 1 : intval($_GET['p']);
$start_from = 50 * ($p - 1);
$data[':start'] = $start_from;
$sql1 .= " ORDER BY " . $sort_by . " " . $sort_dir . ", u.id ASC LIMIT :start, 50";
$page_title = array($panther_config['o_board_title'], $lang_common['User list']);
if ($panther_user['g_search_users'] == '1') {
    $focus_element = array('userlist', 'username');
}
($hook = get_extensions('userlist_before_header')) ? eval($hook) : null;
define('PANTHER_ALLOW_INDEX', 1);
define('PANTHER_ACTIVE_PAGE', 'userlist');
require PANTHER_ROOT . 'header.php';
$users = array();
$ps = $db->run($sql1, $data);
if ($ps->rowCount()) {
    foreach ($ps as $user_data) {
        $users[] = array('avatar' => generate_avatar_markup($user_data['id'], $user_data['email'], $user_data['use_gravatar'], array(32, 32)), 'is_online' => $user_data['is_online'] == $user_data['id'] ? true : false, 'username' => colourize_group($user_data['username'], $user_data['g_id'], $user_data['id']), 'title' => get_title($user_data), 'num_posts' => forum_number_format($user_data['num_posts']), 'registered' => format_time($user_data['registered'], true));
    }
}
$tpl = load_template('userlist.tpl');
echo $tpl->render(array('lang_search' => $lang_search, 'lang_ul' => $lang_ul, 'lang_common' => $lang_common, 'lang_online' => $lang_online, 'panther_groups' => $panther_groups, 'show_post_count' => $show_post_count, 'userlist_link' => panther_link($panther_url['userlist']), 'panther_user' => $panther_user, 'username' => $username, 'show_group' => $show_group, 'sort_by' => $sort_by, 'sort_dir' => $sort_dir, 'pagination' => paginate($num_pages, $p, $panther_url['userlist_result'], array(urlencode($username), $show_group, $sort_by, $sort_dir)), 'users' => $users, 'panther_config' => $panther_config));
($hook = get_extensions('userlist_after_output')) ? eval($hook) : null;
require PANTHER_ROOT . 'footer.php';
示例#12
0
$data = array(':fid' => $box_id, ':uid' => $panther_user['id']);
$ps = $db->run('SELECT COUNT(c.id) FROM ' . $db->prefix . 'conversations AS c INNER JOIN ' . $db->prefix . 'pms_data AS cd ON c.id=cd.topic_id WHERE cd.user_id=:uid AND cd.deleted=0 AND (cd.folder_id=:fid ' . ($box_id == 1 ? 'OR cd.viewed=0)' : ')'), $data);
$messages = $ps->fetchColumn();
$num_pages = ceil($messages / $panther_user['disp_topics']);
$p = !isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages ? 1 : intval($_GET['p']);
$start_from = $panther_user['disp_topics'] * ($p - 1);
$data = array(':uid' => $panther_user['id'], ':fid' => $box_id, ':start' => $start_from);
$ps = $db->run('SELECT c.id, c.subject, c.poster, c.poster_id, c.num_replies, c.last_post, c.last_poster, c.last_post_id, cd.viewed, u.group_id AS poster_gid, u.email, u.use_gravatar, l.id AS last_poster_id, l.group_id AS last_poster_gid FROM ' . $db->prefix . 'conversations AS c INNER JOIN ' . $db->prefix . 'pms_data AS cd ON c.id=cd.topic_id LEFT JOIN ' . $db->prefix . 'users AS u ON u.id=c.poster_id LEFT JOIN ' . $db->prefix . 'users AS l ON l.username=c.last_poster WHERE cd.user_id=:uid AND cd.deleted=0 AND (cd.folder_id=:fid ' . ($box_id == 1 ? 'OR cd.viewed=0)' : ')') . 'ORDER BY c.last_post DESC LIMIT :start, ' . $panther_user['disp_topics'], $data);
define('COMMON_JAVASCRIPT', true);
$page_title = array($panther_config['o_board_title'], $lang_common['PM'], $lang_pm['PM Inbox']);
define('PANTHER_ALLOW_INDEX', 1);
define('PANTHER_ACTIVE_PAGE', 'pm');
require PANTHER_ROOT . 'header.php';
($hook = get_extensions('inbox_before_display')) ? eval($hook) : null;
$topics = array();
foreach ($ps as $cur_topic) {
    $data = array(':tid' => $cur_topic['id']);
    $users = array();
    $ps1 = $db->run('SELECT cd.user_id AS id, u.username, u.group_id FROM ' . $db->prefix . 'pms_data AS cd INNER JOIN ' . $db->prefix . 'users AS u ON cd.user_id=u.id WHERE topic_id=:tid', $data);
    foreach ($ps1 as $user_data) {
        $users[] = colourize_group($user_data['username'], $user_data['group_id'], $user_data['id']);
    }
    if ($panther_config['o_censoring'] == '1') {
        $cur_topic['subject'] = censor_words($cur_topic['subject']);
    }
    $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $panther_user['disp_posts']);
    $topics[] = array('viewed' => $cur_topic['viewed'], 'id' => $cur_topic['id'], 'poster' => colourize_group($cur_topic['poster'], $cur_topic['poster_gid'], $cur_topic['poster_id']), 'users' => $users, 'last_post_avatar' => generate_avatar_markup($cur_topic['last_poster_id'], $cur_topic['email'], $cur_topic['use_gravatar'], array(32, 32)), 'last_post_link' => panther_link($panther_url['pms_post'], array($cur_topic['last_post_id'])), 'last_post' => format_time($cur_topic['last_post']), 'last_poster' => colourize_group($cur_topic['last_poster'], $cur_topic['last_poster_gid'], $cur_topic['last_poster_id']), 'num_replies' => forum_number_format($cur_topic['num_replies']), 'new_post_link' => panther_link($panther_url['pms_new'], array($cur_topic['id'])), 'pagination' => paginate($num_pages_topic, -1, $panther_url['pms_paginate'], array($cur_topic['id'])), 'num_pages' => $num_pages_topic, 'url' => panther_link($panther_url['pms_view'], array($cur_topic['id'])), 'subject' => $cur_topic['subject']);
}
$tpl = load_template('inbox.tpl');
echo $tpl->render(array('lang_common' => $lang_common, 'lang_pm' => $lang_pm, 'index_link' => panther_link($panther_url['index']), 'inbox_link' => panther_link($panther_url['inbox']), 'box_link' => panther_link($panther_url['box'], array($box_id)), 'message_link' => panther_link($panther_url['send_message']), 'box_name' => $box_name, 'pm_menu' => generate_pm_menu($box_id), 'csrf_token' => generate_csrf_token(), 'page' => $p, 'pagination' => paginate($num_pages, $p, $panther_url['box'], array($box_id)), 'box_id' => $box_id, 'topics' => $topics));
require PANTHER_ROOT . 'footer.php';
示例#13
0
    }
    if ($cur_topic['fid'] != '3') {
        if ($cur_post['poster_id'] == $panther_user['id'] || $panther_user['is_admmod']) {
            $post_actions[] = array('class' => 'delete', 'href' => panther_link($panther_url['pms_delete'], array($cur_post['id'])), 'title' => $lang_topic['Delete']);
            if ($panther_user['g_edit_posts'] == '1') {
                $post_actions[] = array('class' => 'edit', 'href' => panther_link($panther_url['pms_edit'], array($cur_post['id'])), 'title' => $lang_topic['Edit']);
            }
            if ($panther_user['g_post_replies'] == '1') {
                $post_actions[] = array('class' => 'quote', 'href' => panther_link($panther_url['pms_quote'], array($tid, $cur_post['id'])), 'title' => $lang_topic['Quote']);
            }
        }
    }
    // Do signature parsing/caching
    if ($panther_config['o_signatures'] == '1' && $cur_post['signature'] != '' && $panther_user['show_sig'] != '0') {
        if (isset($signature_cache[$cur_post['poster_id']])) {
            $signature = $signature_cache[$cur_post['poster_id']];
        } else {
            $signature = $parser->parse_signature($cur_post['signature']);
            $signature_cache[$cur_post['poster_id']] = $signature;
        }
    }
    $posts[] = array('id' => $cur_post['id'], 'link' => panther_link($panther_url['pms_post'], array($cur_post['id'])), 'posted' => format_time($cur_post['posted']), 'username' => colourize_group($cur_post['username'], $cur_post['g_id'], $cur_post['poster_id']), 'user_title' => $user_title, 'number' => $start_from + ++$post_count, 'avatar' => $user_avatar, 'poster_reputation' => $reputation, 'message' => $parser->parse_message($cur_post['message'], $cur_post['hide_smilies']), 'signature' => $signature, 'edited' => $cur_post['edited'] ? format_time($cur_post['edited']) : '', 'edited_by' => $cur_post['edited_by'], 'post_actions' => $post_actions, 'user_info' => $user_info, 'group_image' => $group_image, 'user_contacts' => $user_contacts, 'is_online' => $cur_post['is_online'], 'poster_id' => $cur_post['poster_id']);
}
$render = array('lang_common' => $lang_common, 'lang_topic' => $lang_topic, 'lang_pm' => $lang_pm, 'index_link' => panther_link($panther_url['index']), 'inbox_link' => panther_link($panther_url['inbox']), 'cur_topic' => $cur_topic, 'panther_config' => $panther_config, 'panther_user' => $panther_user, 'reply_link' => panther_link($panther_url['pms_reply'], array($tid)), 'pm_menu' => generate_pm_menu($cur_topic['fid']), 'pagination' => paginate($num_pages, $p, $panther_url['pms_paginate'], array($tid)), 'posts' => $posts, 'quickpost' => $quickpost, 'csrf_token' => generate_csrf_token());
if ($quickpost) {
    $render['quickpost_links'] = array('form_action' => panther_link($panther_url['pms_reply'], array($tid)), 'bbcode' => panther_link($panther_url['help'], array('bbcode')), 'url' => panther_link($panther_url['help'], array('url')), 'img' => panther_link($panther_url['help'], array('img')), 'smilies' => panther_link($panther_url['help'], array('smilies')));
}
$tpl = load_template('pm_topic.tpl');
echo $tpl->render($render);
($hook = get_extensions('pms_topic_after_display')) ? eval($hook) : null;
require PANTHER_ROOT . 'footer.php';
示例#14
0
    }
    foreach ($online['guests'] as $details) {
        if (strpos($details['ident'], '[Bot]') !== false) {
            ++$num_bots;
            $name = explode('[Bot]', $details['ident']);
            if (empty($bots[$name[1]])) {
                $bots[$name[1]] = 1;
            } else {
                ++$bots[$name[1]];
            }
        }
    }
    foreach ($bots as $online_name => $online_id) {
        $bots_online[] = $online_name . ' [Bot]' . ($online_id > 1 ? ' (' . $online_id . ')' : '');
    }
    $num_guests = $num_guests - $num_bots;
} else {
    $num_guests = $num_bots = $num_users = 0;
    $users = $bots_online = array();
}
$groups = array();
foreach ($panther_groups as $g_id => $details) {
    if (!in_array($g_id, array(PANTHER_GUEST, PANTHER_MEMBER)) && $details['g_colour'] !== '') {
        $groups[] = array('link' => panther_link($panther_url['userlist_group'], array($g_id)), 'title' => colourize_group($details['g_title'], $g_id));
    }
}
$tpl = load_template('index.tpl');
echo $tpl->render(array('categories' => $categories, 'forums' => $forums, 'lang_common' => $lang_common, 'lang_index' => $lang_index, 'new_posts' => !empty($new_topics) ? $new_topics : array(), 'panther_user' => $panther_user, 'panther_config' => $panther_config, 'mark_read' => panther_link($panther_url['mark_read'], array(generate_csrf_token('index.php'))), 'num_users' => forum_number_format($num_users), 'num_guests' => forum_number_format($num_guests), 'num_bots' => forum_number_format($num_bots), 'users' => $users, 'bots' => $bots_online, 'groups' => $groups, 'stats' => $stats));
($hook = get_extensions('index_after_display')) ? eval($hook) : null;
$footer_style = 'index';
require PANTHER_ROOT . 'footer.php';
示例#15
0
    $ps = $db->run('SELECT u.id AS uid, u.group_id, up.id AS up_id, up.group_id AS up_group_id, u.use_gravatar, u.email, t.id, t.poster, t.subject, t.question, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM ' . $db->prefix . 'topics AS t LEFT JOIN ' . $db->prefix . 'users AS u ON (t.last_poster=u.username) LEFT JOIN ' . $db->prefix . 'users AS up ON (t.poster=up.username) WHERE t.id IN (' . implode(',', $markers) . ')' . ' ORDER BY t.sticky DESC, t.' . $sort_by . ', t.id DESC', $topic_ids);
    $topic_count = 0;
    foreach ($ps as $cur_topic) {
        $url_subject = url_friendly($cur_topic['subject']);
        // Preg match is slow!
        if ($panther_config['o_censoring'] == '1') {
            $cur_topic['subject'] = censor_words($cur_topic['subject']);
        }
        $ghost_topic = !is_null($cur_topic['moved_to']) ? true : false;
        $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $panther_user['disp_posts']);
        $topics[$cur_topic['id']] = array('count' => ++$topic_count, 'topic_count' => forum_number_format($topic_count + $start_from), 'cur_topic' => $cur_topic, 'topic_poster' => $cur_topic['up_id'] > 1 ? colourize_group($cur_topic['poster'], $cur_topic['up_group_id'], $cur_topic['up_id']) : colourize_group($cur_topic['poster'], PANTHER_GUEST), 'moved_to' => $cur_topic['moved_to'], 'subject' => $cur_topic['subject'], 'sticky' => $cur_topic['sticky'], 'closed' => $cur_topic['closed'], 'topic_link' => panther_link($panther_url['topic'], array($cur_topic['id'], $url_subject)), 'num_pages' => $num_pages_topic, 'pagination' => paginate($num_pages_topic, -1, $panther_url['topic_paginate'], array($cur_topic['id'], $url_subject)), 'new' => !$ghost_topic && $cur_topic['last_post'] > $panther_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_topic['id']]) || $tracked_topics['topics'][$cur_topic['id']] < $cur_topic['last_post']) && (!isset($tracked_topics['forums'][$fid]) || $tracked_topics['forums'][$fid] < $cur_topic['last_post']) ? '1' : '0');
        if (is_null($cur_topic['moved_to'])) {
            $topics[$cur_topic['id']]['last_post_avatar'] = generate_avatar_markup($cur_topic['uid'], $cur_topic['email'], $cur_topic['use_gravatar'], array(32, 32));
            $topics[$cur_topic['id']]['last_post_link'] = panther_link($panther_url['post'], array($cur_topic['last_post_id']));
            $topics[$cur_topic['id']]['last_post'] = format_time($cur_topic['last_post']);
            $topics[$cur_topic['id']]['last_poster'] = $cur_topic['uid'] > 1 ? colourize_group($cur_topic['last_poster'], $cur_topic['group_id'], $cur_topic['uid']) : colourize_group($cur_topic['last_poster'], PANTHER_GUEST);
            $topics[$cur_topic['id']]['num_replies'] = forum_number_format($cur_topic['num_replies']);
            if ($panther_config['o_topic_views'] == '1') {
                $topics[$cur_topic['id']]['num_views'] = forum_number_format($cur_topic['num_views']);
            }
        } else {
            $topics[$cur_topic['id']]['topic_link'] = panther_link($panther_url['topic'], array($cur_topic['moved_to'], $url_subject));
        }
        if ($topics[$cur_topic['id']]['new'] == '1') {
            $topics[$cur_topic['id']]['new_link'] = panther_link($panther_url['topic_new_posts'], array($cur_topic['id'], $url_subject));
        }
    }
}
$tpl = load_template('moderate_forum.tpl');
echo $tpl->render(array('lang_common' => $lang_common, 'lang_misc' => $lang_misc, 'lang_forum' => $lang_forum, 'index_link' => panther_link($panther_url['index']), 'forum_link' => panther_link($panther_url['moderate_forum'], array($fid, url_friendly($cur_forum['forum_name']))), 'pagination' => paginate($num_pages, $p, $panther_url['moderate_forum'], array($fid)), 'forum' => $cur_forum, 'form_action' => panther_link($panther_url['moderate_forum'], array($fid)), 'panther_config' => $panther_config, 'csrf_token' => generate_csrf_token(), 'panther_user' => $panther_user, 'topics' => $topics));
($hook = get_extensions('moderate_forum_after_output')) ? eval($hook) : null;
示例#16
0
 private function do_bbcode($text, $is_signature = false)
 {
     static $user_tags = array();
     if (strpos($text, '[quote') !== false) {
         $text = preg_replace('%\\[quote\\]\\s*%', '</p><div class="quotebox"><blockquote><div><p>', $text);
         $text = preg_replace_callback('%\\[quote=(&quot;|&\\#039;|"|\'|)([^\\r\\n]*?)\\1\\]%s', function ($matches) {
             return '</p><div class="quotebox"><cite>' . str_replace(array('[', '"'), array('&#91;', '"'), $matches[2]) . ' ' . $this->lang_common['wrote'] . '</cite><blockquote><div><p>';
         }, $text);
         $text = preg_replace('%\\s*\\[\\/quote\\]%S', '</p></div></blockquote></div><p>', $text);
     }
     if (strpos($text, '[user]') !== false) {
         for ($i = 0; $i < $this->config['o_user_tags_max']; $i++) {
             preg_match('~\\[user\\](.*?)\\[\\/user\\]~', $text, $match);
             if (isset($match[1])) {
                 // If it's in the array, then we've already replaced this using in an earlier so avoid the database query
                 if (!isset($user_tags[strtolower($match[1])])) {
                     $data = array(':username' => $match[1]);
                     $ps = $this->db->select('users', 'username, id, group_id', $data, 'username=:username');
                     if ($ps->rowCount()) {
                         $cur_user = $ps->fetch();
                         $user_tags[strtolower($cur_user['username'])] = colourize_group($cur_user['username'], $cur_user['group_id'], $cur_user['id']);
                         $text = preg_replace('%\\[user\\]' . $match[1] . '\\s*\\[\\/user\\]%S', $user_tags[strtolower($cur_user['username'])], $text);
                     }
                 } else {
                     $text = preg_replace('%\\[user\\]' . $match[1] . '\\s*\\[\\/user\\]%S', $user_tags[strtolower($match[1])], $text);
                     $i--;
                 }
             }
         }
     }
     if (strpos($text, '[spoiler') !== false) {
         $text = str_replace('[spoiler]', "</p><div class=\"quotebox\" style=\"padding: 0px;\"><div onclick=\"var e,d,c=this.parentNode,a=c.getElementsByTagName('div')[1],b=this.getElementsByTagName('span')[0];if(a.style.display!=''){while(c.parentNode&&(!d||!e||d==e)){e=d;d=(window.getComputedStyle?getComputedStyle(c, null):c.currentStyle)['backgroundColor'];if(d=='transparent'||d=='rgba(0, 0, 0, 0)')d=e;c=c.parentNode;}a.style.display='';a.style.backgroundColor=d;b.innerHTML='&#9650;';}else{a.style.display='none';b.innerHTML='&#9660;';}\" style=\"font-weight: bold; cursor: pointer; font-size: 0.9em;\"><span style=\"padding: 0 5px;\">&#9660;</span>" . $this->lang_common['Spoiler'] . "</div><div style=\"padding: 6px; margin: 0; display: none;\"><p>", $text);
         $text = preg_replace('#\\[spoiler=(.*?)\\]#s', '</p><div class="quotebox" style="padding: 0px;"><div onclick="var e,d,c=this.parentNode,a=c.getElementsByTagName(\'div\')[1],b=this.getElementsByTagName(\'span\')[0];if(a.style.display!=\'\'){while(c.parentNode&&(!d||!e||d==e)){e=d;d=(window.getComputedStyle?getComputedStyle(c, null):c.currentStyle)[\'backgroundColor\'];if(d==\'transparent\'||d==\'rgba(0, 0, 0, 0)\')d=e;c=c.parentNode;}a.style.display=\'\';a.style.backgroundColor=d;b.innerHTML=\'&#9650;\';}else{a.style.display=\'none\';b.innerHTML=\'&#9660;\';}" style="font-weight: bold; cursor: pointer; font-size: 0.9em;"><span style="padding: 0 5px;">&#9660;</span>$1</div><div style="padding: 6px; margin: 0; display: none;"><p>', $text);
         $text = str_replace('[/spoiler]', '</p></div></div><p>', $text);
     }
     if (!$is_signature) {
         $pattern_callback[] = $this->re_list;
         $replace_callback[] = '$this->handle_list_tag($matches[2], $matches[1])';
     }
     $pattern[] = '%\\[b\\](.*?)\\[/b\\]%ms';
     $pattern[] = '%\\[i\\](.*?)\\[/i\\]%ms';
     $pattern[] = '%\\[u\\](.*?)\\[/u\\]%ms';
     $pattern[] = '%\\[s\\](.*?)\\[/s\\]%ms';
     $pattern[] = '%\\[del\\](.*?)\\[/del\\]%ms';
     $pattern[] = '%\\[ins\\](.*?)\\[/ins\\]%ms';
     $pattern[] = '%\\[em\\](.*?)\\[/em\\]%ms';
     $pattern[] = '%\\[colou?r=([a-zA-Z]{3,20}|\\#[0-9a-fA-F]{6}|\\#[0-9a-fA-F]{3})](.*?)\\[/colou?r\\]%ms';
     $pattern[] = '%\\[h\\](.*?)\\[/h\\]%ms';
     $replace[] = '<strong>$1</strong>';
     $replace[] = '<em>$1</em>';
     $replace[] = '<span class="bbu">$1</span>';
     $replace[] = '<span class="bbs">$1</span>';
     $replace[] = '<del>$1</del>';
     $replace[] = '<ins>$1</ins>';
     $replace[] = '<em>$1</em>';
     $replace[] = '<span style="color: $1">$2</span>';
     $replace[] = '</p><h5>$1</h5><p>';
     if ($is_signature && $this->config['p_sig_img_tag'] == '1' || !$is_signature && $this->config['p_message_img_tag'] == '1') {
         $pattern_callback[] = '%\\[img\\]((ht|f)tps?://)([^\\s<"]*?)\\[/img\\]%';
         $pattern_callback[] = '%\\[img=([^\\[]*?)\\]((ht|f)tps?://)([^\\s<"]*?)\\[/img\\]%';
         if ($is_signature) {
             $replace_callback[] = '$this->handle_img_tag($matches[1].$matches[3], true)';
             $replace_callback[] = '$this->handle_img_tag($matches[2].$matches[4], true, $matches[1])';
         } else {
             $replace_callback[] = '$this->handle_img_tag($matches[1].$matches[3], false)';
             $replace_callback[] = '$this->handle_img_tag($matches[2].$matches[4], false, $matches[1])';
         }
     }
     $pattern_callback[] = '%\\[url\\]([^\\[]*?)\\[/url\\]%';
     $pattern_callback[] = '%\\[url=([^\\[]+?)\\](.*?)\\[/url\\]%';
     $pattern[] = '%\\[email\\]([^\\[]*?)\\[/email\\]%';
     $pattern[] = '%\\[email=([^\\[]+?)\\](.*?)\\[/email\\]%';
     $pattern_callback[] = '%\\[topic\\]([1-9]\\d*)\\[/topic\\]%';
     $pattern_callback[] = '%\\[topic=([1-9]\\d*)\\](.*?)\\[/topic\\]%';
     $pattern_callback[] = '%\\[post\\]([1-9]\\d*)\\[/post\\]%';
     $pattern_callback[] = '%\\[post=([1-9]\\d*)\\](.*?)\\[/post\\]%';
     $pattern_callback[] = '%\\[forum\\]([1-9]\\d*)\\[/forum\\]%';
     $pattern_callback[] = '%\\[forum=([1-9]\\d*)\\](.*?)\\[/forum\\]%';
     $pattern_callback[] = '%\\[user\\]([a-zA-Z1-9]\\d*)\\[/user\\]%';
     $replace_callback[] = '$this->handle_url_tag($matches[1])';
     $replace_callback[] = '$this->handle_url_tag($matches[1], $matches[2])';
     $replace[] = '<a href="mailto:$1">$1</a>';
     $replace[] = '<a href="mailto:$1">$2</a>';
     $replace_callback[] = '$this->handle_url_tag(\'' . get_base_url() . '/viewtopic.php?id=\'.$matches[1])';
     $replace_callback[] = '$this->handle_url_tag(\'' . get_base_url() . '/viewtopic.php?id=\'.$matches[1], $matches[2])';
     $replace_callback[] = '$this->handle_url_tag(\'' . get_base_url() . '/viewtopic.php?pid=\'.$matches[1].\'#p\'.$matches[1])';
     $replace_callback[] = '$this->handle_url_tag(\'' . get_base_url() . '/viewtopic.php?pid=\'.$matches[1].\'#p\'.$matches[1], $matches[2])';
     $replace_callback[] = '$this->handle_url_tag(\'' . get_base_url() . '/viewforum.php?id=\'.$matches[1])';
     $replace_callback[] = '$this->handle_url_tag(\'' . get_base_url() . '/viewforum.php?id=\'.$matches[1], $matches[2])';
     $parser = $this;
     // Support for PHP 5.3
     // This thing takes a while! :)
     $text = preg_replace($pattern, $replace, $text);
     $count = count($pattern_callback);
     for ($i = 0; $i < $count; $i++) {
         $text = preg_replace_callback($pattern_callback[$i], function ($matches) use($parser, $i, $replace_callback) {
             return eval('return ' . $replace_callback[$i] . ';');
         }, $text);
     }
     return $text;
 }
示例#17
0
        }
        $tid = filter_var($user_online['currently'], FILTER_SANITIZE_NUMBER_INT);
        if (strpos($user_online['currently'], '?pid') !== false) {
            if (in_array($tid, $post_ids)) {
                if ($user_online['user_id'] == 1) {
                    $guests_in_topic[] = $user_online['ident'];
                } else {
                    $users[] = colourize_group($user_online['ident'], $user_online['group_id'], $user_online['user_id']);
                }
            }
        } elseif (strpos($user_online['currently'], '?id') !== false) {
            if ($tid == $id) {
                if ($user_online['user_id'] == 1) {
                    $guests_in_topic[] = $user_online['ident'];
                } else {
                    $users[] = colourize_group($user_online['ident'], $user_online['group_id'], $user_online['user_id']);
                }
            }
        }
    }
    $render['guests'] = count($guests_in_topic);
    $render['users'] = count($users) > 0 ? implode(', ', $users) : $lang_online['no users'];
    $render['lang_online'] = $lang_online;
}
// Display quick post if enabled
if ($quickpost) {
    $render['quickpost_links'] = array('form_action' => panther_link($panther_url['new_reply'], array($id)), 'csrf_token' => generate_csrf_token('post.php'), 'bbcode' => panther_link($panther_url['help'], array('bbcode')), 'url' => panther_link($panther_url['help'], array('url')), 'img' => panther_link($panther_url['help'], array('img')), 'smilies' => panther_link($panther_url['help'], array('smilies')));
}
// Increment "num_views" for topic
if ($panther_config['o_topic_views'] == '1') {
    $db->run('UPDATE ' . $db->prefix . 'topics SET num_views=num_views+1 WHERE id=:id', array($id));
示例#18
0
$increase = isset($_POST['auto_increase']) && $_POST['auto_increase'] == '1' ? $start + $limit : $start;
$direction = isset($_POST['direction']) && $_POST['direction'] == '1' ? 'ASC' : 'DESC';
$order = isset($_POST['order']) ? intval($_POST['order']) : 0;
switch ($order) {
    case 1:
        $order = 'a.downloads';
        break;
    case 2:
        $order = 'a.size';
        break;
    case 3:
        $order = 'a.downloads*a.size';
        break;
    case 0:
    default:
        $order = 'a.id';
        break;
}
$data = array(':start' => $start, ':limit' => $limit);
$ps = $db->run('SELECT a.id, a.owner, a.post_id, a.filename, a.extension, a.size, a.downloads, u.username, u.group_id FROM ' . $db->prefix . 'attachments AS a LEFT JOIN ' . $db->prefix . 'users AS u ON u.id=a.owner ORDER BY ' . $order . ' ' . $direction . ' LIMIT :start, :limit', $data);
$page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Attachments']);
define('PANTHER_ACTIVE_PAGE', 'admin');
require PANTHER_ROOT . 'header.php';
generate_admin_menu('attachments');
$attachments = array();
foreach ($ps as $cur_item) {
    $attachments[] = array('icon' => attach_icon($cur_item['extension']), 'link' => panther_link($panther_url['attachment'], array($cur_item['id'])), 'name' => $cur_item['filename'], 'username' => colourize_group($cur_item['username'], $cur_item['group_id'], $cur_item['owner']), 'post_link' => panther_link($panther_url['post'], array($cur_item['post_id'])), 'post_id' => $cur_item['post_id'], 'size' => file_size($cur_item['size']), 'downloads' => forum_number_format($cur_item['downloads']), 'transfer' => file_size($cur_item['size'] * $cur_item['downloads']), 'id' => $cur_item['id']);
}
$tpl = load_template('admin_attachments.tpl');
echo $tpl->render(array('lang_admin_attachments' => $lang_admin_attachments, 'lang_admin_common' => $lang_admin_common, 'form_action' => panther_link($panther_url['admin_attachments']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/attachments.php'), 'increase' => $increase, 'start' => $start, 'limit' => $limit, 'order' => $order, 'direction' => $direction, 'attachments' => $attachments));
require PANTHER_ROOT . 'footer.php';
示例#19
0
        $results = array();
        foreach ($search_set as $cur_search) {
            if ($panther_config['o_censoring'] == '1') {
                $cur_search['subject'] = censor_words($cur_search['subject']);
            }
            if ($show_as == 'posts') {
                ++$post_count;
                if ($panther_config['o_censoring'] == '1') {
                    $cur_search['message'] = censor_words($cur_search['message']);
                }
                $results[] = array('pid' => $cur_search, 'message' => $parser->parse_message($cur_search['message'], $cur_search['hide_smilies']), 'posted' => format_time($cur_search['pposted']), 'topic_url' => panther_link($panther_url['topic'], array($cur_search['tid'], url_friendly($cur_search['subject']))), 'post_url' => panther_link($panther_url['post'], array($cur_search['pid'])), 'post_no' => $start_from + $post_count, 'post_count' => $post_count, 'forum' => array('url' => panther_link($panther_url['forum'], array($cur_search['forum_id'], url_friendly($cur_search['forum_name']))), 'name' => $cur_search['forum_name']), 'subject' => $cur_search['subject'], 'poster' => $cur_search['poster_id'] > 1 ? colourize_group($cur_search['pposter'], $cur_search['group_id'], $cur_search['poster_id']) : '', 'post_id' => $cur_search['pid'], 'first_post_id' => $cur_search['first_post_id'], 'num_replies' => forum_number_format($cur_search['num_replies']), 'viewed' => !$panther_user['is_guest'] && $cur_search['last_post'] > $panther_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post']) ? false : true);
            } else {
                ++$topic_count;
                $url_subject = url_friendly($cur_search['subject']);
                $num_pages_topic = ceil(($cur_search['num_replies'] + 1) / $panther_user['disp_posts']);
                $results[$cur_search['tid']] = array('count' => ++$topic_count, 'topic_count' => forum_number_format($topic_count + $start_from), 'cur_search' => $cur_search, 'topic_poster' => $cur_search['up_id'] > 1 ? colourize_group($cur_search['poster'], $cur_search['up_group_id'], $cur_search['up_id']) : colourize_group($cur_search['poster'], PANTHER_GUEST), 'subject' => $cur_search['subject'], 'sticky' => $cur_search['sticky'], 'closed' => $cur_search['closed'], 'question' => $cur_search['question'], 'topic_link' => panther_link($panther_url['topic'], array($cur_search['tid'], $url_subject)), 'num_pages' => $num_pages_topic, 'pagination' => paginate($num_pages_topic, -1, $panther_url['topic_paginate'], array($cur_search['tid'], $url_subject)), 'new' => !$panther_user['is_guest'] && $cur_search['last_post'] > $panther_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post']) ? '1' : '0', 'last_post_avatar' => generate_avatar_markup($cur_search['uid'], $cur_search['email'], $cur_search['use_gravatar'], array(32, 32)), 'last_post_link' => panther_link($panther_url['post'], array($cur_search['last_post_id'])), 'last_post' => format_time($cur_search['last_post']), 'last_poster' => $cur_search['uid'] > 1 ? colourize_group($cur_search['last_poster'], $cur_search['group_id'], $cur_search['uid']) : colourize_group($cur_search['last_poster'], PANTHER_GUEST), 'num_replies' => forum_number_format($cur_search['num_replies']), 'forum' => array('url' => panther_link($panther_url['forum'], array($cur_search['forum_id'], url_friendly($cur_search['forum_name']))), 'name' => $cur_search['forum_name']));
                if ($results[$cur_search['tid']]['new'] == '1') {
                    $results[$cur_search['tid']]['new_link'] = panther_link($panther_url['topic_new_posts'], array($cur_search['tid'], $url_subject));
                }
            }
        }
        $tpl = load_template('search_results.tpl');
        echo $tpl->render(array('forum_actions' => $forum_actions, 'index_link' => panther_link($panther_url['index']), 'lang_common' => $lang_common, 'search_link' => panther_link($panther_url['search']), 'show_as' => $show_as, 'lang_search' => $lang_search, 'lang_topic' => $lang_topic, 'lang_forum' => $lang_forum, 'pagination' => paginate($num_pages, $p, $panther_url['search_pagination'], array($search_id)), 'crumbs_text' => $crumbs_text, 'results' => $results, 'panther_config' => $panther_config));
        require PANTHER_ROOT . 'footer.php';
    } else {
        message($lang_search['No hits']);
    }
}
($hook = get_extensions('search_form_before_header')) ? eval($hook) : null;
$page_title = array($panther_config['o_board_title'], $lang_search['Search']);
$focus_element = array('search', 'keywords');
示例#20
0
                         $moderators = array();
                         $ps = $db->run('SELECT u.id AS id, u.username, u.group_id, o.currently FROM ' . $db->prefix . 'users AS u INNER JOIN ' . $db->prefix . 'groups AS g ON u.group_id=g.g_id LEFT JOIN ' . $db->prefix . 'online AS o ON o.user_id=u.id WHERE g.g_moderator=1 AND g.g_global_moderator=0 AND g.g_admin=0');
                         foreach ($ps as $user_data) {
                             $total = 0;
                             $forums = array();
                             foreach ($panther_forums as $cur_forum) {
                                 $forum_moderators = $cur_forum['moderators'] != '' ? unserialize($cur_forum['moderators']) : array();
                                 if (!isset($perms[$panther_user['g_id'] . '_' . $cur_forum['id']])) {
                                     $perms[$panther_user['g_id'] . '_' . $cur_forum['id']] = $perms['_'];
                                 }
                                 if (in_array($user_data['id'], $forum_moderators) && ($perms[$panther_user['g_id'] . '_' . $cur_forum['id']]['read_forum'] == '1' || is_null($perms[$panther_user['g_id'] . '_' . $cur_forum['id']]['read_forum']))) {
                                     $forums[] = array('forum_id' => $cur_forum['id'], 'forum_name' => $cur_forum['forum_name']);
                                     ++$total;
                                 }
                             }
                             $moderators[$user_data['id']] = array('username' => colourize_group($user_data['username'], $user_data['group_id'], $user_data['id']), 'total' => $total, 'forums' => $forums);
                             if ($panther_config['o_users_online'] == '1') {
                                 $moderators[$user_data['id']]['location'] = generate_user_location($user_data['currently'], $lang_online, $user_data['username']);
                             }
                         }
                         $tpl = load_template('leaders.tpl');
                         echo $tpl->render(array('lang_online' => $lang_online, 'lang_common' => $lang_common, 'global_moderators' => $global_moderators, 'administrators' => $administrators, 'moderators' => $moderators, 'action' => panther_link($panther_url['forum_noid']), 'panther_config' => $panther_config, 'location' => panther_link($panther_url['forum'], array("'+this.options[this.selectedIndex].value)+'", 'forum-name'))));
                         require PANTHER_ROOT . 'footer.php';
                     } else {
                         message($lang_common['Bad request'], false, '404 Not Found');
                     }
                 }
             }
         }
     }
 }