Completed
Pull Request — release-2.1 (#3761)
by Rick
07:11
created
other/upgrade-helper.php 1 patch
Indentation   +307 added lines, -307 removed lines patch added patch discarded remove patch
@@ -14,66 +14,66 @@  discard block
 block discarded – undo
14 14
  */
15 15
 
16 16
 if (!defined('SMF_VERSION'))
17
-    die('No direct access!');
17
+	die('No direct access!');
18 18
 
19 19
 if (!function_exists('un_htmlspecialchars'))
20 20
 {
21
-    /**
22
-     * Undo the voodoo htmlspecialchars does.
23
-     *
24
-     * @param $string
25
-     * @return string
26
-     */
27
-    function un_htmlspecialchars($string)
28
-    {
29
-        return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES)) + array(''' => '\'', ' ' => ' '));
30
-    }
21
+	/**
22
+	 * Undo the voodoo htmlspecialchars does.
23
+	 *
24
+	 * @param $string
25
+	 * @return string
26
+	 */
27
+	function un_htmlspecialchars($string)
28
+	{
29
+		return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES)) + array(''' => '\'', ' ' => ' '));
30
+	}
31 31
 }
32 32
 
33 33
 if (!function_exists('text2words'))
34 34
 {
35
-    /**
36
-     * Split a sentence into words.
37
-     *
38
-     * @param $text
39
-     * @return array
40
-     */
41
-    function text2words($text)
42
-    {
43
-        // Step 1: Remove entities/things we don't consider words:
44
-        $words = preg_replace('~(?:[\x0B\0\xA0\t\r\s\n(){}\\[\\]<>!@$%^*.,:+=`\~\?/\\\\]+|&(?:amp|lt|gt|quot);)+~', ' ', $text);
45
-
46
-        // Step 2: Entities we left to letters, where applicable, lowercase.
47
-        $words = preg_replace('~([^&\d]|^)[#;]~', '$1 ', un_htmlspecialchars(strtolower($words)));
48
-
49
-        // Step 3: Ready to split apart and index!
50
-        $words = explode(' ', $words);
51
-        $returned_words = array();
52
-        foreach ($words as $word)
53
-        {
54
-            $word = trim($word, '-_\'');
55
-
56
-            if ($word != '')
57
-                $returned_words[] = substr($word, 0, 20);
58
-        }
59
-
60
-        return array_unique($returned_words);
61
-    }
35
+	/**
36
+	 * Split a sentence into words.
37
+	 *
38
+	 * @param $text
39
+	 * @return array
40
+	 */
41
+	function text2words($text)
42
+	{
43
+		// Step 1: Remove entities/things we don't consider words:
44
+		$words = preg_replace('~(?:[\x0B\0\xA0\t\r\s\n(){}\\[\\]<>!@$%^*.,:+=`\~\?/\\\\]+|&(?:amp|lt|gt|quot);)+~', ' ', $text);
45
+
46
+		// Step 2: Entities we left to letters, where applicable, lowercase.
47
+		$words = preg_replace('~([^&\d]|^)[#;]~', '$1 ', un_htmlspecialchars(strtolower($words)));
48
+
49
+		// Step 3: Ready to split apart and index!
50
+		$words = explode(' ', $words);
51
+		$returned_words = array();
52
+		foreach ($words as $word)
53
+		{
54
+			$word = trim($word, '-_\'');
55
+
56
+			if ($word != '')
57
+				$returned_words[] = substr($word, 0, 20);
58
+		}
59
+
60
+		return array_unique($returned_words);
61
+	}
62 62
 }
63 63
 
64 64
 if (!function_exists('md5_hmac'))
65 65
 {
66
-    /**
67
-     * Generate an MD5 hash using the HMAC method.
68
-     *
69
-     * @param string $data
70
-     * @param string $key
71
-     * @return string
72
-     */
73
-    function md5_hmac($data, $key)
74
-    {
75
-        return hash_hmac('md5', $data, $key);
76
-    }
66
+	/**
67
+	 * Generate an MD5 hash using the HMAC method.
68
+	 *
69
+	 * @param string $data
70
+	 * @param string $key
71
+	 * @return string
72
+	 */
73
+	function md5_hmac($data, $key)
74
+	{
75
+		return hash_hmac('md5', $data, $key);
76
+	}
77 77
 }
78 78
 
79 79
 /**
@@ -82,17 +82,17 @@  discard block
 block discarded – undo
82 82
  */
83 83
 function upgrade_clean_cache()
84 84
 {
85
-    global $cacheAPI, $sourcedir;
85
+	global $cacheAPI, $sourcedir;
86 86
 
87
-    // Initialize the cache API if it does not have an instance yet.
88
-    if (empty($cacheAPI))
89
-    {
90
-        require_once($sourcedir . '/Load.php');
91
-        loadCacheAccelerator();
92
-    }
87
+	// Initialize the cache API if it does not have an instance yet.
88
+	if (empty($cacheAPI))
89
+	{
90
+		require_once($sourcedir . '/Load.php');
91
+		loadCacheAccelerator();
92
+	}
93 93
 
94
-    // Just fall back to Load.php's clean_cache function.
95
-    clean_cache();
94
+	// Just fall back to Load.php's clean_cache function.
95
+	clean_cache();
96 96
 }
97 97
 
98 98
 /**
@@ -102,40 +102,40 @@  discard block
 block discarded – undo
102 102
  */
103 103
 function getMemberGroups()
104 104
 {
105
-    global $smcFunc;
106
-    static $member_groups = array();
105
+	global $smcFunc;
106
+	static $member_groups = array();
107 107
 
108
-    if (!empty($member_groups))
109
-        return $member_groups;
108
+	if (!empty($member_groups))
109
+		return $member_groups;
110 110
 
111
-    $request = $smcFunc['db_query']('', '
111
+	$request = $smcFunc['db_query']('', '
112 112
 		SELECT group_name, id_group
113 113
 		FROM {db_prefix}membergroups
114 114
 		WHERE id_group = {int:admin_group} OR id_group > {int:old_group}',
115
-        array(
116
-            'admin_group' => 1,
117
-            'old_group' => 7,
118
-            'db_error_skip' => true,
119
-        )
120
-    );
121
-    if ($request === false)
122
-    {
123
-        $request = $smcFunc['db_query']('', '
115
+		array(
116
+			'admin_group' => 1,
117
+			'old_group' => 7,
118
+			'db_error_skip' => true,
119
+		)
120
+	);
121
+	if ($request === false)
122
+	{
123
+		$request = $smcFunc['db_query']('', '
124 124
 			SELECT membergroup, id_group
125 125
 			FROM {db_prefix}membergroups
126 126
 			WHERE id_group = {int:admin_group} OR id_group > {int:old_group}',
127
-            array(
128
-                'admin_group' => 1,
129
-                'old_group' => 7,
130
-                'db_error_skip' => true,
131
-            )
132
-        );
133
-    }
134
-    while ($row = $smcFunc['db_fetch_row']($request))
135
-        $member_groups[trim($row[0])] = $row[1];
136
-    $smcFunc['db_free_result']($request);
137
-
138
-    return $member_groups;
127
+			array(
128
+				'admin_group' => 1,
129
+				'old_group' => 7,
130
+				'db_error_skip' => true,
131
+			)
132
+		);
133
+	}
134
+	while ($row = $smcFunc['db_fetch_row']($request))
135
+		$member_groups[trim($row[0])] = $row[1];
136
+	$smcFunc['db_free_result']($request);
137
+
138
+	return $member_groups;
139 139
 }
140 140
 
141 141
 /**
@@ -146,197 +146,197 @@  discard block
 block discarded – undo
146 146
  */
147 147
 function makeFilesWritable(&$files)
148 148
 {
149
-    global $upcontext, $boarddir;
150
-
151
-    if (empty($files))
152
-        return true;
153
-
154
-    $failure = false;
155
-    // On linux, it's easy - just use is_writable!
156
-    if (substr(__FILE__, 1, 2) != ':\\')
157
-    {
158
-        $upcontext['systemos'] = 'linux';
159
-
160
-        foreach ($files as $k => $file)
161
-        {
162
-            if (!is_writable($file))
163
-            {
164
-                @chmod($file, 0755);
165
-
166
-                // Well, 755 hopefully worked... if not, try 777.
167
-                if (!is_writable($file) && !@chmod($file, 0777))
168
-                    $failure = true;
169
-                // Otherwise remove it as it's good!
170
-                else
171
-                    unset($files[$k]);
172
-            }
173
-            else
174
-                unset($files[$k]);
175
-        }
176
-    }
177
-    // Windows is trickier.  Let's try opening for r+...
178
-    else
179
-    {
180
-        $upcontext['systemos'] = 'windows';
181
-
182
-        foreach ($files as $k => $file)
183
-        {
184
-            // Folders can't be opened for write... but the index.php in them can ;).
185
-            if (is_dir($file))
186
-                $file .= '/index.php';
187
-
188
-            // Funny enough, chmod actually does do something on windows - it removes the read only attribute.
189
-            @chmod($file, 0777);
190
-            $fp = @fopen($file, 'r+');
191
-
192
-            // Hmm, okay, try just for write in that case...
193
-            if (!$fp)
194
-                $fp = @fopen($file, 'w');
195
-
196
-            if (!$fp)
197
-                $failure = true;
198
-            else
199
-                unset($files[$k]);
200
-            @fclose($fp);
201
-        }
202
-    }
203
-
204
-    if (empty($files))
205
-        return true;
206
-
207
-    if (!isset($_SERVER))
208
-        return !$failure;
209
-
210
-    // What still needs to be done?
211
-    $upcontext['chmod']['files'] = $files;
212
-
213
-    // If it's windows it's a mess...
214
-    if ($failure && substr(__FILE__, 1, 2) == ':\\')
215
-    {
216
-        $upcontext['chmod']['ftp_error'] = 'total_mess';
217
-
218
-        return false;
219
-    }
220
-    // We're going to have to use... FTP!
221
-    elseif ($failure)
222
-    {
223
-        // Load any session data we might have...
224
-        if (!isset($_POST['ftp_username']) && isset($_SESSION['installer_temp_ftp']))
225
-        {
226
-            $upcontext['chmod']['server'] = $_SESSION['installer_temp_ftp']['server'];
227
-            $upcontext['chmod']['port'] = $_SESSION['installer_temp_ftp']['port'];
228
-            $upcontext['chmod']['username'] = $_SESSION['installer_temp_ftp']['username'];
229
-            $upcontext['chmod']['password'] = $_SESSION['installer_temp_ftp']['password'];
230
-            $upcontext['chmod']['path'] = $_SESSION['installer_temp_ftp']['path'];
231
-        }
232
-        // Or have we submitted?
233
-        elseif (isset($_POST['ftp_username']))
234
-        {
235
-            $upcontext['chmod']['server'] = $_POST['ftp_server'];
236
-            $upcontext['chmod']['port'] = $_POST['ftp_port'];
237
-            $upcontext['chmod']['username'] = $_POST['ftp_username'];
238
-            $upcontext['chmod']['password'] = $_POST['ftp_password'];
239
-            $upcontext['chmod']['path'] = $_POST['ftp_path'];
240
-        }
241
-
242
-        if (isset($upcontext['chmod']['username']))
243
-        {
244
-            $ftp = new ftp_connection($upcontext['chmod']['server'], $upcontext['chmod']['port'], $upcontext['chmod']['username'], $upcontext['chmod']['password']);
245
-
246
-            if ($ftp->error === false)
247
-            {
248
-                // Try it without /home/abc just in case they messed up.
249
-                if (!$ftp->chdir($upcontext['chmod']['path']))
250
-                {
251
-                    $upcontext['chmod']['ftp_error'] = $ftp->last_message;
252
-                    $ftp->chdir(preg_replace('~^/home[2]?/[^/]+?~', '', $upcontext['chmod']['path']));
253
-                }
254
-            }
255
-        }
256
-
257
-        if (!isset($ftp) || $ftp->error !== false)
258
-        {
259
-            if (!isset($ftp))
260
-                $ftp = new ftp_connection(null);
261
-            // Save the error so we can mess with listing...
262
-            elseif ($ftp->error !== false && !isset($upcontext['chmod']['ftp_error']))
263
-                $upcontext['chmod']['ftp_error'] = $ftp->last_message === null ? '' : $ftp->last_message;
264
-
265
-            list ($username, $detect_path, $found_path) = $ftp->detect_path(dirname(__FILE__));
266
-
267
-            if ($found_path || !isset($upcontext['chmod']['path']))
268
-                $upcontext['chmod']['path'] = $detect_path;
269
-
270
-            if (!isset($upcontext['chmod']['username']))
271
-                $upcontext['chmod']['username'] = $username;
272
-
273
-            // Don't forget the login token.
274
-            $upcontext += createToken('login');
275
-
276
-            return false;
277
-        }
278
-        else
279
-        {
280
-            // We want to do a relative path for FTP.
281
-            if (!in_array($upcontext['chmod']['path'], array('', '/')))
282
-            {
283
-                $ftp_root = strtr($boarddir, array($upcontext['chmod']['path'] => ''));
284
-                if (substr($ftp_root, -1) == '/' && ($upcontext['chmod']['path'] == '' || $upcontext['chmod']['path'][0] === '/'))
285
-                    $ftp_root = substr($ftp_root, 0, -1);
286
-            }
287
-            else
288
-                $ftp_root = $boarddir;
289
-
290
-            // Save the info for next time!
291
-            $_SESSION['installer_temp_ftp'] = array(
292
-                'server' => $upcontext['chmod']['server'],
293
-                'port' => $upcontext['chmod']['port'],
294
-                'username' => $upcontext['chmod']['username'],
295
-                'password' => $upcontext['chmod']['password'],
296
-                'path' => $upcontext['chmod']['path'],
297
-                'root' => $ftp_root,
298
-            );
299
-
300
-            foreach ($files as $k => $file)
301
-            {
302
-                if (!is_writable($file))
303
-                    $ftp->chmod($file, 0755);
304
-                if (!is_writable($file))
305
-                    $ftp->chmod($file, 0777);
306
-
307
-                // Assuming that didn't work calculate the path without the boarddir.
308
-                if (!is_writable($file))
309
-                {
310
-                    if (strpos($file, $boarddir) === 0)
311
-                    {
312
-                        $ftp_file = strtr($file, array($_SESSION['installer_temp_ftp']['root'] => ''));
313
-                        $ftp->chmod($ftp_file, 0755);
314
-                        if (!is_writable($file))
315
-                            $ftp->chmod($ftp_file, 0777);
316
-                        // Sometimes an extra slash can help...
317
-                        $ftp_file = '/' . $ftp_file;
318
-                        if (!is_writable($file))
319
-                            $ftp->chmod($ftp_file, 0755);
320
-                        if (!is_writable($file))
321
-                            $ftp->chmod($ftp_file, 0777);
322
-                    }
323
-                }
324
-
325
-                if (is_writable($file))
326
-                    unset($files[$k]);
327
-            }
328
-
329
-            $ftp->close();
330
-        }
331
-    }
332
-
333
-    // What remains?
334
-    $upcontext['chmod']['files'] = $files;
335
-
336
-    if (empty($files))
337
-        return true;
338
-
339
-    return false;
149
+	global $upcontext, $boarddir;
150
+
151
+	if (empty($files))
152
+		return true;
153
+
154
+	$failure = false;
155
+	// On linux, it's easy - just use is_writable!
156
+	if (substr(__FILE__, 1, 2) != ':\\')
157
+	{
158
+		$upcontext['systemos'] = 'linux';
159
+
160
+		foreach ($files as $k => $file)
161
+		{
162
+			if (!is_writable($file))
163
+			{
164
+				@chmod($file, 0755);
165
+
166
+				// Well, 755 hopefully worked... if not, try 777.
167
+				if (!is_writable($file) && !@chmod($file, 0777))
168
+					$failure = true;
169
+				// Otherwise remove it as it's good!
170
+				else
171
+					unset($files[$k]);
172
+			}
173
+			else
174
+				unset($files[$k]);
175
+		}
176
+	}
177
+	// Windows is trickier.  Let's try opening for r+...
178
+	else
179
+	{
180
+		$upcontext['systemos'] = 'windows';
181
+
182
+		foreach ($files as $k => $file)
183
+		{
184
+			// Folders can't be opened for write... but the index.php in them can ;).
185
+			if (is_dir($file))
186
+				$file .= '/index.php';
187
+
188
+			// Funny enough, chmod actually does do something on windows - it removes the read only attribute.
189
+			@chmod($file, 0777);
190
+			$fp = @fopen($file, 'r+');
191
+
192
+			// Hmm, okay, try just for write in that case...
193
+			if (!$fp)
194
+				$fp = @fopen($file, 'w');
195
+
196
+			if (!$fp)
197
+				$failure = true;
198
+			else
199
+				unset($files[$k]);
200
+			@fclose($fp);
201
+		}
202
+	}
203
+
204
+	if (empty($files))
205
+		return true;
206
+
207
+	if (!isset($_SERVER))
208
+		return !$failure;
209
+
210
+	// What still needs to be done?
211
+	$upcontext['chmod']['files'] = $files;
212
+
213
+	// If it's windows it's a mess...
214
+	if ($failure && substr(__FILE__, 1, 2) == ':\\')
215
+	{
216
+		$upcontext['chmod']['ftp_error'] = 'total_mess';
217
+
218
+		return false;
219
+	}
220
+	// We're going to have to use... FTP!
221
+	elseif ($failure)
222
+	{
223
+		// Load any session data we might have...
224
+		if (!isset($_POST['ftp_username']) && isset($_SESSION['installer_temp_ftp']))
225
+		{
226
+			$upcontext['chmod']['server'] = $_SESSION['installer_temp_ftp']['server'];
227
+			$upcontext['chmod']['port'] = $_SESSION['installer_temp_ftp']['port'];
228
+			$upcontext['chmod']['username'] = $_SESSION['installer_temp_ftp']['username'];
229
+			$upcontext['chmod']['password'] = $_SESSION['installer_temp_ftp']['password'];
230
+			$upcontext['chmod']['path'] = $_SESSION['installer_temp_ftp']['path'];
231
+		}
232
+		// Or have we submitted?
233
+		elseif (isset($_POST['ftp_username']))
234
+		{
235
+			$upcontext['chmod']['server'] = $_POST['ftp_server'];
236
+			$upcontext['chmod']['port'] = $_POST['ftp_port'];
237
+			$upcontext['chmod']['username'] = $_POST['ftp_username'];
238
+			$upcontext['chmod']['password'] = $_POST['ftp_password'];
239
+			$upcontext['chmod']['path'] = $_POST['ftp_path'];
240
+		}
241
+
242
+		if (isset($upcontext['chmod']['username']))
243
+		{
244
+			$ftp = new ftp_connection($upcontext['chmod']['server'], $upcontext['chmod']['port'], $upcontext['chmod']['username'], $upcontext['chmod']['password']);
245
+
246
+			if ($ftp->error === false)
247
+			{
248
+				// Try it without /home/abc just in case they messed up.
249
+				if (!$ftp->chdir($upcontext['chmod']['path']))
250
+				{
251
+					$upcontext['chmod']['ftp_error'] = $ftp->last_message;
252
+					$ftp->chdir(preg_replace('~^/home[2]?/[^/]+?~', '', $upcontext['chmod']['path']));
253
+				}
254
+			}
255
+		}
256
+
257
+		if (!isset($ftp) || $ftp->error !== false)
258
+		{
259
+			if (!isset($ftp))
260
+				$ftp = new ftp_connection(null);
261
+			// Save the error so we can mess with listing...
262
+			elseif ($ftp->error !== false && !isset($upcontext['chmod']['ftp_error']))
263
+				$upcontext['chmod']['ftp_error'] = $ftp->last_message === null ? '' : $ftp->last_message;
264
+
265
+			list ($username, $detect_path, $found_path) = $ftp->detect_path(dirname(__FILE__));
266
+
267
+			if ($found_path || !isset($upcontext['chmod']['path']))
268
+				$upcontext['chmod']['path'] = $detect_path;
269
+
270
+			if (!isset($upcontext['chmod']['username']))
271
+				$upcontext['chmod']['username'] = $username;
272
+
273
+			// Don't forget the login token.
274
+			$upcontext += createToken('login');
275
+
276
+			return false;
277
+		}
278
+		else
279
+		{
280
+			// We want to do a relative path for FTP.
281
+			if (!in_array($upcontext['chmod']['path'], array('', '/')))
282
+			{
283
+				$ftp_root = strtr($boarddir, array($upcontext['chmod']['path'] => ''));
284
+				if (substr($ftp_root, -1) == '/' && ($upcontext['chmod']['path'] == '' || $upcontext['chmod']['path'][0] === '/'))
285
+					$ftp_root = substr($ftp_root, 0, -1);
286
+			}
287
+			else
288
+				$ftp_root = $boarddir;
289
+
290
+			// Save the info for next time!
291
+			$_SESSION['installer_temp_ftp'] = array(
292
+				'server' => $upcontext['chmod']['server'],
293
+				'port' => $upcontext['chmod']['port'],
294
+				'username' => $upcontext['chmod']['username'],
295
+				'password' => $upcontext['chmod']['password'],
296
+				'path' => $upcontext['chmod']['path'],
297
+				'root' => $ftp_root,
298
+			);
299
+
300
+			foreach ($files as $k => $file)
301
+			{
302
+				if (!is_writable($file))
303
+					$ftp->chmod($file, 0755);
304
+				if (!is_writable($file))
305
+					$ftp->chmod($file, 0777);
306
+
307
+				// Assuming that didn't work calculate the path without the boarddir.
308
+				if (!is_writable($file))
309
+				{
310
+					if (strpos($file, $boarddir) === 0)
311
+					{
312
+						$ftp_file = strtr($file, array($_SESSION['installer_temp_ftp']['root'] => ''));
313
+						$ftp->chmod($ftp_file, 0755);
314
+						if (!is_writable($file))
315
+							$ftp->chmod($ftp_file, 0777);
316
+						// Sometimes an extra slash can help...
317
+						$ftp_file = '/' . $ftp_file;
318
+						if (!is_writable($file))
319
+							$ftp->chmod($ftp_file, 0755);
320
+						if (!is_writable($file))
321
+							$ftp->chmod($ftp_file, 0777);
322
+					}
323
+				}
324
+
325
+				if (is_writable($file))
326
+					unset($files[$k]);
327
+			}
328
+
329
+			$ftp->close();
330
+		}
331
+	}
332
+
333
+	// What remains?
334
+	$upcontext['chmod']['files'] = $files;
335
+
336
+	if (empty($files))
337
+		return true;
338
+
339
+	return false;
340 340
 }
341 341
 
342 342
 /**
@@ -347,24 +347,24 @@  discard block
 block discarded – undo
347 347
  */
348 348
 function quickFileWritable($file)
349 349
 {
350
-    if (is_writable($file))
351
-        return true;
350
+	if (is_writable($file))
351
+		return true;
352 352
 
353
-    @chmod($file, 0755);
353
+	@chmod($file, 0755);
354 354
 
355
-    // Try 755 and 775 first since 777 doesn't always work and could be a risk...
356
-    $chmod_values = array(0755, 0775, 0777);
355
+	// Try 755 and 775 first since 777 doesn't always work and could be a risk...
356
+	$chmod_values = array(0755, 0775, 0777);
357 357
 
358
-    foreach ($chmod_values as $val)
359
-    {
360
-        // If it's writable, break out of the loop
361
-        if (is_writable($file))
362
-            break;
363
-        else
364
-            @chmod($file, $val);
365
-    }
358
+	foreach ($chmod_values as $val)
359
+	{
360
+		// If it's writable, break out of the loop
361
+		if (is_writable($file))
362
+			break;
363
+		else
364
+			@chmod($file, $val);
365
+	}
366 366
 
367
-    return is_writable($file);
367
+	return is_writable($file);
368 368
 }
369 369
 
370 370
 /**
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
  */
376 376
 function smf_strtolower($string)
377 377
 {
378
-    return mb_strtolower($string, 'UTF-8');
378
+	return mb_strtolower($string, 'UTF-8');
379 379
 }
380 380
 
381 381
 /**
@@ -386,15 +386,15 @@  discard block
 block discarded – undo
386 386
  */
387 387
 function print_error($message, $fatal = false)
388 388
 {
389
-    static $fp = null;
389
+	static $fp = null;
390 390
 
391
-    if ($fp === null)
392
-        $fp = fopen('php://stderr', 'wb');
391
+	if ($fp === null)
392
+		$fp = fopen('php://stderr', 'wb');
393 393
 
394
-    fwrite($fp, $message . "\n");
394
+	fwrite($fp, $message . "\n");
395 395
 
396
-    if ($fatal)
397
-        exit;
396
+	if ($fatal)
397
+		exit;
398 398
 }
399 399
 
400 400
 /**
@@ -405,12 +405,12 @@  discard block
 block discarded – undo
405 405
  */
406 406
 function throw_error($message)
407 407
 {
408
-    global $upcontext;
408
+	global $upcontext;
409 409
 
410
-    $upcontext['error_msg'] = $message;
411
-    $upcontext['sub_template'] = 'error_message';
410
+	$upcontext['error_msg'] = $message;
411
+	$upcontext['sub_template'] = 'error_message';
412 412
 
413
-    return false;
413
+	return false;
414 414
 }
415 415
 
416 416
 /**
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
  */
423 423
 function smf_mysql_fetch_assoc($rs)
424 424
 {
425
-    return mysqli_fetch_assoc($rs);
425
+	return mysqli_fetch_assoc($rs);
426 426
 }
427 427
 
428 428
 /**
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
  */
432 432
 function smf_mysql_fetch_row($rs)
433 433
 {
434
-    return mysqli_fetch_row($rs);
434
+	return mysqli_fetch_row($rs);
435 435
 }
436 436
 
437 437
 /**
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
  */
440 440
 function smf_mysql_free_result($rs)
441 441
 {
442
-    mysqli_free_result($rs);
442
+	mysqli_free_result($rs);
443 443
 }
444 444
 
445 445
 /**
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
  */
449 449
 function smf_mysql_insert_id($rs)
450 450
 {
451
-    return mysqli_insert_id($rs);
451
+	return mysqli_insert_id($rs);
452 452
 }
453 453
 
454 454
 /**
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
  */
458 458
 function smf_mysql_num_rows($rs)
459 459
 {
460
-    return mysqli_num_rows($rs);
460
+	return mysqli_num_rows($rs);
461 461
 }
462 462
 
463 463
 /**
@@ -465,6 +465,6 @@  discard block
 block discarded – undo
465 465
  */
466 466
 function smf_mysql_real_escape_string($string)
467 467
 {
468
-    global $db_connection;
469
-    mysqli_real_escape_string($db_connection, $string);
468
+	global $db_connection;
469
+	mysqli_real_escape_string($db_connection, $string);
470 470
 }
471 471
\ No newline at end of file
Please login to merge, or discard this patch.