/** * 认证 * @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); }
/** * 获取当前对应的Table查询对象 * @return XF_Db_Table_Select_Abstract */ public function select() { return $this->_select == null ? $this->_select = $this->_table->getTableSelect() : $this->_select; }