From 33a85ae945e55280cd821a82748b5332fefae7b2 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 4 Aug 2014 18:33:57 +0200 Subject: [PATCH 01/17] Inline attachment layout improvement --- lib/inlineattachmentlist.php | 14 +------------- theme/base/css/display.css | 9 +++++++++ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/lib/inlineattachmentlist.php b/lib/inlineattachmentlist.php index 04fddf3b30..b68701fb31 100644 --- a/lib/inlineattachmentlist.php +++ b/lib/inlineattachmentlist.php @@ -59,20 +59,8 @@ class InlineAttachmentList extends AttachmentList class InlineAttachmentListItem extends AttachmentListItem { function showLink() { - $this->out->elementStart('a', $this->linkAttr()); + $this->out->element('a', $this->linkAttr(), $this->title()); $this->showRepresentation(); - $this->out->elementEnd('a'); - } - - /** - * Build HTML attributes for the link - * @return array - */ - function linkAttr() - { - $attr = parent::linkAttr(); - $attr['class'] = 'attachment-thumbnail'; - return $attr; } /** diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 792501e289..00bf5e5e3d 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -812,6 +812,15 @@ position:static; top: 1em; } +.notice.h-entry .attachments .inline-attachment * { + max-width: 100%; +} +.notice.h-entry .attachments .inline-attachment > a { + font-size: 0.88em; + line-height: 16px; + height: 16px; +} + #attachments { clear:both; float:left; From 17b9614ff8ec0070f6ea8c7ac7d38167f862cde5 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Tue, 5 Aug 2014 10:54:00 +0200 Subject: [PATCH 02/17] File->getEnclosure improvements (text/html is not an attachment) --- classes/File.php | 37 ++++++++++++++----------------------- lib/util.php | 9 +++++++++ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/classes/File.php b/classes/File.php index b834036405..029ff487a4 100644 --- a/classes/File.php +++ b/classes/File.php @@ -352,30 +352,21 @@ class File extends Managed_DataObject function getEnclosure(){ $enclosure = (object) array(); - $enclosure->title=$this->title; - $enclosure->url=$this->url; - $enclosure->title=$this->title; - $enclosure->date=$this->date; - $enclosure->modified=$this->modified; - $enclosure->size=$this->size; - $enclosure->mimetype=$this->mimetype; - - if (!isset($this->filename)) { - $notEnclosureMimeTypes = array(null,'text/html','application/xhtml+xml'); - $mimetype = $this->mimetype; - if($mimetype != null){ - $mimetype = strtolower($this->mimetype); - } - $semicolon = strpos($mimetype,';'); - if($semicolon){ - $mimetype = substr($mimetype,0,$semicolon); - } - if (in_array($mimetype, $notEnclosureMimeTypes)) { - Event::handle('FileEnclosureMetadata', array($this, &$enclosure)); - } + foreach (array('title', 'url', 'date', 'modified', 'size', 'mimetype') as $key) { + $enclosure->$key = $this->$key; } - if (empty($enclosure->mimetype)) { - // This means we don't know what it is, so it can't be an enclosure! + + $needMoreMetadataMimetypes = array(null, 'text/html', 'application/xhtml+xml'); + + if (!isset($this->filename) && in_array(common_bare_mime($enclosure->mimetype), $needMoreMetadataMimetypes)) { + // This fetches enclosure metadata for non-local links with unset/HTML mimetypes, + // which may be enriched through oEmbed or similar (implemented as plugins) + Event::handle('FileEnclosureMetadata', array($this, &$enclosure)); + } + if (empty($enclosure->mimetype) || in_array(common_bare_mime($enclosure->mimetype), $needMoreMetadataMimetypes)) { + // This means we either don't know what it is, so it can't + // be shown as an enclosure, or it is an HTML link which + // does not link to a resource with further metadata. throw new ServerException('Unknown enclosure mimetype, not enough metadata'); } return $enclosure; diff --git a/lib/util.php b/lib/util.php index fd89bb491c..08a0cdea2f 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1820,6 +1820,15 @@ function common_get_mime_media($type) return strtolower($tmp[0]); } +function common_bare_mime($mimetype) +{ + $mimetype = mb_strtolower($mimetype); + if ($semicolon = mb_strpos($mimetype, ';')) { + $mimetype = mb_substr($mimetype, 0, $semicolon); + } + return $mimetype; +} + function common_mime_type_match($type, $avail) { if(array_key_exists($type, $avail)) { From 1c04601a9c3fe9b2a358a01478cf7cd141808d48 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Tue, 5 Aug 2014 11:30:45 +0200 Subject: [PATCH 03/17] Removing excessive "inline" attachment listings --- classes/File.php | 7 +++++++ lib/attachmentlist.php | 20 +++++++++++++++----- lib/attachmentlistitem.php | 2 +- lib/inlineattachmentlist.php | 12 ++++-------- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/classes/File.php b/classes/File.php index 029ff487a4..210e758419 100644 --- a/classes/File.php +++ b/classes/File.php @@ -541,4 +541,11 @@ class File extends Managed_DataObject // And finally remove the entry from the database return parent::delete($useWhere); } + + public function getTitle() + { + $title = $this->title ?: $this->filename; + + return $title ?: null; + } } diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php index 6609cb40da..d6cfda6f95 100644 --- a/lib/attachmentlist.php +++ b/lib/attachmentlist.php @@ -74,18 +74,28 @@ class AttachmentList extends Widget */ function show() { - $att = $this->notice->attachments(); - if (empty($att)) return 0; + $attachments = $this->notice->attachments(); + $representable = false; + foreach ($attachments as $key=>$att) { + // Only show attachments representable with a title + if ($att->getTitle() === null) { + unset($attachments[$key]); + } + } + if (!count($attachments)) { + return 0; + } + $this->showListStart(); - foreach ($att as $n=>$attachment) { - $item = $this->newListItem($attachment); + foreach ($attachments as $att) { + $item = $this->newListItem($att); $item->show(); } $this->showListEnd(); - return count($att); + return count($attachments); } function showListStart() diff --git a/lib/attachmentlistitem.php b/lib/attachmentlistitem.php index 025ffa9fd6..3764c827cb 100644 --- a/lib/attachmentlistitem.php +++ b/lib/attachmentlistitem.php @@ -63,7 +63,7 @@ class AttachmentListItem extends Widget } function title() { - return $this->attachment->title ?: $this->attachment->filename; + return $this->attachment->getTitle(); } function linkTitle() { diff --git a/lib/inlineattachmentlist.php b/lib/inlineattachmentlist.php index b68701fb31..d760400487 100644 --- a/lib/inlineattachmentlist.php +++ b/lib/inlineattachmentlist.php @@ -35,12 +35,8 @@ class InlineAttachmentList extends AttachmentList { function showListStart() { - $this->out->elementStart('div', array('class' => 'attachments')); - } - - function showListEnd() - { - $this->out->elementEnd('div'); + $this->out->element('h2', null, _('Attachments')); + parent::showListStart(); } /** @@ -72,7 +68,7 @@ class InlineAttachmentListItem extends AttachmentListItem { // XXX: RDFa // TODO: add notice_type class e.g., notice_video, notice_image - $this->out->elementStart('span', array('class' => 'inline-attachment')); + $this->out->elementStart('li', array('class' => 'inline-attachment')); } /** @@ -84,6 +80,6 @@ class InlineAttachmentListItem extends AttachmentListItem */ function showEnd() { - $this->out->elementEnd('span'); + $this->out->elementEnd('li'); } } From e32178d3ceac6ccab7de27af2a88d7df3a462bcc Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Tue, 5 Aug 2014 11:37:39 +0200 Subject: [PATCH 04/17] Don't auto-enable Twitter and Facebook bridges (singleuser) Multiuser instances already had them disabled. --- lib/siteprofile.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/siteprofile.php b/lib/siteprofile.php index d2a4a00204..569a4bbaf8 100644 --- a/lib/siteprofile.php +++ b/lib/siteprofile.php @@ -230,8 +230,6 @@ class SingleuserSite extends SiteProfileSettings 'core' => self::corePlugins(), 'default' => array_merge(self::defaultPlugins(), array( 'MobileProfile' => array(), - 'TwitterBridge' => array(), - 'FacebookBridge' => array(), )), 'disable-Directory' => 1, ), From a9676f5b2b8653baecf70a3436152aff98d9d7c0 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Tue, 5 Aug 2014 12:42:30 +0200 Subject: [PATCH 05/17] RSVP fromNotice now throws NoResultException --- plugins/Event/classes/RSVP.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/Event/classes/RSVP.php b/plugins/Event/classes/RSVP.php index 31ccf439ef..de3307fad4 100644 --- a/plugins/Event/classes/RSVP.php +++ b/plugins/Event/classes/RSVP.php @@ -226,7 +226,12 @@ class RSVP extends Managed_DataObject static function fromNotice(Notice $notice) { - return RSVP::getKV('uri', $notice->uri); + $rsvp = new RSVP(); + $rsvp->uri = $notice->uri; + if (!$rsvp->find(true)) { + throw new NoResultException($rsvp); + } + return $rsvp; } static function forEvent(Happening $event) From 9933c00c4f2cb19f06d7a1e10e0546c4a26c61a7 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 6 Aug 2014 09:29:47 +0200 Subject: [PATCH 06/17] TwitterBridge PHP require_once paths now relative --- plugins/TwitterBridge/TwitterBridgePlugin.php | 2 +- plugins/TwitterBridge/actions/twitterauthorization.php | 2 +- plugins/TwitterBridge/actions/twitterlogin.php | 2 +- plugins/TwitterBridge/actions/twittersettings.php | 2 +- plugins/TwitterBridge/daemons/synctwitterfriends.php | 2 +- plugins/TwitterBridge/daemons/twitterstatusfetcher.php | 2 +- plugins/TwitterBridge/lib/tweetinqueuehandler.php | 2 +- plugins/TwitterBridge/lib/twitterimport.php | 2 +- plugins/TwitterBridge/lib/twitterqueuehandler.php | 2 +- plugins/TwitterBridge/tweetctlqueuehandler.php | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/TwitterBridge/TwitterBridgePlugin.php b/plugins/TwitterBridge/TwitterBridgePlugin.php index 3284d10563..8d14744090 100644 --- a/plugins/TwitterBridge/TwitterBridgePlugin.php +++ b/plugins/TwitterBridge/TwitterBridgePlugin.php @@ -30,7 +30,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; +require_once __DIR__ . '/twitter.php'; /** * Plugin for sending and importing Twitter statuses diff --git a/plugins/TwitterBridge/actions/twitterauthorization.php b/plugins/TwitterBridge/actions/twitterauthorization.php index aace7e4f09..ce6af091e2 100644 --- a/plugins/TwitterBridge/actions/twitterauthorization.php +++ b/plugins/TwitterBridge/actions/twitterauthorization.php @@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; +require_once dirname(__DIR__) . '/twitter.php'; /** * Class for doing OAuth authentication against Twitter diff --git a/plugins/TwitterBridge/actions/twitterlogin.php b/plugins/TwitterBridge/actions/twitterlogin.php index 379e136045..ee00714c9f 100644 --- a/plugins/TwitterBridge/actions/twitterlogin.php +++ b/plugins/TwitterBridge/actions/twitterlogin.php @@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; +require_once dirname(__DIR__) . '/twitter.php'; /** * Page for logging in with Twitter diff --git a/plugins/TwitterBridge/actions/twittersettings.php b/plugins/TwitterBridge/actions/twittersettings.php index cc3e34f345..37abb4d272 100644 --- a/plugins/TwitterBridge/actions/twittersettings.php +++ b/plugins/TwitterBridge/actions/twittersettings.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; +require_once dirname(__DIR__) . '/twitter.php'; /** * Settings for Twitter integration diff --git a/plugins/TwitterBridge/daemons/synctwitterfriends.php b/plugins/TwitterBridge/daemons/synctwitterfriends.php index 651c4d34da..8b8ffbfd49 100755 --- a/plugins/TwitterBridge/daemons/synctwitterfriends.php +++ b/plugins/TwitterBridge/daemons/synctwitterfriends.php @@ -31,7 +31,7 @@ Batch script for synching local friends with Twitter friends. END_OF_TRIM_HELP; require_once INSTALLDIR . '/scripts/commandline.inc'; -require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; +require_once dirname(__DIR__) . '/twitter.php'; /** * Daemon to sync local friends with Twitter friends diff --git a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php index b4b78dc80a..74fc77cd79 100755 --- a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php +++ b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php @@ -39,7 +39,7 @@ END_OF_TRIM_HELP; require_once INSTALLDIR . '/scripts/commandline.inc'; require_once INSTALLDIR . '/lib/common.php'; require_once INSTALLDIR . '/lib/daemon.php'; -require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; +require_once dirname(__DIR__) . '/twitter.php'; /** * Fetch statuses from Twitter diff --git a/plugins/TwitterBridge/lib/tweetinqueuehandler.php b/plugins/TwitterBridge/lib/tweetinqueuehandler.php index 0ab7480305..cc0c05f9a6 100644 --- a/plugins/TwitterBridge/lib/tweetinqueuehandler.php +++ b/plugins/TwitterBridge/lib/tweetinqueuehandler.php @@ -19,7 +19,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; +require_once dirname(__DIR__) . '/twitter.php'; /** * Queue handler to deal with incoming Twitter status updates, as retrieved by diff --git a/plugins/TwitterBridge/lib/twitterimport.php b/plugins/TwitterBridge/lib/twitterimport.php index 41d8ac9d46..5258bfc2c9 100644 --- a/plugins/TwitterBridge/lib/twitterimport.php +++ b/plugins/TwitterBridge/lib/twitterimport.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; +require_once dirname(__DIR__) . '/twitter.php'; /** * Encapsulation of the Twitter status -> notice incoming bridge import. diff --git a/plugins/TwitterBridge/lib/twitterqueuehandler.php b/plugins/TwitterBridge/lib/twitterqueuehandler.php index 644ce17871..bba1b8b2bc 100644 --- a/plugins/TwitterBridge/lib/twitterqueuehandler.php +++ b/plugins/TwitterBridge/lib/twitterqueuehandler.php @@ -19,7 +19,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; +require_once dirname(__DIR__) . '/twitter.php'; class TwitterQueueHandler extends QueueHandler { diff --git a/plugins/TwitterBridge/tweetctlqueuehandler.php b/plugins/TwitterBridge/tweetctlqueuehandler.php index 4c8bef463e..d7636c373e 100644 --- a/plugins/TwitterBridge/tweetctlqueuehandler.php +++ b/plugins/TwitterBridge/tweetctlqueuehandler.php @@ -19,7 +19,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; +require_once __DIR__ . '/twitter.php'; /** * Queue handler to deal with incoming Twitter status updates, as retrieved by From 6e181a2454e888b09313344138f66713d5c9c99f Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 6 Aug 2014 10:30:35 +0200 Subject: [PATCH 07/17] PATHINFO example added to htaccess.sample --- htaccess.sample | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htaccess.sample b/htaccess.sample index fb191cc7e8..c0b61ee295 100644 --- a/htaccess.sample +++ b/htaccess.sample @@ -19,6 +19,9 @@ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.php?p=$1 [L,QSA] + + ## You can also use PATHINFO by using this RewriteRule instead: + # RewriteRule (.*) index.php/$1 [L,QSA] From df55435a51e87f44f90773ef5c777291108282ad Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 6 Aug 2014 10:31:31 +0200 Subject: [PATCH 08/17] Apache 2.4 mod_authz_host access example Apache 2.2 -> 2.4 upgrades tend to fail on the "Order allow,deny" bit. --- htaccess.sample | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htaccess.sample b/htaccess.sample index c0b61ee295..90e18e72e6 100644 --- a/htaccess.sample +++ b/htaccess.sample @@ -25,6 +25,9 @@ + # For mod_access_compat in Apache <2.4 Order allow,deny - + # Use this instead for Apache >2.4 (mod_authz_host) + # Require all denied + From 2a0a15fa4d6ff4a4946e3e5be1a8443e3ef6fe16 Mon Sep 17 00:00:00 2001 From: postblue Date: Thu, 7 Aug 2014 15:17:48 +0200 Subject: [PATCH 09/17] Deleting useless comma --- theme/base/css/display.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 792501e289..f40c4cf07a 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -704,7 +704,7 @@ font-style:italic; min-height: 1em; } -#shownotice .notice .h-entry {, +#shownotice .notice .h-entry { font-size:2.2em; min-height:123px; font-size: 1.6em; From 21f8c21cacb662f1d5897ea0f6f6cf785c847153 Mon Sep 17 00:00:00 2001 From: postblue Date: Thu, 7 Aug 2014 15:22:44 +0200 Subject: [PATCH 10/17] Missing end of @media screen, projection, tv --- theme/base/css/display.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theme/base/css/display.css b/theme/base/css/display.css index f40c4cf07a..5e87675c8a 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -2484,7 +2484,7 @@ display:none; list-style-type: none; } -/*end of @media screen, projection, tv*/ +}/*end of @media screen, projection, tv*/ @media print { From ebbc3e530bec5dc7ca39e7ea766d0338a155c260 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 7 Aug 2014 20:26:32 +0200 Subject: [PATCH 11/17] Removing old "-browser-border-radius" stuff (pre-CSS3) --- theme/base/css/display.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/theme/base/css/display.css b/theme/base/css/display.css index f054be2b49..1029850a1e 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -2000,8 +2000,6 @@ margin:0; #profile_search_results { display:block; border-radius:4px; --moz-border-radius:4px; --webkit-border-radius:4px; max-height:800px; margin:10px 0; padding: 5px; @@ -2070,8 +2068,6 @@ float:left; padding: 6px; margin: 4px 0px 0px 4px; border-top-left-radius: 7px; - -moz-border-radius-topleft: 7px; - -webkit-border-top-left-radius: 7px; } .oauth-desktop-mode fieldset { From 8aa783241dd8a476b2b25ea75e0148fac287ce72 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 7 Aug 2014 21:54:31 +0200 Subject: [PATCH 12/17] Profile activityobject array outputs "summary" field --- classes/Profile.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/classes/Profile.php b/classes/Profile.php index 94f83ab788..1af29b2620 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -1324,6 +1324,7 @@ class Profile extends Managed_DataObject $object->id = $this->getUri(); $object->title = $this->getBestName(); $object->link = $this->getUrl(); + $object->summary = $this->getDescription(); try { $avatar = Avatar::getUploaded($this); @@ -1390,6 +1391,11 @@ class Profile extends Managed_DataObject return $this->nickname; } + public function getDescription() + { + return $this->bio; + } + /** * Returns the best URI for a profile. Plugins may override. * From 2766c2aeecd20fc9ac0c7437a8d6f55abc447899 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 7 Aug 2014 22:40:36 +0200 Subject: [PATCH 13/17] User timeline ActivityStreams output now has paging data --- actions/apitimelineuser.php | 49 +++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index c0894c5dba..ac33beada4 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -124,6 +124,22 @@ class ApiTimelineUserAction extends ApiBareAuthAction $suplink = common_local_url('sup', null, null, $this->target->id); header('X-SUP-ID: ' . $suplink); + + // paging links + $nextUrl = common_local_url('ApiTimelineUser', + array('format' => $this->format, + 'id' => $this->target->id), + array('max_id' => $this->next_id)); + $lastNotice = $this->notices[0]; + $lastId = $lastNotice->id; + $prevUrl = common_local_url('ApiTimelineUser', + array('format' => $this->format, + 'id' => $this->target->id), + array('since_id' => $lastId)); + $firstUrl = common_local_url('ApiTimelineUser', + array('format' => $this->format, + 'id' => $this->target->id)); + switch($this->format) { case 'xml': $this->showXmlTimeline($this->notices); @@ -150,10 +166,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction // change too quickly! if (!empty($this->next_id)) { - $nextUrl = common_local_url('ApiTimelineUser', - array('format' => 'atom', - 'id' => $this->target->id), - array('max_id' => $this->next_id)); $atom->addLink($nextUrl, array('rel' => 'next', @@ -162,13 +174,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction if (($this->page > 1 || !empty($this->max_id)) && !empty($this->notices)) { - $lastNotice = $this->notices[0]; - $lastId = $lastNotice->id; - - $prevUrl = common_local_url('ApiTimelineUser', - array('format' => 'atom', - 'id' => $this->target->id), - array('since_id' => $lastId)); $atom->addLink($prevUrl, array('rel' => 'prev', @@ -177,10 +182,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction if ($this->page > 1 || !empty($this->since_id) || !empty($this->max_id)) { - $firstUrl = common_local_url('ApiTimelineUser', - array('format' => 'atom', - 'id' => $this->target->id)); - $atom->addLink($firstUrl, array('rel' => 'first', 'type' => 'application/atom+xml')); @@ -201,7 +202,23 @@ class ApiTimelineUserAction extends ApiBareAuthAction $doc->addLink($link, 'alternate', 'text/html'); $doc->addItemsFromNotices($this->notices); - // XXX: Add paging extension? + if (!empty($this->next_id)) { + $doc->addLink($nextUrl, + array('rel' => 'next', + 'type' => ActivityStreamJSONDocument::CONTENT_TYPE)); + } + + if (($this->page > 1 || !empty($this->max_id)) && !empty($this->notices)) { + $doc->addLink($prevUrl, + array('rel' => 'prev', + 'type' => ActivityStreamJSONDocument::CONTENT_TYPE)); + } + + if ($this->page > 1 || !empty($this->since_id) || !empty($this->max_id)) { + $doc->addLink($firstUrl, + array('rel' => 'first', + 'type' => ActivityStreamJSONDocument::CONTENT_TYPE)); + } $this->raw($doc->asString()); break; From 8825aef1de4a391518e04ffc379d252f45c86892 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Fri, 8 Aug 2014 11:35:06 +0200 Subject: [PATCH 14/17] local variable format in ApiAction declared in class --- lib/apiaction.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/apiaction.php b/lib/apiaction.php index d945d532d0..b55647e445 100644 --- a/lib/apiaction.php +++ b/lib/apiaction.php @@ -127,6 +127,7 @@ class ApiAction extends Action var $since_id = null; var $source = null; var $callback = null; + var $format = null; var $access = self::READ_ONLY; // read (default) or read-write From 9a192473d5c220b96281c15592aa00dc02c12584 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Fri, 8 Aug 2014 11:35:38 +0200 Subject: [PATCH 15/17] declared "next_id" used to set the max_id for next link --- actions/apitimelineuser.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index ac33beada4..97462452f2 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -59,6 +59,8 @@ class ApiTimelineUserAction extends ApiBareAuthAction { var $notices = null; + var $next_id = null; + /** * Take arguments for running * @@ -126,10 +128,12 @@ class ApiTimelineUserAction extends ApiBareAuthAction // paging links - $nextUrl = common_local_url('ApiTimelineUser', + $nextUrl = !empty($this->next_id) + ? common_local_url('ApiTimelineUser', array('format' => $this->format, 'id' => $this->target->id), - array('max_id' => $this->next_id)); + array('max_id' => $this->next_id)) + : null; $lastNotice = $this->notices[0]; $lastId = $lastNotice->id; $prevUrl = common_local_url('ApiTimelineUser', @@ -166,22 +170,18 @@ class ApiTimelineUserAction extends ApiBareAuthAction // change too quickly! if (!empty($this->next_id)) { - $atom->addLink($nextUrl, array('rel' => 'next', 'type' => 'application/atom+xml')); } if (($this->page > 1 || !empty($this->max_id)) && !empty($this->notices)) { - - $atom->addLink($prevUrl, array('rel' => 'prev', 'type' => 'application/atom+xml')); } if ($this->page > 1 || !empty($this->since_id) || !empty($this->max_id)) { - $atom->addLink($firstUrl, array('rel' => 'first', 'type' => 'application/atom+xml')); From 3065d9f06d84966940fa3e677274da98f594da0a Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Fri, 8 Aug 2014 11:47:15 +0200 Subject: [PATCH 16/17] Revert "Repeat query window misplaced" I believe other parts of the CSS may have been tidied and propered up since. --- theme/neo/css/display.css | 1 - 1 file changed, 1 deletion(-) diff --git a/theme/neo/css/display.css b/theme/neo/css/display.css index dce214f07b..a46f296537 100644 --- a/theme/neo/css/display.css +++ b/theme/neo/css/display.css @@ -442,7 +442,6 @@ h6 {font-size: 1em;} border: 1px solid #aaa; border-radius: 4px; box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.4); - position: relative; } .notice-options .form_repeat.dialogbox legend { From 571ba1369b7598f7a5c3c154363f72c74b1ed1ad Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 18 Aug 2014 09:39:27 +0200 Subject: [PATCH 17/17] Check for valid database connection object. Signed-off-by: Roland Haeder --- lib/installer.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/installer.php b/lib/installer.php index dc4c7786a8..cea7d29ec7 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -293,6 +293,11 @@ abstract class Installer } } + if (!$conn instanceof DB_common) { + // Is not the right instance + throw new Exception('Cannot connect to database: ' . $conn->getMessage()); + } + $res = $this->updateStatus("Creating database tables..."); if (!$this->createCoreTables($conn)) { $this->updateStatus("Error creating tables.", true);