Merge branch 'master' of gitorious.org:social/mainline

This commit is contained in:
Matt Lee 2014-08-18 23:42:56 -04:00
commit 527224266b
25 changed files with 135 additions and 92 deletions

View File

@ -59,6 +59,8 @@ class ApiTimelineUserAction extends ApiBareAuthAction
{ {
var $notices = null; var $notices = null;
var $next_id = null;
/** /**
* Take arguments for running * Take arguments for running
* *
@ -124,6 +126,24 @@ class ApiTimelineUserAction extends ApiBareAuthAction
$suplink = common_local_url('sup', null, null, $this->target->id); $suplink = common_local_url('sup', null, null, $this->target->id);
header('X-SUP-ID: ' . $suplink); header('X-SUP-ID: ' . $suplink);
// paging links
$nextUrl = !empty($this->next_id)
? common_local_url('ApiTimelineUser',
array('format' => $this->format,
'id' => $this->target->id),
array('max_id' => $this->next_id))
: null;
$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) { switch($this->format) {
case 'xml': case 'xml':
$this->showXmlTimeline($this->notices); $this->showXmlTimeline($this->notices);
@ -150,37 +170,18 @@ class ApiTimelineUserAction extends ApiBareAuthAction
// change too quickly! // change too quickly!
if (!empty($this->next_id)) { 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, $atom->addLink($nextUrl,
array('rel' => 'next', array('rel' => 'next',
'type' => 'application/atom+xml')); 'type' => 'application/atom+xml'));
} }
if (($this->page > 1 || !empty($this->max_id)) && !empty($this->notices)) { 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, $atom->addLink($prevUrl,
array('rel' => 'prev', array('rel' => 'prev',
'type' => 'application/atom+xml')); 'type' => 'application/atom+xml'));
} }
if ($this->page > 1 || !empty($this->since_id) || !empty($this->max_id)) { 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, $atom->addLink($firstUrl,
array('rel' => 'first', array('rel' => 'first',
'type' => 'application/atom+xml')); 'type' => 'application/atom+xml'));
@ -201,7 +202,23 @@ class ApiTimelineUserAction extends ApiBareAuthAction
$doc->addLink($link, 'alternate', 'text/html'); $doc->addLink($link, 'alternate', 'text/html');
$doc->addItemsFromNotices($this->notices); $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()); $this->raw($doc->asString());
break; break;

View File

@ -352,30 +352,21 @@ class File extends Managed_DataObject
function getEnclosure(){ function getEnclosure(){
$enclosure = (object) array(); $enclosure = (object) array();
$enclosure->title=$this->title; foreach (array('title', 'url', 'date', 'modified', 'size', 'mimetype') as $key) {
$enclosure->url=$this->url; $enclosure->$key = $this->$key;
$enclosure->title=$this->title; }
$enclosure->date=$this->date;
$enclosure->modified=$this->modified;
$enclosure->size=$this->size;
$enclosure->mimetype=$this->mimetype;
if (!isset($this->filename)) { $needMoreMetadataMimetypes = array(null, 'text/html', 'application/xhtml+xml');
$notEnclosureMimeTypes = array(null,'text/html','application/xhtml+xml');
$mimetype = $this->mimetype; if (!isset($this->filename) && in_array(common_bare_mime($enclosure->mimetype), $needMoreMetadataMimetypes)) {
if($mimetype != null){ // This fetches enclosure metadata for non-local links with unset/HTML mimetypes,
$mimetype = strtolower($this->mimetype); // which may be enriched through oEmbed or similar (implemented as plugins)
}
$semicolon = strpos($mimetype,';');
if($semicolon){
$mimetype = substr($mimetype,0,$semicolon);
}
if (in_array($mimetype, $notEnclosureMimeTypes)) {
Event::handle('FileEnclosureMetadata', array($this, &$enclosure)); Event::handle('FileEnclosureMetadata', array($this, &$enclosure));
} }
} if (empty($enclosure->mimetype) || in_array(common_bare_mime($enclosure->mimetype), $needMoreMetadataMimetypes)) {
if (empty($enclosure->mimetype)) { // This means we either don't know what it is, so it can't
// This means we don't know what it is, so it can't be an enclosure! // 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'); throw new ServerException('Unknown enclosure mimetype, not enough metadata');
} }
return $enclosure; return $enclosure;
@ -550,4 +541,11 @@ class File extends Managed_DataObject
// And finally remove the entry from the database // And finally remove the entry from the database
return parent::delete($useWhere); return parent::delete($useWhere);
} }
public function getTitle()
{
$title = $this->title ?: $this->filename;
return $title ?: null;
}
} }

View File

@ -1324,6 +1324,7 @@ class Profile extends Managed_DataObject
$object->id = $this->getUri(); $object->id = $this->getUri();
$object->title = $this->getBestName(); $object->title = $this->getBestName();
$object->link = $this->getUrl(); $object->link = $this->getUrl();
$object->summary = $this->getDescription();
try { try {
$avatar = Avatar::getUploaded($this); $avatar = Avatar::getUploaded($this);
@ -1390,6 +1391,11 @@ class Profile extends Managed_DataObject
return $this->nickname; return $this->nickname;
} }
public function getDescription()
{
return $this->bio;
}
/** /**
* Returns the best URI for a profile. Plugins may override. * Returns the best URI for a profile. Plugins may override.
* *

View File

@ -19,9 +19,15 @@
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?p=$1 [L,QSA] RewriteRule (.*) index.php?p=$1 [L,QSA]
## You can also use PATHINFO by using this RewriteRule instead:
# RewriteRule (.*) index.php/$1 [L,QSA]
</IfModule> </IfModule>
<FilesMatch "\.(ini)"> <FilesMatch "\.(ini)">
# For mod_access_compat in Apache <2.4
Order allow,deny Order allow,deny
</FilesMatch>
# Use this instead for Apache >2.4 (mod_authz_host)
# Require all denied
</FilesMatch>

View File

@ -127,6 +127,7 @@ class ApiAction extends Action
var $since_id = null; var $since_id = null;
var $source = null; var $source = null;
var $callback = null; var $callback = null;
var $format = null;
var $access = self::READ_ONLY; // read (default) or read-write var $access = self::READ_ONLY; // read (default) or read-write

View File

@ -74,18 +74,28 @@ class AttachmentList extends Widget
*/ */
function show() function show()
{ {
$att = $this->notice->attachments(); $attachments = $this->notice->attachments();
if (empty($att)) return 0; $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(); $this->showListStart();
foreach ($att as $n=>$attachment) { foreach ($attachments as $att) {
$item = $this->newListItem($attachment); $item = $this->newListItem($att);
$item->show(); $item->show();
} }
$this->showListEnd(); $this->showListEnd();
return count($att); return count($attachments);
} }
function showListStart() function showListStart()

View File

@ -63,7 +63,7 @@ class AttachmentListItem extends Widget
} }
function title() { function title() {
return $this->attachment->title ?: $this->attachment->filename; return $this->attachment->getTitle();
} }
function linkTitle() { function linkTitle() {

View File

@ -23,7 +23,7 @@ define('GNUSOCIAL_ENGINE', 'GNU social');
define('GNUSOCIAL_ENGINE_URL', 'https://www.gnu.org/software/social/'); define('GNUSOCIAL_ENGINE_URL', 'https://www.gnu.org/software/social/');
define('GNUSOCIAL_BASE_VERSION', '1.1.1'); define('GNUSOCIAL_BASE_VERSION', '1.1.1');
define('GNUSOCIAL_LIFECYCLE', 'alpha1'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release' define('GNUSOCIAL_LIFECYCLE', 'alpha2'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE); define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE);

View File

@ -35,12 +35,8 @@ class InlineAttachmentList extends AttachmentList
{ {
function showListStart() function showListStart()
{ {
$this->out->elementStart('div', array('class' => 'attachments')); $this->out->element('h2', null, _('Attachments'));
} parent::showListStart();
function showListEnd()
{
$this->out->elementEnd('div');
} }
/** /**
@ -59,20 +55,8 @@ class InlineAttachmentList extends AttachmentList
class InlineAttachmentListItem extends AttachmentListItem class InlineAttachmentListItem extends AttachmentListItem
{ {
function showLink() { function showLink() {
$this->out->elementStart('a', $this->linkAttr()); $this->out->element('a', $this->linkAttr(), $this->title());
$this->showRepresentation(); $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;
} }
/** /**
@ -84,7 +68,7 @@ class InlineAttachmentListItem extends AttachmentListItem
{ {
// XXX: RDFa // XXX: RDFa
// TODO: add notice_type class e.g., notice_video, notice_image // 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'));
} }
/** /**
@ -96,6 +80,6 @@ class InlineAttachmentListItem extends AttachmentListItem
*/ */
function showEnd() function showEnd()
{ {
$this->out->elementEnd('span'); $this->out->elementEnd('li');
} }
} }

View File

@ -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..."); $res = $this->updateStatus("Creating database tables...");
if (!$this->createCoreTables($conn)) { if (!$this->createCoreTables($conn)) {
$this->updateStatus("Error creating tables.", true); $this->updateStatus("Error creating tables.", true);

View File

@ -230,8 +230,6 @@ class SingleuserSite extends SiteProfileSettings
'core' => self::corePlugins(), 'core' => self::corePlugins(),
'default' => array_merge(self::defaultPlugins(), array( 'default' => array_merge(self::defaultPlugins(), array(
'MobileProfile' => array(), 'MobileProfile' => array(),
'TwitterBridge' => array(),
'FacebookBridge' => array(),
)), )),
'disable-Directory' => 1, 'disable-Directory' => 1,
), ),

View File

@ -1820,6 +1820,15 @@ function common_get_mime_media($type)
return strtolower($tmp[0]); 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) function common_mime_type_match($type, $avail)
{ {
if(array_key_exists($type, $avail)) { if(array_key_exists($type, $avail)) {

View File

@ -226,7 +226,12 @@ class RSVP extends Managed_DataObject
static function fromNotice(Notice $notice) 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) static function forEvent(Happening $event)

View File

@ -30,7 +30,7 @@ if (!defined('STATUSNET')) {
exit(1); exit(1);
} }
require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; require_once __DIR__ . '/twitter.php';
/** /**
* Plugin for sending and importing Twitter statuses * Plugin for sending and importing Twitter statuses

View File

@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1); exit(1);
} }
require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; require_once dirname(__DIR__) . '/twitter.php';
/** /**
* Class for doing OAuth authentication against Twitter * Class for doing OAuth authentication against Twitter

View File

@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1); exit(1);
} }
require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; require_once dirname(__DIR__) . '/twitter.php';
/** /**
* Page for logging in with Twitter * Page for logging in with Twitter

View File

@ -31,7 +31,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1); exit(1);
} }
require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; require_once dirname(__DIR__) . '/twitter.php';
/** /**
* Settings for Twitter integration * Settings for Twitter integration

View File

@ -31,7 +31,7 @@ Batch script for synching local friends with Twitter friends.
END_OF_TRIM_HELP; END_OF_TRIM_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc'; 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 * Daemon to sync local friends with Twitter friends

View File

@ -39,7 +39,7 @@ END_OF_TRIM_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc'; require_once INSTALLDIR . '/scripts/commandline.inc';
require_once INSTALLDIR . '/lib/common.php'; require_once INSTALLDIR . '/lib/common.php';
require_once INSTALLDIR . '/lib/daemon.php'; require_once INSTALLDIR . '/lib/daemon.php';
require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; require_once dirname(__DIR__) . '/twitter.php';
/** /**
* Fetch statuses from Twitter * Fetch statuses from Twitter

View File

@ -19,7 +19,7 @@
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } 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 * Queue handler to deal with incoming Twitter status updates, as retrieved by

View File

@ -31,7 +31,7 @@ if (!defined('STATUSNET')) {
exit(1); exit(1);
} }
require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; require_once dirname(__DIR__) . '/twitter.php';
/** /**
* Encapsulation of the Twitter status -> notice incoming bridge import. * Encapsulation of the Twitter status -> notice incoming bridge import.

View File

@ -19,7 +19,7 @@
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; require_once dirname(__DIR__) . '/twitter.php';
class TwitterQueueHandler extends QueueHandler class TwitterQueueHandler extends QueueHandler
{ {

View File

@ -19,7 +19,7 @@
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } 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 * Queue handler to deal with incoming Twitter status updates, as retrieved by

View File

@ -704,7 +704,7 @@ font-style:italic;
min-height: 1em; min-height: 1em;
} }
#shownotice .notice .h-entry {, #shownotice .notice .h-entry {
font-size:2.2em; font-size:2.2em;
min-height:123px; min-height:123px;
font-size: 1.6em; font-size: 1.6em;
@ -812,6 +812,15 @@ position:static;
top: 1em; 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 { #attachments {
clear:both; clear:both;
float:left; float:left;
@ -1991,8 +2000,6 @@ margin:0;
#profile_search_results { #profile_search_results {
display:block; display:block;
border-radius:4px; border-radius:4px;
-moz-border-radius:4px;
-webkit-border-radius:4px;
max-height:800px; max-height:800px;
margin:10px 0; margin:10px 0;
padding: 5px; padding: 5px;
@ -2061,8 +2068,6 @@ float:left;
padding: 6px; padding: 6px;
margin: 4px 0px 0px 4px; margin: 4px 0px 0px 4px;
border-top-left-radius: 7px; border-top-left-radius: 7px;
-moz-border-radius-topleft: 7px;
-webkit-border-top-left-radius: 7px;
} }
.oauth-desktop-mode fieldset { .oauth-desktop-mode fieldset {
@ -2484,7 +2489,7 @@ display:none;
list-style-type: none; list-style-type: none;
} }
/*end of @media screen, projection, tv*/ }/*end of @media screen, projection, tv*/
@media print { @media print {

View File

@ -442,7 +442,6 @@ h6 {font-size: 1em;}
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; border-radius: 4px;
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.4); box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.4);
position: relative;
} }
.notice-options .form_repeat.dialogbox legend { .notice-options .form_repeat.dialogbox legend {