Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/processors/main_processor.php
Show All 14 Lines | |||||
defined('FULL_PATH') or die('restricted access!'); | defined('FULL_PATH') or die('restricted access!'); | ||||
class kMainTagProcessor extends kTagProcessor { | class kMainTagProcessor extends kTagProcessor { | ||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
parent::__construct(); | parent::__construct(); | ||||
/** @var Params $actions */ | |||||
$actions = $this->Application->recallObject('kActions'); | $actions = $this->Application->recallObject('kActions'); | ||||
/* @var $actions Params */ | |||||
$actions->Set('t', $this->Application->GetVar('t')); | $actions->Set('t', $this->Application->GetVar('t')); | ||||
$actions->Set('sid', $this->Application->GetSID()); | $actions->Set('sid', $this->Application->GetSID()); | ||||
$actions->Set('m_opener', $this->Application->GetVar('m_opener') ); | $actions->Set('m_opener', $this->Application->GetVar('m_opener') ); | ||||
} | } | ||||
/** | /** | ||||
* Base folder for all template includes | * Base folder for all template includes | ||||
▲ Show 20 Lines • Show All 440 Lines • ▼ Show 20 Line(s) | |||||
if ( isset($params['formatted']) && $params['formatted'] ) { | if ( isset($params['formatted']) && $params['formatted'] ) { | ||||
$sql = 'SELECT ValueList | $sql = 'SELECT ValueList | ||||
FROM ' . TABLE_PREFIX . 'SystemSettings | FROM ' . TABLE_PREFIX . 'SystemSettings | ||||
WHERE VariableName = ' . $this->Conn->qstr($config_name) . ' AND ElementType IN ("select", "radio")'; | WHERE VariableName = ' . $this->Conn->qstr($config_name) . ' AND ElementType IN ("select", "radio")'; | ||||
$value_list = $this->Conn->GetOne($sql); | $value_list = $this->Conn->GetOne($sql); | ||||
if ( $value_list ) { | if ( $value_list ) { | ||||
/** @var InpCustomFieldsHelper $helper */ | |||||
$helper = $this->Application->recallObject('InpCustomFieldsHelper'); | $helper = $this->Application->recallObject('InpCustomFieldsHelper'); | ||||
/* @var $helper InpCustomFieldsHelper */ | |||||
$options = $helper->GetValuesHash($value_list); | $options = $helper->GetValuesHash($value_list); | ||||
$ret = isset($options[$ret]) ? $options[$ret] : $ret; | $ret = isset($options[$ret]) ? $options[$ret] : $ret; | ||||
} | } | ||||
} | } | ||||
if ( isset($params['as_label']) && $params['as_label'] ) { | if ( isset($params['as_label']) && $params['as_label'] ) { | ||||
$ret = $this->Application->Phrase($ret); | $ret = $this->Application->Phrase($ret); | ||||
Show All 22 Lines | |||||
* needed for kernel_form | * needed for kernel_form | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
* @return string | * @return string | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected function DumpSystemInfo($params) | protected function DumpSystemInfo($params) | ||||
{ | { | ||||
/** @var Params $actions */ | |||||
$actions = $this->Application->recallObject('kActions'); | $actions = $this->Application->recallObject('kActions'); | ||||
/* @var $actions Params */ | |||||
$actions->Set('t', $this->Application->GetVar('t')); | $actions->Set('t', $this->Application->GetVar('t')); | ||||
$o = ''; | $o = ''; | ||||
$params = $actions->GetParams(); | $params = $actions->GetParams(); | ||||
foreach ($params AS $name => $val) { | foreach ($params AS $name => $val) { | ||||
$o .= "<input type='hidden' name='$name' id='$name' value='$val'>\n"; | $o .= "<input type='hidden' name='$name' id='$name' value='$val'>\n"; | ||||
Show All 11 Lines | |||||
*/ | */ | ||||
protected function GetFormHiddens($params) | protected function GetFormHiddens($params) | ||||
{ | { | ||||
$t = $this->SelectParam($params, 'template,t'); | $t = $this->SelectParam($params, 'template,t'); | ||||
unset($params['template']); | unset($params['template']); | ||||
$form_fields = Array (); | $form_fields = Array (); | ||||
if ( $this->Application->RewriteURLs() ) { | if ( $this->Application->RewriteURLs() ) { | ||||
/** @var Session $session */ | |||||
$session = $this->Application->recallObject('Session'); | $session = $this->Application->recallObject('Session'); | ||||
/* @var $session Session */ | |||||
if ( $session->NeedQueryString() ) { | if ( $session->NeedQueryString() ) { | ||||
$form_fields['sid'] = $this->Application->GetSID(); | $form_fields['sid'] = $this->Application->GetSID(); | ||||
} | } | ||||
} | } | ||||
else { | else { | ||||
$form_fields['env'] = $this->Application->BuildEnv($t, $params, 'm', false, false); | $form_fields['env'] = $this->Application->BuildEnv($t, $params, 'm', false, false); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | |||||
$default_translation = $this->SelectParam($params, 'default'); | $default_translation = $this->SelectParam($params, 'default'); | ||||
$no_editing = isset($params['no_editing']) && $params['no_editing']; | $no_editing = isset($params['no_editing']) && $params['no_editing']; | ||||
$translation = $this->Application->Phrase($phrase_name, !$no_editing); | $translation = $this->Application->Phrase($phrase_name, !$no_editing); | ||||
$phrase_key = mb_strtoupper($phrase_name); | $phrase_key = mb_strtoupper($phrase_name); | ||||
if ( $default_translation && strpos($translation, '!' . $phrase_key . '!') !== false ) { | if ( $default_translation && strpos($translation, '!' . $phrase_key . '!') !== false ) { | ||||
/** @var kDBItem $phrase */ | |||||
$phrase = $this->Application->recallObject('phrases.autocreate', null, Array ('skip_autoload' => true)); | $phrase = $this->Application->recallObject('phrases.autocreate', null, Array ('skip_autoload' => true)); | ||||
/* @var $phrase kDBItem */ | |||||
if ( !$phrase->Load($phrase_key, 'PhraseKey') ) { | if ( !$phrase->Load($phrase_key, 'PhraseKey') ) { | ||||
$phrase->SetDBField('Phrase', $phrase_name); | $phrase->SetDBField('Phrase', $phrase_name); | ||||
/** @var kMultiLanguageHelper $ml_helper */ | |||||
$ml_helper = $this->Application->recallObject('kMultiLanguageHelper'); | $ml_helper = $this->Application->recallObject('kMultiLanguageHelper'); | ||||
/* @var $ml_helper kMultiLanguageHelper */ | |||||
$languages = $ml_helper->getLanguages(); | $languages = $ml_helper->getLanguages(); | ||||
foreach ($languages AS $language_id) { | foreach ($languages AS $language_id) { | ||||
$phrase->SetDBField('l' . $language_id . '_Translation', $default_translation); | $phrase->SetDBField('l' . $language_id . '_Translation', $default_translation); | ||||
} | } | ||||
if ( $phrase->Create() ) { | if ( $phrase->Create() ) { | ||||
▲ Show 20 Lines • Show All 210 Lines • ▼ Show 20 Line(s) | |||||
/** | /** | ||||
* Allows to check if permission exists directly in template and perform additional actions if required | * Allows to check if permission exists directly in template and perform additional actions if required | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
* @return bool | * @return bool | ||||
*/ | */ | ||||
function CheckPermission($params) | function CheckPermission($params) | ||||
{ | { | ||||
/** @var kPermissionsHelper $perm_helper */ | |||||
$perm_helper = $this->Application->recallObject('PermissionsHelper'); | $perm_helper = $this->Application->recallObject('PermissionsHelper'); | ||||
/* @var $perm_helper kPermissionsHelper */ | |||||
return $perm_helper->TagPermissionCheck($params); | return $perm_helper->TagPermissionCheck($params); | ||||
} | } | ||||
/** | /** | ||||
* Checks if user is logged in and if not redirects it to template passed | * Checks if user is logged in and if not redirects it to template passed | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
*/ | */ | ||||
function RequireLogin($params) | function RequireLogin($params) | ||||
{ | { | ||||
$t = $this->Application->GetVar('t'); | $t = $this->Application->GetVar('t'); | ||||
$next_t = getArrayValue($params, 'next_template'); | $next_t = getArrayValue($params, 'next_template'); | ||||
if ( $next_t ) { | if ( $next_t ) { | ||||
$t = $next_t; | $t = $next_t; | ||||
} | } | ||||
// check by permissions: begin | // check by permissions: begin | ||||
if ((isset($params['perm_event']) && $params['perm_event']) || | if ((isset($params['perm_event']) && $params['perm_event']) || | ||||
(isset($params['perm_prefix']) && $params['perm_prefix']) || | (isset($params['perm_prefix']) && $params['perm_prefix']) || | ||||
(isset($params['permissions']) && $params['permissions'])) { | (isset($params['permissions']) && $params['permissions'])) { | ||||
/** @var kPermissionsHelper $perm_helper */ | |||||
$perm_helper = $this->Application->recallObject('PermissionsHelper'); | $perm_helper = $this->Application->recallObject('PermissionsHelper'); | ||||
/* @var $perm_helper kPermissionsHelper */ | |||||
$perm_status = $perm_helper->TagPermissionCheck($params); | $perm_status = $perm_helper->TagPermissionCheck($params); | ||||
if (!$perm_status) { | if (!$perm_status) { | ||||
list($redirect_template, $redirect_params) = $perm_helper->getPermissionTemplate($params); | list($redirect_template, $redirect_params) = $perm_helper->getPermissionTemplate($params); | ||||
$this->Application->Redirect($redirect_template, $redirect_params); | $this->Application->Redirect($redirect_template, $redirect_params); | ||||
} | } | ||||
else { | else { | ||||
return ; | return ; | ||||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | |||||
} | } | ||||
} | } | ||||
if ( EDITING_MODE ) { | if ( EDITING_MODE ) { | ||||
// match SSL mode on front-end to one in administrative console, when browse modes are used | // match SSL mode on front-end to one in administrative console, when browse modes are used | ||||
$require = $this->Application->ConfigValue('Require_AdminSSL'); | $require = $this->Application->ConfigValue('Require_AdminSSL'); | ||||
} | } | ||||
/** @var kHTTPQuery $http_query */ | |||||
$http_query = $this->Application->recallObject('HTTPQuery'); | $http_query = $this->Application->recallObject('HTTPQuery'); | ||||
/* @var $http_query kHTTPQuery */ | |||||
$pass = $http_query->getRedirectParams(); | $pass = $http_query->getRedirectParams(); | ||||
$pass['pass_events'] = 1; // to make sure all events are passed when redirect happens | $pass['pass_events'] = 1; // to make sure all events are passed when redirect happens | ||||
if ( $require ) { | if ( $require ) { | ||||
if ( PROTOCOL == 'https://' ) { | if ( PROTOCOL == 'https://' ) { | ||||
$this->Application->SetVar('__KEEP_SSL__', 1); | $this->Application->SetVar('__KEEP_SSL__', 1); | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | |||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
*/ | */ | ||||
function AttachFile($params) | function AttachFile($params) | ||||
{ | { | ||||
$path = FULL_PATH . '/' . $params['path']; | $path = FULL_PATH . '/' . $params['path']; | ||||
$pseudo = isset($params['special']) ? 'EmailSender.' . $params['special'] : 'EmailSender'; | $pseudo = isset($params['special']) ? 'EmailSender.' . $params['special'] : 'EmailSender'; | ||||
/** @var kEmailSendingHelper $esender */ | |||||
$esender = $this->Application->recallObject($pseudo); | $esender = $this->Application->recallObject($pseudo); | ||||
/* @var $esender kEmailSendingHelper */ | |||||
if ( file_exists($path) && is_file($path) ) { | if ( file_exists($path) && is_file($path) ) { | ||||
$esender->AddAttachment($path); | $esender->AddAttachment($path); | ||||
} | } | ||||
} | } | ||||
function CaptchaImage($params) | function CaptchaImage($params) | ||||
{ | { | ||||
$this->NoDebug($params); | $this->NoDebug($params); | ||||
$this->Application->SetVar('skip_last_template', 1); | $this->Application->SetVar('skip_last_template', 1); | ||||
/** @var kCaptchaHelper $captcha_helper */ | |||||
$captcha_helper = $this->Application->recallObject('CaptchaHelper'); | $captcha_helper = $this->Application->recallObject('CaptchaHelper'); | ||||
/* @var $captcha_helper kCaptchaHelper */ | |||||
// generate captcha code | // generate captcha code | ||||
$code = $captcha_helper->prepareCode( $this->Application->GetVar('var') ); | $code = $captcha_helper->prepareCode( $this->Application->GetVar('var') ); | ||||
$captcha_helper->GenerateCaptchaImage($code, $this->Application->GetVar('w'), $this->Application->GetVar('h'), true); | $captcha_helper->GenerateCaptchaImage($code, $this->Application->GetVar('w'), $this->Application->GetVar('h'), true); | ||||
} | } | ||||
function SID($params) | function SID($params) | ||||
▲ Show 20 Lines • Show All 137 Lines • Show Last 20 Lines |