openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit a86a69d1d3d36a175d665f6456c5830b906bd7bd
parent 8925e18074f00b47427093d1375f7be42cc42642
Author: Jan Dankert <devnull@localhost>
Date:   Sat,  9 Dec 2017 22:35:16 +0100

Kleines Korrekturen für das Benutzerprofil.

Diffstat:
action/Action.class.php | 3++-
action/ProfileAction.class.php | 42+++++++++++++++++++++++++++++-------------
2 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/action/Action.class.php b/action/Action.class.php @@ -27,7 +27,8 @@ namespace { namespace cms\action { -use \DomainException; + use cms\model\User; + use \DomainException; use \Html; use \Session; use \Logger; diff --git a/action/ProfileAction.class.php b/action/ProfileAction.class.php @@ -19,6 +19,10 @@ namespace cms\action; // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +use LogicException; +use Mail; +use security\Base2n; +use \Session; /** @@ -77,18 +81,8 @@ class ProfileAction extends Action // Ausgewählte Sprache sofort verwenden. $l = $this->getRequestVar('language'); - - $langFile = OR_LANGUAGE_DIR.'lang-'.$l.'.'.PHP_EXT; - - // Pruefen, ob Sprache vorhanden ist. - if ( !file_exists( $langFile ) ) - throw new LogicException("Languagefile $langFile does not exist."); - - require( $langFile ); - global $conf; - $conf['language'] = $lang; - $conf['language']['language_code'] = $l; - Session::setConfig( $conf ); + + $this->setLanguage($l); } @@ -293,5 +287,27 @@ class ProfileAction extends Action return true; } } - + + /** + * Setzt eine Sprache für den Benutzer. + * + * @param $l string Sprache + */ + public function setLanguage($l) + { + global $conf; + $langFile = OR_LANGUAGE_DIR . 'lang-' . $l . '.' . PHP_EXT; + + // Pruefen, ob Sprache vorhanden ist. + if (!file_exists($langFile)) + throw new LogicException("Languagefile $langFile does not exist."); + + $lang = array(); + require($langFile); // Setzt $lang + global $conf; + $conf['language'] = $lang; + $conf['language']['language_code'] = $l; + Session::setConfig($conf); + } + } \ No newline at end of file