$cacheid = ''; $image = new GridImage(); if (isset($_REQUEST['id'])) { $image->loadFromId($_REQUEST['id']); $isowner = $image->user_id == $USER->user_id ? 1 : 0; $isadmin = $USER->hasPerm('ticketmod') ? 1 : 0; if ($image->isValid()) { if ($isowner || $isadmin) { //ok, we'll let it lie... } else { header("Location: /photo/{$_REQUEST['id']}"); exit; } if (isset($_POST['pattrib'])) { if ($_POST['pattrib'] == 'other') { $image->setCredit(stripslashes($_POST['pattrib_name'])); } elseif ($_POST['pattrib'] == 'self') { $image->setCredit(''); } if (!empty($_POST['pattrib_default'])) { $USER->setCreditDefault($_POST['pattrib'] == 'other' ? stripslashes($_POST['pattrib_name']) : ''); } //clear any caches involving this photo $ab = floor($image->gridimage_id / 10000); $smarty->clear_cache(null, "img{$ab}|{$image->gridimage_id}"); //clear user specific stuff like profile page $smarty->clear_cache(null, "user{$image->user_id}"); header("Location: /photo/{$_REQUEST['id']}"); exit; } //do our thing!