getuser now returns latest 5 images

This commit is contained in:
Daku 2012-03-12 07:50:20 +00:00
parent e7fc084f44
commit 60666f9300

View File

@ -120,6 +120,25 @@ class ShimmieApi extends Extension {
"SELECT COUNT(*) AS count FROM comments WHERE owner_id=:owner_id",
array("owner_id"=>$all['id']));
$all['commentperday'] = sprintf("%.1f", ($all['commentcount'] / (((time() - strtotime($all['joindate'])) / 86400) + 1)));
if(isset($_GET['recent'])){
$recent = $database->get_all(
"SELECT * FROM images WHERE owner_id=? ORDER BY id DESC LIMIT 0, 5",
array($all['id']));
$i = 0;
foreach($recent as $all['recentposts'][$i]){
unset($all['recentposts'][$i]['owner_id']); //We already know the owners id..
unset($all['recentposts'][$i]['owner_ip']);
for($x=0; $x<14; $x++) unset($all['recentposts'][$i][$x]);
if(empty($all['recentposts'][$i]['author'])) unset($all['recentposts'][$i]['author']);
if($all['recentposts'][$i]['notes'] > 0) $all['recentposts'][$i]['has_notes'] = "Y";
else $all['recentposts'][$i]['has_notes'] = "N";
unset($all['recentposts'][$i]['notes']);
$i += 1;
}
}
$page->set_data(json_encode($all));
}
}