@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | 'class' => 'centercol', |
257 | 257 | ), |
258 | 258 | 'data' => array( |
259 | - 'function' => function ($entry) |
|
259 | + 'function' => function($entry) |
|
260 | 260 | { |
261 | 261 | return '<input type="checkbox" name="delete[]" value="' . $entry['id'] . '"' . ($entry['editable'] ? '' : ' disabled') . '>'; |
262 | 262 | }, |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | if (empty($entries[$k]['action_text'])) |
639 | 639 | $entries[$k]['action_text'] = isset($txt['modlog_ac_' . $entry['action']]) ? $txt['modlog_ac_' . $entry['action']] : $entry['action']; |
640 | 640 | $entries[$k]['action_text'] = preg_replace_callback('~\{([A-Za-z\d_]+)\}~i', |
641 | - function ($matches) use ($entries, $k) |
|
641 | + function($matches) use ($entries, $k) |
|
642 | 642 | { |
643 | 643 | return isset($entries[$k]['extra'][$matches[1]]) ? $entries[$k]['extra'][$matches[1]] : ''; |
644 | 644 | }, $entries[$k]['action_text']); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $table = str_replace('{db_prefix}', $db_prefix, $table); |
93 | 93 | |
94 | - $pg_tables = array('pg_catalog','information_schema'); |
|
94 | + $pg_tables = array('pg_catalog', 'information_schema'); |
|
95 | 95 | |
96 | 96 | $request = $smcFunc['db_query']('', ' |
97 | 97 | SELECT pg_relation_size(C.oid) AS "size" |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | global $db_connection; |
291 | 291 | static $ver; |
292 | 292 | |
293 | - if(!empty($ver)) |
|
293 | + if (!empty($ver)) |
|
294 | 294 | return $ver; |
295 | 295 | |
296 | 296 | $ver = pg_version($db_connection)['server']; |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | $smcFunc['db_drop_table']($table_name); |
123 | 123 | else if ($if_exists == 'update') |
124 | 124 | { |
125 | - $smcFunc['db_drop_table']($table_name.'_old'); |
|
125 | + $smcFunc['db_drop_table']($table_name . '_old'); |
|
126 | 126 | $smcFunc['db_transaction']('begin'); |
127 | 127 | $db_trans = true; |
128 | - $smcFunc['db_query']('',' |
|
129 | - ALTER TABLE '. $table_name .' RENAME TO ' . $table_name . '_old', |
|
128 | + $smcFunc['db_query']('', ' |
|
129 | + ALTER TABLE '. $table_name . ' RENAME TO ' . $table_name . '_old', |
|
130 | 130 | array( |
131 | 131 | 'security_override' => true, |
132 | 132 | ) |
@@ -213,15 +213,15 @@ discard block |
||
213 | 213 | { |
214 | 214 | $same_col = array(); |
215 | 215 | |
216 | - $request = $smcFunc['db_query']('',' |
|
216 | + $request = $smcFunc['db_query']('', ' |
|
217 | 217 | SELECT count(*), column_name |
218 | 218 | FROM information_schema.columns |
219 | 219 | WHERE table_name in ({string:table1},{string:table2}) AND table_schema = {string:schema} |
220 | 220 | GROUP BY column_name |
221 | 221 | HAVING count(*) > 1', |
222 | - array ( |
|
222 | + array( |
|
223 | 223 | 'table1' => $table_name, |
224 | - 'table2' => $table_name.'_old', |
|
224 | + 'table2' => $table_name . '_old', |
|
225 | 225 | 'schema' => 'public', |
226 | 226 | ) |
227 | 227 | ); |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | $same_col[] = $row['column_name']; |
232 | 232 | } |
233 | 233 | |
234 | - $smcFunc['db_query']('',' |
|
235 | - INSERT INTO ' . $table_name .'(' |
|
234 | + $smcFunc['db_query']('', ' |
|
235 | + INSERT INTO ' . $table_name . '(' |
|
236 | 236 | . implode($same_col, ',') . |
237 | 237 | ') |
238 | 238 | SELECT '. implode($same_col, ',') . ' |
@@ -232,7 +232,7 @@ |
||
232 | 232 | // In maintenance mode, only login is allowed and don't show OverlayDiv |
233 | 233 | echo ' |
234 | 234 | <ul class="floatleft welcome"> |
235 | - <li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl. '?action=login', 'return true;'), '</li> |
|
235 | + <li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl . '?action=login', 'return true;'), '</li> |
|
236 | 236 | </ul>'; |
237 | 237 | |
238 | 238 | if (!empty($modSettings['userLanguage']) && !empty($context['languages']) && count($context['languages']) > 1) |
@@ -945,7 +945,7 @@ |
||
945 | 945 | } |
946 | 946 | |
947 | 947 | echo isset($config_var['postinput']) ? ' |
948 | - ' . $config_var['postinput'] : '',' |
|
948 | + ' . $config_var['postinput'] : '', ' |
|
949 | 949 | </dd>'; |
950 | 950 | } |
951 | 951 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | 'class' => 'centercol', |
394 | 394 | ), |
395 | 395 | 'data' => array( |
396 | - 'function' => function ($rowData) |
|
396 | + 'function' => function($rowData) |
|
397 | 397 | { |
398 | 398 | return $rowData['selected'] ? '<span class="generic_icons valid"></span>' : ''; |
399 | 399 | }, |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | 'class' => 'centercol', |
454 | 454 | ), |
455 | 455 | 'data' => array( |
456 | - 'function' => function ($rowData) |
|
456 | + 'function' => function($rowData) |
|
457 | 457 | { |
458 | 458 | return $rowData['selected'] ? '' : sprintf('<input type="checkbox" name="smiley_set[%1$d]">', $rowData['id']); |
459 | 459 | }, |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | 'value' => $txt['smileys_location'], |
998 | 998 | ), |
999 | 999 | 'data' => array( |
1000 | - 'function' => function ($rowData) use ($txt) |
|
1000 | + 'function' => function($rowData) use ($txt) |
|
1001 | 1001 | { |
1002 | 1002 | if (empty($rowData['hidden'])) |
1003 | 1003 | return $txt['smileys_location_form']; |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | }, |
1009 | 1009 | ), |
1010 | 1010 | 'sort' => array( |
1011 | - 'default' => $smcFunc['db_custom_order']('hidden', array_keys($smiley_locations)) , |
|
1011 | + 'default' => $smcFunc['db_custom_order']('hidden', array_keys($smiley_locations)), |
|
1012 | 1012 | 'reverse' => $smcFunc['db_custom_order']('hidden', array_keys($smiley_locations), true), |
1013 | 1013 | ), |
1014 | 1014 | ), |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | 'value' => $txt['smileys_description'], |
1018 | 1018 | ), |
1019 | 1019 | 'data' => array( |
1020 | - 'function' => function ($rowData) use ($context, $txt, $modSettings, $smcFunc) |
|
1020 | + 'function' => function($rowData) use ($context, $txt, $modSettings, $smcFunc) |
|
1021 | 1021 | { |
1022 | 1022 | if (empty($modSettings['smileys_dir']) || !is_dir($modSettings['smileys_dir'])) |
1023 | 1023 | return $smcFunc['htmlspecialchars']($rowData['description']); |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | 'action' => $smcFunc['htmlspecialchars'](strtr($action['destination'], array($boarddir => '.'))) |
1555 | 1555 | ); |
1556 | 1556 | |
1557 | - $file = $packagesdir . '/temp/' . $base_path . $action['filename']; |
|
1557 | + $file = $packagesdir . '/temp/' . $base_path . $action['filename']; |
|
1558 | 1558 | if (isset($action['filename']) && (!file_exists($file) || !is_writable(dirname($action['destination'])))) |
1559 | 1559 | { |
1560 | 1560 | $context['has_failure'] = true; |
@@ -1599,7 +1599,7 @@ discard block |
||
1599 | 1599 | { |
1600 | 1600 | updateSettings(array( |
1601 | 1601 | 'smiley_sets_known' => $modSettings['smiley_sets_known'] . ',' . basename($action['action']), |
1602 | - 'smiley_sets_names' => $modSettings['smiley_sets_names'] . "\n" . $smileyInfo['name'] . (count($context['actions']) > 1 ? ' ' . (!empty($action['description']) ? $smcFunc['htmlspecialchars']($action['description']) : basename($action['action'])) : ''), |
|
1602 | + 'smiley_sets_names' => $modSettings['smiley_sets_names'] . "\n" . $smileyInfo['name'] . (count($context['actions']) > 1 ? ' ' . (!empty($action['description']) ? $smcFunc['htmlspecialchars']($action['description']) : basename($action['action'])) : ''), |
|
1603 | 1603 | )); |
1604 | 1604 | } |
1605 | 1605 | |
@@ -1611,7 +1611,7 @@ discard block |
||
1611 | 1611 | '{db_prefix}log_packages', |
1612 | 1612 | array( |
1613 | 1613 | 'filename' => 'string', 'name' => 'string', 'package_id' => 'string', 'version' => 'string', |
1614 | - 'id_member_installed' => 'int', 'member_installed' => 'string','time_installed' => 'int', |
|
1614 | + 'id_member_installed' => 'int', 'member_installed' => 'string', 'time_installed' => 'int', |
|
1615 | 1615 | 'install_state' => 'int', 'failed_steps' => 'string', 'themes_installed' => 'string', |
1616 | 1616 | 'member_removed' => 'int', 'db_changes' => 'string', 'credits' => 'string', |
1617 | 1617 | ), |
@@ -1860,7 +1860,7 @@ discard block |
||
1860 | 1860 | 'columns' => array( |
1861 | 1861 | 'icon' => array( |
1862 | 1862 | 'data' => array( |
1863 | - 'function' => function ($rowData) use ($settings, $smcFunc) |
|
1863 | + 'function' => function($rowData) use ($settings, $smcFunc) |
|
1864 | 1864 | { |
1865 | 1865 | $images_url = $settings[file_exists(sprintf('%1$s/images/post/%2$s.png', $settings['theme_dir'], $rowData['filename'])) ? 'actual_images_url' : 'default_images_url']; |
1866 | 1866 | return sprintf('<img src="%1$s/post/%2$s.png" alt="%3$s">', $images_url, $rowData['filename'], $smcFunc['htmlspecialchars']($rowData['title'])); |
@@ -1894,7 +1894,7 @@ discard block |
||
1894 | 1894 | 'value' => $txt['icons_board'], |
1895 | 1895 | ), |
1896 | 1896 | 'data' => array( |
1897 | - 'function' => function ($rowData) use ($txt) |
|
1897 | + 'function' => function($rowData) use ($txt) |
|
1898 | 1898 | { |
1899 | 1899 | return empty($rowData['board_name']) ? $txt['icons_edit_icons_all_boards'] : $rowData['board_name']; |
1900 | 1900 | }, |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function cleanCache($type = '') |
110 | 110 | { |
111 | - if($type == 'expired') |
|
112 | - $query = 'DELETE FROM cache WHERE ttl >= ' . time().';'; |
|
111 | + if ($type == 'expired') |
|
112 | + $query = 'DELETE FROM cache WHERE ttl >= ' . time() . ';'; |
|
113 | 113 | else |
114 | 114 | $query = 'DELETE FROM cache;'; |
115 | 115 | |
116 | 116 | $result = $this->cacheDB->exec($query); |
117 | 117 | |
118 | - $query = 'VACUUM;'; |
|
118 | + $query = 'VACUUM;'; |
|
119 | 119 | $this->cacheDB->exec($query); |
120 | 120 | |
121 | 121 | return $result; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | // If its invalid, use SMF's. |
158 | 158 | if (is_null($dir) || !is_writable($dir)) |
159 | - if(is_null($cachedir_sqlite) || !is_writable($cachedir_sqlite)) |
|
159 | + if (is_null($cachedir_sqlite) || !is_writable($cachedir_sqlite)) |
|
160 | 160 | $this->cachedir = $cachedir; |
161 | 161 | else |
162 | 162 | $this->cachedir = $cachedir_sqlite; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | { |
166 | 166 | global $db_connection, $db_prefix; |
167 | 167 | |
168 | - pg_query($db_connection, 'CREATE LOCAL TEMP TABLE IF NOT EXISTS ' . $db_prefix . 'cache_tmp AS SELECT * FROM ' . $db_prefix . 'cache WHERE ttl >= ' . time() ); |
|
168 | + pg_query($db_connection, 'CREATE LOCAL TEMP TABLE IF NOT EXISTS ' . $db_prefix . 'cache_tmp AS SELECT * FROM ' . $db_prefix . 'cache WHERE ttl >= ' . time()); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | { |
190 | 190 | global $db_connection, $db_prefix; |
191 | 191 | |
192 | - pg_query($db_connection, 'INSERT INTO ' . $db_prefix . 'cache SELECT * FROM '. $db_prefix . 'cache_tmp ON CONFLICT DO NOTHING'); |
|
192 | + pg_query($db_connection, 'INSERT INTO ' . $db_prefix . 'cache SELECT * FROM ' . $db_prefix . 'cache_tmp ON CONFLICT DO NOTHING'); |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 |
@@ -199,22 +199,22 @@ discard block |
||
199 | 199 | |
200 | 200 | case 'date': |
201 | 201 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1) |
202 | - return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]).'::date'; |
|
202 | + return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]) . '::date'; |
|
203 | 203 | else |
204 | 204 | smf_db_error_backtrace('Wrong value type sent to the database. Date expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
205 | 205 | break; |
206 | 206 | |
207 | 207 | case 'time': |
208 | 208 | if (preg_match('~^([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $time_matches) === 1) |
209 | - return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]).'::time'; |
|
209 | + return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]) . '::time'; |
|
210 | 210 | else |
211 | 211 | smf_db_error_backtrace('Wrong value type sent to the database. Time expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
212 | 212 | break; |
213 | 213 | |
214 | 214 | case 'datetime': |
215 | 215 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1) |
216 | - return 'to_timestamp('. |
|
217 | - sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5] ,$datetime_matches[6]). |
|
216 | + return 'to_timestamp(' . |
|
217 | + sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5], $datetime_matches[6]) . |
|
218 | 218 | ',\'YYYY-MM-DD HH24:MI:SS\')'; |
219 | 219 | else |
220 | 220 | smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | $old_pos = 0; |
425 | 425 | $pos = -1; |
426 | 426 | // Remove the string escape for better runtime |
427 | - $db_string_1 = str_replace('\'\'','',$db_string); |
|
427 | + $db_string_1 = str_replace('\'\'', '', $db_string); |
|
428 | 428 | while (true) |
429 | 429 | { |
430 | 430 | $pos = strpos($db_string_1, '\'', $pos + 1); |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | if (!empty($keys) && (count($keys) > 0) && $returnmode > 0) |
803 | 803 | { |
804 | 804 | // we only take the first key |
805 | - $returning = ' RETURNING '.$keys[0]; |
|
805 | + $returning = ' RETURNING ' . $keys[0]; |
|
806 | 806 | $with_returning = true; |
807 | 807 | } |
808 | 808 | |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | INSERT INTO ' . $table . '("' . implode('", "', $indexed_columns) . '") |
834 | 834 | VALUES |
835 | 835 | ' . implode(', |
836 | - ', $insertRows).$replace.$returning, |
|
836 | + ', $insertRows) . $replace . $returning, |
|
837 | 837 | array( |
838 | 838 | 'security_override' => true, |
839 | 839 | 'db_error_skip' => $method == 'ignore' || $table === $db_prefix . 'log_errors', |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | if ($returnmode === 2) |
847 | 847 | $return_var = array(); |
848 | 848 | |
849 | - while(($row = $smcFunc['db_fetch_row']($request)) && $with_returning) |
|
849 | + while (($row = $smcFunc['db_fetch_row']($request)) && $with_returning) |
|
850 | 850 | { |
851 | 851 | if (is_numeric($row[0])) // try to emulate mysql limitation |
852 | 852 | { |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | */ |
1010 | 1010 | function smf_db_custom_order($field, $array_values, $desc = false) |
1011 | 1011 | { |
1012 | - $return = 'CASE '. $field . ' '; |
|
1012 | + $return = 'CASE ' . $field . ' '; |
|
1013 | 1013 | $count = count($array_values); |
1014 | 1014 | $then = ($desc ? ' THEN -' : ' THEN '); |
1015 | 1015 |