/branches/ant/0.9.x/process.php |
---|
26,8 → 26,12 |
$DName = $secure->checkStr($_POST["dname"],1); |
$DUA = $secure->checkStr($_POST["dua"],1); |
$DType = $secure->checkInt($_POST["dtype"]); |
// TODO Обработка файла с логотипом дистрибутива |
$DLogo = 0; |
if ($_FILES["distlogo"]["type"]!=0) { |
$DLogo = $core->uploadPicture($picture, $DUA, $_FILES["distlogo"]); |
} |
$r = $core->addDistribution($DName, $DType, $DUA, $DLogo); |
if ($r["ERR"]==0) { |
header("Location: ".$manager."\n\n"); |
42,8 → 46,12 |
$DName = $secure->checkStr($_POST["dname"],1); |
$DUA = $secure->checkStr($_POST["dua"],1); |
$DType = $secure->checkInt($_POST["dtype"]); |
// TODO Обработка файла с логотипом дистрибутива |
$DLogo = 0; |
if ($_FILES["distlogo"]["type"]!=0) { |
$DLogo = $core->uploadPicture($picture, $DUA, $_FILES["distlogo"]); |
} |
$r = $core->updateDistribution($ID, $DName, $DType, $DUA, $DLogo); |
if ($r["ERR"]==0) { |
header("Location: ".$manager."\n\n"); |
/branches/ant/0.9.x/lib/core.php |
---|
905,6 → 905,44 |
return 0; |
} |
public function uploadPicture($path, $distributive, $datafile) { |
$sPath = $this->secure->checkStr($path, 1); |
$sDist = $this->secure->checkStr($distributive, 1); |
$folder = $sPath.$sDist."-orig.png"; |
$folderN = $sPath.$sDist.".png"; |
$folderEM = $sPath.$sDist."-em.png"; |
$distlogo = 0; |
if (move_uploaded_file($datafile["distlogo"]["tmp_name"],$folder)) { |
chmod($folder, 0644); |
list($width, $height) = GetImageSize($folder); |
$percent = 32/$height; |
$newwidth = $width * $percent; |
$newheight = $height * $percent; |
$output = ImageCreateTrueColor($newwidth, $newheight); |
$source = ImageCreateFromPNG($folder); |
ImageCopyResampled($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
ImagePNG($output, $folderEM); |
$percent = 15/$height; |
$newwidth = $width * $percent; |
$newheight = $height * $percent; |
$output = ImageCreateTrueColor($newwidth, $newheight); |
ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
ImagePNG($output, $folderN); |
unlink($folder); |
$distlogo = 1; |
} |
return $distlogo; |
} |
} |
?> |
/branches/ant/0.9.x/init.php |
---|
45,6 → 45,7 |
$webroot = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/"; |
$manager = "./manager.php"; |
$process = "./process.php"; |
$picture = ROOT."/img/d/"; |
$secure = new Security(); |
$core = new Core($db, PREFIX, $secure, $cookie); |