Пример #1
0
                     if ($DT['water_type'] == 2) {
                         $image->waterimage();
                     } else {
                         if ($DT['water_type'] == 1) {
                             $image->watertext();
                         }
                     }
                 }
             }
         }
     }
 }
 $saveto = linkurl($do->saveto);
 if ($DT['ftp_remote'] && $DT['remote_url']) {
     require DT_ROOT . '/include/ftp.class.php';
     $ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
     if ($ftp->connected) {
         $exp = explode("file/upload/", $saveto);
         $remote = $exp[1];
         if ($ftp->dftp_put($do->saveto, $remote)) {
             $saveto = $DT['remote_url'] . $remote;
             file_del(DT_ROOT . '/' . $do->saveto);
             if (strpos($do->saveto, '.thumb.') !== false) {
                 $local = str_replace('.thumb.' . $do->ext, '', $do->saveto);
                 $remote = str_replace('.thumb.' . $do->ext, '', $exp[1]);
                 $ftp->dftp_put($local, $remote);
                 file_del(DT_ROOT . '/' . $local);
                 $local = str_replace('.thumb.' . $do->ext, '.middle.' . $do->ext, $do->saveto);
                 $remote = str_replace('.thumb.' . $do->ext, '.middle.' . $do->ext, $exp[1]);
                 $ftp->dftp_put($local, $remote);
                 file_del(DT_ROOT . '/' . $local);
Пример #2
0
<?php

/*
	[Destoon B2B System] Copyright (c) 2008-2013 Destoon.COM
	This is NOT a freeware, use is subject to license.txt
*/
defined('IN_DESTOON') or exit('Access Denied');
if ($action == 'ftp') {
    require DT_ROOT . '/include/ftp.class.php';
    if (strpos($ftp_pass, '***') !== false) {
        $ftp_pass = $DT['ftp_pass'];
    }
    $ftp = new dftp($ftp_host, $ftp_user, $ftp_pass, $ftp_port, $ftp_path, $ftp_pasv, $ftp_ssl);
    if (!$ftp->connected) {
        dialog('FTP无法连接,请检查设置');
    }
    if (!$ftp->dftp_chdir()) {
        dialog('FTP无法进入远程存储目录,请检查远程存储目录');
    }
    dialog('FTP设置正常,可以使用');
} else {
    if ($action == 'mail') {
        define('TESTMAIL', true);
        if (strpos($smtp_pass, '***') !== false) {
            $smtp_pass = $DT['smtp_pass'];
        }
        $DT['mail_type'] = $mail_type;
        $DT['smtp_host'] = $smtp_host;
        $DT['smtp_port'] = $smtp_port;
        $DT['smtp_auth'] = $smtp_auth;
        $DT['smtp_user'] = $smtp_user;
Пример #3
0
$w2 = $s2[0];
$h2 = $s2[1];
$s3 = getimagesize($img[3]);
$w3 = $s3[0];
$h3 = $s3[1];
if ($s1 && $s2 && $s3 && $w1 == 128 && $h1 == 128 && $w2 == 48 && $h2 == 48 && $w3 == 20 && $h3 == 20) {
    $md5 = md5($user['username']);
    $dir = DT_ROOT . '/file/avatar/' . substr($md5, 0, 2) . '/' . substr($md5, 2, 2) . '/_' . $user['username'];
    $img[4] = $dir . '.jpg';
    $img[5] = $dir . 'x48.jpg';
    $img[6] = $dir . 'x20.jpg';
    file_put($img[4], base64_decode($pic1));
    file_put($img[5], base64_decode($pic2));
    file_put($img[6], base64_decode($pic3));
    if ($DT['ftp_remote'] && $DT['remote_url']) {
        require DT_ROOT . '/include/ftp.class.php';
        $ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
        if ($ftp->connected) {
            foreach ($img as $i) {
                $t = explode("/file/", $i);
                $ftp->dftp_put('file/' . $t[1], $t[1]);
            }
        }
    }
    echo '{"status":1}';
} else {
    file_del($img[1]);
    file_del($img[2]);
    file_del($img[3]);
    exit('{"status":3}');
}
Пример #4
0
        break;
    case 'delete':
        if ($avatar) {
            $img = array();
            $img[1] = useravatar($_userid, 'large', 0, 2);
            $img[2] = useravatar($_userid, '', 0, 2);
            $img[3] = useravatar($_userid, 'small', 0, 2);
            $img[4] = useravatar($_username, 'large', 1, 2);
            $img[5] = useravatar($_username, '', 1, 2);
            $img[6] = useravatar($_username, 'small', 1, 2);
            foreach ($img as $i) {
                file_del($i);
            }
            if ($DT['ftp_remote'] && $DT['remote_url']) {
                require DT_ROOT . '/include/ftp.class.php';
                $ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
                if ($ftp->connected) {
                    foreach ($img as $i) {
                        $t = explode("/file/", $i);
                        $ftp->dftp_delete($t[1]);
                    }
                }
            }
        }
        $db->query("UPDATE {$DT_PRE}member SET avatar=0 WHERE userid={$_userid}");
        dmsg($L['avatar_delete'], 'avatar.php?itemid=' . $DT_TIME);
        break;
    default:
        $head_title = $L['avatar_title'];
        break;
}
Пример #5
0
function delete_upload($file, $userid)
{
    global $CFG, $DT, $DT_TIME, $ftp, $db;
    if (!defined('DT_ADMIN') && (!$userid || $userid != match_userid($file))) {
        return false;
    }
    $fileurl = $file;
    if (strpos($file, 'file/upload') === false) {
        //Remote
        if ($DT['ftp_remote'] && $DT['remote_url']) {
            if (strpos($file, $DT['remote_url']) !== false) {
                if (!is_object($ftp)) {
                    require_once DT_ROOT . '/include/ftp.class.php';
                    $ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
                }
                $file = str_replace($DT['remote_url'], '', $file);
                $ftp->dftp_delete($file);
                if (strpos($file, '.thumb.') !== false) {
                    $ext = file_ext($file);
                    $F = str_replace('.thumb.' . $ext, '', $file);
                    $ftp->dftp_delete($F);
                    $F = str_replace('.thumb.' . $ext, '.middle.' . $ext, $file);
                    $ftp->dftp_delete($F);
                }
            }
        }
    } else {
        $exp = explode("file/upload/", $file);
        $file = DT_ROOT . '/file/upload/' . $exp[1];
        if (is_file($file) && strpos($exp[1], '..') === false) {
            file_del($file);
            if (strpos($file, '.thumb.') !== false) {
                $ext = file_ext($file);
                file_del(str_replace('.thumb.' . $ext, '', $file));
                file_del(str_replace('.thumb.' . $ext, '.middle.' . $ext, $file));
            }
        }
    }
    if ($DT['uploadlog']) {
        $db->query("DELETE FROM {$db->pre}upload_" . $userid % 10 . " WHERE item='" . md5($fileurl) . "'");
    }
}