Remove app_defaults.php a little more

This commit is contained in:
Mark Crane
2014-09-20 03:48:31 +00:00
parent 3105febebf
commit a556222bb0
+40 -38
View File
@@ -24,8 +24,7 @@
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
*/ */
//move the smtp settings from v_settings to the v_default_settings table if ($domains_processed == 1) {
if (count($_SESSION['email']) == 0 && $domains_processed == 1) {
//get the data from the database //get the data from the database
$sql = "select * from v_settings "; $sql = "select * from v_settings ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
@@ -78,43 +77,46 @@ if (count($_SESSION['email']) == 0 && $domains_processed == 1) {
unset($sql); unset($sql);
} }
else { else {
//set the variable //move the smtp settings from v_settings to the v_default_settings table
$smtp[]['smtp_host'] = check_str($row['smtp_host']); if (count($_SESSION['email']) == 0) {
$smtp[]['smtp_secure'] = check_str($row['smtp_secure']); //set the variable
$smtp[]['smtp_auth'] = check_str($row['smtp_auth']); $smtp[]['smtp_host'] = check_str($row['smtp_host']);
$smtp[]['smtp_username'] = check_str($row['smtp_username']); $smtp[]['smtp_secure'] = check_str($row['smtp_secure']);
$smtp[]['smtp_password'] = check_str($row['smtp_password']); $smtp[]['smtp_auth'] = check_str($row['smtp_auth']);
$smtp[]['smtp_from'] = check_str($row['smtp_from']); $smtp[]['smtp_username'] = check_str($row['smtp_username']);
$smtp[]['smtp_from_name'] = check_str($row['smtp_from_name']); $smtp[]['smtp_password'] = check_str($row['smtp_password']);
//build the sql inserts $smtp[]['smtp_from'] = check_str($row['smtp_from']);
foreach ($smtp as $row) { $smtp[]['smtp_from_name'] = check_str($row['smtp_from_name']);
foreach ($row as $key => $value) { //build the sql inserts
//add the provision variable to the default settings table foreach ($smtp as $row) {
$sql = "insert into v_default_settings "; foreach ($row as $key => $value) {
$sql .= "("; //add the provision variable to the default settings table
$sql .= "default_setting_uuid, "; $sql = "insert into v_default_settings ";
$sql .= "default_setting_category, "; $sql .= "(";
$sql .= "default_setting_subcategory, "; $sql .= "default_setting_uuid, ";
$sql .= "default_setting_name, "; $sql .= "default_setting_category, ";
$sql .= "default_setting_value, "; $sql .= "default_setting_subcategory, ";
$sql .= "default_setting_enabled, "; $sql .= "default_setting_name, ";
$sql .= "default_setting_description "; $sql .= "default_setting_value, ";
$sql .= ") "; $sql .= "default_setting_enabled, ";
$sql .= "values "; $sql .= "default_setting_description ";
$sql .= "("; $sql .= ") ";
$sql .= "'".uuid()."', "; $sql .= "values ";
$sql .= "'email', "; $sql .= "(";
$sql .= "'".$key."', "; $sql .= "'".uuid()."', ";
$sql .= "'var', "; $sql .= "'email', ";
$sql .= "'".check_str($value)."', "; $sql .= "'".$key."', ";
$sql .= "'true', "; $sql .= "'var', ";
$sql .= "'' "; $sql .= "'".check_str($value)."', ";
$sql .= ")"; $sql .= "'true', ";
//echo $sql."\n"; $sql .= "'' ";
$db->exec(check_sql($sql)); $sql .= ")";
unset($sql); //echo $sql."\n";
$db->exec(check_sql($sql));
unset($sql);
}
} }
} }
} }
} }