aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--class/class.w.aff.php180
-rw-r--r--class/class.w.app.php141
-rw-r--r--class/class.w.art.php3
-rw-r--r--class/class.w.config.php11
-rw-r--r--public/w/index.php63
6 files changed, 294 insertions, 105 deletions
diff --git a/.gitignore b/.gitignore
index ea3e2dd..74c3183 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ config.json
error_log
public/media/*
public/ACRRecordings/*
+public/css/lecture/*
diff --git a/class/class.w.aff.php b/class/class.w.aff.php
index 86a9aa3..cacec99 100644
--- a/class/class.w.aff.php
+++ b/class/class.w.aff.php
@@ -251,14 +251,14 @@ public function search()
}
- public function tag($getlist, $tag)
+ public function tag($getlist, $tag, $app)
{
echo '<div class="tag">';
echo '<ul>';
foreach ($getlist as $item) {
if (in_array($tag, $item->tag('array'))) {
echo '<li><a href="?id=' . $item->id() . '">' . $item->titre() . '</a> - ' . $item->intro();
- if ($this->session() >= 2) {
+ if ($app->session() >= $app::EDITOR) {
echo ' - <a href="?id=' . $item->id() . '&edit=1">modifier</a></li>';
} else {
echo '</li>';
@@ -269,15 +269,15 @@ public function search()
echo ' </div> ';
}
- public function lien($getlist, $lien)
+ public function lien($getlist, $lien, App $app)
{
echo '<div class="lien">';
echo '<ul>';
foreach ($getlist as $item) {
if (in_array($lien, $item->lien('array'))) {
echo '<li><a href="?id=' . $item->id() . '">' . $item->titre() . '</a> - ' . $item->intro();
- if ($this->session() >= 2) {
- echo ' - <a href="?id=' . $item->id() . '&edit=1">modifier</a></li>';
+ if ($app->session() >= $app::EDITOR) {
+ echo ' - <a href="?id=' . $item->id() . '&edit=1">modifier</a> - <a href="?lien=' . $item->id() . '">liens</a></li>';
} else {
echo '</li>';
}
@@ -287,20 +287,7 @@ public function search()
echo ' </div> ';
}
- public function home($getlist)
- {
- echo '<ul>';
- foreach ($getlist as $item) {
- echo '<li><a href="?id=' . $item->id() . '">' . $item->titre() . '</a> - ' . $item->intro();
- if ($this->session() >= 2) {
- echo ' - <a href="?id=' . $item->id() . '&edit=1">modifier</a></li>';
- } else {
- echo '</li>';
- }
- }
- echo ' </ul> ';
- }
public function dump($getlist)
{
@@ -313,27 +300,6 @@ public function search()
echo ' </ul> ';
}
- public function home2($getlist)
- {
- echo '<div class="home">';
- if ($this->session() >= 2) {
- echo '<ul>';
- foreach ($getlist as $item) {
- $count = 0;
-
- foreach ($getlist as $lien) {
- if (in_array($item->id(), $lien->lien('array'))) {
- $count++;
- }
- }
- echo '<li><a href="?id=' . $item->id() . '">' . $item->titre() . '</a> - ' . $item->intro();
- echo ' - <a href="?lien=' . $item->id() . '">' . $count . '</a> ';
- echo ' - <a href="?id=' . $item->id() . '&edit=1">modifier</a></li>';
- }
- echo ' </ul> ';
- }
- echo ' </div> ';
- }
public function home2table(App $app, $getlist)
{
@@ -389,7 +355,7 @@ public function search()
public function nav($app)
{
echo '<nav>';
- //echo $this->session();
+ echo $app->session();
echo '</br>';
echo '<a class="button" href="?">home</a>';
@@ -421,17 +387,19 @@ public function search()
<?php
}
- if ($app->session() == $app::ADMIN && isset($_GET['id']) && $app->exist($_GET['id'])) {
+ if ($app->session() >= $app::EDITOR && isset($_GET['id']) && $app->exist($_GET['id'])) {
if (isset($_GET['edit']) && $_GET['edit'] == 1) {
echo '<a class="button" href="?id=' . $_GET['id'] . '" target="_blank">display</a>';
} else {
echo '<a class="button" href="?id=' . $_GET['id'] . '&edit=1" >edit</a>';
}
}
- if ($app->session() == $app::ADMIN && !isset($_GET['id'])) {
+ if ($app->session() >= $app::EDITOR && !isset($_GET['id'])) {
echo '<a class="button" href="?aff=media" >Media</a>';
echo '<a class="button" href="?aff=record" >Record</a>';
- echo '<a class="button" href="?aff=admin" >Admin</a>';
+ if ($app->session() >= $app::ADMIN) {
+ echo '<a class="button" href="?aff=admin" >Admin</a>';
+ }
}
?>
@@ -443,9 +411,9 @@ public function search()
// ____________________________________________________ M E D ________________________________________________
- public function addmedia()
+ public function addmedia($app)
{
- if ($this->session() >= 2) {
+ if ($app->session() >= $app::EDITOR) {
?>
<details close>
@@ -606,33 +574,42 @@ public function search()
- public function admincss(Config $config, array $list)
+ public function admincss(Config $config, $app)
{
- echo '<article>';
- echo '<h2>Default CSS for articles</h2>';
+ ?>
+ <article>
+ <h2>CSS</h2>
+ <p>Current global css : <strong><?= $config->cssread() ?></strong></p>
+ <details colse>
+ <summary>Default CSS</summary>
- echo '<form action="?aff=admin" method="post" >';
- echo '<input type="hidden" name="action" value="changecss">';
- echo '<select name="lecturecss" required>';
- foreach ($list as $item) {
+ <form action="?aff=admin" method="post" >
+ <input type="hidden" name="action" value="editconfig">
+ <select name="cssread" required>
+
+ <?php
+ foreach ($app->dirlist($app::CSS_READ_DIR, 'css') as $item) {
if ($item == $config->cssread()) {
echo '<option value="' . $item . '" " selected >' . $item . '</option>';
} else {
echo '<option value="' . $item . '">' . $item . '</option>';
}
}
- echo '</select>';
- echo '<input type="submit" value="choose">';
- echo '</form>';
+ ?>
+ </select>
+ <input type="submit" value="choose">
+ </form>
+ </details>
- $cssfile = '..' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'lecture' . DIRECTORY_SEPARATOR . $config->cssread();
+ <?php
+ $cssfile = $app::CSS_READ_DIR . $config->cssread();
if (is_file($cssfile)) {
$cssread = file_get_contents($cssfile);
echo '<details>';
echo '<summary>Edit current CSS</summary>';
echo '<form>';
- echo '<textarea>' . $cssread . '</textarea>';
+ echo '<textarea style="height:400px;">' . $cssread . '</textarea>';
echo '<input type="submit" value="edit">';
echo '</form>';
echo '</details>';
@@ -649,6 +626,7 @@ public function search()
</form>
</details>
+ </article>
<?php
}
@@ -657,14 +635,11 @@ public function search()
{
?>
- </article>
<article>
<h2>Database</h2>
- <p>Status : ok</p>
-
<details>
<summary>Database credentials</summary>
@@ -674,27 +649,98 @@ public function search()
<input title="dbname" type="text" name="dbname" id="dbname" value="<?= $config->dbname() ?>" placeholder="dbname">
<input title="user" type="text" name="user" id="user" value="<?= $config->user() ?>" placeholder="user">
<input title="password" type="text" name="password" id="user" value="<?= $config->password() ?>" placeholder="password">
- <input type="submit" name="edit" id="">
+ <input type="submit" value="edit" id="">
+ </form>
+
+ </details>
+
+
+
+
+
+ </article>
+
+ <?php
+
+ }
+
+ public function adminpassword(Config $config)
+ {
+ ?>
+ <article>
+
+ <h2>Passwords</h2>
+
+ <details>
+ <summary>Admin</summary>
+
+ <form action="./" method="post">
+ <input type="hidden" name="action" value="editconfig">
+ <input title="admin password" type="password" name="admin" id="admin" value="<?= $config->admin() ?>" placeholder="admin">
+ <input type="submit" value="edit" id="">
</form>
</details>
+ <details>
+ <summary>Others</summary>
+
+ <form action="./" method="post">
+ <input type="hidden" name="action" value="editconfig">
+ <input title="editor" type="text" name="editor" id="editor" value="<?= $config->editor() ?>" placeholder="editor">
+ <input title="invite" type="text" name="invite" id="invite" value="<?= $config->invite() ?>" placeholder="invite">
+ <input title="read" type="text" name="read" id="read" value="<?= $config->read() ?>" placeholder="read">
+ <input type="submit" value="edit" id="">
+ </form>
+
+ </details>
+ </article>
+
+
+
+ <?php
+
+ }
+
+ public function admintable(Config $config, array $arttables)
+ {
+ ?>
+ <p>Current Table : <strong><?= $config->arttable(); ?></strong></p>
<details>
- <summary>Actions</summary>
+ <summary>Select Table</summary>
+ <p>The table is where all your articles are stored, select the one you want to use.</p>
- <p>Create new table on your database</p>
+ <form action="./" method="post">
+ <select name="arttable" required>
- <form action="">
- <input type="submit" value="reset">
- <input type="submit" value="download">
+ <?php
+ foreach ($arttables as $arttable) {
+ if ($arttable == $config->arttable()) {
+ echo '<option value="' . $arttable . '" " selected >' . $arttable . '</option>';
+ } else {
+ echo '<option value="' . $arttable . '">' . $arttable . '</option>';
+ }
+ }
+ ?>
+ </select>
+ <input type="hidden" name="action" value="editconfig">
+ <input type="submit" value="choose">
</form>
</details>
+ <details>
+ <summary>Add table</summary>
+ <p>Create new table in your database. You need at least one to use W_cms</p>
- </article>
+ <form action="./" method="post">
+ <input type="hidden" name="actiondb" value="addtable">
+ <input type="text" name="tablename" maxlength="30" required>
+ <input type="submit" value="create">
+ </form>
+ </details>
<?php
}
diff --git a/class/class.w.app.php b/class/class.w.app.php
index 1ee8005..d178b52 100644
--- a/class/class.w.app.php
+++ b/class/class.w.app.php
@@ -3,10 +3,12 @@ class App
{
private $bdd;
private $session;
+ private $arttable;
const CONFIG_FILE = '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config.json';
const CSS_READ_DIR = '..' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'lecture' . DIRECTORY_SEPARATOR;
+ const SQL_READ_DIR = '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR;
const ADMIN = 10;
@@ -27,12 +29,31 @@ class App
public function setbdd(Config $config)
{
+ $caught = true;
try {
- $this->bdd = new PDO('mysql:host=' . $config->host() . ';dbname=' . $config->dbname() . ';charset=utf8', $config->user(), $config->password());
- } catch (Exeption $e) {
- die('Erreur : ' . $e->getMessage());
+ $this->bdd = new PDO('mysql:host=' . $config->host() . ';dbname=' . $config->dbname() . ';charset=utf8', $config->user(), $config->password(), array(PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT));
+ //$this->bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ } catch (PDOException $e) {
+ $caught = false;
+ echo '<h1>Error 500, database offline</h1>';
+ echo '<p><a href=".">Homepage for admin login</a> (connect on the top right side)</p>';
+ if ($this->session() >= 3) {
+ echo '<p>Error : ' . $e->getMessage() . '</p>';
+ if ($this->session() == 10) {
+ echo '<p>Go to the <a href="?aff=admin">Admin Panel</a> to edit your database credentials</p>';
+ } else {
+ echo '<p>Logout and and come back with an <strong>admin password</strong> to edit the database connexions settings.</p>';
+ }
+ }
+ exit;
}
+ if ($caught) {
+ $this->arttable = $config->arttable();
+ }
+
+ return $caught;
+
}
@@ -77,7 +98,9 @@ class App
$now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
- $q = $this->bdd->prepare('INSERT INTO art(id, titre, soustitre, intro, tag, datecreation, datemodif, css, html, secure, couleurtext, couleurbkg, couleurlien, couleurlienblank, lien, template) VALUES(:id, :titre, :soustitre, :intro, :tag, :datecreation, :datemodif, :css, :html, :secure, :couleurtext, :couleurbkg, :couleurlien, :couleurlienblank, :lien, :template)');
+ $request = 'INSERT INTO ' . $this->arttable . '(id, titre, soustitre, intro, tag, datecreation, datemodif, css, html, secure, couleurtext, couleurbkg, couleurlien, couleurlienblank, lien, template) VALUES(:id, :titre, :soustitre, :intro, :tag, :datecreation, :datemodif, :css, :html, :secure, :couleurtext, :couleurbkg, :couleurlien, :couleurlienblank, :lien, :template)';
+
+ $q = $this->bdd->prepare($request);
$q->bindValue(':id', $art->id());
$q->bindValue(':titre', $art->titre());
@@ -102,14 +125,14 @@ class App
public function delete(Art $art)
{
- $req = $this->bdd->prepare('DELETE FROM art WHERE id = :id ');
+ $req = $this->bdd->prepare('DELETE FROM ' . $this->arttable . ' WHERE id = :id ');
$req->execute(array('id' => $art->id()));
$req->closeCursor();
}
public function get($id)
{
- $req = $this->bdd->prepare('SELECT * FROM art WHERE id = :id ');
+ $req = $this->bdd->prepare('SELECT * FROM ' . $this->arttable . ' WHERE id = :id ');
$req->execute(array('id' => $id));
$donnees = $req->fetch(PDO::FETCH_ASSOC);
@@ -127,7 +150,7 @@ class App
$selection = implode(", ", $selection);
- $select = 'SELECT ' . $selection . ' FROM art ORDER BY ' . $tri . ' ' . $desc;
+ $select = 'SELECT ' . $selection . ' FROM ' . $this->arttable . ' ORDER BY ' . $tri . ' ' . $desc;
$req = $this->bdd->query($select);
while ($donnees = $req->fetch(PDO::FETCH_ASSOC)) {
$list[] = new Art($donnees);
@@ -138,7 +161,7 @@ class App
public function lister()
{
- $req = $this->bdd->query(' SELECT * FROM art ORDER BY id ');
+ $req = $this->bdd->query(' SELECT * FROM ' . $this->arttable . ' ORDER BY id ');
$donnees = $req->fetchAll(PDO::FETCH_ASSOC);
return $donnees;
@@ -148,12 +171,12 @@ class App
public function count()
{
- return $this->bdd->query(' SELECT COUNT(*) FROM art ')->fetchColumn();
+ return $this->bdd->query(' SELECT COUNT(*) FROM ' . $this->arttable . ' ')->fetchColumn();
}
public function exist($id)
{
- $req = $this->bdd->prepare(' SELECT COUNT(*) FROM art WHERE id = :id ');
+ $req = $this->bdd->prepare(' SELECT COUNT(*) FROM ' . $this->arttable . ' WHERE id = :id ');
$req->execute(array('id' => $id));
$donnees = $req->fetch(PDO::FETCH_ASSOC);
@@ -165,7 +188,7 @@ class App
$now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
$art->updatelien();
- $q = $this->bdd->prepare('UPDATE art SET titre = :titre, soustitre = :soustitre, intro = :intro, tag = :tag, datecreation = :datecreation, datemodif = :datemodif, css = :css, html = :html, secure = :secure, couleurtext = :couleurtext, couleurbkg = :couleurbkg, couleurlien = :couleurlien, couleurlienblank = :couleurlienblank, lien = :lien, template = :template WHERE id = :id');
+ $q = $this->bdd->prepare('UPDATE ' . $this->arttable . ' SET titre = :titre, soustitre = :soustitre, intro = :intro, tag = :tag, datecreation = :datecreation, datemodif = :datemodif, css = :css, html = :html, secure = :secure, couleurtext = :couleurtext, couleurbkg = :couleurbkg, couleurlien = :couleurlien, couleurlienblank = :couleurlienblank, lien = :lien, template = :template WHERE id = :id');
$q->bindValue(':id', $art->id());
$q->bindValue(':titre', $art->titre());
@@ -187,6 +210,83 @@ class App
$q->execute();
}
+ public function tableexist($dbname, $tablename)
+ {
+
+ var_dump($dbname);
+ var_dump($tablename);
+
+ $req = $this->bdd->prepare('SELECT COUNT(*)
+ FROM information_schema.tables
+ WHERE table_schema = :dbname AND
+ table_name like :tablename');
+ $req->execute(array(
+ 'dbname' => $dbname,
+ 'tablename' => $tablename
+ ));
+ $donnees = $req->fetch(PDO::FETCH_ASSOC);
+ $req->closeCursor();
+ $exist = intval($donnees['COUNT(*)']);
+ return $exist;
+
+
+
+
+ }
+
+ public function tablelist($dbname)
+ {
+ $request = 'SHOW TABLES IN ' . $dbname;
+ $req = $this->bdd->query($request);
+ $donnees = $req->fetchAll(PDO::FETCH_ASSOC);
+ $req->closeCursor();
+
+ $arttables = [];
+ foreach ($donnees as $table) {
+ $arttables[] = $table['Tables_in_wcms'];
+ }
+ return $arttables;
+
+
+ }
+
+
+ public function addtable($dbname, $tablename)
+ {
+
+ if (!$this->tableexist($dbname, $tablename)) {
+
+ $table = "CREATE TABLE `$tablename` (
+ `id` varchar(255) NOT NULL DEFAULT 'art',
+ `titre` varchar(255) NOT NULL DEFAULT 'titre',
+ `soustitre` varchar(255) NOT NULL DEFAULT 'soustitre',
+ `intro` varchar(255) NOT NULL DEFAULT 'intro',
+ `tag` varchar(255) NOT NULL DEFAULT 'sans tag,',
+ `datecreation` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `datemodif` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `css` text,
+ `html` text,
+ `secure` int(1) NOT NULL DEFAULT '0',
+ `couleurtext` varchar(7) NOT NULL DEFAULT '#000000',
+ `couleurbkg` varchar(7) NOT NULL DEFAULT '#ffffff',
+ `couleurlien` varchar(7) NOT NULL DEFAULT '#2a3599',
+ `couleurlienblank` varchar(7) NOT NULL DEFAULT '#2a8e99',
+ `lien` varchar(255) DEFAULT NULL,
+ `template` varchar(255) DEFAULT NULL
+ )";
+
+ $alter = "ALTER TABLE `'.$tablename.'`
+ ADD PRIMARY KEY (`id`)";
+
+ $req = $this->bdd->query($table);
+ $req->closeCursor();
+
+ return 'tablecreated';
+ } else {
+ return 'tablealreadyexist';
+ }
+ }
+
@@ -366,12 +466,12 @@ class App
return $message;
}
- public function csslist()
+ public function dirlist($dir, $extension)
{
- if ($handle = opendir(self::CSS_READ_DIR)) {
+ if ($handle = opendir($dir)) {
$list = [];
while (false !== ($entry = readdir($handle))) {
- if ($entry != "." && $entry != ".." && pathinfo($entry)['extension'] == 'css') {
+ if ($entry != "." && $entry != ".." && pathinfo($entry)['extension'] == $extension) {
$list[] = $entry;
@@ -381,6 +481,11 @@ class App
}
}
+ public function downloadtable()
+ {
+
+ }
+
@@ -389,9 +494,13 @@ class App
public function login($pass, $config)
{
if (strip_tags($pass) == $config->admin()) {
- return $level = 10;
+ return $level = self::ADMIN;
} elseif (strip_tags($pass) == $config->read()) {
- return $level = 1;
+ return $level = self::READ;
+ } elseif (strip_tags($pass) == $config->editor()) {
+ return $level = self::EDITOR;
+ } elseif (strip_tags($pass) == $config->invite()) {
+ return $level = self::INVITE;
}
}
diff --git a/class/class.w.art.php b/class/class.w.art.php
index 02c06de..9640470 100644
--- a/class/class.w.art.php
+++ b/class/class.w.art.php
@@ -29,6 +29,9 @@ class Art
const DEBUT = '(?id=';
const FIN = ')';
+
+
+
// _____________________________________________________ F U N ____________________________________________________
public function __construct(array $donnees)
diff --git a/class/class.w.config.php b/class/class.w.config.php
index 8a54530..4a63f86 100644
--- a/class/class.w.config.php
+++ b/class/class.w.config.php
@@ -8,6 +8,7 @@ class Config
private $dbname;
private $user;
private $password;
+ private $arttable;
private $domain;
private $admin;
private $editor;
@@ -63,6 +64,11 @@ class Config
return $this->password;
}
+ public function arttable()
+ {
+ return $this->arttable;
+ }
+
public function domain()
{
return $this->domain;
@@ -115,6 +121,11 @@ class Config
$this->password = strip_tags($password);
}
+ public function setarttable($arttable)
+ {
+ $this->arttable = strip_tags($arttable);
+ }
+
public function setdomain($domain)
{
$this->domain = strip_tags($domain);
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 '<span class="alert"><h4>Cet article n\'existe pas encore</h4></span>';
+ echo '<span class="alert"><h4>This article does not exist yet</h4></span>';
- if ($aff->session() >= 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>';
+ if ($app->session() >= $app::EDITOR) {
+ echo '<form action="?id=' . $_GET['id'] . '&edit=1" method="post"><input type="hidden" name="action" value="new"><input type="submit" value="Create"></form>';
}
}
}
} elseif (isset($_GET['tag'])) {
+ $app->setbdd($config);
echo '<h4>' . $_GET['tag'] . '</h4>';
- $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 '<h4>' . $_GET['lien'] . '</h4>';
- $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 '<h4><a href="?id=' . $_GET['lien'] . '">' . $_GET['lien'] . '</a></h4>';
+ $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 '<section>';
echo '<h1>Admin</h1>';
+
+
+
+ // $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 '<p>database status : OK</p>';
+ }
+ $aff->admintable($config, $app->tablelist($config->dbname()));
echo '</section>';
} elseif ($_GET['aff'] == 'media') {
echo '<h1>Media</h1>';
echo '<section>';
- $aff->addmedia();
+ $aff->addmedia($app);
$aff->medialist($app);
echo '</section>';
@@ -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 '</body>';