/** * Initialises auth, onStart, onLogin and onLogout queries. */ public function initStatement() { if (isset($this->table)) { if (is_string($this->table)) { $this->table = DB::i()->table($this->table); } if (!isset($this->query)) { $this->query = $this->table->getStatement('auth'); } if (!isset($this->onStartQuery) && $this->table['onstart']) { $this->onStartQuery = $this->table->getStatement('onstart'); } if (!isset($this->onLoginQuery) && $this->table['onlogin']) { $this->onLoginQuery = $this->table->getStatement('onlogin'); } if (!isset($this->onLogoutQuery) && $this->table['onlogout']) { $this->onLogoutQuery = $this->table->getStatement('onlogout'); } $link = $this->table->getConnection(); } else { $link = DB::i(); } if (!isset($this->query)) { throw new Exception("Table nor query is set."); } if (is_string($this->query)) { $this->query = $link->prepare($this->query); } else { $this->query->commit(); } if (isset($this->onStartQuery) && is_string($this->onStartQuery)) { $this->onStartQuery = $link->prepare($this->onStartQuery); } if (isset($this->onLoginQuery) && is_string($this->onLoginQuery)) { $this->onLoginQuery = $link->prepare($this->onLoginQuery); } if (isset($this->onLogoutQuery) && is_string($this->onLogoutQuery)) { $this->onLogoutQuery = $link->prepare($this->onLogoutQuery); } if (!isset($this->passwordCrypt)) { $this->passwordCrypt = $this->query->getField(4)->getProperty('crypt'); } $this->queryInit = true; }