Index: trunk/core/kernel/utility/http_query.php =================================================================== diff -u -N -r3850 -r3872 --- trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 3850) +++ trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 3872) @@ -438,7 +438,19 @@ do { $template_path = implode('/', $template_parts); - + + /*if (!preg_match('/(.*)\/(.*)$/', $template_path, $t_parts)) { + $t_parts[1] = ''; + $t_parts[2] = $template_path; + } + else { + $t_parts[1] = '/'.$t_parts[1]; + } + + $sql = 'SELECT FileId + FROM '.TABLE_PREFIX.'ThemeFiles + WHERE (FilePath = '.$this->Conn->qstr($t_parts[1]).') AND (FileName = '.$this->Conn->qstr($t_parts[2].'.tpl').')';*/ + $sql = 'SELECT FileId FROM '.TABLE_PREFIX.'ThemeFiles WHERE CONCAT(FilePath, "/", FileName) = '.$this->Conn->qstr('/'.$template_path.'.tpl'); $template_found = $this->Conn->GetOne($sql); if(!$template_found) Index: trunk/core/kernel/event_handler.php =================================================================== diff -u -N -r3834 -r3872 --- trunk/core/kernel/event_handler.php (.../event_handler.php) (revision 3834) +++ trunk/core/kernel/event_handler.php (.../event_handler.php) (revision 3872) @@ -156,9 +156,15 @@ $event_key = array_search('event', $query_vars); if ($event_key) { + // pass through event of this prefix unset($query_vars[$event_key]); } + if (!getArrayValue($url_params, $prefix_special.'_event')) { + // if empty event, then remove it from url + unset( $url_params[$prefix_special.'_event'] ); + } + //if pass events is off and event is not implicity passed if ( !$pass_events && !isset($url_params[$prefix_special.'_event']) ) { Index: trunk/core/kernel/event_manager.php =================================================================== diff -u -N -r3845 -r3872 --- trunk/core/kernel/event_manager.php (.../event_manager.php) (revision 3845) +++ trunk/core/kernel/event_manager.php (.../event_manager.php) (revision 3872) @@ -187,18 +187,18 @@ $this->processOpener(); // 1. get events from $_POST - $events=$this->Application->GetVar('events'); - if($events===false) $events=Array(); + $events = $this->Application->GetVar('events'); + if ($events === false) $events = Array(); // 2. if nothing there, then try to find them in $_GET - if($this->queryMaps && !$events) - { + if ($this->queryMaps && !$events) { // if we got $_GET type submit (links, not javascript) - foreach($this->queryMaps as $prefix_special => $query_map) - { + foreach ($this->queryMaps as $prefix_special => $query_map) { $query_map = array_flip($query_map); - if(isset($query_map['event'])) - { - $events[$prefix_special] = $this->Application->GetVar($prefix_special.'_event'); + if (isset($query_map['event'])) { + $event_name = $this->Application->GetVar($prefix_special.'_event'); + if ($event_name) { + $events[$prefix_special] = $event_name; + } } } $actions = $this->Application->GetVar('do'); Index: trunk/kernel/include/custommetadata.php =================================================================== diff -u -N -r3526 -r3872 --- trunk/kernel/include/custommetadata.php (.../custommetadata.php) (revision 3526) +++ trunk/kernel/include/custommetadata.php (.../custommetadata.php) (revision 3872) @@ -171,48 +171,46 @@ return $found ? ($return_index ? $i : $d) : false; } - function SaveData() - { - foreach($this->Items as $f) - { - $FieldId = $f->Get("CustomFieldId"); - $value = $f->Get("Value"); - $ResId = $f->Get("ResourceId"); - $DataId = $f->Get("CustomDataId"); + function SaveData() + { + foreach($this->Items as $f) { + $FieldId = $f->Get('CustomFieldId'); + $value = $f->Get('Value'); + $ResId = $f->Get('ResourceId'); + $DataId = $f->Get('CustomDataId'); + + if ($FieldId > 0) { + $db_value = $this->adodbConnection->qstr( isset($GLOBALS['_CopyFromEditTable']) ? $value : stripslashes($value) ); + + if (is_numeric($DataId)) { + $sql = 'UPDATE '.$this->SourceTable.' SET Value = '.$db_value.' WHERE CustomFieldId = '.$FieldId.' AND ResourceId = '.$ResId; + $this->adodbConnection->Execute($sql); + } + else { + $sql = 'INSERT INTO '.$this->SourceTable.' (ResourceId,CustomFieldId,Value) VALUES ('.$ResId.','.$FieldId.','.$db_value.')'; + $this->adodbConnection->Execute($sql); + } + } + else + { + $sql = 'DELETE FROM '.$this->SourceTable.' WHERE CustomDataId = '.$DataId; + $this->adodbConnection->Execute($sql); + } + } + + $rs = $this->adodbConnection->Execute("SELECT * FROM ".$this->SourceTable." WHERE CustomDataId=0 "); + while($rs && !$rs->EOF) + { + $m = $this->adodbConnection->Execute("SELECT MIN(CustomDataId) as MinValue FROM ".$this->SourceTable); + $NewId = $m->fields["MinValue"]-1; + + $sql = "UPDATE ".$this->SourceTable." SET CustomDataId=$NewId WHERE ResourceId=".$rs->fields["ResourceId"]." AND "; + $sql .= "CustomFieldId=".$rs->fields["CustomFieldId"]; + $this->adodbConnection->Execute($sql); + $rs->MoveNext(); + } + } - if($FieldId > 0) - { - if(is_numeric($DataId)) - { - $sql = "UPDATE ".$this->SourceTable." SET Value=".$this->adodbConnection->qstr($value)." WHERE CustomFieldId='$FieldId' AND ResourceId='$ResId'"; - $this->adodbConnection->Execute($sql); - } - else - { - $sql = "INSERT INTO ".$this->SourceTable." (ResourceId,CustomFieldId,Value) VALUES ('".$ResId."','$FieldId',".$this->adodbConnection->qstr($value).")"; - $this->adodbConnection->Execute($sql); - } - } - else - { - $sql = 'DELETE FROM '.$this->SourceTable.' WHERE CustomDataId = '.$DataId; - $this->adodbConnection->Execute($sql); - } - } - - $rs = $this->adodbConnection->Execute("SELECT * FROM ".$this->SourceTable." WHERE CustomDataId=0 "); - while($rs && !$rs->EOF) - { - $m = $this->adodbConnection->Execute("SELECT MIN(CustomDataId) as MinValue FROM ".$this->SourceTable); - $NewId = $m->fields["MinValue"]-1; - - $sql = "UPDATE ".$this->SourceTable." SET CustomDataId=$NewId WHERE ResourceId=".$rs->fields["ResourceId"]." AND "; - $sql .= "CustomFieldId=".$rs->fields["CustomFieldId"]; - $this->adodbConnection->Execute($sql); - $rs->MoveNext(); - } - } - function CopyToEditTable($idfield, $idlist) { global $objSession;