From e802d5204b96d645ec3d40b81b4a8bdc6e0ee675 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Mon, 4 Nov 2019 23:31:31 +0100 Subject: refactor: switch to psr-4 autoloading --- app/class/Application.php | 145 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 app/class/Application.php (limited to 'app/class/Application.php') diff --git a/app/class/Application.php b/app/class/Application.php new file mode 100644 index 0000000..70c899f --- /dev/null +++ b/app/class/Application.php @@ -0,0 +1,145 @@ +usermanager = new Modeluser(); + } + + public function wakeup() + { + if(isset($_POST['configinit'])) { + if(Config::readconfig()) { + Config::createconfig($_POST['configinit']); + } else { + Config::hydrate($_POST['configinit']); + } + Config::getdomain(); + if(!is_dir(Model::RENDER_DIR)) { + mkdir(Model::RENDER_DIR); + } + if(!Config::savejson()) { + echo 'Cant write config file'; + exit; + } else{ + header('Location: ./'); + exit; + } + } elseif(isset($_POST['userinit']) && !empty($_POST['userinit']['id']) && !empty($_POST['userinit']['password'])) { + $userdata = $_POST['userinit']; + $userdata['level'] = 10; + $user = new User($userdata); + $this->usermanager->add($user); + header('Location: ./'); + exit; + + } else { + if(Config::readconfig()) { + if(!Config::checkbasepath() || empty(Config::pagetable()) || !is_dir(Model::RENDER_DIR) || !Config::checkdomain()) { + echo ''; + $this->configform(); + exit; + } else { + if($this->usermanager->admincount() === 0) { + echo 'missing admin user'; + $this->adminform(); + exit; + } + } + } else { + echo 'Missing config file'; + $this->configform(); + exit; + } + } + } + + public function configform() + { + ?> +

Configuration

+ +

Version :

+ +

+ +
+
+

+ +

+ +

Leave it empty if W-CMS is in your root folder, otherwise, indicate the subfolder(s) in witch you installed the CMS

+
+
+

+ +

+ +

Set the name of the first folder that is going to store all your work

+
+ +
+ + + +
+
+

+ +

+ +

Your user id as the first administrator.

+
+
+

+ +

+ +

Your user passworder as first administrator.

+
+ +
+ + \ No newline at end of file -- cgit v1.2.3