X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Ffavorited.php;h=19d49feecfcc8224d7bb9433ac80965f14163351;hb=fa6c6077d6e49d03b10da4339e3c97e0734897de;hp=5ba508cdf5e592bfb95ecd16444c0c180fd92cbe;hpb=df86aa721455fde537608d5faeaaf92075afb738;p=quix0rs-gnu-social.git diff --git a/actions/favorited.php b/actions/favorited.php index 5ba508cdf5..19d49feecf 100644 --- a/actions/favorited.php +++ b/actions/favorited.php @@ -153,8 +153,7 @@ class FavoritedAction extends Action $message .= _('Be the first to add a notice to your favorites by clicking the fave button next to any notice you like.'); } else { - $message .= sprintf(_('Why not [register an account](%%%%action.%s%%%%) and be the first to add a notice to your favorites!'), - (!common_config('site','openidonly')) ? 'register' : 'openidlogin'); + $message .= _('Why not [register an account](%%action.register%%) and be the first to add a notice to your favorites!'); } $this->elementStart('div', 'guide'); @@ -186,30 +185,11 @@ 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.*, '. - $weightexpr . ' as weight ' . - 'FROM notice JOIN fave ON notice.id = fave.notice_id ' . - 'GROUP BY id,profile_id,uri,content,rendered,url,created,notice.modified,reply_to,is_local,source,notice.conversation ' . - 'ORDER BY weight DESC'; - - $offset = ($this->page - 1) * NOTICES_PER_PAGE; - $limit = NOTICES_PER_PAGE + 1; - - if (common_config('db', 'type') == 'pgsql') { - $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; - } else { - $qry .= ' LIMIT ' . $offset . ', ' . $limit; - } - - $notice = Memcached_DataObject::cachedQuery('Notice', - sprintf($qry, common_config('popular', 'dropoff')), - 600); + $pop = new Popularity(); + $pop->offset = ($this->page - 1) * NOTICES_PER_PAGE; + $pop->limit = NOTICES_PER_PAGE; + $pop->expiry = 600; + $notice = $pop->getNotices(); $nl = new NoticeList($notice, $this);