aboutsummaryrefslogtreecommitdiff
path: root/app/class
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2019-01-29 13:39:28 +0100
committervincent-peugnet <v.peugnet@free.fr>2019-01-29 13:39:28 +0100
commit5e1ca86211da0439003303cf3e0741edf31bced4 (patch)
tree99fb2548f6eab18b510c9e5850af2459b05d1401 /app/class
parentbd2ddfda3a922766ea2165963f2b2386066deeb2 (diff)
downloadwcms-5e1ca86211da0439003303cf3e0741edf31bced4.tar.gz
wcms-5e1ca86211da0439003303cf3e0741edf31bced4.zip
home redirect
Diffstat (limited to 'app/class')
-rw-r--r--app/class/config.php28
-rw-r--r--app/class/controllerconnect.php2
-rw-r--r--app/class/controllerhome.php25
-rw-r--r--app/class/model.php3
4 files changed, 47 insertions, 11 deletions
diff --git a/app/class/config.php b/app/class/config.php
index 39c8f12..00c03ae 100644
--- a/app/class/config.php
+++ b/app/class/config.php
@@ -20,6 +20,8 @@ abstract class Config
protected static $internallinkblank = false;
protected static $reccursiverender = true;
protected static $defaultprivacy = 0;
+ protected static $homepage = 'default';
+ protected static $homeredirect = null;
// _______________________________________ F U N _______________________________________
@@ -156,6 +158,16 @@ abstract class Config
return self::$defaultprivacy;
}
+ public static function homepage()
+ {
+ return self::$homepage;
+ }
+
+ public static function homeredirect()
+ {
+ return self::$homeredirect;
+ }
+
// __________________________________________ S E T ______________________________________
@@ -268,6 +280,22 @@ abstract class Config
self::$defaultprivacy = $defaultprivacy;
}
}
+
+ public static function sethomepage($homepage)
+ {
+ if(in_array($homepage, Model::HOMEPAGE)) {
+ self::$homepage = $homepage;
+ }
+ }
+
+ public static function sethomeredirect($homeredirect)
+ {
+ if(is_string($homeredirect) && strlen($homeredirect) > 0) {
+ self::$homeredirect = idclean($homeredirect);
+ } else {
+ self::$homeredirect = null;
+ }
+ }
diff --git a/app/class/controllerconnect.php b/app/class/controllerconnect.php
index d6aa7a2..fb43d4c 100644
--- a/app/class/controllerconnect.php
+++ b/app/class/controllerconnect.php
@@ -23,7 +23,7 @@ class Controllerconnect extends Controller
$artupdate['route'] = 'artedit';
$artupdate['id'] = $_SESSION['artupdate']['id'];
} else {
- $artupdate = [$route = 'home'];
+ $artupdate = ['route' => 'home'];
}
$this->showtemplate('connect', $artupdate);
}
diff --git a/app/class/controllerhome.php b/app/class/controllerhome.php
index cc2850f..043ac3e 100644
--- a/app/class/controllerhome.php
+++ b/app/class/controllerhome.php
@@ -16,17 +16,22 @@ class Controllerhome extends Controller
public function desktop()
{
+ if($this->user->isvisitor() && Config::homepage() === 'redirect' && Config::homeredirect() !== null) {
+ $this->routedirect('artread/', ['art' => Config::homeredirect()]);
+ } else {
- $table = $this->modelhome->getlister();
- $this->opt = $this->modelhome->optinit($table);
-
- $table2 = $this->modelhome->table2($table, $this->opt);
-
- $columns = $this->modelhome->setcolumns($this->user->columns());
-
- $this->showtemplate('home', ['user' => $this->user, 'table2' => $table2, 'opt' =>$this->opt, 'columns' => $columns]);
-
-
+
+ $table = $this->modelhome->getlister();
+ $this->opt = $this->modelhome->optinit($table);
+
+ $table2 = $this->modelhome->table2($table, $this->opt);
+
+ $columns = $this->modelhome->setcolumns($this->user->columns());
+
+ $this->showtemplate('home', ['user' => $this->user, 'table2' => $table2, 'opt' =>$this->opt, 'columns' => $columns]);
+
+
+ }
}
public function columns()
diff --git a/app/class/model.php b/app/class/model.php
index 779fb46..c8f251f 100644
--- a/app/class/model.php
+++ b/app/class/model.php
@@ -30,6 +30,9 @@ abstract class Model
const RENDER_CLASS_ORIGIN = false;
const RENDER_EMPTY_ELEMENT = false;
+ /** CONFIG OPTIONS */
+ const HOMEPAGE = ['default', 'search', 'redirect'];
+
public static function dirtopath($dir)
{
$basepath = '';