Esempio n. 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();
 }
Esempio n. 2
0
 public function action_license($id = null)
 {
     $out = array('license' => 'expired');
     $val = \Validation::forge();
     $val->add_field('data', 'licence data', 'required|min_length[10]|max_length[200]');
     if ($val->run()) {
         $active = \Licen::instance()->reactivate($lic);
         $out = array('license' => $active);
     }
     echo json_encode($out);
     //print_r($this->valid);
 }
Esempio n. 3
0
 public function action_force_reload()
 {
     $licen = Licen::reinstance();
     $_data = array('key_found' => $licen->hasDataKey('DATA', 'key'));
     if ($licen->hasDataKey('DATA', 'key')) {
         $_data = array('key_found' => true, 'reloaded' => $licen->valRemote($licen->getDataKey('DATA', 'key')));
     } else {
         $_data = array('key_found' => false, 'reloaded' => false);
     }
     $data = array_merge($_data, $this->_generateLicenseStateData());
     return json_encode($data);
 }
Esempio n. 4
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');
     }
 }
Esempio n. 5
0
 /**
  * Force reinstance
  * 
  * @return Licen
  */
 public static function reinstance()
 {
     self::$_instance = null;
     return self::instance();
 }
Esempio n. 6
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;
 }
Esempio n. 7
0
 protected function step_4()
 {
     $license = \Input::post('licenseKey');
     $action = \Input::post('action');
     $postFile = \Input::post('licensePost');
     if (!$this->_isLicenseValid($license) || !in_array($action, array('step4'))) {
         return $this->_goToStep1();
     }
     $decoded = base64_decode($postFile);
     $fileLicen = Licen::parse($decoded);
     $key = $fileLicen->getKey();
     if ($key != $license || !$fileLicen->isLicenseOk()) {
         // Wrong or invalid license was uploaded, ask for new license upload.
         return $this->step_2();
     }
     $finalData = $this->evaluateFinalErrors();
     if (count($finalData) > 0) {
         return $this->step_3();
     }
     // Write license file to disk
     file_put_contents(APPPATH . 'license/license.txt', $decoded);
     Licen::reinstance();
     // Finaly Preform Install
     $data = $this->getStep4PostData();
     return $this->_install($data);
 }
Esempio n. 8
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);
 }