Commit c0a4603c authored by Marianne's avatar Marianne

fonctions redirect

parent e66b518a
......@@ -5,4 +5,5 @@ RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ index.php?page=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
\ No newline at end of file
RewriteCond %{REQUEST_FILENAME} !-d
deny from all
\ No newline at end of file
<script type="text/javascript" src="assets/js/lib/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="assets/js/lib/opentype.min.js"></script>
<script type="text/javascript" src="assets/js/lib/jquery-wheelcolorpicker/jquery.wheelcolorpicker.js"></script>
<script type="text/javascript" src="assets/js/functions.js"></script>
<script type="text/javascript" src="assets/js/main.js"></script>
<?= $templates->setScripts() ?>
</body>
</html>
......@@ -8,5 +8,4 @@
<link type="text/css" rel="stylesheet" href="js/lib/jquery-wheelcolorpicker/wheelcolorpicker.css" />
</head>
<body class="<?= $routes->current()->uid ?>">
<?= $templates->setNav(); ?>
<?php if($debug == true) ini_set('display_errors', 'On'); ?>
<?php $templates->setNav(); ?>
<?php include("typotheque/launch.php"); ?>
<?php include('inc/head.php') ?>
<?php include('site/inc/head.php') ?>
<div id="content" class="apropos">
......@@ -18,4 +17,4 @@
</div>
</div>
<?php include('inc/foot.php') ?>
<?php include('site/inc/foot.php') ?>
deny from all
\ No newline at end of file
......@@ -24,18 +24,12 @@ class Routes{
exit();
}
public function set404(){
header("HTTP/1.0 404 Not Found");
exit();
}
public function current(){
$url = $_SERVER['REQUEST_URI'];
$page = substr($url, strrpos($url, "/")+1);
$this->uid = $page;
$this->uid = ($page == "") ? "index" : $page;
$this->url = $url;
return $this;
......
......@@ -2,7 +2,7 @@
class Templates extends Strings{
public $frontPages = ["index","apropos","specimen"];
public $frontPages = ["index","apropos","specimen", "typotheque"];
public $backPages = ["upload","check","write","modify","log"];
public $errorPages = ["404"];
......@@ -10,14 +10,29 @@ class Templates extends Strings{
$uid = $this->current()->uid;
return (!in_array($uid, $this->backPages) && !in_array($uid, $this->errorPages)) ? include("site/inc/nav.php") : false;
return (in_array($uid, $this->frontPages)) ? include("site/inc/nav.php") : false;
}
public function writeScriptLinks($scripts){
$loads = [];
$path = "assets/js/";
foreach($scripts as $script) {
$loads [] = '<script type="text/javascript" src="'.$path.$script.'.js"></script>';
}
return implode("\n", $loads);
}
public function setScripts(){
$uid = $this->current()->uid;
$both = ["opentype.min"];
$frontScripts = ["jquery-2.1.1.min"];
$page = $this->current()->uid;
$front = ["lib/opentype.min","lib/jquery-2.1.1.min","lib/jquery-wheelcolorpicker/jquery.wheelcolorpicker","functions","main"];
$back = ["lib/opentype.min","upload"];
return (in_array($uid, $this->frontPages)) ? $this->writeScriptLinks($front) : $this->writeScriptLinks($back);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment