Вход Регистрация
Файл: mail/handler/upload.php
Строк: 34
<?php

if (!empty($_FILES['file']))
{

    if (
$arr_user['ban'] == 1) exit;

    
$arr_dialog mysql_fetch_array(mysql_query("SELECT * FROM `mail_dialog` WHERE `for_id` = '".$user_id."' AND `from_id` = '".$id."' LIMIT 1"));
    
    if (!
is_dir(HOME.'/files/mail/'.$arr_dialog['dir']))
    {
        
mkdir(HOME.'/files/mail/'.$arr_dialog['dir'],0777);
        
mkdir(HOME.'/files/mail/'.$arr_dialog['dir'].'/photos',0777);
        
mkdir(HOME.'/files/mail/'.$arr_dialog['dir'].'/photos/icons',0777);
        
mkdir(HOME.'/files/mail/'.$arr_dialog['dir'].'/photos/mini',0777);
        
mkdir(HOME.'/files/mail/'.$arr_dialog['dir'].'/photos/preview',0777);
    }
    
if (
$arr_dialog['count_cache'] < 10)
{
    require_once 
HOME.'/toolkit/AcImage.php';
    
AcImage::setTransparency(true);
    if(
AcImage::isFileExists($_FILES['file']['tmp_name'])) {} else {$err true;}
    if(
$err == false && AcImage::isFileImage($_FILES['file']['tmp_name']))
    {
        
$file_name time().'.jpg';
        
copy($_FILES['file']['tmp_name'], HOME.'/files/mail/'.$arr_dialog['dir'].'/photos/'.$file_name);
        
///
        
$savePath HOME.'/files/mail/'.$arr_dialog['dir'].'/photos/icons/'.$file_name;
        
$filePath HOME.'/files/mail/'.$arr_dialog['dir'].'/photos/'.$file_name;
        
$image AcImage::createImage($filePath);
        
$image
        
->cropCenter('4pr''4pr')
        ->
resizeByWidth(50)
        ->
save($savePath);
        
$savePath1 HOME.'/files/mail/'.$arr_dialog['dir'].'/photos/mini/'.$file_name;
        
$filePath1 HOME.'/files/mail/'.$arr_dialog['dir'].'/photos/'.$file_name;
        
$image1 AcImage::createImage($filePath1);
        
$image1
        
->cropCenter('4pr''4pr')
        ->
resizeByWidth(150)
        ->
save($savePath1);
        
$savePath2 HOME.'/files/mail/'.$arr_dialog['dir'].'/photos/preview/'.$file_name;
        
$filePath2 HOME.'/files/mail/'.$arr_dialog['dir'].'/photos/'.$file_name;
        
$image2 AcImage::createImage($filePath2);
        
$image2
        
->resizeByWidth(600)
        ->
resizeByHeight(400)
        ->
save($savePath2);
        
        
mysql_query("UPDATE `mail_dialog` SET `cache_photos` = '".$arr_dialog['cache_photos']."|".$file_name."|' , count_cache=count_cache+1 WHERE `for_id` = '".$user_id."' AND `from_id` = '".$id."' LIMIT 1");
        
        
$q explode("||"substr($arr_dialog['cache_photos'], 1, -1));
        if (
$ajax == 'yes') echo '<a id="'.(count($q)+1).'" class="del_cache" href="'.URL.'/mail/upload.php?id='.$id.'&del='.$file_name.'" onclick="FormContent.DelCache(this.id,this.href); return false"><img class="preview" src="'.URL.'/files/mail/'.$arr_dialog['dir'].'/photos/icons/'.$file_name.'"/>';
    }
}
if (
$ajax == 'yes') exit;
else 
go(URL.'/mail/upload.php?id='.$id);
}

?>
Онлайн: 0
Реклама