Index: branches/unlabeled/unlabeled-1.10.2/core/units/categories/categories_event_handler.php =================================================================== diff -u -r4381 -r4382 --- branches/unlabeled/unlabeled-1.10.2/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 4381) +++ branches/unlabeled/unlabeled-1.10.2/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 4382) @@ -8,23 +8,23 @@ * @param kEvent $event */ function OnCategoryUp(&$event) - { + { $category_table = $this->Application->getUnitOption($event->Prefix,'TableName'); $current_cat = $this->Application->GetVar('m_cat_id'); - + if($current_cat) { $sql = 'SELECT ParentId FROM '.$category_table.' WHERE CategoryId = '.$current_cat; $cat_to_go = $this->Conn->GetOne($sql); } - else + else { $cat_to_go = 0; } - + $event->redirect_params = Array('m_cat_id' => $cat_to_go); } - + /** * Goes to home category * @@ -35,7 +35,7 @@ $cat_to_go = 0; $event->redirect_params = Array('m_cat_id' => $cat_to_go); } - + /** * Apply system filter to categories list * @@ -44,16 +44,23 @@ function SetCustomQuery(&$event) { parent::SetCustomQuery($event); - + $types=$event->getEventParam('types'); $except_types=$event->getEventParam('except'); $object =& $event->getObject(); $type_clauses = Array(); - + $object =& $event->getObject(); - + if ( $event->getEventParam('parent_cat_id') ) { $parent_cat_id = $event->getEventParam('parent_cat_id'); + + if ($parent_cat_id == 'Root') { + $module_name = getArrayValue($params, 'module') ? $params['module'] : 'In-Commerce'; + $module =& $this->Application->recallObject('mod.'.$module_name); + $parent_cat_id = $module->GetDBField('RootCat'); + } + } else { $parent_cat_id = $this->Application->GetVar('c_id'); @@ -64,7 +71,7 @@ $parent_cat_id = 0; } } - + if ($parent_cat_id != 'any') { if ($event->getEventParam('recursive')) { $current_path = $this->Conn->GetOne('SELECT ParentPath FROM '.TABLE_PREFIX.'Category WHERE CategoryId='.$parent_cat_id); @@ -75,9 +82,9 @@ $object->addFilter('parent_filter', 'ParentId = '.$parent_cat_id); } } - + $object->addFilter('parent_filter', 'ParentId = '.$parent_cat_id); - + $view_perm = 1; $object->addFilter('perm_filter', 'PermId = '.$view_perm); if ( !$this->Application->IsAdmin() ) @@ -98,7 +105,7 @@ SELECT ResourceId FROM '.$this->Application->getUnitOption($event->Prefix, 'TableName').' WHERE CategoryId = '.$parent_cat_id ); - + $sql = 'SELECT DISTINCT(TargetId) FROM '.TABLE_PREFIX.'Relationship WHERE SourceId = '.$resource_id.' AND SourceType = 1'; $related_cats = $this->Conn->GetCol($sql); @@ -108,30 +115,30 @@ $related_cats2 = $this->Conn->GetCol($sql); $related_cats2 = is_array($related_cats2) ? $related_cats2 : Array(); $related_cats = array_unique( array_merge( $related_cats2, $related_cats ) ); - + if($related_cats) { $type_clauses['category_related']['include'] = '%1$s.ResourceId IN ('.implode(',', $related_cats).')'; $type_clauses['category_related']['except'] = '%1$s.ResourceId NOT IN ('.implode(',', $related_cats).')'; } - else + else { $type_clauses['category_related']['include'] = '0'; $type_clauses['category_related']['except'] = '1'; } $type_clauses['category_related']['having_filter'] = false; } - + if(strpos($types, 'product_related') !== false) { $object->removeFilter('parent_filter'); - + $product_id = $event->getEventParam('product_id') ? $event->getEventParam('product_id') : $this->Application->GetVar('p_id'); $resource_id = $this->Conn->GetOne(' SELECT ResourceId FROM '.$this->Application->getUnitOption('p', 'TableName').' WHERE ProductId = '.$product_id ); - + $sql = 'SELECT DISTINCT(TargetId) FROM '.TABLE_PREFIX.'Relationship WHERE SourceId = '.$resource_id.' AND TargetType = 1'; $related_cats = $this->Conn->GetCol($sql); @@ -141,36 +148,36 @@ $related_cats2 = $this->Conn->GetCol($sql); $related_cats2 = is_array($related_cats2) ? $related_cats2 : Array(); $related_cats = array_unique( array_merge( $related_cats2, $related_cats ) ); - + if($related_cats) { $type_clauses['product_related']['include'] = '%1$s.ResourceId IN ('.implode(',', $related_cats).')'; $type_clauses['product_related']['except'] = '%1$s.ResourceId NOT IN ('.implode(',', $related_cats).')'; } - else + else { $type_clauses['product_related']['include'] = '0'; $type_clauses['product_related']['except'] = '1'; } $type_clauses['product_related']['having_filter'] = false; } - + /********************************************/ - + $includes_or_filter =& $this->Application->makeClass('kMultipleFilter'); $includes_or_filter->setType(FLT_TYPE_OR); - + $excepts_and_filter =& $this->Application->makeClass('kMultipleFilter'); $excepts_and_filter->setType(FLT_TYPE_AND); $includes_or_filter_h =& $this->Application->makeClass('kMultipleFilter'); $includes_or_filter_h->setType(FLT_TYPE_OR); - + $excepts_and_filter_h =& $this->Application->makeClass('kMultipleFilter'); $excepts_and_filter_h->setType(FLT_TYPE_AND); $except_types_array=explode(',', $types); - + if ($types){ $types_array=explode(',', $types); for ($i=0; $iaddFilter('includes_filter', $includes_or_filter); $object->addFilter('excepts_filter', $excepts_and_filter); - + $object->addFilter('includes_filter_h', $includes_or_filter_h, HAVING_FILTER); $object->addFilter('excepts_filter_h', $excepts_and_filter_h, HAVING_FILTER); } - + function GetPassedId(&$event) { if ( $this->Application->IsAdmin() ) return parent::getPassedID($event); - + $ret = $this->Application->GetVar('m_cat_id'); if($ret) return $ret; - + return parent::getPassedID($event); } - + /** * Rebuilds category cache * @@ -230,7 +237,7 @@ $this->Application->StoreVar('PermCache_UpdateRequired', 1); $event->SetRedirectParam('index_file', 'category/category_maint.php'); } - + /** * Adds calculates fields for item statuses * @@ -240,14 +247,14 @@ function prepareObject(&$object, &$event) { $object =& $event->getObject( Array('skip_autoload' => true) ); - + $object->addCalculatedField('IsNew', ' IF(%1$s.NewItem = 2, IF(%1$s.CreatedOn >= (UNIX_TIMESTAMP() - '. $this->Application->ConfigValue('Category_DaysNew'). '*3600*24), 1, 0), %1$s.NewItem )'); - + } } Index: branches/unlabeled/unlabeled-1.18.2/admin/category/addcategory.php =================================================================== diff -u -r4109 -r4382 --- branches/unlabeled/unlabeled-1.18.2/admin/category/addcategory.php (.../addcategory.php) (revision 4109) +++ branches/unlabeled/unlabeled-1.18.2/admin/category/addcategory.php (.../addcategory.php) (revision 4382) @@ -4,12 +4,13 @@ define('REL_PATH', 'admin/category'); $relation_level = count( explode('/', REL_PATH) ); define('FULL_PATH', realpath(dirname(__FILE__) . str_repeat('/..', $relation_level) ) ); + require_once FULL_PATH.'/kernel/startup.php'; // new startup: end -require_once ($pathtoroot.$admin."/include/elements.php"); -require_once ($pathtoroot."kernel/admin/include/navmenu.php"); -//require_once ($pathtolocal."admin/include/navmenu.php"); +require_once ($pathtoroot.$admin."/include/elements.php"); +require_once ($pathtoroot."kernel/admin/include/navmenu.php"); +//require_once ($pathtolocal."admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); unset($objEditItems); @@ -45,15 +46,15 @@ $objRelList->CreateEmptyEditTable("RelationshipId"); $objCustomDataList->CreateEmptyEditTable('c'); $objImages->CreateEmptyEditTable("ResourceId"); - + $TitleVerb = prompt_language("la_Text_Adding"); } else -{ +{ if(isset($_POST["catlist"])) - { + { $cats = $_POST["catlist"]; - $objCatList->CopyToEditTable("CategoryId",$cats); + $objCatList->CopyToEditTable("CategoryId",$cats); $objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable); /* make a copy of the relationship records */ $ids = $objEditItems->GetResourceIDList(); @@ -65,46 +66,46 @@ $en = 0; } else - { + { if($_GET["item"]) { /*shortcut to edit link */ $objCatList->CopyToEditTable("ResourceId",$_GET["item"]); $backurl = $_GET["return"]; - } - + } + //Multiedit init $en = (int)$_GET["en"]; $objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable); - + //$ids = $objEditItems->GetResourceIDList(); //$objRelList->CopyToEditTable("SourceId", $ids); //$objCustomDataList->CopyToEditTable("ResourceId",$ids); //$objImages->CopyToEditTable("ResourceId", $ids); - + $itemcount=$objEditItems->NumItems(); $c = $objEditItems->GetItemByIndex($en); } - + if($itemcount>1) - { + { if ($en+1 == $itemcount) $en_next = -1; else $en_next = $en+1; - + if ($en == 0) $en_prev = -1; else - $en_prev = $en-1; + $en_prev = $en-1; } - + $action = "m_edit_category"; $TitleVerb = prompt_language("la_Text_Editing"); } $envar = "env=" . BuildEnv() . "&en=$en"; -$section = 'in-portal:editcategory_general'; +$section = 'in-portal:editcategory_general'; if (strlen($c->Get("Name"))) $editing_category_title = "'".$c->Get("Name")."' "; @@ -126,10 +127,10 @@ if ( isset($en_prev) || isset($en_next) ) { - $url = $RootUrl.$admin."/category/addcategory.php"; + $url = $RootUrl.$admin."/category/addcategory.php"; $StatusField = "CatEditStatus"; $form = "category"; - MultiEditButtons($objCatToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'','la_PrevCategory','la_NextCategory'); + MultiEditButtons($objCatToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'','la_PrevCategory','la_NextCategory'); } int_header($objCatToolBar,NULL,$title); @@ -222,7 +223,9 @@ + > + Get("Status") == 1) echo "checked"; ?>> @@ -306,7 +309,7 @@ if (is_object($cfield)) { $f->default_value = $c->GetCustomFieldValue($n, '', 0, true); } - print "\n"; + print "\n"; print " ".$f->GetPrompt()."\n"; print " ".$f->ItemFormElement($tab_index++).""; if(is_object($f->NextItem)) @@ -320,7 +323,7 @@ } } } -} +} ?> "> "> @@ -339,11 +342,14 @@ document.getElementById('filename').readOnly = $checked; } reflect_filename(); - + + + +
- \ No newline at end of file Index: branches/unlabeled/unlabeled-1.6.2/admin/category/permcacheupdate.php =================================================================== diff -u -r4315 -r4382 --- branches/unlabeled/unlabeled-1.6.2/admin/category/permcacheupdate.php (.../permcacheupdate.php) (revision 4315) +++ branches/unlabeled/unlabeled-1.6.2/admin/category/permcacheupdate.php (.../permcacheupdate.php) (revision 4382) @@ -2,17 +2,17 @@ class clsRecursionStack { var $Stack; - + function clsRecursionStack() { $this->Stack = Array(); } - + function Push($values) { array_push($this->Stack, $values); } - + function Pop() { if ($this->Count() > 0) { @@ -22,7 +22,7 @@ return false; } } - + function Get() { if ($this->Count() > 0) { @@ -33,12 +33,12 @@ return false; } } - + function Update($values) { $this->Stack[count($this->Stack)-1] = $values; } - + function Count() { return count($this->Stack); @@ -51,25 +51,25 @@ var $Allow; var $Deny; var $CatId; - + function clsCachedPermissions($CatId) { $this->CatId = $CatId; } - + function SetCatId($CatId) { $this->CatId = $CatId; } - + function CheckPermArray($Perm) { if (!isset($this->Allow[$Perm])) { $this->Allow[$Perm] = array(); $this->Deny[$Perm] = array(); } } - + function AddAllow($Perm, $GroupId) { $this->CheckPermArray($Perm); @@ -78,7 +78,7 @@ $this->RemoveDeny($Perm, $GroupId); } } - + function AddDeny($Perm, $GroupId) { $this->CheckPermArray($Perm); @@ -87,34 +87,34 @@ $this->RemoveAllow($Perm, $GroupId); } } - + function RemoveDeny($Perm, $GroupId) { if (in_array($GroupId, $this->Deny[$Perm])) { array_splice($this->Deny[$Perm], array_search($GroupId, $this->Deny[$Perm]), 1); } } - + function RemoveAllow($Perm, $GroupId) { if (in_array($GroupId, $this->Allow[$Perm])) { array_splice($this->Allow[$Perm], array_search($GroupId, $this->Allow[$Perm]), 1); } } - + function GetInsertSQL() { $values = array(); - + $has_deny = array(); - + foreach ($this->Deny as $perm => $groups) { if (count($groups) > 0) { $values[] = '('.$this->CatId.', '.$perm.', "", "'.join(',', $groups).'")'; $has_deny[] = $perm; } } - + foreach ($this->Allow as $perm => $groups) { if (in_array($perm, $has_deny)) continue; if (count($groups) > 0) { @@ -123,7 +123,7 @@ } if (!$values) return ''; $sql = 'INSERT INTO '.GetTablePrefix().'PermCache (CategoryId, PermId, ACL, DACL) VALUES '.join(',', $values); - return $sql; + return $sql; } } @@ -134,7 +134,7 @@ var $totalCats; var $doneCats; var $table; - + /** * Kernel Application * @@ -147,18 +147,18 @@ * @var kDBConnection */ var $Conn = null; - + function clsCacheUpdater($continuing=false) { $this->Application =& kApplication::Instance(); $this->Conn =& $this->Application->GetADODBConnection(); - + $this->conn =& GetADODBConnection(); $this->iteration = 0; $this->table=$GLOBALS['objSession']->GetEditTable('permCacheUpdate'); if (!$continuing) { - $this->Stack =& new clsRecursionStack(); + $this->Stack =& new clsRecursionStack(); $sql = 'DELETE FROM '.GetTablePrefix().'PermCache'; $this->conn->Execute($sql); $this->initData(); @@ -178,29 +178,29 @@ $sql='SELECT data FROM '.$this->table; if( $rs = $this->conn->Execute($sql) ) $tmp = unserialize($rs->fields['data']); - + $this->totalCats = isset($tmp['totalCats']) ? $tmp['totalCats'] : 0; $this->doneCats = isset($tmp['doneCats']) ? $tmp['doneCats'] : 0; if(isset($tmp['stack'])) $this->Stack = $tmp['stack']; else $this->Stack = & new clsRecursionStack(); - - } + + } function setData() { $tmp=Array ( 'totalCats' =>$this->totalCats, 'doneCats' =>$this->doneCats, 'stack' =>$this->Stack, - + ); $sql='DELETE FROM '.$this->table; $this->conn->Execute($sql); $sql='INSERT '.$this->table.' SET data="'.addslashes(serialize($tmp)).'"'; $this->conn->Execute($sql); - } + } function initData() { $sql='CREATE TABLE '.$this->table.'(data LONGTEXT)'; @@ -216,8 +216,8 @@ { $sql='DROP TABLE IF EXISTS '.$this->table; $this->conn->Execute($sql); - } - + } + function DoTheJob() { $data = $this->Stack->Get(); @@ -229,27 +229,27 @@ $data['item_template'] = ''; $this->Stack->Push($data); } - + if (!isset($data['queried'])) { - + $this->QueryTitle($data); $this->QueryChildren($data); $this->QueryPermissions($data); $data['queried'] = 1; - + if($sql = $data['perms']->GetInsertSQL()) { $this->conn->Execute($sql); $this->doneCats++; } $this->iteration++; } - + // start with first child if we haven't started yet if (!isset($data['current_child'])) $data['current_child'] = 0; - + // if we have more children - if (isset($data['children'][$data['current_child']])) + if (isset($data['children'][$data['current_child']])) { $next_data = Array(); $next_data['title'] = $data['title']; @@ -268,33 +268,34 @@ $this->UpdateCachedPath($data); $this->Stack->Pop(); //remove ourself from stack if we have finished all the childs (or there are none) // we are getting here if we finished with current level, so check if it's first level - then bail out. - return $this->Stack->Count() > 0; + return $this->Stack->Count() > 0; } } function UpdateCachedPath(&$data) { + $fields_hash = Array( 'CachedNavbar' => implode('>', $data['title']), 'NamedParentPath' => implode('/', $data['named_path'] ), 'CachedCategoryTemplate'=> $data['category_template'], 'CachedItemTemplate' => $data['item_template'], - ); - - $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$data['current_id']); + ); + + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$data['current_id']); } - + function QueryTitle(&$data) { $sql = 'SELECT Name, Filename, CategoryTemplate, ItemTemplate FROM '.GetTablePrefix().'Category WHERE CategoryId = '.$data['current_id']; - + $rs = $this->conn->Execute($sql); - + if ($rs && !$rs->EOF) { $data['title'][] = $rs->fields['Name']; $data['named_path'][] = $rs->fields['Filename']; - + // if explicitly set, then use it; use parent template otherwise if ($rs->fields['CategoryTemplate']) { $data['category_template'] = $rs->fields['CategoryTemplate']; @@ -304,21 +305,21 @@ } } } - + function QueryChildren(&$data) { $sql = sprintf('SELECT CategoryId FROM '.GetTablePrefix().'Category WHERE ParentId = %s', $data['current_id']); $rs = $this->conn->Execute($sql); - + $data['children'] = Array(); while ($rs && !$rs->EOF) { $data['children'][] = $rs->fields['CategoryId']; $rs->MoveNext(); } } - + function QueryPermissions(&$data) { $sql = sprintf('SELECT ipc.PermissionConfigId, ip.GroupId, ip.PermissionValue FROM '.GetTablePrefix().'Permissions AS ip @@ -327,12 +328,12 @@ WHERE CatId = %s AND Permission LIKE "%%.VIEW"', $data['current_id']); $rs = $this->conn->Execute($sql); - + //create permissions array only if we don't have it yet (set by parent) if (!isset($data['perms'])) { $data['perms'] = new clsCachedPermissions($data['current_id']); } - + while ($rs && !$rs->EOF) { if ($rs->fields['PermissionValue'] == 1) { Index: branches/unlabeled/unlabeled-1.14.2/kernel/units/categories/categories_tag_processor.php =================================================================== diff -u -r4246 -r4382 --- branches/unlabeled/unlabeled-1.14.2/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 4246) +++ branches/unlabeled/unlabeled-1.14.2/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 4382) @@ -146,7 +146,7 @@ // in case if category is deleted return ''; } - + $block_params['cat_name'] = $res['Name']; $block_params['cat_id'] = $res['CategoryId']; Index: branches/unlabeled/unlabeled-1.14.2/core/units/categories/categories_tag_processor.php =================================================================== diff -u -r4246 -r4382 --- branches/unlabeled/unlabeled-1.14.2/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 4246) +++ branches/unlabeled/unlabeled-1.14.2/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 4382) @@ -146,7 +146,7 @@ // in case if category is deleted return ''; } - + $block_params['cat_name'] = $res['Name']; $block_params['cat_id'] = $res['CategoryId']; Index: branches/unlabeled/unlabeled-1.7.2/admin/email/sendmail.php =================================================================== diff -u -r4255 -r4382 --- branches/unlabeled/unlabeled-1.7.2/admin/email/sendmail.php (.../sendmail.php) (revision 4255) +++ branches/unlabeled/unlabeled-1.7.2/admin/email/sendmail.php (.../sendmail.php) (revision 4382) @@ -27,17 +27,17 @@ require_once($pathtoroot.$admin."/browse/toolbar.php"); //Set Section -$section = 'in-portal:sendmail'; +$section = 'in-portal:sendmail'; //Set Environment Variable -$envar = "env=" . BuildEnv(); +$envar = "env=" . BuildEnv(); $objListToolBar = new clsToolBar(); $objListToolBar->Set("section",$section); $objListToolBar->Set("load_menu_func",""); $objListToolBar->Set("CheckClass",""); - + $listImages = array(); //$img, $alt, $link, $onMouseOver, $onMouseOut, $onClick @@ -59,62 +59,62 @@ else $action = "email_single_send"; if ($addr_list != '' || $addr_list != null) { - $addresses = implode(",",$addr_list); + $addresses = implode(",",$addr_list); } ?> - + - > + > - - > + > - - > + > - - > + > - > + > - +
+
+ ">
+

- - + +