Index: trunk/core/kernel/startup.php =================================================================== diff -u -r5248 -r6428 --- trunk/core/kernel/startup.php (.../startup.php) (revision 5248) +++ trunk/core/kernel/startup.php (.../startup.php) (revision 6428) @@ -18,7 +18,7 @@ # New path detection method: begin safeDefine('REL_PATH', '/admin'); - $ps = preg_replace("/".preg_quote(rtrim(REL_PATH, '/'), '/')."$/", '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))); + $ps = rtrim(preg_replace("/".preg_quote(rtrim(REL_PATH, '/'), '/')."$/", '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'); safeDefine('BASE_PATH', $ps); // in case in-portal has defined it before # New path detection method: end Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/kernel/admin/include/toolbar/editgroup_users.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/admin/install.php =================================================================== diff -u -r6093 -r6428 --- trunk/admin/install.php (.../install.php) (revision 6093) +++ trunk/admin/install.php (.../install.php) (revision 6428) @@ -382,8 +382,14 @@ { $RootPass = $rs->fields["VariableValue"]; - if(strlen($RootPass)>0) - $LoggedIn = ($RootPass==md5($_POST["UserPass"])); + if(strlen($RootPass)>0) { + if (ConvertVersion($g_InPortal) >= ConvertVersion("1.3.0")) { + $LoggedIn = ($RootPass==md5(md5($_POST["UserPass"]).'b38')); + } + else { + $LoggedIn = ($RootPass==md5($_POST["UserPass"])); + } + } } else { $login_err_mesg = 'Invalid username or password'; @@ -1361,7 +1367,7 @@ } else { - $pass = md5($pass); + $pass = md5(md5($pass).'b38'); $sql = ' UPDATE '.$g_TablePrefix.'ConfigurationValues SET VariableValue = '.$ado->qstr($pass).' WHERE VariableName = "RootPass";'; @@ -1379,10 +1385,10 @@ if($state=="lang_install_init") { - $ado =& inst_GetADODBConnection(); + $ado =& inst_GetADODBConnection(); - if( TableExists($ado, 'Language,Phrase') ) - { + if( TableExists($ado, 'Language,Phrase') ) + { // KERNEL 4 INIT: BEGIN define('FULL_PATH', realpath(dirname(__FILE__).'/..')); define('APPLICATION_CLASS', 'MyApplication'); @@ -1392,12 +1398,18 @@ $application->Init(); // KERNEL 4 INIT: END - $lang_xml =& $application->recallObject('LangXML'); + $lang_xml =& $application->recallObject('LangXML'); - $lang_xml->renameTable('phrases', TABLE_PREFIX.'ImportPhrases'); - $lang_xml->renameTable('emailmessages', TABLE_PREFIX.'ImportEvents'); + if (defined('DBG_FAST_INSTALL') && DBG_FAST_INSTALL) { + $lang_xml->tables['phrases'] = TABLE_PREFIX.'Phrase'; + $lang_xml->tables['emailmessages'] = TABLE_PREFIX.'EmailMessage'; + } + else { + $lang_xml->renameTable('phrases', TABLE_PREFIX.'ImportPhrases'); + $lang_xml->renameTable('emailmessages', TABLE_PREFIX.'ImportEvents'); + } - $lang_xml->lang_object->TableName = $application->getUnitOption('lang','TableName'); + $lang_xml->lang_object->TableName = $application->getUnitOption('lang','TableName'); $languages = $application->GetVar('lang'); if($languages) @@ -1418,19 +1430,24 @@ } } - $state = 'lang_install'; - } - else - { - $state = 'lang_select'; - } + if (defined('DBG_FAST_INSTALL') && DBG_FAST_INSTALL) { + $state = 'lang_default'; + } + else { + $state = 'lang_install'; + } + } + else + { + $state = 'lang_select'; + } - $application->Done(); - } - else - { - $general_error = 'Database error! No language tables found!'; - } + $application->Done(); + } + else + { + $general_error = 'Database error! No language tables found!'; + } } if($state=="lang_install") @@ -1510,7 +1527,12 @@ $Id = $_POST["lang"]; $objLanguages->SetPrimary($Id); - $state="postconfig_1"; + if (defined('DBG_FAST_INSTALL')) { + $state = 'theme_sel'; + } + else { + $state="postconfig_1"; + } } if($state=="lang_default") @@ -1780,6 +1802,7 @@ $title = "Thank You!"; $help ="

Thanks for using In-Portal! Be sure to visit www.in-portal.net "; $help.=" for the latest news, module releases and support.

"; + $help.="

*Make sure to clean your browser' cache after upgrading In-portal version

"; break; case "license": $title = "License Configuration"; Index: trunk/core/units/configuration/configuration_event_handler.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 6093) +++ trunk/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 6428) @@ -49,7 +49,8 @@ $field_options['skip_empty'] = 1; $object->SetFieldOptions('VariableValue', $field_options); }else { - $object->SetDBField('VariableValue', md5($object->GetDBField('VariableValue'))); + $password_formatter =& $this->Application->recallObject('kPasswordFormatter'); + $object->SetDBField('VariableValue', $password_formatter->EncryptPassword($object->GetDBField('VariableValue'), 'b38')); } } @@ -171,7 +172,7 @@ $event->redirect_params = Array('opener' => 's', 'pass'=>'all,conf'); //stay! $event->redirect = false; }*/ - + /** * Process items from selector (selected_ids var, key - prefix, value - comma separated ids) * Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/addcategory.php'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/addcategory_relations.php'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/js/lang.js'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/admin/category/images/ddarrow.gif =================================================================== diff -u -r13 -r6428 Binary files differ Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/addcategory_custom.php'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/js/core.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/addcategory_customfields.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/admin/category/images/ddarrow_over.gif =================================================================== diff -u -r13 -r6428 Binary files differ Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/addcategory_permissions.php'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/category_maint.php'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/addpermission_modules.php'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/addcategory_images.php'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/js/main.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/addrelation.php'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/addimage.php'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/addpermission.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/admin/category/images/ddarrow_active.gif =================================================================== diff -u -r13 -r6428 Binary files differ Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/permcacheupdate.php'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/category/category_items.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/units/users/users_event_handler.php =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6093) +++ trunk/kernel/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6428) @@ -121,7 +121,9 @@ if ($this->Application->IsAdmin() && ($login_value == 'root')) { // logging in "root" (admin only) $root_password = $this->Application->ConfigValue('RootPass'); - if ($root_password != md5($password)) { + $password_formatter =& $this->Application->recallObject('kPasswordFormatter'); + $test = $password_formatter->EncryptPassword($password, 'b38'); + if ($root_password != $test) { $object->SetError('ValidateLogin', 'invalid_password', 'lu_invalid_password'); $event->status = erFAIL; return false; Index: trunk/core/kernel/parser/template_parser.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/kernel/parser/template_parser.php (.../template_parser.php) (revision 6093) +++ trunk/core/kernel/parser/template_parser.php (.../template_parser.php) (revision 6428) @@ -429,6 +429,7 @@ } if ( !$this->GetParam('from_inportal') && strpos($output, 'Application->recallObject('Inp1Parser'); +// $name = $this->Application->TemplatesCache->GetTemplateFileName($name) . '-block:' . $name; // may be is needed (by Alex) $output = $inp1_parser->Parse($name, $output); } return $output; Index: trunk/kernel/units/general/helpers/mod_rewrite_helper.php =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 6093) +++ trunk/kernel/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 6428) @@ -34,7 +34,7 @@ $res = true; } - $this->Application->VerifyLanguageId(); +// $this->Application->VerifyLanguageId(); if (!$res) { array_unshift($url_parts, $url_part); } @@ -54,7 +54,7 @@ $vars['m_theme'] = $theme_id; $res = true; } - $this->Application->VerifyThemeId(); // verify anyway - will set default if not found!!! +// $this->Application->VerifyThemeId(); // verify anyway - will set default if not found!!! if (!$res) { array_unshift($url_parts, $url_part); } @@ -98,6 +98,20 @@ return $res; } + function ProcessPage(&$url_parts, &$vars) + { + if (!is_numeric($url_parts[0]) || count($url_parts) > 1) return false; + + // set module pages for all modules, since we don't know which module will need it + foreach ($this->Application->ModuleInfo as $module_name => $module_data) + { + $vars[ $module_data['Var'].'_id'] = 0; + $vars[ $module_data['Var'].'_Page'] = $url_parts[0]; + $vars[ $module_data['Var'].'_Reviews_Page'] = 0; + } + return true; + } + function ProcessModuleIndex(&$url_parts, &$vars) { if ( count($url_parts) > 1) return false; // if no more parts or only 1 part left @@ -107,14 +121,7 @@ if( $url_parts ) { // if parts are left, it can only be module page if (!is_numeric($url_parts[0])) return false; - - // set module pages for all modules, since we don't know which module will need it - foreach ($this->Application->ModuleInfo as $module_name => $module_data) - { - $vars[ $module_data['Var'].'_id'] = 0; - $vars[ $module_data['Var'].'_Page'] = $url_parts[0]; - $vars[ $module_data['Var'].'_Reviews_Page'] = 0; - } + $this->ProcessPage($url_parts, $vars); } // try to find CMS index page of the category @@ -279,7 +286,7 @@ */ function ProcessVirtualTemplate(&$url_parts, &$vars) { - if (!isset($url_parts[0]) || !$this->Application->isModuleEnabled('In-CMS')) return false; + if (!isset($url_parts[0]) || !$this->Application->isModuleEnabled('In-Edit')) return false; $template_path = implode('/', $url_parts); $sql = 'SELECT p.PageId, ci.CategoryId FROM '.TABLE_PREFIX.'Pages AS p @@ -326,15 +333,15 @@ { $this->HTTPQuery->Set($name,$value); } - if ($restored) { +// if ($restored) { $this->InitAll(); - } +// } $this->HTTPQuery->finalizeParsing($passed); } function InitAll() { - $this->Application->Phrases = new PhrasesCache(); +// $this->Application->Phrases = new PhrasesCache(); $this->Application->VerifyLanguageId(); $this->Application->Phrases->Init('phrases'); $this->Application->VerifyThemeId(); @@ -380,8 +387,6 @@ $this->ProcessCategory($url_parts, $vars); - - if ( $this->ProcessModuleIndex($url_parts, $vars) ) { foreach ($this->Application->ModuleInfo as $module_name => $info) { $passed[] = $info['Var']; @@ -423,11 +428,25 @@ } } + if ( $this->ProcessPage($url_parts, $vars) ) { + return $vars; + } + if ( $module_prefix = $this->ProcessModuleItem($url_parts, $vars, false) ) { $passed[] = $module_prefix; return $vars; } + if ( $this->Application->isModuleEnabled('In-Edit') && $this->Application->GetVar('admin') == 1) { + $adm_ses =& $this->Application->recallObject('Session.admin'); + $user = $adm_ses->RecallVar('user_id'); + $perm_helper =& $this->Application->recallObject('PermissionsHelper'); + if ($perm_helper->CheckUserPermission($user, 'PAGE.ADD', 0)) { + $vars['t'] = implode('/', $url_parts); + return $vars; + } + } + $not_found = $this->Application->ConfigValue('ErrorTemplate'); $vars['t'] = $not_found ? $not_found : 'error_notfound'; Index: trunk/kernel/units/admin/admin_config.php =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/units/admin/admin_config.php (.../admin_config.php) (revision 6093) +++ trunk/kernel/units/admin/admin_config.php (.../admin_config.php) (revision 6428) @@ -124,16 +124,6 @@ 'type' => stTREE, ), - /*'in-portal:service' => Array( - 'parent' => 'in-portal:tools', - 'icon' => 'conf_general', - 'label' => 'la_tab_Service', - 'url' => Array('t' => 'tools/system_tools', 'pass' => 'm'), - 'permissions' => Array('view'), - 'priority' => 10, - 'type' => stTREE, - ),*/ - 'in-portal:backup' => Array( 'parent' => 'in-portal:tools', 'icon' => 'tool_backup', @@ -198,4 +188,18 @@ ); + + $application =& kApplication::Instance(); + if ($application->isDebugMode()) { + $config['Sections']['in-portal:service'] = Array( + 'parent' => 'in-portal:tools', + 'icon' => 'conf_general', + 'label' => 'la_tab_Service', + 'url' => Array('t' => 'tools/system_tools', 'pass' => 'm'), + 'permissions' => Array('view'), + 'priority' => 10, + 'type' => stTREE, + ); + } + ?> \ No newline at end of file Index: trunk/core/kernel/db/dblist.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/kernel/db/dblist.php (.../dblist.php) (revision 6093) +++ trunk/core/kernel/db/dblist.php (.../dblist.php) (revision 6428) @@ -436,7 +436,7 @@ $fields = $this->getCalculatedFields($aggregated); if (is_array($fields) && count($fields) > 0) { foreach ($fields as $field_name => $field_expression) { - $clause = preg_replace('/[,` ]{1}'.$field_name.'[` ]{1}/', $field_expression, $clause); + $clause = preg_replace('/[,` ]{1}'.$field_name.'[` ]{1}/', ' '.$field_expression.' ', $clause); } } return $clause; Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/kernel/admin/include/toolbar/editcategory_relationselect.php'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/kernel/admin/include/toolbar/editcategory_relations.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/admin/install/upgrades/inportal_upgrade_v1.3.0.sql =================================================================== diff -u --- trunk/admin/install/upgrades/inportal_upgrade_v1.3.0.sql (revision 0) +++ trunk/admin/install/upgrades/inportal_upgrade_v1.3.0.sql (revision 6428) @@ -0,0 +1,3 @@ +UPDATE ConfigurationValues SET VariableValue = MD5(CONCAT(VariableValue, 'b38')) WHERE VariableName = 'RootPass'; + +UPDATE Modules SET Version = '1.3.0' WHERE Name = 'In-Portal'; \ No newline at end of file Index: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6093) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6428) @@ -376,8 +376,6 @@ $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; $i < sizeof($types_array); $i++) { @@ -681,10 +679,11 @@ $object =& $event->getObject(); $this->Application->SetVar($event->getPrefixSpecial().'_Page', 1); $lang = $this->Application->GetVar('m_lang'); - $product_table = $this->Application->getUnitOption('p', 'TableName'); + $items_table = $this->Application->getUnitOption($event->Prefix, 'TableName'); + $module_name = $this->Application->findModule('Var', $event->Prefix, 'Name'); $sql = ' SELECT * FROM '.$this->Application->getUnitOption('confs', 'TableName').' - WHERE ModuleName="In-Commerce" + WHERE ModuleName="'.$module_name.'" AND SimpleSearch=1'; $search_config = $this->Conn->Query($sql, 'FieldName'); $field_list = array_keys($search_config); @@ -699,7 +698,7 @@ $custom_fields = $this->Application->getUnitOption($event->Prefix, 'CustomFields'); if ($custom_fields) { $custom_table = $this->Application->getUnitOption($event->Prefix.'-cdata', 'TableName'); - $join_clauses[] = ' LEFT JOIN '.$custom_table.' custom_data ON '.$product_table.'.ResourceId = custom_data.ResourceId'; + $join_clauses[] = ' LEFT JOIN '.$custom_table.' custom_data ON '.$items_table.'.ResourceId = custom_data.ResourceId'; } // what field in search config becomes what field in sql (key - new field, value - old field (from searchconfig table)) @@ -740,17 +739,31 @@ } else { + $multi_lingual = false; + if ($exploded[0] == 'MULTI') + { + $multi_lingual = true; + $foreign_field = $exploded[1]; + } $exploded = explode('.', $foreign_field); // format: table.field_name $foreign_table = TABLE_PREFIX.$exploded[0]; $alias_counter++; $alias = 't'.$alias_counter; - $field_list[$key] = $alias.'.'.$exploded[1]; - $search_config_map[ $field_list[$key] ] = $field; + if ($multi_lingual) { + $field_list[$key] = $alias.'.'.'l'.$lang.'_'.$exploded[1]; + $field_list[$key.'_primary'] = 'l'.$this->Application->GetDefaultLanguageId().'_'.$field; + $search_config_map[ $field_list[$key] ] = $field; + $search_config_map[ $field_list[$key.'_primary'] ] = $field; + } + else { + $field_list[$key] = $alias.'.'.$exploded[1]; + $search_config_map[ $field_list[$key] ] = $field; + } $join_clause = str_replace('{ForeignTable}', $alias, $search_config[$field]['JoinClause']); - $join_clause = str_replace('{LocalTable}', $product_table, $join_clause); + $join_clause = str_replace('{LocalTable}', $items_table, $join_clause); $join_clauses[] = ' LEFT JOIN '.$foreign_table.' '.$alias.' ON '.$join_clause; @@ -771,20 +784,20 @@ $search_helper =& $this->Application->recallObject('SearchHelper'); $where_clause = $search_helper->buildWhereClause($keywords, $field_list); - $where_clause = $where_clause.' AND '.$product_table.'.Status=1'; + $where_clause = $where_clause.' AND '.$items_table.'.Status=1'; if($this->Application->GetVar('Action') == 'm_simple_subsearch') // subsearch, In-portal { if( $event->getEventParam('ResultIds') ) { - $where_clause .= ' AND '.$product_table.'.ResourceId IN ('.implode(',', $event->specificParams['ResultIds']).')'; + $where_clause .= ' AND '.$items_table.'.ResourceId IN ('.implode(',', $event->specificParams['ResultIds']).')'; } } if( $event->MasterEvent && $event->MasterEvent->Name == 'OnListBuild' ) // subsearch, k4 { if( $event->MasterEvent->getEventParam('ResultIds') ) { - $where_clause .= ' AND '.$product_table.'.ResourceId IN ('.implode(',', $event->MasterEvent->getEventParam('ResultIds')).')'; + $where_clause .= ' AND '.$items_table.'.ResourceId IN ('.implode(',', $event->MasterEvent->getEventParam('ResultIds')).')'; } } @@ -801,34 +814,45 @@ $revelance_parts[] = 'IF('.$field.' LIKE "%'.$keyword.'%", '.$weight.', 0)'; } } - $rel_keywords = $this->Application->ConfigValue('SearchRel_Keyword_products') / 100; - $rel_pop = $this->Application->ConfigValue('SearchRel_Pop_products') / 100; - $rel_rating = $this->Application->ConfigValue('SearchRel_Rating_products') / 100; + $conf_postfix = $this->Application->getUnitOption($event->Prefix, 'SearchConfigPostfix'); + $rel_keywords = $this->Application->ConfigValue('SearchRel_Keyword_'.$conf_postfix) / 100; + $rel_pop = $this->Application->ConfigValue('SearchRel_Pop_'.$conf_postfix) / 100; + $rel_rating = $this->Application->ConfigValue('SearchRel_Rating_'.$conf_postfix) / 100; $relevance_clause = '('.implode(' + ', $revelance_parts).') / '.$weight_sum.' * '.$rel_keywords; - $relevance_clause .= ' + (Hits + 1) / (MAX(Hits) + 1) * '.$rel_pop; - $relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating; + if ($rel_pop && isset($object->Fields['Hits'])) { + $relevance_clause .= ' + (Hits + 1) / (MAX(Hits) + 1) * '.$rel_pop; + } + if ($rel_rating && isset($object->Fields['CachedRating'])) { + $relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating; + } // building final search query - if (!$this->Application->GetVar('INPORTAL_ON')) { + if (!$this->Application->GetVar('do_not_drop_search_table') && !$this->Application->GetVar('INPORTAL_ON')) { $this->Conn->Query('DROP TABLE IF EXISTS '.$search_table); // erase old search table if clean k4 event + $this->Application->SetVar('do_not_drop_search_table', true); } - if ($this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"')) { + + $search_table_exists = $this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"'); + if ($search_table_exists) { $select_intro = 'INSERT INTO '.$search_table.' (Relevance, ItemId, ResourceId, ItemType, EdPick) '; } else { $select_intro = 'CREATE TABLE '.$search_table.' AS '; } + $edpick_clause = $this->Application->getUnitOption($event->Prefix.'.EditorsPick', 'Fields') ? $items_table.'.EditorsPick' : '0'; + + $sql = $select_intro.' SELECT '.$relevance_clause.' AS Relevance, - '.$product_table.'.ProductId AS ItemId, - '.$product_table.'.ResourceId, - 11 AS ItemType, - '.$product_table.'.EditorsPick AS EdPick + '.$items_table.'.'.$this->Application->getUnitOption($event->Prefix, 'IDField').' AS ItemId, + '.$items_table.'.ResourceId, + '.$this->Application->getUnitOption($event->Prefix, 'ItemType').' AS ItemType, + '.$edpick_clause.' AS EdPick FROM '.$object->TableName.' '.implode(' ', $join_clauses).' WHERE '.$where_clause.' - GROUP BY '.$product_table.'.ProductId'; + GROUP BY '.$items_table.'.'.$this->Application->getUnitOption($event->Prefix, 'IDField'); $res = $this->Conn->Query($sql); } @@ -1887,7 +1911,6 @@ } } } - } ?> \ No newline at end of file Index: trunk/core/kernel/utility/debugger.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/kernel/utility/debugger.php (.../debugger.php) (revision 6093) +++ trunk/core/kernel/utility/debugger.php (.../debugger.php) (revision 6428) @@ -244,14 +244,14 @@ $div_width['left'] = round((($total - $total_before - $runtime) / $total) * $total_width); $ret = 'Name: '.$Data['description'].'
'; - + if (isset($Data['file'])) { $ret .= '[Runtime: '.$runtime.'s] [File: '.$Data['file'].']
'; } else { $ret .= 'Runtime: '.$runtime.'s
'; } - + $ret .= '
'; $ret .= '
'; $ret .= '
'; @@ -310,7 +310,7 @@ function print_r(&$array, $return_output = false, $cut_first = -1, $cut_min_length = -1) { static $first_line = true, $tab_count = -1; - + if (is_null($array)) { return 'NULL'; }elseif (!is_array($array)) { @@ -319,15 +319,15 @@ } return $array; } - + $output = ''; - + $tab_count++; $output .= "Array\n".str_repeat(' ', $tab_count)."(\n"; - + $tab_count++; $tabsign = $tab_count ? str_repeat(' ', $tab_count) : ''; - + $array_keys = array_keys($array); foreach ($array_keys as $key) { @@ -348,11 +348,11 @@ } $output .= $tabsign.'['.$key.'] = '.$array[$key]."\n"; break; - + case 'NULL': $output .= $tabsign.'['.$key."] = NULL\n"; break; - + case 'object': $attribute_names = get_class_vars( get_class($array[$key]) ); if (!$attribute_names) { @@ -363,7 +363,7 @@ $output .= $tabsign.'['.$key.'] = SKIPPED (class: '.get_class($array[$key]).")\n"; break; } - + // $attribute_value - default value for this attribute, not used here foreach ($attribute_names as $attribute_name => $attribute_value) { if (is_object($array[$key]->$attribute_name)) { @@ -375,7 +375,7 @@ $output .= $tabsign.'['.$attribute_name.'] = SKIPPED (class: '.$object_class.")\n"; continue; } - + array_push($this->RecursionStack, $object_class); $output .= $this->print_r($array[$key]->$attribute_name, true, 50, 200); array_pop($this->RecursionStack); @@ -391,30 +391,30 @@ } } break; - + default: $output .= $tabsign.'['.$key.'] unknown = '.gettype($array[$key])."\n"; break; } } - + $tab_count--; $output .= str_repeat(' ', $tab_count).")\n"; - + if ($first_line) { $first_line = false; $output .= "\n"; } - + $tab_count--; - + if ($return_output) { return $output; } else { echo $output; } - + return true; } @@ -510,7 +510,7 @@ { $trace = debug_backtrace(); array_shift($trace); - + $this->Data[] = Array('trace' => $trace, 'debug_type' => 'trace'); } @@ -661,7 +661,7 @@ $this->ProfilerData[$key]['file'] = $trace_file.':'.$trace_results[$i]['line']; unset($trace_results); } - + $this->Data[] = Array('profile_key' => $key, 'debug_type' => 'profiler'); } @@ -751,7 +751,7 @@ // don't print same report twice (in case if shutdown function used + compression + fatal error) return ''; } - + $this->profileFinish('script_runtime'); $this->breakOutofBuffering(); @@ -766,12 +766,12 @@ // defined here, because user can define this contant while script is running, not event before debugger is started $this->safeDefine('DBG_RAISE_ON_WARNINGS', 0); $this->safeDefine('DBG_TOOLBAR_BUTTONS', 1); - + $this->appendSession(); // show php session if any // ensure, that 1st line of debug output always is this one: $top_line = '
[Reload Frame] [Hide Debugger][Current Time: '.date('H:i:s').'] [File Size: #DBG_FILESIZE#]
'; - + $this->appendHTML($top_line); $this->moveToBegin(1); @@ -822,14 +822,14 @@ $this->appendHTML('Grand Total: '.' Mem: '.sprintf("%.4f Kb", ($totals['mem']+$totals_configs['mem'])/1024).' Time: '.sprintf("%.4f", $totals['time']+$totals_configs['time'])); } }*/ - + $is_ajax = isset($_GET['ajax']) && $_GET['ajax'] == 'yes'; $skip_reporting = $this->constOn('DBG_SKIP_REPORTING') || $this->constOn('DBG_ZEND_PRESENT'); - + if ($is_ajax || !$skip_reporting) { $debug_file = $this->tempFolder.'/debug_'.$this->rowSeparator.'.txt'; if (file_exists($debug_file)) unlink($debug_file); - + $i = 0; $fp = fopen($debug_file, 'a'); $lineCount = count($this->Data); @@ -839,13 +839,13 @@ } fclose($fp); } - + if ($skip_reporting) { // let debugger write report and then don't output anything $this->reportDone = true; return ''; } - + ob_start(); ?> @@ -946,7 +946,7 @@ break; } } - + return '
'.$ret.'
'; } @@ -996,7 +996,7 @@ die( $this->breakOutofBuffering(false) . $this->printReport(true) ); } } - + function breakOutofBuffering($flush = true) { $buffer_content = Array(); Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 6093) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 6428) @@ -364,7 +364,14 @@ { $object = &$event->getObject(); $top_prefix = $this->Application->GetTopmostPrefix($event->Prefix); - return $this->Application->GetVar($top_prefix.'_mode') == 't'; + + return ( + $this->Application->GetVar(rtrim($top_prefix.'_'.$event->Special, '_')) == 't' + || + $this->Application->GetVar(rtrim($top_prefix.'.'.$event->Special, '.')) == 't' + || + $this->Application->GetVar($top_prefix.'_mode') == 't' + ); } /** @@ -1480,8 +1487,17 @@ if(!$field_type) $field_type = 'string'; // default LIKE filter for all fields without type $filter_value = ''; - $table_name = ($filter_type == 'where') ? '`'.$object->TableName.'`.' : ''; + if (preg_match('/(.*)\.(.*)/', $search_field, $regs)) { + $table_name = '`'.$regs[1].'`.'; + $search_field = $regs[2]; + } + elseif ($filter_type == 'where') { + $table_name = '`'.$object->TableName.'`.'; + } + + $table_name = ($filter_type == 'where') ? $table_name : ''; + // get field clause by formatter name and/or parameters $formatter = getArrayValue($object->Fields[$search_field],'formatter'); switch($formatter) Index: trunk/tools/debug_sample.php =================================================================== diff -u -r4940 -r6428 --- trunk/tools/debug_sample.php (.../debug_sample.php) (revision 4940) +++ trunk/tools/debug_sample.php (.../debug_sample.php) (revision 6428) @@ -1,60 +1,72 @@ '0', ?? - $params = array_merge($params, array('pass'=>'m,'.$this->Prefix)); - $item_id = getArrayValue($params,$this->Prefix.'_id'); + $params = array_merge($params, Array('pass' => 'm,'.$this->Prefix) ); + + $item_id = isset($params[$id_prefix.'_id']) && $params[$id_prefix.'_id']; if (!$item_id) { - $item_id = $this->Application->GetVar($this->Prefix.'_id'); + $item_id = $this->Application->GetVar($this->getPrefixSpecial().'_id'); + if (!$item_id) { + $item_id = $this->Application->GetVar($this->Prefix.'_id'); + } } $params[$this->Prefix.'_id'] = $item_id; - $item =& $this->Application->recallObject($this->getPrefixSpecial()); - $params['m_cat_id'] = $item->GetDBField('CategoryId'); + $object =& $this->getObject($params); + $params['m_cat_id'] = $object->GetDBField('CategoryId'); + $params['pass_category'] = 1; - $main_processor =& $this->Application->recallObject('m_TagProcessor'); - return $main_processor->T($params); + return $this->Application->ProcessParsedTag('m', 't', $params); } /** Index: trunk/kernel/admin_templates/incs/form_blocks.tpl =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 6093) +++ trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 6428) @@ -119,7 +119,7 @@ "> error"> - *:
+ *:
', '', 'popups/translator');" title=""> Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/kernel/admin/include/toolbar/browse.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/core/units/categories/categories_tag_processor.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 6093) +++ trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 6428) @@ -190,6 +190,8 @@ } unset($params['cat_id']); + $params['pass_category'] = 1; + $main_processor =& $this->Application->recallObject('m_TagProcessor'); return $main_processor->T($params); } Index: trunk/kernel/include/modules.php =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/include/modules.php (.../modules.php) (revision 6093) +++ trunk/kernel/include/modules.php (.../modules.php) (revision 6428) @@ -4,9 +4,13 @@ */ $ado =& GetADODBConnection(); -$session_cookie_name = $ado->GetOne('SELECT VariableValue FROM '.$g_TablePrefix.'ConfigurationValues WHERE VariableName = "SessionCookieName"'); -define('SESSION_COOKIE_NAME', $session_cookie_name ? $session_cookie_name : 'sid'); +$application =& kApplication::Instance(); +define('SESSION_COOKIE_NAME', $application->Session->CookieName); + +/*$session_cookie_name = $ado->GetOne('SELECT VariableValue FROM '.$g_TablePrefix.'ConfigurationValues WHERE VariableName = "SessionCookieName"'); +define('SESSION_COOKIE_NAME', $session_cookie_name ? $session_cookie_name : 'sid'); +*/ set_cookie('cookies_on', '1', adodb_mktime() + 31104000); // if branches that uses if($mod_prefix) or like that will never be executed @@ -222,6 +226,15 @@ if ( substr($t, 0, strlen('kernel4:') ) == 'kernel4:' ) $t = substr($t, strlen('kernel4:') ); $url_params = Array('t' => $t); + // sicne 1.3.0 the category is not passed by default when mod_rewrite is on + // enable pass category for module templates (they usually need it) and suggest_cat. + // platform templates usually do not need category + if ( + preg_match('/^inlink|^inbulletin|^innews/', $t) || + in_array(preg_replace('/\.tpl$/', '', $t), array('suggest_cat')) + ) { + $url_params['pass_category'] = 1; + } $app =& kApplication::Instance(); $app->SetVar('prefixes_passed', Array() ); @@ -339,72 +352,72 @@ function admin_login() { - global $objSession,$login_error, $objConfig,$g_Allow,$g_Deny; -// echo "
"; print_r($objSession); echo "
"; + global $objSession,$login_error, $objConfig,$g_Allow,$g_Deny; + // echo "
"; print_r($objSession); echo "
"; if( GetVar('help_usage') == 'install' ) return true; - $env_arr = explode('-', $_GET['env']); - $get_session_key = $env_arr[0]; - $admin_login = isset($_POST['adminlogin']) && $_POST['adminlogin']; - if(!$objSession->ValidSession() || ($objSession->GetSessionKey() != $get_session_key && !$admin_login)) { - if( isset($_GET['expired']) && ($_GET['expired'] == 1) ) - $login_error = admin_language("la_text_sess_expired"); + $env_arr = explode('-', $_GET['env']); + $get_session_key = $env_arr[0]; + $admin_login = isset($_POST['adminlogin']) && $_POST['adminlogin']; + if(!$objSession->ValidSession()) { // || ($objSession->GetSessionKey() != $get_session_key && !$admin_login) + if( isset($_GET['expired']) && ($_GET['expired'] == 1) ) + $login_error = admin_language("la_text_sess_expired"); - return FALSE; - //echo "Expired
"; - } + return FALSE; + //echo "Expired
"; + } if ($objSession->HasSystemPermission("ADMIN") == 1) - return TRUE; + return TRUE; - if(count($_POST)==0 || $_POST["adminlogin"]!=1) - return FALSE; - $login=$_POST["login"]; - $password = $_POST["password"]; + if(count($_POST)==0 || $_POST["adminlogin"]!=1) + return FALSE; + $login=$_POST["login"]; + $password = $_POST["password"]; - if (strlen($login) && strlen($password)) - { - if(!_IpAccess($_SERVER['REMOTE_ADDR'],$g_Allow,$g_Deny)) - { - $login_error = admin_language("la_text_address_denied"); - return FALSE; - } - $valid = $objSession->Login($login, md5($password)); - $hasperm = ($objSession->HasSystemPermission("ADMIN") == 1); - if (($login=="root" || $hasperm) && $valid) - { - if(_ValidateModules()) - { - return TRUE; - } - else - $login_error = "Missing or invalid In-Portal License"; - } - else - { - if(!$hasperm && $valid) - { - $login_error = admin_language("la_text_nopermissions"); - } - else - { - $login_error = admin_language("la_Text_Access_Denied"); - } - return FALSE; - } + if (strlen($login) && strlen($password)) + { + if(!_IpAccess($_SERVER['REMOTE_ADDR'],$g_Allow,$g_Deny)) + { + $login_error = admin_language("la_text_address_denied"); + return FALSE; + } + $valid = $objSession->Login($login, md5($password)); + $hasperm = ($objSession->HasSystemPermission("ADMIN") == 1); + if (($login=="root" || $hasperm) && $valid) + { + if(_ValidateModules()) + { + return TRUE; + } + else + $login_error = "Missing or invalid In-Portal License"; + } + else + { + if(!$hasperm && $valid) + { + $login_error = admin_language("la_text_nopermissions"); + } + else + { + $login_error = admin_language("la_Text_Access_Denied"); + } + return FALSE; + } } - else - { - if(!strlen($login)) - { - $login_error = admin_language("la_Text_Missing_Username"); - } - else - if(!strlen($password)) - $login_error = admin_language("la_Text_Missing_Password"); - return FALSE; - } + else + { + if(!strlen($login)) + { + $login_error = admin_language("la_Text_Missing_Username"); + } + else + if(!strlen($password)) + $login_error = admin_language("la_Text_Missing_Password"); + return FALSE; + } } @@ -813,8 +826,12 @@ $SessionQueryString = false; // by default assume, that SID is located in cookie if( !isset($FrontEnd) ) $FrontEnd = false; // if frontend not explicitly defined, than -if($FrontEnd != 1) + $SessionQueryString = $application->Session->NeedQueryString(); + + +/*if($FrontEnd != 1) { $SessionQueryString = true; +}*/ if (is_array($mod_prefix)) { ParseEnv(); @@ -834,26 +851,26 @@ if ( !isset($var_list['sid']) ) $var_list['sid'] = ''; if ( !isset($_GET['env']) ) $_GET['env'] = ''; -if(strlen($var_list["sid"])==0 && strlen($_GET["env"])>0 && $objConfig->Get("CookieSessions")==2) +if(strlen($var_list["sid"])==0 && strlen($_GET["env"])>0 && $objConfig->Get("CookieSessions")==smCOOKIES_ONLY) { - if(_IsSpider($_SERVER["HTTP_USER_AGENT"])) - { - $UseSession = FALSE; - } - else - { - /* switch user to GET session var */ - if (!$_COOKIE[SESSION_COOKIE_NAME]) { - $SessionQueryString = TRUE; - } - //else { - //$cg = '--code--'; - //} - $UseSession = TRUE; - } + if(_IsSpider($_SERVER["HTTP_USER_AGENT"])) + { + $UseSession = FALSE; + } + else + { + /* switch user to GET session var */ + if (!$_COOKIE[SESSION_COOKIE_NAME]) { + $SessionQueryString = TRUE; + } + //else { + //$cg = '--code--'; + //} + $UseSession = TRUE; + } } else { - $UseSession = TRUE; + $UseSession = TRUE; } if($var_list["sid"]=="_") @@ -864,7 +881,7 @@ if($Action == 'm_logout') { - $u = new clsUserSession($var_list['sid'] ,($SessionQueryString && $FrontEnd==1)); + $u = new clsUserSession($var_list['sid']); // ,($SessionQueryString && $FrontEnd==1) $application =& kApplication::Instance(); $application->HandleEvent( new kEvent('u:OnInpLogout') ); @@ -888,13 +905,13 @@ $HTTP_REFERER = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; -if ( ($CookieTest == 1) /*|| !strstr($HTTP_REFERER, $_SERVER['HTTP_HOST'].$objConfig->Get("Site_Path"))*/) { +/*if ( ($CookieTest == 1) ) { // || !strstr($HTTP_REFERER, $_SERVER['HTTP_HOST'].$objConfig->Get("Site_Path")) $SessionQueryString = FALSE; } if ($FrontEnd != 1) { $SessionQueryString = TRUE; -} +}*/ // SID detecting engine: end @@ -914,7 +931,7 @@ $objSession->SetThemeName($m_var_list["theme"]); if($objConfig->Get("CookieSessions")>0 && !$SessionQueryString && !headers_sent()) { - set_cookie(SESSION_COOKIE_NAME, $var_list['sid'], 0); +// set_cookie(SESSION_COOKIE_NAME, $var_list['sid'], 0); } //echo "New Session: ".$objSession->GetSessionKey()."
\n"; if(isset($_COOKIE["login"]) && $Action != "m_logout" && $FrontEnd==1) Index: trunk/kernel/admin_templates/incs/config_blocks.tpl =================================================================== diff -u -r5037 -r6428 --- trunk/kernel/admin_templates/incs/config_blocks.tpl (.../config_blocks.tpl) (revision 5037) +++ trunk/kernel/admin_templates/incs/config_blocks.tpl (.../config_blocks.tpl) (revision 6428) @@ -1,5 +1,5 @@ - " name="" value="" /> + " name="" value="" /> @@ -32,7 +32,7 @@ - + Index: trunk/core/kernel/session/session.php =================================================================== diff -u -r5219 -r6428 --- trunk/core/kernel/session/session.php (.../session.php) (revision 5219) +++ trunk/core/kernel/session/session.php (.../session.php) (revision 6428) @@ -412,13 +412,7 @@ function CheckIfCookiesAreOn() { // $this->CheckDuplicateCookies(); - if ($this->Mode == smGET_ONLY || - ( defined('INPORTAL_ENV') && - INPORTAL_ENV && - $this->Application->IsAdmin() - && - !$this->Application->GetVar('front')) - ) + if ($this->Mode == smGET_ONLY) { //we don't need to bother checking if we would not use it $this->CookiesEnabled = false; @@ -529,9 +523,6 @@ } } - if ($this->Application->GetVar('front')) { - $this->CookiesEnabled = false; - } $this->CachedSID = $sid; return $this->CachedSID; @@ -698,6 +689,7 @@ $last_env = $this->Application->BuildEnv($t, Array('m_opener' => 'u', '__URLENCODE__' => 1), 'all'); $last_template = basename($_SERVER['PHP_SELF']).'|'.substr($last_env, strlen(ENV_VAR_NAME) + 1); $this->StoreVar('last_template', $last_template); + $this->StoreVar('last_url', $_SERVER['REQUEST_URI']); $this->StoreVar('last_env', substr($this->Application->BuildEnv($t, Array('__URLENCODE__' => 1), 'all'), strlen(ENV_VAR_NAME)+1)); } Index: trunk/core/kernel/db/db_tag_processor.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 6093) +++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 6428) @@ -570,7 +570,10 @@ if( !$this->HasParam($params, 'no_special') ) $value = htmlspecialchars($value); if( getArrayValue($params,'checked' ) ) $value = ($value == ( isset($params['value']) ? $params['value'] : 1)) ? 'checked' : ''; - if( getArrayValue($params,'as_label') ) $value = $this->Application->Phrase($value); + if( isset($params['plus_or_as_label']) ) { + $value = substr($value, 0,1) == '+' ? substr($value, 1) : $this->Application->Phrase($value); + } + elseif( getArrayValue($params,'as_label') ) $value = $this->Application->Phrase($value); $first_chars = $this->SelectParam($params,'first_chars,cut_first'); if($first_chars) @@ -668,6 +671,13 @@ $field = $params['field']; $object =& $this->getObject($params);; + $formatter_class = getArrayValue($object->Fields, $field, 'formatter'); + if ($formatter_class == 'kMultiLanguage') + { + $formatter =& $this->Application->recallObject($formatter_class); + $field = $formatter->LangFieldName($field); + } + $options = $object->GetFieldOptions($field); return getArrayValue($options,'required'); } @@ -1252,6 +1262,7 @@ break; default: + return $object->GetField($info_type); break; } } @@ -1557,7 +1568,7 @@ function DisplayOriginal($params) { return false; - } + } function MultipleEditing($params) { @@ -1572,9 +1583,10 @@ $ret .= $this->Application->ParseBlock($params); } } - + return $ret; } + } ?> \ No newline at end of file Index: trunk/core/units/general/helpers/mod_rewrite_helper.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 6093) +++ trunk/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 6428) @@ -34,7 +34,7 @@ $res = true; } - $this->Application->VerifyLanguageId(); +// $this->Application->VerifyLanguageId(); if (!$res) { array_unshift($url_parts, $url_part); } @@ -54,7 +54,7 @@ $vars['m_theme'] = $theme_id; $res = true; } - $this->Application->VerifyThemeId(); // verify anyway - will set default if not found!!! +// $this->Application->VerifyThemeId(); // verify anyway - will set default if not found!!! if (!$res) { array_unshift($url_parts, $url_part); } @@ -98,6 +98,20 @@ return $res; } + function ProcessPage(&$url_parts, &$vars) + { + if (!is_numeric($url_parts[0]) || count($url_parts) > 1) return false; + + // set module pages for all modules, since we don't know which module will need it + foreach ($this->Application->ModuleInfo as $module_name => $module_data) + { + $vars[ $module_data['Var'].'_id'] = 0; + $vars[ $module_data['Var'].'_Page'] = $url_parts[0]; + $vars[ $module_data['Var'].'_Reviews_Page'] = 0; + } + return true; + } + function ProcessModuleIndex(&$url_parts, &$vars) { if ( count($url_parts) > 1) return false; // if no more parts or only 1 part left @@ -107,14 +121,7 @@ if( $url_parts ) { // if parts are left, it can only be module page if (!is_numeric($url_parts[0])) return false; - - // set module pages for all modules, since we don't know which module will need it - foreach ($this->Application->ModuleInfo as $module_name => $module_data) - { - $vars[ $module_data['Var'].'_id'] = 0; - $vars[ $module_data['Var'].'_Page'] = $url_parts[0]; - $vars[ $module_data['Var'].'_Reviews_Page'] = 0; - } + $this->ProcessPage($url_parts, $vars); } // try to find CMS index page of the category @@ -279,7 +286,7 @@ */ function ProcessVirtualTemplate(&$url_parts, &$vars) { - if (!isset($url_parts[0]) || !$this->Application->isModuleEnabled('In-CMS')) return false; + if (!isset($url_parts[0]) || !$this->Application->isModuleEnabled('In-Edit')) return false; $template_path = implode('/', $url_parts); $sql = 'SELECT p.PageId, ci.CategoryId FROM '.TABLE_PREFIX.'Pages AS p @@ -326,15 +333,15 @@ { $this->HTTPQuery->Set($name,$value); } - if ($restored) { +// if ($restored) { $this->InitAll(); - } +// } $this->HTTPQuery->finalizeParsing($passed); } function InitAll() { - $this->Application->Phrases = new PhrasesCache(); +// $this->Application->Phrases = new PhrasesCache(); $this->Application->VerifyLanguageId(); $this->Application->Phrases->Init('phrases'); $this->Application->VerifyThemeId(); @@ -380,8 +387,6 @@ $this->ProcessCategory($url_parts, $vars); - - if ( $this->ProcessModuleIndex($url_parts, $vars) ) { foreach ($this->Application->ModuleInfo as $module_name => $info) { $passed[] = $info['Var']; @@ -423,11 +428,25 @@ } } + if ( $this->ProcessPage($url_parts, $vars) ) { + return $vars; + } + if ( $module_prefix = $this->ProcessModuleItem($url_parts, $vars, false) ) { $passed[] = $module_prefix; return $vars; } + if ( $this->Application->isModuleEnabled('In-Edit') && $this->Application->GetVar('admin') == 1) { + $adm_ses =& $this->Application->recallObject('Session.admin'); + $user = $adm_ses->RecallVar('user_id'); + $perm_helper =& $this->Application->recallObject('PermissionsHelper'); + if ($perm_helper->CheckUserPermission($user, 'PAGE.ADD', 0)) { + $vars['t'] = implode('/', $url_parts); + return $vars; + } + } + $not_found = $this->Application->ConfigValue('ErrorTemplate'); $vars['t'] = $not_found ? $not_found : 'error_notfound'; Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/kernel/admin/include/toolbar/advanced_view.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/admin/install/upgrades/readme_1_3_0.txt =================================================================== diff -u --- trunk/admin/install/upgrades/readme_1_3_0.txt (revision 0) +++ trunk/admin/install/upgrades/readme_1_3_0.txt (revision 6428) @@ -0,0 +1,4 @@ +Readme notes for In-Portal 1.3.0 +Intechnic Corporation, Sep 26, 2006 + +This release is a maintenance release to support the newly released In-edit module. \ No newline at end of file Index: trunk/core/units/users/users_event_handler.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6093) +++ trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6428) @@ -121,7 +121,9 @@ if ($this->Application->IsAdmin() && ($login_value == 'root')) { // logging in "root" (admin only) $root_password = $this->Application->ConfigValue('RootPass'); - if ($root_password != md5($password)) { + $password_formatter =& $this->Application->recallObject('kPasswordFormatter'); + $test = $password_formatter->EncryptPassword($password, 'b38'); + if ($root_password != $test) { $object->SetError('ValidateLogin', 'invalid_password', 'lu_invalid_password'); $event->status = erFAIL; return false; Index: trunk/core/units/admin/admin_config.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/units/admin/admin_config.php (.../admin_config.php) (revision 6093) +++ trunk/core/units/admin/admin_config.php (.../admin_config.php) (revision 6428) @@ -124,16 +124,6 @@ 'type' => stTREE, ), - /*'in-portal:service' => Array( - 'parent' => 'in-portal:tools', - 'icon' => 'conf_general', - 'label' => 'la_tab_Service', - 'url' => Array('t' => 'tools/system_tools', 'pass' => 'm'), - 'permissions' => Array('view'), - 'priority' => 10, - 'type' => stTREE, - ),*/ - 'in-portal:backup' => Array( 'parent' => 'in-portal:tools', 'icon' => 'tool_backup', @@ -198,4 +188,18 @@ ); + + $application =& kApplication::Instance(); + if ($application->isDebugMode()) { + $config['Sections']['in-portal:service'] = Array( + 'parent' => 'in-portal:tools', + 'icon' => 'conf_general', + 'label' => 'la_tab_Service', + 'url' => Array('t' => 'tools/system_tools', 'pass' => 'm'), + 'permissions' => Array('view'), + 'priority' => 10, + 'type' => stTREE, + ); + } + ?> \ No newline at end of file Index: trunk/kernel/admin_templates/regional/phrases_edit.tpl =================================================================== diff -u -r5979 -r6428 --- trunk/kernel/admin_templates/regional/phrases_edit.tpl (.../phrases_edit.tpl) (revision 5979) +++ trunk/kernel/admin_templates/regional/phrases_edit.tpl (.../phrases_edit.tpl) (revision 6428) @@ -21,7 +21,7 @@ submit_event('phrases','OnCancel'); } ) ); - + a_toolbar.Render(); @@ -33,25 +33,24 @@ "> - - - - - - - - - - - + + + + + + + + + + + - - + + -
+ - \ No newline at end of file Index: trunk/kernel/units/general/helpers/permissions_helper.php =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6093) +++ trunk/kernel/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6428) @@ -305,6 +305,7 @@ if (!$this->Application->LoggedIn()) { $redirect_template = $params['login_template']; + if (!$redirect_template && $this->Application->IsAdmin()) $redirect_template = 'login'; $redirect_params = Array('next_template' => $t); } else { @@ -335,7 +336,13 @@ */ function CheckPermission($name, $type = 1, $cat_id = null) { - if ($this->Application->GetVar('u_id') == -1) { + $user_id = $this->Application->GetVar('u_id'); + return $this->CheckUserPermission($user_id, $name, $type, $cat_id); + } + + function CheckUserPermission($user_id, $name, $type = 1, $cat_id = null) + { + if ($user_id == -1) { // "root" is allowed anywhere return $name == 'SYSTEM_ACCESS.READONLY' ? 0 : 1; } @@ -371,7 +378,16 @@ WHERE (PermId = '.$perm_id.') AND (CategoryId = '.$cat_id.')'; $view_filters = Array(); - $groups = explode(',', $this->Application->RecallVar('UserGroups')); + if ($user_id == $this->Application->GetVar('u_id')) { + $groups = explode(',', $this->Application->RecallVar('UserGroups')); + } + else { // checking not current user + $sql = 'SELECT GroupId FROM '.TABLE_PREFIX.'UserGroup + WHERE (PortalUserId = '.$user_id.') AND + ( (MembershipExpires IS NULL) OR ( MembershipExpires >= UNIX_TIMESTAMP() ) )'; + $groups = $this->Conn->GetCol($sql); + array_push($groups, $this->Application->ConfigValue('User_LoggedInGroup') ); + } foreach ($groups as $group) { $view_filters[] = 'FIND_IN_SET('.$group.', ACL)'; } Index: trunk/kernel/units/email_events/email_events_event_handler.php =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 6093) +++ trunk/kernel/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 6428) @@ -124,7 +124,7 @@ $message_object = &$this->Application->recallObject('emailmessages', null, Array('skip_autoload' => true)); $event_table = $this->Application->getUnitOption('emailevents', 'TableName'); - $event_object = &$event->getObject(); + $event_object =& $event->getObject( Array('skip_autoload' => true) ); $event_object->Load(array('Event'=>$email_event, 'Type'=>$email_event_type)); $event_id = $event_object->GetDBField('EventId'); @@ -165,7 +165,7 @@ $message_template = $message_object->GetDBField('Template')."\r\n".$footer; // add footer: end - $from_user_object = &$this->Application->recallObject('u.-email'.$from_user_id, null, Array('skip_autoload' => true)); + $from_user_object = &$this->Application->recallObject('u.email-from', null, Array('skip_autoload' => true)); $from_user_object->Load($from_user_id); // here if we don't have from_user loaded, it takes a default user from config values if ( $from_user_object->IsLoaded() ) { @@ -176,7 +176,7 @@ $from_user_email = $this->Application->ConfigValue('Smtp_AdminMailFrom'); } - $to_user_object = &$this->Application->recallObject('u.-email'.$to_user_id, null, Array('skip_autoload' => true)); + $to_user_object = &$this->Application->recallObject('u.email-to', null, Array('skip_autoload' => true)); $to_user_object->Load($to_user_id); $to_user_email = $to_user_object->GetDBField('Email'); $to_user_name = trim($to_user_object->GetDBField('FirstName').' '.$to_user_object->GetDBField('LastName')); @@ -263,6 +263,8 @@ $this->Conn->Query($sql); } + $this->Application->removeObject('u.email-from'); + $this->Application->removeObject('u.email-to'); return $event; } } Index: trunk/admin/help/manual.pdf =================================================================== diff -u -r6093 -r6428 Binary files differ Index: trunk/kernel/admin_templates/tools/system_tools.tpl =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/admin_templates/tools/system_tools.tpl (.../system_tools.tpl) (revision 6093) +++ trunk/kernel/admin_templates/tools/system_tools.tpl (.../system_tools.tpl) (revision 6428) @@ -6,43 +6,24 @@ - + "> - - - - - - "> - - - - + + - "> - - - - - - - "> - - - - - - +
- : + + :  
- : + + ]" value="Go">   
- : -  
- : -  
+ + + +
\ No newline at end of file Index: trunk/themes/default/common/head.tpl =================================================================== diff -u -r2946 -r6428 --- trunk/themes/default/common/head.tpl (.../head.tpl) (revision 2946) +++ trunk/themes/default/common/head.tpl (.../head.tpl) (revision 6428) @@ -140,7 +140,7 @@ { d.style.color = highlight_color; } - } + } <inp:m_page_title /> @@ -150,7 +150,13 @@ + + + + + + Index: trunk/kernel/units/general/main_event_handler.php =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/units/general/main_event_handler.php (.../main_event_handler.php) (revision 6093) +++ trunk/kernel/units/general/main_event_handler.php (.../main_event_handler.php) (revision 6428) @@ -83,10 +83,14 @@ $ret .= $theme_name.'/'; } - if ($processed_params['m_cat_id'] > 0) { + if ($processed_params['m_cat_id'] > 0 && isset($url_params['pass_category']) && $url_params['pass_category']) { $ret .= $this->Application->getFilename('c', $processed_params['m_cat_id']).'/'; $url_params['category_processed'] = true; } + else { +// $url_params['no_category'] = 1; // for debugging + } + unset($url_params['pass_category']); // unset it just in case $force_page_adding = false; if (getArrayValue($url_params, 'reset')) Index: trunk/kernel/units/general/inp_ses_storage.php =================================================================== diff -u -r4758 -r6428 --- trunk/kernel/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 4758) +++ trunk/kernel/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 6428) @@ -7,18 +7,25 @@ $this->SessionTimeout = $this->Application->ConfigValue('SessionTimeout'); $path = (BASE_PATH == '') ? '/' : BASE_PATH; - if ( $this->Application->IsAdmin() ) $path = rtrim($path, '/').'/admin'; +// if ( $this->Application->IsAdmin() ) $path = rtrim($path, '/').'/admin'; $this->SetCookiePath($path); $cookie_name = $this->Application->ConfigValue('SessionCookieName'); - $this->SetCookieName($cookie_name ? $cookie_name : 'sid'); + if (!$cookie_name) $cookie_name = 'sid'; + if (($this->Application->IsAdmin() && $special !== 'front') || $special == 'admin' ) { // || $this->Application->GetVar('admin') == 1 + $cookie_name = 'adm_'.$cookie_name; + } + $this->SetCookieName($cookie_name); $this->SetCookieDomain(SERVER_NAME); - if( $this->Application->IsAdmin() ) + if( $this->Application->IsAdmin()) // && $this->Application->GetVar('admin') != 1 { $mode = constOn('IS_INSTALL') ? smCOOKIES_ONLY : smAUTO; } + /*elseif ($this->Application->IsAdmin() && $this->Application->GetVar('admin') == 1) { + $mode = smCOOKIES_ONLY; + }*/ else { $ses_mode = $this->Application->ConfigValue('CookieSessions'); Index: trunk/kernel/admin_templates/incs/script.js =================================================================== diff -u -r5494 -r6428 --- trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 5494) +++ trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 6428) @@ -310,13 +310,13 @@ function openSelector($prefix, $url, $dst_field, $window_size, $event) { var $kf = document.getElementById($form_name); - var $regex = new RegExp('(.*)\?env=' + document.getElementById('sid').value + '-(.*?):(m[^:]+)'); + var $regex = new RegExp('(.*)\?env=(' + document.getElementById('sid').value + ')?-(.*?):(m[^:]+)'); $regex = $regex.exec($url); - - var $t = $regex[2]; + + var $t = $regex[3]; var $window_name = 'select_'+$t.replace(/(\/|-)/g, '_'); - set_hidden_field('return_m', $regex[3]); - + set_hidden_field('return_m', $regex[4]); + if (!isset($window_size)) $window_size = '750x400'; $window_size = $window_size.split('x'); @@ -335,7 +335,7 @@ openwin('', $window_name, $window_size[0], $window_size[1]); $kf.action = $url; $kf.target = $window_name; - + submit_event($prefix, $event, $t); processHooks('openSelector', hAFTER); @@ -347,33 +347,33 @@ { var $kf = document.getElementById($form_name); var $window_name = 'select_'+t.replace(/(\/|-)/g, '_'); - var $regex = new RegExp('(.*)\?env=' + document.getElementById('sid').value + '-(.*?):(m[^:]+)'); - + var $regex = new RegExp('(.*)\?env=(' + document.getElementById('sid').value + ')?-(.*?):(m[^:]+)'); + $regex = $regex.exec($kf.action); - set_hidden_field('return_m', $regex[3]); + set_hidden_field('return_m', $regex[4]); var $prev_opener = get_hidden_field('m_opener'); if (!isset(multi_line)) multi_line = 0; openwin('', $window_name, 750, 400); set_hidden_field('return_template', $kf.elements['t'].value); // where should return after popup is done set_hidden_field('m_opener', 'p'); - + set_hidden_field('translator_wnd_name', $window_name); set_hidden_field('translator_field', field); set_hidden_field('translator_t', t); set_hidden_field('translator_prefixes', prefix); set_hidden_field('translator_multi_line', multi_line); $kf.target = $window_name; - + return $prev_opener; } function PreSaveAndOpenTranslator(prefix, field, t, multi_line) { var $prev_opener = InitTranslator(prefix, field, t, multi_line); - + var split_prefix = prefix.split(','); submit_event(split_prefix[0], 'OnPreSaveAndOpenTranslator'); - + set_hidden_field('m_opener', $prev_opener); } @@ -385,7 +385,7 @@ var split_prefix = prefix.split(','); submit_event(split_prefix[0],'OnPreSaveAndOpenTranslator'); - + set_hidden_field('m_opener', $prev_opener); } @@ -397,8 +397,8 @@ set_hidden_field('trans_field', field); set_hidden_field('events[trans]', 'OnLoad'); - var $regex = new RegExp('(.*)\?env=' + document.getElementById('sid').value + '-(.*?):(.*)'); - var $t = $regex.exec(url)[2]; + var $regex = new RegExp('(.*)\?env=(' + document.getElementById('sid').value + ')?-(.*?):(.*)'); + var $t = $regex.exec(url)[3]; $kf.target = wnd; submit_event(prefix,'',$t,url); } @@ -1019,7 +1019,7 @@ $dst_element.appendChild($new_element); return $new_element; } - + Math.sum = function($array) { var $i = 0; var $total = 0; @@ -1029,7 +1029,7 @@ } return $total; } - + Math.average = function($array) { return Math.sum($array) / $array.length; } Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/advanced_view.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/admin/install/langpacks/english.lang =================================================================== diff -u -r6093 -r6428 --- trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 6093) +++ trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 6428) @@ -225,6 +225,7 @@ VW5rbm93biBjYXRlZ29yeQ== SW5jb3JyZWN0IGRhdGUgZm9ybWF0LCBwbGVhc2UgdXNlICglcykgZXguICglcyk= SW5jb3JyZWN0IGRhdGEgZm9ybWF0LCBwbGVhc2UgdXNlICVz + SW52YWxpZCBGb3JtYXQ= RmllbGQgaXMgb3V0IG9mIHJhbmdl RmllbGQgaXMgcmVxdWlyZWQ= RmllbGQgdmFsdWUgbXVzdCBiZSB1bmlxdWU= @@ -1468,6 +1469,7 @@ UGFzc3dvcmQgZmllbGQ= UmFkaW8gYnV0dG9ucw== RHJvcCBkb3duIGZpZWxk + Q2hlY2tib3g= VGV4dCBmaWVsZA== VGV4dCBhcmVh VW5jaGFuZ2Vk Index: trunk/core/kernel/event_manager.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/kernel/event_manager.php (.../event_manager.php) (revision 6093) +++ trunk/core/kernel/event_manager.php (.../event_manager.php) (revision 6428) @@ -289,6 +289,11 @@ // should do redirect but to no_permissions template if ( ($event->status == erSUCCESS || $event->status == erPERM_FAIL) && ($event->redirect === true || strlen($event->redirect) > 0)) { + // we need to pass category if the action was submitted to self-template, with the category passed + // and it has not explicly set redirect template or pass_cateogry param + if ($event->redirect === true && !isset($event->redirect_params['pass_category']) && $this->Application->GetVar('m_cat_id')) { + $event->redirect_params['pass_category'] = 1; + } $this->Application->Redirect($event->redirect, $event->redirect_params, null, $event->redirect_script); } } @@ -309,7 +314,8 @@ case 'd': // "down/push" new template to opener stack, deeplevel++ if ($this->Application->GetVar('front')) { - array_push($opener_stack, '../'.$this->Application->RecallVar('last_template') ); + $front_session =& $this->Application->recallObject('Session.front'); + array_push($opener_stack, '../'.$front_session->RecallVar('last_template') ); } else { array_push($opener_stack, $this->Application->RecallVar('last_template') ); @@ -334,18 +340,18 @@ $this->Application->StoreVar('opener_stack', serialize($opener_stack)); } - + function openerStackPush($t, $params, $pass = 'all') { $opener_stack = $this->Application->RecallVar('opener_stack'); - $opener_stack = $opener_stack ? unserialize($opener_stack) : Array(); - + $opener_stack = $opener_stack ? unserialize($opener_stack) : Array(); + $redirect_params = array_merge_recursive2(Array('m_opener' => 'u', '__URLENCODE__' => 1), $params); $new_level = $this->Application->BuildEnv($t, $redirect_params, $pass, true); array_push($opener_stack, 'index.php|'.ltrim($new_level, ENV_VAR_NAME.'=') ); $this->Application->StoreVar('opener_stack', serialize($opener_stack)); } - + function registerHook($hookto_prefix, $hookto_special, $hookto_event, $mode, $do_prefix, $do_special, $do_event, $conditional) { if( !$this->Application->prefixRegistred($hookto_prefix) ) Index: trunk/core/units/general/helpers/permissions_helper.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6093) +++ trunk/core/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6428) @@ -305,6 +305,7 @@ if (!$this->Application->LoggedIn()) { $redirect_template = $params['login_template']; + if (!$redirect_template && $this->Application->IsAdmin()) $redirect_template = 'login'; $redirect_params = Array('next_template' => $t); } else { @@ -335,7 +336,13 @@ */ function CheckPermission($name, $type = 1, $cat_id = null) { - if ($this->Application->GetVar('u_id') == -1) { + $user_id = $this->Application->GetVar('u_id'); + return $this->CheckUserPermission($user_id, $name, $type, $cat_id); + } + + function CheckUserPermission($user_id, $name, $type = 1, $cat_id = null) + { + if ($user_id == -1) { // "root" is allowed anywhere return $name == 'SYSTEM_ACCESS.READONLY' ? 0 : 1; } @@ -371,7 +378,16 @@ WHERE (PermId = '.$perm_id.') AND (CategoryId = '.$cat_id.')'; $view_filters = Array(); - $groups = explode(',', $this->Application->RecallVar('UserGroups')); + if ($user_id == $this->Application->GetVar('u_id')) { + $groups = explode(',', $this->Application->RecallVar('UserGroups')); + } + else { // checking not current user + $sql = 'SELECT GroupId FROM '.TABLE_PREFIX.'UserGroup + WHERE (PortalUserId = '.$user_id.') AND + ( (MembershipExpires IS NULL) OR ( MembershipExpires >= UNIX_TIMESTAMP() ) )'; + $groups = $this->Conn->GetCol($sql); + array_push($groups, $this->Application->ConfigValue('User_LoggedInGroup') ); + } foreach ($groups as $group) { $view_filters[] = 'FIND_IN_SET('.$group.', ACL)'; } Index: trunk/themes/default/common/pagetop.tpl =================================================================== diff -u -r3723 -r6428 --- trunk/themes/default/common/pagetop.tpl (.../pagetop.tpl) (revision 3723) +++ trunk/themes/default/common/pagetop.tpl (.../pagetop.tpl) (revision 6428) @@ -1,3 +1,6 @@ + + + @@ -12,27 +15,27 @@
- + - +


- + - +
">
">">
">
">">


Index: trunk/admin/install/install_lib.php =================================================================== diff -u -r6093 -r6428 --- trunk/admin/install/install_lib.php (.../install_lib.php) (revision 6093) +++ trunk/admin/install/install_lib.php (.../install_lib.php) (revision 6428) @@ -925,8 +925,7 @@ $lang_path = FULL_PATH.'/'.$module_name.'/admin/install/langpacks'; $lang_xml->Parse($lang_path.'/english.lang', '|0|1|2|', ''); - $app->Redirect('', Array('pass' => 'all', 'admin' => 1, 'Refresh' => 1), '', 'modules/mod_status.php'); - + $app->Redirect('modules/modules_list', Array('pass' => 'all', 'admin' => 1, 'RefreshTree' => 1), '', 'index.php'); } /** Index: trunk/core/kernel/application.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/kernel/application.php (.../application.php) (revision 6093) +++ trunk/core/kernel/application.php (.../application.php) (revision 6428) @@ -201,7 +201,9 @@ { if($this->InitDone) return false; - ob_start(); // collect any output from method (other then tags) into buffer + if (!constOn('SKIP_OUT_COMPRESSION')) { + ob_start(); // collect any output from method (other then tags) into buffer + } if(defined('DEBUG_MODE') && $this->isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { $this->Debugger->appendMemoryUsage('Application before Init:'); @@ -646,7 +648,7 @@ $this->InitParser(); $t = $this->GetVar('t'); - if ($this->isModuleEnabled('In-CMS')) { + if ($this->isModuleEnabled('In-Edit')) { $cms_handler =& $this->recallObject('cms_EventHandler'); if (!$this->TemplatesCache->TemplateExists($t) && !$this->IsAdmin()) { $t = $cms_handler->GetDesignTemplate(); @@ -1106,6 +1108,7 @@ } else { + unset($params['pass_category']); // we don't need to pass it when mod_rewrite is off $env = $this->BuildEnv($t, $params, $pass, $pass_events); $ret = $this->BaseURL($prefix, $ssl).$index_file.'?'.$env.$map_link; } @@ -1223,6 +1226,7 @@ $env .= ':'.$this->BuildModuleEnv($pass_element, $params, $pass_events); } } + if (!$m_only) $params['pass_category'] = 1; $ret = $this->BuildModuleEnv_NEW('m', $params, $pass_events).$ret; $cat_processed = isset($params['category_processed']) && $params['category_processed']; if ($cat_processed) { @@ -1327,7 +1331,7 @@ $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) { @@ -1480,7 +1484,11 @@ } ob_end_flush(); - $this->Session->SaveData(); + // session expiration is called from session initialization, + // that's why $this->Session may be not defined here + if (is_object($this->Session)) { + $this->Session->SaveData(); + } exit; } @@ -2115,7 +2123,7 @@ */ function isModuleEnabled($module_name) { - return $this->findModule('Name', $module_name); + return $this->findModule('Name', $module_name) !== false; } Index: trunk/core/units/email_events/email_events_event_handler.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 6093) +++ trunk/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 6428) @@ -124,7 +124,7 @@ $message_object = &$this->Application->recallObject('emailmessages', null, Array('skip_autoload' => true)); $event_table = $this->Application->getUnitOption('emailevents', 'TableName'); - $event_object = &$event->getObject(); + $event_object =& $event->getObject( Array('skip_autoload' => true) ); $event_object->Load(array('Event'=>$email_event, 'Type'=>$email_event_type)); $event_id = $event_object->GetDBField('EventId'); @@ -165,7 +165,7 @@ $message_template = $message_object->GetDBField('Template')."\r\n".$footer; // add footer: end - $from_user_object = &$this->Application->recallObject('u.-email'.$from_user_id, null, Array('skip_autoload' => true)); + $from_user_object = &$this->Application->recallObject('u.email-from', null, Array('skip_autoload' => true)); $from_user_object->Load($from_user_id); // here if we don't have from_user loaded, it takes a default user from config values if ( $from_user_object->IsLoaded() ) { @@ -176,7 +176,7 @@ $from_user_email = $this->Application->ConfigValue('Smtp_AdminMailFrom'); } - $to_user_object = &$this->Application->recallObject('u.-email'.$to_user_id, null, Array('skip_autoload' => true)); + $to_user_object = &$this->Application->recallObject('u.email-to', null, Array('skip_autoload' => true)); $to_user_object->Load($to_user_id); $to_user_email = $to_user_object->GetDBField('Email'); $to_user_name = trim($to_user_object->GetDBField('FirstName').' '.$to_user_object->GetDBField('LastName')); @@ -263,6 +263,8 @@ $this->Conn->Query($sql); } + $this->Application->removeObject('u.email-from'); + $this->Application->removeObject('u.email-to'); return $event; } } Index: trunk/kernel/parser.php =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/parser.php (.../parser.php) (revision 6093) +++ trunk/kernel/parser.php (.../parser.php) (revision 6428) @@ -44,7 +44,14 @@ global $m_var_list, $m_var_list_update; $module_vars = Array( 'cat' => 'm_cat_id', 'p' => 'm_cat_page', 'lang' => 'm_lang', 'theme' => 'm_theme', 'opener' => 'm_opener'); + $pass_cat = 0; + if (isset($m_var_list_update['cat'])) { + $pass_cat = 1; + } $ret = GenerateModuleEnv_NEW('m', $module_vars); + if ($pass_cat) { + $ret['pass_category'] = 1; + } if( isset($GLOBALS['m_var_list_update']['cat']) ) unset($GLOBALS['m_var_list_update']['cat']); return $ret; } @@ -1254,6 +1261,14 @@ { global $objConfig, $objCatList; + $application =& kApplication::Instance(); + if ($application->isModuleEnabled('In-Edit')) { + $title = $application->ProcessTag('cms:PageInfo type="htmlhead_title"'); + if ($title && !preg_match('/^_Auto.*/', $title)) { + return $title; + } + } + $ret = strip_tags( $objConfig->Get('Site_Name') ); if(getArrayValue($attribs,'_fullpath') || getArrayValue($attribs,'_currentcategory')) { @@ -2933,6 +2948,14 @@ { global $objCatList, $objConfig; + $application =& kApplication::Instance(); + if ($application->isModuleEnabled('In-Edit')) { + $keywords = $application->ProcessTag('cms:PageInfo type="meta_keywords"'); + if ($keywords) { + return $keywords; + } + } + $keywords = ''; $catid = (int)getArrayValue($attribs, '_catid'); @@ -2960,26 +2983,34 @@ */ function m_meta_description($attribs = array()) { - global $objCatList, $objConfig; + global $objCatList, $objConfig; + $application =& kApplication::Instance(); + if ($application->isModuleEnabled('In-Edit')) { + $description = $application->ProcessTag('cms:PageInfo type="meta_description"'); + if ($description) { + return $description; + } + } + $description = ''; - $catid = (int)getArrayValue($attribs, '_catid'); - if (!$catid) - { + $catid = (int)getArrayValue($attribs, '_catid'); + if (!$catid) + { $catid = $objCatList->CurrentCategoryID(); - } + } - if ($catid) - { - $c = $objCatList->GetItem($catid); - $description = $c->Get('MetaDescription'); - } + if ($catid) + { + $c = $objCatList->GetItem($catid); + $description = $c->Get('MetaDescription'); + } - if (!$description) - { - $description = $objConfig->Get('Category_MetaDesc'); - } - return $description; + if (!$description) + { + $description = $objConfig->Get('Category_MetaDesc'); + } + return $description; } /* Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/admin/browse.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/incs/grid_blocks.tpl =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 6093) +++ trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 6428) @@ -170,7 +170,7 @@ - + Index: trunk/core/units/general/main_event_handler.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/units/general/main_event_handler.php (.../main_event_handler.php) (revision 6093) +++ trunk/core/units/general/main_event_handler.php (.../main_event_handler.php) (revision 6428) @@ -83,10 +83,14 @@ $ret .= $theme_name.'/'; } - if ($processed_params['m_cat_id'] > 0) { + if ($processed_params['m_cat_id'] > 0 && isset($url_params['pass_category']) && $url_params['pass_category']) { $ret .= $this->Application->getFilename('c', $processed_params['m_cat_id']).'/'; $url_params['category_processed'] = true; } + else { +// $url_params['no_category'] = 1; // for debugging + } + unset($url_params['pass_category']); // unset it just in case $force_page_adding = false; if (getArrayValue($url_params, 'reset')) Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/kernel/admin/advanced_view.php'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/kernel/admin/include/toolbar/editcategory_permissions.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/admin/install/inportal_data.sql =================================================================== diff -u -r6093 -r6428 --- trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 6093) +++ trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 6428) @@ -239,7 +239,7 @@ INSERT INTO ItemTypes VALUES (1, 'In-Portal', 'c', 'Category', 'Name', 'CreatedById', NULL, NULL, 'la_ItemTab_Categories', 1, 'admin/category/addcategory.php', 'clsCategory', 'Category'); INSERT INTO ItemTypes VALUES (6, 'In-Portal', 'u', 'PortalUser', 'Login', 'PortalUserId', NULL, NULL, '', 0, '', 'clsPortalUser', 'User'); -INSERT INTO Modules (Name, Path, Var, Version, Loaded, LoadOrder, TemplatePath, RootCat, BuildDate) VALUES ('In-Portal', 'kernel/', 'm', '1.2.1', 1, 0, '', 0, '1054738405'); +INSERT INTO Modules (Name, Path, Var, Version, Loaded, LoadOrder, TemplatePath, RootCat, BuildDate) VALUES ('In-Portal', 'kernel/', 'm', '1.3.0', 1, 0, '', 0, '1054738405'); INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.VIEW', 'lu_PermName_Category.View_desc', 'lu_PermName_Category.View_error', 'In-Portal'); INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.ADD', 'lu_PermName_Category.Add_desc', 'lu_PermName_Category.Add_error', 'In-Portal'); Index: trunk/kernel/units/configuration/configuration_event_handler.php =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 6093) +++ trunk/kernel/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 6428) @@ -49,7 +49,8 @@ $field_options['skip_empty'] = 1; $object->SetFieldOptions('VariableValue', $field_options); }else { - $object->SetDBField('VariableValue', md5($object->GetDBField('VariableValue'))); + $password_formatter =& $this->Application->recallObject('kPasswordFormatter'); + $object->SetDBField('VariableValue', $password_formatter->EncryptPassword($object->GetDBField('VariableValue'), 'b38')); } } @@ -171,7 +172,7 @@ $event->redirect_params = Array('opener' => 's', 'pass'=>'all,conf'); //stay! $event->redirect = false; }*/ - + /** * Process items from selector (selected_ids var, key - prefix, value - comma separated ids) * Index: trunk/core/units/general/inp_ses_storage.php =================================================================== diff -u -r4758 -r6428 --- trunk/core/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 4758) +++ trunk/core/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 6428) @@ -7,18 +7,25 @@ $this->SessionTimeout = $this->Application->ConfigValue('SessionTimeout'); $path = (BASE_PATH == '') ? '/' : BASE_PATH; - if ( $this->Application->IsAdmin() ) $path = rtrim($path, '/').'/admin'; +// if ( $this->Application->IsAdmin() ) $path = rtrim($path, '/').'/admin'; $this->SetCookiePath($path); $cookie_name = $this->Application->ConfigValue('SessionCookieName'); - $this->SetCookieName($cookie_name ? $cookie_name : 'sid'); + if (!$cookie_name) $cookie_name = 'sid'; + if (($this->Application->IsAdmin() && $special !== 'front') || $special == 'admin' ) { // || $this->Application->GetVar('admin') == 1 + $cookie_name = 'adm_'.$cookie_name; + } + $this->SetCookieName($cookie_name); $this->SetCookieDomain(SERVER_NAME); - if( $this->Application->IsAdmin() ) + if( $this->Application->IsAdmin()) // && $this->Application->GetVar('admin') != 1 { $mode = constOn('IS_INSTALL') ? smCOOKIES_ONLY : smAUTO; } + /*elseif ($this->Application->IsAdmin() && $this->Application->GetVar('admin') == 1) { + $mode = smCOOKIES_ONLY; + }*/ else { $ses_mode = $this->Application->ConfigValue('CookieSessions'); Index: trunk/kernel/include/emailmessage.php =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/include/emailmessage.php (.../emailmessage.php) (revision 6093) +++ trunk/kernel/include/emailmessage.php (.../emailmessage.php) (revision 6428) @@ -901,6 +901,8 @@ function SendMail($From, $FromName, $ToAddr, $ToName, $Subject, $Text, $Html, $charset, $SendEvent,$FileName="",$FileLoc="",$QueueOnly=0,$extra_headers = array()) { + $charset = GetRegionalOption('Charset'); + $HasFile = FALSE; $HasFile = (strlen($FileName)>0); $OB="----=_OuterBoundary_000".md5( uniqid (rand())); @@ -963,7 +965,7 @@ if(strlen($Html)>0) { $msg .= "--" . $boundary . "\n"; - $msg .= "Content-Type: text/html; charset=\"iso-8859-1\""."\n"; + $msg .= "Content-Type: text/html; charset=\"".$charset."\""."\n"; $msg .= "Content-Transfer-Encoding: 8bit"."\n"."\n"; $msg .= stripslashes($Html); $msg .= "\n"."\n"; Index: trunk/core/kernel/utility/formatters/password_formatter.php =================================================================== diff -u -r4758 -r6428 --- trunk/core/kernel/utility/formatters/password_formatter.php (.../password_formatter.php) (revision 4758) +++ trunk/core/kernel/utility/formatters/password_formatter.php (.../password_formatter.php) (revision 6428) @@ -59,6 +59,7 @@ { if( $object->GetDBField($password_field) != $this->EncryptPassword('') ) { + if ($options['encryption_method'] == 'plain') return $value; return $this->EncryptPassword($value); } else @@ -87,11 +88,14 @@ } } if($value == '') return $object->GetDBField($field_name); + + if ($options['encryption_method'] == 'plain') return $value; return $this->EncryptPassword($value); } - function EncryptPassword($value) + function EncryptPassword($value, $salt=null) { - return md5($value); + if (!isset($salt)) return md5($value); + return md5(md5($value).$salt); } } \ No newline at end of file Index: trunk/admin/install/upgrades/changelog_1_3_0.txt =================================================================== diff -u --- trunk/admin/install/upgrades/changelog_1_3_0.txt (revision 0) +++ trunk/admin/install/upgrades/changelog_1_3_0.txt (revision 6428) @@ -0,0 +1,82 @@ +File in-portal/index.php changed +File in-portal/admin/advanced_view.php is removed; release_1_2_1 revision 1.25 +File in-portal/admin/browse.php is removed; release_1_2_1 revision 1.35 +File in-portal/admin/install.php changed +File in-portal/admin/category/addcategory.php is removed; release_1_2_1 revision 1.20 +File in-portal/admin/category/addcategory_custom.php is removed; release_1_2_1 revision 1.14 +File in-portal/admin/category/addcategory_customfields.php is removed; release_1_2_1 revision 1.5 +File in-portal/admin/category/addcategory_images.php is removed; release_1_2_1 revision 1.9 +File in-portal/admin/category/addcategory_permissions.php is removed; release_1_2_1 revision 1.11 +File in-portal/admin/category/addcategory_relations.php is removed; release_1_2_1 revision 1.8 +File in-portal/admin/category/addimage.php is removed; release_1_2_1 revision 1.9 +File in-portal/admin/category/addpermission.php is removed; release_1_2_1 revision 1.9 +File in-portal/admin/category/addpermission_modules.php is removed; release_1_2_1 revision 1.10 +File in-portal/admin/category/addrelation.php is removed; release_1_2_1 revision 1.8 +File in-portal/admin/category/category_items.php is removed; release_1_2_1 revision 1.4 +File in-portal/admin/category/category_maint.php is removed; release_1_2_1 revision 1.23.32.1 +File in-portal/admin/category/permcacheupdate.php is removed; release_1_2_1 revision 1.10 +File in-portal/admin/category/images/ddarrow.gif is removed; release_1_2_1 revision 1.1 +File in-portal/admin/category/images/ddarrow_active.gif is removed; release_1_2_1 revision 1.1 +File in-portal/admin/category/images/ddarrow_over.gif is removed; release_1_2_1 revision 1.1 +File in-portal/admin/category/js/core.js is removed; release_1_2_1 revision 1.1 +File in-portal/admin/category/js/lang.js is removed; release_1_2_1 revision 1.1 +File in-portal/admin/category/js/main.js is removed; release_1_2_1 revision 1.1 +File in-portal/admin/help/manual.pdf changed +File in-portal/admin/install/inportal_data.sql changed +File in-portal/admin/install/inportal_remove.sql changed +File in-portal/admin/install/install_lib.php changed +File in-portal/admin/install/langpacks/english.lang changed +File in-portal/admin/install/upgrades/changelog_1_3_0.txt is new; release_1_3_0 revision 1.1.2.12 +File in-portal/admin/install/upgrades/inportal_upgrade_v1.3.0.sql is new; release_1_3_0 revision 1.1.2.1 +File in-portal/admin/install/upgrades/readme_1_3_0.txt is new; release_1_3_0 revision 1.1.2.2 +File in-portal/kernel/parser.php changed +File in-portal/kernel/admin/advanced_view.php is removed; release_1_2_1 revision 1.4 +File in-portal/kernel/admin/include/toolbar/advanced_view.php is removed; release_1_2_1 revision 1.11.2.1 +File in-portal/kernel/admin/include/toolbar/browse.php is removed; release_1_2_1 revision 1.17.2.1 +File in-portal/kernel/admin/include/toolbar/editcategory_permissions.php is removed; release_1_2_1 revision 1.1 +File in-portal/kernel/admin/include/toolbar/editcategory_relations.php is removed; release_1_2_1 revision 1.2 +File in-portal/kernel/admin/include/toolbar/editcategory_relationselect.php is removed; release_1_2_1 revision 1.6.2.1 +File in-portal/kernel/admin/include/toolbar/editgroup_permissions.php is removed; release_1_2_1 revision 1.1 +File in-portal/kernel/admin/include/toolbar/editgroup_users.php is removed; release_1_2_1 revision 1.1 +File in-portal/kernel/admin_templates/incs/config_blocks.tpl changed +File in-portal/kernel/admin_templates/incs/form_blocks.tpl changed +File in-portal/kernel/admin_templates/incs/grid_blocks.tpl changed +File in-portal/kernel/admin_templates/incs/script.js changed +File in-portal/kernel/admin_templates/regional/phrases_edit.tpl changed +File in-portal/kernel/admin_templates/tools/system_tools.tpl changed +File in-portal/kernel/include/emailmessage.php changed +File in-portal/kernel/include/image.php changed +File in-portal/kernel/include/modules.php changed +File in-portal/kernel/units/admin/admin_config.php changed +File in-portal/kernel/units/categories/categories_tag_processor.php changed +File in-portal/kernel/units/configuration/configuration_event_handler.php changed +File in-portal/kernel/units/email_events/email_events_event_handler.php changed +File in-portal/kernel/units/general/cat_event_handler.php changed +File in-portal/kernel/units/general/cat_tag_processor.php changed +File in-portal/kernel/units/general/inp_ses_storage.php changed +File in-portal/kernel/units/general/main_event_handler.php changed +File in-portal/kernel/units/general/helpers/mod_rewrite_helper.php changed +File in-portal/kernel/units/general/helpers/permissions_helper.php changed +File in-portal/kernel/units/users/users_event_handler.php changed +File in-portal/themes/default/search_results.tpl changed +File in-portal/themes/default/common/head.tpl changed +File in-portal/themes/default/common/pagetop.tpl changed +File kernel4_dev/kernel4/application.php changed +File kernel4_dev/kernel4/event_manager.php changed +File kernel4_dev/kernel4/startup.php changed +File kernel4_dev/kernel4/db/db_event_handler.php changed +File kernel4_dev/kernel4/db/db_tag_processor.php changed +File kernel4_dev/kernel4/db/dblist.php changed +File kernel4_dev/kernel4/parser/template_parser.php changed +File kernel4_dev/kernel4/processors/main_processor.php changed +File kernel4_dev/kernel4/session/session.php changed +File kernel4_dev/kernel4/utility/debugger.php changed +File kernel4_dev/kernel4/utility/email.php changed +File kernel4_dev/kernel4/utility/formatters/password_formatter.php changed +File cmseditor/fckeditor.js changed +File cmseditor/editor/filemanager/browser/default/connectors/php/commands.php changed + + +Changes in phrases and events: + + Index: trunk/themes/default/search_results.tpl =================================================================== diff -u -r1566 -r6428 --- trunk/themes/default/search_results.tpl (.../search_results.tpl) (revision 1566) +++ trunk/themes/default/search_results.tpl (.../search_results.tpl) (revision 6428) @@ -37,7 +37,7 @@ - + @@ -76,7 +76,7 @@

-
"> + "> " class="input" style="width: 235px;">  " class="button">
@@ -157,7 +157,7 @@
- + @@ -176,7 +176,7 @@
- + Index: trunk/kernel/include/image.php =================================================================== diff -u -r4645 -r6428 --- trunk/kernel/include/image.php (.../image.php) (revision 4645) +++ trunk/kernel/include/image.php (.../image.php) (revision 6428) @@ -905,8 +905,9 @@ function &GetAvatarImage($ResourceId) { - $sql = 'SELECT * FROM '.$this->SourceTable. - ' WHERE ResourceId='.$ResourceId.' AND Name="avatar" AND Enabled=1 + $sql = 'SELECT * + FROM '.$this->SourceTable.' + WHERE ResourceId = '.(int)$ResourceId.' AND Name = "avatar" AND Enabled = 1 LIMIT 1'; $rs = $this->adodbConnection->Execute($sql); if($rs && ! $rs->EOF) @@ -917,8 +918,9 @@ $img->Clean(); return $img; } - else - return FALSE; + else { + return false; + } } function HandleImageUpload($FILE,$ResourceId,$RelatedTo,$DestDir, $Name="",$AltName="",$IsThumb=0) Index: trunk/kernel/units/general/cat_event_handler.php =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6093) +++ trunk/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6428) @@ -376,8 +376,6 @@ $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; $i < sizeof($types_array); $i++) { @@ -681,10 +679,11 @@ $object =& $event->getObject(); $this->Application->SetVar($event->getPrefixSpecial().'_Page', 1); $lang = $this->Application->GetVar('m_lang'); - $product_table = $this->Application->getUnitOption('p', 'TableName'); + $items_table = $this->Application->getUnitOption($event->Prefix, 'TableName'); + $module_name = $this->Application->findModule('Var', $event->Prefix, 'Name'); $sql = ' SELECT * FROM '.$this->Application->getUnitOption('confs', 'TableName').' - WHERE ModuleName="In-Commerce" + WHERE ModuleName="'.$module_name.'" AND SimpleSearch=1'; $search_config = $this->Conn->Query($sql, 'FieldName'); $field_list = array_keys($search_config); @@ -699,7 +698,7 @@ $custom_fields = $this->Application->getUnitOption($event->Prefix, 'CustomFields'); if ($custom_fields) { $custom_table = $this->Application->getUnitOption($event->Prefix.'-cdata', 'TableName'); - $join_clauses[] = ' LEFT JOIN '.$custom_table.' custom_data ON '.$product_table.'.ResourceId = custom_data.ResourceId'; + $join_clauses[] = ' LEFT JOIN '.$custom_table.' custom_data ON '.$items_table.'.ResourceId = custom_data.ResourceId'; } // what field in search config becomes what field in sql (key - new field, value - old field (from searchconfig table)) @@ -740,17 +739,31 @@ } else { + $multi_lingual = false; + if ($exploded[0] == 'MULTI') + { + $multi_lingual = true; + $foreign_field = $exploded[1]; + } $exploded = explode('.', $foreign_field); // format: table.field_name $foreign_table = TABLE_PREFIX.$exploded[0]; $alias_counter++; $alias = 't'.$alias_counter; - $field_list[$key] = $alias.'.'.$exploded[1]; - $search_config_map[ $field_list[$key] ] = $field; + if ($multi_lingual) { + $field_list[$key] = $alias.'.'.'l'.$lang.'_'.$exploded[1]; + $field_list[$key.'_primary'] = 'l'.$this->Application->GetDefaultLanguageId().'_'.$field; + $search_config_map[ $field_list[$key] ] = $field; + $search_config_map[ $field_list[$key.'_primary'] ] = $field; + } + else { + $field_list[$key] = $alias.'.'.$exploded[1]; + $search_config_map[ $field_list[$key] ] = $field; + } $join_clause = str_replace('{ForeignTable}', $alias, $search_config[$field]['JoinClause']); - $join_clause = str_replace('{LocalTable}', $product_table, $join_clause); + $join_clause = str_replace('{LocalTable}', $items_table, $join_clause); $join_clauses[] = ' LEFT JOIN '.$foreign_table.' '.$alias.' ON '.$join_clause; @@ -771,20 +784,20 @@ $search_helper =& $this->Application->recallObject('SearchHelper'); $where_clause = $search_helper->buildWhereClause($keywords, $field_list); - $where_clause = $where_clause.' AND '.$product_table.'.Status=1'; + $where_clause = $where_clause.' AND '.$items_table.'.Status=1'; if($this->Application->GetVar('Action') == 'm_simple_subsearch') // subsearch, In-portal { if( $event->getEventParam('ResultIds') ) { - $where_clause .= ' AND '.$product_table.'.ResourceId IN ('.implode(',', $event->specificParams['ResultIds']).')'; + $where_clause .= ' AND '.$items_table.'.ResourceId IN ('.implode(',', $event->specificParams['ResultIds']).')'; } } if( $event->MasterEvent && $event->MasterEvent->Name == 'OnListBuild' ) // subsearch, k4 { if( $event->MasterEvent->getEventParam('ResultIds') ) { - $where_clause .= ' AND '.$product_table.'.ResourceId IN ('.implode(',', $event->MasterEvent->getEventParam('ResultIds')).')'; + $where_clause .= ' AND '.$items_table.'.ResourceId IN ('.implode(',', $event->MasterEvent->getEventParam('ResultIds')).')'; } } @@ -801,34 +814,45 @@ $revelance_parts[] = 'IF('.$field.' LIKE "%'.$keyword.'%", '.$weight.', 0)'; } } - $rel_keywords = $this->Application->ConfigValue('SearchRel_Keyword_products') / 100; - $rel_pop = $this->Application->ConfigValue('SearchRel_Pop_products') / 100; - $rel_rating = $this->Application->ConfigValue('SearchRel_Rating_products') / 100; + $conf_postfix = $this->Application->getUnitOption($event->Prefix, 'SearchConfigPostfix'); + $rel_keywords = $this->Application->ConfigValue('SearchRel_Keyword_'.$conf_postfix) / 100; + $rel_pop = $this->Application->ConfigValue('SearchRel_Pop_'.$conf_postfix) / 100; + $rel_rating = $this->Application->ConfigValue('SearchRel_Rating_'.$conf_postfix) / 100; $relevance_clause = '('.implode(' + ', $revelance_parts).') / '.$weight_sum.' * '.$rel_keywords; - $relevance_clause .= ' + (Hits + 1) / (MAX(Hits) + 1) * '.$rel_pop; - $relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating; + if ($rel_pop && isset($object->Fields['Hits'])) { + $relevance_clause .= ' + (Hits + 1) / (MAX(Hits) + 1) * '.$rel_pop; + } + if ($rel_rating && isset($object->Fields['CachedRating'])) { + $relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating; + } // building final search query - if (!$this->Application->GetVar('INPORTAL_ON')) { + if (!$this->Application->GetVar('do_not_drop_search_table') && !$this->Application->GetVar('INPORTAL_ON')) { $this->Conn->Query('DROP TABLE IF EXISTS '.$search_table); // erase old search table if clean k4 event + $this->Application->SetVar('do_not_drop_search_table', true); } - if ($this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"')) { + + $search_table_exists = $this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"'); + if ($search_table_exists) { $select_intro = 'INSERT INTO '.$search_table.' (Relevance, ItemId, ResourceId, ItemType, EdPick) '; } else { $select_intro = 'CREATE TABLE '.$search_table.' AS '; } + $edpick_clause = $this->Application->getUnitOption($event->Prefix.'.EditorsPick', 'Fields') ? $items_table.'.EditorsPick' : '0'; + + $sql = $select_intro.' SELECT '.$relevance_clause.' AS Relevance, - '.$product_table.'.ProductId AS ItemId, - '.$product_table.'.ResourceId, - 11 AS ItemType, - '.$product_table.'.EditorsPick AS EdPick + '.$items_table.'.'.$this->Application->getUnitOption($event->Prefix, 'IDField').' AS ItemId, + '.$items_table.'.ResourceId, + '.$this->Application->getUnitOption($event->Prefix, 'ItemType').' AS ItemType, + '.$edpick_clause.' AS EdPick FROM '.$object->TableName.' '.implode(' ', $join_clauses).' WHERE '.$where_clause.' - GROUP BY '.$product_table.'.ProductId'; + GROUP BY '.$items_table.'.'.$this->Application->getUnitOption($event->Prefix, 'IDField'); $res = $this->Conn->Query($sql); } @@ -1887,7 +1911,6 @@ } } } - } ?> \ No newline at end of file Index: trunk/index.php =================================================================== diff -u -r5547 -r6428 --- trunk/index.php (.../index.php) (revision 5547) +++ trunk/index.php (.../index.php) (revision 6428) @@ -15,9 +15,9 @@ //print_pre(get_included_files()); -function getmicrotime() -{ - list($usec, $sec) = explode(" ", microtime()); - return ((float)$usec + (float)$sec); -} +function getmicrotime() +{ + list($usec, $sec) = explode(" ", microtime()); + return ((float)$usec + (float)$sec); +} ?> \ No newline at end of file Index: trunk/admin/install/inportal_remove.sql =================================================================== diff -u -r4790 -r6428 --- trunk/admin/install/inportal_remove.sql (.../inportal_remove.sql) (revision 4790) +++ trunk/admin/install/inportal_remove.sql (.../inportal_remove.sql) (revision 6428) @@ -207,4 +207,10 @@ DROP TABLE TopicCustomData # -------------------------------------------------------- DROP TABLE ImportCache +# -------------------------------------------------------- +DROP TABLE FormFields +# -------------------------------------------------------- +DROP TABLE Forms +# -------------------------------------------------------- +DROP TABLE FormSubmissions # \ No newline at end of file Index: trunk/kernel/units/categories/categories_tag_processor.php =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 6093) +++ trunk/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 6428) @@ -190,6 +190,8 @@ } unset($params['cat_id']); + $params['pass_category'] = 1; + $main_processor =& $this->Application->recallObject('m_TagProcessor'); return $main_processor->T($params); } Index: trunk/kernel/units/general/cat_tag_processor.php =================================================================== diff -u -r6093 -r6428 --- trunk/kernel/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 6093) +++ trunk/kernel/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 6428) @@ -36,21 +36,31 @@ return isset($icons[$value]) ? $icons[$value] : $icons['default']; } - function ItemLink($params) + /** + * Allows to create valid mod-rewrite compatible link to module item + * + * @param Array $params + * @param string $id_prefix + * @return string + */ + function ItemLink($params, $id_prefix) { - // 'p_id'=>'0', ?? - $params = array_merge($params, array('pass'=>'m,'.$this->Prefix)); - $item_id = getArrayValue($params,$this->Prefix.'_id'); + $params = array_merge($params, Array('pass' => 'm,'.$this->Prefix) ); + + $item_id = isset($params[$id_prefix.'_id']) && $params[$id_prefix.'_id']; if (!$item_id) { - $item_id = $this->Application->GetVar($this->Prefix.'_id'); + $item_id = $this->Application->GetVar($this->getPrefixSpecial().'_id'); + if (!$item_id) { + $item_id = $this->Application->GetVar($this->Prefix.'_id'); + } } $params[$this->Prefix.'_id'] = $item_id; - $item =& $this->Application->recallObject($this->getPrefixSpecial()); - $params['m_cat_id'] = $item->GetDBField('CategoryId'); + $object =& $this->getObject($params); + $params['m_cat_id'] = $object->GetDBField('CategoryId'); + $params['pass_category'] = 1; - $main_processor =& $this->Application->recallObject('m_TagProcessor'); - return $main_processor->T($params); + return $this->Application->ProcessParsedTag('m', 't', $params); } /** Fisheye: Tag 6428 refers to a dead (removed) revision in file `trunk/kernel/admin/include/toolbar/editgroup_permissions.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/core/kernel/utility/email.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/kernel/utility/email.php (.../email.php) (revision 6093) +++ trunk/core/kernel/utility/email.php (.../email.php) (revision 6428) @@ -34,7 +34,10 @@ //$this->TextBoundary = uniqid(adodb_mktime()); $this->EmailBoundary = uniqid(adodb_mktime()); $this->LineFeed = "\n"; - $this->Charset='ISO-8859-1'; + + $lang =& $this->Application->recallObject('lang.current'); + $this->Charset = $lang->GetDBField('Charset') ? $lang->GetDBField('Charset') : 'ISO-8859-1'; + $this->TransferEncoding='8bit'; $this->Body = ''; $this->setHeader('Subject', 'Automatically generated message'); Index: trunk/core/kernel/processors/main_processor.php =================================================================== diff -u -r6093 -r6428 --- trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 6093) +++ trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 6428) @@ -121,7 +121,7 @@ function FormAction($params) { - return $this->Application->ProcessParsedTag('m', 't', array_merge($params, Array('pass'=>'all,m' )) ); + return $this->Application->ProcessParsedTag('m', 't', array_merge($params, Array('pass'=>'all,m', 'pass_category' => 1 )) ); } /*// NEEDS TEST @@ -375,6 +375,9 @@ else { $o .= "\n"; } + if ($this->Application->GetVar('admin') == 1) { + $o .= "\n"; + } return $o; } @@ -522,7 +525,7 @@ if (!$t) { trigger_error('Template name not specified in <inp2:m_include .../> tag', E_USER_ERROR); } - + $res = $BlockParser->ParseTemplate( $t, 1, $params, isset($params['is_silent']) ? 1 : 0 ); if ( !$BlockParser->DataExists && (isset($params['data_exists']) || isset($params['block_no_data'])) ) { @@ -895,11 +898,21 @@ function XMLTemplate($params) { - define('DBG_SKIP_REPORTING', 1); + safeDefine('DBG_SKIP_REPORTING', 1); $lang =& $this->Application->recallObject('lang.current'); header('Content-type: text/xml; charset='.$lang->GetDBField('Charset')); } + function Header($params) + { + header($params['data']); + } + + function NoDebug($params) + { + define('DBG_SKIP_REPORTING', 1); + } + function RootCategoryName($params) { $root_phrase = $this->Application->ConfigValue('Root_Name');