diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/class/Controller.php | 14 | ||||
-rw-r--r-- | app/class/Controllerhome.php | 67 | ||||
-rw-r--r-- | app/class/Controllerpage.php | 36 | ||||
-rw-r--r-- | app/class/Controlleruser.php | 6 | ||||
-rw-r--r-- | app/class/Item.php | 12 | ||||
-rw-r--r-- | app/class/Model.php | 1 | ||||
-rw-r--r-- | app/class/Modelmedia.php | 14 | ||||
-rw-r--r-- | app/class/Modelpage.php | 13 | ||||
-rw-r--r-- | app/class/User.php | 20 | ||||
-rw-r--r-- | app/view/templates/admin.php | 395 | ||||
-rw-r--r-- | app/view/templates/edit.php | 2 | ||||
-rw-r--r-- | app/view/templates/home.php | 392 | ||||
-rw-r--r-- | app/view/templates/homemenu.php | 33 | ||||
-rw-r--r-- | app/view/templates/info.php | 2 | ||||
-rw-r--r-- | app/view/templates/layout.php | 14 | ||||
-rw-r--r-- | app/view/templates/media.php | 6 | ||||
-rw-r--r-- | app/view/templates/timeline.php | 4 | ||||
-rw-r--r-- | app/view/templates/user.php | 36 |
18 files changed, 558 insertions, 509 deletions
diff --git a/app/class/Controller.php b/app/class/Controller.php index ccf31fa..bcfcdba 100644 --- a/app/class/Controller.php +++ b/app/class/Controller.php @@ -99,6 +99,20 @@ class Controller exit; } + /** + * + */ + public function sendstatflashmessage(int $count, int $total, string $message) + { + if ($count === $total) { + Model::sendflashmessage($count . ' / ' . $total . ' ' . $message, 'success'); + } elseif ($count > 0) { + Model::sendflashmessage($count . ' / ' . $total . ' ' . $message, 'warning'); + } else { + Model::sendflashmessage($count . ' / ' . $total . ' ' . $message, 'error'); + } + } + } diff --git a/app/class/Controllerhome.php b/app/class/Controllerhome.php index dae7030..d024a19 100644 --- a/app/class/Controllerhome.php +++ b/app/class/Controllerhome.php @@ -146,11 +146,15 @@ class Controllerhome extends Controllerpage { if ($this->user->iseditor()) { $pagelist = $this->modelhome->pagelist(); + $count = 0; foreach ($pagelist as $page) { - $this->renderpage($page); - $this->pagemanager->update($page); + $page = $this->renderpage($page); + if ($this->pagemanager->update($page)) { + $count ++; + } } - Model::sendflashmessage('All pages have been rendered', 'success'); + $total = count($pagelist); + $this->sendstatflashmessage($count, $total, 'pages have been rendered'); } $this->routedirect('home'); } @@ -203,36 +207,45 @@ class Controllerhome extends Controllerpage $this->multidelete(); break; } + } else { + $action = $_POST['action'] ?? 'edit'; + Model::sendflashmessage('Please select some pages to ' . $action, 'warning'); } $this->routedirect('home'); } public function multiedit() { - if (isset($_POST['pagesid'])) { - $datas = $_POST['datas']?? []; - $datas = array_filter($datas, function ($var) { - return $var !== ""; - }); - $datas = array_map(function ($value) { - if($value === "!") { - return ""; - } else { - return $value; - } - }, $datas); - $reset = $_POST['reset'] ?? []; - $addtag = $_POST['addtag'] ?? ''; - $addauthor = $_POST['addauthor'] ?? ''; - foreach ($_POST['pagesid'] as $id) { - $this->pagemanager->pageedit($id, $datas, $reset, $addtag, $addauthor); + $pagelist = $_POST['pagesid'] ?? []; + $datas = $_POST['datas']?? []; + $datas = array_filter($datas, function ($var) { + return $var !== ""; + }); + $datas = array_map(function ($value) { + if($value === "!") { + return ""; + } else { + return $value; + } + }, $datas); + $reset = $_POST['reset'] ?? []; + $addtag = $_POST['addtag'] ?? ''; + $addauthor = $_POST['addauthor'] ?? ''; + $count = 0; + $total = 0; + foreach ($pagelist as $id) { + $total ++; + if($this->pagemanager->pageedit($id, $datas, $reset, $addtag, $addauthor)) { + $count ++; } } + $this->sendstatflashmessage($count, $total, 'pages have been edited'); } public function multirender() { $pagelist = $_POST['pagesid'] ?? []; + $total = count($pagelist); $pagelist = $this->pagemanager->pagelistbyid($pagelist); $count = 0; foreach ($pagelist as $page) { @@ -240,19 +253,25 @@ class Controllerhome extends Controllerpage if($this->pagemanager->update($page)) { $count ++; } - } - Model::sendflashmessage($count . ' pages have been rendered', 'success'); + $this->sendstatflashmessage($count, $total, 'pages have been rendered'); } public function multidelete() { if(isset($_POST['confirmdelete']) && $_POST['confirmdelete']) { $pagelist = $_POST['pagesid'] ?? []; + $total = count($pagelist); + $count = 0; foreach ($pagelist as $id) { - $this->pagemanager->delete($id); + if ($this->pagemanager->delete($id)) { + $count ++; + } } - } + $this->sendstatflashmessage($count, $total, 'pages have been deleted'); + } else { + Model::sendflashmessage('Confirm delete has not been cheked', 'warning'); + } } } diff --git a/app/class/Controllerpage.php b/app/class/Controllerpage.php index 909a2c2..990f0b7 100644 --- a/app/class/Controllerpage.php +++ b/app/class/Controllerpage.php @@ -279,25 +279,31 @@ class Controllerpage extends Controller { $page = $this->pagemanager->getfromfile(); + if($page !== false) { - if(!empty($_POST['id'])) { - $page->setid(idclean($_POST['id'])); - } - - if($_POST['datecreation']) { - $page->setdatecreation($this->now); - } - - if($_POST['author']) { - $page->setauthors([$this->user->id()]); - } - - $page->setdaterender($page->datecreation('date')); + if(!empty($_POST['id'])) { + $page->setid(idclean($_POST['id'])); + } + + if($_POST['datecreation']) { + $page->setdatecreation($this->now); + } + + if($_POST['author']) { + $page->setauthors([$this->user->id()]); + } + + $page->setdaterender($page->datecreation('date')); - if($page !== false) { if($_POST['erase'] || $this->pagemanager->get($page) === false) { - $this->pagemanager->add($page); + if($this->pagemanager->add($page)) { + Model::sendflashmessage('Page successfully uploaded', 'success'); + } + } else { + Model::sendflashmessage('Page ID already exist, check remplace if you want to erase it', 'warning'); } + } else { + Model::sendflashmessage('Error while importing page JSON', 'error'); } $this->routedirect('home'); } diff --git a/app/class/Controlleruser.php b/app/class/Controlleruser.php index 1586679..1f53f76 100644 --- a/app/class/Controlleruser.php +++ b/app/class/Controlleruser.php @@ -32,7 +32,11 @@ class Controlleruser extends Controller { if($this->user->iseditor()) { $user = $this->usermanager->get($this->user); - $user->hydrate($_POST); + if ($user->hydrate($_POST)) { + Model::sendflashmessage('User preferences have been successfully updated', 'success'); + } else { + Model::sendflashmessage('There was a problem when updating preferences', 'warning'); + } if ($_POST['passwordhash']) { $user->hashpassword(); } diff --git a/app/class/Item.php b/app/class/Item.php index 8bd62d1..10d35d7 100644 --- a/app/class/Item.php +++ b/app/class/Item.php @@ -12,13 +12,21 @@ abstract class Item public function hydrate($datas = []) { + $error = 0; foreach ($datas as $key => $value) { $method = 'set' . $key; if (method_exists($this, $method)) { - $this->$method($value); + if($this->$method($value) === false) { + $error ++; + } } - } + } + if ($error > 0) { + return false; + } else { + return true; + } } diff --git a/app/class/Model.php b/app/class/Model.php index e26a006..73a800d 100644 --- a/app/class/Model.php +++ b/app/class/Model.php @@ -97,6 +97,7 @@ abstract class Model const MAX_ID_LENGTH = 64; const PASSWORD_MIN_LENGTH = 4; const PASSWORD_MAX_LENGTH = 32; + const MAX_COOKIE_CONSERVATION = 365; /** RENDER OPTIONS */ // add class in html element indicating from witch page the content come. diff --git a/app/class/Modelmedia.php b/app/class/Modelmedia.php index a7ade6c..038f49e 100644 --- a/app/class/Modelmedia.php +++ b/app/class/Modelmedia.php @@ -303,7 +303,7 @@ class Modelmedia extends Model $success[] = $this->deletefile($filedir); } } - Model::sendflashmessage(array_count_values($success) . ' / ' . count($filelist) . ' files have been deleted', 'success'); + Model::sendflashmessage(count(array_filter($success)) . ' / ' . count($filelist) . ' files have been deleted', 'success'); if(in_array(false, $success)) { return false; } else { @@ -338,16 +338,20 @@ class Modelmedia extends Model */ public function multimovefile(array $filedirlist, string $dir) : bool { - $success = []; + $count = 0; foreach ($filedirlist as $filedir ) { if(is_string($filedir)) { - $success[] = $this->movefile($filedir, $dir); + if($this->movefile($filedir, $dir)) { + $count ++; + } } } - Model::sendflashmessage(count($success) . ' / ' . count($filedirlist) . ' files have been moved', 'success'); - if(in_array(false, $success)) { + $total = count($filedirlist); + if($count !== $total) { + Model::sendflashmessage($count . ' / ' . $total . ' files have been moved', 'error'); return false; } else { + Model::sendflashmessage($count . ' / ' . $total . ' files have been moved', 'success'); return true; } } diff --git a/app/class/Modelpage.php b/app/class/Modelpage.php index 492f03e..cf07c2b 100644 --- a/app/class/Modelpage.php +++ b/app/class/Modelpage.php @@ -46,7 +46,7 @@ class Modelpage extends Modeldb * * @param array $idlist list of ID strings * - * @return array of Page objects + * @return Page[] array of Page objects */ public function pagelistbyid(array $idlist = []) : array { @@ -65,13 +65,14 @@ class Modelpage extends Modeldb * Store new page in the database * * @param Page $page object + * @return bool depending on database storing */ - public function add(Page $page) + public function add(Page $page) : bool { $pagedata = new Document($page->dry()); $pagedata->setId($page->id()); - $this->repo->store($pagedata); + return $this->repo->store($pagedata); } /** @@ -395,15 +396,17 @@ class Modelpage extends Modeldb * @param array $reset * @param string $addtag * @param string $addauthor + * + * @return bool Depending on update success */ - public function pageedit($pageid, $datas, $reset, $addtag, $addauthor) + public function pageedit($pageid, $datas, $reset, $addtag, $addauthor) : bool { $page = $this->get($pageid); $page = $this->reset($page, $reset); $page->hydrate($datas); $page->addtag($addtag); $page->addauthor($addauthor); - $this->update($page); + return $this->update($page); } /** diff --git a/app/class/User.php b/app/class/User.php index 518b096..dba43e8 100644 --- a/app/class/User.php +++ b/app/class/User.php @@ -118,6 +118,9 @@ class User extends Item $id = idclean($id); if (strlen($id) < Model::MAX_ID_LENGTH and is_string($id)) { $this->id = $id; + return true; + } else { + return false; } } @@ -132,7 +135,12 @@ class User extends Item public function setpassword($password) { if (!empty($password) && is_string($password)) { - $this->password = $password; + if (strlen($password) >= Model::PASSWORD_MIN_LENGTH && strlen($password) <= Model::PASSWORD_MAX_LENGTH) { + $this->password = $password; + return true; + } else { + return false; + } } } @@ -152,9 +160,13 @@ class User extends Item public function setcookie($cookie) { - $cookie = abs(intval($cookie)); - if($cookie >= 365) {$cookie = 365;} - $this->cookie = $cookie; + $cookie = intval($cookie); + if($cookie <= Model::MAX_COOKIE_CONSERVATION && $cookie >= 0) { + $this->cookie = $cookie; + return true; + } else { + return false; + } } public function setcolumns($columns) diff --git a/app/view/templates/admin.php b/app/view/templates/admin.php index 3ae8036..ab35bd0 100644 --- a/app/view/templates/admin.php +++ b/app/view/templates/admin.php @@ -3,298 +3,295 @@ <?php $this->start('page') ?> -<body> +<?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'admin', 'pagelist' => $pagelist]) ?> - <?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'admin', 'pagelist' => $pagelist]) ?> +<main class="admin"> - <main class="admin"> + <nav class="admin"> - <nav class="admin"> + <div class="block"> + <h1>Administration</h1> - <div class="block"> - <h1>Administration</h1> + <div class="scroll"> + <ul> + <li><a href="#home-page">Home page</a></li> + <li><a href="#page-creation">Page creation</a></li> + <li><a href="#alert-pages">Alert Pages</a></li> + <li><a href="#render">Render</a></li> + <li><a href="#css">CSS</a></li> + <li><a href="#interface">Interface</a></li> + <li><a href="#tracking">Tracking</a></li> + </ul> - <div class="scroll"> - <ul> - <li><a href="#home-page">Home page</a></li> - <li><a href="#page-creation">Page creation</a></li> - <li><a href="#alert-pages">Alert Pages</a></li> - <li><a href="#render">Render</a></li> - <li><a href="#css">CSS</a></li> - <li><a href="#interface">Interface</a></li> - <li><a href="#tracking">Tracking</a></li> - </ul> - - <form action="<?= $this->url('adminupdate') ?>" method="post" id="admin"> - <input type="submit" value="Update configuration"> - </form> - </div> + <form action="<?= $this->url('adminupdate') ?>" method="post" id="admin"> + <input type="submit" value="Update configuration"> + </form> </div> - </nav> + </div> + </nav> - <section class="admin"> + <section class="admin"> - <div class="block"> + <div class="block"> - <h1>configuration</h1> + <h1>configuration</h1> - <div class="scroll"> + <div class="scroll"> - <h2 id="home-page">Home page</h2> + <h2 id="home-page">Home page</h2> - <p>Here you can set the home-page view for visitors.</p> + <p>Here you can set the home-page view for visitors.</p> - <div class="radio"> - <input type="radio" name="homepage" value="default" id="default" <?= Wcms\Config::homepage() === 'default' ? 'checked' : '' ?> form="admin"> - <label for="default">default</label> - </div> + <div class="radio"> + <input type="radio" name="homepage" value="default" id="default" <?= Wcms\Config::homepage() === 'default' ? 'checked' : '' ?> form="admin"> + <label for="default">default</label> + </div> - <div class="radio"> - <input type="radio" name="homepage" value="redirect" id="redirect" <?= Wcms\Config::homepage() === 'redirect' ? 'checked' : '' ?> form="admin"> - <label for="redirect">redirect to page</label> - </div> + <div class="radio"> + <input type="radio" name="homepage" value="redirect" id="redirect" <?= Wcms\Config::homepage() === 'redirect' ? 'checked' : '' ?> form="admin"> + <label for="redirect">redirect to page</label> + </div> - <select name="homeredirect" id="homeredirect" form="admin"> - <option value="" <?= Wcms\Config::homeredirect() === null ? 'selected' : '' ?>>--select page to redirect--</option> + <select name="homeredirect" id="homeredirect" form="admin"> + <option value="" <?= Wcms\Config::homeredirect() === null ? 'selected' : '' ?>>--select page to redirect--</option> - <?php - foreach ($pagelist as $page) { - ?> - <option value="<?= $page ?>" <?= Wcms\Config::homeredirect() === $page ? 'selected' : '' ?>><?= $page ?></option> - <?php - } + <?php + foreach ($pagelist as $page) { + ?> + <option value="<?= $page ?>" <?= Wcms\Config::homeredirect() === $page ? 'selected' : '' ?>><?= $page ?></option> + <?php + } - ?> - </select> + ?> + </select> - <h2 id="page-creation">Page creation</h2> + <h2 id="page-creation">Page creation</h2> - <p>What really happend when you create a new page</p> + <p>What really happend when you create a new page</p> - <label for="defaultprivacy">Default privacy</label> - <select name="defaultprivacy" id="defaultprivacy" form="admin"> - <option value="0" <?= Wcms\Config::defaultprivacy() == 0 ? 'selected' : '' ?>>public</option> - <option value="1" <?= Wcms\Config::defaultprivacy() == 1 ? 'selected' : '' ?>>private</option> - <option value="2" <?= Wcms\Config::defaultprivacy() == 2 ? 'selected' : '' ?>>not published</option> - </select> + <label for="defaultprivacy">Default privacy</label> + <select name="defaultprivacy" id="defaultprivacy" form="admin"> + <option value="0" <?= Wcms\Config::defaultprivacy() == 0 ? 'selected' : '' ?>>public</option> + <option value="1" <?= Wcms\Config::defaultprivacy() == 1 ? 'selected' : '' ?>>private</option> + <option value="2" <?= Wcms\Config::defaultprivacy() == 2 ? 'selected' : '' ?>>not published</option> + </select> - <label for="defaultbody">Edit default BODY element</label> - <textarea name="defaultbody" id="defaultbody" cols="30" rows="10" form="admin"><?= Wcms\Config::defaultbody() ?></textarea> + <label for="defaultbody">Edit default BODY element</label> + <textarea name="defaultbody" id="defaultbody" cols="30" rows="10" form="admin"><?= Wcms\Config::defaultbody() ?></textarea> - <h2 id="alert-pages">Alert pages</h2> + <h2 id="alert-pages">Alert pages</h2> - <p>Set the style and text to show when a page does not exist, or when a visitor don't have access to it.</p> + <p>Set the style and text to show when a page does not exist, or when a visitor don't have access to it.</p> - <h4>Common options</h4> + <h4>Common options</h4> - <label for="alerttitle">H1 Title</label> - <input type="text" name="alerttitle" id="alerttitle" value="<?= Wcms\Config::alerttitle() ?>" form="admin"> + <label for="alerttitle">H1 Title</label> + <input type="text" name="alerttitle" id="alerttitle" value="<?= Wcms\Config::alerttitle() ?>" form="admin"> - <label for="alertlink">Link to this page (for visitors)</label> - <select name="alertlink" id="alertlink" form="admin"> - <option value="" <?= empty(Wcms\Config::alertlink()) ? 'selected' : '' ?>>--No link--</option> - <?php - foreach ($pagelist as $page) { - ?> - <option value="<?= $page ?>" <?= Wcms\Config::alertlink() === $page ? 'selected' : '' ?>><?= $page ?></option> - <?php } - ?> - </select> - + <label for="alertlink">Link to this page (for visitors)</label> + <select name="alertlink" id="alertlink" form="admin"> + <option value="" <?= empty(Wcms\Config::alertlink()) ? 'selected' : '' ?>>--No link--</option> + <?php + foreach ($pagelist as $page) { + ?> + <option value="<?= $page ?>" <?= Wcms\Config::alertlink() === $page ? 'selected' : '' ?>><?= $page ?></option> + <?php } + ?> + </select> - <label for="alertlinktext">Link text</label> - <input type="text" name="alertlinktext" id="alertlinktext" value="<?= Wcms\Config::alertlinktext() ?>" form="admin"> + <label for="alertlinktext">Link text</label> + <input type="text" name="alertlinktext" id="alertlinktext" value="<?= Wcms\Config::alertlinktext() ?>" form="admin"> - <h4>Un-existing</h4> - <label for="existnot">Text to show when a page does not exist yet.</label> - <i>This will also be shown as a tooltip over links.</i> - <input type="text" name="existnot" id="existnot" value="<?= Wcms\Config::existnot() ?>" form="admin"> + <h4>Un-existing</h4> - <div class="checkbox"> - <input type="hidden" name="existnotpass" value="0" form="admin"> - <input type="checkbox" name="existnotpass" id="existnotpass" value="1" <?= Wcms\Config::existnotpass() ? 'checked' : '' ?> form="admin"> - <label for="existnotpass">Ask for password</label> - </div> + <label for="existnot">Text to show when a page does not exist yet.</label> + <i>This will also be shown as a tooltip over links.</i> + <input type="text" name="existnot" id="existnot" value="<?= Wcms\Config::existnot() ?>" form="admin"> - <h4>Private</h4> + <div class="checkbox"> + <input type="hidden" name="existnotpass" value="0" form="admin"> + <input type="checkbox" name="existnotpass" id="existnotpass" value="1" <?= Wcms\Config::existnotpass() ? 'checked' : '' ?> form="admin"> + <label for="existnotpass">Ask for password</label> + </div> - <label for="private">Text to show when a page is private.</label> - <input type="text" name="private" id="private" value="<?= Wcms\Config::private() ?>" form="admin"> + <h4>Private</h4> - <div class="checkbox"> - <input type="hidden" name="privatepass" value="0" form="admin"> - <input type="checkbox" name="privatepass" id="privatepass" value="1" <?= Wcms\Config::privatepass() ? 'checked' : '' ?> form="admin"> - <label for="privatepass">Ask for password</label> - </div> + <label for="private">Text to show when a page is private.</label> + <input type="text" name="private" id="private" value="<?= Wcms\Config::private() ?>" form="admin"> - <h4>Not published</h4> + <div class="checkbox"> + <input type="hidden" name="privatepass" value="0" form="admin"> + <input type="checkbox" name="privatepass" id="privatepass" value="1" <?= Wcms\Config::privatepass() ? 'checked' : '' ?> form="admin"> + <label for="privatepass">Ask for password</label> + </div> - <label for="notpublished">Text to show when a page is not published.</label> - <input type="text" name="notpublished" id="notpublished" value="<?= Wcms\Config::notpublished() ?>" form="admin"> + <h4>Not published</h4> - <div class="checkbox"> - <input type="hidden" name="notpublishedpass" value="0" form="admin"> - <input type="checkbox" name="notpublishedpass" id="notpublishedpass" value="1" <?= Wcms\Config::notpublishedpass() ? 'checked' : '' ?> form="admin"> - <label for="notpublishedpass">Ask for password</label> - </div> + <label for="notpublished">Text to show when a page is not published.</label> + <input type="text" name="notpublished" id="notpublished" value="<?= Wcms\Config::notpublished() ?>" form="admin"> - <h4>CSS</h4> + <div class="checkbox"> + <input type="hidden" name="notpublishedpass" value="0" form="admin"> + <input type="checkbox" name="notpublishedpass" id="notpublishedpass" value="1" <?= Wcms\Config::notpublishedpass() ? 'checked' : '' ?> form="admin"> + <label for="notpublishedpass">Ask for password</label> + </div> - <div class="checkbox"> - <input type="hidden" name="alertcss" value="0" form="admin"> - <input type="checkbox" name="alertcss" id="alertcss" value="1" <?= Wcms\Config::alertcss() ? 'checked' : '' ?> form="admin"> - <label for="alertcss">Use global.css for those page as well</label> - </div> + <h4>CSS</h4> - <p> - <i>You can use <code>body.alert</code> class to specify style.</i> - </p> + <div class="checkbox"> + <input type="hidden" name="alertcss" value="0" form="admin"> + <input type="checkbox" name="alertcss" id="alertcss" value="1" <?= Wcms\Config::alertcss() ? 'checked' : '' ?> form="admin"> + <label for="alertcss">Use global.css for those page as well</label> + </div> + <p> + <i>You can use <code>body.alert</code> class to specify style.</i> + </p> - <h2 id="render">Render</h2> - <div class="checkbox"> - <input type="hidden" name="reccursiverender" value="0" form="admin"> - <input type="checkbox" name="reccursiverender" id="reccursiverender" value="1" <?= Wcms\Config::reccursiverender() ? 'checked' : '' ?> form="admin"> - <label for="reccursiverender">Reccursive render</label> - </div> + <h2 id="render">Render</h2> + <div class="checkbox"> + <input type="hidden" name="reccursiverender" value="0" form="admin"> + <input type="checkbox" name="reccursiverender" id="reccursiverender" value="1" <?= Wcms\Config::reccursiverender() ? 'checked' : '' ?> form="admin"> + <label for="reccursiverender">Reccursive render</label> + </div> - <h4>Links</h4> - <div class="checkbox"> - <input type="hidden" name="externallinkblank" value="0" form="admin"> - <input type="checkbox" name="externallinkblank" id="externallinkblank" value="1" <?= Wcms\Config::externallinkblank() ? 'checked' : '' ?> form="admin"> - <label for="externallinkblank">Open external links in new tab</label> - </div> + <h4>Links</h4> - <div class="checkbox"> - <input type="hidden" name="internallinkblank" value="0" form="admin"> - <input type="checkbox" name="internallinkblank" id="internallinkblank" value="1" <?= Wcms\Config::internallinkblank() ? 'checked' : '' ?> form="admin"> - <label for="internallinkblank">Open internal links in new tab</label> - </div> + <div class="checkbox"> + <input type="hidden" name="externallinkblank" value="0" form="admin"> + <input type="checkbox" name="externallinkblank" id="externallinkblank" value="1" <?= Wcms\Config::externallinkblank() ? 'checked' : '' ?> form="admin"> + <label for="externallinkblank">Open external links in new tab</label> + </div> - <i>(This modifications need re-rendering)</i> + <div class="checkbox"> + <input type="hidden" name="internallinkblank" value="0" form="admin"> + <input type="checkbox" name="internallinkblank" id="internallinkblank" value="1" <?= Wcms\Config::internallinkblank() ? 'checked' : '' ?> form="admin"> + <label for="internallinkblank">Open internal links in new tab</label> + </div> + <i>(This modifications need re-rendering)</i> - <h2 id="css">CSS</h2> - <label for="globalcss">Edit global css that will apply to every pages</label> - <textarea name="globalcss" id="globalcss" cols="30" rows="30" form="admin"><?= $globalcss ?></textarea> + <h2 id="css">CSS</h2> - <label for="defaultfavicon">Default favicon</label> - <select name="defaultfavicon" id="defaultfavicon" form="admin"> - <option value="">--no favicon--</option> - <?php - foreach ($faviconlist as $favicon) { - ?> - <option value="<?= $favicon ?>" <?= Wcms\Config::defaultfavicon() === $favicon ? 'selected' : '' ?>><?= $favicon ?></option> - <?php - } - ?> - </select> + <label for="globalcss">Edit global css that will apply to every pages</label> + <textarea name="globalcss" id="globalcss" cols="30" rows="30" form="admin"><?= $globalcss ?></textarea> - <label for="defaultthumbnail">Default thumbnail</label> - <select name="defaultthumbnail" id="defaultthumbnail" form="admin"> - <option value="">--no thumbnail--</option> - <?php - foreach ($thumbnaillist as $thumbnail) { - ?> - <option value="<?= $thumbnail ?>" <?= Wcms\Config::defaultthumbnail() === $thumbnail ? 'selected' : '' ?>><?= $thumbnail ?></option> - <?php } ?> - </select> + <label for="defaultfavicon">Default favicon</label> + <select name="defaultfavicon" id="defaultfavicon" form="admin"> + <option value="">--no favicon--</option> + <?php + foreach ($faviconlist as $favicon) { + ?> + <option value="<?= $favicon ?>" <?= Wcms\Config::defaultfavicon() === $favicon ? 'selected' : '' ?>><?= $favicon ?></option> + <?php + } + ?> + </select> - <h2 id="interface">Interface</h2> + <label for="defaultthumbnail">Default thumbnail</label> + <select name="defaultthumbnail" id="defaultthumbnail" form="admin"> + <option value="">--no thumbnail--</option> + <?php + foreach ($thumbnaillist as $thumbnail) { + ?> + <option value="<?= $thumbnail ?>" <?= Wcms\Config::defaultthumbnail() === $thumbnail ? 'selected' : '' ?>><?= $thumbnail ?></option> + <?php } ?> + </select> - <p>Set interface Style</p> + <h2 id="interface">Interface</h2> - <select name="interfacecss" id="interfacecss" form="admin"> - <option value="null">--default interface style---</option> - <?php - foreach ($interfacecsslist as $interfacecss) { - ?> - <option value="<?= $interfacecss ?>" <?= $interfacecss === Wcms\Config::interfacecss() ? 'selected' : '' ?>><?= $interfacecss ?></option> - <?php - } - ?> - </select> + <p>Set interface Style</p> + <select name="interfacecss" id="interfacecss" form="admin"> + <option value="null">--default interface style---</option> + <?php + foreach ($interfacecsslist as $interfacecss) { + ?> + <option value="<?= $interfacecss ?>" <?= $interfacecss === Wcms\Config::interfacecss() ? 'selected' : '' ?>><?= $interfacecss ?></option> + <?php + } + ?> + </select> - <h2 id="tracking">Tracking</h2> - <label for="analytics">Google analytics Tracking ID</label> - <input type="text" name="analytics" id="analytics" value="<?= Wcms\Config::analytics() ?>" form="admin"> + <h2 id="tracking">Tracking</h2> - <i>(Need rendering to work)</i> + <label for="analytics">Google analytics Tracking ID</label> + <input type="text" name="analytics" id="analytics" value="<?= Wcms\Config::analytics() ?>" form="admin"> + <i>(Need rendering to work)</i> - </div> </div> + </div> - </section> - <section id="databases"> - <div class="block"> - <h1>Databases</h1> - <div class="scroll"> + </section> - <form action="<?= $this->url('admindatabase') ?>" method="post"> + <section id="databases"> + <div class="block"> + <h1>Databases</h1> + <div class="scroll"> + <form action="<?= $this->url('admindatabase') ?>" method="post"> + + + <table id="dirlsit"> + <tr><th>using</th><th>databases</th><th>pages</th></tr> - <table id="dirlsit"> - <tr><th>using</th><th>databases</th><th>pages</th></tr> - - <?php basictree($pagesdbtree, 'pages', 0, '', DIRECTORY_SEPARATOR . Wcms\Config::pagetable()); ?> - </table> + <?php basictree($pagesdbtree, 'pages', 0, '', DIRECTORY_SEPARATOR . Wcms\Config::pagetable()); ?> + </table> - <input type="hidden" name="action" value="select"> - <input type="submit" value="select" name="change database"> + <input type="hidden" name="action" value="select"> + <input type="submit" value="select" name="change database"> - </form> + </form> - <h4>Duplicate Database</h4> + <h4>Duplicate Database</h4> - <form action="<?= $this->url('admindatabase') ?>" method="post"> + <form action="<?= $this->url('admindatabase') ?>" method="post"> - <label for="dbsrc">Database to duplicate</label> - <select name="dbsrc" id="dbsrc"> - <?php - foreach ($pagesdblist as $db) { - ?> - <option value="<?= $db ?>" <?= $db === Wcms\Config::pagetable() ? 'selected' : '' ?>><?= $db ?></option> - <?php - } + <label for="dbsrc">Database to duplicate</label> + <select name="dbsrc" id="dbsrc"> + <?php + foreach ($pagesdblist as $db) { ?> - </select> + <option value="<?= $db ?>" <?= $db === Wcms\Config::pagetable() ? 'selected' : '' ?>><?= $db ?></option> + <?php + } + ?> + </select> - <label for="duplicate">New name</label> - <input type="text" name="dbtarget" id="duplicate" value="" required> - <input type="submit" name="action" value="duplicate"> - </form> + <label for="duplicate">New name</label> + <input type="text" name="dbtarget" id="duplicate" value="" required> + <input type="submit" name="action" value="duplicate"> + </form> - </div> </div> - </section> + </div> + </section> - </main> -</body> +</main> <?php $this->stop('page') ?>
\ No newline at end of file diff --git a/app/view/templates/edit.php b/app/view/templates/edit.php index a27171a..22dda20 100644 --- a/app/view/templates/edit.php +++ b/app/view/templates/edit.php @@ -7,7 +7,6 @@ <style>.tabs textarea{font-size: <?= Wcms\Config::fontsize() ?>px}</style> -<body> <main class="editor"> <?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'edit', 'pagelist' => $pagelist, 'pageid' => $page->id()]) ?> @@ -32,6 +31,5 @@ let pagetitle = '<?= $page->title() ?>'; </script> <script src="<?= Wcms\Model::jspath() ?>edit.bundle.js"></script> -</body> <?php $this->stop('page') ?>
\ No newline at end of file diff --git a/app/view/templates/home.php b/app/view/templates/home.php index d6d1f51..387ef0c 100644 --- a/app/view/templates/home.php +++ b/app/view/templates/home.php @@ -6,243 +6,239 @@ <?php $this->start('page') ?> -<body> - <?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'home', 'pagelist' => $pagelist]) ?> +<?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'home', 'pagelist' => $pagelist]) ?> - <?php if ($user->iseditor()) { ?> +<?php if ($user->iseditor()) { ?> - <?php - $optlist = $optlist ?? null; - $this->insert('homemenu', ['user' => $user, 'opt' => $opt, 'optlist' => $optlist, 'pagelist' => $pagelist, 'faviconlist' => $faviconlist, 'thumbnaillist' => $thumbnaillist, 'editorlist' => $editorlist, 'colors' => $colors]); - ?> +<?php + $optlist = $optlist ?? null; + $this->insert('homemenu', ['user' => $user, 'opt' => $opt, 'optlist' => $optlist, 'pagelist' => $pagelist, 'faviconlist' => $faviconlist, 'thumbnaillist' => $thumbnaillist, 'editorlist' => $editorlist, 'colors' => $colors]); +?> - <main class="home"> +<main class="home"> - <?php $this->insert('homeopt', ['opt' => $opt, 'user' => $user, 'display' => $display]) ?> + <?php $this->insert('homeopt', ['opt' => $opt, 'user' => $user, 'display' => $display]) ?> - <section class="pages"> + <section class="pages"> - <div class="block"> + <div class="block"> - <h2 class="hidephone">Pages (<?= count($pagelistopt) ?>) <span class="right"><a href="?display=list" <?= $display === 'list' ? 'style="color: white"' : '' ?> >list</a> / <a href="?display=map" <?= $display === 'map' ? 'style="color: white"' : '' ?> >map</a></span> </h2> + <h2 class="hidephone">Pages (<?= count($pagelistopt) ?>) <span class="right"><a href="?display=list" <?= $display === 'list' ? 'style="color: white"' : '' ?> >list</a> / <a href="?display=map" <?= $display === 'map' ? 'style="color: white"' : '' ?> >map</a></span> </h2> - <?php if($display === 'map') { ?> + <?php if($display === 'map') { ?> - <!-- ___________________ M A P _________________________ --> + <!-- ___________________ M A P _________________________ --> - <div id="deepsearchbar"> - <form action="" method="get"> - <input type="hidden" name="display" value="map"> - <input type="checkbox" name="showorphans" value="1" id="showorphans" <?= $showorphans ? 'checked' : '' ?>> - <label for="showorphans">show orphans pages</label> - <input type="checkbox" name="showredirection" value="1" id="showredirection" <?= $showredirection ? 'checked' : '' ?>> - <label for="showredirection">show redirections</label> - <select name="layout" id="layout"> - <?= options(Wcms\Model::MAP_LAYOUTS, $layout) ?> - </select> - <label for="layout">graph layout</label> - <input type="submit" value="update"> - </form> - </div> - - <div id="graph"></div> - - <script> - var data = <?= $json ?>; - console.log(data); - </script> - - <script src="<?= Wcms\Model::jspath() ?>map.bundle.js"></script> - - <?php } else { ?> - - <!-- ___________________ D E E P _________________________ --> - - <div id="deepsearchbar" class="hidephone"> - <form action="<?= $this->url('home') ?>" method="get"> - <input type="text" name="search" value="<?= $deepsearch ?>" id="deepsearch" placeholder="deep search"> - <input type="checkbox" name="id" id="deepid" value="1" <?= $searchopt['id'] ? 'checked' : '' ?>> - <label for="deepid">id</label> - <input type="checkbox" name="title" id="deeptitle" value="1" <?= $searchopt['title'] ? 'checked' : '' ?>> - <label for="deeptitle">title</label> - <input type="checkbox" name="description" id="deepdescription" value="1" <?= $searchopt['description'] ? 'checked' : '' ?>> - <label for="deepdescription">description</label> - <input type="checkbox" name="content" id="deepcontent" value="1" <?= $searchopt['content'] ? 'checked' : '' ?>> - <label for="deepcontent" title="Markdown content : MAIN, HEADER, NAV, ASIDE, FOOTER">content</label> - <input type="checkbox" name="other" id="deepother" value="1" <?= $searchopt['other'] ? 'checked' : '' ?>> - <label for="deepother" title="Structure content : BODY, CSS, Javascript">other</label> - <input type="checkbox" name="case" id="deepcase" value="1" <?= $searchopt['casesensitive'] ? 'checked' : '' ?>> - <label for="deepcase" title="Case sensitive or not">case sensitive</label> - <input type="submit" value="search"> - </form> - </div> - - - <!-- ___________________ T A B L E _______________________ --> + <div id="deepsearchbar"> + <form action="" method="get"> + <input type="hidden" name="display" value="map"> + <input type="checkbox" name="showorphans" value="1" id="showorphans" <?= $showorphans ? 'checked' : '' ?>> + <label for="showorphans">show orphans pages</label> + <input type="checkbox" name="showredirection" value="1" id="showredirection" <?= $showredirection ? 'checked' : '' ?>> + <label for="showredirection">show redirections</label> + <select name="layout" id="layout"> + <?= options(Wcms\Model::MAP_LAYOUTS, $layout) ?> + </select> + <label for="layout">graph layout</label> + <input type="submit" value="update"> + </form> + </div> + <div id="graph"></div> + + <script> + var data = <?= $json ?>; + console.log(data); + </script> + + <script src="<?= Wcms\Model::jspath() ?>map.bundle.js"></script> + + <?php } else { ?> + + <!-- ___________________ D E E P _________________________ --> + + <div id="deepsearchbar" class="hidephone"> + <form action="<?= $this->url('home') ?>" method="get"> + <input type="text" name="search" value="<?= $deepsearch ?>" id="deepsearch" placeholder="deep search"> + <input type="checkbox" name="id" id="deepid" value="1" <?= $searchopt['id'] ? 'checked' : '' ?>> + <label for="deepid">id</label> + <input type="checkbox" name="title" id="deeptitle" value="1" <?= $searchopt['title'] ? 'checked' : '' ?>> + <label for="deeptitle">title</label> + <input type="checkbox" name="description" id="deepdescription" value="1" <?= $searchopt['description'] ? 'checked' : '' ?>> + <label for="deepdescription">description</label> + <input type="checkbox" name="content" id="deepcontent" value="1" <?= $searchopt['content'] ? 'checked' : '' ?>> + <label for="deepcontent" title="Markdown content : MAIN, HEADER, NAV, ASIDE, FOOTER">content</label> + <input type="checkbox" name="other" id="deepother" value="1" <?= $searchopt['other'] ? 'checked' : '' ?>> + <label for="deepother" title="Structure content : BODY, CSS, Javascript">other</label> + <input type="checkbox" name="case" id="deepcase" value="1" <?= $searchopt['casesensitive'] ? 'checked' : '' ?>> + <label for="deepcase" title="Case sensitive or not">case sensitive</label> + <input type="submit" value="search"> + </form> + </div> - <div class="scroll"> - <table id="home2table"> - <thead> - <tr> - <?php if($user->issupereditor()) { ?><th id="checkall" class="hidephone">x</th> <?php } ?> - <?php if($columns['favicon']) { ?> - <th class="favicon"><a href="<?= $opt->sortbyorder('favicon') ?>">ico</a></th> - <?php } ?> - <th class="id"><a href="<?= $opt->sortbyorder('id') ?>">id</a></th> - <th>edit</th> - <th>see</th> - <th class="delete" title="delete page">del</th> - <?php if ($user->issupereditor()) { ?> - <th class="download hidephone" title="download page as json">dl</th> - <?php } + <!-- ___________________ T A B L E _______________________ --> + + + <div class="scroll"> + + <table id="home2table"> + <thead> + <tr> + <?php if($user->issupereditor()) { ?><th id="checkall" class="hidephone">x</th> <?php } ?> + <?php if($columns['favicon']) { ?> + <th class="favicon"><a href="<?= $opt->sortbyorder('favicon') ?>">ico</a></th> + <?php } ?> + <th class="id"><a href="<?= $opt->sortbyorder('id') ?>">id</a></th> + <th>edit</th> + <th>see</th> + <th class="delete" title="delete page">del</th> + <?php if ($user->issupereditor()) { ?> + <th class="download hidephone" title="download page as json">dl</th> + <?php } + if ($columns['tag']) { ?> + <th class="tag"><a href="<?= $opt->sortbyorder('tag') ?>">tag</a></th> + <?php } + if ($columns['title']) { ?> + <th class="title"><a href="<?= $opt->sortbyorder('title') ?>">title</a></th> + <?php } + if ($columns['description']) { ?> + <th class="summary">summary</th> + <?php } + if ($columns['linkto']) { ?> + <th class="linkto"><a href="<?= $opt->sortbyorder('linkto') ?>">linkto</a></th> + <?php } + if ($columns['datemodif']) { ?> + <th class="datemodif"><a href="<?= $opt->sortbyorder('datemodif') ?>">last modification</a></th> + <?php } + if ($columns['datecreation']) { ?> + <th class="datecreation"><a href="<?= $opt->sortbyorder('datecreation') ?>">date of creation</a></th> + <?php } + if ($columns['date']) { ?> + <th class="date"><a href="<?= $opt->sortbyorder('date') ?>">date</a></th> + <?php } + if ($columns['secure']) { ?> + <th class="secure"><a href="<?= $opt->sortbyorder('secure') ?>">privacy</a></th> + <?php } + if ($columns['authors']) { ?> + <th class="authors"><a href="<?= $opt->sortbyorder('authors') ?>">authors</a></th> + <?php } + if ($columns['visitcount']) { ?> + <th class="visitcount"><a href="<?= $opt->sortbyorder('visitcount') ?>">visit</a></th> + <?php } + if ($columns['editcount']) { ?> + <th class="editcount"><a href="<?= $opt->sortbyorder('editcount') ?>">edit</a></th> + <?php } + if ($columns['affcount']) { ?> + <th class="affcount"><a href="<?= $opt->sortbyorder('affcount') ?>">aff</a></th> + <?php } ?> + </tr> + </thead> + <tbody> + <?php foreach ($pagelistopt as $item) { ?> + <tr> + <?php if($user->issupereditor()) { ?><td class="hidephone"><input type="checkbox" name="pagesid[]" value="<?= $item->id() ?>" id="id_<?= $item->id() ?>" form="multi"></td><?php } ?> + <?php if($columns['favicon']) { ?> + <td class="favicon"><img class="favicon" src="<?= Wcms\Model::faviconpath() . $item->favicon() ?>" alt="<?= $item->favicon() ?>" title="<?= $item->favicon() ?>"></td> + <?php } ?> + <td class="id"><label title="<?= $item->title() ?>" for="id_<?= $item->id() ?>"><?= $item->id() ?></label></td> + <td><?php if($user->issupereditor() || in_array($user->id(), $item->authors())) { ?><a href="<?= $this->upage('pageedit', $item->id()) ?>"><img src="<?= Wcms\Model::iconpath() ?>edit.png" class="icon"></a><?php } ?></td> + <td><a href="<?= $this->upage('pageread/', $item->id()) ?>" target="_blank"><img src="<?= Wcms\Model::iconpath() ?>read.png" class="icon"></a></td> + <td class="delete"><?php if($user->issupereditor() || $item->authors() === [$user->id()]) { ?><a href="<?= $this->upage('pagedelete', $item->id()) ?>">✖</a><?php } ?></td> + <?php if ($user->issupereditor()) { ?> + <td class="hidephone"><a href="<?= $this->upage('pagedownload', $item->id()) ?>" download><img src="<?= Wcms\Model::iconpath() ?>download.png" class="icon"></a></td> + <?php } if ($columns['tag']) { ?> - <th class="tag"><a href="<?= $opt->sortbyorder('tag') ?>">tag</a></th> - <?php } + <td class="tag"><?= $opt->taglinks($item->tag('array')) ?></td> + <?php } if ($columns['title']) { ?> - <th class="title"><a href="<?= $opt->sortbyorder('title') ?>">title</a></th> - <?php } + <td class="title" title="<?= $item->title() ?>"><label for="id_<?= $item->id() ?>"><?= $item->title() ?></label></td> + <?php } if ($columns['description']) { ?> - <th class="summary">summary</th> - <?php } + <td class="summary" title="<?= $item->description() ?>"><?= $item->description('short') ?></td> + <?php } if ($columns['linkto']) { ?> - <th class="linkto"><a href="<?= $opt->sortbyorder('linkto') ?>">linkto</a></th> - <?php } + <td class="linkto"><?= $opt->linktolink($item->linkto('array')) ?></td> + <?php } if ($columns['datemodif']) { ?> - <th class="datemodif"><a href="<?= $opt->sortbyorder('datemodif') ?>">last modification</a></th> - <?php } + <td class="datemodif" <?= $item->datemodif('dmy') ?> <?= $item->datemodif('ptime') ?>><time datetime="<?= $item->datemodif('string') ?>" title="<?= $item->datemodif('dmy') . ' ' . $item->datemodif('ptime') ?>"><?= $item->datemodif('hrdi') ?></time></td> + <?php } if ($columns['datecreation']) { ?> - <th class="datecreation"><a href="<?= $opt->sortbyorder('datecreation') ?>">date of creation</a></th> - <?php } + <td class="datecreation" <?= $item->datecreation('dmy') ?> <?= $item->datecreation('ptime') ?>><time datetime="<?= $item->datecreation('string') ?>" title="<?= $item->datecreation('dmy') . ' ' . $item->datecreation('ptime') ?>"><?= $item->datecreation('hrdi') ?></time></td> + <?php } if ($columns['date']) { ?> - <th class="date"><a href="<?= $opt->sortbyorder('date') ?>">date</a></th> - <?php } + <td class="date" <?= $item->date('dmy') ?> <?= $item->date('ptime') ?>><time datetime="<?= $item->date('string') ?>" title="<?= $item->date('dmy') . ' ' . $item->date('ptime') ?>"><?= $item->date('dmy') ?></time></td> + <?php } if ($columns['secure']) { ?> - <th class="secure"><a href="<?= $opt->sortbyorder('secure') ?>">privacy</a></th> - <?php } + <td class="secure"><?= $opt->securelink($item->secure('int') , $item->secure('string')) ?></td> + <?php } if ($columns['authors']) { ?> - <th class="authors"><a href="<?= $opt->sortbyorder('authors') ?>">authors</a></th> - <?php } + <td class="authors"><?= $opt->authorlinks($item->authors('array')) ?></td> + <?php } if ($columns['visitcount']) { ?> - <th class="visitcount"><a href="<?= $opt->sortbyorder('visitcount') ?>">visit</a></th> - <?php } + <td class="visitcount"><?= $item->visitcount() ?></td> + <?php } if ($columns['editcount']) { ?> - <th class="editcount"><a href="<?= $opt->sortbyorder('editcount') ?>">edit</a></th> - <?php } + <td class="editcount"><?= $item->editcount() ?></td> + <?php } if ($columns['affcount']) { ?> - <th class="affcount"><a href="<?= $opt->sortbyorder('affcount') ?>">aff</a></th> - <?php } ?> - </tr> - </thead> - <tbody> - <?php foreach ($pagelistopt as $item) { ?> - <tr> - <?php if($user->issupereditor()) { ?><td class="hidephone"><input type="checkbox" name="pagesid[]" value="<?= $item->id() ?>" id="id_<?= $item->id() ?>" form="multi"></td><?php } ?> - <?php if($columns['favicon']) { ?> - <td class="favicon"><img class="favicon" src="<?= Wcms\Model::faviconpath() . $item->favicon() ?>" alt="<?= $item->favicon() ?>" title="<?= $item->favicon() ?>"></td> - <?php } ?> - <td class="id"><label title="<?= $item->title() ?>" for="id_<?= $item->id() ?>"><?= $item->id() ?></label></td> - <td><?php if($user->issupereditor() || in_array($user->id(), $item->authors())) { ?><a href="<?= $this->upage('pageedit', $item->id()) ?>"><img src="<?= Wcms\Model::iconpath() ?>edit.png" class="icon"></a><?php } ?></td> - <td><a href="<?= $this->upage('pageread/', $item->id()) ?>" target="_blank"><img src="<?= Wcms\Model::iconpath() ?>read.png" class="icon"></a></td> - <td class="delete"><?php if($user->issupereditor() || $item->authors() === [$user->id()]) { ?><a href="<?= $this->upage('pagedelete', $item->id()) ?>">✖</a><?php } ?></td> - <?php if ($user->issupereditor()) { ?> - <td class="hidephone"><a href="<?= $this->upage('pagedownload', $item->id()) ?>" download><img src="<?= Wcms\Model::iconpath() ?>download.png" class="icon"></a></td> - <?php } - if ($columns['tag']) { ?> - <td class="tag"><?= $opt->taglinks($item->tag('array')) ?></td> - <?php } - if ($columns['title']) { ?> - <td class="title" title="<?= $item->title() ?>"><label for="id_<?= $item->id() ?>"><?= $item->title() ?></label></td> - <?php } - if ($columns['description']) { ?> - <td class="summary" title="<?= $item->description() ?>"><?= $item->description('short') ?></td> - <?php } - if ($columns['linkto']) { ?> - <td class="linkto"><?= $opt->linktolink($item->linkto('array')) ?></td> - <?php } - if ($columns['datemodif']) { ?> - <td class="datemodif" <?= $item->datemodif('dmy') ?> <?= $item->datemodif('ptime') ?>><time datetime="<?= $item->datemodif('string') ?>" title="<?= $item->datemodif('dmy') . ' ' . $item->datemodif('ptime') ?>"><?= $item->datemodif('hrdi') ?></time></td> - <?php } - if ($columns['datecreation']) { ?> - <td class="datecreation" <?= $item->datecreation('dmy') ?> <?= $item->datecreation('ptime') ?>><time datetime="<?= $item->datecreation('string') ?>" title="<?= $item->datecreation('dmy') . ' ' . $item->datecreation('ptime') ?>"><?= $item->datecreation('hrdi') ?></time></td> - <?php } - if ($columns['date']) { ?> - <td class="date" <?= $item->date('dmy') ?> <?= $item->date('ptime') ?>><time datetime="<?= $item->date('string') ?>" title="<?= $item->date('dmy') . ' ' . $item->date('ptime') ?>"><?= $item->date('dmy') ?></time></td> - <?php } - if ($columns['secure']) { ?> - <td class="secure"><?= $opt->securelink($item->secure('int') , $item->secure('string')) ?></td> - <?php } - if ($columns['authors']) { ?> - <td class="authors"><?= $opt->authorlinks($item->authors('array')) ?></td> - <?php } - if ($columns['visitcount']) { ?> - <td class="visitcount"><?= $item->visitcount() ?></td> - <?php } - if ($columns['editcount']) { ?> - <td class="editcount"><?= $item->editcount() ?></td> - <?php } - if ($columns['affcount']) { ?> - <td class="affcount"><?= $item->affcount() ?></td> - <?php } ?> - </tr> - - <?php } ?> - </tbody> - </table> - </div> - - <?php } ?> - - </div> + <td class="affcount"><?= $item->affcount() ?></td> + <?php } ?> + </tr> - </section> - - - <?php if($user->display()['bookmark'] && (!empty(Wcms\Config::bookmark()) || !empty($user->bookmark()))) { ?> - - <section class="hidephone" id="bookmark"> - <div class="block"> - <h2>Bookmarks</h2> - <div class="scroll"> - <strong>Public</strong> - <ul> - <?php foreach (Wcms\Config::bookmark() as $id => $query) { ?> - <li> - <a href="<?= $query ?>"><?= $id ?></a> - </li> - <?php } ?> - </ul> - <strong><?= $user->id() ?></strong> - <ul> - <?php foreach ($user->bookmark() as $id => $query) { ?> - <li> - <a href="<?= $query ?>"><?= $id ?></a> - </li> - <?php } ?> - </ul> - </section> + <?php } ?> + </tbody> + </table> </div> - </nav> - <?php } ?> + <?php } ?> + + </div> + + </section> + + + <?php if($user->display()['bookmark'] && (!empty(Wcms\Config::bookmark()) || !empty($user->bookmark()))) { ?> + + <section class="hidephone" id="bookmark"> + <div class="block"> + <h2>Bookmarks</h2> + <div class="scroll"> + <strong>Public</strong> + <ul> + <?php foreach (Wcms\Config::bookmark() as $id => $query) { ?> + <li> + <a href="<?= $query ?>"><?= $id ?></a> + </li> + <?php } ?> + </ul> + <strong><?= $user->id() ?></strong> + <ul> + <?php foreach ($user->bookmark() as $id => $query) { ?> + <li> + <a href="<?= $query ?>"><?= $id ?></a> + </li> + <?php } ?> + </ul> + </section> + </div> + </nav> - </main> - - <?php $this->insert('footer', ['footer' => $footer]) ?> + <?php } ?> - <script src="<?= Wcms\Model::jspath() ?>home.bundle.js"></script> +</main> - <?php } ?> +<?php $this->insert('footer', ['footer' => $footer]) ?> -</body> +<script src="<?= Wcms\Model::jspath() ?>home.bundle.js"></script> +<?php } ?> <?php $this->stop() ?>
\ No newline at end of file diff --git a/app/view/templates/homemenu.php b/app/view/templates/homemenu.php index 9d28ffa..ff39f1c 100644 --- a/app/view/templates/homemenu.php +++ b/app/view/templates/homemenu.php @@ -7,7 +7,7 @@ <div class="submenu"> <h2>Import page as file</h2> <form action="<?= $this->url('pageupload') ?>" method="post" enctype="multipart/form-data"> - <input type="file" name="pagefile" id="pagefile" accept=".json"> + <input type="file" name="pagefile" id="pagefile" accept=".json" required> <label for="pagefile">JSON Page file</label> <input type="hidden" name="erase" value="0"> <input type="hidden" name="datecreation" value="0"> @@ -38,13 +38,7 @@ <div class="submenu"> <i>Edit selected pages</i> <form action="<?= $this->url('multi') ?>" method="post" id="multi"> - <h2>Render</h2> - <input type="submit" name="action" value="render"> - <h2>Delete</h2> - <input type="hidden" name="confirmdelete" value="0"> - <input type="checkbox" name="confirmdelete" id="confirmdelete" value="1"> - <label for="confirmdelete">confirm</label> - <input type="submit" name="action" value="delete"> + <h2>Edit Meta infos</h2> <input type="text" name="datas[title]" id="title"> <label for="title">title</label> @@ -181,6 +175,15 @@ </br> <input type="submit" name="action" value="edit"> + <h2>Render</h2> + <input type="submit" name="action" value="render"> + + <h2>Delete</h2> + <input type="hidden" name="confirmdelete" value="0"> + <input type="checkbox" name="confirmdelete" id="confirmdelete" value="1"> + <label for="confirmdelete">confirm</label> + <input type="submit" name="action" value="delete"> + </form> </div> </details> @@ -195,7 +198,7 @@ <details class="hidephone" id="selection" <?= !empty($optlist) ? 'open' : '' ?>> - <summary>Filters</summary> + <summary>Filter</summary> <div class="submenu"> <h2>Get LIST code</h2> <i>Generate code to display a list of pages</i> @@ -309,18 +312,6 @@ <details class="hidephone" id="display"> <summary>Display</summary> <div class="submenu"> - <h2>Worksapce</h2> - <form action=""> - <ul> - <?php foreach ($user->display() as $id => $setting) { ?> - <li> - <input type="checkbox" name="display[<?= $id ?>]" id="display_<?= $id ?>" value="true" <?= $setting ? 'checked' : '' ?>> - <label for="display_<?= $id ?>"><?= $id ?></label> - </li> - <?php } ?> - </ul> - <input type="submit" value="update display"> - </form> <h2>Columns</h2> <form action="<?= $this->url('homecolumns') ?>" method="post"> <ul> diff --git a/app/view/templates/info.php b/app/view/templates/info.php index 0e722a6..e77fbe3 100644 --- a/app/view/templates/info.php +++ b/app/view/templates/info.php @@ -3,7 +3,6 @@ <?php $this->start('page') ?> -<body> <?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'info', 'pagelist' => $pagelist]) ?> @@ -76,6 +75,5 @@ </section> </main> -</body> <?php $this->stop('page') ?>
\ No newline at end of file diff --git a/app/view/templates/layout.php b/app/view/templates/layout.php index c96c61f..7b8ef13 100644 --- a/app/view/templates/layout.php +++ b/app/view/templates/layout.php @@ -38,19 +38,23 @@ <?php if (!empty($flashmessages) && is_array($flashmessages)) { ?> - <div class="flashmessage"> +<a href="#flashmessage"> + <div class="flashmessage" id="flashmessage"> <ul> <?php foreach ($flashmessages as $flashmessage ) { ?> <li class="alert alert-<?= $flashmessage['type'] ?>"> <?= $flashmessage['content'] ?> </li> - <?php } ?> - </ul> - </div> + <?php } ?> + </ul> + </div> + </a> <?php } ?> +<body> + <?= $this->section('page') ?> +</body> -<?= $this->section('page') ?> </html>
\ No newline at end of file diff --git a/app/view/templates/media.php b/app/view/templates/media.php index 9f56116..9901b8e 100644 --- a/app/view/templates/media.php +++ b/app/view/templates/media.php @@ -7,11 +7,10 @@ $this->layout('layout', ['title' => 'media', 'stylesheets' => [$css . 'home.css' <?php $this->start('page') ?> -<body> - <?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'media', 'pagelist' => $pagelist]) ?> +<?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'media', 'pagelist' => $pagelist]) ?> - <?php $this->insert('mediamenu', ['user' => $user, 'pathlist' => $pathlist, 'mediaopt' => $mediaopt]) ?> +<?php $this->insert('mediamenu', ['user' => $user, 'pathlist' => $pathlist, 'mediaopt' => $mediaopt]) ?> <main class="media"> @@ -116,6 +115,5 @@ $this->layout('layout', ['title' => 'media', 'stylesheets' => [$css . 'home.css' <script src="<?= Wcms\Model::jspath() ?>media.bundle.js"></script> -</body> <?php $this->stop('page') ?>
\ No newline at end of file diff --git a/app/view/templates/timeline.php b/app/view/templates/timeline.php index f06180e..e3c6438 100644 --- a/app/view/templates/timeline.php +++ b/app/view/templates/timeline.php @@ -6,9 +6,8 @@ <?php $this->start('page') ?> -<body> - <?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'timeline', 'pagelist' => $pagelist]) ?> +<?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'timeline', 'pagelist' => $pagelist]) ?> <?php if($user->iseditor()) { ?> @@ -97,7 +96,6 @@ foreach ($groupedeventlist as $eventuser) { </section> -</body> diff --git a/app/view/templates/user.php b/app/view/templates/user.php index f77699d..faa44aa 100644 --- a/app/view/templates/user.php +++ b/app/view/templates/user.php @@ -7,14 +7,12 @@ $this->layout('layout', ['title' => 'user', 'stylesheets' => [$css . 'home.css'] <?php $this->start('page') ?> -<body> - - <?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'user', 'pagelist' => $pagelist]) ?> +<?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'user', 'pagelist' => $pagelist]) ?> <main class="user"> - <section id="pref"> + <section id="user"> <div class="block"> @@ -34,25 +32,26 @@ $this->layout('layout', ['title' => 'user', 'stylesheets' => [$css . 'home.css'] <h2>Preferences</h2> + <div id="preferences"> - <form action="<?= $this->url('userpref') ?>" method="post"> + <form action="<?= $this->url('userpref') ?>" method="post"> - <p> - <input type="number" name="cookie" value="<?= $getuser->cookie() ?>" id="cookie" min="0" max="365"> - <label for="cookie">Cookie conservation time <i>(In days)</i></label> - <p>When you tick the <em>remember-me</em> checkbox during login, you can choose how much time <strong>W</strong> will remember you.</p> + <input type="number" name="cookie" value="<?= $getuser->cookie() ?>" id="cookie" min="0" max="<?= Model::MAX_COOKIE_CONSERVATION ?>"> + <label for="cookie">Cookie conservation time <i>(In days)</i></label> + <p>When you tick the <em>remember-me</em> checkbox during login, you can choose how much time <strong>W</strong> will remember you.</p> - <input type="password" name="password" id="password" minlength="<?= Wcms\Model::PASSWORD_MIN_LENGTH ?>" maxlength="<?= Wcms\Model::PASSWORD_MAX_LENGTH ?>"> - <label for="password">New password</label> - - <input type="hidden" name="passwordhash" value="1"> + <input type="password" name="password" id="password" minlength="<?= Wcms\Model::PASSWORD_MIN_LENGTH ?>" maxlength="<?= Wcms\Model::PASSWORD_MAX_LENGTH ?>"> + <label for="password">New password</label> + + <input type="hidden" name="passwordhash" value="1"> - </br> - <input type="submit" value="update"> - </p> - - </form> + <p>Password have to be between <?= Wcms\Model::PASSWORD_MIN_LENGTH ?> and <?= Wcms\Model::PASSWORD_MAX_LENGTH ?> characters long.</p> + + <input type="submit" value="update preferences"> + + </form> + </div> @@ -215,6 +214,5 @@ $this->layout('layout', ['title' => 'user', 'stylesheets' => [$css . 'home.css'] </main> -</body> <?php $this->stop('page') ?>
\ No newline at end of file |