Exemple #1
0
 /**
  * Call this only if database exist
  */
 private function __populate_data()
 {
     //master version currently installed
     $this->_master_version = Model_Version::find('last', array('order_by' => array('meta_update_time' => 'desc')));
     //current avaiable version
     $this->_available_version = $this->_master_version['mode'];
     //license
     $this->_lic = \Licen::load();
 }
Exemple #2
0
 public function check_license($path)
 {
     $wrong = true;
     $recheck = false;
     $licen = Licen::load();
     if ($licen->isLoaded()) {
         if ($licen->isLicenseOk() || $licen->isLicenseOutOfTimeframe()) {
             $dom = implode(',', $licen->getDomainsArray());
             $this->valid = array($licen->getDataKey('DATA', 'register'), $licen->getDataKey('DATA', 'key'), $dom, $licen->getDataKey('DATA', 'ip'), $licen->getDataKey('DATA', 'dir'), date('d-m-Y H:i:s', (int) $licen->getDataKey('DATA', 'created')), date('d-m-Y H:i:s', (int) $licen->getDataKey('DATA', 'valid')), $licen->isOfflineLicense());
             // Let's assume the licence has expired
             $this->valid_c = array('Red', 'Expired');
             // Read the noc version from licence
             $this->nocversion = $licen->getFromLicenceNocVersion();
             /** @todo remove this override of noc version **/
             //$this->nocversion='core';
             //check only for root path
             if ($path == '_root_' && !$licen->isOfflineLicense()) {
                 // If we are in a "Remind period" do recheck on the licence
                 if ($licen->inRemindPeriod()) {
                     if (!isset($this->check_remote)) {
                         $recheck = \Licen::instance()->valRemote($licen->getDataKey('DATA', 'key'));
                         if (!$recheck) {
                             $this->valid_c = array('Orange', 'Server connection problem!');
                         }
                         $this->check_remote = true;
                     }
                 }
             }
             if ($licen->isLicenseOk()) {
                 $wrong = false;
                 $this->valid_c = array('Green', 'Active');
             }
         }
     } else {
         $this->valid_c = array('Red', 'Unknown');
     }
     if (!$recheck && $wrong && !in_array($path, array('auth/license', '_root_', 'force'))) {
         \Response::redirect(\Config::get('base_url') . 'auth/license');
     }
 }
Exemple #3
0
 /**
  * 
  * @param type $data
  * @return boolean
  * 
  */
 private function check_license($data)
 {
     $licen = Licen::load();
     //register online mode
     $data = $licen->valRemote($data['licensekey']);
     if ($data) {
         return $licen->getData();
     }
     return false;
 }
Exemple #4
0
 public function requirements($installed = false)
 {
     $next = true;
     $data = array('php' => array('class' => 'c1', 'value' => 'OK', 'ver' => ''), 'mysql' => array('class' => 'c1', 'value' => 'OK', 'ver' => ''), 'rewrite' => array('class' => 'c1', 'value' => 'OK', 'err' => ''), 'gd' => array('class' => 'c1', 'value' => 'OK', 'err' => ''), 'files' => array(), 'dom' => array('class' => 'c1', 'value' => 'OK', 'err' => ''), 'mysql' => array('class' => 'c1', 'value' => 'OK', 'err' => ''), 'zip' => array('class' => 'c1', 'value' => 'OK', 'err' => ''), 'home' => array('class' => 'c1', 'value' => 'OK', 'err' => ''));
     //php version
     if (version_compare(phpversion(), '5.3.0', '<')) {
         $data['php'] = array('class' => 'c2', 'value' => 'NO', 'ver' => phpversion());
         //$next=false;
     } else {
         $data['php']['ver'] = phpversion();
     }
     /*
      //mod rewrite
      ob_start();
      phpinfo(INFO_MODULES);
      $contents = ob_get_contents();
      ob_end_clean();
     */
     /*
      if(strpos($contents, 'mod_rewrite')==false){
      $data['rewrite']=Array('class'=>'c2','value'=>'NO','err'=>'');
      $next=false;
      }
     */
     //DOM
     if (!class_exists('DOMDocument')) {
         $next = false;
         $data['dom'] = array('class' => 'c2', 'value' => 'NO', 'err' => '');
     }
     //ZIP
     if (!class_exists('ZipArchive')) {
         $next = false;
         $data['zip'] = array('class' => 'c2', 'value' => 'NO', 'err' => '');
     }
     if (!function_exists("mysql_connect")) {
         $next = false;
         $data['mysql'] = array('class' => 'c2', 'value' => 'NO', 'err' => '');
     }
     //gd library
     if (!extension_loaded('gd')) {
         $next = false;
         $data['gd'] = array('class' => 'c2', 'value' => 'NO', 'err' => '');
     }
     //filesecho'hm'; permission
     \Config::load('writable', true);
     $_files = \Config::get('writable');
     foreach ($_files as $file) {
         $perm = substr(sprintf('%o', fileperms($this->path_get($file))), -3);
         if (is_writable($this->path_get($file))) {
             $new = array('file' => $this->path_get($file), 'perm' => $perm, 'writable' => 'OK', 'exist' => 'true', 'class' => 'c1');
         } elseif (!file_exists($this->path_get($file))) {
             $new = array('file' => $this->path_get($file), 'perm' => $perm, 'writable' => 'NO', 'exist' => 'false', 'class' => 'c2');
             $next = false;
         } else {
             $new = array('file' => $this->path_get($file), 'perm' => $perm, 'writable' => 'NO', 'exist' => 'true', 'class' => 'c3');
             $next = false;
         }
         array_push($data['files'], $new);
     }
     $lic = \Licen::load();
     $mode = isset($this->install_mode) ? $this->install_mode : '';
     if (!$lic->isOfflineLicense() and $mode != 'Offline') {
         if (!$installed) {
             $header = @fsockopen('license.noclayer.com', 80, $errno, $errstr, 10);
             if (!$header) {
                 // if the socket fails return failed
                 $data['home'] = array('class' => 'c5', 'value' => $errstr);
                 //$next=false;
             } else {
                 fclose($header);
             }
         } else {
             $data['home'] = array('class' => 'c1', 'value' => 'passed');
         }
     } else {
         $data['home'] = array('class' => 'c1', 'value' => 'OFFLINE');
     }
     return array('req' => $data, 'next' => $next);
 }