Index: branches/unlabeled/unlabeled-1.64.2/kernel/units/general/cat_event_handler.php =================================================================== diff -u -r5970 -r6031 --- branches/unlabeled/unlabeled-1.64.2/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5970) +++ branches/unlabeled/unlabeled-1.64.2/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6031) @@ -348,6 +348,16 @@ $object->addFilter('original_filter', '%1$s.OrgId = 0 OR %1$s.OrgId IS NULL'); } } + else { + if ($this->Application->getUnitOption($event->Prefix, 'UsePendingEditing')) { + $pending_ids = $this->Conn->GetCol( + 'SELECT OrgId FROM '.$object->TableName.' + WHERE Status = -2 AND OrgId IS NOT NULL'); + if ($pending_ids) { + $object->addFilter('no_original_filter', '%1$s.'.$object->IDField.' NOT IN ('.implode(',', $pending_ids).')'); + } + } + } $types = $event->getEventParam('types'); $except_types = $event->getEventParam('except'); @@ -554,8 +564,8 @@ function OnAfterItemLoad(&$event) { $special = substr($event->Special, -6); + $object =& $event->getObject(); if ($special == 'import' || $special == 'export') { - $object =& $event->getObject(); $image_data = $object->getPrimaryImageData(); if ($image_data) { @@ -572,6 +582,16 @@ } } + //substituiting pending status value for pending editing + if ($object->HasField('OrgId') && $object->GetDBField('OrgId') > 0 && $object->GetDBField('Status') == -2) { + $options = $object->Fields['Status']['options']; + foreach ($options as $key => $val) { + if ($key == 2) $key = -2; + $new_options[$key] = $val; + } + $object->Fields['Status']['options'] = $new_options; + } + } function OnAfterItemUpdate(&$event) Index: branches/unlabeled/unlabeled-1.64.2/core/units/general/cat_event_handler.php =================================================================== diff -u -r5970 -r6031 --- branches/unlabeled/unlabeled-1.64.2/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5970) +++ branches/unlabeled/unlabeled-1.64.2/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6031) @@ -348,6 +348,16 @@ $object->addFilter('original_filter', '%1$s.OrgId = 0 OR %1$s.OrgId IS NULL'); } } + else { + if ($this->Application->getUnitOption($event->Prefix, 'UsePendingEditing')) { + $pending_ids = $this->Conn->GetCol( + 'SELECT OrgId FROM '.$object->TableName.' + WHERE Status = -2 AND OrgId IS NOT NULL'); + if ($pending_ids) { + $object->addFilter('no_original_filter', '%1$s.'.$object->IDField.' NOT IN ('.implode(',', $pending_ids).')'); + } + } + } $types = $event->getEventParam('types'); $except_types = $event->getEventParam('except'); @@ -554,8 +564,8 @@ function OnAfterItemLoad(&$event) { $special = substr($event->Special, -6); + $object =& $event->getObject(); if ($special == 'import' || $special == 'export') { - $object =& $event->getObject(); $image_data = $object->getPrimaryImageData(); if ($image_data) { @@ -572,6 +582,16 @@ } } + //substituiting pending status value for pending editing + if ($object->HasField('OrgId') && $object->GetDBField('OrgId') > 0 && $object->GetDBField('Status') == -2) { + $options = $object->Fields['Status']['options']; + foreach ($options as $key => $val) { + if ($key == 2) $key = -2; + $new_options[$key] = $val; + } + $object->Fields['Status']['options'] = $new_options; + } + } function OnAfterItemUpdate(&$event) Index: branches/unlabeled/unlabeled-1.4.2/core/units/general/helpers/mod_rewrite_helper.php =================================================================== diff -u -r5970 -r6031 --- branches/unlabeled/unlabeled-1.4.2/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 5970) +++ branches/unlabeled/unlabeled-1.4.2/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 6031) @@ -147,6 +147,22 @@ function ProcessModuleItem(&$url_parts, &$vars, $set_t=true) { + if (preg_match('/^bb_.*/', $url_parts[0])) { + $cat_item = $this->Conn->GetRow(' + SELECT c.ParentPath, c.CategoryId FROM '.TABLE_PREFIX.'Category AS c + WHERE + c.CategoryId = '.$vars['m_cat_id']); + + if ($set_t) { + $item_template = $this->GetItemTemplate($cat_item, 'bb'); + $vars['t'] = $item_template; + } + + $this->Application->HandleEvent($bb_event, 'bb:ParseEnv', Array('url_parts' => $url_parts, 'vars' => $vars)); + $vars = $bb_event->getEventParam('vars'); + return 'bb'; + } + if (!isset($url_parts[0])) return false; if ( count($url_parts) != 1 ) return false; $url_part = array_shift($url_parts); @@ -171,25 +187,8 @@ if ($cat_item !== false) { // item found $module_prefix = $cat_item['ItemPrefix']; - $parent_path = implode(',',explode('|', substr($cat_item['ParentPath'], 1, -1))); + $item_template = $this->GetItemTemplate($cat_item, $module_prefix); - // item template is stored in module' system custom field - need to get that field Id - $item_template_field_id = $this->Conn->GetOne( - 'SELECT CustomFieldId - FROM '.TABLE_PREFIX.'CustomField - WHERE FieldName = '.$this->Conn->qstr($module_prefix.'_ItemTemplate')); - - // looking for item template through cats hierarchy sorted by parent path - $query = 'SELECT ccd.l1_cust_'.$item_template_field_id.', - FIND_IN_SET(c.CategoryId, '.$this->Conn->qstr($parent_path).') AS Ord1, - c.CategoryId, c.Name, ccd.l1_cust_'.$item_template_field_id.' - FROM '.TABLE_PREFIX.'Category AS c - LEFT JOIN '.TABLE_PREFIX.'CategoryCustomData AS ccd - ON ccd.ResourceId = c.ResourceId - WHERE c.CategoryId IN ('.$parent_path.') AND ccd.l1_cust_'.$item_template_field_id.' != \'\' - ORDER BY FIND_IN_SET(c.CategoryId, '.$this->Conn->qstr($parent_path).') DESC'; - $item_template = $this->Conn->GetOne($query); - // converting ResourceId to correpsonding Item id $module_config = $this->Application->getUnitOptions($module_prefix); $item_id = $this->Conn->GetOne( @@ -210,6 +209,29 @@ return false; } + function GetItemTemplate($category, $module_prefix) + { + $parent_path = implode(',',explode('|', substr($category['ParentPath'], 1, -1))); + + // item template is stored in module' system custom field - need to get that field Id + $item_template_field_id = $this->Conn->GetOne( + 'SELECT CustomFieldId + FROM '.TABLE_PREFIX.'CustomField + WHERE FieldName = '.$this->Conn->qstr($module_prefix.'_ItemTemplate')); + + // looking for item template through cats hierarchy sorted by parent path + $query = 'SELECT ccd.l1_cust_'.$item_template_field_id.', + FIND_IN_SET(c.CategoryId, '.$this->Conn->qstr($parent_path).') AS Ord1, + c.CategoryId, c.Name, ccd.l1_cust_'.$item_template_field_id.' + FROM '.TABLE_PREFIX.'Category AS c + LEFT JOIN '.TABLE_PREFIX.'CategoryCustomData AS ccd + ON ccd.ResourceId = c.ResourceId + WHERE c.CategoryId IN ('.$parent_path.') AND ccd.l1_cust_'.$item_template_field_id.' != \'\' + ORDER BY FIND_IN_SET(c.CategoryId, '.$this->Conn->qstr($parent_path).') DESC'; + $item_template = $this->Conn->GetOne($query); + return $item_template; + } + function ProcessPhisycalTemplate(&$url_parts, &$vars) { if (!isset($url_parts[0])) return false; @@ -351,6 +373,9 @@ } $this->ProcessCategory($url_parts, $vars); + + + if ( $this->ProcessModuleIndex($url_parts, $vars) ) { foreach ($this->Application->ModuleInfo as $module_name => $info) { $passed[] = $info['Var']; Index: branches/unlabeled/unlabeled-1.75.2/kernel/frontaction.php =================================================================== diff -u -r5653 -r6031 --- branches/unlabeled/unlabeled-1.75.2/kernel/frontaction.php (.../frontaction.php) (revision 5653) +++ branches/unlabeled/unlabeled-1.75.2/kernel/frontaction.php (.../frontaction.php) (revision 6031) @@ -632,9 +632,9 @@ 'Country' => $_POST['country'], 'dob' => $dob, 'MinPwResetDelay' => $_POST['minpwresetdelay'], - + ); - + $user =& $objUsers->Edit_User_NEW($UserId, $fields_hash); saveCustomFields('u', $u->Get('ResourceId'), 6); } @@ -652,7 +652,7 @@ $objSession->SetPersistantVariable($field,$value); } } - + } break; case "m_set_lang": @@ -667,12 +667,12 @@ } } if($LangId) - { + { if($objSession->Get("PortalUserId")>0) { - $objSession->SetPersistantVariable("Language",$LangId); + $objSession->SetPersistantVariable("Language",$LangId); } - $objSession->Set("Language",$LangId); + $objSession->Set("Language",$LangId); $objSession->Update(); $m_var_list_update["lang"] = $LangId; $m_var_list["lang"] = $LangId; @@ -685,15 +685,15 @@ $id = $_GET["ThemeId"]; if($id) { - $objSession->SetThemeName($id); + $objSession->SetThemeName($id); $m_var_list["t"] = "index"; $m_var_list_update["theme"] = $id; - $m_var_list["theme"] = $id; + $m_var_list["theme"] = $id; unset($CurrentTheme); } break; - - case "m_sort_cats": + + case "m_sort_cats": $objSession->SetVariable("Category_Sortfield",$_POST["Category_Sortfield"]); $objSession->SetVariable("Category_Sortorder",$_POST["Category_Sortorder"]); $objSession->SetVariable("Perpage_Category",$_POST["Perpage_Category"]); @@ -764,9 +764,8 @@ 'AutomaticFilename' => 1, 'Filename' => '', 'CategoryTemplate' => '', - 'ItemTemplate' => '', ); - + $cat =& $objCatList->Add_NEW($fields_hash); saveCustomFields('c', $cat->Get('ResourceId'), $cat->type); @@ -785,21 +784,21 @@ } DeleteModuleTagCache('kernel'); break; - case "m_front_review_add": + case "m_front_review_add": if($objSession->InSpamControl($_POST["ItemId"])) { $StatusMessage["review"] = language("la_Review_AlreadyReviewed"); } else - { + { $objReviews = new clsItemReviewList(); $Status = $objConfig->Get("Review_DefaultStatus"); $CreatedOn = adodb_date("U"); $html = (int)$objConfig->Get("Review_Html"); $ReviewText = inp_striptags($_POST["review_text"]); - - $r = $objReviews->AddReview($CreatedOn,$ReviewText,$Status, $IPAddress, - 0, $_POST["ItemId"], $_POST["ItemType"], $objSession->Get("PortalUserId")); + + $r = $objReviews->AddReview($CreatedOn,$ReviewText,$Status, $IPAddress, + 0, $_POST["ItemId"], $_POST["ItemType"], $objSession->Get("PortalUserId")); foreach($ItemTypes as $type=>$id) { if($id==$_POST["ItemType"]) @@ -810,13 +809,13 @@ } } if(strlen($ValName) && strlen($IntName)) - { + { $exp_secs = $objConfig->Get($ValName) * $objConfig->Get($IntName); $objSession->AddToSpamControl($_POST["ItemId"],$exp_secs); if(is_object($r)) - { + { if($Status) - { + { $StatusMessage["review"] = language("la_Review_Added"); } else @@ -830,21 +829,21 @@ } DeleteModuleTagCache('kernel'); break; - + case "m_suggest_email": $cutoff = adodb_mktime()+(int)$objConfig->Get("Suggest_MinInterval"); - $email = inp_striptags($_POST["suggest_email"]); - + $email = inp_striptags($_POST["suggest_email"]); + if (strlen($email)) { if(ValidEmail($email)) { $sql = "SELECT * FROM ".GetTablePrefix()."SuggestMail WHERE email='".$email."' and sent<".$cutoff; $adodbConnection = &GetADODBConnection(); $rs = $adodbConnection->Execute($sql); - + $rs = false; - + if($rs && !$rs->EOF) { if(strlen($_GET["Error"])>0) @@ -858,41 +857,41 @@ { if($Event->Get("Enabled")=="1") { - $Event->Item = null; - $Event->SendToAddress($email); + $Event->Item = null; + $Event->SendToAddress($email); $sql = "INSERT INTO ".GetTablePrefix()."SuggestMail (email,sent) VALUES ('".$email."','".adodb_mktime()."')"; - + $rs = $adodbConnection->Execute($sql); $objSession->SetVariable('suggest_result', language("lu_suggest_success")." ".$email); } } - $e =& $objMessageList->GetEmailEventObject("USER.SUGGEST",1); - + $e =& $objMessageList->GetEmailEventObject("USER.SUGGEST",1); + if($e->Get("Enabled")==1) $e->SendAdmin(); - + if(strlen($_GET["Confirm"])>0) $var_list["t"] = $_GET["Confirm"]; } } - else + else { if(strlen($_GET["Error"])>0) $var_list["t"] = $_GET["Error"]; $objSession->SetVariable('suggest_result', language("lu_invalid_emailaddress")); - } + } } else { if(strlen($_GET["Error"])>0) $var_list["t"] = $_GET["Error"]; $objSession->SetVariable('suggest_result', language("lu_suggest_no_address")); - } + } break; - case "m_simple_search": + case "m_simple_search": $keywords = trim($_POST["keywords"]); - $type = $objItemTypes->GetTypeByName("Category"); + $type = $objItemTypes->GetTypeByName("Category"); $objSearch = new clsSearchResults("Category","clsCategory"); $length = $objConfig->Get('Search_MinKeyword_Length'); @@ -906,27 +905,27 @@ } else { $key_arr = explode(' ', $keywords); - + /*foreach($key_arr as $value) { if (strlen(str_replace("+", "", $value)) < $length || strlen(str_replace("-", "", $value)) < $length) { $keywords = str_replace($value, '', $keywords); - //$keywords = str_replace($value, '', $keywords); + //$keywords = str_replace($value, '', $keywords); } } - + //$keywords = str_replace(' ', ' ', $keywords); //$keywords = str_replace('\"', '', $keywords); */ $tmp_keywords = str_replace("+", "", $keywords); $tmp_keywords = str_replace("-", "", $tmp_keywords); - + $performSearch = (strlen($tmp_keywords) >= $length); } - + if ($performSearch) { $objSearchList = new clsSearchLogList(); $objSearchList->UpdateKeyword($keywords,0); - + $objSearch->SetKeywords($keywords); $objSearch->AddSimpleFields('c'); if (is_numeric($objConfig->Get("SearchRel_Pop_category"))) { @@ -938,7 +937,7 @@ if (is_numeric($objConfig->Get("SearchRel_Rating_category"))) { $objSearch->PctRating = ($objConfig->Get("SearchRel_Rating_category")/100); } - + //echo "Searching On $keywords
\n"; $objSearch->PerformSearch(1,$SortOrder,TRUE); $SearchPerformed = TRUE; @@ -948,35 +947,35 @@ else { if(strlen($_GET["Error"])>0) $var_list["t"] = $_GET["Error"]; - - $MissingCount = SetMissingDataErrors("m_simplesearch"); + + $MissingCount = SetMissingDataErrors("m_simplesearch"); $MissingCount++; setSearchError(lu_keywords_tooshort); - } + } } - else + else { if (strlen($_GET["Error"])>0) { $var_list["t"] = $_GET["Error"]; } - + $MissingCount = SetMissingDataErrors("m_simplesearch"); $MissingCount++; setSearchError('lu_no_keyword'); } break; - case "m_adv_search": - + case "m_adv_search": + if ($_GET['type']) { $modules = Array( 1 => 'In-Portal', 2 => 'In-News', - 3 => 'In-Bulletin', 4 => 'In-Link', + 3 => 'In-Bulletin', 4 => 'In-Link', 11 => 'In-Commerce'); $module = $modules[$_GET["type"]]; } else { $module = 0; } - + if( !is_object($objSearchConfig) ) $objSearchConfig = new clsSearchConfigList($module); switch($_GET["type"]) { @@ -998,7 +997,7 @@ } } else - { + { $Value = $_POST["value"][$field->Get("FieldName")]; } switch( $_POST["andor"][$field->Get("FieldName")]) @@ -1008,36 +1007,36 @@ break; case 2: $Conjuction = "OR"; - break; + break; default: $Conjuction = ""; break; } - - if (strlen($Value) && $Verb=="any") + + if (strlen($Value) && $Verb=="any") { $Verb = 'contains'; } - - if(strlen($Value) && strlen($Verb)>0 && $Verb!="any") + + if(strlen($Value) && strlen($Verb)>0 && $Verb!="any") { // echo "Adding CAT SearchField: [".$field->Get("TableName")."]; [".$field->Get("FieldName")."]; [$Verb]; [$Value]; [$Conjuction]
"; $objAdvSearch->AddAdvancedField($field->Get("TableName"),$field->Get("FieldName"),$Verb,$Value,$Conjuction, 'c'); } - + } $objAdvSearch->PerformSearch(1,NULL,TRUE); break; } break; - + case "m_id": $application->ApplicationDie($Action.':'.$DownloadId); break; - + case "m_simple_subsearch": $keywords = $_POST["keywords"]; - $type = $objItemTypes->GetTypeByName("Category"); + $type = $objItemTypes->GetTypeByName("Category"); $objSearch = new clsSearchResults("Category","clsCategory"); $length = $objConfig->Get('Search_MinKeyword_Length'); @@ -1051,23 +1050,23 @@ } else { $key_arr = explode(' ', $keywords); - + /*foreach($key_arr as $value) { if (strlen($value) < $length) { $keywords = str_replace(' '.$value, '', $keywords); $keywords = str_replace($value.' ', '', $keywords); } }*/ - + //$keywords = str_replace(' ', ' ', $keywords); - + $tmp_keywords = str_replace("+", "", $keywords); $tmp_keywords = str_replace("-", "", $tmp_keywords); - - $performSearch = (strlen($tmp_keywords) >= $length); + + $performSearch = (strlen($tmp_keywords) >= $length); } - - if ($performSearch) { + + if ($performSearch) { $objSearchList = new clsSearchLogList(); $objSearchList->UpdateKeyword($keywords,0); @@ -1085,20 +1084,20 @@ $SearchResultIdList = $objSearch->Result_IdList(); if(count($SearchResultIdList)>0) - { + { $objSearch->PerformSearch(1,$SortOrder, TRUE,$SearchResultIdList); //$objSearch->SetRelevence($type->Get("ItemType"), "CategoryId"); } $SearchPerformed = TRUE; } - else { - $MissingCount = SetMissingDataErrors("m_simplesearch"); + else { + $MissingCount = SetMissingDataErrors("m_simplesearch"); $MissingCount++; setSearchError('lu_keywords_tooshort'); - } + } } else { - $MissingCount = SetMissingDataErrors("m_simplesearch"); + $MissingCount = SetMissingDataErrors("m_simplesearch"); $MissingCount++; setSearchError('lu_no_keyword'); } Index: branches/unlabeled/unlabeled-1.4.2/kernel/units/general/helpers/mod_rewrite_helper.php =================================================================== diff -u -r5970 -r6031 --- branches/unlabeled/unlabeled-1.4.2/kernel/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 5970) +++ branches/unlabeled/unlabeled-1.4.2/kernel/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 6031) @@ -147,6 +147,22 @@ function ProcessModuleItem(&$url_parts, &$vars, $set_t=true) { + if (preg_match('/^bb_.*/', $url_parts[0])) { + $cat_item = $this->Conn->GetRow(' + SELECT c.ParentPath, c.CategoryId FROM '.TABLE_PREFIX.'Category AS c + WHERE + c.CategoryId = '.$vars['m_cat_id']); + + if ($set_t) { + $item_template = $this->GetItemTemplate($cat_item, 'bb'); + $vars['t'] = $item_template; + } + + $this->Application->HandleEvent($bb_event, 'bb:ParseEnv', Array('url_parts' => $url_parts, 'vars' => $vars)); + $vars = $bb_event->getEventParam('vars'); + return 'bb'; + } + if (!isset($url_parts[0])) return false; if ( count($url_parts) != 1 ) return false; $url_part = array_shift($url_parts); @@ -171,25 +187,8 @@ if ($cat_item !== false) { // item found $module_prefix = $cat_item['ItemPrefix']; - $parent_path = implode(',',explode('|', substr($cat_item['ParentPath'], 1, -1))); + $item_template = $this->GetItemTemplate($cat_item, $module_prefix); - // item template is stored in module' system custom field - need to get that field Id - $item_template_field_id = $this->Conn->GetOne( - 'SELECT CustomFieldId - FROM '.TABLE_PREFIX.'CustomField - WHERE FieldName = '.$this->Conn->qstr($module_prefix.'_ItemTemplate')); - - // looking for item template through cats hierarchy sorted by parent path - $query = 'SELECT ccd.l1_cust_'.$item_template_field_id.', - FIND_IN_SET(c.CategoryId, '.$this->Conn->qstr($parent_path).') AS Ord1, - c.CategoryId, c.Name, ccd.l1_cust_'.$item_template_field_id.' - FROM '.TABLE_PREFIX.'Category AS c - LEFT JOIN '.TABLE_PREFIX.'CategoryCustomData AS ccd - ON ccd.ResourceId = c.ResourceId - WHERE c.CategoryId IN ('.$parent_path.') AND ccd.l1_cust_'.$item_template_field_id.' != \'\' - ORDER BY FIND_IN_SET(c.CategoryId, '.$this->Conn->qstr($parent_path).') DESC'; - $item_template = $this->Conn->GetOne($query); - // converting ResourceId to correpsonding Item id $module_config = $this->Application->getUnitOptions($module_prefix); $item_id = $this->Conn->GetOne( @@ -210,6 +209,29 @@ return false; } + function GetItemTemplate($category, $module_prefix) + { + $parent_path = implode(',',explode('|', substr($category['ParentPath'], 1, -1))); + + // item template is stored in module' system custom field - need to get that field Id + $item_template_field_id = $this->Conn->GetOne( + 'SELECT CustomFieldId + FROM '.TABLE_PREFIX.'CustomField + WHERE FieldName = '.$this->Conn->qstr($module_prefix.'_ItemTemplate')); + + // looking for item template through cats hierarchy sorted by parent path + $query = 'SELECT ccd.l1_cust_'.$item_template_field_id.', + FIND_IN_SET(c.CategoryId, '.$this->Conn->qstr($parent_path).') AS Ord1, + c.CategoryId, c.Name, ccd.l1_cust_'.$item_template_field_id.' + FROM '.TABLE_PREFIX.'Category AS c + LEFT JOIN '.TABLE_PREFIX.'CategoryCustomData AS ccd + ON ccd.ResourceId = c.ResourceId + WHERE c.CategoryId IN ('.$parent_path.') AND ccd.l1_cust_'.$item_template_field_id.' != \'\' + ORDER BY FIND_IN_SET(c.CategoryId, '.$this->Conn->qstr($parent_path).') DESC'; + $item_template = $this->Conn->GetOne($query); + return $item_template; + } + function ProcessPhisycalTemplate(&$url_parts, &$vars) { if (!isset($url_parts[0])) return false; @@ -351,6 +373,9 @@ } $this->ProcessCategory($url_parts, $vars); + + + if ( $this->ProcessModuleIndex($url_parts, $vars) ) { foreach ($this->Application->ModuleInfo as $module_name => $info) { $passed[] = $info['Var']; 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() Index: branches/unlabeled/unlabeled-1.32.2/core/kernel/event_handler.php =================================================================== diff -u -r5559 -r6031 --- branches/unlabeled/unlabeled-1.32.2/core/kernel/event_handler.php (.../event_handler.php) (revision 5559) +++ branches/unlabeled/unlabeled-1.32.2/core/kernel/event_handler.php (.../event_handler.php) (revision 6031) @@ -202,7 +202,7 @@ $ret = ''; - if($processed_params[$prefix_special.'_Page'] > 1) + if($processed_params[$prefix_special.'_Page'] > 1 && !$processed_params[$prefix_special.'_id']) { $ret .= $processed_params[$prefix_special.'_Page'].'/'; } Index: branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/changelog_1_2_1.txt =================================================================== diff -u -r5970 -r6031 --- branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/changelog_1_2_1.txt (.../changelog_1_2_1.txt) (revision 5970) +++ branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/changelog_1_2_1.txt (.../changelog_1_2_1.txt) (revision 6031) @@ -23,7 +23,8 @@ File in-portal/admin/install/install_lib.php changed File in-portal/admin/install/restore_run.php changed File in-portal/admin/install/langpacks/english.lang changed -File in-portal/admin/install/upgrades/inportal_upgrade_v1.2.1.php is new; release_1_2_1 revision 1.4.2.1 +File in-portal/admin/install/upgrades/changelog_1_2_1.txt is new; release_1_2_1 revision 1.1.2.1 +File in-portal/admin/install/upgrades/inportal_upgrade_v1.2.1.php is new; release_1_2_1 revision 1.4.2.2 File in-portal/admin/install/upgrades/inportal_upgrade_v1.2.1.sql is new; release_1_2_1 revision 1.8.2.3 File in-portal/admin/modules/addmodule.php changed File in-portal/admin/users/group_select.php changed @@ -48,10 +49,11 @@ File in-portal/kernel/admin_templates/category_selector.tpl is removed; release_1_2_0 revision 1.13 File in-portal/kernel/admin_templates/help.tpl changed File in-portal/kernel/admin_templates/index.tpl changed +File in-portal/kernel/admin_templates/login.tpl changed File in-portal/kernel/admin_templates/tree.tpl changed File in-portal/kernel/admin_templates/user_selector.tpl changed File in-portal/kernel/admin_templates/categories/cache_updater.tpl is new; release_1_2_1 revision 1.7 -File in-portal/kernel/admin_templates/categories/categories_edit.tpl is new; release_1_2_1 revision 1.2 +File in-portal/kernel/admin_templates/categories/categories_edit.tpl is new; release_1_2_1 revision 1.2.2.1 File in-portal/kernel/admin_templates/categories/categories_edit_custom.tpl is new; release_1_2_1 revision 1.2 File in-portal/kernel/admin_templates/categories/categories_edit_images.tpl is new; release_1_2_1 revision 1.2 File in-portal/kernel/admin_templates/categories/categories_edit_permissions.tpl is new; release_1_2_1 revision 1.8.2.4 @@ -123,7 +125,7 @@ File in-portal/kernel/admin_templates/item_selector/item_selector_advanced_view.tpl is new; release_1_2_1 revision 1.1.2.2 File in-portal/kernel/admin_templates/item_selector/item_selector_catalog.tpl is new; release_1_2_1 revision 1.1.2.1 File in-portal/kernel/admin_templates/item_selector/item_selector_tabs.tpl is new; release_1_2_1 revision 1.1.2.2 -File in-portal/kernel/admin_templates/item_selector/item_selector_toolbar.tpl is new; release_1_2_1 revision 1.1.2.3 +File in-portal/kernel/admin_templates/item_selector/item_selector_toolbar.tpl is new; release_1_2_1 revision 1.1.2.4 File in-portal/kernel/admin_templates/modules/modules_list.tpl changed File in-portal/kernel/admin_templates/popups/editor.tpl is new; release_1_2_1 revision 1.1.2.1 File in-portal/kernel/admin_templates/popups/translator.tpl changed @@ -151,10 +153,12 @@ File in-portal/kernel/module_help/categories_permissions.txt is new; release_1_2_1 revision 1.1.2.1 File in-portal/kernel/module_help/categories_properties.txt is new; release_1_2_1 revision 1.1.2.1 File in-portal/kernel/module_help/categories_relations.txt is new; release_1_2_1 revision 1.1.2.1 +File in-portal/kernel/module_help/images_edit.txt is new; release_1_2_1 revision 1.1.2.1 +File in-portal/kernel/module_help/relations_edit.txt is new; release_1_2_1 revision 1.1.2.1 File in-portal/kernel/units/admin/admin_config.php changed File in-portal/kernel/units/admin/admin_events_handler.php is new; release_1_2_1 revision 1.1.2.1 File in-portal/kernel/units/admin/admin_tag_processor.php changed -File in-portal/kernel/units/categories/cache_updater.php is new; release_1_2_1 revision 1.6.2.6 +File in-portal/kernel/units/categories/cache_updater.php is new; release_1_2_1 revision 1.6.2.7 File in-portal/kernel/units/categories/categories_config.php changed File in-portal/kernel/units/categories/categories_event_handler.php changed File in-portal/kernel/units/categories/categories_item.php changed @@ -186,6 +190,7 @@ File in-portal/kernel/units/general/helpers/helpers_config.php is new; release_1_2_1 revision 1.2.2.1 File in-portal/kernel/units/general/helpers/mod_rewrite_helper.php changed File in-portal/kernel/units/general/helpers/modules.php changed +File in-portal/kernel/units/general/helpers/multilanguage.php changed File in-portal/kernel/units/general/helpers/permissions_helper.php changed File in-portal/kernel/units/general/helpers/recursive_helper.php is new; release_1_2_1 revision 1.2.2.6 File in-portal/kernel/units/general/helpers/sections_helper.php changed