diff options
Diffstat (limited to 'public/w')
-rw-r--r-- | public/w/art.php | 0 | ||||
-rw-r--r-- | public/w/art_create.php | 0 | ||||
-rw-r--r-- | public/w/art_delete.php | 0 | ||||
-rw-r--r-- | public/w/art_display.php | 0 | ||||
-rw-r--r-- | public/w/art_edit.php | 0 | ||||
-rw-r--r-- | public/w/index.php | 131 |
6 files changed, 61 insertions, 70 deletions
diff --git a/public/w/art.php b/public/w/art.php deleted file mode 100644 index e69de29..0000000 --- a/public/w/art.php +++ /dev/null diff --git a/public/w/art_create.php b/public/w/art_create.php deleted file mode 100644 index e69de29..0000000 --- a/public/w/art_create.php +++ /dev/null diff --git a/public/w/art_delete.php b/public/w/art_delete.php deleted file mode 100644 index e69de29..0000000 --- a/public/w/art_delete.php +++ /dev/null diff --git a/public/w/art_display.php b/public/w/art_display.php deleted file mode 100644 index e69de29..0000000 --- a/public/w/art_display.php +++ /dev/null diff --git a/public/w/art_edit.php b/public/w/art_edit.php deleted file mode 100644 index e69de29..0000000 --- a/public/w/art_edit.php +++ /dev/null diff --git a/public/w/index.php b/public/w/index.php index 41137d0..6148dee 100644 --- a/public/w/index.php +++ b/public/w/index.php @@ -1,95 +1,86 @@ <?php -//inw + +// _____________________________________________________ R E Q U I R E ________________________________________________________________ + + +$_SESSION['level'] = 0; + +$config = require('../../config.php'); +require('../../vendor/autoload.php'); +use Michelf\Markdown; require('../../fn/fn.php'); require('../../class/class.art.php'); require('../../class/class.app.php'); -$config = include('../../config.php'); -$app = new App($config); - +require('../../class/class.aff.php'); session(); +$app = new App($config); +$aff = new Aff($_SESSION['level']); -// fin de in +// _____________________________________________________ A C T I O N __________________________________________________________________ -head('article'); +if (isset($_POST['action'])) { + switch ($_POST['action']) { + + case 'update': + if ($app->exist($_GET['id'])) { + $art = new Art($_POST); + $app->update($art); + header('Location: ?id=' . $art->id() . '&edit=1'); + } + break; + + case 'login' : + $app->login($_POST['pass']); + header('Location: ?id=' . $_GET['id']); + break; + + case 'logout' : + $app->logout(); + header('Location: ?id=' . $_GET['id']); + break; + } + +} -// $art = new Art([ -// 'id' => 'prout', -// 'titre' => 'Prout', -// 'soustitre' => 'mega prout !', -// 'intro' => 'bienvenue dans le mega prout', -// 'datemodif' => new DateTimeImmutable(null, timezone_open("Europe/Paris")) -// ]); -// $arraytest = ([ -// 'id' => 'articlet2', -// 'titre' => 'titre', -// 'soustitre' => 'soustitre', -// 'intro' => 'intro', -// 'tag' => 'sans tag,', -// 'datecreation' => '2018-03-17 18:31:34', -// 'datemodif' => '2018-03-17 18:31:34', -// 'css' => 'display: inline:', -// 'html' => 'coucou les loulous', -// 'secure' => 0, -// 'couleurtext' => '#000000', -// 'couleurbkg' => '#ffffff', -// 'couleurlien' => '#2a3599' -// ]); -// $art = new Art($arreytest); +// _______________________________________________________ H E A D _____________________________________________________________ +$titre = 'home'; +if (isset($_GET['id'])) { + $titre = $_GET['id']; + if ($app->exist($_GET['id'])) { + $art = $app->get($_GET['id']); + $titre = $art->titre(); + } +} +$aff->head($titre); -// echo '<pre>'; -// print_r($art); -// print_r($app); -// echo '</pre>'; -// $app->add($art); -// echo '<p>art count :' . $app->count() . '</p>'; -// echo '<p>article exist :' . $app->exist('articlet') . '</p>'; -// var_dump($app->exist('articlet')); +// ______________________________________________________ B O D Y _______________________________________________________________ -$session = 2; +echo '<body>'; +$aff->nav($app); if (isset($_GET['id'])) { - - if ($session == 2) { - ?> - <nav> - <a href="?" >home</a> - <a href="?id=<?= $_GET['id'] ?>&display=1" target="_blank">display</a> - <a href="?id=<?= $_GET['id'] ?>&edit=1" >edit</a> - </nav> - <?php -} + if ($app->exist($_GET['id'])) { + + $art = $app->get($_GET['id']); -if ($app->exist($_GET['id'])) { - - if (isset($_POST['action']) and $_POST['action'] == 'update') { - $art = new Art($_POST); - var_dump($art); - $app->update($art); - header('Location: ?id=' . $art->id() . '&edit=1'); - - } - - $art = $app->get($_GET['id']); - - - - if (isset($_GET['display']) and $_GET['display'] == 1) { - $art->display($session); - } if (isset($_GET['edit']) and $_GET['edit'] == 1) { - $art->edit($session); + $aff->edit($art); + $aff->aside($app->list()); + } else { + $aff->lecture($art); + } } else { if (isset($_POST['action'])) { @@ -101,20 +92,20 @@ if ($app->exist($_GET['id'])) { header('Location: ?id=' . $_GET['id'] . '&edit=1'); } } else { - echo '<h4>Cet article n\'éxiste pas encore</h4>'; + echo '<span class="alert"><h4>Cet article n\'existe pas encore</h4></span>'; - if ($session >= 2) { + if ($_SESSION['level'] >= 2) { echo '<form action="?id=' . $_GET['id'] . '&edit=1" method="post"><input type="hidden" name="action" value="new"><input type="submit" value="créer"></form>'; } - echo '<a href="?info=erreur">retour maison</a>'; } } } else { echo "<h4>Bienvenue sur ce site.</h4>"; - $app->menu($session); + $aff->home($app->list()); } +echo '</body>'; |