|
From: Jon O. <jon...@us...> - 2005-12-14 12:38:11
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23102/includes Modified Files: mx_functions.php mx_functions_blockcp.php Log Message: fix for missing function_id for adding new block (first time only) Index: mx_functions_blockcp.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_blockcp.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mx_functions_blockcp.php 22 Oct 2005 10:51:02 -0000 1.7 --- mx_functions_blockcp.php 14 Dec 2005 12:38:02 -0000 1.8 *************** *** 83,88 **** $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, '');; // --- 83,88 ---- $block_id = $id; ! $module_id = $mx_request_vars->is_request('module_id') ? $mx_request_vars->request('module_id', MX_TYPE_INT, '') : mx_parent_data($block_id, 'module_id'); ! $function_id = $mx_request_vars->is_request('function_id') ? $mx_request_vars->request('function_id', MX_TYPE_INT, '') : mx_parent_data($block_id, 'function_id'); // Index: mx_functions.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions.php,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** mx_functions.php 13 Dec 2005 20:04:26 -0000 1.55 --- mx_functions.php 14 Dec 2005 12:38:00 -0000 1.56 *************** *** 1106,1109 **** --- 1106,1149 ---- /********************************************************************************\ + | mx_parent_data(), will return function_id and module_id for given block_id. Else false + \********************************************************************************/ + function mx_parent_data($block_id = '', $key = '') + { + global $db; + + if (empty($block_id)) + { + return false; + } + echo('helo'); + $sql = "SELECT mdl.module_id, fnc.function_id, blk.block_id + FROM " . MODULE_TABLE . " mdl, + " . FUNCTION_TABLE . " fnc, + " . BLOCK_TABLE . " blk + WHERE mdl.module_id = fnc.module_id + AND fnc.function_id = blk.function_id + AND blk.block_id = '" . $block_id . "' + LIMIT 1"; + + if( !($result = $db->sql_query($sql)) ) + { + mx_message_die(GENERAL_ERROR, "Couldn't obtain parents data", '', __LINE__, __FILE__, $sql); + } + + $parent_array = $db->sql_fetchrow($result); + + if (!empty($parent_array['module_id'])) + { + if (!empty($key)) + { + return $parent_array[$key]; + } + return $parent_array; + } + + return false; + } + + /********************************************************************************\ | \********************************************************************************/ |