HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/bs.kntsleep.com/system/web/common/js/member/publish.js
$(document).ready(function(){
    $('select[name="items"]').change(function(){
        window.location.href = '{items.folder|url::member='publish'}&itemsid='+$(this).val();
    });

    $.get('../system/extend/ueditor/php/controller.php?web=true&action=config',function(cfg){
        hq = [];
        hq['image'] = cfg['imageAllowFiles'].join(','),
        hq['video'] = cfg['videoAllowFiles'].join(','),
        hq['file'] = cfg['fileAllowFiles'].join(','),
        sc = '<a><i>+</i><b>上传文件</b><u>点击或拖动文件至此处</u></a>',
        ws = ['image','video','file','images'],
        pl = function(src){
            return String(src).replace(/(\.\.\/)+upload\//g,'\.\.\/\/upload\/');
        }
        for(k in ws){
            $('textarea['+ws[k]+']').each(function(){
                h = '<div upfile="'+ws[k]+'"><ul>';
                if(vl = $(this).val()){
                    switch(ws[k]){
                        case 'image':
                            h += '<li><ins>+</ins><img src="'+vl+'" /></li>';
                            break;
                        case 'video':
                        case 'file':
                            if(type = vl.match(/member\/\d+\/(\w+)\//)){
                                type = type[1];
                            }else{
                                type = 'file';
                            }
                            h += '<li><ins>+</ins><span class="'+type+'"></span></li>';
                            break;
                        case 'images':
                            if(vl.match(/^\[.+\]$/)){
                                jv = JSON.parse(vl);
                                for(v in jv){
                                    h += '<li path="'+pl(jv[v]).replace(/"/g,'&quot;')+'"><ins>+</ins><img src="'+jv[v]+'" /></li>';
                                }
                            }
                            h += '<li>'+sc+'<input type="file" multiple accept="'+hq['image']+'"></li>';
                            break;
                    }
                }else{
                    h += '<li>'+sc+'<input type="file" '+(ws[k]=='images'?'multiple':'')+' accept="'+hq[ws[k].replace(/s$/,'')]+'"></li>';
                }
                h += '</ul>'+pl($(this)[0].outerHTML)+'</div>';
                $(this).before(h);
                $(this).remove();
            });
        }
        $(document)
        .on('change','div[upfile]>ul>li>input[type="file"]',function(e){
            var files = e.target.files,
                the = $(this);
                upfile = the.parents('div[upfile]');
                for(f in files){
                    if(typeof(files[f])=='object'){
                        formData = new FormData();
                        formData.append("upfile", files[f]);
                        $.ajax({
                            url: $G['relative']+"system/extend/ueditor/php/controller.php?web=true&action=upload"+upfile.attr('upfile').replace(/s$/,'')+"&referer="+encodeURIComponent(window.location.href),
                            type: 'POST',
                            cache: false,
                            data: formData,
                            processData: false,
                            contentType: false,
                            dataType: "json",
                            success: function(data) {
                                if(data.state == 'SUCCESS'){
                                    switch(upfile.attr('upfile')){
                                        case 'image':
                                        case 'video':
                                        case 'file':
                                            type = data.url.match(/member\/\d+\/(\w+)\//)[1];
                                            upfile.find('ul').html('<li><ins>+</ins>'+(type=='photo'?'<img src="'+data.url+'" />':'<span class="'+type+'"></span>')+'</li>');
                                            upfile.find('textarea').html(pl(data.url));
                                            break;
                                        case 'images':
                                            upfile.find('li').last().before('<li path="'+pl(data.url).replace(/"/g,'&quot;')+'"><ins>+</ins><img src="'+data.url+'" /></li>');
                                            val = [];
                                            upfile.find('li[path]').each(function(){
                                                val.push($(this).attr('path'));
                                            });
                                            upfile.find('textarea').html(JSON.stringify(val).replace('[]',''));
                                            break;
                                    }
                                }else{
                                    _alert(data.state);
                                }
                            }
                        });
                    }
                }
        })
        .on('click','div[upfile]>ul>li>ins',function(){
            upfile = $(this).parents('div[upfile]');
            switch(uptype = upfile.attr('upfile')){
                case 'image':
                case 'video':
                case 'file':
                    upfile.find('ul').html('<li>'+sc+'<input type="file" accept="'+hq[uptype]+'"></li>');
                    upfile.find('textarea').html('');
                    break;
                case 'images':
                    $(this).parent('li').remove();
                    val = [];
                    upfile.find('li[path]').each(function(){
                        val.push($(this).attr('path'));
                    });
                    upfile.find('textarea').html(JSON.stringify(val).replace('[]',''));
                    break;
            }
        });    
    },'json');
});
function ueditor_init(){
    if(typeof(UE) != 'undefined'){
        $('textarea[ueditor]').each(function(i,e){
            $(this).attr('id','ueditor'+i);
            UE.getEditor('ueditor'+i,{
                initialFrameHeight: 400,
                initialFrameWidth: '100%'
            });
        });
    }else{
        window.setTimeout(function(){
            ueditor_init();
        },100);
    }
} 
ueditor_init();