Esempio n. 1
0
 public function envoyer()
 {
     // Yeeeeeeeeeeeeeeeeeeeeeeha ! Et on envoie !
     if ($this->type == "page") {
         echo Squelette::enrober($this);
     } else {
         if ($this->type == "sendfile") {
             Système_fichiers::envoyer_fichier_directement($this->sendfile_fichier);
         } else {
             if ($this->type == "sendprop") {
                 Stockage::get_prop_sendfile($this->sendprop_chemin, $this->sendprop_prop);
             } else {
                 if ($this->type == "raw") {
                     header("Content-Type: " . $this->raw_mime);
                     echo $this->raw_données;
                 } else {
                     if ($this->type == "redirect") {
                         header("Location: " . $this->redirect_destination);
                         /*echo "TODO : Redirection vers <a href=\""
                         		. $this->redirect_destination . "\">"
                         		. $this->redirect_destination . "</a>";*/
                     }
                 }
             }
         }
     }
     // TODO : else erreur
 }
Esempio n. 2
0
            Utils::redirect('/admin/config/site.php?ok');
        } catch (UserException $e) {
            $error = $e->getMessage();
        }
    }
}
if (Utils::get('edit')) {
    $source = Squelette::getSource(Utils::get('edit'));
    if (!$source) {
        throw new UserException("Ce squelette n'existe pas.");
    }
    $csrf_key = 'edit_skel_' . md5(Utils::get('edit'));
    if (Utils::post('save')) {
        if (!Utils::CSRF_check($csrf_key)) {
            $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
        } else {
            if (Squelette::editSource(Utils::get('edit'), Utils::post('content'))) {
                Utils::redirect('/admin/config/site.php?edit=' . rawurlencode(Utils::get('edit')) . '&ok');
            } else {
                $error = "Impossible d'enregistrer le squelette.";
            }
        }
    }
    $tpl->assign('edit', ['file' => trim(Utils::get('edit')), 'content' => $source]);
    $tpl->assign('csrf_key', $csrf_key);
    $tpl->assign('sources_json', json_encode(Squelette::listSources()));
} else {
    $tpl->assign('sources', Squelette::listSources());
}
$tpl->assign('error', $error);
$tpl->display('admin/config/site.tpl');
Esempio n. 3
0
<?php

namespace Garradin;

require __DIR__ . '/_inc.php';
$squelette = new Squelette();
$squelette->dispatchURI();
 public static function enrober($page)
 {
     return '' . Squelette::en_tete($page) . $page->contenu . Squelette::pied($page);
 }