|
From: MW <jo...@us...> - 2008-02-09 12:34:14
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22290/includes Modified Files: mx_functions_core.php Log Message: Extended request_vars wrapper class to also deal with the possibility of empty but maybe still set GET/POST vars. Also first set of changes of using wrapper class instead of $HTML_*_VARS Index: mx_functions_core.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_core.php,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** mx_functions_core.php 8 Feb 2008 23:35:57 -0000 1.67 --- mx_functions_core.php 9 Feb 2008 12:34:09 -0000 1.68 *************** *** 1987,1991 **** function submit_parameters( $block_id = false ) { ! global $HTTP_POST_VARS, $db, $mx_cache, $lang, $userdata; $return = false; --- 1987,1991 ---- function submit_parameters( $block_id = false ) { ! global $mx_request_vars, $db, $mx_cache, $lang, $userdata; $return = false; *************** *** 2000,2004 **** { $parameter_id = $parameter_data['parameter_id']; ! $parameter_value = isset($HTTP_POST_VARS[$parameter_id]) ? $HTTP_POST_VARS[$parameter_id] : $parameter_data['parameter_default']; $parameter_opt = ''; --- 2000,2004 ---- { $parameter_id = $parameter_data['parameter_id']; ! $parameter_value = $mx_request_vars->post($parameter_id, MX_TYPE_NO_TAGS, $parameter_data['parameter_default']); $parameter_opt = ''; *************** *** 2869,2873 **** function _set_all() { ! global $userdata, $mx_root_path, $HTTP_GET_VARS, $HTTP_COOKIE_VARS, $portal_config, $theme, $lang; global $mx_block; --- 2869,2873 ---- function _set_all() { ! global $userdata, $mx_root_path, $mx_request_vars, $HTTP_COOKIE_VARS, $portal_config, $theme, $lang; global $mx_block; *************** *** 2914,2920 **** $s_hidden_fields .= '<input type="hidden" name="portalpage" value="' . $this->page_id . '" />'; $s_hidden_fields .= '<input type="hidden" name="mode" value="setting" />'; ! $s_hidden_fields .= isset( $HTTP_GET_VARS['f'] ) ? '<input type="hidden" name="f" value="' . intval( $HTTP_GET_VARS['f'] ) . '" />' : ''; ! $s_hidden_fields .= isset( $HTTP_GET_VARS['t'] ) ? '<input type="hidden" name="t" value="' . intval( $HTTP_GET_VARS['t'] ) . '" />' : ''; ! $s_hidden_fields .= isset( $HTTP_GET_VARS['p'] ) ? '<input type="hidden" name="p" value="' . intval( $HTTP_GET_VARS['p'] ) . '" />' : ''; $this->s_hidden_fields = $s_hidden_fields; --- 2914,2920 ---- $s_hidden_fields .= '<input type="hidden" name="portalpage" value="' . $this->page_id . '" />'; $s_hidden_fields .= '<input type="hidden" name="mode" value="setting" />'; ! $s_hidden_fields .= $mx_request_vars->is_get('f') ? '<input type="hidden" name="f" value="' . $mx_request_vars->get('f', MX_TYPE_INT) . '" />' : ''; ! $s_hidden_fields .= $mx_request_vars->is_get('t') ? '<input type="hidden" name="t" value="' . $mx_request_vars->get('t', MX_TYPE_INT) . '" />' : ''; ! $s_hidden_fields .= $mx_request_vars->get('p') ? '<input type="hidden" name="p" value="' . $mx_request_vars->get('p', MX_TYPE_INT) . '" />' : ''; $this->s_hidden_fields = $s_hidden_fields; *************** *** 3781,3784 **** --- 3781,3840 ---- return ( $this->is_get($var) || $this->is_post($var) ); } + /** + * Is POST var empty? + * + * Boolean method to check if POST variable is empty + * as it might be set but still be empty. + * + * @access public + * @param string $var + * @return boolean + */ + function is_empty_post($var) + { + global $HTTP_POST_VARS; + // Note: _x and _y are used by (at least IE) to return the mouse position at onclick of INPUT TYPE="img" elements. + if ( isset($HTTP_POST_VARS[$var]) || ( isset($HTTP_POST_VARS[$var.'_x']) && isset($HTTP_POST_VARS[$var.'_y']))) + { + $tmp = $this->_read($var, MX_TYPE_POST_VARS); + return empty($tmp); + } + return true; + } + /** + * Is GET var empty? + * + * Boolean method to check if GET variable is empty + * as it might be set but still be empty + * + * @access public + * @param string $var + * @return boolean + */ + function is_empty_get($var) + { + global $HTTP_GET_VARS; + if ( isset($HTTP_GET_VARS[$var]) ) + { + $tmp = $this->_read($var, MX_TYPE_GET_VARS); + return empty($tmp); + } + return true; + } + + /** + * Is REQUEST empty (GET and POST) var? + * + * Boolean method to check if REQUEST (both) variable is empty. + * + * @access public + * @param string $var + * @return boolean + */ + function is_empty_request($var) + { + return ( $this->is_empty_get($var) && $this->is_empty_post($var) ); + } + } // class mx_request_vars |