This repository has been archived by the owner on Mar 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quickreview.php
37 lines (31 loc) · 1.47 KB
/
quickreview.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
require_once 'inc/init.inc.php';
require_once 'inc/layout_page_top.inc.php';
require_once 'inc/photo.inc.php';
require_once 'inc/favorites.inc.php';
$nb_favs = defined('BROWSE_MIN_NEIGHBOURS') ? BROWSE_MIN_NEIGHBOURS : 5;
?>
<h2>Quick Review</h2>
<?php
$myFavs = implode(', ', $db->getCol("SELECT photo_id FROM favorites WHERE user_nsid = '".FLICKR_USER_NSID."'"));
$total = $db->getOne("SELECT COUNT(DISTINCT photo_id) FROM favorites WHERE nb >= ".$nb_favs." AND photo_id NOT IN (".$myFavs.")");
$num = rand(0, $total - 1);
$data = $db->getRow("SELECT DISTINCT photo_id, nb FROM favorites WHERE nb >= ".$nb_favs." AND photo_id NOT IN (".$myFavs.") LIMIT ".$num.",1");
$photo_id = $data['photo_id'];
$nb = $data['nb'];
$photo = getPhoto($photo_id);
if (!is_array($photo)) {
if ($photo == 'removed') {
echo '<img src="/img/photo_gone.gif" width="75" height="75" alt="Removed" />';
} else {
echo '<img src="/img/photo_error.gif" width="75" height="75" alt="Error" title="'.$photo.'" />';
}
} else {
echo '<a href="'.$photo['url'].'"><img src="'.$photo['medium'].'" style="float: right;" /></a>';
echo '<h3><a href="'.$photo['url'].'">'.(trim($photo['title']) != '' ? htmlspecialchars_decode(trim($photo['title'])) : 'untitled').'</a></h3>';
echo '<p>By '.$photo['owner']['username'].'</p>';
echo '<p>Faved by <strong>'.$nb.'</strong> neighbours</p>';
echo '<p><a href="/ignore.php?photo_id='.$photo_id.'">ignore</a></p>';
}
require_once 'inc/layout_page_bottom.inc.php';
?>