Changeset View
Changeset View
Standalone View
Standalone View
branches/5.3.x/core/units/configuration/configuration_event_handler.php
Show First 20 Lines • Show All 298 Lines • ▼ Show 20 Line(s) | |||||
$changed = $this->Application->GetVar($event->getPrefixSpecial() . '_changed', Array ()); | $changed = $this->Application->GetVar($event->getPrefixSpecial() . '_changed', Array ()); | ||||
if ( $object->GetDBField('VariableValue') != $object->GetOriginalField('VariableValue') ) { | if ( $object->GetDBField('VariableValue') != $object->GetOriginalField('VariableValue') ) { | ||||
$changed[] = $variable_name; | $changed[] = $variable_name; | ||||
$this->Application->SetVar($event->getPrefixSpecial() . '_changed', $changed); | $this->Application->SetVar($event->getPrefixSpecial() . '_changed', $changed); | ||||
// update value in cache, so other code (during this script run) would use new value | // update value in cache, so other code (during this script run) would use new value | ||||
$this->Application->SetConfigValue($variable_name, $object->GetDBField('VariableValue'), true); | $this->Application->SetConfigValue($variable_name, $object->GetDBField('VariableValue'), true); | ||||
$sorting_prefix = $this->getSortingPrefix($variable_name); | |||||
if ( $sorting_prefix ) { | |||||
$sql = 'DELETE FROM ' . TABLE_PREFIX . 'UserPersistentSessionData | |||||
WHERE VariableName LIKE "' . $sorting_prefix . '%Sortings.%"'; | |||||
$this->Conn->Query($sql); | |||||
} | |||||
} | } | ||||
if ( $variable_name == 'Require_AdminSSL' || $variable_name == 'AdminSSLDomain' ) { | if ( $variable_name == 'Require_AdminSSL' || $variable_name == 'AdminSSLDomain' ) { | ||||
// when administrative console is moved to SSL mode, then delete skin | // when administrative console is moved to SSL mode, then delete skin | ||||
if ( in_array($variable_name, $changed) && !$skin_deleted ) { | if ( in_array($variable_name, $changed) && !$skin_deleted ) { | ||||
$skin_helper = $this->Application->recallObject('SkinHelper'); | $skin_helper = $this->Application->recallObject('SkinHelper'); | ||||
/* @var $skin_helper SkinHelper */ | /* @var $skin_helper SkinHelper */ | ||||
$skin_file = $skin_helper->getSkinPath(); | $skin_file = $skin_helper->getSkinPath(); | ||||
if ( file_exists($skin_file) ) { | if ( file_exists($skin_file) ) { | ||||
unlink($skin_file); | unlink($skin_file); | ||||
} | } | ||||
$skin_deleted = true; | $skin_deleted = true; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Returns prefix, related to given sorting system setting | |||||
* | |||||
* @param string $system_setting System setting. | |||||
* | |||||
* @return boolean|string | |||||
*/ | |||||
protected function getSortingPrefix($system_setting) | |||||
{ | |||||
foreach ( $this->Application->ModuleInfo as $module_info ) { | |||||
if ( $module_info['Name'] == 'In-Portal' ) { | |||||
continue; | |||||
} | |||||
$prefix = ($module_info['Var'] == 'adm') ? 'c' : $module_info['Var']; | |||||
$config_mapping = $this->Application->getUnitConfig($prefix)->getConfigMapping(); | |||||
if ( (isset($config_mapping['DefaultSorting1Field']) | |||||
&& $system_setting == $config_mapping['DefaultSorting1Field']) | |||||
|| (isset($config_mapping['DefaultSorting2Field']) | |||||
&& $system_setting == $config_mapping['DefaultSorting2Field']) | |||||
) { | |||||
return $prefix; | |||||
} | |||||
} | |||||
return false; | |||||
} | |||||
/** | |||||
* Updates kDBItem | * Updates kDBItem | ||||
* | * | ||||
* @param kEvent $event | * @param kEvent $event | ||||
* @return void | * @return void | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected function OnUpdate(kEvent $event) | protected function OnUpdate(kEvent $event) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 230 Lines • Show Last 20 Lines |