當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Key::save方法代碼示例

本文整理匯總了PHP中Key::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP Key::save方法的具體用法?PHP Key::save怎麽用?PHP Key::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Key的用法示例。


在下文中一共展示了Key::save方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: up

 /**
  * Make changes to the database.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('keys', function ($table) {
         $table->increments('id');
         $table->string('name');
         $table->string('api_key');
         $table->timestamps();
     });
     $key = new Key();
     $key->name = "default";
     $key->api_key = Config::get('solder.platform_key');
     $key->save();
 }
開發者ID:kreezxil,項目名稱:TechnicSolder,代碼行數:18,代碼來源:2014_01_24_122845_create_keys_table.php

示例2: action_do_create

 public function action_do_create()
 {
     $rules = array('name' => 'required|unique:keys', 'api_key' => 'required|unique:keys');
     $validation = Validator::make(Input::all(), $rules);
     if ($validation->fails()) {
         return Redirect::back()->with_errors($validation->errors);
     }
     $key = new Key();
     $key->name = Input::get('name');
     $key->api_key = Input::get('api_key');
     $key->save();
     return Redirect::to('key/list')->with('success', 'API key added!');
 }
開發者ID:kreezxil,項目名稱:TechnicSolder,代碼行數:13,代碼來源:key.php

示例3: upload

 public function upload()
 {
     $s3 = \Aws\S3\S3Client::factory(array('key' => 'AKIAIUCV4E2L4HDCDOUA', 'secret' => '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', 'region' => 'us-east-1'));
     $key = new Key();
     if (Input::file('key') != null) {
         exec('openssl rsa -noout -in ' . Input::file('key')->getRealPath(), $cli_output, $cli_exec_result_success);
         // lmao why is this logic reversed? and it works?
         if (!$cli_exec_result_success) {
             $s3->putObject(array('Bucket' => App::isLocal() ? 'devkeys.nosprawl.software' : 'keys.nosprawl.software', 'Key' => Input::file('key')->getClientOriginalName(), 'SourceFile' => Input::file('key')->getRealPath()));
             $key->remote_url = Input::file('key')->getClientOriginalName();
         } else {
             return Redirect::to('integrations')->withMessage("Key not added. Please upload a valid PEM file.");
         }
     }
     $key->integration_id = Input::get('integration_id');
     $key->username = Input::get('username');
     $key->password = Input::get('password');
     if ($key->save()) {
         return Redirect::to('integrations')->withMessage("Credentials added.");
     } else {
         return Redirect::to('integrations')->withMessage("Key not added.");
     }
 }
開發者ID:crudbug,項目名稱:Dashboard,代碼行數:23,代碼來源:KeysController.php

示例4: apiKeysAction

 public function apiKeysAction()
 {
     $user = $this->_helper->db->findById();
     $keyTable = $this->_helper->db->getTable('Key');
     $this->view->user = $user;
     $this->view->currentUser = $this->getCurrentUser();
     $this->view->keys = $keyTable->findBy(array('user_id' => $user->id));
     if ($this->getRequest()->isPost()) {
         // Create a new API key.
         if ($this->getParam('api_key_label')) {
             $key = new Key();
             $key->user_id = $user->id;
             $key->label = $this->getParam('api_key_label');
             $key->key = sha1($user->username . microtime() . rand());
             $key->save();
             $this->_helper->flashMessenger(__('A new API key was successfully created.'), 'success');
         }
         // Rescend API keys.
         if ($this->getParam('api_key_rescind')) {
             foreach ($this->getParam('api_key_rescind') as $keyId) {
                 $keyTable->find($keyId)->delete();
             }
             $this->_helper->flashMessenger(__('An existing API key was successfully rescinded.'), 'success');
         }
         $this->_helper->redirector->gotoRoute();
     }
 }
開發者ID:kyfr59,項目名稱:cg35,代碼行數:27,代碼來源:UsersController.php

示例5: saveKey

 /**
  * Saves a key for the form
  * @author Matthew McNaney <mcnaney at gmail dot com>
  */
 function saveKey()
 {
     if (empty($this->_key_id)) {
         $key = new Key();
         $key->setModule('phatform');
         $key->setItemName('form');
         $key->setItemId($this->_id);
         $key->setEditPermission('edit_forms');
         $key->setUrl('index.php?module=phatform&PHAT_MAN_OP=view&PHPWS_MAN_ITEMS[]=' . $this->_id);
     } else {
         $key = new Key($this->_key_id);
     }
     if ($this->_anonymous) {
         $key->restricted = 0;
     } else {
         $key->restricted = 1;
     }
     $key->setTitle($this->_label);
     $key->setSummary($this->_blurb0);
     $key->save();
     $this->_key_id = $key->id;
     return $key;
 }
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:27,代碼來源:Form.php

示例6: saveKey

 public function saveKey()
 {
     if (empty($this->key_id)) {
         $key = new Key();
         $key->module = $key->item_name = 'block';
         $key->item_id = $this->id;
     } else {
         $key = new Key($this->key_id);
     }
     $key->edit_permission = 'edit_block';
     $key->title = $this->title;
     $result = $key->save();
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     if (empty($this->key_id)) {
         $this->key_id = $key->id;
         $this->save(FALSE);
     }
 }
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:20,代碼來源:Block_Item.php

示例7: saveKey

 public function saveKey()
 {
     if (empty($this->key_id)) {
         $key = new Key();
     } else {
         $key = new Key($this->key_id);
         if (PHPWS_Error::isError($key->_error)) {
             $key = new Key();
         }
     }
     $key->setModule('signup');
     $key->setItemName('sheet');
     $key->setItemId($this->id);
     $key->setEditPermission('edit_sheet');
     if (MOD_REWRITE_ENABLED) {
         $key->setUrl('signup/sheet_id/' . $this->id);
     } else {
         $key->setUrl('index.php?module=signup&amp;sheet_id=' . $this->id);
     }
     $key->setTitle($this->title);
     $result = $key->save();
     if (PHPWS_Error::logIfError($result)) {
         return false;
     }
     if (!$this->key_id) {
         $this->key_id = $key->id;
         $db = new PHPWS_DB('signup_sheet');
         $db->addWhere('id', $this->id);
         $db->addValue('key_id', $this->key_id);
         PHPWS_Error::logIfError($db->update());
     }
     return true;
 }
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:33,代碼來源:Sheet.php

示例8: delete

 public function delete($permanent = false)
 {
     $db = new PHPWS_DB('ps_page');
     $db->addWhere('id', $this->id);
     if ($permanent) {
         $result = $db->delete();
         if (PHPWS_Error::logIfError($result)) {
             return false;
         }
         Key::drop($this->key_id);
         $db = new PHPWS_DB('ps_text');
         $db->addWhere('pid', $this->id);
         $result = $db->delete();
         $db = new PHPWS_DB('ps_block');
         $db->addWhere('pid', $this->id);
         $db->delete();
     } else {
         $db->addValue('deleted', 1);
         $db->addValue('last_updated', time());
         $result = $db->update();
         if (PHPWS_Error::logIfError($result)) {
             return false;
         }
         $key = new \Key($this->key_id);
         $key->active = 0;
         $key->save();
         $key->unregister();
     }
     $this->removeShortcuts();
     if ($this->parent_page) {
         $db = new PHPWS_DB('ps_page');
         $db->addWhere('parent_page', $this->parent_page);
         $db->addWhere('page_order', $this->page_order, '>');
         PHPWS_Error::logIfError($db->reduceColumn('page_order'));
     }
     return true;
 }
開發者ID:sysulsj,項目名稱:phpwebsite,代碼行數:37,代碼來源:PS_Page.php

示例9: saveKey

 public function saveKey($new_folder = true)
 {
     if (empty($this->key_id)) {
         $key = new Key();
     } else {
         $key = new Key($this->key_id);
         if (PHPWS_Error::isError($key->getError())) {
             $key = new Key();
         }
     }
     $key->setModule('filecabinet');
     $key->setItemName('folder');
     $key->setItemId($this->id);
     $key->setEditPermission('edit_folders');
     $key->setUrl($this->viewLink(false));
     $key->setTitle($this->title);
     $key->setSummary($this->description);
     $result = $key->save();
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     $this->key_id = $key->id;
     if ($new_folder) {
         $db = new PHPWS_DB('folders');
         $db->addWhere('id', $this->id);
         $db->addValue('key_id', $this->key_id);
         $result = $db->update();
         if (PHPWS_Error::isError($result)) {
             return $result;
         }
     }
     return true;
 }
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:33,代碼來源:Folder.php

示例10: saveKey

 function saveKey()
 {
     if (empty($this->key_id)) {
         $key = new Key();
         $key->module = 'wiki';
         $key->item_name = 'page';
         $key->item_id = $this->getId();
         $key->edit_permission = 'edit_page';
     } else {
         $key = new Key($this->key_id);
     }
     $key->title = $this->getTitle();
     $key->url = (MOD_REWRITE_ENABLED ? 'wiki/' : 'index.php?module=wiki&page=') . $this->getTitle(FALSE);
     $result = $key->save();
     if (PEAR::isError($result)) {
         return $result;
     }
     if (empty($this->key_id)) {
         $this->key_id = $key->id;
         $this->save(FALSE);
     }
 }
開發者ID:Jopperi,項目名稱:wiki,代碼行數:22,代碼來源:WikiPage.php

示例11: saveKey

 public function saveKey()
 {
     if (empty($this->key_id)) {
         $key = new Key();
     } else {
         $key = new Key($this->key_id);
         if (PHPWS_Error::isError($key->_error)) {
             $key = new Key();
         }
     }
     $key->setModule('pagesmith');
     $key->setItemId($this->id);
     $key->setEditPermission('edit_page');
     $key->setUrl($this->url());
     foreach ($this->_sections as $sec) {
         if ($sec->sectype == 'text') {
             $key->setSummary($sec->getContent());
             break;
         }
     }
     $key->setTitle($this->title);
     $result = $key->save();
     if (PHPWS_Error::logIfError($result)) {
         return false;
     }
     if (!$this->key_id) {
         $this->key_id = $key->id;
         $db = new PHPWS_DB('ps_page');
         $db->addWhere('id', $this->id);
         $db->addValue('key_id', $this->key_id);
         PHPWS_Error::logIfError($db->update());
     } elseif ($this->_title_change) {
         PHPWS_Core::initModClass('menu', 'Menu.php');
         Menu::updateKeyLink($this->key_id);
     }
     $this->_key = $key;
     return true;
 }
開發者ID:par-orillonsoft,項目名稱:phpwebsite,代碼行數:38,代碼來源:PS_Page.php

示例12: saveKey

 public function saveKey()
 {
     if (empty($this->key_id)) {
         $key = new Key();
         $key->module = $key->item_name = 'menu';
         $key->item_id = $this->id;
     } else {
         $key = new Key($this->key_id);
     }
     $key->title = $this->title;
     $result = $key->save();
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     if (empty($this->key_id)) {
         $this->key_id = $key->id;
         $this->save(false);
     }
 }
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:19,代碼來源:Menu_Item.php

示例13: saveKey

 public function saveKey()
 {
     if (empty($this->key_id)) {
         $key = new Key();
     } else {
         $key = new Key($this->key_id);
         if (PHPWS_Error::isError($key->getError())) {
             $key = new Key();
         }
     }
     $key->setModule('calendar');
     $key->setItemName('schedule');
     $key->setItemId($this->id);
     if ($this->public) {
         $key->restricted = 0;
         $key->setEditPermission('edit_public');
     } else {
         $key->restricted = 2;
         $key->setEditPermission('edit_private');
     }
     $key->setUrl($this->getViewLink(false));
     $key->setTitle($this->title);
     $key->setSummary($this->summary);
     $result = $key->save();
     $this->key_id = $key->id;
     return $result;
 }
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:27,代碼來源:Schedule.php

示例14: saveKey

 public function saveKey()
 {
     if (empty($this->key_id)) {
         $key = new Key();
     } else {
         $key = new Key($this->key_id);
         if (PHPWS_Error::isError($key->getError())) {
             $key = new Key();
         }
     }
     $key->setModule('calendar');
     $key->setItemName('event' . $this->_schedule->id);
     $key->setItemId($this->id);
     $key->setUrl($this->getViewLink());
     $key->setTitle($this->summary);
     if (!empty($this->description)) {
         $key->setSummary($this->description);
     }
     $result = $key->save();
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     $this->key_id = $key->id;
     return $key;
 }
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:25,代碼來源:Event.php

示例15: saveKey

 public function saveKey()
 {
     if (empty($this->key_id)) {
         $key = new Key();
     } else {
         $key = new Key($this->key_id);
         if (PHPWS_Error::isError($key->getError())) {
             $key = new Key();
         }
     }
     $key->setModule('blog');
     $key->setItemName('entry');
     $key->setItemId($this->id);
     $key->setEditPermission('edit_blog');
     $key->setUrl($this->getViewLink(true));
     $key->setTitle($this->title);
     $key->setShowAfter($this->publish_date);
     $key->setHideAfter($this->expire_date);
     if (!empty($this->summary)) {
         $key->setSummary($this->summary);
     } else {
         $key->setSummary($this->entry);
     }
     $key->save();
     $this->key_id = $key->id;
     return $key;
 }
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:27,代碼來源:Blog.php


注:本文中的Key::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。