if( selectedRows.length > 0 ) { for( i=0; i < selectedRows.length;i++) { selitems[i] = selectedRows[i].get('name'); } } dir = datastore.directory; } //Ext.Msg.alert("Debug", dir ); var requestParams = { option: 'com_extplorer', dir: dir, item: selitems.length > 0 ? selitems[0]:'', 'selitems[]': selitems, token: "<?php echo ext_getToken(); ?> " }; return requestParams; } /** * Function for actions, which don't require a form like download, extraction, deletion etc. */ function deleteFiles(btn) { if( btn != 'yes') { return; } requestParams = getRequestParams(); requestParams.action = 'delete'; handleCallback(requestParams);
function execAction($dir) { // make new directory or file if (($GLOBALS["permissions"] & 01) != 01) { ext_Result::sendResult('mkitem', false, $GLOBALS["error_msg"]["accessfunc"]); } if (extGetParam($_POST, 'confirm') == 'true') { // CSRF Security Check if (!ext_checkToken($GLOBALS['__POST']["token"])) { ext_Result::sendResult('tokencheck', false, 'Request failed: Security Token not valid.'); } $mkname = $GLOBALS['__POST']["mkname"]; $mktype = $GLOBALS['__POST']["mktype"]; $symlink_target = $GLOBALS['__POST']['symlink_target']; $mkname = basename(stripslashes($mkname)); if ($mkname == "") { ext_Result::sendResult('mkitem', false, $GLOBALS["error_msg"]["miscnoname"]); } $new = get_abs_item($dir, $mkname); if (@$GLOBALS['ext_File']->file_exists($new)) { ext_Result::sendResult('mkitem', false, $mkname . ": " . $GLOBALS["error_msg"]["itemdoesexist"]); } $err = print_r($_POST, true); if ($mktype == "dir") { $ok = @$GLOBALS['ext_File']->mkdir($new, 0777); $err = $GLOBALS["error_msg"]["createdir"]; } elseif ($mktype == 'file') { $ok = @$GLOBALS['ext_File']->mkfile($new); $err = $GLOBALS["error_msg"]["createfile"]; } elseif ($mktype == 'symlink') { if (empty($symlink_target)) { ext_Result::sendResult('mkitem', false, 'Please provide a valid <strong>target</strong> for the symbolic link.'); } if (!file_exists($symlink_target) || !is_readable($symlink_target)) { ext_Result::sendResult('mkitem', false, 'The file you wanted to make a symbolic link to does not exist or is not accessible by PHP.'); } $ok = symlink($symlink_target, $new); $err = 'The symbolic link could not be created.'; } if ($ok == false || PEAR::isError($ok)) { if (PEAR::isError($ok)) { $err .= $ok->getMessage(); } ext_Result::sendResult('mkitem', false, $err); } ext_Result::sendResult('mkitem', true, 'The item ' . $new . ' was created'); return; } ?> { "xtype": "form", "id": "simpleform", "labelWidth": 125, "url":"<?php echo basename($GLOBALS['script_name']); ?> ", "dialogtitle": "Create New File/Directory", "frame": true, "items": [{ "xtype": "textfield", "fieldLabel": "<?php echo ext_Lang::msg("nameheader", true); ?> ", "name": "mkname", "width":175, "allowBlank":false },{ "xtype": "combo", "fieldLabel": "Type", "store": [["file", "<?php echo ext_Lang::mime('file', true); ?> "], ["dir", "<?php echo ext_Lang::mime('dir', true); ?> "] <?php if (!ext_isFTPMode() && !$GLOBALS['isWindows']) { ?> ,["symlink", "<?php echo ext_Lang::mime('symlink', true); ?> "] <?php } ?> ], displayField:"type", valueField: "mktype", value: "file", hiddenName: "mktype", disableKeyFilter: true, editable: false, triggerAction: "all", mode: "local", allowBlank: false, selectOnFocus:true },{ "xtype": "textfield", "fieldLabel": "<?php echo ext_Lang::msg('symlink_target', true); ?> ", "name": "symlink_target", "width":175, "allowBlank":true }], "buttons": [{ "text": "<?php echo ext_Lang::msg('btncreate', true); ?> ", "handler": function() { statusBarMessage( "Please wait...", true ); Ext.getCmp("simpleform").getForm().submit({ //reset: true, reset: false, success: function(form, action) { statusBarMessage( action.result.message, false, true ); try{ dirTree.getSelectionModel().getSelectedNode().reload(); } catch(e) {} datastore.reload(); Ext.getCmp("dialog").destroy(); }, failure: function(form, action) { if( !action.result ) return; Ext.Msg.alert("Error!", action.result.error); statusBarMessage( action.result.error, false, false ); }, scope: Ext.getCmp("simpleform"), // add some vars to the request, similar to hidden fields params: {option: "com_extplorer", action: "mkitem", dir: datastore.directory, confirm: "true", token: "<?php echo ext_getToken(); ?> " } }) } },{ "text": "<?php echo ext_Lang::msg('btncancel', true); ?> ", "handler": function() { Ext.getCmp("dialog").destroy(); } }] } <?php }
function show_userform($data = null) { if ($data == null) { $data = array('', '', '', '', '', '', ''); } $formname = @$data[0] ? 'frmedituser' : 'frmadduser'; ?> { "xtype": "form", "id" : "<?php echo $formname; ?> ", "renderTo": Ext.getCmp("dialog_tabpanel").getEl(), "hidden": true, "closable":true, "autoHeight": "true", "labelWidth": 125, "url":"<?php echo basename($GLOBALS['script_name']); ?> ", "title": "<?php if (!empty($data[0])) { printf($GLOBALS["messages"]["miscedituser"], $data[0]); } else { echo $GLOBALS["messages"]["miscadduser"]; } ?> " , items: [{ "xtype": "textfield", "fieldLabel": "<?php echo ext_Lang::msg('miscusername', true); ?> ", "name": "nuser", "value": "<?php echo @$data[0]; ?> ", "width":175, "allowBlank":false },{ "xtype": "textfield", "fieldLabel": "<?php echo ext_Lang::msg('miscconfpass', true); ?> ", "name": "pass1", "inputType": "password", "width":175 }, { "xtype": "textfield", "fieldLabel": "<?php echo ext_Lang::msg('miscconfnewpass', true); ?> ", "name": "pass2", "inputType": "password", "width":175 }, <?php if (!empty($data[0])) { ?> { "xtype": "checkbox", "fieldLabel": "<?php echo ext_Lang::msg('miscchpass', true); ?> ", "name": "chpass", "hiddenValue": "true" }, <?php } ?> { "xtype": "textfield", "fieldLabel": "<?php echo ext_Lang::msg('mischomedir', true); ?> ", "name": "home_dir", "value": "<?php echo !empty($data[2]) ? $data[2] : $_SERVER['DOCUMENT_ROOT']; ?> ", "width":175, "allowBlank":false }, { "xtype": "textfield", "fieldLabel": "<?php echo ext_Lang::msg('mischomeurl', true); ?> ", "name": "home_url", "value": "<?php echo !empty($data[3]) ? $data[3] : $GLOBALS["home_url"]; ?> ", "width":175, "allowBlank":false },{ "xtype": "combo", "fieldLabel": "<?php echo ext_Lang::msg('miscshowhidden', true); ?> ", "store": [ ["1", "<?php echo ext_Lang::msg(array('miscyesno' => 0), true); ?> "], ["0", "<?php echo ext_Lang::msg(array('miscyesno' => 1), true); ?> "] ], "hiddenName": "show_hidden", "disableKeyFilter": true, "value": "<?php echo !empty($data[4]) ? $data[4] : (int) $data[4]; ?> ", "editable": false, "triggerAction": "all", "mode": "local", "allowBlank": false, "selectOnFocus":true }, { "xtype": "textfield", "fieldLabel": "<?php echo ext_Lang::msg('mischidepattern', true); ?> ", "name": "no_access", "value": "<?php echo @$data[5]; ?> ", "width":175, "allowBlank":true }, { "xtype": "combo", "fieldLabel": "<?php echo ext_Lang::msg('miscperms', true); ?> ", "store": [<?php $permvalues = array(0, 1, 2, 3, 7); $permcount = count($GLOBALS["messages"]["miscpermnames"]); for ($i = 0; $i < $permcount; ++$i) { if ($permvalues[$i] == 7) { $index = 4; } else { $index = $i; } echo '["' . $permvalues[$i] . '", "' . ext_lang::msg(array('miscpermnames' => $index)) . '" ]' . "\n"; if ($i + 1 < $permcount) { echo ','; } } ?> ], "hiddenName": "permissions", "disableKeyFilter": true, "value": "<?php echo (int) @$data[6]; ?> ", "editable": false, "triggerAction": "all", "mode": "local" }, { "xtype": "combo", "fieldLabel": "<?php echo ext_Lang::msg('miscactive', true); ?> ", "store": [ ["1", "<?php echo ext_Lang::msg(array('miscyesno' => 0), true); ?> "], ["0", "<?php echo ext_Lang::msg(array('miscyesno' => 1), true); ?> "] ], "hiddenName": "active", "disableKeyFilter": true, "value": "<?php echo !empty($data[7]) ? $data[7] : 0; ?> ", "disabled": <?php echo !empty($self) ? 'true' : 'false'; ?> , "editable": false, "triggerAction": "all", "mode": "local", "allowBlank": false, "selectOnFocus":true } ], "buttons": [ { "text": "<?php echo ext_Lang::msg('btnsave', true); ?> ", "handler": function() { userform = Ext.getCmp("<?php echo $formname; ?> ").getForm(); if(userform.findField('nuser').getValue()=="" || userform.findField('home_dir').getValue()=="") { Ext.Msg.alert('Status', "<?php echo ext_Lang::err('miscfieldmissed', true); ?> "); return false; } if( userform.findField('chpass') ) { if(userform.findField('chpass').getValue() && userform.findField('pass1').getValue() != userform.findField('pass2').getValue()) { Ext.Msg.alert('Status', "<?php echo ext_Lang::err('miscnopassmatch', true); ?> "); return false; } } statusBarMessage( 'Please wait...', true ); userform.submit({ "success": function(form, action) { statusBarMessage( action.result.message, false, true ); Ext.getCmp("dialog_tabpanel").remove("<?php echo $formname; ?> "); }, "failure": function(form, action) { if( !action.result ) return; Ext.Msg.alert('Error!', action.result.error); statusBarMessage( action.result.error, false, true ); }, "scope": userform, // add some vars to the request, similar to hidden fields "params": {option: 'com_extplorer', user: "******", "action": 'admin', "action2": "<?php echo @$data[0] ? 'edituser' : 'adduser'; ?> ", "confirm": "true", "token": "<?php echo ext_getToken(); ?> " } }) } },{ "text": "<?php echo ext_Lang::msg('btncancel', true); ?> ", "handler": function() { Ext.getCmp("dialog_tabpanel").remove("<?php echo $formname; ?> "); } }] } <?php }
function execAction($dir, $item) { // change permissions if (($GLOBALS["permissions"] & 01) != 01) { ext_Result::sendResult('chmod', 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.'); } if (!empty($GLOBALS['__POST']["selitems"])) { $cnt = count($GLOBALS['__POST']["selitems"]); } else { $GLOBALS['__POST']["selitems"][] = $item; $cnt = 1; } if (!empty($GLOBALS['__POST']['do_recurse'])) { $do_recurse = true; } else { $do_recurse = false; } // Execute if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") { $bin = ''; for ($i = 0; $i < 3; $i++) { for ($j = 0; $j < 3; $j++) { $tmp = "r_" . $i . $j; if (!empty($GLOBALS['__POST'][$tmp])) { $bin .= '1'; } else { $bin .= '0'; } } } if ($bin == '0') { // Changing permissions to "none" is not allowed ext_Result::sendResult('chmod', false, $item . ": " . ext_Lang::err('chmod_none_not_allowed')); } $old_bin = $bin; for ($i = 0; $i < $cnt; ++$i) { if (ext_isFTPMode()) { $mode = decoct(bindec($bin)); } else { $mode = bindec($bin); } $item = $GLOBALS['__POST']["selitems"][$i]; if (ext_isFTPMode()) { $abs_item = get_item_info($dir, $item); } else { $abs_item = get_abs_item($dir, $item); } if (!$GLOBALS['ext_File']->file_exists($abs_item)) { ext_Result::sendResult('chmod', false, $item . ": " . $GLOBALS["error_msg"]["fileexist"]); } if (!get_show_item($dir, $item)) { ext_Result::sendResult('chmod', false, $item . ": " . $GLOBALS["error_msg"]["accessfile"]); } if ($do_recurse) { $ok = $GLOBALS['ext_File']->chmodRecursive($abs_item, $mode); } else { if (get_is_dir($abs_item)) { // when we chmod a directory we must care for the permissions // to prevent that the directory becomes not readable (when the "execute bits" are removed) $bin = substr_replace($bin, '1', 2, 1); // set 1st x bit to 1 $bin = substr_replace($bin, '1', 5, 1); // set 2nd x bit to 1 $bin = substr_replace($bin, '1', 8, 1); // set 3rd x bit to 1 if (ext_isFTPMode()) { $mode = decoct(bindec($bin)); } else { $mode = bindec($bin); } } //ext_Result::sendResult('chmod', false, $GLOBALS['FTPCONNECTION']->pwd()); $ok = @$GLOBALS['ext_File']->chmod($abs_item, $mode); } $bin = $old_bin; } if ($ok === false || PEAR::isError($ok)) { $msg = $item . ": " . $GLOBALS["error_msg"]["permchange"]; $msg .= PEAR::isError($ok) ? ' [' . $ok->getMessage() . ']' : ''; ext_Result::sendResult('chmod', false, $msg); } ext_Result::sendResult('chmod', true, ext_Lang::msg('permchange')); return; } if (ext_isFTPMode()) { $abs_item = get_item_info($dir, $GLOBALS['__POST']["selitems"][0]); } else { $abs_item = get_abs_item($dir, $GLOBALS['__POST']["selitems"][0]); $abs_item = utf8_decode($abs_item); } $mode = parse_file_perms(get_file_perms($abs_item)); if ($mode === false) { ext_Result::sendResult('chmod', false, $item . ": " . $GLOBALS["error_msg"]["permread"]); } $pos = "rwx"; $text = ""; for ($i = 0; $i < $cnt; ++$i) { $s_item = get_rel_item($dir, $GLOBALS['__POST']["selitems"][$i]); if (strlen($s_item) > 50) { $s_item = "..." . substr($s_item, -47); } $text .= $s_item . ($i + 1 < $cnt ? ', ' : ''); } ?> { "xtype": "form", "id": "simpleform", "width": "300", "labelWidth": 125, "url":"<?php echo basename($GLOBALS['script_name']); ?> ", "dialogtitle": "<?php echo ext_Lang::msg('actperms'); ?> ", "title" : "<?php echo $text; ?> ", "frame": true, "items": [{ "layout": "column", "items": [{ <?php // print table with current perms & checkboxes to change for ($i = 0; $i < 3; ++$i) { ?> "width":80, "title":"<?php echo ext_Lang::msg(array('miscchmod' => $i), true); ?> ", "items": [{ <?php for ($j = 0; $j < 3; ++$j) { ?> "xtype": "checkbox", "boxLabel":"<?php echo $pos[$j]; ?> ", <?php if ($mode[3 * $i + $j] != "-") { echo '"checked":true,'; } ?> "name":"<?php echo "r_" . $i . $j; ?> " } <?php if ($j < 2) { echo ',{'; } } ?> ] } <?php if ($i < 2) { echo ',{'; } } ?> ,{ "width":400, "style":"margin-left:10px", "clear":true, "html": " " }] },{ "xtype": "checkbox", "fieldLabel":"<?php echo ext_Lang::msg('recurse_subdirs', true); ?> ", "name":"do_recurse" }], "buttons": [{ "text": "<?php echo ext_Lang::msg('btnsave', true); ?> ", "handler": function() { statusBarMessage( '<?php echo ext_Lang::msg('permissions_processing', true); ?> ', true ); form = Ext.getCmp("simpleform").getForm(); form.submit({ //reset: true, reset: false, success: function(form, action) { statusBarMessage( action.result.message, false, true ); datastore.reload(); Ext.getCmp("dialog").destroy(); }, 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, params: { "option": "com_extplorer", "action": "chmod", "dir": "<?php echo stripslashes($GLOBALS['__POST']["dir"]); ?> ", "selitems[]": ['<?php echo implode("','", $GLOBALS['__POST']["selitems"]); ?> '], confirm: 'true', token: "<?php echo ext_getToken(); ?> " } }); } },{ "text": "<?php echo ext_Lang::msg('btncancel', true); ?> ", "handler": function() { Ext.getCmp("dialog").destroy(); } }] } <?php }
function execAction($dir) { if (($GLOBALS["permissions"] & 01) != 01) { ext_Result::sendResult('upload', false, ext_Lang::err('accessfunc')); } // Execute if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") { // CSRF Security Check if (!ext_checkToken($GLOBALS['__POST']["token"])) { ext_Result::sendResult('tokencheck', false, 'Request failed: Security Token not valid.'); } if (isset($GLOBALS['__FILES']['Filedata'])) { // Re-Map the flash-uploaded file with the name "Filedata" to the "userfile" array $GLOBALS['__FILES']['userfile'] = array('name' => array($GLOBALS['__FILES']['Filedata']['name']), 'tmp_name' => array($GLOBALS['__FILES']['Filedata']['tmp_name']), 'size' => array($GLOBALS['__FILES']['Filedata']['size']), 'type' => array($GLOBALS['__FILES']['Filedata']['type']), 'error' => array($GLOBALS['__FILES']['Filedata']['error'])); } $cnt = count($GLOBALS['__FILES']['userfile']['name']); $err = false; $err_available = isset($GLOBALS['__FILES']['userfile']['error']); // upload files & check for errors for ($i = 0; $i < $cnt; $i++) { $errors[$i] = NULL; $tmp = $GLOBALS['__FILES']['userfile']['tmp_name'][$i]; $items[$i] = stripslashes($GLOBALS['__FILES']['userfile']['name'][$i]); if ($err_available) { $up_err = $GLOBALS['__FILES']['userfile']['error'][$i]; } else { $up_err = file_exists($tmp) ? 0 : 4; } $abs = get_abs_item($dir, $items[$i]); if ($items[$i] == "" || $up_err == 4) { continue; } if ($up_err == 1 || $up_err == 2) { $errors[$i] = ext_lang::err('miscfilesize'); $err = true; continue; } if ($up_err == 3) { $errors[$i] = ext_lang::err('miscfilepart'); $err = true; continue; } if (!@is_uploaded_file($tmp)) { $errors[$i] = ext_lang::err('uploadfile'); $err = true; continue; } if (@$GLOBALS['ext_File']->file_exists($abs) && empty($_REQUEST['overwrite_files'])) { $errors[$i] = ext_lang::err('itemdoesexist'); $err = true; continue; } // Upload $ok = @$GLOBALS['ext_File']->move_uploaded_file($tmp, $abs); if ($ok === false || PEAR::isError($ok)) { $errors[$i] = ext_lang::err('uploadfile'); if (PEAR::isError($ok)) { $errors[$i] .= ' [' . $ok->getMessage() . ']'; } $err = true; continue; } else { if (!ext_isFTPMode()) { @$GLOBALS['ext_File']->chmod($abs, 0644); } } } if ($err) { // there were errors $err_msg = ""; for ($i = 0; $i < $cnt; $i++) { if ($errors[$i] == NULL) { continue; } $err_msg .= $items[$i] . " : " . $errors[$i] . "\n"; } ext_Result::sendResult('upload', false, $err_msg); } ext_Result::sendResult('upload', true, ext_Lang::msg('upload_completed')); return; } ?> { "xtype": "tabpanel", "stateId": "upload_tabpanel", "activeTab": "uploadform", "dialogtitle": "<?php echo ext_Lang::msg('actupload'); ?> ", "stateful": "true", "stateEvents": ["tabchange"], "getState": function() { return { activeTab:this.items.indexOf(this.getActiveTab()) }; }, "listeners": { "resize": { "fn": function(panel) { panel.items.each( function(item) { item.setHeight(500);return true } ); } } }, "items": [ { "xtype": "swfuploadpanel", "title": "<?php echo Ext_Lang::msg('flashupload'); ?> ", "height": "300", "id": "swfuploader", viewConfig: { forceFit: true }, "listeners": { "allUploadsComplete": { "fn": function(panel) { datastore.reload(); panel.destroy(); Ext.getCmp("dialog").destroy(); statusBarMessage('<?php echo ext_Lang::msg('upload_completed', true); ?> ', false ); } } }, // Uploader Params "upload_url": "<?php echo _EXT_URL . '/uploadhandler.php'; ?> ", "post_params": { "<?php echo session_name(); ?> ": "<?php echo session_id(); ?> ", "<?php echo get_cfg_var('session.name'); ?> ": "<?php echo session_id(); ?> ", "session_name": "<?php echo session_name(); ?> ", "user_agent": "<?php echo addslashes($_SERVER['HTTP_USER_AGENT']); ?> ", "option": "com_extplorer", "action": "upload", "dir": datastore.directory, "requestType": "xmlhttprequest", "confirm": "true" }, <?php if ($_SERVER['SERVER_NAME'] == 'localhost') { echo '"debug": "true",'; } ?> "flash_url": "<?php echo _EXT_URL; ?> /scripts/extjs3-ext/ux.swfupload/swfupload.swf", "prevent_swf_caching": "false", "file_size_limit": "<?php echo get_max_file_size(); ?> B", // Custom Params "single_file_select": false, // Set to true if you only want to select one file from the FileDialog. "confirm_delete": false, // This will prompt for removing files from queue. "remove_completed": false // Remove file from grid after uploaded. }, { "xtype": "form", "autoScroll": "true", "autoHeight": "true", "id": "uploadform", "fileUpload": true, "labelWidth": 125, "url":"<?php echo basename($GLOBALS['script_name']); ?> ", "title": "<?php echo ext_Lang::msg('standardupload'); ?> ", "tooltip": "<?php echo ext_Lang::msg('max_file_size') . ' = <strong>' . get_max_file_size() / 1024 / 1024 . ' MB<\\/strong><br \\/>' . ext_Lang::msg('max_post_size') . ' = <strong>' . get_max_upload_limit() / 1024 / 1024 . ' MB<\\/strong><br \\/>'; ?> ", "frame": true, "items": [ { "xtype": "displayfield", "value": "<?php echo ext_Lang::msg('max_file_size') . ' = <strong>' . get_max_file_size() / 1024 / 1024 . ' MB<\\/strong><br \\/>' . ext_Lang::msg('max_post_size') . ' = <strong>' . get_max_upload_limit() / 1024 / 1024 . ' MB<\\/strong><br \\/>'; ?> " }, <?php for ($i = 0; $i < 7; $i++) { echo '{ "xtype": "fileuploadfield", "fieldLabel": "' . ext_Lang::msg('file', true) . ' ' . ($i + 1) . '", "id": "userfile' . $i . '", "name": "userfile[' . $i . ']", "width":275, "buttonOnly": false },'; } ?> { "xtype": "checkbox", "fieldLabel": "<?php echo ext_Lang::msg('overwrite_files', true); ?> ", "name": "overwrite_files", "checked": true }], "buttons": [{ "text": "<?php echo ext_Lang::msg('btnsave', true); ?> ", "handler": function() { statusBarMessage( '<?php echo ext_Lang::msg('upload_processing', true); ?> ', true ); form = Ext.getCmp("uploadform").getForm(); form.submit({ //reset: true, reset: false, success: function(form, action) { datastore.reload(); statusBarMessage( action.result.message, false, true ); Ext.getCmp("dialog").destroy(); }, failure: function(form, action) { if( !action.result ) return; Ext.MessageBox.alert('<?php echo ext_Lang::err('error', true); ?> ', 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": "upload", "dir": datastore.directory, "requestType": "xmlhttprequest", "confirm": "true", "token": "<?php echo ext_getToken(); ?> " } }); } }, { "text": "<?php echo ext_Lang::msg('btncancel', true); ?> ", "handler": function() { Ext.getCmp("dialog").destroy(); } }] }, { "xtype": "form", "id": "transferform", "url":"<?php echo basename($GLOBALS['script_name']); ?> ", "hidden": "true", "title": "<?php echo ext_Lang::msg('acttransfer'); ?> ", "autoHeight": "true", "labelWidth": 225, "frame": true, "items": [ <?php for ($i = 0; $i < 7; $i++) { echo '{ "xtype": "textfield", "fieldLabel": "' . ext_Lang::msg('url_to_file', true) . '", "name": "userfile[' . $i . ']", "width":275 },'; } ?> { "xtype": "checkbox", "fieldLabel": "<?php echo ext_Lang::msg('overwrite_files', true); ?> ", "name": "overwrite_files", "checked": true } ], "buttons": [{ "text": "<?php echo ext_Lang::msg('btnsave', true); ?> ", "handler": function() { statusBarMessage( '<?php echo ext_Lang::msg('transfer_processing', true); ?> ', true ); transfer = Ext.getCmp("transferform").getForm(); transfer.submit({ //reset: true, reset: false, success: function(form, action) { datastore.reload(); statusBarMessage( action.result.message, false, true ); Ext.getCmp("dialog").destroy(); }, failure: function(form, action) { if( !action.result ) return; Ext.MessageBox.alert('<?php echo ext_Lang::err('error', true); ?> ', action.result.error); statusBarMessage( action.result.error, false, false ); }, scope: transfer, // add some vars to the request, similar to hidden fields params: { "option": "com_extplorer", "action": "transfer", "dir": datastore.directory, "confirm": 'true', "token": "<?php echo ext_getToken(); ?> " } }); } },{ "text": "<?php echo ext_Lang::msg('btncancel', true); ?> ", "handler": function() { Ext.getCmp("dialog").destroy(); } }] }] } <?php }
/** * Lists all bookmarked directories in a dropdown list. * * @param string $dir */ function ext_list_bookmarks($dir) { $bookmarks = read_bookmarks(); $bookmarks = array_flip($bookmarks); foreach ($bookmarks as $bookmark) { $len = strlen($bookmark); if ($len > 40) { $first_part = substr($bookmark, 0, 20); $last_part = substr($bookmark, -20); $bookmarks[$bookmark] = $first_part . '...' . $last_part; } } $html = $GLOBALS['messages']['quick_jump'] . ': '; if (!empty($dir[0]) && @$dir[0] == '/') { $dir = substr($dir, 1); } $html .= ext_selectList('favourites', $dir, $bookmarks, 1, '', 'onchange="chDir( this.options[this.options.selectedIndex].value);" style="max-width: 200px;"'); $img_add = '<img src="' . _EXT_URL . '/images/_bookmark_add.png" border="0" alt="' . $GLOBALS['messages']['lbl_add_bookmark'] . '" align="absmiddle" />'; $img_remove = '<img src="' . _EXT_URL . '/images/_remove.png" border="0" alt="' . $GLOBALS['messages']['lbl_remove_bookmark'] . '" align="absmiddle" />'; $addlink = $removelink = ''; if (!isset($bookmarks[$dir]) && $dir != '' && $dir != '/') { $addlink = '<a href="' . ext_make_link('modify_bookmark', $dir) . '&task=add" onclick="' . 'Ext.Msg.prompt(\'' . ext_Lang::msg('lbl_add_bookmark', true) . '\', \'' . ext_Lang::msg('enter_alias_name', true) . ':\', ' . 'function(btn, text){ ' . 'if (btn == \'ok\') { ' . 'Ext.get(\'bookmark_container\').load({ ' . 'url: \'' . basename($GLOBALS['script_name']) . '\', ' . 'scripts: true, ' . 'params: { ' . 'action:\'modify_bookmark\', ' . 'task: \'add\', ' . 'requestType: \'xmlhttprequest\', ' . 'alias: text, ' . 'dir: \'' . $dir . '\', ' . 'token: \'' . ext_getToken() . '\', ' . 'option: \'com_extplorer\' ' . '} ' . '}); ' . '}' . '}); return false;" title="' . $GLOBALS['messages']['lbl_add_bookmark'] . '" >' . $img_add . '</a>'; } elseif ($dir != '' && $dir != '/') { $removelink = '<a href="' . ext_make_link('modify_bookmark', $dir) . '&task=remove" onclick="' . 'Ext.Msg.confirm(\'' . ext_Lang::msg('lbl_remove_bookmark', true) . '\',\'' . ext_Lang::msg('lbl_remove_bookmark', true) . '?\', ' . 'function(btn, text){ ' . 'if (btn == \'yes\') { ' . 'Ext.get(\'bookmark_container\').load({ ' . 'url: \'' . basename($GLOBALS['script_name']) . '\', ' . 'scripts: true, ' . 'params: { ' . 'action:\'modify_bookmark\', ' . 'task: \'remove\', ' . 'dir: \'' . $dir . '\', ' . 'token: \'' . ext_getToken() . '\', ' . 'option: \'com_extplorer\' ' . '} ' . '}); ' . '}' . '}); return false;" title="' . $GLOBALS['messages']['lbl_remove_bookmark'] . '">' . $img_remove . '</a>'; } $html .= $addlink . ' ' . $removelink; return $html; }
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") { // CSRF Security Check if (!ext_checkToken($GLOBALS['__POST']["token"])) { ext_Result::sendResult('tokencheck', false, 'Request failed: Security Token not valid.'); } $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', token: "<?php echo ext_getToken(); ?> " } }); } },{ "text": "<?php echo ext_Lang::msg('btncancel', true); ?> ", "handler": function() { Ext.getCmp("dialog").destroy(); } }] } <?php }
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')); } // CSRF Security Check if (!ext_checkToken($GLOBALS['__POST']["token"])) { ext_Result::sendResult('tokencheck', false, 'Request failed: Security Token not valid.'); } 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(htmlentities($s_item, ENT_QUOTES), strlen($s_item) - 30, 30) : htmlentities($s_item, ENT_QUOTES); ?> ", "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', token: "<?php echo ext_getToken(); ?> " } }); }, "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', token: "<?php echo ext_getToken(); ?> " } }); }, "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"] . ': ' . htmlentities($s_item, ENT_QUOTES); ?> " }, { "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 addslashes($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 }
function execAction($dir) { if (($GLOBALS["permissions"] & 01) != 01) { ext_Result::sendResult('archive', false, $GLOBALS["error_msg"]["accessfunc"]); } if (!$GLOBALS["zip"] && !$GLOBALS["tgz"]) { ext_Result::sendResult('archive', false, $GLOBALS["error_msg"]["miscnofunc"]); } // CSRF Security Check if (!ext_checkToken($GLOBALS['__POST']["token"])) { ext_Result::sendResult('tokencheck', false, 'Request failed: Security Token not valid.'); } $allowed_types = array('zip', 'tgz', 'tbz', 'tar'); // If we have something to archive, let's do it now if (extGetParam($_POST, 'confirm') == 'true') { $saveToDir = utf8_decode($GLOBALS['__POST']['saveToDir']); if (!file_exists(get_abs_dir($saveToDir))) { ext_Result::sendResult('archive', false, ext_Lang::err('archive_dir_notexists')); } if (!is_writable(get_abs_dir($saveToDir))) { ext_Result::sendResult('archive', false, ext_Lang::err('archive_dir_unwritable')); } require_once _EXT_PATH . '/libraries/Archive/archive.php'; if (!in_array(strtolower($GLOBALS['__POST']["type"]), $allowed_types)) { ext_Result::sendResult('archive', false, ext_Lang::err('extract_unknowntype') . ': ' . htmlspecialchars($GLOBALS['__POST']["type"])); } // This controls how many files are processed per Step (it's split up into steps to prevent time-outs) $files_per_step = 2000; $cnt = count($GLOBALS['__POST']["selitems"]); $abs_dir = get_abs_dir($dir); $name = basename(stripslashes($GLOBALS['__POST']["name"])); if ($name == "") { ext_Result::sendResult('archive', false, $GLOBALS["error_msg"]["miscnoname"]); } $startfrom = extGetParam($_REQUEST, 'startfrom', 0); $dir_contents_cache_name = 'ext_' . md5(implode(null, $GLOBALS['__POST']["selitems"])); $dir_contents_cache_file = _EXT_FTPTMP_PATH . '/' . $dir_contents_cache_name . '.txt'; $archive_name = get_abs_item($saveToDir, $name); $fileinfo = pathinfo($archive_name); if (empty($fileinfo['extension'])) { $archive_name .= "." . $GLOBALS['__POST']["type"]; $fileinfo['extension'] = $GLOBALS['__POST']["type"]; foreach ($allowed_types as $ext) { if ($GLOBALS['__POST']["type"] == $ext && @$fileinfo['extension'] != $ext) { $archive_name .= "." . $ext; } } } if ($startfrom == 0) { for ($i = 0; $i < $cnt; $i++) { $selitem = stripslashes($GLOBALS['__POST']["selitems"][$i]); if ($selitem == 'ext_root') { $selitem = ''; } if (is_dir(utf8_decode($abs_dir . "/" . $selitem))) { $items = extReadDirectory(utf8_decode($abs_dir . "/" . $selitem), '.', true, true); foreach ($items as $item) { if (is_dir($item) || !is_readable($item) || $item == $archive_name) { continue; } $v_list[] = str_replace('\\', '/', $item); } } else { $v_list[] = utf8_decode(str_replace('\\', '/', $abs_dir . "/" . $selitem)); } } if (count($v_list) > $files_per_step) { if (file_put_contents($dir_contents_cache_file, implode("\n", $v_list)) == false) { ext_Result::sendResult('archive', false, 'Failed to create a temporary list of the directory contents'); } } } else { $file_list_string = file_get_contents($dir_contents_cache_file); if (empty($file_list_string)) { ext_Result::sendResult('archive', false, 'Failed to retrieve the temporary list of the directory contents'); } $v_list = explode("\n", $file_list_string); } $cnt_filelist = count($v_list); // Now we go to the right range of files and "slice" the array $v_list = array_slice($v_list, $startfrom, $files_per_step - 1); $remove_path = $GLOBALS["home_dir"]; if ($dir) { $remove_path .= $dir; } $remove_path = str_replace('\\', '/', realpath($remove_path)) . '/'; $debug = 'Starting from: ' . $startfrom . "\n"; $debug .= 'Files to process: ' . $cnt_filelist . "\n"; $debug .= implode("\n", $v_list); //file_put_contents( 'log.txt', $debug, FILE_APPEND ); // Do some setup stuff ini_set('memory_limit', '128M'); @set_time_limit(0); //error_reporting( E_ERROR | E_PARSE ); $result = extArchive::create($archive_name, $v_list, $GLOBALS['__POST']["type"], '', $remove_path); if (PEAR::isError($result)) { ext_Result::sendResult('archive', false, $name . ': ' . ext_Lang::err('archive_creation_failed') . ' (' . $result->getMessage() . $archive_name . ')'); } $classname = class_exists('ext_Json') ? 'ext_Json' : 'Services_JSON'; $json = new $classname(); if ($cnt_filelist > $startfrom + $files_per_step) { $response = array('startfrom' => $startfrom + $files_per_step, 'totalitems' => $cnt_filelist, 'success' => true, 'action' => 'archive', 'token' => ext_getToken(), 'message' => sprintf(ext_Lang::msg('processed_x_files'), $startfrom + $files_per_step, $cnt_filelist)); } else { @unlink($dir_contents_cache_file); if ($GLOBALS['__POST']["type"] == 'tgz' || $GLOBALS['__POST']["type"] == 'tbz') { chmod($archive_name, 0644); } $response = array('action' => 'archive', 'success' => true, 'token' => ext_getToken(), 'message' => ext_Lang::msg('archive_created'), 'newlocation' => ext_make_link('download', $dir, basename($archive_name))); } echo $json->encode($response); ext_exit(); } $default_archive_type = 'zip'; ?> { "xtype": "form", "id": "simpleform", "height": "200", "width": "350", "labelWidth": 125, "url":"<?php echo basename($GLOBALS['script_name']); ?> ", "dialogtitle": "<?php echo $GLOBALS["messages"]["actarchive"]; ?> ", "frame": true, "items": [{ "xtype": "textfield", "fieldLabel": "<?php echo ext_Lang::msg('archive_name', true); ?> ", "name": "name", "value": "<?php echo $GLOBALS['item'] . '.' . $default_archive_type; ?> ", "width": "200" }, { "xtype": "combo", "fieldLabel": "<?php echo ext_Lang::msg('typeheader', true); ?> ", "store": [ ['zip', 'Zip (<?php echo ext_Lang::msg('normal_compression', true); ?> )'], ['tgz', 'Tar/Gz (<?php echo ext_Lang::msg('good_compression', true); ?> )'], <?php if (extension_loaded("bz2")) { echo "['tbz', 'Tar/Bzip2 (" . ext_Lang::msg('best_compression', true) . ")'],"; } ?> ['tar', 'Tar (<?php echo ext_Lang::msg('no_compression', true); ?> )'] ], "displayField":"typename", "valueField": "type", "name": "type", "value": "<?php echo $default_archive_type; ?> ", "triggerAction": "all", "hiddenName": "type", "disableKeyFilter": "true", "editable": "false", "mode": "local", "allowBlank": "false", "selectOnFocus":"true", "width": "200", "listeners": { "select": { fn: function(o, record ) { form = Ext.getCmp("simpleform").getForm(); var nameField = form.findField("name").getValue(); if( nameField.indexOf( '.' ) > 0 ) { form.findField('name').setValue( nameField.substring( 0, nameField.indexOf('.')+1 ) + o.getValue() ); } else { form.findField('name').setValue( nameField + '.'+ o.getValue()); } } } } }, { "xtype": "textfield", "fieldLabel": "<?php echo ext_Lang::msg('archive_saveToDir', true); ?> ", "name": "saveToDir", "value": "<?php echo str_replace("'", "\\'", $dir); ?> ", "width": "200" },{ "xtype": "checkbox", "fieldLabel": "<?php echo ext_Lang::msg('downlink', true); ?> ?", "name": "download", "checked": "true" } ], "buttons": [{ "text": "<?php echo ext_Lang::msg('btncreate', true); ?> ", "type": "submit", "handler": function() { Ext.ux.OnDemandLoad.load( "<?php echo $GLOBALS['script_name']; ?> ?option=com_extplorer&action=include_javascript&file=archive.js", function(options) { submitArchiveForm(0) } ); } },{ "text": "<?php echo ext_Lang::msg('btncancel', true); ?> ", "handler": function() { Ext.getCmp("dialog").destroy() } }] } <?php }