コード例 #1
0
ファイル: Resources.php プロジェクト: vyrus/remote-edu
 /**
  * Инициализация объекта для работы с БД.
  *
  * @return Db_Pdo
  */
 protected function get_db()
 {
     $config = $this->_config['db'];
     $db = Db_Pdo::create($config['dsn'], $config['user'], $config['passwd'], $config['options']);
     $db->exec('SET NAMES utf8');
     return $db;
 }
コード例 #2
0
ファイル: API.php プロジェクト: emilymwang8/cms
 public function __construct()
 {
     $this->request = APF::get_instance()->get_request();
     $this->response = APF::get_instance()->get_response();
     $p = $this->request->get_parameters();
     $this->check_sig($p);
     Db_Pdo::get_instance();
 }
コード例 #3
0
ファイル: Base.php プロジェクト: emilymwang8/cms
 public function __construct()
 {
     $this->request = APF::get_instance()->get_request();
     $this->response = APF::get_instance()->get_response();
     $cookie_cfg = APF::get_instance()->get_config('cookie');
     $cookie_value = Bll_Cookie::get($cookie_cfg['name']);
     $user_info_str = Util_AuthorCrypt::decrypt($cookie_value, $cookie_cfg['key']);
     $user_info_arr = json_decode($user_info_str, true);
     $this->userInfo = $user_info_arr[0];
     Db_Pdo::get_instance();
 }
コード例 #4
0
ファイル: index.php プロジェクト: vyrus/remote-edu
 public function __construct($file_name, $dsn, $user, $passwd)
 {
     if (false === ($this->_link = dbase_open($file_name, 0))) {
         throw new Exception('Не удалось открыть файл ' . $file_name);
     }
     $options = array(Db_Pdo::ATTR_ERRMODE => Db_Pdo::ERRMODE_EXCEPTION);
     $this->_db = Db_Pdo::create($dsn, $user, $passwd, $options);
     $this->_db->exec('SET NAMES utf8');
     $sql = '
             INSERT INTO regions
             (code, name)
             VALUES (:code, :name)
         ';
     $this->_insert_region = $this->_db->prepare($sql);
     $sql = '
             INSERT INTO localities
             (region_id, code, name, type)
             VALUES (:region_id, :code, :name, :type)
         ';
     $this->_insert_locality = $this->_db->prepare($sql);
 }
コード例 #5
0
ファイル: Abstract.php プロジェクト: vyrus/remote-edu
 /**
  * Закрывает строку в кавычки для использования в запросах.
  *
  * @link http://www.php.net/manual/en/pdo.quote.php
  *
  * @param  string $string Исходная строка.
  * @return string
  */
 protected function quote($string)
 {
     return $this->_db->quote($string);
 }
コード例 #6
0
ファイル: Pdo.php プロジェクト: emilymwang8/cms
 public static function get_instance()
 {
     self::$db = APF_DB_Factory::get_instance()->get_pdo('cms_user');
     return self::$db;
 }