Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 /**
  * 获取数据表查询驱动对象
  * @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;
 }
Ejemplo n.º 3
0
 public function __construct(XF_Db_Table_Abstract $table)
 {
     $this->_db_name = $table->getDbName();
     $this->_db_table = $table;
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 5
0
 /**
  * 获取表字段
  * @return mixed
  */
 public function getFields()
 {
     $this->_allotDatabaseServer();
     return $this->_db_drive_connect->getFields($this->_db_table->getTableName());
 }