Ejemplo n.º 1
0
    function show()
    {
        if (!Login::check_login($this->system)) {
            $page = new Seite($this->system, $this->login_tpl);
            $login = new Login($this->system);
            return $page->header() . $login->show() . $page->footer();
        }
        preg_match("/Admin\\/([^\\/|?|#]*)/", $_SERVER['REQUEST_URI'], $m);
        $this->modul = $m[1];
        $installed_modules = $this->connection->db_assoc("SELECT * FROM `RheinaufCMS>Module` WHERE `Backend` != '' ORDER BY `id` ASC");
        for ($i = 0; $i < count($installed_modules); $i++) {
            $this->installed_modules[$installed_modules[$i]['sysID']] = $installed_modules[$i];
        }
        if (!$_SESSION['RheinaufCMS_User']['allowed_actions']) {
            unset($_SESSION['RheinaufCMS_User']);
            $page = new Seite($this->system, $this->login_tpl);
            $login = new Login($this->system);
            return $page->header() . $login->show('Entschuldigung, Sie haben nicht die Erforderlichen Rechte.') . $page->footer();
        }
        if ($_SESSION['RheinaufCMS_User']['Group'] == 'dev') {
            for ($i = 0; $i < count($installed_modules); $i++) {
                $allowed_modules[] = $installed_modules[$i]['sysID'];
            }
            $_SESSION['RheinaufCMS_User']['allowed_modules'] = $this->allowed_modules = $allowed_modules;
        } else {
            $allowed_modules_sql = "SELECT  * FROM `RheinaufCMS>Rechte` WHERE `id` = '" . implode("' OR `id` ='", $_SESSION['RheinaufCMS_User']['allowed_actions']) . "' ";
            $allowed_modules = $this->connection->db_assoc($allowed_modules_sql);
            $this->allowed_modules = array();
            for ($i = 0; $i < count($allowed_modules); $i++) {
                $this->allowed_modules[] = $allowed_modules[$i]['ModulName'];
            }
            $this->allowed_modules = array_unique($this->allowed_modules);
            if (count($this->allowed_modules) == 0) {
                $this->login('', $this->login_tpl);
            }
            $_SESSION['RheinaufCMS_User']['allowed_modules'] = $this->allowed_modules;
        }
        if ($this->modul != '') {
            $return = '';
            //print_r($this->installed_modules);
            $class = $this->modul;
            include INSTALL_PATH . '/' . $this->installed_modules[$class]['Backend'];
            if (!class_exists($class)) {
                $return = 'Modul nicht installiert';
            } else {
                $instance = new $class($this->system);
                $return .= $instance->show();
            }
            $this->scripts = isset($instance->scripts) ? $instance->scripts : '';
        }
        if ($this->system->backend->tabs) {
            $return = Html::div(Html::span($this->system->backend->tabs), array('id' => 'admin_tabs')) . $return;
        }
        if ($this->system->noframe || isset($_GET['noframe'])) {
            return $return;
        }
        $this->system->noframe = true;
        $page = new Html(PROJECT_NAME . ' - Verwaltungsbereich');
        $page->stylesheet('/CSS/Admin.css');
        $page->custom('
		<!-- compliance patch for microsoft browsers -->
<!--[if lt IE 7]>
<script src="/Libraries/IE7/ie7-standard-p.js" type="text/javascript">
</script>
<![endif]-->
		');
        if ($GLOBALS['other_css']) {
            $page->header_string .= $GLOBALS['other_css'];
        }
        if ($GLOBALS['scripts']) {
            $page->header_string .= $GLOBALS['scripts'];
        }
        if (!$GLOBALS['http_request_scripts']) {
            $page->header_string .= Html::script('', array('src' => '/Scripts/XMLHttpRequest.js'));
            $GLOBALS['http_request_scripts'] = true;
        }
        $page->header_string .= Html::script('     	function pinghome ()
	     	{
	     		var url = location.protocol + "/"+"/"+ location.host +"/Admin?ping";
	     		httpRequestGET (url,function(){
	     		setTimeout(pinghome,120000);
	     		}, false)
	     	}
	     	setTimeout(pinghome,120000);');
        if (isset($_GET['nomenu'])) {
            $page->div($return, array('id' => 'content'));
            return $page->flush_page();
        } else {
            $user = $this->system->user['Name'];
            $logout = Html::span("Guten Tag, " . $user . ' ' . Html::a('?logout=' . rawurlencode($user), ' logout'), array('id' => 'logout'));
            $page->div(Html::span($this->system->backend->top) . $logout, array('id' => 'admin_top'));
            $page->div('', array('id' => 'lo_logo'));
            $page->div('', array('id' => 'menu_appendix'));
            $page->custom($this->admin_menu());
            $page->div(Html::div($this->installed_modules[$class]['Name'], array('id' => 'module_name')) . $return . '<br style="clear:both />', array('id' => 'content', 'class' => 'admin content'));
            return $page->flush_page();
        }
    }
 function login($meldung = '', $template = '')
 {
     die('DEPRECATED LOGIN METHOD: ' . __FILE__ . ' ' . __LINE__);
     if (!isset($_SESSION)) {
         session_start();
     }
     if (isset($_POST['user']) && isset($_POST['pass']) && $this->check_login()) {
         return true;
     }
     $vars['uuid'] = $_SESSION['uuid'] = General::uuid();
     if (defined('HTTPS') && HTTPS && !isset($_SERVER['HTTPS'])) {
         header("Location: " . 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
     }
     $page = new Seite($this, $template);
     $login_form = new Template(INSTALL_PATH . '/Templates/Login.template.html');
     $meldungen = Template::get_all_parts($login_form->template);
     $vars['meldung'] = $meldungen[$meldung] ? $meldungen[$meldung] : $meldung;
     $vars['action'] = SELF_URL;
     $vars['title'] = $this->seite != 'index' ? $this->rubrik . ' | ' . $this->seite : $this->rubrik;
     if ($navi) {
         $navi = new Navi($this);
         $vars['navi'] = $navi->rubriken();
     }
     if (!isset($_POST['user']) || !isset($_POST['pass'])) {
         $vars['meldung'] .= Html::br() . $meldungen['KENNWORT_EINGEBEN'];
         die($page->header($vars) . Html::div($login_form->parse_template('FORM', $vars)) . $page->footer($vars));
     } else {
         if ($this->check_login()) {
             //if (HTTPS) header("Location: ".'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
             header("Location: " . 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
         } else {
             die($page->header($vars) . Html::div($login_form->parse_template('FORM', $vars)) . $page->footer($vars));
         }
     }
 }
 function login($meldung = '', $navi = true)
 {
     $page = new Seite($this->path_information);
     $login_form = new Template(INSTALL_PATH . '/Templates/Login.template.html');
     $meldungen = Template::get_all_parts($login_form->template);
     $vars['meldung'] = $meldungen[$meldung] ? $meldungen[$meldung] : $meldung;
     $vars['action'] = SELF;
     if (isset($_GET['logout'])) {
         $vars['user'] = $_GET['logout'];
         $vars['meldung'] = $login_form->parse_template('LOGOUT-MELDUNG', $vars);
     }
     $vars['title'] = $this->seite != 'index' ? $this->rubrik . ' | ' . $this->seite : $this->rubrik;
     if ($navi) {
         $navi = new Navi($this->path_information, $this->navi);
         $vars['navi'] = $navi->rubriken();
     }
     if (!isset($_POST['user']) || !isset($_POST['pass'])) {
         $vars['meldung'] .= Html::br() . $meldungen['KENNWORT_EINGEBEN'];
         die($page->header($vars) . Html::div($login_form->parse_template('FORM', $vars)) . $page->footer($vars));
     } else {
         if ($this->check_login()) {
             header("Location: " . 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
         } else {
             die($page->header($vars) . Html::div($login_form->parse_template('FORM', $vars)) . $page->footer($vars));
         }
     }
 }