Просмотр файла system/class/diz.php

Размер файла: 3.52Kb
<?php
/*
------------------------------
##############################
-       Загруз Центр         -
-         by Kemel           -
##############################
------------------------------
*/
defined('Loads') or die('Error!');
define('STYLE','two');
final class diz {
//Header
public function head($title = 'Музыкальный портал') {
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Content-Type: text/html; charset=UTF-8");
if (VERSION == 'web') {
include_once ROOT.'web/head.php';
} else {
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
echo "\n" . '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">';
echo "\n" . '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">';
echo "\n" . '<head>
<meta http-equiv="description" content="Музыкальный портал, бесплатная музыка, скачать"/>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8"/>';
echo "\n" . '<meta name="copyright" content="Kemel" />';
echo "\n" . '<link rel="shortcut icon" href="/styles/'.STYLE.'/images/favicon.png" />';
echo "\n" . '<title>'.$title.'</title>';
echo "\n" . '<link rel="stylesheet" href="/styles/'.STYLE.'/style.css" type="text/css" />';
echo "\n" . '</head><body>';
}
}
//Шапка)
public function title($title) {
if (VERSION == 'web') {
include_once ROOT.'web/title.php';
} else {
	echo '<div class="end">'.$title.'</div>';
}
}
public function line($msg) {
	echo '<div class="end">'.$msg.'</div>';
}
public function verh($msg) {
	echo '<div class="end">'.$msg.'</div>';
}
//Вывод
public function out($msg) {
if (VERSION == 'web') echo '<div id="page">'; else
	echo "\n<div class='main'>\n";
	echo $msg;
	echo "\n</div>\n";
	if (VERSION == 'web') {
include ROOT.'web/end.php';
} else {
	include_once ($_SERVER['DOCUMENT_ROOT'].'/system/end.php');
}
}
//Картинки
public function img($img) {
if (is_file($_SERVER['DOCUMENT_ROOT'].'/styles/'.STYLE.'/images/'.$img)) {
$img = '<img src="/styles/'.STYLE.'/images/'.$img.'" alt="img" />';
} else $img = '';
return $img;
}
//Подарки
public function normalgift($img) {
if (is_file($_SERVER['DOCUMENT_ROOT'].'/my/gifts/normal/'.$img)) {
$img = '<img src="/my/gifts/normal/'.$img.'" alt="img" />';
} else $img = '';
return $img;
}
public function smallgift($img) {
if (is_file($_SERVER['DOCUMENT_ROOT'].'/my/gifts/small/'.$img)) {
$img = '<img src="/my/gifts/small/'.$img.'" alt="img" />';
} else $img = '';
return $img;
}
public function scrin($name,$file,$dir,$width,$height) {
$quality = 80;
if ($dir == 'small') $razm = 64; else $razm = 96;
$x_ratio = $razm / $width;
$y_ratio = $razm / $height;
if (($width <= $razm) && ($height <= $razm)) {
                            $tn_width = $width;
                            $tn_height = $height;
} else
if (($x_ratio * $height) < $razm) {
$tn_height = ceil($x_ratio * $height);
$tn_width = $razm;
} else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $razm;
}
$im = ImageCreateFromGIF($file);
$im1 = imagecreatetruecolor($tn_width, $tn_height);
imagecopyresized($im1, $im, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
$imagnam = "my/gifts/$dir/$name";
ImageGif($im1, $imagnam, $quality);
imagedestroy($im);
imagedestroy($im1);
chmod($imagnam,0666);
return true;
}
}
?>