|
From: Jon O. <jon...@us...> - 2005-10-22 10:51:42
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14247/includes Modified Files: mx_constants.php mx_functions.php mx_functions_admincp.php mx_functions_blockcp.php mx_functions_core.php Log Message: massive update, for mxBB 2.8.1 rc1 - most "easy to solve" bugs reported are fixed - optimized adminCP - mod_rewrite - Page IP filter - optimized blockCP - removed old files Index: mx_functions_blockcp.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_blockcp.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mx_functions_blockcp.php 12 Oct 2005 15:37:32 -0000 1.6 --- mx_functions_blockcp.php 22 Oct 2005 10:51:02 -0000 1.7 *************** *** 61,65 **** function _controlpanel( $id, $new_block ) { ! global $blockcptemplate, $lang, $db, $board_config, $theme, $HTTP_GET_VARS, $HTTP_POST_VARS, $phpEx, $mx_root_path, $s_hidden_fields, $userdata, $portalpage, $cookie_states, $module_nav_icon_url, $portalpage, $mx_request_vars; $dynamic_block_id = $mx_request_vars->request('dynamic_block', MX_TYPE_INT, ''); --- 61,65 ---- function _controlpanel( $id, $new_block ) { ! global $blockcptemplate, $lang, $db, $board_config, $theme, $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $phpEx, $mx_root_path, $s_hidden_fields, $userdata, $portalpage, $cookie_states, $module_nav_icon_url, $portalpage, $mx_request_vars; $dynamic_block_id = $mx_request_vars->request('dynamic_block', MX_TYPE_INT, ''); *************** *** 76,135 **** // ! // Instantiate the Block Class ! // ! //$mx_block = new mx_block(); ! ! // ! // Toggle add/edit action // ! if( !$new_block ) ! { ! if ( MX_BLOCKCP_DEBUG ) { echo('DIALOG - BLOCK - EDIT <br>'); } ! ! $mode_general = MX_BLOCK_TYPE; ! $mode_permissions = MX_BLOCK_PRIVATE_TYPE; ! $mode_settings = MX_BLOCK_SETTINGS_TYPE; ! $action = MX_DO_UPDATE; ! ! $block_id = $id; ! //$this->init($block_id); ! $function_id = $this->function_id; ! ! $l_title = $lang['Edit_block']; ! $newmode = 'modify_block'; ! $buttonvalue = $lang['Update']; ! ! $block_title = ( isset($HTTP_POST_VARS[$block_keys['block_title']]) ) ? stripslashes(htmlspecialchars($HTTP_POST_VARS[$block_keys['block_title']])) : $this->$block_keys['block_title']; ! $block_desc = ( isset($HTTP_POST_VARS[$block_keys['block_desc']]) ) ? stripslashes(htmlspecialchars($HTTP_POST_VARS[$block_keys['block_desc']])) : $this->$block_keys['block_desc']; ! $show_block = ( isset($HTTP_POST_VARS[$block_keys['show_block']]) ) ? intval($HTTP_POST_VARS[$block_keys['show_block']]) : intval($this->$block_keys['show_block']); ! $show_title = ( isset($HTTP_POST_VARS[$block_keys['show_title']]) ) ? intval($HTTP_POST_VARS[$block_keys['show_title']]) : intval($this->$block_keys['show_title']); ! $show_stats = ( isset($HTTP_POST_VARS[$block_keys['show_stats']]) ) ? intval($HTTP_POST_VARS[$block_keys['show_stats']]) : intval($this->$block_keys['show_stats']); ! } ! else ! { ! if ( MX_BLOCKCP_DEBUG ) { echo('DIALOG - BLOCK - ADD <br>'); } ! ! $mode_general = MX_BLOCK_TYPE; ! $mode_permissions = MX_BLOCK_PRIVATE_TYPE; ! $mode_settings = MX_BLOCK_SETTINGS_TYPE; ! $action = MX_DO_INSERT; ! ! $function_id = $id; ! ! $l_title = $lang['Create_block']; ! $newmode = 'create_block'; ! $buttonvalue = $lang['Create_block']; ! ! $block_title = ''; ! $block_desc = ''; ! $show_block = '1'; ! $show_title = '1'; ! $show_stats = '0'; ! $this->$block_keys['auth_view'] = AUTH_ALL; ! $this->$block_keys['auth_edit'] = AUTH_ADMIN; ! } ! ! $functionlist = get_list_formatted('function_list', $function_id); // --- 76,88 ---- // ! // General // ! $mode_general = MX_BLOCK_TYPE; ! $mode_permissions = MX_BLOCK_PRIVATE_TYPE; ! $mode_settings = MX_BLOCK_SETTINGS_TYPE; ! $block_id = $id; ! $module_id = $mx_request_vars->request('module_id', MX_TYPE_INT, '');; ! $function_id = $mx_request_vars->request('function_id', MX_TYPE_INT, '');; // *************** *** 140,144 **** $block_auth_ary = array( 'auth_view' => AUTH_ALL, ! 'auth_edit' => AUTH_MOD, ); --- 93,97 ---- $block_auth_ary = array( 'auth_view' => AUTH_ALL, ! 'auth_edit' => AUTH_ADMIN, ); *************** *** 149,152 **** --- 102,137 ---- 'auth_edit' => $lang['Edit'], ); + + // + // Update block + // + $action = MX_DO_UPDATE; + $buttonvalue = $lang['Update']; + + $block_title = ( isset($HTTP_POST_VARS[$block_keys['block_title']]) ) ? stripslashes(htmlspecialchars($HTTP_POST_VARS[$block_keys['block_title']])) : $this->$block_keys['block_title']; + $block_desc = ( isset($HTTP_POST_VARS[$block_keys['block_desc']]) ) ? stripslashes(htmlspecialchars($HTTP_POST_VARS[$block_keys['block_desc']])) : $this->$block_keys['block_desc']; + $show_block = ( isset($HTTP_POST_VARS[$block_keys['show_block']]) ) ? intval($HTTP_POST_VARS[$block_keys['show_block']]) : intval($this->$block_keys['show_block']); + $show_title = ( isset($HTTP_POST_VARS[$block_keys['show_title']]) ) ? intval($HTTP_POST_VARS[$block_keys['show_title']]) : intval($this->$block_keys['show_title']); + $show_stats = ( isset($HTTP_POST_VARS[$block_keys['show_stats']]) ) ? intval($HTTP_POST_VARS[$block_keys['show_stats']]) : intval($this->$block_keys['show_stats']); + + // + // Add block + // + $action_add = MX_DO_INSERT; + $buttonvalue_add = $lang['Create_block']; + + $show_title_yes_add = 'checked="checked"'; + $show_title_no_add = ''; + + $show_block_yes_add = 'checked="checked"'; + $show_block_no_add = ''; + + $show_stats_yes_add = ''; + $show_stats_no_add = 'checked="checked"'; + + // + // Now get started + // + $functionlist = get_list_formatted('function_list', $function_id); /* *************** *** 195,201 **** // ! // Variables // $blockcptemplate->assign_vars(array( 'L_TITLE' => $lang['Block_admin'], 'L_EXPLAIN' => $lang['Block_admin_explain'], --- 180,210 ---- // ! // JS // + + $cookie_tmp = $board_config['cookie_name'].'_adminBlockCP_mode'; + $cookie_blockCP = !empty($HTTP_COOKIE_VARS[$cookie_tmp]) ? $HTTP_COOKIE_VARS[$cookie_tmp] : 'settings'; + + // + // Send General Vars to template + // + $visible_general_add = $cookie_blockCP == 'general_add'; + $visible_general = $cookie_blockCP == 'general'; + $visible_settings = $cookie_blockCP == 'settings'; + $visible_private = $cookie_blockCP == 'private'; + $visible_delete = $cookie_blockCP == 'delete'; + $blockcptemplate->assign_vars(array( + 'VISIBLE_GENERAL_ADD' => $visible_general_add ? 'block' : 'none', + 'VISIBLE_GENERAL' => $visible_general ? 'block' : 'none', + 'VISIBLE_SETTINGS' => $visible_settings ? 'block' : 'none', + 'VISIBLE_PRIVATE' => $visible_private ? 'block' : 'none', + 'VISIBLE_DELETE' => $visible_delete ? 'block' : 'none', + 'IMG_URL_GENERAL_ADD' => $visible_general_add ? $admin_icon['contract'] : $admin_icon['expand'], + 'IMG_URL_GENERAL' => $visible_general ? $admin_icon['contract'] : $admin_icon['expand'], + 'IMG_URL_SETTINGS' => $visible_settings ? $admin_icon['contract'] : $admin_icon['expand'], + 'IMG_URL_PRIVATE' => $visible_private ? $admin_icon['contract'] : $admin_icon['expand'], + 'IMG_URL_DELETE' => $visible_delete ? $admin_icon['contract'] : $admin_icon['expand'], + 'L_TITLE' => $lang['Block_admin'], 'L_EXPLAIN' => $lang['Block_admin_explain'], *************** *** 208,211 **** --- 217,221 ---- "L_ACTION" => $lang['Action'], "L_DELETE" => $lang['Delete'], + "L_UPDATE" => $lang['Update'], 'L_SETTING' => $lang['Settings'], 'L_VIEW' => $lang['View'], *************** *** 245,248 **** --- 255,261 ---- 'S_FUNCTION_LIST' => $functionlist, + // + // Update + // 'S_SHOW_BLOCK_YES' => $show_block_yes, 'S_SHOW_BLOCK_NO' => $show_block_no, *************** *** 254,257 **** --- 267,282 ---- 'S_SHOW_STATS_NO' => $show_stats_no, + // + // Add + // + 'S_SHOW_BLOCK_YES_ADD' => $show_block_yes_add, + 'S_SHOW_BLOCK_NO_ADD' => $show_block_no_add, + + 'S_SHOW_TITLE_YES_ADD' => $show_title_yes_add, + 'S_SHOW_TITLE_NO_ADD' => $show_title_no_add, + + 'S_SHOW_STATS_YES_ADD' => $show_stats_yes_add, + 'S_SHOW_STATS_NO_ADD' => $show_stats_no_add, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_SUBMIT_UPDATE' => $buttonvalue, *************** *** 267,275 **** 'IMG_URL_EXPAND' => $admin_icon['expand'], ! 'IMG_ICON_MODULE' => $admin_icon['module'], 'IMG_ICON_FUNCTION' => $admin_icon['function'], 'IMG_ICON_PARAMETER' => $admin_icon['parameter'], 'IMG_ICON_BLOCK' => $admin_icon['block'], ! 'IMG_ICON_EDIT_BLOCK' => $admin_icon['edit_block'], )); --- 292,308 ---- 'IMG_URL_EXPAND' => $admin_icon['expand'], ! 'IMG_ICON_PAGE' => $admin_icon['page'], ! 'IMG_ICON_PAGE_COLUMN' => $admin_icon['page_column'], 'IMG_ICON_FUNCTION' => $admin_icon['function'], 'IMG_ICON_PARAMETER' => $admin_icon['parameter'], 'IMG_ICON_BLOCK' => $admin_icon['block'], ! 'IMG_ICON_EDIT_BLOCK' => $admin_icon['edit_block'], ! // ! // Cookies ! // ! 'COOKIE_NAME' => $board_config['cookie_name'], ! 'COOKIE_PATH' => $board_config['cookie_path'], ! 'COOKIE_DOMAIN' => $board_config['cookie_domain'], ! 'COOKIE_SECURE' => $board_config['cookie_secure'], )); *************** *** 281,288 **** --- 314,332 ---- <input type="hidden" name="action" value="' . $action . '" /> <input type="hidden" name="id" value="' . $block_id . '" /> + <input type="hidden" name="function_id" value="' . $function_id . '" /> + <input type="hidden" name="module_id" value="' . $module_id . '" /> <input type="hidden" name="dynamic_block" value="' . $dynamic_block_id . '" /> <input type="hidden" name="portalpage" value="' . $portalpage . '" /> <input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />'; + $s_hidden_general_add_fields = '<input type="hidden" name="mode" value="' . $mode_general . '" /> + <input type="hidden" name="action" value="' . MX_DO_INSERT . '" /> + <input type="hidden" name="id" value="' . $function_id . '" /> + <input type="hidden" name="function_id" value="' . $function_id . '" /> + <input type="hidden" name="module_id" value="' . $module_id . '" /> + <input type="hidden" name="dynamic_block" value="' . $dynamic_block_id . '" /> + <input type="hidden" name="portalpage" value="' . $portalpage . '" /> + <input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />'; + $s_hidden_permissions_fields = '<input type="hidden" name="mode" value="' . $mode_permissions . '" /> <input type="hidden" name="action" value="' . $action . '" /> *************** *** 297,311 **** <input type="hidden" name="dynamic_block" value="' . $dynamic_block_id . '" /> <input type="hidden" name="portalpage" value="' . $portalpage . '" /> ! <input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />'; ! // // Activate BlockCP SubPanels, based on auth // $blockcptemplate->assign_block_vars('blockcp_general', array( ! 'L_TITLE' => $lang['Block_quick_edit'], 'S_HIDDEN_FIELDS' => $s_hidden_general_fields, 'S_SUBMIT' => $buttonvalue )); if (!empty($this->block_parameters)) { --- 341,377 ---- <input type="hidden" name="dynamic_block" value="' . $dynamic_block_id . '" /> <input type="hidden" name="portalpage" value="' . $portalpage . '" /> ! <input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />'; ! ! // ! // Get blockcp mode -> to set action file ! // ! $s_action_file = $this->blockcp_mode == 'mx_blockcp' ? $mx_root_path . 'modules/mx_coreblocks/mx_blockcp.' . $phpEx : $mx_root_path . 'admin/admin_mx_block_cp.' . $phpEx; ! ! $deletemode = '?mode=' . $mode_general . '&action=' . MX_DO_DELETE . '&id=' . $block_id . '&module_id=' . $module_id . '&function_id=' . $function_id . '&portalpage=' . $portalpage. '&sid=' . $userdata['session_id']; ! ! $message_delete = $lang['Delete_block'] . ' - ' . $block_title ! . '<br /><br />' . $lang['Delete_block_explain'] ! . '<br /><br />' . sprintf($lang['Click_block_delete_yes'], '<a href="' . append_sid($s_action_file . $deletemode) . '">', '</a>') ! . '<br /><br />'; ! ! // // Activate BlockCP SubPanels, based on auth // $blockcptemplate->assign_block_vars('blockcp_general', array( ! 'L_TITLE' => $lang['Edit'], 'S_HIDDEN_FIELDS' => $s_hidden_general_fields, 'S_SUBMIT' => $buttonvalue )); + if ($this->auth_mod) + { + $blockcptemplate->assign_block_vars('blockcp_general_add', array( + 'L_TITLE' => $lang['Create_block'], + 'S_HIDDEN_FIELDS' => $s_hidden_general_add_fields, + 'S_SUBMIT' => $buttonvalue_add + )); + } + if (!empty($this->block_parameters)) { *************** *** 335,339 **** // ! // Output values of individual auth fields // for( $j = 0; $j < count($block_auth_fields); $j++ ) --- 401,431 ---- // ! // Output values of individual auth fields - add ! // ! for( $j = 0; $j < count($block_auth_fields); $j++ ) ! { ! $custom_auth[$j] = ' <select name="' . $block_auth_fields[$j] . '">'; ! ! for( $k = 0; $k < count($block_auth_levels); $k++ ) ! { ! $selected = ( $block_auth_ary[$block_auth_fields[$j]] == $block_auth_const[$k] ) ? ' selected="selected"' : ''; ! $custom_auth[$j] .= '<option value="' . $block_auth_const[$k] . '"' . $selected . '>' . $lang['AUTH_' . $block_auth_levels[$k]] . "</option>\n"; ! } ! ! $custom_auth[$j] .= '</select> '; ! ! $cell_title = $field_names[$block_auth_fields[$j]]; ! ! $blockcptemplate->assign_block_vars('blockcp_general_add.block_auth_titles', array( ! 'CELL_TITLE' => $cell_title ! )); ! ! $blockcptemplate->assign_block_vars('blockcp_general_add.block_auth_data', array( ! 'S_AUTH_LEVELS_SELECT' => $custom_auth[$j] ! )); ! } ! ! // ! // Output values of individual auth fields - edit // for( $j = 0; $j < count($block_auth_fields); $j++ ) *************** *** 358,362 **** 'S_AUTH_LEVELS_SELECT' => $custom_auth[$j] )); ! } --- 450,454 ---- 'S_AUTH_LEVELS_SELECT' => $custom_auth[$j] )); ! } *************** *** 430,440 **** )); } // - // Load and display additional blockcp panels (if any) - // - //$this->load_block_panels($block_id); - - // // Load and display additional blockcp parameters or panels (if any) // --- 522,535 ---- )); } + + if ($this->auth_mod) + { + $blockcptemplate->assign_block_vars('blockcp_delete', array( + 'L_TITLE' => $lang['Delete'], + 'MESSAGE_DELETE' => $message_delete + )); + } // // Load and display additional blockcp parameters or panels (if any) // Index: mx_functions_core.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_core.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** mx_functions_core.php 12 Oct 2005 15:37:32 -0000 1.12 --- mx_functions_core.php 22 Oct 2005 10:51:02 -0000 1.13 *************** *** 1165,1168 **** --- 1165,1169 ---- // display additional panels in the add/edit page // =================================================== + /* function load_block_panels( $block_id = false ) { *************** *** 1187,1191 **** return $return; } ! // =================================================== // display parameter field and data in the add/edit page --- 1188,1192 ---- return $return; } ! */ // =================================================== // display parameter field and data in the add/edit page *************** *** 1204,1209 **** ob_start(); $this->is_panel = false; ! //$template = new mx_Template($template->root, $board_config); ! $template = new mx_Template($mx_root_path . 'templates/'. $theme['template_name'] , $board_config); switch ( $parameter_data['parameter_type'] ) --- 1205,1209 ---- ob_start(); $this->is_panel = false; ! $template = new mx_Template($mx_root_path . $this->module_root_path . 'templates/subSilver', $board_config); switch ( $parameter_data['parameter_type'] ) Index: mx_constants.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_constants.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** mx_constants.php 1 Oct 2005 14:10:45 -0000 1.16 --- mx_constants.php 22 Oct 2005 10:51:02 -0000 1.17 *************** *** 29,33 **** define('MX_PORTAL_PAGES_OFFSET', -1000); - // // mxBB Core table names --- 29,32 ---- Index: mx_functions_admincp.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_admincp.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mx_functions_admincp.php 12 Oct 2005 15:37:32 -0000 1.10 --- mx_functions_admincp.php 22 Oct 2005 10:51:02 -0000 1.11 *************** *** 337,342 **** } ! $message = $lang['AdminCP_action'] . ": " . $lang['Block'] . ' (' . $mx_request_vars->post('block_title', MX_TYPE_NO_TAGS, 'error - no name given') . ') ' . $lang['was_inserted']; ! break; --- 337,342 ---- } ! $message['text'] = $lang['AdminCP_action'] . ": " . $lang['Block'] . ' (' . $mx_request_vars->post('block_title', MX_TYPE_NO_TAGS, 'error - no name given') . ') ' . $lang['was_inserted']; ! $message['new_id'] = $next_id; break; *************** *** 1259,1263 **** // ! // First delete block(s) parameter data for every module function // $sql_ids = "SELECT * FROM " . BLOCK_TABLE . " WHERE function_id = $function_id"; --- 1259,1263 ---- // ! // First delete block(s) parameter data and page occurances for every module function // $sql_ids = "SELECT * FROM " . BLOCK_TABLE . " WHERE function_id = $function_id"; *************** *** 1269,1272 **** --- 1269,1273 ---- { $message_child .= $this->do_it( MX_BLOCK_PARAMETER_TYPE, MX_DO_DELETE, $delete_ids[$i]['block_id'], false, false); + $message_child .= $this->do_it( MX_PAGE_BLOCK_TYPE, MX_DO_DELETE, $delete_ids[$i]['block_id'], false, false); } } *************** *** 1284,1290 **** // ! // First delete block parameter data for this module function // $message_child .= $this->do_it( MX_BLOCK_PARAMETER_TYPE, MX_DO_DELETE, $block_id, false, false); // --- 1285,1292 ---- // ! // First delete block parameter data and page occurances for this block // $message_child .= $this->do_it( MX_BLOCK_PARAMETER_TYPE, MX_DO_DELETE, $block_id, false, false); + $message_child .= $this->do_it( MX_PAGE_BLOCK_TYPE, MX_DO_DELETE, $block_id, false, false); // *************** *** 1501,1508 **** $block_id = intval($id); ! $column_id = ( isset($HTTP_POST_VARS['column_id']) ) ? $HTTP_POST_VARS['column_id'] : $HTTP_GET_VARS['column_id']; ! $block_order = ( isset($HTTP_POST_VARS['block_order']) ) ? $HTTP_POST_VARS['block_order'] : $HTTP_GET_VARS['block_order']; ! $sql = "DELETE FROM " . COLUMN_BLOCK_TABLE . " WHERE block_id = $block_id AND column_id = $column_id AND block_order = $block_order"; } --- 1503,1514 ---- $block_id = intval($id); ! $column_id = ( isset($HTTP_POST_VARS['column_id']) ) ? intval($HTTP_POST_VARS['column_id']) : intval($HTTP_GET_VARS['column_id']); ! $block_order = ( isset($HTTP_POST_VARS['block_order']) ) ? intval($HTTP_POST_VARS['block_order']) : intval($HTTP_GET_VARS['block_order']); ! $sql_xtra_options = ''; ! $sql_xtra_options .= $column_id > 0 ? ' AND column_id = ' . $column_id : ''; ! $sql_xtra_options .= $block_order > 0 ? ' AND block_order = ' . $block_order : ''; ! ! $sql = "DELETE FROM " . COLUMN_BLOCK_TABLE . " WHERE block_id = $block_id" . $sql_xtra_options; } Index: mx_functions.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions.php,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** mx_functions.php 15 Oct 2005 22:12:17 -0000 1.50 --- mx_functions.php 22 Oct 2005 10:51:02 -0000 1.51 *************** *** 1193,1197 **** function _generate_tpl($block_id) { ! global $template, $blockcptemplate, $lang, $phpEx, $mx_request_vars, $mx_root_path, $userdata; $module_select_list = ''; --- 1193,1197 ---- function _generate_tpl($block_id) { ! global $template, $blockcptemplate, $lang, $phpEx, $mx_request_vars, $mx_root_path, $userdata, $portalpage, $dynamic_block_id; $module_select_list = ''; *************** *** 1235,1239 **** // Hidden fields // ! $s_hidden_dyn_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />'; $tpl = array( --- 1235,1241 ---- // Hidden fields // ! $s_hidden_dyn_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /> ! <input type="hidden" name="dynamic_block" value="' . $dynamic_block_id . '" /> ! <input type="hidden" name="portalpage" value="' . $portalpage . '" />'; $tpl = array( |