Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x
Conflicts: actions/public.php
This commit is contained in:
commit
5ff8d8d447
|
@ -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();
|
$req = OAuthRequest::from_request('POST', common_locale_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__);
|
||||||
|
|
|
@ -69,6 +69,17 @@ class AllAction extends ProfileAction
|
||||||
sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname)));
|
sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output document relationship links
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function showRelationshipLinks()
|
||||||
|
{
|
||||||
|
$this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
|
||||||
|
$this->page, 'all', array('nickname' => $this->user->nickname));
|
||||||
|
}
|
||||||
|
|
||||||
function showLocalNav()
|
function showLocalNav()
|
||||||
{
|
{
|
||||||
$nav = new PersonalGroupNav($this);
|
$nav = new PersonalGroupNav($this);
|
||||||
|
|
|
@ -221,4 +221,15 @@ class FavoritedAction extends Action
|
||||||
$this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
|
$this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
|
||||||
$this->page, 'favorited');
|
$this->page, 'favorited');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output document relationship links
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function showRelationshipLinks()
|
||||||
|
{
|
||||||
|
$this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
|
||||||
|
$this->page, 'favorited');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class FinishremotesubscribeAction extends Action
|
||||||
common_debug('stored request: '.print_r($omb,true), __FILE__);
|
common_debug('stored request: '.print_r($omb,true), __FILE__);
|
||||||
|
|
||||||
common_remove_magic_from_request();
|
common_remove_magic_from_request();
|
||||||
$req = OAuthRequest::from_request();
|
$req = OAuthRequest::from_request('POST', common_local_url('finishuserauthorization'));
|
||||||
|
|
||||||
$token = $req->get_parameter('oauth_token');
|
$token = $req->get_parameter('oauth_token');
|
||||||
|
|
||||||
|
|
|
@ -137,4 +137,15 @@ class GroupmembersAction extends Action
|
||||||
$this->page, 'groupmembers',
|
$this->page, 'groupmembers',
|
||||||
array('nickname' => $this->group->nickname));
|
array('nickname' => $this->group->nickname));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* Output document relationship links
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function showRelationshipLinks()
|
||||||
|
{
|
||||||
|
$this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
|
||||||
|
$this->page, 'groupmembers', array('nickname' => $this->group->nickname));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -129,4 +129,15 @@ class GroupsAction extends Action
|
||||||
$gbm = new GroupsByMembersSection($this);
|
$gbm = new GroupsByMembersSection($this);
|
||||||
$gbm->show();
|
$gbm->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output document relationship links
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function showRelationshipLinks()
|
||||||
|
{
|
||||||
|
$this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
|
||||||
|
$this->page, 'groups', array('nickname' => $this->group->nickname));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,17 @@ class InboxAction extends MailboxAction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output document relationship links
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function showRelationshipLinks()
|
||||||
|
{
|
||||||
|
$this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
|
||||||
|
$this->page, 'inbox', array('nickname' => $this->user->nickname));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the messages for this user and this page
|
* Retrieve the messages for this user and this page
|
||||||
*
|
*
|
||||||
|
|
|
@ -184,11 +184,13 @@ class SearchNoticeListItem extends NoticeListItem {
|
||||||
function highlight($text, $terms)
|
function highlight($text, $terms)
|
||||||
{
|
{
|
||||||
/* Highligh search terms */
|
/* Highligh search terms */
|
||||||
$pattern = '/('.implode('|', array_map('htmlspecialchars', $terms)).')/i';
|
$options = implode('|', array_map('preg_quote', array_map('htmlspecialchars', $terms),
|
||||||
|
array_fill(0, sizeof($terms), '/')));
|
||||||
|
$pattern = "/($options)/i";
|
||||||
$result = preg_replace($pattern, '<strong>\\1</strong>', $text);
|
$result = preg_replace($pattern, '<strong>\\1</strong>', $text);
|
||||||
|
|
||||||
/* Remove highlighting from inside links, loop incase multiple highlights in links */
|
/* Remove highlighting from inside links, loop incase multiple highlights in links */
|
||||||
$pattern = '/(href="[^"]*)<strong>('.implode('|', array_map('htmlspecialchars', $terms)).')<\/strong>([^"]*")/iU';
|
$pattern = '/(href="[^"]*)<strong>('.$options.')<\/strong>([^"]*")/iU';
|
||||||
do {
|
do {
|
||||||
$result = preg_replace($pattern, '\\1\\2\\3', $result, -1, $count);
|
$result = preg_replace($pattern, '\\1\\2\\3', $result, -1, $count);
|
||||||
} while ($count);
|
} while ($count);
|
||||||
|
|
|
@ -62,6 +62,17 @@ class OutboxAction extends MailboxAction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output document relationship links
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function showRelationshipLinks()
|
||||||
|
{
|
||||||
|
$this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
|
||||||
|
$this->page, 'outbox', array('nickname' => $this->user->nickname));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* retrieve the messages for this user and this page
|
* retrieve the messages for this user and this page
|
||||||
*
|
*
|
||||||
|
|
|
@ -28,7 +28,7 @@ class PostnoticeAction extends Action
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
try {
|
try {
|
||||||
common_remove_magic_from_request();
|
common_remove_magic_from_request();
|
||||||
$req = OAuthRequest::from_request();
|
$req = OAuthRequest::from_request('POST', common_local_url('postnotice'));
|
||||||
# Note: server-to-server function!
|
# Note: server-to-server function!
|
||||||
$server = omb_oauth_server();
|
$server = omb_oauth_server();
|
||||||
list($consumer, $token) = $server->verify_request($req);
|
list($consumer, $token) = $server->verify_request($req);
|
||||||
|
|
|
@ -135,6 +135,17 @@ class PublicAction extends Action
|
||||||
_('Public Stream Feed (Atom)')));
|
_('Public Stream Feed (Atom)')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output document relationship links
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function showRelationshipLinks()
|
||||||
|
{
|
||||||
|
$this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
|
||||||
|
$this->page, 'public');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extra head elements
|
* Extra head elements
|
||||||
*
|
*
|
||||||
|
|
|
@ -138,6 +138,17 @@ class RepliesAction extends Action
|
||||||
return array(new Feed(Feed::RSS1, $rssurl, $rsstitle));
|
return array(new Feed(Feed::RSS1, $rssurl, $rsstitle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output document relationship links
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function showRelationshipLinks()
|
||||||
|
{
|
||||||
|
$this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
|
||||||
|
$this->page, 'replies', array('nickname' => $this->user->nickname));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show the personal group nav
|
* show the personal group nav
|
||||||
*
|
*
|
||||||
|
|
|
@ -69,7 +69,7 @@ class RequesttokenAction extends Action
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
try {
|
try {
|
||||||
common_remove_magic_from_request();
|
common_remove_magic_from_request();
|
||||||
$req = OAuthRequest::from_request();
|
$req = OAuthRequest::from_request('POST', common_local_url('requesttoken'));
|
||||||
$server = omb_oauth_server();
|
$server = omb_oauth_server();
|
||||||
$token = $server->fetch_request_token($req);
|
$token = $server->fetch_request_token($req);
|
||||||
print $token;
|
print $token;
|
||||||
|
|
|
@ -150,6 +150,18 @@ class ShowfavoritesAction extends Action
|
||||||
return array(new Feed(Feed::RSS1, $feedurl, $feedtitle));
|
return array(new Feed(Feed::RSS1, $feedurl, $feedtitle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output document relationship links
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function showRelationshipLinks()
|
||||||
|
{
|
||||||
|
$this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
|
||||||
|
$this->page, 'showfavorites', array('nickname' => $this->user->nickname));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show the personal group nav
|
* show the personal group nav
|
||||||
*
|
*
|
||||||
|
|
|
@ -311,6 +311,17 @@ class ShowgroupAction extends Action
|
||||||
$this->group->nickname)));
|
$this->group->nickname)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output document relationship links
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function showRelationshipLinks()
|
||||||
|
{
|
||||||
|
$this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
|
||||||
|
$this->page, 'showgroup', array('nickname' => $this->group->nickname));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill in the sidebar.
|
* Fill in the sidebar.
|
||||||
*
|
*
|
||||||
|
|
|
@ -135,6 +135,17 @@ class ShowstreamAction extends ProfileAction
|
||||||
sprintf(_('FOAF for %s'), $this->user->nickname)));
|
sprintf(_('FOAF for %s'), $this->user->nickname)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output document relationship links
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function showRelationshipLinks()
|
||||||
|
{
|
||||||
|
$this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
|
||||||
|
$this->page, 'showstream', array('nickname' => $this->user->nickname));
|
||||||
|
}
|
||||||
|
|
||||||
function extraHead()
|
function extraHead()
|
||||||
{
|
{
|
||||||
// for remote subscriptions etc.
|
// for remote subscriptions etc.
|
||||||
|
|
|
@ -45,6 +45,13 @@ class TagAction extends Action
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showSections()
|
||||||
|
{
|
||||||
|
$pop = new PopularNoticeSection($this);
|
||||||
|
$pop->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
if ($this->page == 1) {
|
if ($this->page == 1) {
|
||||||
|
@ -70,6 +77,17 @@ class TagAction extends Action
|
||||||
sprintf(_('Feed for tag %s'), $this->tag)));
|
sprintf(_('Feed for tag %s'), $this->tag)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output document relationship links
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function showRelationshipLinks()
|
||||||
|
{
|
||||||
|
$this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
|
||||||
|
$this->page, 'tag', array('tag' => $this->tag));
|
||||||
|
}
|
||||||
|
|
||||||
function showPageNotice()
|
function showPageNotice()
|
||||||
{
|
{
|
||||||
return sprintf(_('Messages tagged "%s", most recent first'), $this->tag);
|
return sprintf(_('Messages tagged "%s", most recent first'), $this->tag);
|
||||||
|
|
|
@ -29,7 +29,7 @@ class UpdateprofileAction extends Action
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
try {
|
try {
|
||||||
common_remove_magic_from_request();
|
common_remove_magic_from_request();
|
||||||
$req = OAuthRequest::from_request();
|
$req = OAuthRequest::from_request('POST', common_local_url('updateprofile'));
|
||||||
# Note: server-to-server function!
|
# Note: server-to-server function!
|
||||||
$server = omb_oauth_server();
|
$server = omb_oauth_server();
|
||||||
list($consumer, $token) = $server->verify_request($req);
|
list($consumer, $token) = $server->verify_request($req);
|
||||||
|
|
42
install.php
42
install.php
|
@ -1,4 +1,22 @@
|
||||||
<?
|
<?php
|
||||||
|
/**
|
||||||
|
* Laconica - a distributed open-source microblogging tool
|
||||||
|
* Copyright (C) 2009, 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
define('INSTALLDIR', dirname(__FILE__));
|
define('INSTALLDIR', dirname(__FILE__));
|
||||||
|
|
||||||
function main()
|
function main()
|
||||||
|
@ -19,12 +37,12 @@ function checkPrereqs()
|
||||||
{
|
{
|
||||||
if (file_exists(INSTALLDIR.'/config.php')) {
|
if (file_exists(INSTALLDIR.'/config.php')) {
|
||||||
?><p class="error">Config file "config.php" already exists.</p>
|
?><p class="error">Config file "config.php" already exists.</p>
|
||||||
<?
|
<?php
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version_compare(PHP_VERSION, '5.0.0', '<')) {
|
if (version_compare(PHP_VERSION, '5.0.0', '<')) {
|
||||||
?><p class="error">Require PHP version 5 or greater.</p><?
|
?><p class="error">Require PHP version 5 or greater.</p><?php
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,23 +52,23 @@ function checkPrereqs()
|
||||||
|
|
||||||
foreach ($reqs as $req) {
|
foreach ($reqs as $req) {
|
||||||
if (!checkExtension($req)) {
|
if (!checkExtension($req)) {
|
||||||
?><p class="error">Cannot load required extension "<?= $req ?>".</p><?
|
?><p class="error">Cannot load required extension "<?php echo $req; ?>".</p><?php
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_writable(INSTALLDIR)) {
|
if (!is_writable(INSTALLDIR)) {
|
||||||
?><p class="error">Cannot write config file to "<?= INSTALLDIR ?>".</p>
|
?><p class="error">Cannot write config file to "<?php echo INSTALLDIR; ?>".</p>
|
||||||
<p>On your server, try this command:</p>
|
<p>On your server, try this command:</p>
|
||||||
<blockquote>chmod a+w <?= INSTALLDIR ?></blockquote>
|
<blockquote>chmod a+w <?php echo INSTALLDIR; ?></blockquote>
|
||||||
<?
|
<?php
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_writable(INSTALLDIR.'/avatar/')) {
|
if (!is_writable(INSTALLDIR.'/avatar/')) {
|
||||||
?><p class="error">Cannot write avatar directory "<?= INSTALLDIR ?>/avatar/".</p>
|
?><p class="error">Cannot write avatar directory "<?php echo INSTALLDIR; ?>/avatar/".</p>
|
||||||
<p>On your server, try this command:</p>
|
<p>On your server, try this command:</p>
|
||||||
<blockquote>chmod a+w <?= INSTALLDIR ?>/avatar/</blockquote>
|
<blockquote>chmod a+w <?php echo INSTALLDIR; ?>/avatar/</blockquote>
|
||||||
<?
|
<?
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +229,7 @@ function handlePost()
|
||||||
function writeConf($sitename, $sqlUrl)
|
function writeConf($sitename, $sqlUrl)
|
||||||
{
|
{
|
||||||
$res = file_put_contents(INSTALLDIR.'/config.php',
|
$res = file_put_contents(INSTALLDIR.'/config.php',
|
||||||
"<?\n".
|
"<?php\n".
|
||||||
"\$config['site']['name'] = \"$sitename\";\n\n".
|
"\$config['site']['name'] = \"$sitename\";\n\n".
|
||||||
"\$config['db']['database'] = \"$sqlUrl\";\n\n");
|
"\$config['db']['database'] = \"$sqlUrl\";\n\n");
|
||||||
return $res;
|
return $res;
|
||||||
|
@ -247,9 +265,9 @@ function runDbScript($filename, $conn)
|
||||||
<div id="core">
|
<div id="core">
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<h1>Install Laconica</h1>
|
<h1>Install Laconica</h1>
|
||||||
<? main() ?>
|
<?php main(); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -124,6 +124,7 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
$this->showShortcutIcon();
|
$this->showShortcutIcon();
|
||||||
$this->showStylesheets();
|
$this->showStylesheets();
|
||||||
$this->showScripts();
|
$this->showScripts();
|
||||||
|
$this->showRelationshipLinks();
|
||||||
$this->showOpenSearch();
|
$this->showOpenSearch();
|
||||||
$this->showFeeds();
|
$this->showFeeds();
|
||||||
$this->showDescription();
|
$this->showDescription();
|
||||||
|
@ -264,6 +265,19 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show document relationship links
|
||||||
|
*
|
||||||
|
* SHOULD overload
|
||||||
|
*
|
||||||
|
* @return nothing
|
||||||
|
*/
|
||||||
|
function showRelationshipLinks()
|
||||||
|
{
|
||||||
|
// output <link> elements with appropriate HTML4.01 link types:
|
||||||
|
// http://www.w3.org/TR/html401/types.html#type-links
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show OpenSearch headers
|
* Show OpenSearch headers
|
||||||
*
|
*
|
||||||
|
@ -1042,4 +1056,36 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate document metadata for sequential navigation
|
||||||
|
*
|
||||||
|
* @param boolean $have_before is there something before?
|
||||||
|
* @param boolean $have_after is there something after?
|
||||||
|
* @param integer $page current page
|
||||||
|
* @param string $action current action
|
||||||
|
* @param array $args rest of query arguments
|
||||||
|
*
|
||||||
|
* @return nothing
|
||||||
|
*/
|
||||||
|
function sequenceRelationships($have_next, $have_previous, $page, $action, $args=null)
|
||||||
|
{
|
||||||
|
// Outputs machine-readable pagination in <link> elements.
|
||||||
|
// Pattern taken from $this->pagination() method.
|
||||||
|
|
||||||
|
// "next" is equivalent to "after"
|
||||||
|
if ($have_next) {
|
||||||
|
$pargs = array('page' => $page-1);
|
||||||
|
$this->element('link', array('rel' => 'next',
|
||||||
|
'href' => common_local_url($action, $args, $pargs),
|
||||||
|
'title' => _('Next')));
|
||||||
|
}
|
||||||
|
// "previous" is equivalent to "before"
|
||||||
|
if ($have_previous=true) { // FIXME
|
||||||
|
$pargs = array('page' => $page+1);
|
||||||
|
$this->element('link', array('rel' => 'prev',
|
||||||
|
'href' => common_local_url($action, $args, $pargs),
|
||||||
|
'title' => _('Previous')));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,17 +50,26 @@ class PopularNoticeSection extends NoticeSection
|
||||||
{
|
{
|
||||||
if (common_config('db', 'type') == 'pgsql') {
|
if (common_config('db', 'type') == 'pgsql') {
|
||||||
$weightexpr='sum(exp(-extract(epoch from (now() - fave.modified)) / %s))';
|
$weightexpr='sum(exp(-extract(epoch from (now() - fave.modified)) / %s))';
|
||||||
|
if (!empty($this->out->tag)) {
|
||||||
|
$tag = pg_escape_string($this->tag);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$weightexpr='sum(exp(-(now() - fave.modified) / %s))';
|
$weightexpr='sum(exp(-(now() - fave.modified) / %s))';
|
||||||
|
if (!empty($this->out->tag)) {
|
||||||
|
$tag = mysql_escape_string($this->out->tag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$qry = "SELECT notice.*, $weightexpr as weight ";
|
||||||
$qry = 'SELECT notice.*, '.
|
if(isset($tag)) {
|
||||||
$weightexpr . ' as weight ' .
|
$qry .= 'FROM notice_tag, notice JOIN fave ON notice.id = fave.notice_id ' .
|
||||||
'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
|
"WHERE notice.id = notice_tag.notice_id and '$tag' = notice_tag.tag";
|
||||||
'GROUP BY notice.id,notice.profile_id,notice.content,notice.uri,' .
|
} else {
|
||||||
'notice.rendered,notice.url,notice.created,notice.modified,' .
|
$qry .= 'FROM notice JOIN fave ON notice.id = fave.notice_id';
|
||||||
'notice.reply_to,notice.is_local,notice.source ' .
|
}
|
||||||
'ORDER BY weight DESC';
|
$qry .= ' GROUP BY notice.id,notice.profile_id,notice.content,notice.uri,' .
|
||||||
|
'notice.rendered,notice.url,notice.created,notice.modified,' .
|
||||||
|
'notice.reply_to,notice.is_local,notice.source ' .
|
||||||
|
'ORDER BY weight DESC';
|
||||||
|
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
$limit = NOTICES_PER_SECTION + 1;
|
$limit = NOTICES_PER_SECTION + 1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user