当前位置: 首页>>代码示例>>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;未经允许,请勿转载。