From cef302cacdf86d1c82f7937d2901f9254c88bf8a Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 28 May 2010 06:22:12 +0000 Subject: [PATCH 1/2] Bugfix: api/statuses/destroy.:format was outputting deleted notice twice, causing parsers to fail. --- actions/apistatusesdestroy.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/actions/apistatusesdestroy.php b/actions/apistatusesdestroy.php index f7d52f0208..0bfcdd060e 100644 --- a/actions/apistatusesdestroy.php +++ b/actions/apistatusesdestroy.php @@ -57,7 +57,7 @@ require_once INSTALLDIR . '/lib/apiauth.php'; class ApiStatusesDestroyAction extends ApiAuthAction { - var $status = null; + var $status = null; /** * Take arguments for running @@ -120,18 +120,11 @@ class ApiStatusesDestroyAction extends ApiAuthAction $replies->get('notice_id', $this->notice_id); $replies->delete(); $this->notice->delete(); - - if ($this->format == 'xml') { - $this->showSingleXmlStatus($this->notice); - } elseif ($this->format == 'json') { - $this->show_single_json_status($this->notice); - } + $this->showNotice(); } else { $this->clientError(_('You may not delete another user\'s status.'), 403, $this->format); } - - $this->showNotice(); } /** From f4539b52ad2c25a87e906c68d955ef921678e18c Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 28 May 2010 16:03:09 -0700 Subject: [PATCH 2/2] Ticket 2329 followup: my clever 'let it use the default' was foiled by PHP gettext module not quite exposing a compatible interface as the backend gettext library. (Most funcs squash null domain parameter into '' empty string, which isn't interpreted as 'use the current default'.) --- lib/language.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/language.php b/lib/language.php index 3846b8f358..cb12cca692 100644 --- a/lib/language.php +++ b/lib/language.php @@ -61,7 +61,7 @@ if (!function_exists('dpgettext')) { * Not currently exposed in PHP's gettext module; implemented to be compat * with gettext.h's macros. * - * @param string $domain domain identifier, or null for default domain + * @param string $domain domain identifier * @param string $context context identifier, should be some key like "menu|file" * @param string $msgid English source text * @return string original or translated message @@ -106,7 +106,7 @@ if (!function_exists('dnpgettext')) { * Not currently exposed in PHP's gettext module; implemented to be compat * with gettext.h's macros. * - * @param string $domain domain identifier, or null for default domain + * @param string $domain domain identifier * @param string $context context identifier, should be some key like "menu|file" * @param string $msg singular English source text * @param string $plural plural English source text @@ -180,7 +180,11 @@ function _m($msg/*, ...*/) } /** - * Looks for which plugin we've been called from to set the gettext domain. + * Looks for which plugin we've been called from to set the gettext domain; + * if not in a plugin subdirectory, we'll use the default 'statusnet'. + * + * Note: we can't return null for default domain since most of the PHP gettext + * wrapper functions turn null into "" before passing to the backend library. * * @param array $backtrace debug_backtrace() output * @return string @@ -207,8 +211,8 @@ function _mdomain($backtrace) } $plug = strpos($path, '/plugins/'); if ($plug === false) { - // We're not in a plugin; return null for the default domain. - return null; + // We're not in a plugin; return default domain. + return 'statusnet'; } else { $cut = $plug + 9; $cut2 = strpos($path, '/', $cut); @@ -217,7 +221,7 @@ function _mdomain($backtrace) } else { // We might be running directly from the plugins dir? // If so, there's no place to store locale info. - return null; + return 'statusnet'; } } }