//lock the table so nothing can happen in between! (leave others as READ so they dont get totally locked) $db->Execute("LOCK TABLES \r\ngridimage_pending gp WRITE,\r\ngridimage gi READ\r\n"); ############################# # define the images to moderate if (empty($_GET['review'])) { $sql = "SELECT gi.* \r\nFROM gridimage_pending gp INNER JOIN gridimage gi USING (gridimage_id)\r\nWHERE (gp.status = 'new' OR (gp.status = 'open' AND updated < DATE_SUB(NOW(),INTERVAL 1 HOUR) ) )\r\nAND type = 'original' \r\nLIMIT 1"; } else { $id = intval($_GET['review']); $sql = "SELECT gi.* \r\nFROM gridimage_pending gp INNER JOIN gridimage gi USING (gridimage_id)\r\nWHERE gridimage_id = {$id}\r\nLIMIT 1"; } ############################# # fetch the list of images... $data = $db->getRow($sql); if ($data && empty($_GET['review'])) { $db->Execute("UPDATE gridimage_pending gp SET status = 'open' WHERE gridimage_id = {$data['gridimage_id']} "); } ############################# $db->Execute("UNLOCK TABLES"); ############################# if ($data) { $image = new GridImage(); $image->_initFromArray(&$data); $image->pendingUrl = $image->_getOriginalpath(true, false, '_pending'); $image->previewUrl = $image->_getOriginalpath(true, false, '_preview'); $image->pendingSize = filesize($_SERVER['DOCUMENT_ROOT'] . $image->pendingUrl); $smarty->assign_by_ref('image', $image); } //what style should we use? $style = $USER->getStyle(); $smarty->assign('maincontentclass', 'content_photo' . $style); $smarty->display('admin_resubmissions.tpl', $style);
header("HTTP/1.0 410 Gone"); header("Status: 410 Gone"); $template = "static_404.tpl"; } else { if (isset($_REQUEST['download']) && $_REQUEST['download'] == $image->_getAntiLeechHash()) { if (stripos($_SERVER['HTTP_REFERER'], 'seadragon.com') !== FALSE) { header("HTTP/1.0 307 Temporary Redirect"); header("Status: 307 Temporary Redirect"); header("Location: /photo/" . intval($_REQUEST['id'])); print "<a href=\"http://{$_SERVER['HTTP_HOST']}/photo/" . intval($_REQUEST['id']) . "\">View image page</a>"; exit; } if (in_array(intval($_REQUEST['size']), $CONF['show_sizes'])) { $filepath = $image->getImageFromOriginal(intval($_REQUEST['size']), intval($_REQUEST['size']), true); } elseif ($_REQUEST['size'] == 'original') { $filepath = $image->_getOriginalpath(); } else { $filepath = $image->_getFullpath(); } $filename = basename($filepath); $filename = "geograph-" . preg_replace('/_\\w+(\\.jpg)/', " by {$image->realname}\$1", $filename); $filename = preg_replace('/ /', '-', trim($filename)); $filename = preg_replace('/[^\\w-\\.,]+/', '', $filename); $lastmod = filemtime($_SERVER['DOCUMENT_ROOT'] . $filepath); header("Content-Type: image/jpeg"); header("Content-Disposition: attachment; filename=\"{$filename}\""); customExpiresHeader(86400, true); customCacheControl($lastmod, $image->gridimage_id); readfile($_SERVER['DOCUMENT_ROOT'] . $filepath); exit; }
$template = 'more.tpl'; $USER->mustHavePerm("basic"); if (isset($_REQUEST['id'])) { //initialise message require_once 'geograph/gridsquare.class.php'; require_once 'geograph/gridimage.class.php'; $image = new GridImage(); $ok = $image->loadFromId($_REQUEST['id']); if (!$ok || $image->moderation_status == 'rejected') { //clear the image $image = new GridImage(); header("HTTP/1.0 410 Gone"); header("Status: 410 Gone"); $template = "static_404.tpl"; } else { $image->altUrl = $image->_getOriginalpath(true, false, '_640x640'); $image->originalUrl = $image->_getOriginalpath(true, false); $image->originalSize = filesize($_SERVER['DOCUMENT_ROOT'] . $image->originalUrl); $style = $USER->getStyle(); $smarty->assign('maincontentclass', 'content_photo' . $style); $imagesize = $image->_getFullSize(); $sizes = array(); $widths = array(); $heights = array(); $showorig = false; if ($image->original_width) { $smarty->assign('original_width', $image->original_width); $smarty->assign('original_height', $image->original_height); $uploadmanager = new UploadManager(); list($destwidth, $destheight, $maxdim, $changedim) = $uploadmanager->_new_size($image->original_width, $image->original_height); if ($changedim) {