Exemplo n.º 1
0
            //Reporting now made fun =)
            if (!stopforumspam_report($panther_config['o_sfs_api'], $cur_post['poster_ip'], $email, $cur_post['poster'], $cur_post['message'])) {
                message($lang_common['Unable to add spam data']);
            }
        }
    }
    if ($is_topic_post) {
        // Delete the topic and all of its posts
        delete_topic($cur_post['tid']);
        update_forum($cur_post['fid']);
        ($hook = get_extensions('delete_after_delete')) ? eval($hook) : null;
        redirect(panther_link($panther_url['forum'], array($cur_post['fid'], url_friendly($cur_post['forum_name']))), $lang_delete['Topic del redirect']);
    } else {
        // Delete just this one post
        delete_post($id, $cur_post['tid']);
        update_forum($cur_post['fid']);
        // Redirect towards the previous post
        $data = array(':tid' => $cur_post['tid'], ':id' => $id);
        $ps = $db->select('posts', 'id', $data, 'topic_id=:tid AND id < :id', 'id DESC LIMIT 1');
        $post_id = $ps->fetchColumn();
        ($hook = get_extensions('delete_after_delete')) ? eval($hook) : null;
        redirect(panther_link($panther_url['post'], array($post_id)), $lang_delete['Post del redirect']);
    }
}
require PANTHER_ROOT . 'include/parser.php';
$page_title = array($panther_config['o_board_title'], $lang_delete['Delete post']);
define('PANTHER_ACTIVE_PAGE', 'index');
require PANTHER_ROOT . 'header.php';
$tpl = load_template('delete.tpl');
echo $tpl->render(array('lang_common' => $lang_common, 'index_link' => panther_link($panther_url['index']), 'forum_link' => panther_link($panther_url['forum'], array($cur_post['fid'], url_friendly($cur_post['forum_name']))), 'post_link' => panther_link($panther_url['post'], array($id)), 'cur_post' => $cur_post, 'lang_delete' => $lang_delete, 'form_action' => panther_link($panther_url['delete'], array($id)), 'csrf_token' => generate_csrf_token(), 'is_topic_post' => $is_topic_post, 'posted' => format_time($cur_post['posted']), 'is_admmod' => $is_admmod, 'panther_config' => $panther_config, 'message' => $parser->parse_message($cur_post['message'], $cur_post['hide_smilies'])));
require PANTHER_ROOT . 'footer.php';
Exemplo n.º 2
0
// temp directory for pclzip
define('PCLZIP_TEMPORARY_DIR', $webDir . '/courses/temp/');
// include_messages
require "{$webDir}/lang/{$language}/common.inc.php";
$extra_messages = "config/{$language_codes[$language]}.inc.php";
if (file_exists($extra_messages)) {
    include $extra_messages;
} else {
    $extra_messages = false;
}
require "{$webDir}/lang/{$language}/messages.inc.php";
if ($extra_messages) {
    include $extra_messages;
}
if (!isset($_SESSION['csrf_token']) || empty($_SESSION['csrf_token'])) {
    $_SESSION['csrf_token'] = generate_csrf_token();
}
if ($upgrade_begin = get_config('upgrade_begin')) {
    if (!defined('UPGRADE')) {
        Session::Messages(sprintf($langUpgradeInProgress, format_time_duration(time() - $upgrade_begin)), 'alert-warning');
        if (!isset($guest_allowed) or !$guest_allowed) {
            redirect_to_home_page();
        }
    }
}
// check if we are admin or power user or manageuser_user
if (isset($_SESSION['is_admin']) and $_SESSION['is_admin']) {
    $is_admin = true;
    $is_power_user = true;
    $is_usermanage_user = true;
    $is_departmentmanage_user = true;
Exemplo n.º 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('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));
Exemplo n.º 4
0
    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';
Exemplo n.º 5
0
?>

      <link rel="icon" href="<?php 
echo IMG_PATH;
?>
favicon.ico">
      <link rel="apple-touch-icon" href="<?php 
echo IMG_PATH;
?>
balise.png">

  </head>
  <body>
    <div id="wrapper">
      <?php 
generate_csrf_token();
?>
      <?php 
if (!($_GET["controller"] == "error" || $_GET["controller"] == "home" && in_array($_GET["action"], array("welcome", "chose_identity")))) {
    include LAYOUT_PATH . "structure.php";
}
?>
      <div id="page-wrapper">
        <?php 
include LAYOUT_PATH . "flash.php";
include VIEW_PATH . (isset($_GET["prefix"]) ? $_GET["prefix"] . "/" : "") . $_GET["controller"] . "/" . $_GET["action"] . ".php";
?>
      </div>
    </div>

    <footer>
Exemplo n.º 6
0
    }
    $id_list = explode(',', $cur_announcement['forum_id']);
    // 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));
Exemplo n.º 7
0
        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';
Exemplo n.º 8
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';
Exemplo n.º 9
0
        }
        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';
Exemplo n.º 10
0
        }
        generate_censoring_cache();
        redirect(panther_link($panther_url['admin_censoring']), $lang_admin_censoring['Word updated redirect']);
    } else {
        if (isset($_POST['remove'])) {
            confirm_referrer(PANTHER_ADMIN_DIR . '/censoring.php');
            $id = intval(key($_POST['remove']));
            $data = array(':id' => $id);
            $db->delete('censoring', 'id=:id', $data);
            // Regenerate the censoring cache
            if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
                require PANTHER_ROOT . 'include/cache.php';
            }
            generate_censoring_cache();
            redirect(panther_link($panther_url['admin_censoring']), $lang_admin_censoring['Word removed redirect']);
        }
    }
}
$page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Censoring']);
$focus_element = array('censoring', 'new_search_for');
define('PANTHER_ACTIVE_PAGE', 'admin');
require PANTHER_ROOT . 'header.php';
generate_admin_menu('censoring');
$words = array();
$ps = $db->select('censoring', 'id, search_for, replace_with', array(), '', 'id');
foreach ($ps as $cur_word) {
    $words[] = array('id' => $cur_word['id'], 'search_for' => $cur_word['search_for'], 'replace_with' => $cur_word['replace_with']);
}
$tpl = load_template('admin_censoring.tpl');
echo $tpl->render(array('form_action' => panther_link($panther_url['admin_censoring']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/censoring.php'), 'lang_admin_censoring' => $lang_admin_censoring, 'lang_admin_common' => $lang_admin_common, 'panther_config' => $panther_config, 'link' => panther_link($panther_url['admin_options']), 'words' => $words));
require PANTHER_ROOT . 'footer.php';
Exemplo n.º 11
0
                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';
Exemplo n.º 12
0
                            $mailer->send($email, $mail_tpl['subject'], $mail_tpl['message']);
                        }
                        message($lang_login['Forget mail'] . ' ' . $panther_config['o_admin_email'], true);
                    } else {
                        $errors[] = $lang_login['No email match'] . ' ' . $email . '.';
                    }
                }
            }
            $page_title = array($panther_config['o_board_title'], $lang_login['Request pass']);
            $required_fields = array('req_email' => $lang_common['Email']);
            $focus_element = array('request_pass', 'req_email');
            ($hook = get_extensions('forgot_password_before_header')) ? eval($hook) : null;
            define('PANTHER_ACTIVE_PAGE', 'login');
            require PANTHER_ROOT . 'header.php';
            $tpl = load_template('forgot_password.tpl');
            echo $tpl->render(array('lang_login' => $lang_login, 'form_url' => panther_link($panther_url['request_password']), 'csrf_token' => generate_csrf_token(), 'lang_common' => $lang_common, 'errors' => $errors));
            require PANTHER_ROOT . 'footer.php';
        }
    }
}
if (!$panther_user['is_guest']) {
    header('Location: ' . panther_link($panther_url['index']));
    exit;
}
// Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to index.php after login)
if (!empty($_SERVER['HTTP_REFERER'])) {
    $redirect_url = validate_redirect($_SERVER['HTTP_REFERER'], null);
}
if (!isset($redirect_url)) {
    $redirect_url = panther_link($panther_url['index']);
} else {
Exemplo n.º 13
0
        $page_head['next'] = array('href' => panther_link($panther_url['forum_page'], array($id, $p + 1, $url_forum)), 'rel' => 'next');
    }
}
if ($panther_config['o_feed_type'] == '1') {
    $page_head['feed'] = array('href' => panther_link($panther_url['forum_rss'], array($id)), 'rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => $lang_common['RSS forum feed']);
} else {
    if ($panther_config['o_feed_type'] == '2') {
        $page_head['feed'] = array('href' => panther_link($panther_url['forum_atom'], array($id)), 'rel' => 'alternate', 'type' => 'application/atom+xml', 'title' => $lang_common['Atom forum feed']);
    }
}
$forum_actions = array();
if (!$panther_user['is_guest']) {
    $token = generate_csrf_token('viewforum.php');
    if ($panther_config['o_forum_subscriptions'] == '1') {
        if ($cur_forum['is_subscribed']) {
            $forum_actions[] = array('info' => $lang_forum['Is subscribed'], 'href' => panther_link($panther_url['forum_unsubscribe'], array($id, generate_csrf_token('viewforum.php', false))), 'title' => $lang_forum['Unsubscribe']);
        } else {
            $forum_actions[] = array('href' => panther_link($panther_url['forum_subscribe'], array($id, $token)), 'title' => $lang_forum['Subscribe']);
        }
    }
    $forum_actions[] = array('href' => panther_link($panther_url['mark_forum_read'], array($id, $token)), 'title' => $lang_common['Mark forum read']);
}
// Load the cached announcements
if (file_exists(FORUM_CACHE_DIR . 'cache_announcements.php')) {
    require FORUM_CACHE_DIR . 'cache_announcements.php';
} else {
    if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
        require PANTHER_ROOT . 'include/cache.php';
    }
    generate_announcements_cache();
    require FORUM_CACHE_DIR . 'cache_announcements.php';
Exemplo n.º 14
0
                        compress_image($smiley_path . '/' . $filename . $extensions[0]);
                        @chmod($smiley_path . '/' . $filename . $extensions[0], 0644);
                    } else {
                        message($lang_admin_smilies['Unknown failure']);
                    }
                    redirect(panther_link($panther_url['admin_smilies']), $lang_admin_smilies['Successful Upload']);
                }
            }
        }
    }
}
$page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Smilies']);
define('PANTHER_ACTIVE_PAGE', 'admin');
require PANTHER_ROOT . 'header.php';
generate_admin_menu('smilies');
$emoticons = $options = array();
$ps = $db->select('smilies', 'id, image, code, disp_position', array(), '', 'disp_position');
foreach ($ps as $cur_smiley) {
    foreach ($img_smilies as $img) {
        $options[$cur_smiley['id']][] = $img;
    }
    $emoticons[] = array('id' => $cur_smiley['id'], 'disp_position' => $cur_smiley['disp_position'], 'code' => $cur_smiley['code'], 'image' => $smiley_dir . $cur_smiley['image'], 'file' => $cur_smiley['image']);
}
$smiley_list = $images = array();
foreach ($img_smilies as $id => $img) {
    $smiley_list[] = array('file' => $img, 'image' => $smiley_dir . $img, 'id' => $id);
    $images[] = $img;
}
$tpl = load_template('admin_smilies.tpl');
echo $tpl->render(array('lang_admin_common' => $lang_admin_common, 'lang_admin_smilies' => $lang_admin_smilies, 'form_action' => panther_link($panther_url['admin_smilies']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/smilies.php'), 'emoticons' => $emoticons, 'img_smilies' => $img_smilies, 'options' => $options, 'smiley_list' => $smiley_list, 'images' => $images));
require PANTHER_ROOT . 'footer.php';
Exemplo n.º 15
0
     }
 }
 // This warning type has been deleted
 $data = array(':id' => $warning_details['user_id']);
 $ps = $db->select('users', 'username, group_id', $data, 'id=:id');
 list($username, $group_id) = $ps->fetch(PDO::FETCH_NUM);
 if ($warning_details['date_expire'] == '0') {
     $warning_expires = sprintf($lang_warnings['Expires'], $lang_warnings['Never']);
 } else {
     if ($warning_details['date_expire'] > time()) {
         $warning_expires = sprintf($lang_warnings['Expires'], format_time($warning_details['date_expire']));
     } else {
         $warning_expires = sprintf($lang_warnings['Expired'], format_time($warning_details['date_expire']));
     }
 }
 $render = array('lang_warnings' => $lang_warnings, 'form_action' => panther_link($panther_url['warnings']), 'issued_to' => colourize_group($username, $group_id, $warning_details['user_id']), 'warning_title' => $warning_title, 'issued' => format_time($warning_details['date_issued']), 'warning_expires' => $warning_expires, 'issued_by' => colourize_group($warning_details['issued_by_username'], $warning_details['issuer_gid'], $warning_details['issued_by']), 'details_link' => panther_link($panther_url['warning_details'], array($warning_id)), 'view_link' => panther_link($panther_url['warning_view'], array($warning_details['user_id'])), 'profile_link' => panther_link($panther_url['profile'], array($warning_details['user_id'], url_friendly($username))), 'username' => $username, 'post_id' => $warning_details['post_id'], 'panther_user' => $panther_user, 'panther_config' => $panther_config, 'csrf_token' => generate_csrf_token(), 'user_id' => $warning_details['user_id'], 'warning_id' => $warning_id);
 require PANTHER_ROOT . 'include/parser.php';
 if ($panther_user['is_admmod']) {
     $note_admin = $parser->parse_message($warning_details['note_admin'], 0);
     $render['admin_note'] = $note_admin == '' ? $lang_warnings['No admin note'] : $note_admin;
 }
 if ($panther_config['o_private_messaging'] == '1') {
     $note_pm = $parser->parse_message($warning_details['note_pm'], 0);
     $render['pm_note'] = $note_pm == '' ? $lang_warnings['No message'] : $note_pm;
 }
 if ($warning_details['post_id']) {
     $render['message'] = $parser->parse_message($warning_details['note_post'], 0);
     $render['post_link'] = panther_link($panther_url['post'], array($warning_details['post_id']));
 }
 define('PANTHER_ACTIVE_PAGE', 'index');
 require PANTHER_ROOT . 'header.php';
Exemplo n.º 16
0
    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';
Exemplo n.º 17
0
            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';
Exemplo n.º 18
0
            $cur_post = $ps->fetch();
            $data = array(':poster' => $cur_post['poster'], ':posted' => $cur_post['posted'], ':last' => $cur_post['id'], ':id' => $cur_topic['tid']);
            $db->run('UPDATE ' . $db->prefix . 'conversations SET num_replies=num_replies-1, poster=:poster, last_post=:posted, last_post_id=:last WHERE id=:id', $data);
            $link = panther_link($panther_url['pms_post'], array($cur_post['id']));
            $redirect_msg = $lang_delete['Post del redirect'];
        }
        redirect($link, $redirect_msg);
    }
    ($hook = get_extensions('pms_delete_before_header')) ? eval($hook) : null;
    $page_title = array($panther_config['o_board_title'], $lang_common['PM'], $lang_pm['Delete message']);
    define('PANTHER_ALLOW_INDEX', 1);
    define('PANTHER_ACTIVE_PAGE', 'pm');
    require PANTHER_ROOT . 'header.php';
    require PANTHER_ROOT . 'include/parser.php';
    $tpl = load_template('delete_message.tpl');
    echo $tpl->render(array('lang_pm' => $lang_pm, 'lang_delete' => $lang_delete, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['pms_delete'], array($pid)), 'message' => $parser->parse_message($cur_topic['message'], $cur_topic['hide_smilies']), 'csrf_token' => generate_csrf_token(), 'poster' => $cur_topic['poster'], 'posted' => format_time($cur_topic['posted']), 'is_topic_post' => $is_topic_post));
    require PANTHER_ROOT . 'footer.php';
} else {
    if ($action == 'blocked') {
        $errors = array();
        if (isset($_POST['add_block'])) {
            $username = isset($_POST['req_username']) ? panther_trim($_POST['req_username']) : '';
            if ($username == $panther_user['username']) {
                $errors[] = $lang_pm['No block self'];
            }
            $data = array(':username' => $username);
            $ps = $db->select('users', 'group_id, id', $data, 'username=:username');
            if (!$ps->rowCount() || $username == $lang_common['Guest']) {
                $errors[] = sprintf($lang_pm['No user x'], $username);
            } else {
                list($group_id, $uid) = $ps->fetch(PDO::FETCH_NUM);
Exemplo n.º 19
0
} 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;
}
if ($can_upload) {
    $render['max_size'] = $max_size;
Exemplo n.º 20
0
     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();
Exemplo n.º 21
0
    $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';
Exemplo n.º 22
0
 if (isset($_GET['del_level'])) {
     $id = isset($_GET['del_level']) ? intval($_GET['del_level']) : 0;
     if ($id < 1) {
         message($lang_common['Bad request']);
     }
     if (isset($_POST['del_level_comply'])) {
         confirm_referrer(PANTHER_ADMIN_DIR . '/warnings.php');
         $data = array(':id' => $id);
         // Delete the warning level
         $db->delete('warning_levels', 'id=:id', $data);
         redirect(panther_link($panther_url['admin_warnings']), $lang_warnings['Level del redirect']);
     }
     require PANTHER_ROOT . 'header.php';
     generate_admin_menu('warnings');
     $tpl = load_template('delete_warning_level.tpl');
     echo $tpl->render(array('lang_warnings' => $lang_warnings, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['warning_del_level'], array($id)), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/warnings.php')));
 } else {
     $types = array();
     $ps = $db->select('warning_types', 'id, title, description, points, expiration_time', array(), '', 'points, id');
     foreach ($ps as $list_types) {
         $expiration = explode(' ', format_expiration_time($list_types['expiration_time']));
         if ($expiration[0] == $lang_warnings['Never']) {
             $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') {
Exemplo n.º 23
0
                    $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';
Exemplo n.º 24
0
// 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';
Exemplo n.º 25
0
            $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';
Exemplo n.º 26
0
            $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';
Exemplo n.º 27
0
        // 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';
Exemplo n.º 28
0
            $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';
Exemplo n.º 29
0
function get_csrf()
{
    if (!isset($_SESSION[config("site.url")]['csrf_token']) || empty($_SESSION[config("site.url")]['csrf_token'])) {
        generate_csrf_token();
    }
    return $_SESSION[config("site.url")]['csrf_token'];
}
Exemplo n.º 30
0
    $links[] = array('id' => 'navregister', 'class' => PANTHER_ACTIVE_PAGE == 'register' ? 'isactive' : '', 'page' => panther_link($panther_url['register']), 'title' => $lang_common['Register']);
    $links[] = array('id' => 'navlogin', 'class' => PANTHER_ACTIVE_PAGE == 'login' ? 'isactive' : '', 'page' => panther_link($panther_url['login']), 'title' => $lang_common['Login']);
} else {
    // To avoid another preg replace, link directly to the essentials section
    $links[] = array('id' => 'navprofile', 'class' => PANTHER_ACTIVE_PAGE == 'profile' ? 'isactive' : '', 'page' => panther_link($panther_url['profile_essentials'], array($panther_user['id'])), 'title' => $lang_common['Profile']);
    if ($panther_config['o_private_messaging'] == '1' && $panther_user['g_use_pm'] == '1' && $panther_user['pm_enabled'] == '1') {
        $header_data = array(':uid' => $panther_user['id']);
        $ps_header = $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 AND cd.user_id=:uid WHERE cd.viewed=0 AND cd.deleted=0', $header_data);
        $num_messages = $ps_header->fetchColumn();
        $pm_lang = $num_messages ? sprintf($lang_common['PM amount'], $num_messages) : $lang_common['PM'];
        $links[] = array('id' => 'navpm', 'class' => PANTHER_ACTIVE_PAGE == 'pm' ? 'isactive' : '', 'page' => panther_link($panther_url['inbox']), 'title' => $pm_lang);
    }
    if ($panther_user['is_admmod'] && ($panther_user['is_admin'] || $panther_user['g_mod_cp'] == '1')) {
        $links[] = array('id' => 'navadmin', 'class' => PANTHER_ACTIVE_PAGE == 'admin' ? 'isactive' : '', 'page' => panther_link($panther_url['admin_index']), 'title' => $lang_common['Admin']);
    }
    $links[] = array('id' => 'navlogout', 'class' => '', 'page' => panther_link($panther_url['logout'], array($panther_user['id'], generate_csrf_token('login.php'))), 'title' => $lang_common['Logout']);
}
// Are there any additional navlinks we should insert into the array before imploding it?
if ($panther_user['g_read_board'] == '1' && $panther_config['o_additional_navlinks'] != '') {
    if (preg_match_all('%([0-9]+)\\s*=\\s*(.*?)\\n%s', $panther_config['o_additional_navlinks'] . "\n", $extra_links)) {
        // Insert any additional links into the $links array (at the correct index)
        $num_links = count($extra_links[1]);
        for ($i = 0; $i < $num_links; ++$i) {
            $link = explode('|', $extra_links[2][$i]);
            array_splice($links, $extra_links[1][$i], 0, array(array('id' => 'navextra' . ($i + 1), 'class' => '', 'page' => $link[0], 'title' => $link[1])));
        }
    }
}
if (defined('PANTHER_ADMIN_CONSOLE')) {
    if (file_exists(PANTHER_ROOT . 'style/' . $panther_user['style'] . '/base_admin.css')) {
        $style_root = ($panther_config['o_style_dir'] != '' ? $panther_config['o_style_dir'] : get_base_url() . '/style/') . $panther_user['style'];