本文整理汇总了PHP中init_userprefs函数的典型用法代码示例。如果您正苦于以下问题:PHP init_userprefs函数的具体用法?PHP init_userprefs怎么用?PHP init_userprefs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了init_userprefs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Abstractify
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;
}
}
示例2: init
/**
* 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;
}
示例3: privmsg_review
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', '<\\2>', $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']) . ' ' . $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;
//.........这里部分代码省略.........
示例4: message_die
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 == '') {
//.........这里部分代码省略.........
示例5: generate_smilies
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;
}
}
示例6: array
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('&', '<', '>');
$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);
示例7: urlencode
$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&file=search&search_author=" . urlencode($row['user_id']) . "&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
示例8: topic_review
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', '<\\2>', $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);
//.........这里部分代码省略.........
示例9: generate_smilies
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';
}
}
示例10: charmap
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');
}
示例11: message_die
//.........这里部分代码省略.........
}
}
$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> ' . $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 == '') {
示例12: generate_post_images
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;
}
示例13: message_die
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!)
//
//.........这里部分代码省略.........
示例14: session_pagestart
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
//.........这里部分代码省略.........
示例15: message_die
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'];
}
//.........这里部分代码省略.........