$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';
$ps = $db->select('topics', 'num_replies', $topic_data, 'id=:id'); $num_replies = $ps->fetchColumn(); $update = array('num_replies' => $num_replies + 1, 'last_post' => $posted, 'last_post_id' => $last_id, 'last_poster' => $poster); $db->update('topics', $update, 'id=:id', $topic_data); update_search_index('post', $post_id, $post['message']); update_forum($post['forum_id']); redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Post approved redirect']); } } else { if ($is_topic_post) { permanently_delete_topic($post['topic_id']); redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Topic deleted redirect']); } else { permanently_delete_post($post_id); redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Post deleted redirect']); } } } $ps = $db->run('SELECT t.id AS topic_id, t.forum_id, p.poster, p.poster_id, p.posted, p.message, p.id AS pid, p.hide_smilies, t.subject, f.forum_name FROM ' . $db->prefix . 'posts AS p LEFT JOIN ' . $db->prefix . 'topics AS t ON p.topic_id=t.id LEFT JOIN ' . $db->prefix . 'forums AS f ON t.forum_id=f.id WHERE p.deleted=1 OR t.deleted=1 ORDER BY p.posted DESC'); require PANTHER_ROOT . 'include/parser.php'; $page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Deleted']); define('PANTHER_ACTIVE_PAGE', 'admin'); require PANTHER_ROOT . 'header.php'; generate_admin_menu('deleted'); $posts = array(); foreach ($ps as $cur_post) { $posts[] = array('id' => $cur_post['pid'], 'posted' => format_time($cur_post['posted']), 'message' => $parser->parse_message($cur_post['message'], $cur_post['hide_smilies']), 'poster' => $cur_post['poster'] != '' ? array('href' => panther_link($panther_url['profile'], array($cur_post['poster_id'], url_friendly($cur_post['poster']))), 'poster' => $cur_post['poster']) : '', 'forum' => $cur_post['forum_name'] != '' ? array('href' => panther_link($panther_url['forum'], array($cur_post['forum_id'], url_friendly($cur_post['forum_name']))), 'forum_name' => $cur_post['forum_name']) : '', 'topic' => $cur_post['subject'] != '' ? array('href' => panther_link($panther_url['topic'], array($cur_post['topic_id'], url_friendly($cur_post['subject']))), 'subject' => $cur_post['subject']) : '', 'post' => $cur_post['pid'] != '' ? array('href' => panther_link($panther_url['post'], array($cur_post['pid'])), 'post' => sprintf($lang_admin_deleted['Post ID'], $cur_post['pid'])) : ''); } $tpl = load_template('admin_deleted.tpl'); echo $tpl->render(array('lang_admin_common' => $lang_admin_common, 'lang_admin_deleted' => $lang_admin_deleted, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['admin_deleted']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/deleted.php'), 'posts' => $posts)); require PANTHER_ROOT . 'footer.php';
} $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'); define('PANTHER_ACTIVE_PAGE', 'search'); require PANTHER_ROOT . 'header.php'; $data = array(':gid' => $panther_user['g_id']); $categories = $forums = array(); $ps = $db->run('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.password, f.redirect_url, f.parent_forum FROM ' . $db->prefix . 'categories AS c INNER JOIN ' . $db->prefix . 'forums AS f ON c.id=f.cat_id LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=:gid) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position', $data); foreach ($ps as $cur_forum) { if ($cur_forum['password'] != '') { if (check_forum_login_cookie($cur_forum['fid'], $cur_forum['password'], true) === false) { continue; } } if (!isset($catgeories[$cur_forum['cid']])) { // A new category since last iteration? $categories[$cur_forum['cid']] = array('name' => $cur_forum['cat_name'], 'id' => $cur_forum['cid']); } $forums[] = array('parent_forum' => $cur_forum['parent_forum'], 'category_id' => $cur_forum['cid'], 'id' => $cur_forum['fid'], 'name' => $cur_forum['forum_name']); } $tpl = load_template('search.tpl'); echo $tpl->render(array('lang_search' => $lang_search, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['search']), 'panther_config' => $panther_config, 'panther_user' => $panther_user, 'search_all_forums' => $panther_config['o_search_all_forums'] == '1' || $panther_user['is_admmod'] ? true : false, 'categories' => $categories, 'forums' => $forums)); require PANTHER_ROOT . 'footer.php';
$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; require PANTHER_ROOT . 'footer.php';
foreach ($ps as $attachment) { $attachments[] = array('id' => $attachment['id'], 'icon' => attach_icon($attachment['extension']), 'link' => panther_link($panther_url['attachment'], array($attachment['id'])), 'name' => $attachment['filename'], 'size' => sprintf($lang_post['Attachment size'], file_size($attachment['size'])), 'downloads' => sprintf($lang_post['Attachment downloads'], forum_number_format($attachment['downloads']))); } } ($hook = get_extensions('edit_before_header')) ? eval($hook) : null; $page_title = array($panther_config['o_board_title'], $lang_post['Edit post']); $required_fields = array('req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']); $focus_element = array('edit', 'req_message'); define('PANTHER_ACTIVE_PAGE', 'index'); require PANTHER_ROOT . 'header.php'; $checkboxes = array(); if ($can_edit_subject && $is_admmod) { $checkboxes[] = array('name' => 'stick_topic', 'title' => $lang_common['Stick topic'], 'checked' => isset($_POST['form_sent']) && isset($_POST['stick_topic']) || !isset($_POST['form_sent']) && $cur_post['sticky'] == '1' ? true : false); } if ($can_edit_subject && $cur_post['post_polls'] != '0' && $panther_user['g_post_polls'] == '1' && $panther_config['o_polls'] == '1') { $checkboxes[] = array('name' => 'add_poll', 'title' => $lang_post['Add poll'], 'checked' => isset($_POST['add_poll']) ? true : false); } if ($panther_config['o_smilies'] == '1') { $checkboxes[] = array('name' => 'hide_smilies', 'title' => $lang_post['Hide smilies'], 'checked' => isset($_POST['form_sent']) && isset($_POST['hide_smilies']) || !isset($_POST['form_sent']) && $cur_post['hide_smilies'] == '1' ? true : false); } if ($is_admmod) { $checkboxes[] = array('id' => 'silent_edit', 'name' => 'silent', 'title' => $lang_post['Silent edit'], 'checked' => isset($_POST['form_sent']) && isset($_POST['silent']) || !isset($_POST['form_sent']) ? true : false); } $render = array('errors' => $errors, 'lang_post' => $lang_post, 'lang_common' => $lang_common, 'preview' => isset($_POST['preview']) ? true : false, 'can_edit_subject' => $can_edit_subject, 'subject' => isset($_POST['req_subject']) ? $_POST['req_subject'] : $cur_post['subject'], 'can_upload' => $can_upload, 'can_delete' => $can_delete, 'panther_user' => $panther_user, 'max_size' => $max_size, 'attachments' => $attachments, 'is_admmod' => $is_admmod, 'edit_reason' => isset($_POST['edit_reason']) ? $_POST['edit_reason'] : $cur_post['edit_reason'], 'checkboxes' => $checkboxes, 'index_link' => panther_link($panther_url['index']), 'forum_link' => panther_link($panther_url['forum'], array($cur_post['fid'], url_friendly($cur_post['forum_name']))), 'cur_post' => $cur_post, 'topic_link' => panther_link($panther_url['topic'], array($cur_post['tid'], url_friendly($cur_post['subject']))), 'form_action' => panther_link($panther_url['edit_edit'], array($id)), 'csrf_token' => generate_csrf_token(), 'message' => isset($_POST['req_message']) ? $message : $cur_post['message'], 'panther_config' => $panther_config, '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')))); if (isset($_POST['preview'])) { require_once PANTHER_ROOT . 'include/parser.php'; $render['preview'] = $parser->parse_message($message, $hide_smilies); } $tpl = load_template('edit.tpl'); echo $tpl->render($render); require PANTHER_ROOT . 'footer.php';
define('PANTHER_ACTIVE_PAGE', 'admin'); require PANTHER_ROOT . 'header.php'; generate_admin_menu('extensions'); $tpl = load_template('uninstall_extension.tpl'); echo $tpl->render(array('extension' => $extension, 'lang_admin_extensions' => $lang_admin_extensions, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['uninstall_extension'], array($file)), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/addons.php'))); } else { $extension_files = array(); $files = array_diff(scandir(PANTHER_ROOT . PANTHER_ADMIN_DIR . '/extensions'), array('.', '..')); foreach ($files as $entry) { if (substr($entry, -4) == '.xml') { $extension_files[$entry] = array('title' => substr($entry, 0, -4), 'file' => $entry, 'install_link' => panther_link($panther_url['install_extension'], array(substr($entry, 0, -4)))); } } $extensions = array(); $ps = $db->select('extensions', 'id, title, enabled'); foreach ($ps as $cur_extension) { if (file_exists(PANTHER_ROOT . PANTHER_ADMIN_DIR . '/extensions/' . $cur_extension['id'] . '.xml')) { unset($extension_files[$cur_extension['id'] . '.xml']); } $extensions[] = array('id' => $cur_extension['id'], 'title' => $cur_extension['title'], 'enabled' => $cur_extension['enabled'], 'enable_link' => $cur_extension['enabled'] ? panther_link($panther_url['disable_extension'], array($cur_extension['id'])) : panther_link($panther_url['enable_extension'], array($cur_extension['id'])), 'uninstall_link' => panther_link($panther_url['uninstall_extension'], array($cur_extension['id']))); } $page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Extensions']); define('PANTHER_ACTIVE_PAGE', 'admin'); require PANTHER_ROOT . 'header.php'; generate_admin_menu('extensions'); $tpl = load_template('admin_extensions.tpl'); echo $tpl->render(array('lang_admin_common' => $lang_admin_common, 'lang_admin_extensions' => $lang_admin_extensions, 'form_action' => panther_link($panther_url['admin_addons']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/addons.php'), 'extensions' => $extensions, 'extension_files' => $extension_files, 'errors' => $errors)); } } } require PANTHER_ROOT . 'footer.php';
$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; } if ($can_upload) { $render['max_size'] = $max_size; } if (!empty($panther_robots) && $panther_user['g_robot_test'] == '1') {
} require PANTHER_ROOT . 'include/common_admin.php'; if (!$panther_user['is_admin']) { message($lang_common['No permission'], false, '403 Forbidden'); } if ($panther_user['id'] != '2') { if (!is_null($admins[$panther_user['id']]['admin_updates'])) { if ($admins[$panther_user['id']]['admin_updates'] == '0') { message($lang_common['No permission'], false, '403 Forbidden'); } } } check_authentication(); // Load the admin_update.php language file require PANTHER_ROOT . 'lang/' . $admin_language . '/admin_update.php'; if (version_compare($panther_config['o_cur_version'], $updater->panther_updates['version'], '>=')) { message($lang_admin_update['no updates']); } $action = isset($_GET['action']) ? $_GET['action'] : ''; if ($action == 'install_update') { $updater->download(); $updater->install(); exit; } $page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Update']); define('PANTHER_ACTIVE_PAGE', 'admin'); require PANTHER_ROOT . 'header.php'; generate_admin_menu('updates'); $tpl = load_template('admin_updates.tpl'); echo $tpl->render(array('lang_admin_update' => $lang_admin_update, 'panther_updates' => $updater->panther_updates, 'released' => format_time($updater->panther_updates['released']), 'updater' => $updater, 'changelog' => $updater->panther_updates['changelog'], 'form_action' => panther_link($panther_url['admin_updates']), 'panther_config' => $panther_config)); require PANTHER_ROOT . 'footer.php';
break; case 'viewforum': if ($panther_config['o_feed_type'] == '1') { $feed = array('type' => 'rss', 'link' => panther_link($panther_url['forum_rss'], array($id)), 'lang' => $lang_common['RSS forum feed']); } else { if ($panther_config['o_feed_type'] == '2') { $feed = array('type' => 'atom', 'link' => panther_link($panther_url['forum_atom'], array($id)), 'lang' => $lang_common['Atom forum feed']); } } break; case 'viewtopic': if ($panther_config['o_feed_type'] == '1') { $feed = array('type' => 'rss', 'link' => panther_link($panther_url['topic_rss'], array($id)), 'lang' => $lang_common['RSS topic feed']); } else { if ($panther_config['o_feed_type'] == '2') { $feed = array('type' => 'atom', 'link' => panther_link($panther_url['topic_atom'], array($id)), 'lang' => $lang_common['Atom topic feed']); } } break; } ($hook = get_extensions('footer_feedsr')) ? eval($hook) : null; } // Display debug info (if enabled/defined) if ($panther_config['o_debug_mode'] == '1') { // Calculate script generation time $time_diff = sprintf('%.3f', microtime(true) - $panther_start); $debug_info = sprintf($lang_common['Querytime'], $time_diff, $db->get_num_queries()); if (function_exists('memory_get_usage')) { $debug_info .= ' - ' . sprintf($lang_common['Memory usage'], file_size(memory_get_usage())); if (function_exists('memory_get_peak_usage')) { $debug_info .= ' ' . sprintf($lang_common['Peak usage'], file_size(memory_get_peak_usage()));
} generate_robots_cache(); redirect(panther_link($panther_url['admin_robots']), $lang_admin_robots['Question updated redirect']); } else { if (isset($_POST['remove'])) { confirm_referrer(PANTHER_ADMIN_DIR . '/robots.php'); $id = intval(key($_POST['remove'])); $data = array(':id' => $id); $db->delete('robots', 'id=:id', $data); // Regenerate the robots cache if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) { require PANTHER_ROOT . 'include/cache.php'; } generate_robots_cache(); redirect(panther_link($panther_url['admin_robots']), $lang_admin_robots['Question removed redirect']); } } } $page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Robots']); $focus_element = array('robots', 'new_question'); define('PANTHER_ACTIVE_PAGE', 'admin'); require PANTHER_ROOT . 'header.php'; generate_admin_menu('robots'); $robots = array(); $ps = $db->select('robots', 'id, question, answer', array(), '', 'id'); foreach ($ps as $cur_test) { $robots[] = array('id' => $cur_test['id'], 'question' => $cur_test['question'], 'answer' => $cur_test['answer']); } $tpl = load_template('admin_robots.tpl'); echo $tpl->render(array('lang_admin_robots' => $lang_admin_robots, 'lang_admin_common' => $lang_admin_common, 'form_action' => panther_link($panther_url['admin_robots']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/robots.php'), 'robots' => $robots)); require PANTHER_ROOT . 'footer.php';
foreach ($tasks as $cur_file) { $options[] = array('option' => substr($cur_file, 0, -4), 'title' => ucwords(str_replace('_', ' ', substr($cur_file, 0, -4)))); } $tpl = load_template('edit_task.tpl'); echo $tpl->render(array('lang_admin_tasks' => $lang_admin_tasks, 'cur_task' => $cur_task, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['admin_tasks']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/tasks.php'), 'id' => $id, 'tasks' => $options)); } else { if (isset($_GET['delete'])) { $id = intval($_GET['delete']); $data = array(':id' => $id); $ps = $db->select('tasks', 1, $data, 'id=:id'); if (!$ps->rowCount()) { message($lang_common['Bad request']); } $tpl = load_template('delete_task.tpl'); echo $tpl->render(array('lang_admin_tasks' => $lang_admin_tasks, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['admin_tasks']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/tasks.php'), 'id' => $id)); } else { $configured_tasks = array(); $ps = $db->select('tasks', 'id, title, minute, hour, day, month, week_day, script, next_run', array(), '', 'id'); foreach ($ps as $cur_task) { $configured_tasks[] = array('minute' => $cur_task['minute'], 'hour' => $cur_task['hour'], 'day' => $cur_task['day'], 'month' => $cur_task['month'], 'week_day' => $cur_task['week_day'], 'delete_link' => panther_link($panther_url['delete_task'], array($cur_task['id'])), 'edit_link' => panther_link($panther_url['edit_task'], array($cur_task['id'])), 'next_run' => format_time($cur_task['next_run']), 'title' => $cur_task['title']); } $options = array(); $tasks = array_diff(scandir(PANTHER_ROOT . 'include/tasks'), array('.', '..')); foreach ($tasks as $cur_task) { $options[] = array('title' => ucwords(str_replace('_', ' ', substr($cur_task, 0, -4))), 'file' => substr($cur_task, 0, -4)); } $tpl = load_template('admin_tasks.tpl'); echo $tpl->render(array('lang_admin_tasks' => $lang_admin_tasks, 'lang_admin_common' => $lang_admin_common, 'form_action' => panther_link($panther_url['admin_tasks']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/tasks.php'), 'configured_tasks' => $configured_tasks, 'tasks' => $options)); } } require PANTHER_ROOT . 'footer.php';
// Check for the existence of various PHP opcode caches/optimizers if (function_exists('mmcache')) { $php_accelerator = '<a href="http://' . $lang_admin_index['Turck MMCache link'] . '">' . $lang_admin_index['Turck MMCache'] . '</a>'; } else { if (isset($_PHPA)) { $php_accelerator = '<a href="http://' . $lang_admin_index['ionCube PHP Accelerator link'] . '">' . $lang_admin_index['ionCube PHP Accelerator'] . '</a>'; } else { if (ini_get('apc.enabled')) { $php_accelerator = '<a href="http://' . $lang_admin_index['Alternative PHP Cache (APC) link'] . '">' . $lang_admin_index['Alternative PHP Cache (APC)'] . '</a>'; } else { if (ini_get('zend_optimizer.optimization_level')) { $php_accelerator = '<a href="http://' . $lang_admin_index['Zend Optimizer link'] . '">' . $lang_admin_index['Zend Optimizer'] . '</a>'; } else { if (ini_get('eaccelerator.enable')) { $php_accelerator = '<a href="http://' . $lang_admin_index['eAccelerator link'] . '">' . $lang_admin_index['eAccelerator'] . '</a>'; } else { if (ini_get('xcache.cacher')) { $php_accelerator = '<a href="http://' . $lang_admin_index['XCache link'] . '">' . $lang_admin_index['XCache'] . '</a>'; } else { $php_accelerator = $lang_admin_index['NA']; } } } } } } $render = array('PHP_OS' => PHP_OS, 'php_version' => phpversion(), 'phpinfo' => panther_link($panther_url['phpinfo']), 'php_accelerator' => $php_accelerator, 'db_version' => $db->get_version(), 'total_records' => forum_number_format($total_records), 'total_size' => $total_size); } $tpl = load_template('admin_statistics.tpl'); echo $tpl->render(array_merge(array('lang_admin_index' => $lang_admin_index, 'server_load' => $server_load, 'num_online' => $num_online, 'panther_user' => $panther_user), $render)); require PANTHER_ROOT . 'footer.php';
$abuse['positive'][$rep['poster_id']] = '1'; } } else { if (array_key_exists($rep['poster_id'], $abuse['negative'])) { ++$abuse['negative'][$rep['poster_id']]; } else { $abuse['negative'][$rep['poster_id']] = '1'; } } } $positive = !empty($abuse['positive']) ? array_search(max(array_values($abuse['positive'])), $abuse['positive']) : '0'; $negative = !empty($abuse['negative']) ? array_search(max(array_values($abuse['negative'])), $abuse['negative']) : '0'; $rep_abuse = $positive < $negative ? array('user' => $negative, 'votes' => $abuse['negative'][$negative], 'type' => 'negative') : array('user' => $positive, 'votes' => $abuse['positive'][$positive], 'type' => 'positive'); if ($rep_abuse['votes'] >= $panther_config['o_rep_abuse'] && $panther_config['o_mailing_list'] != '') { require PANTHER_ROOT . 'include/email.php'; $info = array('message' => array('<abuser>' => $panther_user['username'], '<amount>' => $panther_config['o_rep_abuse'], '<type>' => $rep_abuse['type'], '<user>' => $cur_forum['poster'], '<profile_url>' => panther_link($panther_url['profile_rep_received'], array($rep_abuse['user'])))); $mail_tpl = $mailer->parse(PANTHER_ROOT . 'lang/' . $panther_user['language'] . '/mail_templates/rep_abuse.tpl', $info); $mailer->send($panther_config['o_mailing_list'], $mail_tpl['subject'], $mail_tpl['message']); } } } ($hook = get_extensions('reputation_after_rep_abuse')) ? eval($hook) : null; // Has the user issue issued the opposite vote? If so, remove it first ... $opposite_rep = false; $data = array(':uid' => $panther_user['id'], ':id' => $id); $ps = $db->select('reputation', 1, $data, 'given_by=:uid AND post_id=:id'); if ($ps->rowCount()) { $opposite_rep = true; $vote_add = $vote == '-1' ? '-1' : '+1'; $data = array(':uid' => $panther_user['id'], ':id' => $id); $db->delete('reputation', 'given_by=:uid AND post_id=:id', $data);
if (!$ps->rowCount()) { $alerts[] = sprintf($lang_admin_index['No restrictions'], panther_link($panther_url['admin_restrictions'])); break; } } $update_downloaded = file_exists(PANTHER_ROOT . 'include/updates/panther-update-patch-' . $updater->version_friendly($updater->panther_updates['version']) . '.zip') ? true : false; if (version_compare($panther_config['o_cur_version'], $updater->panther_updates['version'], '<') && !$update_downloaded) { $alerts[] = sprintf($lang_admin_index['New version'], $updater->panther_updates['version'], panther_link($panther_url['admin_updates'])); } if ($update_downloaded) { $alerts[] = sprintf($lang_admin_index['update downloaded'], $updater->panther_updates['version'], panther_link($panther_url['admin_updates'])); } $avatar_path = $panther_config['o_avatars_dir'] != '' ? $panther_config['o_avatars_path'] . '/' : PANTHER_ROOT . $panther_config['o_avatars_path'] . '/'; $smiley_path = $panther_config['o_smilies_dir'] != '' ? $panther_config['o_smilies_path'] . '/' : PANTHER_ROOT . $panther_config['o_smilies_path'] . '/'; if (!forum_is_writable(FORUM_CACHE_DIR)) { $alerts[] = sprintf($lang_admin_index['Alert cache'], FORUM_CACHE_DIR); } if (!forum_is_writable($avatar_path)) { $alerts[] = sprintf($lang_admin_index['Alert avatar'], $avatar_path); } if (!forum_is_writable($smiley_path)) { $alerts[] = sprintf($lang_admin_index['Alert smilies'], $smiley_path); } } $page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Index']); define('PANTHER_ACTIVE_PAGE', 'admin'); require PANTHER_ROOT . 'header.php'; generate_admin_menu('index'); $tpl = load_template('admin_index.tpl'); echo $tpl->render(array('lang_admin_common' => $lang_admin_common, 'lang_admin_index' => $lang_admin_index, 'form_action' => panther_link($panther_url['save_notes']), 'panther_config' => $panther_config, 'upgrade_link' => panther_link($panther_url['check_upgrade']), 'stats_link' => panther_link($panther_url['admin_statistics']), 'alerts' => $alerts)); require PANTHER_ROOT . 'footer.php';
$db->update('topics', $update, 'id=:id', $data); ($hook = get_extensions('delete_poll_after_deletion')) ? eval($hook) : null; redirect(panther_link($panther_url['topic'], array($id, url_friendly($cur_topic['subject']))), $lang_poll['Poll deleted redirect']); } ($hook = get_extensions('delete_poll_before_header')) ? eval($hook) : null; $page_title = array($panther_config['o_board_title'], $lang_poll['Delete poll']); define('PANTHER_ACTIVE_PAGE', 'index'); require PANTHER_ROOT . 'header.php'; $tpl = load_template('delete_poll.tpl'); echo $tpl->render(array('lang_poll' => $lang_poll, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['poll_delete'], array($id)), 'csrf_token' => generate_csrf_token())); } else { if (isset($_GET['reset'])) { if (isset($_POST['form_sent'])) { confirm_referrer('poll_misc.php'); $update = array('voters' => '', 'votes' => ''); $data = array(':id' => $cur_topic['pid']); $db->update('polls', $update, 'id=:id', $data); redirect(panther_link($panther_url['topic'], array($id, url_friendly($cur_topic['subject']))), $lang_poll['Poll reset redirect']); } $page_title = array($panther_config['o_board_title'], $lang_poll['Reset poll']); define('PANTHER_ACTIVE_PAGE', 'index'); require PANTHER_ROOT . 'header.php'; ($hook = get_extensions('reset_poll_before_display')) ? eval($hook) : null; $tpl = load_template('reset_poll.tpl'); echo $tpl->render(array('lang_poll' => $lang_poll, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['poll_reset'], array($id)), 'csrf_token' => generate_csrf_token())); } else { message($lang_common['Bad request']); } } } require PANTHER_ROOT . 'footer.php';
} ($hook = get_extensions('pms_delete_folder_before_deletion')) ? eval($hook) : null; $update = array('folder_id' => 2); $update_data = array(':id' => $id); $db->update('pms_data', $update, 'folder_id=:id', $update_data); $db->delete('folders', 'id=:id AND user_id=:uid', $data); redirect(panther_link($panther_url['pms_folders']), $lang_pm['Folder del redirect']); } } } $data = array(':uid' => $panther_user['id']); $folders = array(); $ps = $db->select('folders', 'name, id', $data, 'user_id=:uid'); foreach ($ps as $cur_folder) { $folders[] = array('id' => $cur_folder['id'], 'name' => $cur_folder['name']); } $required_fields = array('req_folder' => $lang_pm['Folder']); $focus_element = array('folder', 'req_folder'); ($hook = get_extensions('pms_message_folders_before_header')) ? eval($hook) : null; $page_title = array($panther_config['o_board_title'], $lang_common['PM'], $lang_pm['My folders 2']); define('PANTHER_ALLOW_INDEX', 1); define('PANTHER_ACTIVE_PAGE', 'pm'); require PANTHER_ROOT . 'header.php'; $tpl = load_template('message_folders.tpl'); echo $tpl->render(array('errors' => $errors, 'lang_pm' => $lang_pm, 'lang_common' => $lang_common, 'pm_menu' => generate_pm_menu('folders'), 'form_action' => panther_link($panther_url['pms_folders']), 'folder' => isset($folder) ? $folder : '', 'folders' => $folders)); require PANTHER_ROOT . 'footer.php'; } else { message($lang_common['Bad request']); } } }
$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']);
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') { if (!$panther_user['is_admmod'] || $panther_user['g_moderator'] == '1' && $panther_user['g_mod_ban_users'] == '0') { message($lang_common['Bad request'], false, '403 Forbidden'); } $posting_ban = format_posting_ban_expiration($user['posting_ban'] - time(), $lang_profile); $page_title = array($panther_config['o_board_title'], $lang_common['Profile'], $lang_profile['Section admin']); ($hook = get_extensions('profile_admin_before_header')) ? eval($hook) : null; define('PANTHER_ACTIVE_PAGE', 'profile'); require PANTHER_ROOT . 'header.php'; generate_profile_menu('admin'); $render = array('lang_profile' => $lang_profile, 'form_action' => panther_link($panther_url['profile_admin'], array($id)), 'csrf_token' => generate_csrf_token(), 'user' => $user, 'posting_ban' => $user['g_moderator'] == '0' && $user['g_id'] != PANTHER_ADMIN && $user['g_admin'] == '0' && $panther_user['is_admin'] == '1' ? true : false, 'ban_info' => $posting_ban[2] != $lang_profile['Never'] ? sprintf($lang_profile['current ban'], format_time($user['posting_ban'])) : '', 'posting_ban' => $posting_ban, 'is_moderator' => $panther_user['g_moderator'] == '1' && $panther_user['g_admin'] == '0' && $user['g_id'] != PANTHER_ADMIN ? true : false); if ($panther_user['is_admin']) { if (file_exists(FORUM_CACHE_DIR . 'cache_restrictions.php')) { require FORUM_CACHE_DIR . 'cache_restrictions.php'; } else { if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) { require PANTHER_ROOT . 'include/cache.php'; } generate_admin_restrictions_cache(); require FORUM_CACHE_DIR . 'cache_restrictions.php'; } if (!isset($admins[$panther_user['id']]) || $panther_user['id'] == '2') { $admins[$panther_user['id']] = array('admin_users' => '1'); } if ($panther_user['id'] != $id && $admins[$panther_user['id']]['admin_users'] == '1') { $groups = array();
// 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';
$expiration[0] = ''; $expiration[1] = $lang_warnings['Never']; } $types[] = array('edit_link' => panther_link($panther_url['warning_edit_type'], array($list_types['id'])), 'delete_link' => panther_link($panther_url['warning_del_type'], array($list_types['id'])), 'list_types' => $list_types, 'expiration' => $expiration); } $levels = array(); $ps = $db->select('warning_levels', 'id, points, period', array(), '', 'points, id'); foreach ($ps as $list_levels) { if ($list_levels['period'] == '0') { $ban_title = $lang_warnings['Permanent ban']; } else { $expiration = explode(' ', format_expiration_time($list_levels['period'])); if ($expiration[0] == $lang_warnings['Never']) { $expiration[0] = ''; $expiration[1] = $lang_warnings['Never']; } $ban_title = sprintf($lang_warnings['Temporary ban'], $expiration[0], $expiration[1]); } $levels[] = array('edit_link' => panther_link($panther_url['warning_edit_level'], array($list_levels['id'])), 'delete_link' => panther_link($panther_url['warning_del_level'], array($list_levels['id'])), 'points' => $list_levels['points'], 'ban_title' => $ban_title); } // Display the admin navigation menu require PANTHER_ROOT . 'header.php'; generate_admin_menu('warnings'); $tpl = load_template('admin_warnings.tpl'); echo $tpl->render(array('lang_admin_common' => $lang_admin_common, 'lang_warnings' => $lang_warnings, 'form_action' => panther_link($panther_url['admin_warnings']), 'types' => $types, 'levels' => $levels)); } } } } } require PANTHER_ROOT . 'footer.php';
for ($i = 0; $i < count($topics['topics']); $i++) { $markers[] = '?'; $data[] = $topics['topics'][$i]; } $db->run('UPDATE ' . $db->prefix . 'topics SET archived=1 WHERE id IN (' . implode(',', $markers) . ')', $data); $percentage = round($topics['count'] / $total * 100, 2); } $update = array('conf_value' => serialize($rules)); $data = array(':conf_name' => 'o_archive_rules'); $db->update('config', $update, 'conf_name=:conf_name', $data); generate_config_cache(); $redirect_lang = $panther_config['o_archiving'] == '1' ? sprintf($lang_admin_archive['Archive rules updated'], $topics['count'], $total, $percentage . '%') : $lang_admin_archive['Updated redirect']; redirect(panther_link($panther_url['admin_archive']), $redirect_lang); } $archive_rules = $panther_config['o_archive_rules'] != '' ? unserialize($panther_config['o_archive_rules']) : array('closed' => 0, 'sticky' => 0, 'time' => 0, 'unit' => 'days', 'forums' => array(0)); $percentage = $ps->rowCount() != 0 ? round($archived / $total * 100, 2) : 0; $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('name' => $cur_forum['cat_name'], 'id' => $cur_forum['cid']); } $forums[] = array('id' => $cur_forum['fid'], 'selected' => in_array($cur_forum['fid'], $archive_rules['forums']) ? true : false, 'name' => $cur_forum['forum_name'], 'category_id' => $cur_forum['cid']); } $page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Archive']); define('PANTHER_ACTIVE_PAGE', 'admin'); require PANTHER_ROOT . 'header.php'; generate_admin_menu('archive'); $tpl = load_template('admin_archive.tpl'); echo $tpl->render(array('lang_admin_common' => $lang_admin_common, 'lang_admin_archive' => $lang_admin_archive, 'form_action' => panther_link($panther_url['admin_archive']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/archive.php'), 'archive_lang' => $panther_config['o_archiving'] == '1' ? $lang_admin_archive['Archive enabled'] : $lang_admin_archive['Archive disabled'], 'admin_options' => panther_link($panther_url['admin_options']), 'archived' => $archived, 'percentage' => $percentage, 'archive_rules' => $archive_rules, 'lang_common' => $lang_common, 'categories' => $categories, 'forums' => $forums)); require PANTHER_ROOT . 'footer.php';
function generate_quickjump_cache($group_id = false, $read_board = 1) { global $db, $lang_common, $panther_url, $panther_groups; $groups = array(); $base_url = get_base_url(); // If a group_id was supplied, we generate the quick jump cache for that group only if ($group_id !== false) { $groups[$group_id] = isset($panther_groups[$group_id]['g_read_board']) ? $panther_groups[$group_id]['g_read_board'] : $read_board; } else { // A group_id was not supplied, so we generate the quick jump cache for all groups foreach ($panther_groups as $cur_group) { $groups[$cur_group['g_id']] = $cur_group['g_read_board']; } } // Loop through the groups in $groups and output the cache for each of them foreach ($groups as $group_id => $read_board) { // Output quickjump as PHP code $output = '<?php' . "\n\n" . 'if (!defined(\'PANTHER\')) exit;' . "\n" . 'define(\'PANTHER_QJ_LOADED\', 1);' . "\n" . '$forum_id = isset($forum_id) ? $forum_id : 0;' . "\n\n" . '?>'; if ($read_board == '1') { $data = array(':id' => $group_id); $categories = $forums = array(); $ps = $db->run('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url, f.parent_forum FROM ' . $db->prefix . 'categories AS c INNER JOIN ' . $db->prefix . 'forums AS f ON c.id=f.cat_id LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=:id) WHERE f.quickjump=1 AND (fp.read_forum IS NULL OR fp.read_forum=1) ORDER BY c.disp_position, c.id, f.disp_position', $data); if ($ps->rowCount()) { $tpl = load_template('quickjump.tpl'); foreach ($ps as $cur_forum) { if (!isset($categories[$cur_forum['cid']])) { $categories[$cur_forum['cid']] = array('id' => $cur_forum['cid'], 'name' => $cur_forum['cat_name']); } $forums[] = array('id' => $cur_forum['fid'], 'category_id' => $cur_forum['cid'], 'name' => $cur_forum['forum_name'], 'redirect_url' => $cur_forum['redirect_url'], 'parent_forum' => $cur_forum['parent_forum'], 'url' => url_friendly($cur_forum['forum_name'])); } $output .= $tpl->render(array('lang_common' => $lang_common, 'base_url' => $base_url, 'categories' => $categories, 'forums' => $forums, 'forum_link' => panther_link($panther_url['forum'], array("'+this.options[this.selectedIndex].value)+'", '\'+this.options[this.selectedIndex].getAttribute(\'data-name\')+\'')))); } } panther_write_cache_file('cache_quickjump_' . $group_id . '.php', $output); } }
($hook = get_extensions('poll_vote_before_validation')) ? eval($hook) : null; if (in_array($panther_user['id'], $voters)) { message($lang_poll['Already voted']); } if ($cur_poll['type'] == '1') { $vote = isset($_POST['vote']) ? intval($_POST['vote']) : -1; if ($vote < 0) { message($lang_common['Bad request'], false, '404 Not Found'); } // Increment the amount of votes for this option $votes[$vote] = isset($votes[$vote]) ? $votes[$vote]++ : 1; } else { $vote = isset($_POST['options']) && is_array($_POST['options']) ? array_map('intval', $_POST['options']) : array(); if (empty($vote)) { message($lang_common['Bad request'], false, '404 Not Found'); } foreach ($vote as $key => $value) { // If the value isn't nothing, and it's a valid option, increment the votes if (!empty($value) && isset($options[$key])) { $votes[$key] = isset($votes[$key]) ? $votes[$key]++ : 1; } } } $voters[] = $panther_user['id']; $update = array('votes' => serialize($votes), 'voters' => serialize($voters)); $data = array(':id' => $cur_poll['pid']); $db->update('polls', $update, 'id=:id', $data); redirect(panther_link($panther_url['topic'], array($id, url_friendly($cur_poll['subject']))), $lang_poll['Vote success']); } else { message($lang_common['Bad request'], false, '404 Not Found'); }
$select = array_merge($select, $data); $ps = $db->run('SELECT t.id, t.poster, t.subject, t.forum_id, t.posted, t.last_post, t.last_poster, p.message, p.hide_smilies, u.email_setting, u.email, p.poster_id, p.poster_email FROM ' . $db->prefix . 'topics AS t INNER JOIN ' . $db->prefix . 'posts AS p ON p.id=' . ($order_posted ? 't.first_post_id' : 't.last_post_id') . ' INNER JOIN ' . $db->prefix . 'users AS u ON u.id=p.poster_id LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id=?) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL' . $forum_sql . ' ORDER BY ' . ($order_posted ? 't.posted' : 't.last_post') . ' DESC LIMIT ' . (isset($cache_id) ? 50 : $show), $select); foreach ($ps as $cur_topic) { if ($panther_forums[$cur_topic['forum_id']]['password'] != '' && check_forum_login_cookie($cur_topic['forum_id'], $panther_forums[$cur_topic['forum_id']]['password'], true) === false || $panther_forums[$cur_topic['forum_id']]['protected'] == '1' && !$panther_user['is_admmod']) { continue; } if ($panther_config['o_censoring'] == '1') { $cur_topic['subject'] = censor_words($cur_topic['subject']); } $cur_topic['message'] = $parser->parse_message($cur_topic['message'], $cur_topic['hide_smilies']); $item = array('id' => $cur_topic['id'], 'title' => $cur_topic['subject'], 'link' => panther_htmlspecialchars_decode(panther_link($panther_url[$order_posted ? 'topic' : 'topic_new_posts'], array($cur_topic['id'], url_friendly($cur_topic['subject'])))), 'description' => $cur_topic['message'], 'author' => array('name' => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster']), 'pubdate' => $order_posted ? $cur_topic['posted'] : $cur_topic['last_post']); if ($cur_topic['poster_id'] > 1) { if ($cur_topic['email_setting'] == '0' && !$panther_user['is_guest']) { $item['author']['email'] = $cur_topic['email']; } $item['author']['uri'] = panther_link($panther_url['profile'], array($cur_topic['poster_id'])); } else { if ($cur_topic['poster_email'] != '' && !$panther_user['is_guest']) { $item['author']['email'] = $cur_topic['poster_email']; } } $feed['items'][] = $item; } // Output feed as PHP code if (isset($cache_id)) { if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) { require PANTHER_ROOT . 'include/cache.php'; } $content = '<?php' . "\n\n" . '$feed = ' . var_export($feed, true) . ';' . "\n\n" . '$cache_expire = ' . ($now + $panther_config['o_feed_ttl'] * 60) . ';' . "\n\n" . '?>'; panther_write_cache_file('cache_' . $cache_id . '.php', $content); }
$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)); } $tpl = load_template('topic.tpl'); echo $tpl->render($render); ($hook = get_extensions('topic_after_display')) ? eval($hook) : null; $forum_id = $cur_topic['forum_id']; $footer_style = 'viewtopic'; require PANTHER_ROOT . 'footer.php';
// Load the admin_permissions.php language file require PANTHER_ROOT . 'lang/' . $admin_language . '/admin_permissions.php'; if (isset($_POST['form_sent'])) { confirm_referrer(PANTHER_ADMIN_DIR . '/permissions.php'); $form = isset($_POST['form']) && is_array($_POST['form']) ? array_map('intval', $_POST['form']) : array(); foreach ($form as $key => $input) { // Make sure the input is never a negative value if ($input < 0) { $input = 0; } // Only update values that have changed if (array_key_exists('p_' . $key, $panther_config) && $panther_config['p_' . $key] != $input) { $update = array('conf_value' => $input); $data = array(':conf_name' => 'p_' . $key); $db->update('config', $update, 'conf_name=:conf_name', $data); } } // Regenerate the config cache if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) { require PANTHER_ROOT . 'include/cache.php'; } generate_config_cache(); redirect(panther_link($panther_url['admin_permissions']), $lang_admin_permissions['Perms updated redirect']); } $page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Permissions']); define('PANTHER_ACTIVE_PAGE', 'admin'); require PANTHER_ROOT . 'header.php'; generate_admin_menu('permissions'); $tpl = load_template('admin_permissions.tpl'); echo $tpl->render(array('lang_admin_permissions' => $lang_admin_permissions, 'panther_config' => $panther_config, 'lang_admin_common' => $lang_admin_common, 'form_action' => panther_link($panther_url['admin_permissions']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/permissions.php'))); require PANTHER_ROOT . 'footer.php';
// Regenerate the users info cache if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) { require PANTHER_ROOT . 'include/cache.php'; } generate_users_info_cache(); redirect(panther_link($panther_url['admin_maintenance']), $lang_admin_maintenance['User created message']); } } // Get the first post ID from the db $ps = $db->select('posts', 'id', array(), '', 'id ASC LIMIT 1'); $first_id = $ps->rowCount() ? $ps->fetchColumn() : 0; $page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Maintenance']); define('PANTHER_ACTIVE_PAGE', 'admin'); require PANTHER_ROOT . 'header.php'; $options = array(); $ps = $db->run('SELECT u.id, u.username, g.g_title FROM ' . $db->prefix . 'users AS u INNER JOIN ' . $db->prefix . 'groups AS g ON u.group_id=g.g_id WHERE u.id!=1 ORDER BY u.id ASC'); foreach ($ps as $result) { $options[] = array('id' => $result['id'], 'username' => $result['username'], 'group_title' => $result['g_title']); } $forums = $catgeories = 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('id' => $cur_forum['cid'], 'name' => $cur_forum['cat_name']); } $forums[] = array('category_id' => $cur_forum['cid'], 'name' => $cur_forum['forum_name'], 'id' => $cur_forum['fid']); } generate_admin_menu('maintenance'); $tpl = load_template('admin_maintenance.tpl'); echo $tpl->render(array('lang_admin_maintenance' => $lang_admin_maintenance, 'lang_admin_common' => $lang_admin_common, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['admin_maintenance']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/maintenance.php'), 'options_link' => panther_link($panther_url['admin_options']), 'first_id' => $first_id, 'POST' => $_POST, 'panther_config' => $panther_config, 'errors' => $errors, 'options' => $options, 'forums' => $forums, 'categories' => $categories)); require PANTHER_ROOT . 'footer.php';
$mailer->send($email1, $mail_tpl['subject'], $mail_tpl['message']); message(sprintf($lang_register['Reg email'], $panther_config['o_admin_email']), true); } panther_setcookie($new_uid, $login_key, time() + $panther_config['o_timeout_visit']); redirect(panther_link($panther_url['index']), $lang_register['Reg complete']); } } $page_title = array($panther_config['o_board_title'], $lang_register['Register']); $required_fields = array('req_user' => $lang_common['Username'], 'req_password1' => $lang_common['Password'], 'req_password2' => $lang_prof_reg['Confirm pass'], 'req_email1' => $lang_common['Email'], 'req_email2' => $lang_common['Email'] . ' 2'); $focus_element = array('register', 'req_user'); if (!empty($panther_robots)) { $required_fields['answer'] = $lang_common['Robot title']; } ($hook = get_extensions('register_before_header')) ? eval($hook) : null; define('PANTHER_ACTIVE_PAGE', 'register'); require PANTHER_ROOT . 'header.php'; $timezone = isset($timezone) ? $timezone : $panther_config['o_default_timezone']; $dst = isset($dst) ? $dst : $panther_config['o_default_dst']; $email_setting = isset($email_setting) ? $email_setting : $panther_config['o_default_email_setting']; ($hook = get_extensions('register_before_submit')) ? eval($hook) : null; $render = array('lang_register' => $lang_register, 'errors' => $errors, 'form_action' => panther_link($panther_url['register_register']), 'csrf_token' => generate_csrf_token(), 'lang_common' => $lang_common, 'lang_prof_reg' => $lang_prof_reg, 'POST' => $_POST, 'panther_config' => $panther_config, 'dst' => $dst, 'timezone' => $timezone, 'email_setting' => $email_setting, 'languages' => forum_list_langs()); if (!empty($panther_robots)) { $id = array_rand($panther_robots); $test = $panther_robots[$id]; $render['robot_id'] = $id; $render['robot_test'] = $test; } $tpl = load_template('register.tpl'); echo $tpl->render($render); ($hook = get_extensions('register_after_output')) ? eval($hook) : null; require PANTHER_ROOT . 'footer.php';
$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('name' => $cur_forum['cat_name'], 'id' => $cur_forum['cid']); } $forums[] = array('id' => $cur_forum['fid'], 'name' => $cur_forum['forum_name'], 'category_id' => $cur_forum['cid']); } $tpl = load_template('edit_action.tpl'); echo $tpl->render(array('lang_admin_moderate' => $lang_admin_moderate, 'lang_admin_common' => $lang_admin_common, 'lang_common' => $lang_common, 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/moderate.php'), 'form_action' => $action == 'add' ? panther_link($panther_url['admin_moderate_add']) : panther_link($panther_url['admin_moderate_edit'], array($id)), 'action' => $cur_action, 'categories' => $categories, 'forums' => $forums)); } else { if ($action == 'delete' && $id > '0') { $tpl = load_template('delete_action.tpl'); echo $tpl->render(array('lang_admin_moderate' => $lang_admin_moderate, 'lang_admin_common' => $lang_admin_common, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['admin_moderate_delete'], array($id)), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/moderate.php'))); } else { $ps = $db->select('multi_moderation', 'COUNT(id)'); $total = $ps->fetchColumn(); $num_pages = ceil($total / 15); if ($page > $num_pages) { $page = 1; } $start_from = 15 * ($page - 1); $ps = $db->select('multi_moderation', 'title, id', array(), '', 'id DESC LIMIT ' . $start_from . ', ' . $panther_config['o_disp_topics_default']); $actions = array(); foreach ($ps as $action) { $actions[] = array('title' => $action['title'], 'edit_link' => panther_link($panther_url['admin_moderate_edit'], array($action['id'])), 'delete_link' => panther_link($panther_url['admin_moderate_delete'], array($action['id']))); } $tpl = load_template('admin_moderate.tpl'); echo $tpl->render(array('lang_admin_common' => $lang_admin_common, 'lang_admin_moderate' => $lang_admin_moderate, 'lang_common' => $lang_common, 'add_link' => panther_link($panther_url['admin_moderate_add']), 'pagination' => paginate($num_pages, $page, $panther_url['admin_moderate'] . '?'), 'actions' => $actions)); } } require PANTHER_ROOT . 'footer.php';
if ($cur_cat['name'] == '') { message($lang_admin_categories['Must enter name message']); } if ($cur_cat['order'] < 0) { message($lang_admin_categories['Must enter integer message']); } $update = array('cat_name' => $cur_cat['name'], 'disp_position' => $cur_cat['order']); $data = array(':id' => intval($cat_id)); $db->update('categories', $update, 'id=:id', $data); } // Regenerate the quick jump cache if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) { require PANTHER_ROOT . 'include/cache.php'; } generate_quickjump_cache(); redirect(panther_link($panther_url['admin_categories']), $lang_admin_categories['Categories updated redirect']); } } } $page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Categories']); define('PANTHER_ACTIVE_PAGE', 'admin'); require PANTHER_ROOT . 'header.php'; generate_admin_menu('categories'); $categories = array(); $ps = $db->select('categories', 'id, cat_name, disp_position', array(), '', 'disp_position'); foreach ($ps as $cur_cat) { $categories[] = array('id' => $cur_cat['id'], 'name' => $cur_cat['cat_name'], 'disp_position' => $cur_cat['disp_position']); } $tpl = load_template('admin_categories.tpl'); echo $tpl->render(array('lang_admin_categories' => $lang_admin_categories, 'lang_admin_common' => $lang_admin_common, 'form_action' => panther_link($panther_url['admin_categories']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/categories.php'), 'admin_forums' => panther_link($panther_url['admin_forums']), 'categories' => $categories)); require PANTHER_ROOT . 'footer.php';