Файл: us_guest/inc/act.images.php
Строк: 74
<?
@ob_clean();
$name = htmlspecialchars($_GET['name']);
$id = preg_replace('|.[^.]*$|', NULL, $name); // имя файла без расширения
$zip_images = H."us_guest/inc/zip_images.zip";
if (is_numeric($id) && is_file(H."us_guest/files/$id.dat")) {
$zip = new ZipArchive;
$zip -> open(H."us_guest/files/$id.dat");
$content = $zip -> getFromName("META-INF/MANIFEST.MF");
if (!$content) {
$content = $zip -> getFromName("META-INF/manifest.mf");
}
// достаем иконку из манифеста
// by Killer
// RegExp рулят!
$icon = false;
if (preg_match("#MIDlet-Icon:[s]*(.*)([n|r]*?)#", $content, $icon_pre)) {
$icon = $icon_pre[1];
} elseif (preg_match("#MIDlet-1:[s]*(.*),[s]*(.*),[s]*(.*)([n|r]*?)#", $content, $icon_pre)) {
$icon = $icon_pre[2];
}
$icon = preg_replace("#^([s]{1,}|[/]{1,})|([/]{1,}|[s]{1,})$#", null, $icon); // убираем слеши и пробелы в начале и конце названия иконки
if ($icon) {
$content = $zip -> getFromName($icon);
header("Content-type: image/png");
echo $content;
exit();
} else {
$zip -> open($zip_images);
$content = $zip -> getFromName('jar.png');
header("Content-type: image/png");
echo $content;
exit();
}
} else {
$zip = new ZipArchive;
$zip -> open($zip_images);
$content = $zip -> getFromName($name);
if ($content) {
header("Content-type: image/png");
echo $content;
exit();
} else {
$content = $zip -> getFromName('unknown_file.png');
header("Content-type: image/png");
echo $content;
exit();
}
}
?>