Beispiel #1
0
 public function update(UserInterface $user)
 {
     $req = $this->db->prepare('
         UPDATE `camagru_user` SET
             username = :username,
             email = :email,
             password = :password,
             hash = :hash,
             active = :active
         WHERE id = :id
     ');
     $req->execute(['id' => $user->getId(), 'username' => $user->getUsername(), 'email' => $user->getEmail(), 'password' => $user->getPassword(), 'hash' => $user->getHash(), 'active' => $user->getActive()]);
 }
 public function create(UserInterface $user, PictureInterface $picture, $content)
 {
     $comment = new Comment();
     $comment->setUserId($user->getId())->setPictureId($picture->getId())->setContent($content);
     return $comment;
 }
 public function count(UserInterface $user = null)
 {
     if (isset($user)) {
         $userId = $user->getId();
         $req = $this->db->prepare('
             SELECT COUNT(*) as count FROM `camagru_picture`
             WHERE userId = :userId
         ');
         $req->bindParam(':userId', $userId, \PDO::PARAM_INT);
     } else {
         $req = $this->db->prepare('
             SELECT COUNT(*) as count FROM `camagru_picture`
         ');
     }
     $req->execute();
     return strval($req->fetch()['count']);
 }
Beispiel #4
0
 private function send($message, $title, UserInterface $user)
 {
     $headers = 'MIME-Version: 1.0' . "\r\n";
     $headers .= 'Content-type: text/html; charset=utf8' . "\r\n";
     $headers .= 'To: ' . $user->getUsername() . ' <' . $user->getEmail() . '>' . "\r\n";
     $headers .= 'From: Camagru <*****@*****.**>' . "\r\n";
     mail($user->getEmail(), '[Camagru] ' . $title, $message, $headers);
 }