Файл: groups/handler/shop.upload.php
Строк: 28
<?php
if (!empty($_FILES))
{
require_once HOME.'/toolkit/AcImage.php';
function upload_photo($file) {
global $user_id, $id, $gid;
if(AcImage::isFileExists($_FILES[$file]['tmp_name'])) {} else {$err = lang('Файл не существует!','Файл не існує!');}
if($err == false && AcImage::isFileImage($_FILES[$file]['tmp_name']))
{
$file_name = time().'_'.rand(0000,9999).'.jpg';
AcImage::createImage($_FILES[$file]['tmp_name'])->saveAsJPG(HOME.'/files/shop/photos/'.$file_name);
//AcImage::setQuality(80);
//AcImage::createImage($_FILES[$file]['tmp_name'])->cropCenter('4pr', '4pr')->resizeByWidth(50)->saveAsJPG(HOME.'/files/photos/'.$user_id.'/icons/'.$file_name);
//AcImage::createImage($_FILES[$file]['tmp_name'])->cropCenter('4pr', '4pr')->resizeByWidth(150)->saveAsJPG(HOME.'/files/photos/'.$user_id.'/mini/'.$file_name);
//AcImage::createImage($_FILES[$file]['tmp_name'])->resizeByWidth(600)->resizeByHeight(600)->saveAsJPG(HOME.'/files/photos/'.$user_id.'/preview/'.$file_name);
//mysql_query("UPDATE `users` SET count_photos=count_photos+1 WHERE `id` = '".$user_id."'");
//mysql_query("UPDATE `photos_albums` SET count_photos=count_photos+1, `uptime` = '".time()."', `cover` = '".$file_name."' WHERE `id` = '".$id."'");
mysql_query("INSERT INTO `groups_shop_file` SET `url` = '".$file_name."', `user_id` = '".$user_id."', `time` = '".time()."', `fid` = '".$gid."'");
}
}
if (!empty($_FILES['file1'])) upload_photo('file1');
if (!empty($_FILES['file2'])) upload_photo('file2');
if (!empty($_FILES['file3'])) upload_photo('file3');
if ($ajax_query == true) exit;
else go(URL.'/groups/shop/view.php?id='.$id.'&gid='.$gid.'&r='.rand(0000,9999));
}
?>