Example #1
0
function fileUpload($resourceType, $currentFolder)
{
    $sErrorNumber = '0';
    $sfileName = '';
    $c_upload = new cls_upload();
    $c_upload->current_dir = $currentFolder;
    $uploadfile = $c_upload->local_upload('Newfile', $resourceType);
    unset($c_upload);
    if ($uploadfile['error']) {
        $sErrorNumber = '202';
    } else {
        $sErrorNumber = '0';
        $sfileName = tag2atm($uploadfile['remote']);
    }
    echo '<script type="text/javascript">';
    echo 'window.parent.frames["frmUpload"].OnUploadCompleted(' . $sErrorNumber . ',"' . str_replace('"', '\\"', $sfileName) . '");';
    echo '</script>';
    mexit();
}
Example #2
0
function atm_size($value, $datatype, $mode = 0)
{
    //使用没有经过addslashes的值,以k为单位
    if (empty($value)) {
        return 0;
    }
    $size = 0;
    if (in_array($datatype, array('image', 'flash', 'media', 'file'))) {
        $temps = explode('#', $value);
        if ($url = tag2atm($temps[0])) {
            $size = islocal($url) ? filesize(local_file($url)) : rm_filesize($url);
        }
    } elseif (in_array($datatype, array('images', 'flashs', 'medias', 'files'))) {
        if ($temps = @unserialize($value)) {
            foreach ($temps as $v) {
                if ($url = tag2atm($v['remote'])) {
                    $size += isset($v['size']) ? $v['size'] : (islocal($url) ? filesize(local_file($url)) : rm_filesize($url));
                    if ($mode) {
                        break;
                    }
                }
            }
        }
    }
    unset($temps, $url);
    return intval($size / 1024);
}
Example #3
0
function view_atmurl($url = '')
{
    if (!$url) {
        return '';
    }
    return tag2atm($url);
}
Example #4
0
            foreach ($ret['remote'] as $v) {
                echo '|' . tag2atm($v);
            }
        } else {
            echo $ret['error'];
        }
    } elseif ($fn) {
        $ret = $up->local_upload('upload', $lfile);
        empty($ret['error']) && ($ret['error'] = 0);
        $ret['error'] || $up->closure();
        fckEditor($fn, $ret['error'], $ret['error'] ? '' : tag2atm($ret['remote']));
    } else {
        $ret = $up->local_upload('Filedata', $lfile);
        if (empty($ret['error'])) {
            $up->closure();
            echo '0|' . tag2atm($ret['remote']);
        } else {
            echo $ret['error'];
        }
    }
    if (empty($ret['error'])) {
        $up->saveuptotal(1);
    }
} else {
    load_cache('localfiles');
    $tmp = array_key_exists($lfile, $localfiles) ? $localfiles[$lfile] : array();
    $otype = '';
    foreach ($tmp as $v) {
        if ($v['islocal']) {
            $otype .= ",\"{$v['extname']}\":[{$v['minisize']},{$v['maxsize']}]";
        }
Example #5
0
 function thumb_pick($string, $datatype = 'htmltext', $rpid = 0)
 {
     //只处理已经stripslashes的文本。
     if (!$string) {
         return '';
     }
     $thumb = '';
     if (in_array($datatype, array('text', 'multitext', 'htmltext'))) {
         if (preg_match("/src\\s*=\\s*([\"']?)(.{1,100}?)(gif|jpg|jpeg|bmp|png)\\1/is", $string, $matches)) {
             $thumb = $matches[2] . $matches[3];
             $thumb = tag2atm($thumb);
             if (!islocal($thumb, 1) && $rpid) {
                 $filearr = $this->remote_upload($thumb, $rpid);
                 $thumb = $filearr['remote'];
             }
             if (isset($filearr['width'])) {
                 $thumb .= '#' . $filearr['width'] . '#' . $filearr['height'];
             } elseif ($infos = @getimagesize(local_file($thumb))) {
                 $thumb .= '#' . $infos[0] . '#' . $infos[1];
             }
         }
     } elseif ($datatype == 'images') {
         $images = @unserialize($string);
         if (is_array($images)) {
             $image = $images[min(array_keys($images))];
             $image['remote'] = tag2atm($image['remote']);
             if (!islocal($image['remote'], 1) && $rpid) {
                 $image = $this->remote_upload($image['remote'], $rpid);
             }
             $thumb = $image['remote'];
             isset($image['width']) && ($thumb .= '#' . $image['width'] . '#' . $image['height']);
         }
     } elseif ($datatype == 'image') {
         $image = array_filter(explode('#', $string));
         $image[0] = tag2atm($image[0]);
         if (!islocal($image[0], 1) && $rpid) {
             $filearr = $this->remote_upload($image[0], $rpid);
             $image[0] = $filearr['remote'];
             if (isset($filearr['width'])) {
                 $image[1] = $filearr['width'];
                 $image[2] = $filearr['height'];
             }
         }
         $thumb = $image[0];
         isset($image[1]) && ($thumb .= '#' . $image[1] . '#' . $image[2]);
     }
     return save_atmurl($thumb);
 }
Example #6
0
<?php

@set_time_limit(0);
include_once dirname(__FILE__) . "./../general.inc.php";
include_once M_ROOT . "./include/upload.cls.php";
$c_upload = new cls_upload();
$uploadfile = $c_upload->local_upload('Newfile', $_GET['type']);
unset($c_upload);
if ($uploadfile['error']) {
    SendResults('202');
} else {
    $sErrorNumber = '0';
    SendResults('0', tag2atm($uploadfile['remote']));
}
function SendResults($errorNumber, $fileUrl = '', $fileName = '', $customMsg = '')
{
    echo '<script type="text/javascript">';
    echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . str_replace('"', '\\"', $fileUrl) . '","' . str_replace('"', '\\"', $fileName) . '","' . str_replace('"', '\\"', $customMsg) . '");';
    echo '</script>';
    mexit();
}