summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/activitycontext.php9
-rw-r--r--lib/common.php4
-rw-r--r--lib/default.php3
-rw-r--r--lib/httpclient.php13
-rw-r--r--lib/installer.php2
-rw-r--r--lib/language.php7
-rw-r--r--lib/mailbox.php1
-rw-r--r--lib/mysqlschema.php17
-rw-r--r--lib/noticelist.php3
-rw-r--r--lib/schema.php37
-rw-r--r--lib/util.php10
11 files changed, 61 insertions, 45 deletions
diff --git a/lib/activitycontext.php b/lib/activitycontext.php
index 2df7613f7..09a457924 100644
--- a/lib/activitycontext.php
+++ b/lib/activitycontext.php
@@ -51,6 +51,7 @@ class ActivityContext
const POINT = 'point';
const ATTENTION = 'ostatus:attention';
+ const MENTIONED = 'mentioned';
const CONVERSATION = 'ostatus:conversation';
function __construct($element)
@@ -70,16 +71,22 @@ class ActivityContext
$links = $element->getElementsByTagNameNS(ActivityUtils::ATOM, ActivityUtils::LINK);
+ $attention = array();
for ($i = 0; $i < $links->length; $i++) {
$link = $links->item($i);
$linkRel = $link->getAttribute(ActivityUtils::REL);
+ // 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) {
+ $attention[] = $link->getAttribute(self::HREF);
}
}
+ $this->attention = array_unique($attention);
}
/**
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);
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) {
diff --git a/lib/installer.php b/lib/installer.php
index bd9d69cd4..ff2bed140 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -91,7 +91,7 @@ abstract class Installer
}
if (version_compare(PHP_VERSION, '5.2.3', '<')) {
- $errors[] = 'Require PHP version 5.2.3 or greater.';
+ $this->warning('Require PHP version 5.2.3 or greater.');
$pass = false;
}
diff --git a/lib/language.php b/lib/language.php
index 1805707ad..d93e4e0ad 100644
--- a/lib/language.php
+++ b/lib/language.php
@@ -213,16 +213,16 @@ function _mdomain($backtrace)
$plug = strpos($path, '/plugins/');
if ($plug === false) {
// We're not in a plugin; return default domain.
- return 'statusnet';
+ $final = 'statusnet';
} else {
$cut = $plug + 9;
$cut2 = strpos($path, '/', $cut);
if ($cut2) {
- $cached[$path] = substr($path, $cut, $cut2 - $cut);
+ $final = substr($path, $cut, $cut2 - $cut);
} else {
// We might be running directly from the plugins dir?
// If so, there's no place to store locale info.
- return 'statusnet';
+ $final = 'statusnet';
}
}
$cached[$path] = $final;
@@ -307,6 +307,7 @@ function get_all_languages() {
'br' => array('q' => 0.8, 'lang' => 'br', 'name' => 'Breton', 'direction' => 'ltr'),
'ca' => array('q' => 0.5, 'lang' => 'ca', 'name' => 'Catalan', 'direction' => 'ltr'),
'cs' => array('q' => 0.5, 'lang' => 'cs', 'name' => 'Czech', 'direction' => 'ltr'),
+ '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'),
'en-us' => array('q' => 1, 'lang' => 'en', 'name' => 'English (US)', 'direction' => 'ltr'),
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/mysqlschema.php b/lib/mysqlschema.php
index 455695366..f9552c1dc 100644
--- a/lib/mysqlschema.php
+++ b/lib/mysqlschema.php
@@ -50,21 +50,6 @@ class MysqlSchema extends Schema
static $_single = null;
protected $conn = null;
- /**
- * Constructor. Only run once for singleton object.
- */
-
- protected function __construct()
- {
- // XXX: there should be an easier way to do this.
- $user = new User();
-
- $this->conn = $user->getDatabaseConnection();
-
- $user->free();
-
- unset($user);
- }
/**
* Main public entry point. Use this to get
@@ -348,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/lib/noticelist.php b/lib/noticelist.php
index 17adf3a49..dbc5bfb51 100644
--- a/lib/noticelist.php
+++ b/lib/noticelist.php
@@ -499,9 +499,10 @@ 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');
+ // 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(' ');
diff --git a/lib/schema.php b/lib/schema.php
index 1503c96d4..e5def514e 100644
--- a/lib/schema.php
+++ b/lib/schema.php
@@ -47,40 +47,47 @@ if (!defined('STATUSNET')) {
class Schema
{
- static $_single = null;
+ static $_static = null;
protected $conn = null;
/**
* Constructor. Only run once for singleton object.
*/
- protected function __construct()
+ protected function __construct($conn = null)
{
- // XXX: there should be an easier way to do this.
- $user = new User();
-
- $this->conn = $user->getDatabaseConnection();
-
- $user->free();
+ if (is_null($conn)) {
+ // XXX: there should be an easier way to do this.
+ $user = new User();
+ $conn = $user->getDatabaseConnection();
+ $user->free();
+ unset($user);
+ }
- unset($user);
+ $this->conn = $conn;
}
/**
* Main public entry point. Use this to get
- * the singleton object.
+ * the schema object.
*
- * @return Schema the (single) Schema object
+ * @return Schema the Schema object for the connection
*/
- static function get()
+ static function get($conn = null)
{
+ if (is_null($conn)) {
+ $key = 'default';
+ } else {
+ $key = md5(serialize($conn->dsn));
+ }
+
$type = common_config('db', 'type');
- if (empty(self::$_single)) {
+ if (empty(self::$_static[$key])) {
$schemaClass = ucfirst($type).'Schema';
- self::$_single = new $schemaClass();
+ self::$_static[$key] = new $schemaClass($conn);
}
- return self::$_single;
+ return self::$_static[$key];
}
/**
diff --git a/lib/util.php b/lib/util.php
index 2a90b56a9..9f62097d5 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -88,8 +88,8 @@ function common_init_language()
// don't do the job. en_US.UTF-8 should be there most of the
// time, but not guaranteed.
$ok = common_init_locale("en_US");
- if (!$ok) {
- // Try to find a complete, working locale...
+ if (!$ok && strtolower(substr(PHP_OS, 0, 3)) != 'win') {
+ // Try to find a complete, working locale on Unix/Linux...
// @fixme shelling out feels awfully inefficient
// but I don't think there's a more standard way.
$all = `locale -a`;
@@ -101,9 +101,9 @@ function common_init_language()
}
}
}
- if (!$ok) {
- common_log(LOG_ERR, "Unable to find a UTF-8 locale on this system; UI translations may not work.");
- }
+ }
+ if (!$ok) {
+ common_log(LOG_ERR, "Unable to find a UTF-8 locale on this system; UI translations may not work.");
}
$locale_set = common_init_locale($language);
}