Index: branches/unlabeled/unlabeled-1.38.2/kernel/include/item.php =================================================================== diff -u -r6026 -r6031 --- branches/unlabeled/unlabeled-1.38.2/kernel/include/item.php (.../item.php) (revision 6026) +++ branches/unlabeled/unlabeled-1.38.2/kernel/include/item.php (.../item.php) (revision 6031) @@ -875,7 +875,10 @@ if (is_object($rs)) { if($rs->RecordCount() == 0 ) { - $sql = "INSERT INTO $SourceTable (CategoryId,ItemResourceId, PrimaryCat) VALUES (".(int)$CatId.",'".$this->Get("ResourceId")."',$Primary)"; + $sql = "INSERT INTO $SourceTable (CategoryId,ItemResourceId, PrimaryCat, ItemPrefix, Filename) + VALUES (".(int)$CatId.",'".$this->Get("ResourceId")."',$Primary, + '".$this->Prefix."', + ".$this->adodbConnection->qstr($this->Get('Filename')).")"; if($this->debuglevel) echo $sql."
\n"; $this->adodbConnection->Execute($sql); @@ -1108,17 +1111,22 @@ if($cat_id > 0) $this->refreshLastUpdate( $db->GetOne($sql) ); } - function StripDisallowed($string) + function StripDisallowed($filename) { - $not_allowed = Array( ' ', '\\', '/', ':', '*', '?', '"', '<', '>', '|', '`', + $filenames_helper =& $this->Application->recallObject('FilenamesHelper'); + $table = TABLE_PREFIX.'CategoryItems'; + + return $filenames_helper->stripDisallowed($table, 'ItemResourceId', $this->Get('ResourceId'), $filename); + +/* $not_allowed = Array( ' ', '\\', '/', ':', '*', '?', '"', '<', '>', '|', '`', '~', '!', '@', '#', '$', '%', '^', '&', '(', ')', '~', '+', '=', '-', '{', '}', ']', '[', "'", ';', '.', ','); $string = str_replace($not_allowed, '_', $string); $string = preg_replace('/(_+)/', '_', $string); $string = $this->checkAutoFilename($string); - return $string; + return $string;*/ } function checkAutoFilename($filename) @@ -1153,6 +1161,7 @@ return $filename; } + function GenerateFilename() { if ( !$this->Get('AutomaticFilename') && $this->Get('Filename') ) @@ -1170,11 +1179,20 @@ function Update($UpdatedBy = null) { - parent::Update($UpdatedBy); + $ret = parent::Update($UpdatedBy); $this->GenerateFilename(); - parent::Update($UpdatedBy); + $db =& GetADODBConnection(); + if ($ret) { + $filename = $this->Get('Filename'); + $sql = 'UPDATE '.TABLE_PREFIX.'CategoryItems + SET Filename = '.$db->qstr($filename).' + WHERE ItemResourceId = '.$this->Get('ResourceId'); + $db->Query($sql); + } +// parent::Update($UpdatedBy); + } function Create()