summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/activity.php11
-rw-r--r--lib/activityobject.php25
-rw-r--r--lib/apiauth.php2
-rw-r--r--lib/attachmentlist.php2
-rw-r--r--lib/common.php4
-rw-r--r--lib/default.php1
-rw-r--r--lib/httpclient.php21
-rw-r--r--lib/noticeform.php14
-rw-r--r--lib/util.php2
9 files changed, 46 insertions, 36 deletions
diff --git a/lib/activity.php b/lib/activity.php
index f9192c6b8..5d6230c6d 100644
--- a/lib/activity.php
+++ b/lib/activity.php
@@ -179,6 +179,17 @@ class Activity
$this->actor = new ActivityObject($actorEl);
+ // Cliqset has bad actor IDs (just nickname of user). We
+ // work around it by getting the author data and using its
+ // id instead
+
+ if (!preg_match('/^\w+:/', $this->actor->id)) {
+ $authorEl = ActivityUtils::child($entry, 'author');
+ if (!empty($authorEl)) {
+ $authorObj = new ActivityObject($authorEl);
+ $this->actor->id = $authorObj->id;
+ }
+ }
} else if (!empty($feed) &&
$subjectEl = $this->_child($feed, self::SUBJECT)) {
diff --git a/lib/activityobject.php b/lib/activityobject.php
index 34d1b9170..677a48197 100644
--- a/lib/activityobject.php
+++ b/lib/activityobject.php
@@ -177,10 +177,7 @@ class ActivityObject
$this->type = self::PERSON; // XXX: is this fair?
$this->title = $this->_childContent($element, self::NAME);
- $id = $this->_childContent($element, self::URI);
- if (ActivityUtils::validateUri($id)) {
- $this->id = $id;
- }
+ $this->id = $this->_childContent($element, self::URI);
if (empty($this->id)) {
$email = $this->_childContent($element, self::EMAIL);
@@ -193,15 +190,6 @@ class ActivityObject
private function _fromAtomEntry($element)
{
- if ($element->localName == 'actor') {
- // Old-fashioned <activity:actor>...
- // First pull anything from <author>, then we'll add on top.
- $author = ActivityUtils::child($element->parentNode, 'author');
- if ($author) {
- $this->_fromAuthor($author);
- }
- }
-
$this->type = $this->_childContent($element, Activity::OBJECTTYPE,
Activity::SPEC);
@@ -209,11 +197,6 @@ class ActivityObject
$this->type = ActivityObject::NOTE;
}
- $id = $this->_childContent($element, self::ID);
- if (ActivityUtils::validateUri($id)) {
- $this->id = $id;
- }
-
$this->summary = ActivityUtils::childHtmlContent($element, self::SUMMARY);
$this->content = ActivityUtils::getContent($element);
@@ -226,6 +209,12 @@ class ActivityObject
$this->source = $this->_getSource($element);
$this->link = ActivityUtils::getPermalink($element);
+
+ $this->id = $this->_childContent($element, self::ID);
+
+ if (empty($this->id) && !empty($this->link)) { // fallback if there's no ID
+ $this->id = $this->link;
+ }
}
// @fixme rationalize with Activity::_fromRssItem()
diff --git a/lib/apiauth.php b/lib/apiauth.php
index 17f803a1c..e78de618e 100644
--- a/lib/apiauth.php
+++ b/lib/apiauth.php
@@ -267,7 +267,7 @@ class ApiAuthAction extends ApiAction
$this->access = self::READ_WRITE;
- if (empty($this->auth_user) && $required) {
+ if (empty($this->auth_user) && ($required || isset($_SERVER['PHP_AUTH_USER']))) {
// basic authentication failed
diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php
index d29a5fa2f..43f836e15 100644
--- a/lib/attachmentlist.php
+++ b/lib/attachmentlist.php
@@ -337,7 +337,7 @@ class Attachment extends AttachmentListItem
$this->showHtmlFile($this->attachment);
break;
}
- // Fall through to default
+ // Fall through to default.
default:
$this->showFallback();
diff --git a/lib/common.php b/lib/common.php
index 334a88ffd..8d2e6b420 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.0');
+define('STATUSNET_VERSION', '0.9.1');
define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility
-define('STATUSNET_CODENAME', 'Stand');
+define('STATUSNET_CODENAME', 'Everybody Hurts');
define('AVATAR_PROFILE_SIZE', 96);
define('AVATAR_STREAM_SIZE', 48);
diff --git a/lib/default.php b/lib/default.php
index eb0cb0b64..745e8d850 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -72,6 +72,7 @@ $default =
'quote_identifiers' => false,
'type' => 'mysql',
'schemacheck' => 'runtime', // 'runtime' or 'script'
+ 'annotate_queries' => false, // true to add caller comments to queries, eg /* POST Notice::saveNew */
'log_queries' => false, // true to log all DB queries
'log_slow_queries' => 0), // if set, log queries taking over N seconds
'syslog' =>
diff --git a/lib/httpclient.php b/lib/httpclient.php
index 64a51353c..384626ae0 100644
--- a/lib/httpclient.php
+++ b/lib/httpclient.php
@@ -43,6 +43,9 @@ require_once 'HTTP/Request2/Response.php';
*
* This extends the HTTP_Request2_Response class with methods to get info
* about any followed redirects.
+ *
+ * Originally used the name 'HTTPResponse' to match earlier code, but
+ * this conflicts with a class in in the PECL HTTP extension.
*
* @category HTTP
* @package StatusNet
@@ -51,7 +54,7 @@ require_once 'HTTP/Request2/Response.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-class HTTPResponse extends HTTP_Request2_Response
+class StatusNet_HTTPResponse extends HTTP_Request2_Response
{
function __construct(HTTP_Request2_Response $response, $url, $redirects=0)
{
@@ -146,7 +149,7 @@ class HTTPClient extends HTTP_Request2
/**
* Convenience function to run a GET request.
*
- * @return HTTPResponse
+ * @return StatusNet_HTTPResponse
* @throws HTTP_Request2_Exception
*/
public function get($url, $headers=array())
@@ -157,7 +160,7 @@ class HTTPClient extends HTTP_Request2
/**
* Convenience function to run a HEAD request.
*
- * @return HTTPResponse
+ * @return StatusNet_HTTPResponse
* @throws HTTP_Request2_Exception
*/
public function head($url, $headers=array())
@@ -171,7 +174,7 @@ class HTTPClient extends HTTP_Request2
* @param string $url
* @param array $headers optional associative array of HTTP headers
* @param array $data optional associative array or blob of form data to submit
- * @return HTTPResponse
+ * @return StatusNet_HTTPResponse
* @throws HTTP_Request2_Exception
*/
public function post($url, $headers=array(), $data=array())
@@ -183,7 +186,7 @@ class HTTPClient extends HTTP_Request2
}
/**
- * @return HTTPResponse
+ * @return StatusNet_HTTPResponse
* @throws HTTP_Request2_Exception
*/
protected function doRequest($url, $method, $headers)
@@ -217,12 +220,12 @@ class HTTPClient extends HTTP_Request2
}
/**
- * Actually performs the HTTP request and returns an HTTPResponse object
- * with response body and header info.
+ * Actually performs the HTTP request and returns a
+ * StatusNet_HTTPResponse object with response body and header info.
*
* Wraps around parent send() to add logging and redirection processing.
*
- * @return HTTPResponse
+ * @return StatusNet_HTTPResponse
* @throw HTTP_Request2_Exception
*/
public function send()
@@ -265,6 +268,6 @@ class HTTPClient extends HTTP_Request2
}
break;
} while ($maxRedirs);
- return new HTTPResponse($response, $this->getUrl(), $redirs);
+ return new StatusNet_HTTPResponse($response, $this->getUrl(), $redirs);
}
}
diff --git a/lib/noticeform.php b/lib/noticeform.php
index 7278c41a9..a55839de0 100644
--- a/lib/noticeform.php
+++ b/lib/noticeform.php
@@ -189,10 +189,14 @@ class NoticeForm extends Form
}
if (common_config('attachments', 'uploads')) {
- $this->out->element('label', array('for' => 'notice_data-attach'),_('Attach'));
+ $this->out->element('label', array('id' => 'notice_data-attach-label',
+ 'class' => 'attach-label',
+ 'for' => 'notice_data-attach'),
+ _('Attach'));
$this->out->element('input', array('id' => 'notice_data-attach',
+ 'class' => 'attach',
'type' => 'file',
- 'name' => 'attach',
+ 'name' => 'attach0',
'title' => _('Attach a file')));
$this->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota'));
}
@@ -212,8 +216,10 @@ class NoticeForm extends Form
$this->out->checkbox('notice_data-geo', _('Share my location'), true);
$this->out->elementEnd('div');
$this->out->inlineScript(' var NoticeDataGeo_text = {'.
- 'ShareDisable: "'._('Do not share my location').'",'.
- 'ErrorTimeout: "'._('Sorry, retrieving your geo location is taking longer than expected, please try again later').'"'.
+ 'ShareDisable: ' .json_encode(_('Do not share my location')).','.
+ 'ErrorTimeout: ' .json_encode(_('Sorry, retrieving your geo location is taking longer than expected, please try again later')).
+ '} ; var NoticeAttachment_text = {'.
+ 'AttachFile: ' . json_encode(_('Attach a file')) .
'}');
}
diff --git a/lib/util.php b/lib/util.php
index 2add66508..a7f43b5d4 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -803,7 +803,7 @@ function common_linkify($url) {
}
if (!empty($f)) {
- if ($f->getEnclosure()) {
+ if ($f->getEnclosure() || File_oembed::staticGet('file_id',$f->id)) {
$is_attachment = true;
$attachment_id = $f->id;