getData();
if ($data['deleted']){
if (($_SESSION['account_id'] == $data['setupaccountid']) || (account_services_check('admin'))) {
// allow access => user is owner or admin
$allowaccess = true;
} else {
$allowaccess = false;
}
} else {
$allowaccess = true;
}
if ($data['isprivate']){
if (($_SESSION['account_id'] == $data['setupaccountid']) || (account_services_check('admin'))) {
// allow access => user is owner or admin
$allowaccess = true;
} else {
$allowaccess = false;
}
}
if ($allowaccess) {
// get width/height for tag
$calculatedwidthheight = $file->getFileWidthHeight('low');
$theimage = sprintf(
'
',
$file->getFileURL('mid'),
shorten($data["description"], 30, ' '),
shorten($data["description"], 50, ' '),
$calculatedwidthheight['width'],
$calculatedwidthheight['height']
);
$triple_id = id2triplet($id);
$description = $data["description"];
$authorline = $data["ownername"];
$setupaccountid = $data['setupaccountid'];
}
function loadLicense($id){
if (empty($id)) {
return array('type' => 'none');
}
$query = sprintf('SELECT tag, "value" FROM filelicense_details WHERE filelicenseid = %u AND NOT deleted', $id);
$data = queryAssoc($query);
foreach ($data as $key => $value) {
switch ($key){
case 'sharingadditionalallowed':
case 'sharingadditionaldisallowed':
case 'savingthumbnailswithoutpayment':
case 'savingthumbnailswithpayment':
case 'savingoriginalswithoutpayment':
case 'savingoriginalswithpayment':
$tmp = explode(',', $value);
$data[$key] = $tmp;
break;
}
}
return $data;
}
// get license for this file
$vars['licensedetails'] = loadLicense($data['filelicenseid']);
if ($vars['licensedetails']['type'] == 'publicdomain' || $_SESSION['account_id'] == $data['setupaccountid'] || account_services_check('admin')){
$md5 = md5(sprintf('%s,%s,%s,%s', $data["dimension_highres_width"], $data["dimension_highres_height"], $data['filename_original'], $GLOBALS['download_secret']));
$file_params = '?w=' . $data["dimension_highres_width"] . '&h=' . $data["dimension_highres_height"] . '&f=' . $data['filename_original'] . '&c=' . $md5;
$vars['downloadfile_params'] = $file_params;
}
// read prices for the given photo
$vars['prices'] = Product::getPhotoPrices(array('id' => $id));
/*
echo "
"; var_dump($vars['prices']); echo ""; */ ?>