protected function step_2() { $license = \Input::post('licenseKey'); $action = \Input::post('action'); if (!$this->_isLicenseValid($license) || !in_array($action, array('step2', 'step3', 'step4', 'downloadLicense'))) { $this->_goToStep1(); } $manifestVersion = Manifestreader::getDataKey('version'); $licenseVersion = Licen::convertLicenseNameToLicenseNameData($license, 'versionCategory'); $validManifest = Nocversions::isCorrectManifestForVersion($manifestVersion, $licenseVersion); $stepBack = false; switch ($action) { case 'downloadLicense': $content = \Licen::instance()->generateEncodedOfflineLicenseData($license); $download = new \fileDownload($content, 'license-' . time()); return $download->download(); break; case 'step4': case 'step3': $stepBack = true; case 'step2': $view = View::forge('install/offline/layout', array('instaled' => false, 'title' => 'Input license')); $view->content = View::forge('install/offline/step_2', array('stepBack' => $stepBack, 'validManifest' => $validManifest, 'licenseKey' => $license, 'licenseInput' => $this->_posted('licenseInput'))); return $view; break; default: return $this->_goToStep1(); break; } }
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); }
public function action_new_key() { $val = Validation::forge(); $val->add_field('data', 'licence data', 'required|min_length[10]|max_length[200]'); if ($val->run()) { $key_passed = true; $key = $val->validated('data'); $reloaded = Licen::instance()->valRemote($key); } else { $key_passed = false; $reloaded = false; } $_data = array('key_passed' => $key_passed, 'reloaded' => $reloaded); if ($key_passed && $reloaded) { $_data = array_merge($_data, $this->_generateLicenseStateData()); } return json_encode($_data); }
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'); } }