Changeset View
Changeset View
Standalone View
Standalone View
core/units/admin/admin_tag_processor.php
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | |||||
function DrawTree($params) | function DrawTree($params) | ||||
{ | { | ||||
static $deep_level = 0; | static $deep_level = 0; | ||||
// when processings, then sort children by priority (key of children array) | // when processings, then sort children by priority (key of children array) | ||||
$ret = ''; | $ret = ''; | ||||
$section_name = $params['section_name']; | $section_name = $params['section_name']; | ||||
$params['name'] = $this->SelectParam($params, 'name,render_as,block'); | $params['name'] = $this->SelectParam($params, 'name,render_as,block'); | ||||
/** @var kSectionsHelper $sections_helper */ | |||||
$sections_helper = $this->Application->recallObject('SectionsHelper'); | $sections_helper = $this->Application->recallObject('SectionsHelper'); | ||||
/* @var $sections_helper kSectionsHelper */ | |||||
$section_data =& $sections_helper->getSectionData($section_name); | $section_data =& $sections_helper->getSectionData($section_name); | ||||
$params['children_count'] = isset($section_data['children']) ? count($section_data['children']) : 0; | $params['children_count'] = isset($section_data['children']) ? count($section_data['children']) : 0; | ||||
$params['deep_level'] = $deep_level++; | $params['deep_level'] = $deep_level++; | ||||
$template = $section_data['url']['t']; | $template = $section_data['url']['t']; | ||||
unset($section_data['url']['t']); | unset($section_data['url']['t']); | ||||
Show All 21 Lines | |||||
function SectionInfo($params) | function SectionInfo($params) | ||||
{ | { | ||||
$section = $params['section']; | $section = $params['section']; | ||||
if ($section == '#session#') { | if ($section == '#session#') { | ||||
$section = $this->Application->RecallVar('section'); | $section = $this->Application->RecallVar('section'); | ||||
} | } | ||||
/** @var kSectionsHelper $sections_helper */ | |||||
$sections_helper = $this->Application->recallObject('SectionsHelper'); | $sections_helper = $this->Application->recallObject('SectionsHelper'); | ||||
/* @var $sections_helper kSectionsHelper */ | |||||
$section_data =& $sections_helper->getSectionData($section); | $section_data =& $sections_helper->getSectionData($section); | ||||
if (!$section_data) { | if (!$section_data) { | ||||
throw new Exception('Use of undefined section "<strong>' . $section . '</strong>" in "<strong>' . __METHOD__ . '</strong>"'); | throw new Exception('Use of undefined section "<strong>' . $section . '</strong>" in "<strong>' . __METHOD__ . '</strong>"'); | ||||
return ''; | return ''; | ||||
} | } | ||||
if (array_key_exists('parent', $params) && $params['parent']) { | if (array_key_exists('parent', $params) && $params['parent']) { | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | |||||
function PrintSection($params) | function PrintSection($params) | ||||
{ | { | ||||
$section_name = $params['section_name']; | $section_name = $params['section_name']; | ||||
if ($section_name == '#session#') { | if ($section_name == '#session#') { | ||||
$section_name = $this->Application->RecallVar('section'); | $section_name = $this->Application->RecallVar('section'); | ||||
} | } | ||||
/** @var kSectionsHelper $sections_helper */ | |||||
$sections_helper = $this->Application->recallObject('SectionsHelper'); | $sections_helper = $this->Application->recallObject('SectionsHelper'); | ||||
/* @var $sections_helper kSectionsHelper */ | |||||
if (isset($params['use_first_child']) && $params['use_first_child']) { | if (isset($params['use_first_child']) && $params['use_first_child']) { | ||||
$section_name = $sections_helper->getFirstChild($section_name, true); | $section_name = $sections_helper->getFirstChild($section_name, true); | ||||
} | } | ||||
$section_data =& $sections_helper->getSectionData($section_name); | $section_data =& $sections_helper->getSectionData($section_name); | ||||
$params['name'] = $this->SelectParam($params, 'name,render_as,block'); | $params['name'] = $this->SelectParam($params, 'name,render_as,block'); | ||||
Show All 18 Lines | |||||
{ | { | ||||
// when processings, then sort children by priority (key of children array) | // when processings, then sort children by priority (key of children array) | ||||
$ret = ''; | $ret = ''; | ||||
$section_name = $params['section_name']; | $section_name = $params['section_name']; | ||||
if ($section_name == '#session#') { | if ($section_name == '#session#') { | ||||
$section_name = $this->Application->RecallVar('section'); | $section_name = $this->Application->RecallVar('section'); | ||||
} | } | ||||
/** @var kSectionsHelper $sections_helper */ | |||||
$sections_helper = $this->Application->recallObject('SectionsHelper'); | $sections_helper = $this->Application->recallObject('SectionsHelper'); | ||||
/* @var $sections_helper kSectionsHelper */ | |||||
$section_data =& $sections_helper->getSectionData($section_name); | $section_data =& $sections_helper->getSectionData($section_name); | ||||
$params['name'] = $this->SelectParam($params, 'name,render_as,block'); | $params['name'] = $this->SelectParam($params, 'name,render_as,block'); | ||||
if (!isset($section_data['children'])) { | if (!isset($section_data['children'])) { | ||||
return ''; | return ''; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | |||||
return preg_replace("/\r\n|\n/", '', $ret); | return preg_replace("/\r\n|\n/", '', $ret); | ||||
} | } | ||||
function ListSectionPermissions($params) | function ListSectionPermissions($params) | ||||
{ | { | ||||
$section_name = isset($params['section_name']) ? $params['section_name'] : $this->Application->GetVar('section_name'); | $section_name = isset($params['section_name']) ? $params['section_name'] : $this->Application->GetVar('section_name'); | ||||
/** @var kSectionsHelper $sections_helper */ | |||||
$sections_helper = $this->Application->recallObject('SectionsHelper'); | $sections_helper = $this->Application->recallObject('SectionsHelper'); | ||||
/* @var $sections_helper kSectionsHelper */ | |||||
$section_data =& $sections_helper->getSectionData($section_name); | $section_data =& $sections_helper->getSectionData($section_name); | ||||
$block_params = array_merge($section_data, Array('name' => $params['render_as'], 'section_name' => $section_name)); | $block_params = array_merge($section_data, Array('name' => $params['render_as'], 'section_name' => $section_name)); | ||||
$ret = ''; | $ret = ''; | ||||
foreach ($section_data['permissions'] as $perm_name) { | foreach ($section_data['permissions'] as $perm_name) { | ||||
if (preg_match('/^advanced:(.*)/', $perm_name) != $params['type']) continue; | if (preg_match('/^advanced:(.*)/', $perm_name) != $params['type']) continue; | ||||
Show All 19 Lines | |||||
/** | /** | ||||
* Draws section tabs using block name passed | * Draws section tabs using block name passed | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
*/ | */ | ||||
function ListTabs($params) | function ListTabs($params) | ||||
{ | { | ||||
/** @var kSectionsHelper $sections_helper */ | |||||
$sections_helper = $this->Application->recallObject('SectionsHelper'); | $sections_helper = $this->Application->recallObject('SectionsHelper'); | ||||
/* @var $sections_helper kSectionsHelper */ | |||||
$section_data =& $sections_helper->getSectionData($params['section_name']); | $section_data =& $sections_helper->getSectionData($params['section_name']); | ||||
$ret = ''; | $ret = ''; | ||||
$block_params = Array('name' => $params['render_as']); | $block_params = Array('name' => $params['render_as']); | ||||
ksort($section_data['children'], SORT_NUMERIC); | ksort($section_data['children'], SORT_NUMERIC); | ||||
foreach ($section_data['children'] as $priority => $section_name) { | foreach ($section_data['children'] as $priority => $section_name) { | ||||
$perm_section = $sections_helper->getPermSection($section_name); | $perm_section = $sections_helper->getPermSection($section_name); | ||||
▲ Show 20 Lines • Show All 189 Lines • ▼ Show 20 Line(s) | |||||
default: | default: | ||||
$timestamp = 0; | $timestamp = 0; | ||||
break; | break; | ||||
} | } | ||||
if ( isset($params['format']) ) { | if ( isset($params['format']) ) { | ||||
$format = $params['format']; | $format = $params['format']; | ||||
if ( preg_match("/_regional_(.*)/", $format, $regs) ) { | if ( preg_match("/_regional_(.*)/", $format, $regs) ) { | ||||
Lint: Squiz.Strings.DoubleQuoteUsage.NotRequired: String "/_regional_(.*)/" does not require double quotes; use single quotes instead | |||||
/** @var LanguagesItem $lang */ | |||||
$lang = $this->Application->recallObject('lang.current'); | $lang = $this->Application->recallObject('lang.current'); | ||||
/* @var $lang LanguagesItem */ | |||||
$format = $lang->GetDBField($regs[1]); | $format = $lang->GetDBField($regs[1]); | ||||
} | } | ||||
return adodb_date($format, $timestamp); | return adodb_date($format, $timestamp); | ||||
} | } | ||||
return $timestamp; | return $timestamp; | ||||
Show All 10 Lines | |||||
$global_mark = $this->Application->getDBCache('ForcePermCacheUpdate'); | $global_mark = $this->Application->getDBCache('ForcePermCacheUpdate'); | ||||
$local_mark = $this->Application->RecallVar('PermCache_UpdateRequired'); | $local_mark = $this->Application->RecallVar('PermCache_UpdateRequired'); | ||||
if ( $global_mark || $local_mark ) { | if ( $global_mark || $local_mark ) { | ||||
$this->Application->RemoveVar('PermCache_UpdateRequired'); | $this->Application->RemoveVar('PermCache_UpdateRequired'); | ||||
$rebuild_mode = $this->Application->ConfigValue('CategoryPermissionRebuildMode'); | $rebuild_mode = $this->Application->ConfigValue('CategoryPermissionRebuildMode'); | ||||
if ( $rebuild_mode == CategoryPermissionRebuild::SILENT ) { | if ( $rebuild_mode == CategoryPermissionRebuild::SILENT ) { | ||||
/** @var kPermCacheUpdater $updater */ | |||||
$updater = $this->Application->makeClass('kPermCacheUpdater'); | $updater = $this->Application->makeClass('kPermCacheUpdater'); | ||||
/* @var $updater kPermCacheUpdater */ | |||||
$updater->OneStepRun(); | $updater->OneStepRun(); | ||||
$this->Application->HandleEvent(new kEvent('c:OnResetCMSMenuCache')); | $this->Application->HandleEvent(new kEvent('c:OnResetCMSMenuCache')); | ||||
} | } | ||||
elseif ( $rebuild_mode == CategoryPermissionRebuild::AUTOMATIC ) { | elseif ( $rebuild_mode == CategoryPermissionRebuild::AUTOMATIC ) { | ||||
// update with progress bar | // update with progress bar | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 207 Lines • ▼ Show 20 Line(s) | |||||
$width = (int)$this->Application->ConfigValue('MenuFrameWidth'); | $width = (int)$this->Application->ConfigValue('MenuFrameWidth'); | ||||
} | } | ||||
return $width > 0 ? $width : 200; | return $width > 0 ? $width : 200; | ||||
} | } | ||||
function AdminSkin($params) | function AdminSkin($params) | ||||
{ | { | ||||
/** @var SkinHelper $skin_helper */ | |||||
$skin_helper = $this->Application->recallObject('SkinHelper'); | $skin_helper = $this->Application->recallObject('SkinHelper'); | ||||
/* @var $skin_helper SkinHelper */ | |||||
return $skin_helper->AdminSkinTag($params); | return $skin_helper->AdminSkinTag($params); | ||||
} | } | ||||
/** | /** | ||||
* Prints errors, discovered during mass template compilation | * Prints errors, discovered during mass template compilation | ||||
* | * | ||||
* @param $params | * @param $params | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
*/ | */ | ||||
protected function IsParserException($params) | protected function IsParserException($params) | ||||
{ | { | ||||
return mb_strtolower($params['class']) == 'parserexception'; | return mb_strtolower($params['class']) == 'parserexception'; | ||||
} | } | ||||
function ExportData($params) | function ExportData($params) | ||||
{ | { | ||||
/** @var kCSVHelper $export_helper */ | |||||
$export_helper = $this->Application->recallObject('CSVHelper'); | $export_helper = $this->Application->recallObject('CSVHelper'); | ||||
/* @var $export_helper kCSVHelper */ | |||||
$result = $export_helper->ExportData( $this->SelectParam($params, 'var,name,field') ); | $result = $export_helper->ExportData( $this->SelectParam($params, 'var,name,field') ); | ||||
return ($result === false) ? '' : $result; | return ($result === false) ? '' : $result; | ||||
} | } | ||||
function ImportData($params) | function ImportData($params) | ||||
{ | { | ||||
/** @var kCSVHelper $import_helper */ | |||||
$import_helper = $this->Application->recallObject('CSVHelper'); | $import_helper = $this->Application->recallObject('CSVHelper'); | ||||
/* @var $import_helper kCSVHelper */ | |||||
$result = $import_helper->ImportData( $this->SelectParam($params, 'var,name,field') ); | $result = $import_helper->ImportData( $this->SelectParam($params, 'var,name,field') ); | ||||
return ($result === false) ? '' : $result; | return ($result === false) ? '' : $result; | ||||
} | } | ||||
function PrintCSVNotImportedLines($params) | function PrintCSVNotImportedLines($params) | ||||
{ | { | ||||
/** @var kCSVHelper $import_helper */ | |||||
$import_helper = $this->Application->recallObject('CSVHelper'); | $import_helper = $this->Application->recallObject('CSVHelper'); | ||||
/* @var $import_helper kCSVHelper */ | |||||
return $import_helper->GetNotImportedLines(); | return $import_helper->GetNotImportedLines(); | ||||
} | } | ||||
/** | /** | ||||
* Returns input field name to | * Returns input field name to | ||||
* be placed on form (for correct | * be placed on form (for correct | ||||
* event processing) | * event processing) | ||||
* | * | ||||
Show All 15 Lines | |||||
* in passed block | * in passed block | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
* @return string | * @return string | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
function PrintBackupDates($params) | function PrintBackupDates($params) | ||||
{ | { | ||||
/** @var BackupHelper $backup_helper */ | |||||
$backup_helper = $this->Application->recallObject('BackupHelper'); | $backup_helper = $this->Application->recallObject('BackupHelper'); | ||||
/* @var $backup_helper BackupHelper */ | |||||
$ret = ''; | $ret = ''; | ||||
$dates = $backup_helper->getBackupFiles(); | $dates = $backup_helper->getBackupFiles(); | ||||
foreach ($dates as $date) { | foreach ($dates as $date) { | ||||
$params['backuptimestamp'] = $date['filedate']; | $params['backuptimestamp'] = $date['filedate']; | ||||
$params['backuptime'] = date('F j, Y, g:i a', $date['filedate']); | $params['backuptime'] = date('F j, Y, g:i a', $date['filedate']); | ||||
$params['backupsize'] = round($date['filesize'] / 1024 / 1024, 2); // MBytes | $params['backupsize'] = round($date['filesize'] / 1024 / 1024, 2); // MBytes | ||||
▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Line(s) | |||||
// validate user credentials (browsers remembers user/password | // validate user credentials (browsers remembers user/password | ||||
// and sends them each time page is visited, so no need to save | // and sends them each time page is visited, so no need to save | ||||
// authentification result in session) | // authentification result in session) | ||||
if ( $this->Application->ConfigValue('HTTPAuthUsername') != $_SERVER['PHP_AUTH_USER'] ) { | if ( $this->Application->ConfigValue('HTTPAuthUsername') != $_SERVER['PHP_AUTH_USER'] ) { | ||||
// incorrect username | // incorrect username | ||||
return $this->_httpAuthentificate(); | return $this->_httpAuthentificate(); | ||||
} | } | ||||
/** @var kPasswordFormatter $password_formatter */ | |||||
$password_formatter = $this->Application->recallObject('kPasswordFormatter'); | $password_formatter = $this->Application->recallObject('kPasswordFormatter'); | ||||
/* @var $password_formatter kPasswordFormatter */ | |||||
if ( !$password_formatter->checkPasswordFromSetting('HTTPAuthPassword', $_SERVER['PHP_AUTH_PW']) ) { | if ( !$password_formatter->checkPasswordFromSetting('HTTPAuthPassword', $_SERVER['PHP_AUTH_PW']) ) { | ||||
// incorrect password | // incorrect password | ||||
return $this->_httpAuthentificate(); | return $this->_httpAuthentificate(); | ||||
} | } | ||||
} | } | ||||
return true; | return true; | ||||
Show All 27 Lines |
String "/_regional_(.*)/" does not require double quotes; use single quotes instead