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


PHP Db::get方法代碼示例

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


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

示例1: login

 function login()
 {
     if (!empty($_POST)) {
         $check = new Check();
         $user = new User();
         $pdo = new Db();
         $db = $pdo->get();
         $mapper = new Mapper($db);
         //Проверяем входные данные
         $user->login = $check->checkInput($_POST['login']);
         $password = $check->checkInput($_POST['pass']);
         $user->password = md5($password);
         //Если пользователь не найден
         $this->user = $mapper->select($user);
         if (empty($this->user)) {
             $this->error = "Пароль или логин не совпадают";
             $this->out('login.php');
         } else {
             $this->out('profile.php');
             //Если найден, выводим профиль
         }
     } else {
         $this->out('login.php');
     }
 }
開發者ID:toppestkek,項目名稱:Test,代碼行數:25,代碼來源:ctrlIndex.php

示例2: init

 function init($host)
 {
     $this->host = $host;
     $this->dbh = Db::get();
     $host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
     $host->add_hook($host::HOOK_PREFS_TAB, $this);
 }
開發者ID:nowotny,項目名稱:ttrss-wp_fixes,代碼行數:7,代碼來源:init.php

示例3: enumerate

 public function enumerate($spid = null, $include = self::ALL)
 {
     $rawList = Db::get()->getResultSet("SELECT * FROM elenco_programmi()");
     if (!($include & self::POWEROFF)) {
         unset($rawList[0]);
     }
     if (!($include & self::ANTIFREEZE)) {
         unset($rawList[1]);
     }
     if (!($include & self::MANUAL)) {
         array_pop($rawList);
     }
     $this->list = [];
     $selected = null;
     foreach ($rawList as $v) {
         $k = $v['id_programma'];
         $this->list[$k] = $v;
         if ($selected === null && $spid == $k) {
             $this->list[$k]['selected'] = 'selected';
             $selected = $k;
         } else {
             $this->list[$k]['selected'] = '';
         }
     }
     if ($selected === null && $this->list) {
         $selected = key($this->list);
         $this->list[$selected]['selected'] = 'selected';
     }
     return $selected;
 }
開發者ID:balucio,項目名稱:smac,代碼行數:30,代碼來源:programlist.php

示例4: init

 /**
  * Init
  *
  * @param PluginHost $host
  */
 function init($host)
 {
     require_once "PhCURL.php";
     $this->host = $host;
     $this->dbh = Db::get();
     $host->add_hook($host::HOOK_RENDER_ARTICLE_CDM, $this);
     $host->add_hook($host::HOOK_PREFS_TAB, $this);
 }
開發者ID:k2s,項目名稱:af_refspoof,代碼行數:13,代碼來源:init.php

示例5: log

 /**
  * Logs an activity.
  * @param string $activity
  * @param string $data
  */
 public static function log($activity, $data = null)
 {
     $db = Db::get();
     $data = Db::escape(json_encode($data));
     if (ENABLE_AUDIT_TRAILS === true && class_exists("SystemAuditTrailModel", false)) {
         SystemAuditTrailModel::log(array('item_id' => 0, 'item_type' => 'system_activity', 'description' => $activity, 'type' => SystemAuditTrailModel::AUDIT_TYPE_SYSTEM));
     }
 }
開發者ID:rocksyne,項目名稱:wyf,代碼行數:13,代碼來源:User.php

示例6: __construct

 function __construct()
 {
     $this->dbh = Db::get();
     $this->cache = array();
     if ($_SESSION["uid"]) {
         $this->cache();
     }
 }
開發者ID:adrianpietka,項目名稱:bfrss,代碼行數:8,代碼來源:prefs.php

示例7: __construct

 public function __construct($id)
 {
     if (empty($id)) {
         throw new \InvalidArgumentException('Enter User ID');
     }
     $this->id = $id;
     $this->db = Db::get();
 }
開發者ID:kilya11,項目名稱:spotyfest,代碼行數:8,代碼來源:User.php

示例8: addData

 public static function addData($data)
 {
     $pdo = Db::get();
     $statement = $pdo->prepare("INSERT INTO common.binary_objects(data) VALUES(?)");
     $statement->bindParam(1, $data, PDO::PARAM_LOB);
     $statement->execute();
     $id = Db::query("SELECT LASTVAL()");
     return $id[0]['lastval'];
 }
開發者ID:ekowabaka,項目名稱:cfx,代碼行數:9,代碼來源:PgFileStore.php

示例9: savelike

 function savelike($like, $itemid)
 {
     $pdo = new Db();
     $db = $pdo->get();
     $mapper = new Mapper($db);
     $comments = new Comments();
     $comments->likes = $like;
     $comments->id = $itemid;
     $mapper->saveLike($comments);
 }
開發者ID:toppestkek,項目名稱:GuestBook,代碼行數:10,代碼來源:index.php

示例10: enumerate

 public function enumerate($selected = 0)
 {
     $selected != $this->selected && ($this->selected = $selected);
     $this->list = [];
     foreach (Db::get()->getResultSet("SELECT id, nome FROM driver_sensori") as $v) {
         $k = $v['id'];
         $this->list[$k] = $v;
         $this->list[$k]['selected'] = $selected == $k ? 'selected' : '';
     }
 }
開發者ID:balucio,項目名稱:smac,代碼行數:10,代碼來源:driverlist.php

示例11: enumerate

 public function enumerate($status = self::ALL, $selected = 0)
 {
     $selected != $this->selected && ($this->selected = $selected);
     $status != $this->status && ($this->status = $status);
     $this->list = [];
     foreach (Db::get()->getResultSet("SELECT * FROM elenco_sensori(:status)", [':status' => $status]) as $v) {
         $k = $v['id'];
         $this->list[$k] = $v;
         $this->list[$k]['selected'] = $selected == $k ? 'selected' : '';
     }
 }
開發者ID:balucio,項目名稱:smac,代碼行數:11,代碼來源:sensorlist.php

示例12: settings

 /**
  * Install the application
  */
 public function settings()
 {
     $form = new Form(array('id' => 'install-settings-form', 'labelWidth' => '30em', 'fieldsets' => array('global' => array('legend' => Lang::get('install.settings-global-legend', null, null, $this->language), new TextInput(array('name' => 'title', 'required' => true, 'label' => Lang::get('install.settings-title-label', null, null, $this->language), 'default' => DEFAULT_HTML_TITLE)), new TextInput(array('name' => 'rooturl', 'required' => true, 'label' => Lang::get('install.settings-rooturl-label', null, null, $this->language), 'placeholder' => 'http://', 'default' => getenv('REQUEST_SCHEME') . '://' . getenv('SERVER_NAME'))), new SelectInput(array('name' => 'timezone', 'required' => true, 'options' => array_combine(\DateTimeZone::listIdentifiers(), \DateTimeZone::listIdentifiers()), 'default' => DEFAULT_TIMEZONE, 'label' => Lang::get('install.settings-timezone-label')))), 'database' => array('legend' => Lang::get('install.settings-database-legend', null, null, $this->language), new TextInput(array('name' => 'db[host]', 'required' => true, 'label' => Lang::get('install.settings-db-host-label', null, null, $this->language), 'default' => 'localhost')), new TextInput(array('name' => 'db[username]', 'required' => true, 'label' => Lang::get('install.settings-db-username-label', null, null, $this->language))), new PasswordInput(array('name' => 'db[password]', 'required' => true, 'label' => Lang::get('install.settings-db-password-label', null, null, $this->language), 'pattern' => '/^.*$/')), new TextInput(array('name' => 'db[dbname]', 'required' => true, 'pattern' => '/^\\w+$/', 'label' => Lang::get('install.settings-db-dbname-label', null, null, $this->language))), new TextInput(array('name' => 'db[prefix]', 'default' => 'Hawk', 'pattern' => '/^\\w+$/', 'label' => Lang::get('install.settings-db-prefix-label', null, null, $this->language)))), 'admin' => array('legend' => Lang::get('install.settings-admin-legend', null, null, $this->language), new TextInput(array('name' => 'admin[login]', 'required' => true, 'pattern' => '/^\\w+$/', 'label' => Lang::get('install.settings-admin-login-label', null, null, $this->language))), new EmailInput(array('name' => 'admin[email]', 'required' => true, 'label' => Lang::get('install.settings-admin-email-label', null, null, $this->language))), new PasswordInput(array('name' => 'admin[password]', 'required' => true, 'label' => Lang::get('install.settings-admin-password-label', null, null, $this->language))), new PasswordInput(array('name' => 'admin[passagain]', 'required' => true, 'compare' => 'admin[password]', 'label' => Lang::get('install.settings-admin-passagain-label', null, null, $this->language)))), '_submits' => array(new SubmitInput(array('name' => 'valid', 'value' => Lang::get('install.install-button', null, null, $this->language), 'icon' => 'cog')))), 'onsuccess' => 'location.href = data.rooturl;'));
     if (!$form->submitted()) {
         // Display the form
         $body = View::make(Plugin::current()->getView('settings.tpl'), array('form' => $form));
         return \Hawk\Plugins\Main\MainController::getInstance()->index($body);
     } else {
         // Make the installation
         if ($form->check()) {
             /**
              * Generate Crypto constants
              */
             $salt = Crypto::generateKey(24);
             $key = Crypto::generateKey(32);
             $iv = Crypto::generateKey(16);
             $configMode = 'prod';
             /**
              * Create the database and it tables
              */
             $tmpfile = tempnam(sys_get_temp_dir(), '');
             DB::add('tmp', array(array('host' => $form->getData('db[host]'), 'username' => $form->getData('db[username]'), 'password' => $form->getData('db[password]'))));
             try {
                 DB::get('tmp');
             } catch (DBException $e) {
                 return $form->response(Form::STATUS_ERROR, Lang::get('install.install-connection-error'));
             }
             try {
                 $param = array('{{ $dbname }}' => $form->getData('db[dbname]'), '{{ $prefix }}' => $form->getData('db[prefix]'), '{{ $language }}' => $this->language, '{{ $timezone }}' => $form->getData('timezone'), '{{ $title }}' => Db::get('tmp')->quote($form->getData('title')), '{{ $email }}' => Db::get('tmp')->quote($form->getData('admin[email]')), '{{ $login }}' => Db::get('tmp')->quote($form->getData('admin[login]')), '{{ $password }}' => Db::get('tmp')->quote(Crypto::saltHash($form->getData('admin[password]'), $salt)), '{{ $ip }}' => Db::get('tmp')->quote(App::request()->clientIp()));
                 $sql = strtr(file_get_contents(Plugin::current()->getRootDir() . 'templates/install.sql.tpl'), $param);
                 // file_put_contents($tmpfile, $sql);
                 Db::get('tmp')->query($sql);
                 /**
                  * Create the config file
                  */
                 $param = array('{{ $salt }}' => addcslashes($salt, "'"), '{{ $key }}' => addcslashes($key, "'"), '{{ $iv }}' => addcslashes($iv, "'"), '{{ $configMode }}' => $configMode, '{{ $rooturl }}' => $form->getData('rooturl'), '{{ $host }}' => $form->getData('db[host]'), '{{ $username }}' => $form->getData('db[username]'), '{{ $password }}' => $form->getData('db[password]'), '{{ $dbname }}' => $form->getData('db[dbname]'), '{{ $prefix }}' => $form->getData('db[prefix]'), '{{ $sessionEngine }}' => $form->getData('session'), '{{ $version }}' => $form->getData('version'));
                 $config = strtr(file_get_contents(Plugin::current()->getRootDir() . 'templates/config.php.tpl'), $param);
                 file_put_contents(INCLUDES_DIR . 'config.php', $config);
                 /**
                  * Create etc/dev.php
                  */
                 App::fs()->copy(Plugin::current()->getRootDir() . 'templates/etc-dev.php', ETC_DIR . 'dev.php');
                 /**
                  * Create etc/prod.php
                  */
                 App::fs()->copy(Plugin::current()->getRootDir() . 'templates/etc-prod.php', ETC_DIR . 'prod.php');
                 $form->addReturn('rooturl', $form->getData('rooturl'));
                 return $form->response(Form::STATUS_SUCCESS, Lang::get('install.install-success'));
             } catch (\Exception $e) {
                 return $form->response(Form::STATUS_ERROR, Lang::get('install.install-error'));
             }
         }
     }
 }
開發者ID:elvyrra,項目名稱:hawk,代碼行數:57,代碼來源:InstallController.php

示例13: init

 function init($host)
 {
     require_once __DIR__ . "/lib/class.naivebayesian.php";
     //require_once __DIR__ . "/lib/class.naivebayesian_ngram.php";
     require_once __DIR__ . "/lib/class.naivebayesianstorage.php";
     $this->host = $host;
     $this->dbh = Db::get();
     $this->init_database();
     $host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
     $host->add_hook($host::HOOK_PREFS_TAB, $this);
     $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
 }
開發者ID:Verisor,項目名稱:tt-rss,代碼行數:12,代碼來源:init.php

示例14: getAclResources

 public function getAclResources($id)
 {
     $res = Db::get("SELECT * FROM [prefix]user_groups_to_acl_resources WHERE `user-group-id`=:userGroupId", array(':userGroupId' => $id));
     $groups = array();
     if ($res !== false) {
         if (count($res) > 0) {
             foreach ($res as $row) {
                 $groups[] = $row['acl-resource-id'];
             }
         }
     }
     return $groups;
 }
開發者ID:pixelproduction,項目名稱:PixelManagerCMS,代碼行數:13,代碼來源:UserGroups.php

示例15: log_error

 function log_error($errno, $errstr, $file, $line, $context)
 {
     if (Db::get() && get_schema_version() > 117) {
         $errno = Db::get()->escape_string($errno);
         $errstr = Db::get()->escape_string($errstr);
         $file = Db::get()->escape_string($file);
         $line = Db::get()->escape_string($line);
         $context = DB::get()->escape_string($context);
         $owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : "NULL";
         $result = Db::get()->query("INSERT INTO ttrss_error_log\n\t\t\t\t(errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES\n\t\t\t\t({$errno}, '{$errstr}', '{$file}', '{$line}', '{$context}', {$owner_uid}, NOW())");
         return Db::get()->affected_rows($result) != 0;
     }
     return false;
 }
開發者ID:XelaRellum,項目名稱:tt-rss,代碼行數:14,代碼來源:sql.php


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