示例#1
0
 static function toUTF8($filesystemElement, $test = true)
 {
     if ($test && ext_TextEncoding::isUtf8($filesystemElement)) {
         return $filesystemElement;
     }
     $enc = ext_TextEncoding::getEncoding();
     return ext_TextEncoding::changeCharset($enc, "UTF-8", $filesystemElement);
 }
示例#2
0
文件: edit.php 项目: A-Bush/pprod
    function execAction($dir, $item)
    {
        // edit file
        global $mainframe, $mosConfig_live_site;
        if (($GLOBALS["permissions"] & 01) != 01) {
            ext_Result::sendResult('edit', false, ext_Lang::err('accessfunc'));
        }
        $fname = ext_TextEncoding::fromUTF8(get_abs_item($dir, $item));
        if (!get_is_file($fname)) {
            ext_Result::sendResult('edit', false, ext_TextEncoding::toUTF8($item) . ": " . ext_Lang::err('fileexist'));
        }
        if (!get_show_item($dir, $item)) {
            ext_Result::sendResult('edit', false, $item . ": " . ext_Lang::err('accessfile'));
        }
        if (isset($GLOBALS['__POST']["dosave"]) && $GLOBALS['__POST']["dosave"] == "yes") {
            // Save / Save As
            $item = basename(stripslashes($GLOBALS['__POST']["fname"]));
            $fname2 = ext_TextEncoding::fromUTF8(get_abs_item($dir, $item));
            if (!isset($item) || $item == "") {
                ext_Result::sendResult('edit', false, ext_Lang::err('miscnoname'));
            }
            if ($fname != $fname2 && @$GLOBALS['ext_File']->file_exists($fname2)) {
                ext_Result::sendResult('edit', false, $item . ": " . ext_Lang::err('itemdoesexist'));
            }
            $this->savefile($fname2);
            $fname = $fname2;
            ext_Result::sendResult('edit', true, ext_Lang::msg('savefile') . ': ' . $item);
        }
        if (isset($GLOBALS['__POST']["doreopen"]) && $GLOBALS['__POST']["doreopen"] == "yes") {
            // File Reopen
            $extra = array();
            $content = $GLOBALS['ext_File']->file_get_contents($fname);
            if (get_magic_quotes_runtime()) {
                $content = stripslashes($content);
            }
            $langs = $GLOBALS["language"];
            if ($langs == "japanese") {
                $_encoding = $GLOBALS['__POST']["file_encoding"];
                if ($content) {
                    $content = mb_convert_encoding($content, "UTF-8", $_encoding);
                }
                $extra["file_encoding"] = $_encoding;
            }
            $extra["content"] = $content;
            ext_Result::sendResult('edit', true, ext_Lang::msg('reopenfile') . ': ' . $item, $extra);
        }
        // header
        $s_item = get_rel_item($dir, $item);
        if (strlen($s_item) > 50) {
            $s_item = "..." . substr($s_item, -47);
        }
        $id_hash = substr('f' . md5($s_item), 0, 10);
        $s_info = pathinfo($s_item);
        $s_extension = str_replace('.', '', $s_info['extension']);
        switch (strtolower($s_extension)) {
            case 'txt':
                $cp_lang = 'text';
                break;
            case 'cs':
                $cp_lang = 'csharp';
                break;
            case 'css':
                $cp_lang = 'css';
                break;
            case 'html':
            case 'htm':
            case 'xhtml':
                $cp_lang = 'html';
                break;
            case 'java':
                $cp_lang = 'java';
                break;
            case 'js':
                $cp_lang = 'js';
                break;
            case 'pl':
                $cp_lang = 'perl';
                break;
            case 'py':
                $cp_lang = 'python';
                break;
            case 'ruby':
                $cp_lang = 'ruby';
                break;
            case 'sql':
                $cp_lang = 'sql';
                break;
            case 'vb':
            case 'vbs':
                $cp_lang = 'vb';
                break;
            case 'php':
                $cp_lang = 'php';
                break;
            case 'xml':
                $cp_lang = 'xml';
                break;
            default:
                $cp_lang = '';
        }
        $content = $GLOBALS['ext_File']->file_get_contents($fname);
        if (get_magic_quotes_runtime()) {
            $content = stripslashes($content);
        }
        $cw = 250;
        $langs = $GLOBALS["language"];
        if ($langs == "japanese") {
            $cw = 200;
            if ($content) {
                $_encoding = strtoupper(mb_detect_encoding($content, array("ASCII", "ISO-2022-JP", "UTF-8", "EUCJP-WIN", "SJIS-WIN"), true));
                $content = mb_convert_encoding($content, "UTF-8", $_encoding);
                if ($_encoding == "SJIS-WIN") {
                    $_encoding_label = "SJIS";
                } elseif ($_encoding == "EUCJP-WIN") {
                    $_encoding_label = "EUC-JP";
                } elseif ($_encoding == "ISO-2022-JP") {
                    $_encoding_label = "JIS";
                } elseif ($_encoding == "ASCII") {
                    $_encoding_label = "UTF-8";
                } else {
                    $_encoding_label = $_encoding;
                }
            } else {
                $_encoding_label = "UTF-8";
            }
        }
        ?>
{
	"xtype": "form",
	"id": "<?php 
        echo $id_hash;
        ?>
",
	"labelWidth": "300",
	"autoScroll": "true", 
	"url":"<?php 
        echo basename($GLOBALS['script_name']);
        ?>
",
	"title": "<?php 
        echo strlen($s_item) > 50 ? substr($s_item, strlen($s_item) - 30, 30) : $s_item;
        ?>
",
	"frame": "true",
	"closable": "true",
	"tbar": [{
 		"text": "<?php 
        echo ext_Lang::msg('btnsave', true);
        ?>
", 
		"handler": function() {
			statusBarMessage( '<?php 
        echo ext_Lang::msg('save_processing', true);
        ?>
', true );
			form = Ext.getCmp("<?php 
        echo $id_hash;
        ?>
").getForm();
			form.submit({
				waitMsg: 'Saving the File, please wait...',
				reset: false,
				success: function(form, action) {
					datastore.reload();
					statusBarMessage( action.result.message, false, true );
				},
				failure: function(form, action) {
					statusBarMessage( action.result.error, false, false );
					Ext.Msg.alert('<?php 
        echo ext_Lang::err('error', true);
        ?>
!', action.result.error);
				},
				scope: form,
				// add some vars to the request, similar to hidden fields
				params: {option: 'com_extplorer', 
						action: 'edit', 
						code: editAreaLoader.getValue("ext_codefield<?php 
        echo $id_hash;
        ?>
"),
						dir: '<?php 
        echo stripslashes($dir);
        ?>
', 
						item: '<?php 
        echo stripslashes($item);
        ?>
', 
						dosave: 'yes'
				}
			});
		},
        "cls":"x-btn-text-icon",
        "icon": "<?php 
        echo _EXT_URL;
        ?>
/images/_save.png"
    },{
		"text": "<?php 
        echo ext_Lang::msg('btnreopen', true);
        ?>
", 
		"handler": function() { 
			statusBarMessage( '<?php 
        echo ext_Lang::msg('reopen_processing', true);
        ?>
', true );
			form = Ext.getCmp("<?php 
        echo $id_hash;
        ?>
").getForm();
			form.submit({
				waitMsg: 'Processing Data, please wait...',
				reset: false,
				success: function(form, action) {
					statusBarMessage( action.result.message, false, true );
					editAreaLoader.setValue("ext_codefield<?php 
        echo $id_hash;
        ?>
", action.result.content);
				},
				failure: function(form, action) {
					statusBarMessage( action.result.error, false, false );
					Ext.Msg.alert('<?php 
        echo ext_Lang::err('error', true);
        ?>
!', action.result.error);
				},
				scope: form,
				// add some vars to the request, similar to hidden fields
				params: {
					option: 'com_extplorer', 
					action: 'edit', 
					dir: '<?php 
        echo stripslashes($dir);
        ?>
', 
					item: '<?php 
        echo stripslashes($item);
        ?>
', 
					doreopen: 'yes'
				}
			});
		},	
        "cls":"x-btn-text-icon",
        "icon": "<?php 
        echo _EXT_URL;
        ?>
/images/_reload.png"
    },
    {
    	"text": "<?php 
        echo ext_Lang::msg('btncancel', true);
        ?>
", 
		"handler": function() { 
			Ext.getCmp("mainpanel").remove( Ext.getCmp("mainpanel").getActiveTab() );
		},
        "cls":"x-btn-text-icon",
        "icon": "<?php 
        echo _EXT_URL;
        ?>
/images/_cancel.png"
	}],	
	"items": [{
		"xtype": "displayfield",
		"value": "<?php 
        echo $GLOBALS["messages"]["actedit"] . ": {$s_item}";
        ?>
"
		},
		{
		"xtype": "textarea",
		"hideLabel": true,
		"name": "thecode",
		"id": "ext_codefield<?php 
        echo $id_hash;
        ?>
",
		"fieldClass": "x-form-field",
		"value": "<?php 
        echo str_replace(array("\r", "\n"), array('\\r', '\\n'), addslashes($content));
        ?>
",
		"width": "100%",
		"height": 500,
		"plugins": new Ext.ux.plugins.EditAreaEditor({
			"id" : "ext_codefield<?php 
        echo $id_hash;
        ?>
",	
			"syntax": "<?php 
        echo $cp_lang;
        ?>
",
			"start_highlight": true,
			"display": "later",
			"toolbar": "search, go_to_line, |, undo, redo, |, select_font,|, change_smooth_selection, highlight, reset_highlight, |, help" 
			<?php 
        if (array_key_exists($langs, $this->lang_tbl)) {
            ?>
				,"language": "<?php 
            echo $this->lang_tbl[$langs];
            ?>
"
				<?php 
        }
        ?>
		})
	},
	{
		
			"width": "<?php 
        echo $cw;
        ?>
", 
			"xtype": "textfield",
			"fieldLabel": "<?php 
        echo ext_Lang::msg('copyfile', true);
        ?>
",
			"name": "fname",
			"value": "<?php 
        echo $item;
        ?>
",
			"clear": "true"
			}
<?php 
        if ($langs == "japanese") {
            ?>
			,{
			 "width": "<?php 
            echo $cw;
            ?>
",  
			 "style":"margin-left:10px", 
			 "clear":"true",
			"xtype": "combo",
			"fieldLabel": "<?php 
            echo ext_Lang::msg('fileencoding', true);
            ?>
",
			"name": "file_encoding",
			"store": [
						["UTF-8", "UTF-8"],
						["SJIS-WIN", "SJIS"],
						["EUCJP-WIN", "EUC-JP"],
						["ISO-2022-JP","JIS"]
					],
			"value" : "<?php 
            echo $_encoding_label;
            ?>
",
			"typeAhead": "true",
			"mode": "local",
			"triggerAction": "all",
			"editable": "false",
			"forceSelection": "true"
			}
	
<?php 
        }
        ?>
		]

}
	
<?php 
    }
示例#3
0
文件: list.php 项目: kostya1017/our
/**
 * This function assembles an array (list) of files or directories in the directory specified by $dir
 * The result array is send using JSON
 *
 * @param string $dir
 * @param string $sendWhat Can be "files" or "dirs"
 */
function send_dircontents($dir, $sendWhat = 'files')
{
    // print table of files
    global $dir_up, $mainframe;
    // make file & dir tables, & get total filesize & number of items
    get_dircontents($dir, $dir_list, $file_list, $tot_file_size, $num_items);
    if ($sendWhat == 'files') {
        $list = $file_list;
    } elseif ($sendWhat == 'dirs') {
        $list = $dir_list;
    } else {
        $list = make_list($dir_list, $file_list);
    }
    $i = 0;
    $items['totalCount'] = count($list);
    $items['items'] = array();
    $dirlist = array();
    if ($sendWhat != 'dirs') {
        // Replaced array_splice, because it resets numeric indexes (like files or dirs with a numeric name)
        // Here we reduce the list to the range of $limit beginning at $start
        $a = 0;
        $output_array = array();
        foreach ($list as $key => $value) {
            if ($a >= $GLOBALS['start'] && $a - $GLOBALS['start'] < $GLOBALS['limit']) {
                $output_array[$key] = $value;
            }
            $a++;
        }
        $list = $output_array;
    }
    while (list($item, $info) = each($list)) {
        // link to dir / file
        if (is_array($info)) {
            $abs_item = $info;
            if (extension_loaded('posix')) {
                $user_info = posix_getpwnam($info['user']);
                $file_info['uid'] = $user_info['uid'];
                $file_info['gid'] = $user_info['gid'];
            }
        } else {
            $abs_item = get_abs_item(ext_TextEncoding::fromUTF8($dir), $item);
            $file_info = @stat($abs_item);
        }
        $is_dir = get_is_dir($abs_item);
        if ($GLOBALS['use_mb']) {
            if (ext_isFTPMode()) {
                $items['items'][$i]['name'] = $item;
            } else {
                if (mb_detect_encoding($item) == 'ASCII') {
                    $items['items'][$i]['name'] = ext_TextEncoding::toUTF8($item);
                } else {
                    $items['items'][$i]['name'] = ext_TextEncoding::toUTF8($item);
                }
            }
        } else {
            $items['items'][$i]['name'] = ext_isFTPMode() ? $item : ext_TextEncoding::toUTF8($item);
        }
        $items['items'][$i]['is_file'] = get_is_file($abs_item);
        $items['items'][$i]['is_archive'] = ext_isArchive($item) && !ext_isFTPMode();
        $items['items'][$i]['is_writable'] = $is_writable = @$GLOBALS['ext_File']->is_writable($abs_item);
        $items['items'][$i]['is_chmodable'] = $is_chmodable = @$GLOBALS['ext_File']->is_chmodable($abs_item);
        $items['items'][$i]['is_readable'] = $is_readable = @$GLOBALS['ext_File']->is_readable($abs_item);
        $items['items'][$i]['is_deletable'] = $is_deletable = @$GLOBALS['ext_File']->is_deletable($abs_item);
        $items['items'][$i]['is_editable'] = get_is_editable($abs_item);
        $items['items'][$i]['icon'] = _EXT_URL . "/images/" . get_mime_type($abs_item, "img");
        $items['items'][$i]['size'] = parse_file_size(get_file_size($abs_item));
        // type
        $items['items'][$i]['type'] = get_mime_type($abs_item, "type");
        // modified
        $items['items'][$i]['modified'] = parse_file_date(get_file_date($abs_item));
        // permissions
        $perms = get_file_perms($abs_item);
        if ($perms) {
            if (strlen($perms) > 3) {
                $perms = substr($perms, 2);
            }
            $items['items'][$i]['perms'] = $perms . ' (' . parse_file_perms($perms) . ')';
        } else {
            $items['items'][$i]['perms'] = ' (unknown) ';
        }
        $items['items'][$i]['perms'] = $perms . ' (' . parse_file_perms($perms) . ')';
        if (extension_loaded("posix")) {
            if ($file_info["uid"]) {
                $user_info = posix_getpwuid($file_info["uid"]);
                //$group_info = posix_getgrgid($file_info["gid"]);
                $items['items'][$i]['owner'] = $user_info["name"] . " (" . $file_info["uid"] . ")";
            } else {
                $items['items'][$i]['owner'] = " (unknown) ";
            }
        } else {
            $items['items'][$i]['owner'] = 'n/a';
        }
        if ($is_dir && $sendWhat != 'files') {
            $id = str_replace('/', $GLOBALS['separator'], $dir) . $GLOBALS['separator'] . $item;
            $id = str_replace($GLOBALS['separator'], '_RRR_', $id);
            $qtip = "<strong>" . ext_Lang::mime('dir', true) . "</strong><br /><strong>" . ext_Lang::msg('miscperms', true) . ":</strong> " . $perms . "<br />";
            $qtip .= '<strong>' . ext_Lang::msg('miscowner', true) . ':</strong> ' . $items['items'][$i]['owner'];
            if ($GLOBALS['use_mb']) {
                if (ext_isFTPMode()) {
                    $dirlist[] = array('text' => htmlspecialchars($item), 'id' => $id, 'qtip' => $qtip, 'is_writable' => $is_writable, 'is_chmodable' => $is_chmodable, 'is_readable' => $is_readable, 'is_deletable' => $is_deletable, 'cls' => 'folder');
                } else {
                    if (mb_detect_encoding($item) == 'ASCII') {
                        $dirlist[] = array('text' => htmlspecialchars(ext_TextEncoding::toUTF8($item)), 'id' => utf8_encode($id), 'qtip' => $qtip, 'is_writable' => $is_writable, 'is_chmodable' => $is_chmodable, 'is_readable' => $is_readable, 'is_deletable' => $is_deletable, 'cls' => 'folder');
                    } else {
                        $dirlist[] = array('text' => htmlspecialchars($item), 'id' => $id, 'qtip' => $qtip, 'is_writable' => $is_writable, 'is_chmodable' => $is_chmodable, 'is_readable' => $is_readable, 'is_deletable' => $is_deletable, 'cls' => 'folder');
                    }
                }
            } else {
                $dirlist[] = array('text' => htmlspecialchars(ext_isFTPMode() ? $item : ext_TextEncoding::toUTF8($item)), 'id' => ext_isFTPMode() ? $id : ext_TextEncoding::toUTF8($id), 'qtip' => $qtip, 'is_writable' => $is_writable, 'is_chmodable' => $is_chmodable, 'is_readable' => $is_readable, 'is_deletable' => $is_deletable, 'cls' => 'folder');
            }
        }
        if (!$is_dir && $sendWhat == 'files' || $sendWhat == 'both') {
            $i++;
        }
    }
    while (@ob_end_clean()) {
    }
    if ($sendWhat == 'dirs') {
        $result = $dirlist;
    } else {
        $result = $items;
    }
    $classname = class_exists('ext_Json') ? 'ext_Json' : 'Services_JSON';
    $json = new $classname();
    echo $json->encode($result);
    ext_exit();
}
 function file_exists($file)
 {
     if (ext_isFTPMode()) {
         if ($file == '/') {
             return true;
         }
         // The root directory always exists
         $dir = $GLOBALS['FTPCONNECTION']->pwd();
         if (!is_array($file)) {
             $dir = dirname($file);
             $file = array('name' => basename($file));
         }
         $list = getCachedFTPListing($dir);
         if (is_array($list)) {
             foreach ($list as $item) {
                 if ($item['name'] == $file['name']) {
                     return true;
                 }
             }
         }
         return false;
     } else {
         return file_exists(ext_TextEncoding::fromUTF8($file));
     }
 }
示例#5
0
    function execAction($dir, $item)
    {
        // rename directory or file
        if (($GLOBALS["permissions"] & 01) != 01) {
            ext_Result::sendResult('rename', false, $GLOBALS["error_msg"]["accessfunc"]);
        }
        if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
            $newitemname = $GLOBALS['__POST']["newitemname"];
            $newitemname = trim(basename(stripslashes($newitemname)));
            if ($newitemname == '') {
                ext_Result::sendResult('rename', false, $GLOBALS["error_msg"]["miscnoname"]);
            }
            if (!ext_isFTPMode()) {
                $abs_old = get_abs_item($dir, $item);
                $abs_new = get_abs_item($dir, $newitemname);
            } else {
                $abs_old = get_item_info($dir, $item);
                $abs_new = get_item_info($dir, $newitemname);
            }
            if (@$GLOBALS['ext_File']->file_exists($abs_new)) {
                ext_Result::sendResult('rename', false, ext_TextEncoding::toUTF8($newitemname) . ": " . $GLOBALS["error_msg"]["itemdoesexist"]);
            }
            $perms_old = $GLOBALS['ext_File']->fileperms($abs_old);
            $ok = $GLOBALS['ext_File']->rename(get_abs_item($dir, $item), get_abs_item($dir, $newitemname));
            if (ext_isFTPMode()) {
                $abs_new = get_item_info($dir, $newitemname);
            }
            $GLOBALS['ext_File']->chmod($abs_new, $perms_old);
            if ($ok === false || PEAR::isError($ok)) {
                ext_Result::sendResult('rename', false, 'Could not rename ' . $dir . '/' . $item . ' to ' . $newitemname);
            }
            $msg = sprintf($GLOBALS['messages']['success_rename_file'], $item, $newitemname);
            ext_Result::sendResult('rename', true, $msg);
        }
        $is_dir = get_is_dir(ext_isFTPMode() ? get_item_info($dir, $item) : get_abs_item($dir, $item));
        ?>
{
	"xtype": "form",
	"width": "350",
	"height": "150",
	"id": "simpleform",
	"labelWidth": 125,
	"url":"<?php 
        echo basename($GLOBALS['script_name']);
        ?>
",
	"dialogtitle": "<?php 
        echo $GLOBALS['messages']['rename_file'];
        ?>
",
	"frame": true,
	"items": [{
	
		"xtype": "textfield",
		"fieldLabel": "<?php 
        echo ext_Lang::msg('newname', true);
        ?>
",
		"name": "newitemname",
		"id": "newitemname",
		"value": "<?php 
        echo str_replace("'", "\\'", stripslashes($item));
        ?>
",
		"width":175,
		"allowBlank":false
		}
	],
	"listeners": { "afterrender": { 
						fn: function( form ) {
							form.findById("newitemname").focus(true);
						}
					}
	},
	"buttons": [{
		"text": "<?php 
        echo ext_Lang::msg('btnsave', true);
        ?>
", 
		"handler": function() {
			statusBarMessage( 'Please wait...', true );
			form = Ext.getCmp("simpleform").getForm();
			form.submit({
				//reset: true,
				reset: false,
				success: function(form, action) {
					<?php 
        if ($is_dir) {
            ?>
						if( dirTree.getSelectionModel().getSelectedNode() ) {
							parentDir = dirTree.getSelectionModel().getSelectedNode().parentNode;parentDir.reload();parentDir.select();
						}
					<?php 
        }
        ?>
					datastore.reload();
					statusBarMessage( action.result.message, false, true );
					Ext.getCmp("dialog").destroy();
				},
				failure: function(form, action) {
					if( !action.result ) return;
					Ext.MessageBox.alert('Error!', action.result.error);
					statusBarMessage( action.result.error, false, false );
				},
				scope: form,
				// add some vars to the request, similar to hidden fields
				params: {
					option: 'com_extplorer', 
					action: 'rename', 
					dir: '<?php 
        echo stripslashes($dir);
        ?>
', 
					item: '<?php 
        echo stripslashes($item);
        ?>
', 
					confirm: 'true'
				}
			});
		}
	},{
		"text": "<?php 
        echo ext_Lang::msg('btncancel', true);
        ?>
", 
		"handler": function() { Ext.getCmp("dialog").destroy(); } 
	}]
}
	
	<?php 
    }
示例#6
0
/**
 * File/Directory Copy & Move Functions
 */
function ext_copy_move_items($dir)
{
    // copy/move file/dir
    $action = extGetParam($_REQUEST, 'action');
    if (($GLOBALS["permissions"] & 01) != 01) {
        ext_Result::sendResult($action, false, $GLOBALS["error_msg"]["accessfunc"]);
    }
    // CSRF Security Check
    if (!ext_checkToken($GLOBALS['__POST']["token"])) {
        ext_Result::sendResult('tokencheck', false, 'Request failed: Security Token not valid.');
    }
    // Vars
    $first = extGetParam($GLOBALS['__POST'], 'first');
    if ($first == "y") {
        $new_dir = $dir;
    } else {
        $new_dir = extGetParam($GLOBALS['__POST'], "new_dir");
    }
    if ($new_dir == ".") {
        $new_dir = "";
    }
    $cnt = count($GLOBALS['__POST']["selitems"]);
    if (!$new_dir) {
        ext_copy_move_dialog($dir);
        return;
    }
    // DO COPY/MOVE
    // ALL OK?
    if (!@$GLOBALS['ext_File']->file_exists(dirname(get_abs_dir($new_dir)))) {
        ext_Result::sendResult($action, false, dirname(get_abs_dir($new_dir)) . ": " . $GLOBALS["error_msg"]["targetexist"]);
    }
    if (!get_show_item($new_dir, "")) {
        ext_Result::sendResult($action, false, $new_dir . ": " . $GLOBALS["error_msg"]["accesstarget"]);
    }
    if (!down_home(get_abs_dir($new_dir))) {
        ext_Result::sendResult($action, false, $new_dir . ": " . $GLOBALS["error_msg"]["targetabovehome"]);
    }
    // copy / move files
    $err = false;
    for ($i = 0; $i < $cnt; ++$i) {
        $tmp = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
        $new = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
        if (ext_isFTPMode()) {
            $abs_item = get_item_info($dir, $tmp);
            $abs_new_item = $new_dir . '/' . $new;
        } else {
            $abs_item = get_abs_item($dir, $tmp);
            $abs_new_item = get_abs_item($new_dir, $new);
        }
        $items[$i] = $tmp;
        // Check
        if ($new == "") {
            $error[$i] = $GLOBALS["error_msg"]["miscnoname"];
            $err = true;
            continue;
        }
        if (!@$GLOBALS['ext_File']->file_exists($abs_item)) {
            $error[$i] = $GLOBALS["error_msg"]["itemexist"];
            $err = true;
            continue;
        }
        if (!get_show_item($dir, $tmp)) {
            $error[$i] = $GLOBALS["error_msg"]["accessitem"];
            $err = true;
            continue;
        }
        if (@$GLOBALS['ext_File']->file_exists($abs_new_item)) {
            $error[$i] = $GLOBALS["error_msg"]["targetdoesexist"];
            $err = true;
            continue;
        }
        // Copy / Move
        if ($action == "copy") {
            if (@is_link(ext_TextEncoding::fromUTF8($abs_item)) || get_is_file(ext_TextEncoding::fromUTF8($abs_item))) {
                // check file-exists to avoid error with 0-size files (PHP 4.3.0)
                if (ext_isFTPMode()) {
                    $abs_item = '/' . $dir . '/' . $abs_item['name'];
                }
                $ok = @$GLOBALS['ext_File']->copy($abs_item, $abs_new_item);
                //||@file_exists($abs_new_item);
            } elseif (@get_is_dir(ext_TextEncoding::fromUTF8($abs_item))) {
                $ext_copy_dir = ext_isFTPMode() ? '/' . $dir . '/' . $abs_item['name'] . '/' : $abs_item;
                if (ext_isFTPMode()) {
                    $abs_new_item .= '/';
                }
                $ok = $GLOBALS['ext_File']->ext_copy_dir($ext_copy_dir, $abs_new_item);
            }
        } else {
            $ok = $GLOBALS['ext_File']->rename($abs_item, $abs_new_item);
        }
        if ($ok === false || PEAR::isError($ok)) {
            $error[$i] = $action == "copy" ? $GLOBALS["error_msg"]["copyitem"] : $GLOBALS["error_msg"]["moveitem"];
            if (PEAR::isError($ok)) {
                $error[$i] .= ' [' . $ok->getMessage() . ']';
            }
            $err = true;
            continue;
        }
        $error[$i] = NULL;
    }
    if ($err) {
        // there were errors
        $err_msg = "";
        for ($i = 0; $i < $cnt; ++$i) {
            if ($error[$i] == NULL) {
                continue;
            }
            $err_msg .= $items[$i] . " : " . $error[$i] . "\n";
        }
        ext_Result::sendResult($action, false, $err_msg);
    }
    ext_Result::sendResult($action, true, 'The File(s)/Directory(s) were successfully ' . ($action == 'copy' ? 'copied' : 'moved') . '.');
}