Esempio n. 1
0
 /**
  * Конструктор
  *
  */
 protected function __construct()
 {
     parent::__construct();
     if (DEBUG) {
         Open_Benchmark::getInstance()->mark(__CLASS__ . '_start');
     }
     $this->config = Open_Config::getInstance();
     $this->db = Open_Db::getInstance();
     $this->input = Open_Input::getInstance();
     $this->router = Open_Router::getInstance();
     $this->text = Open_Text::getInstance();
     $this->view = Open_View::getInstance();
 }
Esempio n. 2
0
 /**
  * Идентифицировать по значению уникальности и значению удостоверения личности
  *
  * @param string $identity
  * @param string $credential
  * @return mixed
  */
 public function identify($identity, $credential)
 {
     $Db = Open_Db::getInstance();
     $q = "SELECT * FROM `{$this->table}` WHERE `{$this->identityField}`={$Db->escape($identity)} LIMIT 1";
     $result = $Db->result($q);
     if ($result->numRows() == 0) {
         return self::FAILURE_IDENTITY_NOT_FOUND;
     } else {
         $temp = $result->rowArray();
         if ($temp[$this->credentialField] == ($this->treatmentCallback !== FALSE ? call_user_func($this->treatmentCallback, $credential) : $credential)) {
             $this->identity($temp);
             return self::SUCCESS;
         } else {
             return self::FAILURE_CREDENTIAL_INVALID;
         }
     }
 }