コード例 #1
0
 }
 if (preg_match('/\\bgi\\b/', $_POST['crit'])) {
     $join .= " inner join gridimage gi using (gridsquare_id)";
 }
 if (preg_match('/\\bu\\b/', $_POST['crit'])) {
     $join .= " inner join user u using (user_id)";
 }
 $recordSet =& $db->Execute("select * from {$table} {$join} where {$_POST['crit']} {$limit}");
 if (!empty($_POST['file'])) {
     $handle = fopen($_SERVER['DOCUMENT_ROOT'] . "/rss/placename_updates.sql", 'a') or die("unable to open file");
 }
 while (!$recordSet->EOF) {
     if ($table == 'gridimage') {
         $image = new GridImage();
         $gid = $recordSet->fields['gridimage_id'];
         $image->_initFromArray($recordSet->fields);
         $square = $image->grid_square;
         $extra = ",upd_timestamp = '{$recordSet->fields['upd_timestamp']}'";
         if (!isset($square->nateastings)) {
             $square->getNatEastings();
         }
         //to optimise the query, we scan a square centred on the
         //the required point
         $radius = 30000;
         $places = $square->findNearestPlace($radius);
         $pid = $places['pid'];
     } else {
         $gid = $recordSet->fields['gridsquare_id'];
         #$from_stratch = 1;
         if ($from_stratch || $recordSet->fields['reference_index'] == 2) {
             $square = new GridSquare();
コード例 #2
0
//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);