commit 7f52f1959dd1abc648978fbb116dcddc4f6abef7
parent ad621ea0d280abc0c7a5d6fe1cdf2a0b81a27319
Author: Jan Dankert <develop@jandankert.de>
Date: Sat, 31 Oct 2020 13:54:19 +0100
Cleanup: Use constants for session keys.
Diffstat:
5 files changed, 14 insertions(+), 37 deletions(-)
diff --git a/modules/cms/action/Action.class.php b/modules/cms/action/Action.class.php
@@ -41,7 +41,11 @@ class Action
public $security = self::SECURITY_USER; // Default.
- protected $templateVars = array( 'output'=>array() );
+ protected $templateVars = [
+ 'errors' => [],
+ 'notices' => [],
+ 'output' => []
+ ];
/**
* Aktuell angemeldeter Benutzer.<br>
@@ -58,7 +62,7 @@ class Action
/**
- * Will be called by the Dispatcher right after the contruction of this class instance.
+ * Will be called by the Dispatcher right after the conStruction of this class instance.
*/
public function init()
{
@@ -69,10 +73,6 @@ class Action
public function __construct()
{
$this->currentUser = Session::getUser();
-
- $this->templateVars['errors'] = array();
- $this->templateVars['notices'] = array();
- $this->templateVars['output'] = array();
}
/**
diff --git a/modules/cms/action/LoginAction.class.php b/modules/cms/action/LoginAction.class.php
@@ -1058,7 +1058,7 @@ class LoginAction extends BaseAction
{
srand ((double)microtime()*1000003);
$code = rand();
- $this->setSessionVar("password_commit_code",$code);
+ $this->setSessionVar(Session::KEY_PASSWORD_COMMIT_CODE,$code);
$eMail = new Mail( $user->mail,'password_commit_code' );
$eMail->setVar('name',$user->getName());
@@ -1079,7 +1079,7 @@ class LoginAction extends BaseAction
}
- $this->setSessionVar("password_commit_name",$user->name);
+ $this->setSessionVar(Session::KEY_PASSWORD_COMMIT_NAME,$user->name);
}
@@ -1099,10 +1099,10 @@ class LoginAction extends BaseAction
*/
function passwordcodePost()
{
- $username = $this->getSessionVar("password_commit_name");
+ $username = $this->getSessionVar(Session::KEY_PASSWORD_COMMIT_NAME);
if ( $this->getRequestVar("code")=='' ||
- $this->getSessionVar("password_commit_code") != $this->getRequestVar("code") )
+ $this->getSessionVar(Session::KEY_PASSWORD_COMMIT_CODE) != $this->getRequestVar("code") )
{
$this->addValidationError('code','PASSWORDCODE_NOT_MATCH');
return;
diff --git a/modules/cms/action/PageAction.class.php b/modules/cms/action/PageAction.class.php
@@ -158,7 +158,7 @@ class PageAction extends ObjectAction
else
{
// sonst nur 1x speichern (fuer die aktuelle Sprache)
- $value->languageid = $this->getSessionVar(RequestParams::PARAM_LANGUAGE_ID);
+ $value->languageid = $this->getRequestVar(RequestParams::PARAM_LANGUAGE_ID);
$value->save();
}
}
diff --git a/modules/cms/action/PageelementAction.class.php b/modules/cms/action/PageelementAction.class.php
@@ -414,11 +414,6 @@ class PageelementAction extends BaseAction
$this->setTemplateVar('linkname' ,$name);
$this->setTemplateVar('types',implode(',',$types));
-
- if ( $this->getSessionVar('pageaction') != '' )
- $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction'));
- else
- $this->setTemplateVar('old_pageaction','show' );
}
@@ -472,10 +467,6 @@ class PageelementAction extends BaseAction
$this->setTemplateVar('objects' ,$objects);
$this->setTemplateVar('linkobjectid',$this->value->linkToObjectId);
- if ( $this->getSessionVar('pageaction') != '' )
- $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction'));
- else $this->setTemplateVar('old_pageaction','show' );
-
$this->value->page = new Page( $this->page->objectid );
$this->value->page->languageid = $this->value->languageid;
$this->value->page->load();
@@ -497,10 +488,6 @@ class PageelementAction extends BaseAction
$this->setTemplateVar( 'items',$this->value->element->getSelectItems() );
$this->setTemplateVar( 'text' ,$this->value->text );
-
- if ( $this->getSessionVar('pageaction') != '' )
- $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction'));
- else $this->setTemplateVar('old_pageaction','show' );
}
@@ -571,10 +558,6 @@ class PageelementAction extends BaseAction
private function editnumber()
{
$this->setTemplateVar('number',$this->value->number / pow(10,$this->value->element->decimals) );
-
- if ( $this->getSessionVar('pageaction') != '' )
- $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction'));
- else $this->setTemplateVar('old_pageaction','show' );
}
@@ -604,12 +587,6 @@ class PageelementAction extends BaseAction
$this->setTemplateVar( 'text',$this->linkifyOIDs( $this->value->text ) );
- if ( $this->getSessionVar('pageaction') != '' )
- $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction'));
- else $this->setTemplateVar('old_pageaction','show' );
-
-
-
if ( $this->element->wiki && false /* OLD */ )
{
$project = new Project( $this->page->projectid );
@@ -655,9 +632,6 @@ class PageelementAction extends BaseAction
{
$this->setTemplateVar( 'text',$this->value->text );
- if ( $this->getSessionVar('pageaction') != '' )
- $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction'));
- else $this->setTemplateVar('old_pageaction','show' );
}
diff --git a/modules/util/Session.class.php b/modules/util/Session.class.php
@@ -25,6 +25,9 @@ class Session
const KEY_DB = 'database';
const KEY_USER = 'userObject';
const KEY_CONFIG = 'config';
+ const KEY_PASSWORD_COMMIT_CODE = 'password_commit_code';
+ const KEY_PASSWORD_COMMIT_NAME = 'password_commit_name';
+
const PRAEFIX = 'ors_';
public static function get($var)