|
From: Jon O. <jon...@us...> - 2005-12-09 23:22:12
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9047/includes Modified Files: mx_functions.php mx_functions_admincp.php mx_functions_core.php page_header.php page_tail.php Log Message: - phpbb_stats per page - updated schemas - site search optimization (in progress) - code cleanup in index.php, common.php and page_header.php - gzip fixes in progress Index: page_header.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/page_header.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** page_header.php 8 Dec 2005 14:41:48 -0000 1.27 --- page_header.php 9 Dec 2005 23:22:03 -0000 1.28 *************** *** 68,72 **** // ! // If mxBB frane template is not set, instantiate it // if (!is_object($layouttemplate)) --- 68,72 ---- // ! // If mxBB frame template is not set, instantiate it // if (!is_object($layouttemplate)) *************** *** 83,87 **** // $layouttemplate->set_filenames(array( ! 'overall_header' => ( $page_ov_header == '' ? ( empty($gen_simple_header) ? 'overall_header.tpl' : 'simple_header.tpl' ) : ( file_exists($mx_root_path . TEMPLATE_ROOT_PATH . $page_ov_header) ? $page_ov_header : 'overall_header.tpl' ) ) ) ); --- 83,87 ---- // $layouttemplate->set_filenames(array( ! 'overall_header' => ( $mx_page->page_ov_header == '' ? ( empty($gen_simple_header) ? 'overall_header.tpl' : 'simple_header.tpl' ) : ( file_exists($mx_root_path . TEMPLATE_ROOT_PATH . $mx_page->page_ov_header) ? $mx_page->page_ov_header : 'overall_header.tpl' ) ) ) ); *************** *** 146,150 **** $l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms']; $l_privmsgs_text_unread = sprintf($l_message_unread, $userdata['user_unread_privmsg']); - // $mx_priv_msg = $lang['Private_Messages'] . ' (' . $userdata['user_unread_privmsg'] . ')'; } else --- 146,149 ---- *************** *** 192,196 **** $l_timezone = ( count( $l_timezone ) > 1 && $l_timezone[count( $l_timezone )-1] != 0 ) ? $lang[sprintf( '%.1f', $board_config['board_timezone'] )] : $lang[number_format( $board_config['board_timezone'] )]; ! $page_icon_img = ( !empty($page_icon) && $page_icon != 'none' ) ? '<img align="absmiddle" src="' . PORTAL_URL . TEMPLATE_ROOT_PATH . 'images/page_icons/' . $page_icon . '" alt="" /> ' : ''; $option_search_site = '<option value="site">' . $lang['Mx_search_site'] . '</option>'; --- 191,195 ---- $l_timezone = ( count( $l_timezone ) > 1 && $l_timezone[count( $l_timezone )-1] != 0 ) ? $lang[sprintf( '%.1f', $board_config['board_timezone'] )] : $lang[number_format( $board_config['board_timezone'] )]; ! $page_icon_img = ( !empty($mx_page->page_icon) && $mx_page->page_icon != 'none' ) ? '<img align="absmiddle" src="' . PORTAL_URL . TEMPLATE_ROOT_PATH . 'images/page_icons/' . $mx_page->page_icon . '" alt="" /> ' : ''; $option_search_site = '<option value="site">' . $lang['Mx_search_site'] . '</option>'; *************** *** 206,210 **** 'SITENAME' => $board_config['sitename'], 'SITE_DESCRIPTION' => $board_config['site_desc'], ! 'PAGE_TITLE' => $mx_page_title, 'LAST_VISIT_DATE' => sprintf($lang['You_last_visit'], $s_last_visit), 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($board_config['default_dateformat'], time(), $board_config['board_timezone'])), --- 205,209 ---- 'SITENAME' => $board_config['sitename'], 'SITE_DESCRIPTION' => $board_config['site_desc'], ! 'PAGE_TITLE' => $mx_page->page_title, 'LAST_VISIT_DATE' => sprintf($lang['You_last_visit'], $s_last_visit), 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($board_config['default_dateformat'], time(), $board_config['board_timezone'])), *************** *** 324,336 **** // ! // Show portal front page info/links? ! // ! if ( $page_id != 1 || $portal_config['top_phpbb_links'] == 0 ) ! { ! $layouttemplate->assign_block_vars('portal_top_links_off', array()); ! } ! ! // ! // Login box? // if ( !$userdata['session_logged_in'] ) --- 323,327 ---- // ! // Login box & swithes for logged in users? // if ( !$userdata['session_logged_in'] ) *************** *** 346,349 **** --- 337,349 ---- $layouttemplate->assign_block_vars('switch_user_logged_out.switch_allow_autologin', array()); } + + // + // Show phpbb stats? + // + if ( $mx_page->phpbb_stats ) + { + $layouttemplate->assign_block_vars('phpbb_stats', array()); + $layouttemplate->assign_block_vars('phpbb_stats.switch_user_logged_out', array()); + } } else *************** *** 355,362 **** $layouttemplate->assign_block_vars('switch_enable_pm_popup', array()); } } // ! // Do NOT set basedir when in EDIT mode - NEEDED ANYMORE?????????????????????????????? // if ( !(isset($HTTP_POST_VARS['portalpage']) || isset($HTTP_GET_VARS['portalpage'])) ) --- 355,371 ---- $layouttemplate->assign_block_vars('switch_enable_pm_popup', array()); } + + // + // Show phpbb stats? + // + if ( $mx_page->phpbb_stats ) + { + $layouttemplate->assign_block_vars('phpbb_stats', array()); + $layouttemplate->assign_block_vars('phpbb_stats.switch_user_logged_in', array()); + } } // ! // Do NOT set basedir when in EDIT mode // if ( !(isset($HTTP_POST_VARS['portalpage']) || isset($HTTP_GET_VARS['portalpage'])) ) *************** *** 369,374 **** // $useragent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT'); ! $is_gecko = ( strstr($useragent, 'Gecko') ); ! if ( $is_gecko ) { $layouttemplate->assign_block_vars('switch_gecko', array()); --- 378,382 ---- // $useragent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT'); ! if ( strstr($useragent, 'Gecko') ) { $layouttemplate->assign_block_vars('switch_gecko', array()); *************** *** 391,395 **** header ('Pragma: no-cache'); - include($mx_root_path . 'mx_meta.inc'); $meta_str = '<meta name="title" content="' . $title .'" />' . "\n"; --- 399,402 ---- Index: mx_functions_admincp.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_admincp.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** mx_functions_admincp.php 8 Dec 2005 14:41:48 -0000 1.13 --- mx_functions_admincp.php 9 Dec 2005 23:22:03 -0000 1.14 *************** *** 359,362 **** --- 359,363 ---- $ipfilter = $mx_request_vars->post('ip_filter', MX_TYPE_POST_VARS, ''); + $phpbb_stats = $mx_request_vars->post('phpbb_stats', MX_TYPE_INT, '-1'); // *************** *** 385,389 **** } ! $sql = "INSERT INTO " . PAGE_TABLE . " ( page_id, page_name, page_desc, page_icon, page_graph_border, auth_view, page_header, ip_filter ) VALUES ( '" . $page_id_new . "', '" . $page_name . "', --- 386,390 ---- } ! $sql = "INSERT INTO " . PAGE_TABLE . " ( page_id, page_name, page_desc, page_icon, page_graph_border, auth_view, page_header, ip_filter, phpbb_stats ) VALUES ( '" . $page_id_new . "', '" . $page_name . "', *************** *** 393,397 **** '" . $auth_view . "', '" . $page_header . "', ! '" . $ipfilter . "' )"; if( !($result = $db->sql_query($sql)) ) --- 394,399 ---- '" . $auth_view . "', '" . $page_header . "', ! '" . $ipfilter . "', ! '" . $phpbb_stats . "' )"; if( !($result = $db->sql_query($sql)) ) *************** *** 932,935 **** --- 934,938 ---- $auth_view = $mx_request_vars->post('auth_view', MX_TYPE_INT, 0); $ipfilter = $mx_request_vars->post('ip_filter', MX_TYPE_POST_VARS, ''); + $phpbb_stats = $mx_request_vars->post('phpbb_stats', MX_TYPE_INT, '-1'); // *************** *** 951,955 **** page_graph_border = '$page_graph_border', auth_view = '$auth_view', ! ip_filter = '$ipfilter' WHERE page_id = $page_id"; if( !($result = $db->sql_query($sql)) ) --- 954,959 ---- page_graph_border = '$page_graph_border', auth_view = '$auth_view', ! ip_filter = '$ipfilter', ! phpbb_stats = '$phpbb_stats' WHERE page_id = $page_id"; if( !($result = $db->sql_query($sql)) ) Index: page_tail.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/page_tail.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** page_tail.php 8 Dec 2005 14:41:48 -0000 1.19 --- page_tail.php 9 Dec 2005 23:22:03 -0000 1.20 *************** *** 38,44 **** // Generate the fold/unfold categories switches // ! if ( $mx_page->editcp_switch ) { ! $template->assign_block_vars('switch_edit_' . ( $mx_show_edit_blocks_on ? 'on' : 'off' ), array()); } --- 38,44 ---- // Generate the fold/unfold categories switches // ! if ( $mx_page->editcp_switch_show ) { ! $template->assign_block_vars('switch_edit_' . ( $mx_page->editcp_switch_on ? 'on' : 'off' ), array()); } Index: mx_functions_core.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_core.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** mx_functions_core.php 9 Dec 2005 00:22:18 -0000 1.17 --- mx_functions_core.php 9 Dec 2005 23:22:03 -0000 1.18 *************** *** 598,601 **** --- 598,602 ---- pag.auth_moderator_group AS pag_auth_moderator_group, pag.ip_filter, + pag.phpbb_stats, bct.column_id, col.column_title, *************** *** 640,644 **** "page_auth_view_group" => $row['page_auth_view_group'], "page_auth_moderator_group" => $row['page_auth_moderator_group'], ! "ip_filter" => $row['ip_filter'] ); --- 641,646 ---- "page_auth_view_group" => $row['page_auth_view_group'], "page_auth_moderator_group" => $row['page_auth_moderator_group'], ! "ip_filter" => $row['ip_filter'], ! "phpbb_stats" => $row['phpbb_stats'] ); *************** *** 795,799 **** | $mx_block->output_hidden_indicator() : Switch for displaying 'hidden' indicator | $mx_block->output_title() : Switch for displaying block title ! | $mx_block->output_cp_button($edit_on) : Switch for displaying block CP indicator | | // --- 797,801 ---- | $mx_block->output_hidden_indicator() : Switch for displaying 'hidden' indicator | $mx_block->output_title() : Switch for displaying block title ! | $mx_block->output_cp_button() : Switch for displaying block CP indicator | | // *************** *** 1043,1047 **** } ! function output_cp_button( $edit_on ) { global $layouttemplate, $userdata, $mx_root_path, $mx_page, $lang, $block_size, $title_class; --- 1045,1049 ---- } ! function output_cp_button() { global $layouttemplate, $userdata, $mx_root_path, $mx_page, $lang, $block_size, $title_class; *************** *** 1097,1101 **** // Switch: Edit Block state // ! $layouttemplate->assign_block_vars( 'layout_column.blocks.edit.switch_edit_' . ( $edit_on ? 'on' : 'off' ), array() ); } --- 1099,1103 ---- // Switch: Edit Block state // ! $layouttemplate->assign_block_vars( 'layout_column.blocks.edit.switch_edit_' . ( $mx_page->editcp_switch_on ? 'on' : 'off' ), array() ); } *************** *** 1887,1890 **** --- 1889,1896 ---- var $blocks = array(); + var $page_title = ''; + var $page_icon = ''; + var $page_ov_header = ''; + var $total_column = ''; var $total_block = ''; *************** *** 1892,1898 **** var $auth_view = false; var $auth_ip = false; var $block_border_graphics = false; ! var $editcp_switch = false; // ------------------------------ --- 1898,1907 ---- var $auth_view = false; var $auth_ip = false; + var $phpbb_stats = '-1'; var $block_border_graphics = false; ! ! var $editcp_switch_show = false; ! var $editcp_switch_on = false; // ------------------------------ *************** *** 1912,1916 **** function _set_all( $page_id ) { ! global $userdata, $mx_root_path, $HTTP_GET_VARS; $this->info = $this->page_config[$page_id]['page_info']; --- 1921,1925 ---- function _set_all( $page_id ) { ! global $userdata, $mx_root_path, $HTTP_GET_VARS, $HTTP_COOKIE_VARS, $portal_config; $this->info = $this->page_config[$page_id]['page_info']; *************** *** 1928,1931 **** --- 1937,1948 ---- // + // General + // + $this->page_title = $this->info['page_name']; + $this->page_icon = $this->info['page_icon']; + $this->page_ov_header = $this->info['page_header']; + $this->phpbb_stats = $this->info['phpbb_stats'] == -1 ? ($portal_config['top_phpbb_links'] == 1 ? true : false ) : ( $this->info['phpbb_stats'] == 1 ? true : false ); + + // // Set the public view auth // *************** *** 1948,1951 **** --- 1965,1980 ---- $s_hidden_fields .= '<input type="hidden" name="p" value="' . intval( $HTTP_GET_VARS['p'] ) . '" />'; $this->s_hidden_fields = $s_hidden_fields; + + // + // Generate the fold/unfold menu navigation switches (cookie based) + // + if ( $userdata['user_level'] == ADMIN && isset($HTTP_COOKIE_VARS['phpbbEdit_Blocks']) ) + { + $this->editcp_switch_on = $HTTP_COOKIE_VARS['phpbbEdit_Blocks']; + } + else + { + $this->editcp_switch_on = true; + } } *************** *** 1997,2001 **** function show_editcp_switch() { ! $this->editcp_switch = true; } --- 2026,2035 ---- function show_editcp_switch() { ! global $userdata; ! ! if ( $userdata['user_level'] == ADMIN && $userdata['session_logged_in']) ! { ! $this->editcp_switch_show = true; ! } } Index: mx_functions.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions.php,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** mx_functions.php 8 Dec 2005 14:41:48 -0000 1.52 --- mx_functions.php 9 Dec 2005 23:22:03 -0000 1.53 *************** *** 517,524 **** // ! // ! // declared in common.php, just before calling mx_session_start. ;-) ! // ! // $do_gzip_compress = FALSE; if ( $board_config['gzip_compress'] && !defined('MX_GZIP_DISABLED') ) --- 517,524 ---- // ! // ! // declared in common.php, just before calling mx_session_start. ;-) ! // ! // $do_gzip_compress = FALSE; if ( $board_config['gzip_compress'] && !defined('MX_GZIP_DISABLED') ) *************** *** 556,560 **** // session_start(); - } --- 556,559 ---- *************** *** 646,649 **** --- 645,689 ---- } + + if( empty($p_row['page_id']) ) + { + $sql = "SELECT pag.page_id, sys.parameter_value + FROM " . COLUMN_BLOCK_TABLE . " bct, + " . PAGE_TABLE . " pag, + " . COLUMN_TABLE . " col, + " . BLOCK_SYSTEM_PARAMETER_TABLE . " sys, + " . PARAMETER_TABLE . " par + WHERE pag.page_id = col.page_id + AND bct.column_id = col.column_id + AND bct.block_id = sys.block_id + AND sys.parameter_id = par.parameter_id + AND par.parameter_name = 'block_ids' + ORDER BY sys.block_id"; + + if( !($p_result = $db->sql_query($sql)) ) + { + mx_message_die(GENERAL_ERROR, "Could not query column list", '', __LINE__, __FILE__, $sql); + } + + while( $temp_row = $db->sql_fetchrow($p_result) ) + { + $block_ids_array = explode(',' , $temp_row['parameter_value']); + + foreach($block_ids_array as $key => $block_id) + { + if ($block_id = $search_item) + { + $p_row['page_id'] = $temp_row['page_id']; + continue; + } + } + + if (!empty($p_row['page_id'])) + { + continue; + } + } + } + $page_id = ( !empty($p_row['page_id']) ) ? $p_row['page_id'] : ''; |