From a556222bb0b178b83939b57736e36d7c396d1dde Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sat, 20 Sep 2014 03:48:31 +0000 Subject: [PATCH] Remove app_defaults.php a little more --- app/settings/app_defaults.php | 78 ++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/app/settings/app_defaults.php b/app/settings/app_defaults.php index 139d987bc1..b054ccb60b 100644 --- a/app/settings/app_defaults.php +++ b/app/settings/app_defaults.php @@ -24,8 +24,7 @@ Mark J Crane */ -//move the smtp settings from v_settings to the v_default_settings table -if (count($_SESSION['email']) == 0 && $domains_processed == 1) { +if ($domains_processed == 1) { //get the data from the database $sql = "select * from v_settings "; $prep_statement = $db->prepare(check_sql($sql)); @@ -78,43 +77,46 @@ if (count($_SESSION['email']) == 0 && $domains_processed == 1) { unset($sql); } else { - //set the variable - $smtp[]['smtp_host'] = check_str($row['smtp_host']); - $smtp[]['smtp_secure'] = check_str($row['smtp_secure']); - $smtp[]['smtp_auth'] = check_str($row['smtp_auth']); - $smtp[]['smtp_username'] = check_str($row['smtp_username']); - $smtp[]['smtp_password'] = check_str($row['smtp_password']); - $smtp[]['smtp_from'] = check_str($row['smtp_from']); - $smtp[]['smtp_from_name'] = check_str($row['smtp_from_name']); - //build the sql inserts - foreach ($smtp as $row) { - foreach ($row as $key => $value) { - //add the provision variable to the default settings table - $sql = "insert into v_default_settings "; - $sql .= "("; - $sql .= "default_setting_uuid, "; - $sql .= "default_setting_category, "; - $sql .= "default_setting_subcategory, "; - $sql .= "default_setting_name, "; - $sql .= "default_setting_value, "; - $sql .= "default_setting_enabled, "; - $sql .= "default_setting_description "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'email', "; - $sql .= "'".$key."', "; - $sql .= "'var', "; - $sql .= "'".check_str($value)."', "; - $sql .= "'true', "; - $sql .= "'' "; - $sql .= ")"; - //echo $sql."\n"; - $db->exec(check_sql($sql)); - unset($sql); + //move the smtp settings from v_settings to the v_default_settings table + if (count($_SESSION['email']) == 0) { + //set the variable + $smtp[]['smtp_host'] = check_str($row['smtp_host']); + $smtp[]['smtp_secure'] = check_str($row['smtp_secure']); + $smtp[]['smtp_auth'] = check_str($row['smtp_auth']); + $smtp[]['smtp_username'] = check_str($row['smtp_username']); + $smtp[]['smtp_password'] = check_str($row['smtp_password']); + $smtp[]['smtp_from'] = check_str($row['smtp_from']); + $smtp[]['smtp_from_name'] = check_str($row['smtp_from_name']); + //build the sql inserts + foreach ($smtp as $row) { + foreach ($row as $key => $value) { + //add the provision variable to the default settings table + $sql = "insert into v_default_settings "; + $sql .= "("; + $sql .= "default_setting_uuid, "; + $sql .= "default_setting_category, "; + $sql .= "default_setting_subcategory, "; + $sql .= "default_setting_name, "; + $sql .= "default_setting_value, "; + $sql .= "default_setting_enabled, "; + $sql .= "default_setting_description "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'email', "; + $sql .= "'".$key."', "; + $sql .= "'var', "; + $sql .= "'".check_str($value)."', "; + $sql .= "'true', "; + $sql .= "'' "; + $sql .= ")"; + //echo $sql."\n"; + $db->exec(check_sql($sql)); + unset($sql); + } } - } + } } }