function next_photo_link($hash, $status = 1) { if ($photo = next_photo($hash, $status)) { echo '<a id="next-link" class="page next" title="' . $photo['title'] . '" href="' . SITE_URL . 'photo.php?id=' . $photo['uid'] . '">PREV</a>'; } }
require DT_ROOT . '/include/property.func.php'; $options = property_option($catid); $values = property_value($moduleid, $itemid); } $adddate = timetodate($addtime, 3); $editdate = timetodate($edittime, 3); $linkurl = $MOD['linkurl'] . $linkurl; $T = array(); $result = $db->query("SELECT itemid,thumb,introduce FROM {$table_item} WHERE item={$itemid} ORDER BY listorder ASC,itemid ASC"); while ($r = $db->fetch_array($result)) { $r['middle'] = str_replace('.thumb.', '.middle.', $r['thumb']); $r['big'] = str_replace('.thumb.' . file_ext($r['thumb']), '', $r['thumb']); $T[] = $r; } $demo_url = $MOD['linkurl'] . itemurl($item, '{destoon_page}'); $next_photo = $items > 1 ? next_photo($page, $items, $demo_url) : $linkurl; $prev_photo = $items > 1 ? prev_photo($page, $items, $demo_url) : $linkurl; if ($T) { $S = side_photo($T, $page, $demo_url); } else { $S = array(); $T[0]['thumb'] = DT_SKIN . 'image/spacer.gif'; $T[0]['introduce'] = $L['no_picture']; } $P = $T[$page - 1]; $P['src'] = str_replace('.thumb.' . file_ext($P['thumb']), '', $P['thumb']); $user_status = 3; $update = ''; $fee = get_fee($item['fee'], $MOD['fee_view']); if ($fee) { $user_status = 4;
<?php require_once "../classes/mydb_class.php"; // Find the most-recently-selected photo (the one currently being displayed on the photo_of_the_week page) $query = "SELECT id, datediff(now(),last_date_used) as age FROM photo_of_the_week ORDER BY last_date_used DESC,id LIMIT 1"; $result = mydb::cxn()->query($query); $row = $result->fetch_assoc(); if ($row['age'] > 7) { next_photo(); } function next_photo() { // Find the ID of the next photo to use $query = "SELECT id FROM photo_of_the_week ORDER BY last_date_used,id LIMIT 1"; $result = mydb::cxn()->query($query); $row = $result->fetch_assoc(); $next_photo_id = $row['id']; $query = "UPDATE photo_of_the_week SET last_date_used = curdate() where id = " . $next_photo_id; $result = mydb::cxn()->query($query); }