Unset the prepared statements used in the app_defaults.php files.

This commit is contained in:
Mark Crane
2014-07-23 22:00:03 +00:00
parent 411e0d7733
commit 5e0d82c06d
12 changed files with 54 additions and 35 deletions

View File

@@ -125,6 +125,7 @@
$db->query($sql);
unset($sql);
}
unset($prep_statement);
}
}
@@ -153,6 +154,7 @@
$db->query($sql);
unset($sql);
}
unset($prep_statement);
}
}

View File

@@ -45,8 +45,8 @@
$db->exec(check_sql($sql));
unset($sql);
}
unset($prep_statement, $result);
}
unset($prep_statement, $result);
//move the dynamic provision variables that from v_vars table to v_default_settings
if (count($_SESSION['provision']) == 0 && $domains_processed == 1) {
@@ -86,6 +86,7 @@
$db->exec(check_sql($sql));
unset($sql);
}
unset($prep_statement);
//delete the provision variables from system -> variables
//$sql = "delete from v_vars ";
//$sql .= "where var_cat = 'Provision' ";

View File

@@ -31,6 +31,7 @@ if (count($_SESSION['email']) == 0 && $domains_processed == 1) {
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_NAMED);
unset($prep_statement);
//set the variable
$smtp[]['smtp_host'] = check_str($row['smtp_host']);
$smtp[]['smtp_secure'] = check_str($row['smtp_secure']);

View File

@@ -112,6 +112,7 @@
}
}
}
unset($prep_statement);
}
}

View File

@@ -108,8 +108,8 @@ EOD;
$x++;
}
}
unset($prep_statement, $result);
}
unset($prep_statement, $result);
}
//adjust the variables required variables
@@ -145,6 +145,7 @@ EOD;
$db->exec(check_sql($sql));
unset($sql);
}
unset($prep_statement, $row);
}
//set the transfer_ringback
@@ -178,6 +179,7 @@ EOD;
$db->exec(check_sql($sql));
unset($sql);
}
unset($prep_statement, $row);
}
//set variables that depend on the number of domains
@@ -221,6 +223,7 @@ EOD;
$db->exec(check_sql($sql));
unset($sql);
}
unset($prep_statement, $row);
}
}

View File

@@ -81,6 +81,7 @@
$message = $orm->message;
//print_r($message);
}
unset($row);
}
}

View File

@@ -49,6 +49,7 @@ if ($domains_processed == 1) {
$db->exec(check_sql($sql));
unset($sql);
}
unset($prep_statement, $result);
//replace the backslash with a forward slash
$db_path = str_replace("\\", "/", $db_path);
@@ -62,6 +63,7 @@ if ($domains_processed == 1) {
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
unset($prep_statement);
if ($row['num_rows'] > 0) {
$odbc_num_rows = $row['num_rows'];
@@ -95,6 +97,7 @@ if ($domains_processed == 1) {
foreach ($result as &$row) {
$recordings_dir = $row["default_setting_value"];
}
unset($prep_statement, $result);
}
//config.lua

View File

@@ -60,6 +60,7 @@ if ($domains_processed == 1) {
$db->exec(check_sql($sql));
unset($sql);
}
unset($prep_statement, $row);
}
//ensure that the default password length and strength are set
@@ -109,6 +110,7 @@ if ($domains_processed == 1) {
$db->exec(check_sql($sql));
unset($sql);
}
unset($prep_statement, $row);
}
//set the sip_profiles directory for older installs

View File

@@ -116,6 +116,7 @@
}
}
}
unset($prep_statement);
}
?>

View File

@@ -47,6 +47,7 @@ if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
$db->exec(check_sql($sql));
unset($sql);
}
unset($prep_statement, $row);
}
}
}

View File

@@ -73,6 +73,7 @@ if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
$db->exec(check_sql($sql));
unset($sql);
}
unset($prep_statement, $row);
}
//ensure the login message is set, if new message exists
@@ -84,6 +85,7 @@ if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
unset($prep_statement);
if ($row['num_rows'] == 0) {
// insert message
@@ -141,8 +143,8 @@ if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
unset($sql);
}
}
unset($prep_statement, $result);
}
unset($sql, $result);
}
}

View File

@@ -76,8 +76,8 @@
}
}
}
unset($prep_statement, $sub_result);
}
unset($prep_statement, $sub_result);
//if there are no permissions listed in v_group_permissions then set the default permissions
$sql = "select count(*) as count from v_group_permissions ";
@@ -129,13 +129,38 @@
$sql .= "and user_uuid is null; ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach($result as $row) {
if (strlen($row['username']) > 0) {
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach($result as $row) {
if (strlen($row['username']) > 0) {
//get the user_uuid
$sql = "select user_uuid from v_users ";
$sql .= "where username = '".$row['username']."' ";
$sql .= "and user_enabled = 'true' ";
$prep_statement_sub = $db->prepare($sql);
$prep_statement_sub->execute();
$sub_result = $prep_statement_sub->fetch(PDO::FETCH_ASSOC);
unset ($prep_statement_sub);
$user_uuid = $sub_result['user_uuid'];
//set the user uuid
$sql = "update v_group_users set ";
$sql .= "user_uuid = '".$user_uuid."' ";
$sql .= "where username = '".$row['username']."'; ";
$db->exec($sql);
unset($sql);
}
else {
//get the number of users
$sql = "select count(*) as num_rows from v_users ";
$sql .= "where user_enabled = 'true' ";
$prep_statement_sub = $db->prepare($sql);
$prep_statement_sub->execute();
$sub_result = $prep_statement_sub->fetch(PDO::FETCH_ASSOC);
unset ($prep_statement_sub);
$num_rows = $sub_result['num_rows'];
if ($num_rows == 1) {
//get the user_uuid
$sql = "select user_uuid from v_users ";
$sql .= "where username = '".$row['username']."' ";
$sql .= "and user_enabled = 'true' ";
$prep_statement_sub = $db->prepare($sql);
$prep_statement_sub->execute();
@@ -145,36 +170,12 @@
//set the user uuid
$sql = "update v_group_users set ";
$sql .= "user_uuid = '".$user_uuid."' ";
$sql .= "where username = '".$row['username']."'; ";
$db->exec($sql);
unset($sql);
}
else {
//get the number of users
$sql = "select count(*) as num_rows from v_users ";
$sql .= "where user_enabled = 'true' ";
$prep_statement_sub = $db->prepare($sql);
$prep_statement_sub->execute();
$sub_result = $prep_statement_sub->fetch(PDO::FETCH_ASSOC);
unset ($prep_statement_sub);
$num_rows = $sub_result['num_rows'];
if ($num_rows == 1) {
//get the user_uuid
$sql = "select user_uuid from v_users ";
$sql .= "and user_enabled = 'true' ";
$prep_statement_sub = $db->prepare($sql);
$prep_statement_sub->execute();
$sub_result = $prep_statement_sub->fetch(PDO::FETCH_ASSOC);
unset ($prep_statement_sub);
$user_uuid = $sub_result['user_uuid'];
//set the user uuid
$sql = "update v_group_users set ";
$sql .= "user_uuid = '".$user_uuid."' ";
$db->exec($sql);
unset($sql);
}
}
}
}
unset ($prep_statement);
}
//if there are no permissions listed in v_group_permissions then set the default permissions