{ "xtype": "tabpanel", "width": "450", "id": "dialog_tabpanel", "dialogtitle": "", "listeners": { "afterrender": { fn: function(cmp) { cmp.activate(); } } }, "items": [{ "xtype": "form", "id": "passform", "autoHeight": "true", "headerAsText": false, "labelWidth": 125, "url":"", "title": "", "frame": true, "items": [{ "xtype": "textfield", "fieldLabel": "", "name": "oldpwd", "inputType": "password", "allowBlank":false }, { "xtype": "textfield", "fieldLabel": "", "name": "newpwd1", "hiddenName": "newpwd1", "inputType": "password", "allowBlank":false }, { "xtype": "textfield", "fieldLabel": "", "name": "newpwd2", "hiddenName": "newpwd2", "inputType": "password", "allowBlank":false }], "buttons": [{ "text": "", "handler": function() { frm = Ext.getCmp("passform").getForm(); if(frm.findField('newpwd1').getValue() != frm.findField('newpwd2').getValue() ) { Ext.Msg.alert("Error!", ""); return false; } if(frm.findField('oldpwd').getValue() ==frm.findField('newpwd1').getValue()) { Ext.Msg.alert("Error!", ""); return false; } statusBarMessage( "Please wait...", true ); frm.submit({ //reset: true, reset: false, "success": function(form, action) { 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": Ext.getCmp("passform"), // add some vars to the request, similar to hidden fields "params": { option: "com_extplorer", "action": "admin", "action2": "chpwd", "token": "" } }) } }] },{ "xtype": "form", "id": "userlist", "autoHeight": "true", "headerAsText": false, "labelWidth": 125, "url":"", title: "", "frame": true, "items": [{ 15) $user=substr($user,0,12)."..."; $home=$GLOBALS["users"][$i][2]; if(strlen($home)>30) $home=substr($home,0,27)."..."; ?> "xtype": "radio", "name": "nuser", "inputValue": "", "fieldLabel": "", "boxLabel": "Homedir: '.$home.'; ' .($GLOBALS["users"][$i][4] ? $GLOBALS["messages"]["miscyesno"][2]:$GLOBALS["messages"]["miscyesno"][3]).'; ' .$GLOBALS["users"][$i][6].'; ' .($GLOBALS["users"][$i][7] ? $GLOBALS["messages"]["miscyesno"][2]:$GLOBALS["messages"]["miscyesno"][3]); ?>" } ], "buttons": [{ "text": "", "handler": function() { Ext.Ajax.request( { url: "", "params": { "option": "com_extplorer","action": "admin","action2": "adduser", "token": "" }, "callback": function(oElement, bSuccess, oResponse) { if( !bSuccess ) { Ext.Msg.alert( "Ajax communication failure!"); } if( oResponse && oResponse.responseText ) { try{ json = Ext.decode( oResponse.responseText ); if( json.error && typeof json.error != 'xml' ) { Ext.Msg.alert( "", json.error ); dialog.destroy(); return false; } } catch(e) { return false; } Ext.getCmp("dialog_tabpanel").add( json ); Ext.getCmp("dialog_tabpanel").activate(json.id); Ext.getCmp("dialog").syncSize(); } } }); } }, { "text": "", "handler": function() { frm = Ext.getCmp("userlist").getForm(); try { theUser = frm.findField(0).getGroupValue(); } catch(e) { Ext.Msg.alert( "Error", "" ); return; } Ext.Ajax.request( { url: "", "params": { option: "com_extplorer","action": "admin","action2": "edituser","nuser":theUser, "token": "" }, "callback": function(oElement, bSuccess, oResponse) { if( !bSuccess ) { Ext.Msg.alert( "Ajax communication failure!"); } if( oResponse && oResponse.responseText ) { try{ json = Ext.decode( oResponse.responseText ); if( json.error && typeof json.error != 'xml' ) { Ext.Msg.alert( "", json.error ); dialog.destroy(); return false; } } catch(e) { return false; } Ext.getCmp("dialog_tabpanel").add( json ); Ext.getCmp("dialog_tabpanel").activate(json.id); Ext.getCmp("dialog").syncSize(); } } }); } }, { "text": "", "handler": function() { frm = Ext.getCmp("userlist").getForm(); try { theUser = frm.findField(0).getGroupValue(); } catch(e) { Ext.Msg.alert( "Error", "" ); return; } Ext.Msg.confirm( "", String.format( "", theUser ), function( btn ) { if( btn != 'yes') return; statusBarMessage( "Please wait...", true ); frm.submit({ "success": function(form, action) { statusBarMessage( action.result.message, false, true ); }, "failure": function(form, action) { if( !action.result ) return; Ext.MessageBox.alert("Error!", action.result.error); statusBarMessage( action.result.error, false, false ); }, "scope": Ext.getCmp("userlist").getForm(), // add some vars to the request, similar to hidden fields "params": { "option": "com_extplorer", "action": "admin", "action2": "rmuser", "user": theUser, "token": "" } }); }); } } ] }] } CheckPassword($GLOBALS['__POST']["oldpwd"], $data[1]); if(!$result) { $data=ext_find_user($GLOBALS['__SESSION']['credentials_extplorer']['username'],md5(stripslashes($GLOBALS['__POST']["oldpwd"]))); if($data==NULL) { ext_Result::sendResult('changepwd', false, $GLOBALS["error_msg"]["miscnouserpass"]); } } $data[1]=extEncodePassword(stripslashes($GLOBALS['__POST']["newpwd1"])); if(!ext_update_user($data[0],$data)) { ext_Result::sendResult('changepwd', false, $data[0].": ".$GLOBALS["error_msg"]["chpass"]); } require_once(_EXT_PATH.'/include/authentication/extplorer.php'); $auth = new ext_extplorer_authentication(); $auth->onAuthenticate(array('username'=>$data[0],'password'=>$data[1])); ext_Result::sendResult('changepwd', true, ext_Lang::msg('change_password_success')); } //------------------------------------------------------------------------------ function adduser($dir) { // Add User if(isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"]=="true" && ext_checkToken($GLOBALS['__POST']["token"]) ) { $user=stripslashes($GLOBALS['__POST']["nuser"]); if($user=="" || $GLOBALS['__POST']["home_dir"]=="") { ext_Result::sendResult('adduser', false, $GLOBALS["error_msg"]["miscfieldmissed"]); } if($GLOBALS['__POST']["pass1"]!=$GLOBALS['__POST']["pass2"]) { ext_Result::sendResult('adduser', false, $GLOBALS["error_msg"]["miscnopassmatch"]); } $data=ext_find_user($user,NULL); if($data!=NULL) { ext_Result::sendResult('adduser', false, $user.": ".$GLOBALS["error_msg"]["miscuserexist"]); } $data=array($user,extEncodePassword(stripslashes($GLOBALS['__POST']["pass1"])), stripslashes($GLOBALS['__POST']["home_dir"]),stripslashes($GLOBALS['__POST']["home_url"]), $GLOBALS['__POST']["show_hidden"],stripslashes($GLOBALS['__POST']["no_access"]), $GLOBALS['__POST']["permissions"],$GLOBALS['__POST']["active"]); if(!ext_add_user($data)) { ext_Result::sendResult('adduser', false, $user.": ".$GLOBALS["error_msg"]["adduser"]); } ext_Result::sendResult('adduser', true, $user.": The user has been added"); return; } show_userform(); } //------------------------------------------------------------------------------ function edituser($dir) { // Edit User $user=stripslashes($GLOBALS['__POST']["nuser"]); $data=ext_find_user($user,NULL); if( !ext_checkToken($GLOBALS['__POST']["token"]) ) { ext_Result::sendResult('tokencheck', false, 'CSRF Token Check failed.'); } if($data==NULL) { ext_Result::sendResult('edituser', false, $user.": ".$GLOBALS["error_msg"]["miscnofinduser"]); } if($self=($user==$GLOBALS['__SESSION']['credentials_extplorer']['username'])) $dir=""; if(isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"]=="true") { $nuser=stripslashes($GLOBALS['__POST']["nuser"]); if($nuser=="" || $GLOBALS['__POST']["home_dir"]=="") { ext_Result::sendResult('edituser', false, $GLOBALS["error_msg"]["miscfieldmissed"]); } if(isset($GLOBALS['__POST']["chpass"]) && $GLOBALS['__POST']["chpass"]=="on") { if($GLOBALS['__POST']["pass1"]!=$GLOBALS['__POST']["pass2"]) ext_Result::sendResult('edituser', false, $GLOBALS["error_msg"]["miscnopassmatch"]); $pass=extEncodePassword(stripslashes($GLOBALS['__POST']["pass1"])); } else { $pass=$data[1]; } if($self) $GLOBALS['__POST']["active"]=1; $data=array($nuser,$pass,stripslashes($GLOBALS['__POST']["home_dir"]), stripslashes($GLOBALS['__POST']["home_url"]),$GLOBALS['__POST']["show_hidden"], stripslashes($GLOBALS['__POST']["no_access"]),$GLOBALS['__POST']["permissions"],$GLOBALS['__POST']["active"]); if(!ext_update_user($user,$data)) { ext_Result::sendResult('edituser', false, $user.": ".$GLOBALS["error_msg"]["saveuser"]); } /*if($self) { activate_user($nuser,NULL); }*/ ext_Result::sendResult('edituser', true, $user.": ".ext_Lang::msg('User Profile has been updated')); } show_userform( $data); } function show_userform( $data = null ) { if( $data == null ) { $data = array('', '', '', '', '', '', '' ); } $formname = @$data[0] ? 'frmedituser' : 'frmadduser'; ?> { "xtype": "form", "id" : "", "renderTo": Ext.getCmp("dialog_tabpanel").getEl(), "hidden": true, "closable":true, "autoHeight": "true", "labelWidth": 125, "url":"", "title": "" , items: [{ "xtype": "textfield", "fieldLabel": "", "name": "nuser", "value": "", "width":175, "allowBlank":false },{ "xtype": "textfield", "fieldLabel": "", "name": "pass1", "inputType": "password", "width":175 }, { "xtype": "textfield", "fieldLabel": "", "name": "pass2", "inputType": "password", "width":175 }, { "xtype": "checkbox", "fieldLabel": "", "name": "chpass", "hiddenValue": "true" }, { "xtype": "textfield", "fieldLabel": "", "name": "home_dir", "value": "", "width":175, "allowBlank":false }, { "xtype": "textfield", "fieldLabel": "", "name": "home_url", "value": "", "width":175, "allowBlank":false },{ "xtype": "combo", "fieldLabel": "", "store": [ ["1", " 0), true ) ?>"], ["0", " 1), true ) ?>"] ], "hiddenName": "show_hidden", "disableKeyFilter": true, "value": "", "editable": false, "triggerAction": "all", "mode": "local", "allowBlank": false, "selectOnFocus":true }, { "xtype": "textfield", "fieldLabel": "", "name": "no_access", "value": "", "width":175, "allowBlank":true }, { "xtype": "combo", "fieldLabel": "", "store": [ $index)).'" ]'."\n"; if( $i+1<$permcount) echo ','; } ?> ], "hiddenName": "permissions", "disableKeyFilter": true, "value": "", "editable": false, "triggerAction": "all", "mode": "local" }, { "xtype": "combo", "fieldLabel": "", "store": [ ["1", " 0), true ) ?>"], ["0", " 1), true ) ?>"] ], "hiddenName": "active", "disableKeyFilter": true, "value": "", "disabled": , "editable": false, "triggerAction": "all", "mode": "local", "allowBlank": false, "selectOnFocus":true } ], "buttons": [ { "text": "", "handler": function() { userform = Ext.getCmp("").getForm(); if(userform.findField('nuser').getValue()=="" || userform.findField('home_dir').getValue()=="") { Ext.Msg.alert('Status', ""); return false; } if( userform.findField('chpass') ) { if(userform.findField('chpass').getValue() && userform.findField('pass1').getValue() != userform.findField('pass2').getValue()) { Ext.Msg.alert('Status', ""); return false; } } statusBarMessage( 'Please wait...', true ); userform.submit({ "success": function(form, action) { statusBarMessage( action.result.message, false, true ); Ext.getCmp("dialog_tabpanel").remove(""); }, "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": "", "confirm": "true", "token": "" } }) } },{ "text": "", "handler": function() { Ext.getCmp("dialog_tabpanel").remove(""); } }] }