Index: trunk/core/kernel/utility/temp_handler.php =================================================================== diff -u -r4287 -r4758 --- trunk/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 4287) +++ trunk/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 4758) @@ -27,14 +27,14 @@ var $CopiedTables = Array(); - + /** * IDs of newly cloned items (key - prefix.special, value - array of ids) * * @var Array */ var $savedIDs = Array(); - + /** * Description * @@ -61,7 +61,7 @@ { $this->savedIDs[$prefix.($special ? '.' : '').$special][] = $id; } - + /** * Get temp table name * @@ -70,13 +70,12 @@ */ function GetTempName($table) { - // function is sometimes called as static, so we CAN'T use $this->GetTempTablePrefix() here - return TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_edit_'.$table; + return $this->Application->GetTempName($table); } function GetTempTablePrefix() { - return TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_edit_'; + return $this->Application->GetTempTablePrefix(); } /** @@ -87,19 +86,12 @@ */ function GetLiveName($temp_table) { - if( preg_match('/'.TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_edit_(.*)/',$temp_table,$rets) ) - { - return $rets[1]; - } - else - { - return $temp_table; - } + return $this->Application->GetLiveName($temp_table); } function IsTempTable($table) { - return strpos($table, TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_edit_') !== false; + return $this->Application->IsTempTable($table); } /** @@ -132,16 +124,16 @@ 'Prefix' => $prefix, 'TableId' => $this->TableIdCounter++, ); - + $parent_prefix = $this->Application->getUnitOption($prefix, 'ParentPrefix'); if ($parent_prefix) { $tables['ForeignKey'] = $this->Application->getUnitOption($prefix, 'ForeignKey'); $tables['ParentPrefix'] = $parent_prefix; $tables['ParentTableKey'] = $this->Application->getUnitOption($prefix, 'ParentTableKey'); } - + $this->FinalRefs[ $tables['TableName'] ] = $tables['TableId']; // don't forget to add main table to FinalRefs too - + $SubItems = $this->Application->getUnitOption($prefix,'SubItems'); if (is_array($SubItems)) { foreach ($SubItems as $prefix) { @@ -199,7 +191,7 @@ if (!preg_match('/(.*)-item$/', $special)) { $special .= '-item'; } - + $object =& $this->Application->recallObject($prefix.'.'.$special, $prefix, Array('skip_autoload' => true)); foreach ($ids as $id) { @@ -272,11 +264,11 @@ } } } - + if (!$ids) { $this->savedIDs[$prefix.($special ? '.' : '').$special] = Array(); } - + return $this->savedIDs[$prefix.($special ? '.' : '').$special]; } @@ -604,13 +596,13 @@ function RaiseEvent($name, $prefix, $special, $ids, $foreign_key = null, $add_params = null) { if ( !is_array($ids) ) return ; - + $event_key = $prefix.($special ? '.' : '').$special.':'.$name; $event = new kEvent($event_key); if (isset($foreign_key)) { $event->setEventParam('foreign_key', $foreign_key); } - + foreach($ids as $id) { $event->setEventParam('id', $id);