MOD: Alternate directory for download files
Posted: Friday, 22.07.2005 23:34
Date of modification:
17.11.2005
Link:
http://www.4homepages.de/forum/index.php?topic=7499.0
Modified files:
./download.php
./includes/functions.php
./templates/x_images/details.html
./details.php
./lang/english/main.php
./lang/deutsch/main.php
./download.php
Locate:
Change it to:
Locate:
Replace with:
./includes/functions.php
Locate:
Replace with:
Locate:
Add after:
Locate:
Add after:
Locate:
Replace with:
Locate:
Replace with:
Locate the very last line:
Replace with:
Backup: geoheiIM_1.7.1_20050818_0.tgz
./templates/x_images/details.html
Locate:
Replace with:
./details.php
Locate:
Replace with:
./lang/english/main.php
Locate:
Add after:
./lang/deutsch/main.php
Locate:
Add after:
Backup: geoheiIM_1.7.1_20051117_0.tgz
17.11.2005
Link:
http://www.4homepages.de/forum/index.php?topic=7499.0
Modified files:
./download.php
./includes/functions.php
./templates/x_images/details.html
./details.php
./lang/english/main.php
./lang/deutsch/main.php
./download.php
Locate:
Code: Select all
$file['file_path'] = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".$file['file_name'];
Code: Select all
$temp = get_file_path($file['file_name'], "download", $image_row['cat_id'], 0, 1);
if( !file_exists($temp) )
$temp = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".$file['file_name'];
$file['file_path'] = $temp;
Code: Select all
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
Code: Select all
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file'];
if( !file_exists($file_path) )
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file'];
if( !file_exists($file_path) )
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
Locate:
Code: Select all
$file_size = "n/a";
if (!is_remote($image_row['image_media_file'])) {
if ($file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
$file_size = format_file_size($file_size);
}
}
elseif ($detailed_view) {
$file_size = get_remote_file_size($image_row['image_media_file']);
}
Code: Select all
$file_size = "n/a";
$download_file_size = "n/a"; // Download file
if (!is_remote($image_row['image_media_file'])) {
if ($file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
$download_file_size = $file_size; // Download file
$file_size = format_file_size($file_size);
}
if( file_exists(MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file']) )
$download_file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file']);
elseif( file_exists(MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file']) )
$download_file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file']);
$download_file_size = format_file_size($download_file_size);
}
elseif ($detailed_view) {
$file_size = get_remote_file_size($image_row['image_media_file']);
}
Code: Select all
"url_download" => $site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id']),
Code: Select all
"download_image_file_size" => $download_file_size,
Code: Select all
if ($image_info = @getimagesize($src, $info)) {
$width_height = " ".$image_info[3];
$width = $image_info[0];
$height = $image_info[1];
Code: Select all
$download_width_height = $width_height;
$download_width = $width;
$download_height = $height;
Code: Select all
else {
$check_handle = "check_".$image_type."_type";
$path = (($image_type == "media") ? (($cat_id) ? MEDIA_PATH."/".$cat_id : MEDIA_TEMP_PATH) : (($cat_id) ? THUMB_PATH."/".$cat_id : THUMB_TEMP_PATH))."/".$file_name;
return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $path) : $return_code;
}
Code: Select all
else {
$check_handle = "check_".$image_type."_type";
switch( $image_type ) {
case "media":
if( $cat_id )
$path = MEDIA_PATH."/".$cat_id;
else
$path = MEDIA_TEMP_PATH;
break;
case "big":
$path = MEDIA_PATH."/".$cat_id."/big";
break;
case "download":
$path = MEDIA_PATH."/".$cat_id."/download";
break;
default:
if( $cat_id )
$path = THUMB_PATH."/".$cat_id;
else
$path = THUMB_TEMP_PATH;
break;
}
$path .= "/".$file_name;
return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $path) : (($image_type != "big" && $image_type != "download") ? $return_code : "");
}
Code: Select all
$site_template->register_vars(array(
"media_src" => $media_src,
"media_icon" => $media_icon,
"image_name" => $image_name,
"width_height" => $width_height,
"width" => $width,
"height" => $height,
"iptc_info" => $iptc_info
));
Code: Select all
$download_file_src = get_file_path($media_file_name, "download", $cat_id, 0, 1);
$src_download = (!file_exists($download_file_src) && file_exists(preg_replace("/\/{2,}/", "/", get_document_root()."/".$download_file_src))) ? preg_replace("/\/{2,}/", "/", get_document_root()."/".$download_file_src) : $download_file_src;
if ($temp = @getimagesize($src_download)) {
$download_width_height = " ".$temp[3];
$download_width = $temp[0];
$download_height = $temp[1];
}
$site_template->register_vars(array(
"media_src" => $media_src,
"media_icon" => $media_icon,
"image_name" => $image_name,
"width_height" => $width_height,
"width" => $width,
"height" => $height,
"download_width" => $download_width, // Download file
"download_height" => $download_height, // Download file
"iptc_info" => $iptc_info
));
Code: Select all
?>
Code: Select all
function check_remote_download($remote_media_file) {
global $config;
return (preg_match("#^(https?:\/\/[a-z0-9\-]+?\.([a-z0-9\-]+\.)*[a-z]+(:[0-9]+)*\/.*?\.(".$config['allowed_mediatypes_match'].")$)#is", $remote_media_file)) ? 1 : 0;
}
function check_local_download($local_media_file) {
global $config;
return (preg_match("#^((\.)*\/.*?\.(".$config['allowed_mediatypes_match'].")$)#is", $local_media_file)) ? 1 : 0;
}
function check_download_type($file_name) {
global $config;
return (in_array(get_file_extension($file_name), $config['allowed_mediatypes_array'])) ? 1 : 0;
}
?>
./templates/x_images/details.html
Locate:
Code: Select all
<tr>
<td valign="top" class="cat2"><b>{lang_added_by}</b></td>
<td valign="top" class="cat2">{user_name_link}</td>
</tr>
Code: Select all
<tr>
<td valign="top" class="cat2"><b>{lang_download_file_size}</b></td>
<td valign="top" class="cat2">{download_image_file_size} [{download_width}x{download_height}]</td>
</tr>
<tr>
<td valign="top" class="cat1"><b>{lang_added_by}</b></td>
<td valign="top" class="cat1">{user_name_link}</td>
</tr>
Locate:
Code: Select all
"lang_file_size" => $lang['file_size']
Code: Select all
"lang_file_size" => $lang['file_size'],
"lang_download_file_size" => $lang['download_file_size']
Locate:
Code: Select all
$lang['file_size'] = "File size:";
Code: Select all
$lang['download_file_size'] = "Download file size [resolution]:";
Locate:
Code: Select all
$lang['file_size'] = "File size:";
Code: Select all
$lang['download_file_size'] = "Download Dateigröße [Auflösung]:";