aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-07-31 18:29:53 +0200
committervincent-peugnet <v.peugnet@free.fr>2018-07-31 18:29:53 +0200
commite9b2ca7c06875069fa03379258625490872cc33d (patch)
tree3af763a303f07c75d63ca9801c98e58fa9052628
parentc36f25e76f40c6fdd6e02f92713d9c1241ed0a79 (diff)
downloadwcms-e9b2ca7c06875069fa03379258625490872cc33d.tar.gz
wcms-e9b2ca7c06875069fa03379258625490872cc33d.zip
W 2.4 graphic update table sort engine update
-rw-r--r--class/class.w.aff.php417
-rw-r--r--class/class.w.app.php158
-rw-r--r--class/class.w.art.php94
-rw-r--r--class/class.w.opt.php207
-rw-r--r--fn/fn.php35
-rw-r--r--public/css/old/styleedit.css27
-rw-r--r--public/css/style.css0
-rw-r--r--public/css/styleadmin.css0
-rw-r--r--public/css/stylebase.css189
-rw-r--r--public/css/styleedit.css120
-rw-r--r--public/css/stylehome.css56
-rw-r--r--public/css/stylew.css249
-rw-r--r--public/rsc/js/app.js4
-rw-r--r--public/w/index.php87
14 files changed, 983 insertions, 660 deletions
diff --git a/class/class.w.aff.php b/class/class.w.aff.php
index cacec99..9f1177a 100644
--- a/class/class.w.aff.php
+++ b/class/class.w.aff.php
@@ -58,12 +58,11 @@ class Aff
public function lecture(Art $art, App $app)
{
- echo '<div class="lecture">';
if ($art->secure() == 1) {
- echo '<span class="alert"><h4>cet article est privé</h4></span>';
+ echo '<span class="alert">This article is private</span>';
}
if ($art->secure() == 2) {
- echo "<span class=\"alert\"><h4>cet article n'est pas publié</h4></span>";
+ echo "<span class=\"alert\">This article is not published yet</span>";
}
if ($app->session() >= $art->secure()) {
@@ -85,17 +84,14 @@ class Aff
}
<?= $art->csstemplate($app) ?>
</style>
- <section>
<header>
<h1><?= $art->titre() ?></h1>
<h6><?= $art->soustitre() ?></h6>
</header>
<article><?= $art->html($app) ?></article>
- </section>
<?php
}
- echo '</div>';
}
public function edit(Art $art, App $app, $list)
@@ -103,45 +99,50 @@ class Aff
if ($app->session() >= self::$edit) {
?>
- <div class="edit">
- <section>
- <form action="?id=<?= $art->id() ?>" method="post">
- <details close>
+
+ <form action="?id=<?= $art->id() ?>" method="post" id="artedit">
+ <textarea style="background-color: <?= $art->couleurbkg() ?>; color: <?= $art->couleurtext() ?>;" name="html" id="html" spellcheck="true" autofocus><?= $art->md(); ?></textarea>
+
+
+ <details id="editinfo" close>
<summary>Infos</summary>
- <label for="titre">Titre :</label>
- <input type="text" name="titre" id="titre" value="<?= $art->titre(); ?>">
- <label for="soustitre">Sous-titre :</label>
- <input type="text" name="soustitre" id="soustitre" value="<?= $art->soustitre(); ?>">
- <label for="intro">Introduction :</label>
- <input type="text" name="intro" id="intro" value="<?= $art->intro(); ?>">
- <label for="tag">Tag(s) :</label>
- <input type="text" name="tag" id="tag" value="<?= $art->tag('string'); ?>">
- <label for="secure">Niveau de sécurité :</label>
- <select name="secure" id="secure">
- <option value="0" <?= $art->secure() == 0 ? 'selected' : '' ?>>0</option>
- <option value="1" <?= $art->secure() == 1 ? 'selected' : '' ?>>1</option>
- <option value="2" <?= $art->secure() == 2 ? 'selected' : '' ?>>2</option>
- </select>
+ <fieldset>
+ <label for="titre">Titre :</label>
+ <input type="text" name="titre" id="titre" value="<?= $art->titre(); ?>">
+ <label for="soustitre">Sous-titre :</label>
+ <input type="text" name="soustitre" id="soustitre" value="<?= $art->soustitre(); ?>">
+ <label for="intro">Introduction :</label>
+ <input type="text" name="intro" id="intro" value="<?= $art->intro(); ?>">
+ <label for="tag">Tag(s) :</label>
+ <input type="text" name="tag" id="tag" value="<?= $art->tag('string'); ?>">
+ <label for="secure">Niveau de sécurité :</label>
+ <select name="secure" id="secure">
+ <option value="0" <?= $art->secure() == 0 ? 'selected' : '' ?>>0</option>
+ <option value="1" <?= $art->secure() == 1 ? 'selected' : '' ?>>1</option>
+ <option value="2" <?= $art->secure() == 2 ? 'selected' : '' ?>>2</option>
+ </select>
+ </fieldset>
</details>
- <details close>
+ <details id="editcss" close>
<summary>CSS</summary>
+ <fieldset>
<label for="template">Template :</label>
- <select name="template" id="template">
- <?php
- if ($art->template() == 'NULL') {
- echo '<option value="" selected >Sans template</option>';
- } else {
- echo '<option value="" >sans template</option>';
- }
- foreach ($list as $item) {
-
- if ($item->id() == $art->template()) {
- echo '<option value="' . $item->id() . '" selected >' . $item->titre() . '</option>';
- } else {
- echo '<option value="' . $item->id() . '">' . $item->titre() . '</option>';
- }
- }
- ?>
+ <select name="template" id="template">
+ <?php
+ if ($art->template() == 'NULL') {
+ echo '<option value="" selected >Sans template</option>';
+ } else {
+ echo '<option value="" >sans template</option>';
+ }
+ foreach ($list as $item) {
+
+ if ($item->id() == $art->template()) {
+ echo '<option value="' . $item->id() . '" selected >' . $item->titre() . '</option>';
+ } else {
+ echo '<option value="' . $item->id() . '">' . $item->titre() . '</option>';
+ }
+ }
+ ?>
</select>
<label for="css">Styles CSS :</label>
<textarea name="css" id="css"><?= $art->css(); ?></textarea>
@@ -153,20 +154,17 @@ class Aff
<input type="color" name="couleurlien" value="<?= $art->couleurlien() ?>" id="couleurlien">
<label for="couleurlienblank">Couleur des liens externes :</label>
<input type="color" name="couleurlienblank" value="<?= $art->couleurlienblank() ?>" id="couleurlienblank">
+ </fieldset>
</details>
- <details open>
- <summary>Contenu</summary>
- <textarea name="html" id="html" ><?= $art->md(); ?></textarea>
- </details>
+
<input type="hidden" name="datecreation" value="<?= $art->datecreation('string'); ?>">
<input type="hidden" name="id" value="<?= $art->id() ?>">
- </section>
- <div class="submit">
- <input type="submit" name="action" value="update">
- <input type="submit" name="action" value="delete" onclick="confirmSubmit(event, 'Suppression de cet article')">
- </form>
+ </form>
+ <div id="submit">
+ <input type="submit" name="action" value="update" accesskey="s" onclick="document.getElementById('artedit').submit();" form="artedit">
+ <input type="submit" name="action" value="delete" onclick="confirmSubmit(event, 'Suppression de cet article', 'artedit')" form="artedit">
</div>
- </div>
+
<?php
@@ -174,30 +172,34 @@ class Aff
}
+
+
public function copy(Art $art, $list)
{
?>
- <div class="copy">
- <form action="?id=<?= $art->id() ?>&edit=1" method="post">
- <input type="hidden" name="action" value="copy">
- <input type="hidden" name="id" value="<?= $art->id() ?>">
- <select name="copy">
- <?php
- foreach ($list as $item) {
- echo '<option value="' . $item->id() . '">' . $item->titre() . '</option>';
- }
- echo '</select>';
- ?>
- <label for="checkcss">CSS</label>
- <input type="checkbox" id="checkcss" name="css" value="true">
- <label for="checkcolor">Color</label>
- <input type="checkbox" id="checkcolor" name="color" value="true">
- <label for="checkhtml">HTML</label>
- <input type="checkbox" id="checkhtml" name="html" value="true">
- <label for="checktemplate">template</label>
- <input type="checkbox" id="checktemplate" name="template" value="true">
- <input type="submit" value="copy" onclick="confirmSubmit(event, 'Ecraser ces valeurs')">
- </form>
+ <div id="copy">
+ <form action="?id=<?= $art->id() ?>&edit=1" method="post">
+ <fieldset>
+ <input type="hidden" name="action" value="copy">
+ <input type="hidden" name="id" value="<?= $art->id() ?>">
+ <select name="copy" required>
+ <?php
+ foreach ($list as $item) {
+ echo '<option value="' . $item->id() . '">' . $item->id() . '</option>';
+ }
+ echo '</select>';
+ ?>
+ <label for="checkcss">CSS</label>
+ <input type="checkbox" id="checkcss" name="css" value="true">
+ <label for="checkcolor">Color</label>
+ <input type="checkbox" id="checkcolor" name="color" value="true">
+ <label for="checkhtml">HTML</label>
+ <input type="checkbox" id="checkhtml" name="html" value="true">
+ <label for="checktemplate">template</label>
+ <input type="checkbox" id="checktemplate" name="template" value="true">
+ <input type="submit" value="copy" onclick="confirmSubmit(event, 'Ecraser ces valeurs')">
+ </fieldset>
+ </form>
</div>
<?php
@@ -228,8 +230,7 @@ public function arthead(Art $art, $cssread = '', $edit = 0)
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" href="../media/logo.png" type="image/x-icon">
<link href="/css/stylebase.css" rel="stylesheet" />
- <link href="/css/stylew.css" rel="stylesheet" />
- <?= $edit == 0 ? '<link href="/css/lecture/' . $cssread . '" rel="stylesheet" />' : '' ?>
+ <?= $edit == 0 ? '<link href="/css/lecture/' . $cssread . '" rel="stylesheet" />' : '<link href="/css/styleedit.css" rel="stylesheet" />' ?>
<title><?= $edit == 1 ? '✏' : '' ?> <?= $art->titre() ?></title>
<script src="../rsc/js/app.js"></script>
</head>
@@ -243,132 +244,206 @@ public function arthead(Art $art, $cssread = '', $edit = 0)
public function search()
{
?>
+ <div id="search">
<form action="./" method="get">
<input type="text" name="id" id="id" placeholder="identifiant article" required>
<input type="submit" value="accéder">
- </form>
- <?php
+ </form>
+ </div>
+ <?php
- }
+}
- 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 ($app->session() >= $app::EDITOR) {
- echo ' - <a href="?id=' . $item->id() . '&edit=1">modifier</a></li>';
- } else {
- echo '</li>';
- }
+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 ($app->session() >= $app::EDITOR) {
+ echo ' - <a href="?id=' . $item->id() . '&edit=1">modifier</a></li>';
+ } else {
+ echo '</li>';
}
}
- echo ' </ul> ';
- echo ' </div> ';
}
+ echo ' </ul> ';
+ echo ' </div> ';
+}
- 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 ($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>';
- }
+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 ($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>';
}
}
- echo ' </ul> ';
- echo ' </div> ';
}
+ echo ' </ul> ';
+ echo ' </div> ';
+}
- public function dump($getlist)
- {
- echo '<ul>';
+public function dump($getlist)
+{
+ echo '<ul>';
+ foreach ($getlist as $item) {
+ echo '<li>';
+ var_dump($item);
+ echo '</li>';
+ }
+ echo ' </ul> ';
+}
+
+public function header()
+{
+ echo '<header>';
+ $this->search();
+ echo '</header>';
+}
+
+
+public function home2table(App $app, $getlist)
+{
+
+
+ if ($app->session() >= $app::EDITOR) {
+ echo '<table id="home2table">';
+ echo '<tr><th>title</th><th>tag</th><th>summary</th><th>↘ to</th><th>↗ from</th><th>last modification</th><th>date of creation</th><th>privacy</th><th>⚙ edit</th></tr>';
foreach ($getlist as $item) {
- echo '<li>';
- var_dump($item);
- echo '</li>';
+ echo '<tr>';
+ echo '<td><a href="?id=' . $item->id() . '">' . $item->titre() . '</a></td>';
+ echo '<td>' . $item->tag('sort') . '</td>';
+ echo '<td>' . $item->intro() . '</td>';
+ echo '<td><a href="?lien=' . $item->id() . '">' . $item->liento('sort') . '</a></td>';
+ echo '<td>' . $item->lien('sort') . '</td>';
+ echo '<td>' . $item->datemodif('hrdi') . '</td>';
+ echo '<td>' . $item->datecreation('hrdi') . '</td>';
+ echo '<td>' . $item->secure('string') . '</td>';
+ echo '<td><a href="?id=' . $item->id() . '&edit=1">edit</a></td>';
+ echo '</tr>';
}
- echo ' </ul> ';
+ echo ' </table> ';
}
+}
+public function option(App $app, Opt $opt)
+{
+ if ($app->session() >= $app::EDITOR) {
+ echo '<div id="options"><form action="./" method="get" >';
- public function home2table(App $app, $getlist)
- {
- echo '<div class="home">';
- echo '<section>';
- echo '<h1>W</h1>';
- $this->search();
- if ($app->session() >= $app::EDITOR) {
- echo '<h1>Home</h1>';
- echo '<table>';
- echo '<tr><th><a href="./?tri=titre">titre</a></th><th>résumé</th><th>lien from</th><th>lien to</th><th><a href="./?tri=datemodif&desc=DESC">dernière modif</a></th><th><a href="./?tri=datecreation&desc=DESC">date de création</a></th><th>edit</th></tr>';
- foreach ($getlist as $item) {
- $liento = 0;
- $lienfrom = 0;
-
- foreach ($getlist as $lien) {
- if (in_array($item->id(), $lien->lien('array'))) {
- $liento++;
- }
- }
- foreach ($item->lien('array') as $count) {
- $lienfrom++;
- }
- echo '<tr>';
- echo '<td><a href="?id=' . $item->id() . '">' . $item->titre() . '</a></td>';
- echo '<td>' . $item->intro() . '</td>';
- echo '<td>' . $lienfrom . '</td>';
- echo '<td><a href="?lien=' . $item->id() . '">' . $liento . '</a></td>';
- echo '<td>' . $item->datemodif('hrdi') . '</td>';
- echo '<td>' . $item->datecreation('hrdi') . '</td>';
- echo '<td><a href="?id=' . $item->id() . '&edit=1">modifier</a></td>';
- echo '</tr>';
- }
- echo ' </table> ';
+
+ $this->optiontag($opt);
+ $this->optionprivacy($opt);
+ $this->optionsort($opt);
+
+
+
+
+ echo '<input type=submit value="show">';
+
+ echo '</form></div>';
+
+ }
+
+}
+
+public function optiontag(Opt $opt)
+{
+
+ echo '<fieldset><legend>Tag</legend><ul>';
+ foreach ($opt->taglist() as $tagor => $count) {
+ if (in_array($tagor, $opt->tagor())) {
+ echo '<li><input type="checkbox" name="tagor[]" id="' . $tagor . '" value="' . $tagor . '" checked /><label for="' . $tagor . '">' . $tagor . ' (' . $count . ')</label></li>';
+ } else {
+ echo '<li><input type="checkbox" name="tagor[]" id="' . $tagor . '" value="' . $tagor . '" /><label for="' . $tagor . '">' . $tagor . ' (' . $count . ')</label></li>';
}
- echo '</section>';
- echo ' </div> ';
}
+ echo '</ul></fieldset>';
- public function aside(App $app)
- {
- if ($app->session() >= $app::EDITOR) {
- echo '<aside><ul>';
- foreach ($app->lister() as $item) {
- echo '<li><a href="?id=' . $item['id'] . '&edit=1">' . $item['titre'] . '</a> - <code>[' . $item['titre'] . '](?id=' . $item['id'] . ')</code>';
+}
+public function optionprivacy(Opt $opt)
+{
+ echo '<fieldset><legend>Privacity</legend><ul>';
+ echo '<li><input type="radio" id="4" name="secure" value="4" ' . ($opt->secure() == 4 ? "checked" : "") . ' /><label for="4">all</label></li>';
+ echo '<li><input type="radio" id="2" name="secure" value="2" ' . ($opt->secure() == 2 ? "checked" : "") . ' /><label for="2">not published</label></li>';
+ echo '<li><input type="radio" id="1" name="secure" value="1" ' . ($opt->secure() == 1 ? "checked" : "") . ' /><label for="1">private</label></li>';
+ echo '<li><input type="radio" id="0" name="secure" value="0" ' . ($opt->secure() == 0 ? "checked" : "") . ' /><label for="0">public</label></li>';
+ echo '</ul></fieldset>';
+}
- }
- echo ' </ul></aside> ';
+public function optionsort(Opt $opt)
+{
+ echo '<fieldset><legend>Sort</legend>';
+ echo '<select name="sortby" id="sortby">';
+ foreach ($opt->col('array') as $key => $col) {
+ echo '<option value="' . $col . '" ' . ($opt->sortby() == $col ? "selected" : "") . '>' . $col . '</option>';
+ }
+ echo '</select>';
+ echo '<input type="radio" id="asc" name="order" value="1" ' . ($opt->order() == '1' ? "checked" : "") . ' /><label for="asc">ascending</label>';
+ echo '<input type="radio" id="desc" name="order" value="-1" ' . ($opt->order() == '-1' ? "checked" : "") . ' /><label for="desc">descending</label>';
+
+ echo '</fieldset>';
+
+}
+
+public function map(App $app, $url)
+{
+ echo '<div class="home"><section>';
+
+ $map = "";
+ $link = "";
+ foreach ($app->getlister(['id', 'lien']) as $item) {
+ foreach ($item->lien('array') as $lien) {
+ $map = $map . ' </br> ' . $item->id() . ' --> ' . $lien;
}
+ $link = $link . '</br>click ' . $item->id() . ' "' . $url . '/w/?id=' . $item->id() . '"';
}
+ echo $map;
+ echo $link;
- public function nav($app)
- {
- echo '<nav>';
- echo $app->session();
- echo '</br>';
+ echo '</div></section>';
+}
- echo '<a class="button" href="?">home</a>';
+public function aside(App $app)
+{
+ if ($app->session() >= $app::EDITOR) {
+ echo '<div id="linklist">Links<div id="roll"><ul>';
+ foreach ($app->lister() as $item) {
+ echo '<li><a href="?id=' . $item['id'] . '&edit=1">' . $item['titre'] . '</a> - <input type="text" value="[' . $item['titre'] . '](?id=' . $item['id'] . ')">';
- if ($app->session() == $app::FREE) {
- if (isset($_GET['id'])) {
- echo '<form action="./?id=' . $_GET['id'] . '" method="post">';
- } else {
- echo '<form action="." method="post">';
- }
- ?>
+
+ }
+ echo ' </ul></div></div> ';
+ }
+}
+
+public function nav($app)
+{
+ echo '<nav>';
+ echo $app->session();
+ echo '<div id="menu">';
+
+ echo '<a class="button" href="?">home</a>';
+
+ if ($app->session() == $app::FREE) {
+ if (isset($_GET['id'])) {
+ echo '<form action="./?id=' . $_GET['id'] . '" method="post">';
+ } else {
+ echo '<form action="." method="post">';
+ }
+ ?>
<input type="hidden" name="action" value="login">
- <input type="password" name="pass" id="pass" placeholder="password">
+ <input type="password" name="pass" id="loginpass" placeholder="password">
<input type="submit" value="login">
</form>
<?php
@@ -402,7 +477,11 @@ public function search()
}
}
+
+
+
?>
+ </div>
</nav>
<?php
diff --git a/class/class.w.app.php b/class/class.w.app.php
index d178b52..efb8986 100644
--- a/class/class.w.app.php
+++ b/class/class.w.app.php
@@ -142,15 +142,54 @@ class App
}
- public function getlister(array $selection = ['id', 'titre'], $tri = 'id', $desc = 'ASC')
+
+
+ public function update(Art $art)
{
+ $now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
+ $art->updatelien();
+
+ $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());
+ $q->bindValue(':soustitre', $art->soustitre());
+ $q->bindValue(':intro', $art->intro());
+ $q->bindValue(':tag', $art->tag('string'));
+ $q->bindValue(':datecreation', $art->datecreation('string'));
+ $q->bindValue(':datemodif', $now->format('Y-m-d H:i:s'));
+ $q->bindValue(':css', $art->css());
+ $q->bindValue(':html', $art->md());
+ $q->bindValue(':secure', $art->secure());
+ $q->bindValue(':couleurtext', $art->couleurtext());
+ $q->bindValue(':couleurbkg', $art->couleurbkg());
+ $q->bindValue(':couleurlien', $art->couleurlien());
+ $q->bindValue(':couleurlienblank', $art->couleurlienblank());
+ $q->bindValue(':lien', $art->lien('string'));
+ $q->bindValue(':template', $art->template());
+
+ $q->execute();
+ }
+
+
+
+
+ //____________________________________________ L S T ______________________________
+
+
+
+ public function getlister(array $selection = ['id'], array $opt = [])
+ {
+ $default = ['tri' => 'id', 'desc' => 'DESC'];
+ $opt = array_update($default, $opt);
+
$list = [];
- $option = ['datecreation', 'titre', 'id', 'intro', 'datemodif'];
- if (is_array($selection) && is_string($tri) && strlen($tri) < 16 && is_string($desc) && strlen($desc) < 5 && in_array($tri, $option)) {
+ $option = ['datecreation', 'titre', 'id', 'intro', 'datemodif', 'tag', 'secure'];
+ if (is_array($selection) && is_string($opt['tri']) && strlen($opt['tri']) < 16 && is_string($opt['desc']) && strlen($opt['desc']) < 5 && in_array($opt['tri'], $option)) {
$selection = implode(", ", $selection);
- $select = 'SELECT ' . $selection . ' FROM ' . $this->arttable . ' ORDER BY ' . $tri . ' ' . $desc;
+ $select = 'SELECT ' . $selection . ' FROM ' . $this->arttable . ' ORDER BY ' . $opt['tri'] . ' ' . $opt['desc'];
$req = $this->bdd->query($select);
while ($donnees = $req->fetch(PDO::FETCH_ASSOC)) {
$list[] = new Art($donnees);
@@ -159,13 +198,95 @@ class App
}
}
+
+
+
+
+
+ public function getlisteropt(Opt $opt)
+ {
+
+
+ $artlist = [];
+
+ $select = 'SELECT ' . $opt->col('string') . ' FROM ' . $this->arttable;
+ $req = $this->bdd->query($select);
+ while ($donnees = $req->fetch(PDO::FETCH_ASSOC)) {
+ $artlist[] = new Art($donnees);
+ }
+ return $artlist;
+
+ }
+
+ public function listcalclien(&$artlist)
+ {
+ foreach ($artlist as $art) {
+ $art->calcliento($artlist);
+ }
+ }
+
+ public function artcompare($art1, $art2, $method = 'id', $order = 1)
+ {
+ $result = ($art1->$method('sort') <=> $art2->$method('sort'));
+ return $result * $order;
+
+ }
+
+ public function buildsorter($sortby, $order)
+ {
+ return function ($art1, $art2) use ($sortby, $order) {
+ $result = $this->artcompare($art1, $art2, $sortby, $order);
+ return $result;
+ };
+ }
+
+
+
+ public function artlistsort(&$artlist, $sortby, $order = 1)
+ {
+ return usort($artlist, $this->buildsorter($sortby, $order));
+ }
+
+
+
+
+
+
+ public function filtertagor(array $artlist, array $tagchecked)
+ {
+
+ $filteredlist = [];
+ foreach ($artlist as $art) {
+ if (!empty(array_intersect($art->tag('array'), $tagchecked))) {
+ $filteredlist[] = $art->id();
+ } elseif (empty($tagchecked)) {
+ $filteredlist[] = $art->id();
+ }
+ }
+ return $filteredlist;
+ }
+
+ public function filtersecure(array $artlist, $secure)
+ {
+ $filteredlist = [];
+ foreach ($artlist as $art) {
+ if ($art->secure() == intval($secure)) {
+ $filteredlist[] = $art->id();
+ } elseif (intval($secure) >= 4) {
+ $filteredlist[] = $art->id();
+ }
+ }
+ return $filteredlist;
+ }
+
+
public function lister()
{
$req = $this->bdd->query(' SELECT * FROM ' . $this->arttable . ' ORDER BY id ');
$donnees = $req->fetchAll(PDO::FETCH_ASSOC);
+ $req->closeCursor();
return $donnees;
- $req->closeCursor();
}
@@ -183,32 +304,9 @@ class App
return (bool)$donnees['COUNT(*)'];
}
- public function update(Art $art)
- {
- $now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
- $art->updatelien();
-
- $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());
- $q->bindValue(':soustitre', $art->soustitre());
- $q->bindValue(':intro', $art->intro());
- $q->bindValue(':tag', $art->tag('string'));
- $q->bindValue(':datecreation', $art->datecreation('string'));
- $q->bindValue(':datemodif', $now->format('Y-m-d H:i:s'));
- $q->bindValue(':css', $art->css());
- $q->bindValue(':html', $art->md());
- $q->bindValue(':secure', $art->secure());
- $q->bindValue(':couleurtext', $art->couleurtext());
- $q->bindValue(':couleurbkg', $art->couleurbkg());
- $q->bindValue(':couleurlien', $art->couleurlien());
- $q->bindValue(':couleurlienblank', $art->couleurlienblank());
- $q->bindValue(':lien', $art->lien('string'));
- $q->bindValue(':template', $art->template());
+
+ // __________________________________________ T A B L E ________________________________________________________
- $q->execute();
- }
public function tableexist($dbname, $tablename)
{
diff --git a/class/class.w.art.php b/class/class.w.art.php
index 9640470..d757e0d 100644
--- a/class/class.w.art.php
+++ b/class/class.w.art.php
@@ -20,6 +20,7 @@ class Art
private $couleurlien;
private $couleurlienblank;
private $lien;
+ private $liento;
private $template;
const LEN = 255;
@@ -59,8 +60,7 @@ class Art
$this->setintro('resumé');
$this->settag('sans tag,');
$this->setdatecreation($now);
- $this->setcss('section {}
-a:hover {}');
+ $this->setcss('');
$this->sethtml('contenu');
$this->setsecure(2);
$this->setcouleurtext('#000000');
@@ -74,27 +74,50 @@ a:hover {}');
public function updatelien()
{
$this->lien = search($this->md(), self::DEBUT, self::FIN);
+ }
+ public static function classvarlist()
+ {
+ $classvarlist = [];
+ foreach (get_class_vars(__class__) as $var => $default) {
+ $classvarlist[] = $var;
+ }
+ return ['artvarlist' => $classvarlist];
}
+
+
+
+ public function calcliento($getlist)
+ {
+ $liento = [];
+ foreach ($getlist as $lien) {
+ if (in_array($this->id(), $lien->lien('array'))) {
+ $liento[] = $lien->id();
+ }
+ }
+ $this->setliento($liento);
+ }
+
+
// _____________________________________________________ G E T ____________________________________________________
- public function id()
+ public function id($type = 'string')
{
return $this->id;
}
- public function titre()
+ public function titre($type = 'string')
{
return $this->titre;
}
- public function soustitre()
+ public function soustitre($type = 'string')
{
return $this->soustitre;
}
- public function intro()
+ public function intro($type = 'string')
{
return $this->intro;
}
@@ -102,18 +125,19 @@ a:hover {}');
public function tag($option)
{
if ($option == 'string') {
- $tag = implode(", ", $this->tag);
+ return implode(", ", $this->tag);
} elseif ($option == 'array') {
- $tag = $this->tag;
+ return $this->tag;
+ } elseif ($option == 'sort') {
+ return count($this->tag);
}
- return $tag;
}
public function datecreation($option)
{
if ($option == 'string') {
return $this->datecreation->format('Y-m-d H:i:s');
- } elseif ($option == 'date') {
+ } elseif ($option == 'date' || $option == 'sort') {
return $this->datecreation;
} elseif ($option == 'hrdi') {
$now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
@@ -126,7 +150,7 @@ a:hover {}');
{
if ($option == 'string') {
return $this->datemodif->format('Y-m-d H:i:s');
- } elseif ($option == 'date') {
+ } elseif ($option == 'date' || $option == 'sort') {
return $this->datemodif;
} elseif ($option == 'hrdi') {
$now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
@@ -134,7 +158,7 @@ a:hover {}');
}
}
- public function css()
+ public function css($type = 'string')
{
return $this->css;
}
@@ -166,7 +190,7 @@ a:hover {}');
foreach ($this->lien('array') as $id) {
$title = "Cet article n'existe pas encore";
- foreach ($app->getlister(['id', 'intro'], 'id') as $item) {
+ foreach ($app->getlister(['id', 'intro']) as $item) {
if ($item->id() == $id) {
$title = $item->intro();
}
@@ -185,9 +209,16 @@ a:hover {}');
}
- public function secure()
+ public function secure($type = 'int')
{
- return $this->secure;
+ if ($type == 'string') {
+ if ($this->secure == 0) $secure = 'public';
+ if ($this->secure == 1) $secure = 'private';
+ if ($this->secure == 2) $secure = 'not published';
+ return $secure;
+ } else {
+ return $this->secure;
+ }
}
public function couleurtext()
@@ -216,12 +247,27 @@ a:hover {}');
$lien = implode(", ", $this->lien);
} elseif ($option == 'array') {
$lien = $this->lien;
+ } elseif ($option == 'sort') {
+ return count($this->lien);
}
return $lien;
}
- public function template()
+ public function liento($option)
+ {
+ if ($option == 'string') {
+ $liento = implode(", ", $this->liento);
+ } elseif ($option == 'array') {
+ $liento = $this->liento;
+ } elseif ($option == 'sort') {
+ return count($this->liento);
+ }
+ return $liento;
+
+ }
+
+ public function template($type = 'string')
{
return $this->template;
}
@@ -229,6 +275,7 @@ a:hover {}');
+
// _____________________________________________________ S E T ____________________________________________________
public function setid($id)
@@ -263,7 +310,11 @@ a:hover {}');
{
if (strlen($tag) < self::LEN and is_string($tag)) {
$tag = strip_tags(trim(strtolower($tag)));
- $taglist = explode(", ", $tag);
+ $tag = str_replace('*', '', $tag);
+ $tag = str_replace(' ', '', $tag);
+
+ $taglist = explode(",", $tag);
+ $taglist = array_filter($taglist);
$this->tag = $taglist;
}
}
@@ -350,6 +401,15 @@ a:hover {}');
}
}
+ public function setliento($liento)
+ {
+ if (is_array($liento)) {
+ $this->liento = $liento;
+ }
+
+
+ }
+
public function settemplate($template)
{
$template = strip_tags($template);
diff --git a/class/class.w.opt.php b/class/class.w.opt.php
new file mode 100644
index 0000000..76b3905
--- /dev/null
+++ b/class/class.w.opt.php
@@ -0,0 +1,207 @@
+<?php
+class Opt
+{
+ private $sortby = 'id';
+ private $order = '1';
+ private $tagor = [];
+ private $secure = 4;
+ private $liento = ['min' => '0', 'max' => '0'];
+ private $lienfrom = ['min' => '0', 'max' => '0'];
+ private $col = ['id'];
+ private $taglist = [];
+
+ private $artvarlist;
+
+ public function __construct(array $donnees = [])
+ {
+ $this->hydrate($donnees);
+ }
+
+ public function hydrate(array $donnees)
+ {
+ foreach ($donnees as $key => $value) {
+ $method = 'set' . $key;
+
+ if (method_exists($this, $method)) {
+ $this->$method($value);
+ }
+ }
+ }
+
+
+ public function reset()
+ {
+ $varlist = get_class_vars(__class__);
+
+ foreach ($varlist as $var => $default) {
+ $method = 'set' . $var;
+ $this->$method($default);
+ }
+ }
+
+ public function dump()
+ {
+ var_dump($this);
+ }
+
+
+
+
+
+ // _______________________________________________ G E T _______________________________________________
+
+ public function sortby()
+ {
+ return $this->sortby;
+ }
+
+ public function order()
+ {
+ return $this->order;
+ }
+
+ public function secure()
+ {
+ return $this->secure;
+ }
+
+ public function tagor($type = 'array')
+ {
+ return $this->tagor;
+ }
+
+ public function liento($type = 'array')
+ {
+ return $this->liento;
+ }
+
+ public function lienfrom($type = 'array')
+ {
+ return $this->lienfrom;
+ }
+
+ public function col($type = 'array')
+ {
+ if ($type == 'string') {
+ return implode(', ', $this->col);
+ } else {
+ return ($this->col);
+ }
+ }
+
+ public function artvarlist()
+ {
+ return $this->artvarlist;
+ }
+
+ public function taglist()
+ {
+ return $this->taglist;
+ }
+
+
+ // __________________________________________________ S E T _____________________________________________
+
+ public function setsortby($sortby)
+ {
+ if (is_string($sortby) && in_array($sortby, $this->artvarlist())) {
+ $this->sortby = strtolower(strip_tags($sortby));
+ }
+ }
+
+ public function setorder($order)
+ {
+ $order = intval($order);
+ if (in_array($order, [-1, 0, 1])) {
+ $this->order = $order;
+ }
+ }
+
+ public function settagor($tagor)
+ {
+ if (is_array($tagor)) {
+ // $tagorlist = [];
+ // foreach ($tagor as $tag) {
+ // if (array_key_exists($tag, $this->taglist())) {
+ // $tagorlist[] = $tag;
+ // }
+ // }
+ $this->tagor = $tagor;
+ }
+ }
+
+ public function setsecure($secure)
+ {
+ if ($secure >= 0 && $secure <= 5) {
+ $this->secure = intval($secure);
+ }
+ }
+
+ public function setliento($n0, $n1)
+ {
+ $stock = [intval($n1), intval($n2)];
+ $sorted = asort($stock);
+ $this->liento = ['min' => $stock[0], 'max' => $stock[1]];
+ }
+
+ public function setlienfrom($n0, $n1)
+ {
+ $stock = [intval($n1), intval($n2)];
+ $sorted = asort($stock);
+ $this->lienfrom = ['min' => $stock[0], 'max' => $stock[1]];
+ }
+
+ public function setlientomin($min)
+ {
+ $this->liento['min'] = intval($min);
+ }
+
+ public function setlientomax($max)
+ {
+ $this->liento['max'] = intval($max);
+ }
+
+ public function setlienfrommin($min)
+ {
+ $this->lienfrom['min'] = intval($min);
+ }
+
+ public function setlienfrommax($max)
+ {
+ $this->lienfrom['max'] = intval($max);
+ }
+
+ public function setcol($col)
+ {
+ if (is_array($col)) {
+ $this->col = array_intersect($this->artvarlist(), $col);
+ }
+ }
+
+ public function setartvarlist(array $artvarlist)
+ {
+ $this->artvarlist = $artvarlist;
+ }
+
+ public function settaglist(array $artlist)
+ {
+ $taglist = [];
+ foreach ($artlist as $art) {
+ foreach ($art->tag('array') as $tag) {
+ if (!array_key_exists($tag, $taglist)) {
+ $taglist[$tag] = 1;
+ } else {
+ $taglist[$tag]++;
+ }
+ }
+ }
+ $taglistsorted = arsort($taglist);
+ $this->taglist = $taglist;
+ }
+
+}
+
+
+
+
+?> \ No newline at end of file
diff --git a/fn/fn.php b/fn/fn.php
index ce299c8..f3b87aa 100644
--- a/fn/fn.php
+++ b/fn/fn.php
@@ -99,5 +99,40 @@ function hrdi(DateInterval $diff)
}
+
+function arrayclean($input)
+{
+ $output = [];
+ foreach ($input as $key => $value) {
+ if (is_array($value)) {
+ $output[$key] = array_filter($value);
+ } else {
+ $output[$key] = $value;
+ }
+ }
+ return $output;
+}
+
+
+
+
+function array_update($base, $new)
+{
+ foreach ($base as $key => $value) {
+ if (array_key_exists($key, $new)) {
+ if (gettype($base[$key]) == gettype($new[$key])) {
+ $base[$key] = $new[$key];
+ }
+ }
+ }
+ return $base;
+}
+
+
+
+
+
+
+
?>
diff --git a/public/css/old/styleedit.css b/public/css/old/styleedit.css
new file mode 100644
index 0000000..21435fb
--- /dev/null
+++ b/public/css/old/styleedit.css
@@ -0,0 +1,27 @@
+.edit {
+ background-color: greenyellow;
+}
+
+#linklist {
+ background-color: blanchedalmond;
+}
+
+#submit {
+ background-color: coral;
+}
+
+#copy {
+ background-color: darkkhaki;
+}
+
+#html {
+ background-color: deepskyblue;
+}
+
+#artedit {
+ background-color: darksalmon;
+}
+
+#editoption {
+ background-color: blueviolet;
+} \ No newline at end of file
diff --git a/public/css/style.css b/public/css/style.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/public/css/style.css
diff --git a/public/css/styleadmin.css b/public/css/styleadmin.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/public/css/styleadmin.css
diff --git a/public/css/stylebase.css b/public/css/stylebase.css
index ff59114..5621363 100644
--- a/public/css/stylebase.css
+++ b/public/css/stylebase.css
@@ -1,193 +1,58 @@
-body {
- background-color: #dcdcdceb;
- font-family: helvetica, arial, sans-serif;
- margin: 0px;
-
-}
-
-h1 {
- font-size: 3em;
- font-variant: all-small-caps;
- margin-top: 0px;
- margin-bottom: 0px;
-}
-
-h2 {
- font-style: italic;
+:root {
+ --color1: lightgrey;
+ --color2: lightslategrey;
+ --color3: white;
+ --color4: grey;
}
-h3 {
- opacity: 0.7;
-}
-
-h6 {
- font-size: 1em;
-}
-
-p{
- font-size: 1em;
-}
-
-em {
- opacity: 0.8;
-}
-
-a{
- text-decoration: none;
-}
-
-a:hover{
- text-decoration: underline;
+body {
+ margin: 0;
+ font-family: monospace;
}
-form {
- margin-bottom: 0px;
-}
section {
- padding: 3%;
-}
-
-.edit body {
- overflow-y: scroll;
-}
-
-.edit section {
- text-align: left;
- padding-top: 0px;
- padding-bottom: 0px;
- padding-left: 8%;
- padding-right: 8%;
- line-height: 1.2em;
}
-.button, input, textarea, select {
- display: inline-block;
- width: 90%;
- padding-left: 15px;
- padding-right: 15px;
- margin: 5px;
- margin-left: 5%;
- margin-right: 5%;
- height: 30px;
- border-style: unset;
-}
-.button {
- text-align: center;
- color: black;
- font-size: 13px;
- padding-top: 7px;
- background-color: #bfbfbf;
- box-sizing: border-box;
- align-items: flex-start;
- text-align: center;
- cursor: default;
- white-space: pre;
- -webkit-rtl-ordering: logical;
- text-rendering: auto;
- color: initial;
- letter-spacing: normal;
- word-spacing: normal;
- text-transform: none;
- text-indent: 0px;
- text-shadow: none;
-}
-.button:hover {
-
- text-decoration: none;
-}
-article {
- position: relative;
- z-index: 7;
-}
-#html{
- height: calc(100% - 95px);
+form{
+ margin: 0;
}
-#css{
- height: 250px;
-}
-input[type="submit"] {
- background-color: #bfbfbf;
-}
-
-aside {
- position: fixed;
- bottom: 0px;
- right: -300px;
- padding: 7px;
- z-index: 5;
- background: #bfbfbf;
- opacity: 0.3;
- width: 350px;
- overflow-y: scroll;
- max-height: calc(100% - 200px);
-}
-
-aside:hover {
- opacity: 1;
- right: 0px;
-}
nav {
position: fixed;
- top: 0px;
- right: -6%;
- z-index: 10;
- opacity: 0.3;
- width: 8%;
- text-align: right;
-}
-
-
-
-nav:hover, .edit nav {
- opacity: 1;
- right: 0px;
+ top: 0;
+ right: 0;
+ z-index: 10;
+ background-color: var(--color1);
+ /* width: calc(10% - 20px); */
+ width: 10%;
+ border: ridge 1px grey;
}
-.alert h4 {
- background-color: red;
- margin: 0px;
+div#menu {
+ display: none;
}
-table {
- width: 100%;
- margin-top: 20px;
-}
-
-.home tr:hover {
- background-color: #bfbfbf;
+nav:hover div#menu {
+ display: block;
}
-.home td:hover {
- background-color: #a7a6a6;
+nav a {
+ display: block;
}
-td {
- border: 1px solid #ffffff00;
- padding-top: 3px;
- padding-bottom: 3px;
+nav a:hover {
+ background-color: var(--color2);
}
-.submit {
- position: fixed;
- top: 0px;
- left: 0px;
- width: 8%;
+nav #loginpass {
+ width: 100%;
}
-summary {
- height: 24px;
- outline: none;
- font-size: 1.4em;
- background-color: #a0a0a0;
- margin-top: 3px;
- margin-bottom: 3px;
-} \ No newline at end of file
diff --git a/public/css/styleedit.css b/public/css/styleedit.css
new file mode 100644
index 0000000..0e5ed01
--- /dev/null
+++ b/public/css/styleedit.css
@@ -0,0 +1,120 @@
+.edit {
+ background-color: var(--color1);
+}
+
+#linklist {
+ background-color: var(--color1);
+}
+
+#submit {
+ background-color: var(--color1);
+}
+
+#copy {
+ background-color: var(--color1);
+}
+
+
+#artedit {
+ background-color: var(--color1);
+}
+
+details {
+ background-color: var(--color1);
+}
+
+
+
+
+
+
+details#editinfo {
+ position: fixed;
+ top: 0;
+ left: 10%;
+ width: 40%;
+}
+
+details#editcss {
+ position: fixed;
+ top: 0;
+ left: 50%;
+ width: 40%;
+}
+
+div#submit {
+ position: fixed;
+ top: 0;
+ width: 10%;
+}
+
+textarea#html {
+ width: 100%;
+ height: 100%;
+ font-size: 1em;
+ padding-top: 40px;
+ padding-bottom: 40px;
+ font-family: serif;
+ padding-left: 2%;
+ padding-right: calc(50% - 500px);
+
+}
+
+
+div#copy {
+ position: fixed;
+ bottom: 0;
+}
+
+div#linklist {
+ position: fixed;
+ bottom: 0;
+ right: 0;
+ min-width: 10%;
+ max-width: 50%;
+ max-height: 50%;
+ overflow-y: auto;
+
+}
+
+div#linklist div#roll {
+ display: none;
+}
+
+div#linklist:hover div#roll {
+ display: block;
+ width: auto;
+}
+
+div#roll ul {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+
+
+details label {
+ display: block;
+ margin-top: 4px;
+}
+
+textarea#css {
+ width: 100%;
+ height: 200px;
+}
+
+details select, details input, details label, details textarea#css {
+ width: 100%;
+}
+
+fieldset {
+ margin: 0;
+ padding: 0;
+ border: none;
+}
+
+summary, div#linklist, div#copy, div#submit {
+ border: ridge 1px grey;
+
+} \ No newline at end of file
diff --git a/public/css/stylehome.css b/public/css/stylehome.css
new file mode 100644
index 0000000..b2e8c73
--- /dev/null
+++ b/public/css/stylehome.css
@@ -0,0 +1,56 @@
+div#options {
+ background-color: var(--color1);
+}
+
+#home2table {
+ background-color: var(--color3);
+}
+
+header {
+ background-color: var(--color1);
+}
+
+
+
+
+section.home {
+ margin-top: 20px;
+ display: inline-flex;
+ width: 100%;
+}
+
+header {
+ position: fixed;
+ width: 100%;
+ border: ridge 1px grey;
+}
+
+
+div#options {
+ width: 15%;
+ list-style: none;
+}
+
+
+#home2table {
+ width: 85%;
+}
+
+#options ul {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+
+#home2table tr:hover {
+ background-color: var(--color1);
+}
+
+#home2table th {
+ background-color: var(--color1);
+ border: ridge 1px grey;
+}
+
+
+
diff --git a/public/css/stylew.css b/public/css/stylew.css
deleted file mode 100644
index f175036..0000000
--- a/public/css/stylew.css
+++ /dev/null
@@ -1,249 +0,0 @@
-body {
- background-color: #dcdcdceb;
- font-family: helvetica, arial, sans-serif;
- margin: 0px;
- overflow: hidden;
-
-}
-
-h1 {
- font-size: 3em;
- font-variant: all-small-caps;
- margin-top: 0px;
- margin-bottom: 0px;
-}
-
-h2 {
- font-style: italic;
-}
-
-h3 {
- opacity: 0.7;
-}
-
-h6 {
- font-size: 1em;
-}
-
-p{
- font-size: 1em;
-}
-
-em {
- opacity: 0.8;
-}
-
-a{
- text-decoration: none;
-}
-
-a:hover{
- text-decoration: underline;
-}
-
-img {
- width: 90%;
- max-width: 1000px;
-}
-
-form {
- margin-bottom: 0px;
-}
-
-section {
- text-align: justify;
- padding: 3%;
-}
-
-.edit {
- overflow-y: scroll;
- height: 100%;
-
-}
-
-.lecture {
- overflow-wrap: break-word;
- overflow-y: auto;
- height: 100%;
-}
-
-.home {
- overflow-y: scroll;
- height: 100%;
-}
-
-.edit section {
- text-align: left;
- padding-top: 0px;
- padding-bottom: 0px;
- padding-left: 8%;
- padding-right: 8%;
- line-height: 1.2em;
-}
-
-.button, input, textarea, select {
- display: inline-block;
- width: 90%;
- padding-left: 15px;
- padding-right: 15px;
- margin: 5px;
- margin-left: 5%;
- margin-right: 5%;
- height: 30px;
- border-style: unset;
-}
-
-.button {
- text-align: center;
- color: black;
- font-size: 13px;
- padding-top: 7px;
- background-color: #bfbfbf;
- box-sizing: border-box;
- align-items: flex-start;
- text-align: center;
- cursor: default;
- white-space: pre;
- -webkit-rtl-ordering: logical;
- text-rendering: auto;
- color: initial;
- letter-spacing: normal;
- word-spacing: normal;
- text-transform: none;
- text-indent: 0px;
- text-shadow: none;
-}
-
-.button:hover {
-
- text-decoration: none;
-}
-
-article {
- position: relative;
- z-index: 7;
-}
-
-#html{
- height: calc(100% - 95px);
-}
-
-#css{
- height: 250px;
-}
-
-input[type="submit"] {
- background-color: #bfbfbf;
-}
-
-aside {
- position: fixed;
- bottom: 0px;
- right: -300px;
- padding: 7px;
- z-index: 5;
- background: #bfbfbf;
- opacity: 0.3;
- width: 350px;
- overflow-y: scroll;
- max-height: calc(100% - 200px);
-}
-
-aside:hover {
- opacity: 1;
- right: 0px;
-}
-
-nav {
- position: fixed;
- top: 0px;
- right: -6%;
- z-index: 10;
- opacity: 0.3;
- width: 8%;
- text-align: right;
-}
-
-
-
-nav:hover, .edit nav {
- opacity: 1;
- right: 0px;
-}
-
-.alert h4 {
- background-color: red;
- margin: 0px;
-}
-
-table {
- width: 100%;
- margin-top: 20px;
-}
-
-.home tr:hover {
- background-color: #bfbfbf;
-}
-
-.home td:hover {
- background-color: #a7a6a6;
-}
-
-td {
- border: 1px solid #ffffff00;
- padding-top: 3px;
- padding-bottom: 3px;
-}
-
-.submit {
- position: fixed;
- top: 0px;
- left: 0px;
- width: 8%;
-}
-
-.thumbnail {
- max-width: 30px;
-}
-
-.infobulle {
- width: 20%;
- display: none;
-}
-
-.little:hover .infobulle {
- display: inline;
- position: absolute;
- background-color: white;
- border: 1px solid black;
-}
-
-span.infobulle img {
- width: 100%
-}
-
-.grid {
- display: flex;
- flex-wrap: wrap;
-}
-
-.copy {
- position: fixed;
- bottom: 0px;
- left: 0px;
- width: 8%;
-}
-
-.container {
- position: relative;
- width: 100%;
- height: 0;
- padding-bottom: 56.25%;
- }
- .video {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- } \ No newline at end of file
diff --git a/public/rsc/js/app.js b/public/rsc/js/app.js
index d1b9f55..b806baf 100644
--- a/public/rsc/js/app.js
+++ b/public/rsc/js/app.js
@@ -1,5 +1,7 @@
-function confirmSubmit(event, element) {
+function confirmSubmit(event, element, idform) {
if (window.confirm('Confirmer ? ' + element) === false) {
event.preventDefault();
+ } else {
+ document.getElementById(idform).submit();
}
} \ No newline at end of file
diff --git a/public/w/index.php b/public/w/index.php
index 9229bb9..8b5069f 100644
--- a/public/w/index.php
+++ b/public/w/index.php
@@ -4,16 +4,14 @@
// _____________________________________________________ R E Q U I R E ________________________________________________________________
require('../../vendor/autoload.php');
-use Michelf\Markdown;
-use Michelf\MarkdownExtra;
-
require('../../fn/fn.php');
-require('../../class/class.w.config.php');
-require('../../class/class.w.art.php');
-require('../../class/class.w.app.php');
-require('../../class/class.w.aff.php');
-require('../../class/class.w.media.php');
-require('../../class/class.w.record.php');
+
+function my_autoloader($class)
+{
+ require('../../class/class.w.' . strtolower($class) . '.php');
+}
+spl_autoload_register('my_autoloader');
+
// ________________________________________________________ I N S T A L _________________________________________________
@@ -173,19 +171,18 @@ if (isset($_GET['id'])) {
$app->setbdd($config);
if ($app->exist($_GET['id'])) {
$art = $app->get($_GET['id']);
- if (isset($_GET['edit']) && $_GET['edit'] == 1) {
- $aff->arthead($art, $config->cssread(), 1);
- } else {
- $aff->arthead($art, $config->cssread(), 0);
+ if (!isset($_GET['edit'])) {
+ $_GET['edit'] = 0;
}
+ $aff->arthead($art, $config->cssread(), $_GET['edit']);
} else {
- $aff->head($_GET['id'], 'w');
+ $aff->head($_GET['id'], '');
}
} elseif (isset($_GET['aff'])) {
$aff->head($_GET['aff'], $_GET['aff']);
} else {
- $aff->head('home', 'w');
+ $aff->head('home', 'home');
}
@@ -197,7 +194,7 @@ if (isset($_GET['id'])) {
// _____________________________________________________ A L E R T _______________________________________________________________
if (isset($_GET['message'])) {
- echo '<span class="alert"><h4>' . $_GET['message'] . '</h4></span>';
+ echo '<span class="alert">' . $_GET['message'] . '</span>';
}
@@ -221,11 +218,15 @@ if (isset($_GET['id'])) {
$art = $app->get($_GET['id']);
if (isset($_GET['edit']) and $_GET['edit'] == 1 and $app->session() >= $app::EDITOR) {
- $aff->edit($art, $app, $app->getlister(['id', 'titre'], 'id'));
- $aff->copy($art, $app->getlister(['id', 'titre'], 'id'));
+ echo '<section class=edit>';
+ $aff->edit($art, $app, $app->getlister(['id', 'titre']));
+ $aff->copy($art, $app->getlister(['id', 'titre']));
$aff->aside($app);
+ echo '</section>';
} else {
+ echo '<section class="lecture">';
$aff->lecture($art, $app);
+ echo '</section>';
}
} else {
@@ -237,7 +238,7 @@ if (isset($_GET['id'])) {
header('Location: ?id=' . $_GET['id'] . '&edit=1');
}
} else {
- echo '<span class="alert"><h4>This article does not exist yet</h4></span>';
+ echo '<span class="alert">This article does not exist yet</span>';
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>';
@@ -254,7 +255,7 @@ if (isset($_GET['id'])) {
} elseif (isset($_GET['lien'])) {
$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);
+ $aff->lien($app->getlister(['id', 'titre', 'intro', 'lien']), $_GET['lien'], $app);
} elseif (isset($_GET['aff']) && $app->session() >= $app::EDITOR) {
if ($_GET['aff'] == 'admin' && $app->session() >= $app::ADMIN) {
@@ -292,27 +293,49 @@ if (isset($_GET['id'])) {
echo '</section>';
+ } elseif ($_GET['aff'] == 'map') {
+ $app->setbdd($config);
+ $aff->map($app, $config->domain());
} else {
header('Location: ./');
}
} else {
- $app->setbdd($config);
- if (isset($_GET['tri'])) {
- $tri = strip_tags($_GET['tri']);
- } else {
- $tri = 'id';
- }
- if (isset($_GET['desc'])) {
- $desc = strip_tags($_GET['desc']);
- } else {
- $desc = 'ASC';
+ $aff->header();
+
+ echo '<section class="home">';
+
+
+ $app->setbdd($config);
+ $opt = new Opt(Art::classvarlist());
+ $opt->hydrate($_GET);
+ $opt->setcol(['id', 'tag', 'lien', 'contenu', 'intro', 'titre', 'datemodif', 'datecreation', 'secure']);
+ $table = $app->getlisteropt($opt);
+ $app->listcalclien($table);
+ $opt->settaglist($table);
+ $opt->setcol(['id', 'tag', 'lien', 'contenu', 'intro', 'titre', 'datemodif', 'datecreation', 'secure', 'liento']);
+
+ $aff->option($app, $opt);
+
+ $filtertagor = $app->filtertagor($table, $opt->tagor());
+ $filtersecure = $app->filtersecure($table, $opt->secure());
+
+ $filter = array_intersect($filtertagor, $filtersecure);
+ $table2 = [];
+ foreach ($table as $art) {
+ if (in_array($art->id(), $filter)) {
+ $table2[] = $art;
+ }
}
- $aff->home2table($app, $app->getlister(['id', 'titre', 'intro', 'lien', 'datecreation', 'datemodif'], $tri, $desc));
+ $app->artlistsort($table2, $opt->sortby(), $opt->order());
+
+
+
+ $aff->home2table($app, $table2);
- //var_dump($app->getlister(['id', 'lien']));
+ echo '</section>';
}