/**
 * General error handler for arbitrating phpBB & WordPress errors.
 */
function wpu_msg_handler($errno, $msg_text, $errfile, $errline)
{
    global $phpbbForum, $IN_WORDPRESS;
    switch ($errno) {
        case E_NOTICE:
        case E_WARNING:
            return false;
            break;
    }
    if (!$IN_WORDPRESS) {
        return msg_handler($errno, $msg_text, $errfile, $errline);
    }
    return false;
}
Example #2
0
/**
* Wrapper function for the default phpBB msg_handler method.
* This function will overwrite the $phpbb_root_path variable
* if $errno == E_USER_ERROR. This way the "return to index"
* link on the error page will point towards the STK index
* instead of the phpBB index
*/
function stk_msg_handler($errno, $msg_text, $errfile, $errline)
{
    // Sometimes phpBB call this after finishing a certain task, this breaks the ERK!
    // A little bit of fallback here, call the critical repair kit error handler
    if (defined('IN_ERK')) {
        global $critical_repair;
        $critical_repair->trigger_error($msg_text, false, array($errno, $errfile, $errline));
    }
    // If the STK triggers a fatal error before IN_STK is defined we'll show a page
    // informing the user that the ERK *might* resolve this issue.
    if (!defined('IN_STK') && in_array($errno, array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE))) {
        // Trigger error through the critical repair class
        if (!class_exists('critical_repair')) {
            include STK_ROOT_PATH . 'includes/critical_repair.' . PHP_EXT;
        }
        $cr = new critical_repair();
        if ($errno == E_USER_ERROR) {
            $lines = array('The Support Toolkit encountered a fatal error.', 'The Support Toolkit includes an Emergency Repair Kit (ERK), a tool designed to resolve certain errors that prevent phpBB from functioning. It is advised that you run the ERK now so it can attempt to repair the error it has detected.<br />
To run the ERK, click <a href="' . STK_ROOT_PATH . 'erk.php">here</a>.');
            $redirect_stk = false;
        } else {
            $lines = array($msg_text);
            $redirect_stk = true;
        }
        // Trigger
        $cr->trigger_error($lines, $redirect_stk);
    }
    // This is nasty :(
    if ($errno == E_USER_ERROR) {
        global $phpbb_root_path;
        $phpbb_root_path = STK_ROOT_PATH;
    }
    // Call the phpBB error message handler
    msg_handler($errno, $msg_text, $errfile, $errline);
}
    /**
     * Trigger an error message, this method *must* be called when an ERK tool
     * encounters an error. You can not rely on msg_handler!
     * @param	String|Array	$msg				The error message or an string array containing multiple lines
     * @param	Boolean			$redirect_stk		Show a backlink to the STK, otherwise to the ERK
     * @param	Array			$msg_handler_args	Arugments that will be passed to the phpBB msg_handler, should only
     *												be set when called from stk_msg_handler
     * @return	void
     */
    function trigger_error($msg, $redirect_stk = false, $msg_handler_args = array())
    {
        if (defined('ERK_NO_TRIGGER') && ERK_NO_TRIGGER === true) {
            return;
        }
        // Fall back to the phpBB error handler
        if (!empty($msg_handler_args)) {
            $msg = is_array($msg) ? implode('<br />', $msg) : $msg;
            msg_handler($msg_handler_args[0], $msg, $msg_handler_args[1], $msg_handler_args[2]);
            exit;
        }
        if (!is_array($msg)) {
            $msg = array($msg);
        }
        // Send headers
        header('HTTP/1.1 503 Service Unavailable');
        header('Content-type: text/html; charset=UTF-8');
        // Build the page
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta http-equiv="content-style-type" content="text/css" />
		<meta http-equiv="imagetoolbar" content="no" />
		<title>Support Toolkit :: Emergency Repair Kit</title>
		<link href="<?php 
        echo STK_ROOT_PATH;
        ?>
style/style.css" rel="stylesheet" type="text/css" media="screen" />
		<link href="<?php 
        echo STK_ROOT_PATH;
        ?>
style/erk_style.css" rel="stylesheet" type="text/css" media="screen" />
	</head>
	<body id="errorpage">
		<div id="wrap">
			<div id="page-header">
				<p>
					<?php 
        if ($redirect_stk) {
            echo '<a href="' . STK_ROOT_PATH . '">Support Toolkit index</a> &bull; ';
        } else {
            echo '<a href="' . STK_ROOT_PATH . 'erk.php">Emergency Repair Toolkit index</a> &bull; ';
        }
        ?>
					<a href="<?php 
        echo PHPBB_ROOT_PATH;
        ?>
">Board index</a>
				</p>
			</div>
			<div id="page-body">
				<div id="acp">
					<div class="panel">
						<span class="corners-top"><span></span></span>
							<div id="content">
								<h1>Emergency Repair Kit</h1>
								<?php 
        foreach ($msg as $m) {
            echo "<p>{$m}</p>";
        }
        ?>
								<p>
									<?php 
        if ($redirect_stk) {
            echo 'Click <a href="' . STK_ROOT_PATH . '">here</a> to reload the STK';
        } else {
            echo 'Click <a href="' . STK_ROOT_PATH . 'erk.php">here</a> to reload the ERK';
        }
        ?>
								</p>
							</div>
						<span class="corners-bottom"><span></span></span>
					</div>
				</div>
			</div>
			<div id="page-footer">
				Powered by phpBB &copy; 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>
			</div>
		</div>
	</body>
</html>
<?php 
        // Make sure we exit, can't use any phpBB stuff here
        exit;
    }
Example #4
0
				<legend>Создание новой страницы</legend>
				<div class="form-group">
					<label for="inputEmail" class="col-lg-2 control-label">Название</label>
					<div class="col-lg-10">
						<input type="text" class="form-control" name="page_name">
					</div>
				</div>
				<div class="form-group">
					<label for="inputEmail" class="col-lg-2 control-label">URL</label>
					<div class="col-lg-10">
						<input type="text" class="form-control" name="url">
					</div>
				</div>
				<div class="form-group">
					<label for="textArea" class="col-lg-2 control-label">Содержимое</label>
					<div class="col-lg-10">
						<textarea class="form-control" rows="15" id="textArea" name="content"></textarea>
					</div>
				</div>
				<div class="form-group">
					<div class="col-lg-10 col-lg-offset-2">
						<input type="submit" class="btn btn-primary" name="send" value="Создать">
						<?php 
echo msg_handler($_GET['msg']);
?>
					</div>
				</div>
			</fieldset>
		</form>
	</div>
</div>
Example #5
0
 public function handle_session_msgbox($errNo, $errMsg, $errfile, $errLine)
 {
     if ($errNo !== E_USER_NOTICE) {
         return msg_handler($errNo, $errMsg, $errFile, $errLine);
     }
     wp_logout();
     wp_die($errMsg);
 }
Example #6
0
/**
* Blog Error Handler
*/
function blog_error_handler($errno, $msg_text, $errfile, $errline)
{
    if ($errno == E_USER_NOTICE) {
        global $user, $template;
        // If we don't have the language setting needed we probably have not setup the page yet, so we must do it before we can continue.
        if (!isset($user->lang['CLICK_INSTALL_BLOG'])) {
            $user->setup('mods/blog/common');
        } else {
            // Set the template back to the user's default.  So custom style authors do not need to make a message_body template
            $template->set_template();
        }
    }
    msg_handler($errno, $msg_text, $errfile, $errline);
}
Example #7
0
 static function msg_handler($errno, $msg_text, $errfile, $errline)
 {
     msg_handler($errno, $msg_text, $errfile, $errline);
 }
Example #8
0
titania_url::decode_request();
// Include common phpBB files and functions.
if (!file_exists(PHPBB_ROOT_PATH . 'common.' . PHP_EXT)) {
    die('<p>No phpBB installation found. Check the Titania configuration file.</p>');
}
if (!defined('PHPBB_INCLUDED')) {
    require PHPBB_ROOT_PATH . 'common.' . PHP_EXT;
}
// Initialise phpBB
phpbb::initialise();
// If the database is not installed or outdated redirect to the installer
if (!defined('IN_TITANIA_INSTALL') && (!isset(phpbb::$config['titania_version']) || version_compare(phpbb::$config['titania_version'], TITANIA_VERSION, '<'))) {
    if (phpbb::$user->data['user_type'] != USER_FOUNDER) {
        phpbb::$user->set_custom_lang_path(TITANIA_ROOT . 'language/');
        phpbb::$user->add_lang('common');
        msg_handler(E_USER_ERROR, phpbb::$user->lang['TITANIA_DISABLED'], '', '');
    }
    redirect(phpbb::append_sid(TITANIA_ROOT . 'install.' . PHP_EXT));
}
// Initialise Titania
titania::initialise();
// Allow login attempts from any page (mini login box)
if (isset($_POST['login'])) {
    phpbb::login_box();
}
// admin requested the cache to be purged, ensure they have permission and purge the cache.
if (isset($_GET['cache']) && $_GET['cache'] == 'purge' && phpbb::$auth->acl_get('a_')) {
    titania::$cache->purge();
    titania::error_box('SUCCESS', phpbb::$user->lang['CACHE_PURGED']);
}
// admin requested a sync