Index: trunk/admin/include/sections.php =================================================================== diff -u -N -r4243 -r4446 --- trunk/admin/include/sections.php (.../sections.php) (revision 4243) +++ trunk/admin/include/sections.php (.../sections.php) (revision 4446) @@ -79,11 +79,11 @@ $url = $rootURL.$this->Get("icon_small"); return $url; } - + function IsKernel4Link() { $path = $this->Get('path'); if(!$path) return false; - + $file = $this->Get('file'); return ( strpos($path, 'index4.php') !== false || strpos($file, 'kernel4:') !== false) ? true : false; @@ -114,7 +114,7 @@ else { $env = BuildEnv(); } - + $url = $rootURL.$this->Get('path').$this->Get('file'); $url .= (strstr($url, '?') ? '&' : '?').'env='.$env; } @@ -234,16 +234,16 @@ // simplified method to add sections global $pathtoroot; $sn = explode(':', $section_name); - + if (substr($script, 0, 8) == 'kernel4:') { $img_path = $sn[0].'/admin_templates/img/icons'; } else { $img_path = $module.'/admin/images/icons'; } - + if (!$img_path) { - + } if( !isset($title_phrase) ) $title_phrase = $tab_phrase; @@ -430,7 +430,7 @@ $o = "
-
"; +
"; $o .= "
 $caption
@@ -449,7 +449,7 @@
- '; + '; } } } @@ -492,7 +492,7 @@ $o = "
- "; + "; $showtabs=1; } //traverse and print tabs Index: trunk/core/kernel/utility/http_query.php =================================================================== diff -u -N -r4418 -r4446 --- trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 4418) +++ trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 4446) @@ -158,8 +158,7 @@ } } - if( $this->Application->RewriteURLs() ) - { + if ($this->Application->RewriteURLs()) { if( $this->Application->isDebugMode() ) { $this->Application->Debugger->profileStart('url_parsing'); @@ -173,6 +172,10 @@ } } + else { + $this->Application->VerifyLanguageId(); + $this->Application->VerifyThemeId(); + } } function convertFiles() @@ -435,7 +438,7 @@ $module_prefix = $module_info['Var']; $module_event = new kEvent($module_prefix.':ParseEnv', Array('url_parts' => array_merge(Array($url_part), $url_parts)) ); $this->Application->HandleEvent($module_event); - + if ($module_event->status == erSUCCESS && $this->Get($module_prefix.'_id')) { $item_template = $category_data['CachedItemTemplate']; if ($item_template) { @@ -566,7 +569,7 @@ $passed[] = $module_prefix; $module_event = new kEvent($module_prefix.':ParseEnv', Array('url_parts' => $url_parts) ); if ($process_module) { - $this->Application->HandleEvent($module_event); + $this->Application->HandleEvent($module_event); } $item_id = $this->Get($module_prefix.'_id'); $module_params = Array($module_prefix.'_id' => $item_id ? $item_id : '0' ); Index: trunk/core/units/categories/categories_config.php =================================================================== diff -u -N -r4329 -r4446 --- trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 4329) +++ trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 4446) @@ -68,7 +68,7 @@ 'ParentId' => Array('type' => 'int','not_null' => '1','default' => '0'), 'Name' => Array('type' => 'string','not_null' => '1','default' => ''), 'Filename' => Array('type' => 'string','not_null' => '1','default' => ''), - 'AutomaticFilename' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'AutomaticFilename' => Array('type' => 'int','not_null' => '1','default' => '1'), 'Description' => Array('type' => 'string','not_null' => '1','default' => ''), 'CreatedOn' => Array('formatter' => 'kDateFormatter', 'default'=>'#NOW#', 'not_null' => '1'), 'EditorsPick' => Array('type' => 'int','default' => ''), Index: trunk/admin/install/langpacks/english.lang =================================================================== diff -u -N -r4427 -r4446 --- trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 4427) +++ trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 4446) @@ -881,6 +881,7 @@ TWVzc2FnZQ==U2VjdGlvbiBPdmVydmlldw==UHJvcGVydGllcw== + VGVtcGxhdGVzVHJhbnNsYXRpb24=U2VsZWN0aW5nIENhdGVnb3JpZXM=RW1wdHkgc2VsZWN0aW9u Index: trunk/core/units/configuration/configuration_tag_processor.php =================================================================== diff -u -N -r4225 -r4446 --- trunk/core/units/configuration/configuration_tag_processor.php (.../configuration_tag_processor.php) (revision 4225) +++ trunk/core/units/configuration/configuration_tag_processor.php (.../configuration_tag_processor.php) (revision 4446) @@ -34,7 +34,7 @@ $this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); // for edit/delete links using GET // using 2 blocks for drawing o row in case if current & next record titles match - $next_item_prompt = $list->Records[$list->CurrentIndex + 1]['prompt']; + $next_item_prompt = $list->CurrentIndex + 1 < $list->RecordsCount ? $list->Records[$list->CurrentIndex + 1]['prompt'] : ''; $this_item_prompt = $list->GetDBField('prompt'); if ($next_item_prompt == $this_item_prompt) { Index: trunk/kernel/units/general/inp1_parser.php =================================================================== diff -u -N -r3576 -r4446 --- trunk/kernel/units/general/inp1_parser.php (.../inp1_parser.php) (revision 3576) +++ trunk/kernel/units/general/inp1_parser.php (.../inp1_parser.php) (revision 4446) @@ -72,7 +72,7 @@ $lastExpire, $diffZone, $date, $nowDate, $lastExpireDate, $SearchPerformed, $TotalMessagesSent, $ado, $adminDir, $rootURL, $secureURL, $html, $timeout, $pathchar, $objTemplate, $objTopicList, $objArticleList, $objPostingList, $objCensorList, - $objSmileys, $objPMList, $SubscribeAddress, $SubscribeError, $SubscribeResult; + $objSmileys, $objPMList, $SubscribeAddress, $SubscribeError, $SubscribeResult, $application; $pathtoroot = $this->Application->IsAdmin() ? '../' : './'; $pathtoroot = realpath($pathtoroot)."/"; Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r4358 -r4446 --- trunk/core/kernel/application.php (.../application.php) (revision 4358) +++ trunk/core/kernel/application.php (.../application.php) (revision 4446) @@ -205,14 +205,11 @@ // Module items are recalled during url parsing & PhrasesCache is needed already there, // because it's used in their build events. That's why phrases cache initialization is // called from kHTTPQuery in case when mod_rewrite is used - if( !$this->RewriteURLs() ) - { + if (!$this->RewriteURLs()) { $this->Phrases = new PhrasesCache(); - $this->VerifyLanguageId(); $this->Phrases->Init('phrases'); - $this->VerifyThemeId(); } - + if( !$this->RecallVar('UserGroups') ) { $session =& $this->recallObject('Session'); @@ -411,6 +408,11 @@ $id_field = $this->getUnitOption($prefix, 'IDField'); if ($prefix == 'c') { + if(!$id) { + $this->setCache('filenames', $prefix.'_'.$id, ''); + return ''; + } + // this allows to save 2 sql queries for each category $sql = 'SELECT NamedParentPath, CachedCategoryTemplate, CachedItemTemplate FROM '.$table.' @@ -925,6 +927,29 @@ return $ret; } + + /** + * Returns sorted array of passed prefixes (to build url from) + * + * @param string $pass + * @return Array + */ + function getPassInfo($pass = 'all') + { + $pass = str_replace('all', trim($this->GetVar('passed'), ','), $pass); + + $pass_info = array_unique( explode(',', $pass) ); // array( prefix[.special], prefix[.special] ... + sort($pass_info, SORT_STRING); // to be prefix1,prefix1.special1,prefix1.special2,prefix3.specialX + + // ensure that "m" prefix is at the beginning + $main_index = array_search('m', $pass_info); + if ($main_index !== false) { + unset($pass_info[$main_index]); + array_unshift($pass_info, 'm'); + } + return $pass_info; + } + function BuildEnv_NEW($t, $params, $pass = 'all', $pass_events = false) { // $session =& $this->recallObject('Session'); @@ -946,20 +971,9 @@ unset($params['__SSL__']); } - $pass = str_replace('all', trim($this->GetVar('passed'), ','), $pass); - - if(strlen($pass) > 0) - { - $pass_info = array_unique( explode(',',$pass) ); // array( prefix[.special], prefix[.special] ... - sort($pass_info, SORT_STRING); // to be prefix1,prefix1.special1,prefix1.special2,prefix3.specialX - - // ensure that "m" prefix is always first - $main_index = array_search('m', $pass_info); - if($main_index !== false) - { - unset($pass_info[$main_index]); - } - + $pass_info = $this->getPassInfo($pass); + if ($pass_info) { + if ($pass_info[0] == 'm') array_shift($pass_info); $params['t'] = $t; foreach($pass_info as $pass_index => $pass_element) { @@ -1066,18 +1080,19 @@ return $ret; } - function BuildEnv($t, $params, $pass='all', $pass_events=false, $env_var=true) + function BuildEnv($t, $params, $pass='all', $pass_events = false, $env_var = true) { $session =& $this->recallObject('Session'); $ssl = isset($params['__SSL__']) ? $params['__SSL__'] : 0; $sid = $session->NeedQueryString() && !$this->RewriteURLs($ssl) ? $this->GetSID() : ''; - if( getArrayValue($params,'admin') == 1 ) $sid = $this->GetSID(); + if (getArrayValue($params,'admin') == 1) $sid = $this->GetSID(); $ret = ''; if ($env_var) { $ret = ENV_VAR_NAME.'='; } - $ret .= constOn('INPORTAL_ENV') ? $sid.'-'.$t : $sid.':'.$t; + + $ret .= $sid.(constOn('INPORTAL_ENV') ? '-' : ':'); $encode = false; if (isset($params['__URLENCODE__'])) { @@ -1089,16 +1104,39 @@ unset($params['__SSL__']); } - $pass = trim( str_replace('all', $this->GetVar('passed'), $pass), ','); - - if(strlen($pass) > 0) - { - $pass_info = array_unique( explode(',',$pass) ); // array( prefix[.special], prefix[.special] ... - foreach($pass_info as $pass_element) - { - $ret .= ':'.$this->BuildModuleEnv($pass_element, $params, $pass_events); + $env_string = ''; + $category_id = isset($params['m_cat_id']) ? $params['m_cat_id'] : $this->GetVar('m_cat_id'); + + $item_id = 0; + $pass_info = $this->getPassInfo($pass); + if ($pass_info) { + if ($pass_info[0] == 'm') array_shift($pass_info); + foreach ($pass_info as $pass_element) { + list($prefix) = explode('.', $pass_element); + $require_rewrite = $this->findModule('Var', $prefix); + if ($require_rewrite) { + $item_id = isset($params[$pass_element.'_id']) ? $params[$pass_element.'_id'] : $this->GetVar($pass_element.'_id'); + } + $env_string .= ':'.$this->BuildModuleEnv($pass_element, $params, $pass_events); } } + + if (strtolower($t) == '__default__') { + // to put category & item templates into cache + $filename = $this->getFilename('c', $category_id); + if ($item_id) { + $t = $this->getCache('item_templates', $category_id); + } + elseif ($category_id) { + $t = $this->getCache('category_templates', $category_id); + } + else { + $t = 'index'; + } + } + + $ret .= $t.':'.$this->BuildModuleEnv('m', $params, $pass_events).$env_string; + unset($params['pass']); unset($params['opener']); unset($params['m_event']); Index: trunk/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r4029 -r4446 --- trunk/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 4029) +++ trunk/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 4446) @@ -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: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r4314 -r4446 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4314) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4446) @@ -936,7 +936,7 @@ case 'text': if( !$this->Application->GetVar('INPORTAL_ON') ) { - $keywords[$field] = unhtmlentities( $keywords[$field] ); + $keywords[$field] = unhtmlentities( $keywords[$field] ); } if(strlen($keywords[$field]) >= $this->Application->ConfigValue('Search_MinKeyword_Length')) Index: trunk/globals.php =================================================================== diff -u -N -r4243 -r4446 --- trunk/globals.php (.../globals.php) (revision 4243) +++ trunk/globals.php (.../globals.php) (revision 4446) @@ -500,7 +500,7 @@ if ($r[$i] == "<") { $i++; continue; } - $r[$i] = preg_replace("/($k)/i", "$OpenTag\\1$CloseTag", $r[$i]); + $r[$i] = preg_replace('/('.preg_quote($k, '/').')/i', "$OpenTag\\1$CloseTag", $r[$i]); } } return join("", $r); Index: trunk/admin/install/inportal_schema.sql =================================================================== diff -u -N -r4330 -r4446 --- trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 4330) +++ trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 4446) @@ -19,7 +19,7 @@ ParentId int(11) NOT NULL default '0', Name varchar(255) NOT NULL default '', Filename varchar(255) NOT NULL, - AutomaticFilename tinyint(3) unsigned NOT NULL default '0', + AutomaticFilename tinyint(3) unsigned NOT NULL default '1', Description text NOT NULL, CreatedOn int(11) NOT NULL default '0', EditorsPick tinyint(4) NOT NULL default '0', Index: trunk/kernel/admin/include/navmenu.php =================================================================== diff -u -N -r4329 -r4446 --- trunk/kernel/admin/include/navmenu.php (.../navmenu.php) (revision 4329) +++ trunk/kernel/admin/include/navmenu.php (.../navmenu.php) (revision 4446) @@ -35,8 +35,9 @@ $admin."/icons/icon46_reviews.gif",$admin."/icons/icon24_reviews.gif", NULL,"in-portal:site",NULL,"in-portal:configure_categories",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_reviews.gif"); -$objSections->AddSection("in-portal:configure_categories", "la_tab_Settings", "la_tab_Settings", $admin."/config/", - "edit_config.php?&module=In-Portal§ion=in-portal:configure_categories", +$objSections->AddSection("in-portal:configure_categories", "la_tab_Settings", "la_tab_Settings", + $admin."/config/", "edit_config.php?&module=In-Portal§ion=in-portal:configure_categories", +// $admin.'/index4.php?section=in-portal:configure_categories&module=In-Portal','kernel4:config/config_universal', $admin."/icons/icon46_cat_settings.gif", $admin."/icons/icon24_cat_settings.gif", NULL, "in-portal:site","in-portal:advanced_view", "in-portal:configuration_search",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_cat_settings.gif","la_updating_config"); @@ -197,36 +198,42 @@ NULL,NULL,NULL,$admin."/icons/icon46_list_banlist.gif","la_updating_rules"); /*Edit Category Section*/ -$objSections->AddSection("in-portal:editcategory_general","la_tab_General",NULL,$admin."/category/", - "javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory.php',0);", - $admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif", - NULL, "in-portal:browse",NULL, "in-portal:editcategory_items",-1); +$home_category = $objSession->GetVariable('IsHomeCategory'); -$objSections->AddSection("in-portal:editcategory_items","la_tab_Items",NULL, $admin."/category/", - "javascript:edit_submit('category','CatEditStatus','".$admin."/index4_direct.php',0, '&t=category/category_items&prefix=c');", - $admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif", - NULL,"in-portal:browse","in-portal:editcategory_general","in-portal:editcategory_relations",-1); - -$objSections->AddSection("in-portal:editcategory_relations","la_tab_Relations",NULL, $admin."/category/", - "javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory_relations.php',0);", - $admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif", - NULL,"in-portal:browse","in-portal:editcategory_general","in-portal:editcategory_images",-1); +if(!$home_category) { + $objSections->AddSection("in-portal:editcategory_general","la_tab_General",NULL,$admin."/category/", + "javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory.php',0);", + $admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif", + NULL, "in-portal:browse",NULL, "in-portal:editcategory_relations",-1); + + $objSections->AddSection("in-portal:editcategory_relations","la_tab_Relations",NULL, $admin."/category/", + "javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory_relations.php',0);", + $admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif", + NULL,"in-portal:browse","in-portal:editcategory_general","in-portal:editcategory_images",-1); + + $objSections->AddSection("in-portal:editcategory_images","la_tab_Images", NULL,$admin."/category/", + "javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory_images.php',0);", + $admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif", + NULL, "in-portal:browse", "in-portal:editcategory_relations", "in-portal:editcategory_permissions",-1); -$objSections->AddSection("in-portal:editcategory_images","la_tab_Images", NULL,$admin."/category/", - "javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory_images.php',0);", - $admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif", - NULL, "in-portal:browse", "in-portal:editcategory_relations", "in-portal:editcategory_permissions",-1); -$objSections->AddSection("in-portal:editcategory_permissions","la_tab_Permissions", NULL,$admin."/category/", + $objSections->AddSection("in-portal:editcategory_permissions","la_tab_Permissions", NULL,$admin."/category/", + "javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory_permissions.php',0);", + $admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif", + NULL, "in-portal:browse", 'in-portal:editcategory_images', 'in-portal:editcategory_custom', -1); + + $objSections->AddSection("in-portal:editcategory_custom", "la_tab_Custom", NULL, $admin."/category/", + "javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory_custom.php',0);", + $admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif", NULL, + "in-portal:browse", "in-portal:editcategory_permissions", NULL,-1); +} +else { + $objSections->AddSection("in-portal:editcategory_permissions","la_tab_Permissions", NULL,$admin."/category/", "javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory_permissions.php',0);", $admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif", - NULL, "in-portal:browse", "in-portal:editcategory_images","in-portal:editcategory_custom",-1); + NULL, "in-portal:browse", null, null, -1); +} -$objSections->AddSection("in-portal:editcategory_custom", "la_tab_Custom", NULL, $admin."/category/", - "javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory_custom.php',0);", - $admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif", NULL, - "in-portal:browse", "in-portal:editcategory_permissions", NULL,-1); - /* category edit subitems */ $objSections->AddSection("in-portal:cat_imageedit","la_tab_Images","la_title_edit_category",$admin."/category/", "javascript:edit_submit('category','CatEditStatus','".$admin."/category/addimage.php',0);", Index: trunk/core/units/configuration/configuration_config.php =================================================================== diff -u -N -r4043 -r4446 --- trunk/core/units/configuration/configuration_config.php (.../configuration_config.php) (revision 4043) +++ trunk/core/units/configuration/configuration_config.php (.../configuration_config.php) (revision 4446) @@ -18,7 +18,7 @@ 'TitlePresets' => Array( 'default' => Array('tag_params' => Array('conf' => Array('per_page' => -1))), - + 'config_list_general' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"), 'config_list_output' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"), 'config_list_contacts' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"), Index: trunk/admin/category/permcacheupdate.php =================================================================== diff -u -N -r4124 -r4446 --- trunk/admin/category/permcacheupdate.php (.../permcacheupdate.php) (revision 4124) +++ trunk/admin/category/permcacheupdate.php (.../permcacheupdate.php) (revision 4446) @@ -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,6 +134,8 @@ var $totalCats; var $doneCats; var $table; + + var $root_prefixes = Array(); /** * Kernel Application @@ -147,18 +149,22 @@ * @var kDBConnection */ var $Conn = null; - + function clsCacheUpdater($continuing=false) { $this->Application =& kApplication::Instance(); $this->Conn =& $this->Application->GetADODBConnection(); + + foreach ($this->Application->ModuleInfo as $module_name => $module_info) { + $this->root_prefixes[ $module_info['RootCat'] ] = $module_info['Var']; + } $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 +184,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 +222,8 @@ { $sql='DROP TABLE IF EXISTS '.$this->table; $this->conn->Execute($sql); - } - + } + function DoTheJob() { $data = $this->Stack->Get(); @@ -229,27 +235,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,7 +274,7 @@ $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) @@ -277,48 +283,68 @@ '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) { + $category_id = $data['current_id']; + $sql = 'SELECT Name, Filename, CategoryTemplate, ItemTemplate FROM '.GetTablePrefix().'Category - WHERE CategoryId = '.$data['current_id']; - + WHERE CategoryId = '.$category_id; + $rs = $this->conn->Execute($sql); - + if ($rs && !$rs->EOF) { $data['title'][] = $rs->fields['Name']; $data['named_path'][] = $rs->fields['Filename']; + + // it is one of the modules root category + $root_prefix = isset($this->root_prefixes[$category_id]) ? $this->root_prefixes[$category_id] : false; + if ($root_prefix) { + $fields_hash = Array(); + if (!$rs->fields['CategoryTemplate']) { + $rs->fields['CategoryTemplate'] = $this->Application->ConfigValue($root_prefix.'_CategoryTemplate'); + $fields_hash['CategoryTemplate'] = $rs->fields['CategoryTemplate']; + } + + if (!$rs->fields['ItemTemplate']) { + $rs->fields['ItemTemplate'] = $this->Application->ConfigValue($root_prefix.'_ItemTemplate'); + $fields_hash['ItemTemplate'] = $rs->fields['ItemTemplate']; + } + + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$category_id); + } // if explicitly set, then use it; use parent template otherwise if ($rs->fields['CategoryTemplate']) { $data['category_template'] = $rs->fields['CategoryTemplate']; } + if ($rs->fields['ItemTemplate']) { $data['item_template'] = $rs->fields['ItemTemplate']; } } } - + 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 +353,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: trunk/kernel/units/config_general/config_general_tag_processor.php =================================================================== diff -u -N -r4243 -r4446 --- trunk/kernel/units/config_general/config_general_tag_processor.php (.../config_general_tag_processor.php) (revision 4243) +++ trunk/kernel/units/config_general/config_general_tag_processor.php (.../config_general_tag_processor.php) (revision 4446) @@ -79,9 +79,11 @@ $next_params['cat_id'] = $res['ParentId']; return $this->CategoryPath($next_params).$this->Application->ParseBlock($block_params); } - } - function SaveWarning($params){ + } + function SaveWarning($params) + { + $object=&$this->Application->recallObject($this->getPrefixSpecial()); $root_cat=$object->GetDBField("RootCat"); $stored_cat=$this->Application->RecallVar("StoredRootCatId", ""); Index: trunk/admin/install/upgrades/inportal_upgrade_v1.1.8.sql =================================================================== diff -u -N -r4108 -r4446 --- trunk/admin/install/upgrades/inportal_upgrade_v1.1.8.sql (.../inportal_upgrade_v1.1.8.sql) (revision 4108) +++ trunk/admin/install/upgrades/inportal_upgrade_v1.1.8.sql (.../inportal_upgrade_v1.1.8.sql) (revision 4446) @@ -1,5 +1,5 @@ -UPDATE SearchConfig SET CustomFieldId = NULL WHERE CustomFieldId = 0; ALTER TABLE SearchConfig CHANGE CustomFieldId CustomFieldId INT(11) NULL DEFAULT NULL; +UPDATE SearchConfig SET CustomFieldId = NULL WHERE CustomFieldId = 0; UPDATE SearchConfig SET SimpleSearch = -1 WHERE TableName = 'PortalUser' AND ModuleName = 'In-Portal'; INSERT INTO ConfigurationAdmin VALUES ('SearchRel_Keyword_category', 'la_config_SearchRel_DefaultKeyword', 'la_text_keyword', 'text', NULL, NULL, 0, 1); @@ -13,5 +13,6 @@ CREATE TABLE CategoryCustomData (CustomDataId int(11) NOT NULL auto_increment, ResourceId int(10) unsigned NOT NULL default '0', UNIQUE KEY ResourceId (ResourceId), PRIMARY KEY (CustomDataId)); ALTER TABLE Category ADD CategoryTemplate VARCHAR(255) NOT NULL, ADD ItemTemplate VARCHAR(255) NOT NULL, ADD CachedCategoryTemplate VARCHAR(255) NOT NULL, ADD CachedItemTemplate VARCHAR(255) NOT NULL; +ALTER TABLE Category CHANGE AutomaticFilename AutomaticFilename TINYINT(3) UNSIGNED NOT NULL DEFAULT '1'; UPDATE Modules SET Version = '1.1.8' WHERE Name = 'In-Portal'; \ No newline at end of file Index: trunk/kernel/admin_templates/incs/form_blocks.tpl =================================================================== diff -u -N -r4320 -r4446 --- trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 4320) +++ trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 4446) @@ -1,20 +1,32 @@ - + + +
- img/icons/.gif" align="absmiddle" title="">  - + .gif" align="absmiddle" title=""> 
+ + + + img/logo_bg.gif) no-repeat top right;"> + + +
+ .gif" align="absmiddle" title="">  +
+
+
- + +
- \ No newline at end of file Index: trunk/kernel/admin_templates/incs/config_blocks.tpl =================================================================== diff -u -N -r4043 -r4446 --- trunk/kernel/admin_templates/incs/config_blocks.tpl (.../config_blocks.tpl) (revision 4043) +++ trunk/kernel/admin_templates/incs/config_blocks.tpl (.../config_blocks.tpl) (revision 4446) @@ -1,9 +1,9 @@ - " value="" /> + " name="" value="" /> - " id="" value="" /> + " primarytype="password" name="" id="" value="" /> " id="verify_" value="" />  "> @@ -13,29 +13,30 @@ - " tabindex=""> + - + " name="" value=""> " type="checkbox" id="_cb_" name="_cb_" class="" onclick="update_checkbox(this, document.getElementById(''))"> - + name="" id="_" value="">  - + +
@@ -58,6 +59,7 @@ +
Index: trunk/core/kernel/db/db_connection.php =================================================================== diff -u -N -r4329 -r4446 --- trunk/core/kernel/db/db_connection.php (.../db_connection.php) (revision 4329) +++ trunk/core/kernel/db/db_connection.php (.../db_connection.php) (revision 4446) @@ -567,6 +567,8 @@ function doUpdate($fields_hash, $table, $key_clause) { + if (!$fields_hash) return true; + $fields_sql = ''; foreach ($fields_hash as $field_name => $field_value) { $fields_sql .= '`'.$field_name.'` = '.$this->qstr($field_value).','; Index: trunk/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r4287 -r4446 --- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 4287) +++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 4446) @@ -1133,7 +1133,7 @@ $preset_name = replaceModuleSection($params['title_preset']); $title_presets = $this->Application->getUnitOption($this->Prefix,'TitlePresets'); $title_info = getArrayValue($title_presets, $preset_name); - if($title_info === false) return $params['title']; + if($title_info === false) return str_replace('#preset_name#', $preset_name, $params['title']); if( getArrayValue($title_presets,'default') ) { @@ -1458,13 +1458,17 @@ function ModulePath($params) { $force_module = getArrayValue($params, 'module'); - if($force_module) - { - $force_module = strtolower($force_module); + if ($force_module) { + if ($force_module == '#session#') { + $force_module = $this->Application->RecallVar('module'); + } + else { + $force_module = strtolower($force_module); + } + $module_folder = trim( $this->Conn->GetOne('SELECT Path FROM '.TABLE_PREFIX.'Modules WHERE LOWER(Name) = '.$this->Conn->qstr($force_module) ), '/'); } - else - { + else { $module_folder = $this->Application->getUnitOption($this->Prefix, 'ModuleFolder'); } return '../../'.$module_folder.'/admin_templates/'; Index: trunk/admin/email/sendmail.php =================================================================== diff -u -N -r4243 -r4446 --- trunk/admin/email/sendmail.php (.../sendmail.php) (revision 4243) +++ trunk/admin/email/sendmail.php (.../sendmail.php) (revision 4446) @@ -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); } ?> - + - > + > - - > + > - - > + > - - > + > - > + > - +
+
+ ">
+

- - + +