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 target for the symbolic link.'); } if (!down_home(dirname($symlink_target))) { ext_Result::sendResult('', false, $symlink_target.": ".$GLOBALS["error_msg"]["abovehome"]); } 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":"", "dialogtitle": "Create New File/Directory", "frame": true, "items": [{ "xtype": "textfield", "fieldLabel": "", "name": "mkname", "width":175, "allowBlank":false },{ "xtype": "combo", "fieldLabel": "Type", "store": [["file", ""], ["dir", ""] ,["symlink", ""] ], displayField:"type", valueField: "mktype", value: "file", hiddenName: "mktype", disableKeyFilter: true, editable: false, triggerAction: "all", mode: "local", allowBlank: false, selectOnFocus:true },{ "xtype": "textfield", "fieldLabel": "", "name": "symlink_target", "width":175, "allowBlank":true }], "buttons": [{ "text": "", "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: "" } }) } },{ "text": "", "handler": function() { Ext.getCmp("dialog").destroy(); } }] }