Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Mon, Jan 6, 12:24 AM

in-portal

This file is larger than 256 KB, so syntax highlighting was skipped.
Index: branches/5.2.x/core/kernel/db/cat_event_handler.php
===================================================================
--- branches/5.2.x/core/kernel/db/cat_event_handler.php (revision 15562)
+++ branches/5.2.x/core/kernel/db/cat_event_handler.php (revision 15563)
@@ -1,3037 +1,3023 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class kCatDBEventHandler extends kDBEventHandler {
/**
* Allows to override standard permission mapping
*
* @return void
* @access protected
* @see kEventHandler::$permMapping
*/
protected function mapPermissions()
{
parent::mapPermissions();
$permissions = Array(
'OnSaveSettings' => Array ('self' => 'add|edit|advanced:import'),
'OnResetSettings' => Array ('self' => 'add|edit|advanced:import'),
'OnBeforeDeleteOriginal' => Array ('self' => 'edit|advanced:approve'),
'OnAfterDeleteOriginal' => Array ('self' => 'edit|advanced:approve'),
'OnCopy' => Array ('self' => true),
'OnDownloadFile' => Array ('self' => 'view'),
'OnCancelAction' => Array ('self' => true),
'OnItemBuild' => Array ('self' => true),
'OnMakeVote' => Array ('self' => true),
'OnReviewHelpful' => Array ('self' => true),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Load item if id is available
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function LoadItem(kEvent $event)
{
$object = $event->getObject();
/* @var $object kDBItem */
$id = $this->getPassedID($event);
if ( $object->Load($id) ) {
$actions = $this->Application->recallObject('kActions');
/* @var $actions Params */
$actions->Set($event->getPrefixSpecial() . '_id', $object->GetID());
$use_pending_editing = $this->Application->getUnitOption($event->Prefix, 'UsePendingEditing');
if ( $use_pending_editing && $event->Special != 'original' ) {
$this->Application->SetVar($event->Prefix . '.original_id', $object->GetDBField('OrgId'));
}
}
else {
$object->setID($id);
}
}
/**
* Checks user permission to execute given $event
*
* @param kEvent $event
* @return bool
* @access public
*/
public function CheckPermission(kEvent $event)
{
if ( !$this->Application->isAdmin ) {
if ( $event->Name == 'OnSetSortingDirect' ) {
// allow sorting on front event without view permission
return true;
}
}
if ( $event->Name == 'OnExport' ) {
// save category_id before doing export
$this->Application->LinkVar('m_cat_id');
}
if ( in_array($event->Name, $this->_getMassPermissionEvents()) ) {
$items = $this->_getPermissionCheckInfo($event);
$perm_helper = $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
if ( ($event->Name == 'OnSave') && array_key_exists(0, $items) ) {
// adding new item (ID = 0)
$perm_value = $perm_helper->AddCheckPermission($items[0]['CategoryId'], $event->Prefix) > 0;
}
else {
// leave only items, that can be edited
$ids = Array ();
$check_method = in_array($event->Name, Array ('OnMassDelete', 'OnCut')) ? 'DeleteCheckPermission' : 'ModifyCheckPermission';
foreach ($items as $item_id => $item_data) {
if ( $perm_helper->$check_method($item_data['CreatedById'], $item_data['CategoryId'], $event->Prefix) > 0 ) {
$ids[] = $item_id;
}
}
if ( !$ids ) {
// no items left for editing -> no permission
return $perm_helper->finalizePermissionCheck($event, false);
}
$perm_value = true;
$event->setEventParam('ids', $ids); // will be used later by "kDBEventHandler::StoreSelectedIDs" method
}
return $perm_helper->finalizePermissionCheck($event, $perm_value);
}
$export_events = Array ('OnSaveSettings', 'OnResetSettings', 'OnExportBegin');
if ( in_array($event->Name, $export_events) ) {
// when import settings before selecting target import category
return $this->Application->CheckPermission('in-portal:main_import.view');
}
if ( $event->Name == 'OnProcessSelected' ) {
if ( $this->Application->RecallVar('dst_field') == 'ImportCategory' ) {
// when selecting target import category
return $this->Application->CheckPermission('in-portal:main_import.view');
}
}
return parent::CheckPermission($event);
}
/**
* Returns events, that require item-based (not just event-name based) permission check
*
* @return Array
*/
function _getMassPermissionEvents()
{
return Array (
'OnEdit', 'OnSave', 'OnMassDelete', 'OnMassApprove',
'OnMassDecline', 'OnMassMoveUp', 'OnMassMoveDown',
'OnCut',
);
}
/**
* Returns category item IDs, that require permission checking
*
* @param kEvent $event
* @return string
*/
function _getPermissionCheckIDs($event)
{
if ($event->Name == 'OnSave') {
$selected_ids = implode(',', $this->getSelectedIDs($event, true));
if (!$selected_ids) {
$selected_ids = 0; // when saving newly created item (OnPreCreate -> OnPreSave -> OnSave)
}
}
else {
// OnEdit, OnMassDelete events, when items are checked in grid
$selected_ids = implode(',', $this->StoreSelectedIDs($event));
}
return $selected_ids;
}
/**
* Returns information used in permission checking
*
* @param kEvent $event
* @return Array
*/
function _getPermissionCheckInfo($event)
{
$perm_helper = $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
// when saving data from temp table to live table check by data from temp table
$item_ids = $this->_getPermissionCheckIDs($event);
$items = $perm_helper->GetCategoryItemData($event->Prefix, $item_ids, $event->Name == 'OnSave');
if (!$items) {
// when item not present in temp table, then permission is not checked, because there are no data in db to check
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
list ($id, $fields_hash) = each($items_info);
if (array_key_exists('CategoryId', $fields_hash)) {
$item_category = $fields_hash['CategoryId'];
}
else {
$item_category = $this->Application->GetVar('m_cat_id');
}
$items[$id] = Array (
'CreatedById' => $this->Application->RecallVar('use_id'),
'CategoryId' => $item_category,
);
}
return $items;
}
/**
* Add selected items to clipboard with mode = COPY (CLONE)
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnCopy($event)
{
$this->Application->RemoveVar('clipboard');
$clipboard_helper = $this->Application->recallObject('ClipboardHelper');
/* @var $clipboard_helper kClipboardHelper */
$clipboard_helper->setClipboard($event, 'copy', $this->StoreSelectedIDs($event));
$this->clearSelectedIDs($event);
}
/**
* Add selected items to clipboard with mode = CUT
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnCut($event)
{
$this->Application->RemoveVar('clipboard');
$clipboard_helper = $this->Application->recallObject('ClipboardHelper');
/* @var $clipboard_helper kClipboardHelper */
$clipboard_helper->setClipboard($event, 'cut', $this->StoreSelectedIDs($event));
$this->clearSelectedIDs($event);
}
/**
* Checks permission for OnPaste event
*
* @param kEvent $event
* @return bool
*/
function _checkPastePermission($event)
{
$perm_helper = $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
$category_id = $this->Application->GetVar('m_cat_id');
if ($perm_helper->AddCheckPermission($category_id, $event->Prefix) == 0) {
// no items left for editing -> no permission
return $perm_helper->finalizePermissionCheck($event, false);
}
return true;
}
/**
* Performs category item paste
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnPaste($event)
{
if ( $this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1) || !$this->_checkPastePermission($event) ) {
$event->status = kEvent::erFAIL;
return;
}
$clipboard_data = $event->getEventParam('clipboard_data');
if ( !$clipboard_data['cut'] && !$clipboard_data['copy'] ) {
return;
}
if ( $clipboard_data['copy'] ) {
$temp = $this->Application->recallObject($event->getPrefixSpecial() . '_TempHandler', 'kTempTablesHandler');
/* @var $temp kTempTablesHandler */
$this->Application->SetVar('ResetCatBeforeClone', 1); // used in "kCatDBEventHandler::OnBeforeClone"
$temp->CloneItems($event->Prefix, $event->Special, $clipboard_data['copy']);
}
if ( $clipboard_data['cut'] ) {
$object = $this->Application->recallObject($event->getPrefixSpecial() . '.item', $event->Prefix, Array ('skip_autoload' => true));
/* @var $object kCatDBItem */
foreach ($clipboard_data['cut'] as $id) {
$object->Load($id);
$object->MoveToCat();
}
}
}
/**
* Deletes all selected items.
* Automatically recurse into sub-items using temp handler, and deletes sub-items
* by calling its Delete method if sub-item has AutoDelete set to true in its config file
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnMassDelete(kEvent $event)
{
if ( $this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1) ) {
$event->status = kEvent::erFAIL;
return;
}
$ids = $this->StoreSelectedIDs($event);
$to_delete = Array ();
$recycle_bin = $this->Application->ConfigValue('RecycleBinFolder');
if ( $recycle_bin ) {
$rb = $this->Application->recallObject('c.recycle', NULL, array ('skip_autoload' => true));
/* @var $rb CategoriesItem */
$rb->Load($recycle_bin);
$object = $this->Application->recallObject($event->Prefix . '.recycleitem', NULL, Array ('skip_autoload' => true));
/* @var $object kCatDBItem */
foreach ($ids as $id) {
$object->Load($id);
if ( preg_match('/^' . preg_quote($rb->GetDBField('ParentPath'), '/') . '/', $object->GetDBField('ParentPath')) ) {
$to_delete[] = $id;
continue;
}
$object->MoveToCat($recycle_bin);
}
$ids = $to_delete;
}
$temp_handler = $this->Application->recallObject($event->getPrefixSpecial() . '_TempHandler', 'kTempTablesHandler');
/* @var $temp_handler kTempTablesHandler */
$event->setEventParam('ids', $ids);
$this->customProcessing($event, 'before');
$ids = $event->getEventParam('ids');
if ( $ids ) {
$temp_handler->DeleteItems($event->Prefix, $event->Special, $ids);
}
$this->clearSelectedIDs($event);
}
/**
* Return type clauses for list bulding on front
*
* @param kEvent $event
* @return Array
*/
function getTypeClauses($event)
{
$types = $event->getEventParam('types');
$types = $types ? explode(',', $types) : Array ();
$except_types = $event->getEventParam('except');
$except_types = $except_types ? explode(',', $except_types) : Array ();
$type_clauses = Array();
$user_id = $this->Application->RecallVar('user_id');
$owner_field = $this->getOwnerField($event->Prefix);
$type_clauses['my_items']['include'] = '%1$s.'.$owner_field.' = '.$user_id;
$type_clauses['my_items']['except'] = '%1$s.'.$owner_field.' <> '.$user_id;
$type_clauses['my_items']['having_filter'] = false;
$type_clauses['pick']['include'] = '%1$s.EditorsPick = 1 AND '.TABLE_PREFIX.'CategoryItems.PrimaryCat = 1';
$type_clauses['pick']['except'] = '%1$s.EditorsPick! = 1 AND '.TABLE_PREFIX.'CategoryItems.PrimaryCat = 1';
$type_clauses['pick']['having_filter'] = false;
$type_clauses['hot']['include'] = '`IsHot` = 1 AND PrimaryCat = 1';
$type_clauses['hot']['except'] = '`IsHot`! = 1 AND PrimaryCat = 1';
$type_clauses['hot']['having_filter'] = true;
$type_clauses['pop']['include'] = '`IsPop` = 1 AND PrimaryCat = 1';
$type_clauses['pop']['except'] = '`IsPop`! = 1 AND PrimaryCat = 1';
$type_clauses['pop']['having_filter'] = true;
$type_clauses['new']['include'] = '`IsNew` = 1 AND PrimaryCat = 1';
$type_clauses['new']['except'] = '`IsNew`! = 1 AND PrimaryCat = 1';
$type_clauses['new']['having_filter'] = true;
$type_clauses['displayed']['include'] = '';
$displayed = $this->Application->GetVar($event->Prefix.'_displayed_ids');
if ($displayed) {
$id_field = $this->Application->getUnitOption($event->Prefix, 'IDField');
$type_clauses['displayed']['except'] = '%1$s.'.$id_field.' NOT IN ('.$displayed.')';
}
else {
$type_clauses['displayed']['except'] = '';
}
$type_clauses['displayed']['having_filter'] = false;
if (in_array('search', $types) || in_array('search', $except_types)) {
$event_mapping = Array (
'simple' => 'OnSimpleSearch',
'subsearch' => 'OnSubSearch',
'advanced' => 'OnAdvancedSearch'
);
$keywords = $event->getEventParam('keyword_string');
$type = $this->Application->GetVar('search_type', 'simple');
if ( $keywords ) {
// processing keyword_string param of ListProducts tag
$this->Application->SetVar('keywords', $keywords);
$type = 'simple';
}
$search_event = $event_mapping[$type];
$this->$search_event($event);
$object = $event->getObject();
/* @var $object kDBList */
$search_sql = ' FROM ' . TABLE_PREFIX . 'ses_' . $this->Application->GetSID() . '_' . TABLE_PREFIX . 'Search
search_result JOIN %1$s ON %1$s.ResourceId = search_result.ResourceId';
$sql = str_replace('FROM %1$s', $search_sql, $object->GetPlainSelectSQL());
$object->SetSelectSQL($sql);
$object->addCalculatedField('Relevance', 'search_result.Relevance');
$type_clauses['search']['include'] = 'PrimaryCat = 1 AND ('.TABLE_PREFIX.'Categories.Status = '.STATUS_ACTIVE.')';
$type_clauses['search']['except'] = 'PrimaryCat = 1 AND ('.TABLE_PREFIX.'Categories.Status = '.STATUS_ACTIVE.')';
$type_clauses['search']['having_filter'] = false;
}
if (in_array('related', $types) || in_array('related', $except_types)) {
$related_to = $event->getEventParam('related_to');
if (!$related_to) {
$related_prefix = $event->Prefix;
}
else {
$sql = 'SELECT Prefix
FROM '.TABLE_PREFIX.'ItemTypes
WHERE ItemName = '.$this->Conn->qstr($related_to);
$related_prefix = $this->Conn->GetOne($sql);
}
$rel_table = $this->Application->getUnitOption('rel', 'TableName');
$item_type = (int)$this->Application->getUnitOption($event->Prefix, 'ItemType');
if ($item_type == 0) {
trigger_error('<strong>ItemType</strong> not defined for prefix <strong>' . $event->Prefix . '</strong>', E_USER_WARNING);
}
// process case, then this list is called inside another list
$prefix_special = $event->getEventParam('PrefixSpecial');
if (!$prefix_special) {
$prefix_special = $this->Application->Parser->GetParam('PrefixSpecial');
}
$id = false;
if ($prefix_special !== false) {
$processed_prefix = $this->Application->processPrefix($prefix_special);
if ($processed_prefix['prefix'] == $related_prefix) {
// printing related categories within list of items (not on details page)
$list = $this->Application->recallObject($prefix_special);
/* @var $list kDBList */
$id = $list->GetID();
}
}
if ($id === false) {
// printing related categories for single item (possibly on details page)
if ($related_prefix == 'c') {
$id = $this->Application->GetVar('m_cat_id');
}
else {
$id = $this->Application->GetVar($related_prefix . '_id');
}
}
$p_item = $this->Application->recallObject($related_prefix.'.current', NULL, Array('skip_autoload' => true));
/* @var $p_item kCatDBItem */
$p_item->Load( (int)$id );
$p_resource_id = $p_item->GetDBField('ResourceId');
$sql = 'SELECT SourceId, TargetId FROM '.$rel_table.'
WHERE
(Enabled = 1)
AND (
(Type = 0 AND SourceId = '.$p_resource_id.' AND TargetType = '.$item_type.')
OR
(Type = 1
AND (
(SourceId = '.$p_resource_id.' AND TargetType = '.$item_type.')
OR
(TargetId = '.$p_resource_id.' AND SourceType = '.$item_type.')
)
)
)';
$related_ids_array = $this->Conn->Query($sql);
$related_ids = Array();
foreach ($related_ids_array as $record) {
$related_ids[] = $record[ $record['SourceId'] == $p_resource_id ? 'TargetId' : 'SourceId' ];
}
if (count($related_ids) > 0) {
$type_clauses['related']['include'] = '%1$s.ResourceId IN ('.implode(',', $related_ids).') AND PrimaryCat = 1';
$type_clauses['related']['except'] = '%1$s.ResourceId NOT IN ('.implode(',', $related_ids).') AND PrimaryCat = 1';
}
else {
$type_clauses['related']['include'] = '0';
$type_clauses['related']['except'] = '1';
}
$type_clauses['related']['having_filter'] = false;
}
if (in_array('favorites', $types) || in_array('favorites', $except_types)) {
$sql = 'SELECT ResourceId
FROM '.$this->Application->getUnitOption('fav', 'TableName').'
WHERE PortalUserId = '.$this->Application->RecallVar('user_id');
$favorite_ids = $this->Conn->GetCol($sql);
if ($favorite_ids) {
$type_clauses['favorites']['include'] = '%1$s.ResourceId IN ('.implode(',', $favorite_ids).') AND PrimaryCat = 1';
$type_clauses['favorites']['except'] = '%1$s.ResourceId NOT IN ('.implode(',', $favorite_ids).') AND PrimaryCat = 1';
}
else {
$type_clauses['favorites']['include'] = 0;
$type_clauses['favorites']['except'] = 1;
}
$type_clauses['favorites']['having_filter'] = false;
}
return $type_clauses;
}
/**
* Returns SQL clause, that will help to select only data from specified category & it's children
*
* @param int $category_id
* @return string
*/
function getCategoryLimitClause($category_id)
{
if (!$category_id) {
return false;
}
$tree_indexes = $this->Application->getTreeIndex($category_id);
if (!$tree_indexes) {
// id of non-existing category was given
return 'FALSE';
}
return TABLE_PREFIX.'Categories.TreeLeft BETWEEN '.$tree_indexes['TreeLeft'].' AND '.$tree_indexes['TreeRight'];
}
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @return void
* @access protected
* @see kDBEventHandler::OnListBuild()
*/
protected function SetCustomQuery(kEvent $event)
{
parent::SetCustomQuery($event);
$object = $event->getObject();
/* @var $object kDBList */
// add category filter if needed
if ($event->Special != 'showall' && $event->Special != 'user') {
if ( (string)$event->getEventParam('parent_cat_id') !== '' ) {
$parent_cat_id = $event->getEventParam('parent_cat_id');
}
else {
$parent_cat_id = $this->Application->GetVar('c_id');
if (!$parent_cat_id) {
$parent_cat_id = $this->Application->GetVar('m_cat_id');
}
if (!$parent_cat_id) {
$parent_cat_id = 0;
}
}
if ("$parent_cat_id" == '0') {
// replace "0" category with "Content" category id (this way template
$parent_cat_id = $this->Application->getBaseCategory();
}
if ((string)$parent_cat_id != 'any') {
if ($event->getEventParam('recursive')) {
$filter_clause = $this->getCategoryLimitClause($parent_cat_id);
if ($filter_clause !== false) {
$object->addFilter('category_filter', $filter_clause);
}
$object->addFilter('primary_filter', 'PrimaryCat = 1');
}
else {
$object->addFilter('category_filter', TABLE_PREFIX.'CategoryItems.CategoryId = '.$parent_cat_id );
}
}
else {
$object->addFilter('primary_filter', 'PrimaryCat = 1');
}
}
else {
$object->addFilter('primary_filter', 'PrimaryCat = 1');
// if using recycle bin don't show items from there
$recycle_bin = $this->Application->ConfigValue('RecycleBinFolder');
if ($recycle_bin) {
$object->addFilter('recyclebin_filter', TABLE_PREFIX.'CategoryItems.CategoryId <> '.$recycle_bin);
}
}
if ($event->Special == 'user') {
$editable_user = $this->Application->GetVar('u_id');
$object->addFilter('owner_filter', '%1$s.'.$this->getOwnerField($event->Prefix).' = '.$editable_user);
}
// add permission filter
if ($this->Application->RecallVar('user_id') == USER_ROOT) {
// for "root" CATEGORY.VIEW permission is checked for items lists too
$view_perm = 1;
}
else {
// for any real user itemlist view permission is checked instead of CATEGORY.VIEW
$count_helper = $this->Application->recallObject('CountHelper');
/* @var $count_helper kCountHelper */
list ($view_perm, $view_filter) = $count_helper->GetPermissionClause($event->Prefix, 'perm');
$object->addFilter('perm_filter2', $view_filter);
}
$object->addFilter('perm_filter', 'perm.PermId = '.$view_perm);
$types = $event->getEventParam('types');
$this->applyItemStatusFilter($object, $types);
$except_types = $event->getEventParam('except');
$type_clauses = $this->getTypeClauses($event);
$search_helper = $this->Application->recallObject('SearchHelper');
/* @var $search_helper kSearchHelper */
$search_helper->SetComplexFilter($event, $type_clauses, $types, $except_types);
}
/**
* Adds filter that filters out items with non-required statuses
*
* @param kDBList $object
* @param string $types
*/
function applyItemStatusFilter(&$object, $types)
{
// Link1 (before modifications) [Status = 1, OrgId = NULL], Link2 (after modifications) [Status = -2, OrgId = Link1_ID]
$pending_editing = $this->Application->getUnitOption($object->Prefix, 'UsePendingEditing');
if (!$this->Application->isAdminUser) {
$types = explode(',', $types);
if (in_array('my_items', $types)) {
$allow_statuses = Array (STATUS_ACTIVE, STATUS_PENDING, STATUS_PENDING_EDITING);
$object->addFilter('status_filter', '%1$s.Status IN ('.implode(',', $allow_statuses).')');
if ($pending_editing) {
$user_id = $this->Application->RecallVar('user_id');
$this->applyPendingEditingFilter($object, $user_id);
}
}
else {
$object->addFilter('status_filter', '(%1$s.Status = ' . STATUS_ACTIVE . ') AND (' . TABLE_PREFIX . 'Categories.Status = ' . STATUS_ACTIVE . ')');
if ($pending_editing) {
// if category item uses pending editing abilities, then in no cases show pending copies on front
$object->addFilter('original_filter', '%1$s.OrgId = 0 OR %1$s.OrgId IS NULL');
}
}
}
else {
if ($pending_editing) {
$this->applyPendingEditingFilter($object);
}
}
}
/**
* Adds filter, that removes live items if they have pending editing copies
*
* @param kDBList $object
* @param int $user_id
*/
function applyPendingEditingFilter(&$object, $user_id = NULL)
{
$sql = 'SELECT OrgId
FROM '.$object->TableName.'
WHERE Status = '.STATUS_PENDING_EDITING.' AND OrgId IS NOT NULL';
if (isset($user_id)) {
$owner_field = $this->getOwnerField($object->Prefix);
$sql .= ' AND '.$owner_field.' = '.$user_id;
}
$pending_ids = $this->Conn->GetCol($sql);
if ($pending_ids) {
$object->addFilter('no_original_filter', '%1$s.'.$object->IDField.' NOT IN ('.implode(',', $pending_ids).')');
}
}
/**
* Adds calculates fields for item statuses
*
* @param kDBItem|kDBList $object
* @param kEvent $event
* @return void
* @access protected
*/
protected function prepareObject(&$object, kEvent $event)
{
$this->prepareItemStatuses($event);
$object->addCalculatedField('CachedNavbar', 'l' . $this->Application->GetVar('m_lang') . '_CachedNavbar');
if ( $event->Special == 'export' || $event->Special == 'import' ) {
$export_helper = $this->Application->recallObject('CatItemExportHelper');
/* @var $export_helper kCatDBItemExportHelper */
$export_helper->prepareExportColumns($event);
}
}
/**
* Creates calculated fields for all item statuses based on config settings
*
* @param kEvent $event
*/
function prepareItemStatuses($event)
{
$object = $event->getObject( Array('skip_autoload' => true) );
$property_map = $this->Application->getUnitOption($event->Prefix, 'ItemPropertyMappings');
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)
if ($this->Application->isCachingType(CACHING_TYPE_MEMORY)) {
$serial_name = $this->Application->incrementCacheSerial($event->Prefix, NULL, false);
$hot_limit = $this->Application->getCache($property_map['HotLimit'] . '[%' . $serial_name . '%]');
}
else {
$hot_limit = $this->Application->getDBCache($property_map['HotLimit']);
}
if ($hot_limit === false) {
$hot_limit = $this->CalculateHotLimit($event);
}
$object->addCalculatedField('IsHot', ' IF(%1$s.HotItem = 2,
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 >= '.
$this->Application->ConfigValue($property_map['MinPopVotes']).
' AND %1$s.CachedRating >= '.
$this->Application->ConfigValue($property_map['MinPopRating']).
', 1, 0),
%1$s.PopItem)');
}
/**
* Calculates hot limit for current item's table
*
* @param kEvent $event
* @return float
* @access protected
*/
protected function CalculateHotLimit($event)
{
$property_map = $this->Application->getUnitOption($event->Prefix, 'ItemPropertyMappings');
if ( !$property_map ) {
return 0.00;
}
$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
LIMIT ' . $last_hot . ', 1';
$res = $this->Conn->GetCol($sql);
$hot_limit = (double)array_shift($res);
if ( $this->Application->isCachingType(CACHING_TYPE_MEMORY) ) {
$serial_name = $this->Application->incrementCacheSerial($event->Prefix, NULL, false);
$this->Application->setCache($property_map['HotLimit'] . '[%' . $serial_name . '%]', $hot_limit);
}
else {
$this->Application->setDBCache($property_map['HotLimit'], $hot_limit, 3600);
}
return $hot_limit;
}
/**
* Moves item to preferred category, updates item hits
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeItemUpdate(kEvent $event)
{
parent::OnBeforeItemUpdate($event);
$object = $event->getObject();
/* @var $object kCatDBItem */
// update hits field
$property_map = $this->Application->getUnitOption($event->Prefix, 'ItemPropertyMappings');
if ( $property_map ) {
$click_field = $property_map['ClickField'];
if ( $this->Application->isAdminUser && ($this->Application->GetVar($click_field . '_original') !== false) && floor($this->Application->GetVar($click_field . '_original')) != $object->GetDBField($click_field) ) {
$sql = 'SELECT MAX(' . $click_field . ')
FROM ' . $this->Application->getUnitOption($event->Prefix, 'TableName') . '
WHERE FLOOR(' . $click_field . ') = ' . $object->GetDBField($click_field);
$hits = ($res = $this->Conn->GetOne($sql)) ? $res + 0.000001 : $object->GetDBField($click_field);
$object->SetDBField($click_field, $hits);
}
}
// change category
$target_category = $object->GetDBField('CategoryId');
if ( $object->GetOriginalField('CategoryId') != $target_category ) {
$object->MoveToCat($target_category);
}
}
/**
* Occurs after loading item, 'id' parameter
* allows to get id of item that was loaded
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemLoad(kEvent $event)
{
parent::OnAfterItemLoad($event);
$special = substr($event->Special, -6);
$object = $event->getObject();
/* @var $object kCatDBItem */
if ( $special == 'import' || $special == 'export' ) {
$image_data = $object->getPrimaryImageData();
if ( $image_data ) {
$thumbnail_image = $image_data[$image_data['LocalThumb'] ? 'ThumbPath' : 'ThumbUrl'];
if ( $image_data['SameImages'] ) {
$full_image = '';
}
else {
$full_image = $image_data[$image_data['LocalImage'] ? 'LocalPath' : 'Url'];
}
$object->SetDBField('ThumbnailImage', $thumbnail_image);
$object->SetDBField('FullImage', $full_image);
$object->SetDBField('ImageAlt', $image_data['AltName']);
}
}
// substituting pending status value for pending editing
if ( $object->HasField('OrgId') && $object->GetDBField('OrgId') > 0 && $object->GetDBField('Status') == -2 ) {
$new_options = Array ();
$options = $object->GetFieldOption('Status', 'options', false, Array ());
foreach ($options as $key => $val) {
if ( $key == 2 ) {
$key = -2;
}
$new_options[$key] = $val;
}
$object->SetFieldOption('Status', 'options', $new_options);
}
if ( !$this->Application->isAdmin ) {
// linking existing images for item with virtual fields
$image_helper = $this->Application->recallObject('ImageHelper');
/* @var $image_helper ImageHelper */
$image_helper->LoadItemImages($object);
// linking existing files for item with virtual fields
$file_helper = $this->Application->recallObject('FileHelper');
/* @var $file_helper FileHelper */
$file_helper->LoadItemFiles($object);
}
if ( $object->isVirtualField('MoreCategories') ) {
// set item's additional categories to virtual field (used in editing)
$item_categories = $this->getItemCategories($object->GetDBField('ResourceId'));
$object->SetDBField('MoreCategories', $item_categories ? '|' . implode('|', $item_categories) . '|' : '');
}
}
/**
* Occurs after updating item
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemUpdate(kEvent $event)
{
parent::OnAfterItemUpdate($event);
$this->CalculateHotLimit($event);
if ( substr($event->Special, -6) == 'import' ) {
$this->setCustomExportColumns($event);
}
$object = $event->getObject();
/* @var $object kCatDBItem */
if ( !$this->Application->isAdmin ) {
$image_helper = $this->Application->recallObject('ImageHelper');
/* @var $image_helper ImageHelper */
// process image upload in virtual fields
$image_helper->SaveItemImages($object);
$file_helper = $this->Application->recallObject('FileHelper');
/* @var $file_helper FileHelper */
// process file upload in virtual fields
$file_helper->SaveItemFiles($object);
if ( $event->Special != '-item' ) {
// don't touch categories during cloning
$this->processAdditionalCategories($object, 'update');
}
}
$recycle_bin = $this->Application->ConfigValue('RecycleBinFolder');
if ( $this->Application->isAdminUser && $recycle_bin ) {
$sql = 'SELECT CategoryId
FROM ' . $this->Application->getUnitOption('ci', 'TableName') . '
WHERE ItemResourceId = ' . $object->GetDBField('ResourceId') . ' AND PrimaryCat = 1';
$primary_category = $this->Conn->GetOne($sql);
if ( $primary_category == $recycle_bin ) {
$event->CallSubEvent('OnAfterItemDelete');
}
}
if ( $object->GetChangedFields() ) {
$now = adodb_mktime();
$object->SetDBField('Modified_date', $now);
$object->SetDBField('Modified_time', $now);
$object->SetDBField('ModifiedById', $this->Application->RecallVar('user_id'));
}
}
/**
* Sets values for import process
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemCreate(kEvent $event)
{
parent::OnAfterItemCreate($event);
$object = $event->getObject();
/* @var $object kCatDBItem */
if ( substr($event->Special, -6) == 'import' ) {
$this->setCustomExportColumns($event);
}
$object->assignPrimaryCategory();
if ( !$this->Application->isAdmin ) {
$image_helper = $this->Application->recallObject('ImageHelper');
/* @var $image_helper ImageHelper */
// process image upload in virtual fields
$image_helper->SaveItemImages($object);
$file_helper = $this->Application->recallObject('FileHelper');
/* @var $file_helper FileHelper */
// process file upload in virtual fields
$file_helper->SaveItemFiles($object);
if ( $event->Special != '-item' ) {
// don't touch categories during cloning
$this->processAdditionalCategories($object, 'create');
}
}
}
/**
* Make record to search log
*
* @param string $keywords
* @param int $search_type 0 - simple search, 1 - advanced search
*/
function saveToSearchLog($keywords, $search_type = 0)
{
// don't save keywords for each module separately, just one time
// static variable can't help here, because each module uses it's own class instance !
if (!$this->Application->GetVar('search_logged')) {
$sql = 'UPDATE '.TABLE_PREFIX.'SearchLogs
SET Indices = Indices + 1
WHERE Keyword = '.$this->Conn->qstr($keywords).' AND SearchType = '.$search_type; // 0 - simple search, 1 - advanced search
$this->Conn->Query($sql);
if ($this->Conn->getAffectedRows() == 0) {
$fields_hash = Array('Keyword' => $keywords, 'Indices' => 1, 'SearchType' => $search_type);
$this->Conn->doInsert($fields_hash, TABLE_PREFIX.'SearchLogs');
}
$this->Application->SetVar('search_logged', 1);
}
}
/**
* Makes simple search for category items
* based on keywords string
*
* @param kEvent $event
*/
function OnSimpleSearch($event)
{
$event->redirect = false;
$search_table = TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_'.TABLE_PREFIX.'Search';
$keywords = htmlspecialchars_decode( trim($this->Application->GetVar('keywords')) );
$query_object = $this->Application->recallObject('HTTPQuery');
/* @var $query_object kHTTPQuery */
$sql = 'SHOW TABLES LIKE "'.$search_table.'"';
if(!isset($query_object->Get['keywords']) &&
!isset($query_object->Post['keywords']) &&
$this->Conn->Query($sql))
{
return; // used when navigating by pages or changing sorting in search results
}
if(!$keywords || strlen($keywords) < $this->Application->ConfigValue('Search_MinKeyword_Length'))
{
$this->Conn->Query('DROP TABLE IF EXISTS '.$search_table);
$this->Application->SetVar('keywords_too_short', 1);
return; // if no or too short keyword entered, doing nothing
}
$this->Application->StoreVar('keywords', $keywords);
$this->saveToSearchLog($keywords, 0); // 0 - simple search, 1 - advanced search
$event->setPseudoClass('_List');
$object = $event->getObject();
/* @var $object kDBList */
$this->Application->SetVar($event->getPrefixSpecial().'_Page', 1);
$lang = $this->Application->GetVar('m_lang');
$items_table = $this->Application->getUnitOption($event->Prefix, 'TableName');
$module_name = $this->Application->findModule('Var', $event->Prefix, 'Name');
$sql = 'SELECT *
FROM ' . $this->Application->getUnitOption('confs', 'TableName') . '
WHERE ModuleName = ' . $this->Conn->qstr($module_name) . ' AND SimpleSearch = 1';
$search_config = $this->Conn->Query($sql, 'FieldName');
$field_list = array_keys($search_config);
$join_clauses = Array();
// 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 '.$items_table.'.ResourceId = custom_data.ResourceId';
}
// what field in search config becomes what field in sql (key - new field, value - old field (from searchconfig table))
$search_config_map = Array();
foreach ($field_list as $key => $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 ( !$search_config[$field]['CustomFieldId'] && $object->GetFieldOption($field, 'formatter') == 'kMultiLanguage' ) {
$field_list[$key.'_primary'] = 'l'.$this->Application->GetDefaultLanguageId().'_'.$field;
$field_list[$key] = 'l'.$lang.'_'.$field;
if (!isset($search_config[$field]['ForeignField'])) {
$field_list[$key.'_primary'] = $local_table.'.'.$field_list[$key.'_primary'];
$search_config_map[ $field_list[$key.'_primary'] ] = $field;
}
}
// processing fields from other tables
$foreign_field = $search_config[$field]['ForeignField'];
if ( $foreign_field ) {
$exploded = explode(':', $foreign_field, 2);
if ($exploded[0] == 'CALC') {
// ignoring having type clauses in simple search
unset($field_list[$key]);
continue;
}
else {
$multi_lingual = false;
if ($exploded[0] == 'MULTI') {
$multi_lingual = true;
$foreign_field = $exploded[1];
}
$exploded = explode('.', $foreign_field); // format: table.field_name
$foreign_table = TABLE_PREFIX.$exploded[0];
$alias_counter++;
$alias = 't'.$alias_counter;
if ($multi_lingual) {
$field_list[$key] = $alias.'.'.'l'.$lang.'_'.$exploded[1];
$field_list[$key.'_primary'] = 'l'.$this->Application->GetDefaultLanguageId().'_'.$field;
$search_config_map[ $field_list[$key] ] = $field;
$search_config_map[ $field_list[$key.'_primary'] ] = $field;
}
else {
$field_list[$key] = $alias.'.'.$exploded[1];
$search_config_map[ $field_list[$key] ] = $field;
}
$join_clause = str_replace('{ForeignTable}', $alias, $search_config[$field]['JoinClause']);
$join_clause = str_replace('{LocalTable}', $items_table, $join_clause);
$join_clauses[] = ' LEFT JOIN '.$foreign_table.' '.$alias.'
ON '.$join_clause;
}
}
else {
// processing fields from local table
if ($search_config[$field]['CustomFieldId']) {
$local_table = 'custom_data';
// search by custom field value on current language
$custom_field_id = array_search($field_list[$key], $custom_fields);
$field_list[$key] = 'l'.$lang.'_cust_'.$custom_field_id;
// search by custom field value on primary language
$field_list[$key.'_primary'] = $local_table.'.l'.$this->Application->GetDefaultLanguageId().'_cust_'.$custom_field_id;
$search_config_map[ $field_list[$key.'_primary'] ] = $field;
}
$field_list[$key] = $local_table.'.'.$field_list[$key];
$search_config_map[ $field_list[$key] ] = $field;
}
}
// keyword string processing
$search_helper = $this->Application->recallObject('SearchHelper');
/* @var $search_helper kSearchHelper */
$where_clause = Array ();
foreach ($field_list as $field) {
if (preg_match('/^' . preg_quote($items_table, '/') . '\.(.*)/', $field, $regs)) {
// local real field
$filter_data = $search_helper->getSearchClause($object, $regs[1], $keywords, false);
if ($filter_data) {
$where_clause[] = $filter_data['value'];
}
}
elseif (preg_match('/^custom_data\.(.*)/', $field, $regs)) {
$custom_field_name = 'cust_' . $search_config_map[$field];
$filter_data = $search_helper->getSearchClause($object, $custom_field_name, $keywords, false);
if ($filter_data) {
$where_clause[] = str_replace('`' . $custom_field_name . '`', $field, $filter_data['value']);
}
}
else {
$where_clause[] = $search_helper->buildWhereClause($keywords, Array ($field));
}
}
$where_clause = '((' . implode(') OR (', $where_clause) . '))'; // 2 braces for next clauses, see below!
$search_scope = $this->Application->GetVar('search_scope');
if ($search_scope == 'category') {
$category_id = $this->Application->GetVar('m_cat_id');
$category_filter = $this->getCategoryLimitClause($category_id);
if ($category_filter !== false) {
$join_clauses[] = ' LEFT JOIN '.TABLE_PREFIX.'CategoryItems ON '.TABLE_PREFIX.'CategoryItems.ItemResourceId = '.$items_table.'.ResourceId';
$join_clauses[] = ' LEFT JOIN '.TABLE_PREFIX.'Categories ON '.TABLE_PREFIX.'Categories.CategoryId = '.TABLE_PREFIX.'CategoryItems.CategoryId';
$where_clause = '('.$this->getCategoryLimitClause($category_id).') AND '.$where_clause;
}
}
$where_clause = $where_clause . ' AND (' . $items_table . '.Status = ' . STATUS_ACTIVE . ')';
if ($event->MasterEvent && $event->MasterEvent->Name == 'OnListBuild') {
$sub_search_ids = $event->MasterEvent->getEventParam('ResultIds');
if ( $sub_search_ids !== false ) {
if ( $sub_search_ids ) {
$where_clause .= 'AND (' . $items_table . '.ResourceId IN (' . implode(',', $sub_search_ids) . '))';
}
else {
$where_clause .= 'AND FALSE';
}
}
}
// making relevance clause
$positive_words = $search_helper->getPositiveKeywords($keywords);
$this->Application->StoreVar('highlight_keywords', serialize($positive_words));
$revelance_parts = Array();
reset($search_config);
foreach ($positive_words as $keyword_index => $positive_word) {
$positive_word = $search_helper->transformWildcards($positive_word);
$positive_words[$keyword_index] = $this->Conn->escape($positive_word);
}
foreach ($field_list as $field) {
if (!array_key_exists($field, $search_config_map)) {
$map_key = $search_config_map[$items_table . '.' . $field];
}
else {
$map_key = $search_config_map[$field];
}
$config_elem = $search_config[ $map_key ];
$weight = $config_elem['Priority'];
// search by whole words only ([[:<:]] - word boundary)
/*$revelance_parts[] = 'IF('.$field.' REGEXP "[[:<:]]('.implode(' ', $positive_words).')[[:>:]]", '.$weight.', 0)';
foreach ($positive_words as $keyword) {
$revelance_parts[] = 'IF('.$field.' REGEXP "[[:<:]]('.$keyword.')[[:>:]]", '.$weight.', 0)';
}*/
// search by partial word matches too
$revelance_parts[] = 'IF('.$field.' LIKE "%'.implode(' ', $positive_words).'%", '.$weight_sum.', 0)';
foreach ($positive_words as $keyword) {
$revelance_parts[] = 'IF('.$field.' LIKE "%'.$keyword.'%", '.$weight.', 0)';
}
}
$revelance_parts = array_unique($revelance_parts);
$conf_postfix = $this->Application->getUnitOption($event->Prefix, 'SearchConfigPostfix');
$rel_keywords = $this->Application->ConfigValue('SearchRel_Keyword_'.$conf_postfix) / 100;
$rel_pop = $this->Application->ConfigValue('SearchRel_Pop_'.$conf_postfix) / 100;
$rel_rating = $this->Application->ConfigValue('SearchRel_Rating_'.$conf_postfix) / 100;
$relevance_clause = '('.implode(' + ', $revelance_parts).') / '.$weight_sum.' * '.$rel_keywords;
if ($rel_pop && $object->isField('Hits')) {
$relevance_clause .= ' + (Hits + 1) / (MAX(Hits) + 1) * '.$rel_pop;
}
if ($rel_rating && $object->isField('CachedRating')) {
$relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating;
}
// building final search query
if (!$this->Application->GetVar('do_not_drop_search_table')) {
$this->Conn->Query('DROP TABLE IF EXISTS '.$search_table); // erase old search table if clean k4 event
$this->Application->SetVar('do_not_drop_search_table', true);
}
$search_table_exists = $this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"');
if ($search_table_exists) {
$select_intro = 'INSERT INTO '.$search_table.' (Relevance, ItemId, ResourceId, ItemType, EdPick) ';
}
else {
$select_intro = 'CREATE TABLE '.$search_table.' AS ';
}
$edpick_clause = $this->Application->getUnitOption($event->Prefix.'.EditorsPick', 'Fields') ? $items_table.'.EditorsPick' : '0';
$sql = $select_intro.' SELECT '.$relevance_clause.' AS Relevance,
'.$items_table.'.'.$this->Application->getUnitOption($event->Prefix, 'IDField').' AS ItemId,
'.$items_table.'.ResourceId,
'.$this->Application->getUnitOption($event->Prefix, 'ItemType').' AS ItemType,
'.$edpick_clause.' AS EdPick
FROM '.$object->TableName.'
'.implode(' ', $join_clauses).'
WHERE '.$where_clause.'
GROUP BY '.$items_table.'.'.$this->Application->getUnitOption($event->Prefix, 'IDField').' ORDER BY Relevance DESC';
$this->Conn->Query($sql);
if ( !$search_table_exists ) {
$sql = 'ALTER TABLE ' . $search_table . '
ADD INDEX (ResourceId),
ADD INDEX (Relevance)';
$this->Conn->Query($sql);
}
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnSubSearch($event)
{
// keep search results from other items after doing a sub-search on current item type
$this->Application->SetVar('do_not_drop_search_table', true);
$ids = Array ();
$search_table = TABLE_PREFIX . 'ses_' . $this->Application->GetSID() . '_' . TABLE_PREFIX . 'Search';
$sql = 'SHOW TABLES LIKE "' . $search_table . '"';
if ( $this->Conn->Query($sql) ) {
$item_type = $this->Application->getUnitOption($event->Prefix, 'ItemType');
// 1. get ids to be used as search bounds
$sql = 'SELECT DISTINCT ResourceId
FROM ' . $search_table . '
WHERE ItemType = ' . $item_type;
$ids = $this->Conn->GetCol($sql);
// 2. delete previously found ids
$sql = 'DELETE FROM ' . $search_table . '
WHERE ItemType = ' . $item_type;
$this->Conn->Query($sql);
}
$event->setEventParam('ResultIds', $ids);
$event->CallSubEvent('OnSimpleSearch');
}
/**
* Enter description here...
*
* @param kEvent $event
* @todo Change all hardcoded Products table & In-Commerce module usage to dynamic usage from item config !!!
*/
function OnAdvancedSearch($event)
{
$query_object = $this->Application->recallObject('HTTPQuery');
/* @var $query_object kHTTPQuery */
if ( !isset($query_object->Post['andor']) ) {
// used when navigating by pages or changing sorting in search results
return;
}
$this->Application->RemoveVar('keywords');
$this->Application->RemoveVar('Search_Keywords');
$module_name = $this->Application->findModule('Var', $event->Prefix, 'Name');
$sql = 'SELECT *
FROM '.$this->Application->getUnitOption('confs', 'TableName').'
WHERE (ModuleName = '.$this->Conn->qstr($module_name).') AND (AdvancedSearch = 1)';
$search_config = $this->Conn->Query($sql);
$lang = $this->Application->GetVar('m_lang');
$object = $event->getObject();
/* @var $object kDBList */
$object->SetPage(1);
$items_table = $this->Application->getUnitOption($event->Prefix, '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');
$and_conditions = Array();
$or_conditions = Array();
$and_having_conditions = Array();
$or_having_conditions = Array();
$join_clauses = Array();
$highlight_keywords = Array();
$relevance_parts = Array();
$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 '.$items_table.'.ResourceId = custom_data.ResourceId';
}
$search_log = '';
$weight_sum = 0;
// processing fields and preparing conditions
foreach ($search_config as $record) {
$field = $record['FieldName'];
$join_clause = '';
$condition_mode = 'WHERE';
// field processing
$local_table = TABLE_PREFIX.$record['TableName'];
$weight_sum += $record['Priority']; // counting weight sum; used when making relevance clause
// processing multilingual fields
if ( $object->GetFieldOption($field, 'formatter') == 'kMultiLanguage' ) {
$field_name = 'l'.$lang.'_'.$field;
}
else {
$field_name = $field;
}
// processing fields from other tables
$foreign_field = $record['ForeignField'];
if ( $foreign_field ) {
$exploded = explode(':', $foreign_field, 2);
if($exploded[0] == 'CALC')
{
$user_groups = $this->Application->RecallVar('UserGroups');
$field_name = str_replace('{PREFIX}', TABLE_PREFIX, $exploded[1]);
$join_clause = str_replace('{PREFIX}', TABLE_PREFIX, $record['JoinClause']);
$join_clause = str_replace('{USER_GROUPS}', $user_groups, $join_clause);
$join_clause = ' LEFT JOIN '.$join_clause;
$condition_mode = 'HAVING';
}
else {
$exploded = explode('.', $foreign_field);
$foreign_table = TABLE_PREFIX.$exploded[0];
if($record['CustomFieldId']) {
$exploded[1] = 'l'.$lang.'_'.$exploded[1];
}
$alias_counter++;
$alias = 't'.$alias_counter;
$field_name = $alias.'.'.$exploded[1];
$join_clause = str_replace('{ForeignTable}', $alias, $record['JoinClause']);
$join_clause = str_replace('{LocalTable}', $items_table, $join_clause);
if($record['CustomFieldId'])
{
$join_clause .= ' AND '.$alias.'.CustomFieldId='.$record['CustomFieldId'];
}
$join_clause = ' LEFT JOIN '.$foreign_table.' '.$alias.'
ON '.$join_clause;
}
}
else
{
// processing fields from local table
if ($record['CustomFieldId']) {
$local_table = 'custom_data';
$field_name = 'l'.$lang.'_cust_'.array_search($field_name, $custom_fields);
}
$field_name = $local_table.'.'.$field_name;
}
$condition = $this->getAdvancedSearchCondition($field_name, $record, $keywords, $verbs, $highlight_keywords);
if ($record['CustomFieldId'] && strlen($condition)) {
// search in primary value of custom field + value in current language
$field_name = $local_table.'.'.'l'.$this->Application->GetDefaultLanguageId().'_cust_'.array_search($field, $custom_fields);
$primary_condition = $this->getAdvancedSearchCondition($field_name, $record, $keywords, $verbs, $highlight_keywords);
$condition = '('.$condition.' OR '.$primary_condition.')';
}
if ($condition) {
if ($join_clause) {
$join_clauses[] = $join_clause;
}
$relevance_parts[] = 'IF('.$condition.', '.$record['Priority'].', 0)';
if ($glues[$field] == 1) { // and
if ($condition_mode == 'WHERE') {
$and_conditions[] = $condition;
}
else {
$and_having_conditions[] = $condition;
}
}
else { // or
if ($condition_mode == 'WHERE') {
$or_conditions[] = $condition;
}
else {
$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');
}
}
if ($search_log) {
$search_log = implode('<br />', $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->Application->StoreVar('highlight_keywords', serialize($highlight_keywords));
// making relevance clause
if($relevance_parts)
{
$conf_postfix = $this->Application->getUnitOption($event->Prefix, 'SearchConfigPostfix');
$rel_keywords = $this->Application->ConfigValue('SearchRel_Keyword_'.$conf_postfix) / 100;
$rel_pop = $this->Application->ConfigValue('SearchRel_Pop_'.$conf_postfix) / 100;
$rel_rating = $this->Application->ConfigValue('SearchRel_Rating_'.$conf_postfix) / 100;
$relevance_clause = '('.implode(' + ', $relevance_parts).') / '.$weight_sum.' * '.$rel_keywords;
$relevance_clause .= ' + (Hits + 1) / (MAX(Hits) + 1) * '.$rel_pop;
$relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating;
}
else
{
$relevance_clause = '0';
}
// building having clause
if($or_having_conditions)
{
$and_having_conditions[] = '('.implode(' OR ', $or_having_conditions).')';
}
$having_clause = implode(' AND ', $and_having_conditions);
$having_clause = $having_clause ? ' HAVING '.$having_clause : '';
// building where clause
if($or_conditions)
{
$and_conditions[] = '('.implode(' OR ', $or_conditions).')';
}
// $and_conditions[] = $items_table.'.Status = 1';
$where_clause = implode(' AND ', $and_conditions);
if(!$where_clause)
{
if($having_clause)
{
$where_clause = '1';
}
else
{
$where_clause = '0';
$this->Application->SetVar('adv_search_error', 1);
}
}
$where_clause .= ' AND '.$items_table.'.Status = 1';
// building final search query
$search_table = TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_'.TABLE_PREFIX.'Search';
$this->Conn->Query('DROP TABLE IF EXISTS '.$search_table);
$id_field = $this->Application->getUnitOption($event->Prefix, 'IDField');
$fields = $this->Application->getUnitOption($event->Prefix, 'Fields');
$pick_field = isset($fields['EditorsPick']) ? $items_table.'.EditorsPick' : '0';
$sql = ' CREATE TABLE '.$search_table.'
SELECT '.$relevance_clause.' AS Relevance,
'.$items_table.'.'.$id_field.' AS ItemId,
'.$items_table.'.ResourceId AS ResourceId,
11 AS ItemType,
'.$pick_field.' AS EdPick
FROM '.$items_table.'
'.implode(' ', $join_clauses).'
WHERE '.$where_clause.'
GROUP BY '.$items_table.'.'.$id_field.
$having_clause;
$res = $this->Conn->Query($sql);
}
function getAdvancedSearchCondition($field_name, $record, $keywords, $verbs, &$highlight_keywords)
{
$field = $record['FieldName'];
$condition_patterns = Array (
'any' => '%s LIKE %s',
'contains' => '%s LIKE %s',
'notcontains' => '(NOT (%1$s LIKE %2$s) OR %1$s IS NULL)',
'is' => '%s = %s',
'isnot' => '(%1$s != %2$s OR %1$s IS NULL)'
);
$condition = '';
switch ($record['FieldType']) {
case 'select':
$keywords[$field] = htmlspecialchars_decode( $keywords[$field] );
if ($keywords[$field]) {
$condition = sprintf($condition_patterns['is'], $field_name, $this->Conn->qstr( $keywords[$field] ));
}
break;
case 'multiselect':
$keywords[$field] = htmlspecialchars_decode( $keywords[$field] );
if ($keywords[$field]) {
$condition = Array ();
$values = explode('|', substr($keywords[$field], 1, -1));
foreach ($values as $selected_value) {
$condition[] = sprintf($condition_patterns['contains'], $field_name, $this->Conn->qstr('%|'.$selected_value.'|%'));
}
$condition = '('.implode(' OR ', $condition).')';
}
break;
case 'text':
$keywords[$field] = htmlspecialchars_decode( $keywords[$field] );
if (mb_strlen($keywords[$field]) >= $this->Application->ConfigValue('Search_MinKeyword_Length')) {
$highlight_keywords[] = $keywords[$field];
if (in_array($verbs[$field], Array('any', 'contains', 'notcontains'))) {
$keywords[$field] = '%'.strtr($keywords[$field], Array('%' => '\\%', '_' => '\\_')).'%';
}
$condition = sprintf($condition_patterns[$verbs[$field]], $field_name, $this->Conn->qstr( $keywords[$field] ));
}
break;
case 'boolean':
if ($keywords[$field] != -1) {
$property_mappings = $this->Application->getUnitOption($this->Prefix, 'ItemPropertyMappings');
$items_table = $this->Application->getUnitOption($this->Prefix, 'TableName');
switch ($field) {
case 'HotItem':
$hot_limit_var = getArrayValue($property_mappings, 'HotLimit');
if ($hot_limit_var) {
$hot_limit = (int)$this->Application->getDBCache($hot_limit_var);
$condition = 'IF('.$items_table.'.HotItem = 2,
IF('.$items_table.'.Hits >= '.
$hot_limit.
', 1, 0), '.$items_table.'.HotItem) = '.$keywords[$field];
}
break;
case 'PopItem':
$votes2pop_var = getArrayValue($property_mappings, 'VotesToPop');
$rating2pop_var = getArrayValue($property_mappings, 'RatingToPop');
if ($votes2pop_var && $rating2pop_var) {
$condition = 'IF('.$items_table.'.PopItem = 2, IF('.$items_table.'.CachedVotesQty >= '.
$this->Application->ConfigValue($votes2pop_var).
' AND '.$items_table.'.CachedRating >= '.
$this->Application->ConfigValue($rating2pop_var).
', 1, 0), '.$items_table.'.PopItem) = '.$keywords[$field];
}
break;
case 'NewItem':
$new_days_var = getArrayValue($property_mappings, 'NewDays');
if ($new_days_var) {
$condition = 'IF('.$items_table.'.NewItem = 2,
IF('.$items_table.'.CreatedOn >= (UNIX_TIMESTAMP() - '.
$this->Application->ConfigValue($new_days_var).
'*3600*24), 1, 0), '.$items_table.'.NewItem) = '.$keywords[$field];
}
break;
case 'EditorsPick':
$condition = $items_table.'.EditorsPick = '.$keywords[$field];
break;
}
}
break;
case 'range':
$range_conditions = Array();
if ($keywords[$field.'_from'] && !preg_match("/[^0-9]/i", $keywords[$field.'_from'])) {
$range_conditions[] = $field_name.' >= '.$keywords[$field.'_from'];
}
if ($keywords[$field.'_to'] && !preg_match("/[^0-9]/i", $keywords[$field.'_to'])) {
$range_conditions[] = $field_name.' <= '.$keywords[$field.'_to'];
}
if ($range_conditions) {
$condition = implode(' AND ', $range_conditions);
}
break;
case 'date':
if ($keywords[$field]) {
if (in_array($keywords[$field], Array('today', 'yesterday'))) {
$current_time = getdate();
$day_begin = adodb_mktime(0, 0, 0, $current_time['mon'], $current_time['mday'], $current_time['year']);
$time_mapping = Array('today' => $day_begin, 'yesterday' => ($day_begin - 86400));
$min_time = $time_mapping[$keywords[$field]];
}
else {
$time_mapping = Array (
'last_week' => 604800, 'last_month' => 2628000, 'last_3_months' => 7884000,
'last_6_months' => 15768000, 'last_year' => 31536000,
);
$min_time = adodb_mktime() - $time_mapping[$keywords[$field]];
}
$condition = $field_name.' > '.$min_time;
}
break;
}
return $condition;
}
/**
* Returns human readable representation of searched data to be placed in search log
* @param string $type
* @param Array $search_data
* @return string
* @access protected
*/
protected function getHuman($type, $search_data)
{
// all 3 variables are retrieved from $search_data array
/* @var $search_config Array */
/* @var $verb string */
/* @var $value string */
$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':
$values = Array(0 => 'lu_comm_Any', 'today' => 'lu_comm_Today',
'yesterday' => 'lu_comm_Yesterday', 'last_week' => 'lu_comm_LastWeek',
'last_month' => 'lu_comm_LastMonth', 'last_3_months' => 'lu_comm_Last3Months',
'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;
default:
$ret = $value;
break;
}
return '"'.$ret.'"';
break;
}
return '';
}
/**
* Set's correct page for list based on data provided with event
*
* @param kEvent $event
* @return void
* @access protected
* @see kDBEventHandler::OnListBuild()
*/
protected function SetPagination(kEvent $event)
{
$object = $event->getObject();
/* @var $object kDBList */
// get PerPage (forced -> session -> config -> 10)
$object->SetPerPage($this->getPerPage($event));
// main lists on Front-End have special get parameter for page
$page = $object->isMainList() ? $this->Application->GetVar('page') : false;
if ( !$page ) {
// page is given in "env" variable for given prefix
$page = $this->Application->GetVar($event->getPrefixSpecial() . '_Page');
}
if ( !$page && $event->Special ) {
// when not part of env, then variables like "prefix.special_Page" are
// replaced (by PHP) with "prefix_special_Page", so check for that too
$page = $this->Application->GetVar($event->getPrefixSpecial(true) . '_Page');
}
if ( !$object->isMainList() ) {
// main lists doesn't use session for page storing
$this->Application->StoreVarDefault($event->getPrefixSpecial() . '_Page', 1, true); // true for optional
if ( !$page ) {
if ( $this->Application->RewriteURLs() ) {
// when page not found by prefix+special, then try to search it without special at all
$page = $this->Application->GetVar($event->Prefix . '_Page');
if ( !$page ) {
// page not found in request -> get from session
$page = $this->Application->RecallVar($event->Prefix . '_Page');
}
if ( $page ) {
// page found in request -> store in session
$this->Application->StoreVar($event->getPrefixSpecial() . '_Page', $page, true); //true for optional
}
}
else {
// page not found in request -> get from session
$page = $this->Application->RecallVar($event->getPrefixSpecial() . '_Page');
}
}
else {
// page found in request -> store in session
$this->Application->StoreVar($event->getPrefixSpecial() . '_Page', $page, true); //true for optional
}
if ( !$event->getEventParam('skip_counting') ) {
// when stored page is larger, then maximal list page number
// (such case is also processed in kDBList::Query method)
$pages = $object->GetTotalPages();
if ( $page > $pages ) {
$page = 1;
$this->Application->StoreVar($event->getPrefixSpecial() . '_Page', 1, true);
}
}
}
$object->SetPage($page);
}
/* === RELATED TO IMPORT/EXPORT: BEGIN === */
/**
* Shows export dialog
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnExport(kEvent $event)
{
$selected_ids = $this->StoreSelectedIDs($event);
if ( implode(',', $selected_ids) == '' ) {
// K4 fix when no ids found bad selected ids array is formed
$selected_ids = false;
}
$selected_cats_ids = $this->Application->GetVar('export_categories');
$this->Application->StoreVar($event->Prefix . '_export_ids', $selected_ids ? implode(',', $selected_ids) : '');
$this->Application->StoreVar($event->Prefix . '_export_cats_ids', $selected_cats_ids);
$export_helper = $this->Application->recallObject('CatItemExportHelper');
/* @var $export_helper kCatDBItemExportHelper */
$redirect_params = Array (
$this->Prefix . '.export_event' => 'OnNew',
'pass' => 'all,' . $this->Prefix . '.export'
);
$event->setRedirectParams($redirect_params);
}
/**
* Performs each export step & displays progress percent
*
* @param kEvent $event
*/
function OnExportProgress($event)
{
$export_object = $this->Application->recallObject('CatItemExportHelper');
/* @var $export_object kCatDBItemExportHelper */
$event = new kEvent($event->getPrefixSpecial().':OnDummy');
$action_method = 'perform'.ucfirst($event->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 ($event->Special == 'import') {
$this->Application->StoreVar('PermCache_UpdateRequired', 1);
$event->SetRedirectParam('m_cat_id', $this->Application->RecallVar('ImportCategory'));
$event->SetRedirectParam('anchor', 'tab-' . $event->Prefix);
$event->redirect = 'catalog/catalog';
}
elseif ($event->Special == 'export') {
$event->redirect = $export_object->getModuleName($event) . '/' . $event->Special . '_finish';
$event->SetRedirectParam('pass', 'all');
}
return ;
}
$export_options = $export_object->loadOptions($event);
echo $export_options['start_from'] * 100 / $export_options['total_records'];
$event->status = kEvent::erSTOP;
}
/**
* Returns specific to each item type columns only
*
* @param kEvent $event
* @return Array
* @access protected
*/
public function getCustomExportColumns(kEvent $event)
{
return Array (
'__VIRTUAL__ThumbnailImage' => 'ThumbnailImage',
'__VIRTUAL__FullImage' => 'FullImage',
'__VIRTUAL__ImageAlt' => 'ImageAlt'
);
}
/**
* Sets non standart virtual fields (e.g. to other tables)
*
* @param kEvent $event
*/
function setCustomExportColumns($event)
{
$this->restorePrimaryImage($event);
}
/**
* Create/Update primary image record in info found in imported data
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function restorePrimaryImage($event)
{
$object = $event->getObject();
/* @var $object kCatDBItem */
$has_image_info = $object->GetDBField('ImageAlt') && ($object->GetDBField('ThumbnailImage') || $object->GetDBField('FullImage'));
if ( !$has_image_info ) {
return ;
}
$image_data = $object->getPrimaryImageData();
$image = $this->Application->recallObject('img', NULL, Array ('skip_autoload' => true));
/* @var $image kDBItem */
if ( $image_data ) {
$image->Load($image_data['ImageId']);
}
else {
$image->Clear();
$image->SetDBField('Name', 'main');
$image->SetDBField('DefaultImg', 1);
$image->SetDBField('ResourceId', $object->GetDBField('ResourceId'));
}
$image->SetDBField('AltName', $object->GetDBField('ImageAlt'));
if ( $object->GetDBField('ThumbnailImage') ) {
$thumbnail_field = $this->isURL($object->GetDBField('ThumbnailImage')) ? 'ThumbUrl' : 'ThumbPath';
$image->SetDBField($thumbnail_field, $object->GetDBField('ThumbnailImage'));
$image->SetDBField('LocalThumb', $thumbnail_field == 'ThumbPath' ? 1 : 0);
}
if ( !$object->GetDBField('FullImage') ) {
$image->SetDBField('SameImages', 1);
}
else {
$image->SetDBField('SameImages', 0);
$full_field = $this->isURL($object->GetDBField('FullImage')) ? 'Url' : 'LocalPath';
$image->SetDBField($full_field, $object->GetDBField('FullImage'));
$image->SetDBField('LocalImage', $full_field == 'LocalPath' ? 1 : 0);
}
if ( $image->isLoaded() ) {
$image->Update();
}
else {
$image->Create();
}
}
/**
* Detects if image url is specified in a given path (instead of path on disk)
*
* @param string $path
* @return bool
* @access protected
*/
protected function isURL($path)
{
return preg_match('#(http|https)://(.*)#', $path);
}
/**
* Prepares item for import/export operations
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnNew(kEvent $event)
{
parent::OnNew($event);
if ( $event->Special == 'import' || $event->Special == 'export' ) {
$export_helper = $this->Application->recallObject('CatItemExportHelper');
/* @var $export_helper kCatDBItemExportHelper */
$export_helper->setRequiredFields($event);
}
}
/**
* Process items selected in item_selector
*
* @param kEvent $event
*/
function OnProcessSelected($event)
{
$dst_field = $this->Application->RecallVar('dst_field');
$selected_ids = $this->Application->GetVar('selected_ids');
if ( $dst_field == 'ItemCategory' ) {
// Item Edit -> Categories Tab -> New Categories
$object = $event->getObject();
/* @var $object kCatDBItem */
$category_ids = explode(',', $selected_ids['c']);
foreach ($category_ids as $category_id) {
$object->assignToCategory($category_id);
}
}
if ($dst_field == 'ImportCategory') {
// Tools -> Import -> Item Import -> Select Import Category
$this->Application->StoreVar('ImportCategory', $selected_ids['c']);
$event->SetRedirectParam($event->getPrefixSpecial() . '_id', 0);
$event->SetRedirectParam($event->getPrefixSpecial() . '_event', 'OnExportBegin');
}
$event->SetRedirectParam('opener', 'u');
}
/**
* Saves Import/Export settings to session
*
* @param kEvent $event
*/
function OnSaveSettings($event)
{
$event->redirect = false;
$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));
/* @var $object kDBItem */
$object->SetFieldsFromHash($field_values, $this->getRequestProtectedFields($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));
}
}
/**
* Saves Import/Export settings to session
*
* @param kEvent $event
*/
function OnResetSettings($event)
{
$this->Application->StoreVar('ImportCategory', $this->Application->getBaseCategory());
}
/**
* Cancels item editing
* @param kEvent $event
* @return void
* @todo Used?
*/
function OnCancelAction($event)
{
$event->redirect = $this->Application->GetVar('cancel_template');
$event->SetRedirectParam('pass', 'all,' . $event->getPrefixSpecial());
}
/* === RELATED TO IMPORT/EXPORT: END === */
/**
* Stores item's owner login into separate field together with id
*
* @param kEvent $event
* @param string $id_field
* @param string $cached_field
*/
function cacheItemOwner($event, $id_field, $cached_field)
{
$object = $event->getObject();
/* @var $object kDBItem */
- $user_id = $object->GetDBField($id_field);
- $options = $object->GetFieldOptions($id_field);
-
- if ( isset($options['options'][$user_id]) ) {
- $object->SetDBField($cached_field, $options['options'][$user_id]);
- }
- else {
- $id_field = $this->Application->getUnitOption('u', 'IDField');
- $table_name = $this->Application->getUnitOption('u', 'TableName');
-
- $sql = 'SELECT Username
- FROM ' . $table_name . '
- WHERE ' . $id_field . ' = ' . $user_id;
- $object->SetDBField($cached_field, $this->Conn->GetOne($sql));
- }
+ $object->SetDBField($cached_field, $object->GetField($id_field));
}
/**
* Saves edited item into temp table
* If there is no id, new item is created in temp table
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnPreSave(kEvent $event)
{
parent::OnPreSave($event);
$use_pending_editing = $this->Application->getUnitOption($event->Prefix, 'UsePendingEditing');
if ( $event->status == kEvent::erSUCCESS && $use_pending_editing ) {
// decision: clone or not clone
$object = $event->getObject();
/* @var $object kCatDBItem */
if ( $object->GetID() == 0 || $object->GetDBField('OrgId') > 0 ) {
// new items or cloned items shouldn't be cloned again
return ;
}
$perm_helper = $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
$owner_field = $this->getOwnerField($event->Prefix);
if ( $perm_helper->ModifyCheckPermission($object->GetDBField($owner_field), $object->GetDBField('CategoryId'), $event->Prefix) == 2 ) {
// 1. clone original item
$temp_handler = $this->Application->recallObject($event->getPrefixSpecial() . '_TempHandler', 'kTempTablesHandler');
/* @var $temp_handler kTempTablesHandler */
$cloned_ids = $temp_handler->CloneItems($event->Prefix, $event->Special, Array ($object->GetID()), NULL, NULL, NULL, true);
$ci_table = $this->Application->GetTempName(TABLE_PREFIX . 'CategoryItems');
// 2. delete record from CategoryItems (about cloned item) that was automatically created during call of Create method of kCatDBItem
$sql = 'SELECT ResourceId
FROM ' . $object->TableName . '
WHERE ' . $object->IDField . ' = ' . $cloned_ids[0];
$clone_resource_id = $this->Conn->GetOne($sql);
$sql = 'DELETE FROM ' . $ci_table . '
WHERE ItemResourceId = ' . $clone_resource_id . ' AND PrimaryCat = 1';
$this->Conn->Query($sql);
// 3. copy main item categoryitems to cloned item
$sql = ' INSERT INTO ' . $ci_table . ' (CategoryId, ItemResourceId, PrimaryCat, ItemPrefix, Filename)
SELECT CategoryId, ' . $clone_resource_id . ' AS ItemResourceId, PrimaryCat, ItemPrefix, Filename
FROM ' . $ci_table . '
WHERE ItemResourceId = ' . $object->GetDBField('ResourceId');
$this->Conn->Query($sql);
// 4. put cloned id to OrgId field of item being cloned
$sql = 'UPDATE ' . $object->TableName . '
SET OrgId = ' . $object->GetID() . '
WHERE ' . $object->IDField . ' = ' . $cloned_ids[0];
$this->Conn->Query($sql);
// 5. substitute id of item being cloned with clone id
$this->Application->SetVar($event->getPrefixSpecial() . '_id', $cloned_ids[0]);
$selected_ids = $this->getSelectedIDs($event, true);
$selected_ids[ array_search($object->GetID(), $selected_ids) ] = $cloned_ids[0];
$this->StoreSelectedIDs($event, $selected_ids);
// 6. delete original item from temp table
$temp_handler->DeleteItems($event->Prefix, $event->Special, Array ($object->GetID()));
}
}
}
/**
* Sets item's owner field
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnPreCreate(kEvent $event)
{
parent::OnPreCreate($event);
if ( $event->status != kEvent::erSUCCESS ) {
return ;
}
$object = $event->getObject();
/* @var $object kDBItem */
$owner_field = $this->getOwnerField($event->Prefix);
$object->SetDBField($owner_field, $this->Application->RecallVar('user_id'));
}
/**
* Occurs before original item of item in pending editing got deleted (for hooking only)
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeDeleteOriginal(kEvent $event)
{
}
/**
* Occurs after original item of item in pending editing got deleted (for hooking only)
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterDeleteOriginal(kEvent $event)
{
}
/**
* Occurs before an item has been cloned
* Id of newly created item is passed as event' 'id' param
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeClone(kEvent $event)
{
parent::OnBeforeClone($event);
$object = $event->getObject();
/* @var $object kDBItem */
$object->SetDBField('ResourceId', 0); // this will reset it
if ( $this->Application->GetVar('ResetCatBeforeClone') ) {
$object->SetDBField('CategoryId', NULL);
}
}
/**
* Set status for new category item based on user permission in category
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeItemCreate(kEvent $event)
{
parent::OnBeforeItemCreate($event);
$object = $event->getObject();
/* @var $object kCatDBItem */
$is_admin = $this->Application->isAdminUser;
$owner_field = $this->getOwnerField($event->Prefix);
if ( (!$object->IsTempTable() && !$is_admin) || ($is_admin && !$object->GetDBField($owner_field)) ) {
// Front-end OR owner not specified -> set to currently logged-in user
$object->SetDBField($owner_field, $this->Application->RecallVar('user_id'));
}
if ( !$this->Application->isAdmin ) {
$this->setItemStatusByPermission($event);
}
}
/**
* Sets category item status based on user permissions (only on Front-end)
*
* @param kEvent $event
*/
function setItemStatusByPermission($event)
{
$use_pending_editing = $this->Application->getUnitOption($event->Prefix, 'UsePendingEditing');
if (!$use_pending_editing) {
return ;
}
$object = $event->getObject();
/* @var $object kCatDBItem */
$perm_helper = $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
$primary_category = $object->GetDBField('CategoryId') > 0 ? $object->GetDBField('CategoryId') : $this->Application->GetVar('m_cat_id');
$item_status = $perm_helper->AddCheckPermission($primary_category, $event->Prefix);
if ($item_status == STATUS_DISABLED) {
$event->status = kEvent::erFAIL;
}
else {
$object->SetDBField('Status', $item_status);
}
}
/**
* Creates category item & redirects to confirmation template (front-end only)
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnCreate(kEvent $event)
{
parent::OnCreate($event);
$this->SetFrontRedirectTemplate($event, 'suggest');
}
/**
* Returns item's categories (allows to exclude primary category)
*
* @param int $resource_id
* @param bool $with_primary
* @return Array
*/
function getItemCategories($resource_id, $with_primary = false)
{
$sql = 'SELECT CategoryId
FROM '.TABLE_PREFIX.'CategoryItems
WHERE (ItemResourceId = '.$resource_id.')';
if (!$with_primary) {
$sql .= ' AND (PrimaryCat = 0)';
}
return $this->Conn->GetCol($sql);
}
/**
* Adds new and removes old additional categories from category item
*
* @param kCatDBItem $object
* @param int $mode
*/
function processAdditionalCategories(&$object, $mode)
{
if ( !$object->isVirtualField('MoreCategories') ) {
// given category item doesn't require such type of processing
return ;
}
$process_categories = $object->GetDBField('MoreCategories');
if ($process_categories === '') {
// field was not in submit & have default value (when no categories submitted, then value is null)
return ;
}
if ($mode == 'create') {
// prevents first additional category to become primary
$object->assignPrimaryCategory();
}
$process_categories = $process_categories ? explode('|', substr($process_categories, 1, -1)) : Array ();
$existing_categories = $this->getItemCategories($object->GetDBField('ResourceId'));
$add_categories = array_diff($process_categories, $existing_categories);
foreach ($add_categories as $category_id) {
$object->assignToCategory($category_id);
}
$remove_categories = array_diff($existing_categories, $process_categories);
foreach ($remove_categories as $category_id) {
$object->removeFromCategory($category_id);
}
}
/**
* Creates category item & redirects to confirmation template (front-end only)
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnUpdate(kEvent $event)
{
$use_pending = $this->Application->getUnitOption($event->Prefix, 'UsePendingEditing');
if ($this->Application->isAdminUser || !$use_pending) {
parent::OnUpdate($event);
$this->SetFrontRedirectTemplate($event, 'modify');
return ;
}
$object = $event->getObject(Array('skip_autoload' => true));
/* @var $object kCatDBItem */
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if ($items_info) {
$perm_helper = $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
$temp_handler = $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
/* @var $temp_handler kTempTablesHandler */
$owner_field = $this->getOwnerField($event->Prefix);
$file_helper = $this->Application->recallObject('FileHelper');
/* @var $file_helper FileHelper */
foreach ($items_info as $id => $field_values) {
$object->Load($id);
$edit_perm = $perm_helper->ModifyCheckPermission($object->GetDBField($owner_field), $object->GetDBField('CategoryId'), $event->Prefix);
if ($use_pending && !$object->GetDBField('OrgId') && ($edit_perm == STATUS_PENDING)) {
// pending editing enabled + not pending copy -> get/create pending copy & save changes to it
$original_id = $object->GetID();
$original_resource_id = $object->GetDBField('ResourceId');
$file_helper->PreserveItemFiles($field_values);
$object->Load($original_id, 'OrgId');
if (!$object->isLoaded()) {
// 1. user has no pending copy of live item -> clone live item
$cloned_ids = $temp_handler->CloneItems($event->Prefix, $event->Special, Array($original_id), NULL, NULL, NULL, true);
$object->Load($cloned_ids[0]);
$object->SetFieldsFromHash($field_values, $this->getRequestProtectedFields($field_values));
// 1a. delete record from CategoryItems (about cloned item) that was automatically created during call of Create method of kCatDBItem
$ci_table = $this->Application->getUnitOption('ci', 'TableName');
$sql = 'DELETE FROM '.$ci_table.'
WHERE ItemResourceId = '.$object->GetDBField('ResourceId').' AND PrimaryCat = 1';
$this->Conn->Query($sql);
// 1b. copy main item categoryitems to cloned item
$sql = 'INSERT INTO '.$ci_table.' (CategoryId, ItemResourceId, PrimaryCat, ItemPrefix, Filename)
SELECT CategoryId, '.$object->GetDBField('ResourceId').' AS ItemResourceId, PrimaryCat, ItemPrefix, Filename
FROM '.$ci_table.'
WHERE ItemResourceId = '.$original_resource_id;
$this->Conn->Query($sql);
// 1c. put cloned id to OrgId field of item being cloned
$object->SetDBField('Status', STATUS_PENDING_EDITING);
$object->SetDBField('OrgId', $original_id);
}
else {
// 2. user has pending copy of live item -> just update field values
$object->SetFieldsFromHash($field_values, $this->getRequestProtectedFields($field_values));
}
// update id in request (used for redirect in mod-rewrite mode)
$this->Application->SetVar($event->getPrefixSpecial().'_id', $object->GetID());
}
else {
// 3. already editing pending copy -> just update field values
$object->SetFieldsFromHash($field_values, $this->getRequestProtectedFields($field_values));
}
if ($object->Update()) {
$event->status = kEvent::erSUCCESS;
}
else {
$event->status = kEvent::erFAIL;
$event->redirect = false;
break;
}
}
}
$this->SetFrontRedirectTemplate($event, 'modify');
}
/**
* Sets next template to one required for front-end after adding/modifying item
*
* @param kEvent $event
* @param string $template_key - {suggest,modify}
*/
function SetFrontRedirectTemplate($event, $template_key)
{
if ( $this->Application->isAdmin || $event->status != kEvent::erSUCCESS ) {
return;
}
// prepare redirect template
$object = $event->getObject();
/* @var $object kDBItem */
$is_active = ($object->GetDBField('Status') == STATUS_ACTIVE);
$next_template = $is_active ? 'confirm_template' : 'pending_confirm_template';
$event->redirect = $this->Application->GetVar($template_key . '_' . $next_template);
$event->SetRedirectParam('opener', 's');
// send email events
$perm_prefix = $this->Application->getUnitOption($event->Prefix, 'PermItemPrefix');
$owner_field = $this->getOwnerField($event->Prefix);
$owner_id = $object->GetDBField($owner_field);
switch ( $event->Name ) {
case 'OnCreate':
$event_suffix = $is_active ? 'ADD' : 'ADD.PENDING';
$this->Application->EmailEventAdmin($perm_prefix . '.' . $event_suffix); // there are no ADD.PENDING event for admin :(
$this->Application->EmailEventUser($perm_prefix . '.' . $event_suffix, $owner_id);
break;
case 'OnUpdate':
$event_suffix = $is_active ? 'MODIFY' : 'MODIFY.PENDING';
$user_id = is_numeric($object->GetDBField('ModifiedById')) ? $object->GetDBField('ModifiedById') : $owner_id;
$this->Application->EmailEventAdmin($perm_prefix . '.' . $event_suffix); // there are no ADD.PENDING event for admin :(
$this->Application->EmailEventUser($perm_prefix . '.' . $event_suffix, $user_id);
break;
}
}
/**
* Apply same processing to each item being selected in grid
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function iterateItems(kEvent $event)
{
if ( $event->Name != 'OnMassApprove' && $event->Name != 'OnMassDecline' ) {
parent::iterateItems($event);
}
if ( $this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1) ) {
$event->status = kEvent::erFAIL;
return ;
}
$object = $event->getObject(Array ('skip_autoload' => true));
/* @var $object kCatDBItem */
$ids = $this->StoreSelectedIDs($event);
if ( $ids ) {
foreach ($ids as $id) {
$ret = true;
$object->Load($id);
switch ( $event->Name ) {
case 'OnMassApprove':
$ret = $object->ApproveChanges();
break;
case 'OnMassDecline':
$ret = $object->DeclineChanges();
break;
}
if ( !$ret ) {
$event->status = kEvent::erFAIL;
$event->redirect = false;
break;
}
}
}
$this->clearSelectedIDs($event);
}
/**
* Deletes items & preserves clean env
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnDelete(kEvent $event)
{
parent::OnDelete($event);
if ( $event->status == kEvent::erSUCCESS && !$this->Application->isAdmin ) {
$event->SetRedirectParam('pass', 'm');
$event->SetRedirectParam('m_cat_id', 0);
}
}
/**
* Checks, that currently loaded item is allowed for viewing (non permission-based)
*
* @param kEvent $event
* @return bool
* @access protected
*/
protected function checkItemStatus(kEvent $event)
{
$object = $event->getObject();
/* @var $object kDBItem */
if ( !$object->isLoaded() ) {
if ( $event->Special != 'previous' && $event->Special != 'next' ) {
$this->_errorNotFound($event);
}
return true;
}
$status = $object->GetDBField('Status');
$user_id = $this->Application->RecallVar('user_id');
$owner_field = $this->getOwnerField($event->Prefix);
if ( ($status == STATUS_PENDING_EDITING || $status == STATUS_PENDING) && ($object->GetDBField($owner_field) == $user_id) ) {
return true;
}
return $status == STATUS_ACTIVE;
}
/**
* Set's correct sorting for list based on data provided with event
*
* @param kEvent $event
* @return void
* @access protected
* @see kDBEventHandler::OnListBuild()
*/
protected function SetSorting(kEvent $event)
{
if ( !$this->Application->isAdmin ) {
$event->setEventParam('same_special', true);
}
$types = $event->getEventParam('types');
$types = $types ? explode(',', $types) : Array ();
if ( in_array('search', $types) ) {
$event->setPseudoClass('_List');
$object = $event->getObject();
/* @var $object kDBList */
// 1. no user sorting - sort by relevance
$default_sortings = parent::_getDefaultSorting($event);
$default_sorting = key($default_sortings['Sorting']) . ',' . current($default_sortings['Sorting']);
if ( $object->isMainList() ) {
$sort_by = $this->Application->GetVar('sort_by', '');
if ( !$sort_by ) {
$this->Application->SetVar('sort_by', 'Relevance,desc|' . $default_sorting);
}
elseif ( strpos($sort_by, 'Relevance,') !== false ) {
$this->Application->SetVar('sort_by', $sort_by . '|' . $default_sorting);
}
}
else {
$sorting_settings = $this->getListSetting($event, 'Sortings');
$sort_by = trim(getArrayValue($sorting_settings, 'Sort1') . ',' . getArrayValue($sorting_settings, 'Sort1_Dir'), ',');
if ( !$sort_by ) {
$event->setEventParam('sort_by', 'Relevance,desc|' . $default_sorting);
}
elseif ( strpos($sort_by, 'Relevance,') !== false ) {
$event->setEventParam('sort_by', $sort_by . '|' . $default_sorting);
}
}
$this->_removeForcedSortings($event);
}
parent::SetSorting($event);
}
/**
* Removes forced sortings
*
* @param kEvent $event
*/
protected function _removeForcedSortings(kEvent $event)
{
$list_sortings = $this->Application->getUnitOption($event->Prefix, 'ListSortings', Array ());
/* @var $list_sortings Array */
foreach ($list_sortings as $special => $sortings) {
unset($list_sortings[$special]['ForcedSorting']);
}
$this->Application->setUnitOption($event->Prefix, 'ListSortings', $list_sortings);
}
/**
* Default sorting in search results only comes from relevance field
*
* @param kEvent $event
* @return Array
* @access protected
*/
protected function _getDefaultSorting(kEvent $event)
{
$types = $event->getEventParam('types');
$types = $types ? explode(',', $types) : Array ();
return in_array('search', $types) ? Array () : parent::_getDefaultSorting($event);
}
/**
* Returns current per-page setting for list
*
* @param kEvent $event
* @return int
* @access protected
*/
protected function getPerPage(kEvent $event)
{
if ( !$this->Application->isAdmin ) {
$event->setEventParam('same_special', true);
}
return parent::getPerPage($event);
}
/**
* Returns owner field for given prefix
*
* @param $prefix
* @return string
* @access protected
*/
protected function getOwnerField($prefix)
{
return $this->Application->getUnitOption($prefix, 'OwnerField', 'CreatedById');
}
/**
* Creates virtual image fields for item
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterConfigRead(kEvent $event)
{
parent::OnAfterConfigRead($event);
if (defined('IS_INSTALL') && IS_INSTALL) {
return ;
}
if ( !$this->Application->isAdmin ) {
$file_helper = $this->Application->recallObject('FileHelper');
/* @var $file_helper FileHelper */
$file_helper->createItemFiles($event->Prefix, true); // create image fields
$file_helper->createItemFiles($event->Prefix, false); // create file fields
}
$this->changeSortings($event);
// add grids for advanced view (with primary category column)
$grids = $this->Application->getUnitOption($this->Prefix, 'Grids');
$process_grids = Array ('Default', 'Radio');
foreach ($process_grids as $process_grid) {
$grid_data = $grids[$process_grid];
$grid_data['Fields']['CachedNavbar'] = Array ('title' => 'la_col_Path', 'data_block' => 'grid_primary_category_td', 'filter_block' => 'grid_like_filter');
$grids[$process_grid . 'ShowAll'] = $grid_data;
}
$this->Application->setUnitOption($this->Prefix, 'Grids', $grids);
// add options for CategoryId field (quick way to select item's primary category)
$category_helper = $this->Application->recallObject('CategoryHelper');
/* @var $category_helper CategoryHelper */
$virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields');
$virtual_fields['CategoryId']['default'] = (int)$this->Application->GetVar('m_cat_id');
$virtual_fields['CategoryId']['options'] = $category_helper->getStructureTreeAsOptions();
$this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields);
}
function changeSortings($event)
{
$remove_sortings = Array ();
if ( !$this->Application->isAdmin ) {
// remove Pick sorting on Front-end, when not required
$config_mapping = $this->Application->getUnitOption($event->Prefix, 'ConfigMapping', Array ());
if ( !isset($config_mapping['ForceEditorPick']) || !$this->Application->ConfigValue($config_mapping['ForceEditorPick']) ) {
$remove_sortings[] = 'EditorsPick';
}
}
else {
// remove all forced sortings in Admin Console
$remove_sortings = array_merge($remove_sortings, Array ('Priority', 'EditorsPick'));
}
if ( !$remove_sortings ) {
return;
}
$list_sortings = $this->Application->getUnitOption($event->Prefix, 'ListSortings', Array ());
/* @var $list_sortings Array */
foreach ($list_sortings as $special => $sorting_fields) {
foreach ($remove_sortings as $sorting_field) {
unset($list_sortings[$special]['ForcedSorting'][$sorting_field]);
}
}
$this->Application->setUnitOption($event->Prefix, 'ListSortings', $list_sortings);
}
/**
* Returns file contents associated with item
*
* @param kEvent $event
*/
function OnDownloadFile($event)
{
$object = $event->getObject();
/* @var $object kCatDBItem */
$event->status = kEvent::erSTOP;
$field = $this->Application->GetVar('field');
if (!preg_match('/^File([\d]+)/', $field)) {
return ;
}
$file_helper = $this->Application->recallObject('FileHelper');
/* @var $file_helper FileHelper */
$filename = $object->GetField($field, 'full_path');
$file_helper->DownloadFile($filename);
}
/**
* Saves user's vote
*
* @param kEvent $event
*/
function OnMakeVote($event)
{
$event->status = kEvent::erSTOP;
if ($this->Application->GetVar('ajax') != 'yes') {
// this is supposed to call from AJAX only
return ;
}
$rating_helper = $this->Application->recallObject('RatingHelper');
/* @var $rating_helper RatingHelper */
$object = $event->getObject( Array ('skip_autoload' => true) );
/* @var $object kCatDBItem */
$object->Load( $this->Application->GetVar('id') );
echo $rating_helper->makeVote($object);
}
/**
* Marks review as useful
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnReviewHelpful($event)
{
if ( $this->Application->GetVar('ajax') == 'yes' ) {
$event->status = kEvent::erSTOP;
}
$review_id = (int)$this->Application->GetVar('review_id');
if ( !$review_id ) {
return;
}
$spam_helper = $this->Application->recallObject('SpamHelper');
/* @var $spam_helper SpamHelper */
$spam_helper->InitHelper($review_id, 'ReviewHelpful', strtotime('+1 month') - strtotime('now'));
$field = (int)$this->Application->GetVar('helpful') ? 'HelpfulCount' : 'NotHelpfulCount';
$sql = 'SELECT ' . $field . '
FROM ' . $this->Application->getUnitOption('rev', 'TableName') . '
WHERE ' . $this->Application->getUnitOption('rev', 'IDField') . ' = ' . $review_id;
$count = $this->Conn->GetOne($sql);
if ( $spam_helper->InSpamControl() ) {
if ( $this->Application->GetVar('ajax') == 'yes' ) {
echo $count;
}
return;
}
$sql = 'UPDATE ' . $this->Application->getUnitOption('rev', 'TableName') . '
SET ' . $field . ' = ' . $field . ' + 1
WHERE ' . $this->Application->getUnitOption('rev', 'IDField') . ' = ' . $review_id;
$this->Conn->Query($sql);
if ( $this->Conn->getAffectedRows() ) {
// db was changed -> review with such ID exists
$spam_helper->AddToSpamControl();
}
if ( $this->Application->GetVar('ajax') == 'yes' ) {
echo $count + 1;
}
}
/**
* [HOOK] Allows to add cloned subitem to given prefix
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnCloneSubItem(kEvent $event)
{
parent::OnCloneSubItem($event);
if ( $event->MasterEvent->Prefix == 'fav' ) {
$clones = $this->Application->getUnitOption($event->MasterEvent->Prefix, 'Clones');
$subitem_prefix = $event->Prefix . '-' . $event->MasterEvent->Prefix;
$clones[$subitem_prefix]['ParentTableKey'] = 'ResourceId';
$clones[$subitem_prefix]['ForeignKey'] = 'ResourceId';
$this->Application->setUnitOption($event->MasterEvent->Prefix, 'Clones', $clones);
}
}
/**
* Set's new unique resource id to user
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemValidate(kEvent $event)
{
$object = $event->getObject();
/* @var $object kDBItem */
$resource_id = $object->GetDBField('ResourceId');
if ( !$resource_id ) {
$object->SetDBField('ResourceId', $this->Application->NextResourceId());
}
}
}
\ No newline at end of file
Index: branches/5.2.x/core/kernel/constants.php
===================================================================
--- branches/5.2.x/core/kernel/constants.php (revision 15562)
+++ branches/5.2.x/core/kernel/constants.php (revision 15563)
@@ -1,198 +1,199 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
// item statuses
define('STATUS_DISABLED', 0);
define('STATUS_ACTIVE', 1);
define('STATUS_PENDING', 2);
define('STATUS_PENDING_EDITING', -2);
// sections
define('stTREE', 1);
define('stTAB', 2);
define('smHIDE', 0); // always hide section from tree
define('smNORMAL', 1); // show section even, if they were marked as smDEBUG or smSUPER_ADMIN before
define('smDEBUG', 2); // show section in debug mode only
define('smSUPER_ADMIN', 4); // show section in super admin & debug mode
// permission types
define('ptCATEGORY', 0);
define('ptSYSTEM', 1);
define('EDIT_MARK', '&|edit|&'); // replace this sequence inside filters to SID[_main_wid]
$application =& kApplication::Instance();
$spacer_url = $application->BaseURL().'core/admin_templates/img/spacer.gif';
define('SPACER_URL', $spacer_url);
if (!$application->isAdmin) {
// don't show debugger buttons on front (if not overridden in "debug.php")
kUtil::safeDefine('DBG_TOOLBAR_BUTTONS', 0);
}
// common usage regular expressions
define('REGEX_EMAIL_USER', '[-a-zA-Z0-9!\#$%&*+\/=?^_`{|}~.]+');
define('REGEX_EMAIL_DOMAIN', '[a-zA-Z0-9]{1}[-.a-zA-Z0-9_]*\.[a-zA-Z]{2,6}');
define('ALLOW_DEFAULT_SETTINGS', '_USE_DEFAULT_USER_DATA_'); //Allow persistent vars to take data from default user's persistent data
class ChangeLog {
const CREATE = 1;
const UPDATE = 2;
const DELETE = 3;
}
// Separator for ValueList fields
define('VALUE_LIST_SEPARATOR', '||');
// template editing modes
define('EDITING_MODE_BROWSE', 1); // no changes, front-end as users see it
define('EDITING_MODE_CONTENT', 2); // content blocks + phrase editing
define('EDITING_MODE_DESIGN', 3); // all other blocks
class ScheduledTask {
const TYPE_USER = 1;
const TYPE_SYSTEM = 2;
const LAST_RUN_SUCCEEDED = 1;
const LAST_RUN_FAILED = 0;
const LAST_RUN_RUNNING = 2;
}
// place for product file uploads (sort of "/system/images" but for all other files)
define('ITEM_FILES_PATH', WRITEBALE_BASE . '/downloads/');
class MailingList {
const NOT_PROCESSED = 1;
const PARTIALLY_PROCESSED = 2;
const PROCESSED = 3;
const CANCELLED = 4;
}
// theme file statuses (related to structure creation process)
define('SMS_MODE_AUTO', 1);
define('SMS_MODE_FORCE', 2);
// Means, that actual category Template field value should inherited from parent category
define('CATEGORY_TEMPLATE_INHERIT', '#inherit#');
define('REWRITE_MODE_BUILD', 1);
define('REWRITE_MODE_PARSE', 2);
define('SESSION_LOG_ACTIVE', 0);
define('SESSION_LOG_LOGGED_OUT', 1);
define('SESSION_LOG_EXPIRED', 2);
class LoginResult {
const OK = 0;
const INVALID_LOGIN = 1;
const INVALID_PASSWORD = 2;
const BANNED = 3;
const NO_PERMISSION = 4;
}
define('DESTINATION_TYPE_COUNTRY', 1);
define('DESTINATION_TYPE_STATE', 2);
class SubmissionFormField {
const VISIBILITY_EVERYONE = 1;
const VISIBILITY_UNREGISTERED = 2;
const COMMUNICATION_ROLE_NAME = 1;
const COMMUNICATION_ROLE_EMAIL = 2;
const COMMUNICATION_ROLE_SUBJECT = 3;
const COMMUNICATION_ROLE_BODY = 4;
}
// form submission statuses
define('SUBMISSION_REPLIED', 1); // submission was replied by admin
define('SUBMISSION_NOT_REPLIED', 2); // submission has no client replies (no messages at all)
define('SUBMISSION_NEW_EMAIL', 3); // submission have new reply/email from client
define('SUBMISSION_BOUNCE', 4); // submission have bounce from client
// submission log statuses
define('SUBMISSION_LOG_SENT', 1);
define('SUBMISSION_LOG_BOUNCE', 2);
define('SUBMISSION_LOG_REPLIED', 1);
define('SUBMISSION_LOG_ATTACHMENT_PATH', WRITEBALE_BASE . '/user_files/submission_log/');
define('TIMENOW', adodb_mktime()); // for faster message processing
+ define('USER_TITLE_FIELD', 'IF(Email = "", Username, Email)');
// site domains
define('SITE_DOMAIN_REDIRECT_CURRENT', 1);
define('SITE_DOMAIN_REDIRECT_EXTERNAL', 2);
class EmailEvent {
const EVENT_TYPE_FRONTEND = 0;
const EVENT_TYPE_ADMIN = 1;
const ADDRESS_TYPE_EMAIL = 1;
const ADDRESS_TYPE_USER = 2;
const ADDRESS_TYPE_GROUP = 3;
const RECIPIENT_TYPE_TO = 1;
const RECIPIENT_TYPE_CC = 2;
const RECIPIENT_TYPE_BCC = 3;
}
define('PAGE_TYPE_VIRTUAL', 1);
define('PAGE_TYPE_TEMPLATE', 2);
define('CONTENT_LASTAUTOSAVE_UPDATE_INTERVAL', 5 * 60); // 5 minutes
define('CONTENT_LASTAUTOSAVE_REFRESH_INTERVAL', 20); // 20 seconds
define('hBEFORE', 1);
define('hAFTER', 2);
class UserType {
const USER = 0;
const ADMIN = 1;
}
// selectors
define('STYLE_BASE', 1);
define('STYLE_BLOCK', 2);
class Language {
const SYNCHRONIZE_TO_OTHERS = 1;
const SYNCHRONIZE_FROM_OTHERS = 2;
const SYNCHRONIZE_DEFAULT = '|1|2|';
const PHRASE_TYPE_FRONT = 0;
const PHRASE_TYPE_ADMIN = 1;
const PHRASE_TYPE_COMMON = 2;
}
class PromoBlockType {
const INTERNAL = 1;
const EXTERNAL = 2;
}
class StorageEngine {
const HASH = 1;
const TIMESTAMP = 2;
const PS_DATE_TIME = 'DATE-TIME';
const PS_PREFIX = 'PREFIX';
const PS_USER = 'USER';
}
class CategoryPermissionRebuild {
const MANUAL = 1;
const SILENT = 2;
const AUTOMATIC = 3;
}
Index: branches/5.2.x/core/kernel/utility/formatters/left_formatter.php
===================================================================
--- branches/5.2.x/core/kernel/utility/formatters/left_formatter.php (revision 15562)
+++ branches/5.2.x/core/kernel/utility/formatters/left_formatter.php (revision 15563)
@@ -1,102 +1,124 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2011 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
/**
* Replacement for kOptionsFormatter in case if options
* should be selected from database. Use this formatter
* only in case if formatter attached field is in edit form.
*
* For usage in grid just use LEFT JOIN clause to table
* where requested options are located.
*/
class kLEFTFormatter extends kFormatter {
/**
* Formats value of a given field
*
* @param string $value
* @param string $field_name
* @param kDBItem|kDBList $object
* @param string $format
* @return string
*/
function Format($value, $field_name, &$object, $format=null)
{
if ( is_null($value) ) {
return '';
}
$options = $object->GetFieldOptions($field_name);
if ( isset($format) ) {
$options['format'] = $format;
}
if ( !isset($options['options'][$value]) ) {
// required option is not defined in config => query for it
- $sql = sprintf($options['left_sql'], $options['left_title_field'], $options['left_key_field'], $this->Conn->escape($value));
+ $display_field = $this->_escapeField($options['left_title_field']);
+ $match_field = $this->_escapeField($options['left_key_field']);
+
+ $sql = sprintf($options['left_sql'], $display_field, $match_field . ' = ' . $this->Conn->qstr($value));
$options['options'][$value] = $this->Conn->GetOne($sql);
if ( $options['options'][$value] === false ) {
return $value;
}
}
return $options['options'][$value];
}
/**
+ * Escape field names, but not expressions
+ *
+ * @param string $field_name
+ * @return string
+ * @access protected
+ */
+ protected function _escapeField($field_name)
+ {
+ if ( preg_match('/^[a-z_]+$/i', $field_name) ) {
+ return '`' . $field_name . '`';
+ }
+
+ return $field_name;
+ }
+
+ /**
* Performs basic type validation on form field value
*
* @param mixed $value
* @param string $field_name
* @param kDBItem $object
* @return mixed
* @access public
*/
public function Parse($value, $field_name, &$object)
{
if ( $value == '' ) {
return NULL;
}
$options = $object->GetFieldOptions($field_name);
$found = isset($options['options']) ? array_search($value, $options['options']) : false;
if ( $found !== false ) {
// requested option found among field options
return $found;
}
// requested option is not found in field options -> query for it
- $sql = sprintf($options['left_sql'], $options['left_key_field'], $options['left_title_field'], $this->Conn->escape($value));
+ $display_field = $this->_escapeField($options['left_key_field']);
+ $match_field = $this->_escapeField($options['left_title_field']);
+
+ $sql = sprintf($options['left_sql'], $display_field, $match_field . ' = ' . $this->Conn->qstr($value));
$found = $this->Conn->GetOne($sql);
if ( $found !== false ) {
// option successfully retrieved from db -> cache it
$options['options'][$found] = $value;
}
$skip_errors = array_key_exists('skip_errors', $options) && $options['skip_errors'];
-
+
if ( $found === false && !$skip_errors ) {
// option not found at all -> return not formatted value & set error
$object->SetError($field_name, 'invalid_option', 'la_error_InvalidOption');
return $value;
}
return $found;
}
}
\ No newline at end of file
Index: branches/5.2.x/core/units/visits/visits_config.php
===================================================================
--- branches/5.2.x/core/units/visits/visits_config.php (revision 15562)
+++ branches/5.2.x/core/units/visits/visits_config.php (revision 15563)
@@ -1,178 +1,178 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'visits',
'ItemClass' => Array ('class' => 'kDBItem','file' => '','build_event' => 'OnItemBuild'),
'ListClass' => Array ('class' => 'VisitsList','file' => 'visits_list.php','build_event' => 'OnListBuild'),
'EventHandlerClass' => Array ('class' => 'VisitsEventHandler','file' => 'visits_event_handler.php','build_event' => 'OnBuild'),
'TagProcessorClass' => Array ('class' => 'VisitsTagProcessor','file' => 'visits_tag_processor.php','build_event' => 'OnBuild'),
'AutoLoad' => true,
'QueryString' => Array (
1 => 'id',
2 => 'Page',
3 => 'PerPage',
4 => 'event',
5 => 'mode',
),
'Hooks' => Array (
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => 'adm',
'HookToSpecial' => '',
'HookToEvent' => Array ( 'OnStartup' ),
'DoPrefix' => '',
'DoSpecial' => '',
'DoEvent' => 'OnRegisterVisit',
),
Array (
'Mode' => hAFTER,
'Conditional' => false,
'HookToPrefix' => 'u',
'HookToSpecial' => '*',
'HookToEvent' => Array ( 'OnAfterLogin' ),
'DoPrefix' => '',
'DoSpecial' => '',
'DoEvent' => 'OnUserLogin',
),
),
'IDField' => 'VisitId',
'TableName' => TABLE_PREFIX.'UserVisits',
'PermSection' => Array ('main' => 'in-portal:visits'),
'Sections' => Array (
'in-portal:visits' => Array (
'parent' => 'in-portal:reports',
'icon' => 'visits',
'label' => 'la_tab_VisitorLog',
'url' => Array ('t' => 'logs/visits/visits_list', 'pass' => 'm'),
'permissions' => Array ('view', 'delete'),
'priority' => 6,
'type' => stTREE,
),
),
'TitlePresets' => Array (
'visits_list' => Array (
'prefixes' => Array ('visits_List'), 'format' => "!la_title_Visits!",
'toolbar_buttons' => Array ('search', 'search_reset', 'refresh', 'delete', 'export', 'view'),
),
'visits.incommerce_list' => Array (
'prefixes' => Array ('visits.incommerce_List'), 'format' => "!la_title_Visits!",
'toolbar_buttons' => Array ('search', 'search_reset', 'refresh', 'delete', 'export', 'view'),
),
),
'CalculatedFields' => Array (
'' => Array (
- 'UserName' => 'IF( ISNULL(u.Username), IF (%1$s.PortalUserId = ' . USER_ROOT . ', \'root\', IF (%1$s.PortalUserId = ' . USER_GUEST . ', \'Guest\', \'n/a\')), u.Username)',
+ 'UserName' => 'IF( ISNULL(u.Username), IF (%1$s.PortalUserId = ' . USER_ROOT . ', \'root\', IF (%1$s.PortalUserId = ' . USER_GUEST . ', \'Guest\', \'n/a\')), IF(u.Username = "", u.Email, u.Username))',
),
'incommerce' => Array (
- 'UserName' => 'IF( ISNULL(u.Username), IF (%1$s.PortalUserId = ' . USER_ROOT . ', \'root\', IF (%1$s.PortalUserId = ' . USER_GUEST . ', \'Guest\', \'n/a\')), u.Username)',
- 'AffiliateUser' => 'IF( LENGTH(au.Username),au.Username,\'!la_None!\')',
+ 'UserName' => 'IF( ISNULL(u.Username), IF (%1$s.PortalUserId = ' . USER_ROOT . ', \'root\', IF (%1$s.PortalUserId = ' . USER_GUEST . ', \'Guest\', \'n/a\')), IF(u.Username = "", u.Email, u.Username))',
+ 'AffiliateUser' => 'IF(au.PortalUserId IS NULL, "!la_None!", IF(au.Username = "", au.Email, au.Username))',
'AffiliatePortalUserId' => 'af.PortalUserId',
'OrderTotalAmount' => 'IF(ord.Status = 4, ord.SubTotal+ord.ShippingCost+ord.VAT, 0)',
'OrderAffiliateCommission' => 'IF(ord.Status = 4, ord.AffiliateCommission, 0)',
'OrderNumber' => 'CONCAT(LPAD(Number,6,"0"),\'-\',LPAD(SubNumber,3,"0") )',
'OrderId' => 'ord.OrderId',
),
),
'ListSQLs' => Array ( '' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Users u ON %1$s.PortalUserId = u.PortalUserId',
'incommerce' => '
SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Users u ON %1$s.PortalUserId = u.PortalUserId
LEFT JOIN '.TABLE_PREFIX.'Affiliates af ON %1$s.AffiliateId = af.AffiliateId
LEFT JOIN '.TABLE_PREFIX.'Users au ON af.PortalUserId = au.PortalUserId
LEFT JOIN '.TABLE_PREFIX.'Orders ord ON %1$s.VisitId = ord.VisitId',
),
'ItemSQLs' => Array ( '' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Users u ON %1$s.PortalUserId = u.PortalUserId',
'incommerce' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Users u ON %1$s.PortalUserId = u.PortalUserId
LEFT JOIN '.TABLE_PREFIX.'Affiliates af ON %1$s.AffiliateId = af.AffiliateId
LEFT JOIN '.TABLE_PREFIX.'Users au ON af.PortalUserId = au.PortalUserId
LEFT JOIN '.TABLE_PREFIX.'Orders ord ON %1$s.VisitId = ord.VisitId',
),
'ListSortings' => Array (
'' => Array (
'Sorting' => Array ('VisitDate' => 'desc'),
)
),
'Fields' => Array (
'VisitId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'VisitDate' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'custom_filter' => 'date_range', 'default' => NULL),
'Referer' => Array ('type' => 'string','not_null' => '1','default' => ''),
'IPAddress' => Array ('type' => 'string','not_null' => '1','default' => ''),
- 'AffiliateId' => Array ('type' => 'int','formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (0 => 'lu_None'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Affiliates af LEFT JOIN '.TABLE_PREFIX.'Users pu ON pu.PortalUserId = af.PortalUserId WHERE `%s` = \'%s\'','left_key_field' => 'AffiliateId','left_title_field' => 'Username','not_null'=>1,'default'=>0),
+ 'AffiliateId' => Array ('type' => 'int','formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (0 => 'lu_None'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Affiliates af LEFT JOIN '.TABLE_PREFIX.'Users u ON u.PortalUserId = af.PortalUserId WHERE %s','left_key_field' => 'AffiliateId','left_title_field' => 'IF(u.Email = "", u.Username, u.Email)','not_null'=>1,'default'=>0),
'PortalUserId' => Array ('type' => 'int','not_null' => '1','default' => USER_GUEST),
),
'VirtualFields' => Array (
'UserName' => Array ('type' => 'string', 'default' => ''),
'AffiliateUser' => Array ('type' => 'string', 'default' => ''),
'AffiliatePortalUserId' => Array ('type' => 'int', 'default' => null),
'OrderTotalAmount' => Array ('type' => 'float', 'formatter' => 'kFormatter', 'format' => '%01.2f', 'default' => '0.00', 'totals' => 'SUM'),
'OrderTotalAmountSum' => Array ('type' => 'float', 'formatter' => 'kFormatter', 'format' => '%01.2f', 'default' => '0.00'),
'OrderAffiliateCommission' => Array ('type' => 'double', 'formatter' => 'kFormatter','format' => '%.02f', 'default' => '0.0000', 'totals' => 'SUM'),
'OrderAffiliateCommissionSum' => Array ('type' => 'double', 'formatter' => 'kFormatter','format' => '%.02f', 'default' => '0.0000'),
'OrderNumber' => Array ('type' => 'string', 'default' => ''),
'OrderId' => Array ('type' => 'int', 'default' => '0'),
),
'Grids' => Array (
'Default' => Array (
'Icons' => Array ('default' => 'icon16_item.png'),
'Fields' => Array (
'VisitDate' => Array ( 'title' => 'la_col_VisitDate', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_date_range_filter', 'width' => 145, ),
'IPAddress' => Array ( 'title' => 'la_col_IP', 'filter_block' => 'grid_like_filter', 'width' => 130, ),
'Referer' => Array ( 'title' => 'la_col_Referer', 'data_block' => 'grid_referer_td', 'filter_block' => 'grid_like_filter', 'width' => 250, ),
'UserName' => Array ('title' => 'column:la_fld_Username', 'data_block' => 'grid_userlink_td', 'user_field' => 'PortalUserId', 'filter_block' => 'grid_like_filter', 'width' => 100, ),
),
),
'visitsincommerce' => Array (
'Icons' => Array ('default' => 'icon16_item.png'),
'Fields' => Array (
'VisitDate' => Array ( 'title' => 'la_col_VisitDate', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_date_range_filter', 'width' => 145, ),
'IPAddress' => Array ( 'title' => 'la_col_IP', 'filter_block' => 'grid_like_filter', 'width' => 130, ),
'Referer' => Array ( 'title' => 'la_col_Referer', 'data_block' => 'grid_referer_td', 'filter_block' => 'grid_like_filter', 'width' => 250, ),
'UserName' => Array ('data_block' => 'grid_userlink_td', 'user_field' => 'PortalUserId', 'filter_block' => 'grid_like_filter', 'width' => 100, ),
'AffiliateUser' => Array ('data_block' => 'grid_userlink_td', 'user_field' => 'AffiliatePortalUserId', 'filter_block' => 'grid_like_filter', 'width' => 105, ),
'OrderTotalAmountSum' => Array ( 'title' => 'la_col_OrderTotal', 'filter_block' => 'grid_range_filter', 'width' => 95, ),
'OrderAffiliateCommissionSum' => Array ( 'title' => 'la_col_Commission', 'filter_block' => 'grid_range_filter', 'width' => 160, ),
),
),
),
);
\ No newline at end of file
Index: branches/5.2.x/core/units/categories/categories_config.php
===================================================================
--- branches/5.2.x/core/units/categories/categories_config.php (revision 15562)
+++ branches/5.2.x/core/units/categories/categories_config.php (revision 15563)
@@ -1,542 +1,542 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'c',
'ItemClass' => Array ('class' => 'CategoriesItem', 'file' => 'categories_item.php', 'build_event' => 'OnItemBuild'),
'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' => ''),
),
'ConfigPriority' => 0,
'Hooks' => Array (
Array (
'Mode' => hAFTER,
'Conditional' => false,
'HookToPrefix' => 'adm', //self
'HookToSpecial' => '*',
'HookToEvent' => Array('OnRebuildThemes'),
'DoPrefix' => '',
'DoSpecial' => '',
'DoEvent' => 'OnAfterRebuildThemes',
),
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => '',
'HookToSpecial' => '*',
'HookToEvent' => Array('OnAfterConfigRead'),
'DoPrefix' => 'cdata',
'DoSpecial' => '*',
'DoEvent' => 'OnDefineCustomFields',
),
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => 'rel',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
'DoPrefix' => '',
'DoSpecial' => '*',
'DoEvent' => 'OnCloneSubItem',
),
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => 'img',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
'DoPrefix' => '',
'DoSpecial' => '*',
'DoEvent' => 'OnCloneSubItem',
),
),
'AutoLoad' => true,
'CatalogItem' => true,
'AdminTemplatePath' => 'categories',
'AdminTemplatePrefix' => 'categories_',
'SearchConfigPostfix' => 'category',
'QueryString' => Array (
1 => 'id',
2 => 'Page',
3 => 'PerPage',
4 => 'event',
5 => 'mode',
),
'AggregateTags' => Array (
Array (
'AggregateTo' => 'm',
'AggregatedTagName' => 'CategoryLink',
'LocalTagName' => 'CategoryLink',
),
),
'IDField' => 'CategoryId',
'StatusField' => Array ('Status'), // 'Status'
'TitleField' => 'Name',
'TitlePhrase' => 'la_Text_Category',
'ItemType' => 1, // used for custom fields only
'StatisticsInfo' => Array (
'pending' => Array (
'icon' => 'icon16_cat_pending.gif',
'label' => 'la_tab_Categories',
'js_url' => '#url#',
'url' => Array('t' => 'catalog/advanced_view', 'SetTab' => 'c', 'pass' => 'm,c.showall', 'c.showall_event' => 'OnSetFilterPattern', 'c.showall_filters' => 'show_active=0,show_pending=1,show_disabled=0,show_new=1,show_pick=1'),
'status' => STATUS_PENDING,
),
),
'TableName' => TABLE_PREFIX.'Categories',
'CustomDataTableName' => TABLE_PREFIX . 'CategoryCustomData',
'ViewMenuPhrase' => 'la_text_Categories',
'CatalogTabIcon' => 'icon16_sections.png',
'TitlePresets' => Array (
'default' => Array (
'new_status_labels' => Array ('c' => '!la_title_Adding_Category!'),
'edit_status_labels' => Array ('c' => '!la_title_Editing_Category!'),
'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 (), 'format' => "<span id='category_path'>!la_title_Categories!</span>",
'toolbar_buttons' => Array ('select', 'cancel', 'upcat', 'homecat', 'new_cat', 'new_link', 'new_article', 'new_topic', 'new_product', 'edit', 'delete', 'new_listing', 'approve', 'decline', 'cut', 'copy', 'paste', 'move_up', 'move_down', 'tools', 'view', 'dbl-click')
),
'advanced_view' => Array (
'prefixes' => Array (), 'format' => "!la_title_AdvancedView!",
'toolbar_buttons' => Array ('select', 'cancel', 'new_cat', 'new_link', 'new_article', 'new_topic', 'new_product', 'edit', 'delete', 'new_listing', 'approve', 'decline', 'view', 'dbl-click'),
),
'reviews' => Array (
'prefixes' => Array (), 'format' => "!la_title_Reviews!",
'toolbar_buttons' => Array ('edit', 'delete', 'approve', 'decline', 'view', 'dbl-click',)
),
'review_edit' => Array ('prefixes' => Array (), 'format' => "!la_title_Editing_Review!"),
'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!",
'toolbar_buttons' => Array ('select', 'cancel', 'prev', 'next'),
),
'categories_relations' => Array (
'prefixes' => Array ('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Relations!",
'toolbar_buttons' => Array ('select', 'cancel', 'prev', 'next', 'new_item', 'edit', 'delete', 'approve', 'decline', 'view', 'dbl-click'),
),
'categories_related_searches' => Array (
'prefixes' => Array ('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_RelatedSearches!",
'toolbar_buttons' => Array ('select', 'cancel', 'prev', 'next', 'new_item', 'edit', 'delete', 'move_up', 'move_down', 'approve', 'decline', 'view', 'dbl-click'),
),
'categories_images' => Array (
'prefixes' => Array ('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Images!",
'toolbar_buttons' => Array ('select', 'cancel', 'prev', 'next', 'new_item', 'edit', 'delete', 'move_up', 'move_down', 'primary_image', 'view', 'dbl-click'),
),
'categories_permissions' => Array (
'prefixes' => Array ('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Permissions!",
'toolbar_buttons' => Array ('select', 'cancel', 'prev', 'next'),
),
'categories_custom' => Array ('prefixes' => Array ('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Custom!"),
'categories_update' => Array ('prefixes' => Array (), 'format' => "!la_title_UpdatingCategories!"),
'images_edit' => Array (
'prefixes' => Array ('c', 'c-img'),
'new_status_labels' => Array ('c-img' => '!la_title_Adding_Image!'),
'edit_status_labels' => Array ('c-img' => '!la_title_Editing_Image!'),
'new_titlefield' => Array ('c-img' => ''),
'format' => "#c_status# '#c_titlefield#' - #c-img_status# '#c-img_titlefield#'",
'toolbar_buttons' => Array ('select', 'cancel', 'prev', 'next'),
),
'relations_edit' => Array (
'prefixes' => Array ('c', 'c-rel'),
'new_status_labels' => Array ('c-rel' => "!la_title_Adding_Relationship! '!la_title_New_Relationship!'"),
'edit_status_labels' => Array ('c-rel' => '!la_title_Editing_Relationship!'),
'format' => "#c_status# '#c_titlefield#' - #c-rel_status#",
'toolbar_buttons' => Array ('select', 'cancel', 'prev', 'next'),
),
'related_searches_edit' => Array (
'prefixes' => Array ('c', 'c-search'),
'new_status_labels' => Array ('c-search' => "!la_title_Adding_RelatedSearch_Keyword!"),
'edit_status_labels' => Array ('c-search' => '!la_title_Editing_RelatedSearch_Keyword!'),
'format' => "#c_status# '#c_titlefield#' - #c-search_status#",
'toolbar_buttons' => Array ('select', 'cancel', 'prev', 'next'),
),
'edit_content' => Array ('format' => '!la_EditingContent!'),
'tree_site' => Array ('format' => '!la_selecting_categories!'),
),
'EditTabPresets' => Array (
'Default' => Array (
'general' => Array ('title' => 'la_tab_General', 't' => 'categories/categories_edit', 'priority' => 1),
'properties' => Array ('title' => 'la_tab_Properties', 't' => 'categories/categories_edit_properties', 'priority' => 2),
'relations' => Array ('title' => 'la_tab_Relations', 't' => 'categories/categories_edit_relations', 'priority' => 3),
'related_searches' => Array ('title' => 'la_tab_Related_Searches', 't' => 'categories/categories_edit_related_searches', 'priority' => 4),
'images' => Array ('title' => 'la_tab_Images', 't' => 'categories/categories_edit_images', 'priority' => 5),
'permissions' => Array ('title' => 'la_tab_Permissions', 't' => 'categories/categories_edit_permissions', 'priority' => 6),
'custom' => Array ('title' => 'la_tab_Custom', 't' => 'categories/categories_edit_custom', 'priority' => 7),
),
),
'PermItemPrefix' => 'CATEGORY',
'PermSection' => Array ('main' => 'CATEGORY:in-portal:categories', /*'search' => 'in-portal:configuration_search',*/ 'custom' => 'in-portal:configuration_custom'),
'Sections' => Array (
'in-portal:configure_categories' => Array (
'parent' => 'in-portal:website_setting_folder',
'icon' => 'conf_output',
'label' => 'la_tab_ConfigOutput',
'url' => Array ('t' => 'config/config_universal', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array ('view', 'add', 'edit'),
'priority' => 11.1,
'type' => stTREE,
),
'in-portal:configuration_search' => Array (
'parent' => 'in-portal:website_setting_folder',
'icon' => 'conf_search',
'label' => 'la_tab_ConfigSearch',
'url' => Array ('t' => 'config/config_search', 'module_key' => 'category', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array ('view', 'edit'),
'priority' => 11.2,
'type' => stTREE,
),
'in-portal:configuration_custom' => Array (
'parent' => 'in-portal:website_setting_folder',
'icon' => 'conf_customfields',
'label' => 'la_tab_ConfigCustom',
'url' => Array ('t' => 'custom_fields/custom_fields_list', 'cf_type' => 1, 'pass_section' => true, 'pass' => 'm,cf'),
'permissions' => Array ('view', 'add', 'edit', 'delete'),
'priority' => 11.3,
'type' => stTREE,
),
),
'FilterMenu' => Array (
'Groups' => Array (
Array ('mode' => 'AND', 'filters' => Array ('show_new'), 'type' => kDBList::HAVING_FILTER),
Array ('mode' => 'AND', 'filters' => Array ('show_pick'), 'type' => kDBList::WHERE_FILTER),
),
'Filters' => Array (
'show_new' => Array ('label' => 'la_Text_New', 'on_sql' => '', 'off_sql' => '`IsNew` != 1'),
'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.'%3$sCatalogImages img ON img.ResourceId = %1$s.ResourceId AND img.DefaultImg = 1
LEFT JOIN '.TABLE_PREFIX.'CategoryPermissionsCache ON '.TABLE_PREFIX.'CategoryPermissionsCache.CategoryId = %1$s.CategoryId
LEFT JOIN '.TABLE_PREFIX.'%3$sCategoryCustomData cust ON %1$s.ResourceId = cust.ResourceId',
'-virtual' => 'SELECT %1$s.* %2$s FROM %1$s',
),
'SubItems' => Array ('c-rel', 'c-search','c-img', 'c-cdata', 'c-perm', 'content', 'page-revision'),
'ListSortings' => Array (
'' => Array (
'Sorting' => Array ('Priority' => 'desc', 'Name' => 'asc'),
)
),
'CalculatedFields' => Array (
'' => Array (
'CurrentSort' => "REPLACE(ParentPath, CONCAT('|', ".'%1$s'.".CategoryId, '|'), '')",
'AltName' => 'img.AltName',
'SameImages' => 'img.SameImages',
'LocalThumb' => 'img.LocalThumb',
'ThumbPath' => 'img.ThumbPath',
'ThumbUrl' => 'img.ThumbUrl',
'LocalImage' => 'img.LocalImage',
'LocalPath' => 'img.LocalPath',
'FullUrl' => 'img.Url',
),
'-virtual' => Array (),
),
'CacheModRewrite' => true,
'Fields' => Array (
'CategoryId' => Array ('type' => 'int', 'not_null' => 1,'default' => 0),
'Type' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_opt_Virtual', 2 => 'la_opt_Template'), 'use_phrases' => 1,
'not_null' => 1,'default' => 1
),
'SymLinkCategoryId' => Array ('type' => 'int', 'default' => NULL),
'ParentId' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (), 'not_null' => 1,'default' => 0, 'required' => 1),
'Name' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'required' => 1, 'default' => ''),
'Filename' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
'AutomaticFilename' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1,
'default' => 1, 'not_null' => 1,
),
'Description' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'using_fck' => 1, 'default' => null),
'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'required' => 1, 'default' => '#NOW#'),
'EditorsPick' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1,
'default' => 0, 'not_null' => 1,
),
'Status' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Active', 2 => 'la_Pending', 0 => 'la_Disabled' ), 'use_phrases' => 1, 'not_null' => 1,'default' => 1),
'Priority' => Array ('type' => 'int', 'not_null' => 1, 'formatter' => 'kOptionsFormatter', 'options' => Array (), 'default' => 0),
'MetaKeywords' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
'CachedDescendantCatsQty' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'CachedNavbar' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => null),
- 'CreatedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
+ 'CreatedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL),
'ResourceId' => Array ('type' => 'int', 'default' => null),
'ParentPath' => Array ('type' => 'string', 'default' => null),
'TreeLeft' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'TreeRight' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'NamedParentPath' => Array ('type' => 'string', 'default' => null),
'NamedParentPathHash' => Array ('type' => 'string', 'not_null' => 1, 'default' => 0),
'MetaDescription' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
'HotItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'NewItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'PopItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'Modified' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
- 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
+ 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL),
'CachedTemplate' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
'CachedTemplateHash' => Array ('type' => 'string', 'not_null' => 1, 'default' => 0),
// fields from Pages
'Template' => Array (
'type' => 'string',
'formatter' => 'kOptionsFormatter',
'options_sql' => ' SELECT CONCAT(tf.Description, " :: ", FilePath, "/", TRIM(TRAILING ".tpl" FROM FileName) ) AS Title,
IF(tf.TemplateAlias <> "", tf.TemplateAlias, CONCAT(FilePath, "/", TRIM(TRAILING ".tpl" FROM FileName))) AS Value
FROM ' . TABLE_PREFIX . 'ThemeFiles AS tf
LEFT JOIN ' . TABLE_PREFIX . 'Themes AS t ON t.ThemeId = tf.ThemeId
WHERE (t.Enabled = 1) AND (tf.FileName NOT LIKE "%%.elm.tpl") AND (tf.FileName NOT LIKE "%%.des.tpl") AND (tf.FilePath = "/designs")
ORDER BY tf.Description ASC, tf.FileName ASC',
'option_key_field' => 'Value', 'option_title_field' => 'Title',
'error_msgs' => Array (
'no_inherit' => '!la_error_NoInheritancePossible!',
),
'required' => 1, 'not_null' => 1, 'default' => CATEGORY_TEMPLATE_INHERIT
),
'UseExternalUrl' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0,
),
'ExternalUrl' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'UseMenuIconUrl' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0,
),
'MenuIconUrl' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'Title' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => '', 'not_null'=>1),
'MenuTitle' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'default' => ''),
'MetaTitle' => Array ('type' => 'string', 'default' => null),
'IndexTools' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
'IsMenu' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Show', 0 => 'la_Hide'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 1),
'Protected' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
'FormId' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array ('' => ''),
'options_sql' => 'SELECT Title, FormId FROM '.TABLE_PREFIX.'Forms ORDER BY Title',
'option_key_field' => 'FormId', 'option_title_field' => 'Title',
'default' => NULL
),
'FormSubmittedTemplate' => Array ('type' => 'string', 'default' => null),
'FriendlyURL' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
'ThemeId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'EnablePageCache' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0
),
'OverridePageCacheKey' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0
),
'PageCacheKey' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'PageExpiration' => Array ('type' => 'int', 'default' => NULL),
'LiveRevisionNumber' => Array ('type' => 'int', 'not_null' => 1, 'default' => 1),
'DirectLinkEnabled' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 1
),
'DirectLinkAuthKey' => Array ('type' => 'string', 'max_len' => 20, 'not_null' => 1, 'default' => ''),
'PromoBlockGroupId' => Array (
'type' => 'int',
'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'PromoBlockGroups ORDER BY Title', 'option_title_field' => 'Title', 'option_key_field' => 'PromoBlockGroupId',
'not_null' => 1, 'default' => 0,
),
'RequireSSL' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0
),
'RequireLogin' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0
),
),
'VirtualFields' => Array (
'Relevance' => Array ('type' => 'float', 'default' => 0),
'CurrentSort' => Array('type' => 'string', 'default' => ''),
'IsNew' => Array('type' => 'int', 'default' => 0),
'OldPriority' => Array('type' => 'int', 'default' => 0),
// for primary image
'AltName' => Array('type' => 'string', 'default' => ''),
'SameImages' => Array('type' => 'string', 'default' => ''),
'LocalThumb' => Array('type' => 'string', 'default' => ''),
'ThumbPath' => Array('type' => 'string', 'default' => ''),
'ThumbUrl' => Array('type' => 'string', 'default' => ''),
'LocalImage' => Array('type' => 'string', 'default' => ''),
'LocalPath' => Array('type' => 'string', 'default' => ''),
'FullUrl' => Array('type' => 'string', 'default' => ''),
),
'Grids' => Array(
'Default' => Array (
'Icons' => Array( // 'StatusField' => Array ('Type', 'Status', 'IsMenu'), // 'Status'
'default' => 'icon_section.png',
'1_0_0' => 'icon16_section_system.png', // system
'1_0_1' => 'icon16_section_system.png', // system
'1_1_1' => 'icon16_section_system.png', // system
'0_0_0' => 'icon16_section_disabled.png', // disabled
'0_0_1' => 'icon16_section_disabled.png', // disabled
'0_1_0' => 'icon16_section_menuhidden.png', // hidden from menu
'0_2_0' => 'icon16_section_pending.png', // pending
'0_2_1' => 'icon16_section_pending.png', // pending
'NEW' => 'icon16_section_new.png', // section is new
),
'Fields' => Array(
'CategoryId' => Array ('title'=>'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 55),
'Name' => Array ('title'=>'column:la_fld_PageTitle', 'data_block' => 'page_browse_td', 'filter_block' => 'grid_like_filter', 'width' => 250),
'Priority' => Array ('filter_block' => 'grid_options_filter', 'width' => 65),
'Modified' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 170),
'Template' => Array ('title' => 'column:la_fld_TemplateType', 'filter_block' => 'grid_options_filter', 'width' => 220),
'IsMenu' => Array ('title' => 'la_col_InMenu', 'filter_block' => 'grid_options_filter', 'width' => 70),
'Type' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'Status' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'Protected' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'RequireSSL' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'RequireLogin' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
),
),
'Radio' => Array (
'Selector' => 'radio',
'Icons' => Array( // 'StatusField' => Array ('Type', 'Status', 'IsMenu'), // 'Status'
'default' => 'icon_section.png',
'1_0_0' => 'icon16_section_system.png', // system
'1_0_1' => 'icon16_section_system.png', // system
'1_1_1' => 'icon16_section_system.png', // system
'0_0_0' => 'icon16_section_disabled.png', // disabled
'0_0_1' => 'icon16_section_disabled.png', // disabled
'0_1_0' => 'icon16_section_menuhidden.png', // hidden from menu
'0_2_0' => 'icon16_section_pending.png', // pending
'0_2_1' => 'icon16_section_pending.png', // pending
'NEW' => 'icon16_section_new.png', // section is new
),
'Fields' => Array(
'CategoryId' => Array ('title'=>'column:la_fld_Id', 'data_block' => 'grid_radio_td', 'filter_block' => 'grid_range_filter', 'width' => 55),
'Name' => Array ('title'=>'column:la_fld_PageTitle', 'data_block' => 'page_browse_td', 'filter_block' => 'grid_like_filter', 'width' => 250),
'Priority' => Array ('filter_block' => 'grid_options_filter', 'width' => 65),
'IsMenu' => Array ('title' => 'la_col_InMenu', 'filter_block' => 'grid_options_filter', 'width' => 70),
'Modified' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 170),
'Template' => Array ('title' => 'column:la_fld_TemplateType', 'filter_block' => 'grid_options_filter', 'width' => 220),
'Type' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'Status' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'Protected' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'RequireSSL' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'RequireLogin' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
),
),
'Structure' => Array (
'Icons' => Array( // 'StatusField' => Array ('Type', 'Status', 'IsMenu'), // 'Status'
'default' => 'icon_section.png',
'1_0_0' => 'icon16_section_system.png', // system
'1_0_1' => 'icon16_section_system.png', // system
'1_1_1' => 'icon16_section_system.png', // system
'0_0_0' => 'icon16_section_disabled.png', // disabled
'0_0_1' => 'icon16_section_disabled.png', // disabled
'0_1_0' => 'icon16_section_menuhidden.png', // hidden from menu
'0_2_0' => 'icon16_section_pending.png', // pending
'0_2_1' => 'icon16_section_pending.png', // pending
'NEW' => 'icon16_section_new.png', // section is new
),
'Fields' => Array(
'CategoryId' => Array ('title'=>'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 55),
'Name' => Array ('title'=>'column:la_fld_PageTitle', 'data_block' => 'page_browse_td', 'filter_block' => 'grid_like_filter', 'width' => 250),
'Priority' => Array ('filter_block' => 'grid_options_filter', 'width' => 65),
'IsMenu' => Array ('title' => 'la_col_InMenu', 'filter_block' => 'grid_options_filter', 'width' => 70),
'Modified' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 170),
'Template' => Array ('title' => 'column:la_fld_TemplateType', 'filter_block' => 'grid_options_filter', 'width' => 220),
'Type' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'Status' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'Protected' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'RequireSSL' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'RequireLogin' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
),
),
),
'ConfigMapping' => Array (
'PerPage' => 'Perpage_Category',
'ShortListPerPage' => 'Perpage_Category_Short',
'DefaultSorting1Field' => 'Category_Sortfield',
'DefaultSorting2Field' => 'Category_Sortfield2',
'DefaultSorting1Dir' => 'Category_Sortorder',
'DefaultSorting2Dir' => 'Category_Sortorder2',
),
);
\ No newline at end of file
Index: branches/5.2.x/core/units/mailing_lists/mailing_lists_config.php
===================================================================
--- branches/5.2.x/core/units/mailing_lists/mailing_lists_config.php (revision 15562)
+++ branches/5.2.x/core/units/mailing_lists/mailing_lists_config.php (revision 15563)
@@ -1,145 +1,146 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'mailing-list',
'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
'EventHandlerClass' => Array ('class' => 'MailingListEventHandler', 'file' => 'mailing_list_eh.php', 'build_event' => 'OnBuild'),
'TagProcessorClass' => Array ('class' => 'MailingListTagProcessor', 'file' => 'mailing_list_tp.php', 'build_event' => 'OnBuild'),
'AutoLoad' => true,
'QueryString' => Array (
1 => 'id',
2 => 'Page',
3 => 'PerPage',
4 => 'event',
5 => 'mode',
),
'ScheduledTasks' => Array (
'generate_mailing_queue' => Array ('EventName' => 'OnGenerateEmailQueue', 'RunSchedule' => '*/30 * * * *'),
'process_mailing_queue' => Array ('EventName' => 'OnProcessEmailQueue', 'RunSchedule' => '*/30 * * * *'),
),
'IDField' => 'MailingId',
'TableName' => TABLE_PREFIX . 'MailingLists',
'TitlePresets' => Array (
'default' => Array (
'new_status_labels' => Array ('mailing-list' => '!la_title_AddingMailingList!'),
'edit_status_labels' => Array ('mailing-list' => '!la_title_ViewingMailingList!'),
),
'mailing_list_list' => Array (
'prefixes' => Array ('mailing-list_List'), 'format' => "!la_title_MailingLists!",
'toolbar_buttons' => Array ('new_item', 'edit', 'delete', 'primary_theme', 'clone', 'view', 'dbl-click'),
),
'mailing_list_edit' => Array (
'prefixes' => Array ('mailing-list'), 'format' => "#mailing-list_status#",
'toolbar_buttons' => Array ('select', 'cancel', 'reset_edit', 'prev', 'next'),
),
),
'PermSection' => Array('main' => 'in-portal:mailing_lists'),
'Sections' => Array (
'in-portal:mailing_folder' => Array (
'parent' => 'in-portal:users',
'icon' => 'mailing_list',
'label' => 'la_title_MailingLists',
'use_parent_header' => 1,
'permissions' => Array (),
'priority' => 5,
'type' => stTREE,
),
'in-portal:mailing_lists' => Array (
'parent' => 'in-portal:mailing_folder',
'icon' => 'mailing_list',
'label' => 'la_title_MailingLists',
'url' => Array('t' => 'mailing_lists/mailing_list_list', 'pass' => 'm'),
'permissions' => Array('view', 'add', 'edit', 'delete'),
'priority' => 5.1, // <parent_priority>.<own_priority>, because this section replaces parent in tree
'type' => stTAB,
),
),
'ListSQLs' => Array (
'' => ' SELECT %1$s.* %2$s FROM %1$s',
),
'ListSortings' => Array (
'' => Array (
'Sorting' => Array ('MailingId' => 'desc'),
)
),
'Fields' => Array (
'MailingId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'PortalUserId' => Array(
'type' => 'int',
'formatter' => 'kLEFTFormatter',
'options' => Array (USER_ROOT => 'root'),
- 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username',
+ 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s',
+ 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD,
'required' => 1, 'not_null' => 1, 'default' => USER_ROOT,
),
'To' => Array ('type' => 'string', 'required' => 1, 'default' => NULL),
'ToParsed' => Array ('type' => 'string', 'default' => NULL),
'Attachments' => Array (
'type' => 'string',
'formatter' => 'kUploadFormatter', 'upload_dir' => ITEM_FILES_PATH, 'max_size' => 50000000,
'multiple' => 10, 'direct_links' => true, 'file_types' => '*.*', 'files_description' => '!la_hint_AllFiles!',
'default' => NULL
),
'Subject' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'required' => 1, 'default' => ''),
'MessageText' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => NULL),
'MessageHtml' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => NULL),
'Status' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_opt_NotProcessed', 2 => 'la_opt_PartiallyProcessed', 3 => 'la_opt_Processed', 4 => 'la_opt_Cancelled'), 'use_phrases' => 1,
'not_null' => 1, 'required' => 1, 'default' => 1
),
'EmailsQueued' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'EmailsSent' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'EmailsTotal' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
),
'Grids' => Array (
'Default' => Array (
'Icons' => Array ('default' => 'icon16_item.png'),
'Fields' => Array (
'MailingId' => Array ('title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 70),
'Subject' => Array ('filter_block' => 'grid_like_filter', 'width' => 200),
'MessageText' => Array ('filter_block' => 'grid_like_filter', 'cut_first' => 100, 'width' => 120, 'hidden' => 1),
'MessageHtml' => Array ('title' => 'la_col_MessageHtml', 'filter_block' => 'grid_like_filter', 'cut_first' => 100, 'width' => 120, 'hidden' => 1),
'Status' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'EmailsQueued' => Array ('filter_block' => 'grid_range_filter', 'width' => 80),
'EmailsSent' => Array ('filter_block' => 'grid_range_filter', 'width' => 80),
'EmailsTotal' => Array ('filter_block' => 'grid_range_filter', 'width' => 80),
),
),
),
);
\ No newline at end of file
Index: branches/5.2.x/core/units/structure/structure_config.php
===================================================================
--- branches/5.2.x/core/units/structure/structure_config.php (revision 15562)
+++ branches/5.2.x/core/units/structure/structure_config.php (revision 15563)
@@ -1,276 +1,276 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'st',
'ItemClass' => Array('class'=>'CategoriesItem','file'=>'structure_item.php', 'build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'CategoriesEventHandler','file'=>'structure_eh.php', 'build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'CategoriesTagProcessor','file'=>'structure_tp.php', 'build_event'=>'OnBuild'),
'AutoLoad' => true,
'QueryString' => Array(
1 => 'id',
2 => 'Page',
3 => 'PerPage',
4 => 'event',
5 => 'mode',
),
'ConfigPriority' => 0,
'Hooks' => Array(
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => '',
'HookToSpecial' => '*',
'HookToEvent' => Array('OnAfterConfigRead'),
'DoPrefix' => 'cdata',
'DoSpecial' => '*',
'DoEvent' => 'OnDefineCustomFields',
),
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => 'rel',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
'DoPrefix' => '',
'DoSpecial' => '*',
'DoEvent' => 'OnCloneSubItem',
),
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => 'img',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
'DoPrefix' => '',
'DoSpecial' => '*',
'DoEvent' => 'OnCloneSubItem',
),
),
'IDField' => 'CategoryId',
'StatusField' => Array('Status'),
'TitleField' => 'Name', // field, used in bluebar when editing existing item
'TableName' => TABLE_PREFIX.'Categories',
'CustomDataTableName' => TABLE_PREFIX . 'CategoryCustomData',
'TitlePresets' => Array(
'default' => Array( 'new_status_labels' => Array('st'=>'!la_title_Adding_Category!'),
'edit_status_labels' => Array('st'=>'!la_title_Editing_Category!'),
'new_titlefield' => Array('st'=>'!la_title_New_Category!'),
),
'structure_list' => Array(
'prefixes' => Array('st_List', 'st.current'),
'format' => "!la_title_Structure! - '#st.current_Name#'"
),
'structure_edit' => Array(
'prefixes' => Array('st'),
'format' => "#st_status# '#st_titlefield#'",
),
'edit_content' => array('format' => '!la_EditingContent!'),
/* 'categories_edit' => Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_General!"),*/
),
'PermItemPrefix' => 'CATEGORY',
'PermSection' => Array('main' => 'CATEGORY:in-portal:structure', 'email' => 'in-portal:configemail'),
'ListSQLs' => Array (
'' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'CategoryPermissionsCache ON '.TABLE_PREFIX.'CategoryPermissionsCache.CategoryId = %1$s.CategoryId',
'-virtual' => 'SELECT %1$s.* %2$s FROM %1$s',
),
'SubItems' => Array('content', 'page-revision'),
'ListSortings' => Array(
'' => Array(
'ForcedSorting' => Array('Priority' => 'desc'),
'Sorting' => Array('Name' => 'asc'),
)
),
'CalculatedFields' => Array(
'' => Array(
'CurrentSort' => "REPLACE(ParentPath, CONCAT('|', ".'%1$s'.".CategoryId, '|'), '')",
),
'-virtual' => Array (),
),
'Fields' => Array (
'CategoryId' => Array('type' => 'int', 'not_null' => 1,'default' => 0),
'Type' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_opt_Virtual', 2 => 'la_opt_Template'), 'use_phrases' => 1,
'not_null' => 1,'default' => 1
),
'SymLinkCategoryId' => Array ('type' => 'int', 'default' => NULL),
'ParentId' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (), 'not_null' => 1,'default' => 0, 'required'=>1),
'Name' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'required' => 1, 'default' => ''),
'Filename' => Array('type' => 'string', 'not_null' => 1, 'default' => '', 'required' => 1),
'AutomaticFilename' => Array('type' => 'int', 'not_null' => 1, 'default' => 1),
'Description' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => null),
'CreatedOn' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'required' => 1, 'default' => '#NOW#'),
'EditorsPick' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'Status' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Active', 2 => 'la_Pending', 0 => 'la_Disabled' ), 'use_phrases' => 1, 'not_null' => 1,'default' => 1),
'Priority' => Array('type' => 'int', 'not_null' => 1, 'formatter' => 'kOptionsFormatter', 'options' => array(), 'required' => 1, 'default' => 0),
'MetaKeywords' => Array('type' => 'string', 'default' => null),
'CachedDescendantCatsQty' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'CachedNavbar' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => null),
- 'CreatedById' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter', 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
+ 'CreatedById' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter', 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL),
'ResourceId' => Array('type' => 'int', 'default' => null),
'ParentPath' => Array('type' => 'string', 'default' => null),
'TreeLeft' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'TreeRight' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'NamedParentPath' => Array('type' => 'string', 'default' => null),
'NamedParentPathHash' => Array ('type' => 'string', 'not_null' => 1, 'default' => 0),
'MetaDescription' => Array('type' => 'string', 'default' => null),
'HotItem' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'NewItem' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'PopItem' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'Modified' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
- 'ModifiedById' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter', 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
+ 'ModifiedById' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter', 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL),
'CachedTemplate' => Array('type' => 'string', 'not_null' => 1, 'default' => ''),
'CachedTemplateHash' => Array ('type' => 'string', 'not_null' => 1, 'default' => 0),
// fields from Pages
'Template' => Array (
'type' => 'string',
'formatter' => 'kOptionsFormatter', 'options_sql' => ' SELECT CONCAT(tf.Description, " (", TRIM(TRAILING ".des" FROM TRIM(TRAILING ".tpl" FROM FileName) ), ")") AS Title,
CONCAT(FilePath, "/", TRIM(TRAILING ".tpl" FROM FileName)) AS Value
FROM ' . TABLE_PREFIX . 'ThemeFiles AS tf
LEFT JOIN ' . TABLE_PREFIX . 'Themes AS t ON t.ThemeId = tf.ThemeId
WHERE (t.Enabled = 1) AND (tf.FileName NOT LIKE "%%.elm.tpl") AND (tf.FileName NOT LIKE "%%.des.tpl") AND (tf.FilePath = "/designs")',
'option_key_field' => 'Value', 'option_title_field' => 'Title',
'not_null' => 1, 'default' => CATEGORY_TEMPLATE_INHERIT
),
'UseExternalUrl' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0
),
'ExternalUrl' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'UseMenuIconUrl' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0
),
'MenuIconUrl' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'Title' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => '', 'not_null'=>1),
'MenuTitle' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'default' => ''),
'MetaTitle' => Array('type' => 'string', 'default' => null),
'IndexTools' => Array('type' => 'string','default' => null),
'IsMenu' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Show', 0 => 'la_Hide'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 1),
'Protected' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
'FormId' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter',
'options' => array('' => ''),
'options_sql' => 'SELECT Title, FormId FROM '.TABLE_PREFIX.'Forms ORDER BY Title',
'option_key_field' => 'FormId', 'option_title_field' => 'Title', 'default' => NULL),
'FormSubmittedTemplate' => Array('type' => 'string', 'default' => null),
'FriendlyURL' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
'ThemeId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'EnablePageCache' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0
),
'OverridePageCacheKey' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0
),
'PageCacheKey' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'PageExpiration' => Array ('type' => 'int', 'default' => NULL),
'LiveRevisionNumber' => Array ('type' => 'int', 'not_null' => 1, 'default' => 1),
'DirectLinkEnabled' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 1
),
'DirectLinkAuthKey' => Array ('type' => 'string', 'max_len' => 20, 'not_null' => 1, 'default' => '')
),
'VirtualFields' => Array(
'CurrentSort' => Array('type' => 'string', 'default' => ''),
'IsNew' => Array('type' => 'int', 'default' => 0),
'OldPriority' => Array('type' => 'int', 'default' => 0),
),
'Grids' => Array(
'Default' => Array(
'Icons' => Array(1 => 'icon16_folder.gif', 0 => 'icon16_folder-red.gif'),
'Fields' => Array(
'CategoryId' => Array ('title'=>'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 55),
'Name' => Array ('title'=>'column:la_fld_PageTitle', 'data_block' => 'page_browse_td', 'filter_block' => 'grid_like_filter', 'width' => 250),
'Modified' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 170),
'Template' => Array ('title' => 'column:la_fld_TemplateType', 'filter_block' => 'grid_options_filter', 'width' => 220),
'IsMenu' => Array ('title' => 'la_col_Visible', 'filter_block' => 'grid_options_filter', 'width' => 70),
'Path' => Array ('title'=>'la_col_Path', 'data_block' => 'page_entercat_td', 'filter_block' => 'grid_like_filter' ),
'Protected' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
),
),
'Radio' => Array(
'Icons' => Array(1 => 'icon16_folder.gif', 0 => 'icon16_folder-red.gif'),
'Selector' => 'radio',
'Fields' => Array(
'CategoryId' => Array ('title'=>'column:la_fld_Id', 'data_block' => 'grid_radio_td', 'filter_block' => 'grid_range_filter', 'width' => 55),
'Name' => Array ('title'=>'column:la_fld_PageTitle', 'data_block' => 'page_browse_td', 'filter_block' => 'grid_like_filter', 'width' => 250),
'Modified' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 170),
'Template' => Array ('title' => 'column:la_fld_TemplateType', 'filter_block' => 'grid_options_filter', 'width' => 220),
'IsMenu' => Array ('title' => 'la_col_Visible', 'filter_block' => 'grid_options_filter', 'width' => 70),
'Path' => Array ('title'=>'la_col_Path', 'data_block' => 'page_entercat_td', 'filter_block' => 'grid_like_filter' ),
'Protected' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
),
),
'AllPages' => Array(
'Icons' => Array(1 => 'icon16_folder.gif', 0 => 'icon16_folder-red.gif'),
'Fields' => Array(
'CategoryId' => Array ('title'=>'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 55),
'Name' => Array ('title'=>'column:la_fld_PageTitle', 'data_block' => 'page_browse_td', 'filter_block' => 'grid_like_filter', 'width' => 250),
'Path' => Array ('title'=>'la_col_Path', 'data_block' => 'page_path_td', 'sort_field' => 'CachedNavbar', 'filter_block' => 'grid_like_filter' ),
'Modified' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 170),
'Template' => Array ('title' => 'column:la_fld_TemplateType', 'filter_block' => 'grid_options_filter', 'width' => 220),
'IsMenu' => Array ('title' => 'la_col_Visible', 'filter_block' => 'grid_options_filter', 'width' => 70),
'Protected' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
),
),
),
'ConfigMapping' => Array(
'PerPage' => 'Perpage_Category',
'ShortListPerPage' => 'Perpage_Category_Short',
'DefaultSorting1Field' => 'Category_Sortfield',
'DefaultSorting2Field' => 'Category_Sortfield2',
'DefaultSorting1Dir' => 'Category_Sortorder',
'DefaultSorting2Dir' => 'Category_Sortorder2',
),
);
\ No newline at end of file
Index: branches/5.2.x/core/units/users/users_tag_processor.php
===================================================================
--- branches/5.2.x/core/units/users/users_tag_processor.php (revision 15562)
+++ branches/5.2.x/core/units/users/users_tag_processor.php (revision 15563)
@@ -1,362 +1,377 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class UsersTagProcessor extends kDBTagProcessor
{
function LogoutLink($params)
{
$pass = Array('pass' => 'all,m,u', 'u_event' => 'OnLogout', 'm_cat_id' => 0);
$logout_template = $this->SelectParam($params, 'template,t');
return $this->Application->HREF($logout_template, '', $pass);
}
function RegistrationEnabled($params)
{
return $this->Application->ConfigValue('User_Allow_New') != 2;
}
function SuggestRegister($params)
{
return !$this->Application->LoggedIn() && !$this->Application->ConfigValue('Comm_RequireLoginBeforeCheckout') && $this->RegistrationEnabled($params);
}
function ConfirmPasswordLink($params)
{
$user = $this->Application->recallObject($this->Prefix . '.email-to');
/* @var $user UsersItem */
$code = $this->getCachedCode();
$user->SetDBField('PwResetConfirm', $code);
$user->SetDBField('PwRequestTime_date', adodb_mktime());
$user->SetDBField('PwRequestTime_time', adodb_mktime());
if ( $user->GetChangedFields() ) {
// tag is called 2 times within USER.PWDC email event, so don't update user record twice
$user->Update();
}
$params['user_key'] = $code;
if ( !$this->SelectParam($params, 'template,t') ) {
$params['template'] = $this->Application->GetVar('reset_confirm_template');
}
return $this->Application->ProcessParsedTag('m', 'Link', $params);
}
/**
* Generates & caches code for password confirmation link
*
* @return string
*/
function getCachedCode()
{
static $code = null;
if ( !isset($code) ) {
$code = md5(kUtil::generateId());
}
return $code;
}
function TestCodeIsValid($params)
{
$user_helper = $this->Application->recallObject('UserHelper');
/* @var $user_helper UserHelper */
$code_type = isset($params['code_type']) ? $params['code_type'] : 'forgot_password';
$expiration_timeout = isset($params['expiration_timeout']) ? $params['expiration_timeout'] : null;
$user_id = $user_helper->validateUserCode($this->Application->GetVar('user_key'), $code_type, $expiration_timeout);
if ( !is_numeric($user_id) ) {
// used for error reporting only -> rewrite code + theme (by Alex)
$object = $this->getObject( Array('skip_autoload' => true) ); // TODO: change theme too
/* @var $object UsersItem */
$object->SetError('PwResetConfirm', $user_id, $this->_getUserCodeErrorMsg($user_id, $code_type, $params));
return false;
}
return true;
}
/**
* Tries to restore user email
*
* @param Array $params
* @return bool
* @access protected
*/
protected function RestoreEmail($params)
{
$user_helper = $this->Application->recallObject('UserHelper');
/* @var $user_helper UserHelper */
$hash = $this->Application->GetVar('hash');
$error_code = $user_helper->restoreEmail($hash);
if ( $error_code ) {
// used for error reporting only -> rewrite code + theme (by Alex)
$object = $this->getObject(Array ('skip_autoload' => true)); // TODO: change theme too
/* @var $object UsersItem */
$object->SetError('PwResetConfirm', 'restore', $params[$error_code]);
return false;
}
return true;
}
/**
* Returns error message set by given code type
*
* @param string $error_code
* @param string $code_type
* @param Array $params
* @return string
*/
function _getUserCodeErrorMsg($error_code, $code_type, $params)
{
$error_messages = Array (
'forgot_password' => Array (
'code_is_not_valid' => 'lu_code_is_not_valid',
'code_expired' => 'lu_code_expired',
),
'activation' => Array (
'code_is_not_valid' => 'lu_error_ActivationCodeNotValid',
'code_expired' => 'lu_error_ActivationCodeExpired',
),
'verify_email' => Array (
'code_is_not_valid' => 'lu_error_VerificationCodeNotValid',
'code_expired' => 'lu_error_VerificationCodeExpired',
),
);
if ($code_type == 'custom') {
// custom error messages are given directly in tag
$error_messages[$code_type] = Array (
'code_is_not_valid' => $params['error_invalid'],
'code_expired' => $params['error_expired'],
);
}
return $error_messages[$code_type][$error_code];
}
/**
* Returns site administrator email
*
* @param Array $params
* @return string
*/
function SiteAdminEmail($params)
{
return $this->Application->ConfigValue('DefaultEmailSender');
}
/**
* Returns login name of user
*
* @param Array $params
* @return string
* @access protected
*/
protected function LoginName($params)
{
$object = $this->getObject($params);
/* @var $object UsersItem */
return $object->GetID() != USER_ROOT ? $object->GetDBField('Username') : 'root';
}
function CookieUsername($params)
{
$items_info = $this->Application->GetVar( $this->getPrefixSpecial(true) );
if ( $items_info !== false ) {
return $items_info[USER_GUEST][ $params['field'] ];
}
$username = $this->Application->GetVar('save_username'); // from cookie
if ($username == 'super-root') {
$username = 'root';
}
return $username === false ? '' : $username;
}
/**
* Checks if user have one of required permissions
*
* @param Array $params
* @return bool
*/
function HasPermission($params)
{
$perm_helper = $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
return $perm_helper->TagPermissionCheck($params);
}
/**
* Returns link to user public profile
*
* @param Array $params
* @return string
*/
function ProfileLink($params)
{
$object = $this->getObject($params);
$params['user_id'] = $object->GetID();
return $this->Application->ProcessParsedTag('m', 'Link', $params);
}
function ImageSrc($params)
{
list ($ret, $tag_processed) = $this->processAggregatedTag('ImageSrc', $params, $this->getPrefixSpecial());
return $tag_processed ? $ret : false;
}
function LoggedIn($params)
{
static $loggedin_status = Array ();
$object = $this->getObject($params);
/* @var $object kDBList */
if (!isset($loggedin_status[$this->Special])) {
$user_ids = $object->GetCol($object->IDField);
$sql = 'SELECT LastAccessed, '.$object->IDField.'
FROM '.TABLE_PREFIX.'UserSessions
WHERE (PortalUserId IN ('.implode(',', $user_ids).'))';
$loggedin_status[$this->Special] = $this->Conn->GetCol($sql, $object->IDField);
}
return isset($loggedin_status[$this->Special][$object->GetID()]);
}
/**
* Prints user activation link
*
* @param Array $params
* @return string
*/
function ActivationLink($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
$code = $this->getCachedCode();
$object->SetDBField('PwResetConfirm', $code);
$object->SetDBField('PwRequestTime_date', adodb_mktime());
$object->SetDBField('PwRequestTime_time', adodb_mktime());
$object->Update();
$params['user_key'] = $code;
return $this->Application->ProcessParsedTag('m', 'Link', $params);
}
/**
* Returns link to revert e-mail change in user record
*
* @param Array $params
* @return string
* @access protected
*/
protected function UndoEmailChangeLink($params)
{
$params['hash'] = $this->Application->Parser->GetParam('hash');
if ( !$this->SelectParam($params, 'template,t') ) {
$params['template'] = $this->Application->GetVar('undo_email_template');
}
return $this->Application->ProcessParsedTag('m', 'Link', $params);
}
/**
* Activates user using given code
*
* @param Array $params
* @return string
* @access protected
*/
protected function ActivateUser($params)
{
$this->_updateAndLogin(Array ('Status' => STATUS_ACTIVE, 'EmailVerified' => 1));
return '';
}
/**
* Marks user e-mail as verified using given code
*
* @param Array $params
* @return string
* @access protected
*/
protected function MarkUserEmailAsVerified($params)
{
$this->_updateAndLogin(Array ('EmailVerified' => 1));
return '';
}
/**
* Activates user using given code
*
* @param Array $fields_hash
* @return void
* @access protected
*/
protected function _updateAndLogin($fields_hash)
{
$user_helper = $this->Application->recallObject('UserHelper');
/* @var $user_helper UserHelper */
$user = $this->Application->recallObject($this->Prefix . '.activate', null, Array ('skip_autoload' => true));
/* @var $user UsersItem */
$user->Load(trim($this->Application->GetVar('user_key')), 'PwResetConfirm');
if ( !$user->isLoaded() ) {
return ;
}
$user->SetFieldsFromHash($fields_hash);
$user->SetDBField('PwResetConfirm', '');
$user->SetDBField('PwRequestTime_date', NULL);
$user->SetDBField('PwRequestTime_time', NULL);
$user->Update();
$login_user =& $user_helper->getUserObject();
$login_user->Load( $user->GetID() );
if ( ($login_user->GetDBField('Status') == STATUS_ACTIVE) && $user_helper->checkLoginPermission() ) {
$user_helper->loginUserById( $login_user->GetID() );
}
}
+
+ /**
+ * Returns user selector title
+ *
+ * @param Array $params
+ * @return string
+ * @access protected
+ */
+ protected function UserSelectorTitle($params)
+ {
+ $object = $this->getObject($params);
+ /* @var $object kDBItem */
+
+ return $object->GetDBField('Email') ? $object->GetDBField('Email') : $object->GetDBField('Username');
+ }
}
\ No newline at end of file
Index: branches/5.2.x/core/units/helpers/page_helper.php
===================================================================
--- branches/5.2.x/core/units/helpers/page_helper.php (revision 15562)
+++ branches/5.2.x/core/units/helpers/page_helper.php (revision 15563)
@@ -1,275 +1,275 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2011 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class PageHelper extends kHelper {
/**
* Returns page info
*
* @param int $page_id
* @return Array
*/
function getPageInfo($page_id)
{
list ($user_id, $history_permission) = $this->getHistoryPermissionAndUser($page_id);
$where_clause = Array (
'pr.PageId = ' . $page_id,
'pr.CreatedById <> ' . $user_id,
'pr.IsDraft = 1',
);
- $sql = 'SELECT CASE pr.CreatedById WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE u.Username END
+ $sql = 'SELECT CASE pr.CreatedById WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE IF(u.Username = "", u.Email, u.Username) END
FROM ' . $this->Application->getUnitOption('page-revision', 'TableName') . ' pr
LEFT JOIN ' . TABLE_PREFIX . 'Users u ON u.PortalUserId = pr.CreatedById
WHERE (' . implode(') AND (', $where_clause) . ')';
$users = $this->Conn->GetCol($sql);
$page_revisions = Array ();
if ( $history_permission ) {
$tag_params = Array ('per_page' => -1, 'skip_parent_filter' => 1, 'requery' => 1, 'page_id' => $page_id);
$revisions = $this->Application->recallObject('page-revision.list', 'page-revision_List', $tag_params);
/* @var $revisions kDBList */
$revisions->Query();
$revisions->GoFirst();
$status_options = $revisions->GetFieldOptions('Status');
$draft_label = $this->Application->Phrase('la_Draft', false, true);
$title_label = $this->Application->Phrase('la_RevisionNumber', false, true);
$by_label = $this->Application->Phrase('la_By', false, true);
while ( !$revisions->EOL() ) {
$status = $revisions->GetDBField('Status');
$status_label = $this->Application->Phrase($status_options['options'][$status], false, true);
$page_revisions[ 'r' . $revisions->GetDBField('RevisionNumber') ] = Array (
'title' => $revisions->GetDBField('IsDraft') ? $draft_label : sprintf($title_label, $revisions->GetDBField('RevisionNumber')),
'status' => $status,
'status_label' => mb_strtolower($status_label),
'datetime' => $revisions->GetField('CreatedOn'),
'author' => $by_label . ': ' . $revisions->GetField('CreatedById'),
'draft' => (int)$revisions->GetDBField('IsDraft'),
);
$revisions->GoNext();
}
}
$current_revision = $this->Application->recallObject('page-revision.current');
/* @var $current_revision kDBItem */
$revision_status = $current_revision->GetDBField('Status');
$status_options = $current_revision->GetFieldOptions('Status');
$status_label = $this->Application->Phrase($status_options['options'][$revision_status], false, true);
$revision_phase = $current_revision->GetDBField('IsDraft') ? 'la_title_EditingDraft' : 'la_title_ViewingRevision';
$revision_title = sprintf($this->Application->Phrase($revision_phase, false, true), $current_revision->GetDBField('RevisionNumber'), mb_strtolower($status_label));
$current_revision_info = Array ('title' => $revision_title, 'status' => $revision_status, 'saved' => '');
$autosave_time = $current_revision->GetDBField('AutoSavedOn');
if ( $autosave_time ) {
$phrase = $this->Application->Phrase($current_revision->GetDBField('IsDraft') ? 'la_DraftSavedAt' : 'la_SavedAt', false, true);
$current_revision_info['saved'] = sprintf($phrase, $current_revision->GetField('AutoSavedOn_time') . ' (' . $this->getAgoTime($autosave_time) . ')');
}
$ml_helper = $this->Application->recallObject('kMultiLanguageHelper');
/* @var $ml_helper kMultiLanguageHelper */
$currently_editing = $ml_helper->getPluralPhrase(
count($users),
Array (
'phrase1' => 'la_PageCurrentlyEditing1',
'phrase2' => 'la_PageCurrentlyEditing2',
'phrase5' => 'la_PageCurrentlyEditing5',
),
false, true
);
$currently_editing = sprintf($currently_editing, implode(', ', $users));
return Array ('current_revision' => $current_revision_info, 'editors' => $users, 'editors_warning' => $currently_editing, 'revisions' => $page_revisions);
}
/**
* Returns time passed between 2 given dates in "X minutes Y seconds ago" format
*
* @param int $from_date
* @param int $to_date
* @return string
*/
function getAgoTime($from_date, $to_date = null, $max_levels = 1)
{
$blocks = Array (
Array ('name' => 'year', 'amount' => 60*60*24*365),
Array ('name' => 'month' ,'amount' => 60*60*24*31),
Array ('name' => 'week', 'amount' => 60*60*24*7),
Array ('name' => 'day', 'amount' => 60*60*24),
Array ('name' => 'hour', 'amount' => 60*60),
Array ('name' => 'minute', 'amount' => 60),
Array ('name' => 'second', 'amount' => 1),
);
if ( !isset($to_date) ) {
$to_date = adodb_mktime();
}
$diff = abs($to_date - $from_date);
if ( $diff == 0 ) {
return 'now';
}
$current_level = 1;
$result = Array ();
foreach ($blocks as $block) {
if ($current_level > $max_levels) {
break;
}
if ( $diff / $block['amount'] >= 1 ) {
$amount = floor($diff / $block['amount']);
$plural = $amount > 1 ? 's' : '';
$result[] = $amount . ' ' . $block['name'] . $plural;
$diff -= $amount * $block['amount'];
$current_level++;
}
}
return implode(' ', $result) . ' ago';
}
/**
* Returns where clause for loading correct revision for a given page
*
* @param int $page_id
* @param int $live_revision_number
* @param string $table_name
* @return string
*/
function getRevsionWhereClause($page_id, $live_revision_number, $table_name = '')
{
$revision = (int)$this->Application->GetVar('revision');
list ($user_id, $has_permission) = $this->getHistoryPermissionAndUser($page_id);
if ( $has_permission && $revision ) {
$revision_clause = $table_name . 'RevisionNumber = ' . $revision . ' AND ' . $table_name . 'IsDraft = 0';
}
else {
$editing_mode = $this->Application->GetVar('editing_mode'); // not in a EDITING_MODE constant, while in admin console
$revision_clause = $table_name . 'RevisionNumber = ' . $live_revision_number . ' AND ' . $table_name . 'IsDraft = 0';
if ( $this->Application->GetVar('preview') || $editing_mode == EDITING_MODE_CONTENT ) {
$revision_clause = '(' . $table_name . 'CreatedById = ' . $user_id . ' AND ' . $table_name . 'IsDraft = 1) OR (' . $revision_clause . ')';
}
}
return $revision_clause;
}
/**
* Returns current admin user id (even, when called from front-end) and it's revision history view permission
*
* @param int $page_id
* @return Array
*/
function getHistoryPermissionAndUser($page_id)
{
$user_id = (int)$this->Application->RecallVar($this->Application->isAdmin ? 'user_id' : 'admin_user_id');
$history_permission = $this->Application->CheckAdminPermission('CATEGORY.REVISION.HISTORY.VIEW', 0, $page_id);
return Array ($user_id, $history_permission);
}
/**
* Creates new content block in every revision that misses it. Plus creates first page revision
*
* @param int $page_id
* @param int $num
*/
function createNewContentBlock($page_id, $num)
{
$sql = 'SELECT pc.PageContentId, pr.RevisionId
FROM ' . TABLE_PREFIX . 'PageRevisions pr
LEFT JOIN ' . TABLE_PREFIX . 'PageContent pc ON pc.RevisionId = pr.RevisionId AND pc.ContentNum = ' . $num . '
WHERE pr.PageId = ' . $page_id;
$revisions = $this->Conn->GetCol($sql, 'RevisionId');
if ( !$revisions ) {
// no revisions for a page -> create a live revision
$revision = $this->Application->recallObject('page-revision.live', null, Array ('skip_autoload' => true));
/* @var $revision kDBItem */
$revision->SetDBField('PageId', $page_id);
$revision->SetDBField('RevisionNumber', 1);
$revision->SetDBField('Status', STATUS_ACTIVE);
$revision->Create();
$revisions[ $revision->GetID() ] = NULL;
}
$content_block = $this->Application->recallObject('content.new', null, Array ('skip_autoload' => true));
/* @var $content_block kDBItem */
$content_block->SetDBField('PageId', $page_id);
$content_block->SetDBField('ContentNum', $num);
foreach ($revisions as $revision_id => $content_block_id) {
if ( is_numeric($content_block_id) ) {
continue;
}
$content_block->SetDBField('RevisionId', $revision_id);
$content_block->Create();
}
}
/**
* Loads content block by it's number
*
* @param kDBItem $content_block
* @param CategoriesItem $page
* @param int $num
*
* @return bool
*/
function loadContentBlock(&$content_block, &$page, $num)
{
$page_id = $page->GetID();
if ( !EDITING_MODE && !$this->Application->GetVar('preview') ) {
$revision_clause = 'pr.RevisionNumber = ' . $page->GetDBField('LiveRevisionNumber') . ' AND pr.IsDraft = 0';
}
else {
$revision_clause = $this->getRevsionWhereClause($page_id, $page->GetDBField('LiveRevisionNumber'), 'pr.');
}
$sql = $content_block->GetSelectSQL() . '
WHERE (' . $content_block->TableName . '.PageId = ' . $page_id . ') AND (' . $content_block->TableName . '.ContentNum = ' . $num . ') AND (' . $revision_clause . ')
ORDER BY pr.IsDraft DESC, pr.RevisionNumber DESC';
$content_data = $this->Conn->GetRow($sql);
$content_block->LoadFromHash($content_data);
return $content_block->isLoaded();
}
}
Index: branches/5.2.x/core/units/logs/system_logs/system_logs_config.php
===================================================================
--- branches/5.2.x/core/units/logs/system_logs/system_logs_config.php (revision 15562)
+++ branches/5.2.x/core/units/logs/system_logs/system_logs_config.php (revision 15563)
@@ -1,205 +1,205 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2012 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'system-log',
'ItemClass' => Array('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
'ListClass' => Array('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
'EventHandlerClass' => Array ('class' => 'SystemLogEventHandler', 'file' => 'system_log_eh.php', 'build_event' => 'OnBuild'),
'TagProcessorClass' => Array ('class' => 'SystemLogTagProcessor', 'file' => 'system_log_tp.php', 'build_event' => 'OnBuild'),
'AutoLoad' => true,
'QueryString' => Array (
1 => 'id',
2 => 'Page',
3 => 'PerPage',
4 => 'event',
5 => 'mode',
),
'ScheduledTasks' => Array (
'system_log_notifications' => Array('EventName' => 'OnSendNotifications', 'RunSchedule' => '0 * * * *'),
'rotate_system_logs' => Array('EventName' => 'OnRotate', 'RunSchedule' => '0 0 * * *'),
),
'IDField' => 'LogId',
//'StatusField' => Array ('Status'),
'TableName' => TABLE_PREFIX . 'SystemLog',
'TitlePresets' => Array (
'default' => Array (
'edit_status_labels' => Array ('system-log' => '!la_title_ViewingSystemLog!'),
),
'system_log_list' => Array (
'prefixes' => Array('system-log_List'), 'format' => '!la_tab_SystemLog!',
'toolbar_buttons' => Array ('edit', 'delete', 'reset', 'view', 'dbl-click'),
),
'system_log_edit' => Array (
'prefixes' => Array('system-log'), 'format' => '#system-log_status# "#system-log_titlefield#"',
'toolbar_buttons' => Array ('select', 'cancel', 'reset_edit', 'prev', 'next'),
),
),
'PermSection' => Array ('main' => 'in-portal:system_logs'),
'Sections' => Array (
'in-portal:system_logs' => Array (
'parent' => 'in-portal:reports',
'icon' => 'system_log',
'label' => 'la_tab_SystemLog',
'url' => Array('t' => 'logs/system_logs/system_log_list', 'pass' => 'm'),
'permissions' => Array('view', 'edit', 'delete'),
'priority' => 6.1,
'type' => stTREE,
),
),
'TitleField' => 'LogMessage',
'ListSQLs' => Array (
'' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Users AS u ON u.PortalUserId = %1$s.LogUserId',
),
'ListSortings' => Array (
'' => Array (
'Sorting' => Array ('LogId' => 'desc'),
)
),
'CalculatedFields' => Array (
'' => Array (
- 'Username' => 'CASE %1$s.LogUserId WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE IF(CONCAT(u.FirstName, u.LastName) <> "", CONCAT(u.FirstName, " ", u.LastName), u.Username) END',
+ 'Username' => 'CASE %1$s.LogUserId WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE IF(CONCAT(u.FirstName, u.LastName) <> "", CONCAT(u.FirstName, " ", u.LastName), IF(u.Username = "", u.Email, u.Username)) END',
),
),
'ForceDontLogChanges' => true,
'Fields' => Array (
'LogId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'LogUniqueId' => Array ('type' => 'int', 'default' => NULL),
'LogLevel' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (
kLogger::LL_EMERGENCY => 'emergency',
kLogger::LL_ALERT => 'alert',
kLogger::LL_CRITICAL => 'critical',
kLogger::LL_ERROR => 'error',
kLogger::LL_WARNING => 'warning',
kLogger::LL_NOTICE => 'notice',
kLogger::LL_INFO => 'info',
kLogger::LL_DEBUG => 'debug'
),
'not_null' => 1, 'default' => kLogger::LL_INFO
),
'LogType' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (
kLogger::LT_PHP => 'la_opt_LogTypePhp',
kLogger::LT_DATABASE => 'la_opt_LogTypeDatabase',
kLogger::LT_OTHER => 'la_opt_LogTypeOther',
), 'use_phrases' => 1,
'not_null', 'default' => kLogger::LT_OTHER
),
'LogCode' => Array ('type' => 'int', 'default' => NULL),
'LogMessage' => Array ('type' => 'string', 'default' => NULL),
'LogTimestamp' => Array (
'type' => 'int',
'formatter' => 'kDateFormatter',
'default' => NULL
),
'LogDate' => Array ('type' => 'string', 'default' => NULL),
'LogEventName' => Array ('type' => 'string', 'max_len' => 100, 'not_null' => 1, 'default' => ''),
'LogHostname' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'LogRequestSource' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'Web', 2 => 'CLI'),
'default' => NULL
),
'LogRequestURI' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'LogRequestData' => Array ('type' => 'string', 'default' => NULL),
'LogUserId' => Array (
'type' => 'int',
'default' => NULL
),
'LogInterface' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (
kLogger::LI_FRONT => 'Front',
kLogger::LI_ADMIN => 'Admin',
kLogger::LI_CRON_FRONT => 'Cron (Front)',
kLogger::LI_CRON_ADMIN => 'Cron (Admin)',
kLogger::LI_API => 'API',
),
'not_null' => 1, 'default' => 0
),
'IpAddress' => Array ('type' => 'string', 'max_len' => 15, 'not_null' => 1, 'default' => ''),
'LogSessionKey' => Array ('type' => 'int', 'default' => NULL),
'LogSessionData' => Array ('type' => 'string', 'default' => NULL),
'LogBacktrace' => Array ('type' => 'string', 'default' => NULL),
'LogSourceFilename' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'LogSourceFileLine' => Array ('type' => 'int', 'default' => NULL),
'LogProcessId' => Array ('type' => 'int', 'default' => NULL),
'LogMemoryUsed' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'LogUserData' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
'LogNotificationStatus' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (
kLogger::LNS_DISABLED => 'la_opt_LogNotificationDisabled',
kLogger::LNS_PENDING => 'la_opt_LogNotificationPending',
kLogger::LNS_SENT => 'la_opt_LogNotificationSent'
), 'use_phrases' => 1,
'not_null' => 1, 'default' => kLogger::LNS_DISABLED
)
),
'VirtualFields' => Array (
'Username' => Array ('type' => 'string', 'default' => ''),
),
'Grids' => Array (
'Default' => Array (
// 'Icons' => Array ('default' => 'icon16_item.png'),
'Fields' => Array (
'LogId' => Array ('title' => 'column:la_fld_Id', 'filter_block' => 'grid_range_filter', 'width' => 80),
'LogLevel' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'LogType' => Array ('filter_block' => 'grid_options_filter', 'width' => 80),
'LogCode' => Array ('filter_block' => 'grid_range_filter', 'width' => 80),
'LogMessage' => Array ('filter_block' => 'grid_like_filter', 'width' => 250),
'LogTimestamp' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 170),
'LogEventName' => Array ('filter_block' => 'grid_like_filter'),
'LogHostname' => Array ('filter_block' => 'grid_like_filter'),
'LogRequestSource' => Array ('filter_block' => 'grid_options_filter'),
'LogRequestURI' => Array ('data_block' => 'grid_uri_td', 'filter_block' => 'grid_like_filter'),
'Username' => Array ('filter_block' => 'grid_range_filter', 'width' => 80),
'LogInterface' => Array ('filter_block' => 'grid_options_filter'),
'IpAddress' => Array ('filter_block' => 'grid_like_filter'),
'LogSessionKey' => Array ('filter_block' => 'grid_range_filter', 'width' => 80),
'LogSourceFilename' => Array ('data_block' => 'grid_filename_td', 'filter_block' => 'grid_like_filter', 'width' => 200),
'LogSourceFileLine' => Array ('filter_block' => 'grid_range_filter', 'width' => 80),
'LogProcessId' => Array ('filter_block' => 'grid_range_filter', 'width' => 80),
'LogMemoryUsed' => Array ('data_block' => 'grid_memory_td', 'filter_block' => 'grid_range_filter'),
'LogUserData' => Array ('filter_block' => 'grid_like_filter', 'nl2br' => 1),
'LogNotificationStatus' => Array ('filter_block' => 'grid_options_filter'),
'LogBacktrace' => Array ('data_block' => 'grid_backtrace_td', 'filter_block' => 'grid_empty_filter', 'width' => 500, 'hidden' => 1),
),
),
),
);
Index: branches/5.2.x/core/units/system_event_subscriptions/system_event_subscriptions_config.php
===================================================================
--- branches/5.2.x/core/units/system_event_subscriptions/system_event_subscriptions_config.php (revision 15562)
+++ branches/5.2.x/core/units/system_event_subscriptions/system_event_subscriptions_config.php (revision 15563)
@@ -1,142 +1,142 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2011 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'system-event-subscription',
'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
'EventHandlerClass' => Array ('class' => 'SystemEventSubscriptionEventHandler', 'file' => 'system_event_subscription_eh.php', 'build_event' => 'OnBuild'),
'TagProcessorClass' => Array ('class' => 'SystemEventSubscriptionTagProcessor', 'file' => 'system_event_subscription_tp.php', 'build_event' => 'OnBuild'),
'AutoLoad' => true,
'QueryString' => Array (
1 => 'id',
2 => 'Page',
3 => 'PerPage',
4 => 'event',
5 => 'mode',
),
'IDField' => 'SubscriptionId',
'TableName' => TABLE_PREFIX . 'SystemEventSubscriptions',
'TitleField' => 'SubscriptionId',
'TitlePresets' => Array (
'default' => Array (
'new_status_labels' => Array ('system-event-subscription' => '!la_title_AddingSystemEventSubscription!'),
'edit_status_labels' => Array ('system-event-subscription' => '!la_title_EditingSystemEventSubscription!'),
),
'system_event_subscription_list' => Array (
'prefixes' => Array ('system-event-subscription_List'), 'format' => "!la_title_SystemEventSubscriptions!",
'toolbar_buttons' => Array ('new_item', 'edit', 'delete', 'view', 'dbl-click'),
),
'system_event_subscription_edit' => Array (
'prefixes' => Array ('system-event-subscription'), 'format' => "#system-event-subscription_status# '#system-event-subscription_titlefield#'",
'toolbar_buttons' => Array ('select', 'cancel', 'reset_edit', 'prev', 'next'),
),
),
'PermSection' => Array('main' => 'in-portal:system_event_subscriptions'),
'Sections' => Array (
'in-portal:system_event_subscriptions' => Array (
'parent' => 'in-portal:users',
'icon' => 'system_event_subscriptions',
'label' => 'la_title_SystemEventSubscriptions',
'url' => Array('t' => 'system_event_subscriptions/system_event_subscription_list', 'pass' => 'm'),
'permissions' => Array('view', 'add', 'edit', 'delete'),
'priority' => 6,
'type' => stTREE,
),
),
'ListSQLs' => Array (
'' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN ' . TABLE_PREFIX . 'EmailEvents ee ON %1$s.EmailEventId = ee.EventId
LEFT JOIN ' . TABLE_PREFIX . 'Users u ON %1$s.UserId = u.PortalUserId
LEFT JOIN ' . TABLE_PREFIX . 'Categories c ON %1$s.CategoryId = c.CategoryId',
),
'CalculatedFields' => Array (
'' => Array (
'BindToSystemEvent' => 'ee.BindToSystemEvent',
'EmailEventName' => 'ee.Event',
- 'Username' => 'CASE %1$s.UserId WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE IF(CONCAT(u.FirstName, u.LastName) <> "", CONCAT(u.FirstName, " ", u.LastName), IF(%1$s.UserId IS NULL, "Guest", u.Username)) END',
+ 'Username' => 'CASE %1$s.UserId WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE IF(CONCAT(u.FirstName, u.LastName) <> "", CONCAT(u.FirstName, " ", u.LastName), IF(%1$s.UserId IS NULL, "Guest", IF(u.Username = "", u.Email, u.Username))) END',
'CategoryName' => 'c.l%2$s_Name',
'ItemName' => '%1$s.ItemId',
'ParentItemName' => '%1$s.ParentItemId',
),
),
'ListSortings' => Array (
'' => Array (
'Sorting' => Array ('SubscriptionId' => 'desc'),
)
),
'Fields' => Array (
'SubscriptionId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'EmailEventId' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'EmailEvents WHERE BindToSystemEvent <> "" ORDER BY Event ASC', 'option_key_field' => 'EventId', 'option_title_field' => 'BindToSystemEvent',
'required' => 1, 'default' => NULL
),
'SubscriberEmail' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
- 'UserId' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
+ 'UserId' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL),
'CategoryId' => Array ('type' => 'int', 'default' => NULL),
'IncludeSublevels' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 1
),
'ItemId' => Array ('type' => 'int', 'default' => NULL),
'ParentItemId' => Array ('type' => 'int', 'default' => NULL),
'SubscribedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'required' => 1, 'default' => '#NOW#')
),
'VirtualFields' => Array (
'Username' => Array ('type' => 'string', 'default' => ''),
'EmailEventName' => Array ('type' => 'string', 'default' => ''),
'CategoryName' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => ''),
),
'Grids' => Array (
'Default' => Array (
'Fields' => Array (
'SubscriptionId' => Array ('title' => 'column:la_fld_Id', 'filter_block' => 'grid_range_filter', 'width' => 80),
'EmailEventId' => Array ('title' => 'column:la_fld_SystemEvent', 'filter_block' => 'grid_options_filter', 'width' => 170),
'EmailEventName' => Array ('title' => 'column:la_fld_EmailEvent', 'filter_block' => 'grid_like_filter', 'width' => 170),
'SubscriberEmail' => Array ('title' => 'column:la_fld_Email', 'filter_block' => 'grid_like_filter'),
'UserId' => Array ('title' => 'la_col_PortalUserId', 'filter_block' => 'grid_range_filter', 'width' => 80),
'Username' => Array ('filter_block' => 'grid_like_filter'),
'CategoryId' => Array ('title' => 'column:la_fld_CategoryId', /*'data_block' => 'grid_category_td',*/ 'filter_block' => 'grid_range_filter', 'width' => 100),
'IncludeSublevels' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'CategoryName' => Array ('title' => 'column:la_fld_Category', 'filter_block' => 'grid_like_filter', 'width' => 200),
'ItemId' => Array ('filter_block' => 'grid_range_filter', 'width' => 80),
'ItemName' => Array ('data_block' => 'grid_item_name_td', 'associated_field' => 'ItemId', 'filter_block' => 'grid_like_filter', 'width' => 120),
'ParentItemId' => Array ('filter_block' => 'grid_range_filter', 'width' => 80),
'ParentItemName' => Array ('data_block' => 'grid_item_name_td', 'associated_field' => 'ParentItemId', 'filter_block' => 'grid_like_filter', 'width' => 120),
'SubscribedOn' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 170)
),
),
),
);
\ No newline at end of file
Index: branches/5.2.x/core/units/user_groups/user_groups_config.php
===================================================================
--- branches/5.2.x/core/units/user_groups/user_groups_config.php (revision 15562)
+++ branches/5.2.x/core/units/user_groups/user_groups_config.php (revision 15563)
@@ -1,137 +1,137 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$config = Array(
'Prefix' => 'ug',
'Clones' => Array(
'g-ug' => Array(
'ParentPrefix' => 'g',
'ForeignKey' => 'GroupId',
'ParentTableKey' => 'GroupId',
'IDField' => 'PortalUserId',
'ListSQLs' => Array(
'' => ' SELECT %1$s.* %2$s FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'UserGroups g ON %1$s.GroupId = g.GroupId
LEFT JOIN '.TABLE_PREFIX.'Users u ON %1$s.PortalUserId = u.PortalUserId'
),
'ItemSQLs' => Array(
'' => ' SELECT %1$s.* %2$s FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'UserGroups g ON %1$s.GroupId = g.GroupId
LEFT JOIN '.TABLE_PREFIX.'Users u ON %1$s.PortalUserId = u.PortalUserId'
),
'CalculatedFields' => Array (
'' => Array(
'UserName' => 'CONCAT(u.LastName, \' \', u.FirstName)',
- 'UserLogin' => 'u.Username',
+ 'UserLogin' => 'IF(u.Username = "", u.Email, u.Username)',
'PrimaryGroup' => 'IF(u.PrimaryGroupId = %1$s.GroupId, 1, 0)',
),
),
'VirtualFields' => Array (
'UserName' => Array('type' => 'string', 'default' => ''),
'UserLogin' => Array('type' => 'string', 'default' => ''),
),
'Grids' => Array(
'GroupUsers' => Array(
'Icons' => Array ('default' => 'icon16_item.png'),
'Fields' => Array(
'PortalUserId' => Array ('title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 60, ),
'UserName' => Array ('title'=>'la_col_UserFirstLastName', 'width' => 200, ),
'UserLogin' => Array ('title'=>'column:la_fld_Username', 'width' => 100, ),
'PrimaryGroup' => Array( 'title'=>'la_col_PrimaryGroup', 'filter_block' => 'grid_options_filter', 'width' => 100, ),
'MembershipExpires' => Array ('title' => 'la_col_MembershipExpires', 'data_block' => 'grid_membership_td', 'filter_block' => 'grid_date_range_filter', 'width' => 150, ),
),
),
),
),
'u-ug' => Array(
'ParentPrefix' => 'u',
'ForeignKey' => 'PortalUserId',
'ParentTableKey' => 'PortalUserId',
),
),
'ItemClass' => Array('class'=>'UserGroups_DBItem','file'=>'user_groups_dbitem.php','build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'UserGroupsEventHandler','file'=>'user_groups_eh.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),
'AutoLoad' => true,
'QueryString' => Array (
1 => 'id',
2 => 'Page',
3 => 'PerPage',
4 => 'event',
),
'IDField' => 'GroupId',
'TitleField' => 'GroupName',
'TableName' => TABLE_PREFIX.'UserGroupRelations',
'ListSQLs' => Array( ''=>' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'UserGroups g ON %1$s.GroupId = g.GroupId
LEFT JOIN '.TABLE_PREFIX.'%3$sUsers u ON %1$s.PortalUserId = u.PortalUserId'),
'AutoDelete' => true,
'AutoClone' => false,
'CalculatedFields' => Array (
'' => Array(
'GroupName' => 'g.Name',
'GroupDescription' => 'g.Description',
'PrimaryGroup' => 'IF(u.PrimaryGroupId = %1$s.GroupId, 1, 0)',
),
),
'Fields' => Array(
'PortalUserId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'GroupId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'MembershipExpires' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => null),
'ExpirationReminderSent' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
),
'VirtualFields' => Array (
'GroupName' => Array('type' => 'string', 'default' => ''),
'GroupDescription' => Array('type' => 'string', 'default' => ''),
'PrimaryGroup' => Array(
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 1
),
),
'Grids' => Array(
'Default' => Array(
'Icons' => Array (
'default' => 'icon16_item.png',
1 => 'icon16_primary.png'
),
'Fields' => Array(
'GroupId' => Array ('title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 60, ),
'GroupName' => Array ('width' => 100, ),
'GroupDescription' => Array ('title' => 'column:la_fld_Description', 'width' => 150, ),
'PrimaryGroup' => Array( 'title'=>'la_col_PrimaryGroup', 'filter_block' => 'grid_options_filter', 'width' => 150, ),
'MembershipExpires' => Array ('title' => 'la_col_MembershipExpires', 'data_block' => 'grid_membership_td', 'filter_block' => 'grid_date_range_filter', 'width' => 150, ),
),
),
),
);
\ No newline at end of file
Index: branches/5.2.x/core/units/reviews/reviews_config.php
===================================================================
--- branches/5.2.x/core/units/reviews/reviews_config.php (revision 15562)
+++ branches/5.2.x/core/units/reviews/reviews_config.php (revision 15563)
@@ -1,220 +1,218 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'rev',
'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 => 'PerPage',
4 => 'event',
5 => 'mode',
),
'RewriteListener' => 'CategoryItemRewrite:ReviewRewriteListener',
'ParentPrefix' => 'p', // replace all usage of rev to "p-rev" and then remove this param from here and Prefix too
'ConfigMapping' => Array (
'PerPage' => 'Comm_Perpage_Reviews',
'ReviewDelayInterval' => 'product_ReviewDelay_Value',
'ReviewDelayValue' => 'product_ReviewDelay_Interval',
),
'IDField' => 'ReviewId',
'StatusField' => Array ('Status'), // field, that is affected by Approve/Decline events
'TableName' => TABLE_PREFIX.'CatalogReviews',
'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!"),
'reviews' => Array (
'toolbar_buttons' => Array ('edit', 'delete', 'approve', 'decline', 'view', 'dbl-click'),
),
),
'CalculatedFields' => Array (
'' => Array (
'ReviewedBy' => 'CASE %1$s.CreatedById WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE IF(CONCAT(pu.FirstName, pu.LastName) <> "", CONCAT(pu.FirstName, " ", pu.LastName), pu.Username) END',
),
'products' => Array (
'ReviewedBy' => 'CASE %1$s.CreatedById WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE IF(CONCAT(pu.FirstName, pu.LastName) <> "", CONCAT(pu.FirstName, " ", pu.LastName), pu.Username) END',
'ItemName' => 'pr.l1_Name',
'ProductId' => 'pr.ProductId',
),
'product' => Array (
'ReviewedBy' => 'CASE %1$s.CreatedById WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE IF(CONCAT(pu.FirstName, pu.LastName) <> "", CONCAT(pu.FirstName, " ", pu.LastName), pu.Username) END',
'ItemName' => 'pr.l1_Name',
'ProductId' => 'pr.ProductId',
),
),
// key - special, value - list select sql
'ListSQLs' => Array (
'' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN ' . TABLE_PREFIX . 'Users pu ON pu.PortalUserId = %1$s.CreatedById',
'products' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN ' . TABLE_PREFIX . 'Products pr ON pr.ResourceId = %1$s.ItemId
LEFT JOIN ' . TABLE_PREFIX . 'Users pu ON pu.PortalUserId = %1$s.CreatedById',
'product' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN ' . TABLE_PREFIX . 'Products pr ON pr.ResourceId = %1$s.ItemId
LEFT JOIN ' . TABLE_PREFIX . 'Users pu ON pu.PortalUserId = %1$s.CreatedById',
),
'ItemSQLs' => Array ('' => 'SELECT * FROM %s'),
'ListSortings' => Array (
'' => Array (
'ForcedSorting' => Array ('Priority' => 'desc'),
'Sorting' => Array ('ReviewId' => 'desc'),
)
),
'Fields' => Array (
'ReviewId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'CreatedOn' => Array (
'type' => 'int',
'formatter' => 'kDateFormatter', 'default' => '#NOW#',
),
'ReviewText' => Array (
'type' => 'string',
'formatter' => 'kFormatter',
'using_fck' => 1, 'default' => null, 'required' => 1,
),
'Rating' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (
0 => 'lu_None',
1 => 'lu_Rating_1',
2 => 'lu_Rating_2',
3 => 'lu_Rating_3',
4 => 'lu_Rating_4',
5 => 'lu_Rating_5'),
'use_phrases' => 1,
'min_value_inc' => 0, 'max_value_inc' => 5, 'not_null' => 1, 'default' => 0,
),
'IPAddress' => Array (
'type' => 'string',
'max_value_inc' => 15, 'not_null' =>1, 'default' => '',
),
'ItemId' => Array (
'type' => 'int',
'not_null' => 1, 'default' => 0
),
'CreatedById' => Array (
'type' => 'int',
'formatter' => 'kLEFTFormatter',
'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),
- 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users
- WHERE `%s` = \'%s\' ',
- 'left_key_field' => 'PortalUserId',
- 'left_title_field' => 'Username',
+ 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s',
+ 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD,
'required' => 1, 'default' => NULL,
'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'),
),
'ItemType' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'Priority' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'Status' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'use_phrases' => 1,
'options' => Array (
0 => 'la_Disabled',
1 => 'la_Active',
2 => 'la_Pending',
),
'not_null' =>1, 'default' => 2,
),
'TextFormat' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_text', 1 => 'la_html'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0,
),
'Module' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
'HelpfulCount' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'NotHelpfulCount' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0)
),
'VirtualFields' => Array (
'ReviewedBy' => Array ('type' => 'string', 'default' => ''),
'CatalogItemName' => Array ('type' => 'string', 'default' => ''),
'CatalogItemId' => Array ('type' => 'int', 'default' => 0),
'CatalogItemCategory' => Array ('type' => 'int', 'default' => 0),
'ItemName' => Array ('type' => 'string', 'default' => ''),
'ProductId' => Array ('type' => 'int', 'default' => 0),
),
'Grids' => Array (
'Default' => Array (
'Icons' => Array (
'default' => 'icon16_item.png',
0 => 'icon16_disabled.png',
1 => 'icon16_item.png',
2 => 'icon16_pending.png',
),
'Fields' => Array (
'ReviewId' => Array ('title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 60, ),
'ReviewText' => Array ('filter_block' => 'grid_like_filter', 'width' => 210, 'first_chars' => 200, ),
'ReviewedBy' => Array ( 'title' => 'la_col_ReviewedBy', 'filter_block' => 'grid_like_filter', 'width' => 100, ),
'CreatedOn' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 145, ),
'Status' => Array ('filter_block' => 'grid_options_filter', 'width' => 80, ),
'Rating' => Array ('filter_block' => 'grid_options_filter', 'width' => 80, ),
'HelpfulCount' => Array ('title' => 'la_col_HelpfulCount', 'filter_block' => 'grid_range_filter'),
'NotHelpfulCount' => Array ('title' => 'la_col_NotHelpfulCount', 'filter_block' => 'grid_range_filter'),
),
),
'ReviewsSection' => Array (
'Icons' => Array (
'default' => 'icon16_item.png',
0 => 'icon16_disabled.png',
1 => 'icon16_item.png',
2 => 'icon16_pending.png',
),
'Fields' => Array (
'ReviewId' => Array ('title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 60, ),
'ReviewText' => Array ('data_block' => 'grid_reviewtext_td', 'filter_block' => 'grid_like_filter', 'width' => 210, 'first_chars' => 200, ),
'ReviewedBy' => Array ( 'title' => 'la_col_ReviewedBy', 'filter_block' => 'grid_like_filter', 'width' => 100, ),
'CreatedOn' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 145, ),
'Status' => Array ('filter_block' => 'grid_options_filter', 'width' => 80, ),
'Rating' => Array ('filter_block' => 'grid_options_filter', 'width' => 80, ),
'HelpfulCount' => Array ('title' => 'la_col_HelpfulCount', 'filter_block' => 'grid_range_filter'),
'NotHelpfulCount' => Array ('title' => 'la_col_NotHelpfulCount', 'filter_block' => 'grid_range_filter'),
),
),
),
);
\ No newline at end of file
Index: branches/5.2.x/core/units/page_revisions/page_revisions_config.php
===================================================================
--- branches/5.2.x/core/units/page_revisions/page_revisions_config.php (revision 15562)
+++ branches/5.2.x/core/units/page_revisions/page_revisions_config.php (revision 15563)
@@ -1,93 +1,93 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2011 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'page-revision',
'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
'EventHandlerClass' => Array ('class' => 'PageRevisionEventHandler', 'file' => 'page_revision_eh.php', 'build_event' => 'OnBuild'),
'TagProcessorClass' => Array ('class' => 'PageRevisionTagProcessor', 'file' => 'page_revision_tp.php', 'build_event' => 'OnBuild'),
'AutoLoad' => true,
'QueryString' => Array (
1 => 'id',
2 => 'Page',
3 => 'PerPage',
4 => 'event',
5 => 'mode', // needed?
),
'IDField' => 'RevisionId',
'ParentTableKey' => 'CategoryId', // linked field in master table
'ForeignKey' => 'PageId', // linked field in subtable
'ParentPrefix' => 'c',
'AutoDelete' => true,
'AutoClone' => true,
'TitleField' => 'RevisionNumber',
'TableName' => TABLE_PREFIX . 'PageRevisions',
'ListSQLs' => Array (
'' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN ' . TABLE_PREFIX . '%3$sCategories c ON c.CategoryId = %1$s.PageId
LEFT JOIN ' . TABLE_PREFIX . 'Users created_by ON created_by.PortalUserId = %1$s.CreatedById'
),
'SubItems' => Array ('content'),
'ListSortings' => Array (
'' => Array (
'Sorting' => Array ('IsDraft' => 'desc', 'RevisionNumber' => 'desc'),
)
),
'CalculatedFields' => Array (
'' => Array (
- 'CreatedBy' => 'created_by.Username',
+ 'CreatedBy' => 'IF(created_by.Username = "", created_by.Email, created_by.Username)',
'IsLive' => 'IF(%1$s.RevisionNumber = c.LiveRevisionNumber, 1, 0)',
),
),
'Fields' => Array (
'RevisionId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'PageId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'RevisionNumber' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'IsDraft' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0
),
'FromRevisionId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'CreatedById' => Array (
'type' => 'int',
- 'formatter' => 'kLEFTFormatter', 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'sample_value' => 'Guest', 'required' => 1,
+ 'formatter' => 'kLEFTFormatter', 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'sample_value' => 'Guest', 'required' => 1,
'default' => NULL
),
'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
'AutoSavedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => NULL),
'Status' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Pending', 1 => 'la_opt_Published', 0 => 'la_opt_Declined'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2)
),
'VirtualFields' => Array (
'CreatedBy' => Array ('type' => 'string', 'default' => ''),
'IsLive' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'default' => 0,
)
),
);
Index: branches/5.2.x/core/units/spam_reports/spam_reports_config.php
===================================================================
--- branches/5.2.x/core/units/spam_reports/spam_reports_config.php (revision 15562)
+++ branches/5.2.x/core/units/spam_reports/spam_reports_config.php (revision 15563)
@@ -1,112 +1,112 @@
<?php
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'spam-report',
'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
'EventHandlerClass' => Array ('class' => 'SpamReportEventHandler', 'file' => 'spam_report_eh.php', 'build_event' => 'OnBuild'),
'TagProcessorClass' => Array ('class' => 'SpamReportTagProcessor', 'file' => 'spam_report_tp.php', 'build_event' => 'OnBuild'),
'AutoLoad' => true,
'QueryString' => Array (
1 => 'id',
2 => 'Page',
3 => 'PerPage',
4 => 'event',
5 => 'mode',
),
'IDField' => 'ReportId',
'TableName' => TABLE_PREFIX . 'SpamReports',
'TitleField' => 'MessageText',
'TitlePresets' => Array (
'default' => Array (
'edit_status_labels' => Array ('spam-report' => '!la_title_EditingSpamReport!'),
),
'spam_report_list' => Array (
'prefixes' => Array ('spam-report_List'), 'format' => "!la_title_SpamReports!",
'toolbar_buttons' => Array ('edit', 'delete', 'view'),
),
'spam_report_edit' => Array (
'prefixes' => Array ('spam-report'), 'format' => "#spam-report_status# '#spam-report_titlefield#'",
'toolbar_buttons' => Array ('select', 'cancel', 'reset_edit', 'delete'),
),
),
'PermSection' => Array('main' => 'in-portal:spam_reports'),
'Sections' => Array (
'in-portal:spam_reports' => Array (
'parent' => 'in-portal:reports',
'icon' => 'spam_reports',
'label' => 'la_title_SpamReports',
'url' => Array('t' => 'spam_reports/spam_report_list', 'pass' => 'm'),
'permissions' => Array('view', 'edit', 'delete'),
'priority' => 8,
'type' => stTREE,
),
),
'ListSQLs' => Array (
'' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN ' . TABLE_PREFIX . 'Users reported_by ON reported_by.PortalUserId = %1$s.ReportedById
LEFT JOIN ' . TABLE_PREFIX . 'CatalogReviews review ON review.ReviewId = %1$s.ItemId AND %1$s.ItemPrefix LIKE "%rev"',
),
'CalculatedFields' => Array (
'' => Array (
'ItemName' => 'IF(%1$s.ItemPrefix LIKE "%rev", review.ReviewText, "")',
- 'ReportedBy' => 'reported_by.Username',
+ 'ReportedBy' => 'IF(reported_by.Username = "", reported_by.Email, reported_by.Username)',
),
),
'ListSortings' => Array (
'' => Array (
'Sorting' => Array ('ReportId' => 'desc'),
)
),
'Fields' => Array (
'ReportId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'ItemPrefix' => Array (
'type' => 'string', 'max_len' => 255,
'formatter' => 'kOptionsFormatter', 'options' => Array ('p-rev' => 'la_opt_ProductReview'), 'use_phrases' => 1,
'not_null' => 1, 'default' => ''
),
'ItemId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'MessageText' => Array ('type' => 'string', 'required' => 1, 'default' => NULL),
'ReportedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
'ReportedById' => Array (
'type' => 'int',
- 'formatter' => 'kLEFTFormatter', 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'sample_value' => 'Guest',
+ 'formatter' => 'kLEFTFormatter', 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'sample_value' => 'Guest',
'default' => NULL
)
),
'VirtualFields' => Array (
'ItemName' => Array ('type' => 'string', 'default' => ''),
'ReportedBy' => Array ('type' => 'string', 'default' => ''),
),
'Grids' => Array (
'Default' => Array (
'Fields' => Array (
'ReportId' => Array ('title' => 'column:la_fld_Id', 'filter_block' => 'grid_range_filter'),
'ItemPrefix' => Array ('data_block' => 'grid_item_prefix_td', 'filter_block' => 'grid_options_filter', 'width' => 150),
'ItemId' => Array ('filter_block' => 'grid_range_filter'),
'ItemName' => Array ('data_block' => 'grid_edit_item_td', 'filter_block' => 'grid_like_filter'),
'MessageText' => Array ('filter_block' => 'grid_like_filter'),
'ReportedOn' => Array ('filter_block' => 'grid_date_range_filter'),
'ReportedBy' => Array ('filter_block' => 'grid_like_filter'),
),
),
),
);
\ No newline at end of file
Index: branches/5.2.x/core/admin_templates/user_selector.tpl
===================================================================
--- branches/5.2.x/core/admin_templates/user_selector.tpl (revision 15562)
+++ branches/5.2.x/core/admin_templates/user_selector.tpl (revision 15563)
@@ -1,61 +1,61 @@
<inp2:adm_SetPopupSize width="582" height="504"/>
<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" prefix="u" section="in-portal:user_list" grid="UserSelector" title_preset="user_select" pagination="1"/>
<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<script type="text/javascript">
a_toolbar = new ToolBar();
a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', edit) );
a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
window_close();
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep3') );
a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View" escape="1"/>', function() {
show_viewmenu(a_toolbar,'view');
}
) );
a_toolbar.Render();
function edit() {
var $opener = getWindowOpener(window);
if ( $.isFunction($opener.processUserSelector) ) {
$opener.processUserSelector('<inp2:m_Recall name="dst_field"/>', window);
window_close();
}
else {
submit_event('<inp2:m_Recall name="main_prefix"/>', 'OnSelectUser');
}
}
var $user_logins = {};
</script>
</td>
<inp2:m_RenderElement name="search_main_toolbar" prefix="u" grid="UserSelector"/>
</tr>
</tbody>
</table>
<inp2:m_DefineElement name="grid_login_td" format="" nl2br="" no_special="1" first_chars="" td_style="">
<inp2:Field field="$field" first_chars="$first_chars" nl2br="$nl2br" grid="$grid" no_special="$no_special" format="$format"/>
<script type="text/javascript">
- $user_logins[ <inp2:Field name="$IdField"/> ] = '<inp2:Field name="Username" js_escape="1"/>';
+ $user_logins[ <inp2:Field name="$IdField"/> ] = '<inp2:UserSelectorTitle js_escape="1"/>';
</script>
</inp2:m_DefineElement>
<inp2:m_RenderElement name="grid" PrefixSpecial="u" IdField="PortalUserId" grid="UserSelector"/>
<script type="text/javascript">
Grids['u'].SetDependantToolbarButtons( new Array('select') );
</script>
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Index: branches/5.2.x/core/install/install_data.sql
===================================================================
--- branches/5.2.x/core/install/install_data.sql (revision 15562)
+++ branches/5.2.x/core/install/install_data.sql (revision 15563)
@@ -1,1032 +1,1032 @@
# Section "in-portal:configure_categories":
INSERT INTO SystemSettings VALUES(DEFAULT, 'Category_Sortfield', 'Name', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_category_sortfield_prompt', 'select', '', 'Name=la_opt_Title||Description=la_opt_Description||CreatedOn=la_opt_CreatedOn||EditorsPick=la_opt_EditorsPick||<SQL>SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM <PREFIX>CustomFields WHERE (Type = 1) AND (IsSystem = 0)</SQL>', 10.01, 1, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Category_Sortorder', 'asc', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_category_sortfield_prompt', 'select', '', 'asc=la_common_Ascending||desc=la_common_Descending', 10.01, 2, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Category_Sortfield2', 'Description', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_category_sortfield2_prompt', 'select', '', 'Name=la_opt_Title||Description=la_opt_Description||CreatedOn=la_opt_CreatedOn||EditorsPick=la_opt_EditorsPick||<SQL>SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM <PREFIX>CustomFields WHERE (Type = 1) AND (IsSystem = 0)</SQL>', 10.02, 1, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Category_Sortorder2', 'asc', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_category_sortfield2_prompt', 'select', '', 'asc=la_common_Ascending||desc=la_common_Descending', 10.02, 2, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Perpage_Category', '20', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_category_perpage_prompt', 'text', '', '', 10.03, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Perpage_Category_Short', '3', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_category_perpage__short_prompt', 'text', '', '', 10.04, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Category_DaysNew', '8', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_category_daysnew_prompt', 'text', '', '', 10.05, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Category_ShowPick', '', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_category_showpick_prompt', 'checkbox', '', '', 10.06, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'MaxImportCategoryLevels', '10', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_prompt_max_import_category_levels', 'text', '', '', 10.07, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'AllowDeleteRootCats', '1', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_AllowDeleteRootCats', 'checkbox', NULL, NULL, 10.08, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Catalog_PreselectModuleTab', '1', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_CatalogPreselectModuleTab', 'checkbox', NULL, NULL, 10.09, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'RecycleBinFolder', '', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_RecycleBinFolder', 'text', NULL, NULL, 10.10, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'CategoryPermissionRebuildMode', '3', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_CategoryPermissionRebuildMode', 'select', NULL, '1=la_opt_Manual||2=la_opt_Silent||3=la_opt_Automatic', 10.11, 0, 0, 'hint:la_config_CategoryPermissionRebuildMode');
INSERT INTO SystemSettings VALUES(DEFAULT, 'FilenameSpecialCharReplacement', '-', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_FilenameSpecialCharReplacement', 'select', NULL, '_=+_||-=+-', 10.12, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Search_MinKeyword_Length', '3', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_Search_MinKeyword_Length', 'text', NULL, NULL, 10.13, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'ExcludeTemplateSectionsFromSearch', '0', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_ExcludeTemplateSectionsFromSearch', 'checkbox', '', '', 10.14, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UpdateCountersOnFilterChange', '1', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_UpdateCountersOnFilterChange', 'checkbox', '', '', 10.15, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Category_MetaKey', '', 'In-Portal', 'in-portal:configure_categories', 'la_Text_MetaInfo', 'la_category_metakey', 'textarea', '', '', 20.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Category_MetaDesc', '', 'In-Portal', 'in-portal:configure_categories', 'la_Text_MetaInfo', 'la_category_metadesc', 'textarea', '', '', 20.02, 0, 1, NULL);
# Section "in-portal:configure_general":
INSERT INTO SystemSettings VALUES(DEFAULT, 'Site_Name', 'In-Portal CMS', 'In-Portal', 'in-portal:configure_general', 'la_section_SettingsWebsite', 'la_config_website_name', 'text', '', '', 10.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'FirstDayOfWeek', '1', 'In-Portal', 'in-portal:configure_general', 'la_Text_Date_Time_Settings', 'la_config_first_day_of_week', 'select', '', '0=la_sunday||1=la_monday', 20.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Config_Site_Time', '', 'In-Portal', 'in-portal:configure_general', 'la_Text_Date_Time_Settings', 'la_config_site_zone', 'select', '', NULL, 20.02, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'DefaultEmailSender', 'portal@user.domain.name', 'In-Portal', 'in-portal:configure_general', 'la_section_SettingsMailling', 'la_prompt_AdminMailFrom', 'text', NULL, 'size="40"', 30.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SessionTimeout', '3600', 'In-Portal', 'in-portal:configure_general', 'la_section_SettingsSession', 'la_prompt_session_timeout', 'text', 'a:3:{s:4:"type";s:3:"int";s:13:"min_value_inc";i:1;s:8:"required";i:1;}', '', 40.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'AdminConsoleInterface', 'simple', 'In-Portal', 'in-portal:configure_general', 'la_section_SettingsAdmin', 'la_config_AdminConsoleInterface', 'select', '', 'simple=+simple||advanced=+advanced||custom=+custom', 50.01, 1, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'AllowAdminConsoleInterfaceChange', '1', 'In-Portal', 'in-portal:configure_general', 'la_section_SettingsAdmin', 'la_config_AdminConsoleInterface', 'checkbox', NULL, NULL, 50.01, 2, 0, NULL);
# Section "in-portal:configure_advanced":
INSERT INTO SystemSettings VALUES(DEFAULT, 'PageHitCounter', '0', 'In-Portal', 'in-portal:configure_advanced', '', '', '', NULL, NULL, 0, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseModRewrite', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_use_modrewrite', 'checkbox', '', '', 10.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'ModRewriteUrlEnding', '.html', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ModRewriteUrlEnding', 'select', '', '=+||/=+/||.html=+.html', 10.011, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'ForceModRewriteUrlEnding', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ForceModRewriteUrlEnding', 'checkbox', '', NULL, 10.012, 0, 0, 'hint:la_config_ForceModRewriteUrlEnding');
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseContentLanguageNegotiation', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UseContentLanguageNegotiation', 'checkbox', '', '', 10.013, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'cms_DefaultDesign', '#default_design#', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_DefaultDesignTemplate', 'text', NULL, NULL, 10.02, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'ErrorTemplate', 'error_notfound', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_error_template', 'text', '', '', 10.03, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'NoPermissionTemplate', 'no_permission', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_nopermission_template', 'text', '', '', 10.04, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UsePageHitCounter', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UsePageHitCounter', 'checkbox', '', '', 10.05, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'ForceImageMagickResize', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ForceImageMagickResize', 'checkbox', '', '', 10.06, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'CheckStopWords', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_CheckStopWords', 'checkbox', '', '', 10.07, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseVisitorTracking', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UseVisitorTracking', 'checkbox', '', '', 10.08, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'cms_DefaultTrackingCode', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_DefaultTrackingCode', 'textarea', NULL, 'COLS=40 ROWS=5', 10.09, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'PerformExactSearch', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_PerformExactSearch', 'checkbox', '', '', '10.10', 0, 0, 'hint:la_config_PerformExactSearch');
INSERT INTO SystemSettings VALUES(DEFAULT, 'MaintenanceMessageFront', 'Website is currently undergoing the upgrades. Please come back shortly!', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMaintenance', 'la_config_MaintenanceMessageFront', 'textarea', '', 'style="width: 100%; height: 100px;"', '15.01', 0, 0, 'hint:la_config_MaintenanceMessageFront');
INSERT INTO SystemSettings VALUES(DEFAULT, 'MaintenanceMessageAdmin', 'Website is currently undergoing the upgrades. Please come back shortly!', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMaintenance', 'la_config_MaintenanceMessageAdmin', 'textarea', '', 'style="width: 100%; height: 100px;"', '15.02', 0, 0, 'hint:la_config_MaintenanceMessageAdmin');
INSERT INTO SystemSettings VALUES(DEFAULT, 'SoftMaintenanceTemplate', 'maintenance', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMaintenance', 'la_config_SoftMaintenanceTemplate', 'text', '', 'style="width: 200px;"', '15.03', 0, 0, 'hint:la_config_SoftMaintenanceTemplate');
INSERT INTO SystemSettings VALUES(DEFAULT, 'HardMaintenanceTemplate', 'maintenance', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMaintenance', 'la_config_HardMaintenanceTemplate', 'text', '', 'style="width: 200px;"', '15.04', 0, 0, 'hint:la_config_HardMaintenanceTemplate');
INSERT INTO SystemSettings VALUES(DEFAULT, 'CookieSessions', '2', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_prompt_session_management', 'select', NULL, '0=la_opt_QueryString||1=la_opt_Cookies||2=la_opt_AutoDetect', 20.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SessionCookieName', 'sid', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_prompt_session_cookie_name', 'text', '', '', 20.02, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SessionCookieDomains', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_config_SessionCookieDomains', 'textarea', '', 'rows="5" cols="40"', 20.021, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'KeepSessionOnBrowserClose', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_config_KeepSessionOnBrowserClose', 'checkbox', '', '', 20.03, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SessionBrowserSignatureCheck', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_config_SessionBrowserSignatureCheck', 'checkbox', NULL, NULL, 20.04, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SessionIPAddressCheck', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_config_SessionIPAddressCheck', 'checkbox', NULL, NULL, 20.05, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseJSRedirect', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_config_use_js_redirect', 'checkbox', '', '', 20.06, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SSL_URL', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_ssl_url', 'text', '', '', 30.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'AdminSSL_URL', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_AdminSSL_URL', 'text', '', '', 30.02, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Require_SSL', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_require_ssl', 'checkbox', '', '', 30.03, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Require_AdminSSL', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_RequireSSLAdmin', 'checkbox', '', '', 30.04, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Force_HTTP_When_SSL_Not_Required', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_force_http', 'checkbox', '', '', 30.05, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseModRewriteWithSSL', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_use_modrewrite_with_ssl', 'checkbox', '', '', 30.06, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'RootPass', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_prompt_root_pass', 'password', NULL, NULL, 40.01, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseToolbarLabels', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_UseToolbarLabels', 'checkbox', NULL, NULL, 40.02, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseSmallHeader', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_UseSmallHeader', 'checkbox', '', '', 40.03, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseColumnFreezer', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_UseColumnFreezer', 'checkbox', '', '', 40.04, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UsePopups', '2', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_UsePopups', 'select', '', '0=la_opt_SameWindow||1=la_opt_PopupWindow||2=la_opt_ModalWindow', 40.05, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'StickyGridSelection', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_StickyGridSelection', 'radio', '', '1=la_Yes||0=la_No', 40.06, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseDoubleSorting', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_UseDoubleSorting', 'radio', '', '1=la_Yes||0=la_No', 40.07, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'MenuFrameWidth', '200', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_prompt_MenuFrameWidth', 'text', NULL, NULL, 40.08, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'ResizableFrames', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_ResizableFrames', 'checkbox', '', '', 40.09, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'AutoRefreshIntervals', '1,5,15,30,60,120,240', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_AutoRefreshIntervals', 'text', '', '', 40.10, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'DefaultGridPerPage', '20', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_DefaultGridPerPage', 'select', '', '10=+10||20=+20||50=+50||100=+100||500=+500', 40.11, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'DebugOnlyFormConfigurator', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_DebugOnlyFormConfigurator', 'checkbox', '', '', 40.12, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'DebugOnlyPromoBlockGroupConfigurator', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_DebugOnlyPromoBlockGroupConfigurator', 'checkbox', '', '', 40.13, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'RememberLastAdminTemplate', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_RememberLastAdminTemplate', 'checkbox', '', '', 40.14, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseHTTPAuth', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_UseHTTPAuth', 'checkbox', '', '', 40.15, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'HTTPAuthUsername', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_HTTPAuthUsername', 'text', '', '', 40.16, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'HTTPAuthPassword', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_HTTPAuthPassword', 'password', NULL, NULL, 40.17, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'HTTPAuthBypassIPs', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_HTTPAuthBypassIPs', 'text', '', '', 40.18, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'EnablePageContentRevisionControl', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_EnablePageContentRevisionControl', 'checkbox', '', '', 40.19, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Smtp_Server', NULL, 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_prompt_mailserver', 'text', NULL, NULL, 50.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Smtp_Port', NULL, 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_prompt_mailport', 'text', NULL, NULL, 50.02, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Smtp_Authenticate', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_prompt_mailauthenticate', 'checkbox', NULL, NULL, 50.03, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Smtp_User', NULL, 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_prompt_smtp_user', 'text', NULL, NULL, 50.04, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Smtp_Pass', NULL, 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_prompt_smtp_pass', 'text', NULL, NULL, 50.05, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Smtp_DefaultHeaders', 'X-Mailer: In-Portal', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_prompt_smtpheaders', 'textarea', NULL, 'COLS=40 ROWS=5', 50.06, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'MailFunctionHeaderSeparator', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_MailFunctionHeaderSeparator', 'radio', NULL, '1=la_Linux||2=la_Windows', 50.07, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'MailingListQueuePerStep', '10', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_MailingListQueuePerStep', 'text', NULL, NULL, 50.08, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'MailingListSendPerStep', '10', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_MailingListSendPerStep', 'text', NULL, NULL, 50.09, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'DefaultEmailRecipients', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_DefaultEmailRecipients', 'text', NULL, NULL, 50.10, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseOutputCompression', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_UseOutputCompression', 'checkbox', '', '', 60.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'OutputCompressionLevel', '7', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_OutputCompressionLevel', 'text', '', '', 60.02, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseTemplateCompression', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_UseTemplateCompression', 'checkbox', '', '', 60.03, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'TrimRequiredFields', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_TrimRequiredFields', 'checkbox', '', '', 60.04, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'RunScheduledTasksFromCron', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_UseCronForRegularEvent', 'checkbox', NULL, NULL, 60.05, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseChangeLog', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_UseChangeLog', 'checkbox', '', '', 60.06, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Backup_Path', '/home/alex/web/in-portal.rc/system/backupdata', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_backup_path', 'text', '', '', 60.07, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemTagCache', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_prompt_syscache_enable', 'checkbox', NULL, NULL, 60.08, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SocketBlockingMode', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_prompt_socket_blocking_mode', 'checkbox', NULL, NULL, 60.09, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'EnableEmailLog', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_EnableEmailLog', 'radio', NULL, '1=la_Yes||0=la_No', 65.01, 0, 1, 'hint:la_config_EnableEmailLog');
INSERT INTO SystemSettings VALUES(DEFAULT, 'EmailLogRotationInterval', '2419200', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_EmailLogRotationInterval', 'select', NULL, '86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_EmailLogKeepForever', 65.02, 0, 0, 'hint:la_config_EmailLogRotationInterval');
INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemLogRotationInterval', '2419200', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_SystemLogRotationInterval', 'select', NULL, '86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_SystemLogKeepForever', 65.03, 0, 1, 'hint:la_config_SystemLogRotationInterval');
INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemLogNotificationEmail', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_SystemLogNotificationEmail', 'text', 'a:5:{s:4:"type";s:6:"string";s:9:"formatter";s:10:"kFormatter";s:6:"regexp";s:85:"/^([-a-zA-Z0-9!\\#$%&*+\\/=?^_`{|}~.]+@[a-zA-Z0-9]{1}[-.a-zA-Z0-9_]*\\.[a-zA-Z]{2,6})$/i";s:10:"error_msgs";a:1:{s:14:"invalid_format";s:18:"!la_invalid_email!";}s:7:"default";s:0:"";}', NULL, 65.04, 0, 1, 'hint:la_config_SystemLogNotificationEmail');
INSERT INTO SystemSettings VALUES(DEFAULT, 'CSVExportDelimiter', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsCSVExport', 'la_config_CSVExportDelimiter', 'select', NULL, '0=la_opt_Tab||1=la_opt_Comma||2=la_opt_Semicolon||3=la_opt_Space||4=la_opt_Colon', 70.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'CSVExportEnclosure', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsCSVExport', 'la_config_CSVExportEnclosure', 'radio', NULL, '0=la_Doublequotes||1=la_Quotes', 70.02, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'CSVExportSeparator', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsCSVExport', 'la_config_CSVExportSeparator', 'radio', NULL, '0=la_Linux||1=la_Windows', 70.03, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'CSVExportEncoding', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsCSVExport', 'la_config_CSVExportEncoding', 'radio', NULL, '0=la_Unicode||1=la_Regular', 70.04, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'YahooApplicationId', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_Settings3rdPartyAPI', 'la_config_YahooApplicationId', 'text', NULL, NULL, 80.01, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'l_GoogleMapsAPIKey', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_Settings3rdPartyAPI', 'la_fld_LinkGoogleMapsAPIKey', 'text', NULL, NULL, 80.02, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'CKFinderLicenseName', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_Settings3rdPartyAPI', 'la_config_CKFinderLicenseName', 'text', NULL, NULL, 80.03, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'CKFinderLicenseKey', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_Settings3rdPartyAPI', 'la_config_CKFinderLicenseKey', 'text', NULL, NULL, 80.04, 0, 0, NULL);
# Section "in-portal:configure_users":
INSERT INTO SystemSettings VALUES(DEFAULT, 'User_Allow_New', '3', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_users_allow_new', 'radio', '', '1=la_opt_UserInstantRegistration||2=la_opt_UserNotAllowedRegistration||3=la_opt_UserUponApprovalRegistration||4=la_opt_UserEmailActivation', 10.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'AdvancedUserManagement', '0', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_prompt_AdvancedUserManagement', 'checkbox', NULL, NULL, 10.011, 0, 1, NULL);
-INSERT INTO SystemSettings VALUES(DEFAULT, 'RegistrationUsernameRequired', '1', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_config_RegistrationUsernameRequired', 'checkbox', NULL, NULL, 10.02, 0, 0, NULL);
+INSERT INTO SystemSettings VALUES(DEFAULT, 'RegistrationUsernameRequired', '0', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_config_RegistrationUsernameRequired', 'checkbox', NULL, NULL, 10.02, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'RegistrationCaptcha', '0', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_registration_captcha', 'checkbox', NULL, NULL, 10.025, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Min_UserName', '3', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_text_min_username', 'text', '', 'style="width: 50px;"', 10.03, 1, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'MaxUserName', '', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_text_min_username', 'text', '', 'style="width: 50px;"', 10.03, 2, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Min_Password', '5', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_text_min_password', 'text', '', '', 10.04, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Users_AllowReset', '180', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_prompt_allow_reset', 'text', NULL, NULL, 10.05, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UserEmailActivationTimeout', '', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_config_UserEmailActivationTimeout', 'text', NULL, NULL, 10.051, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'User_Password_Auto', '0', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_users_password_auto', 'checkbox', '', '', 10.06, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'User_MembershipExpirationReminder', '10', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_MembershipExpirationReminder', 'text', NULL, '', 10.07, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'User_NewGroup', '13', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_users_new_group', 'select', NULL, '0=lu_none||<SQL+>SELECT GroupId as OptionValue, Name as OptionName FROM <PREFIX>UserGroups WHERE Enabled=1 AND Personal=0</SQL>', 10.08, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'User_LoggedInGroup', '15', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_users_assign_all_to', 'select', NULL, '0=lu_none||<SQL+>SELECT GroupId as OptionValue, Name as OptionName FROM <PREFIX>UserGroups WHERE Enabled=1 AND Personal=0</SQL>', 10.09, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'User_GuestGroup', '14', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_users_guest_group', 'select', NULL, '0=lu_none||<SQL+>SELECT GroupId as OptionValue, Name as OptionName FROM <PREFIX>UserGroups WHERE Enabled=1 AND Personal=0</SQL>', 10.1, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'User_SubscriberGroup', '12', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_users_subscriber_group', 'select', NULL, '0=lu_none||<SQL+>SELECT GroupId as OptionValue, Name as OptionName FROM <PREFIX>UserGroups WHERE Enabled=1 AND Personal=0</SQL>', 10.11, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'User_AdminGroup', '11', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_users_admin_group', 'select', NULL, '0=lu_none||<SQL+>SELECT GroupId as OptionValue, Name as OptionName FROM <PREFIX>UserGroups WHERE Enabled=1 AND Personal=0</SQL>', 10.12, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'User_Default_Registration_Country', '', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_config_DefaultRegistrationCountry', 'select', NULL, '=+||<SQL+>SELECT l%3$s_Name AS OptionName, CountryStateId AS OptionValue FROM <PREFIX>CountryStates WHERE Type = 1 ORDER BY OptionName</SQL>', 10.13, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'AllowSelectGroupOnFront', '0', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_config_AllowSelectGroupOnFront', 'checkbox', NULL, NULL, 10.14, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'DefaultSettingsUserId', '-1', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_prompt_DefaultUserId', 'text', NULL, NULL, 10.15, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'u_MaxImageCount', '5', 'In-Portal:Users', 'in-portal:configure_users', 'la_section_ImageSettings', 'la_config_MaxImageCount', 'text', '', '', 30.01, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'u_ThumbnailImageWidth', '120', 'In-Portal:Users', 'in-portal:configure_users', 'la_section_ImageSettings', 'la_config_ThumbnailImageWidth', 'text', '', '', 30.02, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'u_ThumbnailImageHeight', '120', 'In-Portal:Users', 'in-portal:configure_users', 'la_section_ImageSettings', 'la_config_ThumbnailImageHeight', 'text', '', '', 30.03, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'u_FullImageWidth', '450', 'In-Portal:Users', 'in-portal:configure_users', 'la_section_ImageSettings', 'la_config_FullImageWidth', 'text', '', '', 30.04, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'u_FullImageHeight', '450', 'In-Portal:Users', 'in-portal:configure_users', 'la_section_ImageSettings', 'la_config_FullImageHeight', 'text', '', '', 30.05, 0, 0, NULL);
# Section "in-portal:configuration_search":
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Increase_category', '30', 'In-Portal', 'in-portal:configuration_search', 'la_config_DefaultIncreaseImportance', 'la_text_increase_importance', 'text', NULL, NULL, 0, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Keyword_category', '90', 'In-Portal', 'in-portal:configuration_search', 'la_config_SearchRel_DefaultKeyword', 'la_text_keyword', 'text', NULL, NULL, 0, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Pop_category', '5', 'In-Portal', 'in-portal:configuration_search', 'la_config_DefaultPop', 'la_text_popularity', 'text', NULL, NULL, 0, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Rating_category', '5', 'In-Portal', 'in-portal:configuration_search', 'la_config_DefaultRating', 'la_prompt_Rating', 'text', NULL, NULL, 0, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'CategoriesRebuildSerial', '0', 'In-Portal', '', '', '', '', NULL, NULL, 0, 0, 0, NULL);
INSERT INTO ItemTypes VALUES (1, 'In-Portal', 'c', 'Categories', 'Name', 'CreatedById', NULL, NULL, 'la_ItemTab_Categories', 1, 'admin/category/addcategory.php', 'clsCategory', 'Category');
INSERT INTO ItemTypes VALUES (6, 'In-Portal', 'u', 'Users', 'Username', 'PortalUserId', NULL, NULL, '', 0, '', 'clsPortalUser', 'User');
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.ADD', NULL, 1, 0, 'Core', 'Add User', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.ADD', NULL, 1, 1, 'Core', 'Add User', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.APPROVE', NULL, 1, 0, 'Core', 'Approve User', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.APPROVE', NULL, 1, 1, 'Core', 'Approve User', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.VALIDATE', NULL, 1, 0, 'Core', 'Validate User', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.VALIDATE', NULL, 1, 1, 'Core', 'Validate User', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.DENY', NULL, 1, 0, 'Core', 'Deny User', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.DENY', NULL, 1, 1, 'Core', 'Deny User', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.ADD.PENDING', NULL, 1, 0, 'Core', 'Add Pending User', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.ADD.PENDING', NULL, 1, 1, 'Core', 'Add Pending User', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'CATEGORY.ADD', NULL, 1, 0, 'Core', 'Add Category', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'CATEGORY.ADD.PENDING', NULL, 1, 0, 'Core', 'Add Pending Category', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'CATEGORY.ADD.PENDING', NULL, 1, 1, 'Core', 'Add Pending Category', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'CATEGORY.ADD', NULL, 1, 1, 'Core', 'Add Category', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'CATEGORY.APPROVE', NULL, 1, 0, 'Core', 'Approve Category', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'CATEGORY.DENY', NULL, 1, 0, 'Core', 'Deny Category', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.SUBSCRIBE', NULL, 1, 0, 'Core', 'User subscribed', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.SUBSCRIBE', NULL, 1, 1, 'Core', 'User subscribed', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.UNSUBSCRIBE', NULL, 1, 0, 'Core', 'User unsubscribed', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.UNSUBSCRIBE', NULL, 1, 1, 'Core', 'User unsubscribed', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.SUGGEST', NULL, 1, 0, 'Core', 'Suggest to a friend', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.SUGGEST', NULL, 1, 1, 'Core', 'Suggest to a friend', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.PSWDC', NULL, 1, 0, 'Core', 'Password Confirmation', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.MEMBERSHIP.EXPIRED', NULL, 1, 0, 'Core', 'Membership expired', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.MEMBERSHIP.EXPIRED', NULL, 1, 0, 'Core', 'Membership expired', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.MEMBERSHIP.EXPIRATION.NOTICE', NULL, 1, 0, 'Core', 'Membership expiration notice', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.MEMBERSHIP.EXPIRATION.NOTICE', NULL, 1, 0, 'Core', 'Membership expiration notice', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'COMMON.FOOTER', NULL, 1, 0, 'Core', 'Common Footer Template', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'FORM.SUBMITTED', NULL, 1, 0, 'Core', 'This e-mail is sent to a user after filling in the Contact Us form', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'FORM.SUBMITTED', NULL, 1, 0, 'Core', 'This e-mail is sent to a user after filling in the Contact Us form', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'FORM.SUBMISSION.REPLY.TO.USER', NULL, 1, 0, 'Core', 'Admin Reply to User Form Submission', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'FORM.SUBMISSION.REPLY.FROM.USER', NULL, 1, 0, 'Core', 'User Replied to It\'s Form Submission', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'FORM.SUBMISSION.REPLY.FROM.USER.BOUNCED', NULL, 1, 0, 'Core', 'Form Submission Admin Reply Delivery Failure', 1, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.NEW.PASSWORD', NULL, 1, 0, 'Core', 'Sends new password to an existing user', 0, 1, 0);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.ADD.BYADMIN', NULL, 1, 0, 'Core', 'Sends password to a new user', 0, 1, 0);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ROOT.RESET.PASSWORD', NULL, 1, 0, 'Core', 'Root Reset Password', 1, 1, 0);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.EMAIL.CHANGE.VERIFY', NULL, 1, 0, 'Core', 'Changed E-mail Verification', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.EMAIL.CHANGE.UNDO', NULL, 1, 0, 'Core', 'Changed E-mail Rollback', 0, 1, 1);
INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'SYSTEM.LOG.NOTIFY', NULL, 1, 0, 'Core', 'Notification about message added to System Log', 1, 1, 1);
INSERT INTO IdGenerator VALUES ('100');
INSERT INTO UserGroups VALUES(15, 'Everyone', 'Everyone', 0, 1, 0, 1, 0, NULL);
INSERT INTO UserGroups VALUES(13, 'Member', '', 1054738682, 0, 0, 1, 1, NULL);
INSERT INTO UserGroups VALUES(12, 'Subscribers', '', 1054738670, 0, 0, 1, 0, NULL);
INSERT INTO UserGroups VALUES(14, 'Guest', 'Guest User', 0, 1, 0, 1, 0, NULL);
INSERT INTO UserGroups VALUES(11, 'admin', NULL, 1054738405, 0, 0, 1, 0, NULL);
INSERT INTO CountryStates (CountryStateId, Type, StateCountryId, IsoCode, ShortIsoCode) VALUES
(1, 1, NULL, 'AFG', 'AF'),
(2, 1, NULL, 'ALB', 'AL'),
(3, 1, NULL, 'DZA', 'DZ'),
(4, 1, NULL, 'ASM', 'AS'),
(5, 1, NULL, 'AND', 'AD'),
(6, 1, NULL, 'AGO', 'AO'),
(7, 1, NULL, 'AIA', 'AI'),
(8, 1, NULL, 'ATA', 'AQ'),
(9, 1, NULL, 'ATG', 'AG'),
(10, 1, NULL, 'ARG', 'AR'),
(11, 1, NULL, 'ARM', 'AM'),
(12, 1, NULL, 'ABW', 'AW'),
(13, 1, NULL, 'AUS', 'AU'),
(14, 1, NULL, 'AUT', 'AT'),
(15, 1, NULL, 'AZE', 'AZ'),
(16, 1, NULL, 'BHS', 'BS'),
(17, 1, NULL, 'BHR', 'BH'),
(18, 1, NULL, 'BGD', 'BD'),
(19, 1, NULL, 'BRB', 'BB'),
(20, 1, NULL, 'BLR', 'BY'),
(21, 1, NULL, 'BEL', 'BE'),
(22, 1, NULL, 'BLZ', 'BZ'),
(23, 1, NULL, 'BEN', 'BJ'),
(24, 1, NULL, 'BMU', 'BM'),
(25, 1, NULL, 'BTN', 'BT'),
(26, 1, NULL, 'BOL', 'BO'),
(27, 1, NULL, 'BIH', 'BA'),
(28, 1, NULL, 'BWA', 'BW'),
(29, 1, NULL, 'BVT', 'BV'),
(30, 1, NULL, 'BRA', 'BR'),
(31, 1, NULL, 'IOT', 'IO'),
(32, 1, NULL, 'BRN', 'BN'),
(33, 1, NULL, 'BGR', 'BG'),
(34, 1, NULL, 'BFA', 'BF'),
(35, 1, NULL, 'BDI', 'BI'),
(36, 1, NULL, 'KHM', 'KH'),
(37, 1, NULL, 'CMR', 'CM'),
(38, 1, NULL, 'CAN', 'CA'),
(39, 1, NULL, 'CPV', 'CV'),
(40, 1, NULL, 'CYM', 'KY'),
(41, 1, NULL, 'CAF', 'CF'),
(42, 1, NULL, 'TCD', 'TD'),
(43, 1, NULL, 'CHL', 'CL'),
(44, 1, NULL, 'CHN', 'CN'),
(45, 1, NULL, 'CXR', 'CX'),
(46, 1, NULL, 'CCK', 'CC'),
(47, 1, NULL, 'COL', 'CO'),
(48, 1, NULL, 'COM', 'KM'),
(49, 1, NULL, 'COD', 'CD'),
(50, 1, NULL, 'COG', 'CG'),
(51, 1, NULL, 'COK', 'CK'),
(52, 1, NULL, 'CRI', 'CR'),
(53, 1, NULL, 'CIV', 'CI'),
(54, 1, NULL, 'HRV', 'HR'),
(55, 1, NULL, 'CUB', 'CU'),
(56, 1, NULL, 'CYP', 'CY'),
(57, 1, NULL, 'CZE', 'CZ'),
(58, 1, NULL, 'DNK', 'DK'),
(59, 1, NULL, 'DJI', 'DJ'),
(60, 1, NULL, 'DMA', 'DM'),
(61, 1, NULL, 'DOM', 'DO'),
(62, 1, NULL, 'TLS', 'TL'),
(63, 1, NULL, 'ECU', 'EC'),
(64, 1, NULL, 'EGY', 'EG'),
(65, 1, NULL, 'SLV', 'SV'),
(66, 1, NULL, 'GNQ', 'GQ'),
(67, 1, NULL, 'ERI', 'ER'),
(68, 1, NULL, 'EST', 'EE'),
(69, 1, NULL, 'ETH', 'ET'),
(70, 1, NULL, 'FLK', 'FK'),
(71, 1, NULL, 'FRO', 'FO'),
(72, 1, NULL, 'FJI', 'FJ'),
(73, 1, NULL, 'FIN', 'FI'),
(74, 1, NULL, 'FRA', 'FR'),
(75, 1, NULL, 'FXX', 'FX'),
(76, 1, NULL, 'GUF', 'GF'),
(77, 1, NULL, 'PYF', 'PF'),
(78, 1, NULL, 'ATF', 'TF'),
(79, 1, NULL, 'GAB', 'GA'),
(80, 1, NULL, 'GMB', 'GM'),
(81, 1, NULL, 'GEO', 'GE'),
(82, 1, NULL, 'DEU', 'DE'),
(83, 1, NULL, 'GHA', 'GH'),
(84, 1, NULL, 'GIB', 'GI'),
(85, 1, NULL, 'GRC', 'GR'),
(86, 1, NULL, 'GRL', 'GL'),
(87, 1, NULL, 'GRD', 'GD'),
(88, 1, NULL, 'GLP', 'GP'),
(89, 1, NULL, 'GUM', 'GU'),
(90, 1, NULL, 'GTM', 'GT'),
(91, 1, NULL, 'GIN', 'GN'),
(92, 1, NULL, 'GNB', 'GW'),
(93, 1, NULL, 'GUY', 'GY'),
(94, 1, NULL, 'HTI', 'HT'),
(95, 1, NULL, 'HMD', 'HM'),
(96, 1, NULL, 'HND', 'HN'),
(97, 1, NULL, 'HKG', 'HK'),
(98, 1, NULL, 'HUN', 'HU'),
(99, 1, NULL, 'ISL', 'IS'),
(100, 1, NULL, 'IND', 'IN'),
(101, 1, NULL, 'IDN', 'ID'),
(102, 1, NULL, 'IRN', 'IR'),
(103, 1, NULL, 'IRQ', 'IQ'),
(104, 1, NULL, 'IRL', 'IE'),
(105, 1, NULL, 'ISR', 'IL'),
(106, 1, NULL, 'ITA', 'IT'),
(107, 1, NULL, 'JAM', 'JM'),
(108, 1, NULL, 'JPN', 'JP'),
(109, 1, NULL, 'JOR', 'JO'),
(110, 1, NULL, 'KAZ', 'KZ'),
(111, 1, NULL, 'KEN', 'KE'),
(112, 1, NULL, 'KIR', 'KI'),
(113, 1, NULL, 'PRK', 'KP'),
(114, 1, NULL, 'KOR', 'KR'),
(115, 1, NULL, 'KWT', 'KW'),
(116, 1, NULL, 'KGZ', 'KG'),
(117, 1, NULL, 'LAO', 'LA'),
(118, 1, NULL, 'LVA', 'LV'),
(119, 1, NULL, 'LBN', 'LB'),
(120, 1, NULL, 'LSO', 'LS'),
(121, 1, NULL, 'LBR', 'LR'),
(122, 1, NULL, 'LBY', 'LY'),
(123, 1, NULL, 'LIE', 'LI'),
(124, 1, NULL, 'LTU', 'LT'),
(125, 1, NULL, 'LUX', 'LU'),
(126, 1, NULL, 'MAC', 'MO'),
(127, 1, NULL, 'MKD', 'MK'),
(128, 1, NULL, 'MDG', 'MG'),
(129, 1, NULL, 'MWI', 'MW'),
(130, 1, NULL, 'MYS', 'MY'),
(131, 1, NULL, 'MDV', 'MV'),
(132, 1, NULL, 'MLI', 'ML'),
(133, 1, NULL, 'MLT', 'MT'),
(134, 1, NULL, 'MHL', 'MH'),
(135, 1, NULL, 'MTQ', 'MQ'),
(136, 1, NULL, 'MRT', 'MR'),
(137, 1, NULL, 'MUS', 'MU'),
(138, 1, NULL, 'MYT', 'YT'),
(139, 1, NULL, 'MEX', 'MX'),
(140, 1, NULL, 'FSM', 'FM'),
(141, 1, NULL, 'MDA', 'MD'),
(142, 1, NULL, 'MCO', 'MC'),
(143, 1, NULL, 'MNG', 'MN'),
(144, 1, NULL, 'MSR', 'MS'),
(145, 1, NULL, 'MAR', 'MA'),
(146, 1, NULL, 'MOZ', 'MZ'),
(147, 1, NULL, 'MMR', 'MM'),
(148, 1, NULL, 'NAM', 'NA'),
(149, 1, NULL, 'NRU', 'NR'),
(150, 1, NULL, 'NPL', 'NP'),
(151, 1, NULL, 'NLD', 'NL'),
(152, 1, NULL, 'ANT', 'AN'),
(153, 1, NULL, 'NCL', 'NC'),
(154, 1, NULL, 'NZL', 'NZ'),
(155, 1, NULL, 'NIC', 'NI'),
(156, 1, NULL, 'NER', 'NE'),
(157, 1, NULL, 'NGA', 'NG'),
(158, 1, NULL, 'NIU', 'NU'),
(159, 1, NULL, 'NFK', 'NF'),
(160, 1, NULL, 'MNP', 'MP'),
(161, 1, NULL, 'NOR', 'NO'),
(162, 1, NULL, 'OMN', 'OM'),
(163, 1, NULL, 'PAK', 'PK'),
(164, 1, NULL, 'PLW', 'PW'),
(165, 1, NULL, 'PSE', 'PS'),
(166, 1, NULL, 'PAN', 'PA'),
(167, 1, NULL, 'PNG', 'PG'),
(168, 1, NULL, 'PRY', 'PY'),
(169, 1, NULL, 'PER', 'PE'),
(170, 1, NULL, 'PHL', 'PH'),
(171, 1, NULL, 'PCN', 'PN'),
(172, 1, NULL, 'POL', 'PL'),
(173, 1, NULL, 'PRT', 'PT'),
(174, 1, NULL, 'PRI', 'PR'),
(175, 1, NULL, 'QAT', 'QA'),
(176, 1, NULL, 'REU', 'RE'),
(177, 1, NULL, 'ROU', 'RO'),
(178, 1, NULL, 'RUS', 'RU'),
(179, 1, NULL, 'RWA', 'RW'),
(180, 1, NULL, 'KNA', 'KN'),
(181, 1, NULL, 'LCA', 'LC'),
(182, 1, NULL, 'VCT', 'VC'),
(183, 1, NULL, 'WSM', 'WS'),
(184, 1, NULL, 'SMR', 'SM'),
(185, 1, NULL, 'STP', 'ST'),
(186, 1, NULL, 'SAU', 'SA'),
(187, 1, NULL, 'SEN', 'SN'),
(188, 1, NULL, 'SYC', 'SC'),
(189, 1, NULL, 'SLE', 'SL'),
(190, 1, NULL, 'SGP', 'SG'),
(191, 1, NULL, 'SVK', 'SK'),
(192, 1, NULL, 'SVN', 'SI'),
(193, 1, NULL, 'SLB', 'SB'),
(194, 1, NULL, 'SOM', 'SO'),
(195, 1, NULL, 'ZAF', 'ZA'),
(196, 1, NULL, 'SGS', 'GS'),
(197, 1, NULL, 'ESP', 'ES'),
(198, 1, NULL, 'LKA', 'LK'),
(199, 1, NULL, 'SHN', 'SH'),
(200, 1, NULL, 'SPM', 'PM'),
(201, 1, NULL, 'SDN', 'SD'),
(202, 1, NULL, 'SUR', 'SR'),
(203, 1, NULL, 'SJM', 'SJ'),
(204, 1, NULL, 'SWZ', 'SZ'),
(205, 1, NULL, 'SWE', 'SE'),
(206, 1, NULL, 'CHE', 'CH'),
(207, 1, NULL, 'SYR', 'SY'),
(208, 1, NULL, 'TWN', 'TW'),
(209, 1, NULL, 'TJK', 'TJ'),
(210, 1, NULL, 'TZA', 'TZ'),
(211, 1, NULL, 'THA', 'TH'),
(212, 1, NULL, 'TGO', 'TG'),
(213, 1, NULL, 'TKL', 'TK'),
(214, 1, NULL, 'TON', 'TO'),
(215, 1, NULL, 'TTO', 'TT'),
(216, 1, NULL, 'TUN', 'TN'),
(217, 1, NULL, 'TUR', 'TR'),
(218, 1, NULL, 'TKM', 'TM'),
(219, 1, NULL, 'TCA', 'TC'),
(220, 1, NULL, 'TUV', 'TV'),
(221, 1, NULL, 'UGA', 'UG'),
(222, 1, NULL, 'UKR', 'UA'),
(223, 1, NULL, 'ARE', 'AE'),
(224, 1, NULL, 'GBR', 'GB'),
(225, 1, NULL, 'USA', 'US'),
(226, 1, NULL, 'UMI', 'UM'),
(227, 1, NULL, 'URY', 'UY'),
(228, 1, NULL, 'UZB', 'UZ'),
(229, 1, NULL, 'VUT', 'VU'),
(230, 1, NULL, 'VAT', 'VA'),
(231, 1, NULL, 'VEN', 'VE'),
(232, 1, NULL, 'VNM', 'VN'),
(233, 1, NULL, 'VGB', 'VG'),
(234, 1, NULL, 'VIR', 'VI'),
(235, 1, NULL, 'WLF', 'WF'),
(236, 1, NULL, 'ESH', 'EH'),
(237, 1, NULL, 'YEM', 'YE'),
(238, 1, NULL, 'YUG', 'YU'),
(239, 1, NULL, 'ZMB', 'ZM'),
(240, 1, NULL, 'ZWE', 'ZW'),
(370, 2, 38, 'YT', NULL),
(369, 2, 38, 'SK', NULL),
(368, 2, 38, 'QC', NULL),
(367, 2, 38, 'PE', NULL),
(366, 2, 38, 'ON', NULL),
(365, 2, 38, 'NU', NULL),
(364, 2, 38, 'NS', NULL),
(363, 2, 38, 'NT', NULL),
(362, 2, 38, 'NL', NULL),
(361, 2, 38, 'NB', NULL),
(360, 2, 38, 'MB', NULL),
(359, 2, 38, 'BC', NULL),
(358, 2, 38, 'AB', NULL),
(357, 2, 225, 'DC', NULL),
(356, 2, 225, 'WY', NULL),
(355, 2, 225, 'WI', NULL),
(354, 2, 225, 'WV', NULL),
(353, 2, 225, 'WA', NULL),
(352, 2, 225, 'VA', NULL),
(351, 2, 225, 'VT', NULL),
(350, 2, 225, 'UT', NULL),
(349, 2, 225, 'TX', NULL),
(348, 2, 225, 'TN', NULL),
(347, 2, 225, 'SD', NULL),
(346, 2, 225, 'SC', NULL),
(345, 2, 225, 'RI', NULL),
(344, 2, 225, 'PR', NULL),
(343, 2, 225, 'PA', NULL),
(342, 2, 225, 'OR', NULL),
(341, 2, 225, 'OK', NULL),
(340, 2, 225, 'OH', NULL),
(339, 2, 225, 'ND', NULL),
(338, 2, 225, 'NC', NULL),
(337, 2, 225, 'NY', NULL),
(336, 2, 225, 'NM', NULL),
(335, 2, 225, 'NJ', NULL),
(334, 2, 225, 'NH', NULL),
(333, 2, 225, 'NV', NULL),
(332, 2, 225, 'NE', NULL),
(331, 2, 225, 'MT', NULL),
(330, 2, 225, 'MO', NULL),
(329, 2, 225, 'MS', NULL),
(328, 2, 225, 'MN', NULL),
(327, 2, 225, 'MI', NULL),
(326, 2, 225, 'MA', NULL),
(325, 2, 225, 'MD', NULL),
(324, 2, 225, 'ME', NULL),
(323, 2, 225, 'LA', NULL),
(322, 2, 225, 'KY', NULL),
(321, 2, 225, 'KS', NULL),
(320, 2, 225, 'IA', NULL),
(319, 2, 225, 'IN', NULL),
(318, 2, 225, 'IL', NULL),
(317, 2, 225, 'ID', NULL),
(316, 2, 225, 'HI', NULL),
(315, 2, 225, 'GA', NULL),
(314, 2, 225, 'FL', NULL),
(313, 2, 225, 'DE', NULL),
(312, 2, 225, 'CT', NULL),
(311, 2, 225, 'CO', NULL),
(310, 2, 225, 'CA', NULL),
(309, 2, 225, 'AR', NULL),
(308, 2, 225, 'AZ', NULL),
(307, 2, 225, 'AK', NULL),
(306, 2, 225, 'AL', NULL);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'CATEGORY.VIEW', 'la_PermName_Category.View_desc', 'In-Portal', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'CATEGORY.ADD', 'la_PermName_Category.Add_desc', 'In-Portal', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'CATEGORY.DELETE', 'la_PermName_Category.Delete_desc', 'In-Portal', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'CATEGORY.ADD.PENDING', 'la_PermName_Category.AddPending_desc', 'In-Portal', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'CATEGORY.MODIFY', 'la_PermName_Category.Modify_desc', 'In-Portal', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'CATEGORY.REVISION.ADD', 'la_PermName_Category.Revision.Add_desc', 'In-Portal', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'CATEGORY.REVISION.ADD.PENDING', 'la_PermName_Category.Revision.Add.Pending_desc', 'In-Portal', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'CATEGORY.REVISION.MODERATE', 'la_PermName_Category.Revision.Moderate_desc', 'In-Portal', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'CATEGORY.REVISION.HISTORY.VIEW', 'la_PermName_Category.Revision.History.View_desc', 'In-Portal', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'CATEGORY.REVISION.HISTORY.RESTORE', 'la_PermName_Category.Revision.History.Restore_desc', 'In-Portal', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'ADMIN', 'la_PermName_Admin_desc', 'Admin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'LOGIN', 'la_PermName_Login_desc', 'Front', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'DEBUG.ITEM', 'la_PermName_Debug.Item_desc', 'Admin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'DEBUG.LIST', 'la_PermName_Debug.List_desc', 'Admin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'DEBUG.INFO', 'la_PermName_Debug.Info_desc', 'Admin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'PROFILE.MODIFY', 'la_PermName_Profile.Modify_desc', 'Admin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'SHOWLANG', 'la_PermName_ShowLang_desc', 'Admin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'FAVORITES', 'la_PermName_favorites_desc', 'In-Portal', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'SYSTEM_ACCESS.READONLY', 'la_PermName_SystemAccess.ReadOnly_desc', 'Admin', 1);
INSERT INTO CategoryPermissionsCache VALUES (DEFAULT, 0, 1, '11,12,13,14,15');
INSERT INTO Permissions VALUES (DEFAULT, 'LOGIN', 13, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'LOGIN', 12, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'LOGIN', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'ADMIN', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:root.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:system.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:website_setting_folder.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_setting_folder.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_advanced.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_advanced.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_advanced.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_list.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_list.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_list.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_list.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:admins.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:admins.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:admins.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:admins.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_lang.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_lang.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_lang.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_lang.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:phrases.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:phrases.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:phrases.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:phrases.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configemail.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configemail.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configemail.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configemail.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES(DEFAULT, 'CATEGORY.VIEW', 15, 1, 0, 1);
INSERT INTO Permissions VALUES(DEFAULT, 'CATEGORY.ADD', 11, 1, 0, 1);
INSERT INTO Permissions VALUES(DEFAULT, 'CATEGORY.ADD.PENDING', 13, 1, 0, 1);
INSERT INTO Permissions VALUES(DEFAULT, 'CATEGORY.DELETE', 11, 1, 0, 1);
INSERT INTO Permissions VALUES(DEFAULT, 'CATEGORY.MODIFY', 11, 1, 0, 1);
INSERT INTO Permissions VALUES(DEFAULT, 'CATEGORY.REVISION.ADD', 11, 1, 0, 1);
INSERT INTO Permissions VALUES(DEFAULT, 'CATEGORY.REVISION.HISTORY.VIEW', 11, 1, 0, 1);
INSERT INTO Permissions VALUES(DEFAULT, 'CATEGORY.REVISION.HISTORY.RESTORE', 11, 1, 0, 1);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:service.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:service.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:scheduled_tasks.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:scheduled_tasks.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:scheduled_tasks.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:scheduled_tasks.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:site_domains.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:site_domains.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:site_domains.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:site_domains.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:country_states.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:country_states.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:country_states.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:country_states.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:spelling_dictionary.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:spelling_dictionary.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:spelling_dictionary.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:spelling_dictionary.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:ban_rulelist.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:ban_rulelist.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:ban_rulelist.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:site.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:browse.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:advanced_view.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:reviews.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_categories.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_categories.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_categories.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configuration_search.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configuration_search.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configuration_custom.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configuration_custom.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configuration_custom.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configuration_custom.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:users.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_list.advanced:ban', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_list.advanced:send_email', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_groups.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_groups.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_groups.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_groups.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_groups.advanced:send_email', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_groups.advanced:manage_permissions', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_users.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_users.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_users.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_custom.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_custom.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_custom.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_custom.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_banlist.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_banlist.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_banlist.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_banlist.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:reports.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:log_summary.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:searchlog.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:searchlog.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:sessionlog.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:sessionlog.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:emaillog.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:emaillog.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:emaillog.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:visits.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:visits.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:spam_reports.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:spam_reports.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:spam_reports.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_general.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_general.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_general.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:modules.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mod_status.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mod_status.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mod_status.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mod_status.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:permission_types.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:permission_types.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:permission_types.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:permission_types.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:item_filters.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:item_filters.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:item_filters.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:item_filters.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:addmodule.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:addmodule.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:addmodule.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:tag_library.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_themes.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_themes.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_themes.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_themes.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_styles.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_styles.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_styles.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_styles.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_lang.advanced:set_primary', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_lang.advanced:import', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_lang.advanced:export', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:tools.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:backup.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:restore.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:export.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:main_import.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:sql_query.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:sql_query.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:server_info.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:help.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:browse_site.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:forms.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:forms.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:forms.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:forms.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:submissions.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:promo_block_groups.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:promo_block_groups.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:promo_block_groups.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:promo_block_groups.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mailing_lists.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mailing_lists.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mailing_lists.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mailing_lists.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:system_event_subscriptions.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:system_event_subscriptions.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:system_event_subscriptions.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:system_event_subscriptions.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:email_queue.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:email_queue.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:session_logs.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:session_logs.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:change_logs.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:change_logs.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:change_logs.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:stop_words.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:stop_words.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:stop_words.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:stop_words.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:thesaurus.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:thesaurus.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:thesaurus.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:thesaurus.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:skins.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:skins.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:skins.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:skins.delete', 11, 1, 1, 0);
INSERT INTO AdminSkins VALUES(DEFAULT, 'Default', '/* General elements */\r\n\r\nhtml {\r\n height: 100%;\r\n}\r\n\r\nbody {\r\n font-family: verdana,arial,helvetica,sans-serif;\r\n color: #000000;\r\n overflow-x: auto; overflow-y: auto;\r\n margin: 0px 0px 0px 0px;\r\n text-decoration: none;\r\n}\r\n\r\nbody, td {\r\n /* fix for Firefox, when font-size was not inherited in table cells */\r\n font-size: 9pt;\r\n}\r\n\r\na {\r\n color: #006699;\r\n text-decoration: none;\r\n}\r\n\r\na:hover {\r\n color: #009ff0;\r\n text-decoration: none;\r\n}\r\n\r\nform {\r\n display: inline;\r\n}\r\n\r\nimg { border: 0px; }\r\n\r\nbody.height-100 {\r\n height: 100%;\r\n}\r\n\r\nbody.regular-body {\r\n margin: 0px 10px 5px 10px;\r\n color: #000000;\r\n background-color: @@SectionBgColor@@;\r\n}\r\n\r\nbody.edit-popup {\r\n margin: 0px 0px 0px 0px;\r\n}\r\n\r\ntable.collapsed {\r\n border-collapse: collapse;\r\n}\r\n\r\n.bordered, table.bordered, .bordered-no-bottom {\r\n border: 1px solid #000000 !important;\r\n border-top-width: 0px;\r\n border-collapse: collapse;\r\n}\r\n\r\n.bordered-no-bottom {\r\n border-top-width: 1px;\r\n border-bottom: none;\r\n}\r\n\r\n.login-table td {\r\n padding: 1px;\r\n}\r\n\r\n.disabled {\r\n background-color: #ebebeb;\r\n}\r\n\r\n/* Head frame */\r\ntable.head-table {\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/right_background.png'') top right @@HeadBgColor@@ no-repeat;\r\n}\r\n\r\n.head-table tr td, .head-table tr td a {\r\n color: @@HeadColor@@\r\n}\r\n\r\ndiv#extra_toolbar td.button-active {\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/toolbar_button_background.gif'') bottom left repeat-x;\r\n height: 22px;\r\n}\r\n\r\ndiv#extra_toolbar td.button-active a {\r\n color: black;\r\n text-decoration: none;\r\n}\r\n\r\ntd.kx-block-header, .head-table tr td.kx-block-header{\r\n color: @@HeadBarColor@@;\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/toolbar_background.gif'') repeat-x top left;\r\n /*background-color: @@HeadBarBgColor@@;*/\r\n padding-left: 7px;\r\n padding-right: 7px;\r\n}\r\n\r\na.kx-header-link {\r\n text-decoration: underline;\r\n font-weight: bold;\r\n color: #0080C8;\r\n}\r\n\r\na.kx-header-link:hover {\r\n color: #FFCB05;\r\n text-decoration: none;\r\n}\r\n\r\n.kx-secondary-foreground {\r\n color: #FFFFFF;\r\n /*background-color: @@HeadBarBgColor@@;*/\r\n}\r\n\r\n.kx-login-button {\r\n background-color: #2D79D6;\r\n color: #FFFFFF;\r\n}\r\n\r\n/* General form button (yellow) */\r\n.button {\r\n font-size: 12px;\r\n font-weight: normal;\r\n color: #000000;\r\n background: url(''@@base_url@@/core/admin_templates/img/button_back.gif'') #f9eeae repeat-x;\r\n text-decoration: none;\r\n}\r\n\r\n/* Disabled (grayed-out) form button */\r\n.button-disabled {\r\n font-size: 12px;\r\n font-weight: normal;\r\n color: #676767;\r\n background: url(''@@base_url@@/core/admin_templates/img/button_back_disabled.gif'') #f9eeae repeat-x;\r\n text-decoration: none;\r\n}\r\n\r\n/* Tabs bar */\r\n\r\n.tab, .tab-active {\r\n background-color: #F0F1EB;\r\n padding: 3px 7px 2px 7px;\r\n border-top: 1px solid black;\r\n border-left: 1px solid black;\r\n border-right: 1px solid black;\r\n margin-left: 3px !important;\r\n white-space: nowrap;\r\n}\r\n\r\n.tab-active {\r\n background-color: #4487D9;\r\n}\r\n\r\n.tab a {\r\n color: #4487D9;\r\n font-weight: bold;\r\n}\r\n\r\n.tab-active a {\r\n color: #FFFFFF;\r\n font-weight: bold;\r\n}\r\n\r\na.scroll-left, a.scroll-right {\r\n cursor: pointer;\r\n display: block;\r\n float: left;\r\n height: 18px;\r\n margin: 0px 1px;\r\n width: 18px;\r\n}\r\n\r\na.scroll-left {\r\n background: transparent url(''@@base_url@@/core/admin_templates/img/tabs/left.png'') no-repeat scroll 0 0;\r\n}\r\n\r\na.scroll-right {\r\n background: transparent url(''@@base_url@@/core/admin_templates/img/tabs/right.png'') no-repeat scroll 0 0;\r\n}\r\n\r\na.disabled {\r\n visibility: hidden !important;\r\n}\r\n\r\na.scroll-left:hover, a.scroll-right:hover {\r\n background-position: 0 -18px;\r\n}\r\n\r\ntd.scroll-right-container {\r\n width: 20px;\r\n}\r\n\r\ntd.scroll-right-container.disabled, td.scroll-right-container.disabled * {\r\n width: 0px;\r\n margin: 0px;\r\n}\r\n\r\ntd.scroll-right-container.disabled br {\r\n display: none;\r\n}\r\n\r\n/* Toolbar */\r\n\r\n.toolbar {\r\n font-size: 8pt;\r\n border: 1px solid #000000;\r\n border-width: 0px 1px 1px 1px;\r\n background-color: @@ToolbarBgColor@@;\r\n border-collapse: collapse;\r\n}\r\n\r\n.toolbar td {\r\n height: 100%;\r\n}\r\n\r\n.toolbar-button, .toolbar-button-disabled, .toolbar-button-over {\r\n float: left;\r\n text-align: center;\r\n font-size: 8pt;\r\n padding: 5px 5px 5px 5px;\r\n vertical-align: middle;\r\n color: #006F99;\r\n}\r\n\r\n.toolbar-button-over {\r\n color: #000;\r\n}\r\n\r\n.toolbar-button-disabled {\r\n color: #444;\r\n}\r\n\r\n/* Scrollable Grids */\r\n\r\n\r\n.layout-only-table td {\r\n border: none !important;\r\n}\r\n\r\n/* Main Grid class */\r\n.grid-scrollable {\r\n padding: 0px;\r\n border: 1px solid black !important;\r\n border-top: none !important;\r\n}\r\n\r\n/* Div generated by js, which contains all the scrollable grid elements, affects the style of scrollable area without data (if there are too few rows) */\r\n.grid-container {\r\n background-color: #fff;\r\n}\r\n\r\n.grid-container table {\r\n border-collapse: collapse;\r\n}\r\n\r\n/* Inner div generated in each data-cell */\r\n.grid-cell-div {\r\n overflow: hidden;\r\n height: auto;\r\n}\r\n\r\n/* Main row definition */\r\n.grid-data-row td, .grid-data-row-selected td, .grid-data-row-even-selected td, .grid-data-row-mouseover td, .table-color1, .table-color2, .grid-edit-table .edit-form-odd > td, .grid-edit-table .edit-form-even > td {\r\n font-weight: normal;\r\n color: @@OddColor@@;\r\n background-color: @@OddBgColor@@;\r\n padding: 3px 5px 3px 5px;\r\n overflow: hidden;\r\n border-right: 1px solid #c9c9c9;\r\n}\r\n.grid-data-row-even td, .table-color2, .grid-edit-table .edit-form-even > td {\r\n background-color: @@EvenBgColor@@;\r\n color: @@EvenColor@@;\r\n}\r\n.grid-data-row td a, .grid-data-row-selected td a, .grid-data-row-mouseover td a {\r\n text-decoration: underline;\r\n}\r\n\r\n/* mouse-over rows */\r\n.grid-data-row-mouseover td, table tr.grid-data-row[_row_highlighted] td {\r\n background: #FFFDF4;\r\n}\r\n\r\n/* Selected row, applies to both checkbox and data areas */\r\n.grid-data-row-selected td, table tr.grid-data-row[_row_selected] td {\r\n background: #FEF2D6;\r\n}\r\n\r\n.grid-data-row-even-selected td, .grid-data-row-even[_row_selected] td {\r\n background: #FFF7E0;\r\n}\r\n\r\n/* General header cell definition */\r\n.grid-header-row td {\r\n font-weight: bold;\r\n background-color: @@ColumnTitlesBgColor@@;\r\n text-decoration: none;\r\n padding: 3px 5px 3px 5px;\r\n color: @@ColumnTitlesColor@@;\r\n border-right: none;\r\n text-align: left;\r\n vertical-align: middle !important;\r\n white-space: nowrap;\r\n border-right: 1px solid #777;\r\n}\r\n\r\n/* Filters row */\r\ntr.grid-header-row-1 td {\r\n background-color: @@FiltersBgColor@@;\r\n border-bottom: 1px solid black;\r\n}\r\n\r\n/* Grid Filters */\r\ntable.range-filter {\r\n width: 100%;\r\n}\r\n\r\n.range-filter td {\r\n padding: 0px 0px 2px 2px !important;\r\n border: none !important;\r\n font-size: 8pt !important;\r\n font-weight: normal !important;\r\n text-align: left;\r\n color: #000000 !important;\r\n}\r\n\r\ninput.filter, select.filter, input.filter-active, select.filter-active {\r\n margin-bottom: 0px;\r\n border: 1px solid #aaa;\r\n}\r\n\r\ninput.filter-active {\r\n background-color: #FFFF00;\r\n}\r\n\r\nselect.filter-active {\r\n background-color: #FFFF00;\r\n}\r\n\r\ndiv.filter, div.filter-active {\r\n background-color: white;\r\n border: 1px solid #AAAAAA;\r\n color: black;\r\n font-weight: normal;\r\n padding: 3px;\r\n}\r\n\r\ndiv.filter-active {\r\n background-color: #FFFF00;\r\n}\r\n\r\ndiv.multioptions_filter {\r\n position: absolute;\r\n z-index: 100;\r\n color: black;\r\n background-color: white;\r\n border: 1px solid black;\r\n padding: 3px 5px;\r\n display: none;\r\n vertical-align: middle;\r\n}\r\n\r\n/* Column titles row */\r\ntr.grid-header-row-0 td {\r\n height: 25px;\r\n font-weight: bold;\r\n background-color: @@ColumnTitlesBgColor@@;\r\n color: @@ColumnTitlesColor@@;\r\n border-bottom: 1px solid black;\r\n}\r\n\r\ntr.grid-header-row-0 td a {\r\n color: @@ColumnTitlesColor@@;\r\n}\r\n\r\ntr.grid-header-row-0 td a:hover {\r\n color: #FFCC00;\r\n}\r\n\r\n\r\n.grid-footer-row td {\r\n background-color: #D7D7D7;\r\n font-weight: bold;\r\n border-right: 1px solid #C9C9C9;\r\n padding: 3px 5px 3px 5px;\r\n}\r\n\r\ntd.grid-header-last-cell, td.grid-data-last-cell, td.grid-footer-last-cell {\r\n border-right: none !important;\r\n}\r\n\r\ntd.grid-data-col-0, td.grid-data-col-0 div {\r\n text-align: center;\r\n vertical-align: middle !important;\r\n}\r\n\r\ntr.grid-header-row-1 td.grid-header-col-1 {\r\n text-align: center;\r\n vertical-align: middle !important;\r\n}\r\n\r\ntr.grid-header-row-1 td.grid-header-col-1 div {\r\n display: table-cell;\r\n vertical-align: middle;\r\n}\r\n\r\n.grid-status-bar {\r\n border: 1px solid black;\r\n border-top: none;\r\n padding: 0px;\r\n width: 100%;\r\n border-collapse: collapse;\r\n height: 30px;\r\n}\r\n\r\n.grid-status-bar td {\r\n background-color: @@TitleBarBgColor@@;\r\n color: @@TitleBarColor@@;\r\n font-size: 11pt;\r\n font-weight: normal;\r\n padding: 2px 8px 2px 8px;\r\n}\r\n\r\n/* /Scrollable Grids */\r\n\r\n\r\n/* Forms */\r\ntable.edit-form {\r\n border: none;\r\n border-top-width: 0px !important;\r\n border-collapse: collapse;\r\n width: 100%;\r\n}\r\n\r\n.edit-form-odd, .edit-form-even {\r\n padding: 0px;\r\n}\r\n\r\n.subsectiontitle {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n background-color: #4A92CE;\r\n color: #fff;\r\n height: 25px;\r\n border-top: 1px solid black;\r\n vertical-align: middle;\r\n}\r\n\r\n/* remove top-border from first sub-section element */\r\ntable.edit-form .subsectiontitle:first-child, table.bordered .subsectiontitle:first-child {\r\n border-top-width: 0;\r\n}\r\n\r\n.subsectiontitle td {\r\n vertical-align: middle;\r\n /*padding: 3px 5px 3px 5px;*/\r\n padding: 1px 5px;\r\n}\r\n\r\n.label-cell {\r\n background: #DEE7F6 url(''@@base_url@@/core/admin_templates/img/bgr_input_name_line.gif'') no-repeat right bottom;\r\n font: 12px arial, sans-serif;\r\n padding: 4px 20px;\r\n width: 160px;\r\n}\r\n\r\n.control-mid {\r\n width: 13px;\r\n border-left: 1px solid #7A95C2;\r\n background: #fff url(''@@base_url@@/core/admin_templates/img/bgr_mid.gif'') repeat-x left bottom;\r\n}\r\n\r\n.control-cell {\r\n font: 11px arial, sans-serif;\r\n padding: 4px 10px 5px 5px;\r\n background: #fff url(''@@base_url@@/core/admin_templates/img/bgr_input_line.gif'') no-repeat left bottom;\r\n width: auto;\r\n vertical-align: middle;\r\n}\r\n\r\n.label-cell-filler {\r\n background: #DEE7F6 none;\r\n}\r\n.control-mid-filler {\r\n background: #fff none;\r\n border-left: 1px solid #7A95C2;\r\n}\r\n.control-cell-filler {\r\n background: #fff none;\r\n}\r\n\r\n.error {\r\n color: red;\r\n}\r\n.error-cell {\r\n color: red;\r\n}\r\n\r\n.field-required {\r\n color: red;\r\n}\r\n\r\n.warning-table {\r\n background-color: #F0F1EB;\r\n border: 1px solid #000000;\r\n border-collapse: collapse;\r\n border-top-width: 0px;\r\n}\r\n\r\n.form-notice, .form-warning {\r\n font-size: 11px;\r\n}\r\n\r\n.form-warning {\r\n color: red;\r\n}\r\n\r\n.form-notice {\r\n color: green;\r\n}\r\n\r\n.priority {\r\n color: red;\r\n padding-left: 1px;\r\n padding-right: 1px;\r\n font-size: 11px;\r\n}\r\n\r\n.small-statistics {\r\n font-size: 11px;\r\n color: #707070;\r\n}\r\n\r\n.req-note {\r\n font-style: italic;\r\n color: #333;\r\n}\r\n\r\n#scroll_container table.tableborder {\r\n border-collapse: separate\r\n}\r\n\r\n/* Uploader */\r\n.uploader-queue div.file {\r\n font-size: 11px;\r\n border: 1px solid #7F99C5;\r\n padding: 3px;\r\n background-color: #DEE7F6;\r\n margin-bottom: 2px;\r\n}\r\n\r\n.uploader-queue .left {\r\n float: left;\r\n vertical-align: top;\r\n}\r\n\r\n.uploader-queue .file-label {\r\n margin-left: 5px;\r\n}\r\n\r\n.uploader-queue .preview .delete-checkbox {\r\n margin-top: -3px;\r\n}\r\n\r\n.uploader-queue .progress-container {\r\n margin: 2px 5px 0px 5px;\r\n}\r\n\r\n.uploader-queue .progress-empty {\r\n width: 150px;\r\n height: 9px;\r\n border: 1px solid black;\r\n background: url(''@@base_url@@/core/admin_templates/img/progress_left.gif'') repeat-x;\r\n}\r\n\r\n.uploader-queue .progress-full {\r\n height: 9px;\r\n background: url(''@@base_url@@/core/admin_templates/img/progress_done.gif'');\r\n}\r\n\r\n.uploader-queue .thumbnail {\r\n /*margin-bottom: 2px;*/\r\n border: 1px solid black;\r\n background-color: grey;\r\n}\r\n\r\n/* To be sorted */\r\nspan#category_path, span#category_path a {\r\n color: #FFFFFF;\r\n}\r\n\r\nspan#category_path a {\r\n text-decoration: underline;\r\n}\r\n\r\n/* Section title, right to the big icon */\r\n.admintitle {\r\n font-size: 16pt;\r\n font-weight: bold;\r\n color: @@SectionColor@@;\r\n text-decoration: none;\r\n}\r\n\r\n/* Page header (bluebar) */\r\n.page-title td {\r\n background-color: @@TitleBarBgColor@@;\r\n color: @@TitleBarColor@@;\r\n font-size: 11pt;\r\n font-weight: normal;\r\n padding: 2px 8px 2px 8px;\r\n}\r\n\r\n/* Right side of bluebar */\r\n.tablenav, tablenav a {\r\n font-size: 11pt;\r\n font-weight: bold;\r\n color: @@TitleBarColor@@;\r\n\r\n text-decoration: none;\r\n background-color: @@TitleBarBgColor@@;\r\n background-image: none;\r\n}\r\n\r\n/* Section title in the bluebar * -- why ''link''? :S */\r\n.tablenav_link {\r\n font-size: 11pt;\r\n font-weight: bold;\r\n color: @@TitleBarColor@@;\r\n text-decoration: none;\r\n}\r\n\r\n/* Active page in top and bottom bluebars pagination */\r\n.current_page {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n background-color: #fff;\r\n color: #2D79D6;\r\n padding: 3px 2px 3px 3px;\r\n}\r\n\r\n/* Other pages and arrows in pagination on blue */\r\n.nav_url {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n color: #fff;\r\n padding: 3px 2px 3px 3px;\r\n}\r\n\r\n/* Tree */\r\n.tree-body {\r\n background-color: @@TreeBgColor@@;\r\n height: 100%\r\n}\r\n\r\n.tree_head.td, .tree_head, .tree_head:hover {\r\n font-weight: bold;\r\n font-size: 10px;\r\n color: #FFFFFF;\r\n font-family: Verdana, Arial;\r\n text-decoration: none;\r\n}\r\n\r\n.tree {\r\n padding: 0px;\r\n border: none;\r\n border-collapse: collapse;\r\n}\r\n\r\n.tree tr td {\r\n padding: 0px;\r\n margin: 0px;\r\n font-family: helvetica, arial, verdana,;\r\n font-size: 11px;\r\n white-space: nowrap;\r\n}\r\n\r\n.tree tr td a {\r\n font-size: 11px;\r\n color: @@TreeColor@@;\r\n font-family: Helvetica, Arial, Verdana;\r\n text-decoration: none;\r\n padding: 2px;\r\n}\r\n\r\n.tree tr td a:hover, .tree tr td a.debug-only-item:hover {\r\n color: @@TreeHoverColor@@;\r\n}\r\n\r\n.tree tr.highlighted td a, .tree tr.highlighted td a.debug-only-item {\r\n color: @@TreeHighColor@@;\r\n background-color: @@TreeHighBgColor@@;\r\n}\r\n\r\n.tree tr.highlighted td a:hover {\r\n color: @@TreeHighHoverColor@@;\r\n}\r\n\r\n.tree tr td a.debug-only-item {\r\n color: grey;\r\n}\r\n\r\n/* Ajax Dropdown */\r\n.suggest-box {\r\n border: 1px solid #999;\r\n background-color: #fff;\r\n}\r\n\r\n.suggest-item, .suggest-item-over {\r\n padding: 1px 2px 0px 2px;\r\n font-family: arial,verdana;\r\n font-size: 12px;\r\n}\r\n\r\n.suggest-item-over {\r\n background-color: #3366CC;\r\n color: #fff;\r\n}\r\n\r\n/* Dashboard Summary Boxes */\r\n.summary-box {\r\n border: 1px solid black;\r\n margin-bottom: 4px;\r\n}\r\n\r\n.summary-box .title {\r\n color: white;\r\n font-weight: bold;\r\n padding: 6px 5px;\r\n vertical-align: middle;\r\n background-color: #4A92CE;\r\n border-bottom: 1px solid black;\r\n}\r\n\r\n.summary-box .content {\r\n padding: 4px;\r\n background-color: #F6F6F6;\r\n}\r\n\r\n.summary-box .group {\r\n border-bottom: 1px solid black;\r\n margin-bottom: 10px;\r\n padding: 0 0 10px 10px;\r\n}\r\n\r\n.summary-box .group.last {\r\n border-width: 0px;\r\n margin-bottom: 0;\r\n padding-bottom: 5px;\r\n}\r\n\r\n.summary-box h4 {\r\n margin: 0;\r\n padding: 0 0 3px 0;\r\n font-size: 11px;\r\n font-weight: bold;\r\n}\r\n\r\n.summary-box .hint {\r\n font-size: 10px;\r\n color: grey;\r\n margin-bottom: 3px;\r\n}\r\n\r\n.summary-box .hint .cache-key {\r\n margin-bottom: 7px;\r\n margin-left: 3px;\r\n}\r\n\r\n.summary-box ul {\r\n margin-top: 5px;\r\n margin-bottom: 3px;\r\n padding-left: 30px;\r\n}\r\n\r\n.summary-box li {\r\n padding-bottom: 4px;\r\n}\r\n\r\nspan.cke_skin_kama {\r\n border-width: 0px !important;\r\n -moz-border-radius: 0px !important;\r\n -webkit-border-radius: 0px !important;\r\n padding: 0px !important;\r\n}\r\n\r\n.cke_wrapper{\r\n border-width: 0px !important;\r\n -moz-border-radius: 0px !important;\r\n -webkit-border-radius: 0px !important;\r\n}', 'in-portal_logo_img.jpg', 'in-portal_logo_img2.jpg', 'in-portal_logo_login.gif', 'a:22:{s:11:"HeadBgColor";a:2:{s:11:"Description";s:27:"Head frame background color";s:5:"Value";s:7:"#007BF4";}s:9:"HeadColor";a:2:{s:11:"Description";s:21:"Head frame text color";s:5:"Value";s:7:"#FFFFFF";}s:14:"SectionBgColor";a:2:{s:11:"Description";s:28:"Section bar background color";s:5:"Value";s:7:"#FFFFFF";}s:12:"SectionColor";a:2:{s:11:"Description";s:22:"Section bar text color";s:5:"Value";s:7:"#2D79D6";}s:12:"HeadBarColor";a:1:{s:5:"Value";s:7:"#000000";}s:14:"HeadBarBgColor";a:1:{s:5:"Value";s:7:"#1961B8";}s:13:"TitleBarColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:15:"TitleBarBgColor";a:1:{s:5:"Value";s:7:"#2D79D6";}s:14:"ToolbarBgColor";a:1:{s:5:"Value";s:7:"#F0F1EB";}s:14:"FiltersBgColor";a:1:{s:5:"Value";s:7:"#D7D7D7";}s:17:"ColumnTitlesColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:19:"ColumnTitlesBgColor";a:1:{s:5:"Value";s:7:"#999999";}s:8:"OddColor";a:1:{s:5:"Value";s:7:"#000000";}s:10:"OddBgColor";a:1:{s:5:"Value";s:7:"#F6F6F6";}s:9:"EvenColor";a:1:{s:5:"Value";s:7:"#000000";}s:11:"EvenBgColor";a:1:{s:5:"Value";s:7:"#EBEBEB";}s:9:"TreeColor";a:1:{s:5:"Value";s:7:"#000000";}s:14:"TreeHoverColor";a:1:{s:5:"Value";s:7:"#009FF0";}s:13:"TreeHighColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:18:"TreeHighHoverColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:15:"TreeHighBgColor";a:1:{s:5:"Value";s:7:"#4A92CE";}s:11:"TreeBgColor";a:1:{s:5:"Value";s:7:"#DCECF6";}}', 1342105805, 1, 1);
INSERT INTO LocalesList VALUES
(1, '0x0436', 'Afrikaans (South Africa)', 'af-ZA', 'Latn', '1252'),
(2, '0x041c', 'Albanian (Albania)', 'sq-AL', 'Latn', '1252'),
(3, '0x0484', 'Alsatian (France)', 'gsw-FR', '', ''),
(4, '0x045e', 'Amharic (Ethiopia)', 'am-ET', '', 'UTF-8'),
(5, '0x1401', 'Arabic (Algeria)', 'ar-DZ', 'Arab', '1256'),
(6, '0x3c01', 'Arabic (Bahrain)', 'ar-BH', 'Arab', '1256'),
(7, '0x0c01', 'Arabic (Egypt)', 'ar-EG', 'Arab', '1256'),
(8, '0x0801', 'Arabic (Iraq)', 'ar-IQ', 'Arab', '1256'),
(9, '0x2c01', 'Arabic (Jordan)', 'ar-JO', 'Arab', '1256'),
(10, '0x3401', 'Arabic (Kuwait)', 'ar-KW', 'Arab', '1256'),
(11, '0x3001', 'Arabic (Lebanon)', 'ar-LB', 'Arab', '1256'),
(12, '0x1001', 'Arabic (Libya)', 'ar-LY', 'Arab', '1256'),
(13, '0x1801', 'Arabic (Morocco)', 'ar-MA', 'Arab', '1256'),
(14, '0x2001', 'Arabic (Oman)', 'ar-OM', 'Arab', '1256'),
(15, '0x4001', 'Arabic (Qatar)', 'ar-QA', 'Arab', '1256'),
(16, '0x0401', 'Arabic (Saudi Arabia)', 'ar-SA', 'Arab', '1256'),
(17, '0x2801', 'Arabic (Syria)', 'ar-SY', 'Arab', '1256'),
(18, '0x1c01', 'Arabic (Tunisia)', 'ar-TN', 'Arab', '1256'),
(19, '0x3801', 'Arabic (U.A.E.)', 'ar-AE', 'Arab', '1256'),
(20, '0x2401', 'Arabic (Yemen)', 'ar-YE', 'Arab', '1256'),
(21, '0x042b', 'Armenian (Armenia)', 'hy-AM', 'Armn', 'UTF-8'),
(22, '0x044d', 'Assamese (India)', 'as-IN', '', 'UTF-8'),
(23, '0x082c', 'Azeri (Azerbaijan, Cyrillic)', 'az-Cyrl-AZ', 'Cyrl', '1251'),
(24, '0x042c', 'Azeri (Azerbaijan, Latin)', 'az-Latn-AZ', 'Latn', '1254'),
(25, '0x046d', 'Bashkir (Russia)', 'ba-RU', '', ''),
(26, '0x042d', 'Basque (Basque)', 'eu-ES', 'Latn', '1252'),
(27, '0x0423', 'Belarusian (Belarus)', 'be-BY', 'Cyrl', '1251'),
(28, '0x0445', 'Bengali (India)', 'bn-IN', 'Beng', 'UTF-8'),
(29, '0x201a', 'Bosnian (Bosnia and Herzegovina, Cyrillic)', 'bs-Cyrl-BA', 'Cyrl', '1251'),
(30, '0x141a', 'Bosnian (Bosnia and Herzegovina, Latin)', 'bs-Latn-BA', 'Latn', '1250'),
(31, '0x047e', 'Breton (France)', 'br-FR', 'Latn', '1252'),
(32, '0x0402', 'Bulgarian (Bulgaria)', 'bg-BG', 'Cyrl', '1251'),
(33, '0x0403', 'Catalan (Catalan)', 'ca-ES', 'Latn', '1252'),
(34, '0x0c04', 'Chinese (Hong Kong SAR, PRC)', 'zh-HK', 'Hant', '950'),
(35, '0x1404', 'Chinese (Macao SAR)', 'zh-MO', 'Hant', '950'),
(36, '0x0804', 'Chinese (PRC)', 'zh-CN', 'Hans', '936'),
(37, '0x1004', 'Chinese (Singapore)', 'zh-SG', 'Hans', '936'),
(38, '0x0404', 'Chinese (Taiwan)', 'zh-TW', 'Hant', '950'),
(39, '0x101a', 'Croatian (Bosnia and Herzegovina, Latin)', 'hr-BA', 'Latn', '1250'),
(40, '0x041a', 'Croatian (Croatia)', 'hr-HR', 'Latn', '1250'),
(41, '0x0405', 'Czech (Czech Republic)', 'cs-CZ', 'Latn', '1250'),
(42, '0x0406', 'Danish (Denmark)', 'da-DK', 'Latn', '1252'),
(43, '0x048c', 'Dari (Afghanistan)', 'prs-AF', 'Arab', '1256'),
(44, '0x0465', 'Divehi (Maldives)', 'dv-MV', 'Thaa', 'UTF-8'),
(45, '0x0813', 'Dutch (Belgium)', 'nl-BE', 'Latn', '1252'),
(46, '0x0413', 'Dutch (Netherlands)', 'nl-NL', 'Latn', '1252'),
(47, '0x0c09', 'English (Australia)', 'en-AU', 'Latn', '1252'),
(48, '0x2809', 'English (Belize)', 'en-BZ', 'Latn', '1252'),
(49, '0x1009', 'English (Canada)', 'en-CA', 'Latn', '1252'),
(50, '0x2409', 'English (Caribbean)', 'en-029', 'Latn', '1252'),
(51, '0x4009', 'English (India)', 'en-IN', 'Latn', '1252'),
(52, '0x1809', 'English (Ireland)', 'en-IE', 'Latn', '1252'),
(53, '0x2009', 'English (Jamaica)', 'en-JM', 'Latn', '1252'),
(54, '0x4409', 'English (Malaysia)', 'en-MY', 'Latn', '1252'),
(55, '0x1409', 'English (New Zealand)', 'en-NZ', 'Latn', '1252'),
(56, '0x3409', 'English (Philippines)', 'en-PH', 'Latn', '1252'),
(57, '0x4809', 'English (Singapore)', 'en-SG', 'Latn', '1252'),
(58, '0x1c09', 'English (South Africa)', 'en-ZA', 'Latn', '1252'),
(59, '0x2c09', 'English (Trinidad and Tobago)', 'en-TT', 'Latn', '1252'),
(60, '0x0809', 'English (United Kingdom)', 'en-GB', 'Latn', '1252'),
(61, '0x0409', 'English (United States)', 'en-US', 'Latn', '1252'),
(62, '0x3009', 'English (Zimbabwe)', 'en-ZW', 'Latn', '1252'),
(63, '0x0425', 'Estonian (Estonia)', 'et-EE', 'Latn', '1257'),
(64, '0x0438', 'Faroese (Faroe Islands)', 'fo-FO', 'Latn', '1252'),
(65, '0x0464', 'Filipino (Philippines)', 'fil-PH', 'Latn', '1252'),
(66, '0x040b', 'Finnish (Finland)', 'fi-FI', 'Latn', '1252'),
(67, '0x080c', 'French (Belgium)', 'fr-BE', 'Latn', '1252'),
(68, '0x0c0c', 'French (Canada)', 'fr-CA', 'Latn', '1252'),
(69, '0x040c', 'French (France)', 'fr-FR', 'Latn', '1252'),
(70, '0x140c', 'French (Luxembourg)', 'fr-LU', 'Latn', '1252'),
(71, '0x180c', 'French (Monaco)', 'fr-MC', 'Latn', '1252'),
(72, '0x100c', 'French (Switzerland)', 'fr-CH', 'Latn', '1252'),
(73, '0x0462', 'Frisian (Netherlands)', 'fy-NL', 'Latn', '1252'),
(74, '0x0456', 'Galician (Spain)', 'gl-ES', 'Latn', '1252'),
(75, '0x0437', 'Georgian (Georgia)', 'ka-GE', 'Geor', 'UTF-8'),
(76, '0x0c07', 'German (Austria)', 'de-AT', 'Latn', '1252'),
(77, '0x0407', 'German (Germany)', 'de-DE', 'Latn', '1252'),
(78, '0x1407', 'German (Liechtenstein)', 'de-LI', 'Latn', '1252'),
(79, '0x1007', 'German (Luxembourg)', 'de-LU', 'Latn', '1252'),
(80, '0x0807', 'German (Switzerland)', 'de-CH', 'Latn', '1252'),
(81, '0x0408', 'Greek (Greece)', 'el-GR', 'Grek', '1253'),
(82, '0x046f', 'Greenlandic (Greenland)', 'kl-GL', 'Latn', '1252'),
(83, '0x0447', 'Gujarati (India)', 'gu-IN', 'Gujr', 'UTF-8'),
(84, '0x0468', 'Hausa (Nigeria, Latin)', 'ha-Latn-NG', 'Latn', '1252'),
(85, '0x040d', 'Hebrew (Israel)', 'he-IL', 'Hebr', '1255'),
(86, '0x0439', 'Hindi (India)', 'hi-IN', 'Deva', 'UTF-8'),
(87, '0x040e', 'Hungarian (Hungary)', 'hu-HU', 'Latn', '1250'),
(88, '0x040f', 'Icelandic (Iceland)', 'is-IS', 'Latn', '1252'),
(89, '0x0470', 'Igbo (Nigeria)', 'ig-NG', '', ''),
(90, '0x0421', 'Indonesian (Indonesia)', 'id-ID', 'Latn', '1252'),
(91, '0x085d', 'Inuktitut (Canada, Latin)', 'iu-Latn-CA', 'Latn', '1252'),
(92, '0x045d', 'Inuktitut (Canada, Syllabics)', 'iu-Cans-CA', 'Cans', 'UTF-8'),
(93, '0x083c', 'Irish (Ireland)', 'ga-IE', 'Latn', '1252'),
(94, '0x0410', 'Italian (Italy)', 'it-IT', 'Latn', '1252'),
(95, '0x0810', 'Italian (Switzerland)', 'it-CH', 'Latn', '1252'),
(96, '0x0411', 'Japanese (Japan)', 'ja-JP', 'Hani;Hira;Kana', '932'),
(97, '0x044b', 'Kannada (India)', 'kn-IN', 'Knda', 'UTF-8'),
(98, '0x043f', 'Kazakh (Kazakhstan)', 'kk-KZ', 'Cyrl', '1251'),
(99, '0x0453', 'Khmer (Cambodia)', 'kh-KH', 'Khmr', 'UTF-8'),
(100, '0x0486', 'K''iche (Guatemala)', 'qut-GT', 'Latn', '1252'),
(101, '0x0487', 'Kinyarwanda (Rwanda)', 'rw-RW', 'Latn', '1252'),
(102, '0x0457', 'Konkani (India)', 'kok-IN', 'Deva', 'UTF-8'),
(103, '0x0812', 'Windows 95, Windows NT 4.0 only: Korean (Johab)', '', '', ''),
(104, '0x0412', 'Korean (Korea)', 'ko-KR', 'Hang;Hani', '949'),
(105, '0x0440', 'Kyrgyz (Kyrgyzstan)', 'ky-KG', 'Cyrl', '1251'),
(106, '0x0454', 'Lao (Lao PDR)', 'lo-LA', 'Laoo', 'UTF-8'),
(107, '0x0426', 'Latvian (Latvia)', 'lv-LV', 'Latn', '1257'),
(108, '0x0427', 'Lithuanian (Lithuania)', 'lt-LT', 'Latn', '1257'),
(109, '0x082e', 'Lower Sorbian (Germany)', 'dsb-DE', 'Latn', '1252'),
(110, '0x046e', 'Luxembourgish (Luxembourg)', 'lb-LU', 'Latn', '1252'),
(111, '0x042f', 'Macedonian (Macedonia, FYROM)', 'mk-MK', 'Cyrl', '1251'),
(112, '0x083e', 'Malay (Brunei Darussalam)', 'ms-BN', 'Latn', '1252'),
(113, '0x043e', 'Malay (Malaysia)', 'ms-MY', 'Latn', '1252'),
(114, '0x044c', 'Malayalam (India)', 'ml-IN', 'Mlym', 'UTF-8'),
(115, '0x043a', 'Maltese (Malta)', 'mt-MT', 'Latn', '1252'),
(116, '0x0481', 'Maori (New Zealand)', 'mi-NZ', 'Latn', '1252'),
(117, '0x047a', 'Mapudungun (Chile)', 'arn-CL', 'Latn', '1252'),
(118, '0x044e', 'Marathi (India)', 'mr-IN', 'Deva', 'UTF-8'),
(119, '0x047c', 'Mohawk (Canada)', 'moh-CA', 'Latn', '1252'),
(120, '0x0450', 'Mongolian (Mongolia)', 'mn-Cyrl-MN', 'Cyrl', '1251'),
(121, '0x0850', 'Mongolian (PRC)', 'mn-Mong-CN', 'Mong', 'UTF-8'),
(122, '0x0850', 'Nepali (India)', 'ne-IN', '__', 'UTF-8'),
(123, '0x0461', 'Nepali (Nepal)', 'ne-NP', 'Deva', 'UTF-8'),
(124, '0x0414', 'Norwegian (Bokmål, Norway)', 'nb-NO', 'Latn', '1252'),
(125, '0x0814', 'Norwegian (Nynorsk, Norway)', 'nn-NO', 'Latn', '1252'),
(126, '0x0482', 'Occitan (France)', 'oc-FR', 'Latn', '1252'),
(127, '0x0448', 'Oriya (India)', 'or-IN', 'Orya', 'UTF-8'),
(128, '0x0463', 'Pashto (Afghanistan)', 'ps-AF', '', ''),
(129, '0x0429', 'Persian (Iran)', 'fa-IR', 'Arab', '1256'),
(130, '0x0415', 'Polish (Poland)', 'pl-PL', 'Latn', '1250'),
(131, '0x0416', 'Portuguese (Brazil)', 'pt-BR', 'Latn', '1252'),
(132, '0x0816', 'Portuguese (Portugal)', 'pt-PT', 'Latn', '1252'),
(133, '0x0446', 'Punjabi (India)', 'pa-IN', 'Guru', 'UTF-8'),
(134, '0x046b', 'Quechua (Bolivia)', 'quz-BO', 'Latn', '1252'),
(135, '0x086b', 'Quechua (Ecuador)', 'quz-EC', 'Latn', '1252'),
(136, '0x0c6b', 'Quechua (Peru)', 'quz-PE', 'Latn', '1252'),
(137, '0x0418', 'Romanian (Romania)', 'ro-RO', 'Latn', '1250'),
(138, '0x0417', 'Romansh (Switzerland)', 'rm-CH', 'Latn', '1252'),
(139, '0x0419', 'Russian (Russia)', 'ru-RU', 'Cyrl', '1251'),
(140, '0x243b', 'Sami (Inari, Finland)', 'smn-FI', 'Latn', '1252'),
(141, '0x103b', 'Sami (Lule, Norway)', 'smj-NO', 'Latn', '1252'),
(142, '0x143b', 'Sami (Lule, Sweden)', 'smj-SE', 'Latn', '1252'),
(143, '0x0c3b', 'Sami (Northern, Finland)', 'se-FI', 'Latn', '1252'),
(144, '0x043b', 'Sami (Northern, Norway)', 'se-NO', 'Latn', '1252'),
(145, '0x083b', 'Sami (Northern, Sweden)', 'se-SE', 'Latn', '1252'),
(146, '0x203b', 'Sami (Skolt, Finland)', 'sms-FI', 'Latn', '1252'),
(147, '0x183b', 'Sami (Southern, Norway)', 'sma-NO', 'Latn', '1252'),
(148, '0x1c3b', 'Sami (Southern, Sweden)', 'sma-SE', 'Latn', '1252'),
(149, '0x044f', 'Sanskrit (India)', 'sa-IN', 'Deva', 'UTF-8'),
(150, '0x1c1a', 'Serbian (Bosnia and Herzegovina, Cyrillic)', 'sr-Cyrl-BA', 'Cyrl', '1251'),
(151, '0x181a', 'Serbian (Bosnia and Herzegovina, Latin)', 'sr-Latn-BA', 'Latn', '1250'),
(152, '0x0c1a', 'Serbian (Serbia, Cyrillic)', 'sr-Cyrl-CS', 'Cyrl', '1251'),
(153, '0x081a', 'Serbian (Serbia, Latin)', 'sr-Latn-CS', 'Latn', '1250'),
(154, '0x046c', 'Sesotho sa Leboa/Northern Sotho (South Africa)', 'ns-ZA', 'Latn', '1252'),
(155, '0x0432', 'Setswana/Tswana (South Africa)', 'tn-ZA', 'Latn', '1252'),
(156, '0x045b', 'Sinhala (Sri Lanka)', 'si-LK', 'Sinh', 'UTF-8'),
(157, '0x041b', 'Slovak (Slovakia)', 'sk-SK', 'Latn', '1250'),
(158, '0x0424', 'Slovenian (Slovenia)', 'sl-SI', 'Latn', '1250'),
(159, '0x2c0a', 'Spanish (Argentina)', 'es-AR', 'Latn', '1252'),
(160, '0x400a', 'Spanish (Bolivia)', 'es-BO', 'Latn', '1252'),
(161, '0x340a', 'Spanish (Chile)', 'es-CL', 'Latn', '1252'),
(162, '0x240a', 'Spanish (Colombia)', 'es-CO', 'Latn', '1252'),
(163, '0x140a', 'Spanish (Costa Rica)', 'es-CR', 'Latn', '1252'),
(164, '0x1c0a', 'Spanish (Dominican Republic)', 'es-DO', 'Latn', '1252'),
(165, '0x300a', 'Spanish (Ecuador)', 'es-EC', 'Latn', '1252'),
(166, '0x440a', 'Spanish (El Salvador)', 'es-SV', 'Latn', '1252'),
(167, '0x100a', 'Spanish (Guatemala)', 'es-GT', 'Latn', '1252'),
(168, '0x480a', 'Spanish (Honduras)', 'es-HN', 'Latn', '1252'),
(169, '0x080a', 'Spanish (Mexico)', 'es-MX', 'Latn', '1252'),
(170, '0x4c0a', 'Spanish (Nicaragua)', 'es-NI', 'Latn', '1252'),
(171, '0x180a', 'Spanish (Panama)', 'es-PA', 'Latn', '1252'),
(172, '0x3c0a', 'Spanish (Paraguay)', 'es-PY', 'Latn', '1252'),
(173, '0x280a', 'Spanish (Peru)', 'es-PE', 'Latn', '1252'),
(174, '0x500a', 'Spanish (Puerto Rico)', 'es-PR', 'Latn', '1252'),
(175, '0x0c0a', 'Spanish (Spain)', 'es-ES', 'Latn', '1252'),
(176, '0x040a', 'Spanish (Spain, Traditional Sort)', 'es-ES_tradnl', 'Latn', '1252'),
(177, '0x540a', 'Spanish (United States)', 'es-US', '', ''),
(178, '0x380a', 'Spanish (Uruguay)', 'es-UY', 'Latn', '1252'),
(179, '0x200a', 'Spanish (Venezuela)', 'es-VE', 'Latn', '1252'),
(180, '0x0441', 'Swahili (Kenya)', 'sw-KE', 'Latn', '1252'),
(181, '0x081d', 'Swedish (Finland)', 'sv-FI', 'Latn', '1252'),
(182, '0x041d', 'Swedish (Sweden)', 'sv-SE', 'Latn', '1252'),
(183, '0x045a', 'Syriac (Syria)', 'syr-SY', 'Syrc', 'UTF-8'),
(184, '0x0428', 'Tajik (Tajikistan)', 'tg-Cyrl-TJ', 'Cyrl', '1251'),
(185, '0x085f', 'Tamazight (Algeria, Latin)', 'tzm-Latn-DZ', 'Latn', '1252'),
(186, '0x0449', 'Tamil (India)', 'ta-IN', 'Taml', 'UTF-8'),
(187, '0x0444', 'Tatar (Russia)', 'tt-RU', 'Cyrl', '1251'),
(188, '0x044a', 'Telugu (India)', 'te-IN', 'Telu', 'UTF-8'),
(189, '0x041e', 'Thai (Thailand)', 'th-TH', 'Thai', '874'),
(190, '0x0851', 'Tibetan (Bhutan)', 'bo-BT', 'Tibt', 'UTF-8'),
(191, '0x0451', 'Tibetan (PRC)', 'bo-CN', 'Tibt', 'UTF-8'),
(192, '0x041f', 'Turkish (Turkey)', 'tr-TR', 'Latn', '1254'),
(193, '0x0442', 'Turkmen (Turkmenistan)', 'tk-TM', 'Cyrl', '1251'),
(194, '0x0480', 'Uighur (PRC)', 'ug-CN', 'Arab', '1256'),
(195, '0x0422', 'Ukrainian (Ukraine)', 'uk-UA', 'Cyrl', '1251'),
(196, '0x042e', 'Upper Sorbian (Germany)', 'wen-DE', 'Latn', '1252'),
(197, '0x0820', 'Urdu (India)', 'tr-IN', '', ''),
(198, '0x0420', 'Urdu (Pakistan)', 'ur-PK', 'Arab', '1256'),
(199, '0x0843', 'Uzbek (Uzbekistan, Cyrillic)', 'uz-Cyrl-UZ', 'Cyrl', '1251'),
(200, '0x0443', 'Uzbek (Uzbekistan, Latin)', 'uz-Latn-UZ', 'Latn', '1254'),
(201, '0x042a', 'Vietnamese (Vietnam)', 'vi-VN', 'Latn', '1258'),
(202, '0x0452', 'Welsh (United Kingdom)', 'cy-GB', 'Latn', '1252'),
(203, '0x0488', 'Wolof (Senegal)', 'wo-SN', 'Latn', '1252'),
(204, '0x0434', 'Xhosa/isiXhosa (South Africa)', 'xh-ZA', 'Latn', '1252'),
(205, '0x0485', 'Yakut (Russia)', 'sah-RU', 'Cyrl', '1251'),
(206, '0x0478', 'Yi (PRC)', 'ii-CN', 'Yiii', 'UTF-8'),
(207, '0x046a', 'Yoruba (Nigeria)', 'yo-NG', '', ''),
(208, '0x0435', 'Zulu/isiZulu (South Africa)', 'zu-ZA', 'Latn', '1252');
INSERT INTO SearchConfig VALUES ('Categories', 'NewItem', 0, 1, 'lu_fielddesc_category_newitem', 'lc_field_newitem', 'In-Portal', 'la_text_category', 18, DEFAULT, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'PopItem', 0, 1, 'lu_fielddesc_category_popitem', 'lc_field_popitem', 'In-Portal', 'la_text_category', 19, DEFAULT, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'HotItem', 0, 1, 'lu_fielddesc_category_hotitem', 'lc_field_hotitem', 'In-Portal', 'la_text_category', 17, DEFAULT, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'MetaDescription', 0, 1, 'lu_fielddesc_category_metadescription', 'lc_field_MetaDescription', 'In-Portal', 'la_text_category', 16, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'ParentPath', 0, 1, 'lu_fielddesc_category_parentpath', 'lc_field_ParentPath', 'In-Portal', 'la_text_category', 15, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'ResourceId', 0, 1, 'lu_fielddesc_category_resourceid', 'lc_field_resourceid', 'In-Portal', 'la_text_category', 14, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'CreatedById', 0, 1, 'lu_fielddesc_category_createdbyid', 'lc_field_createdbyid', 'In-Portal', 'la_text_category', 13, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'CachedNavbar', 0, 1, 'lu_fielddesc_category_cachednavbar', 'lc_field_CachedNavBar', 'In-Portal', 'la_text_category', 12, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'CachedDescendantCatsQty', 0, 1, 'lu_fielddesc_category_cacheddescendantcatsqty', 'lc_field_CachedDescendantCatsQty', 'In-Portal', 'la_text_category', 11, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'MetaKeywords', 0, 1, 'lu_fielddesc_category_metakeywords', 'lc_field_MetaKeywords', 'In-Portal', 'la_text_category', 10, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'Priority', 0, 1, 'lu_fielddesc_category_priority', 'lc_field_priority', 'In-Portal', 'la_text_category', 9, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'Status', 0, 1, 'lu_fielddesc_category_status', 'lc_field_status', 'In-Portal', 'la_text_category', 7, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'EditorsPick', 0, 1, 'lu_fielddesc_category_editorspick', 'lc_field_EditorsPick', 'In-Portal', 'la_text_category', 6, DEFAULT, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'CreatedOn', 0, 1, 'lu_fielddesc_category_createdon', 'lc_field_createdon', 'In-Portal', 'la_text_category', 5, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'Description', 1, 1, 'lu_fielddesc_category_description', 'lc_field_description', 'In-Portal', 'la_text_category', 4, DEFAULT, 2, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'Name', 1, 1, 'lu_fielddesc_category_name', 'lc_field_name', 'In-Portal', 'la_text_category', 3, DEFAULT, 2, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'ParentId', 0, 1, 'lu_fielddesc_category_parentid', 'lc_field_ParentId', 'In-Portal', 'la_text_category', 2, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'CategoryId', 0, 1, 'lu_fielddesc_category_categoryid', 'lc_field_CategoryId', 'In-Portal', 'la_text_category', 0, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'Modified', 0, 1, 'lu_fielddesc_category_modified', 'lc_field_modified', 'In-Portal', 'la_text_category', 20, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Categories', 'ModifiedById', 0, 1, 'lu_fielddesc_category_modifiedbyid', 'lc_field_modifiedbyid', 'In-Portal', 'la_text_category', 21, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'PortalUserId', -1, 0, 'lu_fielddesc_user_portaluserid', 'lu_field_portaluserid', 'In-Portal', 'la_text_user', 0, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'Username', -1, 0, 'lu_fielddesc_user_login', 'lu_field_login', 'In-Portal', 'la_text_user', 1, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'Password', -1, 0, 'lu_fielddesc_user_password', 'lu_field_password', 'In-Portal', 'la_text_user', 2, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'TimeZone', -1, 0, 'lu_fielddesc_user_tz', 'lu_field_tz', 'In-Portal', 'la_text_user', 17, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'dob', -1, 0, 'lu_fielddesc_user_dob', 'lu_field_dob', 'In-Portal', 'la_text_user', 16, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'Modified', -1, 0, 'lu_fielddesc_user_modified', 'lc_field_modified', 'In-Portal', 'la_text_user', 15, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'Status', -1, 0, 'lu_fielddesc_user_status', 'lc_field_status', 'In-Portal', 'la_text_user', 14, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'ResourceId', -1, 0, 'lu_fielddesc_user_resourceid', 'lc_field_resourceid', 'In-Portal', 'la_text_user', 13, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'Country', -1, 0, 'lu_fielddesc_user_country', 'lu_field_country', 'In-Portal', 'la_text_user', 12, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'Zip', -1, 0, 'lu_fielddesc_user_zip', 'lu_field_zip', 'In-Portal', 'la_text_user', 11, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'State', -1, 0, 'lu_fielddesc_user_state', 'lu_field_state', 'In-Portal', 'la_text_user', 10, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'City', -1, 0, 'lu_fielddesc_user_city', 'lu_field_city', 'In-Portal', 'la_text_user', 9, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'Street', -1, 0, 'lu_fielddesc_user_street', 'lu_field_street', 'In-Portal', 'la_text_user', 8, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'Phone', -1, 0, 'lu_fielddesc_user_phone', 'lu_field_phone', 'In-Portal', 'la_text_user', 7, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'CreatedOn', -1, 0, 'lu_fielddesc_user_createdon', 'lc_field_createdon', 'In-Portal', 'la_text_user', 6, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'Email', -1, 0, 'lu_fielddesc_user_email', 'lu_field_email', 'In-Portal', 'la_text_user', 5, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'LastName', -1, 0, 'lu_fielddesc_user_lastname', 'lu_field_lastname', 'In-Portal', 'la_text_user', 4, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Users', 'FirstName', -1, 0, 'lu_fielddesc_user_firstname', 'lu_field_firstname', 'In-Portal', 'la_text_user', 3, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT count(*) FROM <%prefix%>Categories WHERE Status=1 ', NULL, 'la_prompt_ActiveCategories', '0', '1');
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT count(*) FROM <%prefix%>Users WHERE Status=1 ', NULL, 'la_prompt_ActiveUsers', '0', '1');
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT count(*) FROM <%prefix%>UserSessions', NULL, 'la_prompt_CurrentSessions', '0', '1');
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) as CategoryCount FROM <%prefix%>Categories', NULL, 'la_prompt_TotalCategories', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) AS ActiveCategories FROM <%prefix%>Categories WHERE Status = 1', NULL, 'la_prompt_ActiveCategories', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) AS PendingCategories FROM <%prefix%>Categories WHERE Status = 2', NULL, 'la_prompt_PendingCategories', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) AS DisabledCategories FROM <%prefix%>Categories WHERE Status = 0', NULL, 'la_prompt_DisabledCategories', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) AS NewCategories FROM <%prefix%>Categories WHERE (NewItem = 1) OR ( (UNIX_TIMESTAMP() - CreatedOn) <= <%m:config name="Category_DaysNew"%>*86400 AND (NewItem = 2) )', NULL, 'la_prompt_NewCategories', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) FROM <%prefix%>Categories WHERE EditorsPick = 1', NULL, 'la_prompt_CategoryEditorsPick', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT <%m:post_format field="MAX(CreatedOn)" type="date"%> FROM <%prefix%>Categories', NULL, 'la_prompt_NewestCategoryDate', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT <%m:post_format field="MAX(Modified)" type="date"%> FROM <%prefix%>Categories', NULL, 'la_prompt_LastCategoryUpdate', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) AS TotalUsers FROM <%prefix%>Users', NULL, 'la_prompt_TopicsUsers', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) AS ActiveUsers FROM <%prefix%>Users WHERE Status = 1', NULL, 'la_prompt_UsersActive', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) AS PendingUsers FROM <%prefix%>Users WHERE Status = 2', NULL, 'la_prompt_UsersPending', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) AS DisabledUsers FROM <%prefix%>Users WHERE Status = 0', NULL, 'la_prompt_UsersDisabled', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT <%m:post_format field="MAX(CreatedOn)" type="date"%> FROM <%prefix%>Users', NULL, 'la_prompt_NewestUserDate', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT( DISTINCT LOWER( Country ) ) FROM <%prefix%>Users WHERE LENGTH(Country) > 0', NULL, 'la_prompt_UsersUniqueCountries', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT( DISTINCT LOWER( State ) ) FROM <%prefix%>Users WHERE LENGTH(State) > 0', NULL, 'la_prompt_UsersUniqueStates', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) AS TotalUserGroups FROM <%prefix%>UserGroups', NULL, 'la_prompt_TotalUserGroups', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) AS BannedUsers FROM <%prefix%>Users WHERE IsBanned = 1', NULL, 'la_prompt_BannedUsers', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) AS NonExipedSessions FROM <%prefix%>UserSessions WHERE Status = 1', NULL, 'la_prompt_NonExpiredSessions', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) AS ThemeCount FROM <%prefix%>Themes', NULL, 'la_prompt_ThemeCount', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', 'SELECT COUNT(*) AS RegionsCount FROM <%prefix%>Languages', NULL, 'la_prompt_RegionsCount', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', '<%m:sql_action sql="SHOW+TABLES" action="COUNT" field="*"%>', NULL, 'la_prompt_TablesCount', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', '<%m:sql_action sql="SHOW+TABLE+STATUS" action="SUM" field="Rows"%>', NULL, 'la_prompt_RecordsCount', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', '<%m:custom_action sql="empty" action="SysFileSize"%>', NULL, 'la_prompt_SystemFileSize', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Portal', '<%m:sql_action sql="SHOW+TABLE+STATUS" action="SUM" format_as="file" field="Data_length"%>', NULL, 'la_prompt_DataSize', 0, 2);
INSERT INTO Counters VALUES (DEFAULT, 'members_count', 'SELECT COUNT(*) FROM <%PREFIX%>Users WHERE Status = 1', NULL , NULL , '3600', '0', '|Users|');
INSERT INTO Counters VALUES (DEFAULT, 'members_online', 'SELECT COUNT(*) FROM <%PREFIX%>UserSessions WHERE PortalUserId > 0', NULL , NULL , '3600', '0', '|UserSessions|');
INSERT INTO Counters VALUES (DEFAULT, 'guests_online', 'SELECT COUNT(*) FROM <%PREFIX%>UserSessions WHERE PortalUserId <= 0', NULL , NULL , '3600', '0', '|UserSessions|');
INSERT INTO Counters VALUES (DEFAULT, 'users_online', 'SELECT COUNT(*) FROM <%PREFIX%>UserSessions', NULL , NULL , '3600', '0', '|UserSessions|');
INSERT INTO StopWords VALUES (90, '~'),(152, 'on'),(157, 'see'),(156, 'put'),(128, 'and'),(154, 'or'),(155, 'other'),(153, 'one'),(126, 'as'),(127, 'at'),(125, 'are'),(91, '!'),(92, '@'),(93, '#'),(94, '$'),(95, '%'),(96, '^'),(97, '&'),(98, '*'),(99, '('),(100, ')'),(101, '-'),(102, '_'),(103, '='),(104, '+'),(105, '['),(106, '{'),(107, ']'),(108, '}'),(109, '\\'),(110, '|'),(111, ';'),(112, ':'),(113, ''''),(114, '"'),(115, '<'),(116, '.'),(117, '>'),(118, '/'),(119, '?'),(120, 'ah'),(121, 'all'),(122, 'also'),(123, 'am'),(124, 'an'),(151, 'of'),(150, 'note'),(149, 'not'),(148, 'no'),(147, 'may'),(146, 'its'),(145, 'it'),(144, 'is'),(143, 'into'),(142, 'in'),(141, 'had'),(140, 'has'),(139, 'have'),(138, 'from'),(137, 'form'),(136, 'for'),(135, 'end'),(134, 'each'),(133, 'can'),(132, 'by'),(130, 'be'),(131, 'but'),(129, 'any'),(158, 'that'),(159, 'the'),(160, 'their'),(161, 'there'),(162, 'these'),(163, 'they'),(164, 'this'),(165, 'through'),(166, 'thus'),(167, 'to'),(168, 'two'),(169, 'too'),(170, 'up'),(171, 'where'),(172, 'which'),(173, 'with'),(174, 'were'),(175, 'was'),(176, 'you'),(177, 'yet');
#INSERT INTO PageContent VALUES (DEFAULT, 1, 1, '<span style="font-weight: bold;">In-portal</span> is a revolutionary Web Site management system that allows you to automate and facilitate management of large portal and community web sites. Regardless of whether you are running a directory site or a content news portal, a community site or an online mall, In-portal will enhance your web site management experience with innovative.</span><br><br>We are proud to present our newly developed <b>"default"</b> theme that introduces a fresh look as well totally new approach in the template system.</span><br>', NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0);
INSERT INTO PromoBlockGroups VALUES (DEFAULT, 'Default Group', UNIX_TIMESTAMP(), '1', '7.00', '0.60', '1', 'fade', '');
INSERT INTO Modules VALUES ('Core', 'core/', 'adm', DEFAULT, 1, 1, '', 0, NULL, NULL);
INSERT INTO Modules VALUES ('In-Portal', 'core/', 'm', DEFAULT, 1, 0, '', 0, NULL, NULL);
\ No newline at end of file

Event Timeline