本文整理汇总了PHP中License::save方法的典型用法代码示例。如果您正苦于以下问题:PHP License::save方法的具体用法?PHP License::save怎么用?PHP License::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类License
的用法示例。
在下文中一共展示了License::save方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create()
{
$data = Input::all();
$license = new License();
$license->months = Input::get('months');
$license->code = Crypt::encrypt(Input::get('code'));
$license->status = 0;
$license->colony_id = Input::get('colony_id');
if ($license->save()) {
$user_id = Input::get('admin_colonia');
$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::action('LicenseController@report_license', $license->colony_id)->with('error', false)->with('msg', $notice_msg)->with('class', 'info');
}
}
示例2: saveLicense
public function saveLicense(License $license)
{
try {
$license->save();
} catch (Exception $e) {
throw new DaoException($e->getMessage(), $e->getCode(), $e);
}
}
示例3: store
/**
* Store a newly created resource in storage.
* POST /branch
*
* @return Response
*/
public function store()
{
$inputs = Input::all();
$inputs['license'] = "<<<LICENSER" . sha1(mt_rand(10000, 99999) . time() . $inputs['name']) . sha1($inputs['name'] . time() . mt_rand(10000, 99999)) . sha1($inputs['name'] . mt_rand(10000, 99999) . time()) . sha1($inputs['name'] . time() . uniqid()) . sha1(uniqid() . $inputs['name'] . time()) . "LICENSER>>>";
$inputs['user_id'] = Auth::user()->id;
$license = new License($inputs);
if ($license->save()) {
return Redirect::to('/licenses')->with('alert', ['type' => 'success', 'message' => 'La licencia ha sido generada con exito.']);
}
return Redirect::to('/licenses')->with('alert', ['type' => 'danger', 'message' => 'Ocurrio un error, intenta mas tarde.']);
}
示例4: run
/**
* 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();
}
}
示例5: do_license_payment
public function do_license_payment()
{
$testMode = Session::get('test_mode') === 'true';
$rules = array('first_name' => 'required', 'last_name' => 'required', 'card_number' => 'required', 'expiration_month' => 'required', 'expiration_year' => 'required', 'cvv' => 'required', 'address1' => 'required', 'city' => 'required', 'state' => 'required', 'postal_code' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('license')->withErrors($validator);
}
$account = $this->accountRepo->getNinjaAccount();
$account->load('account_gateways.gateway');
$accountGateway = $account->account_gateways[0];
try {
if ($testMode) {
$ref = 'TEST_MODE';
} else {
$gateway = self::createGateway($accountGateway);
$details = self::getLicensePaymentDetails(Input::all());
$response = $gateway->purchase($details)->send();
$ref = $response->getTransactionReference();
if (!$ref) {
Session::flash('error', $response->getMessage());
return Redirect::to('license')->withInput();
}
if (!$response->isSuccessful()) {
Session::flash('error', $response->getMessage());
Utils::logError($response->getMessage());
return Redirect::to('license')->withInput();
}
}
$licenseKey = Utils::generateLicense();
$license = new License();
$license->first_name = Input::get('first_name');
$license->last_name = Input::get('last_name');
$license->email = Input::get('email');
$license->transaction_reference = $ref;
$license->license_key = $licenseKey;
$license->affiliate_id = Session::get('affiliate_id');
$license->save();
$affiliate = Affiliate::find(Session::get('affiliate_id'));
$data = ['message' => $affiliate->payment_subtitle, 'license' => $licenseKey, 'hideHeader' => true];
return View::make('public.license', $data);
//return Redirect::away(Session::get('return_url') . "?license_key={$license->license_key}");
} catch (\Exception $e) {
$errorMessage = trans('texts.payment_error');
Session::flash('error', $errorMessage);
Utils::logError($e->getMessage());
return Redirect::to('license')->withInput();
}
}
示例6: License
function update_license($nations) {
$comic_id = $this->id;
log_message('error', 'updatecomic');
$licenses = new License();
$licenses->where('comic_id', $comic_id)->get();
$removeme = array();
foreach ($licenses->all as $key => $license) {
$removeme[$key] = $license->nation;
}
$temp_nations = $nations;
foreach ($nations as $key => $nation) {
$found = false;
foreach ($licenses->all as $subkey => $license) {
if ($nation == $license->nation) {
unset($removeme[$subkey]);
$found = true;
}
}
if (!$found && $nation != "") {
$new_license = new License();
$new_license->comic_id = $comic_id;
$new_license->nation = $nation;
$new_license->save();
}
}
foreach ($removeme as $key => $nation) {
$remove = new License();
$remove->where('comic_id', $comic_id)->where('nation', $nation)->get()->remove();
}
}
示例7: catch
} catch (Exception $e) {
echo $e->getMessage();
}
break;
//updates license status when a new one is selected in dropdown box
//updates license status when a new one is selected in dropdown box
case 'updateStatus':
$licenseID = $_GET['licenseID'];
$statusID = $_GET['statusID'];
$statusDate = date('Y-m-d H:i:s');
//update license
$license = new License(new NamedArguments(array('primaryKey' => $_GET['licenseID'])));
$license->statusID = $statusID;
$license->statusDate = $statusDate;
try {
$license->save();
echo "Status has been updated";
} catch (Exception $e) {
echo $e->getMessage();
}
break;
//used for autocomplete of signer name
//used for autocomplete of signer name
case 'getSigners':
if (isset($_GET['searchMode'])) {
$searchMode = $_GET['searchMode'];
} else {
$searchMode = '';
}
if (isset($_GET['limit'])) {
$limit = $_GET['limit'];
示例8: trim
if ((string) $licenseText['id'] !== "") {
$textArray[(string) $licenseText['id']] = "<p>" . preg_replace('~\\R~u', "<br/>", (string) $licenseText->Text) . "</p>";
}
}
//Save License Agreement to documents directory, create license, attachment, and attachmentFile records and get IDs
$filename = trim($xml->LicenseDetail->Description);
print $xml->LicenseDetail->Description;
$licenseFile = fopen("documents/" . $filename . ".html", "wb") or die(_("Unable to create file for license."));
fwrite($licenseFile, "<html>\n<head>\n<meta charset='utf-8'/>\n</head>\n</body>");
fwrite($licenseFile, $licenseAgreement);
fwrite($licenseFile, "</body>\n</html>");
fclose($licenseFile);
$licenseObj = new License();
$licenseObj->shortName = $filename;
$licenseObj->setOrganization($_POST['organizationID'], $_POST['organizationName']);
$licenseObj->save();
$licenseID = $licenseObj->primaryKey;
$documentObj = new Document();
$documentObj->shortName = $filename;
$documentObj->documentTypeID = 3;
$documentObj->licenseID = $licenseID;
$documentObj->documentURL = $filename . ".html";
$documentObj->save();
$documentID = $documentObj->primaryKey;
if ($_POST['usageTerms'] === "on") {
foreach ($xml->UsageTerms->Usage as $usage) {
//get the expressionTypeID -- create expressionType if necessary
$expression = preg_replace('/^onixPL\\:/s', '', $usage->UsageType);
$index = searchForShortName($expression, $expressionTypeArray);
if ($index !== null) {
$expressionTypeID = $expressionTypeArray[$index]['expressionTypeID'];
示例9: postGenerateLicense
/**
* 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');
}
}
}
示例10: fire
//.........这里部分代码省略.........
}
$user_username = $email_prefix;
// Generate an email based on their name if no email address is given
if ($user_email == '') {
if ($first_name == 'Unknown') {
$status_id = 7;
}
$email = strtolower($email_prefix) . '@' . $this->option('domain');
$user_email = str_replace("'", '', $email);
}
}
$this->comment('Full Name: ' . $user_name);
$this->comment('First Name: ' . $first_name);
$this->comment('Last Name: ' . $last_name);
$this->comment('Username: ' . $user_username);
$this->comment('Email: ' . $user_email);
$this->comment('License Name: ' . $user_license_name);
$this->comment('Serial No: ' . $user_license_serial);
$this->comment('Licensed To Name: ' . $user_licensed_to_name);
$this->comment('Licensed To Email: ' . $user_licensed_to_email);
$this->comment('Seats: ' . $user_license_seats);
$this->comment('Reassignable: ' . $user_license_reassignable);
$this->comment('Supplier: ' . $user_license_supplier);
$this->comment('Maintained: ' . $user_license_maintained);
$this->comment('Notes: ' . $user_license_notes);
$this->comment('Purchase Date: ' . $user_license_purchase_date);
$this->comment('------------- Action Summary ----------------');
if ($user_username != '') {
if ($user = User::where('username', $user_username)->whereNotNull('username')->first()) {
$this->comment('User ' . $user_username . ' already exists');
} else {
// Create the user
$user = Sentry::createUser(array('first_name' => $first_name, 'last_name' => $last_name, 'email' => $user_email, 'username' => $user_username, 'password' => substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 10), 'activated' => true, 'permissions' => array('admin' => 0, 'user' => 1), 'notes' => 'User importerd through license importer'));
// Find the group using the group id
$userGroup = Sentry::findGroupById(3);
// Assign the group to the user
$user->addGroup($userGroup);
$this->comment('User ' . $first_name . ' created');
}
} else {
$user = new User();
$user->user_id = NULL;
}
// Check for the supplier match and create it if it doesn't exist
if ($supplier = Supplier::where('name', $user_license_supplier)->first()) {
$this->comment('Supplier ' . $user_license_supplier . ' already exists');
} else {
$supplier = new Supplier();
$supplier->name = e($user_license_supplier);
$supplier->user_id = 1;
if ($supplier->save()) {
$this->comment('Supplier ' . $user_license_supplier . ' was created');
} else {
$this->comment('Something went wrong! Supplier ' . $user_license_supplier . ' was NOT created');
}
}
// Add the license
$license = new License();
$license->name = e($user_license_name);
if ($user_license_purchase_date != '') {
$license->purchase_date = $user_license_purchase_date;
} else {
$license->purchase_date = NULL;
}
$license->serial = e($user_license_serial);
$license->seats = e($user_license_seats);
$license->supplier_id = $supplier->id;
$license->user_id = 1;
if ($user_license_purchase_date != '') {
$license->purchase_date = $user_license_purchase_date;
} else {
$license->purchase_date = NULL;
}
$license->license_name = $user_licensed_to_name;
$license->license_email = $user_licensed_to_email;
$license->notes = e($user_license_notes);
if ($license->save()) {
$this->comment('License ' . $user_license_name . ' with serial number ' . $user_license_serial . ' was created');
$license_seat_created = 0;
for ($x = 0; $x < $user_license_seats; $x++) {
// Create the license seat entries
$license_seat = new LicenseSeat();
$license_seat->license_id = $license->id;
$license_seat->assigned_to = $user->id;
if ($license_seat->save()) {
$license_seat_created++;
}
}
if ($license_seat_created > 0) {
$this->comment($license_seat_created . ' seats were created');
} else {
$this->comment('Something went wrong! NO seats for ' . $user_license_name . ' were created');
}
} else {
$this->comment('Something went wrong! License ' . $user_license_name . ' was NOT created');
}
$this->comment('=====================================');
return true;
});
}
示例11: doRegister
public function doRegister()
{
$affiliate = Affiliate::where('affiliate_key', '=', SELF_HOST_AFFILIATE_KEY)->first();
$license = new License();
$license->first_name = Input::get('first_name');
$license->last_name = Input::get('last_name');
$license->email = Input::get('email');
$license->transaction_reference = Request::getClientIp();
$license->license_key = Utils::generateLicense();
$license->affiliate_id = $affiliate->id;
$license->product_id = PRODUCT_SELF_HOST;
$license->is_claimed = 1;
$license->save();
return '';
}
示例12: getPage
public function getPage($post, &$_CORELANG)
{
$lc = LicenseCommunicator::getInstance($this->config);
$lc->addJsUpdateCode($this->lang, $this->license, true, false);
$sm = new \Cx\Core\Config\Controller\Config();
if (\FWUser::getFWUserObject()->objUser->getAdminStatus()) {
if (isset($post['save']) && isset($post['licenseKey'])) {
$license = License::getCached($this->config, $this->db);
if ($license->checkSum(contrexx_input2db($post['licenseKey']))) {
$license->setLicenseKey(contrexx_input2db($post['licenseKey']));
// save it before we check it, so we only change the license key
$license->save($this->db);
$license->check();
$this->license = $license;
}
} else {
if (isset($post['update'])) {
// This is only a backup if javascript is bogus
try {
$lc->update($this->license, $this->config, true, false, $this->lang);
$this->license->save($this->db);
} catch (\Exception $e) {
}
}
}
}
if (!file_exists(ASCMS_TEMP_PATH . '/licenseManager.html')) {
try {
$lc->update($this->license, $this->config, true, true, $this->lang);
$this->license->save($this->db);
} catch (\Exception $e) {
}
}
if (file_exists(ASCMS_TEMP_PATH . '/licenseManager.html')) {
\JS::activate('cx');
$remoteTemplate = new \Cx\Core\Html\Sigma(ASCMS_TEMP_PATH);
$remoteTemplate->loadTemplateFile('/licenseManager.html');
if (isset($_POST['save']) && isset($_POST['licenseKey'])) {
$remoteTemplate->setVariable('STATUS_TYPE', 'okbox');
$remoteTemplate->setVariable('STATUS_MESSAGE', $this->lang['TXT_LICENSE_SAVED']);
} else {
if (isset($_POST['update'])) {
$remoteTemplate->setVariable('STATUS_TYPE', 'okbox');
$remoteTemplate->setVariable('STATUS_MESSAGE', $this->lang['TXT_LICENSE_UPDATED']);
}
}
$remoteTemplate->setVariable($this->lang);
$this->setLicensePlaceholders($remoteTemplate);
if ($remoteTemplate->blockExists('legalComponents')) {
foreach ($this->license->getLegalComponentsList() as $component) {
$remoteTemplate->setVariable('LICENSE_LEGAL_COMPONENT', contrexx_raw2xhtml($component));
$remoteTemplate->parse('legalComponents');
}
}
if ($remoteTemplate->blockExists('licenseDomain')) {
foreach ($this->license->getRegisteredDomains() as $domain) {
$remoteTemplate->setVariable('LICENSE_DOMAIN', contrexx_raw2xhtml($domain));
$remoteTemplate->parse('licenseDomain');
}
}
$message = $this->license->getMessage(false, \FWLanguage::getLanguageCodeById(BACKEND_LANG_ID), $this->lang);
if (!$sm->isWritable()) {
$remoteTemplate->setVariable('MESSAGE_TITLE', preg_replace('/<br \\/>/', ' ', sprintf($_CORELANG['TXT_SETTINGS_ERROR_NO_WRITE_ACCESS'], \Cx\Core\Config\Controller\Config::getSettingsFile())));
$remoteTemplate->setVariable('MESSAGE_LINK', '#');
$remoteTemplate->setVariable('MESSAGE_LINK_TARGET', '_self');
$remoteTemplate->setVariable('MESSAGE_TYPE', 'alertbox');
} else {
if ($message && strlen($message->getText())) {
$remoteTemplate->setVariable('MESSAGE_TITLE', contrexx_raw2xhtml($this->getReplacedMessageText($message)));
$remoteTemplate->setVariable('MESSAGE_LINK', contrexx_raw2xhtml($message->getLink()));
$remoteTemplate->setVariable('MESSAGE_LINK_TARGET', contrexx_raw2xhtml($message->getLinkTarget()));
$remoteTemplate->setVariable('MESSAGE_TYPE', contrexx_raw2xhtml($message->getType()));
} else {
if ($remoteTemplate->blockExists('message')) {
$remoteTemplate->setVariable('MESSAGE_TYPE', '" style="display:none;');
}
}
}
if (\FWUser::getFWUserObject()->objUser->getAdminStatus()) {
$remoteTemplate->touchBlock('licenseAdmin');
$remoteTemplate->hideBlock('licenseNotAdmin');
} else {
$remoteTemplate->hideBlock('licenseAdmin');
$remoteTemplate->touchBlock('licenseNotAdmin');
$remoteTemplate->setVariable('LICENSE_ADMIN_MAIL', contrexx_raw2xhtml($this->config['coreAdminEmail']));
}
$this->template->setVariable('ADMIN_CONTENT', $remoteTemplate->get());
} else {
$this->template->setVariable('ADMIN_CONTENT', $this->lang['TXT_LICENSE_NO_TEMPLATE']);
}
}
示例13: postGenerateLicense
/**
* Generate License
*
* Generate license of any product
*/
public function postGenerateLicense()
{
//if($this->_isValidRequest())
//{
$prefix = Input::get('code');
$transaction_id = Input::get('transaction_id');
$allowed_usage = Input::get('allowed_usage');
if (!$transaction_id) {
$this->_invalidRequest("Transaction ID parameter is required");
}
if (!$allowed_usage) {
$this->_invalidRequest("Allowed Usage parameter is required");
}
// Check if license is already created for given transaction
if (License::where('transaction_id', '=', $transaction_id)->first()) {
$this->_invalidRequest("License already exists for transaction with ID: {$transaction_id}");
}
$license_key = License::generate($prefix);
// Save license
$license = new License();
$license->license_key = $license_key;
$license->transaction_id = $transaction_id;
$license->allowed_usage = $allowed_usage;
$license->save();
$data = array('license_key' => $license_key);
die(json_encode(array('data' => $data)));
//}
}
示例14: _generate_license
/**
* Generate and store license in database
*/
private function _generate_license($product, $plan, $transaction_id)
{
if ($plan->has_license) {
$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();
return $license_key;
}
}