Example #1
0
File: Auth.php Project: fucoso/site
 public function isLoginUsed($login)
 {
     if (!$this->enabled) {
         return false;
     }
     $sql = "Select * From {$this->tableUser} Where {$this->columnUsername} = '{$login}' Limit 1";
     $query = $this->dbProvider->query($sql);
     $row = $this->dbProvider->row($query);
     if ($row) {
         return true;
     } else {
         return false;
     }
 }
Example #2
0
 /**
  *
  * @param Config $config
  * @param IData $dbData
  */
 protected function loadFromDatabase(Config $config, IData $dbData)
 {
     if ($dbData && $config->settingsUseDatabase) {
         $this->table = $config->settingsTable;
         $this->columnKey = $config->settingsKeyColumn;
         $this->columnValue = $config->settingsValueColumn;
         if ($this->table && $this->columnKey && $this->columnValue) {
             $sql = "Select `{$this->columnKey}` as `key`, `{$this->columnValue}` as `value` From {$this->table} ";
             $query = $dbData->query($sql);
             $results = $dbData->result($query);
             if ($results) {
                 foreach ($results as $row) {
                     $key = $row->key;
                     $this->data[$key] = $row->value;
                 }
             }
         }
     }
 }