aboutsummaryrefslogtreecommitdiff
path: root/app/class
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2019-08-09 15:58:37 +0200
committervincent-peugnet <v.peugnet@free.fr>2019-08-09 15:58:37 +0200
commit93c827446737252c36d6d9daee7e2e7a55eb911b (patch)
treec3c602a65e971b0953ff9c6d98cbb2b017964b12 /app/class
parent95ada5c09026882f384a4a386916b1b2decbfce9 (diff)
downloadwcms-93c827446737252c36d6d9daee7e2e7a55eb911b.tar.gz
wcms-93c827446737252c36d6d9daee7e2e7a55eb911b.zip
New Feature : Alert pages have more options
Diffstat (limited to 'app/class')
-rw-r--r--app/class/config.php130
-rw-r--r--app/class/controllerart.php9
2 files changed, 119 insertions, 20 deletions
diff --git a/app/class/config.php b/app/class/config.php
index dfeb4d7..59d80eb 100644
--- a/app/class/config.php
+++ b/app/class/config.php
@@ -6,11 +6,19 @@ abstract class Config
{
protected static $arttable = 'mystore';
protected static $domain = '';
- protected static $color4;
protected static $fontsize = 15;
protected static $basepath = '';
- protected static $route404;
+ protected static $route404;
+ protected static $alerttitle = '';
+ protected static $alertlink = '';
+ protected static $alertlinktext = '';
protected static $existnot = 'This page does not exist yet';
+ protected static $private = 'This page is private';
+ protected static $notpublished = 'This page is not published';
+ protected static $existnotpass = false;
+ protected static $privatepass = false;
+ protected static $notpublishedpass = false;
+ protected static $alertcss = false;
protected static $defaultbody = '%HEADER%'. PHP_EOL .PHP_EOL . '%NAV%'. PHP_EOL .PHP_EOL . '%ASIDE%'. PHP_EOL .PHP_EOL . '%MAIN%'. PHP_EOL .PHP_EOL . '%FOOTER%';
protected static $defaultart = '';
protected static $defaultfavicon = '';
@@ -115,11 +123,6 @@ abstract class Config
return self::$domain;
}
- public static function color4()
- {
- return self::$color4;
- }
-
public static function fontsize()
{
return self::$fontsize;
@@ -135,11 +138,56 @@ abstract class Config
return self::$route404;
}
+ public static function alerttitle()
+ {
+ return self::$alerttitle;
+ }
+
+ public static function alertlink()
+ {
+ return self::$alertlink;
+ }
+
+ public static function alertlinktext()
+ {
+ return self::$alertlinktext;
+ }
+
public static function existnot()
{
return self::$existnot;
}
+ public static function private()
+ {
+ return self::$private;
+ }
+
+ public static function notpublished()
+ {
+ return self::$notpublished;
+ }
+
+ public static function existnotpass()
+ {
+ return self::$existnotpass;
+ }
+
+ public static function privatepass()
+ {
+ return self::$privatepass;
+ }
+
+ public static function notpublishedpass()
+ {
+ return self::$notpublishedpass;
+ }
+
+ public static function alertcss()
+ {
+ return self::$alertcss;
+ }
+
public static function defaultbody()
{
return self::$defaultbody;
@@ -218,13 +266,6 @@ abstract class Config
self::$domain = strip_tags(strtolower($domain));
}
- public static function setcolor4($color4)
- {
- if (strlen($color4) <= 8) {
- self::$color4 = $color4;
- }
- }
-
public static function setfontsize($fontsize)
{
$fontsize = intval($fontsize);
@@ -245,13 +286,68 @@ abstract class Config
}
}
- public static function setexistnot($description)
+ public static function setalerttitle($alerttitle)
{
- if(is_string($description)) {
- self::$existnot = strip_tags($description);
+ if(is_string($alerttitle)) {
+ self::$alerttitle = strip_tags($alerttitle);
}
}
+ public static function setalertlink($alertlink)
+ {
+ if(is_string($alertlink)) {
+ self::$alertlink = idclean(strip_tags($alertlink));
+ }
+ }
+
+ public static function setalertlinktext($alertlinktext)
+ {
+ if(is_string($alertlinktext)) {
+ self::$alertlinktext = strip_tags($alertlinktext);
+ }
+ }
+
+ public static function setexistnot($existnot)
+ {
+ if(is_string($existnot)) {
+ self::$existnot = strip_tags($existnot);
+ }
+ }
+
+ public static function setprivate($private)
+ {
+ if(is_string($private)) {
+ self::$private = strip_tags($private);
+ }
+ }
+
+ public static function setnotpublished($notpublished)
+ {
+ if(is_string($notpublished)) {
+ self::$notpublished = strip_tags($notpublished);
+ }
+ }
+
+ public static function setexistnotpass($existnotpass)
+ {
+ self::$existnotpass = boolval($existnotpass);
+ }
+
+ public static function setprivatepass($privatepass)
+ {
+ self::$privatepass = boolval($privatepass);
+ }
+
+ public static function setnotpublishedpass($notpublishedpass)
+ {
+ self::$notpublishedpass = boolval($notpublishedpass);
+ }
+
+ public static function setalertcss($alertcss)
+ {
+ self::$alertcss = boolval($alertcss);
+ }
+
public static function setdefaultbody($defaultbody)
{
if(is_string($defaultbody)) {
diff --git a/app/class/controllerart.php b/app/class/controllerart.php
index 027fc19..ac52043 100644
--- a/app/class/controllerart.php
+++ b/app/class/controllerart.php
@@ -118,7 +118,6 @@ class Controllerart extends Controller
$artexist = $this->importart();
$canread = $this->user->level() >= $this->art->secure();
- $alerts = ['alertnotexist' => 'This page does not exist yet', 'alertprivate' => 'You cannot see this page'];
$page = ['head' => '', 'body' => ''];
if ($artexist) {
@@ -138,9 +137,13 @@ class Controllerart extends Controller
}
$this->artmanager->update($this->art);
}
- $data = array_merge($alerts, $page, ['art' => $this->art, 'artexist' => $artexist, 'canread' => $canread, 'readernav' => Config::showeditmenu(), 'canedit' => $this->canedit()]);
+ $data = array_merge($page, ['art' => $this->art, 'artexist' => $artexist , 'readernav' => Config::showeditmenu(), 'canedit' => $this->canedit()]);
- $this->showtemplate('read', $data);
+ if($artexist && $canread) {
+ $this->showtemplate('read', $data);
+ } else {
+ $this->showtemplate('alert', $data);
+ }
}