Beispiel #1
0
 /**
  * Teste si un pseudo est présent en base de données
  * @param string $username Le pseudo à tester
  * @return boolean true si présent en base de données, false sinon
  */
 public function usernameExists($username)
 {
     $app = getApp();
     $sql = 'SELECT ' . $app->getConfig('security_username_property') . ' FROM ' . $this->table . ' WHERE ' . $app->getConfig('security_username_property') . ' = :username LIMIT 1';
     $dbh = ConnectionModel::getDbh();
     $sth = $dbh->prepare($sql);
     $sth->bindValue(':username', $username);
     if ($sth->execute()) {
         $foundUser = $sth->fetch();
         if ($foundUser) {
             return true;
         }
     }
     return false;
 }
Beispiel #2
0
 public static function getUser($id)
 {
     $cursor = ConnectionModel::getConnection()->query("Select * From user where id = :id", ["id" => $id]);
     if ($cursor && \sizeof($cursor) == 1) {
         $user = new UserModel("", "");
         $user->hydrate($cursor[0]);
         return $user;
     }
     return new UserModel("", "");
 }
Beispiel #3
0
 /**
  * Supprime la traduction de la base de données
  * @return type
  */
 public function delete()
 {
     return ConnectionModel::getConnection()->query('Delete from translation where layoutId = :layoutId', ['layoutId' => $this->_layoutId]);
 }
Beispiel #4
0
 /**
  * Return the list of the last commented algorithm
  * @param type $numPage the number of the search page
  */
 public static function getMostRecentHelped($numPage = 0, $displayPerPage = 6)
 {
     $result = [];
     $cursor = ConnectionModel::getConnection()->query("Select function.*\r\n                 From function, (SELECT max( date ) as commentDate , subjectId\r\n                                    FROM mail\r\n                                    GROUP BY subjectId) as lastComment\r\n                Where function.id = lastComment.subjectId\r\n                Order by lastComment.commentDate Desc", [], [$numPage * $displayPerPage, ($numPage + 1) * $displayPerPage]);
     $i = 0;
     while ($i < \sizeof($cursor) && $cursor) {
         $newAlgo = new AlgorithmModel();
         $newAlgo->hydrate($cursor[$i]);
         array_push($result, $newAlgo);
         $i += 1;
     }
     return $result;
 }
Beispiel #5
0
 /**
  * Supprime la structure de la base de données
  * @return type
  */
 public function delete()
 {
     return ConnectionModel::getConnection()->query('Delete from layout where id = :id', ['id' => $this->_id]);
 }
Beispiel #6
0
 public function update()
 {
     $statement = ConnectionModel::getConnection()->query('Update backup set content = :content, date = NOW(),' . ' label = :label, type = :type where functionId = :functionId and versionId = :versionId', ['content' => $this->_content, 'label' => $this->_label, 'type' => $this->_type, 'functionId' => $this->_functionId, 'versionId' => $this->_versionId]);
     return $statement;
 }
Beispiel #7
0
 /**
  * Constructeur
  */
 public function __construct()
 {
     $this->setTableFromClassName();
     $this->dbh = ConnectionModel::getDbh();
 }