Index: trunk/core/units/general/cat_tag_processor.php =================================================================== diff -u -N -r8491 -r8535 --- trunk/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 8491) +++ trunk/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 8535) @@ -210,6 +210,7 @@ /* @var $object kDBItem */ $params['cat_id'] = $object->isLoaded() ? $object->GetDBField('ParentPath') : $this->Application->GetVar('m_cat_id'); + return $perm_helper->TagPermissionCheck($params, $this->getPrefixSpecial().'_HasPermission'); } @@ -340,6 +341,58 @@ { return 'events['.$this->Prefix.']['.$params['event'].']'; } + + /** + * Checks if we are viewing module root category + * + * @param Array $params + * @return bool + */ + function IsModuleHome($params) + { + $root_category = $this->Application->findModule('Var', $this->Prefix, 'RootCat'); + + return $root_category == $this->Application->GetVar('m_cat_id'); + } + + /** + * Dynamic votes indicator + * + * @param Array $params + * + * @return string + */ + function VotesIndicator($params) + { + $blocks_params = $this->prepareTagParams($params); + $blocks_params['name'] = $params['render_as']; + + $object =& $this->getObject($params); + /* @var $object kDBItem */ + + $rating = $object->GetDBField('CachedRating'); + $float_rating = floor(($rating - floor($rating)) / 0.25) * 0.25; + + $i = 1; + $ret = ''; + while ($i <= 5) { + $blocks_params['number'] = $i; + $blocks_params['active'] = $rating >= $i ? 1 : 0; + + if ($rating > $i - 1 && $rating < $i && $float_rating > 0) { + $blocks_params['active'] = 1; + $blocks_params['float_rating'] = $float_rating; + } + else { + $blocks_params['float_rating'] = ''; + } + + $ret .= trim($this->Application->ParseBlock($blocks_params)); + $i++; + } + + return $ret; + } } ?> \ No newline at end of file Index: trunk/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r8428 -r8535 --- trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 8428) +++ trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 8535) @@ -384,27 +384,40 @@ return $o; } + /** + * Used for search sidebox on front-end only + * + * @param Array $params + * @return string + * @author Alex + */ function GetFormHiddens($params) { - $sid = $this->Application->GetSID(); $t = $this->SelectParam($params, 'template,t'); unset($params['template']); - $env = $this->Application->BuildEnv($t, $params, 'm', null, false); - $o = ''; - if ( $this->Application->RewriteURLs() ) - { + + $form_fields = Array (); + if ($this->Application->RewriteURLs()) { $session =& $this->Application->recallObject('Session'); if ($session->NeedQueryString()) { - $o .= "\n"; + $form_fields['sid'] = $this->Application->GetSID(); } } else { - $o .= "\n"; + $form_fields['env'] = $this->Application->BuildEnv($t, $params, 'm', null, false); } + if ($this->Application->GetVar('admin') == 1) { - $o .= "\n"; + $form_fields['admin'] = 1; } - return $o; + + $ret = ''; + $field_tpl = ''."\n"; + foreach ($form_fields as $form_field => $field_value) { + $ret .= sprintf($field_tpl, $form_field, $field_value); + } + + return $ret; } function Odd_Even($params)