Example #1
0
 public function get($type, $authToken)
 {
     $response = $this->defaultResponseObj;
     $sth = null;
     if ($type == "top") {
         $sth = $this->db->prepare("SELECT S.ShareId, S.ContextioEmailId, U.UserId, U.FirstName, U.LastName, S.EmailHTML, S.EmailSubject, S.EmailComment, S.ShareDate, S.Rank\n\t\t\t\t\t\t\tFROM Shares S, Users U\n\t\t\t\t\t\t\tWHERE S.UserId = U.UserId\n\t\t\t\t\t\t\tORDER BY Rank DESC LIMIT 200");
     } else {
         if ($type == "recent") {
             $sth = $this->db->prepare("SELECT * FROM Shares S, Users U WHERE U.UserId = S.UserId ORDER BY ShareDate DESC LIMIT 200");
         }
     }
     $sth->execute(array());
     $sthMyVotes = $this->db->prepare("SELECT * FROM Votes WHERE UserId = :userId");
     $sthMyVotes->execute(array(":userId" => parent::getUserId_GET($authToken)));
     $response["Success"] = true;
     $response["Message"] = "Fetched";
     $response["Shares"] = $sth->fetchAll();
     $response["MyVotes"] = $sthMyVotes->fetchAll();
     return array($response);
 }
 public function getAccounts($authToken)
 {
     $userId = parent::getUserId_GET($authToken);
     if ($userId == false) {
         return "Invalid User";
     }
     // Get all accounts for this user
     $sth = $this->db->prepare("SELECT * FROM EmailAccounts WHERE UserId = :userId");
     $sth->execute(array(":userId" => $userId));
     return $sth->fetchAll();
 }