From c36f25e76f40c6fdd6e02f92713d9c1241ed0a79 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Tue, 17 Jul 2018 15:53:02 +0200 Subject: W 2.4 admin include css passwords db table --- public/w/index.php | 63 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 22 deletions(-) (limited to 'public/w') diff --git a/public/w/index.php b/public/w/index.php index 3f572b3..9229bb9 100644 --- a/public/w/index.php +++ b/public/w/index.php @@ -48,19 +48,15 @@ if (!isset($_SESSION['level'])) { $app->setsession($session); -//var_dump($config); -//var_dump($app); - - -// _________________________________________________________ N A V _______________________________________________ +// __________________________________________________________ I D _______________________________________________ if (isset($_GET['id'])) { $app->setbdd($config); } -// _____________________________________________________ A C T I O N __________________________________________________________________ +// _______________________________________________________ A C T I O N __________________________________________________________________ if (isset($_POST['action'])) { @@ -94,12 +90,6 @@ if (isset($_POST['action'])) { header('Location: ./?aff=admin&message=' . $message); break; - case 'changecss': - $config->setcssread($_POST['lecturecss']); - $app->savejson($config->tojson()); - header('Location: ./?aff=admin'); - break; - case 'editconfig': $config->hydrate($_POST); $app->savejson($config->tojson()); @@ -163,7 +153,20 @@ if (isset($_POST['action'])) { } +if (isset($_POST['actiondb'])) { + $app->setbdd($config); + + switch ($_POST['actiondb']) { + case 'addtable': + if (isset($_POST['tablename'])) { + $message = $app->addtable($config->dbname(), $_POST['tablename']); + header('Location: ./?aff=admin&message=' . $message); + } + break; + + } +} // _______________________________________________________ H E A D _____________________________________________________________ if (isset($_GET['id'])) { @@ -234,36 +237,49 @@ if (isset($_GET['id'])) { header('Location: ?id=' . $_GET['id'] . '&edit=1'); } } else { - echo '

Cet article n\'existe pas encore

'; + echo '

This article does not exist yet

'; - if ($aff->session() >= 2) { - echo '
'; + if ($app->session() >= $app::EDITOR) { + echo '
'; } } } } elseif (isset($_GET['tag'])) { + $app->setbdd($config); echo '

' . $_GET['tag'] . '

'; - $aff->tag($app->getlister(['id', 'titre', 'intro', 'tag'], 'id'), $_GET['tag']); + $aff->tag($app->getlister(['id', 'titre', 'intro', 'tag'], 'id'), $_GET['tag'], $app); } elseif (isset($_GET['lien'])) { - echo '

' . $_GET['lien'] . '

'; - $aff->lien($app->getlister(['id', 'titre', 'intro', 'lien'], 'id'), $_GET['lien']); -} elseif (isset($_GET['aff']) && $app->session() == $app::ADMIN) { - if ($_GET['aff'] == 'admin') { + $app->setbdd($config); + echo '

' . $_GET['lien'] . '

'; + $aff->lien($app->getlister(['id', 'titre', 'intro', 'lien'], 'id'), $_GET['lien'], $app); + +} elseif (isset($_GET['aff']) && $app->session() >= $app::EDITOR) { + if ($_GET['aff'] == 'admin' && $app->session() >= $app::ADMIN) { echo '
'; echo '

Admin

'; + + + + // $app->tableexist($config->dbname(), 'guigui'); - $aff->admincss($config, $app->csslist()); + $aff->admincss($config, $app); + $aff->adminpassword($config); $aff->admindb($config); + if ($app->setbdd($config)) { + //var_dump($app->tablelist($config->dbname())); + echo '

database status : OK

'; + } + $aff->admintable($config, $app->tablelist($config->dbname())); echo '
'; } elseif ($_GET['aff'] == 'media') { echo '

Media

'; echo '
'; - $aff->addmedia(); + $aff->addmedia($app); $aff->medialist($app); echo '
'; @@ -293,8 +309,11 @@ if (isset($_GET['id'])) { } else { $desc = 'ASC'; } + $aff->home2table($app, $app->getlister(['id', 'titre', 'intro', 'lien', 'datecreation', 'datemodif'], $tri, $desc)); + //var_dump($app->getlister(['id', 'lien'])); + } echo ''; -- cgit v1.2.3