Exemplo n.º 1
0
 public function testLogout()
 {
     $login = new rex_backend_login();
     $login->setLogin($this->login, $this->password, false);
     $this->assertTrue($login->checkLogin());
     $login->setLogout(true);
     $this->assertFalse($login->checkLogin());
 }
Exemplo n.º 2
0
 /**
  * very basic setup steps, so everything is in place for our browser-based setup wizard.
  *
  * @param string $skinAddon
  * @param string $skinPlugin
  */
 public static function init($skinAddon = 'be_style', $skinPlugin = 'redaxo')
 {
     // initial purge all generated files
     rex_delete_cache();
     // delete backend session
     rex_backend_login::deleteSession();
     // copy alle media files of the current rex-version into redaxo_media
     rex_dir::copy(rex_path::core('assets'), rex_path::assets());
     // copy skins files/assets
     rex_dir::copy(rex_path::addon($skinAddon, 'assets'), rex_path::addonAssets($skinAddon));
     rex_dir::copy(rex_path::plugin($skinAddon, $skinPlugin, 'assets'), rex_path::pluginAssets($skinAddon, $skinPlugin));
 }
Exemplo n.º 3
0
 /**
  * very basic setup steps, so everything is in place for our browser-based setup wizard.
  *
  * @param string $skinAddon
  * @param string $skinPlugin
  */
 public static function init($skinAddon = 'be_style', $skinPlugin = 'redaxo')
 {
     // initial purge all generated files
     rex_delete_cache();
     // delete backend session
     rex_backend_login::deleteSession();
     // copy alle media files of the current rex-version into redaxo_media
     rex_dir::copy(rex_path::core('assets'), rex_path::coreAssets());
     // copy skins files/assets
     $skinAddon = rex_addon::get($skinAddon);
     $skinPlugin = $skinAddon->getPlugin($skinPlugin);
     rex_dir::copy($skinAddon->getPath('assets'), $skinAddon->getAssetsPath());
     rex_dir::copy($skinPlugin->getPath('assets'), $skinPlugin->getAssetsPath());
     if (is_file($skinAddon->getPath('install.php'))) {
         $skinAddon->includeFile('install.php');
     }
     if (is_file($skinPlugin->getPath('install.php'))) {
         $skinPlugin->includeFile('install.php');
     }
 }
Exemplo n.º 4
0
<?php

/**
 * History.
 *
 * @author jan@kristinus.de
 *
 * @package redaxo5
 */
$mypage = 'history';
$history_date = rex_request('rex_history_date', 'string');
rex_perm::register('history[article_rollback]', null, rex_perm::OPTIONS);
if ($history_date != '') {
    $user = rex_backend_login::createUser();
    if (!$user) {
        throw new rex_exception('no permission');
    }
    if (!$user->hasPerm('history[article_rollback]')) {
        throw new rex_exception('no permission for the slice version');
    }
    rex_extension::register('ART_INIT', function (rex_extension_point $ep) {
        $article = $ep->getParam('article');
        if ($article instanceof rex_article_content) {
            $article->getContentAsQuery();
        }
        $article->setEval(true);
    });
    rex_extension::register('ART_SLICES_QUERY', function (rex_extension_point $ep) {
        $history_date = rex_request('rex_history_date', 'string');
        $history_revision = rex_request('history_revision', 'int', 0);
        $article = $ep->getParam('article');
Exemplo n.º 5
0
    setlocale(LC_ALL, trim($I18N->msg('setlocale')));
    header('Content-Type: text/html; charset=' . $I18N->msg('htmlcharset'));
    $page_name = $I18N->msg('setup');
    $page = 'setup';
} else {
    // ----------------- CREATE LANG OBJ
    $I18N = rex_create_lang($REX['LANG']);
    $locale = trim($I18N->msg('setlocale'));
    $charset = trim($I18N->msg('htmlcharset'));
    $charset_alt = str_replace('iso-', 'iso', $charset);
    setlocale(LC_ALL, $locale . '.' . $charset, $locale . '.' . $charset_alt, $locale);
    header('Content-Type: text/html; charset=' . $I18N->msg('htmlcharset'));
    header('Cache-Control: no-cache');
    header('Pragma: no-cache');
    // ---- prepare login
    $REX_LOGIN = new rex_backend_login($REX['TABLE_PREFIX'] . 'user');
    $REX_ULOGIN = rex_post('REX_ULOGIN', 'string');
    $REX_UPSW = rex_post('REX_UPSW', 'string');
    if ($REX['PSWFUNC'] != '') {
        $REX_LOGIN->setPasswordFunction($REX['PSWFUNC']);
    }
    if (isset($FORM['logout']) and $FORM['logout'] == 1) {
        $REX_LOGIN->setLogout(true);
    }
    $REX_LOGIN->setLogin($REX_ULOGIN, $REX_UPSW);
    $loginCheck = $REX_LOGIN->checkLogin();
    if ($loginCheck !== true) {
        // login failed
        $FORM['loginmessage'] = $REX_LOGIN->message;
        // Fehlermeldung von der Datenbank
        if (is_string($loginCheck)) {
Exemplo n.º 6
0
 /**
  * Handles autoloading of classes.
  *
  * @param string $class A class name.
  *
  * @return bool Returns true if the class has been loaded
  */
 public static function autoload($class)
 {
     // class already exists
     if (self::classExists($class)) {
         return true;
     }
     $force = false;
     $lowerClass = strtolower($class);
     if (isset(self::$classes[$lowerClass])) {
         // we have a class path for the class, let's include it
         if (is_readable(self::$classes[$lowerClass])) {
             require_once self::$classes[$lowerClass];
             if (self::classExists($class)) {
                 return true;
             }
         }
         // there is a class path in cache, but the file does not exist or does not contain the class any more
         // but maybe the class exists in another already known file now
         // so all files have to be analysed again => $force reload
         $force = true;
         unset(self::$classes[$lowerClass]);
         self::$cacheChanged = true;
     }
     // Return true if class exists after calling $composerLoader
     if (self::$composerLoader->loadClass($class) && self::classExists($class)) {
         return true;
     }
     // Class not found, so reanalyse all directories if not already done or if $force==true
     // but only if an admin is logged in
     if ((!self::$reloaded || $force) && ($user = rex_backend_login::createUser()) && $user->isAdmin()) {
         self::reload($force);
         return self::autoload($class);
     }
     return false;
 }
Exemplo n.º 7
0
 /**
  * Handles a error message.
  *
  * @param int    $errno   The error code to handle
  * @param string $errstr  The error message
  * @param string $errfile The file in which the error occured
  * @param int    $errline The line of the file in which the error occured
  *
  * @throws ErrorException
  */
 public static function handleError($errno, $errstr, $errfile, $errline)
 {
     if (in_array($errno, [E_USER_ERROR, E_ERROR, E_COMPILE_ERROR, E_RECOVERABLE_ERROR, E_PARSE])) {
         throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
     } elseif ((error_reporting() & $errno) == $errno) {
         if (ini_get('display_errors') && (rex::isSetup() || rex::isDebugMode() || ($user = rex_backend_login::createUser()) && $user->isAdmin())) {
             echo '<div><b>' . self::getErrorType($errno) . "</b>: {$errstr} in <b>{$errfile}</b> on line <b>{$errline}</b></div>";
         }
         rex_logger::logError($errno, $errstr, $errfile, $errline);
     }
 }
Exemplo n.º 8
0
Arquivo: boot.php Projeto: eaCe/redaxo
 * Version.
 *
 * @author jan@kristinus.de
 *
 * @package redaxo5
 */
$mypage = 'version';
rex_perm::register('version[live_version]', null, rex_perm::OPTIONS);
// ***** an EPs andocken
rex_extension::register('ART_INIT', function (rex_extension_point $ep) {
    $version = rex_request('rex_version', 'int');
    if ($version != 1) {
        return;
    }
    rex_login::startSession();
    if (!rex_backend_login::hasSession()) {
        throw new rex_exception('no permission for the working version');
    }
    $article = $ep->getParam('article');
    $article->setSliceRevision($version);
    if ($article instanceof rex_article_content) {
        $article->getContentAsQuery();
    }
    $article->setEval(true);
});
rex_extension::register('PAGE_CONTENT_HEADER', function (rex_extension_point $ep) {
    $params = $ep->getParams();
    $return = '';
    $rex_version_article = rex::getProperty('login')->getSessionVar('rex_version_article');
    if (!is_array($rex_version_article)) {
        $rex_version_article = [];
Exemplo n.º 9
0
<?php

if (!rex::isBackend()) {
    if ($this->getConfig('status') != 'deaktiviert') {
        $session = rex_backend_login::hasSession();
        if (!$session) {
            header('Location: ' . $this->getConfig('url'));
            exit;
        }
    }
}