Exemplo n.º 1
0
 static function render()
 {
     $Page = self::PageFromRequest();
     if (!$Page->is()) {
         // search for redirect
         $sql = "SELECT * FROM page_redirect WHERE request = " . D()->quote(appRequestUri) . " ";
         if ($vs = D()->row($sql)) {
             if (is_numeric($vs['redirect'])) {
                 $url = $_SERVER['SCHEME'] . '://' . $_SERVER['HTTP_HOST'] . Page($vs['redirect'])->url();
             } else {
                 $url = $vs['redirect'];
             }
             header('HTTP/1.1 301');
             // better 302 (temporary)?
             header('Location: ' . $url);
             abort();
         }
         // not found
         header("HTTP/1.1 404 Not Found");
         $Page = Page(G()->SET['cms']['pageNotFound']->v);
     }
     self::$MainPage = self::$RequestedPage = $Page;
     if (!self::$MainPage->access()) {
         // no access
         header("HTTP/1.1 401 Unauthorized");
         self::$MainPage = Page(G()->SET['cms']['pageNoAccess']->v);
     }
     globalTemplate(appPATH . 'qg/html-template.php');
     html::$content .= Page()->get();
     if (self::$MainPage->access() > 1) {
         html::addBodyFile(sysPATH . 'cms/view/frontend.php');
     }
     D()->log->Entry(liveLog::$id)->page_id = Page();
     qg::fire('cms-ready');
 }
Exemplo n.º 2
0
<?php

qg::on('action', function () {
    if (strpos(appRequestUri, 'editor/') === 0 && isset($_GET['file'])) {
        /* wird bereits geprüft zzz
        			if (!isset($_GET['file'])) {
                      echo 'no file'; exit();
                    }
                    */
        $file = urldecode($_GET['file']);
        if (!isset($_SESSION['fileEditor']['allow'][$file]) && !Usr()->superuser) {
            echo 'no access';
            exit;
        }
        !is_dir(dirname($file)) && mkdir(dirname($file));
        !is_file($file) && touch($file);
        if ($ask = G()->ASK) {
            $done = 0;
            if (isset($ask['save']) && is_file($file)) {
                copy($file, appPATH . 'cache/tmp/pri/fileEditorBackup_' . urlencode($file) . '_' . date('dmYhi'));
                if (file_put_contents($file, $ask['save']) && is_writable($file)) {
                    $done = 1;
                }
            }
            Answer($done);
        }
        globalTemplate(sysPATH . 'fileEditor/view/html-template.php');
        include sysPATH . 'fileEditor/view/codemirror.php';
        exit;
    }
});