summaryrefslogtreecommitdiff
path: root/actions/favorited.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/favorited.php')
-rw-r--r--actions/favorited.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/actions/favorited.php b/actions/favorited.php
index 4155b3a23..5082f4a4e 100644
--- a/actions/favorited.php
+++ b/actions/favorited.php
@@ -104,6 +104,9 @@ class FavoritedAction extends Action
{
parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
+
+ common_set_returnto($this->selfUrl());
+
return true;
}
@@ -166,8 +169,14 @@ class FavoritedAction extends Action
function showContent()
{
+ if (common_config('db', 'type') == 'pgsql') {
+ $weightexpr='sum(exp(-extract(epoch from (now() - fave.modified)) / %s))';
+ } else {
+ $weightexpr='sum(exp(-(now() - fave.modified) / %s))';
+ }
+
$qry = 'SELECT notice.*, '.
- 'sum(exp(-(now() - fave.modified) / %s)) as weight ' .
+ $weightexpr . ' as weight ' .
'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
'GROUP BY fave.notice_id ' .
'ORDER BY weight DESC';