]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/twitapifavorites.php
Update favorited for new layout and framework
[quix0rs-gnu-social.git] / actions / twitapifavorites.php
index ad8c5f18b1823cac6a3ea322b24f09a8bb21890e..737b7229f0335a63bc6fa21d08c7895fca1435e7 100644 (file)
@@ -21,23 +21,25 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/twitterapi.php');
 
-class TwitapifavoritesAction extends TwitterapiAction {
+class TwitapifavoritesAction extends TwitterapiAction
+{
 
-    function favorites($args, $apidata) {
+    function favorites($args, $apidata)
+    {
         parent::handle($args);
 
         $this->auth_user = $apidata['user'];
         $user = $this->get_user($apidata['api_arg'], $apidata);
 
         if (!$user) {
-            $this->client_error('Not Found', 404, $apidata['content-type']);
+            $this->clientError('Not Found', 404, $apidata['content-type']);
             return;
         }
 
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
@@ -54,7 +56,7 @@ class TwitapifavoritesAction extends TwitterapiAction {
         $notice = $user->favoriteNotices((($page-1)*20), $count);
 
         if (!$notice) {
-            common_server_error(_('Could not retrieve favorite notices.'));
+            $this->serverError(_('Could not retrieve favorite notices.'));
             return;
         }
 
@@ -80,23 +82,24 @@ class TwitapifavoritesAction extends TwitterapiAction {
             $this->show_json_timeline($notice);
             break;
          default:
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
         }
 
     }
 
-    function create($args, $apidata) {
+    function create($args, $apidata)
+    {
         parent::handle($args);
 
         // Check for RESTfulness
         if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
             // XXX: Twitter just prints the err msg, no XML / JSON.
-            $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
             return;
         }
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
@@ -106,20 +109,20 @@ class TwitapifavoritesAction extends TwitterapiAction {
         $notice = Notice::staticGet($notice_id);
 
         if (!$notice) {
-            $this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']);
+            $this->clientError(_('No status found with that ID.'), 404, $apidata['content-type']);
             return;
         }
 
         // XXX: Twitter lets you fave things repeatedly via api.
         if ($user->hasFave($notice)) {
-            $this->client_error(_('This notice is already a favorite!'), 403, $apidata['content-type']);
+            $this->clientError(_('This notice is already a favorite!'), 403, $apidata['content-type']);
             return;
         }
 
         $fave = Fave::addNew($user, $notice);
 
         if (!$fave) {
-            common_server_error(_('Could not create favorite.'));
+            $this->serverError(_('Could not create favorite.'));
             return;
         }
 
@@ -134,14 +137,16 @@ class TwitapifavoritesAction extends TwitterapiAction {
 
     }
 
-    function destroy($args, $apidata) {
+    function destroy($args, $apidata)
+    {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
     // XXX: these two funcs swiped from faves.  Maybe put in util.php, or some common base class?
 
-    function notify($fave, $notice, $user) {
+    function notify($fave, $notice, $user)
+    {
         $other = User::staticGet('id', $notice->profile_id);
         if ($other && $other->id != $user->id) {
             if ($other->email && $other->emailnotifyfav) {
@@ -152,7 +157,8 @@ class TwitapifavoritesAction extends TwitterapiAction {
         }
     }
 
-    function notify_mail($other, $user, $notice) {
+    function notify_mail($other, $user, $notice)
+    {
         $profile = $user->getProfile();
         $bestname = $profile->getBestName();
         $subject = sprintf(_('%s added your notice as a favorite'), $bestname);