|
From: Markus P. <mar...@us...> - 2005-04-10 20:40:50
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1769 Modified Files: mx_functions_phpbb.php Log Message: Removed mx_block_info function. This was only used by mx_poll.php. Added mx_block_message, which is basically a simple version of a mx_message_die kind of function. It allows to send a message without header/footer, which might break page layout. Usefull to send message from blocks, etc. Index: mx_functions_phpbb.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_phpbb.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mx_functions_phpbb.php 21 Mar 2005 20:59:33 -0000 1.3 --- mx_functions_phpbb.php 10 Apr 2005 20:40:42 -0000 1.4 *************** *** 28,32 **** * - mx_setup_style (from functions.php) * - mx_message_die (from functions.php) ! * - mx_block_info (another message_die clone, from functions.php) * - mx_redirect (from functions_post.php) */ --- 28,32 ---- * - mx_setup_style (from functions.php) * - mx_message_die (from functions.php) ! * - mx_block_message (a message_die kind of function for blocks) * - mx_redirect (from functions_post.php) */ *************** *** 438,593 **** } ! function mx_block_info( $msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '' ) { ! global $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path, $mx_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( $mx_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx ); ! } ! else ! { ! include( $mx_root_path . 'language/lang_english/lang_main.' . $phpEx ); ! } ! } ! ! if ( empty( $template ) ) ! { ! $template = new mx_Template( $mx_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( $mx_root_path . 'includes/page_header.' . $phpEx ); ! } ! else ! { ! include( $mx_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( $mx_root_path . 'language/lang_english/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>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' ); ! } ! else ! { ! echo "<html>\n<body>\n" . $msg_title . "\n<br /><br />\n" . $msg_text . "</body>\n</html>"; ! } } --- 438,458 ---- } ! // ! // mx_block_message is basically a simple version of a mx_message_die kind of function. ! // It allows to send a message without header/footer, which might break page layout. ! // Usefull to send message from blocks, etc. ! // ! function mx_block_message($title, $message) { ! global $template; ! $template->set_filenames(array( ! 'message_body' => 'message_body.tpl') ! ); ! $template->assign_vars(array( ! 'MESSAGE_TITLE' => $title, ! 'MESSAGE_TEXT' => $message ! )); ! $template->pparse('message_body'); } |