aboutsummaryrefslogtreecommitdiff
path: root/app/class
diff options
context:
space:
mode:
Diffstat (limited to 'app/class')
-rw-r--r--app/class/Controllerhome.php7
-rw-r--r--app/class/Controllerpage.php1
-rw-r--r--app/class/Metaedit.php44
-rw-r--r--app/class/Modelpage.php26
-rw-r--r--app/class/Page.php2
5 files changed, 28 insertions, 52 deletions
diff --git a/app/class/Controllerhome.php b/app/class/Controllerhome.php
index bb22e57..6e691a6 100644
--- a/app/class/Controllerhome.php
+++ b/app/class/Controllerhome.php
@@ -36,7 +36,7 @@ class Controllerhome extends Controllerpage
$columns = $this->modelhome->setcolumns($this->user->columns());
- $vars = ['user' => $this->user, 'table2' => $table2, 'opt' => $this->opt, 'columns' => $columns];
+ $vars = ['user' => $this->user, 'table2' => $table2, 'opt' => $this->opt, 'columns' => $columns, 'faviconlist' => $this->mediamanager->listfavicon(), 'editorlist' => $this->usermanager->getlisterbylevel(2, '>=')];
$vars['footer'] = ['version' => getversion(), 'total' => count($table), 'database' => Config::pagetable()];
if (isset($_POST['query']) && $this->user->iseditor()) {
@@ -132,9 +132,10 @@ class Controllerhome extends Controllerpage
if ($this->user->issupereditor() && isset($_POST['pagesid'])) {
$datas = $_POST['datas'] ?? [];
$reset = $_POST['reset'] ?? [];
- $addtag = $_POST['addtag'] ?? [];
+ $addtag = $_POST['addtag'] ?? '';
+ $addauthor = $_POST['addauthor'] ?? '';
foreach ($_POST['pagesid'] as $id) {
- $this->pagemanager->pageedit($id, $datas, $reset, $addtag);
+ $this->pagemanager->pageedit($id, $datas, $reset, $addtag, $addauthor);
}
}
$this->routedirect('home');
diff --git a/app/class/Controllerpage.php b/app/class/Controllerpage.php
index d1bfca5..e12d76e 100644
--- a/app/class/Controllerpage.php
+++ b/app/class/Controllerpage.php
@@ -163,7 +163,6 @@ class Controllerpage extends Controller
} else {
$this->showtemplate('alert', ['page' => $this->page, 'pageexist' => $pageexist, 'canedit' => $this->canedit()]);
}
-
}
public function edit($id)
diff --git a/app/class/Metaedit.php b/app/class/Metaedit.php
deleted file mode 100644
index e21a0c2..0000000
--- a/app/class/Metaedit.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-namespace Wcms;
-
-class Pageedit extends Page
-{
- protected $resettag;
- protected $resetdate;
- protected $emptycontent;
-
-
-
-
- /**
- * Edit a page based on object seting
- *
- * @param Page $page Page to be metaedited
- *
- * @return Page Edited page object
- */
- public function editpage(Page $page)
- {
- if($this->resettag) {
- $page->tag([]);
- }
- $page->addtag($this->tag);
- if($this->resetdate) {
- $page->date()
- }
- $page->secure($this->secure);
- $page->templatebody($this->templatebody);
- $page->templatecss($this->templatecss);
- $page->templatejavascript($this->templatejavascript);
-
- return $page;
- }
-
-}
-
-
-
-
-
-?> \ No newline at end of file
diff --git a/app/class/Modelpage.php b/app/class/Modelpage.php
index 3f4dcf4..a13b3d4 100644
--- a/app/class/Modelpage.php
+++ b/app/class/Modelpage.php
@@ -333,21 +333,41 @@ class Modelpage extends Modeldb
return $idlist;
}
- public function pageedit($pageid, $datas, $reset, $addtag)
+ /**
+ * Edit a page based on meta infos
+ *
+ * @param string $pageid
+ * @param array $datas
+ * @param array $reset
+ * @param string $addtag
+ * @param string $addauthor
+ */
+ public function pageedit($pageid, $datas, $reset, $addtag, $addauthor)
{
$page = $this->get($pageid);
$page = $this->reset($page, $reset);
$page->hydrate($datas);
$page->addtag($addtag);
+ $page->addauthor($addauthor);
$this->update($page);
}
-
- public function reset(Page $page, $reset)
+ /**
+ * Reset values of a page
+ *
+ * @param Page $page Page object to be reseted
+ * @param array $reset List of parameters needing reset
+ *
+ * @return Page The reseted page object
+ */
+ public function reset(Page $page, array $reset) : Page
{
if($reset['tag']) {
$page->settag([]);
}
+ if($reset['author']) {
+ $page->setauthors([]);
+ }
if($reset['date']) {
// reset date as now
}
diff --git a/app/class/Page.php b/app/class/Page.php
index 1daa240..41cf0ab 100644
--- a/app/class/Page.php
+++ b/app/class/Page.php
@@ -719,7 +719,7 @@ class Page
public function setauthors($authors)
{
if(is_array($authors)) {
- $this->authors = array_values(array_filter($authors));
+ $this->authors = array_unique(array_values(array_filter($authors)));
}
}