Example #1
0
 /**
  * Get default server information and prepare chmod info
  */
 public function before()
 {
     $this->phpVersion = phpversion();
     $this->pdo = extension_loaded('pdo');
     $this->gd = extension_loaded('gd') && function_exists('gd_info');
     // autoload is disabled, lets get chmod file & dirs from console app data
     File::inc('/Apps/Controller/Console/Main.php');
     $this->_chmodDirs = Main::$installDirs;
     // for each file or directory in list - check permissions
     foreach ($this->_chmodDirs as $object) {
         if (Str::endsWith('.php', $object)) {
             // sounds like a file
             $this->chmodCheck[$object] = File::exist($object) && File::writable($object);
         } else {
             $this->chmodCheck[$object] = Directory::exist($object) && Directory::writable($object);
         }
     }
 }
Example #2
0
 /**
  * Write configurations data from array to cfg file
  * @param string $configFile
  * @param array $data
  * @return bool
  */
 public function writeConfig($configFile, array $data)
 {
     $path = '/Private/Config/' . ucfirst(Str::lowerCase($configFile)) . '.php';
     if (!File::exist($path) || !File::writable($path)) {
         return false;
     }
     $saveData = '<?php return ' . Arr::exportVar($data) . ';';
     File::write($path, $saveData);
     return true;
 }
Example #3
0
 /**
  * Save model properties as configurations
  * @return bool
  */
 public function makeSave()
 {
     $toSave = App::$Security->strip_php_tags($this->getAllProperties());
     $stringSave = '<?php return ' . Arr::exportVar($toSave, null, true) . ';';
     $cfgPath = '/Private/Config/Default.php';
     if (File::exist($cfgPath) && File::writable($cfgPath)) {
         File::write($cfgPath, $stringSave);
         return true;
     }
     return false;
 }
Example #4
0
 /**
  * Show add form for routing
  * @return string
  * @throws \Ffcms\Core\Exception\SyntaxException
  * @throws \Ffcms\Core\Exception\NativeException
  */
 public function actionAddroute()
 {
     $model = new FormAddRoute(true);
     if (!File::exist('/Private/Config/Routing.php') || !File::writable('/Private/Config/Routing.php')) {
         App::$Session->getFlashBag()->add('error', __('Routing configuration file is not allowed to write: /Private/Config/Routing.php'));
     } elseif ($model->send() && $model->validate()) {
         $model->save();
         return $this->view->render('add_route_save');
     }
     return $this->view->render('add_route', ['model' => $model]);
 }