Index: trunk/core/kernel/utility/http_query.php =================================================================== diff -u -r2416 -r2600 --- trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 2416) +++ trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 2600) @@ -8,7 +8,7 @@ * @access private */ var $Post; - + /** * $_GET vars * @@ -23,44 +23,44 @@ * @access private */ var $Cookie; - + /** * $_SERVER vars * * @var Array * @access private */ var $Server; - + /** * $_ENV vars * * @var Array * @access private */ var $Env; - + /** * Order in what write * all vars together in - * the same array + * the same array * * @var string */ var $Order; - + /** * Uploaded files info * * @var Array * @access private */ var $Files; - + var $specialsToRemove = Array(); - + var $Admin = false; - + /** * Loads info from $_POST, $_GET and * related arrays into common place @@ -75,15 +75,15 @@ $this->Order = $order; $this->Admin = defined('ADMIN') && ADMIN; $this->AddAllVars(); - + $this->specialsToRemove = $this->Get('remove_specials'); if($this->specialsToRemove) { $this->_Params = $this->removeSpecials($this->_Params); } ini_set('magic_quotes_gpc', 0); } - + function removeSpecials($array) { $ret = Array(); @@ -102,7 +102,7 @@ } return $removed ? $ret : $array; } - + /** * All all requested vars to * common storage place @@ -139,34 +139,34 @@ } } } - + function convertFiles() { if (!$_FILES) { return false; } - + $file_keys = Array('error','name','size','tmp_name','type'); - + $tmp = Array(); foreach($_FILES as $file_name => $file_info) { if( is_array($file_info['error']) ) { $tmp[$file_name] = $this->getArrayLevel( $file_info['error'], $file_name ); } - else + else { $normal_files[$file_name] = $file_info; } } - + if(!$tmp) return false; - + $files = $_FILES; - $_FILES = Array(); - + $_FILES = Array(); + foreach($tmp as $prefix => $prefix_files) { $anchor =& $_FILES; @@ -182,7 +182,7 @@ foreach($file_keys as $file_key) { $inner_anchor =& $files[$prefix][$file_key]; - if (isset($copy)) + if (isset($copy)) { $work_copy = $copy; } @@ -193,40 +193,40 @@ array_shift($work_copy); foreach($work_copy as $prefix_file_key) { - $inner_anchor =& $inner_anchor[$prefix_file_key]; + $inner_anchor =& $inner_anchor[$prefix_file_key]; } $anchor[$field_name][$file_key] = $inner_anchor[$field_name]; } } } - + // keys: img_temp, 0, values: LocalPath, ThumbPath } - + function getArrayLevel(&$level, $prefix='') { $ret['keys'] = $prefix ? Array($prefix) : Array(); - $ret['value'] = Array(); - + $ret['value'] = Array(); + foreach($level as $level_key => $level_value) { if( is_array($level_value) ) { $ret['keys'][] = $level_key; $tmp = $this->getArrayLevel($level_value); - + $ret['keys'] = array_merge($ret['keys'], $tmp['keys']); $ret['value'] = array_merge($ret['value'], $tmp['value']); } else { - $ret['value'][] = $level_key; + $ret['value'][] = $level_key; } } - + return $ret; } - + /** * Owerwrites GET events with POST events in case if they are set and not empty * @@ -254,8 +254,9 @@ function processQueryString() { // env=SID:TEMPLATE:m-1-1-1-1:l0-0-0:n-0-0-0:bb-0-0-1-1-1-0 - - $env_var =& $this->Get(ENV_VAR_NAME); + + + $env_var = $this->Get(ENV_VAR_NAME); if($env_var) { $sid = $this->Get('sid'); @@ -268,23 +269,23 @@ $env_var = rtrim( implode($split_by, $env_var), '/'); } $env_var = str_replace('\:','_&+$$+&_',$env_var); // replace escaped "=" with spec-chars :) - + $parts=explode(':',$env_var); - + if (defined('MOD_REWRITE') && MOD_REWRITE) $env_var = str_replace('/', ':', $env_var); - + if (defined('INPORTAL_ENV')) { $sub_parts = array_shift($parts); - + list($sid, $t) = explode('-', $sub_parts, 2); - - + + // Save Session ID if($sid) { $this->Set('sid',$sid); $this->Get['sid'] = $sid; } - + // Save Template Name $t=$this->getTemplateName( trim($t, '/') ); if(!$t) $t='index'; @@ -294,7 +295,7 @@ // Save Session ID $sid=array_shift($parts); if($sid) $this->Set('sid',$sid); - + // Save Template Name $t=$this->getTemplateName( array_shift($parts) ); if(!$t) $t='index'; @@ -305,28 +306,28 @@ { $query_maps=Array(); $event_manger =& $this->Application->recallObject('EventManager'); - + $passed = Array(); - + foreach($parts as $mixed_part) { //In-portal old style env conversion - adds '-' between prefix and first var $mixed_part = str_replace('_&+$$+&_',':',$mixed_part); - $mixed_part = preg_replace("/^([a-zA-Z]+)([0-9]+)-(.*)/", "$1-$2-$3", $mixed_part); - + $mixed_part = preg_replace("/^([a-zA-Z]+)([0-9]+)-(.*)/", "$1-$2-$3", $mixed_part); + $escaped_part = str_replace('\-', '_&+$$+&_', $mixed_part); $escaped_part = explode('-', $escaped_part); - + $mixed_part = array(); foreach ($escaped_part as $escaped_val) { $mixed_part[] = str_replace('_&+$$+&_', '-', $escaped_val); } - + $prefix_special=array_shift($mixed_part); // l.pick, l list($prefix)=explode('.',$prefix_special); - + $query_maps[$prefix_special]=$this->Application->getUnitOption($prefix,'QueryString'); - + // if config is not defined for prefix in QueryString, then don't process it if( $query_maps[$prefix_special] ) { @@ -343,7 +344,7 @@ { unset($query_maps[$prefix_special]); } - + } $this->Set('passed', implode(',', $passed)); $event_manger->setQueryMaps($query_maps); @@ -355,7 +356,7 @@ $this->Set('t',$t); } } - + /** * Decides what template name to * use from $_GET or from $_POST @@ -368,16 +369,16 @@ { $t_from_post = $this->Get('t'); $t= $t_from_post ? $t_from_post : $querystring_template; - + if ( is_numeric($t) ) { - $t = $this->Application->DB->GetOne('SELECT CONCAT(FilePath, \'/\', FileName) FROM '.TABLE_PREFIX.'ThemeFiles + $t = $this->Application->DB->GetOne('SELECT CONCAT(FilePath, \'/\', FileName) FROM '.TABLE_PREFIX.'ThemeFiles WHERE FileId = '.$t); } $t = preg_replace("/\.tpl$/", '', $t); - + return $t; } - + /** * Saves variables from array specified * into common variable storage place @@ -395,7 +396,7 @@ } return $array; } - + function MergeVars($array, $strip_slashes=true) { if ($strip_slashes) $array = $this->StripSlashes($array); @@ -405,7 +406,7 @@ } return $array; } - + function StripSlashes($array) { //if( !get_magic_quotes_gpc() ) return $array; @@ -425,7 +426,7 @@ } return $array; } - + /** * Returns the hash of http params * matching the mask with values @@ -438,7 +439,7 @@ { return $this->Application->ExtractByMask($this->Vars, $mask); } - + /** * Returns the sprintf'ed by format list of * http params matching the mask and set to on @@ -455,13 +456,13 @@ foreach ($this->GetParams() as $name => $val) { if (eregi($mask, $name, $regs) && $val == 'on') { - + $result.= sprintf($format, $regs[1]); } } return $result; } - + /** * Returns the sprintf'ed by format list of * http params matching the mask and set to on