From: hickert Date: Fri, 4 May 2007 13:47:11 +0000 (+0000) Subject: Fixed Post Problems X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5da37856e28ed9296b5fa593baac620c1d868d15;p=gosa.git Fixed Post Problems git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6268 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/setup/class_setup.inc b/setup/class_setup.inc index a774c5043..ec662d910 100644 --- a/setup/class_setup.inc +++ b/setup/class_setup.inc @@ -18,8 +18,24 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Returns contents of the given POST variable and check magic quotes settings */ +function get_post($name) +{ + if(!isset($_POST[$name])){ + trigger_error("Requested POST value (".$name.") does not exists, you should add a check to prevent this message."); + return(FALSE); + } + if(get_magic_quotes_gpc()){ + return(stripcslashes($_POST[$name])); + }else{ + return($_POST[$name]); + } +} + require_once("class_setupStep.inc"); + class setup { var $i_steps = 9; // Number of setup steps diff --git a/setup/class_setupStep_Config1.inc b/setup/class_setupStep_Config1.inc index f5f0c5a56..a1e9c0b6b 100644 --- a/setup/class_setupStep_Config1.inc +++ b/setup/class_setupStep_Config1.inc @@ -145,7 +145,7 @@ class Step_Config1 extends setup_step /* Get attributes */ foreach($this->attributes as $attr){ if(isset($_POST[$attr])){ - $this->$attr = validate($_POST[$attr]); + $this->$attr = validate(get_post($attr)); } } @@ -163,7 +163,7 @@ class Step_Config1 extends setup_step if(isset($_POST['minid_active'])){ $this->id_settings['minid_active'] = TRUE; if(isset($_POST['minid'])){ - $this->id_settings['minid'] = $_POST['minid']; + $this->id_settings['minid'] = get_post('minid'); } }else{ $this->id_settings['minid_active'] = FALSE; @@ -173,7 +173,7 @@ class Step_Config1 extends setup_step if(isset($_POST['idgen_active'])){ $this->id_settings['idgen_active'] = TRUE; if(isset($_POST['idgen'])){ - $this->id_settings['idgen'] = $_POST['idgen']; + $this->id_settings['idgen'] = get_post('idgen'); } }else{ $this->id_settings['idgen_active'] = FALSE; @@ -183,7 +183,7 @@ class Step_Config1 extends setup_step if(isset($_POST['pwdiffer_active'])){ $this->pwd_rules['pwdiffer_active'] = TRUE; if(isset($_POST['pwdiffer'])){ - $this->pwd_rules['pwdiffer'] = $_POST['pwdiffer']; + $this->pwd_rules['pwdiffer'] = get_post('pwdiffer'); } }else{ $this->pwd_rules['pwdiffer_active'] = FALSE; @@ -193,7 +193,7 @@ class Step_Config1 extends setup_step if(isset($_POST['pwminlen_active'])){ $this->pwd_rules['pwminlen_active'] = TRUE; if(isset($_POST['pwminlen'])){ - $this->pwd_rules['pwminlen'] = $_POST['pwminlen']; + $this->pwd_rules['pwminlen'] = get_post('pwminlen'); } }else{ $this->pwd_rules['pwminlen_active'] = FALSE; @@ -203,7 +203,7 @@ class Step_Config1 extends setup_step if(isset($_POST['externalpwdhook_active'])){ $this->pwd_rules['externalpwdhook_active'] = TRUE; if(isset($_POST['externalpwdhook'])){ - $this->pwd_rules['externalpwdhook'] = $_POST['externalpwdhook']; + $this->pwd_rules['externalpwdhook'] = get_post('externalpwdhook'); } }else{ $this->pwd_rules['externalpwdhook_active'] = FALSE; @@ -213,7 +213,7 @@ class Step_Config1 extends setup_step if(isset($_POST['base_hook_active'])){ $this->pwd_rules['base_hook_active'] = TRUE; if(isset($_POST['base_hook'])){ - $this->pwd_rules['base_hook'] = $_POST['base_hook']; + $this->pwd_rules['base_hook'] = get_post('base_hook'); } }else{ $this->pwd_rules['base_hook_active'] = FALSE; diff --git a/setup/class_setupStep_Config2.inc b/setup/class_setupStep_Config2.inc index 31a430f55..d238af045 100644 --- a/setup/class_setupStep_Config2.inc +++ b/setup/class_setupStep_Config2.inc @@ -140,7 +140,7 @@ class Step_Config2 extends setup_step /* Get attributes */ foreach($this->attributes as $attr){ if(isset($_POST[$attr])){ - $this->$attr = validate($_POST[$attr]); + $this->$attr = validate(get_post($attr)); } } @@ -148,20 +148,20 @@ class Step_Config2 extends setup_step if(isset($_POST['vacationdir_active'])){ $this->mail_settings['vacationdir_active'] = TRUE; if(isset($_POST['vacationdir'])){ - $this->mail_settings['vacationdir'] = $_POST['vacationdir']; + $this->mail_settings['vacationdir'] = get_post('vacationdir'); } }else{ $this->mail_settings['vacationdir_active'] = FALSE; } if(isset($_POST['enableCopyPaste'])){ - $this->generic_settings['enableCopyPaste'] = $_POST['enableCopyPaste']; + $this->generic_settings['enableCopyPaste'] = get_post('enableCopyPaste'); } if(isset($_POST['wws_ou_active'])){ $this->generic_settings['wws_ou_active'] = TRUE; if(isset($_POST['wws_ou'])){ - $this->generic_settings['wws_ou'] = $_POST['wws_ou']; + $this->generic_settings['wws_ou'] = get_post('wws_ou'); } }else{ $this->generic_settings['wws_ou_active'] = FALSE; @@ -170,16 +170,16 @@ class Step_Config2 extends setup_step if(isset($_POST['snapshot_active'])){ $this->generic_settings['snapshot_active'] = TRUE; if(isset($_POST['snapshot_base'])){ - $this->generic_settings['snapshot_base'] = $_POST['snapshot_base']; + $this->generic_settings['snapshot_base'] = get_post('snapshot_base'); } if(isset($_POST['snapshot_user'])){ - $this->generic_settings['snapshot_user'] = $_POST['snapshot_user']; + $this->generic_settings['snapshot_user'] = get_post('snapshot_user'); } if(isset($_POST['snapshot_password'])){ - $this->generic_settings['snapshot_password'] = $_POST['snapshot_password']; + $this->generic_settings['snapshot_password'] = get_post('snapshot_password'); } if(isset($_POST['snapshot_server'])){ - $this->generic_settings['snapshot_server'] = $_POST['snapshot_server']; + $this->generic_settings['snapshot_server'] = get_post('snapshot_server'); } }else{ $this->generic_settings['snapshot_active'] = FALSE; @@ -189,7 +189,7 @@ class Step_Config2 extends setup_step if(isset($_POST['samba_sid_active'])){ $this->samba_settings['samba_sid_active'] = TRUE; if(isset($_POST['samba_sid'])){ - $this->samba_settings['samba_sid'] = $_POST['samba_sid']; + $this->samba_settings['samba_sid'] = get_post('samba_sid'); } }else{ $this->samba_settings['samba_sid_active'] = FALSE; @@ -197,13 +197,13 @@ class Step_Config2 extends setup_step if(isset($_POST['samba_rid_active'])){ $this->samba_settings['samba_rid_active'] = TRUE; if(isset($_POST['samba_rid'])){ - $this->samba_settings['samba_rid'] = $_POST['samba_rid']; + $this->samba_settings['samba_rid'] = get_post('samba_rid'); } }else{ $this->samba_settings['samba_rid_active'] = FALSE; } if(isset($_POST['smbhash'])){ - $this->samba_settings['smbhash'] = $_POST['smbhash']; + $this->samba_settings['smbhash'] = get_post('smbhash'); } if(!$this->sambaDomain_found){ diff --git a/setup/class_setupStep_Config3.inc b/setup/class_setupStep_Config3.inc index 88828512d..6140cd22a 100644 --- a/setup/class_setupStep_Config3.inc +++ b/setup/class_setupStep_Config3.inc @@ -89,20 +89,20 @@ class Step_Config3 extends setup_step /* Get attributes */ foreach($this->attributes as $attr){ if(isset($_POST[$attr])){ - $this->$attr = validate($_POST[$attr]); + $this->$attr = validate(get_post($attr)); } } foreach(array("strict_units","noprimarygroup","forceglobals","forcessl","ldapstats","warnssl","compile","debuglevel","session_lifetime") as $name){ if(isset($_POST[$name])){ - $this->optional[$name] = stripslashes($_POST[$name]); + $this->optional[$name] = get_post($name); } } if(isset($_POST['ppd_path_active'])){ $this->optional['ppd_path_active'] = TRUE; if(isset($_POST['ppd_path'])){ - $this->optional['ppd_path'] = $_POST['ppd_path']; + $this->optional['ppd_path'] = get_post('ppd_path'); } }else{ $this->optional['ppd_path_active'] = FALSE; @@ -111,7 +111,7 @@ class Step_Config3 extends setup_step if(isset($_POST['max_ldap_query_time_active'])){ $this->optional['max_ldap_query_time_active'] = TRUE; if(isset($_POST['max_ldap_query_time'])){ - $this->optional['max_ldap_query_time'] = $_POST['max_ldap_query_time']; + $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time'); } }else{ $this->optional['max_ldap_query_time_active'] = FALSE; @@ -120,7 +120,7 @@ class Step_Config3 extends setup_step if(isset($_POST['mailQueueScriptPath_active'])){ $this->optional['mailQueueScriptPath_active'] = TRUE; if(isset($_POST['mailQueueScriptPath'])){ - $this->optional['mailQueueScriptPath'] = $_POST['mailQueueScriptPath']; + $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath'); } }else{ $this->optional['mailQueueScriptPath_active'] = FALSE; @@ -129,7 +129,7 @@ class Step_Config3 extends setup_step if(isset($_POST['kioskpath_active'])){ $this->optional['kioskpath_active'] = TRUE; if(isset($_POST['kioskpath'])){ - $this->optional['kioskpath'] = $_POST['kioskpath']; + $this->optional['kioskpath'] = get_post('kioskpath'); } }else{ $this->optional['kioskpath_active'] = FALSE; @@ -138,7 +138,7 @@ class Step_Config3 extends setup_step if(isset($_POST['auto_network_hook_active'])){ $this->optional['auto_network_hook_active'] = TRUE; if(isset($_POST['auto_network_hook'])){ - $this->optional['auto_network_hook'] = $_POST['auto_network_hook']; + $this->optional['auto_network_hook'] = get_post('auto_network_hook'); } }else{ $this->optional['auto_network_hook_active'] = FALSE; @@ -147,7 +147,7 @@ class Step_Config3 extends setup_step if(isset($_POST['notifydir_active'])){ $this->optional['notifydir_active'] = TRUE; if(isset($_POST['notifydir'])){ - $this->optional['notifydir'] = $_POST['notifydir']; + $this->optional['notifydir'] = get_post('notifydir'); } }else{ $this->optional['notifydir_active'] = FALSE; diff --git a/setup/class_setupStep_Ldap.inc b/setup/class_setupStep_Ldap.inc index 429c4f164..79238f2ce 100644 --- a/setup/class_setupStep_Ldap.inc +++ b/setup/class_setupStep_Ldap.inc @@ -132,7 +132,7 @@ class Step_Ldap extends setup_step { foreach($this->attributes as $attr){ if(isset($_POST[$attr])){ - $this->$attr = $_POST[$attr]; + $this->$attr = get_post($attr); } } @@ -147,13 +147,13 @@ class Step_Ldap extends setup_step $this->dialog = $this->resolve_user; if(isset($_POST['resolve_filter'])){ - $this->resolve_filter = $_POST['resolve_filter']; + $this->resolve_filter = get_post('resolve_filter'); } if(isset($_POST['use_selected_user'])){ if(isset($_POST['admin_to_use'])){ - $this->admin = base64_decode($_POST['admin_to_use']); + $this->admin = base64_decode(get_post('admin_to_use')); $this->resolve_user = false; } } diff --git a/setup/setup_ldap.tpl b/setup/setup_ldap.tpl index 93ec3dc63..57b2ec93c 100644 --- a/setup/setup_ldap.tpl +++ b/setup/setup_ldap.tpl @@ -60,7 +60,7 @@ {html_options values=$namingContexts output=$namingContexts selected=$base} {else} - + {/if}