|
From: OryNider <ory...@us...> - 2008-02-06 15:13:44
|
Update of /cvsroot/mxbb/core/includes/shared/phpbb3/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18668 Modified Files: functions.php functions_hook.php functions_module.php Log Message: new acp releated Index: functions.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/shared/phpbb3/includes/functions.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** functions.php 4 Feb 2008 15:56:44 -0000 1.7 --- functions.php 6 Feb 2008 15:13:40 -0000 1.8 *************** *** 11,15 **** // // Common global functions ! // Fixes for MX-Publisher: // $config -> $board_config // $cache -> $mx_cache --- 11,15 ---- // // Common global functions ! // Fixes for mxBB: // $config -> $board_config // $cache -> $mx_cache *************** *** 291,295 **** $random = substr($random, 0, $count); } ! $hash = self::_hash_crypt_private($password, self::_hash_gensalt_private($random, $itoa64), $itoa64); --- 291,295 ---- $random = substr($random, 0, $count); } ! $hash = self::_hash_crypt_private($password, self::_hash_gensalt_private($random, $itoa64), $itoa64); *************** *** 364,368 **** $output .= $itoa64[($value >> 12) & 0x3f]; ! if ($i++ >= $count) { --- 364,368 ---- $output .= $itoa64[($value >> 12) & 0x3f]; ! if ($i++ >= $count) { *************** *** 2781,2785 **** } ! $text = censor_text($text); // Parse bbcode if bbcode uid stored and bbcode enabled --- 2781,2785 ---- } ! $text = phpBB3::censor_text($text); // Parse bbcode if bbcode uid stored and bbcode enabled *************** *** 2807,2811 **** $text = str_replace("\n", '<br />', $text); ! $text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES)); return $text; --- 2807,2811 ---- $text = str_replace("\n", '<br />', $text); ! $text = phpBB3::smiley_text($text, !($flags & OPTION_FLAG_SMILIES)); return $text; *************** *** 3053,3059 **** function smiley_text($text, $force_option = false) { ! global $board_config, $user, $phpbb_root_path; ! if ($force_option || !$board_config['allow_smilies'] || !$user->optionget('viewsmilies')) { return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $text); --- 3053,3059 ---- function smiley_text($text, $force_option = false) { ! global $board_config, $mx_user, $phpbb_root_path; ! if ($force_option || !$board_config['allow_smilies'] || !$mx_user->optionget('viewsmilies')) { return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $text); Index: functions_hook.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/shared/phpbb3/includes/functions_hook.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** functions_hook.php 4 Feb 2008 15:56:44 -0000 1.6 --- functions_hook.php 6 Feb 2008 15:13:40 -0000 1.7 *************** *** 32,38 **** var $p_master = null; ! ! function mx_phpbb3_admin() { } --- 32,42 ---- var $p_master = null; ! var $mx_master = null; ! function mx_phpbb3_admin( $mx_master = null) { + if ( $mx_master != null) + { + $this->mx_master = $mx_master; + } } *************** *** 207,350 **** { //$html = preg_replace( '#.*\<div id="page-body"\>#si', '', $html); ! ! $html = trim(preg_replace('#(.*\<div id="page-body"\>|</div>[^<]*?<div id="page-footer">.*)#si', '', $html)); ! return $html; ! } ! ! /** ! * OLD HOOK ! */ ! 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 ) ) ) ! { ! 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 ) ) { ! if ( $header != $row['m1_langname'] ) ! { ! $header = $row['m1_langname']; ! $menu_ary[$header] = array(); ! } ! $menu_ary[$header][$row['m2_langname']] = $row['m2_basename'] ; } ! ! return $menu_ary; } ! function admin_tabs( $curr_tab ) { ! if ( $this->main_part != 'admin' ) ! { ! return false; ! } ! ! global $db, $lang, $template, $mx_user, $phpEx; ! ! $this->current_tab = $curr_tab; ! // This sintax is not correct ! $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 ! "; ! ! /* ! $sql = 'SELECT DISTINCT * ! FROM ' . MODULES_TABLE . " ! WHERE module_enabled = 1 ! AND module_display = 1 ! AND parent_id = 0 ! GROUP BY module_id ! ORDER BY left_id ASC"; ! */ ! /* ! $sql_array = array(); ! $sql_array['SELECT'] = 'm1.*, count(m2.module_id) AS subcount'; ! $sql_array['FROM'][MODULES_TABLE] = 'AS m1'; ! $sql_array['LEFT_JOIN'][] = array( ! 'FROM' => array( MODULES_TABLE => 'AS m2' ), ! 'ON' => 'm1.module_id = m2.parent_id AND m2.module_enabled = 1 AND m2.module_display = 1', ! ); ! $sql_array['GROUP_BY'] = 'm1.module_id'; ! $sql_array['WHERE'] = "m1.parent_id = 0 AND m1.module_class = 'acp'"; ! $sql_array['ORDER_BY'] = 'm1.left_id ASC'; ! $sql = $db->sql_build_query( 'SELECT', $sql_array ); ! */ ! if ( !( $rs = $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Could not obtain tabs data form phpbb3 modules', 'Error', __LINE__, __FILE__, $sql ); ! } ! $return_category = ''; ! while ( $row = $db->sql_fetchrow( $rs ) ) { } ! return $return_category; ! } ! ! function admin_panel( $acp_panel, $mode = '' ) ! { ! global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $mx_user, $mx_cache, $cache, $template; ! global $phpbb_auth, $auth; ! $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 = $mx_user; ! $auth = $phpbb_auth; ! $auth->acl( $user->data ); ! $user->setup( 'acp/common' ); ! ! $module_id = $acp_panel; ! ! $user->theme['template_storedb'] = false; ! // $template->set_custom_template($phpbb_admin_path . 'style', 'admin'); ! // 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; } } --- 211,268 ---- { //$html = preg_replace( '#.*\<div id="page-body"\>#si', '', $html); ! global $phpbb_root_path, $phpbb_admin_path; ! $html = trim(preg_replace('#<!-- INCLUDE overall_(header|footer)\.html -->#si', '', $html)); ! //$match_img_count = preg_match_all( '#img src="(adm\/[^"]*)"#s', $html, $match_img); ! // REPLACE IMAGES_PATHs ! $preg_array = array( ! '#img src="((adm|..)\/[^"]*)"#si' => 'img src="'.$phpbb_root_path.'\1"', ! '#img src="(images\/[^"]*)"#si' => 'img src="'.$phpbb_root_path . $phpbb_admin_path.'\1"', ! ); ! $html = preg_replace( array_keys( $preg_array), $preg_array, $html); ! // REPLACE LINK PATHs ! $html = $this->_convert_links( $html); ! if ( 0 ) { ! print '<pre>'; ! print htmlentities( $html); ! print_r( $match_link); ! die( ); } ! return $html; } ! function _convert_links( $html ) { ! global $phpEx, $mx_request_vars; ! $panel_i = $mx_request_vars->request( 'i', ''); ! $menu_action = $this->mx_master->menu_actions; ! $admin_path = $mx_root_path. 'acp/'; ! $match_link_cnt = preg_match_all( '#(action|href)=[\'"](([^?]*)\??([^\'"]*?))[\'"]#si', $html, $match_link); ! $preg_array = array(); ! for( $i=0; $i<$match_link_cnt; $i++) { + $params = str_replace( '&', '&', $match_link[4][$i]); + $p_cnt = preg_match_all( '#([^=&]*)=([^&]*)#si', '&' . $params , $link_parts); + $link_compare_ary = array_combine( $link_parts[1], $link_parts[2]); + $eregi = 'adm/index.' . $phpEx . '?i=' . $panel_i . '&panel=' . $link_compare_ary['i'] . '&mode=' . $link_compare_ary['mode']; + $panel = $menu_action[$eregi]; + $link = 'index.' . $phpEx . '?cat=' . OLYMPUS_CATEGORY . '&i=' . $panel_i . '&panel=' . $menu_action[$eregi] . '&mode=' . $link_compare_ary['mode']; + unset( $link_compare_ary['i']); + unset( $link_compare_ary['mode']); + ksort( $link_compare_ary); + foreach( $link_compare_ary as $key => $value) + { + $link .= '&' . $key . '=' . $value; + } + $link_orig = preg_replace( '#([./\[\]\(\)?\\\\]{1})#si', "\\\\\\1", $match_link[2][$i]); + $preg_array = array_merge( $preg_array, array( '#' . $link_orig .'#si' => $link)); } ! return preg_replace( array_keys( $preg_array), $preg_array, $html); } } Index: functions_module.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/shared/phpbb3/includes/functions_module.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** functions_module.php 5 Feb 2008 14:51:27 -0000 1.7 --- functions_module.php 6 Feb 2008 15:13:40 -0000 1.8 *************** *** 19,23 **** // // Common global functions ! // Fixes for MX-Publisher: // $config -> $board_config // $cache -> $mx_cache --- 19,23 ---- // // Common global functions ! // Fixes for mxBB: // $config -> $board_config // $cache -> $mx_cache *************** *** 71,75 **** ORDER BY left_id ASC"; $result = $db->sql_query($sql); ! $rows = array(); while ($row = $db->sql_fetchrow($result)) --- 71,75 ---- ORDER BY left_id ASC"; $result = $db->sql_query($sql); ! $rows = array(); while ($row = $db->sql_fetchrow($result)) *************** *** 206,210 **** $names[$row['module_basename'] . '_' . $row['module_mode']][] = true; ! $module_row = array( 'depth' => $depth, --- 206,210 ---- $names[$row['module_basename'] . '_' . $row['module_mode']][] = true; ! $module_row = array( 'depth' => $depth, *************** *** 426,432 **** $func_array = array( ! 'request_var', 'add_form_key', 'generate_text_for_display' ); ! $preg_array = array( '#^<\?(php)?|\?>$#si' => '', --- 426,432 ---- $func_array = array( ! 'request_var', 'add_form_key', 'generate_text_for_display', 'censor_text' ); ! $preg_array = array( '#^<\?(php)?|\?>$#si' => '', *************** *** 437,447 **** '#append_sid\(#si' => 'mx3_append_sid(', '#get_username_string\(#si' => 'mx_get_username_string(', ! '#global#si' => 'global $mx_acp,', '#\$template-#si' => '$mx_acp->template-', '#(' . implode( '|', $func_array) . ')\(#si' => 'phpBB3::\1(', ); ! ! $modulecode = preg_replace( array_keys( $preg_array), array_values( $preg_array), $modulecode); ! $mx_user = new mx_user(); eval($modulecode); --- 437,447 ---- '#append_sid\(#si' => 'mx3_append_sid(', '#get_username_string\(#si' => 'mx_get_username_string(', ! '#global#si' => 'global $mx_acp,', '#\$template-#si' => '$mx_acp->template-', '#(' . implode( '|', $func_array) . ')\(#si' => 'phpBB3::\1(', ); ! ! $modulecode = preg_replace( array_keys( $preg_array), array_values( $preg_array), $modulecode); ! $mx_user = new mx_user(); eval($modulecode); |