Файл: fo/them_file.php
Строк: 55
<?php
if(!empty($_GET['f']) && preg_match('~.(thm|nth)$~', $_GET['f']) && file_exists($_GET['f'])){
$ext = pathinfo($_GET['f'], PATHINFO_EXTENSION);
if($ext == 'thm'){
include'moduls/tar.php';
$thm = new Archive_Tar($_GET['f']);
$content = $thm->extractInString('Theme.xml');
$teg = simplexml_load_string($content)->Standby_image['Source'] or simplexml_load_string($content)->Desktop_image['Source'];
$string = $thm->extractInString(trim($teg));
}
else{
include 'moduls/pclzip.lib.php';
$nth = new PclZip($_GET['f']);
$content = $nth->extract(PCLZIP_OPT_BY_NAME, 'theme_descriptor.xml', PCLZIP_OPT_EXTRACT_AS_STRING);
$teg = simplexml_load_string($content[0]['content'])->wallpaper['src'] or simplexml_load_string($content[0]['content'])->wallpaper['main_display_graphics'];
$string = $nth->extract(PCLZIP_OPT_BY_NAME, trim($teg), PCLZIP_OPT_EXTRACT_AS_STRING);
$string = $string[0]['content'];
}
$src = imagecreatefromstring($string);
$width = imagesx($src);
$height = imagesy($src);
$new_width = !empty($_GET['w']) && ctype_digit($_GET['w']) ? $_GET['w'] : $width;
$new_height = !empty($_GET['h']) && ctype_digit($_GET['h']) ? $_GET['h'] : $height;
$x = ceil(($new_width / $height) * $width);
$y = ceil(($new_height / $width) * $height);
if($width <= $new_width && $height <= $new_height){
$set_width = $width;
$set_height = $height;
}
elseif($x < $new_height){
$set_height = $x;
$set_width = $new_width;
}
else{
$set_width = $y;
$set_height = $new_height;
}
$img = imagecreatetruecolor(80, 95);
imagecopyresampled($img, $src, 0, 0, 0, 0, 80, 95, $width, $height);
header('Content-type: image/gif');
imagegif($img);
imagedestroy($src);
imagedestroy($img);
}
exit;
?>