Index: branches/5.1.x/core/kernel/utility/http_query.php
===================================================================
diff -u -r13545 -r13750
--- branches/5.1.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 13545)
+++ branches/5.1.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 13750)
@@ -1,6 +1,6 @@
specialsToRemove as $prefix_special => $flag) {
if ($flag && strpos($prefix_special, '.') === false) {
unset($this->specialsToRemove[$prefix_special]);
- trigger_error('Incorrect usage of "remove_specials['.$prefix_special.']" field (no special found)', E_USER_WARNING);
+ trigger_error('Incorrect usage of "remove_specials['.$prefix_special.']" field (no special found)', E_USER_NOTICE);
}
}
$this->_Params = $this->removeSpecials($this->_Params);
Index: branches/5.1.x/core/install/install_toolkit.php
===================================================================
diff -u -r13545 -r13750
--- branches/5.1.x/core/install/install_toolkit.php (.../install_toolkit.php) (revision 13545)
+++ branches/5.1.x/core/install/install_toolkit.php (.../install_toolkit.php) (revision 13750)
@@ -1,6 +1,6 @@
INIFile) && !is_writable(dirname($this->INIFile))) {
- trigger_error('Cannot write to "' . $this->INIFile . '" file.', $silent ? E_USER_NOTICE : E_USER_ERROR);
+ trigger_error('Cannot write to "' . $this->INIFile . '" file.', $silent ? E_USER_WARNING : E_USER_ERROR);
return ;
}
@@ -834,6 +834,25 @@
}
/**
+ * Deletes all temp tables (from active sessions too)
+ *
+ */
+ function deleteEditTables()
+ {
+ $table_prefix = $this->getSystemConfig('Database', 'TablePrefix');
+
+ $tables = $this->Conn->GetCol('SHOW TABLES');
+ $mask_edit_table = '/' . $table_prefix . 'ses_(.*)_edit_(.*)/';
+ $mask_search_table = '/' . $table_prefix . 'ses_(.*?)_(.*)/';
+
+ foreach ($tables as $table) {
+ if ( preg_match($mask_edit_table, $table, $rets) || preg_match($mask_search_table, $table, $rets) ) {
+ $this->Conn->Query('DROP TABLE IF EXISTS ' . $table);
+ }
+ }
+ }
+
+ /**
* Perform redirect after separate module install
*
* @param string $module_folder
Index: branches/5.1.x/core/kernel/db/db_tag_processor.php
===================================================================
diff -u -r13613 -r13750
--- branches/5.1.x/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 13613)
+++ branches/5.1.x/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 13750)
@@ -1,6 +1,6 @@
Application->ParseBlock($block_params);
$filter_menu = $this->Application->getUnitOption($this->Prefix,'FilterMenu');
if (!$filter_menu) {
- trigger_error('no filters defined for prefix '.$this->Prefix.', but DrawFilterMenu tag used', E_USER_WARNING);
+ trigger_error('no filters defined for prefix '.$this->Prefix.', but DrawFilterMenu tag used', E_USER_NOTICE);
return '';
}
@@ -147,7 +147,7 @@
{
$refresh_intervals = $this->Application->ConfigValue('AutoRefreshIntervals');
if (!$refresh_intervals) {
- trigger_error('no filters defined for prefix '.$this->Prefix.', but DrawAutoRefreshMenu tag used', E_USER_WARNING);
+ trigger_error('no refresh intervals defined for prefix '.$this->Prefix.', but DrawAutoRefreshMenu tag used', E_USER_NOTICE);
return '';
}
@@ -2652,7 +2652,7 @@
$title_presets = $this->Application->getUnitOption($this->Prefix, 'TitlePresets');
if (!array_key_exists($preset_name, $title_presets)) {
- trigger_error('Title preset not specified or missing (in tag "' . $this->getPrefixSpecial() . ':' . __METHOD__ . '")', E_USER_WARNING);
+ trigger_error('Title preset not specified or missing (in tag "' . $this->getPrefixSpecial() . ':' . __METHOD__ . '")', E_USER_NOTICE);
return false;
}
Index: branches/5.1.x/core/units/helpers/file_helper.php
===================================================================
diff -u -r13667 -r13750
--- branches/5.1.x/core/units/helpers/file_helper.php (.../file_helper.php) (revision 13667)
+++ branches/5.1.x/core/units/helpers/file_helper.php (.../file_helper.php) (revision 13750)
@@ -1,6 +1,6 @@
create default image fields
- $image_names = Array ('Primary'.$field_prefix => '');
$image_count = $this->Application->ConfigValue($prefix.'_MaxImageCount');
- $created_count = 1;
- while ($created_count < $image_count) {
- $image_names[$field_prefix.$created_count] = '';
- $created_count++;
+ if ($is_image) {
+ $created_count = 1;
+ $image_names = Array ('Primary' . $field_prefix => '');
+
+ while ($created_count < $image_count) {
+ $image_names[$field_prefix . $created_count] = '';
+ $created_count++;
+ }
}
+ else {
+ $created_count = 0;
+ $image_names = Array ();
+ while ($created_count < $image_count) {
+ $image_names[$field_prefix . ($created_count + 1)] = '';
+ $created_count++;
+ }
+ }
+
$this->createUploadFields($prefix, $image_names, $is_image);
return ;
}
Index: branches/5.1.x/core/units/fck/fck_tp.php
===================================================================
diff -u -r13545 -r13750
--- branches/5.1.x/core/units/fck/fck_tp.php (.../fck_tp.php) (revision 13545)
+++ branches/5.1.x/core/units/fck/fck_tp.php (.../fck_tp.php) (revision 13750)
@@ -1,6 +1,6 @@
Application->recallObject('FCKHelper');
/* @var fck_helper fckFCKHelper*/
- $default_folders = defined('FCK_DEFAULT_FOLDERS') ? FCK_DEFAULT_FOLDERS : Array ('Files', 'Images', 'Flash', 'Documents');
+ $default_folders = defined('FCK_DEFAULT_FOLDERS') ? FCK_DEFAULT_FOLDERS : Array ('Files', 'Images', 'Flash', 'Media', 'Documents');
foreach ($default_folders as $index => $folder) {
if (!$fck_helper->CreateFolder($folder)) {
Index: branches/5.1.x/core/units/helpers/custom_fields_helper.php
===================================================================
diff -u -r13545 -r13750
--- branches/5.1.x/core/units/helpers/custom_fields_helper.php (.../custom_fields_helper.php) (revision 13545)
+++ branches/5.1.x/core/units/helpers/custom_fields_helper.php (.../custom_fields_helper.php) (revision 13750)
@@ -1,6 +1,6 @@
Application->Debugger->appendTrace();
}
- trigger_error('Invalid symbol in ValueList field [' . substr($values_list, 0, 100) . ' ...]' , E_USER_NOTICE);
+ trigger_error('Invalid symbol in ValueList field [' . substr($values_list, 0, 100) . ' ...]' , E_USER_WARNING);
return Array ();
}
Index: branches/5.1.x/core/units/languages/languages_event_handler.php
===================================================================
diff -u -r13581 -r13750
--- branches/5.1.x/core/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 13581)
+++ branches/5.1.x/core/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 13750)
@@ -1,6 +1,6 @@
status = erSTOP;
}
- if (is_object($event->MasterEvent) && $event->MasterEvent->status != erSUCCESS) {
- return ;
+ if (is_object($event->MasterEvent)) {
+ if ($event->MasterEvent->status != erSUCCESS) {
+ // only rebuild when all fields are validated
+ return ;
+ }
+
+ if (($event->MasterEvent->Name == 'OnSave') && !$this->Application->GetVar('new_language')) {
+ // only rebuild during new language adding
+ return ;
+ }
}
$ml_helper =& $this->Application->recallObject('kMultiLanguageHelper');
@@ -293,6 +301,26 @@
$object->SetDBField('CopyFromLanguage', $primary_lang_id);
}
+ /**
+ * Sets new language mark
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeDeleteFromLive(&$event)
+ {
+ $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField');
+ $table_name = $this->Application->getUnitOption($event->Prefix, 'TableName');
+
+ $sql = 'SELECT ' . $id_field . '
+ FROM ' . $table_name . '
+ WHERE ' . $id_field . ' = ' . $event->getEventParam('id');
+ $id = $this->Conn->GetOne($sql);
+
+ if (!$id) {
+ $this->Application->SetVar('new_language', 1);
+ }
+ }
+
function OnChangeLanguage(&$event)
{
$language_id = $this->Application->GetVar('language');
Index: branches/5.1.x/core/kernel/utility/temp_handler.php
===================================================================
diff -u -r13581 -r13750
--- branches/5.1.x/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 13581)
+++ branches/5.1.x/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 13750)
@@ -1,6 +1,6 @@
clone mapping for dual ForeignKey updating
$this->AlreadyProcessed[$master['TableName']][$id] = $object->GetId();
}
- if ($object->mode == 't') {
- $object->setTempID();
- }
+
if ($mode == 'create') {
$this->RaiseEvent('OnAfterClone', $master['Prefix'], $special, Array($object->GetId()), $foreign_key, array('original_id' => $id) );
$this->saveID($master['Prefix'], $special, $object->GetID());
Index: branches/5.1.x/core/units/helpers/sections_helper.php
===================================================================
diff -u -r13168 -r13750
--- branches/5.1.x/core/units/helpers/sections_helper.php (.../sections_helper.php) (revision 13168)
+++ branches/5.1.x/core/units/helpers/sections_helper.php (.../sections_helper.php) (revision 13750)
@@ -1,6 +1,6 @@
debugMode = $this->Application->isDebugMode();
+ $this->superAdminMode = $this->Application->RecallVar('super_admin');
+
$this->BuildTree();
}
@@ -236,7 +254,7 @@
$current_data = isset($this->Tree[$section_name]) ? $this->Tree[$section_name] : Array();
if ($current_data) {
- trigger_error('Section "' . $section_name . '" declaration (originally defined in "' . $current_data['SectionPrefix'] . '") was overwriten from "' . $prefix . '"', E_USER_NOTICE);
+ trigger_error('Section "' . $section_name . '" declaration (originally defined in "' . $current_data['SectionPrefix'] . '") was overwriten from "' . $prefix . '"', E_USER_WARNING);
}
$this->Tree[$section_name] = array_merge_recursive2($current_data, $section_params);
@@ -276,11 +294,7 @@
// get 1st child
ksort($children, SORT_NUMERIC);
foreach ($children as $child_priority => $child_section) {
- $section_data =& $this->getSectionData($child_section);
-
- $perm_section = $this->getPermSection($child_section);
- $perm_status = $check_permission ? $this->Application->CheckPermission($perm_section.'.view') : true;
- if ((isset($section_data['show_mode']) && $section_data['show_mode']) || !$perm_status) {
+ if (!$this->sectionVisible($child_section, $check_permission)) {
continue;
}
@@ -294,6 +308,44 @@
}
/**
+ * Checks if given section is visible by it's definition and optionally by user permission
+ *
+ * @param string $section_name
+ * @param bool $check_permission
+ * @return bool
+ */
+ function sectionVisible($section_name, $check_permission = false)
+ {
+ $section_data =& $this->getSectionData($section_name);
+
+ if (isset($section_data['show_mode']) && is_numeric($section_data['show_mode'])) {
+ $show_mode = $section_data['show_mode'];
+
+ // if super admin section -> show in super admin mode & debug mode
+ $show_section = $show_mode == smNORMAL || ((($show_mode & smSUPER_ADMIN) == smSUPER_ADMIN) && ($this->superAdminMode || $this->debugMode));
+
+ if (!$show_section) {
+ // if section is in debug mode only && debug mode -> show
+ $show_section = (($show_mode & smDEBUG) == smDEBUG) && $this->debugMode;
+ }
+
+ if (!$show_section) {
+ // visibility by section definition
+ return false;
+ }
+ }
+
+ // visibility by section permission
+ if ($check_permission) {
+ $perm_section = $this->getPermSection($section_name);
+
+ return $this->Application->CheckPermission($perm_section.'.view');
+ }
+
+ return true;
+ }
+
+ /**
* Returns section for permission checking based on given section
*
* @param string $section_name
Index: branches/5.1.x/core/units/groups/groups_event_handler.php
===================================================================
diff -u -r13086 -r13750
--- branches/5.1.x/core/units/groups/groups_event_handler.php (.../groups_event_handler.php) (revision 13086)
+++ branches/5.1.x/core/units/groups/groups_event_handler.php (.../groups_event_handler.php) (revision 13750)
@@ -1,6 +1,6 @@
Conn->GetCol($sql);
- array_push($group_ids, 14, 15); // Guest & Everyone groups are set dynamically
+ // add system groups
+ array_push($group_ids, $this->Application->ConfigValue('User_GuestGroup')); // Guest
+ array_push($group_ids, $this->Application->ConfigValue('User_LoggedInGroup')); // Everyone
+
$object->addFilter('already_member_filter', '%1$s.GroupId NOT IN ('.implode(',', $group_ids).')');
}
break;
Index: branches/5.1.x/core/units/helpers/brackets_helper.php
===================================================================
diff -u -r13086 -r13750
--- branches/5.1.x/core/units/helpers/brackets_helper.php (.../brackets_helper.php) (revision 13086)
+++ branches/5.1.x/core/units/helpers/brackets_helper.php (.../brackets_helper.php) (revision 13750)
@@ -1,6 +1,6 @@
SetFieldsFromHash($values);
$object->SetDBField($linked_info['ForeignKey'], $linked_info['ParentId']);
- if( $object->Create() )
- {
- $object->setTempID();
+ if ($object->Create()) {
$event->status = erSUCCESS;
}
}
Index: branches/5.1.x/core/admin_templates/categories/categories_edit_permissions.tpl
===================================================================
diff -u -r13086 -r13750
--- branches/5.1.x/core/admin_templates/categories/categories_edit_permissions.tpl (.../categories_edit_permissions.tpl) (revision 13086)
+++ branches/5.1.x/core/admin_templates/categories/categories_edit_permissions.tpl (.../categories_edit_permissions.tpl) (revision 13750)
@@ -17,22 +17,15 @@
Request.progressText = '
+
+ |
+ + | + + | +