Merge branch '0.7.x' into cometplugin

This commit is contained in:
Evan Prodromou 2009-05-01 08:00:41 -07:00
commit 1a61a171cd
25 changed files with 326 additions and 106 deletions

3
.gitignore vendored
View File

@ -13,3 +13,6 @@ dataobject.ini
*.rej *.rej
.#* .#*
*.swp *.swp
.buildpath
.project
.settings

View File

@ -59,7 +59,7 @@ class AccesstokenAction extends Action
try { try {
common_debug('getting request from env variables', __FILE__); common_debug('getting request from env variables', __FILE__);
common_remove_magic_from_request(); common_remove_magic_from_request();
$req = OAuthRequest::from_request('POST', common_locale_url('accesstoken')); $req = OAuthRequest::from_request('POST', common_local_url('accesstoken'));
common_debug('getting a server', __FILE__); common_debug('getting a server', __FILE__);
$server = omb_oauth_server(); $server = omb_oauth_server();
common_debug('fetching the access token', __FILE__); common_debug('fetching the access token', __FILE__);

View File

@ -130,6 +130,7 @@ class ApiAction extends Action
'statuses/friends_timeline', 'statuses/friends_timeline',
'statuses/friends', 'statuses/friends',
'statuses/replies', 'statuses/replies',
'statuses/mentions',
'statuses/followers', 'statuses/followers',
'favorites/favorites'); 'favorites/favorites');

View File

@ -107,7 +107,7 @@ class FavoritesrssAction extends Rss10Action
$c = array('url' => common_local_url('favoritesrss', $c = array('url' => common_local_url('favoritesrss',
array('nickname' => array('nickname' =>
$user->nickname)), $user->nickname)),
'title' => sprintf(_("%s favorite notices"), $user->nickname), 'title' => sprintf(_("%s's favorite notices"), $user->nickname),
'link' => common_local_url('showfavorites', 'link' => common_local_url('showfavorites',
array('nickname' => array('nickname' =>
$user->nickname)), $user->nickname)),

View File

@ -67,8 +67,8 @@ class OpenidsettingsAction extends AccountSettingsAction
function getInstructions() function getInstructions()
{ {
return _('[OpenID](%%doc.openid%%) lets you log into many sites ' . return _('[OpenID](%%doc.openid%%) lets you log into many sites' .
' with the same user account. '. ' with the same user account.'.
' Manage your associated OpenIDs from here.'); ' Manage your associated OpenIDs from here.');
} }

View File

@ -151,11 +151,11 @@ class RecoverpasswordAction extends Action
$this->element('p', null, $this->element('p', null,
_('If you\'ve forgotten or lost your' . _('If you\'ve forgotten or lost your' .
' password, you can get a new one sent to' . ' password, you can get a new one sent to' .
' the email address you have stored ' . ' the email address you have stored' .
' in your account.')); ' in your account.'));
} else if ($this->mode == 'reset') { } else if ($this->mode == 'reset') {
$this->element('p', null, $this->element('p', null,
_('You\'ve been identified. Enter a ' . _('You\'ve been identified. Enter a' .
' new password below. ')); ' new password below. '));
} }
$this->elementEnd('div'); $this->elementEnd('div');

View File

@ -74,9 +74,9 @@ class ShowfavoritesAction extends Action
function title() function title()
{ {
if ($this->page == 1) { if ($this->page == 1) {
return sprintf(_("%s favorite notices"), $this->user->nickname); return sprintf(_("%s's favorite notices"), $this->user->nickname);
} else { } else {
return sprintf(_("%s favorite notices, page %d"), return sprintf(_("%s's favorite notices, page %d"),
$this->user->nickname, $this->user->nickname,
$this->page); $this->page);
} }

View File

@ -144,10 +144,10 @@ class TwitapistatusesAction extends TwitterapiAction
break; break;
case 'atom': case 'atom':
if (isset($apidata['api_arg'])) { if (isset($apidata['api_arg'])) {
$selfuri = $selfuri = common_root_url() . $selfuri = common_root_url() .
'api/statuses/friends_timeline/' . $apidata['api_arg'] . '.atom'; 'api/statuses/friends_timeline/' . $apidata['api_arg'] . '.atom';
} else { } else {
$selfuri = $selfuri = common_root_url() . $selfuri = common_root_url() .
'api/statuses/friends_timeline.atom'; 'api/statuses/friends_timeline.atom';
} }
$this->show_atom_timeline($notice, $title, $id, $link, $subtitle, null, $selfuri); $this->show_atom_timeline($notice, $title, $id, $link, $subtitle, null, $selfuri);
@ -231,10 +231,10 @@ class TwitapistatusesAction extends TwitterapiAction
break; break;
case 'atom': case 'atom':
if (isset($apidata['api_arg'])) { if (isset($apidata['api_arg'])) {
$selfuri = $selfuri = common_root_url() . $selfuri = common_root_url() .
'api/statuses/user_timeline/' . $apidata['api_arg'] . '.atom'; 'api/statuses/user_timeline/' . $apidata['api_arg'] . '.atom';
} else { } else {
$selfuri = $selfuri = common_root_url() . $selfuri = common_root_url() .
'api/statuses/user_timeline.atom'; 'api/statuses/user_timeline.atom';
} }
$this->show_atom_timeline($notice, $title, $id, $link, $subtitle, $suplink, $selfuri); $this->show_atom_timeline($notice, $title, $id, $link, $subtitle, $suplink, $selfuri);
@ -344,7 +344,7 @@ class TwitapistatusesAction extends TwitterapiAction
$this->show($args, $apidata); $this->show($args, $apidata);
} }
function replies($args, $apidata) function mentions($args, $apidata)
{ {
parent::handle($args); parent::handle($args);
@ -360,11 +360,13 @@ class TwitapistatusesAction extends TwitterapiAction
$profile = $user->getProfile(); $profile = $user->getProfile();
$sitename = common_config('site', 'name'); $sitename = common_config('site', 'name');
$title = sprintf(_('%1$s / Updates replying to %2$s'), $sitename, $user->nickname); $title = sprintf(_('%1$s / Updates mentioning %2$s'),
$sitename, $user->nickname);
$taguribase = common_config('integration', 'taguri'); $taguribase = common_config('integration', 'taguri');
$id = "tag:$taguribase:Replies:".$user->id; $id = "tag:$taguribase:Mentions:".$user->id;
$link = common_local_url('replies', array('nickname' => $user->nickname)); $link = common_local_url('replies', array('nickname' => $user->nickname));
$subtitle = sprintf(_('%1$s updates that reply to updates from %2$s / %3$s.'), $sitename, $user->nickname, $profile->getBestName()); $subtitle = sprintf(_('%1$s updates that reply to updates from %2$s / %3$s.'),
$sitename, $user->nickname, $profile->getBestName());
if (!$page) { if (!$page) {
$page = 1; $page = 1;
@ -385,7 +387,8 @@ class TwitapistatusesAction extends TwitterapiAction
$since = strtotime($this->arg('since')); $since = strtotime($this->arg('since'));
$notice = $user->getReplies((($page-1)*20), $count, $since_id, $before_id, $since); $notice = $user->getReplies((($page-1)*20),
$count, $since_id, $before_id, $since);
$notices = array(); $notices = array();
while ($notice->fetch()) { while ($notice->fetch()) {
@ -400,14 +403,10 @@ class TwitapistatusesAction extends TwitterapiAction
$this->show_rss_timeline($notices, $title, $link, $subtitle); $this->show_rss_timeline($notices, $title, $link, $subtitle);
break; break;
case 'atom': case 'atom':
if (isset($apidata['api_arg'])) { $selfuri = common_root_url() .
$selfuri = $selfuri = common_root_url() . ltrim($_SERVER['QUERY_STRING'], 'p=');
'api/statuses/replies/' . $apidata['api_arg'] . '.atom'; $this->show_atom_timeline($notices, $title, $id, $link, $subtitle,
} else { null, $selfuri);
$selfuri = $selfuri = common_root_url() .
'api/statuses/replies.atom';
}
$this->show_atom_timeline($notices, $title, $id, $link, $subtitle, null, $selfuri);
break; break;
case 'json': case 'json':
$this->show_json_timeline($notices); $this->show_json_timeline($notices);
@ -418,6 +417,11 @@ class TwitapistatusesAction extends TwitterapiAction
} }
function replies($args, $apidata)
{
call_user_func(array($this, 'mentions'), $args, $apidata);
}
function show($args, $apidata) function show($args, $apidata)
{ {
parent::handle($args); parent::handle($args);

View File

@ -285,7 +285,7 @@ class Notice extends Memcached_DataObject
// Clear the user's cache // Clear the user's cache
$cache = common_memcache(); $cache = common_memcache();
if (!empty($cache)) { if (!empty($cache)) {
$cache->delete(common_cache_key('user:notices_with_friends:' . $this->profile_id)); $cache->delete(common_cache_key('notice_inbox:by_user:'.$this->profile_id));
} }
$this->blowNoticeCache($blowLast); $this->blowNoticeCache($blowLast);
$this->blowPublicCache($blowLast); $this->blowPublicCache($blowLast);
@ -307,9 +307,9 @@ class Notice extends Memcached_DataObject
$member->group_id = $group_inbox->group_id; $member->group_id = $group_inbox->group_id;
if ($member->find()) { if ($member->find()) {
while ($member->fetch()) { while ($member->fetch()) {
$cache->delete(common_cache_key('user:notices_with_friends:' . $member->profile_id)); $cache->delete(common_cache_key('notice_inbox:by_user:' . $member->profile_id));
if ($blowLast) { if ($blowLast) {
$cache->delete(common_cache_key('user:notices_with_friends:' . $member->profile_id . ';last')); $cache->delete(common_cache_key('notice_inbox:by_user:' . $member->profile_id . ';last'));
} }
} }
} }
@ -352,9 +352,9 @@ class Notice extends Memcached_DataObject
'WHERE subscription.subscribed = ' . $this->profile_id); 'WHERE subscription.subscribed = ' . $this->profile_id);
while ($user->fetch()) { while ($user->fetch()) {
$cache->delete(common_cache_key('user:notices_with_friends:' . $user->id)); $cache->delete(common_cache_key('notice_inbox:by_user:'.$user->id));
if ($blowLast) { if ($blowLast) {
$cache->delete(common_cache_key('user:notices_with_friends:' . $user->id . ';last')); $cache->delete(common_cache_key('notice_inbox:by_user:'.$user->id.';last'));
} }
} }
$user->free(); $user->free();
@ -613,27 +613,80 @@ class Notice extends Memcached_DataObject
return $wrapper; return $wrapper;
} }
function getStreamByIds($ids)
{
$cache = common_memcache();
if (!empty($cache)) {
$notices = array();
foreach ($ids as $id) {
$notices[] = Notice::staticGet('id', $id);
}
return new ArrayWrapper($notices);
} else {
$notice = new Notice();
$notice->whereAdd('id in (' . implode(', ', $ids) . ')');
$notice->orderBy('id DESC');
$notice->find();
return $notice;
}
}
function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null) function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null)
{ {
$ids = Notice::stream(array('Notice', '_publicStreamDirect'),
array(),
'public',
$offset, $limit, $since_id, $before_id, $since);
$parts = array(); return Notice::getStreamByIds($ids);
}
$qry = 'SELECT * FROM notice '; function _publicStreamDirect($offset=0, $limit=20, $since_id=0, $before_id=0, $since=null)
{
$notice = new Notice();
$notice->selectAdd(); // clears it
$notice->selectAdd('id');
$notice->orderBy('id DESC');
if (!is_null($offset)) {
$notice->limit($offset, $limit);
}
if (common_config('public', 'localonly')) { if (common_config('public', 'localonly')) {
$parts[] = 'is_local = 1'; $notice->whereAdd('is_local = 1');
} else { } else {
# -1 == blacklisted # -1 == blacklisted
$parts[] = 'is_local != -1'; $notice->whereAdd('is_local != -1');
} }
if ($parts) { if ($since_id != 0) {
$qry .= ' WHERE ' . implode(' AND ', $parts); $notice->whereAdd('id > ' . $since_id);
} }
return Notice::getStream($qry, if ($before_id != 0) {
'public', $notice->whereAdd('id < ' . $before_id);
$offset, $limit, $since_id, $before_id, null, $since); }
if (!is_null($since)) {
$notice->whereAdd('created > \'' . date('Y-m-d H:i:s', $since) . '\'');
}
$ids = array();
if ($notice->find()) {
while ($notice->fetch()) {
$ids[] = $notice->id;
}
}
$notice->free();
$notice = NULL;
return $ids;
} }
function addToInboxes() function addToInboxes()
@ -947,4 +1000,59 @@ class Notice extends Memcached_DataObject
array('notice' => $this->id)); array('notice' => $this->id));
} }
} }
function stream($fn, $args, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $since=null)
{
$cache = common_memcache();
if (empty($cache) ||
$since_id != 0 || $before_id != 0 || !is_null($since) ||
($offset + $limit) > NOTICE_CACHE_WINDOW) {
return call_user_func_array($fn, array_merge($args, array($offset, $limit, $since_id,
$before_id, $since)));
}
$idkey = common_cache_key($cachekey);
$idstr = $cache->get($idkey);
if (!empty($idstr)) {
// Cache hit! Woohoo!
$window = explode(',', $idstr);
$ids = array_slice($window, $offset, $limit);
return $ids;
}
$laststr = $cache->get($idkey.';last');
if (!empty($laststr)) {
$window = explode(',', $laststr);
$last_id = $window[0];
$new_ids = call_user_func_array($fn, array_merge($args, array(0, NOTICE_CACHE_WINDOW,
$last_id, 0, null)));
$new_window = array_merge($new_ids, $window);
$new_windowstr = implode(',', $new_window);
$result = $cache->set($idkey, $new_windowstr);
$result = $cache->set($idkey . ';last', $new_windowstr);
$ids = array_slice($new_window, $offset, $limit);
return $ids;
}
$window = call_user_func_array($fn, array_merge($args, array(0, NOTICE_CACHE_WINDOW,
0, 0, null)));
$windowstr = implode(',', $window);
$result = $cache->set($idkey, $windowstr);
$result = $cache->set($idkey . ';last', $windowstr);
$ids = array_slice($window, $offset, $limit);
return $ids;
}
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* /*
* Laconica - a distributed open-source microblogging tool * Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc. * Copyright (C) 2008, 2009, Control Yourself, Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by * it under the terms of the GNU Affero General Public License as published by
@ -21,7 +21,11 @@ if (!defined('LACONICA')) { exit(1); }
require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Notice_inbox extends Memcached_DataObject // We keep 5 pages of inbox notices in memcache, +1 for pagination check
define('INBOX_CACHE_WINDOW', 101);
class Notice_inbox extends Memcached_DataObject
{ {
###START_AUTOCODE ###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */ /* the code below is auto generated do not remove the above tag */
@ -38,4 +42,47 @@ class Notice_inbox extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */ /* the code above is auto generated do not remove the tag below */
###END_AUTOCODE ###END_AUTOCODE
function stream($user_id, $offset, $limit, $since_id, $before_id, $since)
{
return Notice::stream(array('Notice_inbox', '_streamDirect'),
array($user_id),
'notice_inbox:by_user:'.$user_id,
$offset, $limit, $since_id, $before_id, $since);
}
function _streamDirect($user_id, $offset, $limit, $since_id, $before_id, $since)
{
$inbox = new Notice_inbox();
$inbox->user_id = $user_id;
if ($since_id != 0) {
$inbox->whereAdd('notice_id > ' . $since_id);
}
if ($before_id != 0) {
$inbox->whereAdd('notice_id < ' . $before_id);
}
if (!is_null($since)) {
$inbox->whereAdd('created > \'' . date('Y-m-d H:i:s', $since) . '\'');
}
$inbox->orderBy('notice_id DESC');
if (!is_null($offset)) {
$inbox->limit($offset, $limit);
}
$ids = array();
if ($inbox->find()) {
while ($inbox->fetch()) {
$ids[] = $inbox->notice_id;
}
}
return $ids;
}
} }

View File

@ -444,21 +444,17 @@ class User extends Memcached_DataObject
'SELECT notice.* ' . 'SELECT notice.* ' .
'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' . 'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' .
'WHERE subscription.subscriber = %d '; 'WHERE subscription.subscriber = %d ';
$order = null; return Notice::getStream(sprintf($qry, $this->id),
'user:notices_with_friends:' . $this->id,
$offset, $limit, $since_id, $before_id,
$order, $since);
} else if ($enabled === true || } else if ($enabled === true ||
($enabled == 'transitional' && $this->inboxed == 1)) { ($enabled == 'transitional' && $this->inboxed == 1)) {
$qry = $ids = Notice_inbox::stream($this->id, $offset, $limit, $since_id, $before_id, $since);
'SELECT notice.* ' .
'FROM notice JOIN notice_inbox ON notice.id = notice_inbox.notice_id ' . return Notice::getStreamByIds($ids);
'WHERE notice_inbox.user_id = %d ';
// NOTE: we override ORDER
$order = null;
} }
return Notice::getStream(sprintf($qry, $this->id),
'user:notices_with_friends:' . $this->id,
$offset, $limit, $since_id, $before_id,
$order, $since);
} }
function blowFavesCache() function blowFavesCache()

View File

@ -128,7 +128,7 @@
var a = document.createElement('A'); var a = document.createElement('A');
a.innerHTML = 'get this'; a.innerHTML = 'get this';
a.target = '_blank'; a.target = '_blank';
a.href = 'http://identica/doc/badge'; a.href = 'http://identi.ca/doc/badge';
$.s.f.appendChild(a); $.s.f.appendChild(a);
$.s.appendChild($.s.f); $.s.appendChild($.s.f);
$.f.getUser(); $.f.getUser();

View File

@ -166,23 +166,14 @@ $(document).ready(function(){
$("#notice_action-submit").addClass("disabled"); $("#notice_action-submit").addClass("disabled");
return true; return true;
}, },
timeout: 7000,
error: function (xhr, textStatus, errorThrown) { $("#form_notice").removeClass("processing"); error: function (xhr, textStatus, errorThrown) { $("#form_notice").removeClass("processing");
$("#notice_action-submit").removeAttr("disabled"); $("#notice_action-submit").removeAttr("disabled");
$("#notice_action-submit").removeClass("disabled"); $("#notice_action-submit").removeClass("disabled");
if ($(".error", xhr.responseXML).length > 0) {
if (textStatus == "timeout") { $('#form_notice').append(document._importNode($(".error", xhr.responseXML).get(0), true));
alert ("Sorry! We had trouble sending your notice. The servers are overloaded. Please try again, and contact the site administrator if this problem persists");
} }
else { else {
switch(xhr.status) { alert("Sorry! We had trouble sending your notice ("+xhr.status+" "+xhr.statusText+"). Please report the problem to the site administrator if this happens again.");
default: case 404:
alert("Sorry! We had trouble sending your notice. Please report the problem to the site administrator if this happens again.");
break;
case 502: case 503: case 504:
alert("Sorry! We had trouble sending your notice. The servers are overloaded. Please try again, and contact the site administrator if this problem persists.");
break;
}
} }
}, },
success: function(xml) { if ($("#error", xml).length > 0) { success: function(xml) { if ($("#error", xml).length > 0) {
@ -197,11 +188,15 @@ $(document).ready(function(){
alert(result); alert(result);
} }
else { else {
$("#notices_primary .notices").prepend(document._importNode($("li", xml).get(0), true)); li = $("li", xml).get(0);
$("#notices_primary .notice:first").css({display:"none"}); id = li.id;
$("#notices_primary .notice:first").fadeIn(2500); if ($("#"+li.id).length == 0) {
NoticeHover(); $("#notices_primary .notices").prepend(document._importNode(li, true));
NoticeReply(); $("#notices_primary .notice:first").css({display:"none"});
$("#notices_primary .notice:first").fadeIn(2500);
NoticeHover();
NoticeReply();
}
} }
$("#notice_data-text").val(""); $("#notice_data-text").val("");
counter(); counter();

View File

@ -134,9 +134,11 @@ class GalleryAction extends Action
$this->elementStart('li', array('id'=>'filter_tags_item')); $this->elementStart('li', array('id'=>'filter_tags_item'));
$this->elementStart('form', array('name' => 'bytag', $this->elementStart('form', array('name' => 'bytag',
'id' => 'bytag', 'id' => 'bytag',
'action' => common_path('?action=' . $this->trimmed('action')),
'method' => 'post')); 'method' => 'post'));
$this->dropdown('tag', _('Tag'), $content, $this->dropdown('tag', _('Tag'), $content,
_('Choose a tag to narrow list'), false, $tag); _('Choose a tag to narrow list'), false, $tag);
$this->hidden('nickname', $this->user->nickname);
$this->submit('submit', _('Go')); $this->submit('submit', _('Go'));
$this->elementEnd('form'); $this->elementEnd('form');
$this->elementEnd('li'); $this->elementEnd('li');
@ -169,4 +171,4 @@ class GalleryAction extends Action
{ {
return array(); return array();
} }
} }

View File

@ -231,12 +231,12 @@ class Router
$m->connect('api/statuses/:method', $m->connect('api/statuses/:method',
array('action' => 'api', array('action' => 'api',
'apiaction' => 'statuses'), 'apiaction' => 'statuses'),
array('method' => '(public_timeline|friends_timeline|user_timeline|update|replies|friends|followers|featured)(\.(atom|rss|xml|json))?')); array('method' => '(public_timeline|friends_timeline|user_timeline|update|replies|mentions|friends|followers|featured)(\.(atom|rss|xml|json))?'));
$m->connect('api/statuses/:method/:argument', $m->connect('api/statuses/:method/:argument',
array('action' => 'api', array('action' => 'api',
'apiaction' => 'statuses'), 'apiaction' => 'statuses'),
array('method' => '(user_timeline|friends_timeline|replies|show|destroy|friends|followers)')); array('method' => '(user_timeline|friends_timeline|replies|mentions|show|destroy|friends|followers)'));
// users // users

View File

@ -74,3 +74,4 @@ class SubPeopleTagCloudSection extends TagCloudSection
$this->out->elementEnd('li'); $this->out->elementEnd('li');
} }
} }

View File

@ -49,6 +49,14 @@ class SubscribersPeopleSelfTagCloudSection extends SubPeopleTagCloudSection
} }
function query() { function query() {
return 'select tag, count(tag) as weight from subscription left join profile_tag on tagger = subscriber where subscribed=%d and subscribed != subscriber and tagger = tagged group by tag order by weight desc'; // return 'select tag, count(tag) as weight from subscription left join profile_tag on tagger = subscriber where subscribed=%d and subscribed != subscriber and tagger = tagged group by tag order by weight desc';
return 'select tag, count(tag) as weight from subscription left join profile_tag on tagger = subscriber where subscribed=%d and subscribed != subscriber and tagger = tagged and tag is not null group by tag order by weight desc';
// return 'select tag, count(tag) as weight from subscription left join profile_tag on tagger = subscribed where subscriber=%d and subscribed != subscriber and tagger = tagged and tag is not null group by tag order by weight desc';
} }
} }

View File

@ -53,8 +53,9 @@ class SubscribersPeopleTagCloudSection extends SubPeopleTagCloudSection
return common_local_url('subscribers', array('nickname' => $nickname, 'tag' => $tag)); return common_local_url('subscribers', array('nickname' => $nickname, 'tag' => $tag));
} }
function query() { function query() {
return 'select tag, count(tag) as weight from subscription left join profile_tag on subscriber=tagged and subscribed=tagger where subscribed=%d and subscriber != subscribed group by tag order by weight desc'; // return 'select tag, count(tag) as weight from subscription left join profile_tag on subscriber=tagged and subscribed=tagger where subscribed=%d and subscriber != subscribed group by tag order by weight desc';
return 'select tag, count(tag) as weight from subscription left join profile_tag on subscriber=tagged and subscribed=tagger where subscribed=%d and subscriber != subscribed and tag is not null group by tag order by weight desc';
} }
} }

View File

@ -49,6 +49,13 @@ class SubscriptionsPeopleSelfTagCloudSection extends SubPeopleTagCloudSection
} }
function query() { function query() {
return 'select tag, count(tag) as weight from subscription left join profile_tag on tagger = subscriber where subscribed=%d and subscriber != subscribed and tagger = tagged group by tag order by weight desc'; // return 'select tag, count(tag) as weight from subscription left join profile_tag on tagger = subscriber where subscribed=%d and subscriber != subscribed and tagger = tagged group by tag order by weight desc';
return 'select tag, count(tag) as weight from subscription left join profile_tag on tagger = subscribed where subscriber=%d and subscribed != subscriber and tagger = tagged and tag is not null group by tag order by weight desc';
// return 'select tag, count(tag) as weight from subscription left join profile_tag on tagger = subscriber where subscribed=%d and subscribed != subscriber and tagger = tagged and tag is not null group by tag order by weight desc';
} }
} }

View File

@ -54,6 +54,8 @@ class SubscriptionsPeopleTagCloudSection extends SubPeopleTagCloudSection
} }
function query() { function query() {
return 'select tag, count(tag) as weight from subscription left join profile_tag on subscriber=tagger and subscribed=tagged where subscriber=%d and subscriber != subscribed group by tag order by weight desc'; // return 'select tag, count(tag) as weight from subscription left join profile_tag on subscriber=tagger and subscribed=tagged where subscriber=%d and subscriber != subscribed group by tag order by weight desc';
return 'select tag, count(tag) as weight from subscription left join profile_tag on subscriber=tagger and subscribed=tagged where subscriber=%d and subscriber != subscribed and tag is not null group by tag order by weight desc';
} }
} }

View File

@ -121,6 +121,12 @@ class LinkbackPlugin extends Plugin
{ {
$args = array($this->notice->uri, $url); $args = array($this->notice->uri, $url);
if (!extension_loaded('xmlrpc')) {
if (!dl('xmlrpc.so')) {
common_log(LOG_ERR, "Can't pingback; xmlrpc extension not available.");
}
}
$request = xmlrpc_encode_request('pingback.ping', $args); $request = xmlrpc_encode_request('pingback.ping', $args);
$context = stream_context_create(array('http' => array('method' => "POST", $context = stream_context_create(array('http' => array('method' => "POST",
'header' => 'header' =>
@ -141,7 +147,7 @@ class LinkbackPlugin extends Plugin
} }
// Largely cadged from trackback_cls.php by // Largely cadged from trackback_cls.php by
// Ran Aroussi <ran@blogish.org>, GPL2 // Ran Aroussi <ran@blogish.org>, GPL2 or any later version
// http://phptrackback.sourceforge.net/ // http://phptrackback.sourceforge.net/
function getTrackback($text, $url) function getTrackback($text, $url)

52
scripts/getvaliddaemons.php Executable file
View File

@ -0,0 +1,52 @@
#!/usr/bin/env php
<?php
/*
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Utility script to get a list of daemons that should run, based on the
* current configuration. This is used by startdaemons.sh to determine what
* it should and shouldn't start up. The output is a list of space-separated
* daemon names.
*/
# Abort if called from a web server
if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
print "This script must be run from the command line\n";
exit();
}
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
define('LACONICA', true);
require_once(INSTALLDIR . '/lib/common.php');
if(common_config('xmpp','enabled')) {
echo "xmppdaemon.php jabberqueuehandler.php publicqueuehandler.php ";
echo "xmppconfirmhandler.php ";
}
if(common_config('memcached','enabled')) {
echo "memcachedqueuehandler.php ";
}
echo "ombqueuehandler.php ";
echo "twitterqueuehandler.php ";
echo "facebookqueuehandler.php ";
echo "pingqueuehandler.php ";
echo "inboxqueuehandler.php ";
echo "smsqueuehandler.php ";

View File

@ -21,11 +21,9 @@
# Note that the 'maildaemon' needs to run as a mail filter. # Note that the 'maildaemon' needs to run as a mail filter.
DIR=`dirname $0` DIR=`dirname $0`
DAEMONS=`php $DIR/getvaliddaemons.php`
for f in xmppdaemon.php jabberqueuehandler.php publicqueuehandler.php \ for f in $DAEMONS; do
xmppconfirmhandler.php smsqueuehandler.php ombqueuehandler.php \
twitterqueuehandler.php facebookqueuehandler.php pingqueuehandler.php \
memcachedqueuehandler.php inboxqueuehandler.php; do
echo -n "Starting $f..."; echo -n "Starting $f...";
php $DIR/$f php $DIR/$f

View File

@ -25,7 +25,7 @@ DIR=`php $SDIR/getpiddir.php`
for f in jabberhandler ombhandler publichandler smshandler pinghandler \ for f in jabberhandler ombhandler publichandler smshandler pinghandler \
xmppconfirmhandler xmppdaemon twitterhandler facebookhandler \ xmppconfirmhandler xmppdaemon twitterhandler facebookhandler \
memcachedhandler inboxhandler; do memcachehandler inboxhandler; do
FILES="$DIR/$f.*.pid" FILES="$DIR/$f.*.pid"
for ff in "$FILES" ; do for ff in "$FILES" ; do

View File

@ -86,7 +86,7 @@ border:0;
.error, .error,
.success { .success {
padding:4px 7px; padding:4px 1.55%;
border-radius:4px; border-radius:4px;
-moz-border-radius:4px; -moz-border-radius:4px;
-webkit-border-radius:4px; -webkit-border-radius:4px;
@ -426,6 +426,7 @@ line-height:1;
#form_notice fieldset { #form_notice fieldset {
border:0; border:0;
padding:0; padding:0;
position:relative;
} }
#form_notice legend { #form_notice legend {
display:none; display:none;
@ -480,7 +481,13 @@ margin-bottom:7px;
margin-left:18px; margin-left:18px;
float:left; float:left;
} }
#form_notice .error {
float:left;
clear:both;
width:96.9%;
margin-bottom:0;
line-height:1.618;
}
/* entity_profile */ /* entity_profile */
.entity_profile { .entity_profile {
@ -835,23 +842,6 @@ text-transform:lowercase;
} }
.notice-data {
position:absolute;
top:18px;
right:0;
min-height:50px;
margin-bottom:4px;
}
.notice .entry-content .notice-data dt {
display:none;
}
.notice-data a {
display:block;
outline:none;
}
.notice-options { .notice-options {
padding-left:2%; padding-left:2%;
float:left; float:left;
@ -1029,6 +1019,8 @@ padding-right:30px;
.hentry .entry-content p { .hentry .entry-content p {
margin-bottom:18px; margin-bottom:18px;
} }
.system_notice ul,
.instructions ul,
.hentry entry-content ol, .hentry entry-content ol,
.hentry .entry-content ul { .hentry .entry-content ul {
list-style-position:inside; list-style-position:inside;
@ -1153,9 +1145,6 @@ clear:both;
margin-bottom:0; margin-bottom:0;
} }
.instructions ul {
list-style-position:inside;
}
.instructions p, .instructions p,
.instructions ul { .instructions ul {
margin-bottom:18px; margin-bottom:18px;