File modules/cms/action/ProfileAction.class.php
Last commit: Fri Apr 15 14:51:22 2022 +0200 dankert Refactoring: User,Config and Database info is now stored in the Request, because so there is no session required for clients which are using Basic Authorization.
1 <?php 2 3 namespace cms\action; 4 5 6 // OpenRat Content Management System 7 // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de 8 // 9 // This program is free software; you can redistribute it and/or 10 // modify it under the terms of the GNU General Public License 11 // as published by the Free Software Foundation; either version 2 12 // of the License, or (at your option) any later version. 13 // 14 // This program is distributed in the hope that it will be useful, 15 // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 // GNU General Public License for more details. 18 // 19 // You should have received a copy of the GNU General Public License 20 // along with this program; if not, write to the Free Software 21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 use cms\base\Configuration; 23 use cms\base\Startup; 24 use cms\model\BaseObject; 25 use cms\model\User; 26 use language\Language; 27 use language\Messages; 28 use logger\Logger; 29 use security\Base2n; 30 use util\exception\SecurityException; 31 use util\exception\ValidationException; 32 use util\mail\Mail; 33 use util\Request; 34 use util\Session; 35 use util\UIUtils; 36 37 38 /** 39 * profile data of current user. 40 */ 41 class ProfileAction extends BaseAction 42 { 43 /** 44 * Current user. 45 * 46 * Current user or null, if no user is present. 47 * 48 * @var User|null 49 */ 50 protected $user; 51 52 /** 53 * Konstruktor. 54 * Setzen der Benutzer-Objektes. 55 */ 56 function __construct() 57 { 58 parent::__construct(); 59 60 $this->user = $this->currentUser; 61 } 62 63 64 /** 65 * Setting new language for current session. 66 * 67 * @param $languageISOcode string ISO coded language 68 */ 69 protected function setLanguage($languageISOcode ) 70 { 71 // Overwrite configuration 72 $conf = Request::getConfig(); 73 $language = new Language(); 74 $conf['language'] = $language->getLanguage($languageISOcode); 75 $conf['language']['language_code'] = $languageISOcode; 76 Request::setConfig($conf); 77 } 78 79 80 /** 81 * Theme name. 82 * 83 * Gets the theme name of the current user, or the 84 * default style if no user is present. 85 * 86 * @param User $user 87 * @return string 88 */ 89 protected function getUserStyle($user ) 90 { 91 // Gets theme for current user. 92 if ( $user && Configuration::subset('style')->has($user->style)) 93 $style = $user->style; 94 else 95 // Fallback: Default theme. 96 $style = Configuration::subset(['interface','style'])->get('default',''); 97 98 return $style; 99 } 100 101 102 /** 103 * Default permission: An authenticated user is necessary. 104 * 105 * @return void 106 */ 107 public function checkAccess() { 108 if ( !$this->user ) 109 throw new SecurityException(); 110 } 111 112 }
Downloadmodules/cms/action/ProfileAction.class.php
History Fri, 15 Apr 2022 14:51:22 +0200 dankert Refactoring: User,Config and Database info is now stored in the Request, because so there is no session required for clients which are using Basic Authorization. Wed, 9 Mar 2022 01:57:45 +0100 dankert Fix: Do not write the language to a cookie. Fri, 3 Dec 2021 23:27:44 +0100 dankert New: Only allowed methods are shown in the dropdown menu; Some security enhancements. Wed, 27 Oct 2021 02:27:59 +0200 Jan Dankert Refactoring: Splitted the mail client into a.) sendmail and b.) smtp. Sun, 14 Mar 2021 22:29:56 +0100 Jan Dankert Refactoring: Clearer access check. Wed, 18 Nov 2020 20:42:57 +0100 Jan Dankert Getting/Setting cookies with constants, this is more safe. Wed, 18 Nov 2020 00:18:10 +0100 Jan Dankert Refactoring Part 2: Removing all unnecessary methods in the action base classes. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class. Thu, 12 Nov 2020 01:12:45 +0100 Jan Dankert Fix: Workflow for changing the users email adress; Mail sending; Forwarding forms Sun, 1 Nov 2020 00:36:50 +0100 Jan Dankert Refactoring: Only using the configuration object. Sat, 31 Oct 2020 03:52:03 +0100 Jan Dankert Fix: Better detection if password change is possbile. Fri, 2 Oct 2020 23:11:48 +0200 Jan Dankert Cleanup: No '.inputholder' any more, notices with links to objects. Tue, 29 Sep 2020 22:17:11 +0200 Jan Dankert Refactoring: Do not use global constants. Sat, 26 Sep 2020 04:26:55 +0200 Jan Dankert Refactoring: read configuration values with a class. Thu, 10 Sep 2020 18:30:16 +0200 Jan Dankert Some code cleanup, killing the old "checkMenu()"-methods. Sat, 22 Aug 2020 23:13:01 +0200 Jan Dankert Security: Configuration-setting for the SameSite-Cookie-Policy. Sun, 23 Feb 2020 04:01:30 +0100 Jan Dankert Refactoring with Namespaces for the cms modules, part 1: moving.