]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into testing
authorBrion Vibber <brion@status.net>
Thu, 5 Aug 2010 17:56:49 +0000 (10:56 -0700)
committerBrion Vibber <brion@status.net>
Thu, 5 Aug 2010 17:56:49 +0000 (10:56 -0700)
actions/apiaccountupdateprofilecolors.php
actions/apimediaupload.php
actions/apistatusesupdate.php
actions/apitimelinegroup.php
classes/Notice.php
lib/apiaction.php
lib/noticelist.php

index 3cac829749679353ec4fc608a2ee9894367698da..c666f9d7592e6deea13a1d49b07ce70316e7c793 100644 (file)
@@ -22,7 +22,7 @@
  * @category  API
  * @package   StatusNet
  * @author    Zach Copley <zach@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009-2010 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -131,7 +131,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
             try {
                 $this->setColors($design);
             } catch (WebColorException $e) {
-                $this->clientError($e->getMessage());
+                $this->clientError($e->getMessage(), 400, $this->format);
                 return false;
             }
 
@@ -153,7 +153,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
             try {
                 $this->setColors($design);
             } catch (WebColorException $e) {
-                $this->clientError($e->getMessage());
+                $this->clientError($e->getMessage(), 400, $this->format);
                 return false;
             }
 
index ec316edc8d78b1c50d5573db9a10bad8ac9707d0..7aa88c186bcc58c3592393e6d90bda8f7596feaf 100644 (file)
@@ -88,15 +88,15 @@ class ApiMediaUploadAction extends ApiAuthAction
 
         try {
             $upload = MediaFile::fromUpload('media', $this->auth_user);
-        } catch (ClientException $ce) {
-            $this->clientError($ce->getMessage());
+        } catch (Exception $e) {
+            $this->clientError($e->getMessage(), $e->getCode());
             return;
         }
 
         if (isset($upload)) {
             $this->showResponse($upload);
         } else {
-            $this->clientError('Upload failed.');
+            $this->clientError(_('Upload failed.'));
             return;
         }
     }
index d65a068f50734250bef6d1167b5765fab5e7333f..fa3f611c0a8a59a797691de9087a5211da6be2ee 100644 (file)
@@ -196,7 +196,8 @@ class ApiStatusesUpdateAction extends ApiAuthAction
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
             $this->clientError(
                 _('This method requires a POST.'),
-                400, $this->format
+                400,
+                $this->format
             );
             return;
         }
@@ -217,7 +218,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
 
         if (empty($this->status)) {
             $this->clientError(
-                'Client must provide a \'status\' parameter with a value.',
+                _('Client must provide a \'status\' parameter with a value.'),
                 400,
                 $this->format
             );
@@ -291,8 +292,8 @@ class ApiStatusesUpdateAction extends ApiAuthAction
 
             try {
                 $upload = MediaFile::fromUpload('media', $this->auth_user);
-            } catch (ClientException $ce) {
-                $this->clientError($ce->getMessage());
+            } catch (Exception $e) {
+                $this->clientError($e->getMessage(), $e->getCode(), $this->format);
                 return;
             }
 
@@ -305,7 +306,11 @@ class ApiStatusesUpdateAction extends ApiAuthAction
                         'Max notice size is %d chars, ' .
                         'including attachment URL.'
                     );
-                    $this->clientError(sprintf($msg, Notice::maxContent()));
+                    $this->clientError(
+                        sprintf($msg, Notice::maxContent()),
+                        400,
+                        $this->format
+                    );
                 }
             }
 
@@ -332,7 +337,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
                     $options
                 );
             } catch (Exception $e) {
-                $this->clientError($e->getMessage());
+                $this->clientError($e->getMessage(), $e->getCode(), $this->format);
                 return;
             }
 
index c4a6a18d249aced19214c2748c9ba24b57d5c020..7a40fd808430b456aaaf5e1f68e586963228a694 100644 (file)
@@ -25,7 +25,7 @@
  * @author    Evan Prodromou <evan@status.net>
  * @author    Jeffery To <jeffery.to@gmail.com>
  * @author    Zach Copley <zach@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009-2010 StatusNet, Inc.
  * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
@@ -138,7 +138,9 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
                 $this->raw($atom->getString());
             } catch (Atom10FeedException $e) {
                 $this->serverError(
-                    'Could not generate feed for group - ' . $e->getMessage()
+                    'Could not generate feed for group - ' . $e->getMessage(),
+                   400,
+                   $this->format
                 );
                 return;
             }
index 8552248bad2c4cc3dfea6290803a4b653733f1f9..36943be84b044f7a57c2e0626cf42dabc2af9035 100644 (file)
@@ -275,7 +275,7 @@ class Notice extends Memcached_DataObject
 
         if (!$profile->hasRight(Right::NEWNOTICE)) {
             common_log(LOG_WARNING, "Attempted post from user disallowed to post: " . $profile->nickname);
-            throw new ClientException(_('You are banned from posting notices on this site.'));
+            throw new ClientException(_('You are banned from posting notices on this site.'), 403);
         }
 
         $notice = new Notice();
index 7868ecab157c178654fdd81345e2c0808daadd37..479a86ad8046f8a324fb39b2798a47b3cca1de14 100644 (file)
@@ -27,7 +27,7 @@
  * @author    Jeffery To <jeffery.to@gmail.com>
  * @author    Toby Inkster <mail@tobyinkster.co.uk>
  * @author    Zach Copley <zach@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009-2010 StatusNet, Inc.
  * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
index 17adf3a49cdef86043c0c44b3970b9ed9143ecbc..252e1ca9002f9ad01a7d6ca89c0f11427781d0db 100644 (file)
@@ -499,7 +499,7 @@ class NoticeListItem extends Widget
         $ns = $this->notice->getSource();
 
         if ($ns) {
-            $source_name = _($ns->code);
+            $source_name = (empty($ns->name)) ? _($ns->code) : _($ns->name);
             $this->out->text(' ');
             $this->out->elementStart('span', 'source');
             $this->out->text(_('from'));