@@ -220,7 +220,7 @@ |
||
| 220 | 220 | ), |
| 221 | 221 | ), |
| 222 | 222 | ); |
| 223 | - */ |
|
| 223 | + */ |
|
| 224 | 224 | |
| 225 | 225 | // Are we using right-to-left orientation? |
| 226 | 226 | $first = $context['right_to_left'] ? 'last' : 'first'; |
@@ -384,7 +384,7 @@ |
||
| 384 | 384 | clean_cache(); |
| 385 | 385 | |
| 386 | 386 | // If warning decrement is enabled and we have people who have not had a new warning in 24 hours, lower their warning level. |
| 387 | - list (, , $modSettings['warning_decrement']) = explode(',', $modSettings['warning_settings']); |
|
| 387 | + list (,, $modSettings['warning_decrement']) = explode(',', $modSettings['warning_settings']); |
|
| 388 | 388 | if ($modSettings['warning_decrement']) |
| 389 | 389 | { |
| 390 | 390 | // Find every member who has a warning level... |
@@ -27,146 +27,146 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | if (!defined('RANDOM_COMPAT_READ_BUFFER')) { |
| 30 | - define('RANDOM_COMPAT_READ_BUFFER', 8); |
|
| 30 | + define('RANDOM_COMPAT_READ_BUFFER', 8); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | if (!is_callable('random_bytes')) { |
| 34 | - /** |
|
| 35 | - * Unless open_basedir is enabled, use /dev/urandom for |
|
| 36 | - * random numbers in accordance with best practices |
|
| 37 | - * |
|
| 38 | - * Why we use /dev/urandom and not /dev/random |
|
| 39 | - * @ref http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers |
|
| 40 | - * |
|
| 41 | - * @param int $bytes |
|
| 42 | - * |
|
| 43 | - * @throws Exception |
|
| 44 | - * |
|
| 45 | - * @return string |
|
| 46 | - */ |
|
| 47 | - function random_bytes($bytes) |
|
| 48 | - { |
|
| 49 | - /** @var resource $fp */ |
|
| 50 | - static $fp = null; |
|
| 34 | + /** |
|
| 35 | + * Unless open_basedir is enabled, use /dev/urandom for |
|
| 36 | + * random numbers in accordance with best practices |
|
| 37 | + * |
|
| 38 | + * Why we use /dev/urandom and not /dev/random |
|
| 39 | + * @ref http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers |
|
| 40 | + * |
|
| 41 | + * @param int $bytes |
|
| 42 | + * |
|
| 43 | + * @throws Exception |
|
| 44 | + * |
|
| 45 | + * @return string |
|
| 46 | + */ |
|
| 47 | + function random_bytes($bytes) |
|
| 48 | + { |
|
| 49 | + /** @var resource $fp */ |
|
| 50 | + static $fp = null; |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * This block should only be run once |
|
| 54 | - */ |
|
| 55 | - if (empty($fp)) { |
|
| 56 | - /** |
|
| 57 | - * We use /dev/urandom if it is a char device. |
|
| 58 | - * We never fall back to /dev/random |
|
| 59 | - */ |
|
| 60 | - /** @var resource|bool $fp */ |
|
| 61 | - $fp = fopen('/dev/urandom', 'rb'); |
|
| 62 | - if (is_resource($fp)) { |
|
| 63 | - /** @var array<string, int> $st */ |
|
| 64 | - $st = fstat($fp); |
|
| 65 | - if (($st['mode'] & 0170000) !== 020000) { |
|
| 66 | - fclose($fp); |
|
| 67 | - $fp = false; |
|
| 68 | - } |
|
| 69 | - } |
|
| 52 | + /** |
|
| 53 | + * This block should only be run once |
|
| 54 | + */ |
|
| 55 | + if (empty($fp)) { |
|
| 56 | + /** |
|
| 57 | + * We use /dev/urandom if it is a char device. |
|
| 58 | + * We never fall back to /dev/random |
|
| 59 | + */ |
|
| 60 | + /** @var resource|bool $fp */ |
|
| 61 | + $fp = fopen('/dev/urandom', 'rb'); |
|
| 62 | + if (is_resource($fp)) { |
|
| 63 | + /** @var array<string, int> $st */ |
|
| 64 | + $st = fstat($fp); |
|
| 65 | + if (($st['mode'] & 0170000) !== 020000) { |
|
| 66 | + fclose($fp); |
|
| 67 | + $fp = false; |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - if (is_resource($fp)) { |
|
| 72 | - /** |
|
| 73 | - * stream_set_read_buffer() does not exist in HHVM |
|
| 74 | - * |
|
| 75 | - * If we don't set the stream's read buffer to 0, PHP will |
|
| 76 | - * internally buffer 8192 bytes, which can waste entropy |
|
| 77 | - * |
|
| 78 | - * stream_set_read_buffer returns 0 on success |
|
| 79 | - */ |
|
| 80 | - if (is_callable('stream_set_read_buffer')) { |
|
| 81 | - stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER); |
|
| 82 | - } |
|
| 83 | - if (is_callable('stream_set_chunk_size')) { |
|
| 84 | - stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER); |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - } |
|
| 71 | + if (is_resource($fp)) { |
|
| 72 | + /** |
|
| 73 | + * stream_set_read_buffer() does not exist in HHVM |
|
| 74 | + * |
|
| 75 | + * If we don't set the stream's read buffer to 0, PHP will |
|
| 76 | + * internally buffer 8192 bytes, which can waste entropy |
|
| 77 | + * |
|
| 78 | + * stream_set_read_buffer returns 0 on success |
|
| 79 | + */ |
|
| 80 | + if (is_callable('stream_set_read_buffer')) { |
|
| 81 | + stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER); |
|
| 82 | + } |
|
| 83 | + if (is_callable('stream_set_chunk_size')) { |
|
| 84 | + stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER); |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - try { |
|
| 90 | - /** @var int $bytes */ |
|
| 91 | - $bytes = RandomCompat_intval($bytes); |
|
| 92 | - } catch (TypeError $ex) { |
|
| 93 | - throw new TypeError( |
|
| 94 | - 'random_bytes(): $bytes must be an integer' |
|
| 95 | - ); |
|
| 96 | - } |
|
| 89 | + try { |
|
| 90 | + /** @var int $bytes */ |
|
| 91 | + $bytes = RandomCompat_intval($bytes); |
|
| 92 | + } catch (TypeError $ex) { |
|
| 93 | + throw new TypeError( |
|
| 94 | + 'random_bytes(): $bytes must be an integer' |
|
| 95 | + ); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - if ($bytes < 1) { |
|
| 99 | - throw new Error( |
|
| 100 | - 'Length must be greater than 0' |
|
| 101 | - ); |
|
| 102 | - } |
|
| 98 | + if ($bytes < 1) { |
|
| 99 | + throw new Error( |
|
| 100 | + 'Length must be greater than 0' |
|
| 101 | + ); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * This if() block only runs if we managed to open a file handle |
|
| 106 | - * |
|
| 107 | - * It does not belong in an else {} block, because the above |
|
| 108 | - * if (empty($fp)) line is logic that should only be run once per |
|
| 109 | - * page load. |
|
| 110 | - */ |
|
| 111 | - if (is_resource($fp)) { |
|
| 112 | - /** |
|
| 113 | - * @var int |
|
| 114 | - */ |
|
| 115 | - $remaining = $bytes; |
|
| 104 | + /** |
|
| 105 | + * This if() block only runs if we managed to open a file handle |
|
| 106 | + * |
|
| 107 | + * It does not belong in an else {} block, because the above |
|
| 108 | + * if (empty($fp)) line is logic that should only be run once per |
|
| 109 | + * page load. |
|
| 110 | + */ |
|
| 111 | + if (is_resource($fp)) { |
|
| 112 | + /** |
|
| 113 | + * @var int |
|
| 114 | + */ |
|
| 115 | + $remaining = $bytes; |
|
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * @var string|bool |
|
| 119 | - */ |
|
| 120 | - $buf = ''; |
|
| 117 | + /** |
|
| 118 | + * @var string|bool |
|
| 119 | + */ |
|
| 120 | + $buf = ''; |
|
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * We use fread() in a loop to protect against partial reads |
|
| 124 | - */ |
|
| 125 | - do { |
|
| 126 | - /** |
|
| 127 | - * @var string|bool |
|
| 128 | - */ |
|
| 129 | - $read = fread($fp, $remaining); |
|
| 130 | - if (!is_string($read)) { |
|
| 131 | - if ($read === false) { |
|
| 132 | - /** |
|
| 133 | - * We cannot safely read from the file. Exit the |
|
| 134 | - * do-while loop and trigger the exception condition |
|
| 135 | - * |
|
| 136 | - * @var string|bool |
|
| 137 | - */ |
|
| 138 | - $buf = false; |
|
| 139 | - break; |
|
| 140 | - } |
|
| 141 | - } |
|
| 142 | - /** |
|
| 143 | - * Decrease the number of bytes returned from remaining |
|
| 144 | - */ |
|
| 145 | - $remaining -= RandomCompat_strlen($read); |
|
| 146 | - /** |
|
| 147 | - * @var string|bool |
|
| 148 | - */ |
|
| 149 | - $buf = $buf . $read; |
|
| 150 | - } while ($remaining > 0); |
|
| 122 | + /** |
|
| 123 | + * We use fread() in a loop to protect against partial reads |
|
| 124 | + */ |
|
| 125 | + do { |
|
| 126 | + /** |
|
| 127 | + * @var string|bool |
|
| 128 | + */ |
|
| 129 | + $read = fread($fp, $remaining); |
|
| 130 | + if (!is_string($read)) { |
|
| 131 | + if ($read === false) { |
|
| 132 | + /** |
|
| 133 | + * We cannot safely read from the file. Exit the |
|
| 134 | + * do-while loop and trigger the exception condition |
|
| 135 | + * |
|
| 136 | + * @var string|bool |
|
| 137 | + */ |
|
| 138 | + $buf = false; |
|
| 139 | + break; |
|
| 140 | + } |
|
| 141 | + } |
|
| 142 | + /** |
|
| 143 | + * Decrease the number of bytes returned from remaining |
|
| 144 | + */ |
|
| 145 | + $remaining -= RandomCompat_strlen($read); |
|
| 146 | + /** |
|
| 147 | + * @var string|bool |
|
| 148 | + */ |
|
| 149 | + $buf = $buf . $read; |
|
| 150 | + } while ($remaining > 0); |
|
| 151 | 151 | |
| 152 | - /** |
|
| 153 | - * Is our result valid? |
|
| 154 | - */ |
|
| 155 | - if (is_string($buf)) { |
|
| 156 | - if (RandomCompat_strlen($buf) === $bytes) { |
|
| 157 | - /** |
|
| 158 | - * Return our random entropy buffer here: |
|
| 159 | - */ |
|
| 160 | - return $buf; |
|
| 161 | - } |
|
| 162 | - } |
|
| 163 | - } |
|
| 152 | + /** |
|
| 153 | + * Is our result valid? |
|
| 154 | + */ |
|
| 155 | + if (is_string($buf)) { |
|
| 156 | + if (RandomCompat_strlen($buf) === $bytes) { |
|
| 157 | + /** |
|
| 158 | + * Return our random entropy buffer here: |
|
| 159 | + */ |
|
| 160 | + return $buf; |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - /** |
|
| 166 | - * If we reach here, PHP has failed us. |
|
| 167 | - */ |
|
| 168 | - throw new Exception( |
|
| 169 | - 'Error reading from source device' |
|
| 170 | - ); |
|
| 171 | - } |
|
| 165 | + /** |
|
| 166 | + * If we reach here, PHP has failed us. |
|
| 167 | + */ |
|
| 168 | + throw new Exception( |
|
| 169 | + 'Error reading from source device' |
|
| 170 | + ); |
|
| 171 | + } |
|
| 172 | 172 | } |
@@ -27,65 +27,65 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | if (!is_callable('random_bytes')) { |
| 30 | - /** |
|
| 31 | - * Windows with PHP < 5.3.0 will not have the function |
|
| 32 | - * openssl_random_pseudo_bytes() available, so let's use |
|
| 33 | - * CAPICOM to work around this deficiency. |
|
| 34 | - * |
|
| 35 | - * @param int $bytes |
|
| 36 | - * |
|
| 37 | - * @throws Exception |
|
| 38 | - * |
|
| 39 | - * @return string |
|
| 40 | - */ |
|
| 41 | - function random_bytes($bytes) |
|
| 42 | - { |
|
| 43 | - try { |
|
| 44 | - /** @var int $bytes */ |
|
| 45 | - $bytes = RandomCompat_intval($bytes); |
|
| 46 | - } catch (TypeError $ex) { |
|
| 47 | - throw new TypeError( |
|
| 48 | - 'random_bytes(): $bytes must be an integer' |
|
| 49 | - ); |
|
| 50 | - } |
|
| 30 | + /** |
|
| 31 | + * Windows with PHP < 5.3.0 will not have the function |
|
| 32 | + * openssl_random_pseudo_bytes() available, so let's use |
|
| 33 | + * CAPICOM to work around this deficiency. |
|
| 34 | + * |
|
| 35 | + * @param int $bytes |
|
| 36 | + * |
|
| 37 | + * @throws Exception |
|
| 38 | + * |
|
| 39 | + * @return string |
|
| 40 | + */ |
|
| 41 | + function random_bytes($bytes) |
|
| 42 | + { |
|
| 43 | + try { |
|
| 44 | + /** @var int $bytes */ |
|
| 45 | + $bytes = RandomCompat_intval($bytes); |
|
| 46 | + } catch (TypeError $ex) { |
|
| 47 | + throw new TypeError( |
|
| 48 | + 'random_bytes(): $bytes must be an integer' |
|
| 49 | + ); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - if ($bytes < 1) { |
|
| 53 | - throw new Error( |
|
| 54 | - 'Length must be greater than 0' |
|
| 55 | - ); |
|
| 56 | - } |
|
| 52 | + if ($bytes < 1) { |
|
| 53 | + throw new Error( |
|
| 54 | + 'Length must be greater than 0' |
|
| 55 | + ); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** @var string $buf */ |
|
| 59 | - $buf = ''; |
|
| 60 | - if (!class_exists('COM')) { |
|
| 61 | - throw new Error( |
|
| 62 | - 'COM does not exist' |
|
| 63 | - ); |
|
| 64 | - } |
|
| 65 | - /** @var COM $util */ |
|
| 66 | - $util = new COM('CAPICOM.Utilities.1'); |
|
| 67 | - $execCount = 0; |
|
| 58 | + /** @var string $buf */ |
|
| 59 | + $buf = ''; |
|
| 60 | + if (!class_exists('COM')) { |
|
| 61 | + throw new Error( |
|
| 62 | + 'COM does not exist' |
|
| 63 | + ); |
|
| 64 | + } |
|
| 65 | + /** @var COM $util */ |
|
| 66 | + $util = new COM('CAPICOM.Utilities.1'); |
|
| 67 | + $execCount = 0; |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Let's not let it loop forever. If we run N times and fail to |
|
| 71 | - * get N bytes of random data, then CAPICOM has failed us. |
|
| 72 | - */ |
|
| 73 | - do { |
|
| 74 | - $buf .= base64_decode((string) $util->GetRandom($bytes, 0)); |
|
| 75 | - if (RandomCompat_strlen($buf) >= $bytes) { |
|
| 76 | - /** |
|
| 77 | - * Return our random entropy buffer here: |
|
| 78 | - */ |
|
| 79 | - return (string) RandomCompat_substr($buf, 0, $bytes); |
|
| 80 | - } |
|
| 81 | - ++$execCount; |
|
| 82 | - } while ($execCount < $bytes); |
|
| 69 | + /** |
|
| 70 | + * Let's not let it loop forever. If we run N times and fail to |
|
| 71 | + * get N bytes of random data, then CAPICOM has failed us. |
|
| 72 | + */ |
|
| 73 | + do { |
|
| 74 | + $buf .= base64_decode((string) $util->GetRandom($bytes, 0)); |
|
| 75 | + if (RandomCompat_strlen($buf) >= $bytes) { |
|
| 76 | + /** |
|
| 77 | + * Return our random entropy buffer here: |
|
| 78 | + */ |
|
| 79 | + return (string) RandomCompat_substr($buf, 0, $bytes); |
|
| 80 | + } |
|
| 81 | + ++$execCount; |
|
| 82 | + } while ($execCount < $bytes); |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * If we reach here, PHP has failed us. |
|
| 86 | - */ |
|
| 87 | - throw new Exception( |
|
| 88 | - 'Could not gather sufficient random data' |
|
| 89 | - ); |
|
| 90 | - } |
|
| 84 | + /** |
|
| 85 | + * If we reach here, PHP has failed us. |
|
| 86 | + */ |
|
| 87 | + throw new Exception( |
|
| 88 | + 'Could not gather sufficient random data' |
|
| 89 | + ); |
|
| 90 | + } |
|
| 91 | 91 | } |
| 92 | 92 | \ No newline at end of file |
@@ -28,50 +28,50 @@ |
||
| 28 | 28 | |
| 29 | 29 | if (!is_callable('RandomCompat_intval')) { |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Cast to an integer if we can, safely. |
|
| 33 | - * |
|
| 34 | - * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX) |
|
| 35 | - * (non-inclusive), it will sanely cast it to an int. If you it's equal to |
|
| 36 | - * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats |
|
| 37 | - * lose precision, so the <= and => operators might accidentally let a float |
|
| 38 | - * through. |
|
| 39 | - * |
|
| 40 | - * @param int|float $number The number we want to convert to an int |
|
| 41 | - * @param bool $fail_open Set to true to not throw an exception |
|
| 42 | - * |
|
| 43 | - * @return float|int |
|
| 44 | - * @psalm-suppress InvalidReturnType |
|
| 45 | - * |
|
| 46 | - * @throws TypeError |
|
| 47 | - */ |
|
| 48 | - function RandomCompat_intval($number, $fail_open = false) |
|
| 49 | - { |
|
| 50 | - if (is_int($number) || is_float($number)) { |
|
| 51 | - $number += 0; |
|
| 52 | - } elseif (is_numeric($number)) { |
|
| 53 | - /** @psalm-suppress InvalidOperand */ |
|
| 54 | - $number += 0; |
|
| 55 | - } |
|
| 56 | - /** @var int|float $number */ |
|
| 31 | + /** |
|
| 32 | + * Cast to an integer if we can, safely. |
|
| 33 | + * |
|
| 34 | + * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX) |
|
| 35 | + * (non-inclusive), it will sanely cast it to an int. If you it's equal to |
|
| 36 | + * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats |
|
| 37 | + * lose precision, so the <= and => operators might accidentally let a float |
|
| 38 | + * through. |
|
| 39 | + * |
|
| 40 | + * @param int|float $number The number we want to convert to an int |
|
| 41 | + * @param bool $fail_open Set to true to not throw an exception |
|
| 42 | + * |
|
| 43 | + * @return float|int |
|
| 44 | + * @psalm-suppress InvalidReturnType |
|
| 45 | + * |
|
| 46 | + * @throws TypeError |
|
| 47 | + */ |
|
| 48 | + function RandomCompat_intval($number, $fail_open = false) |
|
| 49 | + { |
|
| 50 | + if (is_int($number) || is_float($number)) { |
|
| 51 | + $number += 0; |
|
| 52 | + } elseif (is_numeric($number)) { |
|
| 53 | + /** @psalm-suppress InvalidOperand */ |
|
| 54 | + $number += 0; |
|
| 55 | + } |
|
| 56 | + /** @var int|float $number */ |
|
| 57 | 57 | |
| 58 | - if ( |
|
| 59 | - is_float($number) |
|
| 60 | - && |
|
| 61 | - $number > ~PHP_INT_MAX |
|
| 62 | - && |
|
| 63 | - $number < PHP_INT_MAX |
|
| 64 | - ) { |
|
| 65 | - $number = (int) $number; |
|
| 66 | - } |
|
| 58 | + if ( |
|
| 59 | + is_float($number) |
|
| 60 | + && |
|
| 61 | + $number > ~PHP_INT_MAX |
|
| 62 | + && |
|
| 63 | + $number < PHP_INT_MAX |
|
| 64 | + ) { |
|
| 65 | + $number = (int) $number; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - if (is_int($number)) { |
|
| 69 | - return (int) $number; |
|
| 70 | - } elseif (!$fail_open) { |
|
| 71 | - throw new TypeError( |
|
| 72 | - 'Expected an integer.' |
|
| 73 | - ); |
|
| 74 | - } |
|
| 75 | - return $number; |
|
| 76 | - } |
|
| 68 | + if (is_int($number)) { |
|
| 69 | + return (int) $number; |
|
| 70 | + } elseif (!$fail_open) { |
|
| 71 | + throw new TypeError( |
|
| 72 | + 'Expected an integer.' |
|
| 73 | + ); |
|
| 74 | + } |
|
| 75 | + return $number; |
|
| 76 | + } |
|
| 77 | 77 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | display_db_error(); |
| 74 | 74 | |
| 75 | 75 | // We need to escape ' and \ |
| 76 | - $db_passwd = str_replace(array('\\','\''), array('\\\\','\\\''), $db_passwd); |
|
| 76 | + $db_passwd = str_replace(array('\\', '\''), array('\\\\', '\\\''), $db_passwd); |
|
| 77 | 77 | |
| 78 | 78 | if (!empty($db_options['persist'])) |
| 79 | 79 | $connection = @pg_pconnect((empty($db_server) ? '' : 'host=' . $db_server . ' ') . 'dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\'' . (empty($db_options['port']) ? '' : ' port=\'' . $db_options['port'] . '\'')); |
@@ -925,7 +925,7 @@ discard block |
||
| 925 | 925 | if (filter_var($error_array[2], FILTER_VALIDATE_IP) === false) |
| 926 | 926 | $error_array[2] = null; |
| 927 | 927 | |
| 928 | - if(empty($db_persist)) |
|
| 928 | + if (empty($db_persist)) |
|
| 929 | 929 | { // without pooling |
| 930 | 930 | if (empty($pg_error_data_prep)) |
| 931 | 931 | $pg_error_data_prep = pg_prepare($db_connection, 'smf_log_errors', |
@@ -393,17 +393,17 @@ discard block |
||
| 393 | 393 | $quickbuttons = array( |
| 394 | 394 | 'approve' => array( |
| 395 | 395 | 'label' => $txt['approve'], |
| 396 | - 'href' => $scripturl.'?action=moderate;area=postmod;sa='.$context['current_view'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'].';approve='.$item['id'], |
|
| 396 | + 'href' => $scripturl . '?action=moderate;area=postmod;sa=' . $context['current_view'] . ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';approve=' . $item['id'], |
|
| 397 | 397 | 'icon' => 'approve', |
| 398 | 398 | ), |
| 399 | 399 | 'delete' => array( |
| 400 | 400 | 'label' => $txt['remove'], |
| 401 | - 'href' => $scripturl.'?action=moderate;area=postmod;sa='.$context['current_view'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'].';delete='.$item['id'], |
|
| 401 | + 'href' => $scripturl . '?action=moderate;area=postmod;sa=' . $context['current_view'] . ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';delete=' . $item['id'], |
|
| 402 | 402 | 'icon' => 'remove_button', |
| 403 | 403 | 'show' => $item['can_delete'] |
| 404 | 404 | ), |
| 405 | 405 | 'quickmod' => array( |
| 406 | - 'content' => '<input type="checkbox" name="item[]" value="'.$item['id'].'" checked>', |
|
| 406 | + 'content' => '<input type="checkbox" name="item[]" value="' . $item['id'] . '" checked>', |
|
| 407 | 407 | 'show' => !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 |
| 408 | 408 | ), |
| 409 | 409 | ); |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $quickbuttons = array( |
| 469 | 469 | 'delete' => array( |
| 470 | 470 | 'label' => $txt['remove_message'], |
| 471 | - 'href' => $scripturl.'?action=moderate;area=userwatch;sa=post;delete='.$post['id'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'], |
|
| 471 | + 'href' => $scripturl . '?action=moderate;area=userwatch;sa=post;delete=' . $post['id'] . ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'], |
|
| 472 | 472 | 'javascript' => 'data-confirm="' . $txt['mc_watched_users_delete_post'] . '"', |
| 473 | 473 | 'class' => 'you_sure', |
| 474 | 474 | 'icon' => 'remove_button', |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | AND a.is_read = 0' : '') . (!empty($alertIDs) ? ' |
| 262 | 262 | AND a.id_alert IN ({array_int:alertIDs})' : '') . ' |
| 263 | 263 | ORDER BY id_alert DESC' . (!empty($limit) ? ' |
| 264 | - LIMIT {int:limit}' : '') . (!empty($offset) ?' |
|
| 264 | + LIMIT {int:limit}' : '') . (!empty($offset) ? ' |
|
| 265 | 265 | OFFSET {int:offset}' : ''), |
| 266 | 266 | array( |
| 267 | 267 | 'id_member' => $memID, |
@@ -1160,20 +1160,20 @@ discard block |
||
| 1160 | 1160 | $context['posts'][$key]['quickbuttons'] = array( |
| 1161 | 1161 | 'reply' => array( |
| 1162 | 1162 | 'label' => $txt['reply'], |
| 1163 | - 'href' => $scripturl.'?action=post;topic='.$post['topic'].'.'.$post['start'], |
|
| 1163 | + 'href' => $scripturl . '?action=post;topic=' . $post['topic'] . '.' . $post['start'], |
|
| 1164 | 1164 | 'icon' => 'reply_button', |
| 1165 | 1165 | 'show' => $post['can_reply'] |
| 1166 | 1166 | ), |
| 1167 | 1167 | 'quote' => array( |
| 1168 | 1168 | 'label' => $txt['quote_action'], |
| 1169 | - 'href' => $scripturl.'?action=post;topic='.$post['topic'].'.'.$post['start'].';quote='.$post['id'], |
|
| 1169 | + 'href' => $scripturl . '?action=post;topic=' . $post['topic'] . '.' . $post['start'] . ';quote=' . $post['id'], |
|
| 1170 | 1170 | 'icon' => 'quote', |
| 1171 | 1171 | 'show' => $post['can_quote'] |
| 1172 | 1172 | ), |
| 1173 | 1173 | 'remove' => array( |
| 1174 | 1174 | 'label' => $txt['remove'], |
| 1175 | - 'href' => $scripturl.'?action=deletemsg;msg='.$post['id'].';topic='.$post['topic'].';profile;u='.$context['member']['id'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'], |
|
| 1176 | - 'javascript' => 'data-confirm="'.$txt['remove_message'].'"', |
|
| 1175 | + 'href' => $scripturl . '?action=deletemsg;msg=' . $post['id'] . ';topic=' . $post['topic'] . ';profile;u=' . $context['member']['id'] . ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'], |
|
| 1176 | + 'javascript' => 'data-confirm="' . $txt['remove_message'] . '"', |
|
| 1177 | 1177 | 'class' => 'you_sure', |
| 1178 | 1178 | 'icon' => 'remove_button', |
| 1179 | 1179 | 'show' => $post['can_delete'] |
@@ -93,14 +93,14 @@ discard block |
||
| 93 | 93 | ), |
| 94 | 94 | 'ignore' => array( |
| 95 | 95 | 'label' => $report['ignore'] ? $txt['mc_reportedp_unignore'] : $txt['mc_reportedp_ignore'], |
| 96 | - 'href' => $scripturl.'?action=moderate;area=reported'.$context['report_type'].';sa=handle;ignore='.(int)!$report['ignore'].';rid='.$report['id'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'].';'.$context['mod-report-ignore_token_var'].'='.$context['mod-report-ignore_token'], |
|
| 96 | + 'href' => $scripturl . '?action=moderate;area=reported' . $context['report_type'] . ';sa=handle;ignore=' . (int) !$report['ignore'] . ';rid=' . $report['id'] . ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';' . $context['mod-report-ignore_token_var'] . '=' . $context['mod-report-ignore_token'], |
|
| 97 | 97 | 'javascript' => !$report['ignore'] ? ' data-confirm="' . $txt['mc_reportedp_ignore_confirm'] . '"' : '', |
| 98 | 98 | 'class' => 'you_sure', |
| 99 | 99 | 'icon' => 'ignore' |
| 100 | 100 | ), |
| 101 | 101 | 'close' => array( |
| 102 | 102 | 'label' => $context['view_closed'] ? $txt['mc_reportedp_open'] : $txt['mc_reportedp_close'], |
| 103 | - 'href' => $scripturl.'?action=moderate;area=reported'.$context['report_type'].';sa=handle;closed='.(int)!$report['closed'].';rid='.$report['id'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'].';'.$context['mod-report-closed_token_var'].'='.$context['mod-report-closed_token'], |
|
| 103 | + 'href' => $scripturl . '?action=moderate;area=reported' . $context['report_type'] . ';sa=handle;closed=' . (int) !$report['closed'] . ';rid=' . $report['id'] . ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';' . $context['mod-report-closed_token_var'] . '=' . $context['mod-report-closed_token'], |
|
| 104 | 104 | 'icon' => $context['view_closed'] ? 'folder' : 'close', |
| 105 | 105 | ), |
| 106 | 106 | ); |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | if ($context['report_type'] == 'posts') |
| 110 | 110 | $context['reports'][$key]['quickbuttons']['delete'] = array( |
| 111 | 111 | 'label' => $txt['mc_reportedp_delete'], |
| 112 | - 'href' => $scripturl.'?action=deletemsg;topic='.$report['topic']['id'].'.0;msg='.$report['topic']['id_msg'].';modcenter;'.$context['session_var'].'='.$context['session_id'], |
|
| 113 | - 'javascript' => 'data-confirm="'.$txt['mc_reportedp_delete_confirm'].'"', |
|
| 112 | + 'href' => $scripturl . '?action=deletemsg;topic=' . $report['topic']['id'] . '.0;msg=' . $report['topic']['id_msg'] . ';modcenter;' . $context['session_var'] . '=' . $context['session_id'], |
|
| 113 | + 'javascript' => 'data-confirm="' . $txt['mc_reportedp_delete_confirm'] . '"', |
|
| 114 | 114 | 'class' => 'you_sure', |
| 115 | 115 | 'icon' => 'delete', |
| 116 | 116 | 'show' => !$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards'])) |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | // Ban reported member/post author link |
| 120 | 120 | if ($context['report_type'] == 'members') |
| 121 | - $ban_link = $scripturl.'?action=admin;area=ban;sa=add;u='.$report['user']['id'].';'.$context['session_var'].'='.$context['session_id']; |
|
| 121 | + $ban_link = $scripturl . '?action=admin;area=ban;sa=add;u=' . $report['user']['id'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
|
| 122 | 122 | else |
| 123 | - $ban_link = $scripturl.'?action=admin;area=ban;sa=add'.(!empty($report['author']['id']) ? ';u='.$report['author']['id'] : ';msg='.$report['topic']['id_msg']).';'.$context['session_var'].'='.$context['session_id']; |
|
| 123 | + $ban_link = $scripturl . '?action=admin;area=ban;sa=add' . (!empty($report['author']['id']) ? ';u=' . $report['author']['id'] : ';msg=' . $report['topic']['id_msg']) . ';' . $context['session_var'] . '=' . $context['session_id']; |
|
| 124 | 124 | |
| 125 | 125 | $context['reports'][$key]['quickbuttons'] += array( |
| 126 | 126 | 'ban' => array( |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | 'show' => !$report['closed'] && !empty($context['report_manage_bans']) && ($context['report_type'] == 'posts' || $context['report_type'] == 'members' && !empty($report['user']['id'])) |
| 131 | 131 | ), |
| 132 | 132 | 'quickmod' => array( |
| 133 | - 'content' => '<input type="checkbox" name="close[]" value="'.$report['id'].'">', |
|
| 133 | + 'content' => '<input type="checkbox" name="close[]" value="' . $report['id'] . '">', |
|
| 134 | 134 | 'show' => !$context['view_closed'] |
| 135 | 135 | ) |
| 136 | 136 | ); |