public function saveLicense(License $license) { try { $license->save(); } catch (Exception $e) { throw new DaoException($e->getMessage(), $e->getCode(), $e); } }
public function testAddLicense() { $license = new License(); $license->setName('Bicycle'); $this->licenseDao->saveLicense($license); $savedLicense = TestDataService::fetchLastInsertedRecord('License', 'id'); $this->assertTrue($savedLicense instanceof License); $this->assertEquals('Bicycle', $savedLicense->getName()); }
/** * @param $args * @param $url * * @return mixed */ public function add_auth_headers($args, $url) { if (strpos($url, $this->api_url) !== 0) { return $args; } $this->license->load(); if (!isset($args['headers'])) { $args['headers'] = array(); } $args['headers']['Authorization'] = 'Basic ' . base64_encode(urlencode($this->license->site) . ':' . urlencode($this->license->key)); return $args; }
function license_get_by_id($id) { $result = sql_do('SELECT id_lic,name_lic,valid_lic FROM licenses WHERE id_lic=\'' . int($id) . '\''); if ($result->numRows() != 1) { return 0; } $row = $result->fetchRow(); $lic = new License(); $lic->set_id_lic($row[0]); $lic->set_name_lic($row[1]); $lic->set_valid_lic($row[2]); return $lic; }
/** * Search Licenses */ static function search($q = NULL, $param = NULL, $product_code = NULL) { $_tbl_licenses = License::getTableName(); $_tbl_licensesUses = LicensesUses::getTableName(); $_tbl_transactions = Transaction::getTableName(); $_tbl_purchases = Purchase::getTableName(); $_tbl_products = Product::getTableName(); $_tbl_plans = Plan::getTableName(); $_tbl_buyers = Buyer::getTableName(); $fields = array("{$_tbl_licenses}.*", DB::raw("COUNT({$_tbl_licensesUses}.id) AS totalUsed"), "{$_tbl_buyers}.first_name", "{$_tbl_buyers}.last_name", "{$_tbl_buyers}.email", "{$_tbl_products}.code", "{$_tbl_plans}.code AS plan_code", "{$_tbl_products}.api_key"); $licenses = DB::table($_tbl_licenses)->leftJoin($_tbl_licensesUses, "{$_tbl_licensesUses}.license_id", '=', "{$_tbl_licenses}.id")->join($_tbl_transactions, "{$_tbl_transactions}.id", '=', "{$_tbl_licenses}.transaction_id")->join($_tbl_plans, "{$_tbl_transactions}.plan_id", '=', "{$_tbl_plans}.id")->join($_tbl_purchases, "{$_tbl_purchases}.id", '=', "{$_tbl_transactions}.purchase_id")->join($_tbl_products, "{$_tbl_products}.id", '=', "{$_tbl_purchases}.product_id")->join($_tbl_buyers, "{$_tbl_buyers}.id", '=', "{$_tbl_purchases}.buyer_id")->select($fields)->groupBy("{$_tbl_licenses}.id"); $q = $q ? $q : Input::get('q'); $param = $param ? $param : Input::get('param'); if ($q) { if ($param == "key") { $licenses = $licenses->where("license_key", '=', $q); } if ($param == "email") { $licenses = $licenses->where("email", '=', $q); } if ($product_code) { $licenses = $licenses->where($_tbl_licenses . ".license_key", 'LIKE', strtoupper($product_code) . '-%'); } } return $licenses->orderBy($_tbl_licenses . '.created_at', 'DESC')->paginate(25); }
/** * Generate license */ public function postGenerateLicense() { $rules = array('transaction_id' => 'required'); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { return Redirect::to('admin/utilities/generate-license')->withErrors($validator)->withInput(); } else { $transaction_id = Input::get('transaction_id'); if ($transaction = Transaction::where('id', '=', $transaction_id)->first()) { if ($license = License::where('transaction_id', '=', $transaction_id)->first()) { Session::flash('alert_error', '<strong>Ooops!</strong> License for given transaction already exists.'); return Redirect::to('admin/licenses?q=' . $license->license_key . '¶m=key'); } $plan = Plan::where('id', '=', $transaction->plan_id)->first(); if ($plan->has_license) { $product = Product::where('id', '=', $plan->product_id)->first(); $license_key = License::generate($product->code); // Save license $license = new License(); $license->license_key = $license_key; $license->transaction_id = $transaction_id; $license->allowed_usage = $plan->license_allowed_usage; $license->save(); Session::flash('alert_message', '<strong>Well done!</strong> You successfully have generated license key.'); return Redirect::to('admin/licenses?q=' . $license_key . '¶m=key'); } else { Session::flash('alert_error', '<strong>Ooops!</strong> This plan does not allow to generate a license key.'); return Redirect::to('admin/utilities/generate-license'); } } else { Session::flash('alert_error', '<strong>Ooops!</strong> Transaction was not found.'); return Redirect::to('admin/utilities/generate-license'); } } }
public static function getDefaultLicense() { if (License::$noDataLicense === null) { License::$noDataLicense = new License(null); } return License::$noDataLicense; }
public function setLicensePlaceholders($template) { $date = $this->license->getValidToDate(); if ($date) { $formattedValidityDate = date(ASCMS_DATE_FORMAT_DATE, $date); } else { $formattedValidityDate = ''; } $date = $this->license->getCreatedAtDate(); if ($date) { $formattedCreateDate = date(ASCMS_DATE_FORMAT_DATE, $date); } else { $formattedCreateDate = ''; } $cdate = $this->license->getValidToDate(); $today = time(); $difference = $cdate - $today; if ($difference < 0) { $difference = 0; } $validDayCount = ceil($difference / 60 / 60 / 24) - 1; if ($validDayCount < 0) { $validDayCount = 0; } $template->setVariable(array('LICENSE_STATE' => $this->lang['TXT_LICENSE_STATE_' . $this->license->getState()], 'LICENSE_EDITION' => contrexx_raw2xhtml($this->license->getEditionName()), 'INSTALLATION_ID' => contrexx_raw2xhtml($this->license->getInstallationId()), 'LICENSE_KEY' => contrexx_raw2xhtml($this->license->getLicenseKey()), 'LICENSE_VALID_TO' => contrexx_raw2xhtml($formattedValidityDate), 'LICENSE_VALID_DAY_COUNT' => contrexx_raw2xhtml($validDayCount), 'LICENSE_CREATED_AT' => contrexx_raw2xhtml($formattedCreateDate), 'LICENSE_REQUEST_INTERVAL' => contrexx_raw2xhtml($this->license->getRequestInterval()), 'LICENSE_GRAYZONE_DAYS' => contrexx_raw2xhtml($this->license->getGrayzoneTime()), 'LICENSE_FRONTENT_OFFSET_DAYS' => contrexx_raw2xhtml($this->license->getFrontendLockTime()), 'LICENSE_UPGRADE_URL' => contrexx_raw2xhtml($this->license->getUpgradeUrl()), 'LICENSE_PARTNER_TITLE' => contrexx_raw2xhtml($this->license->getPartner()->getTitle()), 'LICENSE_PARTNER_LASTNAME' => contrexx_raw2xhtml($this->license->getPartner()->getLastname()), 'LICENSE_PARTNER_FIRSTNAME' => contrexx_raw2xhtml($this->license->getPartner()->getFirstname()), 'LICENSE_PARTNER_COMPANY' => contrexx_raw2xhtml($this->license->getPartner()->getCompanyName()), 'LICENSE_PARTNER_ADDRESS' => contrexx_raw2xhtml($this->license->getPartner()->getAddress()), 'LICENSE_PARTNER_ZIP' => contrexx_raw2xhtml($this->license->getPartner()->getZip()), 'LICENSE_PARTNER_CITY' => contrexx_raw2xhtml($this->license->getPartner()->getCity()), 'LICENSE_PARTNER_COUNTRY' => contrexx_raw2xhtml($this->license->getPartner()->getCountry()), 'LICENSE_PARTNER_PHONE' => contrexx_raw2xhtml($this->license->getPartner()->getPhone()), 'LICENSE_PARTNER_URL' => contrexx_raw2xhtml($this->license->getPartner()->getUrl()), 'LICENSE_PARTNER_MAIL' => contrexx_raw2xhtml($this->license->getPartner()->getMail()), 'LICENSE_CUSTOMER_TITLE' => contrexx_raw2xhtml($this->license->getCustomer()->getTitle()), 'LICENSE_CUSTOMER_LASTNAME' => contrexx_raw2xhtml($this->license->getCustomer()->getLastname()), 'LICENSE_CUSTOMER_FIRSTNAME' => contrexx_raw2xhtml($this->license->getCustomer()->getFirstname()), 'LICENSE_CUSTOMER_COMPANY' => contrexx_raw2xhtml($this->license->getCustomer()->getCompanyName()), 'LICENSE_CUSTOMER_ADDRESS' => contrexx_raw2xhtml($this->license->getCustomer()->getAddress()), 'LICENSE_CUSTOMER_ZIP' => contrexx_raw2xhtml($this->license->getCustomer()->getZip()), 'LICENSE_CUSTOMER_CITY' => contrexx_raw2xhtml($this->license->getCustomer()->getCity()), 'LICENSE_CUSTOMER_COUNTRY' => contrexx_raw2xhtml($this->license->getCustomer()->getCountry()), 'LICENSE_CUSTOMER_PHONE' => contrexx_raw2xhtml($this->license->getCustomer()->getPhone()), 'LICENSE_CUSTOMER_URL' => contrexx_raw2xhtml($this->license->getCustomer()->getUrl()), 'LICENSE_CUSTOMER_MAIL' => contrexx_raw2xhtml($this->license->getCustomer()->getMail()), 'VERSION_NUMBER' => contrexx_raw2xhtml($this->license->getVersion()->getNumber()), 'VERSION_NUMBER_INT' => contrexx_raw2xhtml($this->license->getVersion()->getNumber(true)), 'VERSION_NAME' => contrexx_raw2xhtml($this->license->getVersion()->getName()), 'VERSION_CODENAME' => contrexx_raw2xhtml($this->license->getVersion()->getCodeName()), 'VERSION_STATE' => contrexx_raw2xhtml($this->license->getVersion()->getState()), 'VERSION_RELEASE_DATE' => contrexx_raw2xhtml($this->license->getVersion()->getReleaseDate()))); if ($template->blockExists('upgradable')) { if ($this->license->isUpgradable()) { $template->touchBlock('upgradable'); } else { $template->hideBlock('upgradable'); } } }
function Status() { require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Data.php"; require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/License.class.php"; $lic = new License(); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.leoferrarezi.com/muweb/version.php"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); curl_setopt($ch, CURLOPT_HEADER, 0); $lastVersion = trim(curl_exec($ch)); curl_close($ch); $version = explode(".", $lastVersion); $LastMainVersion = $version[0]; $LastSubVersion = $version[1]; $LastReviewVersion = $version[2]; $localVersion = "{$SystemMainVersion}.{$SystemSubVersion}.{$SystemReviewVersion}"; if ($lastVersion == $localVersion) { $upToDate = "ui-icon-check"; $title = "Great! Files up to date!"; $link = "javascript:;"; } else { $upToDate = "ui-icon-alert"; $title = "You should update your files! Current release is Version {$lastVersion}"; $link = "Update()"; } $return = "<p> </p>"; $return .= "\n\t\t<fieldset>\n\t\t\t<legend>System Information</legend>\n\t\t\t<table class=\"SystemInformationTable\">\n\t\t\t\t<tr>\n\t\t\t\t\t<th align=\"right\">Version:</th>\n\t\t\t\t\t<td><span style=\"float:left; margin-right:5px;\">{$localVersion}</span><span class=\"ui-widget ui-icon {$upToDate}\" title=\"{$title}\" style=\"cursor:help\" onclick=\"{$link}\"></span></td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</fieldset>\n\t\t<p> </p>\n\t\t"; $return .= "\n\t\t<fieldset>\n\t\t\t<legend>License Information</legend>\n\t\t\t<table class=\"SystemInformationTable\">\n\t\t\t\t<tr>\n\t\t\t\t\t<th align=\"right\">Licensed domain:</th>\n\t\t\t\t\t<td>" . $lic->GetLicensedServer() . "</td>\n\t\t\t\t</tr>\n\t\t\t\t"; switch ($lic->license['LicenseType']['value']) { case "1": $MyLicense = "STARTER"; break; case "2": $MyLicense = "PREMIUM"; break; case "3": $MyLicense = "FULL"; break; default: $MyLicense = "undefinded"; break; } $return .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<th align=\"right\">License type:</th>\n\t\t\t\t\t<td>{$MyLicense}</td>\n\t\t\t\t</tr>"; $return .= "\n\t\t\t</table>\n\t\t</fieldset>\n\t\t"; return $return; }
static function getUsage($id) { $_tbl_licenses = License::getTableName(); $_tbl_licensesUses = LicensesUses::getTableName(); $fields = array("{$_tbl_licensesUses}.*", "{$_tbl_licenses}.license_key"); $usage = DB::table($_tbl_licensesUses)->join($_tbl_licenses, "{$_tbl_licenses}.id", '=', "{$_tbl_licensesUses}.license_id")->select($fields)->where("{$_tbl_licensesUses}.id", '=', $id)->first(); return $usage; }
public function run() { // Initialize empty array $license = array(); $date = new DateTime(); $license[] = array('name' => 'Adobe Photoshop CS6', 'serial' => 'ZOMG-WtF-BBQ-SRSLY', 'purchase_date' => '2013-10-02', 'purchase_cost' => '2435.99', 'purchase_order' => '1', 'maintained' => '0', 'order_number' => '987698576946', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'seats' => 5, 'license_name' => '', 'license_email' => '', 'notes' => '', 'user_id' => 1, 'depreciation_id' => 2, 'deleted_at' => NULL, 'depreciate' => '0'); $license[] = array('name' => 'Git Tower', 'serial' => '98049890394-340485934', 'purchase_date' => '2013-10-02', 'purchase_cost' => '2435.99', 'purchase_order' => '1', 'maintained' => '1', 'order_number' => '987698576946', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'seats' => 2, 'license_name' => 'Alison Gianotto', 'license_email' => '*****@*****.**', 'notes' => '', 'user_id' => 1, 'depreciation_id' => 2, 'deleted_at' => NULL, 'depreciate' => '0'); // Delete all the old data DB::table('licenses')->truncate(); // Insert the new posts License::insert($license); }
/** * Run! */ public function run() { // don't run if license not active if (!$this->license->activated) { return; } // assume valid by default, in case of server errors on our side. $license_still_valid = true; try { $remote_license = $this->api->get_license(); $license_still_valid = $remote_license->valid; } catch (API_Exception $e) { // license key wasn't found or expired if (in_array($e->getApiCode(), array('license_invalid', 'license_expired'))) { $license_still_valid = false; } } if (!$license_still_valid) { $this->license->activated = false; $this->license->save(); } }
public function profile() { $neighbor_id = Auth::user()->id; $colonia = Session::get("colonia"); $urbanismUsers = Urbanism::where('colony_id', '=', $colonia)->first(); $neighbor = Neighbors::with('NeighborProperty')->where('user_id', '=', $neighbor_id)->first(); $role = AssigmentRole::where('user_id', '=', $neighbor_id)->where('colony_id', '=', $colonia)->first(); $neighbor_role = ucfirst($role->Role->name); $licencia = License::where('colony_id', '=', $colonia)->first(); $expiration_license = LicenseExpiration::where('colony_id', '=', $colonia)->first(); $photo_user = UserPhoto::where('user_id', '=', $neighbor_id)->where('colony_id', '=', $colonia)->pluck('filename'); return View::make('dashboard.neighbors.profile', ['neighbor' => $neighbor, 'colonia_nombre' => $urbanismUsers->Colony->name, 'urbanism' => $urbanismUsers->Colony->name, 'role' => $neighbor_role, 'licencia' => $licencia, 'photo_user' => $photo_user, 'expiration_license' => $expiration_license]); }
public function license_store() { $data = Input::all(); $colonia = Input::get('colony_id'); $code = Input::get('code'); $license_colonia = License::where('colony_id', '=', $colonia)->get(); $code_exist = 0; foreach ($license_colonia as $lic) { if ($code == Crypt::decrypt($lic->code)) { $code_exist = 1; $code_id = $lic->id; $lic_status = $lic->status; } } if ($code_exist == 1) { if ($lic_status == 0) { $license = License::where('id', '=', $code_id)->first(); $license->status = 1; if ($license->update(['id'])) { $expiration = Expiration::where('colony_id', '=', $colonia)->first(); $expiration->status = 2; $expiration->update(['id']); Session::put('days_expiration', 0); $expiration_lic = LicenseExpiration::where('colony_id', '=', $colonia)->first(); if ($expiration_lic->expiration == null) { $expiration_old = date('Y-m-j'); } else { $expiration_old = date('Y-m-j', strtotime($expiration_lic->expiration)); } $newExpiration = strtotime('+' . $license->months . ' month', strtotime($expiration_old)); $newExpiration = date('Y-m-j', $newExpiration); $expiration_lic->expiration = $newExpiration; $expiration_lic->update(['id']); $datetime2 = new DateTime($expiration_lic->expiration); $datetime1 = new DateTime(date('Y-m-d')); $interval = $datetime1->diff($datetime2); $days_expiration = $interval->format('%a'); Session::put('lic_fecha_expiration', $expiration_lic->expiration); Session::put('lic_expiration', $days_expiration); $notice_msg = 'Código de la licencia activado'; return Redirect::route('home')->with('notice_modal', $notice_msg); } } else { $error_msg = 'Este Código de licencia ya se fue utilizado'; return Redirect::back()->with('error_modal', $error_msg); } } else { $error_msg = 'Código de la licencia inválido'; return Redirect::back()->with('error_modal', $error_msg); } }
public function checkPermissionsWithLicense() { $users = License::moduleIsRestricted($this->id()); // GO::debug($users); if ($users === false) { return true; } $acl_id = GO::modules()->{$this->id()}->acl_id; $users = \GO\Base\Model\Acl::getAuthorizedUsers($acl_id); foreach ($users as $user) { if (!in_array($user->username, $users)) { return false; } } return true; }
function handler_admin($page) { $admin_groups = S::user()->castes(Rights::admin())->groups(); $admin_groups->diff($admin_groups->filter('ns', Group::NS_USER)); $page->assign('admin_groups', $admin_groups); $page->assign('validates', array()); if ($admin_groups->count() > 0) { $validate_filter = new ValidateFilter(new VFC_Group($admin_groups)); $validates = $validate_filter->get()->select(ValidateSelect::quick()); $validates = $validates->split('group'); $page->assign('validates', $validates); } $page->assign('licensesDisplay', License::hasRights(S::user())); $page->assign('title', "Administration"); $page->addCssLink('admin.css'); $page->changeTpl('admin/index.tpl'); }
/** * Seed the licenses * * @return void */ private function seedLicenses() { // Fetch the licenses from the json file $this->command->info('---- DCAT Licenses ----'); $this->command->info('Trying to fetch the licenses from a local json file.'); $licenses = json_decode(file_get_contents(app_path() . '/database/seeds/data/licenses.json')); if (!empty($licenses)) { $this->command->info('Licenses have been found, deleting the current ones, and replacing them with the new ones.'); // Empty the licenses table $this->command->info('Emptying the current licenses table.'); \License::truncate(); foreach ($licenses as $license) { \License::create(array('domain_content' => $license->domain_content, 'domain_data' => $license->domain_data, 'domain_software' => $license->domain_software, 'family' => $license->family, 'license_id' => $license->license_id, 'is_generic' => @$license->is_generic, 'is_okd_compliant' => $license->is_okd_compliant, 'is_osi_compliant' => $license->is_osi_compliant, 'maintainer' => $license->maintainer, 'status' => $license->status, 'title' => $license->title, 'url' => $license->url)); } $this->command->info('Added the licenses from a local json file.'); } else { $this->command->info('The licenses from the json file were empty, the old ones will not be replaced.'); } }
public function send_cupon($id) { $license = License::where('id', '=', $id)->first(); $user_id = AssigmentRoleHab::where('role_id', '=', 2)->where('colony_id', '=', $license->colony_id)->pluck('user_id'); $admin_user = DB::connection('habitaria_dev')->select('select email from users where id = ? ', [$user_id]); foreach ($admin_user as $user) { $admin_email = $user->email; } $admin_neighbor = Neighbors::where('user_id', '=', $user_id)->first(); $colony_data = Colony::where('id', '=', $license->colony_id)->first(); $colony_name = $colony_data->name; $data = array('email' => $admin_email, 'months' => $license->months, 'code' => Crypt::decrypt($license->code), 'colony' => $colony_name, 'admin' => $admin_neighbor->name . ' ' . $admin_neighbor->last_name); Mail::send('emails.cupon_license', $data, function ($message) use($admin_email) { $message->subject('Licencia para HABITARIA'); $message->to($admin_email); }); $notice_msg = 'Licencia enviada al administrador de la Colonia: ' . $colony_name; return Redirect::back()->with('error', false)->with('msg', $notice_msg)->with('class', 'info'); }
public static function ValidateLicense($licenseparams) { if (empty($licenseparams['key'])) { $response = array('error_code' => '2', 'status' => 'failed', 'description' => 'No License Key Entered'); } if (empty($licenseparams['deviceid'])) { $response = array('error_code' => '2', 'status' => 'failed', 'description' => 'Device ID is empty'); } $response = array(); $db = Utility::mysqlRes(); $license = $db->license()->where("licensekey", $licenseparams['key'])->where("used", 0); if ($license->count()) { if (License::ApplyLicense($licenseparams)) { $response = array('error_code' => '0', 'status' => 'success', 'description' => 'Product Activated'); } } else { $response = array('error_code' => '1', 'status' => 'failed', 'description' => 'Invalid or Used License Key'); } return $response; }
public function activate() { $inputs = Input::all(); //dd($inputs); if (Input::has('license') && Input::has('domain')) { //verify new licenses $license = License::available($inputs['license'])->first(); if ($license) { $license->activate($inputs['domain']); return Response::json(["status" => 'active', "condition" => 'new']); } else { //verify used licenses $license = License::where('domain', $inputs['domain'])->first(); if ($license) { if ($license->license == $inputs['license']) { return Response::json(["status" => 'active', "condition" => 'reactivated']); } } } } return Response::json(["status" => 'invalid']); }
public function getAcceptAsset($logID = null) { if (is_null($findlog = Actionlog::find($logID))) { // Redirect to the asset management page return Redirect::to('account')->with('error', Lang::get('admin/hardware/message.does_not_exist')); } // Asset if ($findlog->asset_id != '' && $findlog->asset_type == 'hardware') { $item = Asset::find($findlog->asset_id); // software } elseif ($findlog->asset_id != '' && $findlog->asset_type == 'software') { $item = License::find($findlog->asset_id); // accessories } elseif ($findlog->accessory_id != '') { $item = Accessory::find($findlog->accessory_id); } // Check if the asset exists if (is_null($item)) { // Redirect to the asset management page return Redirect::to('account')->with('error', Lang::get('admin/hardware/message.does_not_exist')); } return View::make('frontend/account/accept-asset', compact('item'))->with('findlog', $findlog); }
public static function run($p = null, $root = null, $routes = true, $session = true, $whoops = true) { ob_start(); // self::$page = $p; self::$root = $root; // //session require __DIR__ . '/../core/Storage/Session.php'; if ($session) { Session::start(__DIR__ . '/../app/storage/session'); } // require __DIR__ . '/../core/Access/ErrorHandler.php'; // Config require __DIR__ . '/../core/Config/Config.php'; require __DIR__ . '/../core/Config/Exceptions/ConfigException.php'; //Maintenance require __DIR__ . '/../core/Maintenance/Maintenance.php'; //Objects require __DIR__ . '/../core/Objects/Vars.php'; require __DIR__ . '/../core/Objects/String/String.php'; require __DIR__ . '/../core/Objects/String/Exceptions/StringOutIndexException.php'; // Access require __DIR__ . '/../core/Access/Path.php'; // Set the error log ini_set("log_errors", 1); ini_set("error_log", __DIR__ . '/../app/storage/logs/fiesta.log'); // Set Whoops error handler if ($whoops) { ErrorHandler::ini(self::$root); } // //require __DIR__.'/../core/MVC/Templete.php'; require __DIR__ . '/../core/Objects/Exception.php'; require __DIR__ . '/../core/Faker.php'; require __DIR__ . '/../core/Storage/Cookie.php'; //routes // old //require __DIR__.'/../core/Access/Routes_2.php'; // new require __DIR__ . '/../core/Router/Routes.php'; require __DIR__ . '/../core/Router/Route.php'; require __DIR__ . '/../core/Router/Exceptions/RouteNotFoundException.php'; // Caches require __DIR__ . '/../core/Caches/Caches.php'; require __DIR__ . '/../core/Caches/Cache.php'; require __DIR__ . '/../core/Caches/FileCache.php'; require __DIR__ . '/../core/Caches/DatabaseCache.php'; require __DIR__ . '/../core/Caches/Exceptions/DriverNotFoundException.php'; require __DIR__ . '/../core/Storage/Storage.php'; require __DIR__ . '/../core/Security/Auth.php'; require __DIR__ . '/../core/Objects/Table.php'; // Database require __DIR__ . '/../core/Database/Schema.php'; require __DIR__ . '/../core/Database/Migration.php'; require __DIR__ . '/../core/Database/Seeder.php'; require __DIR__ . '/../core/Database/Database.php'; require __DIR__ . '/../core/Database/Drivers/MySql.php'; require __DIR__ . '/../core/Database/Exceptions/DatabaseArgumentsException.php'; require __DIR__ . '/../core/Database/Exceptions/DatabaseConnectionException.php'; require __DIR__ . '/../core/Access/Url.php'; require __DIR__ . '/../core/Hypertext/Pages.php'; require __DIR__ . '/../core/Objects/DateTime.php'; require __DIR__ . '/../core/Objects/Sys.php'; require __DIR__ . '/../core/Http/Links.php'; require __DIR__ . '/../core/Objects/Base.php'; require __DIR__ . '/../core/Libs.php'; require __DIR__ . '/../core/Hypertext/Res.php'; require __DIR__ . '/../core/Hypertext/Input.php'; require __DIR__ . '/../core/License.php'; require __DIR__ . '/../core/Hypertext/Cookie.php'; //Languages require __DIR__ . '/../core/Lang/Lang.php'; require __DIR__ . '/../core/Lang/Exceptions/LanguageKeyNotFoundException.php'; // MVC - model require __DIR__ . '/../core/MVC/Model/Model.php'; require __DIR__ . '/../core/MVC/Model/ModelArray.php'; require __DIR__ . '/../core/MVC/Model/Exceptions/ForeingKeyMethodException.php'; require __DIR__ . '/../core/MVC/Model/Exceptions/ColumnNotEmptyException.php'; require __DIR__ . '/../core/MVC/Model/Exceptions/ManyPrimaryKeysException.php'; require __DIR__ . '/../core/MVC/Model/Exceptions/PrimaryKeyNotFoundException.php'; // MVC - View require __DIR__ . '/../core/MVC/View/View.php'; require __DIR__ . '/../core/MVC/View/Libs/Template.php'; require __DIR__ . '/../core/MVC/View/Libs/Views.php'; require __DIR__ . '/../core/MVC/View/Exceptions/ViewNotFoundException.php'; require __DIR__ . '/../core/Hypertext/HTML.php'; require __DIR__ . '/../core/Security/Encrypt.php'; require __DIR__ . '/../core/Security.php'; //require __DIR__.'/../core/MVC/Model.php'; // require __DIR__.'/../core/MVC/View.php'; require __DIR__ . '/../core/MVC/Controller.php'; require __DIR__ . '/../core/Http/Error.php'; require __DIR__ . '/../core/Hypertext/Script.php'; require __DIR__ . '/../core/Http/Root.php'; require __DIR__ . '/../core/Mail_2.php'; require __DIR__ . '/../core/Objects/DataCollection.php'; require __DIR__ . '/../core/Debug.php'; // Filesystem require __DIR__ . '/../core/Filesystem/Exceptions/FileNotFoundException.php'; require __DIR__ . '/../core/Filesystem/Exceptions/DirectoryNotFoundException.php'; require __DIR__ . '/../core/Filesystem/Filesystem.php'; // Database files require __DIR__ . '/../core/Database/DBTable.php'; Sys::ini(); Url::ini(); Path::ini(); Fiesta\MVC\View\Template::ini(self::$root); // Faker::ini(); Links::ini(); Errors::ini($root); License::ini(self::$page); Lang::ini(); Database::ini(); Auth::ini(); // if ($root != null) { // include models foreach (glob($root . "../app/models/*.php") as $file) { include_once $file; } //include the controllers files foreach (glob($root . "../app/controllers/*.php") as $file) { include_once $file; } //include the link files foreach (glob($root . "../app/paths/*.php") as $file) { include_once $file; } //include the seeders files foreach (glob($root . "../app/seeds/*.php") as $file) { include_once $file; } // //include filters include_once $root . "../app/http/Filters.php"; //include for routes if ($routes) { include_once $root . "../app/http/Routes.php"; Fiesta\Router\Routes::run(); } } else { // include models foreach (glob("../app/models/*.php") as $file) { include_once $file; } //include the controllers files foreach (glob("../app/controllers/*.php") as $file) { include_once $file; } //include the seeders files foreach (glob("../app/seeds/*.php") as $file) { include_once $file; } //include filters include_once "../app/http/Filters.php"; //include for routes if ($routes) { include_once "../app/http/Routes.php"; Fiesta\Router\Routes::run(); } } }
/** * constructor */ public function __construct($id = null, $searchtype = 'song') { $this->searchtype = $searchtype; if ($id) { $info = $this->get_info($id); foreach ($info as $key => $value) { $this->{$key} = $value; } $this->rules = unserialize($this->rules); } // Define our basetypes $this->basetypes['numeric'][] = array('name' => 'gte', 'description' => T_('is greater than or equal to'), 'sql' => '>='); $this->basetypes['numeric'][] = array('name' => 'lte', 'description' => T_('is less than or equal to'), 'sql' => '<='); $this->basetypes['numeric'][] = array('name' => 'equal', 'description' => T_('is'), 'sql' => '<=>'); $this->basetypes['numeric'][] = array('name' => 'ne', 'description' => T_('is not'), 'sql' => '<>'); $this->basetypes['numeric'][] = array('name' => 'gt', 'description' => T_('is greater than'), 'sql' => '>'); $this->basetypes['numeric'][] = array('name' => 'lt', 'description' => T_('is less than'), 'sql' => '<'); $this->basetypes['boolean'][] = array('name' => 'true', 'description' => T_('is true')); $this->basetypes['boolean'][] = array('name' => 'false', 'description' => T_('is false')); $this->basetypes['text'][] = array('name' => 'contain', 'description' => T_('contains'), 'sql' => 'LIKE', 'preg_match' => array('/^/', '/$/'), 'preg_replace' => array('%', '%')); $this->basetypes['text'][] = array('name' => 'notcontain', 'description' => T_('does not contain'), 'sql' => 'NOT LIKE', 'preg_match' => array('/^/', '/$/'), 'preg_replace' => array('%', '%')); $this->basetypes['text'][] = array('name' => 'start', 'description' => T_('starts with'), 'sql' => 'LIKE', 'preg_match' => '/$/', 'preg_replace' => '%'); $this->basetypes['text'][] = array('name' => 'end', 'description' => T_('ends with'), 'sql' => 'LIKE', 'preg_match' => '/^/', 'preg_replace' => '%'); $this->basetypes['text'][] = array('name' => 'equal', 'description' => T_('is'), 'sql' => '='); $this->basetypes['text'][] = array('name' => 'sounds', 'description' => T_('sounds like'), 'sql' => 'SOUNDS LIKE'); $this->basetypes['text'][] = array('name' => 'notsounds', 'description' => T_('does not sound like'), 'sql' => 'NOT SOUNDS LIKE'); $this->basetypes['boolean_numeric'][] = array('name' => 'equal', 'description' => T_('is'), 'sql' => '<=>'); $this->basetypes['boolean_numeric'][] = array('name' => 'ne', 'description' => T_('is not'), 'sql' => '<>'); $this->basetypes['boolean_subsearch'][] = array('name' => 'equal', 'description' => T_('is'), 'sql' => ''); $this->basetypes['boolean_subsearch'][] = array('name' => 'ne', 'description' => T_('is not'), 'sql' => 'NOT'); $this->basetypes['date'][] = array('name' => 'lt', 'description' => T_('before'), 'sql' => '<'); $this->basetypes['date'][] = array('name' => 'gt', 'description' => T_('after'), 'sql' => '>'); $this->basetypes['multiple'] = array_merge($this->basetypes['text'], $this->basetypes['numeric']); switch ($searchtype) { case 'song': $this->types[] = array('name' => 'anywhere', 'label' => T_('Any searchable text'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'title', 'label' => T_('Title'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'album', 'label' => T_('Album'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'artist', 'label' => T_('Artist'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'composer', 'label' => T_('Composer'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'comment', 'label' => T_('Comment'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'label', 'label' => T_('Label'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'tag', 'label' => T_('Tag'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'album_tag', 'label' => T_('Album tag'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'file', 'label' => T_('Filename'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'year', 'label' => T_('Year'), 'type' => 'numeric', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'time', 'label' => T_('Length (in minutes)'), 'type' => 'numeric', 'widget' => array('input', 'text')); if (AmpConfig::get('ratings')) { $this->types[] = array('name' => 'rating', 'label' => T_('Rating'), 'type' => 'numeric', 'widget' => array('select', array('1 Star', '2 Stars', '3 Stars', '4 Stars', '5 Stars'))); } if (AmpConfig::get('show_played_times')) { $this->types[] = array('name' => 'played_times', 'label' => T_('# Played'), 'type' => 'numeric', 'widget' => array('input', 'text')); } $this->types[] = array('name' => 'bitrate', 'label' => T_('Bitrate'), 'type' => 'numeric', 'widget' => array('select', array('32', '40', '48', '56', '64', '80', '96', '112', '128', '160', '192', '224', '256', '320'))); $this->types[] = array('name' => 'played', 'label' => T_('Played'), 'type' => 'boolean', 'widget' => array('input', 'hidden')); $this->types[] = array('name' => 'added', 'label' => T_('Added'), 'type' => 'date', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'updated', 'label' => T_('Updated'), 'type' => 'date', 'widget' => array('input', 'text')); $catalogs = array(); foreach (Catalog::get_catalogs() as $catid) { $catalog = Catalog::create_from_id($catid); $catalog->format(); $catalogs[$catid] = $catalog->f_name; } $this->types[] = array('name' => 'catalog', 'label' => T_('Catalog'), 'type' => 'boolean_numeric', 'widget' => array('select', $catalogs)); $playlists = array(); foreach (Playlist::get_playlists() as $playlistid) { $playlist = new Playlist($playlistid); $playlist->format(); $playlists[$playlistid] = $playlist->f_name; } $this->types[] = array('name' => 'playlist', 'label' => T_('Playlist'), 'type' => 'boolean_numeric', 'widget' => array('select', $playlists)); $this->types[] = array('name' => 'playlist_name', 'label' => T_('Playlist Name'), 'type' => 'text', 'widget' => array('input', 'text')); $playlists = array(); foreach (Search::get_searches() as $playlistid) { // Slightly different from the above so we don't instigate // a vicious loop. $playlists[$playlistid] = Search::get_name_byid($playlistid); } $this->types[] = array('name' => 'smartplaylist', 'label' => T_('Smart Playlist'), 'type' => 'boolean_subsearch', 'widget' => array('select', $playlists)); $metadataFields = array(); $metadataFieldRepository = new \Lib\Metadata\Repository\MetadataField(); foreach ($metadataFieldRepository->findAll() as $metadata) { $metadataFields[$metadata->getId()] = $metadata->getName(); } $this->types[] = array('name' => 'metadata', 'label' => T_('Metadata'), 'type' => 'multiple', 'subtypes' => $metadataFields, 'widget' => array('subtypes', array('input', 'text'))); $licenses = array(); foreach (License::get_licenses() as $license_id) { $license = new License($license_id); $licenses[$license_id] = $license->name; } if (AmpConfig::get('licensing')) { $this->types[] = array('name' => 'license', 'label' => T_('Music License'), 'type' => 'boolean_numeric', 'widget' => array('select', $licenses)); } break; case 'album': $this->types[] = array('name' => 'title', 'label' => T_('Title'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'artist', 'label' => T_('Artist'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'year', 'label' => T_('Year'), 'type' => 'numeric', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'image width', 'label' => T_('Image Width'), 'type' => 'numeric', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'image height', 'label' => T_('Image Height'), 'type' => 'numeric', 'widget' => array('input', 'text')); if (AmpConfig::get('ratings')) { $this->types[] = array('name' => 'rating', 'label' => T_('Rating'), 'type' => 'numeric', 'widget' => array('select', array('1 Star', '2 Stars', '3 Stars', '4 Stars', '5 Stars'))); } $catalogs = array(); foreach (Catalog::get_catalogs() as $catid) { $catalog = Catalog::create_from_id($catid); $catalog->format(); $catalogs[$catid] = $catalog->f_name; } $this->types[] = array('name' => 'catalog', 'label' => T_('Catalog'), 'type' => 'boolean_numeric', 'widget' => array('select', $catalogs)); $this->types[] = array('name' => 'tag', 'label' => T_('Tag'), 'type' => 'text', 'widget' => array('input', 'text')); break; case 'video': $this->types[] = array('name' => 'filename', 'label' => T_('Filename'), 'type' => 'text', 'widget' => array('input', 'text')); break; case 'artist': $this->types[] = array('name' => 'name', 'label' => T_('Name'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'yearformed', 'label' => T_('Year'), 'type' => 'numeric', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'placeformed', 'label' => T_('Place'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'tag', 'label' => T_('Tag'), 'type' => 'text', 'widget' => array('input', 'text')); break; case 'playlist': $this->types[] = array('name' => 'name', 'label' => T_('Name'), 'type' => 'text', 'widget' => array('input', 'text')); break; case 'label': $this->types[] = array('name' => 'name', 'label' => T_('Name'), 'type' => 'text', 'widget' => array('input', 'text')); $this->types[] = array('name' => 'category', 'label' => T_('Category'), 'type' => 'text', 'widget' => array('input', 'text')); break; case 'user': $this->types[] = array('name' => 'username', 'label' => T_('Username'), 'type' => 'text', 'widget' => array('input', 'text')); break; } // end switch on searchtype }
public function testUrl() { assertThat($this->license->getUrl(), is($this->url)); }
public function OnPaid(Invoice $Invoice, AbstractPaymentModule $payment_module = null) { $db = Core::GetDBInstance(); if (!in_array($Invoice->Purpose, $this->HandledPurposes)) { return; } Log::Log("RegistryInvoiceObserver::OnPaid(InvoiceID={$Invoice->ID})", E_USER_NOTICE); // Get domain information try { $Domain = DBDomain::GetInstance()->Load($Invoice->ItemID); } catch (Exception $e) { Log::Log("RegistryInvoiceObserver::OnPaid() thown exception: {$e->getMessage()}", E_USER_ERROR); } if ($Domain) { Log::Log("Invoice purpose: {$Invoice->Purpose}", E_USER_NOTICE); // Get user information $userinfo = $db->GetRow("SELECT * FROM users WHERE id=?", array($Domain->UserID)); // Check command switch ($Invoice->Purpose) { case INVOICE_PURPOSE::DOMAIN_TRADE: try { $Action = new UpdateDomainContactAction($Invoice); try { $Action->Run(); } catch (UpdateDomainContactAction_Exception $e) { Log::Log(sprintf("Trade failed. %s", $e->getMessage()), E_ERROR); DBDomain::GetInstance()->Save($Action->GetDomain()); // Send mail $args = array("client" => $userinfo, "Invoice" => $Invoice, "domain_name" => $Domain->Name, "extension" => $Domain->Extension, "domain_trade_failure_reason" => $e->getMessage()); mailer_send("domain_trade_action_required.eml", $args, $userinfo["email"], $userinfo["name"]); } } catch (LogicException $e2) { Log::Log($e2->getMessage(), E_ERROR); } break; case INVOICE_PURPOSE::DOMAIN_CREATE: if ($Domain->Status == DOMAIN_STATUS::AWAITING_PAYMENT || $Domain->Status == DOMAIN_STATUS::REJECTED) { $Domain->Status = DOMAIN_STATUS::PENDING; $Domain->IncompleteOrderOperation = INCOMPLETE_OPERATION::DOMAIN_CREATE; $Domain = DBDomain::GetInstance()->Save($Domain); // If domain has incomplete information skip domain creation. Update status to Pending. if (count($Domain->GetContactList()) == 0 || count($Domain->GetNameserverList()) == 0) { // // Send mail // Log::Log("Domain registration process not completed. Need more information from client.", E_USER_NOTICE); $args = array("client" => $userinfo, "Invoice" => $Invoice, "domain_name" => $Domain->Name, "extension" => $Domain->Extension); mailer_send("domain_registration_action_required.eml", $args, $userinfo["email"], $userinfo["name"]); // Write information in invoice $Invoice->ActionStatus = INVOICE_ACTION_STATUS::FAILED; $Invoice->ActionFailReason = _('Domain registration process not completed. Need more information from client.'); } else { Log::Log("Trying to register domain", E_USER_NOTICE); ///// get Registry instance and connect to registry server try { $Registry = RegistryModuleFactory::GetInstance()->GetRegistryByExtension($Domain->Extension); } catch (Exception $e) { Log::Log($e->getMessage(), E_ERROR); return; } // Validate license for this module if (!License::IsModuleLicensed($Registry->GetModuleName())) { throw new LicensingException("Your license does not permit module {$Registry->ModuleName()}"); } // $extra_data = $db->GetAll("SELECT * FROM domains_data WHERE domainid=?", array($Domain->ID)); if ($extra_data && count($extra_data) > 0) { foreach ($extra_data as $v) { $extra[$v["key"]] = $v["value"]; } } else { $extra = array(); } // Try to create domain name try { $cr = $Registry->CreateDomain($Domain, $Domain->Period, $extra); } catch (Exception $e) { $args = array("client" => $userinfo, "Invoice" => $Invoice, "domain_name" => $Domain->Name, "extension" => $Domain->Extension, "domain_reg_failure_reason" => $e->getMessage()); mailer_send("domain_registration_action_required.eml", $args, $userinfo["email"], $userinfo["name"]); // If domain not created Log::Log("Cannot register domain name. Server return: " . $e->getMessage(), E_ERROR); $Invoice->ActionStatus = INVOICE_ACTION_STATUS::FAILED; $Invoice->ActionFailReason = $e->getMessage(); } if ($cr) { // If domain created Log::Log(sprintf("Domain %s successfully registered. Updating database", $Domain->GetHostName()), E_USER_NOTICE); $Invoice->ActionStatus = INVOICE_ACTION_STATUS::COMPLETE; } } } else { Log::Log("Domain status '{$Domain->Status}'. Expected 'Awaiting payment'", E_ERROR); $retval = false; $Invoice->ActionStatus = INVOICE_ACTION_STATUS::FAILED; $Invoice->ActionFailReason = sprintf(_("Domain status '%s'. Expected 'Awaiting payment'"), $Domain->Status); } break; case INVOICE_PURPOSE::DOMAIN_TRANSFER: if ($Domain->Status == DOMAIN_STATUS::AWAITING_PAYMENT) { // // Send mail // $args = array("client" => $userinfo, "domain_name" => $Domain->Name, "extension" => $Domain->Extension, "Invoice" => $Invoice); mailer_send("domain_transfer_action_required.eml", $args, $userinfo["email"], $userinfo["name"]); Log::Log("Domain transfer process not completed. Need more information from client.", E_USER_NOTICE); $Domain->IncompleteOrderOperation = INCOMPLETE_OPERATION::DOMAIN_TRANSFER; $Domain->Status = DOMAIN_STATUS::PENDING; DBDomain::GetInstance()->Save($Domain); $Invoice->ActionStatus = INVOICE_ACTION_STATUS::COMPLETE; } break; case INVOICE_PURPOSE::DOMAIN_RENEW: // Renew domain name Log::Log("Trying to renew domain", E_USER_NOTICE); ///// Get registry instance and connect to registry server try { $Registry = RegistryModuleFactory::GetInstance()->GetRegistryByExtension($Domain->Extension); } catch (Exception $e) { Log::Log($e->getMessage(), E_ERROR); return; } try { $renew = $Registry->RenewDomain($Domain, array('period' => $Domain->Period)); } catch (Exception $e) { $renew = false; $err = $e->getMessage(); } if ($renew) { Log::Log("Domain successfully renewed.", E_USER_NOTICE); $Invoice->ActionStatus = INVOICE_ACTION_STATUS::COMPLETE; $Domain->DeleteStatus = DOMAIN_DELETE_STATUS::NOT_SET; DBDomain::GetInstance()->Save($Domain); } else { $Domain->SetExtraField('RenewInvoiceID', $Invoice->ID); DBDomain::GetInstance()->Save($Domain); // // Send mail here // $args = array("client" => $userinfo, "domain_name" => $Domain->Name, "extension" => $Domain->Extension, "reason" => $err, "years" => $Domain->Period); mailer_send("renewal_failed.eml", $args, $userinfo["email"], $userinfo["name"]); // If renew failed Log::Log("Cannot renew domain name. Server return: " . $err, E_ERROR); $Invoice->ActionStatus = INVOICE_ACTION_STATUS::FAILED; $Invoice->ActionFailReason = $err; } ///// break; } $Invoice->Save(); } else { // Domain not found Log::Log(sprintf("Domain width ID '%s' not found.", $Invoice->ItemID), E_ERROR); } // OnPaymentComplete routine succeffully completed. Log::Log("RegistryInvoiceObserver::OnPaid Successfully completed.", E_USER_NOTICE); }
public function claim_license() { $license = License::where('license_key', '=', Input::get('license_key'))->where('is_claimed', '=', false)->first(); if ($license) { if ($license->transaction_reference != 'TEST_MODE') { $license->is_claimed = true; $license->save(); } return 'valid'; } else { return 'invalid'; } }
if (isset($_POST['license_id'])) { $license = new License($_POST['license_id']); if ($license->id) { $license->update($_POST); } $text = T_('License Updated'); } else { License::create($_POST); $text = T_('License Created'); } show_confirmation($text, '', AmpConfig::get('web_path') . '/admin/license.php'); break; case 'show_edit': $license = new License($_REQUEST['license_id']); case 'show_create': require_once AmpConfig::get('prefix') . '/templates/show_edit_license.inc.php'; break; case 'delete': License::delete($_REQUEST['license_id']); show_confirmation(T_('License Deleted'), '', AmpConfig::get('web_path') . '/admin/license.php'); break; default: $browse = new Browse(); $browse->set_type('license'); $browse->set_simple_browse(true); $license_ids = $browse->get_objects(); $browse->show_objects($license_ids); $browse->store(); break; } UI::show_footer();
/** * @access public * @param string $TLD TLD part, without dot * @param bool $extended If true, return all TLD's exports by module * @return Registry */ public function GetRegistryByExtension($extension, $db_check = true, $ignore_cache = false) { $db = Core::GetDBInstance(); $extensions = $this->GetExtensionList($db_check); if (in_array($extension, $extensions)) { $this->ListModules(); $module_name = $this->Modules[$extension]; if (!$module_name) { throw new Exception(sprintf(_("Module not defined for %s domain extension."), $extension)); } // Validate license for this module if (!License::IsModuleLicensed($module_name)) { switch (CONTEXTS::$APPCONTEXT) { case APPCONTEXT::CRONJOB: case APPCONTEXT::REGISTRAR_CP: $message = "Your license does not permit module {$module_name}. For additional module purchases, please contact sales@webta.net"; break; case APPCONTEXT::REGISTRANT_CP: $message = sprintf(_("Application license does not permit module %s. Please contact %s"), $module_name, UI::GetSupportEmailLink()); break; case APPCONTEXT::ORDERWIZARD: $message = "Your license does not permit module {$module_name}. For additional module purchases, please contact sales@webta.net"; break; } // Validate license for this module if (!License::IsModuleLicensed($module_name)) { throw new LicensingException($message); } } $Manifest = new RegistryManifest("{$this->ModulesPath}/{$module_name}/module.xml"); $module_codebase = $Manifest->GetModuleCodebase(); if (!$module_codebase) { $module_codebase = $module_name; } $this->LoadRegistryModule($module_codebase); if (!$this->ModulesCache[$extension] || $ignore_cache) { $reflect = new ReflectionClass("{$module_codebase}RegistryModule"); $Module = $reflect->newInstance($Manifest); $Config = $this->LoadModuleConfig($Module->GetConfigurationForm(), $module_name); $Module->InitializeModule($extension, $Config); $this->ModulesCache[$extension] = $Module; } } else { throw new Exception(sprintf(_("No modules configured to handle extension '%s'"), $extension)); } return new Registry($this->ModulesCache[$extension]); }
/** * Set the license * * @param License $license */ public function set_license($license) { $this->license = $license; $this->license->store(); }
<form action="./common/controller.php" method="post" style="padding-left: 10px;"> <input type="hidden" name="action" value="saveLicense"/> <input type="hidden" name="host" value="<?php echo $_SERVER['SERVER_NAME']; ?> "/> Serial key<br/> <input type="text" name="serial" id="serial" style="width: 300px;"/> <p/> <input type="image" src="./assets/images/save.gif" style="vertical-align: middle;" value="Save"/> </form> </div> <?php } else { $l = new License(); $l->load($rawLicense); ?> Ok, you have a license. <br/> Host: <?php echo $l->host; ?> <br/> Serial: <?php echo $l->serial; ?> <?php } ?> </div>