示例#1
0
 /**
  * 认证
  * @return XF_Auth_Result
  */
 public function authenticate()
 {
     if ($this->_dbTable == NULL || !$this->_dbTable instanceof XF_Db_Table_Abstract) {
         throw new XF_Auth_Adapter_Exception('Lack of effective XF_Db_Table_Abstract authentication adapter !');
     }
     if (XF_Functions::isEmpty($this->_identity_column)) {
         throw new XF_Auth_Adapter_Exception('Certified identity column name and credential column name can not be empty!');
     }
     if (XF_Functions::isEmpty($this->_identity)) {
         return new XF_Auth_Result(-1, NULL);
     }
     $row = $this->_dbTable->getTableSelect()->setWhere(array($this->_identity_column => $this->_identity))->fetchRow();
     if ($row instanceof XF_Db_Table_Abstract) {
         $tmp = array();
         $array = $row->toArray();
         foreach ($array as $key => $val) {
             if (is_array($this->_storage_column)) {
                 if (in_array($key, $this->_storage_column)) {
                     $tmp[$key] = $val;
                 }
             } else {
                 $tmp[$key] = $val;
             }
         }
         return new XF_Auth_Result(9, (object) $tmp);
     }
     return new XF_Auth_Result(-1, NULL);
 }
示例#2
0
文件: Abstract.php 项目: kevinwan/xf
 /**
  * 获取数据表查询驱动对象
  * @return XF_Db_Table_Select_Abstract
  */
 public function getTableSelect()
 {
     if (self::$_select == NULL) {
         self::$_select = new XF_Db_Table_Select_Mysql($this);
     } else {
         //防止在 XF_Db_Table_Select_Interface 中无法获取当前Table已有的数据,所以要重新实例化
         $class = get_class(self::$_select);
         self::$_select = new $class($this);
     }
     return self::$_select;
 }
示例#3
0
文件: Mysql.php 项目: kevinwan/xf
 public function __construct(XF_Db_Table_Abstract $table)
 {
     $this->_db_name = $table->getDbName();
     $this->_db_table = $table;
 }
示例#4
0
 /**
  * 根据主键删除记录
  * @access public
  * @param int $pk_id 主键id
  * @return void
  */
 public function deletePk($pk_id)
 {
     return $this->delete(array($this->_table->getPrimaryKey() => $pk_id));
 }
示例#5
0
文件: Abstract.php 项目: kevinwan/xf
 /**
  * 获取表字段
  * @return mixed
  */
 public function getFields()
 {
     $this->_allotDatabaseServer();
     return $this->_db_drive_connect->getFields($this->_db_table->getTableName());
 }