@@ -52,10 +52,11 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function cleanup($bind) { |
54 | 54 | if ( ! is_array($bind)) { |
55 | - if ( ! empty($bind)) |
|
56 | - $bind = array($bind); |
|
57 | - else |
|
58 | - $bind = array(); |
|
55 | + if ( ! empty($bind)) { |
|
56 | + $bind = array($bind); |
|
57 | + } else { |
|
58 | + $bind = array(); |
|
59 | + } |
|
59 | 60 | } |
60 | 61 | return $bind; |
61 | 62 | } |
@@ -68,10 +69,11 @@ discard block |
||
68 | 69 | try { |
69 | 70 | $pdostmt = $this->prepare($this->sql); |
70 | 71 | if ($pdostmt->execute($this->bind) !== false) { |
71 | - if (preg_match("/^(".implode("|", array("select", "describe", "pragma")).") /i", $this->sql)) |
|
72 | - return $pdostmt->fetchAll(PDO::FETCH_ASSOC); |
|
73 | - elseif (preg_match("/^(".implode("|", array("delete", "insert", "update")).") /i", $this->sql)) |
|
74 | - return $pdostmt->rowCount(); |
|
72 | + if (preg_match("/^(".implode("|", array("select", "describe", "pragma")).") /i", $this->sql)) { |
|
73 | + return $pdostmt->fetchAll(PDO::FETCH_ASSOC); |
|
74 | + } elseif (preg_match("/^(".implode("|", array("delete", "insert", "update")).") /i", $this->sql)) { |
|
75 | + return $pdostmt->rowCount(); |
|
76 | + } |
|
75 | 77 | } |
76 | 78 | } catch (PDOException $e) { |
77 | 79 | $this->error = $e->getMessage(); |
@@ -154,8 +154,9 @@ |
||
154 | 154 | |
155 | 155 | $sp_gw_settings = json_decode($sp_gw_value['gateway_data'], true); |
156 | 156 | foreach ($sp_gw_settings as $sp_gw_settings_key => $sp_gw_settings_value) { |
157 | - if ($sp_gw_settings_value != "") |
|
158 | - $xml .= " <param name=\"" . $sp_gw_settings_key . "\" value=\"" . $sp_gw_settings_value . "\"/>\n"; |
|
157 | + if ($sp_gw_settings_value != "") { |
|
158 | + $xml .= " <param name=\"" . $sp_gw_settings_key . "\" value=\"" . $sp_gw_settings_value . "\"/>\n"; |
|
159 | + } |
|
159 | 160 | } |
160 | 161 | $xml .= " </gateway>\n"; |
161 | 162 | } |
@@ -29,22 +29,25 @@ |
||
29 | 29 | function logger($lib) { |
30 | 30 | $this->config = $lib->config; |
31 | 31 | $this->config['log_path'] = "/var/log/astpp/"; |
32 | - if ($this->config['debug'] == '0') |
|
33 | - $this->fp = fopen($this->config['log_path'] . 'astpp_' . date('Y-m-d') . '.txt', 'a'); |
|
32 | + if ($this->config['debug'] == '0') { |
|
33 | + $this->fp = fopen($this->config['log_path'] . 'astpp_' . date('Y-m-d') . '.txt', 'a'); |
|
34 | + } |
|
34 | 35 | } |
35 | 36 | |
36 | 37 | function log($log) { |
37 | 38 | if ($this->config['debug'] == '0') { |
38 | - if (is_array($log)) |
|
39 | - fwrite($this->fp, "[" . date('Y-m-d H:i:s') . "] " . print_r($log, TRUE)); |
|
40 | - else |
|
41 | - fwrite($this->fp, "[" . date('Y-m-d H:i:s') . "] " . $log . "\n"); |
|
39 | + if (is_array($log)) { |
|
40 | + fwrite($this->fp, "[" . date('Y-m-d H:i:s') . "] " . print_r($log, TRUE)); |
|
41 | + } else { |
|
42 | + fwrite($this->fp, "[" . date('Y-m-d H:i:s') . "] " . $log . "\n"); |
|
43 | + } |
|
42 | 44 | } |
43 | 45 | } |
44 | 46 | |
45 | 47 | function close() { |
46 | - if ($this->config['debug'] == '0') |
|
47 | - fclose($this->fp); |
|
48 | + if ($this->config['debug'] == '0') { |
|
49 | + fclose($this->fp); |
|
50 | + } |
|
48 | 51 | } |
49 | 52 | |
50 | 53 | } |
@@ -28,10 +28,11 @@ |
||
28 | 28 | |
29 | 29 | if (isset($_REQUEST['user']) && isset($_REQUEST['domain'])) { |
30 | 30 | $xml = load_directory($logger, $db); |
31 | - if ($xml == "") |
|
32 | - xml_not_found(); |
|
31 | + if ($xml == "") { |
|
32 | + xml_not_found(); |
|
33 | + } |
|
33 | 34 | echo $xml; |
34 | -}else { |
|
35 | +} else { |
|
35 | 36 | xml_not_found(); |
36 | 37 | } |
37 | 38 | $logger->log("*************************** Directory Ends **********************************"); |