function init_imprefs($id, $style_setup = false, $get_default = false)
{
    global $db, $prill_config, $lang, $append_msg, $theme, $template, $images;
    $id = intval($id);
    $im_data = array();
    if ($id == ANONYMOUS || empty($id)) {
        $im_data['current_mode'] = MAIN_MODE;
        return $im_data;
    } else {
        $sql = 'SELECT * FROM ' . IM_PREFS_TABLE . ' WHERE user_id=' . $id;
        if (!($result = $db->sql_query($sql))) {
            // Bad mojo
            $msg = $lang['No_prill_prefs'] . $append_msg;
            message_die(CRITICAL_ERROR, $msg, '', __LINE__, __FILE__, $sql);
        }
        if (!($im_data = $db->sql_fetchrow($result))) {
            $msg = $lang['No_prill_userprefs'] . $append_msg;
            message_die(CRITICAL_ERROR, $msg, '', __LINE__, __FILE__, $sql);
        }
        // Check status of admin overrides
        override_im_settings($im_data, $id, $append_msg);
        if (!$im_data['default_mode']) {
            $im_data['default_mode'] = MAIN_MODE;
        }
        if (!$im_data['current_mode'] || $get_default) {
            $im_data['current_mode'] = MAIN_MODE;
        }
        $end_string = '';
        if ($get_default) {
            $end_string = '&mode_switch=1';
        }
        $width = $im_data['mode' . $im_data['current_mode'] . '_width'];
        $height = $im_data['mode' . $im_data['current_mode'] . '_height'];
        if (!$width) {
            $width = $prill_config['mode' . $im_data['current_mode'] . '_width'];
        }
        if (!$height) {
            $height = $prill_config['mode' . $im_data['current_mode'] . '_height'];
        }
        $frames = !$im_data['use_frames'] ? NO_FRAMES_MODE : FRAMES_MODE;
        $im_data['mode_width'] = $width;
        $im_data['mode_height'] = $height;
        $im_data['mode_string'] = '?mode=' . $frames . '&mode2=' . $im_data['current_mode'] . $end_string;
    }
    // Set the style for the IM Client
    if ($style_setup) {
        if ($prill_config['themes_allow']) {
            if ($id != ANONYMOUS && $im_data['themes_id'] > 0) {
                if ($theme = setup_style($im_data['themes_id'])) {
                    return $im_data;
                }
            }
        }
        $theme = setup_style($prill_config['themes_id']);
    }
    return $im_data;
}
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;
}
Exemple #3
0
 /**
  *  Initialise user settings
  */
 function init_userprefs()
 {
     global $bb_cfg, $theme, $lang, $DeltaTime;
     if (defined('LANG_DIR')) {
         return;
     }
     // prevent multiple calling
     define('DEFAULT_LANG_DIR', LANG_ROOT_DIR . $bb_cfg['default_lang'] . '/');
     define('ENGLISH_LANG_DIR', LANG_ROOT_DIR . 'en/');
     if ($this->data['user_id'] != GUEST_UID) {
         if ($this->data['user_lang'] && $this->data['user_lang'] != $bb_cfg['default_lang']) {
             $bb_cfg['default_lang'] = basename($this->data['user_lang']);
             define('LANG_DIR', LANG_ROOT_DIR . $bb_cfg['default_lang'] . '/');
         }
         if (isset($this->data['user_timezone'])) {
             $bb_cfg['board_timezone'] = $this->data['user_timezone'];
         }
     }
     $this->data['user_lang'] = $bb_cfg['default_lang'];
     $this->data['user_timezone'] = $bb_cfg['board_timezone'];
     if (!defined('LANG_DIR')) {
         define('LANG_DIR', DEFAULT_LANG_DIR);
     }
     require LANG_DIR . 'main.php';
     setlocale(LC_ALL, $bb_cfg['lang'][$this->data['user_lang']]['locale']);
     $theme = setup_style();
     $DeltaTime = new Date_Delta();
     // Handle marking posts read
     if (!IS_GUEST && !empty($_COOKIE[COOKIE_MARK])) {
         $this->mark_read($_COOKIE[COOKIE_MARK]);
     }
     $this->load_opt_js();
     $this->enqueue_ads();
 }
Exemple #4
0
 /**
  *  Initialise user settings
  */
 function init_userprefs()
 {
     global $ft_cfg, $theme, $lang;
     if (defined('LANG_DIR')) {
         return;
     }
     // prevent multiple calling
     define('DEFAULT_LANG_DIR', LANG_ROOT_DIR . 'lang_' . $ft_cfg['default_lang'] . '/');
     define('ENGLISH_LANG_DIR', LANG_ROOT_DIR . 'lang_english/');
     if ($this->data['user_id'] != GUEST_UID) {
         if ($this->data['user_lang'] && $this->data['user_lang'] != $ft_cfg['default_lang']) {
             $ft_cfg['default_lang'] = basename($this->data['user_lang']);
             define('LANG_DIR', LANG_ROOT_DIR . 'lang_' . $ft_cfg['default_lang'] . '/');
         }
         if (isset($this->data['user_timezone'])) {
             $ft_cfg['board_timezone'] = $this->data['user_timezone'];
         }
     }
     $this->data['user_lang'] = $ft_cfg['default_lang'];
     $this->data['user_timezone'] = $ft_cfg['board_timezone'];
     if (!defined('LANG_DIR')) {
         define('LANG_DIR', DEFAULT_LANG_DIR);
     }
     require LANG_DIR . 'lang_main.php';
     setlocale(LC_ALL, 'ru_RU.UTF-8');
     // Временная функция [BEGIN]
     if (defined('IN_ADMIN')) {
         require FT_ROOT . 'language/lang_' . $ft_cfg['default_lang'] . '/lang_admin.php';
     }
     // Временная функция [END]
     include_attach_lang();
     $theme = setup_style();
     // Handle marking posts read
     if (!IS_GUEST && !empty($_COOKIE[COOKIE_MARK])) {
         $this->mark_read($_COOKIE[COOKIE_MARK]);
     }
     $this->load_opt_js();
 }
Exemple #5
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;
}
Exemple #6
0
function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '')
{
	global $db, $config, $template, $theme, $images, $lang, $nav_links, $gen_simple_header;
	global $user, $user_ip;
	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($user->data) && ( $msg_code == GENERAL_MESSAGE || $msg_code == GENERAL_ERROR ) )
	{
		// Start session management
		$user->session_begin();
		$auth->acl($user->data);
		$user->setup();
		// End session management
	}

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

		if ( empty($template) || empty($theme) )
		{
			$theme = setup_style($config['default_style']);
		}

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

	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(IP_ROOT_PATH . 'language/lang_english/lang_main.'.PHP_EXT);

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

			if ( $msg_title == '' )
			{
				$msg_title = 'Icy Phoenix : <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(IP_ROOT_PATH . 'includes/page_tail.'.PHP_EXT);
		}
		else
		{
			include(IP_ROOT_PATH . 'admin/page_footer_admin.'.PHP_EXT);
		}
	}
	else
	{
		echo "<html>\n<body>\n" . $msg_title . "\n<br /><br />\n" . $msg_text . "</body>\n</html>";
	}

	exit;
}
function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '')
{
    global $db, $cache, $config, $auth, $user, $lang, $template, $images, $theme, $tree;
    global $table_prefix, $SID, $_SID;
    global $gen_simple_header, $starttime, $base_memory_usage, $do_gzip_compress;
    global $ip_cms, $cms_config_vars, $cms_config_global_blocks, $cms_config_layouts, $cms_page;
    global $nav_separator, $nav_links;
    // Global vars needed by page header, but since we are in message_die better use default values instead of the assigned ones in case we are dying before including page_header.php
    /*
    global $meta_content;
    global $nav_pgm, $nav_add_page_title, $skip_nav_cat, $start;
    global $breadcrumbs;
    */
    //+MOD: Fix message_die for multiple errors MOD
    static $msg_history;
    if (!isset($msg_history)) {
        $msg_history = array();
    }
    $msg_history[] = array('msg_code' => $msg_code, 'msg_text' => $msg_text, 'msg_title' => $msg_title, 'err_line' => $err_line, 'err_file' => $err_file, 'sql' => htmlspecialchars($sql));
    //-MOD: Fix message_die for multiple errors MOD
    if (defined('HAS_DIED')) {
        //+MOD: Fix message_die for multiple errors MOD
        //
        // This message is printed at the end of the report.
        // Of course, you can change it to suit your own needs. ;-)
        //
        $custom_error_message = 'Please, contact the %swebmaster%s. Thank you.';
        if (!empty($config) && !empty($config['board_email'])) {
            $custom_error_message = sprintf($custom_error_message, '<a href="mailto:' . $config['board_email'] . '">', '</a>');
        } else {
            $custom_error_message = sprintf($custom_error_message, '', '');
        }
        echo "<html>\n<body>\n<b>Critical Error!</b><br />\nmessage_die() was called multiple times.<br />&nbsp;<hr />";
        for ($i = 0; $i < sizeof($msg_history); $i++) {
            echo '<b>Error #' . ($i + 1) . "</b>\n<br />\n";
            if (!empty($msg_history[$i]['msg_title'])) {
                echo '<b>' . $msg_history[$i]['msg_title'] . "</b>\n<br />\n";
            }
            echo $msg_history[$i]['msg_text'] . "\n<br /><br />\n";
            if (!empty($msg_history[$i]['err_line'])) {
                echo '<b>Line :</b> ' . $msg_history[$i]['err_line'] . '<br /><b>File :</b> ' . $msg_history[$i]['err_file'] . "</b>\n<br />\n";
            }
            if (!empty($msg_history[$i]['sql'])) {
                echo '<b>SQL :</b> ' . $msg_history[$i]['sql'] . "\n<br />\n";
            }
            echo "&nbsp;<hr />\n";
        }
        echo $custom_error_message . '<hr /><br clear="all">';
        die("</body>\n</html>");
        //-MOD: Fix message_die for multiple errors MOD
    }
    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 />' . htmlspecialchars($sql_store);
        }
        if ($err_line != '' && $err_file != '') {
            $debug_text .= '<br /><br />Line : ' . $err_line . '<br />File : ' . basename($err_file);
        }
    }
    if (empty($user->data) && ($msg_code == GENERAL_MESSAGE || $msg_code == GENERAL_ERROR)) {
        // Start session management
        $user->session_begin();
        $auth->acl($user->data);
        $user->setup();
        // End session management
    }
    // If the header hasn't been parsed yet... then do it!
    if (!defined('HEADER_INC') && $msg_code != CRITICAL_ERROR) {
        setup_basic_lang();
        if (empty($template) || empty($theme)) {
            $theme = setup_style($config['default_style'], $current_default_style);
        }
        $template->assign_var('HAS_DIED', true);
        define('TPL_HAS_DIED', true);
        // Load the Page Header
        if (!defined('IN_ADMIN')) {
            $parse_template = defined('IN_CMS') ? false : true;
            page_header('', $parse_template);
        } else {
            include IP_ROOT_PATH . ADM . '/page_header_admin.' . PHP_EXT;
        }
    }
    if (!defined('IN_ADMIN') && !defined('IN_CMS') && !defined('HEADER_INC_COMPLETED') && $msg_code != CRITICAL_ERROR) {
        if (!defined('TPL_HAS_DIED')) {
            $template->assign_var('HAS_DIED', true);
            define('TPL_HAS_DIED', true);
        }
        $header_tpl = empty($gen_simple_header) ? 'overall_header.tpl' : 'simple_header.tpl';
        $template->set_filenames(array('overall_header' => $header_tpl));
        $template->pparse('overall_header');
    }
    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
            // We force english to make sure we have at least the default language
            $config['default_lang'] = 'english';
            setup_basic_lang();
            if ($msg_text == '') {
                $msg_text = $lang['A_critical_error'];
            }
            if ($msg_title == '') {
                $msg_title = '<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;
        }
    }
    // MG Logs - BEGIN
    //if (($config['mg_log_actions'] == true) && ($msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR))
    if ($msg_code != GENERAL_MESSAGE) {
        if ($config['mg_log_actions'] || !empty($config['db_log_actions'])) {
            $db_log = array('action' => 'MESSAGE', 'desc' => $msg_code, 'target' => '');
            $error_log = array('code' => $msg_code, 'title' => $msg_title, 'text' => $msg_text);
            if (!function_exists('ip_log')) {
                @(include IP_ROOT_PATH . 'includes/functions_mg_log.' . PHP_EXT);
            }
            ip_log('[MSG_CODE: ' . $msg_code . '] - [MSG_TITLE: ' . $msg_title . '] - [MSG_TEXT: ' . $msg_text . ']', $db_log, $error_log);
        }
    }
    // MG Logs - END
    if ($msg_code != CRITICAL_ERROR) {
        if (defined('STATUS_404')) {
            send_status_line(404, 'Not Found');
        }
        if (defined('STATUS_503')) {
            send_status_line(503, 'Service Unavailable');
        }
        if (!empty($lang[$msg_text])) {
            $msg_text = $lang[$msg_text];
        }
        if (defined('IN_ADMIN')) {
            $template->set_filenames(array('message_body' => ADM_TPL . 'admin_message_body.tpl'));
        } elseif (defined('IN_CMS')) {
            $template->set_filenames(array('message_body' => COMMON_TPL . 'cms/message_body.tpl'));
        } else {
            $template->set_filenames(array('message_body' => 'message_body.tpl'));
        }
        //echo('<br />' . htmlspecialchars($template->vars['META']));
        $template->assign_vars(array('MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text));
        if (!defined('IN_CMS')) {
            $template->pparse('message_body');
        }
        // If we have already defined the var in header, let's output it in footer as well
        if (defined('TPL_HAS_DIED')) {
            $template->assign_var('HAS_DIED', true);
        }
        if (!defined('IN_ADMIN')) {
            $template_to_parse = defined('IN_CMS') ? 'message_body' : '';
            $parse_template = defined('IN_CMS') ? false : true;
            page_footer(true, $template_to_parse, $parse_template);
        } else {
            include IP_ROOT_PATH . ADM . '/page_footer_admin.' . PHP_EXT;
        }
    } else {
        echo "<html>\n<body>\n" . $msg_title . "\n<br /><br />\n" . $msg_text . "</body>\n</html>";
    }
    garbage_collection();
    exit_handler();
    exit;
}
Exemple #8
0
 /**
  * Setup basic user-specific items (style, language, ...)
  */
 function setup($lang_set = false, $style = false)
 {
     global $db, $cache, $config, $auth, $template;
     // We need $lang declared as global to make sure we do not miss extra $lang vars added using this function
     global $theme, $images, $lang, $nav_separator;
     global $class_settings, $tree;
     // Get all settings
     $class_settings->setup_settings();
     // Mighty Gorgon - Change Lang - BEGIN
     $test_language = request_var(LANG_URL, '');
     if (!empty($test_language)) {
         $test_language = str_replace(array('.', '/'), '', urldecode($test_language));
         $config['default_lang'] = file_exists(@phpbb_realpath($this->lang_path . 'lang_' . basename($test_language) . '/lang_main.' . PHP_EXT)) ? $test_language : $config['default_lang'];
         $this->set_cookie('lang', $config['default_lang'], $user->cookie_expire);
     } else {
         if (isset($_COOKIE[$config['cookie_name'] . '_lang']) && file_exists(@phpbb_realpath($this->lang_path . 'lang_' . basename($_COOKIE[$config['cookie_name'] . '_lang']) . '/lang_main.' . PHP_EXT))) {
             $config['default_lang'] = $_COOKIE[$config['cookie_name'] . '_lang'];
         }
     }
     // Mighty Gorgon - Change Lang - END
     if ($this->data['user_id'] != ANONYMOUS) {
         $this->lang_name = file_exists($this->lang_path . 'lang_' . basename($this->data['user_lang']) . '/lang_main.' . PHP_EXT) ? basename($this->data['user_lang']) : basename($config['default_lang']);
         $this->date_format = $this->data['user_dateformat'];
         $this->timezone = $this->data['user_timezone'] * 3600;
         $this->dst = $this->data['user_dst'] * 3600;
         $config['board_timezone'] = !empty($this->data['user_timezone']) ? $this->data['user_timezone'] : $config['board_timezone'];
         $config['default_dateformat'] = !empty($this->data['user_dateformat']) ? $this->data['user_dateformat'] : $config['default_dateformat'];
         $config['topics_per_page'] = !empty($this->data['user_topics_per_page']) ? $this->data['user_topics_per_page'] : $config['topics_per_page'];
         $config['posts_per_page'] = !empty($this->data['user_posts_per_page']) ? $this->data['user_posts_per_page'] : $config['posts_per_page'];
         $config['hot_threshold'] = !empty($this->data['user_hot_threshold']) ? $this->data['user_hot_threshold'] : $config['hot_threshold'];
         // Store CMS AUTH - BEGIN
         if (empty($this->data['user_cms_auth'])) {
             $auth_array = array();
             $auth_to_get_array = array('cmsl_admin', 'cmss_admin', 'cmsb_admin');
             foreach ($auth_to_get_array as $auth_to_get) {
                 $auth_getf = $auth->acl_getf($auth_to_get, true);
                 foreach ($auth_getf as $auth_id => $auth_value) {
                     $auth_array[$auth_to_get][$auth_id] = $auth_value[$auth_to_get];
                 }
             }
             $this->data['user_cms_auth'] = $auth_array;
             $sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\t\tSET user_cms_auth = '" . $db->sql_escape(serialize($this->data['user_cms_auth'])) . "'\n\t\t\t\t\tWHERE user_id = " . $this->data['user_id'];
             $db->sql_query($sql);
         } else {
             $this->data['user_cms_auth'] = unserialize($this->data['user_cms_auth']);
         }
         // Store CMS AUTH - END
     } else {
         $this->lang_name = basename($config['default_lang']);
         $this->date_format = $config['default_dateformat'];
         $this->timezone = $config['board_timezone'] * 3600;
         $this->dst = $config['board_dst'] * 3600;
     }
     // If we've had to change the value in any way then let's write it back to the database before we go any further since it means there is something wrong with it
     if ($this->data['user_id'] != ANONYMOUS && $this->data['user_lang'] !== $this->lang_name && file_exists($this->lang_path . 'lang_' . basename($this->lang_name) . '/lang_main.' . PHP_EXT)) {
         $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_lang = '" . $db->sql_escape($this->lang_name) . "'\n\t\t\t\tWHERE user_lang = '" . $this->data['user_lang'] . "'";
         $result = $db->sql_query($sql);
         $this->data['user_lang'] = $this->lang_name;
     } elseif ($this->data['user_id'] === ANONYMOUS && $config['default_lang'] !== $this->lang_name && file_exists($this->lang_path . 'lang_' . basename($this->lang_name) . '/lang_main.' . PHP_EXT)) {
         $sql = 'UPDATE ' . CONFIG_TABLE . "\n\t\t\t\tSET config_value = '" . $db->sql_escape($this->lang_name) . "'\n\t\t\t\tWHERE config_name = 'default_lang'";
         $result = $db->sql_query($sql);
     }
     $config['default_lang'] = $this->lang_name;
     // We include common language file here to not load it every time a custom language file is included
     $lang =& $this->lang;
     setup_basic_lang();
     $this->add_lang($lang_set);
     unset($lang_set);
     $nav_separator = empty($nav_separator) ? empty($lang['Nav_Separator']) ? '&nbsp;&raquo;&nbsp;' : $lang['Nav_Separator'] : $nav_separator;
     if (empty($tree['auth'])) {
         get_user_tree($this->data);
     }
     // MG Logs - BEGIN
     if ($config['mg_log_actions'] || $config['db_log_actions']) {
         include IP_ROOT_PATH . 'includes/log_http_cmd.' . PHP_EXT;
     }
     // MG Logs - END
     // UPI2DB - BEGIN
     if (!defined('IN_CMS') && $this->data['upi2db_access']) {
         if (!defined('UPI2DB_UNREAD')) {
             $this->data['upi2db_unread'] = upi2db_unread();
         }
     } else {
         $this->data['upi2db_unread'] = array();
     }
     // UPI2DB - END
     // Mighty Gorgon Edit
     // DISABLED BY MG
     /*
     //if (!empty($_GET['style']) && $auth->acl_get('a_styles') && !defined('IN_ADMIN') && !defined('IN_CMS'))
     if (!empty($_GET['style']) && !defined('IN_ADMIN') && !defined('IN_CMS'))
     {
     	global $SID, $_EXTRA_URL;
     
     	$style = request_var(STYLE_URL, 0);
     	$SID .= '&amp;' . STYLE_URL . '=' . $style;
     	$_EXTRA_URL = array(STYLE_URL . '=' . $style);
     }
     else
     {
     	// Set up style
     	$style = ($style) ? $style : ((!$config['override_user_style']) ? $this->data['user_style'] : $config['default_style']);
     }
     */
     // Call phpbb_user_session_handler() in case external application want to "bend" some variables or replace classes...
     // After calling it we continue script execution...
     phpbb_user_session_handler();
     // If this function got called from the error handler we are finished here.
     if (defined('IN_ERROR_HANDLER')) {
         return;
     }
     // Disable board if the install/ directory is still present
     // For the brave development army we do not care about this, else we need to comment out this everytime we develop locally
     // DISABLED BY MG
     /*
     if (!defined('DEBUG_EXTRA') && !defined('IN_ADMIN') && !defined('IN_CMS') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists(IP_ROOT_PATH . 'install') && !is_file(IP_ROOT_PATH . 'install'))
     {
     	// Adjust the message slightly according to the permissions
     	if ($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))
     	{
     		$message = 'REMOVE_INSTALL';
     	}
     	else
     	{
     		$message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
     	}
     	trigger_error($message);
     }
     */
     // Is board disabled and user not an admin or moderator?
     // DISABLED BY MG
     /*
     if ($config['board_disable'] && !defined('IN_LOGIN') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_'))
     {
     	if ($this->data['is_bot'])
     	{
     		send_status_line(503, 'Service Unavailable');
     	}
     
     	$message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
     	trigger_error($message);
     }
     */
     // Is load exceeded?
     // DISABLED BY MG
     /*
     if ($config['limit_load'] && $this->load !== false)
     {
     	if ($this->load > floatval($config['limit_load']) && !defined('IN_LOGIN') && !defined('IN_ADMIN'))
     	{
     		// Set board disabled to true to let the admins/mods get the proper notification
     		$config['board_disable'] = '1';
     
     		if (!$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_'))
     		{
     			if ($this->data['is_bot'])
     			{
     				send_status_line(503, 'Service Unavailable');
     			}
     			trigger_error('BOARD_UNAVAILABLE');
     		}
     	}
     }
     */
     // DISABLED BY MG
     /*
     if (isset($this->data['session_viewonline']))
     {
     	// Make sure the user is able to hide his session
     	if (!$this->data['session_viewonline'])
     	{
     		// Reset online status if not allowed to hide the session...
     		if (!$auth->acl_get('u_hideonline'))
     		{
     			$sql = 'UPDATE ' . SESSIONS_TABLE . '
     				SET session_viewonline = 1
     				WHERE session_user_id = ' . $this->data['user_id'];
     			$db->sql_query($sql);
     			$this->data['session_viewonline'] = 1;
     		}
     	}
     	elseif (!$this->data['user_allow_viewonline'])
     	{
     		// the user wants to hide and is allowed to -> cloaking device on.
     		if ($auth->acl_get('u_hideonline'))
     		{
     			$sql = 'UPDATE ' . SESSIONS_TABLE . '
     				SET session_viewonline = 0
     				WHERE session_user_id = ' . $this->data['user_id'];
     			$db->sql_query($sql);
     			$this->data['session_viewonline'] = 0;
     		}
     	}
     }
     */
     // Set up style
     $current_default_style = $config['default_style'];
     $change_style = false;
     $is_mobile = is_mobile();
     // For debugging purpose you can force this to true
     //$this->data['is_mobile'] = true;
     // We need to store somewhere if the user has the mobile style enabled... so we can output a link to switch between mobile style and norma style
     $this->data['mobile_style'] = false;
     $disable_mobile_style = false;
     // MOBILE STYLE DISABLING - BEGIN
     // Let's check if the user wants to disable the mobile style
     if (isset($_GET['mob'])) {
         $mob_get = isset($_GET['mob']) && intval($_GET['mob']) == 0 ? 0 : 1;
         $_GET['mob'] = $mob_get;
         $_COOKIE[$config['cookie_name'] . '_mob'] = $mob_get;
         $this->set_cookie('mob', $mob_get, $user->cookie_expire);
         if (empty($mob_get)) {
             $disable_mobile_style = true;
         }
     }
     $mob_cok = isset($_COOKIE[$config['cookie_name'] . '_mob']) && intval($_COOKIE[$config['cookie_name'] . '_mob']) == 0 ? false : true;
     if (empty($mob_cok)) {
         $disable_mobile_style = true;
     }
     // MOBILE STYLE DISABLING - END
     if (empty($disable_mobile_style) && !empty($this->data['is_mobile']) && !defined('IN_CMS') && !defined('IN_ADMIN')) {
         $this->data['mobile_style'] = true;
         $_COOKIE[$config['cookie_name'] . '_mob'] = 1;
         $this->set_cookie('mob', 1, $user->cookie_expire);
         $theme = setup_mobile_style();
     } else {
         if (empty($config['override_user_style'])) {
             // Mighty Gorgon - Change Style - BEGIN
             // Check cookie as well!!!
             $test_style = request_var(STYLE_URL, 0);
             if ($test_style > 0) {
                 $config['default_style'] = urldecode($test_style);
                 $config['default_style'] = check_style_exists($config['default_style']) == false ? $current_default_style : $config['default_style'];
                 $this->set_cookie('style', $config['default_style'], $user->cookie_expire);
                 $change_style = true;
             } else {
                 if (isset($_COOKIE[$config['cookie_name'] . '_style']) && check_style_exists($_COOKIE[$config['cookie_name'] . '_style']) != false) {
                     $config['default_style'] = $_COOKIE[$config['cookie_name'] . '_style'];
                 }
             }
             // Mighty Gorgon - Change Style - END
             $style = $this->data['user_id'] != ANONYMOUS && $this->data['user_style'] > 0 && empty($change_style) ? $this->data['user_style'] : $config['default_style'];
             if ($theme = setup_style($style, $current_default_style)) {
                 if ($this->data['user_id'] != ANONYMOUS && !empty($change_style)) {
                     // user logged in --> save new style ID in user profile
                     $sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\t\t\t\tSET user_style = " . $theme['themes_id'] . "\n\t\t\t\t\t\t\tWHERE user_id = " . $this->data['user_id'];
                     $db->sql_query($sql);
                     $this->data['user_style'] = $theme['themes_id'];
                 }
                 return;
             }
         }
         $theme = setup_style($config['default_style'], $current_default_style);
     }
     return;
 }
Exemple #9
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;
}
Exemple #10
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
}
Exemple #11
0
function bb_die($msg_text)
{
    global $ajax, $bb_cfg, $lang, $template, $theme, $userdata;
    if (defined('IN_AJAX')) {
        $ajax->ajax_die($msg_text);
    }
    // Check
    if (defined('HAS_DIED')) {
        trigger_error(__FUNCTION__ . ' was called multiple times', E_USER_ERROR);
    }
    define('HAS_DIED', 1);
    define('DISABLE_CACHING_OUTPUT', true);
    // If empty lang
    if (empty($lang)) {
        require $bb_cfg['default_lang_dir'] . 'main.php';
    }
    // If empty session
    if (empty($userdata)) {
        $userdata = session_pagestart();
    }
    // If the header hasn't been output then do it
    if (!defined('PAGE_HEADER_SENT')) {
        if (empty($template)) {
            $template = new Template(BB_ROOT . "templates/{$bb_cfg['tpl_name']}");
        }
        if (empty($theme)) {
            $theme = setup_style();
        }
        require PAGE_HEADER;
    }
    // Check for lang variable
    if (!empty($lang[$msg_text])) {
        $msg_text = $lang[$msg_text];
    }
    $template->assign_vars(array('TPL_BB_DIE' => true, 'MESSAGE_TEXT' => $msg_text));
    $template->set_filenames(array('bb_die' => 'common.tpl'));
    $template->pparse('bb_die');
    require PAGE_FOOTER;
    exit;
}