|
From: Jon O. <jon...@us...> - 2005-05-01 16:14:13
|
Update of /cvsroot/mxbb/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17941 Modified Files: common.php index.php Log Message: merging new cache :-) Index: common.php =================================================================== RCS file: /cvsroot/mxbb/core/common.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** common.php 25 Apr 2005 12:18:43 -0000 1.33 --- common.php 1 May 2005 16:13:59 -0000 1.34 *************** *** 27,31 **** define('IN_PHPBB', 1); - // ================================================================================ // The following code is based on common.php from phpBB 2.0.14 --- 27,30 ---- *************** *** 234,238 **** ! // // Obtain and encode users IP // --- 233,240 ---- ! // instatiate the mx_cache class ! ! $mx_cache = new mx_cache(); ! // Obtain and encode users IP // Index: index.php =================================================================== RCS file: /cvsroot/mxbb/core/index.php,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** index.php 25 Apr 2005 23:56:07 -0000 1.36 --- index.php 1 May 2005 16:14:00 -0000 1.37 *************** *** 23,29 **** //define('MX_DEBUG', 1); ! define('IN_PORTAL', 1); ! $mx_root_path = './'; include($mx_root_path . 'extension.inc'); --- 23,29 ---- //define('MX_DEBUG', 1); ! define( 'IN_PORTAL', 1 ); ! $mx_root_path = "./"; include($mx_root_path . 'extension.inc'); *************** *** 35,38 **** --- 35,39 ---- // Page selector // + $page_id = $mx_request_vars->request('page', MX_TYPE_INT, 1); *************** *** 40,46 **** // Start session management // ! $userdata = session_pagestart($user_ip, (MX_PORTAL_PAGES_OFFSET - $page_id)); mx_init_userprefs($userdata); if ( $mx_request_vars->is_request('mx_copy') ) --- 41,51 ---- // Start session management // ! ! $userdata = session_pagestart($user_ip, - ( 1000 + $page_id )); mx_init_userprefs($userdata); + // + // End session management + // if ( $mx_request_vars->is_request('mx_copy') ) *************** *** 50,99 **** // ! // Load page vars ! // Load http_session variables if populated, else consult db and populate http_session // ! $mx_session_time = isset($HTTP_SESSION_VARS['mx_session_recached']) ? $HTTP_SESSION_VARS['mx_session_recached'] : $userdata['session_start']; ! if ( empty($HTTP_SESSION_VARS['mx_pages']['page_' . $page_id]) || $portal_config['portal_recached'] > $mx_session_time ) ! { ! $HTTP_SESSION_VARS['mx_session_recached'] = $portal_config['portal_recached']; ! if ( defined('MX_DEBUG') ) ! { ! echo('populating page block http_session'); ! } ! // Populate all mx_pages session vars, for faster navigation ! get_page_session(); ! } // ! // Now use the session data // ! $page_row = $HTTP_SESSION_VARS['mx_pages']['page_' . $page_id]['page_info']; ! ! $block_rows = $HTTP_SESSION_VARS['mx_pages']['page_' . $page_id]['blocks']; ! $total_block = count($block_rows); ! ! $column_rows = $HTTP_SESSION_VARS['mx_pages']['page_' . $page_id]['columns']; ! $total_column = count($column_rows); ! ! $page_title .= $page_row['page_name']; ! $page_icon = $page_row['page_icon']; ! $page_ov_header = $page_row['page_header']; // // Page auth // - $is_auth_ary = page_auth(AUTH_VIEW, $userdata, $page_row['page_auth_view'], $page_row['page_auth_view_group']); ! if( !$is_auth_ary['auth_view'] ) { ! if( $userdata['session_logged_in'] ) ! { ! $message = empty($lang['Page_Not_Authorised']) ? "Sorry, but you don't have privilege to access this page." : $lang['Page_Not_Authorised']; ! mx_message_die(GENERAL_MESSAGE, $message); ! } ! else ! { ! mx_redirect(append_sid($mx_root_path . "login.$phpEx?redirect=" . mx_this_url(), true)); ! } } --- 55,86 ---- // ! // Load page and block classes // ! ! $mx_page = new mx_page(); ! $mx_page->init( $page_id ); ! ! $mx_block = new mx_block(); // ! // ...and define some basic vars // ! ! $page_title .= $mx_page->info['page_name']; ! $page_icon = $mx_page->info['page_icon']; ! $page_ov_header = $mx_page->info['page_header']; // // Page auth // ! if ( !$mx_page->auth_view && $userdata['session_logged_in'] ) { ! $message = empty( $lang['Page_Not_Authorised'] ) ? "Sorry, but you don't have privilege to access this page." : $lang['Page_Not_Authorised']; ! mx_message_die(GENERAL_MESSAGE, $message, '', __LINE__, __FILE__, ''); ! } ! elseif ( !$mx_page->auth_view && !$userdata['session_logged_in'] ) ! { ! mx_redirect( append_sid( $mx_root_path . "login.$phpEx?redirect=" . mx_this_url(), true ) ); } *************** *** 101,110 **** // Output header // ! include($mx_root_path . 'includes/page_header.' . $phpEx); // // Initialize template // ! $layouttemplate = new mx_Template($template->root); $layouttemplate->set_filenames(array( --- 88,99 ---- // Output header // ! ! include( $mx_root_path . 'includes/page_header.' . $phpEx ); // // Initialize template // ! ! $layouttemplate = new mx_Template( $template->root, $board_config, $db ); $layouttemplate->set_filenames(array( *************** *** 115,363 **** // Generate the fold/unfold menu navigation switches (cookie based) // if ( !empty($HTTP_COOKIE_VARS['phpbbEdit_Blocks']) ) { ! $mx_show_edit_blocks_on = $HTTP_COOKIE_VARS['phpbbEdit_Blocks']; } elseif ( $userdata['user_level'] == ADMIN ) { ! $mx_show_edit_blocks_on = true; } else { ! $mx_show_edit_blocks_on = false; } - $mx_show_edit_blocks_icon = false; // Start output of page --------------------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------------------ // ! // Page columns // - for( $column = 0; $column < $total_column; $column++ ) - { - $block_size = $column_rows[$column]['column_size']; - // Send optional column class - - if ( $total_column == 1 ) - { - $colclass = 'middlecol'; - } - else - { - switch( $column ) - { - case 0: - $colclass = 'leftcol'; - break; - case 1: - $colclass = 'middlecol'; - break; - case 2: - $colclass = 'rightcol'; - break; - } - } // // Pass column data // ! $layouttemplate->assign_block_vars('layout_column', array( ! 'COL_CLASS' => $colclass, ! 'BLOCK_SIZE' => $block_size ! )); ! $column_contents = array(); ! // ! // Page blocks // ! for( $block = 0; $block < $total_block; $block++ ) { // ! // Validate this block is really visible and exists for the column // - if ( $column_rows[$column]['column_id'] != $block_rows[$block]['column_id'] ) - { - continue; - } - - $block_id = $mx_block_id = $block_rows[$block]['block_id']; - $block_file = $block_rows[$block]['function_file']; - $dynamic_main_block_id = ''; - - // Block view auth ----------------------------------------------------------------------------------------------------- - - $is_auth_ary = block_auth(AUTH_VIEW, $mx_block_id, $userdata, $block_rows[$block]['auth_view'], $block_rows[$block]['auth_view_group']); ! if ( ($is_auth_ary['auth_view'] && $block_rows[$block]['show_block'] == 1) || $is_auth_ary['auth_mod'] ) ! { ! //$layouttemplate->assign_block_vars('layoutcol', array()); ! $template = new mx_Template($template->root, $board_config, $db); ! ! $module_root_path = $block_rows[$block]['module_path']; ! ! $title_class = ( $block_rows[$block]['function_file'] != 'mx_multiple_blocks.php' ? 'mxthHead' : 'mxthHead_none' ); ! ! ob_start(); ! include($module_root_path . $block_file); ! $column_contents[$column] = ob_get_contents(); ! ob_end_clean(); // ! // Pass block data // ! if ( $block_rows[$block]['show_block'] == 1 || $is_auth_ary['auth_mod'] ) { ! $layouttemplate->assign_block_vars('layout_column.blocks', array( ! 'BLOCK' => $column_contents[$column], ! 'BLOCK_SIZE' => ( !empty($block_size) ? $block_size : '100%' ) ! )); ! // ! // Switch: graphical block borders // ! if ( !empty($page_row['page_graph_border']) ) { ! if ( file_exists($mx_root_path . TEMPLATE_ROOT_PATH . 'images/' . $page_row['page_graph_border'] . '1-1.gif') ) { ! $layouttemplate->assign_block_vars('layout_column.blocks.graph_border', array( ! 'TEMPLATE_ROOT_PATH' => TEMPLATE_ROOT_PATH, ! 'PREFIX' => $page_row['page_graph_border'] ! )); } } ! ! if ( $block_rows[$block]['show_stats'] == 1 && !empty($block_rows[$block]['block_time']) && !empty($block_rows[$block]['block_editor_id']) ) { ! $editor_name_tmp = get_userdata($block_rows[$block]['block_editor_id']); ! $editor_name = $editor_name_tmp['username']; ! $edit_time = create_date($board_config['default_dateformat'], $block_rows[$block]['block_time'], $board_config['board_timezone']); ! ! $layouttemplate->assign_block_vars('layout_column.blocks.block_stats', array( ! 'L_BLOCK_UPDATED' => $lang['Block_updated_by'], ! 'EDITOR_NAME' => $editor_name, ! 'EDIT_TIME' => $edit_time ! )); ! } ! else { ! $layouttemplate->assign_block_vars('layout_column.blocks.no_stats', array()); } ! } ! } // End View auth ! ! // Block edit auth --------------------------------------------------------------------------------- ! $mx_block_edit = false; ! ! $is_auth_ary = block_auth(AUTH_EDIT, $mx_block_id, $userdata, $block_rows[$block]['auth_edit'], $block_rows[$block]['auth_edit_group']); ! ! if ( ( ($is_auth_ary['auth_edit'] && $block_rows[$block]['show_block'] == 1 ) || $is_auth_ary['auth_mod']) ) ! { ! $mx_show_edit_blocks_icon = true; ! $mx_block_edit = true; ! ! // Define some hidden Edit Block parameters ! $s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />'; ! $s_hidden_fields .= '<input type="hidden" name="portalpage" value="' . $page_id . '" />'; ! $s_hidden_fields .= '<input type="hidden" name="mode" value="setting" />'; ! $s_hidden_fields .= '<input type="hidden" name="f" value="' . intval($HTTP_GET_VARS['f']) . '" />'; ! $s_hidden_fields .= '<input type="hidden" name="t" value="' . intval($HTTP_GET_VARS['t']) . '" />'; ! $s_hidden_fields .= '<input type="hidden" name="p" value="' . intval($HTTP_GET_VARS['p']) . '" />'; ! ! // ! // Switch between different block types ! // ! $block_edit_img = ( ( $block_file == 'mx_multiple_blocks.php' ) ? 'block_edit_split.gif' : ( $block_file == 'mx_textblock_blog.php' ? 'block_edit_admin.gif' : 'block_edit.gif' ) ) ; ! $split_admin_file = !empty($block_rows[$block]['function_admin']) ? $block_rows[$block]['function_admin'] : 'admin/admin_mx_block.php'; ! ! // ! // Dynamic Block Itself ! // ! if ( !empty($dynamic_main_block_id) ) ! { ! $is_dynamic_auth_ary = block_auth(AUTH_EDIT, $dynamic_main_block_id , $userdata, $dynamic_block_config[$dynamic_main_block_id]['auth_edit'], $dynamic_block_config[$dynamic_main_block_id]['auth_edit_group']); ! ! if ( ($is_dynamic_auth_ary['auth_edit'] || $is_dynamic_auth_ary['auth_mod']) ) ! { ! $block_desc = !empty($dynamic_block_config[$dynamic_main_block_id]['block_desc']) ? ' (' . $dynamic_block_config[$dynamic_main_block_id]['block_desc'] . ')' : ''; ! $edit_url = append_sid($mx_root_path . "admin/admin_mx_block.php?sid=" . $userdata['session_id']); ! ! $edit_img = '<input type="image" class ="editblock" src="' . PORTAL_URL . TEMPLATE_ROOT_PATH . 'images/block_icons/' . 'block_edit_admin.gif' . '" alt="' . $lang['Block_Edit'] . $block_rows[$block]['block_id'] . '" title="' . $lang['Block_Edit'] . ' :: ' . $dynamic_block_config[$dynamic_main_block_id]['block_title'] . $block_desc . '">'; ! ! $s_hidden_fields .= '<input type="hidden" name="block_id" value="' . $dynamic_main_block_id . '" />'; ! $layouttemplate->assign_block_vars('layout_column.blocks.edit', array( ! 'BLOCK_SIZE' => ( !empty($block_size) ? $block_size : '100%' ), ! 'L_TITLE' => $title, ! 'L_DESC' => $b_description, ! 'EDIT_ACTION' => $edit_url, ! 'EDIT_IMG' => $edit_img, ! 'TITLECLASS' => $title_class, ! 'S_HIDDEN_FORM_FIELDS' => $s_hidden_fields )); ! ! $layouttemplate->assign_block_vars('layout_column.blocks.edit.switch_edit_' . ( $mx_show_edit_blocks_on ? 'on' : 'off' ), array()); } - } - - $block_desc = !empty($block_rows[$block]['block_desc']) ? ' (' . $block_rows[$block]['block_desc'] . ')' : ''; - $edit_url = append_sid($mx_root_path . $split_admin_file . "?sid=" . $userdata['session_id']); - $edit_img = '<input type="image" class ="editblock" src="' . PORTAL_URL . TEMPLATE_ROOT_PATH . 'images/block_icons/' . $block_edit_img . '" alt="' . $lang['Block_Edit'] . ' :: ' . $block_rows[$block]['block_title'] . $block_desc . '" title="' . $lang['Block_Edit'] . ' :: ' . $block_rows[$block]['block_title'] . $block_desc . '">'; - - $s_hidden_fields .= '<input type="hidden" name="block_id" value="' . $mx_block_id . '" />'; - - $layouttemplate->assign_block_vars('layout_column.blocks.edit', array( - 'BLOCK_SIZE' => ( !empty($block_size) ? $block_size : '100%' ), - 'L_TITLE' => $title, - 'L_DESC' => $b_description, - 'EDIT_ACTION' => $edit_url, - 'EDIT_IMG' => $edit_img, - 'TITLECLASS' => $title_class, - 'S_HIDDEN_FORM_FIELDS' => $s_hidden_fields - )); - - // - // Is the Block hidden ? - // - if ( $block_rows[$block]['show_block'] == 0 ) - { - $hidden_img = '<img src="' . PORTAL_URL . TEMPLATE_ROOT_PATH . 'images/block_icons/block_hidden.gif" alt="' . $lang['Hidden_block'] . '">'; - $layouttemplate->assign_block_vars('layout_column.blocks.edit.hidden_block', array( - 'HIDDEN_BLOCK' => $hidden_img - )); - } // ! // Switch: Edit Block // ! $layouttemplate->assign_block_vars('layout_column.blocks.edit.switch_edit_' . ( $mx_show_edit_blocks_on ? 'on' : 'off' ), array()); ! ! } // End Edit auth ! ! // Switch: show block header ------------------- ! if ( $block_rows[$block]['show_block'] == 1 && ( $mx_block_edit || $block_rows[$block]['show_title'] == 1 ) || $is_auth_ary['auth_mod'] ) ! { ! $layouttemplate->assign_block_vars('layout_column.blocks.block_header', array()); ! ! // Switch: show title ------------------- ! if ( $block_rows[$block]['show_title'] == 1 || $is_auth_ary['auth_mod'] ) { ! $this_block_title = $block_rows[$block]['show_title'] == 0 && $is_auth_ary['auth_mod'] ? '(' . $block_rows[$block]['block_title'] . ')' : $block_rows[$block]['block_title']; ! $layouttemplate->assign_block_vars('layout_column.blocks.show_title', array( ! 'L_TITLE' => $this_block_title, ! 'TITLECLASS' => $title_class ! )); } } ! } // for ... blocks ! } // for ... column // Output page $layouttemplate->pparse('mx_main_layout'); // Output footer include($mx_root_path . 'includes/page_tail.' . $phpEx); --- 104,362 ---- // Generate the fold/unfold menu navigation switches (cookie based) // + if ( !empty($HTTP_COOKIE_VARS['phpbbEdit_Blocks']) ) { ! $edit_on = $HTTP_COOKIE_VARS['phpbbEdit_Blocks']; } elseif ( $userdata['user_level'] == ADMIN ) { ! $edit_on = true; } else { ! $edit_on = false; } + // // Start output of page --------------------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------------------ + // // ! // Page columns - loop through each column // + for( $column = 0; $column < $mx_page->total_column; $column++ ) + { // // Pass column data // ! ! $mx_page->output_column( $column ); ! // ! // Column blocks - loop through column blocks // ! ! $column_contents = array(); ! ! for( $block = 0; $block < $mx_page->total_block; $block++ ) { // ! // Validate this block is visible and exists for the column // ! if ( $mx_page->columns[$column]['column_id'] == $mx_page->blocks[$block]['column_id'] ) ! { ! ! $block_id = $mx_block_id = $mx_page->blocks[$block]['block_id']; ! $mx_block->init( $block_id ); ! ! // ! // Toggle mode: default, dynamic, sub ! // ! ! if ( $mx_block->is_dynamic ) ! { ! $mx_dynamic_block = new mx_block(); ! $mx_dynamic_block = $mx_block; ! ! $block_id = $mx_block->dynamic_block_id; ! $mx_block->init( $block_id ); ! } + if ( $mx_block->is_sub ) + { + $total_subs = $mx_block->total_subs; + + $mx_parent_block = new mx_block(); + $mx_parent_block = $mx_block; + + } + else + { + $total_subs = 1; + } + // ! // Additional loop for subblocks - split block // ! ! for( $subblock = 0; $subblock < $total_subs; $subblock++ ) { ! if ( $mx_parent_block->is_sub ) ! { ! $block_id = intval( $mx_parent_block->sub_block_ids[$subblock] ); ! $mx_block->init( $block_id ); ! } ! // ! // View Auth ------------------------------------------------------------------------------- START // ! ! if ( ( $mx_block->auth_view && $mx_block->show_block ) || $mx_block->auth_mod ) { ! $template = new mx_Template($template->root, $board_config, $db); ! ! // ! // Define $module_root_path, to be used within blocks ! // ! ! $module_root_path = $mx_block->module_root_path; ! ! // ! // Include block file and cache output ! // ! ! ob_start(); ! include($module_root_path . $mx_block->block_file); ! $column_contents[$column] = ob_get_contents(); ! ob_end_clean(); ! ! // ! // Pass block data ! // ! ! if ( $mx_block->show_block || $mx_block->auth_mod ) { ! // ! // Output Block contents ! // ! ! $mx_block->output( $column_contents[$column] ); ! ! // ! // Switch: Block border graphics? ! // ! ! if ( $mx_page->block_border_graphics ) ! { ! $mx_block->output_border_graphics(); ! } ! ! // ! // Output Block stats ! // ! ! $mx_block->output_stats(); } } ! ! // ! // View Auth --------------------------------------------------------------------------------- END ! // ! ! // ! // Edit Auth --------------------------------------------------------------------------------- START ! // ! ! if ( ( ( $mx_block->auth_edit && $mx_block->show_block ) || $mx_block->auth_mod ) ) { ! // ! // Now use the editCP on/off switch ! // ! ! $mx_page->show_editcp_switch(); ! ! // ! // Output editcp controls/buttons ! // ! ! if ( $mx_dynamic_block->dynamic_block_id > 0 ) ! { ! $mx_dynamic_block->output_cp( $edit_on ); ! } ! ! $mx_block->output_cp( $edit_on ); ! ! // ! // Is the Block hidden ? Output 'hidden' indicator ! // ! ! if ( !$mx_block->show_block ) ! { ! $mx_block->output_hidden_indicator(); ! } ! } ! ! // ! // Edit Auth ----------------------------------------------------------------------------------- END ! // ! ! // ! // Block header -------------------------------------------------------------------------------- START ! // ! ! if ( $mx_block->show_block && ( $mx_page->editcp_switch || $mx_block->show_title ) || $mx_block->auth_mod ) { ! $layouttemplate->assign_block_vars('layout_column.blocks.block_header', array()); ! ! // ! // Switch: show title ------------------- ! // ! ! if ( $mx_block->show_title || $mx_block->auth_mod ) ! { ! $mx_block->output_title(); ! } } ! ! // ! // Block header ---------------------------------------------------------------------------------- END ! // ! ! // ! // Output some subblock wrappers ! // ! if ( $mx_parent_block->is_sub ) ! { ! if ( $subblock == 0 ) ! { ! $layouttemplate->assign_block_vars('layout_column.blocks.sub_start', array()); ! $inner_space = ''; ! } ! else ! { ! $inner_space = '<td width="'.$mx_parent_block->sub_inner_space.'"> </td>'; ! } ! ! $layouttemplate->assign_block_vars('layout_column.blocks.sub_col', array( ! 'INNER_SPACE' => $inner_space, ! 'BLOCK_SIZE' => $mx_parent_block->sub_block_sizes[$subblock] )); ! ! if ( intval($subblock + 1) == $total_subs ) ! { ! $layouttemplate->assign_block_vars('layout_column.blocks.sub_end', array()); ! } } + + } // for ... subblocks + // ! // Destroy parent block data // ! ! if ( $mx_parent_block->is_sub ) { ! $mx_parent_block->erase(); } } ! } // for ... blocks ! } // for ... column + // // Output page + // $layouttemplate->pparse('mx_main_layout'); + // // Output footer + // include($mx_root_path . 'includes/page_tail.' . $phpEx); |