@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * update the local copy |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | -require_once dirname(dirname(__FILE__)) . "/config/_config.php"; |
|
| 27 | +require_once dirname(dirname(__FILE__))."/config/_config.php"; |
|
| 28 | 28 | setlocale(LC_CTYPE, "en_US.UTF-8"); |
| 29 | 29 | |
| 30 | 30 | class updateFromMonitor { |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $tmp_table = 'tmp_'.$table_name; |
| 114 | 114 | if ($this->tablesource[$table_name] == 'eduroam') { |
| 115 | 115 | $this->db_local->select_db('monitor_copy'); |
| 116 | - } elseif($this->tablesource[$table_name] == 'eduroamv2') { |
|
| 116 | + } elseif ($this->tablesource[$table_name] == 'eduroamv2') { |
|
| 117 | 117 | $this->db_local->select_db('eduroamv2'); |
| 118 | 118 | } |
| 119 | 119 | $this->db_local->query("CREATE TEMPORARY TABLE $tmp_table SELECT * FROM $table LIMIT 0"); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $this->db->query("SET NAMES 'utf8'"); |
| 123 | 123 | $this->db_local->query("SET NAMES 'utf8mb4'"); |
| 124 | 124 | $result = $this->db->query("SELECT * FROM $table"); |
| 125 | - $queryFields = implode(',', array_column($this->fields[$table_name],0)); |
|
| 125 | + $queryFields = implode(',', array_column($this->fields[$table_name], 0)); |
|
| 126 | 126 | while ($row = $result->fetch_assoc()) { |
| 127 | 127 | $v = []; |
| 128 | 128 | foreach ($this->fields[$table_name] as $field) { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | - $queryValues = implode(',',$v); |
|
| 143 | + $queryValues = implode(',', $v); |
|
| 144 | 144 | $query = "INSERT INTO $tmp_table (".$queryFields.") VALUES (".$queryValues.")"; |
| 145 | 145 | $this->db_local->query($query); |
| 146 | 146 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $tmp_table = 'tmp_'.$table_name; |
| 153 | 153 | if ($this->tablesource[$table_name] == 'eduroam') { |
| 154 | 154 | $this->db_local->select_db('monitor_copy'); |
| 155 | - } elseif($this->tablesource[$table_name] == 'eduroamv2') { |
|
| 155 | + } elseif ($this->tablesource[$table_name] == 'eduroamv2') { |
|
| 156 | 156 | $this->db_local->select_db('eduroamv2'); |
| 157 | 157 | } |
| 158 | 158 | $this->db_local->query("SET NAMES 'utf8mb4'"); |
@@ -161,9 +161,9 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | private function escape($inp) { |
| 164 | - $out=str_replace('\\','\\\\',$inp); |
|
| 165 | - $out=str_replace('"','\"',$out); |
|
| 166 | - $out=str_replace('?','\?',$out); |
|
| 164 | + $out = str_replace('\\', '\\\\', $inp); |
|
| 165 | + $out = str_replace('"', '\"', $out); |
|
| 166 | + $out = str_replace('?', '\?', $out); |
|
| 167 | 167 | $out = 'convert(cast(convert("'.$out.'" using latin1) as binary) using utf8)'; |
| 168 | 168 | return($out); |
| 169 | 169 | } |