aboutsummaryrefslogtreecommitdiff
path: root/app/class
diff options
context:
space:
mode:
Diffstat (limited to 'app/class')
-rw-r--r--app/class/Colors.php2
-rw-r--r--app/class/Controllerhome.php34
-rw-r--r--app/class/Controlleruser.php36
-rw-r--r--app/class/Element.php2
-rw-r--r--app/class/Medialist.php15
-rw-r--r--app/class/Modelrender.php10
-rw-r--r--app/class/Routes.php2
7 files changed, 58 insertions, 43 deletions
diff --git a/app/class/Colors.php b/app/class/Colors.php
index 2e4af23..bdea98e 100644
--- a/app/class/Colors.php
+++ b/app/class/Colors.php
@@ -121,7 +121,7 @@ class Colors extends Item
foreach ($this->tagcolor as $tag => $color) {
$i = '<input type="color" name="tagcolor[' . $tag . ']" value="' . $color . '" id="color_' . $tag . '">';
$l = '<label for="color_' . $tag . '" >' . $tag . '</label>';
- $html .= "\n<li>$i . $l</li>";
+ $html .= "\n<li>$i$l</li>";
}
$html .= PHP_EOL . '</ul>';
return $html;
diff --git a/app/class/Controllerhome.php b/app/class/Controllerhome.php
index 1385652..4dd8227 100644
--- a/app/class/Controllerhome.php
+++ b/app/class/Controllerhome.php
@@ -177,40 +177,6 @@ class Controllerhome extends Controllerpage
$this->routedirect('home');
}
- public function bookmark()
- {
- if ($this->user->iseditor() && isset($_POST['action']) && isset($_POST['id']) && !empty($_POST['id'])) {
- if ($_POST['action'] == 'add' && isset($_POST['query'])) {
- if (isset($_POST['user']) && $_POST['user'] == $this->user->id()) {
- $bookmark = new Bookmark($_POST);
- $bookmark->init($_POST['id'], 'home', $_POST['query'], [], $_POST['icon']);
- $usermanager = new Modeluser();
- $user = $usermanager->get($_POST['user']);
- $user->addbookmark($bookmark);
- $usermanager->add($user);
- } else {
- Config::addbookmark($_POST['id'], $_POST['query']);
- Config::savejson();
- }
- } elseif ($_POST['action'] == 'del') {
- if (isset($_POST['user']) && $_POST['user'] == $this->user->id()) {
- $usermanager = new Modeluser();
- $user = $usermanager->get($_POST['user']);
- foreach ($_POST['id'] as $id) {
- $user->deletebookmark($id);
- }
- $usermanager->add($user);
- } else {
- foreach ($_POST['id'] as $id) {
- Config::deletebookmark($id);
- }
- Config::savejson();
- }
- }
- }
- $this->routedirect('home');
- }
-
public function multi()
{
if (isset($_POST['action']) && $this->user->issupereditor() && !empty($_POST['pagesid'])) {
diff --git a/app/class/Controlleruser.php b/app/class/Controlleruser.php
index d5bf934..7f12e77 100644
--- a/app/class/Controlleruser.php
+++ b/app/class/Controlleruser.php
@@ -49,6 +49,42 @@ class Controlleruser extends Controller
}
+ public function bookmark()
+ {
+ if ($this->user->iseditor() && isset($_POST['action']) && isset($_POST['id']) && !empty($_POST['id'])) {
+ if ($_POST['action'] == 'add' && isset($_POST['query'])) {
+ if (isset($_POST['user']) && $_POST['user'] == $this->user->id()) {
+ $bookmark = new Bookmark();
+ $bookmark->init($_POST['id'], $_POST['route'], $_POST['query'], [], $_POST['icon']);
+ $usermanager = new Modeluser();
+ $user = $usermanager->get($_POST['user']);
+ $user->addbookmark($bookmark);
+ $usermanager->add($user);
+ } else {
+ Config::addbookmark($_POST['id'], $_POST['query']);
+ Config::savejson();
+ }
+ } elseif ($_POST['action'] == 'del') {
+ if (isset($_POST['user']) && $_POST['user'] == $this->user->id()) {
+ $usermanager = new Modeluser();
+ $user = $usermanager->get($_POST['user']);
+ foreach ($_POST['id'] as $id) {
+ $user->deletebookmark($id);
+ }
+ $usermanager->add($user);
+ } else {
+ foreach ($_POST['id'] as $id) {
+ Config::deletebookmark($id);
+ }
+ Config::savejson();
+ }
+ }
+ }
+ $this->routedirect($_POST['route']);
+ }
+
+
+
diff --git a/app/class/Element.php b/app/class/Element.php
index 7478256..b4a9285 100644
--- a/app/class/Element.php
+++ b/app/class/Element.php
@@ -46,7 +46,7 @@ class Element extends Item
public function addtags()
{
- $this->content = "\n<' . $this->type() . '>\n' . $this->content() . '\n</' . $this->type() . '>\n";
+ $this->content = "\n<{$this->type()}>\n{$this->content()}\n</{$this->type()}>\n";
}
diff --git a/app/class/Medialist.php b/app/class/Medialist.php
index c597505..e716845 100644
--- a/app/class/Medialist.php
+++ b/app/class/Medialist.php
@@ -127,7 +127,20 @@ class Medialist extends Item
if (array_diff(self::TYPES, $this->type) != []) {
$query['type'] = $this->type;
}
- return '%MEDIA?' . urldecode(http_build_query($query)) . '%';
+ return urldecode(http_build_query($query));
+ }
+
+ /**
+ * Get the code to insert directly
+ */
+ public function getcode(): string
+ {
+ return '%MEDIA?' . $this->getquery() . '%';
+ }
+
+ public function getadress(): string
+ {
+ return '?' . $this->getquery();
}
diff --git a/app/class/Modelrender.php b/app/class/Modelrender.php
index 1ad9e20..8f20f83 100644
--- a/app/class/Modelrender.php
+++ b/app/class/Modelrender.php
@@ -89,7 +89,7 @@ class Modelrender extends Modelpage
$body = $this->getbody($this->readbody());
$parsebody = $this->bodyparser($body);
- $html = "<!DOCTYPE html>\n<html>\n<head>\n' . $head . '\n</head>\n' . $parsebody . '\N</html>";
+ $html = "<!DOCTYPE html>\n<html>\n<head>\n$head\n</head>\n$parsebody\n</html>";
return $html;
}
@@ -288,16 +288,16 @@ class Modelrender extends Modelpage
if (!empty($this->page->templatecss())) {
$tempaltecsspage = $this->page->templatecss();
- $head .= "<link href=\"$renderpath . $tempaltecsspage.css\" rel=\"stylesheet\" />\n";
+ $head .= "<link href=\"$renderpath$tempaltecsspage.css\" rel=\"stylesheet\" />\n";
}
- $head .= "<link href=\"$renderpath . $id.css\" rel=\"stylesheet\" />\n";
+ $head .= "<link href=\"$renderpath$id.css\" rel=\"stylesheet\" />\n";
if (!empty($this->page->templatejavascript())) {
$templatejspage = $this->page->templatejavascript();
- $head .= "<script src=\"$renderpath . $templatejspage.js\" async/></script>\n";
+ $head .= "<script src=\"$renderpath$templatejspage.js\" async/></script>\n";
}
if (!empty($this->page->javascript())) {
- $head .= "<script src=\"$renderpath . $id.js\" async/></script>\n";
+ $head .= "<script src=\"$renderpath$id.js\" async/></script>\n";
}
if (!empty(Config::analytics())) {
diff --git a/app/class/Routes.php b/app/class/Routes.php
index 2a1e088..59659ea 100644
--- a/app/class/Routes.php
+++ b/app/class/Routes.php
@@ -25,7 +25,6 @@ class Routes
['POST', '/columns', 'Controllerhome#columns', 'homecolumns'],
['POST', '/colors', 'Controllerhome#colors', 'homecolors'],
['GET', '//renderall', 'Controllerhome#renderall', 'homerenderall'],
- ['POST', '/bookmark', 'Controllerhome#bookmark', 'homebookmark'],
['POST', '/multi', 'Controllerhome#multi', 'multi'],
['POST', '/upload', 'Controllerpage#upload', 'pageupload'],
['POST', '/!co', 'Controllerconnect#log', 'log'],
@@ -45,6 +44,7 @@ class Routes
['GET', '/!user', 'Controlleruser#desktop', 'user'],
['POST', '/!user/add', 'Controlleruser#add', 'useradd'],
['POST', '/!user/update', 'Controlleruser#update', 'userupdate'],
+ ['POST', '/!user/bookmark', 'Controlleruser#bookmark', 'userbookmark'],
['POST', '/!user/pref', 'Controlleruser#pref', 'userpref'],
['POST', '/!user/token', 'Controlleruser#token', 'usertoken'],
['GET', '/!info', 'Controllerinfo#desktop', 'info'],