Index: trunk/core/kernel/startup.php =================================================================== diff -u -N -r5206 -r5219 --- trunk/core/kernel/startup.php (.../startup.php) (revision 5206) +++ trunk/core/kernel/startup.php (.../startup.php) (revision 5219) @@ -1,9 +1,17 @@ '; echo 'Please use the installation script to fix the problem.

'; Index: trunk/core/kernel/session/session.php =================================================================== diff -u -N -r5024 -r5219 --- trunk/core/kernel/session/session.php (.../session.php) (revision 5024) +++ trunk/core/kernel/session/session.php (.../session.php) (revision 5219) @@ -233,7 +233,7 @@ $sql = 'DELETE FROM '.$this->TableName.$where_clause; $this->Conn->Query($sql); - + // delete debugger ouputs left of expired sessions foreach ($expired_sids as $expired_sid) { $debug_file = KERNEL_PATH.'/../cache/debug_@'.$expired_sid.'@.txt'; @@ -412,7 +412,13 @@ 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 || + ( defined('INPORTAL_ENV') && + INPORTAL_ENV && + $this->Application->IsAdmin() + && + !$this->Application->GetVar('front')) + ) { //we don't need to bother checking if we would not use it $this->CookiesEnabled = false; @@ -692,10 +698,10 @@ $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_env', substr($this->Application->BuildEnv($t, Array('__URLENCODE__' => 1), 'all'), strlen(ENV_VAR_NAME)+1)); } - + function StoreVar($name, $value) { $this->Data->Set($name, $value); Index: trunk/kernel/admin_templates/popups/editor.tpl =================================================================== diff -u -N --- trunk/kernel/admin_templates/popups/editor.tpl (revision 0) +++ trunk/kernel/admin_templates/popups/editor.tpl (revision 5219) @@ -0,0 +1,116 @@ + + + + +In-Portal + +"> + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + \ No newline at end of file Index: trunk/kernel/admin_templates/incs/script.js =================================================================== diff -u -N -r5185 -r5219 --- trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 5185) +++ trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 5219) @@ -108,7 +108,7 @@ set_hidden_field('events[' + prefix_special + ']', event); } if (t) set_hidden_field('t', t); - + if (form_action) { var old_env = ''; if (!form_action.match(/\?/)) { @@ -226,15 +226,18 @@ } // in-portal compatibility functions: begin -function getScriptURL($script_name) +function getScriptURL($script_name, tpl) { + tpl = tpl ? '-'+tpl : ''; var $asid = get_hidden_field('sid'); - return base_url+$script_name+'?env='+( isset($env)&&$env?$env:$asid )+'&en=0'; + return base_url+$script_name+'?env='+( isset($env)&&$env?$env:$asid )+tpl+'&en=0'; } function OpenEditor(extra_env,TargetForm,TargetField) { - var $url = getScriptURL('admin/editor/editor_new.php'); +// var $url = getScriptURL('admin/editor/editor_new.php'); + var $url = getScriptURL('admin/index.php', 'popups/editor'); +// alert($url); $url = $url+'&TargetForm='+TargetForm+'&TargetField='+TargetField+'&destform=popup'; if(extra_env.length>0) $url += extra_env; openwin($url,'html_edit',800,575); @@ -456,7 +459,7 @@ // sets hidden field value // if the field does not exist - creates it function set_hidden_field($field_id, $value) -{ +{ var $kf = document.getElementById($form_name); var $field = $kf.elements[$field_id]; if ($field) { @@ -477,7 +480,7 @@ // sets hidden field value // if the field does not exist - creates it function setInnerHTML($field_id, $value) -{ +{ var $element = document.getElementById($field_id); if (!$element) return false; $element.innerHTML = $value; @@ -541,7 +544,7 @@ yPos += tempEl.offsetTop; tempEl = tempEl.offsetParent; } - + // if (obj.y) return obj.y; return yPos; } @@ -979,7 +982,7 @@ el.removeEventListener(evname, func, true); } };*/ - + function setCookie($Name, $Value) { // set cookie @@ -988,20 +991,20 @@ document.cookie = $Name+'='+escape($Value)+'; path=' + $base_path + '/'; } } - + function getCookie($Name) { // get cookie var $cookieString = document.cookie; var $index = $cookieString.indexOf($Name+'='); if($index == -1) return null; - + $index = $cookieString.indexOf('=',$index)+1; var $endstr = $cookieString.indexOf(';',$index); if($endstr == -1) $endstr = $cookieString.length; - return unescape($cookieString.substring($index, $endstr)); + return unescape($cookieString.substring($index, $endstr)); } - + function deleteCookie($Name) { // deletes cookie @@ -1010,7 +1013,7 @@ document.cookie = $Name+'=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/'; } } - + function addElement($dst_element, $tag_name) { var $new_element = document.createElement($tag_name.toUpperCase()); $dst_element.appendChild($new_element); Index: trunk/core/kernel/parser/template_parser.php =================================================================== diff -u -N -r4880 -r5219 --- trunk/core/kernel/parser/template_parser.php (.../template_parser.php) (revision 4880) +++ trunk/core/kernel/parser/template_parser.php (.../template_parser.php) (revision 5219) @@ -90,6 +90,7 @@ function SetParam($name, $value) { $this->Params[strtolower($name)] = $value; + $this->AddParam('/[{]{0,1}\$'.$name.'[}]{0,1}/i', $val, 0); } function SetBuffer($body) @@ -263,13 +264,13 @@ //getting prefix_tag upto first space, tab or line break into regs[1] preg_match("/^([^ \t\n]*)(.*)/", $tag, $regs); $tag_part = $regs[1]; - + if (strpos($tag_part, '_') !== false) { list($prefix, $the_tag) = explode('_', $tag, 2); /*preg_match('/(.*)_(.*)/', $tag_part, $rets); $prefix = $rets[1]; $the_tag = $rets[2].$regs[2];*/ - + $tag = $prefix.':'.$the_tag; } else { @@ -406,6 +407,7 @@ $this->CompiledBuffer .= 'global $application;'."\n"; $this->CompiledBuffer .= '$params =& $application->Parser->Params;'."\n"; + $this->CompiledBuffer .= 'extract($params);'."\n"; $this->CompiledBuffer .= '$o = \'\';'."\n"; } Index: trunk/core/units/categories/categories_config.php =================================================================== diff -u -N -r5185 -r5219 --- trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 5185) +++ trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 5219) @@ -6,11 +6,11 @@ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'CategoriesEventHandler','file'=>'categories_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'CategoriesTagProcessor','file'=>'categories_tag_processor.php','build_event'=>'OnBuild'), - + 'RegisterClasses' => Array( Array('pseudo' => 'kPermCacheUpdater','class' => 'kPermCacheUpdater', 'file' => 'cache_updater.php','build_event'=>''), ), - + 'AutoLoad' => true, 'QueryString' => Array( 1 => 'id', @@ -26,12 +26,12 @@ ), ), 'IDField' => 'CategoryId', - + 'StatusField' => Array('Status'), - + 'TitleField' => 'Name', // field, used in bluebar when editing existing item 'ItemType' => 1, // used for custom fields only - + 'StatisticsInfo' => Array( 'pending' => Array( 'icon' => 'icon16_cat_pending.gif', @@ -41,7 +41,7 @@ 'status' => STATUS_PENDING, ), ), - + 'TableName' => TABLE_PREFIX.'Category', 'ViewMenuPhrase' => 'la_text_Categories', @@ -52,22 +52,22 @@ 'new_titlefield' => Array('c' => '!la_title_New_Category!'), ), 'category_list' => Array('prefixes' => Array('c_List'), 'format' => "!la_title_Categories! (#c_recordcount#)"), - + 'catalog' => Array('prefixes' => Array('c_List'), 'format' => "!la_title_Categories! (#c_recordcount#)"), - + 'categories_edit' => Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_General!"), 'categories_properties' => Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Properties!"), 'categories_custom' => Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Custom!"), - + 'categories_update' => Array('prefixes' => Array(), 'format' => "!la_title_UpdatingCategories! "), - + 'tree_site' => Array('format' => '!la_selecting_categories!'), ), 'PermItemPrefix' => 'CATEGORY', 'PermSection' => Array('main' => 'CATEGORY:in-portal:categories', /*'search' => 'in-portal:configuration_search',*/ 'email' => 'in-portal:configuration_email', 'custom' => 'in-portal:configuration_custom'), - + 'Sections' => Array( // "Structure & Data" section 'in-portal:site' => Array( @@ -89,7 +89,7 @@ 'priority' => 1, 'type' => stTREE, ), - + 'in-portal:browse_new' => Array( 'parent' => 'in-portal:site', 'icon' => 'catalog', @@ -163,7 +163,7 @@ ), ), - + 'FilterMenu' => Array( 'Groups' => Array( Array('mode' => 'AND', 'filters' => Array('show_active','show_pending','show_disabled'), 'type' => WHERE_FILTER), @@ -179,7 +179,7 @@ 'show_pick' => Array('label' => 'la_prompt_EditorsPick', 'on_sql' => '', 'off_sql' => '`EditorsPick` != 1' ), ) ), - + 'ListSQLs' => Array( ''=> ' SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'PermCache ON '.TABLE_PREFIX.'PermCache.CategoryId = %1$s.CategoryId @@ -198,7 +198,7 @@ 'Sorting' => Array('Name' => 'asc'), ) ), - + 'CalculatedFields' => Array( '' => Array( 'CurrentSort' => "REPLACE(ParentPath, CONCAT('|', ".'%1$s'.".CategoryId, '|'), '')", @@ -254,7 +254,7 @@ ), ), - + 'ConfigMapping' => Array( 'PerPage' => 'Perpage_Category', 'DefaultSorting1Field' => 'Category_Sortfield', Index: trunk/core/kernel/event_handler.php =================================================================== diff -u -N -r4840 -r5219 --- trunk/core/kernel/event_handler.php (.../event_handler.php) (revision 4840) +++ trunk/core/kernel/event_handler.php (.../event_handler.php) (revision 5219) @@ -1,7 +1,7 @@ getPrefixSpecial(true) instead of @@ -25,50 +25,50 @@ * */ class kEventHandler extends kBase { - + /** * In case if event should be handled with mehod, * which name differs from event name, then it * should be specified here. - * key - event name, value - event method + * key - event name, value - event method * * @var Array * @access protected */ var $eventMethods = Array(); - + /** * Defines mapping vs event names and permission names * * @var Array */ var $permMapping = Array(); - + /** * Define alternative event processing method names - * + * * @see $eventMethods * @access protected */ function mapEvents() { - + } - + /** * Allows to override standart permission mapping * */ function mapPermissions() { - + } - + function getPrefixSpecial() { trigger_error('Usage of getPrefixSpecial() this method is forbidden in kEventHandler class children. Use $event->getPrefixSpecial(true); instead', E_USER_ERROR); } - + /** * Set's prefix and special * @@ -82,7 +82,7 @@ $this->mapEvents(); $this->mapPermissions(); } - + /** * Process Event * @@ -93,17 +93,17 @@ { $event_name=$event->Name; if( isset($this->eventMethods[$event_name]) ) $event_name=$this->eventMethods[$event_name]; - + if( method_exists($this,$event_name) ) { $this->$event_name($event); } - else + else { trigger_error('event '.$event->Name.' not implemented in class '.get_class($this).'', E_USER_ERROR); } } - + /** * Sample dummy event * @@ -115,7 +115,7 @@ /*echo 'building:
'; print_pre($event);*/ } - + /** * Returns to previous template in opener stack * @@ -125,7 +125,7 @@ { $event->SetRedirectParam('opener', 'u'); } - + /** * Apply some special processing to * object beeing recalled before using @@ -139,7 +139,7 @@ { // processing here } - + /** * Creates new event as child of * event passed as $event param @@ -157,7 +157,7 @@ $child_event->Name = $name; return $child_event; } - + /** * Created url part for this module * @@ -168,29 +168,29 @@ $prefix_special = $event->getPrefixSpecial(); $url_params = $event->getEventParam('url_params'); $pass_events = $event->getEventParam('pass_events'); - + $query_vars = $this->Application->getUnitOption($event->Prefix, 'QueryString'); - + $event_key = array_search('event', $query_vars); if ($event_key) { // pass through event of this prefix unset($query_vars[$event_key]); } - + if (!getArrayValue($url_params, $prefix_special.'_event')) { // if empty event, then remove it from url unset( $url_params[$prefix_special.'_event'] ); } - + //if pass events is off and event is not implicity passed if ( !$pass_events && !isset($url_params[$prefix_special.'_event']) ) { unset($url_params[$prefix_special.'_event']); // remove event from url if requested //otherwise it will use value from get_var } - + if(!$query_vars) return true; - + $processed_params = Array(); foreach($query_vars as $index => $var_name) { @@ -199,42 +199,42 @@ $processed_params[$var_name] = isset( $url_params[$var_name] ) ? $url_params[$var_name] : $this->Application->GetVar($var_name); if ( isset($url_params[$var_name]) ) unset( $url_params[$var_name] ); } - + $ret = ''; - + if($processed_params[$prefix_special.'_Page'] > 1) { $ret .= $processed_params[$prefix_special.'_Page'].'/'; } - + if ($processed_params[$prefix_special.'_id']) { - + // this allows to fill 3 cache records with one query (see this method for details) $category_id = isset($url_params['m_cat_id']) ? $url_params['m_cat_id'] : $this->Application->GetVar('m_cat_id'); $category_filename = $this->Application->getFilename('c', $category_id); - + // if template is also item template of category, then remove template $template = getArrayValue($url_params, 't'); $item_template = $this->Application->getCache('item_templates', $category_id); if ($template == $item_template || strtolower($template) == '__default__') { unset($url_params['t']); } - + // get item's filename $filename = $this->Application->getFilename($event->Prefix, $processed_params[$prefix_special.'_id'] ); if($filename !== false) $ret .= $filename.'/'; } - + if( getArrayValue($processed_params, $prefix_special.'_Reviews_Page') > 1) { if($processed_params[$prefix_special.'_id']) $ret = rtrim($ret, '/'); $ret .= '_'.$processed_params[$prefix_special.'_Reviews_Page'].'/'; } - + $event->setEventParam('url_params', $url_params); $event->setEventParam('env_string', strtolower($ret) ); } - + /** * Process mod_rewrite url part left after previous parser * @@ -243,9 +243,9 @@ function ParseEnv(&$event) { // /_ - + $url_parts = $event->getEventParam('url_parts'); - + $defaults = Array('id' => 0, 'Page' => 1, 'Reviews_Page' => 1); foreach ($defaults as $var_name => $var_value) { @@ -255,30 +255,30 @@ // $event->status = erFAIL; return false; } - + $ret = ''; $url_part = array_shift($url_parts); - + // match module page if( is_numeric($url_part) ) { $this->Application->SetVar( $event->getPrefixSpecial().'_Page', $url_part); $url_part = $url_parts ? array_shift($url_parts) : ''; } - + if (!$url_part) { $event->setEventParam('url_parts', $url_parts); // $event->status = erFAIL; return true; } - + // match module reviews page if( preg_match('/(.*)_([\d]+)$/', $url_part, $rets) ) { $url_part = $rets[1]; $this->Application->SetVar( $event->getPrefixSpecial().'_Reviews_Page', $rets[2]); } - + // match item's filename $db =& $this->Application->GetADODBConnection(); $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); @@ -288,19 +288,19 @@ LEFT JOIN '.TABLE_PREFIX.'CategoryItems cat_items ON item_table.ResourceId = cat_items.ItemResourceId WHERE (item_table.Filename = '.$db->qstr($url_part).') AND (cat_items.CategoryId = '.$this->Application->GetVar('m_cat_id').')'; $item_id = $db->GetOne($sql); - if($item_id !== false) + if($item_id !== false) { $this->Application->SetVar($event->getPrefixSpecial().'_id', $item_id); } - else + elseif ($url_part !== 'index') // otherwise category/index.html is parsed as /index.tpl { array_unshift($url_parts, $url_part); $event->status = erFAIL; } - + $event->setEventParam('url_parts', $url_parts); } - + /** * Checks permissions of user * @@ -311,7 +311,7 @@ $perm_helper =& $this->Application->recallObject('PermissionsHelper'); return $perm_helper->CheckEventPermission($event, $this->permMapping); } - + /** * Occurs, when config was parsed, allows to change config data dynamically * @@ -321,7 +321,7 @@ { // readonly, for hooking only! } - + } Index: trunk/kernel/units/categories/categories_config.php =================================================================== diff -u -N -r5185 -r5219 --- trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 5185) +++ trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 5219) @@ -6,11 +6,11 @@ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'CategoriesEventHandler','file'=>'categories_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'CategoriesTagProcessor','file'=>'categories_tag_processor.php','build_event'=>'OnBuild'), - + 'RegisterClasses' => Array( Array('pseudo' => 'kPermCacheUpdater','class' => 'kPermCacheUpdater', 'file' => 'cache_updater.php','build_event'=>''), ), - + 'AutoLoad' => true, 'QueryString' => Array( 1 => 'id', @@ -26,12 +26,12 @@ ), ), 'IDField' => 'CategoryId', - + 'StatusField' => Array('Status'), - + 'TitleField' => 'Name', // field, used in bluebar when editing existing item 'ItemType' => 1, // used for custom fields only - + 'StatisticsInfo' => Array( 'pending' => Array( 'icon' => 'icon16_cat_pending.gif', @@ -41,7 +41,7 @@ 'status' => STATUS_PENDING, ), ), - + 'TableName' => TABLE_PREFIX.'Category', 'ViewMenuPhrase' => 'la_text_Categories', @@ -52,22 +52,22 @@ 'new_titlefield' => Array('c' => '!la_title_New_Category!'), ), 'category_list' => Array('prefixes' => Array('c_List'), 'format' => "!la_title_Categories! (#c_recordcount#)"), - + 'catalog' => Array('prefixes' => Array('c_List'), 'format' => "!la_title_Categories! (#c_recordcount#)"), - + 'categories_edit' => Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_General!"), 'categories_properties' => Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Properties!"), 'categories_custom' => Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Custom!"), - + 'categories_update' => Array('prefixes' => Array(), 'format' => "!la_title_UpdatingCategories! "), - + 'tree_site' => Array('format' => '!la_selecting_categories!'), ), 'PermItemPrefix' => 'CATEGORY', 'PermSection' => Array('main' => 'CATEGORY:in-portal:categories', /*'search' => 'in-portal:configuration_search',*/ 'email' => 'in-portal:configuration_email', 'custom' => 'in-portal:configuration_custom'), - + 'Sections' => Array( // "Structure & Data" section 'in-portal:site' => Array( @@ -89,7 +89,7 @@ 'priority' => 1, 'type' => stTREE, ), - + 'in-portal:browse_new' => Array( 'parent' => 'in-portal:site', 'icon' => 'catalog', @@ -163,7 +163,7 @@ ), ), - + 'FilterMenu' => Array( 'Groups' => Array( Array('mode' => 'AND', 'filters' => Array('show_active','show_pending','show_disabled'), 'type' => WHERE_FILTER), @@ -179,7 +179,7 @@ 'show_pick' => Array('label' => 'la_prompt_EditorsPick', 'on_sql' => '', 'off_sql' => '`EditorsPick` != 1' ), ) ), - + 'ListSQLs' => Array( ''=> ' SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'PermCache ON '.TABLE_PREFIX.'PermCache.CategoryId = %1$s.CategoryId @@ -198,7 +198,7 @@ 'Sorting' => Array('Name' => 'asc'), ) ), - + 'CalculatedFields' => Array( '' => Array( 'CurrentSort' => "REPLACE(ParentPath, CONCAT('|', ".'%1$s'.".CategoryId, '|'), '')", @@ -254,7 +254,7 @@ ), ), - + 'ConfigMapping' => Array( 'PerPage' => 'Perpage_Category', 'DefaultSorting1Field' => 'Category_Sortfield', Index: trunk/kernel/units/reviews/reviews_event_handler.php =================================================================== diff -u -N -r4689 -r5219 --- trunk/kernel/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 4689) +++ trunk/kernel/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 5219) @@ -1,6 +1,6 @@ Name == 'OnAddReview') { $item_prefix = $this->getPermPrefix($event); - return $this->Application->CheckPermission($item_prefix.'.REVIEW.PENDING', 0) || $this->Application->CheckPermission($item_prefix.'.REVIEW', 0); + $res = $this->Application->CheckPermission($item_prefix.'.REVIEW.PENDING', 0) || $this->Application->CheckPermission($item_prefix.'.REVIEW', 0); + if (!$res) { + $event->status = erPERM_FAIL; + } + return $res; } - + return parent::CheckPermission($event); } - + /** * Returns prefix for permissions * @@ -27,11 +31,11 @@ $main_prefix = $this->Application->GetTopmostPrefix($event->Prefix); // this will return LINK for l, ARTICLE for n, TOPIC for bb, PRODUCT for p $item_prefix = $this->Application->getUnitOption($main_prefix, 'PermItemPrefix'); - + return $item_prefix; } - - + + /** * Apply any custom changes to list's sql query * @@ -47,17 +51,26 @@ case 'showall': $object->clearFilters(); break; - + case 'products': $object->removeFilter('parent_filter'); // this is important $object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId'); // $object->addFilter('active', '%1$s.Status = 1'); - + /*$this->Application->setUnitOption('p', 'AutoLoad', true); $product =& $this->Application->recallObject('p'); $object->addFilter('current_product', 'pr.ResourceId = '.$product->GetDBField('ResourceId'));*/ break; - + + case 'item': + $object->clearFilters(); + $info = $object->getLinkedInfo(); + $this->Application->setUnitOption($info['ParentPrefix'], 'AutoLoad', true); + $parent =& $this->Application->recallObject($info['ParentPrefix']); + $object->addFilter('item_reviews', '%1$s.ItemId = '.$parent->GetDBField('ResourceId')); + $object->addFilter('active', '%1$s.Status = 1'); + break; + case 'product': $object->clearFilters(); $object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId'); @@ -68,7 +81,7 @@ break; } - + if($event->getEventParam('type') == 'current_user') { $user_id = $this->Application->GetVar('u_id') ? $this->Application->GetVar('u_id') : -2; @@ -79,10 +92,10 @@ $object->addFilter('current_item', '%1$s.ItemId = '.$product_info['ParentId']); $object->addFilter('current_user', '%1$s.CreatedById = '.$user_id); $object->addFilter('current_ip', '%1$s.IPAddress = "'.$ip.'"'); - + } } - + /** * Adds review from front in case if user is logged in * @@ -95,79 +108,82 @@ $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); $object =& $event->getObject(); - $item_info = $this->Application->GetVar('rev_product'); - $product_info = $object->getLinkedInfo(); - + + $parent_info = $object->getLinkedInfo(); + $review_fields = $this->Application->GetVar($event->getPrefixSpecial(true)); + $sql = ' SELECT * FROM '.TABLE_PREFIX.'SpamControl - WHERE ItemResourceId='.$product_info['ParentId'].' + WHERE ItemResourceId='.$parent_info['ParentId'].' AND IPaddress="'.$_SERVER['REMOTE_ADDR'].'" AND PortalUserId='.$user_id.' AND DataType="Review"'; $res = $this->Conn->GetRow($sql); - + if( $res && $res['Expire'] < adodb_mktime() ) { $sql = ' DELETE FROM '.TABLE_PREFIX.'SpamControl - WHERE ItemResourceId='.$product_info['ParentId'].' + WHERE ItemResourceId='.$parent_info['ParentId'].' AND IPaddress="'.$_SERVER['REMOTE_ADDR'].'" AND PortalUserId='.$user_id.' AND DataType="Review"'; $this->Conn->Query($sql); unset($res); } - + if(!$res) { - $object->SetFieldsFromHash( array_shift($item_info) ); + $object->SetFieldsFromHash( array_shift($review_fields) ); $object->SetDBField('CreatedById', $user_id); $object->SetDBField('IPAddress', $_SERVER['REMOTE_ADDR']); $object->SetDBField('CreatedOn', adodb_mktime()); - - if( $this->Application->CheckPermission('PRODUCT.REVIEW.PENDING', 0) ) + + $module_info = $this->Application->findModule('Var',$parent_info['ParentPrefix']); + $object->SetDBField('Module', $module_info['Name']); + if( $this->Application->CheckPermission( $this->getPermPrefix($event).'REVIEW.PENDING', 0) ) { $object->SetDBField('Status', 2); } - elseif( $this->Application->CheckPermission('PRODUCT.REVIEW', 0) ) + if( $this->Application->CheckPermission($this->getPermPrefix($event).'REVIEW', 0) ) { $object->SetDBField('Status', 1); } - - $object->SetDBField('ItemId', $product_info['ParentId']); - + + $object->SetDBField('ItemId', $parent_info['ParentId']); + $event->CallSubEvent('OnCreate'); - + if($event->status == erSUCCESS) { - $product_object =& $this->Application->recallObject('p'); + $parent =& $this->Application->recallObject($parent_info['ParentPrefix']); $sql = ' SELECT COUNT(ReviewId) FROM '.$object->TableName.' - WHERE ItemId='.$product_info['ParentId']; + WHERE ItemId='.$parent_info['ParentId']; $review_qty = $this->Conn->GetOne($sql); - $product_object->SetDBField('CachedReviewsQty', $review_qty); - $product_object->Update(); + $parent->SetDBField('CachedReviewsQty', $review_qty); + $parent->Update(); $expire = adodb_mktime() + $this->Application->ConfigValue('product_ReviewDelay_Value') * $this->Application->ConfigValue('product_ReviewDelay_Interval'); $sql = ' INSERT INTO '.TABLE_PREFIX.'SpamControl (ItemResourceId, IPaddress, PortalUserId, DataType, Expire) - VALUES ('.$product_info['ParentId'].', + VALUES ('.$parent_info['ParentId'].', "'.$_SERVER['REMOTE_ADDR'].'", '.$user_id.', "Review", '.$expire.')'; $this->Conn->Query($sql); - - $event->redirect_params = Array('pass' => 'all,p'); + + $event->redirect_params = Array('pass' => 'all,'.$parent_info['ParentPrefix']); $event->redirect = $this->Application->GetVar('success_template'); - } + } } - else + else { - $this->Application->removeObject($event->getPrefixSpecial()); +// $this->Application->removeObject($event->getPrefixSpecial()); $event->status == erFAIL; $event->redirect=false; $object->FieldErrors['ReviewText']['pseudo'] = 'too_frequent'; $object->ErrorMsgs['too_frequent'] = $this->Application->Phrase('lu_ferror_review_duplicate'); } - } + } } ?> \ No newline at end of file Index: trunk/core/kernel/event_manager.php =================================================================== diff -u -N -r4845 -r5219 --- trunk/core/kernel/event_manager.php (.../event_manager.php) (revision 4845) +++ trunk/core/kernel/event_manager.php (.../event_manager.php) (revision 5219) @@ -278,6 +278,8 @@ if ($event->status == erPERM_FAIL) { $event->redirect = $this->Application->IsAdmin() ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate'); + $event->redirect_params['pass'] = 'm'; + $event->redirect_params['m_cat_id'] = 0; // restore stuff, that processOpener() changed $this->Application->RestoreVar('opener_stack'); Index: trunk/core/kernel/parser/tags.php =================================================================== diff -u -N -r4330 -r5219 --- trunk/core/kernel/parser/tags.php (.../tags.php) (revision 4330) +++ trunk/core/kernel/parser/tags.php (.../tags.php) (revision 5219) @@ -14,7 +14,7 @@ } function &GetTag($tag_data, &$parser, $inp_tag = 0) - { + { if (!isset($this->_Tag)) { $this->_Tag =& new Tag($tag_data, $parser, $inp_tag); } @@ -150,6 +150,7 @@ function ParseTagData($tag_data) { if (defined('EXPERIMENTAL_PRE_PARSE') ) { + $this->OriginalTagData = $tag_data; $tag_data = $this->PreParseReplaceParams($tag_data) . ' '; } else { @@ -291,7 +292,13 @@ function GetCode($echo=false) { - $pass_params = $this->NP; + $tmp_params = $this->NamedParams; + $splited = split("[ \t\n]{1}", $this->OriginalTagData, 2); + if (isset($splited[1]) && $splited[1]) { + $this->ParseNamedParams($splited[1]); + } + $pass_params = $this->NamedParams; + $this->NamedParams = $tmp_params; $code = Array(); @@ -346,13 +353,13 @@ case 'endif': $code[] = ' }'; return $code; - + case 'else': $code[] = ' }'; $code[] = ' else {'; return $code; } - + $code[] = '$tmp = $application->processPrefix("'.$this->getPrefixSpecial().'");'."\n"; $code[] = '$__tp = $tmp[\'prefix\'].\'_TagProcessor\';'."\n"; $code[] = '$p =& $application->recallObject($__tp);'."\n"; Index: trunk/core/units/reviews/reviews_event_handler.php =================================================================== diff -u -N -r4689 -r5219 --- trunk/core/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 4689) +++ trunk/core/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 5219) @@ -1,6 +1,6 @@ Name == 'OnAddReview') { $item_prefix = $this->getPermPrefix($event); - return $this->Application->CheckPermission($item_prefix.'.REVIEW.PENDING', 0) || $this->Application->CheckPermission($item_prefix.'.REVIEW', 0); + $res = $this->Application->CheckPermission($item_prefix.'.REVIEW.PENDING', 0) || $this->Application->CheckPermission($item_prefix.'.REVIEW', 0); + if (!$res) { + $event->status = erPERM_FAIL; + } + return $res; } - + return parent::CheckPermission($event); } - + /** * Returns prefix for permissions * @@ -27,11 +31,11 @@ $main_prefix = $this->Application->GetTopmostPrefix($event->Prefix); // this will return LINK for l, ARTICLE for n, TOPIC for bb, PRODUCT for p $item_prefix = $this->Application->getUnitOption($main_prefix, 'PermItemPrefix'); - + return $item_prefix; } - - + + /** * Apply any custom changes to list's sql query * @@ -47,17 +51,26 @@ case 'showall': $object->clearFilters(); break; - + case 'products': $object->removeFilter('parent_filter'); // this is important $object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId'); // $object->addFilter('active', '%1$s.Status = 1'); - + /*$this->Application->setUnitOption('p', 'AutoLoad', true); $product =& $this->Application->recallObject('p'); $object->addFilter('current_product', 'pr.ResourceId = '.$product->GetDBField('ResourceId'));*/ break; - + + case 'item': + $object->clearFilters(); + $info = $object->getLinkedInfo(); + $this->Application->setUnitOption($info['ParentPrefix'], 'AutoLoad', true); + $parent =& $this->Application->recallObject($info['ParentPrefix']); + $object->addFilter('item_reviews', '%1$s.ItemId = '.$parent->GetDBField('ResourceId')); + $object->addFilter('active', '%1$s.Status = 1'); + break; + case 'product': $object->clearFilters(); $object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId'); @@ -68,7 +81,7 @@ break; } - + if($event->getEventParam('type') == 'current_user') { $user_id = $this->Application->GetVar('u_id') ? $this->Application->GetVar('u_id') : -2; @@ -79,10 +92,10 @@ $object->addFilter('current_item', '%1$s.ItemId = '.$product_info['ParentId']); $object->addFilter('current_user', '%1$s.CreatedById = '.$user_id); $object->addFilter('current_ip', '%1$s.IPAddress = "'.$ip.'"'); - + } } - + /** * Adds review from front in case if user is logged in * @@ -95,79 +108,82 @@ $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); $object =& $event->getObject(); - $item_info = $this->Application->GetVar('rev_product'); - $product_info = $object->getLinkedInfo(); - + + $parent_info = $object->getLinkedInfo(); + $review_fields = $this->Application->GetVar($event->getPrefixSpecial(true)); + $sql = ' SELECT * FROM '.TABLE_PREFIX.'SpamControl - WHERE ItemResourceId='.$product_info['ParentId'].' + WHERE ItemResourceId='.$parent_info['ParentId'].' AND IPaddress="'.$_SERVER['REMOTE_ADDR'].'" AND PortalUserId='.$user_id.' AND DataType="Review"'; $res = $this->Conn->GetRow($sql); - + if( $res && $res['Expire'] < adodb_mktime() ) { $sql = ' DELETE FROM '.TABLE_PREFIX.'SpamControl - WHERE ItemResourceId='.$product_info['ParentId'].' + WHERE ItemResourceId='.$parent_info['ParentId'].' AND IPaddress="'.$_SERVER['REMOTE_ADDR'].'" AND PortalUserId='.$user_id.' AND DataType="Review"'; $this->Conn->Query($sql); unset($res); } - + if(!$res) { - $object->SetFieldsFromHash( array_shift($item_info) ); + $object->SetFieldsFromHash( array_shift($review_fields) ); $object->SetDBField('CreatedById', $user_id); $object->SetDBField('IPAddress', $_SERVER['REMOTE_ADDR']); $object->SetDBField('CreatedOn', adodb_mktime()); - - if( $this->Application->CheckPermission('PRODUCT.REVIEW.PENDING', 0) ) + + $module_info = $this->Application->findModule('Var',$parent_info['ParentPrefix']); + $object->SetDBField('Module', $module_info['Name']); + if( $this->Application->CheckPermission( $this->getPermPrefix($event).'REVIEW.PENDING', 0) ) { $object->SetDBField('Status', 2); } - elseif( $this->Application->CheckPermission('PRODUCT.REVIEW', 0) ) + if( $this->Application->CheckPermission($this->getPermPrefix($event).'REVIEW', 0) ) { $object->SetDBField('Status', 1); } - - $object->SetDBField('ItemId', $product_info['ParentId']); - + + $object->SetDBField('ItemId', $parent_info['ParentId']); + $event->CallSubEvent('OnCreate'); - + if($event->status == erSUCCESS) { - $product_object =& $this->Application->recallObject('p'); + $parent =& $this->Application->recallObject($parent_info['ParentPrefix']); $sql = ' SELECT COUNT(ReviewId) FROM '.$object->TableName.' - WHERE ItemId='.$product_info['ParentId']; + WHERE ItemId='.$parent_info['ParentId']; $review_qty = $this->Conn->GetOne($sql); - $product_object->SetDBField('CachedReviewsQty', $review_qty); - $product_object->Update(); + $parent->SetDBField('CachedReviewsQty', $review_qty); + $parent->Update(); $expire = adodb_mktime() + $this->Application->ConfigValue('product_ReviewDelay_Value') * $this->Application->ConfigValue('product_ReviewDelay_Interval'); $sql = ' INSERT INTO '.TABLE_PREFIX.'SpamControl (ItemResourceId, IPaddress, PortalUserId, DataType, Expire) - VALUES ('.$product_info['ParentId'].', + VALUES ('.$parent_info['ParentId'].', "'.$_SERVER['REMOTE_ADDR'].'", '.$user_id.', "Review", '.$expire.')'; $this->Conn->Query($sql); - - $event->redirect_params = Array('pass' => 'all,p'); + + $event->redirect_params = Array('pass' => 'all,'.$parent_info['ParentPrefix']); $event->redirect = $this->Application->GetVar('success_template'); - } + } } - else + else { - $this->Application->removeObject($event->getPrefixSpecial()); +// $this->Application->removeObject($event->getPrefixSpecial()); $event->status == erFAIL; $event->redirect=false; $object->FieldErrors['ReviewText']['pseudo'] = 'too_frequent'; $object->ErrorMsgs['too_frequent'] = $this->Application->Phrase('lu_ferror_review_duplicate'); } - } + } } ?> \ No newline at end of file Index: trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/config.php =================================================================== diff -u -N -r5050 -r5219 --- trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/config.php (.../config.php) (revision 5050) +++ trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/config.php (.../config.php) (revision 5219) @@ -1,20 +1,20 @@ -CreateHtml() ; } - + function CreateHtml() { $HtmlValue = htmlspecialchars( $this->Value ) ; $Html = '
' ; - + if ( $this->IsCompatible() ) { $Link = "{$this->BasePath}editor/fckeditor.html?InstanceName={$this->InstanceName}" ; - + if ( $this->ToolbarSet != '' ) $Link .= "&Toolbar={$this->ToolbarSet}" ; @@ -84,7 +84,7 @@ } $Html .= '
' ; - + return $Html ; } @@ -117,23 +117,23 @@ $sParams .= '&' ; else $bFirst = false ; - + if ( $sValue === true ) $sParams .= $this->EncodeConfig( $sKey ) . '=true' ; else if ( $sValue === false ) $sParams .= $this->EncodeConfig( $sKey ) . '=false' ; else $sParams .= $this->EncodeConfig( $sKey ) . '=' . $this->EncodeConfig( $sValue ) ; } - + return $sParams ; } function EncodeConfig( $valueToEncode ) { - $chars = array( - '&' => '%26', - '=' => '%3D', + $chars = array( + '&' => '%26', + '=' => '%3D', '"' => '%22' ) ; return strtr( $valueToEncode, $chars ) ; Index: trunk/core/units/reviews/reviews_config.php =================================================================== diff -u -N -r5206 -r5219 --- trunk/core/units/reviews/reviews_config.php (.../reviews_config.php) (revision 5206) +++ trunk/core/units/reviews/reviews_config.php (.../reviews_config.php) (revision 5219) @@ -1,43 +1,48 @@ 'rev', - + 'Clones' => Array( - - 'l-rev' => Array('ParentPrefix' => 'l'), - 'n-rev' => Array('ParentPrefix' => 'n'), - 'bb-rev'=> Array('ParentPrefix' => 'bb'), + 'l-rev' => Array( + 'ParentPrefix' => 'l', + ), + 'n-rev' => Array( + 'ParentPrefix' => 'n', + ), + 'bb-rev'=> Array( + 'ParentPrefix' => 'bb', + ), /*'p-rev' => Array('ParentPrefix' => 'p'),*/ ), - + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'ReviewsEventHandler','file'=>'reviews_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'ReviewsTagProcessor','file'=>'reviews_tag_processor.php','build_event'=>'OnBuild'), 'AutoLoad' => true, - + 'QueryString' => Array( 1 => 'id', 2 => 'page', 3 => 'event', ), - - + + 'ParentPrefix' => 'p', // replace all usage of rev to "p-rev" and then remove this param from here and Prefix too - + 'IDField' => 'ReviewId', 'StatusField' => Array('Status'), // field, that is affected by Approve/Decline events 'TableName' => TABLE_PREFIX.'ItemReview', 'ParentTableKey' => 'ResourceId', // linked field in master table 'ForeignKey' => 'ItemId', // linked field in subtable - + 'AutoDelete' => true, 'AutoClone' => true, - + 'TitlePresets' => Array( 'reviews_edit' => Array('format' => "!la_title_Editing_Review!"), - ), + ), 'FilterMenu' => Array( 'Groups' => Array( Array('mode' => 'AND', 'filters' => Array('show_active','show_pending','show_disabled'), 'type' => WHERE_FILTER), @@ -48,7 +53,7 @@ 'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Status != 0' ), ) ), - + 'CalculatedFields' => Array( '' => Array( 'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', @@ -63,31 +68,31 @@ 'ItemName' => 'pr.l1_Name', 'ProductId' => 'pr.ProductId', ), - + ), - - // key - special, value - list select sql + + // key - special, value - list select sql 'ListSQLs' => Array( ''=>'SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById', - + 'products' => ' SELECT %1$s.* %2$s FROM %1$s, '.TABLE_PREFIX.'Products pr LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById', - + 'product' => ' SELECT %1$s.* %2$s FROM %1$s, '.TABLE_PREFIX.'Products pr LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById', ), 'ItemSQLs' => Array( ''=> 'SELECT * FROM %s'), - - 'ListSortings' => Array( + + 'ListSortings' => Array( '' => Array( 'ForcedSorting' => Array('Priority' => 'desc'), 'Sorting' => Array('CreatedOn' => 'desc'), ) - ), - + ), + 'Fields' => Array( 'ReviewId' => Array('type'=>'int'), 'CreatedOn' => Array('formatter'=>'kDateFormatter','not_null'=>1,'default'=>'#NOW#'), @@ -104,7 +109,7 @@ 'VirtualFields' => Array( 'ReviewedBy' => Array(), ), - + 'Grids' => Array( 'Default' => Array( 'Icons' => Array('default'=>'icon16_custom.gif',1=>'icon16_review.gif',2=>'icon16_review_pending.gif',0=>'icon16_review_disabled.gif'), 'Fields' => Array( @@ -113,17 +118,17 @@ 'CreatedOn_formatted' => Array( 'title'=>'la_col_CreatedOn', 'sort_field' => 'CreatedOn' ), 'Status' => Array( 'title'=>'la_col_Status' ), ), - + ), - + 'ReviewsSection' => Array( 'Icons' => Array('default'=>'icon16_custom.gif',1=>'icon16_review.gif',2=>'icon16_review_pending.gif',0=>'icon16_review_disabled.gif'), 'Fields' => Array( 'ReviewText' => Array( 'title'=>'la_col_ReviewText', 'data_block' => 'grid_checkbox_namelink_td'), 'ReviewedBy' => Array( 'title'=>'la_col_ReviewedBy' ), 'CreatedOn_formatted' => Array( 'title'=>'la_col_CreatedOn', 'sort_field' => 'CreatedOn' ), 'Status' => Array( 'title'=>'la_col_Status' ), ), - + ), ), ); Index: trunk/kernel/units/reviews/reviews_config.php =================================================================== diff -u -N -r5206 -r5219 --- trunk/kernel/units/reviews/reviews_config.php (.../reviews_config.php) (revision 5206) +++ trunk/kernel/units/reviews/reviews_config.php (.../reviews_config.php) (revision 5219) @@ -1,43 +1,48 @@ 'rev', - + 'Clones' => Array( - - 'l-rev' => Array('ParentPrefix' => 'l'), - 'n-rev' => Array('ParentPrefix' => 'n'), - 'bb-rev'=> Array('ParentPrefix' => 'bb'), + 'l-rev' => Array( + 'ParentPrefix' => 'l', + ), + 'n-rev' => Array( + 'ParentPrefix' => 'n', + ), + 'bb-rev'=> Array( + 'ParentPrefix' => 'bb', + ), /*'p-rev' => Array('ParentPrefix' => 'p'),*/ ), - + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'ReviewsEventHandler','file'=>'reviews_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'ReviewsTagProcessor','file'=>'reviews_tag_processor.php','build_event'=>'OnBuild'), 'AutoLoad' => true, - + 'QueryString' => Array( 1 => 'id', 2 => 'page', 3 => 'event', ), - - + + 'ParentPrefix' => 'p', // replace all usage of rev to "p-rev" and then remove this param from here and Prefix too - + 'IDField' => 'ReviewId', 'StatusField' => Array('Status'), // field, that is affected by Approve/Decline events 'TableName' => TABLE_PREFIX.'ItemReview', 'ParentTableKey' => 'ResourceId', // linked field in master table 'ForeignKey' => 'ItemId', // linked field in subtable - + 'AutoDelete' => true, 'AutoClone' => true, - + 'TitlePresets' => Array( 'reviews_edit' => Array('format' => "!la_title_Editing_Review!"), - ), + ), 'FilterMenu' => Array( 'Groups' => Array( Array('mode' => 'AND', 'filters' => Array('show_active','show_pending','show_disabled'), 'type' => WHERE_FILTER), @@ -48,7 +53,7 @@ 'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Status != 0' ), ) ), - + 'CalculatedFields' => Array( '' => Array( 'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', @@ -63,31 +68,31 @@ 'ItemName' => 'pr.l1_Name', 'ProductId' => 'pr.ProductId', ), - + ), - - // key - special, value - list select sql + + // key - special, value - list select sql 'ListSQLs' => Array( ''=>'SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById', - + 'products' => ' SELECT %1$s.* %2$s FROM %1$s, '.TABLE_PREFIX.'Products pr LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById', - + 'product' => ' SELECT %1$s.* %2$s FROM %1$s, '.TABLE_PREFIX.'Products pr LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById', ), 'ItemSQLs' => Array( ''=> 'SELECT * FROM %s'), - - 'ListSortings' => Array( + + 'ListSortings' => Array( '' => Array( 'ForcedSorting' => Array('Priority' => 'desc'), 'Sorting' => Array('CreatedOn' => 'desc'), ) - ), - + ), + 'Fields' => Array( 'ReviewId' => Array('type'=>'int'), 'CreatedOn' => Array('formatter'=>'kDateFormatter','not_null'=>1,'default'=>'#NOW#'), @@ -104,7 +109,7 @@ 'VirtualFields' => Array( 'ReviewedBy' => Array(), ), - + 'Grids' => Array( 'Default' => Array( 'Icons' => Array('default'=>'icon16_custom.gif',1=>'icon16_review.gif',2=>'icon16_review_pending.gif',0=>'icon16_review_disabled.gif'), 'Fields' => Array( @@ -113,17 +118,17 @@ 'CreatedOn_formatted' => Array( 'title'=>'la_col_CreatedOn', 'sort_field' => 'CreatedOn' ), 'Status' => Array( 'title'=>'la_col_Status' ), ), - + ), - + 'ReviewsSection' => Array( 'Icons' => Array('default'=>'icon16_custom.gif',1=>'icon16_review.gif',2=>'icon16_review_pending.gif',0=>'icon16_review_disabled.gif'), 'Fields' => Array( 'ReviewText' => Array( 'title'=>'la_col_ReviewText', 'data_block' => 'grid_checkbox_namelink_td'), 'ReviewedBy' => Array( 'title'=>'la_col_ReviewedBy' ), 'CreatedOn_formatted' => Array( 'title'=>'la_col_CreatedOn', 'sort_field' => 'CreatedOn' ), 'Status' => Array( 'title'=>'la_col_Status' ), ), - + ), ), ); Index: trunk/kernel/units/general/cat_event_handler.php =================================================================== diff -u -N -r5218 -r5219 --- trunk/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5218) +++ trunk/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5219) @@ -4,7 +4,7 @@ $application->Factory->includeClassFile('kDBEventHandler'); class kCatDBEventHandler extends InpDBEventHandler { - + /** * Allows to override standart permission mapping * @@ -19,7 +19,7 @@ ); $this->permMapping = array_merge($this->permMapping, $permissions); } - + /** * Checks permissions of user * @@ -33,21 +33,21 @@ return true; } } - + if ($event->Name == 'OnExport') { // save category_id before doing export $this->Application->LinkVar('m_cat_id'); } - + if ($event->Name == 'OnNew' && preg_match('/(.*)\/import$/', $this->Application->GetVar('t'), $rets)) { // redirect to item import template, where permission (import) category will be chosen) $root_category = $this->Application->findModule('Path', $rets[1].'/', 'RootCat'); $this->Application->StoreVar('m_cat_id', $root_category); } - + return parent::CheckPermission($event); } - + function OnCopy(&$event) { $object = $event->getObject(); @@ -91,7 +91,7 @@ } else { // mode == cut $object =& $this->Application->recallObject($event->getPrefixSpecial().'.item', $event->Prefix, Array('skip_autoload' => true)); - + foreach ($ids_arr as $id) { $object->Load($id); $object->MoveToCat(); @@ -449,15 +449,15 @@ if (!$property_map) { return ; } - + // new items $object->addCalculatedField('IsNew', ' IF(%1$s.NewItem = 2, IF(%1$s.CreatedOn >= (UNIX_TIMESTAMP() - '. $this->Application->ConfigValue($property_map['NewDays']). '*3600*24), 1, 0), %1$s.NewItem )'); - + // hot items (cache updated every hour) $sql = 'SELECT Data FROM '.TABLE_PREFIX.'Cache @@ -470,7 +470,7 @@ IF(%1$s.'.$property_map['ClickField'].' >= '.$hot_limit.', 1, 0), %1$s.HotItem )'); - + // popular items $object->addCalculatedField('IsPop', ' IF(%1$s.PopItem = 2, IF(%1$s.CachedVotesQty >= '. @@ -479,14 +479,17 @@ $this->Application->ConfigValue($property_map['MinPopRating']). ', 1, 0), %1$s.PopItem)'); - + } function CalculateHotLimit(&$event) { $property_map = $this->Application->getUnitOption($event->Prefix, 'ItemPropertyMappings'); + if (!$property_map) { + return; + } $click_field = $property_map['ClickField']; - + $last_hot = $this->Application->ConfigValue($property_map['MaxHotNumber']) - 1; $sql = 'SELECT '.$click_field.' FROM '.$this->Application->getUnitOption($event->Prefix, 'TableName').' ORDER BY '.$click_field.' DESC @@ -495,7 +498,7 @@ $hot_limit = (double)array_shift($res); $this->Conn->Query('REPLACE INTO '.TABLE_PREFIX.'Cache (VarName, Data, Cached) VALUES ("'.$property_map['HotLimit'].'", "'.$hot_limit.'", '.adodb_mktime().')'); return $hot_limit; - + return 0; } @@ -583,7 +586,7 @@ $this->Conn->doInsert($fields_hash, TABLE_PREFIX.'SearchLog'); } } - + /** * Makes simple search for products * based on keywords string @@ -624,8 +627,8 @@ // don't save search log, because in-portal already saved it $this->saveToSearchLog($keywords, 0); // 0 - simple search, 1 - advanced search } - - + + $keywords = strtr($keywords, Array('%' => '\\%', '_' => '\\_')); $event->setPseudoClass('_List'); @@ -644,23 +647,23 @@ // field processing $weight_sum = 0; - + $alias_counter = 0; - + $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'; } - + // what field in search config becomes what field in sql (key - new field, value - old field (from searchconfig table)) $search_config_map = Array(); - + foreach ($field_list as $key => $field) { $options = $object->getFieldOptions($field); $local_table = TABLE_PREFIX.$search_config[$field]['TableName']; $weight_sum += $search_config[$field]['Priority']; // counting weight sum; used when making relevance clause - + // processing multilingual fields if (getArrayValue($options, 'formatter') == 'kMultiLanguage') { $field_list[$key] = 'l'.$lang.'_'.$field; @@ -686,16 +689,16 @@ { $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; - + $join_clause = str_replace('{ForeignTable}', $alias, $search_config[$field]['JoinClause']); $join_clause = str_replace('{LocalTable}', $product_table, $join_clause); - + $join_clauses[] = ' LEFT JOIN '.$foreign_table.' '.$alias.' ON '.$join_clause; } @@ -714,7 +717,7 @@ // keyword string processing $search_helper =& $this->Application->recallObject('SearchHelper'); $where_clause = $search_helper->buildWhereClause($keywords, $field_list); - + $where_clause = $where_clause.' AND '.$product_table.'.Status=1'; if($this->Application->GetVar('Action') == 'm_simple_subsearch') // subsearch, In-portal @@ -823,7 +826,7 @@ $product_table = $this->Application->getUnitOption('p', 'TableName'); $search_keywords = $this->Application->GetVar('value'); // will not be changed - + $keywords = $this->Application->GetVar('value'); // will be changed down there $verbs = $this->Application->GetVar('verb'); $glues = $this->Application->GetVar('andor'); @@ -843,13 +846,13 @@ 'isnot' => '(%1$s != %2$s OR %1$s IS NULL)'); $alias_counter = 0; - + $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'; - } - + } + $search_log = ''; $weight_sum = 0; // processing fields and preparing conditions @@ -872,7 +875,7 @@ else { $field_name = $field; } - + // processing fields from other tables if ($foreign_field = $record['ForeignField']) { $exploded = explode(':', $foreign_field, 2); @@ -916,7 +919,7 @@ $local_table = 'custom_data'; $field_name = 'l'.$lang.'_cust_'.array_search($field_name, $custom_fields); } - + $field_name = $local_table.'.'.$field_name; } @@ -1051,16 +1054,16 @@ $or_having_conditions[] = $condition; } } - + // create search log record $search_log_data = Array('search_config' => $record, 'verb' => getArrayValue($verbs, $field), 'value' => ($record['FieldType'] == 'range') ? $search_keywords[$field.'_from'].'|'.$search_keywords[$field.'_to'] : $search_keywords[$field]); $search_log[] = $this->Application->Phrase('la_Field').' "'.$this->getHuman('Field', $search_log_data).'" '.$this->getHuman('Verb', $search_log_data).' '.$this->Application->Phrase('la_Value').' '.$this->getHuman('Value', $search_log_data).' '.$this->Application->Phrase($glues[$field] == 1 ? 'lu_And' : 'lu_Or'); } } - + $search_log = implode('
', $search_log); $search_log = preg_replace('/(.*) '.preg_quote($this->Application->Phrase('lu_and'), '/').'|'.preg_quote($this->Application->Phrase('lu_or'), '/').'$/is', '\\1', $search_log); - $this->saveToSearchLog($search_log, 1); // advanced search + $this->saveToSearchLog($search_log, 1); // advanced search $this->Application->StoreVar('highlight_keywords', serialize($highlight_keywords)); @@ -1128,21 +1131,21 @@ $res = $this->Conn->Query($sql); } - + function getHuman($type, $search_data) { $type = ucfirst(strtolower($type)); extract($search_data); - + switch ($type) { case 'Field': return $this->Application->Phrase($search_config['DisplayName']); break; - + case 'Verb': return $verb ? $this->Application->Phrase('lu_advsearch_'.$verb) : ''; break; - + case 'Value': switch ($search_config['FieldType']) { case 'date': @@ -1152,29 +1155,29 @@ 'last_6_months' => 'lu_comm_Last6Months', 'last_year' => 'lu_comm_LastYear'); $ret = $this->Application->Phrase($values[$value]); break; - + case 'range': $value = explode('|', $value); return $this->Application->Phrase('lu_comm_From').' "'.$value[0].'" '.$this->Application->Phrase('lu_comm_To').' "'.$value[1].'"'; break; - + case 'boolean': $values = Array(1 => 'lu_comm_Yes', 0 => 'lu_comm_No', -1 => 'lu_comm_Both'); $ret = $this->Application->Phrase($values[$value]); - break; - + break; + case 'text': $ret = $value; break; - + } return '"'.$ret.'"'; break; } } - - - + + + /** * Set's correct page for list * based on data provided with event @@ -1314,7 +1317,7 @@ $object =& $event->getObject( Array('skip_autoload' => true) ); $object->SetFieldsFromHash($field_values); $field_values['ImportFilename'] = $object->GetDBField('ImportFilename'); //if upload formatter has renamed the file during moving !!! - + $object->setID($item_id); $this->setRequiredFields($event); @@ -1334,11 +1337,11 @@ $field_values['ExportColumns'] = $field_values['ExportColumns'] ? explode('|', substr($field_values['ExportColumns'], 1, -1) ) : Array(); $field_values['start_from'] = 0; $export_object->saveOptions($event, $field_values); - + if( $export_object->verifyOptions($event) ) { $event->redirect = $this->getModuleFolder($event).'/'.$event->Special.'_progress'; - + } else { @@ -1352,12 +1355,12 @@ $field_values['ImportLocalFilename'] = $filename; $export_object->saveOptions($event, $field_values); } - + $event->status = erFAIL; $event->redirect = false; } } - + /** * Enter description here... * @@ -1367,7 +1370,7 @@ { $this->OnGoBack($event); } - + /** * Sets correct available & export fields * @@ -1450,9 +1453,9 @@ if ($event->Special != 'import') { return false; } - + $object =& $event->getObject(); - + $import_filenames = Array(); if ($folder_handle = opendir(EXPORT_PATH)) { @@ -1464,12 +1467,12 @@ } closedir($folder_handle); } - + $options = $object->GetFieldOptions('ImportLocalFilename'); $options['options'] = $import_filenames; $object->SetFieldOptions('ImportLocalFilename', $options); } - + /** * Returns specific to each item type columns only * @@ -1648,33 +1651,33 @@ else { $category_id = 0; } - + if ($dst_field == 'ImportCategory') { $this->Application->StoreVar('ImportCategory', $category_id); $this->Application->StoreVar($event->getPrefixSpecial().'_ForceNotValid', 1); // not to loose import/export values on form refresh - + $this->Application->SetVar($event->getPrefixSpecial().'_id', 0); $this->Application->SetVar($event->getPrefixSpecial().'_event', 'OnExportBegin'); - + $passed = $this->Application->GetVar('passed'); $this->Application->SetVar('passed', $passed.','.$event->getPrefixSpecial()); $event->setEventParam('pass_events', true); } - + if ($dst_field == 'ItemCategory') { $object =& $event->getObject(); // category item object (e.g. link, product, etc.) - + $ci_prefix = $object->Prefix.'-ci'; $ci_object =& $this->Application->recallObject($ci_prefix, null, Array('skip_autoload' => true)); - + $ci_object->Load($category_id); if (!$ci_object->isLoaded()) { $fields_hash = Array('CategoryId' => $category_id, 'ItemResourceId' => $object->GetDBField('ResourceId')); $ci_object->SetDBFieldsFromHash($fields_hash); $ci_object->Create(true); } } - + $this->finalizePopup($event); } @@ -1689,18 +1692,24 @@ $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); if ($items_info) { list($id, $field_values) = each($items_info); - + $object =& $event->getObject( Array('skip_autoload' => true) ); $object->SetFieldsFromHash($field_values); $field_values['ImportFilename'] = $object->GetDBField('ImportFilename'); //if upload formatter has renamed the file during moving !!! $field_values['ImportSource'] = 2; $field_values['ImportLocalFilename'] = $object->GetDBField('ImportFilename'); $items_info[$id] = $field_values; - + $this->Application->StoreVar($event->getPrefixSpecial().'_ItemsInfo', serialize($items_info)); } } + function OnCancelAction(&$event) + { + $event->redirect_params = Array('pass' => 'all,'.$event->GetPrefixSpecial()); + $event->redirect = $this->Application->GetVar('cancel_template'); + } + /* === RELATED TO IMPORT/EXPORT: END === */ } Index: trunk/kernel/units/reviews/reviews_tag_processor.php =================================================================== diff -u -N -r4309 -r5219 --- trunk/kernel/units/reviews/reviews_tag_processor.php (.../reviews_tag_processor.php) (revision 4309) +++ trunk/kernel/units/reviews/reviews_tag_processor.php (.../reviews_tag_processor.php) (revision 5219) @@ -2,8 +2,6 @@ class ReviewsTagProcessor extends kDBTagProcessor { - - /** * Returns a link for editing product * @@ -55,8 +53,7 @@ function AlreadyReviewed($params) { $user_id = ($this->Application->GetVar('u_id') == 0) ? -2 : $this->Application->GetVar('u_id'); - $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); - $object =& $this->Application->recallObject($this->getPrefixSpecial()); + $object =& $this->Application->recallObject($this->getPrefixSpecial(),null,array('skip_autoload'=>1)); $product_info = $object->getLinkedInfo(); $sql = ' SELECT * FROM '.TABLE_PREFIX.'SpamControl Index: trunk/kernel/units/categories/categories_event_handler.php =================================================================== diff -u -N -r5218 -r5219 --- trunk/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5218) +++ trunk/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5219) @@ -63,7 +63,7 @@ } $object->addFilter('parent_filter', 'ParentId = '.$parent_cat_id); - + $object->addFilter('perm_filter', 'PermId = 1'); // check for CATEGORY.VIEW permission if ($this->Application->GetVar('u_id') > 0) { // apply permission filters to all users except "root" @@ -208,7 +208,7 @@ return parent::getPassedID($event); } - + /** * Rebuilds category cache * @@ -237,7 +237,7 @@ %1$s.NewItem )'); } - + /** * Set correct parent path for newly created categories * @@ -248,12 +248,12 @@ if ($event->getEventParam('temp_id') == 0) { $object =& $this->Application->recallObject($event->Prefix.'.-item', null, Array('skip_autoload' => true, 'live_table' => true)); $object->Load($event->getEventParam('id')); - + $fields_hash = Array('ParentPath' => $object->buildParentPath()); $this->Conn->doUpdate($fields_hash, $object->TableName, 'CategoryId = '.$object->GetID()); } } - + /** * Set cache modification mark if needed * @@ -267,24 +267,24 @@ $this->Application->SetVar('require_cache_update', 1); return ; } - + // existing category was edited, check if in-cache fields are modified $temp_object =& $event->getObject( Array('skip_autoload' => true) ); $temp_object->Load($id); - + $live_object =& $this->Application->recallObject($event->Prefix.'.-item', null, Array('live_table' => true)); $live_object->Load($id); - + $cached_fields = Array('Name', 'Filename', 'CategoryTemplate', 'ItemTemplate'); - + foreach ($cached_fields as $cached_field) { if ($live_object->GetDBField($cached_field) != $temp_object->GetDBField($cached_field)) { $this->Application->SetVar('require_cache_update', 1); break; } } } - + /** * Checks cache update mark and redirect to cache if needed * @@ -300,7 +300,7 @@ $this->Application->StoreVar('opener_stack', serialize($opener_stack)); } } - + /** * Deletes all selected items. * Automatically recurse into sub-items using temp handler, and deletes sub-items Index: trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php =================================================================== diff -u -N -r5182 -r5219 --- trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php (.../commands.php) (revision 5182) +++ trunk/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php (.../commands.php) (revision 5219) @@ -32,15 +32,15 @@ $aFolders[] = $sFile; //echo '' ; } - + if (count($aFolders) > 0) { natcasesort($aFolders); foreach($aFolders AS $k=>$v) { echo '' ; - } + } } - - + + closedir( $oCurrentFolder ) ; // Close the "Folders" node. echo "" ; @@ -49,7 +49,7 @@ function ValidateAdminSid() { $conn = GetADODbConnection(); - $session_time = GetConfigValue('ses_timeout')+0; + $session_time = GetConfigValue('ses_timeout')+0; $sid = ($_COOKIE['admin_sid'])?$_COOKIE['admin_sid']:$_COOKIE['sid']; $sql = "SELECT count( sd.sid ) FROM session_data AS sd @@ -59,7 +59,7 @@ AND sd.sid = '".$sid."' AND s.expire + '".$session_time."' > unix_timestamp()"; if ($conn->GetOne($sql) > 0) { - return true; + return true; } function ValidateUserSid() @@ -68,12 +68,12 @@ $session_time = GetConfigValue('ses_timeout')+0; $sid = $_COOKIE['sid']; $sql = "SELECT count( sd.sid ) - FROM sessions + FROM sessions sid = '".$sid."' AND expire + '".$session_time."' > unix_timestamp()"; } if ($conn->GetOne($sql) > 0) - return true; + return true; } function ValidateSID() @@ -87,10 +87,10 @@ return ValidateAdminSid(); else echo "SESSION Validation FALSE"; - + } return false; -} +} function GetCmsTree() { @@ -209,7 +209,7 @@ $prefix .= '--'; if ($level > 0) $prefix=$prefix.'- '; -/* +/* $page = ereg_replace("&","&",$rs->fields['page_title']); $page = ereg_replace("\"",""",$page); $page = ereg_replace("'","'",$page); @@ -250,12 +250,13 @@ function GetFoldersAndFiles( $resourceType, $currentFolder, $aParams = array('name','asc')) { + global $Config ; // Map the virtual path to the local server path. if (isset($Config['K4Mode'])) $date_format = "m/d/Y h:i A"; - else + else $date_format = GetConfigValue('date_format').' '.GetConfigValue('time_format'); - + $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; // Initialize the output buffers for "Folders" and "Files". $aFolders = array(); @@ -278,7 +279,7 @@ { $size = round( $iFileSize / 1024 ); $aFileSizes[] = ($size < 1)? 1:$size;// round( $iFileSize / 1024 ) ; - } else + } else $aFileSizes[] = $iFileSize; $aFiles[] = $sFile; $aFileDate[] = filectime($sServerDir.$sFile); @@ -296,11 +297,11 @@ } foreach($aFolders AS $k=>$v) { $sFolders .= '' ; - } + } } if (count($aFiles) > 0) { - if ($aParams[0] == 'name') - { + if ($aParams[0] == 'name') + { natcasesort($aFiles); if ($aParams[1] == 'desc') { @@ -328,7 +329,7 @@ $sFiles .= '' ; } } - } + } /* while ( $sFile = readdir( $oCurrentFolder ) ) { if ( $sFile != '.' && $sFile != '..' && $sFile != 'CVS') @@ -346,8 +347,8 @@ $sFiles .= '' ; } } -*/ - +*/ + if ($aParams[1] == "desc") { echo $sFiles ; @@ -416,7 +417,7 @@ $sql = "UPDATE live_blocks SET ".$lang_prefix."_content = replace(".$lang_prefix."_content,'".$original_str."','".$new_str."')"; $conn->Execute($sql); } - + } function RenameFile( $resourceType, $currentFolder , $aFilenames = array()) @@ -439,7 +440,7 @@ } else UpdateCmsBlocksK3($resourceType,$currentFolder,$aFilenames[0],$aFilenames[1]); $sErrorNumber = "0"; - } else + } else $sErrorNumber = '205' ; } else $sErrorNumber = '203' ; @@ -520,19 +521,19 @@ return; $conn = GetADODbConnection(); $aLangs = array(); - $multilang = GetConfigValue('multilingual_mode'); + $multilang = GetConfigValue('multilingual_mode'); $def_lang_prefix = GetConfigValue('default_lang_prefix'); - if ($multilang) + if ($multilang) { $query="SELECT lang_prefix FROM lang ORDER BY lang_id"; $rs = $conn->Execute($query); while ($rs && !$rs->EOF) { $aLangs[] = $rs->fields['lang_prefix']; $rs->MoveNext(); - } - } else + } + } else $aLangs[] = $def_lang_prefix; - $sErrorNumber = 230; + $sErrorNumber = 230; if ($confirm == 1) { DeleteConfirmedFiles($resourceType, $currentFolder, $aFiles); echo '' ; @@ -544,9 +545,9 @@ continue; $deleted_file = $Config['UserFilesPathNoBase'].$resourceType.$currentFolder.addslashes($v); for($i=0; $i 0) { + $add_sql.= " lb1.".$aLangs[$i]."_content LIKE '%".$deleted_file."%' OR"; + + if (strlen($add_sql) > 0) { $add_sql = rtrim($add_sql," OR"); $sql = "SELECT lb1.template_id, lb2.".$def_lang_prefix."_content FROM live_blocks AS lb1 LEFT JOIN live_blocks AS lb2 ON lb2.template_id = lb1.template_id AND lb2.block_num = 20 @@ -558,7 +559,7 @@ $page = @html_entity_decode($page,ENT_NOQUOTES,'UTF-8'); $page = @htmlspecialchars($page); $ret_xml.= '' ; - $rs->MoveNext(); + $rs->MoveNext(); } } } Index: trunk/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r5218 -r5219 --- trunk/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5218) +++ trunk/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5219) @@ -63,7 +63,7 @@ } $object->addFilter('parent_filter', 'ParentId = '.$parent_cat_id); - + $object->addFilter('perm_filter', 'PermId = 1'); // check for CATEGORY.VIEW permission if ($this->Application->GetVar('u_id') > 0) { // apply permission filters to all users except "root" @@ -208,7 +208,7 @@ return parent::getPassedID($event); } - + /** * Rebuilds category cache * @@ -237,7 +237,7 @@ %1$s.NewItem )'); } - + /** * Set correct parent path for newly created categories * @@ -248,12 +248,12 @@ if ($event->getEventParam('temp_id') == 0) { $object =& $this->Application->recallObject($event->Prefix.'.-item', null, Array('skip_autoload' => true, 'live_table' => true)); $object->Load($event->getEventParam('id')); - + $fields_hash = Array('ParentPath' => $object->buildParentPath()); $this->Conn->doUpdate($fields_hash, $object->TableName, 'CategoryId = '.$object->GetID()); } } - + /** * Set cache modification mark if needed * @@ -267,24 +267,24 @@ $this->Application->SetVar('require_cache_update', 1); return ; } - + // existing category was edited, check if in-cache fields are modified $temp_object =& $event->getObject( Array('skip_autoload' => true) ); $temp_object->Load($id); - + $live_object =& $this->Application->recallObject($event->Prefix.'.-item', null, Array('live_table' => true)); $live_object->Load($id); - + $cached_fields = Array('Name', 'Filename', 'CategoryTemplate', 'ItemTemplate'); - + foreach ($cached_fields as $cached_field) { if ($live_object->GetDBField($cached_field) != $temp_object->GetDBField($cached_field)) { $this->Application->SetVar('require_cache_update', 1); break; } } } - + /** * Checks cache update mark and redirect to cache if needed * @@ -300,7 +300,7 @@ $this->Application->StoreVar('opener_stack', serialize($opener_stack)); } } - + /** * Deletes all selected items. * Automatically recurse into sub-items using temp handler, and deletes sub-items Index: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r5218 -r5219 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5218) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5219) @@ -4,7 +4,7 @@ $application->Factory->includeClassFile('kDBEventHandler'); class kCatDBEventHandler extends InpDBEventHandler { - + /** * Allows to override standart permission mapping * @@ -19,7 +19,7 @@ ); $this->permMapping = array_merge($this->permMapping, $permissions); } - + /** * Checks permissions of user * @@ -33,21 +33,21 @@ return true; } } - + if ($event->Name == 'OnExport') { // save category_id before doing export $this->Application->LinkVar('m_cat_id'); } - + if ($event->Name == 'OnNew' && preg_match('/(.*)\/import$/', $this->Application->GetVar('t'), $rets)) { // redirect to item import template, where permission (import) category will be chosen) $root_category = $this->Application->findModule('Path', $rets[1].'/', 'RootCat'); $this->Application->StoreVar('m_cat_id', $root_category); } - + return parent::CheckPermission($event); } - + function OnCopy(&$event) { $object = $event->getObject(); @@ -91,7 +91,7 @@ } else { // mode == cut $object =& $this->Application->recallObject($event->getPrefixSpecial().'.item', $event->Prefix, Array('skip_autoload' => true)); - + foreach ($ids_arr as $id) { $object->Load($id); $object->MoveToCat(); @@ -449,15 +449,15 @@ if (!$property_map) { return ; } - + // new items $object->addCalculatedField('IsNew', ' IF(%1$s.NewItem = 2, IF(%1$s.CreatedOn >= (UNIX_TIMESTAMP() - '. $this->Application->ConfigValue($property_map['NewDays']). '*3600*24), 1, 0), %1$s.NewItem )'); - + // hot items (cache updated every hour) $sql = 'SELECT Data FROM '.TABLE_PREFIX.'Cache @@ -470,7 +470,7 @@ IF(%1$s.'.$property_map['ClickField'].' >= '.$hot_limit.', 1, 0), %1$s.HotItem )'); - + // popular items $object->addCalculatedField('IsPop', ' IF(%1$s.PopItem = 2, IF(%1$s.CachedVotesQty >= '. @@ -479,14 +479,17 @@ $this->Application->ConfigValue($property_map['MinPopRating']). ', 1, 0), %1$s.PopItem)'); - + } function CalculateHotLimit(&$event) { $property_map = $this->Application->getUnitOption($event->Prefix, 'ItemPropertyMappings'); + if (!$property_map) { + return; + } $click_field = $property_map['ClickField']; - + $last_hot = $this->Application->ConfigValue($property_map['MaxHotNumber']) - 1; $sql = 'SELECT '.$click_field.' FROM '.$this->Application->getUnitOption($event->Prefix, 'TableName').' ORDER BY '.$click_field.' DESC @@ -495,7 +498,7 @@ $hot_limit = (double)array_shift($res); $this->Conn->Query('REPLACE INTO '.TABLE_PREFIX.'Cache (VarName, Data, Cached) VALUES ("'.$property_map['HotLimit'].'", "'.$hot_limit.'", '.adodb_mktime().')'); return $hot_limit; - + return 0; } @@ -583,7 +586,7 @@ $this->Conn->doInsert($fields_hash, TABLE_PREFIX.'SearchLog'); } } - + /** * Makes simple search for products * based on keywords string @@ -624,8 +627,8 @@ // don't save search log, because in-portal already saved it $this->saveToSearchLog($keywords, 0); // 0 - simple search, 1 - advanced search } - - + + $keywords = strtr($keywords, Array('%' => '\\%', '_' => '\\_')); $event->setPseudoClass('_List'); @@ -644,23 +647,23 @@ // field processing $weight_sum = 0; - + $alias_counter = 0; - + $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'; } - + // what field in search config becomes what field in sql (key - new field, value - old field (from searchconfig table)) $search_config_map = Array(); - + foreach ($field_list as $key => $field) { $options = $object->getFieldOptions($field); $local_table = TABLE_PREFIX.$search_config[$field]['TableName']; $weight_sum += $search_config[$field]['Priority']; // counting weight sum; used when making relevance clause - + // processing multilingual fields if (getArrayValue($options, 'formatter') == 'kMultiLanguage') { $field_list[$key] = 'l'.$lang.'_'.$field; @@ -686,16 +689,16 @@ { $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; - + $join_clause = str_replace('{ForeignTable}', $alias, $search_config[$field]['JoinClause']); $join_clause = str_replace('{LocalTable}', $product_table, $join_clause); - + $join_clauses[] = ' LEFT JOIN '.$foreign_table.' '.$alias.' ON '.$join_clause; } @@ -714,7 +717,7 @@ // keyword string processing $search_helper =& $this->Application->recallObject('SearchHelper'); $where_clause = $search_helper->buildWhereClause($keywords, $field_list); - + $where_clause = $where_clause.' AND '.$product_table.'.Status=1'; if($this->Application->GetVar('Action') == 'm_simple_subsearch') // subsearch, In-portal @@ -823,7 +826,7 @@ $product_table = $this->Application->getUnitOption('p', 'TableName'); $search_keywords = $this->Application->GetVar('value'); // will not be changed - + $keywords = $this->Application->GetVar('value'); // will be changed down there $verbs = $this->Application->GetVar('verb'); $glues = $this->Application->GetVar('andor'); @@ -843,13 +846,13 @@ 'isnot' => '(%1$s != %2$s OR %1$s IS NULL)'); $alias_counter = 0; - + $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'; - } - + } + $search_log = ''; $weight_sum = 0; // processing fields and preparing conditions @@ -872,7 +875,7 @@ else { $field_name = $field; } - + // processing fields from other tables if ($foreign_field = $record['ForeignField']) { $exploded = explode(':', $foreign_field, 2); @@ -916,7 +919,7 @@ $local_table = 'custom_data'; $field_name = 'l'.$lang.'_cust_'.array_search($field_name, $custom_fields); } - + $field_name = $local_table.'.'.$field_name; } @@ -1051,16 +1054,16 @@ $or_having_conditions[] = $condition; } } - + // create search log record $search_log_data = Array('search_config' => $record, 'verb' => getArrayValue($verbs, $field), 'value' => ($record['FieldType'] == 'range') ? $search_keywords[$field.'_from'].'|'.$search_keywords[$field.'_to'] : $search_keywords[$field]); $search_log[] = $this->Application->Phrase('la_Field').' "'.$this->getHuman('Field', $search_log_data).'" '.$this->getHuman('Verb', $search_log_data).' '.$this->Application->Phrase('la_Value').' '.$this->getHuman('Value', $search_log_data).' '.$this->Application->Phrase($glues[$field] == 1 ? 'lu_And' : 'lu_Or'); } } - + $search_log = implode('
', $search_log); $search_log = preg_replace('/(.*) '.preg_quote($this->Application->Phrase('lu_and'), '/').'|'.preg_quote($this->Application->Phrase('lu_or'), '/').'$/is', '\\1', $search_log); - $this->saveToSearchLog($search_log, 1); // advanced search + $this->saveToSearchLog($search_log, 1); // advanced search $this->Application->StoreVar('highlight_keywords', serialize($highlight_keywords)); @@ -1128,21 +1131,21 @@ $res = $this->Conn->Query($sql); } - + function getHuman($type, $search_data) { $type = ucfirst(strtolower($type)); extract($search_data); - + switch ($type) { case 'Field': return $this->Application->Phrase($search_config['DisplayName']); break; - + case 'Verb': return $verb ? $this->Application->Phrase('lu_advsearch_'.$verb) : ''; break; - + case 'Value': switch ($search_config['FieldType']) { case 'date': @@ -1152,29 +1155,29 @@ 'last_6_months' => 'lu_comm_Last6Months', 'last_year' => 'lu_comm_LastYear'); $ret = $this->Application->Phrase($values[$value]); break; - + case 'range': $value = explode('|', $value); return $this->Application->Phrase('lu_comm_From').' "'.$value[0].'" '.$this->Application->Phrase('lu_comm_To').' "'.$value[1].'"'; break; - + case 'boolean': $values = Array(1 => 'lu_comm_Yes', 0 => 'lu_comm_No', -1 => 'lu_comm_Both'); $ret = $this->Application->Phrase($values[$value]); - break; - + break; + case 'text': $ret = $value; break; - + } return '"'.$ret.'"'; break; } } - - - + + + /** * Set's correct page for list * based on data provided with event @@ -1314,7 +1317,7 @@ $object =& $event->getObject( Array('skip_autoload' => true) ); $object->SetFieldsFromHash($field_values); $field_values['ImportFilename'] = $object->GetDBField('ImportFilename'); //if upload formatter has renamed the file during moving !!! - + $object->setID($item_id); $this->setRequiredFields($event); @@ -1334,11 +1337,11 @@ $field_values['ExportColumns'] = $field_values['ExportColumns'] ? explode('|', substr($field_values['ExportColumns'], 1, -1) ) : Array(); $field_values['start_from'] = 0; $export_object->saveOptions($event, $field_values); - + if( $export_object->verifyOptions($event) ) { $event->redirect = $this->getModuleFolder($event).'/'.$event->Special.'_progress'; - + } else { @@ -1352,12 +1355,12 @@ $field_values['ImportLocalFilename'] = $filename; $export_object->saveOptions($event, $field_values); } - + $event->status = erFAIL; $event->redirect = false; } } - + /** * Enter description here... * @@ -1367,7 +1370,7 @@ { $this->OnGoBack($event); } - + /** * Sets correct available & export fields * @@ -1450,9 +1453,9 @@ if ($event->Special != 'import') { return false; } - + $object =& $event->getObject(); - + $import_filenames = Array(); if ($folder_handle = opendir(EXPORT_PATH)) { @@ -1464,12 +1467,12 @@ } closedir($folder_handle); } - + $options = $object->GetFieldOptions('ImportLocalFilename'); $options['options'] = $import_filenames; $object->SetFieldOptions('ImportLocalFilename', $options); } - + /** * Returns specific to each item type columns only * @@ -1648,33 +1651,33 @@ else { $category_id = 0; } - + if ($dst_field == 'ImportCategory') { $this->Application->StoreVar('ImportCategory', $category_id); $this->Application->StoreVar($event->getPrefixSpecial().'_ForceNotValid', 1); // not to loose import/export values on form refresh - + $this->Application->SetVar($event->getPrefixSpecial().'_id', 0); $this->Application->SetVar($event->getPrefixSpecial().'_event', 'OnExportBegin'); - + $passed = $this->Application->GetVar('passed'); $this->Application->SetVar('passed', $passed.','.$event->getPrefixSpecial()); $event->setEventParam('pass_events', true); } - + if ($dst_field == 'ItemCategory') { $object =& $event->getObject(); // category item object (e.g. link, product, etc.) - + $ci_prefix = $object->Prefix.'-ci'; $ci_object =& $this->Application->recallObject($ci_prefix, null, Array('skip_autoload' => true)); - + $ci_object->Load($category_id); if (!$ci_object->isLoaded()) { $fields_hash = Array('CategoryId' => $category_id, 'ItemResourceId' => $object->GetDBField('ResourceId')); $ci_object->SetDBFieldsFromHash($fields_hash); $ci_object->Create(true); } } - + $this->finalizePopup($event); } @@ -1689,18 +1692,24 @@ $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); if ($items_info) { list($id, $field_values) = each($items_info); - + $object =& $event->getObject( Array('skip_autoload' => true) ); $object->SetFieldsFromHash($field_values); $field_values['ImportFilename'] = $object->GetDBField('ImportFilename'); //if upload formatter has renamed the file during moving !!! $field_values['ImportSource'] = 2; $field_values['ImportLocalFilename'] = $object->GetDBField('ImportFilename'); $items_info[$id] = $field_values; - + $this->Application->StoreVar($event->getPrefixSpecial().'_ItemsInfo', serialize($items_info)); } } + function OnCancelAction(&$event) + { + $event->redirect_params = Array('pass' => 'all,'.$event->GetPrefixSpecial()); + $event->redirect = $this->Application->GetVar('cancel_template'); + } + /* === RELATED TO IMPORT/EXPORT: END === */ } Index: trunk/core/units/reviews/reviews_tag_processor.php =================================================================== diff -u -N -r4309 -r5219 --- trunk/core/units/reviews/reviews_tag_processor.php (.../reviews_tag_processor.php) (revision 4309) +++ trunk/core/units/reviews/reviews_tag_processor.php (.../reviews_tag_processor.php) (revision 5219) @@ -2,8 +2,6 @@ class ReviewsTagProcessor extends kDBTagProcessor { - - /** * Returns a link for editing product * @@ -55,8 +53,7 @@ function AlreadyReviewed($params) { $user_id = ($this->Application->GetVar('u_id') == 0) ? -2 : $this->Application->GetVar('u_id'); - $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); - $object =& $this->Application->recallObject($this->getPrefixSpecial()); + $object =& $this->Application->recallObject($this->getPrefixSpecial(),null,array('skip_autoload'=>1)); $product_info = $object->getLinkedInfo(); $sql = ' SELECT * FROM '.TABLE_PREFIX.'SpamControl Index: trunk/kernel/units/admin/admin_tag_processor.php =================================================================== diff -u -N -r5177 -r5219 --- trunk/kernel/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 5177) +++ trunk/kernel/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 5219) @@ -7,7 +7,7 @@ $name = $this->SelectParam($params, 'name,const'); safeDefine($name, $params['value']); } - + /** * Allows to execute js script after the page is fully loaded * @@ -100,10 +100,10 @@ $module = strtolower($is_params['is_Module']); $template = $module.'/import'; $module_info = $this->Application->findModule('Name', $module); - + $item_prefix = $module_info['Var']; $pass_params = Array('m_opener' => 'd', $item_prefix.'.import_id' => 0, $item_prefix.'.import_event' => 'OnNew', 'pass' => 'm,'.$item_prefix.'.import', 'm_cat_id' => $module_info['RootCat']); - + $this->Application->Redirect($template, $pass_params); } } @@ -133,14 +133,14 @@ function DrawTree($params) { static $deep_level = 0; - + // when processings, then sort children by priority (key of children array) $ret = ''; $section_name = $params['section_name']; $params['name'] = $this->SelectParam($params, 'name,render_as,block'); $sections_helper =& $this->Application->recallObject('SectionsHelper'); $section_data =& $sections_helper->getSectionData($section_name); - + $params['children_count'] = isset($section_data['children']) ? count($section_data['children']) : 0; $params['deep_level'] = $deep_level++; $template = $section_data['url']['t']; @@ -158,33 +158,33 @@ $deep_level--; } - + return $ret; } - + function PrintSection($params) { $section_name = $params['section_name']; if ($section_name == '#session#') { $section_name = $this->Application->RecallVar('section'); } - + $sections_helper =& $this->Application->recallObject('SectionsHelper'); $section_data =& $sections_helper->getSectionData($section_name); - + $params['name'] = $this->SelectParam($params, 'name,render_as,block'); $params['section_name'] = $section_name; - + $template = $section_data['url']['t']; unset($section_data['url']['t']); - + $section_data['section_url'] = $this->Application->HREF($template, '', $section_data['url']); $ret = $this->Application->ParseBlock( array_merge_recursive2($params, $section_data) ); - + return $ret; } - + /** * Used in XML drawing for tree * @@ -199,10 +199,10 @@ if ($section_name == '#session#') { $section_name = $this->Application->RecallVar('section'); } - + $sections_helper =& $this->Application->recallObject('SectionsHelper'); $section_data =& $sections_helper->getSectionData($section_name); - + $params['name'] = $this->SelectParam($params, 'name,render_as,block'); if (!isset($section_data['children'])) { return ''; @@ -212,7 +212,7 @@ foreach ($section_data['children'] as $section_name) { $params['section_name'] = $section_name; $section_data =& $sections_helper->getSectionData($section_name); - + if (isset($section_data['tabs_only']) && $section_data['tabs_only']) { $perm_status = false; $folder_label = $section_data['label']; @@ -227,7 +227,7 @@ // no permission for all tabs -> don't display tree node either continue; } - + $params['section_name'] = $section_name; $section_data =& $sections_helper->getSectionData($section_name); $section_data['label'] = $folder_label; // use folder label in tree @@ -236,9 +236,9 @@ elseif (!$this->Application->CheckPermission($section_name.'.view', 1)) { continue; } - + $params['children_count'] = isset($section_data['children']) ? count($section_data['children']) : 0; - + $template = $section_data['url']['t']; unset($section_data['url']['t']); @@ -261,15 +261,15 @@ return preg_replace("/\r\n|\n/", '', $ret); } - + function ListSectionPermissions($params) { $section_name = isset($params['section_name']) ? $params['section_name'] : $this->Application->GetVar('section_name'); $sections_helper =& $this->Application->recallObject('SectionsHelper'); $section_data =& $sections_helper->getSectionData($section_name); - + $block_params = array_merge_recursive2($section_data, Array('name' => $params['render_as'], 'section_name' => $section_name)); - + $ret = ''; foreach ($section_data['permissions'] as $perm_name) { if (preg_match('/^advanced:(.*)/', $perm_name) != $params['type']) continue; @@ -278,21 +278,21 @@ } return $ret; } - + function ModuleInclude($params) { foreach ($params as $param_name => $param_value) { $params[$param_name] = replaceModuleSection($param_value); } - + return $this->Application->ProcessParsedTag('m', 'ModuleInclude', $params); } - + function TodayDate($params) { return date($params['format']); } - + function TreeEditWarrning($params) { $ret = $this->Application->Phrase($params['label']); @@ -303,7 +303,7 @@ $ret = str_replace('
', '\n', $ret); return $ret; } - + /** * Draws section tabs using block name passed * @@ -313,24 +313,24 @@ { $sections_helper =& $this->Application->recallObject('SectionsHelper'); $section_data =& $sections_helper->getSectionData($params['section_name']); - + $ret = ''; $block_params = Array('name' => $params['render_as']); ksort($section_data['children'], SORT_NUMERIC); foreach ($section_data['children'] as $priority => $section_name) { // if (!$this->Application->CheckPermission($section_name.'.view', 1)) continue; - + $tab_data =& $sections_helper->getSectionData($section_name); $block_params['t'] = $tab_data['url']['t']; $block_params['title'] = $tab_data['label']; $block_params['main_prefix'] = $section_data['SectionPrefix']; $ret .= $this->Application->ParseBlock($block_params); } - - + + return $ret; } - + /** * Returns list of module item tabs that have view permission in current category * @@ -351,6 +351,28 @@ } return $ret; } + + function FCKEditor($params) + { + include_once(FULL_PATH.'/admin/editor/cmseditor/fckeditor.php'); + $oFCKeditor = new FCKeditor($params['name']); + $oFCKeditor->BasePath = BASE_PATH.'/admin/editor/cmseditor/'; + $oFCKeditor->Width = $params['width'] ; + $oFCKeditor->Height = $params['height'] ; + $oFCKeditor->ToolbarSet = 'Advanced' ; + $oFCKeditor->Value = '' ; + $oFCKeditor->Config = Array( + //'UserFilesPath' => $pathtoroot.'kernel/user_files', + 'ProjectPath' => BASE_PATH.'/', + 'CustomConfigurationsPath' => $this->Application->BaseURL().'admin/editor/inp_fckconfig.js', + 'EditorAreaCSS' => $this->Application->BaseURL().'/themes/inportal_site/inc/inportal.css', //GetThemeCSS(), + //'StylesXmlPath' => '../../inp_styles.xml', +// 'Debug' => 1, + 'Admin' => 1, + ); + return $oFCKeditor->CreateHtml(); + + } } ?> \ No newline at end of file Index: trunk/kernel/units/general/cat_tag_processor.php =================================================================== diff -u -N -r5214 -r5219 --- trunk/kernel/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 5214) +++ trunk/kernel/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 5219) @@ -1,28 +1,28 @@ Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params); - + $grids = $this->Application->getUnitOption($this->Prefix,'Grids'); $icons =& $grids[ $params['grid'] ]['Icons']; - + $status_fields = $this->Application->getUnitOption($this->Prefix,'StatusField'); if (!$status_fields) return $icons['default']; - + $value = $object->GetDBField($status_fields[0]); // sets base status icon if ($value == STATUS_ACTIVE) { if( $object->GetDBField('IsPop') ) $value = 'POP'; if( $object->GetDBField('IsHot') ) $value = 'HOT'; if( $object->GetDBField('IsNew') ) $value = 'NEW'; if( $object->GetDBField('EditorsPick') ) $value = 'PICK'; } - + return isset($icons[$value]) ? $icons[$value] : $icons['default']; } - + /** * Returns path where exported category items should be saved * @@ -36,19 +36,19 @@ { $ret = str_replace( FULL_PATH.'/', $this->Application->BaseURL(), $ret); } - + $export_options = unserialize($this->Application->RecallVar($this->getPrefixSpecial().'_options')); $ret .= $export_options['ExportFilename'].'.'.($export_options['ExportFormat'] == 1 ? 'csv' : 'xml'); - + return $ret; } - + function CategoryPath($params) { if (!isset($params['cat_id'])) { $params['cat_id'] = $this->Application->RecallVar($params['session_var'], 0); } - + $block_params['separator'] = $params['separator']; if ($params['cat_id'] == 0) { @@ -66,18 +66,18 @@ // in case if category is deleted return ''; } - $block_params['name'] = $params['block']; + $block_params['name'] = $params['block']; $block_params['cat_name'] = $res['Name']; $block_params['cat_id'] = $res['CategoryId']; - + $next_params['separator'] = $params['separator']; $next_params['rootcatblock'] = $params['rootcatblock']; $next_params['block'] = $params['block']; $next_params['cat_id'] = $res['ParentId']; return $this->CategoryPath($next_params).$this->Application->ParseBlock($block_params); } } - + function BuildListSpecial($params) { if ($this->Special != '') return $this->Special; @@ -90,47 +90,60 @@ $parent_cat_id = $this->Application->GetVar('m_cat_id'); } } - + $recursive = isset($params['recursive']); - + $types = $this->SelectParam($params, 'types'); $except = $this->SelectParam($params, 'except'); - + if ($types.$except.$recursive == '') { return parent::BuildListSpecial($params); } - + $special = crc32($parent_cat_id.$types.$except.$recursive); return $special; } - + function ExportStatus($params) { $export_object =& $this->Application->recallObject('CatItemExportHelper'); $event = new kEvent($this->getPrefixSpecial().':OnDummy'); - + $action_method = 'perform'.ucfirst($this->Special); $field_values = $export_object->$action_method($event); - + // finish code is done from JS now if ($field_values['start_from'] == $field_values['total_records']) { if ($this->Special == 'import') { $this->Application->StoreVar('PermCache_UpdateRequired', 1); } } - + $export_options = $export_object->loadOptions($event); return $export_options['start_from'] * 100 / $export_options['total_records']; } - + function CatalogItemCount($params) { $object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix.'_List', $params); return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount; } - + + function ListReviews($params) + { + $prefix = $this->Prefix.'-rev'; + $review_tag_processor =& $this->Application->recallObject($prefix.'.item_TagProcessor'); + return $review_tag_processor->PrintList($params); + } + + function ReviewCount($params) + { + $review_tag_processor =& $this->Application->recallObject('rev.item_TagProcessor'); + return $review_tag_processor->TotalRecords($params); + } + } ?> \ No newline at end of file Index: trunk/core/units/admin/admin_tag_processor.php =================================================================== diff -u -N -r5177 -r5219 --- trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 5177) +++ trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 5219) @@ -7,7 +7,7 @@ $name = $this->SelectParam($params, 'name,const'); safeDefine($name, $params['value']); } - + /** * Allows to execute js script after the page is fully loaded * @@ -100,10 +100,10 @@ $module = strtolower($is_params['is_Module']); $template = $module.'/import'; $module_info = $this->Application->findModule('Name', $module); - + $item_prefix = $module_info['Var']; $pass_params = Array('m_opener' => 'd', $item_prefix.'.import_id' => 0, $item_prefix.'.import_event' => 'OnNew', 'pass' => 'm,'.$item_prefix.'.import', 'm_cat_id' => $module_info['RootCat']); - + $this->Application->Redirect($template, $pass_params); } } @@ -133,14 +133,14 @@ function DrawTree($params) { static $deep_level = 0; - + // when processings, then sort children by priority (key of children array) $ret = ''; $section_name = $params['section_name']; $params['name'] = $this->SelectParam($params, 'name,render_as,block'); $sections_helper =& $this->Application->recallObject('SectionsHelper'); $section_data =& $sections_helper->getSectionData($section_name); - + $params['children_count'] = isset($section_data['children']) ? count($section_data['children']) : 0; $params['deep_level'] = $deep_level++; $template = $section_data['url']['t']; @@ -158,33 +158,33 @@ $deep_level--; } - + return $ret; } - + function PrintSection($params) { $section_name = $params['section_name']; if ($section_name == '#session#') { $section_name = $this->Application->RecallVar('section'); } - + $sections_helper =& $this->Application->recallObject('SectionsHelper'); $section_data =& $sections_helper->getSectionData($section_name); - + $params['name'] = $this->SelectParam($params, 'name,render_as,block'); $params['section_name'] = $section_name; - + $template = $section_data['url']['t']; unset($section_data['url']['t']); - + $section_data['section_url'] = $this->Application->HREF($template, '', $section_data['url']); $ret = $this->Application->ParseBlock( array_merge_recursive2($params, $section_data) ); - + return $ret; } - + /** * Used in XML drawing for tree * @@ -199,10 +199,10 @@ if ($section_name == '#session#') { $section_name = $this->Application->RecallVar('section'); } - + $sections_helper =& $this->Application->recallObject('SectionsHelper'); $section_data =& $sections_helper->getSectionData($section_name); - + $params['name'] = $this->SelectParam($params, 'name,render_as,block'); if (!isset($section_data['children'])) { return ''; @@ -212,7 +212,7 @@ foreach ($section_data['children'] as $section_name) { $params['section_name'] = $section_name; $section_data =& $sections_helper->getSectionData($section_name); - + if (isset($section_data['tabs_only']) && $section_data['tabs_only']) { $perm_status = false; $folder_label = $section_data['label']; @@ -227,7 +227,7 @@ // no permission for all tabs -> don't display tree node either continue; } - + $params['section_name'] = $section_name; $section_data =& $sections_helper->getSectionData($section_name); $section_data['label'] = $folder_label; // use folder label in tree @@ -236,9 +236,9 @@ elseif (!$this->Application->CheckPermission($section_name.'.view', 1)) { continue; } - + $params['children_count'] = isset($section_data['children']) ? count($section_data['children']) : 0; - + $template = $section_data['url']['t']; unset($section_data['url']['t']); @@ -261,15 +261,15 @@ return preg_replace("/\r\n|\n/", '', $ret); } - + function ListSectionPermissions($params) { $section_name = isset($params['section_name']) ? $params['section_name'] : $this->Application->GetVar('section_name'); $sections_helper =& $this->Application->recallObject('SectionsHelper'); $section_data =& $sections_helper->getSectionData($section_name); - + $block_params = array_merge_recursive2($section_data, Array('name' => $params['render_as'], 'section_name' => $section_name)); - + $ret = ''; foreach ($section_data['permissions'] as $perm_name) { if (preg_match('/^advanced:(.*)/', $perm_name) != $params['type']) continue; @@ -278,21 +278,21 @@ } return $ret; } - + function ModuleInclude($params) { foreach ($params as $param_name => $param_value) { $params[$param_name] = replaceModuleSection($param_value); } - + return $this->Application->ProcessParsedTag('m', 'ModuleInclude', $params); } - + function TodayDate($params) { return date($params['format']); } - + function TreeEditWarrning($params) { $ret = $this->Application->Phrase($params['label']); @@ -303,7 +303,7 @@ $ret = str_replace('
', '\n', $ret); return $ret; } - + /** * Draws section tabs using block name passed * @@ -313,24 +313,24 @@ { $sections_helper =& $this->Application->recallObject('SectionsHelper'); $section_data =& $sections_helper->getSectionData($params['section_name']); - + $ret = ''; $block_params = Array('name' => $params['render_as']); ksort($section_data['children'], SORT_NUMERIC); foreach ($section_data['children'] as $priority => $section_name) { // if (!$this->Application->CheckPermission($section_name.'.view', 1)) continue; - + $tab_data =& $sections_helper->getSectionData($section_name); $block_params['t'] = $tab_data['url']['t']; $block_params['title'] = $tab_data['label']; $block_params['main_prefix'] = $section_data['SectionPrefix']; $ret .= $this->Application->ParseBlock($block_params); } - - + + return $ret; } - + /** * Returns list of module item tabs that have view permission in current category * @@ -351,6 +351,28 @@ } return $ret; } + + function FCKEditor($params) + { + include_once(FULL_PATH.'/admin/editor/cmseditor/fckeditor.php'); + $oFCKeditor = new FCKeditor($params['name']); + $oFCKeditor->BasePath = BASE_PATH.'/admin/editor/cmseditor/'; + $oFCKeditor->Width = $params['width'] ; + $oFCKeditor->Height = $params['height'] ; + $oFCKeditor->ToolbarSet = 'Advanced' ; + $oFCKeditor->Value = '' ; + $oFCKeditor->Config = Array( + //'UserFilesPath' => $pathtoroot.'kernel/user_files', + 'ProjectPath' => BASE_PATH.'/', + 'CustomConfigurationsPath' => $this->Application->BaseURL().'admin/editor/inp_fckconfig.js', + 'EditorAreaCSS' => $this->Application->BaseURL().'/themes/inportal_site/inc/inportal.css', //GetThemeCSS(), + //'StylesXmlPath' => '../../inp_styles.xml', +// 'Debug' => 1, + 'Admin' => 1, + ); + return $oFCKeditor->CreateHtml(); + + } } ?> \ No newline at end of file Index: trunk/core/units/general/cat_tag_processor.php =================================================================== diff -u -N -r5214 -r5219 --- trunk/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 5214) +++ trunk/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 5219) @@ -1,28 +1,28 @@ Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params); - + $grids = $this->Application->getUnitOption($this->Prefix,'Grids'); $icons =& $grids[ $params['grid'] ]['Icons']; - + $status_fields = $this->Application->getUnitOption($this->Prefix,'StatusField'); if (!$status_fields) return $icons['default']; - + $value = $object->GetDBField($status_fields[0]); // sets base status icon if ($value == STATUS_ACTIVE) { if( $object->GetDBField('IsPop') ) $value = 'POP'; if( $object->GetDBField('IsHot') ) $value = 'HOT'; if( $object->GetDBField('IsNew') ) $value = 'NEW'; if( $object->GetDBField('EditorsPick') ) $value = 'PICK'; } - + return isset($icons[$value]) ? $icons[$value] : $icons['default']; } - + /** * Returns path where exported category items should be saved * @@ -36,19 +36,19 @@ { $ret = str_replace( FULL_PATH.'/', $this->Application->BaseURL(), $ret); } - + $export_options = unserialize($this->Application->RecallVar($this->getPrefixSpecial().'_options')); $ret .= $export_options['ExportFilename'].'.'.($export_options['ExportFormat'] == 1 ? 'csv' : 'xml'); - + return $ret; } - + function CategoryPath($params) { if (!isset($params['cat_id'])) { $params['cat_id'] = $this->Application->RecallVar($params['session_var'], 0); } - + $block_params['separator'] = $params['separator']; if ($params['cat_id'] == 0) { @@ -66,18 +66,18 @@ // in case if category is deleted return ''; } - $block_params['name'] = $params['block']; + $block_params['name'] = $params['block']; $block_params['cat_name'] = $res['Name']; $block_params['cat_id'] = $res['CategoryId']; - + $next_params['separator'] = $params['separator']; $next_params['rootcatblock'] = $params['rootcatblock']; $next_params['block'] = $params['block']; $next_params['cat_id'] = $res['ParentId']; return $this->CategoryPath($next_params).$this->Application->ParseBlock($block_params); } } - + function BuildListSpecial($params) { if ($this->Special != '') return $this->Special; @@ -90,47 +90,60 @@ $parent_cat_id = $this->Application->GetVar('m_cat_id'); } } - + $recursive = isset($params['recursive']); - + $types = $this->SelectParam($params, 'types'); $except = $this->SelectParam($params, 'except'); - + if ($types.$except.$recursive == '') { return parent::BuildListSpecial($params); } - + $special = crc32($parent_cat_id.$types.$except.$recursive); return $special; } - + function ExportStatus($params) { $export_object =& $this->Application->recallObject('CatItemExportHelper'); $event = new kEvent($this->getPrefixSpecial().':OnDummy'); - + $action_method = 'perform'.ucfirst($this->Special); $field_values = $export_object->$action_method($event); - + // finish code is done from JS now if ($field_values['start_from'] == $field_values['total_records']) { if ($this->Special == 'import') { $this->Application->StoreVar('PermCache_UpdateRequired', 1); } } - + $export_options = $export_object->loadOptions($event); return $export_options['start_from'] * 100 / $export_options['total_records']; } - + function CatalogItemCount($params) { $object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix.'_List', $params); return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount; } - + + function ListReviews($params) + { + $prefix = $this->Prefix.'-rev'; + $review_tag_processor =& $this->Application->recallObject($prefix.'.item_TagProcessor'); + return $review_tag_processor->PrintList($params); + } + + function ReviewCount($params) + { + $review_tag_processor =& $this->Application->recallObject('rev.item_TagProcessor'); + return $review_tag_processor->TotalRecords($params); + } + } ?> \ No newline at end of file Index: trunk/admin/editor/cmseditor/fckconfig.js =================================================================== diff -u -N -r3507 -r5219 --- trunk/admin/editor/cmseditor/fckconfig.js (.../fckconfig.js) (revision 3507) +++ trunk/admin/editor/cmseditor/fckconfig.js (.../fckconfig.js) (revision 5219) @@ -2,20 +2,20 @@ * Edited by Kostja * FCKeditor - The text editor for internet * Copyright (C) 2003-2004 Frederico Caldeira Knabben - * + * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php - * + * * For further information visit: * http://www.fckeditor.net/ - * + * * File Name: fckconfig.js * Editor configuration settings. * See the documentation for more info. - * + * * Version: 2.0 RC3 * Modified: 2005-02-27 21:31:48 - * + * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ Index: trunk/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r5060 -r5219 --- trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 5060) +++ trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 5219) @@ -42,7 +42,7 @@ } return $this->Application->BaseURL().$path; } - + /** * Creates HTML tag for all templates * affects future css, js files and href params of links @@ -189,6 +189,15 @@ return $res; } + function DefaultParam($params) + { + foreach ($params as $key => $val) { + if ($this->Application->Parser->GetParam($key) === false) { + $this->Application->Parser->SetParam($key, $val); + } + } + } + /** * Gets value of specified field from specified prefix_special and set it as parser param * @@ -702,7 +711,7 @@ $perm_helper =& $this->Application->recallObject('PermissionsHelper'); return $perm_helper->TagPermissionCheck($params, 'm_CheckPermission'); } - + /** * Checks if user is logged in and if not redirects it to template passed * @@ -723,7 +732,7 @@ $this->Application->Redirect($redirect_template, $redirect_params); } // check by permissions: end - + // check by configuration value: begin $condition = getArrayValue($params, 'condition'); if (!$condition) { @@ -738,7 +747,7 @@ } } // check by configuration value: end - + // check by belonging to group: begin $group = $this->SelectParam($params, 'group'); $group_access = true; @@ -751,7 +760,7 @@ } } // check by belonging to group: end - + if ((!$this->Application->LoggedIn() || !$group_access) && $condition) { if ( $this->Application->LoggedIn() && !$group_access) { $this->Application->Redirect( $params['no_group_perm_template'], Array('next_template'=>$t) );