Merge branch '0.7.x' into 0.8.x
This commit is contained in:
commit
e632f3be6f
|
@ -143,6 +143,25 @@ class FavoritedAction extends Action
|
||||||
$this->elementStart('div', 'instructions');
|
$this->elementStart('div', 'instructions');
|
||||||
$this->raw($output);
|
$this->raw($output);
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
|
|
||||||
|
$favorite = new Fave;
|
||||||
|
|
||||||
|
if ($favorite->count()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$message = _('Favorite notices appear on this page but noone has favorited one yet.') . ' ';
|
||||||
|
|
||||||
|
if (common_logged_in()) {
|
||||||
|
$message .= _('Be the first to add a notice to your favorites by clicking the fave button next to any notice you like.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$message .= _('Why not [register an account](%%action.register%%) and be the first to add a notice to your favorites!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->elementStart('div', 'blankfiller');
|
||||||
|
$this->raw(common_markup_to_html($message));
|
||||||
|
$this->elementEnd('div');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,7 +33,24 @@ class FoafAction extends Action
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
$this->nickname = $this->trimmed('nickname');
|
|
||||||
|
$nickname_arg = $this->arg('nickname');
|
||||||
|
|
||||||
|
if (empty($nickname_arg)) {
|
||||||
|
$this->clientError(_('No such user.'), 404);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->nickname = common_canonical_nickname($nickname_arg);
|
||||||
|
|
||||||
|
// Permanent redirect on non-canonical nickname
|
||||||
|
|
||||||
|
if ($nickname_arg != $this->nickname) {
|
||||||
|
common_redirect(common_local_url('foaf',
|
||||||
|
array('nickname' => $this->nickname)),
|
||||||
|
301);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$this->user = User::staticGet('nickname', $this->nickname);
|
$this->user = User::staticGet('nickname', $this->nickname);
|
||||||
|
|
||||||
|
@ -122,20 +139,30 @@ class FoafAction extends Action
|
||||||
|
|
||||||
if ($sub->find()) {
|
if ($sub->find()) {
|
||||||
while ($sub->fetch()) {
|
while ($sub->fetch()) {
|
||||||
if ($sub->token) {
|
if (!empty($sub->token)) {
|
||||||
$other = Remote_profile::staticGet('id', $sub->subscribed);
|
$other = Remote_profile::staticGet('id', $sub->subscribed);
|
||||||
} else {
|
} else {
|
||||||
$other = User::staticGet('id', $sub->subscribed);
|
$other = User::staticGet('id', $sub->subscribed);
|
||||||
}
|
}
|
||||||
if (!$other) {
|
if (empty($other)) {
|
||||||
common_debug('Got a bad subscription: '.print_r($sub,true));
|
common_debug('Got a bad subscription: '.print_r($sub,true));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$this->element('knows', array('rdf:resource' => $other->uri));
|
$this->element('knows', array('rdf:resource' => $other->uri));
|
||||||
$person[$other->uri] = array(LISTENEE, $other);
|
$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);
|
||||||
|
|
||||||
// Get people who subscribe to user
|
// Get people who subscribe to user
|
||||||
|
|
||||||
$sub = new Subscription();
|
$sub = new Subscription();
|
||||||
|
@ -156,25 +183,36 @@ class FoafAction extends Action
|
||||||
if (array_key_exists($other->uri, $person)) {
|
if (array_key_exists($other->uri, $person)) {
|
||||||
$person[$other->uri][0] = BOTH;
|
$person[$other->uri][0] = BOTH;
|
||||||
} else {
|
} else {
|
||||||
$person[$other->uri] = array(LISTENER, $other);
|
$person[$other->uri] = array(LISTENER,
|
||||||
|
$other->id,
|
||||||
|
$other->nickname,
|
||||||
|
(empty($sub->token)) ? 'User' : 'Remote_profile');
|
||||||
}
|
}
|
||||||
|
$other->free();
|
||||||
|
$other = null;
|
||||||
|
unset($other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sub->free();
|
||||||
|
$sub = null;
|
||||||
|
unset($sub);
|
||||||
|
|
||||||
$this->elementEnd('Person');
|
$this->elementEnd('Person');
|
||||||
|
|
||||||
foreach ($person as $uri => $p) {
|
foreach ($person as $uri => $p) {
|
||||||
$foaf_url = null;
|
$foaf_url = null;
|
||||||
if ($p[1] instanceof User) {
|
list($type, $id, $nickname, $cls) = $p;
|
||||||
$foaf_url = common_local_url('foaf', array('nickname' => $p[1]->nickname));
|
if ($cls == 'User') {
|
||||||
|
$foaf_url = common_local_url('foaf', array('nickname' => $nickname));
|
||||||
}
|
}
|
||||||
$this->profile = Profile::staticGet($p[1]->id);
|
$profile = Profile::staticGet($id);
|
||||||
$this->elementStart('Person', array('rdf:about' => $uri));
|
$this->elementStart('Person', array('rdf:about' => $uri));
|
||||||
if ($p[0] == LISTENER || $p[0] == BOTH) {
|
if ($type == LISTENER || $type == BOTH) {
|
||||||
$this->element('knows', array('rdf:resource' => $this->user->uri));
|
$this->element('knows', array('rdf:resource' => $this->user->uri));
|
||||||
}
|
}
|
||||||
$this->showMicrobloggingAccount($this->profile, ($p[1] instanceof User) ?
|
$this->showMicrobloggingAccount($profile, ($cls == 'User') ?
|
||||||
common_root_url() : null);
|
common_root_url() : null);
|
||||||
if ($foaf_url) {
|
if ($foaf_url) {
|
||||||
$this->element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
|
$this->element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
|
||||||
}
|
}
|
||||||
|
@ -182,6 +220,9 @@ class FoafAction extends Action
|
||||||
if ($foaf_url) {
|
if ($foaf_url) {
|
||||||
$this->showPpd($foaf_url, $uri);
|
$this->showPpd($foaf_url, $uri);
|
||||||
}
|
}
|
||||||
|
$profile->free();
|
||||||
|
$profile = null;
|
||||||
|
unset($profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->elementEnd('rdf:RDF');
|
$this->elementEnd('rdf:RDF');
|
||||||
|
|
|
@ -168,14 +168,13 @@ class PublicAction extends Action
|
||||||
|
|
||||||
function showPageNotice()
|
function showPageNotice()
|
||||||
{
|
{
|
||||||
$notice = Notice::publicStream(0, 1);
|
$notice = new Notice;
|
||||||
|
|
||||||
if (!$notice) {
|
if (!$notice) {
|
||||||
$this->serverError(_('Could not retrieve public stream.'));
|
$this->serverError(_('Could not retrieve public stream.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no notices in the public stream, let's get out of here
|
|
||||||
if ($notice->count()) {
|
if ($notice->count()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -184,25 +183,9 @@ class PublicAction extends Action
|
||||||
|
|
||||||
if (common_logged_in()) {
|
if (common_logged_in()) {
|
||||||
$message .= _('Be the first to post!');
|
$message .= _('Be the first to post!');
|
||||||
/*
|
|
||||||
sprintf(_('You are logged in... %%%%site.name%%%% groups let you find and talk with ' .
|
|
||||||
'people of similar interests. After you join a group ' .
|
|
||||||
'you can send messages to all other members using the ' .
|
|
||||||
'syntax "!groupname". Don\'t see a group you like? Try ' .
|
|
||||||
'[searching for one](%%%%action.groupsearch%%%%) or ' .
|
|
||||||
'[start your own!](%%%%action.newgroup%%%%)'));
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$message .= _('Why not [register an account](%%action.register%%) and be the first to post!');
|
$message .= _('Why not [register an account](%%action.register%%) and be the first to post!');
|
||||||
/*
|
|
||||||
sprintf(_('You are not logged in... %%%%site.name%%%% groups let you find and talk with ' .
|
|
||||||
'people of similar interests. After you join a group ' .
|
|
||||||
'you can send messages to all other members using the ' .
|
|
||||||
'syntax "!groupname". Don\'t see a group you like? Try ' .
|
|
||||||
'[searching for one](%%%%action.groupsearch%%%%) or ' .
|
|
||||||
'[start your own!](%%%%action.newgroup%%%%)'));
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->elementStart('div', 'blankfiller');
|
$this->elementStart('div', 'blankfiller');
|
||||||
|
|
|
@ -62,6 +62,24 @@ class PublictagcloudAction extends Action
|
||||||
$this->element('p', 'instructions',
|
$this->element('p', 'instructions',
|
||||||
sprintf(_('These are most popular recent tags on %s '),
|
sprintf(_('These are most popular recent tags on %s '),
|
||||||
common_config('site', 'name')));
|
common_config('site', 'name')));
|
||||||
|
|
||||||
|
$tags = new Notice_tag;
|
||||||
|
if ($tags->count()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$message = _('Noone has posted a notice with a [hashtag](%%doc.tags%%) yet.') . ' ';
|
||||||
|
|
||||||
|
if (common_logged_in()) {
|
||||||
|
$message .= _('Be the first to post one!');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$message .= _('Why not [register an account](%%action.register%%) and be the first to post one!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->elementStart('div', 'blankfiller');
|
||||||
|
$this->raw(common_markup_to_html($message));
|
||||||
|
$this->elementEnd('div');
|
||||||
}
|
}
|
||||||
|
|
||||||
function showLocalNav()
|
function showLocalNav()
|
||||||
|
|
|
@ -97,7 +97,7 @@ class RemotesubscribeAction extends Action
|
||||||
'class' => 'form_settings',
|
'class' => 'form_settings',
|
||||||
'action' => common_local_url('remotesubscribe')));
|
'action' => common_local_url('remotesubscribe')));
|
||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
$this->element('legend', 'Subscribe to a remote user');
|
$this->element('legend', _('Subscribe to a remote user'));
|
||||||
$this->hidden('token', common_session_token());
|
$this->hidden('token', common_session_token());
|
||||||
|
|
||||||
$this->elementStart('ul', 'form_data');
|
$this->elementStart('ul', 'form_data');
|
||||||
|
|
|
@ -45,7 +45,7 @@ class SupAction extends Action
|
||||||
function availablePeriods()
|
function availablePeriods()
|
||||||
{
|
{
|
||||||
static $periods = array(86400, 43200, 21600, 7200,
|
static $periods = array(86400, 43200, 21600, 7200,
|
||||||
3600, 1800, 600, 300, 120,
|
3600, 1800, 600, 300, 120,
|
||||||
60, 30, 15);
|
60, 30, 15);
|
||||||
$available = array();
|
$available = array();
|
||||||
foreach ($periods as $period) {
|
foreach ($periods as $period) {
|
||||||
|
|
|
@ -45,4 +45,5 @@ VALUES
|
||||||
('twitux','Twitux','http://live.gnome.org/DanielMorales/Twitux', now()),
|
('twitux','Twitux','http://live.gnome.org/DanielMorales/Twitux', now()),
|
||||||
('twitvim','TwitVim','http://vim.sourceforge.net/scripts/script.php?script_id=2204', now()),
|
('twitvim','TwitVim','http://vim.sourceforge.net/scripts/script.php?script_id=2204', now()),
|
||||||
('urfastr','urfastr','http://urfastr.net/', now()),
|
('urfastr','urfastr','http://urfastr.net/', now()),
|
||||||
('adium', 'Adium', 'http://www.adiumx.com/', now());
|
('adium', 'Adium', 'http://www.adiumx.com/', now()),
|
||||||
|
('yatca','Yatca','http://www.yatca.com/', now());
|
||||||
|
|
|
@ -107,6 +107,9 @@ class Router
|
||||||
$m->connect('main/'.$a, array('action' => $a));
|
$m->connect('main/'.$a, array('action' => $a));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$m->connect('main/sup/:seconds', array('action' => 'sup'),
|
||||||
|
array('seconds' => '[0-9]+'));
|
||||||
|
|
||||||
$m->connect('main/tagother/:id', array('action' => 'tagother'));
|
$m->connect('main/tagother/:id', array('action' => 'tagother'));
|
||||||
|
|
||||||
// these take a code
|
// these take a code
|
||||||
|
|
|
@ -581,10 +581,8 @@ function common_shorten_link($url, $reverse = false)
|
||||||
|
|
||||||
function common_xml_safe_str($str)
|
function common_xml_safe_str($str)
|
||||||
{
|
{
|
||||||
$xmlStr = htmlentities(iconv('UTF-8', 'UTF-8//IGNORE', $str), ENT_NOQUOTES, 'UTF-8');
|
// Neutralize control codes and surrogates
|
||||||
|
return preg_replace('/[\p{Cc}\p{Cs}]/u', '*', $str);
|
||||||
// Replace control, formatting, and surrogate characters with '*', ala Twitter
|
|
||||||
return preg_replace('/[\p{Cc}\p{Cf}\p{Cs}]/u', '*', $str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function common_tag_link($tag)
|
function common_tag_link($tag)
|
||||||
|
@ -723,7 +721,7 @@ function common_local_url($action, $args=null, $params=null, $fragment=null)
|
||||||
{
|
{
|
||||||
static $sensitive = array('login', 'register', 'passwordsettings',
|
static $sensitive = array('login', 'register', 'passwordsettings',
|
||||||
'twittersettings', 'finishopenidlogin',
|
'twittersettings', 'finishopenidlogin',
|
||||||
'api');
|
'finishaddopenid', 'api');
|
||||||
|
|
||||||
$r = Router::get();
|
$r = Router::get();
|
||||||
$path = $r->build($action, $args, $params, $fragment);
|
$path = $r->build($action, $args, $params, $fragment);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user