@@ -1859,7 +1859,7 @@ |
||
| 1859 | 1859 | global $txt, $context, $user_info, $language, $modSettings; |
| 1860 | 1860 | |
| 1861 | 1861 | // Check that this feature is even enabled! |
| 1862 | - $pmsg_check = $this->_req->getPost('pmsg', 'intval', $this->_req->getQuery('pmsg', 'intval', 0)); |
|
| 1862 | + $pmsg_check = $this->_req->getPost('pmsg', 'intval', $this->_req->getQuery('pmsg', 'intval', 0)); |
|
| 1863 | 1863 | if (empty($modSettings['enableReportPM']) || empty($pmsg_check)) |
| 1864 | 1864 | { |
| 1865 | 1865 | throw new Elk_Exception('no_access', false); |
@@ -633,7 +633,9 @@ discard block |
||
| 633 | 633 | // Get the order right. |
| 634 | 634 | $orderBy = array(); |
| 635 | 635 | foreach (array_reverse($pms) as $pm) |
| 636 | - $orderBy[] = 'pm.id_pm = ' . $pm; |
|
| 636 | + { |
|
| 637 | + $orderBy[] = 'pm.id_pm = ' . $pm; |
|
| 638 | + } |
|
| 637 | 639 | |
| 638 | 640 | // Separate query for these bits, preparePMContext_callback will use it as required |
| 639 | 641 | $subjects_request = loadPMSubjectRequest($pms, $orderBy); |
@@ -894,7 +896,9 @@ discard block |
||
| 894 | 896 | // Get a literal name list in case the user has JavaScript disabled. |
| 895 | 897 | $names = array(); |
| 896 | 898 | foreach ($context['recipients']['to'] as $to) |
| 897 | - $names[] = $to['name']; |
|
| 899 | + { |
|
| 900 | + $names[] = $to['name']; |
|
| 901 | + } |
|
| 898 | 902 | $context['to_value'] = empty($names) ? '' : '"' . implode('", "', $names) . '"'; |
| 899 | 903 | } |
| 900 | 904 | else |
@@ -963,8 +967,7 @@ discard block |
||
| 963 | 967 | && !allowedTo(array('admin_forum', 'moderate_forum', 'send_mail')) |
| 964 | 968 | && $user_info['mod_cache']['bq'] === '0=1' |
| 965 | 969 | && $user_info['mod_cache']['gq'] === '0=1' |
| 966 | - ) |
|
| 967 | - { |
|
| 970 | + ) { |
|
| 968 | 971 | // How many have they sent this last hour? |
| 969 | 972 | $pmCount = pmCount($user_info['id'], 3600); |
| 970 | 973 | |
@@ -1095,7 +1098,9 @@ discard block |
||
| 1095 | 1098 | $post_errors->removeError('no_to'); |
| 1096 | 1099 | |
| 1097 | 1100 | foreach ($namesNotFound[$recipientType] as $name) |
| 1098 | - $context['send_log']['failed'][] = sprintf($txt['pm_error_user_not_found'], $name); |
|
| 1101 | + { |
|
| 1102 | + $context['send_log']['failed'][] = sprintf($txt['pm_error_user_not_found'], $name); |
|
| 1103 | + } |
|
| 1099 | 1104 | } |
| 1100 | 1105 | } |
| 1101 | 1106 | } |
@@ -1166,7 +1171,9 @@ discard block |
||
| 1166 | 1171 | { |
| 1167 | 1172 | $post_errors->addError('bad_' . $recipientType); |
| 1168 | 1173 | foreach ($names as $name) |
| 1169 | - $context['send_log']['failed'][] = sprintf($txt['pm_error_user_not_found'], $name); |
|
| 1174 | + { |
|
| 1175 | + $context['send_log']['failed'][] = sprintf($txt['pm_error_user_not_found'], $name); |
|
| 1176 | + } |
|
| 1170 | 1177 | } |
| 1171 | 1178 | |
| 1172 | 1179 | $this->messagePostError($namedRecipientList, $recipientList); |
@@ -1440,12 +1447,16 @@ discard block |
||
| 1440 | 1447 | { |
| 1441 | 1448 | $pm_actions = array(); |
| 1442 | 1449 | foreach ($this->_req->post->pms as $pm) |
| 1443 | - $pm_actions[(int) $pm] = $pm_action; |
|
| 1450 | + { |
|
| 1451 | + $pm_actions[(int) $pm] = $pm_action; |
|
| 1452 | + } |
|
| 1444 | 1453 | } |
| 1445 | 1454 | |
| 1446 | 1455 | // No messages to action then bug out |
| 1447 | 1456 | if (empty($pm_actions)) |
| 1448 | - redirectexit($context['current_label_redirect']); |
|
| 1457 | + { |
|
| 1458 | + redirectexit($context['current_label_redirect']); |
|
| 1459 | + } |
|
| 1449 | 1460 | |
| 1450 | 1461 | // If we are in conversation, we may need to apply this to every message in that conversation. |
| 1451 | 1462 | if ($context['display_mode'] == 2 && isset($this->_req->query->conversation)) |
@@ -1716,7 +1727,9 @@ discard block |
||
| 1716 | 1727 | if (!empty($new_labels)) |
| 1717 | 1728 | { |
| 1718 | 1729 | for ($i = max($searchArray) + 1, $n = max(array_keys($new_labels)); $i <= $n; $i++) |
| 1719 | - $searchArray[] = $i; |
|
| 1730 | + { |
|
| 1731 | + $searchArray[] = $i; |
|
| 1732 | + } |
|
| 1720 | 1733 | } |
| 1721 | 1734 | |
| 1722 | 1735 | updateLabelsToPM($searchArray, $new_labels, $user_info['id']); |
@@ -1754,9 +1767,11 @@ discard block |
||
| 1754 | 1767 | |
| 1755 | 1768 | // Update/delete as appropriate. |
| 1756 | 1769 | foreach ($rule_changes as $k => $id) |
| 1757 | - if (!empty($context['rules'][$id]['actions'])) |
|
| 1770 | + { |
|
| 1771 | + if (!empty($context['rules'][$id]['actions'])) |
|
| 1758 | 1772 | { |
| 1759 | 1773 | updatePMRuleAction($id, $user_info['id'], $context['rules'][$id]['actions']); |
| 1774 | + } |
|
| 1760 | 1775 | unset($rule_changes[$k]); |
| 1761 | 1776 | } |
| 1762 | 1777 | |
@@ -1918,7 +1933,9 @@ discard block |
||
| 1918 | 1933 | $recipients = array(); |
| 1919 | 1934 | $temp = loadPMRecipientsAll($context['pm_id'], true); |
| 1920 | 1935 | foreach ($temp as $recipient) |
| 1921 | - $recipients[] = $recipient['link']; |
|
| 1936 | + { |
|
| 1937 | + $recipients[] = $recipient['link']; |
|
| 1938 | + } |
|
| 1922 | 1939 | |
| 1923 | 1940 | // Now let's get out and loop through the admins. |
| 1924 | 1941 | $admins = admins(isset($this->_req->post->id_admin) ? (int) $this->_req->post->id_admin : 0); |
@@ -1970,7 +1987,9 @@ discard block |
||
| 1970 | 1987 | |
| 1971 | 1988 | // Send a different email for each language. |
| 1972 | 1989 | foreach ($messagesToSend as $lang => $message) |
| 1973 | - sendpm($message['recipients'], $message['subject'], $message['body']); |
|
| 1990 | + { |
|
| 1991 | + sendpm($message['recipients'], $message['subject'], $message['body']); |
|
| 1992 | + } |
|
| 1974 | 1993 | |
| 1975 | 1994 | // Give the user their own language back! |
| 1976 | 1995 | if (!empty($modSettings['userLanguage'])) |
@@ -2089,9 +2108,11 @@ discard block |
||
| 2089 | 2108 | |
| 2090 | 2109 | // Need to get member names! |
| 2091 | 2110 | foreach ($context['rule']['criteria'] as $k => $criteria) |
| 2092 | - if ($criteria['t'] === 'mid' && !empty($criteria['v'])) |
|
| 2111 | + { |
|
| 2112 | + if ($criteria['t'] === 'mid' && !empty($criteria['v'])) |
|
| 2093 | 2113 | { |
| 2094 | 2114 | $members[(int) $criteria['v']] = $k; |
| 2115 | + } |
|
| 2095 | 2116 | } |
| 2096 | 2117 | |
| 2097 | 2118 | if (!empty($members)) |
@@ -2099,7 +2120,9 @@ discard block |
||
| 2099 | 2120 | require_once(SUBSDIR . '/Members.subs.php'); |
| 2100 | 2121 | $result = getBasicMemberData(array_keys($members)); |
| 2101 | 2122 | foreach ($result as $row) |
| 2102 | - $context['rule']['criteria'][$members[$row['id_member']]]['v'] = $row['member_name']; |
|
| 2123 | + { |
|
| 2124 | + $context['rule']['criteria'][$members[$row['id_member']]]['v'] = $row['member_name']; |
|
| 2125 | + } |
|
| 2103 | 2126 | } |
| 2104 | 2127 | } |
| 2105 | 2128 | else |
@@ -2226,7 +2249,9 @@ discard block |
||
| 2226 | 2249 | checkSession('post'); |
| 2227 | 2250 | $toDelete = array(); |
| 2228 | 2251 | foreach ($this->_req->post->delrule as $k => $v) |
| 2229 | - $toDelete[] = (int) $k; |
|
| 2252 | + { |
|
| 2253 | + $toDelete[] = (int) $k; |
|
| 2254 | + } |
|
| 2230 | 2255 | |
| 2231 | 2256 | if (!empty($toDelete)) |
| 2232 | 2257 | { |
@@ -2621,7 +2646,9 @@ discard block |
||
| 2621 | 2646 | |
| 2622 | 2647 | $labelStatements = array(); |
| 2623 | 2648 | foreach ($this->_req->post->searchlabel as $label) |
| 2624 | - $labelStatements[] = $db->quote('FIND_IN_SET({string:label}, pmr.labels) != 0', array('label' => $label,)); |
|
| 2649 | + { |
|
| 2650 | + $labelStatements[] = $db->quote('FIND_IN_SET({string:label}, pmr.labels) != 0', array('label' => $label,)); |
|
| 2651 | + } |
|
| 2625 | 2652 | |
| 2626 | 2653 | $this->_searchq_parameters ['label_implode'] = '(' . implode(' OR ', $labelStatements) . ')'; |
| 2627 | 2654 | } |
@@ -2665,7 +2692,9 @@ discard block |
||
| 2665 | 2692 | $members = membersBy('member_names', array('member_names' => $possible_users)); |
| 2666 | 2693 | |
| 2667 | 2694 | foreach ($possible_users as $key => $possible_user) |
| 2668 | - $this->_searchq_parameters ['guest_user_name_implode_' . $key] = defined('DB_CASE_SENSITIVE') ? strtolower($possible_user) : $possible_user; |
|
| 2695 | + { |
|
| 2696 | + $this->_searchq_parameters ['guest_user_name_implode_' . $key] = defined('DB_CASE_SENSITIVE') ? strtolower($possible_user) : $possible_user; |
|
| 2697 | + } |
|
| 2669 | 2698 | |
| 2670 | 2699 | // Simply do nothing if there are too many members matching the criteria. |
| 2671 | 2700 | if (count($members) > $maxMembersToSearch) |
@@ -2679,7 +2708,9 @@ discard block |
||
| 2679 | 2708 | $uq = array(); |
| 2680 | 2709 | $name = defined('DB_CASE_SENSITIVE') ? 'LOWER(pm.from_name)' : 'pm.from_name'; |
| 2681 | 2710 | foreach (array_keys($possible_users) as $key) |
| 2682 | - $uq[] = 'AND pm.id_member_from = 0 AND (' . $name . ' LIKE {string:guest_user_name_implode_' . $key . '})'; |
|
| 2711 | + { |
|
| 2712 | + $uq[] = 'AND pm.id_member_from = 0 AND (' . $name . ' LIKE {string:guest_user_name_implode_' . $key . '})'; |
|
| 2713 | + } |
|
| 2683 | 2714 | $userQuery = implode(' ', $uq); |
| 2684 | 2715 | $this->_searchq_parameters ['pm_from_name'] = defined('DB_CASE_SENSITIVE') ? 'LOWER(pm.from_name)' : 'pm.from_name'; |
| 2685 | 2716 | } |
@@ -2692,7 +2723,9 @@ discard block |
||
| 2692 | 2723 | { |
| 2693 | 2724 | $memberlist = array(); |
| 2694 | 2725 | foreach ($members as $id) |
| 2695 | - $memberlist[] = $id; |
|
| 2726 | + { |
|
| 2727 | + $memberlist[] = $id; |
|
| 2728 | + } |
|
| 2696 | 2729 | |
| 2697 | 2730 | // Use the name as as sent from or sent to |
| 2698 | 2731 | if ($context['folder'] === 'inbox') |
@@ -2701,7 +2734,9 @@ discard block |
||
| 2701 | 2734 | $name = defined('DB_CASE_SENSITIVE') ? 'LOWER(pm.from_name)' : 'pm.from_name'; |
| 2702 | 2735 | |
| 2703 | 2736 | foreach (array_keys($possible_users) as $key) |
| 2704 | - $uq[] = 'AND (pm.id_member_from IN ({array_int:member_list}) OR (pm.id_member_from = 0 AND (' . $name . ' LIKE {string:guest_user_name_implode_' . $key . '})))'; |
|
| 2737 | + { |
|
| 2738 | + $uq[] = 'AND (pm.id_member_from IN ({array_int:member_list}) OR (pm.id_member_from = 0 AND (' . $name . ' LIKE {string:guest_user_name_implode_' . $key . '})))'; |
|
| 2739 | + } |
|
| 2705 | 2740 | |
| 2706 | 2741 | $userQuery = implode(' ', $uq); |
| 2707 | 2742 | } |
@@ -2806,7 +2841,9 @@ discard block |
||
| 2806 | 2841 | |
| 2807 | 2842 | // Now we have all the parameters, combine them together for pagination and the like... |
| 2808 | 2843 | foreach ($this->_search_params as $k => $v) |
| 2809 | - $encoded[] = $k . '|\'|' . $v; |
|
| 2844 | + { |
|
| 2845 | + $encoded[] = $k . '|\'|' . $v; |
|
| 2846 | + } |
|
| 2810 | 2847 | |
| 2811 | 2848 | // Base64 encode, then replace +/= with uri safe ones that can be reverted |
| 2812 | 2849 | $encoded = str_replace(array('+', '/', '='), array('-', '_', '.'), base64_encode(implode('|"|', $encoded))); |
@@ -293,7 +293,7 @@ |
||
| 293 | 293 | loadUserSettings(); |
| 294 | 294 | |
| 295 | 295 | $_SESSION['session_var'] = isset($_SESSION['session_var']) ? $_SESSION['session_var'] : ''; |
| 296 | - $_SESSION['session_value'] = isset($_SESSION['session_value'] ) ? $_SESSION['session_value'] : ''; |
|
| 296 | + $_SESSION['session_value'] = isset($_SESSION['session_value']) ? $_SESSION['session_value'] : ''; |
|
| 297 | 297 | loadTheme(); |
| 298 | 298 | |
| 299 | 299 | // Here lies elkarte, dead from a program error. Just a cryptic message, no output could be better. |
@@ -104,7 +104,9 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | // Just so we know what board error messages are from. |
| 106 | 106 | if (isset($_POST['board']) && !isset($_GET['board'])) |
| 107 | - $query_string .= ($query_string == '' ? 'board=' : ';board=') . $_POST['board']; |
|
| 107 | + { |
|
| 108 | + $query_string .= ($query_string == '' ? 'board=' : ';board=') . $_POST['board']; |
|
| 109 | + } |
|
| 108 | 110 | |
| 109 | 111 | return $query_string; |
| 110 | 112 | } |
@@ -126,9 +128,13 @@ discard block |
||
| 126 | 128 | |
| 127 | 129 | // Just in case there's no id_member or IP set yet. |
| 128 | 130 | if (empty($user_info['id'])) |
| 129 | - $user_info['id'] = 0; |
|
| 131 | + { |
|
| 132 | + $user_info['id'] = 0; |
|
| 133 | + } |
|
| 130 | 134 | if (empty($user_info['ip'])) |
| 131 | - $user_info['ip'] = ''; |
|
| 135 | + { |
|
| 136 | + $user_info['ip'] = ''; |
|
| 137 | + } |
|
| 132 | 138 | |
| 133 | 139 | // Don't log the same error countless times, as we can get in a cycle of depression... |
| 134 | 140 | $error_info = array($user_info['id'], time(), $user_info['ip'], $query_string, $error_message, isset($_SESSION['session_value']) ? (string) $_SESSION['session_value'] : 'no_session_data', $error_type, $file, $line); |
@@ -164,7 +170,9 @@ discard block |
||
| 164 | 170 | { |
| 165 | 171 | // Check if error logging is actually on. |
| 166 | 172 | if (empty($this->_modSettings['enableErrorLogging'])) |
| 167 | - return $error_message; |
|
| 173 | + { |
|
| 174 | + return $error_message; |
|
| 175 | + } |
|
| 168 | 176 | |
| 169 | 177 | // Basically, htmlspecialchars it minus &. (for entities!) |
| 170 | 178 | $error_message = strtr($error_message, array('<' => '<', '>' => '>', '"' => '"')); |
@@ -218,7 +226,9 @@ discard block |
||
| 218 | 226 | |
| 219 | 227 | // Load the language file, only if it needs to be reloaded |
| 220 | 228 | if ($reload_lang_file) |
| 221 | - loadLanguage('Errors'); |
|
| 229 | + { |
|
| 230 | + loadLanguage('Errors'); |
|
| 231 | + } |
|
| 222 | 232 | |
| 223 | 233 | // Return the message to make things simpler. |
| 224 | 234 | return $error_message; |
@@ -281,7 +291,9 @@ discard block |
||
| 281 | 291 | // Attempt to prevent a recursive loop. |
| 282 | 292 | ++$level; |
| 283 | 293 | if ($level > 1) |
| 284 | - return false; |
|
| 294 | + { |
|
| 295 | + return false; |
|
| 296 | + } |
|
| 285 | 297 | |
| 286 | 298 | // Maybe they came from dlattach or similar? |
| 287 | 299 | if (ELK !== 'SSI' && empty($context['theme_loaded'])) |
@@ -315,19 +327,27 @@ discard block |
||
| 315 | 327 | $context['sub_template'] = 'fatal_error'; |
| 316 | 328 | |
| 317 | 329 | if (class_exists('Template_Layers')) |
| 318 | - \Template_Layers::instance()->isError(); |
|
| 330 | + { |
|
| 331 | + \Template_Layers::instance()->isError(); |
|
| 332 | + } |
|
| 319 | 333 | |
| 320 | 334 | // If this is SSI, what do they want us to do? |
| 321 | 335 | if (ELK === 'SSI') |
| 322 | 336 | { |
| 323 | 337 | if (!empty($ssi_on_error_method) && $ssi_on_error_method !== true && is_callable($ssi_on_error_method)) |
| 324 | - call_user_func($ssi_on_error_method); |
|
| 338 | + { |
|
| 339 | + call_user_func($ssi_on_error_method); |
|
| 340 | + } |
|
| 325 | 341 | elseif (empty($ssi_on_error_method) || $ssi_on_error_method !== true) |
| 326 | - loadSubTemplate('fatal_error'); |
|
| 342 | + { |
|
| 343 | + loadSubTemplate('fatal_error'); |
|
| 344 | + } |
|
| 327 | 345 | |
| 328 | 346 | // No layers? |
| 329 | 347 | if (empty($ssi_on_error_method) || $ssi_on_error_method !== true) |
| 330 | - $this->terminate(); |
|
| 348 | + { |
|
| 349 | + $this->terminate(); |
|
| 350 | + } |
|
| 331 | 351 | } |
| 332 | 352 | |
| 333 | 353 | // We want whatever for the header, and a footer. (footer includes sub template!) |
@@ -358,7 +378,8 @@ discard block |
||
| 358 | 378 | $this->_set_fatal_error_headers(); |
| 359 | 379 | |
| 360 | 380 | if (!empty($maintenance)) |
| 361 | - echo '<!DOCTYPE html> |
|
| 381 | + { |
|
| 382 | + echo '<!DOCTYPE html> |
|
| 362 | 383 | <html> |
| 363 | 384 | <head> |
| 364 | 385 | <meta name="robots" content="noindex" /> |
@@ -369,6 +390,7 @@ discard block |
||
| 369 | 390 | ', $mmessage, ' |
| 370 | 391 | </body> |
| 371 | 392 | </html>'; |
| 393 | + } |
|
| 372 | 394 | |
| 373 | 395 | $this->terminate(); |
| 374 | 396 | } |
@@ -434,7 +456,9 @@ discard block |
||
| 434 | 456 | |
| 435 | 457 | $temp = ''; |
| 436 | 458 | if ($cache->getVar($temp, 'db_last_error', 600)) |
| 437 | - $db_last_error = max($db_last_error, $temp); |
|
| 459 | + { |
|
| 460 | + $db_last_error = max($db_last_error, $temp); |
|
| 461 | + } |
|
| 438 | 462 | |
| 439 | 463 | // Perhaps we want to notify by mail that there was a this->_db error |
| 440 | 464 | if ($db_last_error < time() - 3600 * 24 * 3 && empty($maintenance) && !empty($db_error_send)) |
@@ -442,7 +466,9 @@ discard block |
||
| 442 | 466 | // Try using shared memory if possible. |
| 443 | 467 | $cache->put('db_last_error', time(), 600); |
| 444 | 468 | if (!$cache->getVar($temp, 'db_last_error', 600)) |
| 445 | - logLastDatabaseError(); |
|
| 469 | + { |
|
| 470 | + logLastDatabaseError(); |
|
| 471 | + } |
|
| 446 | 472 | |
| 447 | 473 | // Language files aren't loaded yet :'( |
| 448 | 474 | $db_error = $this->_db->last_error($this->_db->connection()); |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | { |
| 41 | 41 | while ($row = $db->fetch_assoc($request)) |
| 42 | 42 | { |
| 43 | - foreach(array('body', 'subject') as $column) |
|
| 43 | + foreach (array('body', 'subject') as $column) |
|
| 44 | 44 | { |
| 45 | 45 | if ($row['Column_name'] === $column && (isset($row['Index_type']) && $row['Index_type'] === 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] === 'FULLTEXT')) |
| 46 | 46 | { |
@@ -131,7 +131,9 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | // Set up to output a file to the users browser |
| 133 | 133 | while (ob_get_level() > 0) |
| 134 | - @ob_end_clean(); |
|
| 134 | + { |
|
| 135 | + @ob_end_clean(); |
|
| 136 | + } |
|
| 135 | 137 | |
| 136 | 138 | header('Content-Encoding: none'); |
| 137 | 139 | header('Pragma: no-cache'); |
@@ -349,11 +351,15 @@ discard block |
||
| 349 | 351 | |
| 350 | 352 | // Temporarily switch back to not using a search index. |
| 351 | 353 | if (!empty($modSettings['search_index']) && $modSettings['search_index'] === 'custom') |
| 352 | - updateSettings(array('search_index' => '')); |
|
| 354 | + { |
|
| 355 | + updateSettings(array('search_index' => '')); |
|
| 356 | + } |
|
| 353 | 357 | |
| 354 | 358 | // Don't let simultaneous processes be updating the search index. |
| 355 | 359 | if (!empty($modSettings['search_custom_index_config'])) |
| 356 | - updateSettings(array('search_custom_index_config' => '')); |
|
| 360 | + { |
|
| 361 | + updateSettings(array('search_custom_index_config' => '')); |
|
| 362 | + } |
|
| 357 | 363 | } |
| 358 | 364 | |
| 359 | 365 | $num_messages = array( |
@@ -370,7 +376,9 @@ discard block |
||
| 370 | 376 | ) |
| 371 | 377 | ); |
| 372 | 378 | while ($row = $db->fetch_assoc($request)) |
| 373 | - $num_messages[empty($row['todo']) ? 'done' : 'todo'] = $row['num_messages']; |
|
| 379 | + { |
|
| 380 | + $num_messages[empty($row['todo']) ? 'done' : 'todo'] = $row['num_messages']; |
|
| 381 | + } |
|
| 374 | 382 | |
| 375 | 383 | // Done with indexing the messages, on to the next step |
| 376 | 384 | if (empty($num_messages['todo'])) |
@@ -411,7 +419,9 @@ discard block |
||
| 411 | 419 | |
| 412 | 420 | $number_processed++; |
| 413 | 421 | foreach (text2words($row['body'], $index_settings['bytes_per_word'], true) as $id_word) |
| 414 | - $inserts[] = array($id_word, $row['id_msg']); |
|
| 422 | + { |
|
| 423 | + $inserts[] = array($id_word, $row['id_msg']); |
|
| 424 | + } |
|
| 415 | 425 | } |
| 416 | 426 | $num_messages['done'] += $number_processed; |
| 417 | 427 | $num_messages['todo'] -= $number_processed; |
@@ -420,12 +430,14 @@ discard block |
||
| 420 | 430 | $start += $forced_break ? $number_processed : $messages_per_batch; |
| 421 | 431 | |
| 422 | 432 | if (!empty($inserts)) |
| 423 | - $db->insert('ignore', |
|
| 433 | + { |
|
| 434 | + $db->insert('ignore', |
|
| 424 | 435 | '{db_prefix}log_search_words', |
| 425 | 436 | array('id_word' => 'int', 'id_msg' => 'int'), |
| 426 | 437 | $inserts, |
| 427 | 438 | array('id_word', 'id_msg') |
| 428 | 439 | ); |
| 440 | + } |
|
| 429 | 441 | |
| 430 | 442 | // Done then set up for the next step, set up for the next loop. |
| 431 | 443 | if ($num_messages['todo'] === 0) |
@@ -434,8 +446,9 @@ discard block |
||
| 434 | 446 | $start = 0; |
| 435 | 447 | break; |
| 436 | 448 | } |
| 437 | - else |
|
| 438 | - updateSettings(array('search_custom_index_resume' => serialize(array_merge($index_settings, array('resume_at' => $start))))); |
|
| 449 | + else { |
|
| 450 | + updateSettings(array('search_custom_index_resume' => serialize(array_merge($index_settings, array('resume_at' => $start))))); |
|
| 451 | + } |
|
| 439 | 452 | } |
| 440 | 453 | |
| 441 | 454 | // Since there are still steps to go, 80% is the maximum here. |
@@ -478,19 +491,23 @@ discard block |
||
| 478 | 491 | ) |
| 479 | 492 | ); |
| 480 | 493 | while ($row = $db->fetch_assoc($request)) |
| 481 | - $stop_words[] = $row['id_word']; |
|
| 494 | + { |
|
| 495 | + $stop_words[] = $row['id_word']; |
|
| 496 | + } |
|
| 482 | 497 | $db->free_result($request); |
| 483 | 498 | |
| 484 | 499 | updateSettings(array('search_stopwords' => implode(',', $stop_words))); |
| 485 | 500 | |
| 486 | 501 | if (!empty($stop_words)) |
| 487 | - $db->query('', ' |
|
| 502 | + { |
|
| 503 | + $db->query('', ' |
|
| 488 | 504 | DELETE FROM {db_prefix}log_search_words |
| 489 | 505 | WHERE id_word in ({array_int:stop_words})', |
| 490 | 506 | array( |
| 491 | 507 | 'stop_words' => $stop_words, |
| 492 | 508 | ) |
| 493 | 509 | ); |
| 510 | + } |
|
| 494 | 511 | |
| 495 | 512 | $start += $column_definition['step_size']; |
| 496 | 513 | if ($start > $column_definition['max_size']) |
@@ -1078,13 +1078,13 @@ |
||
| 1078 | 1078 | { |
| 1079 | 1079 | global $db_row_count; |
| 1080 | 1080 | |
| 1081 | - if(!is_resource($resource) && ($resource instanceof \PgSql\Result)) |
|
| 1081 | + if (!is_resource($resource) && ($resource instanceof \PgSql\Result)) |
|
| 1082 | 1082 | { |
| 1083 | 1083 | $id = spl_object_id($resource); |
| 1084 | 1084 | } |
| 1085 | 1085 | else |
| 1086 | 1086 | { |
| 1087 | - $id = (int)$resource; |
|
| 1087 | + $id = (int) $resource; |
|
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | return $id; |
@@ -17,7 +17,9 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | // Let's define the name of the class so that we will be able to use it in the instantiations |
| 19 | 19 | if (!defined('DB_TYPE')) |
| 20 | +{ |
|
| 20 | 21 | define('DB_TYPE', 'PostgreSQL'); |
| 22 | +} |
|
| 21 | 23 | |
| 22 | 24 | /** |
| 23 | 25 | * PostgreSQL database class, implements database class to control mysql functions |
@@ -67,25 +69,36 @@ discard block |
||
| 67 | 69 | { |
| 68 | 70 | // initialize the instance... if not done already! |
| 69 | 71 | if (self::$_db === null) |
| 70 | - self::$_db = new self(); |
|
| 72 | + { |
|
| 73 | + self::$_db = new self(); |
|
| 74 | + } |
|
| 71 | 75 | |
| 72 | 76 | if (!empty($db_options['port'])) |
| 73 | - $db_port = ' port=' . (int) $db_options['port']; |
|
| 74 | - else |
|
| 75 | - $db_port = ''; |
|
| 77 | + { |
|
| 78 | + $db_port = ' port=' . (int) $db_options['port']; |
|
| 79 | + } |
|
| 80 | + else { |
|
| 81 | + $db_port = ''; |
|
| 82 | + } |
|
| 76 | 83 | |
| 77 | 84 | if (!empty($db_options['persist'])) |
| 78 | - $connection = @pg_pconnect('host=' . $db_server . $db_port . ' dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\''); |
|
| 79 | - else |
|
| 80 | - $connection = @pg_connect('host=' . $db_server . $db_port . ' dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\''); |
|
| 85 | + { |
|
| 86 | + $connection = @pg_pconnect('host=' . $db_server . $db_port . ' dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\''); |
|
| 87 | + } |
|
| 88 | + else { |
|
| 89 | + $connection = @pg_connect('host=' . $db_server . $db_port . ' dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\''); |
|
| 90 | + } |
|
| 81 | 91 | |
| 82 | 92 | // Something's wrong, show an error if its fatal (which we assume it is) |
| 83 | 93 | if (!$connection) |
| 84 | 94 | { |
| 85 | 95 | if (!empty($db_options['non_fatal'])) |
| 86 | - return null; |
|
| 87 | - else |
|
| 88 | - Errors::instance()->display_db_error(); |
|
| 96 | + { |
|
| 97 | + return null; |
|
| 98 | + } |
|
| 99 | + else { |
|
| 100 | + Errors::instance()->display_db_error(); |
|
| 101 | + } |
|
| 89 | 102 | } |
| 90 | 103 | |
| 91 | 104 | self::$_db->_connection = $connection; |
@@ -179,13 +192,17 @@ discard block |
||
| 179 | 192 | ); |
| 180 | 193 | |
| 181 | 194 | if (isset($replacements[$identifier])) |
| 182 | - $db_string = preg_replace(array_keys($replacements[$identifier]), array_values($replacements[$identifier]), $db_string); |
|
| 195 | + { |
|
| 196 | + $db_string = preg_replace(array_keys($replacements[$identifier]), array_values($replacements[$identifier]), $db_string); |
|
| 197 | + } |
|
| 183 | 198 | |
| 184 | 199 | // Limits need to be a little different. |
| 185 | 200 | $db_string = preg_replace('~\sLIMIT\s(\d+|{int:.+}),\s*(\d+|{int:.+})(.*)~i', 'LIMIT $2 OFFSET $1 $3', $db_string); |
| 186 | 201 | |
| 187 | 202 | if (trim($db_string) == '') |
| 188 | - return false; |
|
| 203 | + { |
|
| 204 | + return false; |
|
| 205 | + } |
|
| 189 | 206 | |
| 190 | 207 | // Comments that are allowed in a query are preg_removed. |
| 191 | 208 | static $allowed_comments_from = array( |
@@ -206,7 +223,9 @@ discard block |
||
| 206 | 223 | $this->_db_replace_result = null; |
| 207 | 224 | |
| 208 | 225 | if (empty($modSettings['disableQueryCheck']) && strpos($db_string, '\'') !== false && empty($db_values['security_override'])) |
| 209 | - $this->error_backtrace('Hacking attempt...', 'Illegal character (\') used in query...', true, __FILE__, __LINE__); |
|
| 226 | + { |
|
| 227 | + $this->error_backtrace('Hacking attempt...', 'Illegal character (\') used in query...', true, __FILE__, __LINE__); |
|
| 228 | + } |
|
| 210 | 229 | |
| 211 | 230 | if (empty($db_values['security_override']) && (!empty($db_values) || strpos($db_string, '{db_prefix}') !== false)) |
| 212 | 231 | { |
@@ -257,7 +276,9 @@ discard block |
||
| 257 | 276 | { |
| 258 | 277 | $pos = strpos($db_string, '\'', $pos + 1); |
| 259 | 278 | if ($pos === false) |
| 260 | - break; |
|
| 279 | + { |
|
| 280 | + break; |
|
| 281 | + } |
|
| 261 | 282 | $clean .= substr($db_string, $old_pos, $pos - $old_pos); |
| 262 | 283 | |
| 263 | 284 | while (true) |
@@ -266,7 +287,9 @@ discard block |
||
| 266 | 287 | $pos2 = strpos($db_string, '\'\'', $pos + 1); |
| 267 | 288 | |
| 268 | 289 | if ($pos1 === false) |
| 269 | - break; |
|
| 290 | + { |
|
| 291 | + break; |
|
| 292 | + } |
|
| 270 | 293 | elseif ($pos2 === false || $pos2 > $pos1) |
| 271 | 294 | { |
| 272 | 295 | $pos = $pos1; |
@@ -285,19 +308,29 @@ discard block |
||
| 285 | 308 | |
| 286 | 309 | // Comments? We don't use comments in our queries, we leave 'em outside! |
| 287 | 310 | if (strpos($clean, '/*') > 2 || strpos($clean, '--') !== false || strpos($clean, ';') !== false) |
| 288 | - $fail = true; |
|
| 311 | + { |
|
| 312 | + $fail = true; |
|
| 313 | + } |
|
| 289 | 314 | // Trying to change passwords, slow us down, or something? |
| 290 | 315 | elseif (strpos($clean, 'sleep') !== false && preg_match('~(^|[^a-z])sleep($|[^[_a-z])~s', $clean) != 0) |
| 291 | - $fail = true; |
|
| 316 | + { |
|
| 317 | + $fail = true; |
|
| 318 | + } |
|
| 292 | 319 | elseif (strpos($clean, 'benchmark') !== false && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0) |
| 293 | - $fail = true; |
|
| 320 | + { |
|
| 321 | + $fail = true; |
|
| 322 | + } |
|
| 294 | 323 | |
| 295 | 324 | if (!empty($fail) && class_exists('Errors')) |
| 296 | - $this->error_backtrace('Hacking attempt...', 'Hacking attempt...' . "\n" . $db_string, E_USER_ERROR, __FILE__, __LINE__); |
|
| 325 | + { |
|
| 326 | + $this->error_backtrace('Hacking attempt...', 'Hacking attempt...' . "\n" . $db_string, E_USER_ERROR, __FILE__, __LINE__); |
|
| 327 | + } |
|
| 297 | 328 | |
| 298 | 329 | // If we are updating something, better start a transaction so that indexes may be kept consistent |
| 299 | 330 | if (!$this->_in_transaction && strpos($clean, 'update') !== false) |
| 300 | - $this->db_transaction('begin', $connection); |
|
| 331 | + { |
|
| 332 | + $this->db_transaction('begin', $connection); |
|
| 333 | + } |
|
| 301 | 334 | } |
| 302 | 335 | |
| 303 | 336 | $this->_db_last_result = @pg_query($connection, $db_string); |
@@ -320,7 +353,9 @@ discard block |
||
| 320 | 353 | } |
| 321 | 354 | |
| 322 | 355 | if ($this->_in_transaction) |
| 323 | - $this->db_transaction('commit', $connection); |
|
| 356 | + { |
|
| 357 | + $this->db_transaction('commit', $connection); |
|
| 358 | + } |
|
| 324 | 359 | |
| 325 | 360 | // Debugging. |
| 326 | 361 | if ($db_show_debug === true) |
@@ -340,9 +375,13 @@ discard block |
||
| 340 | 375 | public function affected_rows($result = null) |
| 341 | 376 | { |
| 342 | 377 | if ($this->_db_replace_result !== null) |
| 343 | - return $this->_db_replace_result; |
|
| 378 | + { |
|
| 379 | + return $this->_db_replace_result; |
|
| 380 | + } |
|
| 344 | 381 | elseif ($result === null && !$this->_db_last_result) |
| 345 | - return 0; |
|
| 382 | + { |
|
| 383 | + return 0; |
|
| 384 | + } |
|
| 346 | 385 | |
| 347 | 386 | return pg_affected_rows($result === null ? $this->_db_last_result : $result); |
| 348 | 387 | } |
@@ -371,7 +410,9 @@ discard block |
||
| 371 | 410 | ); |
| 372 | 411 | |
| 373 | 412 | if (!$request) |
| 374 | - return false; |
|
| 413 | + { |
|
| 414 | + return false; |
|
| 415 | + } |
|
| 375 | 416 | |
| 376 | 417 | list ($lastID) = $this->fetch_row($request); |
| 377 | 418 | $this->free_result($request); |
@@ -391,11 +432,15 @@ discard block |
||
| 391 | 432 | global $db_row_count; |
| 392 | 433 | |
| 393 | 434 | if ($counter !== false) |
| 394 | - return pg_fetch_row($result, $counter); |
|
| 435 | + { |
|
| 436 | + return pg_fetch_row($result, $counter); |
|
| 437 | + } |
|
| 395 | 438 | |
| 396 | 439 | // Reset the row counter... |
| 397 | 440 | if (!isset($db_row_count[$this->seekCounter($result)])) |
| 398 | - $db_row_count[$this->seekCounter($result)] = 0; |
|
| 441 | + { |
|
| 442 | + $db_row_count[$this->seekCounter($result)] = 0; |
|
| 443 | + } |
|
| 399 | 444 | |
| 400 | 445 | // Return the right row. |
| 401 | 446 | return @pg_fetch_row($result, $db_row_count[$this->seekCounter($result)]++); |
@@ -413,7 +458,9 @@ discard block |
||
| 413 | 458 | $id = $this->seekCounter($result); |
| 414 | 459 | // Reset the row counter... |
| 415 | 460 | if (isset($db_row_count[$id])) |
| 416 | - unset($db_row_count[$id]); |
|
| 461 | + { |
|
| 462 | + unset($db_row_count[$id]); |
|
| 463 | + } |
|
| 417 | 464 | |
| 418 | 465 | // Just delegate to the native function |
| 419 | 466 | pg_free_result($result); |
@@ -472,7 +519,9 @@ discard block |
||
| 472 | 519 | return @pg_query($connection, 'BEGIN'); |
| 473 | 520 | } |
| 474 | 521 | elseif ($type == 'rollback') |
| 475 | - return @pg_query($connection, 'ROLLBACK'); |
|
| 522 | + { |
|
| 523 | + return @pg_query($connection, 'ROLLBACK'); |
|
| 524 | + } |
|
| 476 | 525 | elseif ($type == 'commit') |
| 477 | 526 | { |
| 478 | 527 | $this->_in_transaction = false; |
@@ -493,7 +542,9 @@ discard block |
||
| 493 | 542 | $connection = $connection === null ? $this->_connection : $connection; |
| 494 | 543 | |
| 495 | 544 | if (is_resource($connection) || $connection instanceof \PgSql\Connection) |
| 496 | - return pg_last_error($connection); |
|
| 545 | + { |
|
| 546 | + return pg_last_error($connection); |
|
| 547 | + } |
|
| 497 | 548 | } |
| 498 | 549 | |
| 499 | 550 | /** |
@@ -526,21 +577,30 @@ discard block |
||
| 526 | 577 | |
| 527 | 578 | // Nothing's defined yet... just die with it. |
| 528 | 579 | if (empty($context) || empty($txt)) |
| 529 | - die($query_error); |
|
| 580 | + { |
|
| 581 | + die($query_error); |
|
| 582 | + } |
|
| 530 | 583 | |
| 531 | 584 | // Show an error message, if possible. |
| 532 | 585 | $context['error_title'] = $txt['database_error']; |
| 533 | 586 | if (allowedTo('admin_forum')) |
| 534 | - $context['error_message'] = nl2br($query_error) . '<br />' . $txt['file'] . ': ' . $file . '<br />' . $txt['line'] . ': ' . $line; |
|
| 535 | - else |
|
| 536 | - $context['error_message'] = $txt['try_again']; |
|
| 587 | + { |
|
| 588 | + $context['error_message'] = nl2br($query_error) . '<br />' . $txt['file'] . ': ' . $file . '<br />' . $txt['line'] . ': ' . $line; |
|
| 589 | + } |
|
| 590 | + else { |
|
| 591 | + $context['error_message'] = $txt['try_again']; |
|
| 592 | + } |
|
| 537 | 593 | |
| 538 | 594 | // Add database version that we know of, for the admin to know. (and ask for support) |
| 539 | 595 | if (allowedTo('admin_forum')) |
| 540 | - $context['error_message'] .= '<br /><br />' . sprintf($txt['database_error_versions'], $modSettings['elkVersion']); |
|
| 596 | + { |
|
| 597 | + $context['error_message'] .= '<br /><br />' . sprintf($txt['database_error_versions'], $modSettings['elkVersion']); |
|
| 598 | + } |
|
| 541 | 599 | |
| 542 | 600 | if (allowedTo('admin_forum') && $db_show_debug === true) |
| 543 | - $context['error_message'] .= '<br /><br />' . nl2br($db_string); |
|
| 601 | + { |
|
| 602 | + $context['error_message'] .= '<br /><br />' . nl2br($db_string); |
|
| 603 | + } |
|
| 544 | 604 | |
| 545 | 605 | // It's already been logged... don't log it again. |
| 546 | 606 | throw new Elk_Exception($context['error_message'], false); |
@@ -566,11 +626,15 @@ discard block |
||
| 566 | 626 | |
| 567 | 627 | // With nothing to insert, simply return. |
| 568 | 628 | if (empty($data)) |
| 569 | - return; |
|
| 629 | + { |
|
| 630 | + return; |
|
| 631 | + } |
|
| 570 | 632 | |
| 571 | 633 | // Inserting data as a single row can be done as a single array. |
| 572 | 634 | if (!is_array($data[array_rand($data)])) |
| 573 | - $data = array($data); |
|
| 635 | + { |
|
| 636 | + $data = array($data); |
|
| 637 | + } |
|
| 574 | 638 | |
| 575 | 639 | // Replace the prefix holder with the actual prefix. |
| 576 | 640 | $table = str_replace('{db_prefix}', $db_prefix, $table); |
@@ -592,13 +656,18 @@ discard block |
||
| 592 | 656 | { |
| 593 | 657 | // Are we restricting the length? |
| 594 | 658 | if (strpos($type, 'string-') !== false) |
| 595 | - $actualType = sprintf($columnName . ' = SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $count); |
|
| 596 | - else |
|
| 597 | - $actualType = sprintf($columnName . ' = {%1$s:%2$s}, ', $type, $count); |
|
| 659 | + { |
|
| 660 | + $actualType = sprintf($columnName . ' = SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $count); |
|
| 661 | + } |
|
| 662 | + else { |
|
| 663 | + $actualType = sprintf($columnName . ' = {%1$s:%2$s}, ', $type, $count); |
|
| 664 | + } |
|
| 598 | 665 | |
| 599 | 666 | // A key? That's what we were looking for. |
| 600 | 667 | if (in_array($columnName, $keys)) |
| 601 | - $where .= (empty($where) ? '' : ' AND ') . substr($actualType, 0, -2); |
|
| 668 | + { |
|
| 669 | + $where .= (empty($where) ? '' : ' AND ') . substr($actualType, 0, -2); |
|
| 670 | + } |
|
| 602 | 671 | $count++; |
| 603 | 672 | } |
| 604 | 673 | |
@@ -625,9 +694,12 @@ discard block |
||
| 625 | 694 | { |
| 626 | 695 | // Are we restricting the length? |
| 627 | 696 | if (strpos($type, 'string-') !== false) |
| 628 | - $insertData .= sprintf('SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $columnName); |
|
| 629 | - else |
|
| 630 | - $insertData .= sprintf('{%1$s:%2$s}, ', $type, $columnName); |
|
| 697 | + { |
|
| 698 | + $insertData .= sprintf('SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $columnName); |
|
| 699 | + } |
|
| 700 | + else { |
|
| 701 | + $insertData .= sprintf('{%1$s:%2$s}, ', $type, $columnName); |
|
| 702 | + } |
|
| 631 | 703 | } |
| 632 | 704 | $insertData = substr($insertData, 0, -2) . ')'; |
| 633 | 705 | |
@@ -637,7 +709,9 @@ discard block |
||
| 637 | 709 | // Here's where the variables are injected to the query. |
| 638 | 710 | $insertRows = array(); |
| 639 | 711 | foreach ($data as $dataRow) |
| 640 | - $insertRows[] = $this->quote($insertData, $this->_array_combine($indexed_columns, $dataRow), $connection); |
|
| 712 | + { |
|
| 713 | + $insertRows[] = $this->quote($insertData, $this->_array_combine($indexed_columns, $dataRow), $connection); |
|
| 714 | + } |
|
| 641 | 715 | |
| 642 | 716 | $inserted_results = 0; |
| 643 | 717 | $skip_error = $method == 'ignore' || $table === $db_prefix . 'log_errors'; |
@@ -658,11 +732,15 @@ discard block |
||
| 658 | 732 | $inserted_results += (!$this->_db_last_result ? 0 : pg_affected_rows($this->_db_last_result)); |
| 659 | 733 | } |
| 660 | 734 | if (isset($db_replace_result)) |
| 661 | - $this->_db_replace_result = $db_replace_result + $inserted_results; |
|
| 735 | + { |
|
| 736 | + $this->_db_replace_result = $db_replace_result + $inserted_results; |
|
| 737 | + } |
|
| 662 | 738 | } |
| 663 | 739 | |
| 664 | 740 | if ($priv_trans) |
| 665 | - $this->db_transaction('commit', $connection); |
|
| 741 | + { |
|
| 742 | + $this->db_transaction('commit', $connection); |
|
| 743 | + } |
|
| 666 | 744 | } |
| 667 | 745 | |
| 668 | 746 | /** |
@@ -726,7 +804,9 @@ discard block |
||
| 726 | 804 | $num_rows = $this->num_rows($result); |
| 727 | 805 | |
| 728 | 806 | if ($num_rows == 0) |
| 729 | - return ''; |
|
| 807 | + { |
|
| 808 | + return ''; |
|
| 809 | + } |
|
| 730 | 810 | |
| 731 | 811 | if ($new_table) |
| 732 | 812 | { |
@@ -747,11 +827,16 @@ discard block |
||
| 747 | 827 | { |
| 748 | 828 | // Try to figure out the type of each field. (NULL, number, or 'string'.) |
| 749 | 829 | if (!isset($item)) |
| 750 | - $field_list[] = 'NULL'; |
|
| 830 | + { |
|
| 831 | + $field_list[] = 'NULL'; |
|
| 832 | + } |
|
| 751 | 833 | elseif (is_numeric($item) && (int) $item == $item) |
| 752 | - $field_list[] = $item; |
|
| 753 | - else |
|
| 754 | - $field_list[] = '\'' . $this->escape_string($item) . '\''; |
|
| 834 | + { |
|
| 835 | + $field_list[] = $item; |
|
| 836 | + } |
|
| 837 | + else { |
|
| 838 | + $field_list[] = '\'' . $this->escape_string($item) . '\''; |
|
| 839 | + } |
|
| 755 | 840 | } |
| 756 | 841 | |
| 757 | 842 | // 'Insert' the data. |
@@ -801,12 +886,18 @@ discard block |
||
| 801 | 886 | while ($row = $this->fetch_assoc($result)) |
| 802 | 887 | { |
| 803 | 888 | if ($row['data_type'] == 'character varying') |
| 804 | - $row['data_type'] = 'varchar'; |
|
| 889 | + { |
|
| 890 | + $row['data_type'] = 'varchar'; |
|
| 891 | + } |
|
| 805 | 892 | elseif ($row['data_type'] == 'character') |
| 806 | - $row['data_type'] = 'char'; |
|
| 893 | + { |
|
| 894 | + $row['data_type'] = 'char'; |
|
| 895 | + } |
|
| 807 | 896 | |
| 808 | 897 | if ($row['character_maximum_length']) |
| 809 | - $row['data_type'] .= '(' . $row['character_maximum_length'] . ')'; |
|
| 898 | + { |
|
| 899 | + $row['data_type'] .= '(' . $row['character_maximum_length'] . ')'; |
|
| 900 | + } |
|
| 810 | 901 | |
| 811 | 902 | // Make the CREATE for this column. |
| 812 | 903 | $schema_create .= ' "' . $row['column_name'] . '" ' . $row['data_type'] . ($row['is_nullable'] != 'YES' ? ' NOT NULL' : ''); |
@@ -859,12 +950,15 @@ discard block |
||
| 859 | 950 | if ($row['is_primary']) |
| 860 | 951 | { |
| 861 | 952 | if (preg_match('~\(([^\)]+?)\)~i', $row['inddef'], $matches) == 0) |
| 862 | - continue; |
|
| 953 | + { |
|
| 954 | + continue; |
|
| 955 | + } |
|
| 863 | 956 | |
| 864 | 957 | $index_create .= $crlf . 'ALTER TABLE ' . $tableName . ' ADD PRIMARY KEY ("' . $matches[1] . '");'; |
| 865 | 958 | } |
| 866 | - else |
|
| 867 | - $index_create .= $crlf . $row['inddef'] . ';'; |
|
| 959 | + else { |
|
| 960 | + $index_create .= $crlf . $row['inddef'] . ';'; |
|
| 961 | + } |
|
| 868 | 962 | } |
| 869 | 963 | $this->free_result($result); |
| 870 | 964 | |
@@ -892,7 +986,9 @@ discard block |
||
| 892 | 986 | ); |
| 893 | 987 | $tables = array(); |
| 894 | 988 | while ($row = $this->fetch_row($request)) |
| 895 | - $tables[] = $row[0]; |
|
| 989 | + { |
|
| 990 | + $tables[] = $row[0]; |
|
| 991 | + } |
|
| 896 | 992 | $this->free_result($request); |
| 897 | 993 | |
| 898 | 994 | return $tables; |
@@ -1008,11 +1104,15 @@ discard block |
||
| 1008 | 1104 | global $db_row_count; |
| 1009 | 1105 | |
| 1010 | 1106 | if ($counter !== false) |
| 1011 | - return pg_fetch_assoc($request, $counter); |
|
| 1107 | + { |
|
| 1108 | + return pg_fetch_assoc($request, $counter); |
|
| 1109 | + } |
|
| 1012 | 1110 | |
| 1013 | 1111 | // Reset the row counter... |
| 1014 | 1112 | if (!isset($db_row_count[$this->seekCounter($request)])) |
| 1015 | - $db_row_count[$this->seekCounter($request)] = 0; |
|
| 1113 | + { |
|
| 1114 | + $db_row_count[$this->seekCounter($request)] = 0; |
|
| 1115 | + } |
|
| 1016 | 1116 | |
| 1017 | 1117 | // Return the right row. |
| 1018 | 1118 | return @pg_fetch_assoc($request, $db_row_count[$this->seekCounter($request)]++); |
@@ -12,5 +12,6 @@ |
||
| 12 | 12 | header('Location: ' . $boardurl); |
| 13 | 13 | } |
| 14 | 14 | // Can't find it... just forget it. |
| 15 | -else |
|
| 16 | - exit; |
|
| 17 | 15 | \ No newline at end of file |
| 16 | +else { |
|
| 17 | + exit; |
|
| 18 | +} |
|
@@ -803,8 +803,10 @@ |
||
| 803 | 803 | global $txt, $context; |
| 804 | 804 | |
| 805 | 805 | if ($output_method === 'echo') |
| 806 | - echo ' |
|
| 806 | + { |
|
| 807 | + echo ' |
|
| 807 | 808 | ', sprintf($txt['welcome_newest_member'], $context['common_stats']['latest_member']['link']), '<br />'; |
| 809 | + } |
|
| 808 | 810 | else |
| 809 | 811 | { |
| 810 | 812 | return $context['common_stats']['latest_member']; |
@@ -12,5 +12,6 @@ |
||
| 12 | 12 | header('Location: ' . $boardurl); |
| 13 | 13 | } |
| 14 | 14 | // Can't find it... just forget it. |
| 15 | -else |
|
| 15 | +else { |
|
| 16 | 16 | exit; |
| 17 | +} |
|
@@ -2,6 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | 4 | if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
| 5 | +{ |
|
| 5 | 6 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 7 | - exit; |
|
| 8 | 7 | \ No newline at end of file |
| 8 | +} |
|
| 9 | +else { |
|
| 10 | + exit; |
|
| 11 | +} |
|
@@ -2,6 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | 4 | if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
| 5 | +{ |
|
| 5 | 6 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 7 | - exit; |
|
| 8 | 7 | \ No newline at end of file |
| 8 | +} |
|
| 9 | +else { |
|
| 10 | + exit; |
|
| 11 | +} |
|