Merge branch '0.8.x' of git://gitorious.org/laconica/dev into 0.8.x
This commit is contained in:
commit
8fce421607
@ -100,6 +100,12 @@ StartPublicGroupNav: Showing the public group nav menu
|
||||
EndPublicGroupNav: At the end of the public group nav menu
|
||||
- $action: the current action
|
||||
|
||||
StartSubGroupNav: Showing the subscriptions group nav menu
|
||||
- $action: the current action
|
||||
|
||||
EndSubGroupNav: At the end of the subscriptions group nav menu
|
||||
- $action: the current action
|
||||
|
||||
RouterInitialized: After the router instance has been initialized
|
||||
- $m: the Net_URL_Mapper that has just been set up
|
||||
|
||||
@ -109,3 +115,5 @@ StartLogout: Before logging out
|
||||
EndLogout: After logging out
|
||||
- $action: the logout action
|
||||
|
||||
ArgsInitialized: After the argument array has been initialized
|
||||
- $args: associative array of arguments, can be modified
|
||||
|
@ -68,6 +68,9 @@ class ShowstreamAction extends ProfileAction
|
||||
} else {
|
||||
$base = $this->user->nickname;
|
||||
}
|
||||
if (!empty($this->tag)) {
|
||||
$base .= sprintf(_(' tagged %s'), $this->tag);
|
||||
}
|
||||
|
||||
if ($this->page == 1) {
|
||||
return $base;
|
||||
@ -110,6 +113,15 @@ class ShowstreamAction extends ProfileAction
|
||||
|
||||
function getFeeds()
|
||||
{
|
||||
if (!empty($this->tag)) {
|
||||
return array(new Feed(Feed::RSS1,
|
||||
common_local_url('userrss',
|
||||
array('nickname' => $this->user->nickname,
|
||||
'tag' => $this->tag)),
|
||||
sprintf(_('Notice feed for %s tagged %s (RSS 1.0)'),
|
||||
$this->user->nickname, $this->tag)));
|
||||
}
|
||||
|
||||
return array(new Feed(Feed::RSS1,
|
||||
common_local_url('userrss',
|
||||
array('nickname' => $this->user->nickname)),
|
||||
@ -363,7 +375,9 @@ class ShowstreamAction extends ProfileAction
|
||||
|
||||
function showNotices()
|
||||
{
|
||||
$notice = $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
||||
$notice = empty($this->tag)
|
||||
? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1)
|
||||
: $this->user->getTaggedNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null, $this->tag);
|
||||
|
||||
$pnl = new ProfileNoticeList($notice, $this);
|
||||
$cnt = $pnl->show();
|
||||
|
@ -25,14 +25,15 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
|
||||
|
||||
class UserrssAction extends Rss10Action
|
||||
{
|
||||
|
||||
var $user = null;
|
||||
var $tag = null;
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
$nickname = $this->trimmed('nickname');
|
||||
$this->user = User::staticGet('nickname', $nickname);
|
||||
$this->tag = $this->trimmed('tag');
|
||||
|
||||
if (!$this->user) {
|
||||
$this->clientError(_('No such user.'));
|
||||
@ -42,6 +43,25 @@ class UserrssAction extends Rss10Action
|
||||
}
|
||||
}
|
||||
|
||||
function getTaggedNotices($tag = null, $limit=0)
|
||||
{
|
||||
$user = $this->user;
|
||||
|
||||
if (is_null($user)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$notice = $user->getTaggedNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit, 0, 0, null, $tag);
|
||||
|
||||
$notices = array();
|
||||
while ($notice->fetch()) {
|
||||
$notices[] = clone($notice);
|
||||
}
|
||||
|
||||
return $notices;
|
||||
}
|
||||
|
||||
|
||||
function getNotices($limit=0)
|
||||
{
|
||||
|
||||
|
@ -201,7 +201,6 @@ class File_redirection extends Memcached_DataObject
|
||||
|
||||
if ($short_url) {
|
||||
$short_url = (string)$short_url;
|
||||
if(1) {
|
||||
// store it
|
||||
$file = File::staticGet('url', $long_url);
|
||||
if (empty($file)) {
|
||||
@ -221,7 +220,6 @@ if(1) {
|
||||
$file_redir->file_id = $file_id;
|
||||
$file_redir->insert();
|
||||
}
|
||||
}
|
||||
return $short_url;
|
||||
}
|
||||
return $long_url;
|
||||
|
@ -1024,7 +1024,7 @@ class Notice extends Memcached_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
function stream($fn, $args, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $since=null)
|
||||
function stream($fn, $args, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $since=null, $tag=null)
|
||||
{
|
||||
$cache = common_memcache();
|
||||
|
||||
@ -1032,7 +1032,7 @@ class Notice extends Memcached_DataObject
|
||||
$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)));
|
||||
$before_id, $since, $tag)));
|
||||
}
|
||||
|
||||
$idkey = common_cache_key($cachekey);
|
||||
@ -1052,7 +1052,7 @@ class Notice extends Memcached_DataObject
|
||||
$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)));
|
||||
$last_id, 0, null, $tag)));
|
||||
|
||||
$new_window = array_merge($new_ids, $window);
|
||||
|
||||
@ -1067,7 +1067,7 @@ class Notice extends Memcached_DataObject
|
||||
}
|
||||
|
||||
$window = call_user_func_array($fn, array_merge($args, array(0, NOTICE_CACHE_WINDOW,
|
||||
0, 0, null)));
|
||||
0, 0, null, $tag)));
|
||||
|
||||
$windowstr = implode(',', $window);
|
||||
|
||||
|
@ -153,18 +153,66 @@ class Profile extends Memcached_DataObject
|
||||
return null;
|
||||
}
|
||||
|
||||
function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
|
||||
function getTaggedNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null, $tag=null)
|
||||
{
|
||||
// XXX: I'm not sure this is going to be any faster. It probably isn't.
|
||||
$ids = Notice::stream(array($this, '_streamTaggedDirect'),
|
||||
array(),
|
||||
'profile:notice_ids:' . $this->id,
|
||||
$offset, $limit, $since_id, $before_id, $since, $tag);
|
||||
common_debug(print_r($ids, true));
|
||||
return Notice::getStreamByIds($ids);
|
||||
}
|
||||
|
||||
function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
|
||||
{
|
||||
// XXX: I'm not sure this is going to be any faster. It probably isn't.
|
||||
$ids = Notice::stream(array($this, '_streamDirect'),
|
||||
array(),
|
||||
'profile:notice_ids:' . $this->id,
|
||||
$offset, $limit, $since_id, $before_id);
|
||||
$offset, $limit, $since_id, $before_id, $since);
|
||||
|
||||
return Notice::getStreamByIds($ids);
|
||||
}
|
||||
|
||||
function _streamDirect($offset, $limit, $since_id, $before_id, $since)
|
||||
function _streamTaggedDirect($offset, $limit, $since_id, $before_id, $since=null, $tag=null)
|
||||
{
|
||||
common_debug('_streamTaggedDirect()');
|
||||
$notice = new Notice();
|
||||
$notice->profile_id = $this->id;
|
||||
$query = "select id from notice join notice_tag on id=notice_id where tag='" . $notice->escape($tag) . "' and profile_id=" . $notice->escape($notice->profile_id);
|
||||
if ($since_id != 0) {
|
||||
$query .= " and id > $since_id";
|
||||
}
|
||||
|
||||
if ($before_id != 0) {
|
||||
$query .= " and id < $before_id";
|
||||
}
|
||||
|
||||
if (!is_null($since)) {
|
||||
$query .= " and created > '" . date('Y-m-d H:i:s', $since) . "'";
|
||||
}
|
||||
|
||||
$query .= ' order by id DESC';
|
||||
|
||||
if (!is_null($offset)) {
|
||||
$query .= " limit $offset, $limit";
|
||||
}
|
||||
$notice->query($query);
|
||||
$ids = array();
|
||||
|
||||
while ($notice->fetch()) {
|
||||
common_debug(print_r($notice, true));
|
||||
$ids[] = $notice->id;
|
||||
}
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function _streamDirect($offset, $limit, $since_id, $before_id, $since = null)
|
||||
{
|
||||
$notice = new Notice();
|
||||
|
||||
|
@ -407,13 +407,22 @@ class User extends Memcached_DataObject
|
||||
return Notice::getStreamByIds($ids);
|
||||
}
|
||||
|
||||
function getTaggedNotices($tag, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
|
||||
$profile = $this->getProfile();
|
||||
if (!$profile) {
|
||||
return null;
|
||||
} else {
|
||||
return $profile->getTaggedNotices($tag, $offset, $limit, $since_id, $before_id, $since);
|
||||
}
|
||||
}
|
||||
|
||||
function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
|
||||
{
|
||||
$profile = $this->getProfile();
|
||||
if (!$profile) {
|
||||
return null;
|
||||
} else {
|
||||
return $profile->getNotices($offset, $limit, $since_id, $before_id);
|
||||
return $profile->getNotices($offset, $limit, $since_id, $before_id, $since);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,6 +105,8 @@ function main()
|
||||
|
||||
$args = array_merge($args, $_REQUEST);
|
||||
|
||||
Event::handle('ArgsInitialize', array(&$args));
|
||||
|
||||
$action = $args['action'];
|
||||
|
||||
if (!$action || !preg_match('/^[a-zA-Z0-9_-]*$/', $action)) {
|
||||
|
@ -597,7 +597,10 @@ class Action extends HTMLOutputter // lawsuit
|
||||
'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');
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ class NoticeListItem extends Widget
|
||||
|
||||
function showNotice()
|
||||
{
|
||||
if (0)
|
||||
if(0)
|
||||
$this->out->elementStart('entry-title');
|
||||
else
|
||||
|
||||
@ -236,7 +236,7 @@ else
|
||||
$clip .= '.png';
|
||||
$top = '20px';
|
||||
}
|
||||
if (0)
|
||||
if(0)
|
||||
$this->out->elementStart('div', 'entry-attachments');
|
||||
else
|
||||
$this->out->elementStart('p', array('class' => 'entry-attachments', 'style' => "float: right; width: $width_att; background: url($clip) no-repeat; text-align: right; height: $height;"));
|
||||
|
@ -52,6 +52,7 @@ class ProfileAction extends Action
|
||||
var $user = null;
|
||||
var $page = null;
|
||||
var $profile = null;
|
||||
var $tag = null;
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
@ -85,10 +86,9 @@ class ProfileAction extends Action
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->tag = $this->trimmed('tag');
|
||||
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
|
||||
|
||||
common_set_returnto($this->selfUrl());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -245,3 +245,4 @@ class ProfileAction extends Action
|
||||
$this->elementEnd('div');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -426,6 +426,16 @@ class Router
|
||||
array('size' => '(original|96|48|24)',
|
||||
'nickname' => '[a-zA-Z0-9]{1,64}'));
|
||||
|
||||
$m->connect(':nickname/tag/:tag/rss',
|
||||
array('action' => 'userrss'),
|
||||
array('nickname' => '[a-zA-Z0-9]{1,64}'),
|
||||
array('tag' => '[a-zA-Z0-9]+'));
|
||||
|
||||
$m->connect(':nickname/tag/:tag',
|
||||
array('action' => 'showstream'),
|
||||
array('nickname' => '[a-zA-Z0-9]{1,64}'),
|
||||
array('tag' => '[a-zA-Z0-9]+'));
|
||||
|
||||
$m->connect(':nickname',
|
||||
array('action' => 'showstream'),
|
||||
array('nickname' => '[a-zA-Z0-9]{1,64}'));
|
||||
|
@ -97,7 +97,11 @@ class Rss10Action extends Action
|
||||
// Parent handling, including cache check
|
||||
parent::handle($args);
|
||||
// Get the list of notices
|
||||
if (empty($this->tag)) {
|
||||
$this->notices = $this->getNotices($this->limit);
|
||||
} else {
|
||||
$this->notices = $this->getTaggedNotices($this->tag, $this->limit);
|
||||
}
|
||||
$this->showRss();
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,8 @@ class SubGroupNav extends Widget
|
||||
|
||||
$this->out->elementStart('ul', array('class' => 'nav'));
|
||||
|
||||
if (Event::handle('StartSubGroupNav', array($this))) {
|
||||
|
||||
$this->out->menuItem(common_local_url('subscriptions',
|
||||
array('nickname' =>
|
||||
$this->user->nickname)),
|
||||
@ -106,6 +108,10 @@ class SubGroupNav extends Widget
|
||||
$action == 'invite',
|
||||
'nav_invite');
|
||||
}
|
||||
|
||||
Event::handle('EndSubGroupNav', array($this));
|
||||
}
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
}
|
||||
}
|
||||
|
@ -114,8 +114,12 @@ class TagCloudSection extends Section
|
||||
|
||||
function tagUrl($tag)
|
||||
{
|
||||
if ('showstream' === $this->out->trimmed('action')) {
|
||||
return common_local_url('showstream', array('nickname' => $this->out->profile->nickname, 'tag' => $tag));
|
||||
} else {
|
||||
return common_local_url('tag', array('tag' => $tag));
|
||||
}
|
||||
}
|
||||
|
||||
function divId()
|
||||
{
|
||||
|
@ -496,11 +496,6 @@ function common_linkify($url) {
|
||||
}
|
||||
|
||||
$attrs = array('href' => $longurl, 'rel' => 'external');
|
||||
if(0){
|
||||
if ($longurl !== $url) {
|
||||
$attrs['title'] = $longurl;
|
||||
}
|
||||
}
|
||||
return XMLStringer::estring('a', $attrs, $display);
|
||||
}
|
||||
|
||||
|
@ -495,7 +495,7 @@ line-height:1.618;
|
||||
/* entity_profile */
|
||||
.entity_profile {
|
||||
position:relative;
|
||||
width:67.702%;
|
||||
width:74.702%;
|
||||
min-height:123px;
|
||||
float:left;
|
||||
margin-bottom:18px;
|
||||
@ -531,12 +531,15 @@ margin-bottom:4px;
|
||||
.entity_profile .entity_nickname {
|
||||
margin-left:11px;
|
||||
display:inline;
|
||||
font-weight:bold;
|
||||
}
|
||||
.entity_profile .entity_nickname {
|
||||
margin-left:0;
|
||||
}
|
||||
|
||||
.entity_profile .fn,
|
||||
.entity_profile .nickname {
|
||||
font-size:1.1em;
|
||||
font-weight:bold;
|
||||
}
|
||||
.entity_profile .entity_fn dd:before {
|
||||
content: "(";
|
||||
font-weight:normal;
|
||||
@ -558,7 +561,7 @@ display:none;
|
||||
/*entity_actions*/
|
||||
.entity_actions {
|
||||
float:right;
|
||||
margin-left:4.35%;
|
||||
margin-left:2.35%;
|
||||
max-width:25%;
|
||||
}
|
||||
.entity_actions h2 {
|
||||
@ -636,6 +639,7 @@ margin-bottom:29px;
|
||||
clear:both;
|
||||
float:left;
|
||||
width:100%;
|
||||
list-style-position:inside;
|
||||
}
|
||||
.aside .section h2 {
|
||||
text-transform:uppercase;
|
||||
@ -659,6 +663,7 @@ list-style-type:none;
|
||||
float:left;
|
||||
margin-right:7px;
|
||||
margin-bottom:7px;
|
||||
display:inline;
|
||||
}
|
||||
.section .entities li .photo {
|
||||
margin-right:0;
|
||||
@ -1039,7 +1044,7 @@ margin-left:18px;
|
||||
|
||||
/* TOP_POSTERS */
|
||||
.section tbody td {
|
||||
padding-right:11px;
|
||||
padding-right:18px;
|
||||
padding-bottom:11px;
|
||||
}
|
||||
.section .vcard .photo {
|
||||
|
Loading…
Reference in New Issue
Block a user