Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Mon, Feb 3, 12:56 AM

in-portal

Index: trunk/admin/install/prerequisit.php
===================================================================
--- trunk/admin/install/prerequisit.php (nonexistent)
+++ trunk/admin/install/prerequisit.php (revision 2183)
@@ -0,0 +1,51 @@
+<?php
+$PreRequisitErrors = Array();
+$path = $pathtoroot."in-link";
+
+$result = true;
+
+if (!function_exists('ConvertVersion')) {
+ function ConvertVersion($version)
+ {
+ $parts = explode('.', $version);
+
+ $bin = '';
+ foreach ($parts as $part) {
+ $bin .= str_pad(decbin($part), 8, '0', STR_PAD_LEFT);
+ }
+
+ $dec = bindec($bin);
+
+ return $dec;
+ }
+}
+
+//'In-Portal' => '1.1.0',
+
+$min_versions = Array(
+ 'In-Link' => '3.1.0',
+ 'In-News' => '1.1.0',
+ 'In-Bulletin' => '1.1.0',
+ 'In-Commerce' => '1.0.0',
+);
+
+$conn =& GetADODBConnection();
+$query = 'SELECT * FROM '.GetTablePrefix().'Modules';
+$rs = $conn->Execute($query);
+while($rs && !$rs->EOF)
+{
+ if (isset($min_versions[$rs->fields['Name']])) {
+ if ( ConvertVersion($rs->fields['Version']) < ConvertVersion($min_versions[$rs->fields['Name']]) ) {
+ $PreRequisitErrors[] = 'Please upgrade '.$rs->fields['Name'].' to version '.$min_versions[$rs->fields['Name']].' or above';
+ $result = false;
+ }
+ }
+ $rs->MoveNext();
+}
+
+if ($show_errors) {
+ foreach ($PreRequisitErrors as $error) {
+ echo '<b><font color="#FF0000">'.$error.'</font></b><br />';
+ }
+}
+?>
\ No newline at end of file
Property changes on: trunk/admin/install/prerequisit.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/core/kernel/utility/http_query.php
===================================================================
--- trunk/core/kernel/utility/http_query.php (revision 2182)
+++ trunk/core/kernel/utility/http_query.php (revision 2183)
@@ -1,478 +1,478 @@
<?php
class HTTPQuery extends Params {
/**
* $_POST vars
*
* @var Array
* @access private
*/
var $Post;
/**
* $_GET vars
*
* @var Array
* @access private
*/
var $Get;
/**
* $_COOKIE vars
*
* @var Array
* @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
*
* @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
*
* @param string $order
* @return HTTPQuery
* @access public
*/
function HTTPQuery($order='CGPF')
{
parent::Params();
$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();
$removed = false;
foreach($this->specialsToRemove as $prefix_special => $flag)
{
if($flag)
{
$removed = true;
list($prefix,$special) = explode('.',$prefix_special, 2);
foreach ($array as $key => $val) {
$new_key = preg_match("/^".$prefix."[._]{1}".$special."(.*)/", $key, $regs) ? $prefix.$regs[1] : $key;
$ret[$new_key] = is_array($val) ? $this->removeSpecials($val) : $val;
}
}
}
return $removed ? $ret : $array;
}
/**
* All all requested vars to
* common storage place
*
* @access private
*/
function AddAllVars()
{
for ($i=0; $i < strlen($this->Order); $i++)
{
$current = $this->Order[$i];
switch ($current) {
case 'G':
$this->Get =$this->AddVars($_GET);
$this->processQueryString();
break;
case 'P':
$this->Post = $this->AddVars($_POST);
$this->convertPostEvents();
break;
case 'C':
$this->Cookie = $this->AddVars($_COOKIE);
break;
case 'E';
$this->Env = $this->AddVars($_ENV);
break;
case 'S';
$this->Server = $this->AddVars($_SERVER);
break;
case 'F';
$this->convertFiles();
$this->Files = $this->MergeVars($_FILES, false); //do not strip slashes!
break;
}
}
}
function convertFiles()
{
if (!$_FILES)
{
return false;
}
$file_keys = Array('error','name','size','tmp_name','type');
foreach($_FILES as $file_name => $file_info)
{
if( is_array($file_info['error']) )
{
$tmp[$file_name] = $this->getArrayLevel( $file_info['error'], $file_name );
}
else
{
$normal_files[$file_name] = $file_info;
}
}
$files = $_FILES;
$_FILES = Array();
foreach($tmp as $prefix => $prefix_files)
{
$anchor =& $_FILES;
foreach($prefix_files['keys'] as $key)
{
$anchor =& $anchor[$key];
}
foreach($prefix_files['value'] as $field_name)
{
unset($inner_anchor);
unset($copy);
$work_copy = $prefix_files['keys'];
foreach($file_keys as $file_key)
{
$inner_anchor =& $files[$prefix][$file_key];
if (isset($copy))
{
$work_copy = $copy;
}
else
{
$copy = $work_copy;
}
array_shift($work_copy);
foreach($work_copy as $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();
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;
}
}
return $ret;
}
/**
* Owerwrites GET events with POST events in case if they are set and not empty
*
*/
function convertPostEvents()
{
$events = $this->Get('events');
if( is_array($events) )
{
foreach ($events as $prefix_special => $event_name)
{
if($event_name) $this->Set($prefix_special.'_event', $event_name);
}
}
}
/**
* Process QueryString only, create
* events, ids, based on config
* set template name and sid in
* desired application variables.
*
* @access private
*/
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);
if($env_var)
{
$sid = $this->Get('sid');
if (defined('MOD_REWRITE') && MOD_REWRITE && $sid) $env_var = rtrim($sid.$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( $t );
+ $t=$this->getTemplateName( trim($t, '/') );
if(!$t) $t='index';
- $this->Set('t',$t);
+ $this->Set('t', trim($t, '/') );
}
else {
// 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';
- $this->Set('t',$t);
+ $this->Set('t', trim($t, '/') );
}
if($parts)
{
$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);
$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] )
{
array_push($passed, $prefix);
foreach($query_maps[$prefix_special] as $index => $var_name)
{
// l_id, l_page, l_bla-bla-bla
$val = $mixed_part[$index-1];
if ($val == '') $val = false;
$this->Set($prefix_special.'_'.$var_name, $val);
}
}
else
{
unset($query_maps[$prefix_special]);
}
}
$this->Set('passed', implode(',', $passed));
$event_manger->setQueryMaps($query_maps);
}
}
else
{
$t=$this->getTemplateName('index');
$this->Set('t',$t);
}
}
/**
* Decides what template name to
* use from $_GET or from $_POST
*
* @param string $querystring_template
* @return string
* @access private
*/
function getTemplateName($querystring_template)
{
$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
WHERE FileId = '.$t);
}
$t = preg_replace("/\.tpl$/", '', $t);
return $t;
}
/**
* Saves variables from array specified
* into common variable storage place
*
* @param Array $array
* @return Array
* @access private
*/
function AddVars($array)
{
$array = $this->StripSlashes($array);
foreach($array as $key => $value)
{
$this->Set($key,$value);
}
return $array;
}
function MergeVars($array, $strip_slashes=true)
{
if ($strip_slashes) $array = $this->StripSlashes($array);
foreach($array as $key => $value)
{
$this->_Params = array_merge_recursive2($this->_Params, Array($key=>$value));
}
return $array;
}
function StripSlashes($array)
{
//if( !get_magic_quotes_gpc() ) return $array;
foreach($array as $key=>$value)
{
if( is_array($value) )
{
$array[$key] = $this->StripSlashes($value);
}
else
{
if( get_magic_quotes_gpc() ) $value = stripslashes($value);
if(!$this->Admin) $value = htmlspecialchars($value);
$array[$key] = $value;
}
//$array[$key]=is_array($value)?$this->StripSlashes($value):stripslashes($value);
}
return $array;
}
/**
* Returns the hash of http params
* matching the mask with values
*
* @param string $mask
* @return Array
* @access public
*/
function GetSelectedValues($mask)
{
return $this->Application->ExtractByMask($this->Vars, $mask);
}
/**
* Returns the sprintf'ed by format list of
* http params matching the mask and set to on
*
* @param string $mask
* @param string $format
* @return string
* @access public
*/
function GetSelectedIDs($mask, $format)
{
if ($mask == '') return;
$result = '';
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
*
* @param string $mask
* @param string $value_mask
* @return Array
* @access public
*/
function GetSelectedIDsArray($mask, $value_mask="%s,")
{
$str = $this->GetSelectedIDs($mask, $value_mask);
$str = rtrim($str, ',');
if (!empty($str)) {
$ids = split(',', $str);
if ($ids !== false)
return $ids;
else return Array();
}
else return Array();
}
}
?>
\ No newline at end of file
Property changes on: trunk/core/kernel/utility/http_query.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.5
\ No newline at end of property
+1.6
\ No newline at end of property

Event Timeline