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

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

if (
mysql_result(mysql_query("SELECT COUNT(`id`) FROM `wall_cache` WHERE `user_id` = '".$user_id."' LIMIT 1"),0) == falsemysql_query("INSERT INTO `wall_cache` SET `user_id` = '".$user_id."'");

$arr_wall_cache mysql_fetch_array(mysql_query("SELECT * FROM `wall_cache` WHERE `user_id` = '".$user_id."' LIMIT 1"));
    
    if (!
is_dir(HOME.'/files/wall/'.$user_id))
    {
        
mkdir(HOME.'/files/wall/'.$user_id,0777);
        
mkdir(HOME.'/files/wall/'.$user_id.'/photos',0777);
        
mkdir(HOME.'/files/wall/'.$user_id.'/photos/icons',0777);
        
mkdir(HOME.'/files/wall/'.$user_id.'/photos/mini',0777);
        
mkdir(HOME.'/files/wall/'.$user_id.'/photos/preview',0777);
    }
    
    
if (
$arr_wall_cache['count_photos'] < 10)
{
    require_once 
HOME.'/toolkit/AcImage.php';
    if(
AcImage::isFileExists($_FILES['file']['tmp_name'])) {} else {$err true;}
    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/wall/'.$user_id.'/photos/'.$file_name);
        
AcImage::setQuality(80);
        
AcImage::createImage($_FILES['file']['tmp_name'])->cropCenter('4pr''4pr')->resizeByWidth(50)->saveAsJPG(HOME.'/files/wall/'.$user_id.'/photos/icons/'.$file_name);
        
AcImage::createImage($_FILES['file']['tmp_name'])->cropCenter('4pr''4pr')->resizeByWidth(150)->saveAsJPG(HOME.'/files/wall/'.$user_id.'/photos/mini/'.$file_name);
        
AcImage::createImage($_FILES['file']['tmp_name'])->resizeByWidth(600)->resizeByHeight(600)->saveAsJPG(HOME.'/files/wall/'.$user_id.'/photos/preview/'.$file_name);
        
        
mysql_query("UPDATE `wall_cache` SET `photos` = '".$arr_wall_cache['photos']."|".$file_name."|' , count_photos=count_photos+1 WHERE `user_id` = '".$user_id."' LIMIT 1");
        
        
$q explode("||"substr($arr_wall_cache['photos'], 1, -1));
        if (
$ajax == 'yes') echo '<a id="'.time().'" class="del_cache" href="'.URL.'/groups/wall/upload.php?del_photo='.$file_name.'&from='.$from.'" onclick="FormContent.DelCache(this.id,this.href); return false"><img class="preview_icons" src="'.URL.'/files/wall/'.$user_id.'/photos/icons/'.$file_name.'"/>';
    }
}
if (
$ajax == 'yes') exit;
else 
go(URL.'/groups/wall/upload.php?from='.$from.($_GET['target']=='group_forum'?'&target=group_forum':''));
}

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