|
From: OryNider <ory...@us...> - 2008-01-15 12:32:31
|
Update of /cvsroot/mxbb/core/includes/shared/phpbb3/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29700 Modified Files: functions_hook.php Log Message: Index: functions_hook.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/shared/phpbb3/includes/functions_hook.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** functions_hook.php 15 Jan 2008 12:29:05 -0000 1.1 --- functions_hook.php 15 Jan 2008 12:32:27 -0000 1.2 *************** *** 18,33 **** //include_once( $phpbb_root_path . 'adm/index.'. $phpEx); class phpbb3_hook { ! var $main_part = ''; var $current_tab = ''; ! ! function phpbb3() { ! } ! function hook( $part, $curr_tab = '', $mode = '') { --- 18,197 ---- //include_once( $phpbb_root_path . 'adm/index.'. $phpEx); + include_once( $mx_root_path . 'includes/shared/phpbb3/includes/functions.' . $phpEx ); + include_once( $mx_root_path . 'includes/shared/phpbb3/includes/functions_module.' . $phpEx ); + include_once( $mx_root_path . 'includes/sessions/phpbb3/auth.'.$phpEx); + include_once( $mx_root_path . 'includes/sessions/phpbb3/session.'. $phpEx); + + if ( !function_exists( 'function phpbb_user_session_handler')) + { + function phpbb_user_session_handler() + { + global $phpbb_hook; + + if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__)) + { + if ($phpbb_hook->hook_return(__FUNCTION__)) + { + return $phpbb_hook->hook_return_result(__FUNCTION__); + } + } + + return; + } + } + + if ( !function_exists( 'request_var')) + { + function request_var( $p1, $p2 = '', $p3 = false, $p4=false) + { + global $mx_request_vars; + return $mx_request_vars->request( $p1, $p2, $p3, $p4); + } + } + if ( !function_exists( 'append_sid')) + { + function append_sid( $url) + { + return mx_append_sid( $url); + } + } + + if ( !function_exists( 'adm_page_header')) + { + function adm_page_header($page_title) + { + global $config, $db, $user, $template; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $SID, $_SID; + + if (defined('HEADER_INC')) + { + return; + } + + define('HEADER_INC', true); + + // gzip_compression + if ($config['gzip_compress']) + { + if (@extension_loaded('zlib') && !headers_sent()) + { + ob_start('ob_gzhandler'); + } + } + + $template->assign_vars(array( + 'PAGE_TITLE' => $page_title, + 'USERNAME' => $user->data['username'], + + 'SID' => $SID, + '_SID' => $_SID, + 'SESSION_ID' => $user->session_id, + 'ROOT_PATH' => $phpbb_admin_path, + + 'U_LOGOUT' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout'), + 'U_ADM_INDEX' => append_sid("{$phpbb_admin_path}index.$phpEx"), + 'U_INDEX' => append_sid("{$phpbb_root_path}index.$phpEx"), + + 'T_IMAGES_PATH' => "{$phpbb_root_path}images/", + 'T_SMILIES_PATH' => "{$phpbb_root_path}{$config['smilies_path']}/", + 'T_AVATAR_PATH' => "{$phpbb_root_path}{$config['avatar_path']}/", + 'T_AVATAR_GALLERY_PATH' => "{$phpbb_root_path}{$config['avatar_gallery_path']}/", + 'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/", + 'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/", + 'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/", + + 'ICON_MOVE_UP' => '<img src="' . $phpbb_admin_path . 'images/icon_up.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />', + 'ICON_MOVE_UP_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_up_disabled.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />', + 'ICON_MOVE_DOWN' => '<img src="' . $phpbb_admin_path . 'images/icon_down.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />', + 'ICON_MOVE_DOWN_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_down_disabled.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />', + 'ICON_EDIT' => '<img src="' . $phpbb_admin_path . 'images/icon_edit.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />', + 'ICON_EDIT_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_edit_disabled.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />', + 'ICON_DELETE' => '<img src="' . $phpbb_admin_path . 'images/icon_delete.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />', + 'ICON_DELETE_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_delete_disabled.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />', + 'ICON_SYNC' => '<img src="' . $phpbb_admin_path . 'images/icon_sync.gif" alt="' . $user->lang['RESYNC'] . '" title="' . $user->lang['RESYNC'] . '" />', + 'ICON_SYNC_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_sync_disabled.gif" alt="' . $user->lang['RESYNC'] . '" title="' . $user->lang['RESYNC'] . '" />', + + 'S_USER_LANG' => $user->lang['USER_LANG'], + 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], + 'S_CONTENT_ENCODING' => 'UTF-8', + 'S_CONTENT_FLOW_BEGIN' => ($user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right', + 'S_CONTENT_FLOW_END' => ($user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left', + )); + + // application/xhtml+xml not used because of IE + header('Content-type: text/html; charset=UTF-8'); + + header('Cache-Control: private, no-cache="set-cookie"'); + header('Expires: 0'); + header('Pragma: no-cache'); + + return; + } + } + + if ( !function_exists( 'adm_page_footer')) + { + function adm_page_footer($copyright_html = true) + { + global $db, $config, $template, $user, $auth, $cache; + global $starttime, $phpbb_root_path, $phpbb_admin_path, $phpEx; + + // Output page creation time + if (defined('DEBUG')) + { + $mtime = explode(' ', microtime()); + $totaltime = $mtime[0] + $mtime[1] - $starttime; + + if (!empty($_REQUEST['explain']) && $auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report')) + { + $db->sql_report('display'); + } + + $debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress']) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime); + + if ($auth->acl_get('a_') && defined('DEBUG_EXTRA')) + { + if (function_exists('memory_get_usage')) + { + if ($memory_usage = memory_get_usage()) + { + global $base_memory_usage; + $memory_usage -= $base_memory_usage; + $memory_usage = ($memory_usage >= 1048576) ? round((round($memory_usage / 1048576 * 100) / 100), 2) . ' ' . $user->lang['MB'] : (($memory_usage >= 1024) ? round((round($memory_usage / 1024 * 100) / 100), 2) . ' ' . $user->lang['KB'] : $memory_usage . ' ' . $user->lang['BYTES']); + + $debug_output .= ' | Memory Usage: ' . $memory_usage; + } + } + + $debug_output .= ' | <a href="' . build_url() . '&explain=1">Explain</a>'; + } + } + + $template->assign_vars(array( + 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', + 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', + 'S_COPYRIGHT_HTML' => $copyright_html, + 'VERSION' => $config['version']) + ); + + $template->pparse('body'); + + //garbage_collection(); + //exit_handler(); + } + } + class phpbb3_hook { ! var $main_part = ''; var $current_tab = ''; ! ! function phpbb3_hook() { ! } ! function hook( $part, $curr_tab = '', $mode = '') { *************** *** 38,42 **** case 'admin': $this->main_part = $part; ! //print_r( $mx_user);die(); //include_once( $mx_user->lang_path . 'acp/common.'.$phpEx); --- 202,206 ---- case 'admin': $this->main_part = $part; ! //print_r( $mx_user);die(); //include_once( $mx_user->lang_path . 'acp/common.'.$phpEx); *************** *** 62,79 **** } } ! function admin_menu( $part) { if ( $this->main_part != 'admin') { ! return false; } ! global $db, $lang, $template, $mx_user, $phpEx; ! $sql = "SELECT m1.module_langname AS m1_langname, m2.module_langname AS m2_langname, m2.module_basename AS m2_basename, m2.module_mode AS m2_mode ! FROM " . MODULES_TABLE . " AS m1 RIGHT OUTER JOIN phpbb3_modules AS m2 ON m1.module_id = m2.parent_id AND m2.module_enabled = 1 AND m2.module_display = 1 ! WHERE m1.parent_id = '$part' AND m1.module_class = 'acp' ! ORDER BY m1.left_id "; if( !( $rs=$db->sql_query( $sql))) --- 226,243 ---- } } ! function admin_menu( $part) { if ( $this->main_part != 'admin') { ! return false; } ! global $db, $lang, $template, $mx_user, $phpEx; ! $sql = "SELECT m1.module_langname AS m1_langname, m2.module_langname AS m2_langname, m2.module_basename AS m2_basename, m2.module_mode AS m2_mode ! FROM " . MODULES_TABLE . " AS m1 RIGHT OUTER JOIN phpbb3_modules AS m2 ON m1.module_id = m2.parent_id AND m2.module_enabled = 1 AND m2.module_display = 1 ! WHERE m1.parent_id = '$part' AND m1.module_class = 'acp' ! ORDER BY m1.left_id "; if( !( $rs=$db->sql_query( $sql))) *************** *** 81,88 **** mx_message_die( GENERAL_ERROR, 'Could not obtain menu data form phpbb3 modules', 'Error', __LINE__, __FILE__, $sql); } ! $header= ''; $menu_ary = array(); ! while( $row = $db->sql_fetchrow( $rs) ) { --- 245,252 ---- mx_message_die( GENERAL_ERROR, 'Could not obtain menu data form phpbb3 modules', 'Error', __LINE__, __FILE__, $sql); } ! $header= ''; $menu_ary = array(); ! while( $row = $db->sql_fetchrow( $rs) ) { *************** *** 94,101 **** $menu_ary[$header][$row['m2_langname']] = $row['m2_basename'] ; } ! return $menu_ary; } ! function admin_tabs( $curr_tab) { --- 258,265 ---- $menu_ary[$header][$row['m2_langname']] = $row['m2_basename'] ; } ! return $menu_ary; } ! function admin_tabs( $curr_tab) { *************** *** 104,125 **** return false; } ! global $db, $lang, $template, $mx_user, $phpEx; ! $this->current_tab = $curr_tab; ! $sql = "SELECT m1.*, count(m2.module_id) AS subcount ! FROM " . MODULES_TABLE . " AS m1 LEFT OUTER JOIN phpbb3_modules AS m2 ON m1.module_id = m2.parent_id AND m2.module_enabled = 1 AND m2.module_display = 1 ! WHERE m1.parent_id =0 AND m1.module_class = 'acp' ! GROUP BY m1.module_id ! HAVING count(m2.module_id) > 0 ! ORDER BY m1.left_id "; ! if ( !($rs = $db->sql_query( $sql)) ) { mx_message_die( GENERAL_ERROR, 'Could not obtain data form phpbb3 modules', 'Error', __LINE__, __FILE__, $sql); ! } $return_category = ''; while ( $row = $db->sql_fetchrow( $rs)) --- 268,289 ---- return false; } ! global $db, $lang, $template, $mx_user, $phpEx; ! $this->current_tab = $curr_tab; ! $sql = "SELECT m1.*, count(m2.module_id) AS subcount ! FROM " . MODULES_TABLE . " AS m1 LEFT OUTER JOIN phpbb3_modules AS m2 ON m1.module_id = m2.parent_id AND m2.module_enabled = 1 AND m2.module_display = 1 ! WHERE m1.parent_id =0 AND m1.module_class = 'acp' ! GROUP BY m1.module_id ! HAVING count(m2.module_id) > 0 ! ORDER BY m1.left_id "; ! if ( !($rs = $db->sql_query( $sql)) ) { mx_message_die( GENERAL_ERROR, 'Could not obtain data form phpbb3 modules', 'Error', __LINE__, __FILE__, $sql); ! } $return_category = ''; while ( $row = $db->sql_fetchrow( $rs)) *************** *** 134,149 **** 'PARAMS' => '&i=' . $row['module_id'], 'L_MX_PHPBB' => (isset( $mx_user->lang[$row['module_langname']])?$mx_user->lang[$row['module_langname']]:$row['module_langname']), ! )); } ! return $return_category; ! } function admin_panel( $acp_panel, $mode = '') { $phpbb_admin_html = "<h1>In Progress</h1><p>Still not done.</p>"; ! $phpbb_admin_html .= "<p>ACP Panel: <strong>$acp_panel</strong></p>"; return $phpbb_admin_html; } --- 298,353 ---- 'PARAMS' => '&i=' . $row['module_id'], 'L_MX_PHPBB' => (isset( $mx_user->lang[$row['module_langname']])?$mx_user->lang[$row['module_langname']]:$row['module_langname']), ! )); } ! return $return_category; ! } function admin_panel( $acp_panel, $mode = '') { + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $mx_user, $mx_cache, $cache, $template; $phpbb_admin_html = "<h1>In Progress</h1><p>Still not done.</p>"; ! $phpbb_admin_html .= "<p>ACP Panel: <strong>$acp_panel</strong></p>"; + include_once( $phpbb_root_path . 'includes/acp/acp_' . $acp_panel . '.'. $phpEx); + $cache = $mx_cache; + $user = new user(); + $auth = new phpbb_auth_base(); + $user->session_begin(); + $auth->acl($user->data); + $user->setup('acp/common'); + //$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : 'adm/'; + $module_id = $acp_panel; + + $user->theme['template_storedb'] = false; + //$template->set_custom_template($phpbb_admin_path . 'style', 'admin'); + $module = new p_master(); + + // Instantiate new module + $module = new p_master(); + + // Instantiate module system and generate list of available modules + $module->list_modules('acp'); + $module->p_name = $acp_panel; + // Select the active module + $module->set_active($acp_panel, $mode); + + // Assign data to the template engine for the list of modules + // We do this before loading the active module for correct menu display in trigger_error + $module->assign_tpl_vars(append_sid("{$phpbb_admin_path}index.$phpEx")); + + // Load and execute the relevant module + $module->load_active(); + + ob_start(); + adm_page_header($module->get_page_title()); + $template->set_filenames(array( + 'body' => $phpbb_root_path . 'adm/style/acp_' . $acp_panel . '.html', + )); + adm_page_footer(); + $phpbb_admin_html .= ob_get_contents(); + ob_end_clean(); + return $phpbb_admin_html; } |