rendered paste bodyfunction getRank($points){
$memcache_key = __FUNCTION__ . __CLASS__ . "_{$this->userId}";
if (!($ret = Cache::get($memcache_key))) {
$query="SELECT COUNT( * ) +1 AS ranking
FROM
(
(
(
(
(
(
(
(
users U LEFT JOIN view_favorite favorite ON U.user_id = favorite.user_id
)
LEFT JOIN view_comment_score cs ON U.user_id = cs.user_id
)
LEFT JOIN view_profile_views pv ON U.user_id = pv.user_id
)
LEFT JOIN view_comments_own vcown ON U.user_id = vcown.user_id
)
LEFT JOIN view_uploadedpic vu ON U.user_id = vu.user_id
)
LEFT JOIN view_views_own vviewown ON U.user_id = vviewown.user_id
)
LEFT JOIN view_votes_other vvother ON U.user_id = vvother.user_id
)
LEFT JOIN view_votes_own vvoteown ON U.user_id = vvoteown.user_id
)
LEFT JOIN view_group_score gs ON U.user_id = gs.user_id
WHERE(
( COALESCE( pv.totalviews, 0 ) *".$points['profileview']." ) +
( COALESCE( cs.score, 0 ) *".$points['commentscore']." ) +
( COALESCE( vcown.totalcomments, 0 ) *".$points['pointCommentOwn']." ) +
( COALESCE( vu.totaluploadedpic, 0 ) *".$points['uploadedPicture']." ) +
( COALESCE( vviewown.totalviews, 0 ) *".$points['viewOwn']." ) +
( COALESCE( favorite.totalfavorite, 0 ) *".$points['favorite']." ) +
( COALESCE( vvother.totalvotes, 0 ) *".$points['voteOther']." ) +
( COALESCE( vvoteown.totalvotes, 0 ) *".$points['voteOwn']." ) +
COALESCE( gs.totalpoints, 0 )
) > (
SELECT (
( COALESCE( pv.totalviews, 0 ) *".$points['profileview']." ) +
( COALESCE( cs.score, 0 ) *".$points['commentscore']." ) +
( COALESCE( vcown.totalcomments, 0 ) *".$points['pointCommentOwn']." ) +
( COALESCE( vu.totaluploadedpic, 0 ) *".$points['uploadedPicture']." ) +
( COALESCE( vviewown.totalviews, 0 ) *".$points['viewOwn']." ) +
( COALESCE( favorite.totalfavorite, 0 ) *".$points['favorite']." ) +
( COALESCE( vvother.totalvotes, 0 ) *".$points['voteOther']." ) +
( COALESCE( vvoteown.totalvotes, 0 ) *".$points['voteOwn']." ) +
COALESCE( gs.totalpoints, 0 )
) FROM (
(
(
(
(
(
(
(
users U
LEFT JOIN view_favorite favorite ON U.user_id = favorite.user_id
)
LEFT JOIN view_comment_score cs ON U.user_id = cs.user_id
)
LEFT JOIN view_profile_views pv ON U.user_id = pv.user_id
)
LEFT JOIN view_comments_own vcown ON U.user_id = vcown.user_id
)
LEFT JOIN view_uploadedpic vu ON U.user_id = vu.user_id
)
LEFT JOIN view_views_own vviewown ON U.user_id = vviewown.user_id
)
LEFT JOIN view_votes_other vvother ON U.user_id = vvother.user_id
)
LEFT JOIN view_votes_own vvoteown ON U.user_id = vvoteown.user_id
)
LEFT JOIN view_group_score gs ON U.user_id = gs.user_id
WHERE U.user_id =".$this->userId."
)";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$ret = $row[0];
Cache::set($memcache_key, $ret);
}
return $ret;
}