function HookFormat_chooserCollection_downloadReplaceuseoriginal() { global $format_chooser_output_formats, $lang; $defaultFormat = getDefaultOutputFormat(); ?> <div class="Question"> <label for="downloadformat"><?php echo $lang["downloadformat"]; ?> </label> <select name="ext" class="stdwidth" id="downloadformat"> <?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> <div class="clearerleft"> </div></div><?php return true; }
function HookFormat_chooserCollection_downloadReplaceuseoriginal() { global $format_chooser_output_formats, $format_chooser_profiles, $lang, $use_zip_extension; $disabled = ''; $submitted = getvalescaped('submitted', null); if (!empty($submitted)) { $disabled = ' disabled="disabled"'; } # Replace the existing ajax_download() with our own that disables our widgets, too if ($use_zip_extension) { ?> <script> var originalDownloadFunction = ajax_download; ajax_download = function() { originalDownloadFunction(); jQuery('#downloadformat').attr('disabled', 'disabled'); jQuery('#profile').attr('disabled', 'disabled'); } </script><?php } ?> <div class="Question"> <input type=hidden name="useoriginal" value="yes" /> <label for="downloadformat"><?php echo $lang["downloadformat"]; ?> </label> <select name="ext" class="stdwidth" id="downloadformat"<?php echo $disabled; ?> > <option value="" selected="selected"><?php echo $lang['format_chooser_keep_format']; ?> </option> <?php foreach ($format_chooser_output_formats as $format) { ?> <option value="<?php echo $format; ?> "><?php echo str_replace_formatted_placeholder("%extension", $format, $lang["field-fileextension"]); ?> </option><?php } ?> </select> <div class="clearerleft"> </div></div><?php if (!empty($format_chooser_profiles)) { ?> <div class="Question"> <label for="profile"><?php echo $lang['format_chooser_choose_profile']; ?> </label> <?php showProfileChooser('stdwidth'); ?> <div class="clearerleft"> </div></div><?php } return true; }
$count_restypes = 0; foreach ($related_restypes as $rtype) { if (in_array($rtype, $relatedtypes_shown)) { // Don't show this type again. continue; } $restypename = sql_value("select name as value from resource_type where ref = '{$rtype}'", ""); $restypename = lang_or_i18n_get_translated($restypename, "resourcetype-", "-2"); ?> <!--Panel for related resources--> <div class="RecordBox"> <div class="RecordPanel"> <div id="RelatedResources"> <div class="RecordResouce"> <div class="Title"><?php echo str_replace_formatted_placeholder("%restype%", $restypename, $lang["relatedresources-restype"]); ?> </div> <?php # loop and display the results by file extension for ($n = 0; $n < count($result); $n++) { if ($result[$n]["resource_type"] == $rtype) { $rref = $result[$n]["ref"]; $title = $result[$n]["field" . $view_title_field]; $access = get_resource_access($rref); $use_watermark = check_use_watermark(); # swap title fields if necessary if (isset($metadata_template_title_field) && isset($metadata_template_resource_type)) { if ($result[$n]['resource_type'] == $metadata_template_resource_type) { $title = $result[$n]["field" . $metadata_template_title_field]; }
# Show the no-preview icon ?> <img src="<?php echo $baseurl_short; ?> gfx/<?php echo get_nopreview_icon($resource["resource_type"], $resource["file_extension"], true); ?> " /> <br /> <?php } if ($resource["file_extension"] != "") { ?> <strong><?php echo str_replace_formatted_placeholder("%extension", $resource["file_extension"], $lang["cell-fileoftype"]) . " (" . formatfilesize(@filesize_unlimited(get_resource_path($ref, true, "", false, $resource["file_extension"]))) . ")"; ?> </strong><?php if (checkperm("w") && $resource["has_image"] == 1 && file_exists($wmpath)) { ?> <a href="#" onclick="jQuery('#wmpreview').toggle();jQuery('#preview').toggle();if (jQuery(this).text()=='<?php echo $lang['showwatermark']; ?> '){jQuery(this).text('<?php echo $lang['hidewatermark']; ?> ');} else {jQuery(this).text('<?php echo $lang['showwatermark']; ?> ');}"><?php echo $lang['showwatermark'];
<div class="Fixed"> <?php if ($resource["has_image"]==1) { ?><img align="top" src="<?php echo get_resource_path($ref,false,($edit_large_preview?"pre":"thm"),false,$resource["preview_extension"],-1,1,checkperm("w"))?>" class="ImageBorder" style="margin-right:10px;"/><br /> <?php } else { # Show the no-preview icon ?> <img src="../gfx/<?php echo get_nopreview_icon($resource["resource_type"],$resource["file_extension"],true)?>" /> <br /> <?php } if ($resource["file_extension"]!="") { ?><strong><?php echo str_replace_formatted_placeholder("%extension", $resource["file_extension"], $lang["cell-fileoftype"]) . " (" . formatfilesize(@filesize_unlimited(get_resource_path($ref,true,"",false,$resource["file_extension"]))) . ")" ?></strong><br /><?php } ?> <?php if ($resource["has_image"]!=1) { ?> <a href="<?php echo $baseurl_short?>pages/upload.php?ref=<?php echo 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) ?>&upload_a_file=true" onClick="return CentralSpaceLoad(this,true);">> <?php echo $lang["uploadafile"]?></a> <?php } else { ?> <a href="<?php echo $baseurl_short?>pages/upload_<?php echo $top_nav_upload_type ?>.php?ref=<?php echo 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) ?>&replace_resource=<?php echo urlencode($ref) ?>&resource_type=<?php echo $resource['resource_type']?>" onClick="return CentralSpaceLoad(this,true);">> <?php echo $lang["replacefile"]?></a> <?php hook("afterreplacefile"); ?> <?php } ?> <?php if (! $disable_upload_preview) { ?><br /> <a href="<?php echo $baseurl_short?>pages/upload_preview.php?ref=<?php echo 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) ?>" onClick="return CentralSpaceLoad(this,true);">> <?php echo $lang["uploadpreview"]?></a><?php } ?> <?php if (! $disable_alternative_files) { ?><br /> <a href="<?php echo $baseurl_short?>pages/alternative_files.php?ref=<?php echo 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) ?>" onClick="return CentralSpaceLoad(this,true);">> <?php echo $lang["managealternativefiles"]?></a><?php } ?> <?php if ($allow_metadata_revert){?><br /> <a href="<?php echo $baseurl_short?>pages/edit.php?ref=<?php echo urlencode($ref) ?>&exif=true&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) ?>" onClick="return confirm('<?php echo $lang["confirm-revertmetadata"]?>');">> <?php echo $lang["action-revertmetadata"]?></a><?php } ?> <?php hook("afterfileoptions"); ?>
for ($n = 0; $n < count($result); $n++) { $related_file_extension = $result[$n]["file_extension"]; $related_file_extensions[] = $related_file_extension; } #reduce extensions array to unique values $related_file_extensions = array_unique($related_file_extensions); $count_extensions = 0; foreach ($related_file_extensions as $rext) { ?> <!--Panel for related resources--> <div class="RecordBox"> <div class="RecordPanel"> <div class="RecordResouce"> <div class="Title"><?php echo str_replace_formatted_placeholder("%extension", $rext, $lang["relatedresources-filename_extension"]); ?> </div> <?php # loop and display the results by file extension for ($n = 0; $n < count($result); $n++) { if ($result[$n]["file_extension"] == $rext) { $rref = $result[$n]["ref"]; $title = $result[$n]["field" . $view_title_field]; # swap title fields if necessary if (isset($metadata_template_title_field) && isset($metadata_template_resource_type)) { if ($result[$n]['resource_type'] == $metadata_template_resource_type) { $title = $result[$n]["field" . $metadata_template_title_field]; } } ?>
" onClick="return CentralSpaceLoad(this,true);" <?php if (!$infobox) { ?> title="<?php echo str_replace(array("\"", "'"), "", htmlspecialchars(i18n_get_translated($value))); ?> "<?php } //end if infobox ?> ><?php } //end link echo format_display_field($value); if ($show_extension_in_search) { echo " " . str_replace_formatted_placeholder("%extension", $result[$n]["file_extension"], $lang["fileextension"]); } if ($x == 0) { // add link if necessary ?> </a><?php } //end link ?> </div></div> <?php } /* end hook replaceresourcepanelinfolarge */ ?> <?php // normal behavior
function HookInplaceeditAllReplaceresourcepanelinfolarge() { global $x, $value, $show_extension_in_search, $infobox, $url, $result, $ref, $df, $in_place_editable, $n; if (!in_array($df[$x]['ref'], $in_place_editable)) { return false; } # Should this field be displayed? if (!in_array($df[$x]['ref'], $in_place_editable) || checkperm("F*") && !checkperm("F-" . $df[$x]["ref"]) && !($ref < 0 && checkperm("P" . $df[$x]["ref"])) || checkperm("F" . $df[$x]["ref"]) || $ref < 0 && $df[$x]["hide_when_uploading"] && $df[$x]["required"] == 0) { return false; } ?> <div class="ResourcePanelInfo"><div class="extended"> <a class="editablefield" olddata-pk="<?php echo htmlspecialchars($value); ?> " data-pk="<?php echo $df[$x]['ref']; ?> " rel="<?php echo urlencode($ref); ?> " id="title<?php echo htmlspecialchars($ref); ?> " href="#"> <?php echo format_display_field($value); if ($show_extension_in_search) { echo " " . str_replace_formatted_placeholder("%extension", $result[$n]["file_extension"], $lang["fileextension-inside-brackets"]); } ?> </a></div></div> <?php return true; }
elseif($sort_relations_by_restype){ $count_restypes=0; foreach($related_restypes as $rtype){ if(in_array($rtype,$relatedtypes_shown)) { // Don't show this type again. continue; } $restypename=sql_value("select name as value from resource_type where ref = '$rtype'",""); $restypename = lang_or_i18n_get_translated($restypename, "resourcetype-", "-2"); ?><!--Panel for related resources--> <div class="RecordBox"> <div class="RecordPanel"> <div id="RelatedResources"> <div class="RecordResouce"> <div class="Title"><?php echo str_replace_formatted_placeholder("%restype%", $restypename, $lang["relatedresources-restype"]); ?></div> <?php # loop and display the results by file extension for ($n=0;$n<count($result);$n++) { if ($result[$n]["resource_type"]==$rtype){ $rref=$result[$n]["ref"]; $title=$result[$n]["field".$view_title_field]; $access=get_resource_access($rref); $use_watermark=check_use_watermark(); # swap title fields if necessary if (isset($metadata_template_title_field) && isset($metadata_template_resource_type)) { if ($result[$n]['resource_type']==$metadata_template_resource_type) {
} $resource_type = $resource['resource_type']; $type_name = get_resource_type_name($resource_type); $image = get_resource_path($ref, true, "", false, $ext); if (!file_exists($image)) { die($lang['error']); } #test if filetype is supported by exiftool $command = $exiftool_fullpath . " -listf"; $formats = run_command($command); $ext = strtoupper($ext); if (strlen(strstr($formats, $ext)) < 2) { die(str_replace_formatted_placeholder("%extension", $ext, $lang['filetypenotsupported'])); } if (in_array(strtolower($ext), $exiftool_no_process)) { die(str_replace_formatted_placeholder("%extension", $ext, $lang['exiftoolprocessingdisabledforfiletype'])); } #build array of writable tags $command = $exiftool_fullpath . " -listw"; $writable_tags = run_command($command); $writable_tags = strtolower(str_replace("\n", "", $writable_tags)); $writable_tags_array = explode(" ", $writable_tags); $command = $exiftool_fullpath . " -ver"; $exiftool_version = run_command($command); if ($exiftool_version >= 7.4) { #build array of writable formats $command = $exiftool_fullpath . " -listwf"; $writable_formats = run_command($command); $writable_formats = str_replace("\n", "", $writable_formats); $writable_formats_array = explode(" ", $writable_formats); $file_writability = in_array($ext, $writable_formats_array);
} elseif (count($searched_resource_types_names_array) == 0 && count($searched_collection_types_names_array) > 0) { # Only (one or more) collection types are selected $searchtitle = str_replace_formatted_placeholder("%collectiontypes%", $searched_collection_types_names_array, $lang["no_resourcetypes-collections"], false, $lang["collectiontypes_separator"]); } elseif (count($searched_resource_types_names_array) > 0 && count($searched_collection_types_names_array) > 0) { # Both resource types and collection types are selected # Step 1: Replace %resourcetypes% $searchtitle = $lang["all"] . " " . implode($lang["resourcetypes_separator"] . " ", $searched_resource_types_names_array); //$searchtitle = str_replace_formatted_placeholder("%resourcetypes%", $searched_resource_types_names_array, $lang["resourcetypes-collections"], false, //$lang["resourcetypes_separator"]); # Step 2: Replace %collectiontypes% $searchtitle = str_replace_formatted_placeholder("%collectiontypes%", $searched_collection_types_names_array, $searchtitle, false, $lang["collectiontypes_separator"]); } else { # No resource types and no collection types are selected – show all resource types and all collection types # Step 1: Replace %resourcetypes% $searchtitle = str_replace_formatted_placeholder("%resourcetypes%", $lang["all-resourcetypes"], $lang["resourcetypes-collections"], false, $lang["resourcetypes_separator"]); # Step 2: Replace %collectiontypes% $searchtitle = str_replace_formatted_placeholder("%collectiontypes%", $lang["all-collectiontypes"], $searchtitle, false, $lang["collectiontypes_separator"]); } $search_title = '<h1 class="searchcrumbs"><a href="' . $baseurl_short . 'pages/search.php?search=" onClick="return CentralSpaceLoad(this,true);">' . $searchtitle . '</a></h1> '; } elseif (substr($search, 0, 5) == "!last") { $searchq = substr($search, 5); $searchq = explode(",", $searchq); $searchq = $searchq[0]; if (!is_numeric($searchq)) { $searchq = 1000; } # 'Last' must be a number. SQL injection filter. $search_title = '<h1 class="searchcrumbs"><a href="' . $baseurl_short . 'pages/search.php?search=!last' . $searchq . $parameters_string . '" onClick="return CentralSpaceLoad(this,true);">' . str_replace('%qty', $searchq, $lang["n_recent"]) . '</a>' . $searchcrumbs . '</h1> '; } elseif (substr($search, 0, 8) == "!related") { $resource = substr($search, 8); $resource = explode(",", $resource); $resource = $resource[0];
if($sort_relations_by_filetype){ #build array of related resources' file extensions for ($n=0;$n<count($result);$n++){ $related_file_extension=$result[$n]["file_extension"]; $related_file_extensions[]=$related_file_extension; } #reduce extensions array to unique values $related_file_extensions=array_unique($related_file_extensions); $count_extensions=0; foreach($related_file_extensions as $rext){ ?><!--Panel for related resources--> <div class="RecordBox"> <div class="RecordPanel"> <div class="RecordResouce"> <div class="Title"><?php echo str_replace_formatted_placeholder("%extension", $rext, $lang["relatedresources-filename_extension"]); ?></div> <?php # loop and display the results by file extension for ($n=0;$n<count($result);$n++) { if ($result[$n]["file_extension"]==$rext){ $rref=$result[$n]["ref"]; $title=$result[$n]["field".$view_title_field]; # swap title fields if necessary if (isset($metadata_template_title_field) && isset($metadata_template_resource_type)) { if ($result[$n]['resource_type']==$metadata_template_resource_type) { $title=$result[$n]["field".$metadata_template_title_field];
# swap title fields if necessary if (isset($metadata_template_resource_type) && isset ($metadata_template_title_field)){ if (($df[$x]['ref']==$view_title_field) && ($result[$n]['resource_type']==$metadata_template_resource_type)){ $value=$result[$n]['field'.$metadata_template_title_field]; } } ?> <?php // extended css behavior if ( in_array($df[$x]['ref'],$thumbs_display_extended_fields) && ( (isset($metadata_template_title_field) && $df[$x]['ref']!=$metadata_template_title_field) || !isset($metadata_template_title_field) ) ){ ?> <?php if (!hook("replaceresourcepanelinfo")){?> <div class="ResourcePanelInfo"><div class="extended"> <?php if ($x==0){ // add link if necessary ?><a href="<?php echo $url?>" onClick="return CentralSpaceLoad(this,true);" <?php if (!$infobox) { ?>title="<?php echo str_replace(array("\"","'"),"",htmlspecialchars(i18n_get_translated($value)))?>"<?php } //end if infobox ?>><?php } //end link echo format_display_field($value); ?><?php if ($show_extension_in_search) { ?><?php echo " " . str_replace_formatted_placeholder("%extension", $result[$n]["file_extension"], $lang["fileextension-inside-brackets"])?><?php } ?><?php if ($x==0){ // add link if necessary ?></a><?php } //end link?> </div></div> <?php } /* end hook replaceresourcepanelinfo */?> <?php // normal behavior } else if ( (isset($metadata_template_title_field)&&$df[$x]['ref']!=$metadata_template_title_field) || !isset($metadata_template_title_field) ) {?> <div class="ResourcePanelInfo"><?php if ($x==0){ // add link if necessary ?><a href="<?php echo $url?>" onClick="return CentralSpaceLoad(this,true);" <?php if (!$infobox) { ?>title="<?php echo str_replace(array("\"","'"),"",htmlspecialchars(i18n_get_translated($value)))?>"<?php } //end if infobox ?>><?php } //end link?><?php echo highlightkeywords(tidy_trim(TidyList(i18n_get_translated($value)),$search_results_title_trim),$search,$df[$x]['partial_index'],$df[$x]['name'],$df[$x]['indexed'])?><?php if ($x==0){ // add link if necessary ?></a><?php } //end link?> </div><div class="clearer"></div> <?php } ?> <?php } ?> <!-- Checkboxes --> <div class="ResourcePanelIcons"> <?php if(!hook("thumbscheckboxes")){?> <?php if ($use_checkboxes_for_selection){?><input type="checkbox" id="check<?php echo htmlspecialchars($ref)?>" class="checkselect" <?php if (in_array($ref,$collectionresources)){ ?>checked<?php } ?> onclick="if (jQuery('#check<?php echo htmlspecialchars($ref)?>').attr('checked')=='checked'){ AddResourceToCollection(<?php echo htmlspecialchars($ref)?>); } else if (jQuery('#check<?php echo htmlspecialchars($ref)?>').attr('checked')!='checked'){ RemoveResourceFromCollection(<?php echo htmlspecialchars($ref)?>); }"> <?php } ?>
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; }
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; }
$files = get_alternative_files($ref, $alt_order_by, $alt_sort); hook("alt_files_before_list"); for ($n = 0; $n < count($files); $n++) { ?> <!--List Item--> <tr> <td><?php echo htmlspecialchars($files[$n]["name"]); ?> </td> <td><?php echo htmlspecialchars($files[$n]["description"]); ?> </td> <td><?php echo $files[$n]["file_extension"] == "" ? $lang["notuploaded"] : htmlspecialchars(str_replace_formatted_placeholder("%extension", $files[$n]["file_extension"], $lang["cell-fileoftype"])); ?> </td> <td><?php echo formatfilesize($files[$n]["file_size"]); ?> </td> <td><?php echo nicedate($files[$n]["creation_date"], true); ?> </td> <?php if (count($alt_types) > 1) { ?> <td><?php echo $files[$n]["alt_type"];
<input type="hidden" name="resource_type" value="<?php echo $resource_type; ?> " /> <input type="hidden" name="archive" value="<?php echo $archive; ?> " /> <br/> <?php if ($status != "") { echo $status; } ?> <div id="invalid" style="display:none;" class="FormIncorrect"><?php echo str_replace_formatted_placeholder("%extensions", str_replace(",", ", ", $allowed_extensions), $lang['invalidextension_mustbe-extensions']); ?> </div> <div class="Question"> <label for="userfile"><?php echo $lang["file"]; ?> </label> <?php if ($show_progress) { ?> <input type="hidden" id="uid" name="UPLOAD_IDENTIFIER" value="<?php echo $uid; ?> " >
?> </h2> <p><?php echo $intro; ?> </p> <?php if ($allowed_extensions != "") { $allowed_extensions = str_replace(", ", ",", $allowed_extensions); $list = explode(",", trim($allowed_extensions)); sort($list); $allowed_extensions = implode(",", $list); ?> <p><?php echo str_replace_formatted_placeholder("%extensions", str_replace(",", ", ", $allowed_extensions), $lang['allowedextensions-extensions']); ?> </p><?php } ?> <!--------------------------------------------------------------------------------------------------------- ------------------- A SIMPLE AND STANDARD APPLET TAG, to call the JUpload applet --------------------- -----------------------------------------------------------------------------------------------------------> <applet code="wjhk.jupload2.JUploadApplet" name="JUpload" archive="../lib/jupload/wjhk.jupload.jar?1" width="640" height="300" mayscript
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $maxsize; ?> "> <input type="hidden" name="ref" value="<?php echo htmlspecialchars($ref); ?> "> <br/> <?php if ($status != "") { echo $status; } ?> <div id="invalid" style="display:none;" class="FormIncorrect"><?php echo str_replace_formatted_placeholder("%extensions", "JPG", $lang['invalidextension_mustbe-extensions']); ?> </div> <div class="Question"> <label for="userfile"><?php echo $lang["clickbrowsetolocate"]; ?> </label> <input type=file name=userfile id=userfile> <div class="clearerleft"> </div> </div> <div class="QuestionSubmit"> <label for="buttons"> </label> <input name="save" type="submit" onclick="if (!check(this.form.userfile.value)){document.getElementById('invalid').style.display='block';return false;}else {document.getElementById('invalid').style.display='none';}" value=" <?php echo $lang["upload_file"];
?> : </td> <td colspan='3'><?php if ($cropper_force_original_format == true) { echo "<input type='hidden' name='new_ext' value='"; echo strtoupper($orig_ext) . "' />" . strtoupper($orig_ext); } else { ?> <select name='new_ext'> <?php foreach ($cropper_formatarray as $theformat) { echo "<option value='{$theformat}'"; if (strtolower($theformat) == strtolower($orig_ext)) { echo " selected"; } echo ">" . str_replace_formatted_placeholder("%extension", $theformat, $lang["field-fileextension"]) . " </option>\n"; } ?> </select> <?php } // end of if force_original_format ?> </td> </tr> <?php if (count($cropper_resolutions) > 0) { ?> <tr>
<p><?php echo text("introtext")?></p> <script language="JavaScript"> // Check allowed extensions: function check(filename) { var allowedExtensions='jpg,jpeg'; var ext = filename.substr(filename.lastIndexOf('.')); ext =ext.substr(1).toLowerCase(); if (allowedExtensions.indexOf(ext)==-1){ return false;} else {return true;} } </script> <form method="post" class="form" enctype="multipart/form-data" action="upload_preview.php"> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $maxsize?>"> <input type="hidden" name="ref" value="<?php echo htmlspecialchars($ref)?>"> <br/> <?php if ($status!="") { ?><?php echo $status?><?php } ?> <div id="invalid" style="display:none;" class="FormIncorrect"><?php echo str_replace_formatted_placeholder("%extensions", "JPG", $lang['invalidextension_mustbe-extensions']); ?></div> <div class="Question"> <label for="userfile"><?php echo $lang["clickbrowsetolocate"]?></label> <input type=file name=userfile id=userfile> <div class="clearerleft"> </div> </div> <div class="QuestionSubmit"> <label for="buttons"> </label> <input name="save" type="submit" onclick="if (!check(this.form.userfile.value)){document.getElementById('invalid').style.display='block';return false;}else {document.getElementById('invalid').style.display='none';}" value=" <?php echo $lang["upload_file"]?> " /> </div> <p><a onClick="return CentralSpaceLoad(this,true);" href="edit.php?ref=<?php echo urlencode($ref)?>">> <?php echo $lang["backtoeditresource"]?></a></p> </form> </div>