Index: branches/unlabeled/unlabeled-1.1.2/kernel/units/general/helpers/clipboard_helper.php
===================================================================
diff -u -r5609 -r5718
--- branches/unlabeled/unlabeled-1.1.2/kernel/units/general/helpers/clipboard_helper.php (.../clipboard_helper.php) (revision 5609)
+++ branches/unlabeled/unlabeled-1.1.2/kernel/units/general/helpers/clipboard_helper.php (.../clipboard_helper.php) (revision 5718)
@@ -1,7 +1,7 @@
getObject();
-
+
$clipboard = $this->Application->RecallVar('clipboard');
$clipboard = $clipboard ? unserialize($clipboard) : Array();
-
+
$prefix = $event->getPrefixSpecial();
-
+
// 1. add $ids to mode key for prefix (make sure the unique)
$this_mode_ids =& $clipboard[$prefix][$mode];
if (!is_array($this_mode_ids)) {
@@ -26,7 +26,7 @@
else {
$this_mode_ids = array_unique( array_merge($this_mode_ids, $ids) );
}
-
+
// 2. remove that ids from all other modes
$other_mode_ids =& $clipboard[$prefix][$mode == 'cut' ? 'copy' : 'cut'];
if (!is_array($other_mode_ids)) {
@@ -35,9 +35,9 @@
else {
$other_mode_ids = array_diff($other_mode_ids, $this_mode_ids);
}
-
+
$this->Application->StoreVar('clipboard', serialize($clipboard));
-
+
/*// do not go up - STAY
$event->SetRedirectParam('opener', 's');
$event->SetRedirectParam('pass_events', true);*/
Index: branches/unlabeled/unlabeled-1.62.2/core/kernel/db/db_tag_processor.php
===================================================================
diff -u -r5655 -r5718
--- branches/unlabeled/unlabeled-1.62.2/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 5655)
+++ branches/unlabeled/unlabeled-1.62.2/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 5718)
@@ -419,7 +419,7 @@
// $http_query =& $this->Application->recallObject('HTTPQuery');
// $get = $http_query->getRedirectParams();
- $pass = Array('pass' => 'all,'.$this->getPrefixSpecial());
+ $pass = Array('pass' => 'm,'.$this->getPrefixSpecial());
// $pass = array_merge($get, $pass);
return $this->Application->HREF($t, '', $pass);
Index: branches/unlabeled/unlabeled-1.12.2/core/kernel/parser/tags.php
===================================================================
diff -u -r5549 -r5718
--- branches/unlabeled/unlabeled-1.12.2/core/kernel/parser/tags.php (.../tags.php) (revision 5549)
+++ branches/unlabeled/unlabeled-1.12.2/core/kernel/parser/tags.php (.../tags.php) (revision 5718)
@@ -313,6 +313,7 @@
switch ( $this->Tag ) {
case 'DefaultParam':
foreach ($this->NP as $key => $val) {
+ $code[] = 'if (!$'.$key.') $application->Parser->SetParam(\''.$key.'\', \''.$val.'\');';
$code[] = '$'.$key.' = $'.$key.' ? $'.$key.' : \''.$val.'\';';
}
return $code;
@@ -373,7 +374,7 @@
}
else {
$processor_to_check = $tmp_processor;
- } */
+ } */
$code[] = '$tmp = $application->processPrefix("'.$this->getPrefixSpecial().'");'."\n";
Index: branches/unlabeled/unlabeled-1.13.2/core/units/general/main_event_handler.php
===================================================================
diff -u -r5215 -r5718
--- branches/unlabeled/unlabeled-1.13.2/core/units/general/main_event_handler.php (.../main_event_handler.php) (revision 5215)
+++ branches/unlabeled/unlabeled-1.13.2/core/units/general/main_event_handler.php (.../main_event_handler.php) (revision 5718)
@@ -85,6 +85,7 @@
if ($processed_params['m_cat_id'] > 0) {
$ret .= $this->Application->getFilename('c', $processed_params['m_cat_id']).'/';
+ $url_params['category_processed'] = true;
}
$force_page_adding = false;
Index: branches/unlabeled/unlabeled-1.13.2/kernel/units/general/main_event_handler.php
===================================================================
diff -u -r5215 -r5718
--- branches/unlabeled/unlabeled-1.13.2/kernel/units/general/main_event_handler.php (.../main_event_handler.php) (revision 5215)
+++ branches/unlabeled/unlabeled-1.13.2/kernel/units/general/main_event_handler.php (.../main_event_handler.php) (revision 5718)
@@ -85,6 +85,7 @@
if ($processed_params['m_cat_id'] > 0) {
$ret .= $this->Application->getFilename('c', $processed_params['m_cat_id']).'/';
+ $url_params['category_processed'] = true;
}
$force_page_adding = false;
Index: branches/unlabeled/unlabeled-1.155.2/core/kernel/application.php
===================================================================
diff -u -r5715 -r5718
--- branches/unlabeled/unlabeled-1.155.2/core/kernel/application.php (.../application.php) (revision 5715)
+++ branches/unlabeled/unlabeled-1.155.2/core/kernel/application.php (.../application.php) (revision 5718)
@@ -1130,6 +1130,7 @@
unset($params['__SSL__']);
}
+ $m_only = true;
$pass_info = $this->getPassInfo($pass);
if ($pass_info) {
if ($pass_info[0] == 'm') array_shift($pass_info);
@@ -1145,17 +1146,30 @@
$next_prefix = substr($next_prefix, 0, strlen($prefix) + 1);
if ($prefix.'.' == $next_prefix) continue;
}
-
- $ret .= '/'.$this->BuildModuleEnv_NEW($pass_element, $params, $pass_events);
+ $a = $this->BuildModuleEnv_NEW($pass_element, $params, $pass_events);
+ if ($a) {
+ $ret .= '/'.$a;
+ $m_only = false;
+ }
}
else
{
$env .= ':'.$this->BuildModuleEnv($pass_element, $params, $pass_events);
}
}
$ret = $this->BuildModuleEnv_NEW('m', $params, $pass_events).$ret;
+ $cat_processed = isset($params['category_processed']) && $params['category_processed'];
+ if ($cat_processed) {
+ unset($params['category_processed']);
+ }
- $ret = trim($ret, '/').'.html';
+ if (!$m_only || !$cat_processed) {
+ $ret = trim($ret, '/').'.html';
+ }
+ else {
+ $ret .= '/';
+ }
+
// $ret = trim($ret, '/').'/';
if($env) $params[ENV_VAR_NAME] = ltrim($env, ':');
}
Index: branches/unlabeled/unlabeled-1.5.2/core/units/general/xml_helper.php
===================================================================
diff -u -r5519 -r5718
--- branches/unlabeled/unlabeled-1.5.2/core/units/general/xml_helper.php (.../xml_helper.php) (revision 5519)
+++ branches/unlabeled/unlabeled-1.5.2/core/units/general/xml_helper.php (.../xml_helper.php) (revision 5718)
@@ -23,9 +23,10 @@
xml_set_element_handler( $xml_parser, Array(&$this, 'startElement'), Array(&$this, 'endElement') );
xml_set_character_data_handler( $xml_parser, Array(&$this, 'characterData') );
if (!xml_parse($xml_parser, $xml, 1)) {
- trigger_error(sprintf('XML error: %s at line %d'),
- xml_error_string(xml_get_error_code($xml_parser)),
- xml_get_current_line_number($xml_parser), E_USER_WARNING);
+ $this->RootElement =& new kXMLNode('ERROR', array('code'=>xml_get_error_code($xml_parser),'message'=>xml_error_string(xml_get_error_code($xml_parser))));
+ trigger_error(sprintf('XML error: %s at line %d'),
+ xml_error_string(xml_get_error_code($xml_parser)),
+ xml_get_current_line_number($xml_parser), E_USER_WARNING);
}
xml_parser_free($xml_parser);
return $this->RootElement;
@@ -67,7 +68,7 @@
var $Attributes = array();
var $Children = array();
var $Data = null;
-
+
var $firstChild = null;
var $lastChild = null;
/**
@@ -82,7 +83,7 @@
* @var int
*/
var $Position = 0;
-
+
function kXMLNode($name, $attrs = array())
{
$this->Name = $name;
@@ -103,15 +104,15 @@
{
$node_count = count($this->Children);
$a_child->Position = $node_count;
-
+
if ($node_count == 0) {
$this->firstChild =& $a_child;
$this->lastChild =& $a_child;
}
else {
$this->lastChild =& $a_child;
}
-
+
$this->Children[] =& $a_child;
$a_child->SetParent($this);
}
@@ -151,7 +152,7 @@
return $false;
}
}
-
+
function &FindChild($name)
{
$name = strtoupper($name);
@@ -179,7 +180,7 @@
return $child->Data;
}
}
-
+
/**
* Returns next node to this, false in case of end list
*
Index: branches/unlabeled/unlabeled-1.4.2/core/units/general/helpers/mod_rewrite_helper.php
===================================================================
diff -u -r5560 -r5718
--- branches/unlabeled/unlabeled-1.4.2/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 5560)
+++ branches/unlabeled/unlabeled-1.4.2/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 5718)
@@ -100,16 +100,49 @@
function ProcessModuleIndex(&$url_parts)
{
- if ( count($url_parts) != 0 ) return false;
+ if ( count($url_parts) > 1) return false; // if no more parts or only 1 part left
+ if ( $url_parts && $url_parts[0] == 'index') { // treat index same as no parts
+ array_shift($url_parts);
+ }
+ 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)
+ {
+ $this->Application->SetVar( $module_data['Var'].'_id', 0);
+ $this->Application->SetVar( $module_data['Var'].'_Page', $url_parts[0]);
+ $this->Application->SetVar( $module_data['Var'].'_Reviews_Page', 0);
+ }
+ }
+
+ // try to find CMS index page of the category
+ if ($this->Application->isModuleEnabled('In-CMS')) {
+ $sql = 'SELECT p.Path, ci.CategoryId FROM '.TABLE_PREFIX.'Pages AS p
+ LEFT JOIN '.TABLE_PREFIX.'CategoryItems AS ci
+ ON ci.ItemResourceId = p.ResourceId
+ WHERE
+ p.IsIndex = 1
+ AND
+ CategoryId = '.$this->Application->GetVar('m_cat_id').'
+ AND
+ ci.PrimaryCat = 1';
+ $template_found = $this->Conn->GetRow($sql);
+ if ($template_found !== false) {
+ $this->HTTPQuery->Set('t', $template_found['Path']);
+ return true;
+ }
+ }
+
$sql = 'SELECT CachedCategoryTemplate
FROM '.TABLE_PREFIX.'Category
WHERE CategoryId = '.$this->Application->GetVar('m_cat_id');
$this->HTTPQuery->Set('t', $this->HTTPQuery->getDefaultTemplate( $this->Conn->GetOne($sql) ) );
return true;
}
- function ProcessModuleItem(&$url_parts)
+ function ProcessModuleItem(&$url_parts, $set_t=true)
{
if (!isset($url_parts[0])) return false;
if ( count($url_parts) != 1 ) return false;
@@ -123,51 +156,51 @@
$page = $rets[2];
}
+ // locating the item in CategoryItems by filename to detect its ItemPrefix and its category ParentPath
$cat_item = $this->Conn->GetRow('
- SELECT ci.ItemPrefix, c.ParentPath, ci.CategoryId FORM '.TABLE_PREFIX.'CategoryItems AS ci
+ SELECT ci.ItemResourceId, ci.ItemPrefix, c.ParentPath, ci.CategoryId FROM '.TABLE_PREFIX.'CategoryItems AS ci
LEFT JOIN '.TABLE_PREFIX.'Category AS c
ON c.CategoryId = ci.CategoryId
WHERE
- CategoryId = '.$this->Application->GetVar('m_cat_id').'
+ ci.CategoryId = '.$this->Application->GetVar('m_cat_id').'
AND
- Filename = '.$this->Conn->qstr($url_part));
- if ($cat_item !== false) {
+ ci.Filename = '.$this->Conn->qstr($url_part));
+
+ if ($cat_item !== false) { // item found
$module_prefix = $cat_item['ItemPrefix'];
- $item_template = $category_data['CachedItemTemplate'];
- if ($item_template) {
- $url_parts = explode('/', $item_template);
- array_push($url_parts, $url_part); // save item's filename as not processed
- $url_part = array_shift($url_parts);
- }
- $this->Application->SetVar($cat_item['ItemPrefix'].'_id', $item_id);
- }
+ $parent_path = implode(',',explode('|', substr($cat_item['ParentPath'], 1, -1)));
+ // item template is stored in module' system custom field - need to get that field Id
+ $item_template_field_id = $this->Conn->GetOne(
+ 'SELECT CustomFieldId
+ FROM '.TABLE_PREFIX.'CustomField
+ WHERE FieldName = '.$this->Conn->qstr($module_prefix.'_ItemTemplate'));
+ // looking for item template through cats hierarchy sorted by parent path
+ $query = 'SELECT ccd.l1_cust_'.$item_template_field_id.',
+ FIND_IN_SET(c.CategoryId, '.$this->Conn->qstr($parent_path).') AS Ord1,
+ c.CategoryId, c.Name, ccd.l1_cust_15
+ FROM inp_Category AS c
+ LEFT JOIN inp_CategoryCustomData AS ccd
+ ON ccd.ResourceId = c.ResourceId
+ WHERE c.CategoryId IN ('.$parent_path.') AND ccd.l1_cust_'.$item_template_field_id.' != \'\'
+ ORDER BY FIND_IN_SET(c.CategoryId, '.$this->Conn->qstr($parent_path).') DESC';
+ $item_template = $this->Conn->GetOne($query);
- $this->Application->SetVar( $event->getPrefixSpecial().'_Reviews_Page', $page);
+ // converting ResourceId to correpsonding Item id
+ $module_config = $this->Application->getUnitOptions($module_prefix);
+ $item_id = $this->Conn->GetOne(
+ 'SELECT '.$module_config['IDField'].' FROM '.$module_config['TableName'].'
+ WHERE ResourceId = '.$cat_item['ItemResourceId']
+ );
- // only filename left, no other parts
- $process_module = false;
- $sql = 'SELECT ParentPath, CachedItemTemplate, CachedCategoryTemplate
- FROM '.TABLE_PREFIX.'Category
- WHERE CategoryId = '.$this->Application->GetVar('m_cat_id');
- $category_data = $this->Conn->GetRow($sql);
-
-
-
- $root_category_id = array_shift( explode('|', substr($category_data['ParentPath'], 1, -1)) );
- $module_info = $this->Application->findModule('RootCat', $root_category_id);
- if ($module_info) {
- $module_prefix = $module_info['Var'];
- $module_event = new kEvent($module_prefix.':ParseEnv', Array('url_parts' => array_merge(Array($url_part), $url_parts)) );
- $this->Application->HandleEvent($module_event);
-
- if ($module_event->status == erSUCCESS && $this->HTTPQuery->Get($module_prefix.'_id')) {
- $item_template = $category_data['CachedItemTemplate'];
- if ($item_template) {
- $this->HTTPQuery->Set('t', $item_template );
- return true;
+ if ($item_template && $item_id) {
+ if ($set_t) {
+ $this->HTTPQuery->Set('t', $item_template);
}
+ $this->Application->SetVar($module_prefix.'_id', $item_id);
+ $this->Application->SetVar($module_prefix.'_Reviews_Page', $page);
+ return $module_prefix;
}
}
array_unshift($url_parts, $url_part);
@@ -264,18 +297,26 @@
$this->HTTPQuery->Set('t', '');
}
+ $passed = Array('m');
$this->ProcessLanguage($url_parts);
$this->ProcessTheme($url_parts);
if ( $this->ProcessVirtualTemplate($url_parts) ) {
+ $this->HTTPQuery->finalizeParsing($passed, $module_params);
return true;
}
$this->ProcessCategory($url_parts);
if ( $this->ProcessModuleIndex($url_parts) ) {
+ foreach ($this->Application->ModuleInfo as $module_name => $info) {
+ $passed[] = $info['Var'];
+ }
+ $this->HTTPQuery->finalizeParsing($passed, $module_params);
return ;
}
- if ( $this->ProcessModuleItem($url_parts) ) {
+ if ( $module_prefix = $this->ProcessModuleItem($url_parts) ) {
+ $passed[] = $module_prefix;
+ $this->HTTPQuery->finalizeParsing($passed, $module_params);
return ;
}
@@ -305,13 +346,22 @@
if ( $this->ProcessPhisycalTemplate($url_parts) ) {
if (!$url_parts) {
+ $this->HTTPQuery->finalizeParsing($passed, $module_params);
return true;
}
}
+ if ( $module_prefix = $this->ProcessModuleItem($url_parts, false) ) {
+ $passed[] = $module_prefix;
+ $this->HTTPQuery->finalizeParsing($passed, $module_params);
+ return ;
+ }
+
+ $this->HTTPQuery->finalizeParsing($passed, $module_params);
+
// pass params left to module
- $this->Application->Phrases->Init('phrases');
+ /*$this->Application->Phrases->Init('phrases');
$passed = Array('m');
$module_params = Array();
if ( isset($module_prefix) ) {
@@ -329,7 +379,7 @@
}
}
- $this->HTTPQuery->finalizeParsing($passed, $module_params);
+ $this->HTTPQuery->finalizeParsing($passed, $module_params);*/
}
Index: branches/unlabeled/unlabeled-1.5.2/kernel/units/general/xml_helper.php
===================================================================
diff -u -r5519 -r5718
--- branches/unlabeled/unlabeled-1.5.2/kernel/units/general/xml_helper.php (.../xml_helper.php) (revision 5519)
+++ branches/unlabeled/unlabeled-1.5.2/kernel/units/general/xml_helper.php (.../xml_helper.php) (revision 5718)
@@ -23,9 +23,10 @@
xml_set_element_handler( $xml_parser, Array(&$this, 'startElement'), Array(&$this, 'endElement') );
xml_set_character_data_handler( $xml_parser, Array(&$this, 'characterData') );
if (!xml_parse($xml_parser, $xml, 1)) {
- trigger_error(sprintf('XML error: %s at line %d'),
- xml_error_string(xml_get_error_code($xml_parser)),
- xml_get_current_line_number($xml_parser), E_USER_WARNING);
+ $this->RootElement =& new kXMLNode('ERROR', array('code'=>xml_get_error_code($xml_parser),'message'=>xml_error_string(xml_get_error_code($xml_parser))));
+ trigger_error(sprintf('XML error: %s at line %d'),
+ xml_error_string(xml_get_error_code($xml_parser)),
+ xml_get_current_line_number($xml_parser), E_USER_WARNING);
}
xml_parser_free($xml_parser);
return $this->RootElement;
@@ -67,7 +68,7 @@
var $Attributes = array();
var $Children = array();
var $Data = null;
-
+
var $firstChild = null;
var $lastChild = null;
/**
@@ -82,7 +83,7 @@
* @var int
*/
var $Position = 0;
-
+
function kXMLNode($name, $attrs = array())
{
$this->Name = $name;
@@ -103,15 +104,15 @@
{
$node_count = count($this->Children);
$a_child->Position = $node_count;
-
+
if ($node_count == 0) {
$this->firstChild =& $a_child;
$this->lastChild =& $a_child;
}
else {
$this->lastChild =& $a_child;
}
-
+
$this->Children[] =& $a_child;
$a_child->SetParent($this);
}
@@ -151,7 +152,7 @@
return $false;
}
}
-
+
function &FindChild($name)
{
$name = strtoupper($name);
@@ -179,7 +180,7 @@
return $child->Data;
}
}
-
+
/**
* Returns next node to this, false in case of end list
*
Index: branches/unlabeled/unlabeled-1.4.2/kernel/units/general/helpers/mod_rewrite_helper.php
===================================================================
diff -u -r5560 -r5718
--- branches/unlabeled/unlabeled-1.4.2/kernel/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 5560)
+++ branches/unlabeled/unlabeled-1.4.2/kernel/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 5718)
@@ -100,16 +100,49 @@
function ProcessModuleIndex(&$url_parts)
{
- if ( count($url_parts) != 0 ) return false;
+ if ( count($url_parts) > 1) return false; // if no more parts or only 1 part left
+ if ( $url_parts && $url_parts[0] == 'index') { // treat index same as no parts
+ array_shift($url_parts);
+ }
+ 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)
+ {
+ $this->Application->SetVar( $module_data['Var'].'_id', 0);
+ $this->Application->SetVar( $module_data['Var'].'_Page', $url_parts[0]);
+ $this->Application->SetVar( $module_data['Var'].'_Reviews_Page', 0);
+ }
+ }
+
+ // try to find CMS index page of the category
+ if ($this->Application->isModuleEnabled('In-CMS')) {
+ $sql = 'SELECT p.Path, ci.CategoryId FROM '.TABLE_PREFIX.'Pages AS p
+ LEFT JOIN '.TABLE_PREFIX.'CategoryItems AS ci
+ ON ci.ItemResourceId = p.ResourceId
+ WHERE
+ p.IsIndex = 1
+ AND
+ CategoryId = '.$this->Application->GetVar('m_cat_id').'
+ AND
+ ci.PrimaryCat = 1';
+ $template_found = $this->Conn->GetRow($sql);
+ if ($template_found !== false) {
+ $this->HTTPQuery->Set('t', $template_found['Path']);
+ return true;
+ }
+ }
+
$sql = 'SELECT CachedCategoryTemplate
FROM '.TABLE_PREFIX.'Category
WHERE CategoryId = '.$this->Application->GetVar('m_cat_id');
$this->HTTPQuery->Set('t', $this->HTTPQuery->getDefaultTemplate( $this->Conn->GetOne($sql) ) );
return true;
}
- function ProcessModuleItem(&$url_parts)
+ function ProcessModuleItem(&$url_parts, $set_t=true)
{
if (!isset($url_parts[0])) return false;
if ( count($url_parts) != 1 ) return false;
@@ -123,51 +156,51 @@
$page = $rets[2];
}
+ // locating the item in CategoryItems by filename to detect its ItemPrefix and its category ParentPath
$cat_item = $this->Conn->GetRow('
- SELECT ci.ItemPrefix, c.ParentPath, ci.CategoryId FORM '.TABLE_PREFIX.'CategoryItems AS ci
+ SELECT ci.ItemResourceId, ci.ItemPrefix, c.ParentPath, ci.CategoryId FROM '.TABLE_PREFIX.'CategoryItems AS ci
LEFT JOIN '.TABLE_PREFIX.'Category AS c
ON c.CategoryId = ci.CategoryId
WHERE
- CategoryId = '.$this->Application->GetVar('m_cat_id').'
+ ci.CategoryId = '.$this->Application->GetVar('m_cat_id').'
AND
- Filename = '.$this->Conn->qstr($url_part));
- if ($cat_item !== false) {
+ ci.Filename = '.$this->Conn->qstr($url_part));
+
+ if ($cat_item !== false) { // item found
$module_prefix = $cat_item['ItemPrefix'];
- $item_template = $category_data['CachedItemTemplate'];
- if ($item_template) {
- $url_parts = explode('/', $item_template);
- array_push($url_parts, $url_part); // save item's filename as not processed
- $url_part = array_shift($url_parts);
- }
- $this->Application->SetVar($cat_item['ItemPrefix'].'_id', $item_id);
- }
+ $parent_path = implode(',',explode('|', substr($cat_item['ParentPath'], 1, -1)));
+ // item template is stored in module' system custom field - need to get that field Id
+ $item_template_field_id = $this->Conn->GetOne(
+ 'SELECT CustomFieldId
+ FROM '.TABLE_PREFIX.'CustomField
+ WHERE FieldName = '.$this->Conn->qstr($module_prefix.'_ItemTemplate'));
+ // looking for item template through cats hierarchy sorted by parent path
+ $query = 'SELECT ccd.l1_cust_'.$item_template_field_id.',
+ FIND_IN_SET(c.CategoryId, '.$this->Conn->qstr($parent_path).') AS Ord1,
+ c.CategoryId, c.Name, ccd.l1_cust_15
+ FROM inp_Category AS c
+ LEFT JOIN inp_CategoryCustomData AS ccd
+ ON ccd.ResourceId = c.ResourceId
+ WHERE c.CategoryId IN ('.$parent_path.') AND ccd.l1_cust_'.$item_template_field_id.' != \'\'
+ ORDER BY FIND_IN_SET(c.CategoryId, '.$this->Conn->qstr($parent_path).') DESC';
+ $item_template = $this->Conn->GetOne($query);
- $this->Application->SetVar( $event->getPrefixSpecial().'_Reviews_Page', $page);
+ // converting ResourceId to correpsonding Item id
+ $module_config = $this->Application->getUnitOptions($module_prefix);
+ $item_id = $this->Conn->GetOne(
+ 'SELECT '.$module_config['IDField'].' FROM '.$module_config['TableName'].'
+ WHERE ResourceId = '.$cat_item['ItemResourceId']
+ );
- // only filename left, no other parts
- $process_module = false;
- $sql = 'SELECT ParentPath, CachedItemTemplate, CachedCategoryTemplate
- FROM '.TABLE_PREFIX.'Category
- WHERE CategoryId = '.$this->Application->GetVar('m_cat_id');
- $category_data = $this->Conn->GetRow($sql);
-
-
-
- $root_category_id = array_shift( explode('|', substr($category_data['ParentPath'], 1, -1)) );
- $module_info = $this->Application->findModule('RootCat', $root_category_id);
- if ($module_info) {
- $module_prefix = $module_info['Var'];
- $module_event = new kEvent($module_prefix.':ParseEnv', Array('url_parts' => array_merge(Array($url_part), $url_parts)) );
- $this->Application->HandleEvent($module_event);
-
- if ($module_event->status == erSUCCESS && $this->HTTPQuery->Get($module_prefix.'_id')) {
- $item_template = $category_data['CachedItemTemplate'];
- if ($item_template) {
- $this->HTTPQuery->Set('t', $item_template );
- return true;
+ if ($item_template && $item_id) {
+ if ($set_t) {
+ $this->HTTPQuery->Set('t', $item_template);
}
+ $this->Application->SetVar($module_prefix.'_id', $item_id);
+ $this->Application->SetVar($module_prefix.'_Reviews_Page', $page);
+ return $module_prefix;
}
}
array_unshift($url_parts, $url_part);
@@ -264,18 +297,26 @@
$this->HTTPQuery->Set('t', '');
}
+ $passed = Array('m');
$this->ProcessLanguage($url_parts);
$this->ProcessTheme($url_parts);
if ( $this->ProcessVirtualTemplate($url_parts) ) {
+ $this->HTTPQuery->finalizeParsing($passed, $module_params);
return true;
}
$this->ProcessCategory($url_parts);
if ( $this->ProcessModuleIndex($url_parts) ) {
+ foreach ($this->Application->ModuleInfo as $module_name => $info) {
+ $passed[] = $info['Var'];
+ }
+ $this->HTTPQuery->finalizeParsing($passed, $module_params);
return ;
}
- if ( $this->ProcessModuleItem($url_parts) ) {
+ if ( $module_prefix = $this->ProcessModuleItem($url_parts) ) {
+ $passed[] = $module_prefix;
+ $this->HTTPQuery->finalizeParsing($passed, $module_params);
return ;
}
@@ -305,13 +346,22 @@
if ( $this->ProcessPhisycalTemplate($url_parts) ) {
if (!$url_parts) {
+ $this->HTTPQuery->finalizeParsing($passed, $module_params);
return true;
}
}
+ if ( $module_prefix = $this->ProcessModuleItem($url_parts, false) ) {
+ $passed[] = $module_prefix;
+ $this->HTTPQuery->finalizeParsing($passed, $module_params);
+ return ;
+ }
+
+ $this->HTTPQuery->finalizeParsing($passed, $module_params);
+
// pass params left to module
- $this->Application->Phrases->Init('phrases');
+ /*$this->Application->Phrases->Init('phrases');
$passed = Array('m');
$module_params = Array();
if ( isset($module_prefix) ) {
@@ -329,7 +379,7 @@
}
}
- $this->HTTPQuery->finalizeParsing($passed, $module_params);
+ $this->HTTPQuery->finalizeParsing($passed, $module_params);*/
}
Index: branches/unlabeled/unlabeled-1.1.2/core/units/general/helpers/clipboard_helper.php
===================================================================
diff -u -r5609 -r5718
--- branches/unlabeled/unlabeled-1.1.2/core/units/general/helpers/clipboard_helper.php (.../clipboard_helper.php) (revision 5609)
+++ branches/unlabeled/unlabeled-1.1.2/core/units/general/helpers/clipboard_helper.php (.../clipboard_helper.php) (revision 5718)
@@ -1,7 +1,7 @@
getObject();
-
+
$clipboard = $this->Application->RecallVar('clipboard');
$clipboard = $clipboard ? unserialize($clipboard) : Array();
-
+
$prefix = $event->getPrefixSpecial();
-
+
// 1. add $ids to mode key for prefix (make sure the unique)
$this_mode_ids =& $clipboard[$prefix][$mode];
if (!is_array($this_mode_ids)) {
@@ -26,7 +26,7 @@
else {
$this_mode_ids = array_unique( array_merge($this_mode_ids, $ids) );
}
-
+
// 2. remove that ids from all other modes
$other_mode_ids =& $clipboard[$prefix][$mode == 'cut' ? 'copy' : 'cut'];
if (!is_array($other_mode_ids)) {
@@ -35,9 +35,9 @@
else {
$other_mode_ids = array_diff($other_mode_ids, $this_mode_ids);
}
-
+
$this->Application->StoreVar('clipboard', serialize($clipboard));
-
+
/*// do not go up - STAY
$event->SetRedirectParam('opener', 's');
$event->SetRedirectParam('pass_events', true);*/
Index: branches/unlabeled/unlabeled-1.108.2/globals.php
===================================================================
diff -u -r5626 -r5718
--- branches/unlabeled/unlabeled-1.108.2/globals.php (.../globals.php) (revision 5626)
+++ branches/unlabeled/unlabeled-1.108.2/globals.php (.../globals.php) (revision 5718)
@@ -103,7 +103,7 @@
$application =& kApplication::Instance();
return $application->GetADODBConnection();
}
-
+
if( !isset($DB) && strlen($g_DBType) > 0 )
{
$DB = ADONewConnection($g_DBType);
@@ -537,28 +537,28 @@
function ExtractDatePart($part, $datestamp)
{
if ($datestamp <= 0) return '';
-
+
$formats = Array( 'month' => 'm', 'day' => 'd', 'year' => 'Y',
'time_24hr' => 'H:i', 'time_12hr' => 'g:i a', 'time' => GetTimeFormat(), 'date' => GetDateFormat() );
-
+
$format = isset($formats[$part]) ? $formats[$part] : $part;
return adodb_date($format, $datestamp);
}
function GetLocalTime($TimeStamp, $TargetZone = null)
{
global $objConfig;
-
+
if ($TargetZone == null) {
$TargetZone = $objConfig->Get('Config_Site_Time');
}
-
+
$server = $objConfig->Get('Config_Server_Time');
if ($TargetZone != $server) {
$offset = ($server - $TargetZone) * -1;
$TimeStamp = $TimeStamp + (3600 * $offset);
}
-
+
return $TimeStamp;
}
@@ -873,11 +873,11 @@
if ($LangId == 0) {
$LangId = $objSession->Get('Language');
}
-
+
if ($LangId == 0) {
$LangId = $objLanguages->GetPrimary();
}
-
+
return $objLanguageCache->GetTranslation($phrase,$LangId);
}
@@ -1171,14 +1171,14 @@
function GetDateFormat($LangId = 0, $is_input = false)
{
global $objLanguages;
-
+
if (!$LangId) {
$LangId = $objLanguages->GetPrimary();
}
-
+
$l = $objLanguages->GetItem($LangId);
$fmt = is_object($l) ? $l->Get(($is_input ? 'Input' : '').'DateFormat') : 'm-d-Y';
-
+
if (getArrayValue($GLOBALS, 'FrontEnd')) {
return $fmt;
}
@@ -1193,7 +1193,7 @@
$LangId = $objLanguages->GetPrimary();
}
$l = $objLanguages->GetItem($LangId);
-
+
$fmt = is_object($l) ? $l->Get(($is_input ? 'Input' : '').'TimeFormat') : 'H:i:s';
return $fmt;
}
@@ -1567,13 +1567,13 @@
static $import_scripts = Array();
if( count($import_scripts) == 0 )
{
-
+
$sql = 'SELECT imp.* , m.LoadOrder
FROM '.TABLE_PREFIX.'ImportScripts imp
LEFT JOIN '.TABLE_PREFIX.'Modules m ON m.Name = imp.is_Module
WHERE m.Loaded = 1
ORDER BY m.LoadOrder';
-
+
$db =& GetADODBConnection();
$rs = $db->Execute($sql);
if ($rs && $rs->RecordCount() > 0) {
@@ -1615,10 +1615,10 @@
$main =& $GLOBALS[$prefix.'_var_list'];
$update =& $GLOBALS[$prefix.'_var_list_update'];
//echo "VAR: [$main]; VAR_UPDATE: [$update]
";
-
+
// if update var count is zero, then do nothing
if( !is_array($update) || count($update) == 0 ) return '';
-
+
// ensure that we have no empty values in enviroment variable
foreach($update as $vl_key => $vl_value) {
if(!$vl_value) $update[$vl_key] = '0'; // unset($update[$vl_key]);
@@ -1627,7 +1627,7 @@
foreach($main as $vl_key => $vl_value) {
if(!$vl_value) $main[$vl_key] = '0'; // unset($main[$vl_key]);
}
-
+
$ret = Array();
foreach($var_list as $var_name) {
$value = GetEnvVar($prefix, $var_name);
@@ -1640,25 +1640,25 @@
foreach ($keys as $key) {
unset($update[$key]);
}
-
+
return ':'.$prefix.implode('-',$ret);
}
// functions for dealign with enviroment variable construction
function GenerateModuleEnv_NEW($prefix, $var_list)
-{
+{
// globalize module varible arrays
$main =& $GLOBALS[$prefix.'_var_list'];
$update =& $GLOBALS[$prefix.'_var_list_update'];
//echo "VAR: [$main]; VAR_UPDATE: [$update]
";
-
+
if ( isset($update) && $update )
{
// ensure that we have no empty values in enviroment variable
foreach($update as $vl_key => $vl_value) {
if(!$vl_value) $update[$vl_key] = '0'; // unset($update[$vl_key]);
}
-
+
$app =& kApplication::Instance();
$passed = $app->GetVar('prefixes_passed');
$passed[] = $prefix;
@@ -1668,13 +1668,13 @@
{
return Array();
}
-
+
if ($main) {
foreach($main as $vl_key => $vl_value) {
if(!$vl_value) $main[$vl_key] = '0'; // unset($main[$vl_key]);
}
}
-
+
$ret = Array();
foreach($var_list as $src_name => $dst_name) {
$ret[$dst_name] = GetEnvVar($prefix, $src_name);
@@ -1701,7 +1701,7 @@
if ($submit_value !== false) {
return $submit_value;
}
-
+
return isset($update[$name]) ? $update[$name] : ( isset($main[$name]) ? $main[$name] : '');
}
@@ -1939,7 +1939,7 @@
header('Location: '.$adminURL.'/index.php?'.$redirect_params);
exit;
}
-
+
/**
* Builds up K4 url from data supplied by in-portal
*
@@ -1960,7 +1960,7 @@
$app =& kApplication::Instance();
return $app->HREF($t, '', $url_params, $index_file);
}
-
+
/**
* Set url params based on tag params & mapping hash passed
*
@@ -1975,11 +1975,11 @@
if( getArrayValue($tag_attribs, $tag_param) ) $url_params[$url_param] = $tag_attribs[$tag_param];
}
}
-
+
function ExtractParams($params_str, $separator = '&')
{
if(!$params_str) return Array();
-
+
$ret = Array();
$parts = explode($separator, trim($params_str, $separator) );
foreach ($parts as $part)
@@ -1989,7 +1989,7 @@
}
return $ret;
}
-
+
function &recallObject($var_name, $class_name)
{
if (!isset($GLOBALS[$var_name]) || !is_object($GLOBALS[$var_name]))
@@ -1998,7 +1998,7 @@
}
return $GLOBALS[$var_name];
}
-
+
/**
* Returns true in case of AM/PM time
*
@@ -2008,7 +2008,7 @@
{
return preg_match('/(a|A)/', GetTimeFormat() );
}
-
+
/**
* Saves custom fields for old in-portal items
*
@@ -2020,24 +2020,24 @@
{
$objCustomEdit = new clsCustomDataList();
$CustomFields = new clsCustomFieldList($item_type);
-
+
$data_changed = false;
for ($i = 0; $i < $CustomFields->NumItems(); $i++) {
$objField =& $CustomFields->GetItemRefByIndex($i);
$field_name = $objField->Get('FieldName');
-
+
$value = getCustomValue($field_name);
if ($value !== false) {
$objCustomEdit->SetFieldValue($objField->Get('CustomFieldId'), $resource_id, $value);
$data_changed = true;
}
}
-
+
if ($data_changed) {
$objCustomEdit->SaveData($prefix, $resource_id);
}
}
-
+
/**
* Returns custom field value from submit
*
@@ -2058,27 +2058,27 @@
function checkActionPermission($action_mapping, $action, $system = 0)
{
$application =& kApplication::Instance();
-
+
if (!isset($action_mapping[$action])) {
// if no permission mapping defined, then action is allowed in any case
return true;
}
-
+
$perm_status = false;
- $action_mapping = explode('|', $action_mapping[$action]);
+ $action_mapping = explode('|', $action_mapping[$action]);
foreach ($action_mapping as $perm_name) {
$perm_status = $application->CheckPermission($perm_name, $system);
if ($perm_status) {
break;
}
}
-
+
if (!$perm_status) {
$application->Redirect($application->IsAdmin() ? 'no_permission' : $application->ConfigValue('NoPermissionTemplate'), null, '', 'index.php');
}
return true;
}
-
+
function checkViewPermission($section_name, $system = 1)
{
$application =& kApplication::Instance();