Example #1
0
 /**
  * Update core Phanbook
  *
  * @return mixed
  */
 public function indexAction()
 {
     $this->tag->setTitle(t('Phanbook Updates'));
     if (ZFunction::gitUpdate()) {
         $this->view->output = ZFunction::gitUpdate();
         $this->flashSession->success(t('Phanbook upgraded successfully'));
     }
 }
Example #2
0
 /**
  * The task updated core Phanbook
  *
  * @return mixed
  */
 public function mainAction()
 {
     Output::stdout('======================================================');
     Output::stdout('Loading phanbook repositories with package information');
     Output::stdout('Call function ZFunction::gitUpdate()');
     ZFunction::gitUpdate();
     Output::stdout('Phanbook upgraded successfully');
     Output::stdout('======================================================');
 }
Example #3
0
 public function saveConfig($arrayConfig)
 {
     $filename = ROOT_DIR . 'content/options/options.php';
     if (!file_exists($filename)) {
         $makeFile = ZFunction::makeFile($filename);
         file_put_contents($filename, "<?php return [];");
     }
     if (file_exists($filename)) {
         $data = new AdapterPhp($filename);
         $result = array_merge($data->toArray(), $arrayConfig);
         $result = '<?php return ' . var_export($result, true) . ';';
         if (!file_put_contents($filename, $result)) {
             return false;
         }
         return true;
     }
 }
 /**
  * Make data configuration to file options.php inside directory config
  *
  * @return mixed
  */
 public function saveAnalyticAction()
 {
     $this->view->disable();
     //Is not $_POST
     if (!$this->request->isPost()) {
         return $this->currentRedirect();
     }
     $filename = ROOT_DIR . 'common/config/options.php';
     if (!file_exists($filename)) {
         $makeFile = ZFunction::makeFile($filename);
     }
     if (file_exists($filename)) {
         $analytic = ['googleAnalytic' => $this->request->getPost('analytic')];
         $data = new AdapterPhp($filename);
         $result = array_merge($data->toArray(), $analytic);
         $result = '<?php return ' . var_export($result, true) . ';';
         if (!file_put_contents($filename, $result)) {
             throw new \Exception("Data was not saved", 1);
         }
         $this->flashSession->success(t('Data was successfully deleted'));
         return $this->currentRedirect();
     }
     return $this->currentRedirect();
 }
Example #5
0
 /**
  * @return bool|string
  */
 public function getHumanCreatedAt()
 {
     return ZFunction::getHumanDate($this->createdAt);
 }
Example #6
0
 /**
  * @return bool|string
  */
 public function getHumanModifiedAt()
 {
     if ($this->modifiedAt != $this->createdAt) {
         return ZFunction::getHumanDate($this->modifiedAt);
     }
     return false;
 }