$size = getvalescaped("size", ""); $ext = getvalescaped("ext", ""); if (!preg_match('/^[a-zA-Z0-9]+$/', $ext)) { $ext = "jpg"; } $alternative = getvalescaped("alternative", -1); $page = getvalescaped("page", 1); $usage = getvalescaped("usage", "-1"); $usagecomment = getvalescaped("usagecomment", ""); $resource_data = get_resource_data($ref); if ($direct_download_noauth && $direct) { # if this is a direct download and direct downloads w/o authentication are enabled, allow regardless of permissions $allowed = true; } else { # Permissions check $allowed = resource_download_allowed($ref, $size, $resource_data["resource_type"], $alternative); } if (!$allowed) { # This download is not allowed. How did the user get here? exit("Permission denied"); } # additional access check, as the resource download may be allowed, but access restriction should force watermark. $access = get_resource_access($ref); $use_watermark = check_use_watermark($ref); # If no extension was provided, we fallback to JPG. if ($ext == "") { $ext = "jpg"; } $noattach = getval("noattach", ""); $path = get_resource_path($ref, true, $size, false, $ext, -1, $page, $use_watermark && $alternative == -1, "", $alternative); if (!file_exists($path)) {
} } elseif ($use_mp3_player && file_exists($mp3realpath) && hook("custommp3player")){ // leave player to place image } else{?> <?php if (!hook("replacepreviewimage")) { ?> <td><a onClick="return CentralSpaceLoad(this);" href="<?php echo ((getval("from","")=="search")?$baseurl_short."pages/search.php?":$baseurl_short."pages/view.php?ref=" . urlencode($ref) . "&")?>search=<?php echo urlencode($search)?>&offset=<?php echo urlencode($offset)?>&order_by=<?php echo urlencode($order_by)?>&sort=<?php echo urlencode($sort)?>&archive=<?php echo urlencode($archive)?>&k=<?php echo urlencode($k)?>&<?php echo hook("viewextraurl") ?>"><img class="Picture" src="<?php echo $url?>" alt=""/></a><?php hook('afterpreviewimage'); ?></td> <?php } // end hook replacepreviewimage ?> <?php } ?> <td valign="middle"><?php if ($nextpage!=-1 &&resource_download_allowed($ref,"scr",$resource["resource_type"])) { ?><a onClick="return CentralSpaceLoad(this);" href="<?php echo $baseurl_short?>pages/preview.php?ref=<?php echo urlencode($ref) ?>&alternative=<?php echo urlencode($alternative)?>&ext=<?php echo urlencode($ext)?>&k=<?php echo urlencode($k)?>&search=<?php echo urlencode($search)?>&offset=<?php echo urlencode($offset)?>&order_by=<?php echo urlencode($order_by)?>&sort=<?php echo urlencode($sort)?>&archive=<?php echo urlencode($archive)?>&page=<?php echo urlencode($nextpage)?>" class="PDFnav pageNext">></a><?php } ?></td> </tr></table> <?php } // end hook previewimage2 ?> <?php } // end hook previewimage ?> <?php if ($show_resource_title_in_titlebar){ $title = htmlspecialchars(i18n_get_translated(get_data_by_field($ref,$view_title_field))); if (strlen($title) > 0){ echo "<script language='javascript'>\n"; echo "document.title = \"$applicationname - $title\";\n"; echo "</script>"; } }
hook('afterpreviewimage'); ?> </td> <?php } // end hook replacepreviewimage ?> <?php } ?> <td valign="middle"><?php if ($nextpage != -1 && resource_download_allowed($ref, "scr", $resource["resource_type"])) { ?> <a onClick="return CentralSpaceLoad(this);" href="<?php echo $baseurl_short; ?> pages/preview.php?ref=<?php echo urlencode($ref); ?> &alternative=<?php echo urlencode($alternative); ?> &ext=<?php echo urlencode($ext); ?> &k=<?php echo urlencode($k);
$p = $new_file; $deletion_array[] = $p; $replaced_file = true; } else { if ($useoriginal == 'yes' && resource_download_allowed($ref, '', $result[$n]['resource_type'])) { // this size doesn't exist, so we'll try using the original instead $p = get_resource_path($ref, true, '', false, $result[$n]['file_extension'], -1, 1, $use_watermark); $pextension = $result[$n]['file_extension']; $subbed_original_resources[] = $ref; $subbed_original = true; } } $target_exists = file_exists($p); } # Check file exists and, if restricted access, that the user has access to the requested size. if (($target_exists && $access == 0 || $target_exists && $access == 1 && (image_size_restricted_access($size) || ($usesize = '' && $restricted_full_download))) && resource_download_allowed($ref, $usesize, $result[$n]['resource_type'])) { $used_resources[] = $ref; # when writing metadata, we take an extra security measure by copying the files to tmp $tmpfile = write_metadata($p, $ref, $id); // copies file if ($tmpfile !== false && file_exists($tmpfile)) { $p = $tmpfile; // file already in tmp, just rename it } else { if (!$replaced_file) { $copy = true; // copy the file from filestore rather than renaming } } # if the tmpfile is made, from here on we are working with that. # If using original filenames when downloading, copy the file to new location so the name is included.
function HookFormat_chooserViewReplacedownloadoptions() { global $resource, $ref, $counter, $headline, $lang, $download_multisize, $showprice, $save_as, $direct_link_previews, $hide_restricted_download_sizes, $format_chooser_output_formats, $baseurl_short, $search, $offset, $k, $order_by, $sort, $archive, $direct_download; $inputFormat = $resource['file_extension']; if ($resource["has_image"] != 1 || !$download_multisize || $save_as || !supportsInputFormat($inputFormat)) { return false; } $defaultFormat = getDefaultOutputFormat($inputFormat); $tableHeadersDrawn = false; ?> <table cellpadding="0" cellspacing="0"><?php hook("formatchooserbeforedownloads"); $sizes = get_image_sizes($ref, false, $resource['file_extension'], false); $downloadCount = 0; $originalSize = -1; # Show original file download for ($n = 0; $n < count($sizes); $n++) { $downloadthissize = resource_download_allowed($ref, $sizes[$n]["id"], $resource["resource_type"]); $counter++; if ($sizes[$n]['id'] != '') { if ($downloadthissize) { $downloadCount++; } continue; } # Is this the original file? Set that the user can download the original file # so the request box does not appear. $fulldownload = false; if ($sizes[$n]["id"] == "") { $fulldownload = true; } $originalSize = $sizes[$n]; $headline = $lang['collection_download_original']; if ($direct_link_previews && $downloadthissize) { $headline = make_download_preview_link($ref, $sizes[$n]); } if ($hide_restricted_download_sizes && !$downloadthissize && !checkperm("q")) { continue; } if (!$tableHeadersDrawn) { show_table_headers($showprice); $tableHeadersDrawn = true; } ?> <tr class="DownloadDBlend" id="DownloadBox<?php echo $n; ?> "> <td class="DownloadFileName"><h2><?php echo $headline; ?> </h2><p><?php echo $sizes[$n]["filesize"]; if (is_numeric($sizes[$n]["width"])) { echo preg_replace('/^<p>/', ', ', get_size_info($sizes[$n]), 1); } ?> </p><td class="DownloadFileFormat"><?php echo str_replace_formatted_placeholder("%extension", $resource["file_extension"], $lang["field-fileextension"]); ?> </td><?php if ($showprice) { ?> <td><?php echo get_display_price($ref, $sizes[$n]); ?> </td><?php } add_download_column($ref, $sizes[$n], $downloadthissize); } # Add drop down for all other sizes $closestSize = 0; if ($downloadCount > 0) { if (!$tableHeadersDrawn) { show_table_headers($showprice); } ?> <tr class="DownloadDBlend"> <td class="DownloadFileSizePicker"><select id="size"><?php $sizes = get_all_image_sizes(); # Filter out all sizes that are larger than our image size, but not the closest one for ($n = 0; $n < count($sizes); $n++) { if (intval($sizes[$n]['width']) >= intval($originalSize['width']) && intval($sizes[$n]['height']) >= intval($originalSize['height']) && ($closestSize == 0 || $closestSize > (int) $sizes[$n]['width'])) { $closestSize = (int) $sizes[$n]['width']; } } for ($n = 0; $n < count($sizes); $n++) { if (intval($sizes[$n]['width']) != $closestSize && intval($sizes[$n]['width']) > intval($originalSize['width']) && intval($sizes[$n]['height']) > intval($originalSize['height'])) { unset($sizes[$n]); } } foreach ($sizes as $n => $size) { # Only add choice if allowed $downloadthissize = resource_download_allowed($ref, $size["id"], $resource["resource_type"]); if (!$downloadthissize) { continue; } $name = $size['name']; if ($size['width'] == $closestSize) { $name = $lang['format_chooser_original_size']; } ?> <option value="<?php echo $n; ?> "><?php echo $name; ?> </option><?php } ?> </select><p id="sizeInfo"></p></td><?php if ($showprice) { ?> <td>-</td><?php } ?> <td class="DownloadFileFormatPicker" style="vertical-align: top;"><select id="format"><?php foreach ($format_chooser_output_formats as $format) { ?> <option value="<?php echo $format; ?> " <?php if ($format == $defaultFormat) { ?> selected="selected"<?php } ?> ><?php echo str_replace_formatted_placeholder("%extension", $format, $lang["field-fileextension"]); ?> </option><?php } ?> </select><?php showProfileChooser(); ?> </td> <td class="DownloadButton"><a id="convertDownload" onClick="return CentralSpaceLoad(this,true);"><?php echo $lang['action-download']; ?> </a></td> </tr><?php } ?> </table><?php hook("formatchooseraftertable"); if ($downloadCount > 0) { ?> <script type="text/javascript"> // Store size info in JavaScript array var sizeInfo = { <?php foreach ($sizes as $n => $size) { if ($size['width'] == $closestSize) { $size = $originalSize; } ?> <?php echo $n; ?> : { 'info': '<?php echo get_size_info($size, $originalSize); ?> ', 'id': '<?php echo $size['id']; ?> ', }, <?php } ?> }; function updateSizeInfo() { var selected = jQuery('select#size').find(":selected").val(); jQuery('#sizeInfo').html(sizeInfo[selected]['info']); } function updateDownloadLink() { var index = jQuery('select#size').find(":selected").val(); var selectedFormat = jQuery('select#format').find(":selected").val(); var profile = jQuery('select#profile').find(":selected").val(); if (profile) profile = "&profile=" + profile; else profile = ''; basePage = 'pages/download_progress.php?ref=<?php echo $ref; ?> &ext=' + selectedFormat.toLowerCase() + profile + '&size=' + sizeInfo[index]['id'] + '&search=<?php echo urlencode($search); ?> &offset=<?php echo $offset; ?> ' + '&k=<?php echo $k; ?> &archive=<?php echo $archive; ?> &sort=' + '<?php echo $sort; ?> &order_by=<?php echo $order_by; ?> '; jQuery('a#convertDownload').attr('href', '<?php echo $baseurl_short; if (!$direct_download) { echo 'pages/terms.php?ref=' . $ref . '&search=' . $search . '&k=' . $k . '&url='; } ?> ' + <?php echo $direct_download ? 'basePage' : 'encodeURIComponent(basePage)'; ?> ); } jQuery(document).ready(function() { updateSizeInfo(); updateDownloadLink(); }); jQuery('select#size').change(function() { updateSizeInfo(); updateDownloadLink(); }); jQuery('select#format').change(function() { updateDownloadLink(); }); jQuery('select#profile').change(function() { updateDownloadLink(); }); </script><?php } return true; }
} } # check permissions (error message is not pretty but they shouldn't ever arrive at this page unless entering a URL manually) if ($access == 2) { exit("Confidential resource."); } # Locate the resource $path = ""; $url = ""; if ($access == 1 && (checkperm('w') || $k != "" && isset($watermark))) { $watermark = true; } else { $watermark = false; } $path = get_resource_path($ref, true, "scr", false, $ext, -1, $page, $watermark, $result[$x]["file_modified"], $alternative, -1, false); if (file_exists($path) && resource_download_allowed($result[$x], "scr", $resource_data["resource_type"])) { $url = get_resource_path($ref, false, "scr", false, $ext, -1, $page, $watermark, $result[$x]["file_modified"], $alternative, -1, false); } else { $path = get_resource_path($ref, true, "pre", false, $ext, -1, $page, $watermark, $result[$x]["file_modified"], $alternative, -1, false); if (file_exists($path)) { $url = get_resource_path($ref, false, "pre", false, $ext, -1, $page, $watermark, $result[$x]["file_modified"], $alternative, -1, false); } } if (!file_exists($path)) { $info = get_resource_data($ref); $url = "../gfx/" . get_nopreview_icon($info["resource_type"], $info["file_extension"], false); $path = $url; $border = false; } ?>
hook("additionalresourcetools"); if ($resource["has_image"] == 1 && $download_multisize) { # Restricted access? Show the request link. # List all sizes and allow the user to download them $sizes = get_image_sizes($ref, false, $resource["file_extension"]); for ($n = 0; $n < count($sizes); $n++) { # Is this the original file? Set that the user can download the original file # so the request box does not appear. $fulldownload = false; if ($sizes[$n]["id"] == "") { $fulldownload = true; } $counter++; # Should we allow this download? # If the download is allowed, show a download button, otherwise show a request button. $downloadthissize = resource_download_allowed($ref, $sizes[$n]["id"], $resource["resource_type"]); $headline = $sizes[$n]['id'] == '' ? str_replace_formatted_placeholder("%extension", $resource["file_extension"], $lang["originalfileoftype"]) : $sizes[$n]["name"]; $newHeadline = hook('replacesizelabel', '', array($ref, $resource, $sizes[$n])); if (!empty($newHeadline)) { $headline = $newHeadline; } if ($direct_link_previews && $downloadthissize) { $headline = make_download_preview_link($ref, $sizes[$n], $headline); } if ($hide_restricted_download_sizes && !$downloadthissize && !checkperm("q")) { continue; } if (!hook("replacedownloadspacetableheaders")) { if ($table_headers_drawn == false) { ?> <td><?php
<?php include '../../../include/db.php'; include '../../../include/authenticate.php'; include '../../../include/general.php'; include '../../../include/resource_functions.php'; include_once dirname(__FILE__) . "/../include/utility.php"; $ref = getvalescaped('ref', 0, true); $size = getvalescaped('size', ''); $page = getvalescaped('page', 1, true); $alternative = getvalescaped('alt', -1, true); $resource = get_resource_data($ref); if (!resource_download_allowed($ref, $size, $resource["resource_type"])) { # This download is not allowed. exit("Permission denied"); } $width = getvalescaped('width', 0, true); $height = getvalescaped('height', 0, true); if ($width == 0 && $height == 0) { $format = getImageFormat($size); $width = (int) $format['width']; $height = (int) $format['height']; } $ext = getvalescaped('ext', getDefaultOutputFormat()); $profile = getProfileFileName(getvalescaped('profile', null)); $baseDirectory = get_temp_dir() . '/format_chooser'; @mkdir($baseDirectory); $target = $baseDirectory . '/' . getTargetFilename($ref, $ext, $size); set_time_limit(0); convertImage($resource, $page, $alternative, $target, $width, $height, $profile); sendFile($target);
} } $ref = getvalescaped("ref", "", true); $size = getvalescaped("size", ""); $ext = getvalescaped("ext", ""); $alternative = getvalescaped("alternative", -1); $page = getvalescaped("page", 1); $usage = getval("usage", "-1"); $usagecomment = getval("usagecomment", ""); $resource_data = get_resource_data($ref); if ($direct_download_noauth && $direct) { # if this is a direct download and direct downloads w/o authentication are enabled, allow regardless of permissions $allowed = true; } else { # Permissions check $allowed = resource_download_allowed($ref, $size, $resource_data["resource_type"]); } if (!$allowed) { # This download is not allowed. How did the user get here? exit("Permission denied"); } # additional access check, as the resource download may be allowed, but access restriction should force watermark. $access = get_resource_access($ref); $use_watermark = check_use_watermark($ref); # If no extension was provided, we fallback to JPG. if ($ext == "") { $ext = "jpg"; } $noattach = getval("noattach", ""); $path = get_resource_path($ref, true, $size, false, $ext, -1, $page, $use_watermark && $alternative == -1, "", $alternative); if (!file_exists($path)) {
function HookFormat_chooserViewReplacedownloadoptions() { global $resource, $ref, $counter, $headline, $lang, $download_multisize, $showprice, $save_as, $direct_link_previews, $hide_restricted_download_sizes, $format_chooser_output_formats, $baseurl_short, $search, $offset, $k, $order_by, $sort, $archive, $direct_download; $inputFormat = $resource['file_extension']; if ($resource["has_image"] != 1 || !$download_multisize || $save_as || !supportsInputFormat($inputFormat)) { return false; } $defaultFormat = getDefaultOutputFormat($inputFormat); $tableHeadersDrawn = false; ?> <table cellpadding="0" cellspacing="0"><?php hook("formatchooserbeforedownloads"); $sizes = get_image_sizes($ref, false, $resource['file_extension'], false); $downloadCount = 0; $originalSize = -1; # Show original file download for ($n = 0; $n < count($sizes); $n++) { $downloadthissize = resource_download_allowed($ref, $sizes[$n]["id"], $resource["resource_type"]); $counter++; if ($sizes[$n]['id'] != '') { if ($downloadthissize) { $downloadCount++; } continue; } # Is this the original file? Set that the user can download the original file # so the request box does not appear. $fulldownload = false; if ($sizes[$n]["id"] == "") { $fulldownload = true; } $originalSize = $sizes[$n]; $headline = $lang['collection_download_original']; if ($direct_link_previews && $downloadthissize) { $headline = make_download_preview_link($ref, $sizes[$n]); } if ($hide_restricted_download_sizes && !$downloadthissize && !checkperm("q")) { continue; } if (!$tableHeadersDrawn) { show_table_headers($showprice); $tableHeadersDrawn = true; } ?> <tr class="DownloadDBlend" id="DownloadBox<?php echo $n; ?> "> <td class="DownloadFileName"><h2><?php echo $headline; ?> </h2><p><?php echo $sizes[$n]["filesize"]; if (is_numeric($sizes[$n]["width"])) { echo preg_replace('/^<p>/', ', ', get_size_info($sizes[$n]), 1); } ?> </p><td class="DownloadFileFormat"><?php echo str_replace_formatted_placeholder("%extension", $resource["file_extension"], $lang["field-fileextension"]); ?> </td><?php if ($showprice) { ?> <td><?php echo get_display_price($ref, $sizes[$n]); ?> </td><?php } add_download_column($ref, $sizes[$n], $downloadthissize); } # Add drop down for all other sizes $closestSize = 0; if ($downloadCount > 0) { if (!$tableHeadersDrawn) { show_table_headers($showprice); } ?> <tr class="DownloadDBlend"> <td class="DownloadFileSizePicker"><select id="size"><?php $sizes = get_all_image_sizes(); # Filter out all sizes that are larger than our image size, but not the closest one for ($n = 0; $n < count($sizes); $n++) { if (intval($sizes[$n]['width']) >= intval($originalSize['width']) && intval($sizes[$n]['height']) >= intval($originalSize['height']) && ($closestSize == 0 || $closestSize > (int) $sizes[$n]['width'])) { $closestSize = (int) $sizes[$n]['width']; } } for ($n = 0; $n < count($sizes); $n++) { if (intval($sizes[$n]['width']) != $closestSize && intval($sizes[$n]['width']) > intval($originalSize['width']) && intval($sizes[$n]['height']) > intval($originalSize['height'])) { unset($sizes[$n]); } } foreach ($sizes as $n => $size) { # Only add choice if allowed $downloadthissize = resource_download_allowed($ref, $size["id"], $resource["resource_type"]); if (!$downloadthissize) { continue; } $name = $size['name']; if ($size['width'] == $closestSize) { $name = $lang['format_chooser_original_size']; } ?> <option value="<?php echo $n; ?> "><?php echo $name; ?> </option><?php } ?> </select><p id="sizeInfo"></p></td><?php if ($showprice) { ?> <td>-</td><?php } ?> <td class="DownloadFileFormatPicker" style="vertical-align: top;"><select id="format"><?php foreach ($format_chooser_output_formats as $format) { ?> <option value="<?php echo $format; ?> " <?php if ($format == $defaultFormat) { ?> selected="selected"<?php } ?> ><?php echo str_replace_formatted_placeholder("%extension", $format, $lang["field-fileextension"]); ?> </option><?php } ?> </select><?php showProfileChooser(); ?> </td> <td class="DownloadButton"><a id="convertDownload" onClick="return CentralSpaceLoad(this,true);"><?php echo $lang['action-download']; ?> </a></td> </tr><?php } ?> </table><?php hook("formatchooseraftertable"); if ($downloadCount > 0) { ?> <script type="text/javascript"> // Store size info in JavaScript array var sizeInfo = { <?php foreach ($sizes as $n => $size) { if ($size['width'] == $closestSize) { $size = $originalSize; } ?> <?php echo $n; ?> : { 'info': '<?php echo get_size_info($size, $originalSize); ?> ', 'id': '<?php echo $size['id']; ?> ', }, <?php } ?> }; function updateSizeInfo() { var selected = jQuery('select#size').find(":selected").val(); jQuery('#sizeInfo').html(sizeInfo[selected]['info']); } function updateDownloadLink() { var index = jQuery('select#size').find(":selected").val(); var selectedFormat = jQuery('select#format').find(":selected").val(); var profile = jQuery('select#profile').find(":selected").val(); if (profile) profile = "&profile=" + profile; else profile = ''; basePage = 'pages/download_progress.php?ref=<?php echo $ref; ?> &ext=' + selectedFormat.toLowerCase() + profile + '&size=' + sizeInfo[index]['id'] + '&search=<?php echo urlencode($search); ?> &offset=<?php echo $offset; ?> ' + '&k=<?php echo $k; ?> &archive=<?php echo $archive; ?> &sort=' + '<?php echo $sort; ?> &order_by=<?php echo $order_by; ?> '; jQuery('a#convertDownload').attr('href', '<?php echo $baseurl_short; if (!$direct_download) { echo 'pages/terms.php?ref=' . $ref . '&search=' . $search . '&k=' . $k . '&url='; } ?> ' + <?php echo $direct_download ? 'basePage' : 'encodeURIComponent(basePage)'; ?> ); } jQuery(document).ready(function() { updateSizeInfo(); updateDownloadLink(); }); jQuery('select#size').change(function() { updateSizeInfo(); updateDownloadLink(); }); jQuery('select#format').change(function() { updateDownloadLink(); }); jQuery('select#profile').change(function() { updateDownloadLink(); }); </script> <?php } global $access, $alt_types_organize, $alternative_file_previews, $userrequestmode; # Alternative files listing $alt_access = hook("altfilesaccess"); if ($access == 0) { $alt_access = true; } # open access (not restricted) if ($alt_access) { $alt_order_by = ""; $alt_sort = ""; if ($alt_types_organize) { $alt_order_by = "alt_type"; $alt_sort = "asc"; } $altfiles = get_alternative_files($ref, $alt_order_by, $alt_sort); hook("processaltfiles"); $last_alt_type = "-"; ?> <table> <?php for ($n = 0; $n < count($altfiles); $n++) { $alt_type = $altfiles[$n]['alt_type']; if ($alt_types_organize) { if ($alt_type != $last_alt_type) { $alt_type_header = $alt_type; if ($alt_type_header == "") { $alt_type_header = $lang["alternativefiles"]; } hook("viewbeforealtheader"); ?> <tr class="DownloadDBlend"> <td colspan="3" id="altfileheader"><h2><?php echo $alt_type_header; ?> </h2></td> </tr> <?php } $last_alt_type = $alt_type; } else { if ($n == 0) { hook("viewbeforealtheader"); ?> <tr> <td colspan="3" id="altfileheader"><?php echo $lang["alternativefiles"]; ?> </td> </tr> <?php } } $alt_thm = ""; $alt_pre = ""; if ($alternative_file_previews) { $alt_thm_file = get_resource_path($ref, true, "col", false, "jpg", -1, 1, false, "", $altfiles[$n]["ref"]); if (file_exists($alt_thm_file)) { # Get web path for thumb (pass creation date to help cache refresh) $alt_thm = get_resource_path($ref, false, "col", false, "jpg", -1, 1, false, $altfiles[$n]["creation_date"], $altfiles[$n]["ref"]); } $alt_pre_file = get_resource_path($ref, true, "pre", false, "jpg", -1, 1, false, "", $altfiles[$n]["ref"]); if (file_exists($alt_pre_file)) { # Get web path for preview (pass creation date to help cache refresh) $alt_pre = get_resource_path($ref, false, "pre", false, "jpg", -1, 1, false, $altfiles[$n]["creation_date"], $altfiles[$n]["ref"]); } } ?> <tr class="DownloadDBlend" <?php if ($alt_pre != "" && isset($alternative_file_previews_mouseover) && $alternative_file_previews_mouseover) { ?> onMouseOver="orig_preview=jQuery('#previewimage').attr('src');orig_width=jQuery('#previewimage').width();jQuery('#previewimage').attr('src','<?php echo $alt_pre; ?> ');jQuery('#previewimage').width(orig_width);" onMouseOut="jQuery('#previewimage').attr('src',orig_preview);"<?php } ?> > <td class="DownloadFileName"> <?php if (!hook("renderaltthumb")) { ?> <?php if ($alt_thm != "") { ?> <a href="<?php echo $baseurl_short; ?> pages/preview.php?ref=<?php echo urlencode($ref); ?> &alternative=<?php echo $altfiles[$n]["ref"]; ?> &k=<?php echo urlencode($k); ?> &search=<?php echo urlencode($search); ?> &offset=<?php echo urlencode($offset); ?> &order_by=<?php echo urlencode($order_by); ?> &sort=<?php echo urlencode($sort); ?> &archive=<?php echo urlencode($archive); ?> &<?php echo hook("previewextraurl"); ?> "><img src="<?php echo $alt_thm; ?> " class="AltThumb"></a><?php } ?> <?php } ?> <h2 class="breakall"><?php echo htmlspecialchars($altfiles[$n]["name"]); ?> </h2> <p><?php echo htmlspecialchars($altfiles[$n]["description"]); ?> </p> </td> <td class="DownloadFileSize"><?php echo formatfilesize($altfiles[$n]["file_size"]); ?> </td> <?php if ($userrequestmode == 2 || $userrequestmode == 3) { ?> <td></td><?php } # Blank spacer column if displaying a price above (basket mode). ?> <?php if ($access == 0) { ?> <td class="DownloadButton"> <?php if (!$direct_download || $save_as) { if (!hook("downloadbuttonreplace")) { ?> <a <?php if (!hook("downloadlink", "", array("ref=" . $ref . "&alternative=" . $altfiles[$n]["ref"] . "&k=" . $k . "&ext=" . $altfiles[$n]["file_extension"]))) { ?> href="<?php echo $baseurl_short; ?> pages/terms.php?ref=<?php echo urlencode($ref); ?> &k=<?php echo urlencode($k); ?> &search=<?php echo urlencode($search); ?> &url=<?php echo urlencode("pages/download_progress.php?ref=" . $ref . "&ext=" . $altfiles[$n]["file_extension"] . "&k=" . $k . "&alternative=" . $altfiles[$n]["ref"] . "&search=" . urlencode($search) . "&offset=" . $offset . "&archive=" . $archive . "&sort=" . $sort . "&order_by=" . urlencode($order_by)); ?> "<?php } ?> onClick="return CentralSpaceLoad(this,true);"><?php echo $lang["action-download"]; ?> </a><?php } } else { ?> <a href="#" onclick="directDownload('<?php echo $baseurl_short; ?> pages/download_progress.php?ref=<?php echo urlencode($ref); ?> &ext=<?php echo $altfiles[$n]["file_extension"]; ?> &k=<?php echo urlencode($k); ?> &alternative=<?php echo $altfiles[$n]["ref"]; ?> ')"><?php echo $lang["action-download"]; ?> </a> <?php } // end if direct_download ?> </td></td> <?php } else { ?> <td class="DownloadButton DownloadDisabled"><?php echo $lang["access1"]; ?> </td> <?php } ?> </tr> <?php } hook("morealtdownload"); ?> </table> <?php } # --- end of alternative files listing return true; }
function HookAnnotatePreviewPreviewimage2() { global $ajax, $ext, $baseurl, $ref, $k, $search, $offset, $order_by, $sort, $archive, $lang, $download_multisize, $baseurl_short, $url, $path, $path_orig, $annotate_ext_exclude, $annotate_rt_exclude, $annotate_public_view, $annotate_pdf_output, $nextpage, $previouspage, $alternative; $resource = get_resource_data($ref); if (in_array($resource['file_extension'], $annotate_ext_exclude)) { return false; } if (in_array($resource['resource_type'], $annotate_rt_exclude)) { return false; } if (!($k == "") && !$annotate_public_view) { return false; } if (!file_exists($path) && !file_exists($path_orig)) { return false; } if (!file_exists($path)) { $sizes = getimagesize($path_orig); } else { $sizes = getimagesize($path); } $w = $sizes[0]; $h = $sizes[1]; ?> <script type="text/javascript"> button_ok = "<?php echo preg_replace("/\r?\n/", "\\n", addslashes($lang["ok"])); ?> "; button_cancel = "<?php echo preg_replace("/\r?\n/", "\\n", addslashes($lang["cancel"])); ?> "; button_delete = "<?php echo preg_replace("/\r?\n/", "\\n", addslashes($lang["action-delete"])); ?> "; button_add = "> <?php echo preg_replace("/\r?\n/", "\\n", addslashes($lang["action-add_note"])); ?> "; button_toggle = "> <?php echo preg_replace("/\r?\n/", "\\n", addslashes($lang["action-toggle-on"])); ?> "; button_toggle_off = "> <?php echo preg_replace("/\r?\n/", "\\n", addslashes($lang["action-toggle-off"])); ?> "; error_saving = "<?php echo preg_replace("/\r?\n/", "\\n", addslashes($lang["error-saving"])); ?> "; error_deleting = "<?php echo preg_replace("/\r?\n/", "\\n", addslashes($lang["error-deleting"])); ?> "; </script> <script> jQuery.noConflict(); </script> <div id="wrapper" style="display:block;clear:none;float:left;margin: 0px;"> <table cellpadding="0" cellspacing="0"> <tr> <?php if ($resource['file_extension'] != "jpg" && $previouspage != -1 && resource_download_allowed($ref, "scr", $resource["resource_type"])) { ?> <td valign="middle"> <a onClick="return CentralSpaceLoad(this);" href="<?php echo $baseurl_short; ?> pages/preview.php?ref=<?php echo urlencode($ref); ?> &alternative=<?php echo urlencode($alternative); ?> &ext=<?php echo urlencode($ext); ?> &k=<?php echo urlencode($k); ?> &search=<?php echo urlencode($search); ?> &offset=<?php echo urlencode($offset); ?> &order_by=<?php echo urlencode($order_by); ?> &sort=<?php echo urlencode($sort); ?> &archive=<?php echo urlencode($archive); ?> &page=<?php echo urlencode($previouspage); ?> " class="PDFnav pagePrev"><</a> </td> <?php } else { if ($nextpage != -1 && resource_download_allowed($ref, "scr", $resource["resource_type"])) { ?> <td valign="middle"> <a href="#" class="PDFnav pagePrev"> </a> </td> <?php } } ?> <div> <td> <img id="toAnnotate" onload="annotate(<?php echo $ref; ?> ,'<?php echo $k; ?> ','<?php echo $w; ?> ','<?php echo $h; ?> ',<?php echo getvalescaped("annotate_toggle", true); ?> ,<?php echo getvalescaped('page', 1); ?> );" src="<?php echo $url; ?> " id="previewimage" class="Picture" GALLERYIMG="no" style="display:block;" /> </td> <?php if ($nextpage != -1 && resource_download_allowed($ref, "scr", $resource["resource_type"])) { ?> <td valign="middle"> <a onClick="return CentralSpaceLoad(this);" href="<?php echo $baseurl_short; ?> pages/preview.php?ref=<?php echo urlencode($ref); ?> &alternative=<?php echo urlencode($alternative); ?> &ext=<?php echo urlencode($ext); ?> &k=<?php echo urlencode($k); ?> &search=<?php echo urlencode($search); ?> &offset=<?php echo urlencode($offset); ?> &order_by=<?php echo urlencode($order_by); ?> &sort=<?php echo urlencode($sort); ?> &archive=<?php echo urlencode($archive); ?> &page=<?php echo urlencode($nextpage); ?> " class="PDFnav pageNext">></a> </td> <?php } ?> </div> <div style="padding-top:5px;"> <?php // MAGICTOUCH PLUGIN COMPATIBILITY global $magictouch_account_id; if ($magictouch_account_id != "") { global $plugins; global $magictouch_rt_exclude; global $magictouch_ext_exclude; if (in_array("magictouch", $plugins) && !in_array($resource['resource_type'], $magictouch_rt_exclude) && !in_array($resource['file_extension'], $magictouch_ext_exclude) && !defined("MTFAIL")) { ?> <a style="display:inline;float:right;" href="<?php echo getval("from", "") == "search" ? "search.php?" : "preview.php?ref=" . $ref . "&"; ?> search=<?php echo urlencode($search); ?> &offset=<?php echo $offset; ?> &order_by=<?php echo $order_by; ?> &sort=<?php echo $sort; ?> &archive=<?php echo $archive; ?> &k=<?php echo $k; ?> " onClick="document.cookie='annotate=off;';return CentralSpaceLoad(this);">> <?php echo $lang['zoom']; ?> </a><?php } } /////////////// ?> <?php if ($annotate_pdf_output) { ?> <a style="display:inline;float:right;margin-right:10px;" href="<?php echo $baseurl; ?> /plugins/annotate/pages/annotate_pdf_config.php?ref=<?php echo $ref; ?> &ext=<?php echo $resource["preview_extension"]; ?> &k=<?php echo $k; ?> &search=<?php echo urlencode($search); ?> &offset=<?php echo $offset; ?> &order_by=<?php echo $order_by; ?> &sort=<?php echo $sort; ?> &archive=<?php echo $archive; ?> " >> <?php echo $lang["pdfwithnotes"]; ?> </a> <?php } ?> </div> </tr></table> </div> <?php return true; }
else if (!$target_exists && $useoriginal == 'yes' && resource_download_allowed($ref,'',$result[$n]['resource_type'])) { // this size doesn't exist, so we'll try using the original instead $p=get_resource_path($ref,true,'',false,$result[$n]['file_extension'],-1,1,$use_watermark); $pextension = $result[$n]['file_extension']; $subbed_original_resources[] = $ref; $subbed_original = true; $target_exists = file_exists($p); } # Check file exists and, if restricted access, that the user has access to the requested size. if ((($target_exists && $access==0) || ($target_exists && $access==1 && (image_size_restricted_access($size) || ($usesize='' && $restricted_full_download))) ) && resource_download_allowed($ref,$usesize,$result[$n]['resource_type'])) { $used_resources[]=$ref; # when writing metadata, we take an extra security measure by copying the files to tmp $tmpfile=write_metadata($p,$ref,$id); // copies file if($tmpfile!==false && file_exists($tmpfile)){ $p=$tmpfile; // file already in tmp, just rename it } else if (!$replaced_file) { $copy=true; // copy the file from filestore rather than renaming } # if the tmpfile is made, from here on we are working with that. # If using original filenames when downloading, copy the file to new location so the name is included. $filename = ''; if ($original_filenames_when_downloading)