forked from GNUsocial/gnu-social
Merge branch '0.8.x' into small-fixes
This commit is contained in:
commit
bb3361467c
@ -207,7 +207,7 @@ class ConversationTree extends NoticeList
|
||||
// We take responsibility for doing the li
|
||||
|
||||
$this->out->elementStart('li', array('class' => 'hentry notice',
|
||||
'id' => 'notice-' . $this->notice->id));
|
||||
'id' => 'notice-' . $id));
|
||||
|
||||
$item = $this->newListItem($notice);
|
||||
$item->show();
|
||||
|
127
actions/foaf.php
127
actions/foaf.php
@ -82,14 +82,18 @@ class FoafAction extends Action
|
||||
'http://www.w3.org/2000/01/rdf-schema#',
|
||||
'xmlns:geo' =>
|
||||
'http://www.w3.org/2003/01/geo/wgs84_pos#',
|
||||
'xmlns:bio' =>
|
||||
'http://purl.org/vocab/bio/0.1/',
|
||||
'xmlns:sioc' =>
|
||||
'http://rdfs.org/sioc/ns#',
|
||||
'xmlns' => 'http://xmlns.com/foaf/0.1/'));
|
||||
|
||||
// This is the document about the user
|
||||
|
||||
$this->showPpd('', $this->user->uri);
|
||||
|
||||
// XXX: might not be a person
|
||||
$this->elementStart('Person', array('rdf:about' =>
|
||||
// Would be nice to tell if they were a Person or not (e.g. a #person usertag?)
|
||||
$this->elementStart('Agent', array('rdf:about' =>
|
||||
$this->user->uri));
|
||||
$this->element('mbox_sha1sum', null, sha1('mailto:' . $this->user->email));
|
||||
if ($this->profile->fullname) {
|
||||
@ -98,8 +102,11 @@ class FoafAction extends Action
|
||||
if ($this->profile->homepage) {
|
||||
$this->element('homepage', array('rdf:resource' => $this->profile->homepage));
|
||||
}
|
||||
if ($this->profile->profileurl) {
|
||||
$this->element('weblog', array('rdf:resource' => $this->profile->profileurl));
|
||||
}
|
||||
if ($this->profile->bio) {
|
||||
$this->element('rdfs:comment', null, $this->profile->bio);
|
||||
$this->element('bio:olb', null, $this->profile->bio);
|
||||
}
|
||||
// XXX: more structured location data
|
||||
if ($this->profile->location) {
|
||||
@ -110,10 +117,7 @@ class FoafAction extends Action
|
||||
$this->elementEnd('based_near');
|
||||
}
|
||||
|
||||
$this->showMicrobloggingAccount($this->profile, common_root_url());
|
||||
|
||||
$avatar = $this->profile->getOriginalAvatar();
|
||||
|
||||
if ($avatar) {
|
||||
$this->elementStart('img');
|
||||
$this->elementStart('Image', array('rdf:about' => $avatar->url));
|
||||
@ -129,39 +133,8 @@ class FoafAction extends Action
|
||||
$this->elementEnd('img');
|
||||
}
|
||||
|
||||
// Get people user is subscribed to
|
||||
|
||||
$person = array();
|
||||
|
||||
$sub = new Subscription();
|
||||
$sub->subscriber = $this->profile->id;
|
||||
$sub->whereAdd('subscriber != subscribed');
|
||||
|
||||
if ($sub->find()) {
|
||||
while ($sub->fetch()) {
|
||||
if (!empty($sub->token)) {
|
||||
$other = Remote_profile::staticGet('id', $sub->subscribed);
|
||||
} else {
|
||||
$other = User::staticGet('id', $sub->subscribed);
|
||||
}
|
||||
if (empty($other)) {
|
||||
common_debug('Got a bad subscription: '.print_r($sub,true));
|
||||
continue;
|
||||
}
|
||||
$this->element('knows', array('rdf:resource' => $other->uri));
|
||||
$person[$other->uri] = array(LISTENEE,
|
||||
$other->id,
|
||||
$other->nickname,
|
||||
(empty($sub->token)) ? 'User' : 'Remote_profile');
|
||||
$other->free();
|
||||
$other = null;
|
||||
unset($other);
|
||||
}
|
||||
}
|
||||
|
||||
$sub->free();
|
||||
$sub = null;
|
||||
unset($sub);
|
||||
$person = $this->showMicrobloggingAccount($this->profile,
|
||||
common_root_url(), $this->user->uri, false);
|
||||
|
||||
// Get people who subscribe to user
|
||||
|
||||
@ -198,7 +171,15 @@ class FoafAction extends Action
|
||||
$sub = null;
|
||||
unset($sub);
|
||||
|
||||
$this->elementEnd('Person');
|
||||
foreach ($person as $uri => $p) {
|
||||
list($type, $id, $nickname, $cls) = $p;
|
||||
if ($type == BOTH) {
|
||||
$this->element('knows', array('rdf:resource' => $uri));
|
||||
}
|
||||
}
|
||||
|
||||
$this->elementEnd('Agent');
|
||||
|
||||
|
||||
foreach ($person as $uri => $p) {
|
||||
$foaf_url = null;
|
||||
@ -207,16 +188,18 @@ class FoafAction extends Action
|
||||
$foaf_url = common_local_url('foaf', array('nickname' => $nickname));
|
||||
}
|
||||
$profile = Profile::staticGet($id);
|
||||
$this->elementStart('Person', array('rdf:about' => $uri));
|
||||
if ($type == LISTENER || $type == BOTH) {
|
||||
$this->elementStart('Agent', array('rdf:about' => $uri));
|
||||
if ($type == BOTH) {
|
||||
$this->element('knows', array('rdf:resource' => $this->user->uri));
|
||||
}
|
||||
$this->showMicrobloggingAccount($profile, ($cls == 'User') ?
|
||||
common_root_url() : null);
|
||||
$this->showMicrobloggingAccount($profile,
|
||||
($cls == 'User') ? common_root_url() : null,
|
||||
$uri,
|
||||
true);
|
||||
if ($foaf_url) {
|
||||
$this->element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
|
||||
}
|
||||
$this->elementEnd('Person');
|
||||
$this->elementEnd('Agent');
|
||||
if ($foaf_url) {
|
||||
$this->showPpd($foaf_url, $uri);
|
||||
}
|
||||
@ -237,18 +220,66 @@ class FoafAction extends Action
|
||||
$this->elementEnd('PersonalProfileDocument');
|
||||
}
|
||||
|
||||
function showMicrobloggingAccount($profile, $service=null)
|
||||
function showMicrobloggingAccount($profile, $service=null, $useruri=null, $isSubscriber=false)
|
||||
{
|
||||
$attr = array();
|
||||
if ($useruri) {
|
||||
$attr['rdf:about'] = $useruri . '#acct';
|
||||
}
|
||||
|
||||
// Their account
|
||||
$this->elementStart('holdsAccount');
|
||||
$this->elementStart('OnlineAccount');
|
||||
$this->elementStart('OnlineAccount', $attr);
|
||||
if ($service) {
|
||||
$this->element('accountServiceHomepage', array('rdf:resource' =>
|
||||
$service));
|
||||
}
|
||||
$this->element('accountName', null, $profile->nickname);
|
||||
$this->element('homepage', array('rdf:resource' => $profile->profileurl));
|
||||
$this->element('accountProfilePage', array('rdf:resource' => $profile->profileurl));
|
||||
if ($useruri) {
|
||||
$this->element('sioc:account_of', array('rdf:resource'=>$useruri));
|
||||
}
|
||||
|
||||
$person = array();
|
||||
|
||||
if ($isSubscriber) {
|
||||
$this->element('sioc:follows', array('rdf:resource'=>$this->user->uri . '#acct'));
|
||||
} else {
|
||||
// Get people user is subscribed to
|
||||
$sub = new Subscription();
|
||||
$sub->subscriber = $profile->id;
|
||||
$sub->whereAdd('subscriber != subscribed');
|
||||
|
||||
if ($sub->find()) {
|
||||
while ($sub->fetch()) {
|
||||
if (!empty($sub->token)) {
|
||||
$other = Remote_profile::staticGet('id', $sub->subscribed);
|
||||
} else {
|
||||
$other = User::staticGet('id', $sub->subscribed);
|
||||
}
|
||||
if (empty($other)) {
|
||||
common_debug('Got a bad subscription: '.print_r($sub,true));
|
||||
continue;
|
||||
}
|
||||
$this->element('sioc:follows', array('rdf:resource' => $other->uri.'#acct'));
|
||||
$person[$other->uri] = array(LISTENEE,
|
||||
$other->id,
|
||||
$other->nickname,
|
||||
(empty($sub->token)) ? 'User' : 'Remote_profile');
|
||||
$other->free();
|
||||
$other = null;
|
||||
unset($other);
|
||||
}
|
||||
}
|
||||
|
||||
$sub->free();
|
||||
$sub = null;
|
||||
unset($sub);
|
||||
}
|
||||
|
||||
$this->elementEnd('OnlineAccount');
|
||||
$this->elementEnd('holdsAccount');
|
||||
|
||||
return $person;
|
||||
}
|
||||
}
|
||||
|
@ -76,11 +76,6 @@ class TagAction extends Action
|
||||
sprintf(_('Feed for tag %s'), $this->tag)));
|
||||
}
|
||||
|
||||
function showPageNotice()
|
||||
{
|
||||
return sprintf(_('Messages tagged "%s", most recent first'), $this->tag);
|
||||
}
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$notice = Notice_tag::getStream($this->tag, (($this->page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
|
||||
|
19
js/util.js
19
js/util.js
@ -203,10 +203,20 @@ $(document).ready(function(){
|
||||
else {
|
||||
li = $("li", xml).get(0);
|
||||
if ($("#"+li.id).length == 0) {
|
||||
$("#notices_primary .notices").prepend(document._importNode(li, true));
|
||||
$("#notices_primary .notice:first").css({display:"none"});
|
||||
$("#notices_primary .notice:first").fadeIn(2500);
|
||||
NoticeReply();
|
||||
var notice_irt_value = $('#notice_in-reply-to').val();
|
||||
var notice_irt = '#notices_primary #notice-'+notice_irt_value;
|
||||
if($('body')[0].id == 'conversation') {
|
||||
if(notice_irt_value.length > 0 && $(notice_irt+' .notices').length < 1) {
|
||||
$(notice_irt).append('<ul class="notices"></ul>');
|
||||
}
|
||||
$($(notice_irt+' .notices')[0]).append(document._importNode(li, true));
|
||||
}
|
||||
else {
|
||||
$("#notices_primary .notices").prepend(document._importNode(li, true));
|
||||
}
|
||||
$('#'+li.id).css({display:'none'});
|
||||
$('#'+li.id).fadeIn(2500);
|
||||
NoticeReply();
|
||||
}
|
||||
}
|
||||
$("#notice_data-text").val("");
|
||||
@ -310,4 +320,3 @@ function NoticeAttachments() {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -575,20 +575,32 @@ class Action extends HTMLOutputter // lawsuit
|
||||
/**
|
||||
* Show page notice block.
|
||||
*
|
||||
* Only show the block if a subclassed action has overrided
|
||||
* Action::showPageNotice(), or an event handler is registered for
|
||||
* the StartShowPageNotice event, in which case we assume the
|
||||
* 'page_notice' definition list is desired. This is to prevent
|
||||
* empty 'page_notice' definition lists from being output everywhere.
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function showPageNoticeBlock()
|
||||
{
|
||||
$this->elementStart('dl', array('id' => 'page_notice',
|
||||
'class' => 'system_notice'));
|
||||
$this->element('dt', null, _('Page notice'));
|
||||
$this->elementStart('dd');
|
||||
if (Event::handle('StartShowPageNotice', array($this))) {
|
||||
$this->showPageNotice();
|
||||
Event::handle('EndShowPageNotice', array($this));
|
||||
$rmethod = new ReflectionMethod($this, 'showPageNotice');
|
||||
$dclass = $rmethod->getDeclaringClass()->getName();
|
||||
|
||||
if ($dclass != 'Action' || Event::hasHandler('StartShowPageNotice')) {
|
||||
|
||||
$this->elementStart('dl', array('id' => 'page_notice',
|
||||
'class' => 'system_notice'));
|
||||
$this->element('dt', null, _('Page notice'));
|
||||
$this->elementStart('dd');
|
||||
if (Event::handle('StartShowPageNotice', array($this))) {
|
||||
$this->showPageNotice();
|
||||
Event::handle('EndShowPageNotice', array($this));
|
||||
}
|
||||
$this->elementEnd('dd');
|
||||
$this->elementEnd('dl');
|
||||
}
|
||||
$this->elementEnd('dd');
|
||||
$this->elementEnd('dl');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,7 +71,6 @@ $config =
|
||||
array('name' => 'Just another Laconica microblog',
|
||||
'server' => $_server,
|
||||
'theme' => 'default',
|
||||
'skin' => 'default',
|
||||
'path' => $_path,
|
||||
'logfile' => null,
|
||||
'logo' => null,
|
||||
|
@ -110,4 +110,32 @@ class Event {
|
||||
}
|
||||
return ($result !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if an event handler exists
|
||||
*
|
||||
* Look to see if there's any handler for a given event, or narrow
|
||||
* by providing the name of a specific plugin class.
|
||||
*
|
||||
* @param string $name Name of the event to look for
|
||||
* @param string $plugin Optional name of the plugin class to look for
|
||||
*
|
||||
* @return boolean flag saying whether such a handler exists
|
||||
*
|
||||
*/
|
||||
|
||||
public static function hasHandler($name, $plugin=null) {
|
||||
if (array_key_exists($name, Event::$_handlers)) {
|
||||
if (isset($plugin)) {
|
||||
foreach (Event::$_handlers[$name] as $handler) {
|
||||
if (get_class($handler[0]) == $plugin) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ class Rss10Action extends Action
|
||||
$this->elementStart('rdf:Seq');
|
||||
|
||||
foreach ($this->notices as $notice) {
|
||||
$this->element('sioct:MicroblogPost', array('rdf:resource' => $notice->uri));
|
||||
$this->element('rdf:li', array('rdf:resource' => $notice->uri));
|
||||
}
|
||||
|
||||
$this->elementEnd('rdf:Seq');
|
||||
@ -197,14 +197,19 @@ class Rss10Action extends Action
|
||||
$profile = Profile::staticGet($notice->profile_id);
|
||||
$nurl = common_local_url('shownotice', array('notice' => $notice->id));
|
||||
$creator_uri = common_profile_uri($profile);
|
||||
$this->elementStart('item', array('rdf:about' => $notice->uri));
|
||||
$this->elementStart('item', array('rdf:about' => $notice->uri,
|
||||
'rdf:type' => 'http://rdfs.org/sioc/types#MicroblogPost'));
|
||||
$title = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
|
||||
$this->element('title', null, $title);
|
||||
$this->element('link', null, $nurl);
|
||||
$this->element('description', null, $profile->nickname."'s status on ".common_exact_date($notice->created));
|
||||
if ($notice->rendered) {
|
||||
$this->element('content:encoded', null, common_xml_safe_str($notice->rendered));
|
||||
}
|
||||
$this->element('dc:date', null, common_date_w3dtf($notice->created));
|
||||
$this->element('dc:creator', null, ($profile->fullname) ? $profile->fullname : $profile->nickname);
|
||||
$this->element('sioc:has_creator', array('rdf:resource' => $creator_uri));
|
||||
$this->element('foaf:maker', array('rdf:resource' => $creator_uri));
|
||||
$this->element('sioc:has_creator', array('rdf:resource' => $creator_uri.'#acct'));
|
||||
$this->element('laconica:postIcon', array('rdf:resource' => $profile->avatarUrl()));
|
||||
$this->element('cc:licence', array('rdf:resource' => common_config('license', 'url')));
|
||||
$this->elementEnd('item');
|
||||
@ -216,15 +221,15 @@ class Rss10Action extends Action
|
||||
foreach ($this->creators as $uri => $profile) {
|
||||
$id = $profile->id;
|
||||
$nickname = $profile->nickname;
|
||||
$this->elementStart('sioc:User', array('rdf:about' => $uri));
|
||||
$this->elementStart('foaf:Agent', array('rdf:about' => $uri));
|
||||
$this->element('foaf:nick', null, $nickname);
|
||||
if ($profile->fullname) {
|
||||
$this->element('foaf:name', null, $profile->fullname);
|
||||
}
|
||||
$this->element('sioc:id', null, $id);
|
||||
$this->element('foaf:holdsAccount', array('rdf:resource' => $uri.'#acct'));
|
||||
$avatar = $profile->avatarUrl();
|
||||
$this->element('sioc:avatar', array('rdf:resource' => $avatar));
|
||||
$this->elementEnd('sioc:User');
|
||||
$this->element('foaf:depiction', array('rdf:resource' => $avatar));
|
||||
$this->elementEnd('foaf:Agent');
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +244,7 @@ class Rss10Action extends Action
|
||||
'xmlns:dc' =>
|
||||
'http://purl.org/dc/elements/1.1/',
|
||||
'xmlns:cc' =>
|
||||
'http://web.resource.org/cc/',
|
||||
'http://creativecommons.org/ns#',
|
||||
'xmlns:content' =>
|
||||
'http://purl.org/rss/1.0/modules/content/',
|
||||
'xmlns:foaf' =>
|
||||
@ -253,10 +258,10 @@ class Rss10Action extends Action
|
||||
'xmlns' => 'http://purl.org/rss/1.0/'));
|
||||
$this->elementStart('sioc:Site', array('rdf:about' => common_root_url()));
|
||||
$this->element('sioc:name', null, common_config('site', 'name'));
|
||||
$this->elementStart('sioc:container_of');
|
||||
$this->elementStart('sioc:space_of');
|
||||
$this->element('sioc:Container', array('rdf:about' =>
|
||||
$channel['url']));
|
||||
$this->elementEnd('sioc:container_of');
|
||||
$this->elementEnd('sioc:space_of');
|
||||
$this->elementEnd('sioc:Site');
|
||||
}
|
||||
|
||||
|
@ -70,30 +70,3 @@ function theme_path($relative, $theme=null)
|
||||
return common_path('theme/'.$theme.'/'.$relative);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the full URL of a file in a skin dir based on its relative name
|
||||
*
|
||||
* @param string $relative relative path within the theme, skin directory
|
||||
* @param string $theme name of the theme; defaults to current theme
|
||||
* @param string $skin name of the skin; defaults to current theme
|
||||
*
|
||||
* @return string URL of the file
|
||||
*/
|
||||
|
||||
function skin_path($relative, $theme=null, $skin=null)
|
||||
{
|
||||
if (!$theme) {
|
||||
$theme = common_config('site', 'theme');
|
||||
}
|
||||
if (!$skin) {
|
||||
$skin = common_config('site', 'skin');
|
||||
}
|
||||
$server = common_config('theme', 'server');
|
||||
if ($server) {
|
||||
return 'http://'.$server.'/'.$theme.'/skin/'.$skin.'/'.$relative;
|
||||
} else {
|
||||
return common_path('theme/'.$theme.'/skin/'.$skin.'/'.$relative);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user