?> favorites with me. <?php echo $nbIgnoredUsers; ?> users are ignored because they have at least <?php echo IGNORED_DISTANCE; ?> favorites that I ignored.</p> <h3>Favorites suggestions</h3> <?php $favoritesSuggestions = $db->getAll("SELECT DISTINCT photo_id, nb FROM favorites WHERE photo_id NOT IN (" . $myFavs . ") ORDER BY nb DESC, photo_id LIMIT 0,3"); if ($total > 0) { echo '<ol class="gallery">'; foreach ($favoritesSuggestions as $data) { echo getPhotoHTML($data['photo_id'], $data['nb']); } echo '</ol>'; } ?> <h3>Contacts suggestions</h3> <p>These contacts suggestions are users from which you have favorited the most photos, with a minimum of <?php echo CONTACTS_SUGGESTIONS_TRIGGER; ?> .</p> <?php $flickr = new Flickr_API(array('api_key' => FLICKR_APIKEY)); $contactsListResponse = $flickr->callMethod('flickr.contacts.getPublicList', array('email' => FLICKR_ACCOUNT_EMAIL, 'password' => FLICKR_ACCOUNT_PASSWORD, 'user_id' => FLICKR_USER_NSID, 'per_page' => 1000, 'page' => 1)); $contactsString = ''; if ($contactsListResponse && $contactsListResponse->attributes['stat'] == 'ok') { $contactsList = $contactsListResponse->getNodeAt('contacts');
$pager .= ' <a href="?nb=' . $nb . '&page=' . ($page + 1) . '">»</a>'; } } $pager = preg_replace("/#+/", " ...", $pager); $pager .= ' <span class="num">(' . $total . ' photos)</span></div>'; ?> <h2>Favorites</h2> <p class="params"> How many photos per page: <?php foreach (array(6, 12, 18, 24, 30) as $nbProp) { if ($nbProp == $nb) { echo '<strong>' . $nbProp . '</strong> '; } else { echo '<a href="?nb=' . $nbProp . '&page=' . $page . '">' . $nbProp . '</a> '; } } ?> </p> <?php echo $pager; $favorites = $db->getAll("SELECT photo_id FROM favorites WHERE user_nsid = '" . FLICKR_USER_NSID . "' ORDER BY date_faved DESC LIMIT " . ($page - 1) * $nb . "," . $nb); if ($total > 0) { echo '<ol class="gallery">'; foreach ($favorites as $data) { echo getPhotoHTML($data['photo_id'], 0); } echo '</ol>' . $pager; } require_once 'inc/layout_page_bottom.inc.php';
echo '<h3>Updating <a href="http://www.flickr.com/photos/' . FLICKR_USER_NSID . '/favorites/">my favorites</a>...</h3>' . "\n"; flush(); $nb = updateFavsFromUser(FLICKR_USER_NSID); echo '<p>' . $nb . ' fav' . ($nb > 1 ? 's' : '') . ' added!</p>' . "\n"; flush(); if ($olderUser = $db->getOne("SELECT user_nsid FROM users WHERE user_nsid != '" . FLICKR_USER_NSID . "' AND ignored=0 ORDER BY date_updated LIMIT 0,1")) { echo '<h3>Updating <a href="http://www.flickr.com/photos/' . $olderUser . '/favorites/">' . $olderUser . '\'s favorites</a>...</h3>' . "\n"; flush(); $nb = updateFavsFromUser($olderUser); echo '<p>' . $nb . ' fav' . ($nb > 1 ? 's' : '') . ' added!</p>' . "\n"; flush(); } if ($olderPhoto = $db->getOne("SELECT photo_id FROM favorites WHERE user_nsid = '" . FLICKR_USER_NSID . "' ORDER BY date_updated LIMIT 0,1")) { echo '<h3>Updating users who have favorited ' . $olderPhoto . '...</h3>' . "\n"; flush(); echo '<ol class="gallery">' . getPhotoHTML($olderPhoto) . '</ol>' . "\n"; flush(); $nb = updateUsersFromFav($olderPhoto); echo '<p style="clear: left">' . $nb . ' user' . ($nb > 1 ? 's' : '') . ' added!</p>' . "\n"; flush(); } require 'inc/close.inc.php'; echo '<p>Done in ' . (time() - $begin) . ' seconds.</p>'; if (!SHOW_DEBUG) { ?> <p>This page will self refresh in 10 seconds...</p> <script language="javascript"> setTimeout("window.location.reload()", 1000*10); </script>