aboutsummaryrefslogtreecommitdiff
path: root/public/w
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-10-18 01:08:46 +0200
committervincent-peugnet <v.peugnet@free.fr>2018-10-18 01:08:46 +0200
commit7b2e48276b2a3ceff83c906d38077f8d0479c3df (patch)
tree0fc26bb1cbae5a30583292fbfb2b752fb623a94d /public/w
parent65796d4a2349e71ca05f5f298d6f94ff792d88b2 (diff)
downloadwcms-7b2e48276b2a3ceff83c906d38077f8d0479c3df.tar.gz
wcms-7b2e48276b2a3ceff83c906d38077f8d0479c3df.zip
2.92 new architecture + quickcss class
Diffstat (limited to 'public/w')
-rw-r--r--public/w/article.php33
-rw-r--r--public/w/home.php85
-rw-r--r--public/w/index.php359
-rw-r--r--public/w/menu.php56
-rw-r--r--public/w/rsc/css/styleadmin.css (renamed from public/w/css/styleadmin.css)0
-rw-r--r--public/w/rsc/css/stylebase.css (renamed from public/w/css/stylebase.css)0
-rw-r--r--public/w/rsc/css/styleedit.css (renamed from public/w/css/styleedit.css)0
-rw-r--r--public/w/rsc/css/stylehome.css (renamed from public/w/css/stylehome.css)0
-rw-r--r--public/w/rsc/css/styleinfo.css (renamed from public/w/css/styleinfo.css)0
-rw-r--r--public/w/rsc/css/stylemedia.css (renamed from public/w/css/stylemedia.css)0
-rw-r--r--public/w/rsc/css/stylerecord.css (renamed from public/w/css/stylerecord.css)0
11 files changed, 1 insertions, 532 deletions
diff --git a/public/w/article.php b/public/w/article.php
deleted file mode 100644
index 307caa4..0000000
--- a/public/w/article.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-if ($app->exist($_GET['id'])) {
-
- $art = $app->get($_GET['id']);
-
- if (isset($_GET['edit']) and $_GET['edit'] == 1 and $app->session() >= $app::EDITOR) {
- echo '<section class=edit>';
- $aff->edit($art, $app, $app->getlister(['id', 'titre']), $config->fontsize(), $app->getlistermedia($app::MEDIA_DIR, 'image'));
- //$aff->copy($art, $app->getlister(['id', 'titre']));
- $aff->aside($app);
- echo '</section>';
- } else {
- echo '<section class="lecture">';
-
-
- $art->autotaglistupdate($app->taglist($app->getlister(['id', 'titre', 'intro', 'tag']), $art->autotaglist()));
-
-
- $aff->lecture($art, $app);
- echo '</section>';
-
- }
-} else {
- 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>';
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/public/w/home.php b/public/w/home.php
deleted file mode 100644
index 3094d03..0000000
--- a/public/w/home.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-
-
-$aff->header();
-
-echo '<section class="home">';
-
-
-if ($app->session() >= $app::EDITOR) {
-
- $app->bddinit($config);
-
- $opt = new Opt(Art::classvarlist());
- $opt->setcol(['id', 'tag', 'lien', 'contenu', 'intro', 'titre', 'datemodif', 'datecreation', 'secure']);
- $table = $app->getlisteropt($opt);
- $app->listcalclien($table);
- $opt->settaglist($table);
- $opt->submit();
-
-
-
-
-
-
-
-
-
-
-
- $opt->setcol(['id', 'tag', 'lien', 'contenu', 'intro', 'titre', 'datemodif', 'datecreation', 'secure', 'liento']);
-
-
- $aff->option($app, $opt);
-
- $filtertagfilter = $app->filtertagfilter($table, $opt->tagfilter(), $opt->tagcompare());
- $filtersecure = $app->filtersecure($table, $opt->secure());
-
- $filter = array_intersect($filtertagfilter, $filtersecure);
- $table2 = [];
- $table2invert = [];
- foreach ($table as $art) {
- if (in_array($art->id(), $filter)) {
- $table2[] = $art;
- } else {
- $table2invert[] = $art;
- }
-
-
- }
-
- if(!empty($opt->invert())) {
- $table2 = $table2invert;
- }
-
- $app->artlistsort($table2, $opt->sortby(), $opt->order());
-
-
- echo '<div id="flex">';
-
-
- $aff->home2table($app, $table2, $app->getlister());
-
-
-
-
- echo '<div id="map">';
- $aff->mapheader();
- if(isset($_GET['map'])) {
- $aff->mermaid($app->map($table2));
- }
- echo '</div>';
-
-
-
-
-
- echo '</div>';
-
-}
-
-
-
-echo '</section>';
-
-?> \ No newline at end of file
diff --git a/public/w/index.php b/public/w/index.php
index a5b3e03..bc5047e 100644
--- a/public/w/index.php
+++ b/public/w/index.php
@@ -1,362 +1,5 @@
<?php
-// _____________________________________________________ R E Q U I R E ________________________________________________________________
-
-session_start();
-
-
-
-require('../../vendor/autoload.php');
-require('../../fn/fn.w.php');
-
-spl_autoload_register('my_autoloader');
-
-
-
-
-// ________________________________________________________ I N S T A L _________________________________________________
-
-$app = new App();
-$aff = new Aff();
-
-
-$config = $app->readconfig();
-if (!$config) {
- $message = 'config_file_error';
- echo $message;
- if (isset($_POST['config']) && $_POST['config'] == 'create') {
- $config = $app->createconfig($_POST);
- $app->savejson($config->tojson());
- header('Location: ./');
-
- } else {
- $aff->configform();
- }
- exit;
-}
-
-
-// _________________________________________________________ S E S ___________________________________________________________
-
-
-if (!isset($_SESSION['level'])) {
- $session = 0;
-} else {
- $session = $_SESSION['level'];
-}
-
-$app->setsession($session);
-
-
-
-
-// _______________________________________________________ A C T I O N __________________________________________________________________
-
-
-if (isset($_POST['action'])) {
- switch ($_POST['action']) {
-
- case 'login':
- $_SESSION['level'] = $app->login($_POST['pass'], $config);
- if (isset($_GET['id'])) {
- header('Location: ?id=' . $_GET['id']);
- } else {
- header('Location: ./');
- }
- break;
-
- case 'logout':
- $_SESSION['level'] = $app->logout();
- if (isset($_GET['id'])) {
- header('Location: ?id=' . $_GET['id']);
- } else {
- header('Location: ./');
- }
- break;
-
- case 'addmedia':
- $message = $app->addmedia($_FILES, 2 ** 24, $_POST['id']);
- header('Location: ./?aff=media&message=' . $message);
- break;
-
- case 'addcss':
- $message = $app->addcss($_FILES, 2 ** 24, $_POST['id']);
- header('Location: ./?aff=admin&message=' . $message);
- break;
-
- case 'editcss':
- file_put_contents($app::CSS_READ_DIR . $config->cssread(), $_POST['editcss']);
- header('Location: ./?aff=admin');
- break;
-
- case 'editconfig':
- $config->hydrate($_POST);
- $app->savejson($config->tojson());
- header('Location: ./?aff=admin');
- break;
-
-
- }
-}
-
-
-
-// _____________________________________________________ D A T A B A S E __________________________________________________________________
-
-if (isset($_POST['action'])) {
- $app->bddinit($config);
-
- switch ($_POST['action']) {
-
- case 'new':
- if (isset($_GET['id'])) {
- $art = new Art($_GET);
- $art->reset();
- $app->add($art);
- header('Location: ?id=' . $_GET['id'] . '&edit=1');
- }
- break;
-
- case 'update':
- if ($app->exist($_GET['id'])) {
- $art = new Art($_POST);
- $art->updatelien();
- $art->autotaglistcalc($app->taglist($app->getlister(['id', 'titre', 'tag']), $art->autotaglist()));
- $app->update($art);
- if($config->fontsize() != $_POST['fontsize']) {
- $config->setfontsize($_POST['fontsize']);
- $app->savejson($config->tojson());
- }
- header('Location: ?id=' . $art->id() . '&edit=1&message='.$art->id().'_saved');
- }
- break;
-
- case 'display':
- if ($app->exist($_GET['id'])) {
- $art = new Art($_POST);
- $art->updatelien();
- $art->autotaglistcalc($app->taglist($app->getlister(['id', 'titre', 'tag']), $art->autotaglist()));
- $app->update($art);
- if($config->fontsize() != $_POST['fontsize']) {
- $config->setfontsize($_POST['fontsize']);
- $app->savejson($config->tojson());
- }
- header('Location: ?id=' . $art->id().'&message='.$art->id().'_saved');
- }
- break;
-
- case 'home':
- if ($app->exist($_GET['id'])) {
- $art = new Art($_POST);
- $art->updatelien();
- $art->autotaglistcalc($app->taglist($app->getlister(['id', 'titre', 'tag']), $art->autotaglist()));
- $app->update($art);
- if($config->fontsize() != $_POST['fontsize']) {
- $config->setfontsize($_POST['fontsize']);
- $app->savejson($config->tojson());
- }
- header('Location: ./?message='.$art->id().'_saved');
- }
- break;
-
- case 'copy':
- if ($app->exist($_GET['id'])) {
- $copy = $app->get($_POST['copy']);
- $art = $app->get($_POST['id']);
- if (!empty($_POST['css'])) {
- $art->setcss($copy->css());
- }
- if (!empty($_POST['color'])) {
- $art->setcouleurtext($copy->couleurtext());
- $art->setcouleurbkg($copy->couleurbkg());
- $art->setcouleurlien($copy->couleurlien());
- $art->setcouleurlienblank($copy->couleurlienblank());
- }
- if (!empty($_POST['html'])) {
- $art->sethtml($copy->md());
- }
- if (!empty($_POST['template'])) {
- $art->settemplate($copy->template());
- }
- $app->update($art);
- header('Location: ?id=' . $art->id() . '&edit=1');
- }
- break;
-
- case 'delete':
- if ($app->exist($_GET['id'])) {
- $art = new Art($_POST);
- $app->delete($art);
- header('Location: ?id=' . $art->id());
- }
- break;
-
- case 'massedit':
- if (isset($_POST['id'])) {
- foreach ($_POST['id'] as $id) {
- if ($app->exist($id)) {
- $art = $app->get($id);
-
- switch ($_POST['massaction']) {
- case 'do':
- switch ($_POST['massedit']) {
- case 'delete':
- $app->delete($art);
- break;
-
- case 'erasetag':
- $art->settag('');
- $app->update($art);
- break;
-
- case 'erasetemplate':
- $art->settemplate('');
- $app->update($art);
- break;
-
- case 'not published':
- $art->setsecure(2);
- $app->update($art);
- break;
-
- case 'private':
- $art->setsecure(1);
- $app->update($art);
- break;
-
- case 'public':
- $art->setsecure(0);
- $app->update($art);
- break;
- }
- break;
-
- case 'set template':
- if (isset($_POST['masstemplate'])) {
- $art->settemplate($_POST['masstemplate']);
- $app->update($art);
- }
- break;
-
- case 'add tag':
- if (isset($_POST['targettag'])) {
- $art = $app->get($id);
- $tagstring = strip_tags(trim(strtolower($_POST['targettag'])));
- $taglist = str_replace(' ', '', $tagstring);
- $taglist = explode(",", $taglist);
- foreach ($taglist as $tag) {
- if (!in_array($tag, $art->tag('array'))) {
- $newtaglist = $art->tag('array');
- array_push($newtaglist, $tag);
- $art->settag($newtaglist);
- }
- }
- $app->update($art);
- }
- break;
-
- }
-
-
-
-
- }
- header('Location: ./');
- }
- break;
- }
- }
-}
-
-
-
-
-
-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;
-
- case 'duplicatetable':
- $message = $app->tableduplicate($config->dbname(), $_POST['arttable'], $_POST['tablename']);
- header('Location: ./?aff=admin&message=' . $message);
- break;
-
- }
-}
-
-
-
-
-// _______________________________________________________ H E A D _____________________________________________________________
-
-if (isset($_GET['id'])) {
- $app->bddinit($config);
- if ($app->exist($_GET['id'])) {
- $art = $app->get($_GET['id']);
- if (!isset($_GET['edit'])) {
- $_GET['edit'] = 0;
- }
- $aff->arthead($art, $app::CSS_READ_DIR, $config->cssread(), $_GET['edit']);
- } else {
- // $aff->head($_GET['id'], '', 'white');
- $aff->noarthead($_GET['id'], $app::CSS_READ_DIR, $config->cssread());
-
- }
-} elseif (isset($_GET['aff'])) {
- $aff->head($_GET['aff'], $_GET['aff'], $config->color4());
-} else {
- $aff->head('home', 'home', $config->color4());
-}
-
-
-
-
-
-
-
-// _____________________________________________________ A L E R T _______________________________________________________________
-
-if (isset($_GET['message'])) {
- echo '<span class="alert">' . $_GET['message'] . '</span>';
-}
-
-
-
-
-
-
-
-
-// ______________________________________________________ B O D Y _______________________________________________________________
-
-
-$aff->nav($app);
-
-if (array_key_exists('id', $_GET)) {
- $app->bddinit($config);
- include('article.php');
-} elseif (array_key_exists('tag', $_GET)) {
- $app->bddinit($config);
- echo '<h4>' . $_GET['tag'] . '</h4>';
- $aff->tag($app->getlister(['id', 'titre', 'intro', 'tag']), $_GET['tag'], $app);
-} elseif (array_key_exists('lien', $_GET)) {
- $app->bddinit($config);
- echo '<h4><a href="?id=' . $_GET['lien'] . '">' . $_GET['lien'] . '</a></h4>';
- $aff->lien($app->getlister(['id', 'titre', 'intro', 'lien']), $_GET['lien'], $app);
-} elseif (array_key_exists('aff', $_GET)) {
- include('menu.php');
-} else {
- include('home.php');
-}
-
-
+require('../../w/w.router.php');
?> \ No newline at end of file
diff --git a/public/w/menu.php b/public/w/menu.php
deleted file mode 100644
index 8e89ed1..0000000
--- a/public/w/menu.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-
-if ($app->session() >= $app::EDITOR) {
-
- if ($_GET['aff'] == 'admin' && $app->session() >= $app::ADMIN) {
- echo '<section>';
- echo '<h1>Admin</h1>';
-
- $aff->admincss($config, $app);
- $aff->adminpassword($config);
- $aff->admindb($config);
- if ($app->setbdd($config)) {
- $status = "OK";
- } else {
- $status = "Not Connected";
- }
- $aff->admintable($config, $status, $app->tablelist($config->dbname()));
- $aff->admindisplay($config->color4());
-
- echo '</section>';
- } elseif ($_GET['aff'] == 'media') {
- echo '<h1>Media</h1>';
- echo '<section>';
- echo '<article>';
-
- $aff->addmedia($app);
- $aff->medialist($app->getlistermedia($app::MEDIA_DIR), $app::MEDIA_DIR);
-
- echo '</article>';
- echo '</section>';
-
- } elseif ($_GET['aff'] == 'record') {
- echo '<h1>Record</h1>';
- echo '<section>';
-
- $aff->recordlist($app);
-
- echo '</section>';
-
- } elseif ($_GET['aff'] == 'info') {
-
-
-
- } else {
-
- echo '<h1>Private</h1><p>You dont have the permission to access this page.</p>';
-
- }
-
-
-} else {
- echo '<h1>Private</h1><p>You should be connected to access this page.</p>';
-}
-
-?> \ No newline at end of file
diff --git a/public/w/css/styleadmin.css b/public/w/rsc/css/styleadmin.css
index a3fcc5c..a3fcc5c 100644
--- a/public/w/css/styleadmin.css
+++ b/public/w/rsc/css/styleadmin.css
diff --git a/public/w/css/stylebase.css b/public/w/rsc/css/stylebase.css
index 017b075..017b075 100644
--- a/public/w/css/stylebase.css
+++ b/public/w/rsc/css/stylebase.css
diff --git a/public/w/css/styleedit.css b/public/w/rsc/css/styleedit.css
index fe6745f..fe6745f 100644
--- a/public/w/css/styleedit.css
+++ b/public/w/rsc/css/styleedit.css
diff --git a/public/w/css/stylehome.css b/public/w/rsc/css/stylehome.css
index 98822f0..98822f0 100644
--- a/public/w/css/stylehome.css
+++ b/public/w/rsc/css/stylehome.css
diff --git a/public/w/css/styleinfo.css b/public/w/rsc/css/styleinfo.css
index a3fcc5c..a3fcc5c 100644
--- a/public/w/css/styleinfo.css
+++ b/public/w/rsc/css/styleinfo.css
diff --git a/public/w/css/stylemedia.css b/public/w/rsc/css/stylemedia.css
index d721a9b..d721a9b 100644
--- a/public/w/css/stylemedia.css
+++ b/public/w/rsc/css/stylemedia.css
diff --git a/public/w/css/stylerecord.css b/public/w/rsc/css/stylerecord.css
index 409bcd4..409bcd4 100644
--- a/public/w/css/stylerecord.css
+++ b/public/w/rsc/css/stylerecord.css