Example #1
0
 function Abstractify($version, $wpu_version)
 {
     //
     // 	CLASS CONSTRUCTOR
     //	------------------------------
     //
     $version = $version == 'PHPBB3' ? 'PHPBB3' : 'PHPBB2';
     $this->ver = $version;
     $this->wpu_ver = $wpu_version;
     if ('PHPBB3' == $this->ver) {
         define('GENERAL_ERROR', 100);
         define('CRITICAL_ERROR', -100);
         if (!$GLOBALS['user']->data) {
             $GLOBALS['user']->session_begin();
             $GLOBALS['auth']->acl($GLOBALS['user']->data);
             $GLOBALS['user']->setup('mods/wp-united');
         } else {
             $GLOBALS['user']->add_lang('mods/wp-united');
         }
     } else {
         if (!$GLOBALS['userdata']) {
             $GLOBALS['userdata'] = session_pagestart($GLOBALS['user_ip'], PAGE_BLOG);
             init_userprefs($userdata);
         }
         global $lang, $phpEx, $board_config, $phpbb_root_path;
         include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_wp-united.' . $phpEx;
     }
 }
Example #2
0
 /**
  * Initialize phpBB.
  *
  * @param $args  An associative array, which may contain the following options:
  *    template: Whether the default header and footer should be printed. Defaults to true.
  *    admin: Whether the visitor must be an administrator. Defaults to false.
  *    check_sid: Whether 'sid' parameter should be checked against the visitor's actual SID.
  *               Defaults to true if 'admin' is set to true, otherwise defaults to false.
  *    root: Specify the phpbb root path. Defaults to './'.
  *    page: The page type, as will be shown in the administration panel. Defaults to PAGE_MODERATING
  *    title: The page title.
  */
 public static function init($args = array())
 {
     global $phpbb_root_path, $phpEx, $user_ip, $userdata, $db, $themes_id, $board_config, $template, $theme, $lang, $page_title, $SID, $html_entities_match, $html_entities_replace, $user_ip, $attachment_mod, $unhtml_specialchars_match, $unhtml_specialchars_replace;
     define('IN_PHPBB', true);
     if (isset($args['root'])) {
         $phpbb_root_path = $args['root'];
     } else {
         $phpbb_root_path = './';
     }
     include $phpbb_root_path . 'extension.inc';
     include $phpbb_root_path . 'common.' . $phpEx;
     // Start session management.
     if (!isset($args['page'])) {
         $args['page'] = PAGE_MODERATING;
     }
     $userdata = session_pagestart($user_ip, $args['page']);
     init_userprefs($userdata);
     // Check whether user is admin.
     if ($args['admin'] && $userdata['user_level'] != ADMIN) {
         message_die(GENERAL_MESSAGE, "You are not an administrator.");
     }
     // Check session ID if necessary.
     if (!isset($args['check_sid']) && $args['admin'] || $args['check_sid']) {
         // Session ID check.
         if (!empty($_POST['sid']) || !empty($_GET['sid'])) {
             $sid = !empty($_POST['sid']) ? $_POST['sid'] : $_GET['sid'];
         } else {
             $sid = '';
         }
         if ($sid == '' || $sid != $userdata['session_id']) {
             message_die(GENERAL_ERROR, 'Invalid session.');
         }
     }
     $SID = $userdata['session_id'];
     // Print default header and footer.
     if (isset($args['title'])) {
         $page_title = $args['title'];
     }
     if (!isset($args['template']) || $args['template']) {
         include $phpbb_root_path . 'includes/page_header.' . $phpEx;
     }
     self::$phpBB_args = $args;
 }
function privmsg_review($view_user_id, $privmsg_recip_id, $is_inline_review)
{
    global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
    global $userdata, $user_ip;
    global $orig_word, $replacement_word;
    global $starttime;
    global $admin_level, $level_prior, $bbcode_parse;
    global $icones;
    include_once $phpbb_root_path . './includes/functions_messages.' . $phpEx;
    // fix parameters
    $privmsg_recip_id = intval($privmsg_recip_id);
    $view_user_id = intval($view_user_id);
    // check if exists and belongs to the user
    $sql = "SELECT privmsg_id\n                FROM " . PRIVMSGA_RECIPS_TABLE . "\n                WHERE privmsg_user_id = {$view_user_id}\n                    AND privmsg_recip_id = {$privmsg_recip_id}";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not obtain private message information', '', __LINE__, __FILE__, $sql);
    }
    if (!($row = $db->sql_fetchrow($result))) {
        message_die(GENERAL_MESSAGE, 'No_post_id');
    }
    $privmsg_id = intval($row['privmsg_id']);
    if (!$is_inline_review) {
        //
        // Start session management
        //
        $userdata = session_pagestart($user_ip, $forum_id);
        init_userprefs($userdata);
        //
        // End session management
        //
        $sql = "SELECT *\n                    FROM " . USERS_TABLE . "\n                    WHERE user_id = {$view_user_id}";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not read user information', '', __LINE__, __FILE__, $sql);
        }
        if (!($view_userdata = $db->sql_fetchrow($result))) {
            message_die(GENERAL_MESSAGE, 'User_not_exist');
        }
        check_user($view_userdata);
    }
    //
    // Define censored word matches
    //
    if (empty($orig_word) && empty($replacement_word)) {
        $orig_word = array();
        $replacement_word = array();
        obtain_word_list($orig_word, $replacement_word);
    }
    //
    // Dump out the page header and load viewtopic body template
    //
    if (!$is_inline_review) {
        $gen_simple_header = true;
        $page_title = _lang('Topic_review');
        include $phpbb_root_path . 'includes/page_header.' . $phpEx;
    }
    $template->set_filenames(array('reviewbody' => 'posting_topic_review.tpl'));
    // Read the message id
    $sql = "SELECT p.*, pa.*, u.username AS privmsg_from_username\n                FROM " . PRIVMSGA_TABLE . " p, " . PRIVMSGA_RECIPS_TABLE . " pa, " . USERS_TABLE . " u\n                WHERE p.privmsg_id = {$privmsg_id}\n                    AND pa.privmsg_id = p.privmsg_id AND pa.privmsg_direct = 0\n                    AND ( (pa.privmsg_user_id <> 0 AND u.user_id = pa.privmsg_user_id) OR (pa.privmsg_user_id = 0 AND u.user_id = " . ANONYMOUS . ") )";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not obtain post/user information', '', __LINE__, __FILE__, $sql);
    }
    if ($row = $db->sql_fetchrow($result)) {
        $poster_id = $row['privmsg_user_id'];
        $poster = empty($poster_id) ? $board_config['sitename'] : $poster_id == ANONYMOUS ? _lang('Guest') : $row['privmsg_from_username'];
        $post_date = create_date($userdata['user_dateformat'], $row['privmsg_time'], $userdata['user_timezone']);
        $post_subject = empty($row['privmsg_subject']) ? '' : $row['privmsg_subject'];
        $message = $row['privmsg_text'];
        $bbcode_uid = $row['privmsg_bbcode_uid'];
        //
        // If the board has HTML off but the post has HTML
        // on then we process it, else leave it alone
        //
        if (!$board_config['allow_html'] && $row['privmsg_enable_html']) {
            $message = preg_replace('#(<)([\\/]?.*?)(>)#is', '&lt;\\2&gt;', $message);
        }
        if (!empty($bbcode_uid)) {
            $message = $board_config['allow_bbcode'] ? $bbcode_parse->bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $message);
        }
        $message = $bbcode_parse->make_clickable($message);
        if (count($orig_word)) {
            $post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
            $message = preg_replace($orig_word, $replacement_word, $message);
        }
        if ($board_config['allow_smilies'] && $row['enable_smilies']) {
            $message = $bbcode_parse->smilies_pass($message);
        }
        $message = str_replace("\n", '<br />', $message);
        $message = $bbcode_parse->acronym_pass($message);
        $message = $bbcode_parse->smart_pass($message);
        if (function_exists('get_icon_title')) {
            $post_subject = get_icon_title($row['post_icon']) . '&nbsp;' . $post_subject;
        }
        // just for the template : no signification here
        $mini_post_img = _images('icon_minipost');
        $mini_post_alt = _lang('Post');
        //
        // Again this will be handled by the templating
        // code at some point
        //
        $color = true;
        $row_color = $color ? $theme['td_color1'] : $theme['td_color2'];
        $row_class = $color ? $theme['td_class1'] : $theme['td_class2'];
        $template->assign_block_vars('postrow', array('ROW_COLOR' => '#' . $row_color, 'ROW_CLASS' => $row_class, 'MINI_POST_IMG' => $mini_post_img, 'POSTER_NAME' => $poster, 'POST_DATE' => $post_date, 'POST_SUBJECT' => $post_subject, 'MESSAGE' => $message, 'L_MINI_POST_ALT' => $mini_post_alt));
    } else {
        message_die(GENERAL_MESSAGE, 'No_post_id', '', __LINE__, __FILE__, $sql);
    }
    $template->assign_vars(array('L_AUTHOR' => _lang('Author'), 'L_MESSAGE' => _lang('Message'), 'L_POSTED' => _lang('Posted'), 'L_POST_SUBJECT' => _lang('Post_subject'), 'L_TOPIC_REVIEW' => _lang('Topic_review')));
    if (!$is_inline_review) {
        $template->pparse('reviewbody');
        include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
    }
}
Example #4
0
function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '')
{
    global $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path, $nav_links, $gen_simple_header, $images;
    global $userdata, $user_ip, $session_length;
    global $starttime;
    //-- mod : sub-template ----------------------------------------------------------------------------
    //-- add
    //-- fix
    global $sub_template_key_image, $sub_templates;
    //-- fin mod : sub-template ------------------------------------------------------------------------
    //-- mod : profile cp ------------------------------------------------------------------------------
    //-- add
    global $admin_level, $level_prior;
    //-- fin mod : profile cp --------------------------------------------------------------------------
    if (defined('HAS_DIED')) {
        die("message_die() was called multiple times. This isn't supposed to happen. Was message_die() used in page_tail.php?");
    }
    define('HAS_DIED', 1);
    $sql_store = $sql;
    //
    // Get SQL error if we are debugging. Do this as soon as possible to prevent
    // subsequent queries from overwriting the status of sql_error()
    //
    if (DEBUG && ($msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR)) {
        $debug_text = '';
        if (isset($db)) {
            $sql_error = $db->sql_error();
        } else {
            $sql_error['message'] = '';
        }
        if ($sql_error['message'] != '') {
            $debug_text .= '<br /><br />SQL Error : ' . $sql_error['code'] . ' ' . $sql_error['message'];
        }
        if ($sql_store != '') {
            $debug_text .= "<br /><br />{$sql_store}";
        }
        if ($err_line != '' && $err_file != '') {
            $debug_text .= '</br /><br />Line : ' . $err_line . '<br />File : ' . $err_file;
        }
    }
    if (empty($userdata) && ($msg_code == GENERAL_MESSAGE || $msg_code == GENERAL_ERROR)) {
        $userdata = session_pagestart($user_ip, PAGE_INDEX);
        init_userprefs($userdata);
    }
    //
    // If the header hasn't been output then do it
    //
    if (!defined('HEADER_INC') && $msg_code != CRITICAL_ERROR) {
        if (empty($lang)) {
            if (!empty($board_config['default_lang'])) {
                include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx;
            } else {
                include $phpbb_root_path . 'language/lang_english/lang_main.' . $phpEx;
            }
            //-- mod : language settings -----------------------------------------------------------------------
            //-- add
            include $phpbb_root_path . './includes/lang_extend_mac.' . $phpEx;
            //-- fin mod : language settings -------------------------------------------------------------------
        }
        if (empty($template)) {
            $template = new Template($phpbb_root_path . 'templates/' . $board_config['board_template']);
        }
        if (empty($theme)) {
            $theme = setup_styles($board_config['default_style']);
        }
        //
        // Load the Page Header
        //
        if (!defined('IN_ADMIN')) {
            include $phpbb_root_path . 'includes/page_header.' . $phpEx;
        } else {
            include $phpbb_root_path . 'admin/page_header_admin.' . $phpEx;
        }
    }
    switch ($msg_code) {
        case GENERAL_MESSAGE:
            if ($msg_title == '') {
                $msg_title = $lang['Information'];
            }
            break;
        case CRITICAL_MESSAGE:
            if ($msg_title == '') {
                $msg_title = $lang['Critical_Information'];
            }
            break;
        case GENERAL_ERROR:
            if ($msg_text == '') {
                $msg_text = $lang['An_error_occured'];
            }
            if ($msg_title == '') {
                $msg_title = $lang['General_Error'];
            }
            break;
        case CRITICAL_ERROR:
            //
            // Critical errors mean we cannot rely on _ANY_ DB information being
            // available so we're going to dump out a simple echo'd statement
            //
            include $phpbb_root_path . 'language/lang_english/lang_main.' . $phpEx;
            if ($msg_text == '') {
                $msg_text = $lang['A_critical_error'];
            }
            if ($msg_title == '') {
                $msg_title = 'Minerva : <b>' . $lang['Critical_Error'] . '</b>';
            }
            break;
    }
    //
    // Add on DEBUG info if we've enabled debug mode and this is an error. This
    // prevents debug info being output for general messages should DEBUG be
    // set TRUE by accident (preventing confusion for the end user!)
    //
    if (DEBUG && ($msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR)) {
        if ($debug_text != '') {
            $msg_text = $msg_text . '<br /><br /><b><u>DEBUG MODE</u></b>' . $debug_text;
        }
    }
    if ($msg_code != CRITICAL_ERROR) {
        if (!empty($lang[$msg_text])) {
            $msg_text = $lang[$msg_text];
        }
        if (!defined('IN_ADMIN')) {
            $template->set_filenames(array('message_body' => 'message_body.tpl'));
        } else {
            $template->set_filenames(array('message_body' => 'admin_message_body.tpl'));
        }
        $template->assign_vars(array('MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text));
        //--------------------------------------------------------------------------------
        // Prillian - Begin Code Addition
        //
        if ($gen_simple_header) {
            $template->assign_vars(array('U_INDEX' => '', 'L_INDEX' => ''));
        }
        //
        // Prillian - End Code Addition
        //--------------------------------------------------------------------------------
        $template->pparse('message_body');
        if (!defined('IN_ADMIN')) {
            include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
        } else {
            include $phpbb_root_path . 'admin/page_footer_admin.' . $phpEx;
        }
    } else {
        echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>' . strip_tags($msg_title) . '</title>' . "\n";
        echo '<body><h1 style="font-family:Verdana,serif;font-size:18pt;font-weight:bold">' . $msg_title . '</h1><hr style="height:2px;border-style:dashed;color:black" /><p style="font-family:Verdana,serif;font-size:10pt">' . $msg_text . '</p><hr style="height:2px;border-style:dashed;color:black" /><p style="font-family:Verdana,serif;font-size:10pt">Contact the site administrator to report this failure</p></body></html>';
    }
    exit;
}
function generate_smilies($mode, $page_id)
{
    global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
    global $user_ip, $session_length, $starttime, $cache;
    global $userdata;
    //-- mod : sub-template ----------------------------------------------------------------------------
    //-- add
    global $sub_template_key_image, $sub_templates;
    //-- fin mod : sub-template ------------------------------------------------------------------------
    //-- mod : profile cp ------------------------------------------------------------------------------
    //-- add
    global $admin_level, $level_prior;
    //-- fin mod : profile cp --------------------------------------------------------------------------
    $inline_columns = 4;
    $inline_rows = 5;
    $window_columns = 8;
    if ($mode == 'window') {
        $userdata = session_pagestart($user_ip, $page_id);
        init_userprefs($userdata);
        $gen_simple_header = TRUE;
        $page_title = $lang['Emoticons'] . " - {$topic_title}";
        include $phpbb_root_path . 'includes/page_header.' . $phpEx;
        $template->set_filenames(array('smiliesbody' => 'posting_smilies.tpl'));
    }
    if ($cache->exists('smilies')) {
        $rowset = $cache->get('smilies');
        $num_smilies = count($rowset);
    } else {
        $sql = 'SELECT *
			FROM ' . SMILIES_TABLE . '
			ORDER BY smilies_id';
        if ($result = $db->sql_query($sql)) {
            $num_smilies = 0;
            $rowset = array();
            $rowset2 = array();
            while ($row = $db->sql_fetchrow($result)) {
                if (!isset($rowset2[$row['smile_url']])) {
                    $rowset[$row['smilies_id']]['code'] = str_replace("'", "\\'", str_replace('\\', '\\\\', $row['code']));
                    $rowset[$row['smilies_id']]['emoticon'] = $row['emoticon'];
                    $rowset[$row['smilies_id']]['smile_url'] = $row['smile_url'];
                    $rowset2[$row['smile_url']] = TRUE;
                    $num_smilies++;
                }
            }
            unset($rowset2);
            $cache->put('smilies', $rowset);
        }
    }
    if ($num_smilies) {
        $smilies_count = $mode == 'inline' ? min(19, $num_smilies) : $num_smilies;
        $smilies_split_row = $mode == 'inline' ? $inline_columns - 1 : $window_columns - 1;
        $s_colspan = 0;
        $row = 0;
        $col = 0;
        while (list(, $data) = @each($rowset)) {
            if (!$col) {
                $template->assign_block_vars('smilies_row', array());
            }
            $template->assign_block_vars('smilies_row.smilies_col', array('SMILEY_CODE' => $data['code'], 'SMILEY_IMG' => $images['smiles'] . '/' . $data['smile_url'], 'SMILEY_DESC' => $data['emoticon']));
            $s_colspan = max($s_colspan, $col + 1);
            if ($col == $smilies_split_row) {
                if ($mode == 'inline' && $row == $inline_rows - 1) {
                    break;
                }
                $col = 0;
                $row++;
            } else {
                $col++;
            }
        }
        if ($mode == 'inline' && $num_smilies > $inline_rows * $inline_columns) {
            $template->assign_block_vars('switch_smilies_extra', array());
            $template->assign_vars(array('L_MORE_SMILIES' => $lang['More_emoticons'], 'U_MORE_SMILIES' => append_sid("posting.{$phpEx}?mode=smilies")));
        }
        $template->assign_vars(array('L_EMOTICONS' => $lang['Emoticons'], 'L_CLOSE_WINDOW' => $lang['Close_window'], 'S_SMILIES_COLSPAN' => $s_colspan));
    }
    if ($mode == 'window') {
        $template->pparse('smiliesbody');
        include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
    }
}
include_once $phpbb_root_path . 'includes/template.' . $phpEx;
include_once $phpbb_root_path . 'includes/sessions.' . $phpEx;
include_once $phpbb_root_path . 'includes/auth.' . $phpEx;
include_once $phpbb_root_path . 'includes/functions.' . $phpEx;
include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
include_once $phpbb_root_path . 'includes/functions_post.' . $phpEx;
$html_entities_match = array('#&#', '#<#', '#>#');
$html_entities_replace = array('&amp;', '&lt;', '&gt;');
$error = FALSE;
$submit = isset($_REQUEST['post']) ? TRUE : 0;
$site_url = '';
$site_info = array();
$from_username = '';
$to_username = '';
// Set up default style and language info
init_userprefs(array());
function unprocess_var($var)
{
    global $bbcode_parse;
    $var = trim(strip_tags($bbcode_parse->undo_htmlspecialchars($var)));
    return $var;
}
$site_url = !empty($_REQUEST['site_url']) ? unprocess_var($_REQUEST['site_url']) : '';
if (empty($site_url)) {
    $msg = $lang['Network_no_siteurl'] . $append_msg;
    message_die(GENERAL_ERROR, $msg);
} else {
    $sql = 'SELECT site_id FROM ' . IM_SITES_TABLE . ' WHERE site_url = \'' . $site_url . '\'';
    if (!($result = $db->sql_query($sql))) {
        $msg = 'Could not get Site to Site information' . $append_msg;
        message_die(GENERAL_ERROR, $msg);
Example #7
0
    $www_img = $row['user_website'] ? '<a href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" style="border:0;" /></a>' : '';
    $www = $row['user_website'] ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : '';
    $temp_url = URL::index("Forums&amp;file=search&amp;search_author=" . urlencode($row['user_id']) . "&amp;showresults=posts");
    $search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . $lang['Search_user_posts'] . '" style="border:0;" /></a>';
    $search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
    return;
}
//
// --------------------------
if (isset($_POST['cancel'])) {
    URL::redirect(URL::index());
}
//
// Start session management
//
init_userprefs($userinfo);
//
// End session management
//
if (isset($_GET['g']) || isset($_POST['g'])) {
    $group_id = isset($_POST['g']) ? intval($_POST['g']) : intval($_GET['g']);
} else {
    $group_id = false;
}
if (isset($_POST['mode']) || isset($_GET['mode'])) {
    $mode = htmlprepare(isset($_POST['mode']) ? $_POST['mode'] : $_GET['mode']);
} else {
    $mode = '';
}
//
// Default var values
function topic_review($topic_id, $is_inline_review)
{
    global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
    global $userdata, $user_ip;
    global $orig_word, $replacement_word;
    global $starttime;
    if (!$is_inline_review) {
        if (!isset($topic_id)) {
            message_die(GENERAL_MESSAGE, 'Topic_not_exist');
        }
        //
        // Get topic info ...
        //
        $sql = "SELECT t.topic_title, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments \n\t\t\tFROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f \n\t\t\tWHERE t.topic_id = {$topic_id}\n\t\t\t\tAND f.forum_id = t.forum_id";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
        }
        if (!($forum_row = $db->sql_fetchrow($result))) {
            message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
        }
        $db->sql_freeresult($result);
        $forum_id = $forum_row['forum_id'];
        $topic_title = $forum_row['topic_title'];
        //
        // Start session management
        //
        $userdata = session_pagestart($user_ip, $forum_id);
        init_userprefs($userdata);
        //
        // End session management
        //
        $is_auth = array();
        $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_row);
        if (!$is_auth['auth_read']) {
            message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']));
        }
    }
    //
    // Define censored word matches
    //
    if (empty($orig_word) && empty($replacement_word)) {
        $orig_word = array();
        $replacement_word = array();
        obtain_word_list($orig_word, $replacement_word);
    }
    //
    // Dump out the page header and load viewtopic body template
    //
    if (!$is_inline_review) {
        $gen_simple_header = TRUE;
        $page_title = $lang['Topic_review'] . ' - ' . $topic_title;
        include $phpbb_root_path . 'includes/page_header.' . $phpEx;
        $template->set_filenames(array('reviewbody' => 'posting_topic_review.tpl'));
    }
    //
    // Go ahead and pull all data for this topic
    //
    $sql = "SELECT u.username, u.user_id, p.*,  pt.post_text, pt.post_subject, pt.bbcode_uid\n\t\tFROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt\n\t\tWHERE p.topic_id = {$topic_id}\n\t\t\tAND p.poster_id = u.user_id\n\t\t\tAND p.post_id = pt.post_id\n\t\tORDER BY p.post_time DESC\n\t\tLIMIT " . $board_config['posts_per_page'];
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not obtain post/user information', '', __LINE__, __FILE__, $sql);
    }
    //
    // Okay, let's do the loop, yeah come on baby let's do the loop
    // and it goes like this ...
    //
    if ($row = $db->sql_fetchrow($result)) {
        $mini_post_img = $images['icon_minipost'];
        $mini_post_alt = $lang['Post'];
        $i = 0;
        do {
            $poster_id = $row['user_id'];
            $poster = $row['username'];
            $post_date = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']);
            //
            // Handle anon users posting with usernames
            //
            if ($poster_id == ANONYMOUS && $row['post_username'] != '') {
                $poster = $row['post_username'];
                $poster_rank = $lang['Guest'];
            } elseif ($poster_id == ANONYMOUS) {
                $poster = $lang['Guest'];
                $poster_rank = '';
            }
            $post_subject = $row['post_subject'] != '' ? $row['post_subject'] : '';
            $message = $row['post_text'];
            $bbcode_uid = $row['bbcode_uid'];
            //
            // If the board has HTML off but the post has HTML
            // on then we process it, else leave it alone
            //
            if (!$board_config['allow_html'] && $row['enable_html']) {
                $message = preg_replace('#(<)([\\/]?.*?)(>)#is', '&lt;\\2&gt;', $message);
            }
            if ($bbcode_uid != "") {
                $message = $board_config['allow_bbcode'] ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $message);
            }
            $message = make_clickable($message);
            if (count($orig_word)) {
                $post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
                $message = preg_replace($orig_word, $replacement_word, $message);
            }
            if ($board_config['allow_smilies'] && $row['enable_smilies']) {
                $message = smilies_pass($message);
            }
            $message = str_replace("\n", '<br />', $message);
            //
            // Again this will be handled by the templating
            // code at some point
            //
            $row_color = !($i % 2) ? $theme['td_color1'] : $theme['td_color2'];
            $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
            $template->assign_block_vars('postrow', array('ROW_COLOR' => '#' . $row_color, 'ROW_CLASS' => $row_class, 'MINI_POST_IMG' => $mini_post_img, 'POSTER_NAME' => $poster, 'POST_DATE' => $post_date, 'POST_SUBJECT' => $post_subject, 'MESSAGE' => $message, 'L_MINI_POST_ALT' => $mini_post_alt));
            $i++;
        } while ($row = $db->sql_fetchrow($result));
    } else {
        message_die(GENERAL_MESSAGE, 'Topic_post_not_exist', '', __LINE__, __FILE__, $sql);
    }
    $db->sql_freeresult($result);
    $template->assign_vars(array('L_AUTHOR' => $lang['Author'], 'L_MESSAGE' => $lang['Message'], 'L_POSTED' => $lang['Posted'], 'L_POST_SUBJECT' => $lang['Post_subject'], 'L_TOPIC_REVIEW' => $lang['Topic_review']));
    if (!$is_inline_review) {
        $template->pparse('reviewbody');
        include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
    }
}
Example #9
0
function generate_smilies($mode)
{
    global $ft_cfg, $template, $lang, $images, $theme;
    global $user_ip, $session_length, $starttime;
    global $userdata;
    $inline_columns = 4;
    $inline_rows = 7;
    $window_columns = 8;
    if ($mode == 'window') {
        $userdata = session_pagestart($user_ip);
        init_userprefs($userdata);
        $gen_simple_header = TRUE;
        $page_title = $lang['Emoticons'] . " - {$topic_title}";
        require FT_ROOT . 'includes/page_header.php';
        $template->set_filenames(array('smiliesbody' => 'posting_smilies.tpl'));
    }
    $sql = "SELECT emoticon, code, smile_url\n\t\tFROM " . SMILIES_TABLE . "\n\t\tORDER BY smilies_id";
    if ($result = DB()->sql_query($sql)) {
        $num_smilies = 0;
        $rowset = array();
        while ($row = DB()->sql_fetchrow($result)) {
            if (empty($rowset[$row['smile_url']])) {
                $rowset[$row['smile_url']]['code'] = str_replace("'", "\\'", str_replace('\\', '\\\\', $row['code']));
                $rowset[$row['smile_url']]['emoticon'] = $row['emoticon'];
                $num_smilies++;
            }
        }
        if ($num_smilies) {
            $smilies_count = $mode == 'inline' ? min(19, $num_smilies) : $num_smilies;
            $smilies_split_row = $mode == 'inline' ? $inline_columns - 1 : $window_columns - 1;
            $s_colspan = 0;
            $row = 0;
            $col = 0;
            while (list($smile_url, $data) = @each($rowset)) {
                if (!$col) {
                    $template->assign_block_vars('smilies_row', array());
                }
                $template->assign_block_vars('smilies_row.smilies_col', array('SMILEY_CODE' => $data['code'], 'SMILEY_IMG' => $ft_cfg['smilies_path'] . '/' . $smile_url, 'SMILEY_DESC' => $data['emoticon']));
                $s_colspan = max($s_colspan, $col + 1);
                if ($col == $smilies_split_row) {
                    if ($mode == 'inline' && $row == $inline_rows - 1) {
                        break;
                    }
                    $col = 0;
                    $row++;
                } else {
                    $col++;
                }
            }
            if ($mode == 'inline' && $num_smilies > $inline_rows * $inline_columns) {
                $template->assign_block_vars('switch_smilies_extra', array());
                $template->assign_vars(array('L_MORE_SMILIES' => $lang['More_emoticons'], 'U_MORE_SMILIES' => append_sid("posting.php?mode=smilies")));
            }
            $template->assign_vars(array('L_EMOTICONS' => $lang['Emoticons'], 'L_CLOSE_WINDOW' => $lang['Close_window'], 'S_SMILIES_COLSPAN' => $s_colspan));
        }
    }
    if ($mode == 'window') {
        $template->pparse('smiliesbody');
        require FT_ROOT . 'includes/page_tail.php';
    }
}
Example #10
0
function charmap($page_id)
{
    global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
    global $user_ip, $session_length, $starttime;
    global $userdata;
    // ensure categories hierarchy v2.1.x compliancy
    if (!empty($board_config['mod_cat_hierarchy'])) {
        global $config, $user, $censored_words, $icons, $navigation, $themes, $smilies;
        global $forums, $forum_id;
        // fix this missing var
        $topic_title = '';
        $forum_id = intval($forum_id);
        if (empty($forum_id)) {
            $forum_id = _read(POST_FORUM_URL, TYPE_INT);
        }
    }
    $userdata = session_pagestart($user_ip, $page_id);
    init_userprefs($userdata);
    // bbc box language file
    if ($userdata['user_id'] != ANONYMOUS) {
        if (!empty($userdata['user_lang'])) {
            $board_config['default_lang'] = $userdata['user_lang'];
        }
    }
    if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_bbc_box.' . $phpEx))) {
        $board_config['default_lang'] = 'english';
    }
    include_once $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_bbc_box.' . $phpEx;
    $gen_simple_header = TRUE;
    $page_title = $lang['charmap_page'] . " - {$topic_title}";
    include $phpbb_root_path . 'includes/page_header.' . $phpEx;
    $template->set_filenames(array('chrpopup' => 'bbc_chr_popup.tpl'));
    $template->assign_vars(array('L_CHARMAP_TITLE' => $lang['charmap_title'], 'L_CLOSE_WINDOW' => $lang['Close_window'], 'BBC_CHR_SHEET' => $images['bbc_chr_sheet']));
    $template->pparse('chrpopup');
}
Example #11
0
function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '')
{
    global $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path, $nav_links, $gen_simple_header, $images;
    global $userdata, $user_ip, $session_length;
    global $starttime;
    //-- mod : rank color system ---------------------------------------------------
    //-- add
    global $get;
    //-- fin mod : rank color system -----------------------------------------------
    if (defined('HAS_DIED')) {
        die("message_die() was called multiple times. This isn't supposed to happen. Was message_die() used in page_tail.php?");
    }
    define('HAS_DIED', 1);
    $sql_store = $sql;
    //
    // Get SQL error if we are debugging. Do this as soon as possible to prevent
    // subsequent queries from overwriting the status of sql_error()
    //
    if (DEBUG && ($msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR)) {
        $sql_error = $db->sql_error();
        $debug_text = '';
        if ($sql_error['message'] != '') {
            switch ($sql_error['code']) {
                case '1050':
                    $sql_error['help'] = $lang['SQL_exist_error'];
                    break;
                case '1062':
                    $sql_error['help'] = $lang['SQL_duplicate_error'];
                    break;
                case '1064':
                    $sql_error['help'] = $lang['SQL_syntax_error'];
                    break;
            }
            $sql_error['help'] .= isset($sql_error['help']) ? '<br /><br />' : '';
            $debug_text .= '<br /><br />' . $sql_error['help'] . '<b>' . $lang['DEBUG_sql_error'] . ':</b> ' . $sql_error['code'] . ' ' . $sql_error['message'];
        }
        if ($sql_store != '') {
            $debug_text .= '<br /><br /><div align="left">
					<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center">
						<tr> 
	  						<td><span class="genmed"><b>' . $lang['DEBUG_sql_query'] . ':</b></span></td>
						</tr>
						<tr>
	  						<td class="code">' . $sql_store . '</td>
						</tr>
					</table></div>';
        }
        /*
        		if (empty($err_line) || empty($err_file))
        		{
        			echo '<pre>';
        			debug_print_backtrace();
        			echo '</pre>';
        		}*/
        if ($err_line != '' && $err_file != '') {
            //
            // On va ouvrir le fichier incriminé et récupéré ll ligne de l'erreur ainsi que la ligne suivante et les 5 lignes précédentes
            //
            $file_array = array();
            $file_array = explode('/', $err_file);
            $file_name = $file_array[count($file_array) - 1];
            $dir_name = $file_array[count($file_array) - 2];
            if ($dir_name == 'includes') {
                $phpbb_relativ_path = $phpbb_root_path . 'includes/';
            } else {
                if (ereg('^lang_', $dir_name)) {
                    $phpbb_relativ_path = $phpbb_root_path . 'language/' . $dir_name . '/';
                } else {
                    if ($dir_name == 'admin') {
                        $phpbb_relativ_path = $phpbb_root_path . 'admin/';
                    } else {
                        // V: fix that for windows
                        // maybe that broke it on oter systems :D
                        $phpbb_relativ_path = '';
                        //$phpbb_root_path;
                    }
                }
            }
            $file_code_array = array();
            $file_code_array = @file($phpbb_relativ_path . $file_name);
            // rajoutez des données dans le tableau si vous souhaitez effectuer un débuggage plus large
            $loop_number = range(10, 0);
            // décalage, permet d'afficher des lignes + loin
            $offset = 3;
            $file_code_draw = '';
            for ($i = 0; $i < count($loop_number); $i++) {
                $curline = $err_line - $loop_number[$i] + 1 + $offset;
                $file_code_draw .= '<b>' . $lang['DEBUG_line'] . '-' . $curline . ($curline == $err_line ? '!' : ':') . '</b>&nbsp;&nbsp;' . $file_code_array[$err_line - $loop_number[$i] + $offset] . '<br />';
            }
            // pour éviter toute faille de sécurité il n y aura jamais de débuggage dans config.php
            $file_code_draw = ereg('^config.' . $phpEx . '$', $file_name) ? '' : $file_code_draw;
            $debug_text .= '<blockquote><div align="left"><br />
						<b>' . $lang['DEBUG_line'] . ':</b> ' . $err_line . '<br />
						<b>' . $lang['DEBUG_file'] . ':</b> ' . $err_file . '</div></blockquote>';
            if ($file_code_draw != '') {
                $debug_text .= '<br /><div align="left">
					<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center">
						<tr> 
	  						<td><span class="genmed"><b>' . $lang['DEBUG_code_debbuger'] . ':</b></span></td>
						</tr>
						<tr>
	  						<td class="code">' . $file_code_draw . '</td>
						</tr>
					</table></div>';
            }
        }
    }
    if (empty($userdata) && ($msg_code == GENERAL_MESSAGE || $msg_code == GENERAL_ERROR)) {
        $userdata = session_pagestart($user_ip, PAGE_INDEX);
        init_userprefs($userdata);
    }
    //
    // If the header hasn't been output then do it
    //
    if (!defined('HEADER_INC') && $msg_code != CRITICAL_ERROR) {
        if (empty($lang)) {
            if (!empty($board_config['default_lang'])) {
                include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx;
            } else {
                include $phpbb_root_path . 'language/lang_french/lang_main.' . $phpEx;
            }
            //-- mod : language settings ---------------------------------------------------
            //-- add
            include $phpbb_root_path . 'includes/lang_extend_mac.' . $phpEx;
            //-- fin mod : language settings -----------------------------------------------
        }
        if (empty($template) || empty($theme)) {
            $theme = setup_style($board_config['default_style']);
        }
        $toggle_unreads_link = true;
        //
        // Load the Page Header
        //
        if (!defined('IN_ADMIN')) {
            include $phpbb_root_path . 'includes/page_header.' . $phpEx;
        } else {
            include $phpbb_root_path . 'admin/page_header_admin.' . $phpEx;
        }
    }
    switch ($msg_code) {
        case GENERAL_MESSAGE:
            if ($msg_title == '') {
                $msg_title = $lang['Information'];
            }
            break;
        case CRITICAL_MESSAGE:
            if ($msg_title == '') {
                $msg_title = $lang['Critical_Information'];
            }
            break;
        case GENERAL_ERROR:
            if ($msg_text == '') {
                $msg_text = $lang['An_error_occured'];
            }
            if ($msg_title == '') {
                $msg_title = $lang['General_Error'];
            }
            break;
        case CRITICAL_ERROR:
            //
            // Critical errors mean we cannot rely on _ANY_ DB information being
            // available so we're going to dump out a simple echo'd statement
            //
            include $phpbb_root_path . 'language/lang_french/lang_main.' . $phpEx;
            if ($msg_text == '') {
                $msg_text = $lang['A_critical_error'];
            }
            if ($msg_title == '') {
                $msg_title = 'phpBB : <b>' . $lang['Critical_Error'] . '</b>';
            }
            break;
    }
    //
    // Add on DEBUG info if we've enabled debug mode and this is an error. This
    // prevents debug info being output for general messages should DEBUG be
    // set TRUE by accident (preventing confusion for the end user!)
    //
    if (DEBUG && ($msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR)) {
        if ($debug_text != '') {
            $msg_text = $msg_text . '<br /><br /><b><u>' . $lang['DEBUG'] . '</u></b>' . $debug_text;
        }
    }
    if ($msg_code != CRITICAL_ERROR) {
        if (!empty($lang[$msg_text])) {
            $msg_text = $lang[$msg_text];
        }
        if (!defined('IN_ADMIN')) {
            $template->set_filenames(array('message_body' => 'message_body.tpl'));
        } else {
            $template->set_filenames(array('message_body' => 'admin/admin_message_body.tpl'));
        }
        $template->assign_vars(array('MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text));
        $template->pparse('message_body');
        if (!defined('IN_ADMIN')) {
            include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
        } else {
            include $phpbb_root_path . 'admin/page_footer_admin.' . $phpEx;
        }
    } else {
        echo "<html>\n<body>\n" . $msg_title . "\n<br /><br />\n" . $msg_text . "</body>\n</html>";
    }
    exit;
}
Example #12
0
function generate_post_images($mode, $page_id)
{
    global $db, $board_config, $template, $lang, $images, $phpbb_theme, $phpEx, $phpbb_root_path, $msg_icon;
    global $user_ip, $session_length, $starttime;
    global $userdata;
    $inline_columns = 8;
    $inline_rows = 2;
    $window_columns = 9;
    if ($mode == 'window') {
        $userdata = session_pagestart($user_ip, $page_id);
        init_userprefs($userdata);
        global $gen_simple_header;
        $gen_simple_header = TRUE;
        $page_title = $lang['Review_topic'] . " - {$topic_title}";
        include $phpbb_root_path . 'includes/page_header.php';
        $template->set_filenames(array('postimagesbody' => 'posting_images.tpl'));
    } else {
        $template->set_filenames(array('postimagesbody' => 'post_images_body.tpl'));
    }
    $dir = @opendir($board_config['path_posticons']);
    $post_images = array();
    $num_post_images = 0;
    while ($file = @readdir($dir)) {
        if (preg_match('/image_(\\d+)\\.gif$/is', $file, $num)) {
            if ($num[1] > 0 and $num[1] < 256) {
                $post_images[$num_post_images] = $num[1];
                $num_post_images++;
            }
        }
    }
    @closedir($dir);
    if ($num_post_images) {
        @sort($post_images, SORT_NUMERIC);
        @reset($post_images);
        $post_images_count = $mode == 'inline' ? min(19, $num_post_images) : $num_post_images;
        $post_images_split_row = $mode == 'inline' ? $inline_columns - 1 : $window_columns - 1;
        $s_colspan = 0;
        $row = 0;
        $col = 0;
        for ($i = 0; $i < count($post_images); $i++) {
            if (!$col) {
                $template->assign_block_vars('post_images_row', array());
            }
            $template->assign_block_vars('post_images_row.post_images_column', array('POST_IMAGE' => $board_config['path_posticons'] . "/image_" . $post_images[$i] . ".gif", 'POST_IMAGE_NUM' => $post_images[$i], 'POST_IMAGE_CHECKED' => $msg_icon == $post_images[$i] ? "checked" : "", 'POST_IMAGE_NAME' => $post_images[$i]));
            $s_colspan = max($s_colspan, $col + 1);
            if ($col == $post_images_split_row) {
                //				if ($mode == 'inline' && $row == $inline_rows - 1)
                //				{
                //					break;
                //				}
                $col = 0;
                $row++;
            } else {
                $col++;
            }
        }
        //
        //		if ($mode == 'inline' && $num_post_images > $inline_rows * $inline_columns)
        //		{
        //			$template->assign_block_vars('switch_post_images_extra', array());
        //
        //			$template->assign_vars(array(
        //				'L_MORE_POST_IMAGES' => $lang['More_msg_icons'],
        //				'U_MORE_POST_IMAGE' => append_sid("posting.$phpEx?mode=postimages"))
        //			);
        //		}
        $template->assign_vars(array('L_MSG_ICONS' => $lang['Msg_Icons'], 'L_MSG_ICON_NO_ICON' => $lang['Msg_Icon_No_Icon'], 'L_CLOSE_WINDOW' => $lang['Close_window'], 'POSTICONS_SIZE' => $board_config['posticons_size'], 'S_POST_IMAGE_COLSPAN' => $s_colspan));
    }
    //	$post_images_col_count++;
    //	if ( $post_images_col_count == 7 )
    //	{
    //		$post_images_row_count++;
    //		$template->assign_block_vars("post_images_row", array());
    //		$post_images_col_count = 0;
    //	}
    if ($mode == 'window') {
        $template->pparse('postimagesbody');
        include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
        exit;
        // ZphpBB2 added
    } else {
        $template->assign_var_from_handle('POSTIMAGES', 'postimagesbody');
    }
    return $num_post_images;
}
Example #13
0
function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '')
{
    // Begin PNphpBB2 Module
    //	global $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path, $nav_links, $gen_simple_header, $images;
    global $db, $template, $board_config, $phpbb_theme, $lang, $phpEx, $phpbb_root_path, $nav_links, $images;
    // End PNphpBB2 Module
    global $userdata, $user_ip, $session_length;
    global $starttime;
    if (defined('HAS_DIED')) {
        die("message_die() was called multiple times. This isn't supposed to happen. Was message_die() used in page_tail.php?");
    }
    define('HAS_DIED', 1);
    $sql_store = $sql;
    //
    // Get SQL error if we are debugging. Do this as soon as possible to prevent
    // subsequent queries from overwriting the status of sql_error()
    //
    if (DEBUG && ($msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR)) {
        $sql_error = $db->sql_error();
        $debug_text = '';
        if ($sql_error['message'] != '') {
            $debug_text .= '<br /><br />SQL Error : ' . $sql_error['code'] . ' ' . $sql_error['message'];
        }
        if ($sql_store != '') {
            $debug_text .= "<br /><br />{$sql_store}";
        }
        if ($err_line != '' && $err_file != '') {
            $debug_text .= '<br /><br />Line : ' . $err_line . '<br />File : ' . basename($err_file);
        }
    }
    if (empty($userdata) && ($msg_code == GENERAL_MESSAGE || $msg_code == GENERAL_ERROR)) {
        $userdata = session_pagestart($user_ip, PAGE_INDEX);
        init_userprefs($userdata);
    }
    //
    // If the header hasn't been output then do it
    //
    if (!defined('HEADER_INC') && $msg_code != CRITICAL_ERROR) {
        if (empty($lang)) {
            if (!empty($board_config['default_lang'])) {
                include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx;
            } else {
                include $phpbb_root_path . 'language/lang_english/lang_main.' . $phpEx;
            }
        }
        // Begin PNphpBB2 Module
        if (empty($template) || empty($phpbb_theme)) {
            $phpbb_theme = setup_style($board_config['default_style']);
        }
        // End PNphpBB2 Module
        //
        // Load the Page Header
        //
        if (!defined('IN_ADMIN')) {
            include $phpbb_root_path . 'includes/page_header.' . $phpEx;
        } else {
            include $phpbb_root_path . 'admin/page_header_admin.' . $phpEx;
        }
    }
    switch ($msg_code) {
        case GENERAL_MESSAGE:
            if ($msg_title == '') {
                $msg_title = $lang['Information'];
            }
            break;
        case CRITICAL_MESSAGE:
            if ($msg_title == '') {
                $msg_title = $lang['Critical_Information'];
            }
            break;
        case GENERAL_ERROR:
            if ($msg_text == '') {
                $msg_text = $lang['An_error_occured'];
            }
            if ($msg_title == '') {
                $msg_title = $lang['General_Error'];
            }
            break;
        case CRITICAL_ERROR:
            //
            // Critical errors mean we cannot rely on _ANY_ DB information being
            // available so we're going to dump out a simple echo'd statement
            //
            include $phpbb_root_path . 'language/lang_english/lang_main.' . $phpEx;
            if ($msg_text == '') {
                $msg_text = $lang['A_critical_error'];
            }
            if ($msg_title == '') {
                // Begin PNphpBB2 Module
                //				$msg_title = 'phpBB : <b>' . $lang['Critical_Error'] . '</b>';
                $msg_title = 'ZphpBB2 : <b>' . $lang['Critical_Error'] . '</b>';
                // End PNphpBB2 Module
            }
            break;
    }
    //
    // Add on DEBUG info if we've enabled debug mode and this is an error. This
    // prevents debug info being output for general messages should DEBUG be
    // set TRUE by accident (preventing confusion for the end user!)
    //
    if (DEBUG && ($msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR)) {
        if ($debug_text != '') {
            $msg_text = $msg_text . '<br /><br /><b><u>DEBUG MODE</u></b>' . $debug_text;
        }
    }
    if ($msg_code != CRITICAL_ERROR) {
        if (!empty($lang[$msg_text])) {
            $msg_text = $lang[$msg_text];
        }
        if (!defined('IN_ADMIN')) {
            $template->set_filenames(array('message_body' => 'message_body.tpl'));
        } else {
            $template->set_filenames(array('message_body' => 'admin/admin_message_body.tpl'));
        }
        $template->assign_vars(array('MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text));
        ob_start();
        // ZphpBB2
        $template->pparse('message_body');
        $content = ob_get_contents();
        // ZphpBB2
        ob_end_clean();
        // ZphpBB2
        if (!defined('IN_ADMIN')) {
            include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
        } else {
            echo $content;
            // ZphpBB2
            include $phpbb_root_path . 'admin/page_footer_admin.' . $phpEx;
        }
    } else {
        echo "<html>\n<body>\n" . $msg_title . "\n<br /><br />\n" . $msg_text . "</body>\n</html>";
    }
    // ZphpBB2 =>
    if (defined('IN_ADMIN')) {
        exit;
    } else {
        if (Zikula_Core::VERSION_NUM >= '1.4.0') {
            LogUtil::registerStatus($content);
            System::redirect(ModUtil::url('ZphpBB2', 'user', 'message'));
        } else {
            echo $content;
            Zikula_View_Theme::getInstance()->themefooter();
            System::shutdown();
        }
    }
    //exit;
    // <= ZphpBB2
}
Example #14
0
function session_pagestart($user_ip, $thispage_id)
{
    global $db, $lang, $board_config;
    global $SID;
    $cookiename = $board_config['cookie_name'];
    $cookiepath = $board_config['cookie_path'];
    $cookiedomain = $board_config['cookie_domain'];
    $cookiesecure = $board_config['cookie_secure'];
    $current_time = time();
    unset($userdata);
    if (isset($_COOKIE[$cookiename . '_sid']) || isset($_COOKIE[$cookiename . '_data'])) {
        $sessiondata = isset($_COOKIE[$cookiename . '_data']) ? unserialize(stripslashes($_COOKIE[$cookiename . '_data'])) : array();
        $session_id = isset($_COOKIE[$cookiename . '_sid']) ? $_COOKIE[$cookiename . '_sid'] : '';
        $sessionmethod = SESSION_METHOD_COOKIE;
    } else {
        $sessiondata = array();
        $session_id = isset($_GET['sid']) ? $_GET['sid'] : '';
        $sessionmethod = SESSION_METHOD_GET;
    }
    //
    if (!preg_match('/^[A-Za-z0-9]*$/', $session_id)) {
        $session_id = '';
    }
    $thispage_id = (int) $thispage_id;
    //
    // Does a session exist?
    //
    if (!empty($session_id)) {
        //
        // session_id exists so go ahead and attempt to grab all
        // data in preparation
        //
        $sql = "SELECT u.*, s.*\n            FROM " . SESSIONS_TABLE . " s, " . USERS_TABLE . " u\n            WHERE s.session_id = '{$session_id}'\n                AND u.user_id = s.session_user_id";
        if (!($result = $db->sql_query($sql))) {
            message_die(CRITICAL_ERROR, 'Error doing DB query userdata row fetch', '', __LINE__, __FILE__, $sql);
        }
        $userdata = $db->sql_fetchrow($result);
        //
        // Did the session exist in the DB?
        //
        if (isset($userdata['user_id'])) {
            // Begin PNphpBB2 Module
            // OK we found a session, now determine if it should be logged in or not
            // Fix by Allan (Poster on PNphpBB.com)
            /* Adsense interferes with PNphpBB2 session handling.
             * Adsense agent scans the page to find relevant words
             * and appears as an anonymous user, forcing the expire
             * of the session.
             */
            $is_adsense = isset($_SERVER['HTTP_USER_AGENT']) && strstr($_SERVER['HTTP_USER_AGENT'], 'Google');
            if (!UserUtil::isLoggedIn() && $userdata['user_id'] != ANONYMOUS && !$is_adsense) {
                // PN user not logged in so this session should not be logged in.
                session_end($userdata['session_id'], $userdata['user_id']);
                unset($sessiondata['userid']);
                if (!($userdata = session_begin(ANONYMOUS, $user_ip, $thispage_id, FALSE))) {
                    message_die(CRITICAL_ERROR, 'Error creating user session', '', __LINE__, __FILE__, $sql);
                }
                init_userprefs($userdata);
                return $userdata;
            }
            if (UserUtil::isLoggedIn() && $userdata['user_id'] != UserUtil::getVar('uid')) {
                // PN user not logged in so this session should not be logged in.
                session_end($userdata['session_id'], $userdata['user_id']);
                if (!($userdata = session_begin(UserUtil::getVar('uid'), $user_ip, $thispage_id, FALSE))) {
                    message_die(CRITICAL_ERROR, 'Error creating user session', '', __LINE__, __FILE__, $sql);
                }
            }
            // End PNphpBB2 Module
            //
            // Do not check IP assuming equivalence, if IPv4 we'll check only first 24
            // bits ... I've been told (by vHiker) this should alleviate problems with
            // load balanced et al proxies while retaining some reliance on IP security.
            //
            $ip_check_s = substr($userdata['session_ip'], 0, 6);
            $ip_check_u = substr($user_ip, 0, 6);
            if ($ip_check_s == $ip_check_u) {
                $SID = $sessionmethod == SESSION_METHOD_GET || defined('IN_ADMIN') ? 'sid=' . $session_id : '';
                //
                // Only update session DB a minute or so after last update
                //
                if ($current_time - $userdata['session_time'] > 60) {
                    // A little trick to reset session_admin on session re-usage
                    // Begin PNphpBB2 Module
                    //					$update_admin = (!defined('IN_ADMIN') && $current_time - $userdata['session_time'] > ($board_config['session_length']+60)) ? ', session_admin = 0' : '';
                    // End PNphpBB2 Module
                    $sql = "UPDATE " . SESSIONS_TABLE . " \n                        SET session_time = {$current_time}, session_page = {$thispage_id}{$update_admin}\n                        WHERE session_id = '" . $userdata['session_id'] . "'";
                    if (!$db->sql_query($sql)) {
                        message_die(CRITICAL_ERROR, 'Error updating sessions table', '', __LINE__, __FILE__, $sql);
                    }
                    if ($userdata['user_id'] != ANONYMOUS) {
                        $sql = "UPDATE " . USERS_TABLE . " \n                            SET user_session_time = {$current_time}, user_session_page = {$thispage_id}\n                            WHERE user_id = " . $userdata['user_id'];
                        if (!$db->sql_query($sql)) {
                            message_die(CRITICAL_ERROR, 'Error updating sessions table', '', __LINE__, __FILE__, $sql);
                        }
                    }
                    session_clean($userdata['session_id']);
                    setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
                    setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);
                }
                // Add the session_key to the userdata array if it is set
                if (isset($sessiondata['autologinid']) && $sessiondata['autologinid'] != '') {
                    $userdata['session_key'] = $sessiondata['autologinid'];
                }
                return $userdata;
            }
        }
    }
    //
    // If we reach here then no (valid) session exists. So we'll create a new one,
    // using the cookie user_id if available to pull basic user prefs.
    //
    $user_id = isset($sessiondata['userid']) ? intval($sessiondata['userid']) : ANONYMOUS;
    if (!($userdata = session_begin($user_id, $user_ip, $thispage_id, TRUE))) {
        message_die(CRITICAL_ERROR, 'Error creating user session', '', __LINE__, __FILE__, $sql);
    }
    return $userdata;
}
Example #15
0
function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '')
{
	global $db, $template, $board_config, $theme, $lang, $phpbb_root_path, $nav_links, $gen_simple_header;
	global $userdata, $user_ip, $session_length;
	global $starttime;

	$sql_store = $sql;

	//
	// Get SQL error if we are debugging. Do this as soon as possible to prevent
	// subsequent queries from overwriting the status of sql_error()
	//
	if ( DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) )
	{
		$sql_error = $db->sql_error();

		$debug_text = '';

		if ( $sql_error['message'] != '' )
		{
			$debug_text .= '<br /><br />SQL Error : ' . $sql_error['code'] . ' ' . $sql_error['message'];
		}

		if ( $sql_store != '' )
		{
			$debug_text .= "<br /><br />$sql_store";
		}

		if ( $err_line != '' && $err_file != '' )
		{
			$debug_text .= '</br /><br />Line : ' . $err_line . '<br />File : ' . $err_file;
		}
	}

	if( empty($userdata) && ( $msg_code == GENERAL_MESSAGE || $msg_code == GENERAL_ERROR ) )
	{
		$userdata = session_pagestart($user_ip, PAGE_INDEX);
		init_userprefs($userdata);
	}

	//
	// If the header hasn't been output then do it
	//
	if ( !defined('HEADER_INC') && $msg_code != CRITICAL_ERROR )
	{
		if ( empty($lang) )
		{
			if ( !empty($board_config['default_lang']) )
			{
				include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.php');
			}
			else
			{
				include($phpbb_root_path . 'language/lang_english/lang_main.php');
			}
		}

		if ( empty($template) )
		{
			$template = new Template($phpbb_root_path . 'templates/' . $board_config['board_template']);
		}
		if ( empty($theme) )
		{
			$theme = setup_style($board_config['default_style']);
		}

		//
		// Load the Page Header
		//
		if ( !defined('IN_ADMIN') )
		{
			include($phpbb_root_path . 'includes/page_header.php');
		}
		else
		{
			include($phpbb_root_path . 'admin/page_header_admin.php');
		}
	}

	switch($msg_code)
	{
		case GENERAL_MESSAGE:
			if ( $msg_title == '' )
			{
				$msg_title = $lang['Information'];
			}
			break;

		case CRITICAL_MESSAGE:
			if ( $msg_title == '' )
			{
				$msg_title = $lang['Critical_Information'];
			}
			break;

		case GENERAL_ERROR:
			if ( $msg_text == '' )
			{
				$msg_text = $lang['An_error_occured'];
			}

			if ( $msg_title == '' )
			{
				$msg_title = $lang['General_Error'];
			}
			break;

		case CRITICAL_ERROR:
			//
			// Critical errors mean we cannot rely on _ANY_ DB information being
			// available so we're going to dump out a simple echo'd statement
			//
			include($phpbb_root_path . 'language/lang_english/lang_main.php');

			if ( $msg_text == '' )
			{
				$msg_text = $lang['A_critical_error'];
			}

			if ( $msg_title == '' )
			{
				$msg_title = 'phpBB : <b>' . $lang['Critical_Error'] . '</b>';
			}
			break;
	}

	//
	// Add on DEBUG info if we've enabled debug mode and this is an error. This
	// prevents debug info being output for general messages should DEBUG be
	// set TRUE by accident (preventing confusion for the end user!)
	//
	if ( DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) )
	{
		if ( $debug_text != '' )
		{
			$msg_text = $msg_text . '<br /><br /><b><u>DEBUG MODE</u></b>' . $debug_text;
		}
	}

	if ( $msg_code != CRITICAL_ERROR )
	{
		if ( !empty($lang[$msg_text]) )
		{
			$msg_text = $lang[$msg_text];
		}

		if ( !defined('IN_ADMIN') )
		{
			$template->set_filenames(array(
				'message_body' => 'message_body.tpl')
			);
		}
		else
		{
			$template->set_filenames(array(
				'message_body' => 'admin/admin_message_body.tpl')
			);
		}

		$template->assign_vars(array(
			'MESSAGE_TITLE' => $msg_title,
			'MESSAGE_TEXT' => $msg_text)
		);
		$template->pparse('message_body');

		if ( !defined('IN_ADMIN') )
		{
			include($phpbb_root_path . 'includes/page_tail.php');
		}
		else
		{
			include($phpbb_root_path . 'admin/page_footer_admin.php');
		}
	}
	else
	{
		echo "<html>\n<body>\n" . $msg_title . "\n<br /><br />\n" . $msg_text . "</body>\n</html>";
	}

	exit;
}
Example #16
0
function generate_smilies($mode, $page_id)
{
    global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
    global $user_ip, $session_length, $starttime;
    global $userdata;
    //-- mod : rank color system ---------------------------------------------------
    //-- add
    global $get;
    //-- fin mod : rank color system -----------------------------------------------
    $inline_columns = 4;
    $inline_rows = 9;
    $window_columns = 8;
    if ($mode == 'window') {
        $userdata = session_pagestart($user_ip, $page_id);
        init_userprefs($userdata);
        $gen_simple_header = TRUE;
        $page_title = $lang['Emoticons'];
        include $phpbb_root_path . 'includes/page_header.' . $phpEx;
        $template->set_filenames(array('smiliesbody' => 'posting_smilies.tpl'));
    } elseif ($mode == 'window_announcement_text') {
        $userdata = session_pagestart($user_ip, $page_id);
        init_userprefs($userdata);
        $gen_simple_header = TRUE;
        $page_title = $lang['Site_Announcement'];
        include $phpbb_root_path . 'includes/page_header.' . $phpEx;
        $template->set_filenames(array('smiliesbody' => 'posting_smilies_announcement_centre_text.tpl'));
    }
    $sql = "SELECT emoticon, code, smile_url   \r\n\t\tFROM " . SMILIES_TABLE . " \r\n\t\tORDER BY smilies_id";
    if ($result = $db->sql_query($sql, false, true)) {
        $num_smilies = 0;
        $rowset = array();
        while ($row = $db->sql_fetchrow($result)) {
            if (empty($rowset[$row['smile_url']])) {
                $rowset[$row['smile_url']]['code'] = str_replace("'", "\\'", str_replace('\\', '\\\\', $row['code']));
                $rowset[$row['smile_url']]['emoticon'] = $row['emoticon'];
                $num_smilies++;
            }
        }
        if ($num_smilies) {
            $smilies_count = $mode == 'inline' ? min(19, $num_smilies) : $num_smilies;
            $smilies_split_row = $mode == 'inline' ? $inline_columns - 1 : $window_columns - 1;
            $s_colspan = 0;
            $row = 0;
            $col = 0;
            while (list($smile_url, $data) = @each($rowset)) {
                if (!$col) {
                    $template->assign_block_vars('smilies_row', array());
                }
                $template->assign_block_vars('smilies_row.smilies_col', array('SMILEY_CODE' => $data['code'], 'SMILEY_IMG' => $board_config['smilies_path'] . '/' . $smile_url, 'SMILEY_DESC' => $data['emoticon']));
                $s_colspan = max($s_colspan, $col + 1);
                if ($col == $smilies_split_row) {
                    if ($mode == 'inline' && $row == $inline_rows - 1) {
                        break;
                    }
                    $col = 0;
                    $row++;
                } else {
                    $col++;
                }
            }
            if ($mode == 'inline' && $num_smilies > $inline_rows * $inline_columns) {
                $template->assign_block_vars('switch_smilies_extra', array());
                $template->assign_vars(array('L_MORE_SMILIES' => $lang['More_emoticons'], 'U_MORE_SMILIES' => append_sid("posting.{$phpEx}?mode=smilies")));
            }
            $template->assign_vars(array('L_EMOTICONS' => $lang['Emoticons'], 'L_CLOSE_WINDOW' => $lang['Close_window'], 'S_SMILIES_COLSPAN' => $s_colspan));
        }
    }
    if ($mode == 'window' || $mode == 'window_announcement_text') {
        $template->pparse('smiliesbody');
        include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
    }
}
Example #17
0
function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '')
{
    global $db, $template, $cpgtpl, $board_config, $theme, $lang, $phpbb_root_path, $gen_simple_header, $images;
    global $userdata, $user_ip;
    if (defined('HAS_DIED')) {
        die("message_die() was called multiple times. This isn't supposed to happen. Was message_die() used in page_tail.php?");
    }
    define('HAS_DIED', 1);
    $sql_store = $sql;
    //
    // Get SQL error if we are debugging. Do this as soon as possible to prevent
    // subsequent queries from overwriting the status of sql_error()
    //
    if (DEBUG && ($msg_code == GENERAL_ERROR || $msg_code == BB_CRITICAL_ERROR)) {
        $sql_error = $db->sql_error();
        $debug_text = '';
        if ($sql_error['message'] != '') {
            $debug_text .= '<br /><br />SQL Error : ' . $sql_error['code'] . ' ' . $sql_error['message'];
        }
        if ($sql_store != '') {
            $debug_text .= "<br /><br />{$sql_store}";
        }
        if ($err_line != '' && $err_file != '') {
            $debug_text .= '</br /><br />Line : ' . $err_line . '<br />File : ' . (is_admin() ? $err_file : basename($err_file));
        }
    }
    if (empty($userdata) && ($msg_code == GENERAL_MESSAGE || $msg_code == GENERAL_ERROR)) {
        $userdata = session_pagestart($user_ip, PAGE_INDEX);
        init_userprefs($userdata);
    }
    //
    // If the header hasn't been output then do it
    //
    if (!defined('HEADER_INC') && $msg_code != BB_CRITICAL_ERROR) {
        if (empty($lang)) {
            if (!empty($board_config['default_lang'])) {
                include 'language/' . $board_config['default_lang'] . '/forums.php';
                //include('language/'.$board_config['default_lang'].'/Forums/lang_admin.php');
            } else {
                include 'language/english/forums.php';
                //include('language/english/Forums/lang_admin.php');
            }
        }
        if (empty($theme)) {
            $theme = setup_style($board_config['default_style']);
        }
        //
        // Load the Page Header
        if (!defined('IN_ADMIN')) {
            $temp = false !== stripos($msg_text, '<br />') ? explode('<br />', $msg_text) : explode('.', $msg_text);
            $paget_text = $temp[0];
            ///$page_title = ' '._BC_DELIM.' ';
            $page_title = !empty($msg_title) ? strip_tags($msg_title) : strip_tags($paget_text);
            include 'includes/phpBB/page_header.php';
        }
    }
    global $cpgdebugger;
    switch ($msg_code) {
        case GENERAL_MESSAGE:
            if ($msg_title == '') {
                $msg_title = !empty($lang[$msg_text]) ? $lang[$msg_text] : $msg_text;
                $msg_title = empty($msg_title) && !empty($msg_text) ? $msg_text : $lang['Information'];
            }
            //$cpgdebugger->handler(E_USER_WARNING, $debug_text.'<br />'.$msg_title.'<br />'.$msg_text, $err_file, $err_line)
            break;
        case CRITICAL_MESSAGE:
            if (!empty($lang[$msg_text])) {
                $msg_text = $lang[$msg_text];
            }
            if ($msg_title == '') {
                $msg_title = $lang['Critical_Information'];
            }
            $cpgdebugger->handler(E_USER_ERROR, $debug_text . '<br />' . $msg_title . '<br />' . $msg_text, $err_file, $err_line);
            return false;
            //break;
        //break;
        case GENERAL_ERROR:
            if (!empty($lang[$msg_text])) {
                $msg_text = $lang[$msg_text];
            }
            if ($msg_text == '') {
                $msg_text = $lang['An_error_occured'];
            }
            if ($msg_title == '') {
                $msg_title = $lang['General_Error'];
            }
            $cpgdebugger->handler(E_USER_ERROR, $debug_text . '<br />' . $msg_title . '<br />' . $msg_text, $err_file, $err_line);
            return false;
            //break;
        //break;
        case BB_CRITICAL_ERROR:
            //
            // Critical errors mean we cannot rely on _ANY_ DB information being
            // available so we're going to dump out a simple echo'd statement
            //
            include 'language/english/forums.php';
            if ($msg_text == '') {
                $msg_text = $lang['A_critical_error'];
            }
            if ($msg_title == '') {
                $msg_title = 'phpBB : <b>' . $lang['Critical_Error'] . '</b>';
            }
            $cpgdebugger->handler(E_USER_ERROR, $debug_text . '<br />' . $msg_title . '<br />' . $msg_text, $err_file, $err_line);
            return false;
            //break;
    }
    //
    // Add on DEBUG info if we've enabled debug mode and this is an error. This
    // prevents debug info being output for general messages should DEBUG be
    // set TRUE by accident (preventing confusion for the end user!)
    //
    if (DEBUG && ($msg_code == GENERAL_ERROR || $msg_code == BB_CRITICAL_ERROR)) {
        if ($debug_text != '') {
            $msg_text = $msg_text . '<br /><br /><b><u>DEBUG MODE</u></b>' . $debug_text;
        }
    }
    if ($msg_code != BB_CRITICAL_ERROR) {
        if (!empty($lang[$msg_text])) {
            $msg_text = $lang[$msg_text];
        }
        $template->assign_vars(array('MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text));
        $template->set_filenames(array('body' => !defined('IN_ADMIN') ? 'forums/message_body.html' : 'forums/admin/admin_message_body.html'));
        if (!defined('IN_ADMIN')) {
            include "includes/phpBB/page_tail.php";
        } else {
            //$template->display('body');
            //$template->destroy();
            //trigger_error('Function message_die() called with depreciated arguments', E_USER_WARNING);
            cpg_error($msg_text, $msg_title);
        }
    } else {
        $cpgdebugger->handler(E_USER_ERROR, $debug_text . '<br />' . $msg_title . '<br />' . $msg_text, $err_file, $err_line);
        //trigger_error($debug_text.'<br />.'$msg_text,E_USER_ERROR, $err_line, $err_file);
        echo "<html>\n<body>\n" . $msg_title . "\n<br /><br />\n" . $msg_text . "</body>\n</html>";
    }
    return false;
}
Example #18
0
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include $phpbb_root_path . 'extension.inc';
include $phpbb_root_path . 'common.' . $phpEx;
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_VIEWONLINE);
init_userprefs($userdata);
//
// End session management
//
//
// Output page header and load viewonline template
//
$page_title = $lang['Who_is_Online'];
include $phpbb_root_path . 'includes/page_header.' . $phpEx;
$template->set_filenames(array('body' => 'viewonline_body.tpl'));
make_jumpbox('viewforum.' . $phpEx);
$template->assign_vars(array('L_WHOSONLINE' => $lang['Who_is_Online'], 'L_ONLINE_EXPLAIN' => $lang['Online_explain'], 'L_USERNAME' => $lang['Username'], 'L_FORUM_LOCATION' => $lang['Forum_Location'], 'L_LAST_UPDATE' => $lang['Last_updated']));
//
// Forum info
//
$sql = "SELECT forum_name, forum_id\n\tFROM " . FORUMS_TABLE;
Example #19
0
 ***************************************************************************/
/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include $phpbb_root_path . 'extension.inc';
include $phpbb_root_path . 'common.' . $phpEx;
include $phpbb_root_path . 'includes/functions_subforums.' . $phpEx;
$user->data = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($user->data);
// Start initial var setup
$forum_id = request_var('f', 0);
$mark_read = request_var('mark', '');
$start = request_var('start', 0);
$sort_days = isset($_REQUEST['st']) ? max(intval($_REQUEST['st']), 0) : (!empty($user->data['user_show_days']) ? ${$user}->data['user_show_days'] : 0);
$sort_key = !empty($_REQUEST['sk']) ? htmlspecialchars($_REQUEST['sk']) : (!empty($user->data['user_sortby_type']) ? $user->data['user_sortby_type'] : 't');
$sort_dir = !empty($_REQUEST['sd']) ? htmlspecialchars($_REQUEST['sd']) : (!empty($user->data['user_sortby_dir']) ? $user->data['user_sortby_dir'] : 'd');
// Check if the user has actually sent a forum ID with his/her request
// If not give them a nice error page.
if (!$forum_id) {
    trigger_error('NO_FORUM');
}
// Grab appropriate forum data
if ($user->data['user_id'] == ANONYMOUS) {
    $sql = 'SELECT *