@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * update the local copy |
25 | 25 | */ |
26 | 26 | |
27 | -require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php"; |
|
27 | +require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php"; |
|
28 | 28 | setlocale(LC_CTYPE, "en_US.UTF-8"); |
29 | 29 | require 'config.php'; |
30 | 30 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $this->db_ext->query("SET NAMES 'utf8'"); |
114 | 114 | $this->db_local->query("SET NAMES 'utf8mb4'"); |
115 | 115 | $result = $this->db_ext->query("SELECT * FROM $table"); |
116 | - $queryFields = implode(',', array_column($this->fields[$db][$table_name],0)); |
|
116 | + $queryFields = implode(',', array_column($this->fields[$db][$table_name], 0)); |
|
117 | 117 | while ($row = $result->fetch_assoc()) { |
118 | 118 | $v = []; |
119 | 119 | foreach ($this->fields[$db][$table_name] as $field) { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | } |
133 | 133 | } |
134 | - $queryValues = implode(',',$v); |
|
134 | + $queryValues = implode(',', $v); |
|
135 | 135 | $query = "INSERT INTO $tmpTable (".$queryFields.") VALUES (".$queryValues.")"; |
136 | 136 | $this->db_local->query($query); |
137 | 137 | } |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | $realms = explode(',', $row[1]); |
154 | 154 | foreach ($contacts as $contact) { |
155 | 155 | foreach ($realms as $realm) { |
156 | - $email = empty($contact['mail']) ? 'NULL' :'"'.$contact['mail'].'"'; |
|
157 | - $name = empty($contact['name']) ? 'NULL' :'"'.$contact['name'].'"'; |
|
158 | - $phone = empty($contact['phone']) ? 'NULL' :'"'.$contact['phone'].'"'; |
|
156 | + $email = empty($contact['mail']) ? 'NULL' : '"'.$contact['mail'].'"'; |
|
157 | + $name = empty($contact['name']) ? 'NULL' : '"'.$contact['name'].'"'; |
|
158 | + $phone = empty($contact['phone']) ? 'NULL' : '"'.$contact['phone'].'"'; |
|
159 | 159 | $id = $db == 'eduroam' ? $row[2] : '"'.$row[2].'"'; |
160 | 160 | $query = "INSERT INTO tmp_institution_admins (name, email, phone, inst_realm, $instid)" |
161 | 161 | . ' VALUES ('.$name.','.$email.','.$phone.',"'.$realm.'",'.$id.')'; |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | private function escape($inp) { |
178 | - $out=str_replace('\\','\\\\',$inp); |
|
179 | - $out=str_replace('"','\"',$out); |
|
180 | - $out=str_replace('?','\?',$out); |
|
178 | + $out = str_replace('\\', '\\\\', $inp); |
|
179 | + $out = str_replace('"', '\"', $out); |
|
180 | + $out = str_replace('?', '\?', $out); |
|
181 | 181 | $out = 'convert(cast(convert("'.$out.'" using latin1) as binary) using utf8)'; |
182 | 182 | return($out); |
183 | 183 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | $databases = [ |
4 | 4 | 'eduroam' => "eduroam1_1_tmp", // this is the local copy of eduroam (v1) database created by update_monitor_copy.php |
5 | 5 | 'eduroamv2' => "eduroam2_1_tmp", // this is the local copy of eduroam (v2) database created by update_monitor_copy.php |
6 | - 'cat' => "cat_twoln_214_test2", // this is the curent production CAT database where we need to put in new identifiers |
|
6 | + 'cat' => "cat_twoln_214_test2", // this is the curent production CAT database where we need to put in new identifiers |
|
7 | 7 | 'eduroam_new' => "monitor_copy2_test_xxx" // this is the resulting monitor_copy database containing all data required by CAT it must exist but tables will be created by the sript |
8 | 8 | ]; |
9 | 9 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php"; |
|
3 | +require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php"; |
|
4 | 4 | setlocale(LC_CTYPE, "en_US.UTF-8"); |
5 | 5 | require 'config.php'; |
6 | 6 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * |
9 | 9 | */ |
10 | 10 | |
11 | -require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php"; |
|
11 | +require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php"; |
|
12 | 12 | setlocale(LC_CTYPE, "en_US.UTF-8"); |
13 | 13 | require 'config.php'; |
14 | 14 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | // add CAT ids to view_active_institution2 |
132 | 132 | print "add CAT ids to view_active_institution2\n"; |
133 | -$q ="update view_active_institution2 join view_active_institution1 |
|
133 | +$q = "update view_active_institution2 join view_active_institution1 |
|
134 | 134 | on view_active_institution2.instid1=view_active_institution1.id_institution |
135 | 135 | set view_active_institution2.cat_sync_id=view_active_institution1.cat_sync_id"; |
136 | 136 | $result = $db_local->query($q); |