Commit e66b518a authored by Marianne's avatar Marianne

reorganisation === rangement ++

parent 0e37bf54
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ index.php?page=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
\ No newline at end of file
<?php require("typotheque/launch.php") ?>
<?php include('inc/head.php');?>
<div id="content">
<?php
<?php
require("typotheque/launch.php");
foreach ($dirs as $dir){
if($_GET){
$files = array_diff(scandir($path.'/'.$dir), array('.', '..'));
if($routes->pageExists($_GET["page"])) {
$txtFileInfos = file_get_contents($path.'/'.$dir.'/infos.txt');
if($_GET["page"] !== "home"){
if($txtFileInfos){
include("site/pages/".$_GET["page"].".php");
// extraire les données du fichier texte (voir functions.php)
$styles = explode( ', ', extract_content($txtFileInfos, 'styles = ', ';'));
$name = extract_content($txtFileInfos, 'nom = ', ';');
$cat = extract_content($txtFileInfos, 'catégories = ', ';');
$author = extract_content($txtFileInfos, 'auteurs = ', ';');
$link = extract_content($txtFileInfos, 'lien = ', ';');
$version = extract_content($txtFileInfos, 'version = ', ';');
}else{
}
$routes->redirect($routes->index());
}
// Remplir les infos. Si fichier texte, elles viennent
// en priorité, sinon en jquery avec opentype.js
?>
}else{
<div class="fonte <?= $dir ?>" data-type="<?= strtolower($dir) ?>">
<ul class="infos">
<li class="name"><h2>Nom:</h2> <?php if($txtFileInfos && $name) echo '<span>'.$name.'</span>' ?></li>
<li class="author"><h2>Auteur(s):</h2> <?php if($txtFileInfos && $author) echo '<span>'.$author.'</span>' ?></li>
<li class="styles"><h2>Style(s):</h2> <?php if($txtFileInfos && $styles){ echo '<span>'.count($styles).'</span>'; } else { echo '<span>'.count($files).'</span>'; } ?></li>
<li class="category"><h2>Categorie(s):</h2> <?php if($txtFileInfos && $cat){ echo $cat; } else { echo '?'; } ?></li>
<li class="download"><a href="<?php if($txtFileInfos && $link) echo $link ?>" target="_blank">Download</a></li>
<li class="specimen"><a href="specimen.php?font=<?= $dir ?>">Spécimen</a></li>
</ul>
<div class="deroule">
</div>
<?php
// echo '<h1>'.$dir.'</h1>';
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
include("site/pages/404.php");
}
foreach($files as $i => $file){
$fileInfos = pathinfo($file);
$fontExt = Array('ttf', 'otf');
}else{
if( in_array($fileInfos[extension], $fontExt)){
$nameSlug = str_replace(' ', '', $fileInfos[filename]);
include("site/pages/home.php");
echo '
<style>
@font-face {
font-family: '.$nameSlug.';
src: url('.$path.'/'.$dir.'/'.$file.');
}
</style>
';
echo '<p class="sample '.$i.' '.$fileInfos[filename].'.'.$fileInfos[extension].'" style="font-family: '.$nameSlug.', substitut"><input class="demo" type="text" value="Hello world."></p>';
}
}
}
?>
</div>
<?php
}
?>
</div>
<?php include('inc/foot.php') ?>
?>
\ No newline at end of file
......@@ -8,5 +8,5 @@
<link type="text/css" rel="stylesheet" href="js/lib/jquery-wheelcolorpicker/wheelcolorpicker.css" />
</head>
<body class="<?= $routes->current()->uid ?>">
<?php $routes->setNav(); ?>
<?= $templates->setNav(); ?>
<?php if($debug == true) ini_set('display_errors', 'On'); ?>
Coucou je suis 404
\ No newline at end of file
<?php include('site/inc/head.php') ?>
<div id="content">
<?php
foreach ($dirs as $dir){
$files = array_diff(scandir($path.'/'.$dir), array('.', '..'));
$txtFileInfos = file_get_contents($path.'/'.$dir.'/infos.txt');
if($txtFileInfos){
// extraire les données du fichier texte (voir functions.php)
$styles = explode( ', ', extract_content($txtFileInfos, 'styles = ', ';'));
$name = extract_content($txtFileInfos, 'nom = ', ';');
$cat = extract_content($txtFileInfos, 'catégories = ', ';');
$author = extract_content($txtFileInfos, 'auteurs = ', ';');
$link = extract_content($txtFileInfos, 'lien = ', ';');
$version = extract_content($txtFileInfos, 'version = ', ';');
}
// Remplir les infos. Si fichier texte, elles viennent
// en priorité, sinon en jquery avec opentype.js
?>
<div class="fonte <?= $dir ?>" data-type="<?= strtolower($dir) ?>">
<ul class="infos">
<li class="name"><h2>Nom:</h2> <?php if($txtFileInfos && $name) echo '<span>'.$name.'</span>' ?></li>
<li class="author"><h2>Auteur(s):</h2> <?php if($txtFileInfos && $author) echo '<span>'.$author.'</span>' ?></li>
<li class="styles"><h2>Style(s):</h2> <?php if($txtFileInfos && $styles){ echo '<span>'.count($styles).'</span>'; } else { echo '<span>'.count($files).'</span>'; } ?></li>
<li class="category"><h2>Categorie(s):</h2> <?php if($txtFileInfos && $cat){ echo $cat; } else { echo '?'; } ?></li>
<li class="download"><a href="<?php if($txtFileInfos && $link) echo $link ?>" target="_blank">Download</a></li>
<li class="specimen"><a href="specimen.php?font=<?= $dir ?>">Spécimen</a></li>
</ul>
<div class="deroule">
</div>
<?php
// echo '<h1>'.$dir.'</h1>';
foreach($files as $i => $file){
$fileInfos = pathinfo($file);
$fontExt = Array('ttf', 'otf');
if( in_array($fileInfos[extension], $fontExt)){
$nameSlug = str_replace(' ', '', $fileInfos[filename]);
echo '
<style>
@font-face {
font-family: '.$nameSlug.';
src: url('.$path.'/'.$dir.'/'.$file.');
}
</style>
';
echo '<p class="sample '.$i.' '.$fileInfos[filename].'.'.$fileInfos[extension].'" style="font-family: '.$nameSlug.', substitut"><input class="demo" type="text" value="Hello world."></p>';
}
}
?>
</div>
<?php
}
?>
</div>
<?php include('site/inc/foot.php') ?>
<?php include("typotheque/launch.php"); ?>
<?php include('inc/head.php'); ?>
<?php include('site/inc/head.php'); ?>
<h2>Nouvelle famille</h2>
<?php if($_GET["errors"]): ?>
<div class="errors">
......@@ -14,4 +13,4 @@
<input type="text" name="from" value="upload" readonly style="display: none">
<input type="submit" name="envoyer" value="Ajouter">
</form>
<?php include('inc/foot.php') ?>
<?php include('site/inc/foot.php') ?>
......@@ -2,37 +2,45 @@
class Routes{
public function index(){
$url = $_SERVER['REQUEST_URI'];
$needle = "typotheque/";
$index = substr($url, 0, strrpos($url, $needle)+strlen($needle));
return $index;
}
public function pageExists($page){
$file = "site/pages/".$page.".php";
return (file_exists($file)) ? true : false;
}
public function redirect($url){
header('Location: '.$url);
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 = (strpos($page, ".") !== -1) ? substr($page, 0, strpos($page, ".")) : $page;
$this->uid = $page;
$this->url = $url;
return $this;
}
public function setNav(){
$uid = $this->current()->uid;
$notNav = ["upload","font-infos"];
return !in_array($uid, $notNav) ? include("inc/nav.php") : false;
}
public function setScripts(){
$page = $this->current()->uid;
$
}
}
?>
\ No newline at end of file
<?php
class Templates extends Strings{
public $frontPages = ["index","apropos","specimen"];
public $backPages = ["upload","check","write","modify","log"];
public $errorPages = ["404"];
public function setNav(){
$uid = $this->current()->uid;
return (!in_array($uid, $this->backPages) && !in_array($uid, $this->errorPages)) ? include("site/inc/nav.php") : false;
}
public function setScripts(){
$uid = $this->current()->uid;
$both = ["opentype.min"];
$frontScripts = ["jquery-2.1.1.min"];
}
}
?>
\ No newline at end of file
......@@ -2,6 +2,7 @@
include("core/routes.php");
include("core/strings.php");
include("core/templates.php");
include("core/datas.php");
include("core/validate.php");
include("core/files.php");
......@@ -12,5 +13,6 @@ $routes = new Routes;
$datas = new Datas;
$validate = new Validate;
$files = new Files;
$templates = new Templates;
?>
\ No newline at end of file
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