Index: branches/5.2.x/core/kernel/managers/url_manager.php =================================================================== diff -u -N -r14628 -r14653 --- branches/5.2.x/core/kernel/managers/url_manager.php (.../url_manager.php) (revision 14628) +++ branches/5.2.x/core/kernel/managers/url_manager.php (.../url_manager.php) (revision 14653) @@ -1,6 +1,6 @@ Application->recallObject('Session'); /* @var $session Session */ - + $ssl = isset($params['__SSL__']) ? $params['__SSL__'] : 0; $sid = $session->NeedQueryString() && !$this->Application->RewriteURLs($ssl) ? $this->Application->GetSID() : ''; // if (getArrayValue($params,'admin') == 1) $sid = $this->Application->GetSID(); @@ -536,7 +536,7 @@ if ( $this->Application->getUnitOption($prefix, 'PortalStyleEnv') == true ) { $ret = preg_replace('/^([a-zA-Z]+)-([0-9]+)-(.*)/', '\\1\\2-\\3', $ret); } - + return $ret; } @@ -624,12 +624,31 @@ return trim(preg_replace('/'.preg_quote($cut_prefix, '/').'(.*)/', '\\1', $_SERVER['PHP_SELF']), '/'); } - function getPhysicalTemplate($template) + /** + * Returns theme template filename and it's corresponding page_id based on given seo template + * + * @param string $seo_template + * @return string + * @access public + */ + public function getPhysicalTemplate($seo_template) { - return array_search($template, $this->structureTemplateMapping); + return array_search($seo_template, $this->structureTemplateMapping); } /** + * Returns template name, that corresponds with given virtual (not physical) page id + * + * @param int $page_id + * @return string|bool + * @access public + */ + public function getVirtualPageTemplate($page_id) + { + return isset($this->structureTemplateMapping['id:' . $page_id]) ? $this->structureTemplateMapping['id:' . $page_id] : false; + } + + /** * Loads template mapping for Front-End * */ Index: branches/5.2.x/core/kernel/application.php =================================================================== diff -u -N -r14628 -r14653 --- branches/5.2.x/core/kernel/application.php (.../application.php) (revision 14628) +++ branches/5.2.x/core/kernel/application.php (.../application.php) (revision 14653) @@ -1,6 +1,6 @@ UrlManager->HREF($t, $prefix, $params, $index_file); } - function getPhysicalTemplate($template) + /** + * Returns theme template filename and it's corresponding page_id based on given seo template + * + * @param string $seo_template + * @return string + * @access public + */ + public function getPhysicalTemplate($seo_template) { - return $this->UrlManager->getPhysicalTemplate($template); + return $this->UrlManager->getPhysicalTemplate($seo_template); } /** - * Returns variables with values that should be passed throught with this link + variable list + * Returns template name, that corresponds with given virtual (not physical) page id * + * @param int $page_id + * @return string|bool + * @access public + */ + public function getVirtualPageTemplate($page_id) + { + return $this->UrlManager->getVirtualPageTemplate($page_id); + } + + /** + * Returns variables with values that should be passed through with this link + variable list + * * @param Array $params * @return Array */ Index: branches/5.2.x/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r14628 -r14653 --- branches/5.2.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 14628) +++ branches/5.2.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 14653) @@ -1,6 +1,6 @@ Application->recallObject($this->getPrefixSpecial(), $this->Prefix.'_List'); /* @var $cat_object kDBList */ - + $sql = 'SELECT '.$this->getTitleField().' FROM '.$cat_object->TableName.' WHERE CategoryId = '.(int)$this->Application->GetVar('m_cat_id'); @@ -216,7 +216,7 @@ { $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); /* @var $ml_formatter kMultiLanguage */ - + return $ml_formatter->LangFieldName('Name'); } @@ -257,28 +257,28 @@ { $category_id = getArrayValue($params, 'cat_id'); - if ($category_id === false) { + if ( $category_id === false ) { $category_id = $this->Application->GetVar($this->getPrefixSpecial() . '_id'); } - if ("$category_id" == 'Root') { + if ( "$category_id" == 'Root' ) { $category_id = $this->Application->findModule('Name', $params['module'], 'RootCat'); } - elseif ("$category_id" == 'current') { + elseif ( "$category_id" == 'current' ) { $category_id = $this->Application->GetVar('m_cat_id'); } - if (!array_key_exists('direct_link', $params) || !$params['direct_link']) { - $category_id = $this->getCategorySymLink( (int)$category_id ); + if ( !array_key_exists('direct_link', $params) || !$params['direct_link'] ) { + $category_id = $this->getCategorySymLink((int)$category_id); } else { unset($params['direct_link']); } - $physical_template = $this->Application->getPhysicalTemplate('id:' . $category_id); + $virtual_template = $this->Application->getVirtualPageTemplate($category_id); - if ( ($physical_template !== false) && preg_match('/external:(.*)/', $physical_template, $rets) ) { - // external url + if ( ($virtual_template !== false) && preg_match('/external:(.*)/', $virtual_template, $rets) ) { + // external url (return here, instead of always replacing $params['t'] for kApplication::HREF to find it) return $rets[1]; } @@ -607,7 +607,7 @@ { $object =& $this->getObject($params); /* @var $object CategoriesItem */ - + return $object->IsRoot(); } Index: branches/5.2.x/core/kernel/db/dbitem.php =================================================================== diff -u -N -r14608 -r14653 --- branches/5.2.x/core/kernel/db/dbitem.php (.../dbitem.php) (revision 14608) +++ branches/5.2.x/core/kernel/db/dbitem.php (.../dbitem.php) (revision 14653) @@ -1,6 +1,6 @@ Prefix . '-cdata.' . $this->Special, '.'); - $cdata =& $this->Application->recallObject($cdata_key, null, Array ('skip_autoload' => true, 'populate_ml_fields' => true)); + $cdata =& $this->Application->recallObject($cdata_key, null, Array ('skip_autoload' => true)); /* @var $cdata kDBItem */ $resource_id = $this->GetDBField('ResourceId'); @@ -1375,9 +1375,22 @@ $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); /* @var $ml_formatter kMultiLanguage */ + $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); + /* @var $ml_helper kMultiLanguageHelper */ + + $languages = $ml_helper->getLanguages(); + foreach ($this->customFields as $custom_id => $custom_name) { $force_primary = $cdata->GetFieldOption('cust_' . $custom_id, 'force_primary'); - $cdata->SetDBField($ml_formatter->LangFieldName('cust_' . $custom_id, $force_primary), $this->GetDBField('cust_' . $custom_name)); + + if ( $force_primary ) { + $cdata->SetDBField($ml_formatter->LangFieldName('cust_' . $custom_id, true), $this->GetDBField('cust_' . $custom_name)); + } + else { + foreach ($languages as $language_id) { + $cdata->SetDBField('l' . $language_id . '_cust_' . $custom_id, $this->GetDBField('l' . $language_id . '_cust_' . $custom_name)); + } + } } return $cdata->isLoaded() ? $cdata->Update() : $cdata->Create(); Index: branches/5.2.x/core/units/users/users_tag_processor.php =================================================================== diff -u -N -r14596 -r14653 --- branches/5.2.x/core/units/users/users_tag_processor.php (.../users_tag_processor.php) (revision 14596) +++ branches/5.2.x/core/units/users/users_tag_processor.php (.../users_tag_processor.php) (revision 14653) @@ -1,6 +1,6 @@ getObject($params); + /* @var $object UsersItem */ + return $object->GetID() != USER_ROOT ? $object->GetDBField('Login') : 'root'; }