From fd530a892fd969f8938d8f7300d348846e684d2f Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 4 Aug 2010 12:30:43 -0700 Subject: Fix for source attribution on notices; it was displaying the code instead of the source name sometimes. --- lib/noticelist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/noticelist.php b/lib/noticelist.php index 17adf3a49..252e1ca90 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -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')); -- cgit v1.2.3-54-g00ecf From ebd2fc2f7cb799cc190b2d4a77d8d0057a8854c0 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 6 Aug 2010 10:14:07 -0700 Subject: Partial fix for ticket #2489 -- problems with SNI SSL virtual host certificate validation. Two prongs here: * We attempt to enable SNI on the SSL stream context with the appropriate hostname... This requires PHP 5.3.2 and OpenSSL that supports the TLS extensions. Unfortunately this doesn't seem to be working in my testing. * If set $config['http']['curl'] = true, we'll use the CURL backend if available. In my testing on Ubuntu 10.04, this works. No guarantees on other systems. I'm not enabling CURL mode by default just yet; want to make sure there's no other surprises. --- lib/default.php | 3 ++- lib/httpclient.php | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/default.php b/lib/default.php index dcf225d1f..45a4560ff 100644 --- a/lib/default.php +++ b/lib/default.php @@ -315,6 +315,7 @@ $default = 'members' => true, 'peopletag' => true), 'http' => // HTTP client settings when contacting other sites - array('ssl_cafile' => false // To enable SSL cert validation, point to a CA bundle (eg '/usr/lib/ssl/certs/ca-certificates.crt') + array('ssl_cafile' => false, // To enable SSL cert validation, point to a CA bundle (eg '/usr/lib/ssl/certs/ca-certificates.crt') + 'curl' => false, // Use CURL backend for HTTP fetches if available. (If not, PHP's socket streams will be used.) ), ); diff --git a/lib/httpclient.php b/lib/httpclient.php index b69f718e5..514a5afeb 100644 --- a/lib/httpclient.php +++ b/lib/httpclient.php @@ -145,6 +145,10 @@ class HTTPClient extends HTTP_Request2 $this->config['ssl_verify_peer'] = false; } + if (common_config('http', 'curl') && extension_loaded('curl')) { + $this->config['adapter'] = 'HTTP_Request2_Adapter_Curl'; + } + parent::__construct($url, $method, $config); $this->setHeader('User-Agent', $this->userAgent()); } @@ -204,6 +208,15 @@ class HTTPClient extends HTTP_Request2 protected function doRequest($url, $method, $headers) { $this->setUrl($url); + + // Workaround for HTTP_Request2 not setting up SNI in socket contexts; + // This fixes cert validation for SSL virtual hosts using SNI. + // Requires PHP 5.3.2 or later and OpenSSL with SNI support. + if ($this->url->getScheme() == 'https' && defined('OPENSSL_TLSEXT_SERVER_NAME')) { + $this->config['ssl_SNI_enabled'] = true; + $this->config['ssl_SNI_server_name'] = $this->url->getHost(); + } + $this->setMethod($method); if ($headers) { foreach ($headers as $header) { -- cgit v1.2.3-54-g00ecf From 09dee24cbeadfb1fef797d38265e2ece09266bb0 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 8 Aug 2010 21:13:21 +0200 Subject: Add two i18n related FIXMEs. --- lib/mailbox.php | 1 + lib/noticelist.php | 1 + 2 files changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/mailbox.php b/lib/mailbox.php index 90a58b4c4..2b00f5ffd 100644 --- a/lib/mailbox.php +++ b/lib/mailbox.php @@ -224,6 +224,7 @@ class MailboxAction extends CurrentUserDesignAction if ($message->source) { $this->elementStart('span', 'source'); + // FIXME: bad i18n. Device should be a parameter (from %s). $this->text(_('from')); $this->element('span', 'device', $this->showSource($message->source)); $this->elementEnd('span'); diff --git a/lib/noticelist.php b/lib/noticelist.php index 252e1ca90..dbc5bfb51 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -502,6 +502,7 @@ class NoticeListItem extends Widget $source_name = (empty($ns->name)) ? _($ns->code) : _($ns->name); $this->out->text(' '); $this->out->elementStart('span', 'source'); + // FIXME: probably i18n issue. If "from" is followed by text, that should be a parameter to "from" (from %s). $this->out->text(_('from')); $this->out->text(' '); -- cgit v1.2.3-54-g00ecf From 6a2659ed67577b3f33c5c4d55067744a4b812a06 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 10 Aug 2010 11:45:34 -0700 Subject: Workaround for index setup on SubMirror until I'm done w/ arbitrary index support for Schema setup. --- lib/mysqlschema.php | 2 +- plugins/SubMirror/SubMirrorPlugin.php | 3 +++ plugins/SubMirror/classes/SubMirror.php | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/mysqlschema.php b/lib/mysqlschema.php index 464c718f9..f9552c1dc 100644 --- a/lib/mysqlschema.php +++ b/lib/mysqlschema.php @@ -333,7 +333,7 @@ class MysqlSchema extends Schema } if (empty($name)) { - $name = "$table_".implode("_", $columnNames)."_idx"; + $name = "{$table}_".implode("_", $columnNames)."_idx"; } $res = $this->conn->query("ALTER TABLE $table ". diff --git a/plugins/SubMirror/SubMirrorPlugin.php b/plugins/SubMirror/SubMirrorPlugin.php index 7289e7793..80c6c5a88 100644 --- a/plugins/SubMirror/SubMirrorPlugin.php +++ b/plugins/SubMirror/SubMirrorPlugin.php @@ -120,6 +120,9 @@ class SubMirrorPlugin extends Plugin { $schema = Schema::get(); $schema->ensureTable('submirror', SubMirror::schemaDef()); + + // @hack until key definition support is merged + SubMirror::fixIndexes($schema); return true; } diff --git a/plugins/SubMirror/classes/SubMirror.php b/plugins/SubMirror/classes/SubMirror.php index 4e7e005db..bd8fc80a5 100644 --- a/plugins/SubMirror/classes/SubMirror.php +++ b/plugins/SubMirror/classes/SubMirror.php @@ -76,6 +76,22 @@ class SubMirror extends Memcached_DataObject null, false)); } + /** + * Temporary hack to set up the compound index, since we can't do + * it yet through regular Schema interface. (Coming for 1.0...) + * + * @param Schema $schema + * @return void + */ + static function fixIndexes($schema) + { + try { + $schema->createIndex('submirror', array('subscribed', 'subscriber')); + } catch (Exception $e) { + common_log(LOG_ERR, __METHOD__ . ': ' . $e->getMessage()); + } + } + /** * return key definitions for DB_DataObject * -- cgit v1.2.3-54-g00ecf From 08fc6053ec55e911b842fd05dafc5e0c99c4e992 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 10 Aug 2010 13:36:38 -0700 Subject: Fix for regression with OStatus mention processing (duplicated new and old style lead to trying to save a reply entry twice). --- classes/Notice.php | 7 ++++--- lib/activitycontext.php | 6 ++++-- plugins/OStatus/classes/Ostatus_profile.php | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/classes/Notice.php b/classes/Notice.php index 4646fc6ab..0eeebfadf 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -485,7 +485,7 @@ class Notice extends Memcached_DataObject function saveKnownUrls($urls) { // @fixme validation? - foreach ($urls as $url) { + foreach (array_unique($urls) as $url) { File::processNew($url, $this->id); } } @@ -893,7 +893,7 @@ class Notice extends Memcached_DataObject } $groups = array(); - foreach ($group_ids as $id) { + foreach (array_unique($group_ids) as $id) { $group = User_group::staticGet('id', $id); if ($group) { common_log(LOG_ERR, "Local delivery to group id $id, $group->nickname"); @@ -1016,7 +1016,7 @@ class Notice extends Memcached_DataObject } $sender = Profile::staticGet($this->profile_id); - foreach ($uris as $uri) { + foreach (array_unique($uris) as $uri) { $user = User::staticGet('uri', $uri); @@ -1029,6 +1029,7 @@ class Notice extends Memcached_DataObject $reply->notice_id = $this->id; $reply->profile_id = $user->id; + common_log(LOG_INFO, __METHOD__ . ": saving reply: notice $this->id to profile $user->id"); $id = $reply->insert(); } diff --git a/lib/activitycontext.php b/lib/activitycontext.php index 5afbb7fd2..09a457924 100644 --- a/lib/activitycontext.php +++ b/lib/activitycontext.php @@ -71,6 +71,7 @@ class ActivityContext $links = $element->getElementsByTagNameNS(ActivityUtils::ATOM, ActivityUtils::LINK); + $attention = array(); for ($i = 0; $i < $links->length; $i++) { $link = $links->item($i); @@ -80,11 +81,12 @@ class ActivityContext // XXX: Deprecate this in favour of "mentioned" from Salmon spec // http://salmon-protocol.googlecode.com/svn/trunk/draft-panzer-salmon-00.html#SALR if ($linkRel == self::ATTENTION) { - $this->attention[] = $link->getAttribute(self::HREF); + $attention[] = $link->getAttribute(self::HREF); } elseif ($linkRel == self::MENTIONED) { - $this->attention[] = $link->getAttribute(self::HREF); + $attention[] = $link->getAttribute(self::HREF); } } + $this->attention = array_unique($attention); } /** diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 77a5e22cc..8f8eb773f 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -681,7 +681,7 @@ class Ostatus_profile extends Memcached_DataObject common_log(LOG_DEBUG, "Original reply recipients: " . implode(', ', $attention_uris)); $groups = array(); $replies = array(); - foreach ($attention_uris as $recipient) { + foreach (array_unique($attention_uris) as $recipient) { // Is the recipient a local user? $user = User::staticGet('uri', $recipient); if ($user) { -- cgit v1.2.3-54-g00ecf From 5c210f724a865830d0c39feba8386f495b18ee4f Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 10 Aug 2010 16:28:33 -0700 Subject: update version for 0.9.4beta1 --- lib/common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/common.php b/lib/common.php index 817434b97..ddd06bf92 100644 --- a/lib/common.php +++ b/lib/common.php @@ -22,10 +22,10 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } //exit with 200 response, if this is checking fancy from the installer if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') { exit; } -define('STATUSNET_VERSION', '0.9.3'); +define('STATUSNET_VERSION', '0.9.4beta1'); define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility -define('STATUSNET_CODENAME', 'Half a World Away'); +define('STATUSNET_CODENAME', 'Orange Crush'); define('AVATAR_PROFILE_SIZE', 96); define('AVATAR_STREAM_SIZE', 48); -- cgit v1.2.3-54-g00ecf From 19e6b84050ffc855183ec6e6f022e5d1190b3425 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 10 Aug 2010 17:22:26 -0700 Subject: StatusNet_network staticGet lookup fix --- lib/statusnet.php | 2 +- lib/stompqueuemanager.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/statusnet.php b/lib/statusnet.php index 2aa73486e..7212a4a47 100644 --- a/lib/statusnet.php +++ b/lib/statusnet.php @@ -141,7 +141,7 @@ class StatusNet return true; } - $sn = Status_network::staticGet($nickname); + $sn = Status_network::staticGet('nickname', $nickname); if (empty($sn)) { return false; throw new Exception("No such site nickname '$nickname'"); diff --git a/lib/stompqueuemanager.php b/lib/stompqueuemanager.php index 91faa8c36..fc98c77d4 100644 --- a/lib/stompqueuemanager.php +++ b/lib/stompqueuemanager.php @@ -649,7 +649,7 @@ class StompQueueManager extends QueueManager */ protected function updateSiteConfig($nickname) { - $sn = Status_network::staticGet($nickname); + $sn = Status_network::staticGet('nickname', $nickname); if ($sn) { $this->switchSite($nickname); if (!in_array($nickname, $this->sites)) { -- cgit v1.2.3-54-g00ecf From db46d73a5f3cac322c4ca2ef4e4c863a0346bb7e Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Wed, 11 Aug 2010 12:46:54 +0200 Subject: Add dummy support for Esperanto. --- lib/language.php | 1 + locale/eo/LC_MESSAGES/statusnet.po | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 locale/eo/LC_MESSAGES/statusnet.po (limited to 'lib') diff --git a/lib/language.php b/lib/language.php index d93e4e0ad..80d256807 100644 --- a/lib/language.php +++ b/lib/language.php @@ -310,6 +310,7 @@ function get_all_languages() { 'da' => array('q' => 0.8, 'lang' => 'da', 'name' => 'Danish', 'direction' => 'ltr'), 'de' => array('q' => 0.8, 'lang' => 'de', 'name' => 'German', 'direction' => 'ltr'), 'el' => array('q' => 0.1, 'lang' => 'el', 'name' => 'Greek', 'direction' => 'ltr'), + 'eo' => array('q' => 0.8, 'lang' => 'eo', 'name' => 'Esperanto', 'direction' => 'ltr'), 'en-us' => array('q' => 1, 'lang' => 'en', 'name' => 'English (US)', 'direction' => 'ltr'), 'en-gb' => array('q' => 1, 'lang' => 'en_GB', 'name' => 'English (British)', 'direction' => 'ltr'), 'en' => array('q' => 1, 'lang' => 'en', 'name' => 'English (US)', 'direction' => 'ltr'), diff --git a/locale/eo/LC_MESSAGES/statusnet.po b/locale/eo/LC_MESSAGES/statusnet.po new file mode 100644 index 000000000..9fa7115cb --- /dev/null +++ b/locale/eo/LC_MESSAGES/statusnet.po @@ -0,0 +1,24 @@ +# Translation of StatusNet to Esperanto +# -- +# This file is distributed under the same license as the StatusNet package. +# +msgid "" +msgstr "" +"Project-Id-Version: StatusNet\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-08-11 10:11+0000\n" +"PO-Revision-Date: 2010-08-11 10:12:58+0000\n" +"Language-Team: Esperanto\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: MediaWiki 1.17alpha (r70848); Translate extension (2010-07-21)\n" +"X-Translation-Project: translatewiki.net at http://translatewiki.net\n" +"X-Language-Code: eo\n" +"X-Message-Group: out-statusnet\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. TRANS: Page title +#. TRANS: Menu item for site administration +#: actions/accessadminpanel.php:55 lib/adminpanelaction.php:376 +msgid "Access" +msgstr "" -- cgit v1.2.3-54-g00ecf From d15a41c96e97428843cc731cc88b63be9f57c489 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 11 Aug 2010 10:32:52 -0700 Subject: 0.9.4beta2 update some notes in README, note the fix from beta1 --- README | 37 +++++++++++++++++++++---------------- lib/common.php | 2 +- 2 files changed, 22 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/README b/README index 9e59ccb44..c20244354 100644 --- a/README +++ b/README @@ -2,8 +2,8 @@ README ------ -StatusNet 0.9.3 ("Half a World Away") -29 June 2010 +StatusNet 0.9.4beta2 +11 August 2010 This is the README file for StatusNet, the Open Source microblogging platform. It includes installation instructions, descriptions of @@ -77,27 +77,31 @@ for additional terms. New this version ================ -This is a minor bug and feature release since version 0.9.2 released on -4 May 2010. +This is a security, bug and feature release since version 0.9.3 released on +29 June 2010. For best compatibility with client software and site federation, and a lot of bug fixes, it is highly recommended that all public sites upgrade to the new version. +Changes from 0.9.4beta1: +- fix for daemon config switching on multi-site setup + Notable changes this version: -- Enhanced API output to aid StatusNet-specific clients +- OpenID and OAuth libraries patched for potential timing attack +- OStatus feed i/o updated for Activity Streams +- Correctness fixes on XRD, other discovery bits +- Support for contacting SNI-based SSL virtual hosts when SSL + certificate verification is enabled (requires PHP 5.3.2+ or + enabling CURL backend with $config['http']['curl'] = true) +- Experimental SubMirror plugin +- Multi-site status_network table mode has been tweaked to support + multiple tags better - Many updates to user interface translation from TranslateWiki -- OStatus now works subscribing to SSL-protected sites by default -- OpenID now works on PHP 5.3, supports closer site integration. -- Numerous API and FOAF output fixes. -- Fixes to Facebook integration for FB API behavior changes -- PostgreSQL support updates -- Initial version of a custom theme uploader (disabled by default) -- LDAP auth plugins cleanup - Many other bugfixes -A full changelog is available at http://status.net/wiki/StatusNet_0.9.3. +A full changelog is available at http://status.net/wiki/StatusNet_0.9.4. Prerequisites ============= @@ -125,7 +129,6 @@ Your PHP installation must include the following PHP extensions: - MySQL. For accessing the database. - GD. For scaling down avatar images. - mbstring. For handling Unicode (UTF-8) encoded strings. -- gettext. For multiple languages. Default on many PHP installs. For some functionality, you will also need the following extensions: @@ -140,6 +143,8 @@ For some functionality, you will also need the following extensions: Sphinx server to serve the search queries. - bcmath or gmp. For Salmon signatures (part of OStatus). Needed if you have OStatus configured. +- gettext. For multiple languages. Default on many PHP installs; + will be emulated if not present. You will almost definitely get 2-3 times better performance from your site if you install a PHP bytecode cache/accelerator. Some well-known @@ -209,7 +214,7 @@ especially if you've previously installed PHP/MySQL packages. 1. Unpack the tarball you downloaded on your Web server. Usually a command like this will work: - tar zxf statusnet-0.9.2.tar.gz + tar zxf statusnet-0.9.4.tar.gz ...which will make a statusnet-0.9.2 subdirectory in your current directory. (If you don't have shell access on your Web server, you @@ -219,7 +224,7 @@ especially if you've previously installed PHP/MySQL packages. 2. Move the tarball to a directory of your choosing in your Web root directory. Usually something like this will work: - mv statusnet-0.9.2 /var/www/statusnet + mv statusnet-0.9.4 /var/www/statusnet This will make your StatusNet instance available in the statusnet path of your server, like "http://example.net/statusnet". "microblog" or diff --git a/lib/common.php b/lib/common.php index ddd06bf92..897d08b77 100644 --- a/lib/common.php +++ b/lib/common.php @@ -22,7 +22,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } //exit with 200 response, if this is checking fancy from the installer if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') { exit; } -define('STATUSNET_VERSION', '0.9.4beta1'); +define('STATUSNET_VERSION', '0.9.4beta2'); define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility define('STATUSNET_CODENAME', 'Orange Crush'); -- cgit v1.2.3-54-g00ecf From 111fc33e1aa521e8ad33fa333654d09f45a1a24e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 11 Aug 2010 18:53:34 -0700 Subject: Output "web" instead of gettext translation file metadata when notice.source is empty --- lib/noticelist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/noticelist.php b/lib/noticelist.php index dbc5bfb51..529d6a3f9 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -499,7 +499,7 @@ class NoticeListItem extends Widget $ns = $this->notice->getSource(); if ($ns) { - $source_name = (empty($ns->name)) ? _($ns->code) : _($ns->name); + $source_name = (empty($ns->name)) ? ($ns->code ? _($ns->code) : _('web')) : _($ns->name); $this->out->text(' '); $this->out->elementStart('span', 'source'); // FIXME: probably i18n issue. If "from" is followed by text, that should be a parameter to "from" (from %s). -- cgit v1.2.3-54-g00ecf From f7d599f8eac0a9e3d47c3ff2f074bed0b6e9c124 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 12 Aug 2010 15:19:47 -0700 Subject: Fix for ticket 2513: "Can't linkify" error when some links are shortened When bogus SSL sites etc were hit through a shortening redirect, sometimes link resolution kinda blew up and the user would get a "Can't linkify" error, aborting their post. Now catching this case and just passing through the URL without attempting to resolve it. Could benefit from an overall scrubbing of the freaky link/attachment code though...! :) http://status.net/open-source/issues/2513 --- classes/File_redirection.php | 8 ++++++++ lib/util.php | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/classes/File_redirection.php b/classes/File_redirection.php index f128b3e07..51b8be3b0 100644 --- a/classes/File_redirection.php +++ b/classes/File_redirection.php @@ -210,6 +210,14 @@ class File_redirection extends Memcached_DataObject } else if (is_string($redir_data)) { // The file is a known redirect target. $file = File::staticGet('url', $redir_data); + if (empty($file)) { + // @fixme should we save a new one? + // this case was triggering sometimes for redirects + // with unresolvable targets; found while fixing + // "can't linkify" bugs with shortened links to + // SSL sites with cert issues. + return null; + } $file_id = $file->id; } } else { diff --git a/lib/util.php b/lib/util.php index 9f62097d5..66600c766 100644 --- a/lib/util.php +++ b/lib/util.php @@ -830,7 +830,10 @@ function common_linkify($url) { } elseif (is_string($longurl_data)) { $longurl = $longurl_data; } else { - throw new ServerException("Can't linkify url '$url'"); + // Unable to reach the server to verify contents, etc + // Just pass the link on through for now. + common_log(LOG_ERR, "Can't linkify url '$url'"); + $longurl = $url; } } $attrs = array('href' => $canon, 'title' => $longurl, 'rel' => 'external'); -- cgit v1.2.3-54-g00ecf