Passed
Push — master ( a3c0d0...678db7 )
by Cody
06:27 queued 03:12
created
include/autoload.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php
2
-	require_once "functions.php";
2
+    require_once "functions.php";
3 3
 
4
-	spl_autoload_register(function($class) {
5
-		$namespace = '';
6
-		$class_name = $class;
4
+    spl_autoload_register(function($class) {
5
+        $namespace = '';
6
+        $class_name = $class;
7 7
 
8
-		if (strpos($class, '\\') !== false)
9
-			list ($namespace, $class_name) = explode('\\', $class, 2);
8
+        if (strpos($class, '\\') !== false)
9
+            list ($namespace, $class_name) = explode('\\', $class, 2);
10 10
 
11
-		$root_dir = dirname(__DIR__); // we're in tt-rss/include
11
+        $root_dir = dirname(__DIR__); // we're in tt-rss/include
12 12
 
13
-		// 1. third party libraries with namespaces are loaded from vendor/
14
-		// 2. internal tt-rss classes are loaded from classes/ and use special naming logic instead of namespaces
15
-		// 3. plugin classes are loaded by PluginHandler from plugins.local/ and plugins/ (TODO: use generic autoloader?)
13
+        // 1. third party libraries with namespaces are loaded from vendor/
14
+        // 2. internal tt-rss classes are loaded from classes/ and use special naming logic instead of namespaces
15
+        // 3. plugin classes are loaded by PluginHandler from plugins.local/ and plugins/ (TODO: use generic autoloader?)
16 16
 
17
-		if ($namespace && $class_name) {
18
-			$class_file = "$root_dir/vendor/$namespace/" . str_replace('\\', '/', $class_name) . ".php";
19
-		} else {
20
-			$class_file = "$root_dir/classes/" . str_replace("_", "/", strtolower($class)) . ".php";
21
-		}
17
+        if ($namespace && $class_name) {
18
+            $class_file = "$root_dir/vendor/$namespace/" . str_replace('\\', '/', $class_name) . ".php";
19
+        } else {
20
+            $class_file = "$root_dir/classes/" . str_replace("_", "/", strtolower($class)) . ".php";
21
+        }
22 22
 
23
-		if (file_exists($class_file))
24
-			include $class_file;
23
+        if (file_exists($class_file))
24
+            include $class_file;
25 25
 
26
-	});
26
+    });
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,8 +5,9 @@  discard block
 block discarded – undo
5 5
 		$namespace = '';
6 6
 		$class_name = $class;
7 7
 
8
-		if (strpos($class, '\\') !== false)
9
-			list ($namespace, $class_name) = explode('\\', $class, 2);
8
+		if (strpos($class, '\\') !== false) {
9
+					list ($namespace, $class_name) = explode('\\', $class, 2);
10
+		}
10 11
 
11 12
 		$root_dir = dirname(__DIR__); // we're in tt-rss/include
12 13
 
@@ -20,7 +21,8 @@  discard block
 block discarded – undo
20 21
 			$class_file = "$root_dir/classes/" . str_replace("_", "/", strtolower($class)) . ".php";
21 22
 		}
22 23
 
23
-		if (file_exists($class_file))
24
-			include $class_file;
24
+		if (file_exists($class_file)) {
25
+					include $class_file;
26
+		}
25 27
 
26 28
 	});
Please login to merge, or discard this patch.
include/sanity_check.php 1 patch
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -1,190 +1,190 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-	function make_self_url() {
4
-		$proto = is_server_https() ? 'https' : 'http';
3
+    function make_self_url() {
4
+        $proto = is_server_https() ? 'https' : 'http';
5 5
 
6
-		return $proto . '://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
7
-	}
6
+        return $proto . '://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
7
+    }
8 8
 
9
-	function make_self_url_path() {
10
-		$proto = is_server_https() ? 'https' : 'http';
11
-		$url_path = $proto . '://' . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
9
+    function make_self_url_path() {
10
+        $proto = is_server_https() ? 'https' : 'http';
11
+        $url_path = $proto . '://' . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
12 12
 
13
-		return $url_path;
14
-	}
13
+        return $url_path;
14
+    }
15 15
 
16
-	function check_mysql_tables() {
17
-		$pdo = Db::pdo();
16
+    function check_mysql_tables() {
17
+        $pdo = Db::pdo();
18 18
 
19
-		$sth = $pdo->prepare("SELECT engine, table_name FROM information_schema.tables WHERE
19
+        $sth = $pdo->prepare("SELECT engine, table_name FROM information_schema.tables WHERE
20 20
 				table_schema = ? AND table_name LIKE 'ttrss_%' AND engine != 'InnoDB'");
21
-		$sth->execute([DB_NAME]);
21
+        $sth->execute([DB_NAME]);
22 22
 
23
-		$bad_tables = [];
23
+        $bad_tables = [];
24 24
 
25
-		while ($line = $sth->fetch()) {
26
-			array_push($bad_tables, $line);
27
-		}
25
+        while ($line = $sth->fetch()) {
26
+            array_push($bad_tables, $line);
27
+        }
28 28
 
29
-		return $bad_tables;
30
-	}
29
+        return $bad_tables;
30
+    }
31 31
 
32
-	function initial_sanity_check() {
32
+    function initial_sanity_check() {
33 33
 
34
-		$errors = array();
34
+        $errors = array();
35 35
 
36
-		if (!file_exists("config.php")) {
37
-			array_push($errors, "Configuration file not found. Looks like you forgot to copy config.php-dist to config.php and edit it.");
38
-		} else {
36
+        if (!file_exists("config.php")) {
37
+            array_push($errors, "Configuration file not found. Looks like you forgot to copy config.php-dist to config.php and edit it.");
38
+        } else {
39 39
 
40
-			require_once "sanity_config.php";
40
+            require_once "sanity_config.php";
41 41
 
42
-			if (file_exists("install") && !file_exists("config.php")) {
43
-				array_push($errors, "Please copy config.php-dist to config.php or run the installer in install/");
44
-			}
42
+            if (file_exists("install") && !file_exists("config.php")) {
43
+                array_push($errors, "Please copy config.php-dist to config.php or run the installer in install/");
44
+            }
45 45
 
46
-			if (strpos(PLUGINS, "auth_") === false) {
47
-				array_push($errors, "Please enable at least one authentication module via PLUGINS constant in config.php");
48
-			}
46
+            if (strpos(PLUGINS, "auth_") === false) {
47
+                array_push($errors, "Please enable at least one authentication module via PLUGINS constant in config.php");
48
+            }
49 49
 
50
-			if (function_exists('posix_getuid') && posix_getuid() == 0) {
51
-				array_push($errors, "Please don't run this script as root.");
52
-			}
50
+            if (function_exists('posix_getuid') && posix_getuid() == 0) {
51
+                array_push($errors, "Please don't run this script as root.");
52
+            }
53 53
 
54
-			if (version_compare(PHP_VERSION, '5.6.0', '<')) {
55
-				array_push($errors, "PHP version 5.6.0 or newer required. You're using " . PHP_VERSION . ".");
56
-			}
54
+            if (version_compare(PHP_VERSION, '5.6.0', '<')) {
55
+                array_push($errors, "PHP version 5.6.0 or newer required. You're using " . PHP_VERSION . ".");
56
+            }
57 57
 
58
-			if (!class_exists("UConverter")) {
59
-				array_push($errors, "PHP UConverter class is missing, it's provided by the Internationalization (intl) module.");
60
-			}
58
+            if (!class_exists("UConverter")) {
59
+                array_push($errors, "PHP UConverter class is missing, it's provided by the Internationalization (intl) module.");
60
+            }
61 61
 
62
-			if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) {
63
-				array_push($errors, "Configuration file (config.php) has incorrect version. Update it with new options from config.php-dist and set CONFIG_VERSION to the correct value.");
64
-			}
62
+            if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) {
63
+                array_push($errors, "Configuration file (config.php) has incorrect version. Update it with new options from config.php-dist and set CONFIG_VERSION to the correct value.");
64
+            }
65 65
 
66
-			if (!is_writable(CACHE_DIR . "/images")) {
67
-				array_push($errors, "Image cache is not writable (chmod -R 777 ".CACHE_DIR."/images)");
68
-			}
66
+            if (!is_writable(CACHE_DIR . "/images")) {
67
+                array_push($errors, "Image cache is not writable (chmod -R 777 ".CACHE_DIR."/images)");
68
+            }
69 69
 
70
-			if (!is_writable(CACHE_DIR . "/upload")) {
71
-				array_push($errors, "Upload cache is not writable (chmod -R 777 ".CACHE_DIR."/upload)");
72
-			}
70
+            if (!is_writable(CACHE_DIR . "/upload")) {
71
+                array_push($errors, "Upload cache is not writable (chmod -R 777 ".CACHE_DIR."/upload)");
72
+            }
73 73
 
74
-			if (!is_writable(CACHE_DIR . "/export")) {
75
-				array_push($errors, "Data export cache is not writable (chmod -R 777 ".CACHE_DIR."/export)");
76
-			}
74
+            if (!is_writable(CACHE_DIR . "/export")) {
75
+                array_push($errors, "Data export cache is not writable (chmod -R 777 ".CACHE_DIR."/export)");
76
+            }
77 77
 
78
-			if (GENERATED_CONFIG_CHECK != EXPECTED_CONFIG_VERSION) {
79
-				array_push($errors,
80
-					"Configuration option checker sanity_config.php is outdated, please recreate it using ./utils/regen_config_checks.sh");
81
-			}
78
+            if (GENERATED_CONFIG_CHECK != EXPECTED_CONFIG_VERSION) {
79
+                array_push($errors,
80
+                    "Configuration option checker sanity_config.php is outdated, please recreate it using ./utils/regen_config_checks.sh");
81
+            }
82 82
 
83
-			foreach ($required_defines as $d) {
84
-				if (!defined($d)) {
85
-					array_push($errors,
86
-						"Required configuration file parameter $d is not defined in config.php. You might need to copy it from config.php-dist.");
87
-				}
88
-			}
83
+            foreach ($required_defines as $d) {
84
+                if (!defined($d)) {
85
+                    array_push($errors,
86
+                        "Required configuration file parameter $d is not defined in config.php. You might need to copy it from config.php-dist.");
87
+                }
88
+            }
89 89
 
90
-			if (SINGLE_USER_MODE && class_exists("PDO")) {
91
-			    $pdo = DB::pdo();
90
+            if (SINGLE_USER_MODE && class_exists("PDO")) {
91
+                $pdo = DB::pdo();
92 92
 
93
-				$res = $pdo->query("SELECT id FROM ttrss_users WHERE id = 1");
93
+                $res = $pdo->query("SELECT id FROM ttrss_users WHERE id = 1");
94 94
 
95
-				if (!$res->fetch()) {
96
-					array_push($errors, "SINGLE_USER_MODE is enabled in config.php but default admin account is not found.");
97
-				}
98
-			}
95
+                if (!$res->fetch()) {
96
+                    array_push($errors, "SINGLE_USER_MODE is enabled in config.php but default admin account is not found.");
97
+                }
98
+            }
99 99
 
100
-			$ref_self_url_path = make_self_url_path();
101
-			$ref_self_url_path = preg_replace("/\w+\.php$/", "", $ref_self_url_path);
100
+            $ref_self_url_path = make_self_url_path();
101
+            $ref_self_url_path = preg_replace("/\w+\.php$/", "", $ref_self_url_path);
102 102
 
103
-			if (SELF_URL_PATH == "http://example.org/tt-rss/") {
104
-				array_push($errors,
105
-						"Please set SELF_URL_PATH to the correct value for your server (possible value: <b>$ref_self_url_path</b>)");
106
-			}
103
+            if (SELF_URL_PATH == "http://example.org/tt-rss/") {
104
+                array_push($errors,
105
+                        "Please set SELF_URL_PATH to the correct value for your server (possible value: <b>$ref_self_url_path</b>)");
106
+            }
107 107
 
108
-			if (isset($_SERVER["HTTP_HOST"]) &&
109
-				(!defined('_SKIP_SELF_URL_PATH_CHECKS') || !_SKIP_SELF_URL_PATH_CHECKS) &&
110
-				SELF_URL_PATH != $ref_self_url_path && SELF_URL_PATH != mb_substr($ref_self_url_path, 0, mb_strlen($ref_self_url_path)-1)) {
111
-				array_push($errors,
112
-					"Please set SELF_URL_PATH to the correct value detected for your server: <b>$ref_self_url_path</b>");
113
-			}
108
+            if (isset($_SERVER["HTTP_HOST"]) &&
109
+                (!defined('_SKIP_SELF_URL_PATH_CHECKS') || !_SKIP_SELF_URL_PATH_CHECKS) &&
110
+                SELF_URL_PATH != $ref_self_url_path && SELF_URL_PATH != mb_substr($ref_self_url_path, 0, mb_strlen($ref_self_url_path)-1)) {
111
+                array_push($errors,
112
+                    "Please set SELF_URL_PATH to the correct value detected for your server: <b>$ref_self_url_path</b>");
113
+            }
114 114
 
115
-			if (!is_writable(ICONS_DIR)) {
116
-				array_push($errors, "ICONS_DIR defined in config.php is not writable (chmod -R 777 ".ICONS_DIR.").\n");
117
-			}
115
+            if (!is_writable(ICONS_DIR)) {
116
+                array_push($errors, "ICONS_DIR defined in config.php is not writable (chmod -R 777 ".ICONS_DIR.").\n");
117
+            }
118 118
 
119
-			if (!is_writable(LOCK_DIRECTORY)) {
120
-				array_push($errors, "LOCK_DIRECTORY defined in config.php is not writable (chmod -R 777 ".LOCK_DIRECTORY.").\n");
121
-			}
119
+            if (!is_writable(LOCK_DIRECTORY)) {
120
+                array_push($errors, "LOCK_DIRECTORY defined in config.php is not writable (chmod -R 777 ".LOCK_DIRECTORY.").\n");
121
+            }
122 122
 
123
-			if (!function_exists("curl_init") && !ini_get("allow_url_fopen")) {
124
-				array_push($errors, "PHP configuration option allow_url_fopen is disabled, and CURL functions are not present. Either enable allow_url_fopen or install PHP extension for CURL.");
125
-			}
123
+            if (!function_exists("curl_init") && !ini_get("allow_url_fopen")) {
124
+                array_push($errors, "PHP configuration option allow_url_fopen is disabled, and CURL functions are not present. Either enable allow_url_fopen or install PHP extension for CURL.");
125
+            }
126 126
 
127
-			if (!function_exists("json_encode")) {
128
-				array_push($errors, "PHP support for JSON is required, but was not found.");
129
-			}
127
+            if (!function_exists("json_encode")) {
128
+                array_push($errors, "PHP support for JSON is required, but was not found.");
129
+            }
130 130
 
131
-			if (DB_TYPE == "mysql" && !function_exists("mysqli_connect")) {
132
-				array_push($errors, "PHP support for MySQL is required for configured DB_TYPE in config.php.");
133
-			}
131
+            if (DB_TYPE == "mysql" && !function_exists("mysqli_connect")) {
132
+                array_push($errors, "PHP support for MySQL is required for configured DB_TYPE in config.php.");
133
+            }
134 134
 
135
-			if (DB_TYPE == "pgsql" && !function_exists("pg_connect")) {
136
-				array_push($errors, "PHP support for PostgreSQL is required for configured DB_TYPE in config.php");
137
-			}
135
+            if (DB_TYPE == "pgsql" && !function_exists("pg_connect")) {
136
+                array_push($errors, "PHP support for PostgreSQL is required for configured DB_TYPE in config.php");
137
+            }
138 138
 
139
-			if (!class_exists("PDO")) {
140
-				array_push($errors, "PHP support for PDO is required but was not found.");
141
-			}
139
+            if (!class_exists("PDO")) {
140
+                array_push($errors, "PHP support for PDO is required but was not found.");
141
+            }
142 142
 
143
-			if (!function_exists("mb_strlen")) {
144
-				array_push($errors, "PHP support for mbstring functions is required but was not found.");
145
-			}
143
+            if (!function_exists("mb_strlen")) {
144
+                array_push($errors, "PHP support for mbstring functions is required but was not found.");
145
+            }
146 146
 
147
-			if (!function_exists("hash")) {
148
-				array_push($errors, "PHP support for hash() function is required but was not found.");
149
-			}
147
+            if (!function_exists("hash")) {
148
+                array_push($errors, "PHP support for hash() function is required but was not found.");
149
+            }
150 150
 
151
-			if (ini_get("safe_mode")) {
152
-				array_push($errors, "PHP safe mode setting is obsolete and not supported by tt-rss.");
153
-			}
151
+            if (ini_get("safe_mode")) {
152
+                array_push($errors, "PHP safe mode setting is obsolete and not supported by tt-rss.");
153
+            }
154 154
 
155
-			if (!function_exists("mime_content_type")) {
156
-				array_push($errors, "PHP function mime_content_type() is missing, try enabling fileinfo module.");
157
-			}
155
+            if (!function_exists("mime_content_type")) {
156
+                array_push($errors, "PHP function mime_content_type() is missing, try enabling fileinfo module.");
157
+            }
158 158
 
159
-			if (!class_exists("DOMDocument")) {
160
-				array_push($errors, "PHP support for DOMDocument is required, but was not found.");
161
-			}
159
+            if (!class_exists("DOMDocument")) {
160
+                array_push($errors, "PHP support for DOMDocument is required, but was not found.");
161
+            }
162 162
 
163
-			if (DB_TYPE == "mysql") {
164
-				$bad_tables = check_mysql_tables();
163
+            if (DB_TYPE == "mysql") {
164
+                $bad_tables = check_mysql_tables();
165 165
 
166
-				if (count($bad_tables) > 0) {
167
-					$bad_tables_fmt = [];
166
+                if (count($bad_tables) > 0) {
167
+                    $bad_tables_fmt = [];
168 168
 
169
-					foreach ($bad_tables as $bt) {
170
-						array_push($bad_tables_fmt, sprintf("%s (%s)", $bt['table_name'], $bt['engine']));
171
-					}
169
+                    foreach ($bad_tables as $bt) {
170
+                        array_push($bad_tables_fmt, sprintf("%s (%s)", $bt['table_name'], $bt['engine']));
171
+                    }
172 172
 
173
-					$msg = "<p>The following tables use an unsupported MySQL engine: <b>" .
174
-						implode(", ", $bad_tables_fmt) . "</b>.</p>";
173
+                    $msg = "<p>The following tables use an unsupported MySQL engine: <b>" .
174
+                        implode(", ", $bad_tables_fmt) . "</b>.</p>";
175 175
 
176
-					$msg .= "<p>The only supported engine on MySQL is InnoDB. MyISAM lacks functionality to run
176
+                    $msg .= "<p>The only supported engine on MySQL is InnoDB. MyISAM lacks functionality to run
177 177
 						tt-rss.
178 178
 						Please backup your data (via OPML) and re-import the schema before continuing.</p>
179 179
 						<p><b>WARNING: importing the schema would mean LOSS OF ALL YOUR DATA.</b></p>";
180 180
 
181 181
 
182
-					array_push($errors, $msg);
183
-				}
184
-			}
185
-		}
182
+                    array_push($errors, $msg);
183
+                }
184
+            }
185
+        }
186 186
 
187
-		if (count($errors) > 0 && $_SERVER['REQUEST_URI']) { ?>
187
+        if (count($errors) > 0 && $_SERVER['REQUEST_URI']) { ?>
188 188
 			<!DOCTYPE html>
189 189
 			<html>
190 190
 			<head>
@@ -211,22 +211,22 @@  discard block
 block discarded – undo
211 211
 		</html>
212 212
 
213 213
 		<?php
214
-			die;
215
-		} else if (count($errors) > 0) {
216
-			echo "Tiny Tiny RSS was unable to start properly. This usually means a misconfiguration or an incomplete upgrade.\n";
217
-			echo "Please fix errors indicated by the following messages:\n\n";
214
+            die;
215
+        } else if (count($errors) > 0) {
216
+            echo "Tiny Tiny RSS was unable to start properly. This usually means a misconfiguration or an incomplete upgrade.\n";
217
+            echo "Please fix errors indicated by the following messages:\n\n";
218 218
 
219
-			foreach ($errors as $error) {
220
-				echo " * $error\n";
221
-			}
219
+            foreach ($errors as $error) {
220
+                echo " * $error\n";
221
+            }
222 222
 
223
-			echo "\nYou might want to check tt-rss wiki or the forums for more information.\n";
224
-			echo "Please search the forums before creating new topic for your question.\n";
223
+            echo "\nYou might want to check tt-rss wiki or the forums for more information.\n";
224
+            echo "Please search the forums before creating new topic for your question.\n";
225 225
 
226
-			exit(-1);
227
-		}
228
-	}
226
+            exit(-1);
227
+        }
228
+    }
229 229
 
230
-	initial_sanity_check();
230
+    initial_sanity_check();
231 231
 
232 232
 ?>
Please login to merge, or discard this patch.
include/controls.php 2 patches
Indentation   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -1,339 +1,339 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 function print_select($id, $default, $values, $attributes = "", $name = "") {
4
-	if (!$name) $name = $id;
4
+    if (!$name) $name = $id;
5 5
 
6
-	print "<select name=\"$name\" id=\"$id\" $attributes>";
7
-	foreach ($values as $v) {
8
-		if ($v == $default)
9
-			$sel = "selected=\"1\"";
10
-		else
11
-			$sel = "";
6
+    print "<select name=\"$name\" id=\"$id\" $attributes>";
7
+    foreach ($values as $v) {
8
+        if ($v == $default)
9
+            $sel = "selected=\"1\"";
10
+        else
11
+            $sel = "";
12 12
 
13
-		$v = trim($v);
13
+        $v = trim($v);
14 14
 
15
-		print "<option value=\"$v\" $sel>$v</option>";
16
-	}
17
-	print "</select>";
15
+        print "<option value=\"$v\" $sel>$v</option>";
16
+    }
17
+    print "</select>";
18 18
 }
19 19
 
20 20
 function print_select_hash($id, $default, $values, $attributes = "", $name = "") {
21
-	if (!$name) $name = $id;
21
+    if (!$name) $name = $id;
22 22
 
23
-	print "<select name=\"$name\" id='$id' $attributes>";
24
-	foreach (array_keys($values) as $v) {
25
-		if ($v == $default)
26
-			$sel = 'selected="selected"';
27
-		else
28
-			$sel = "";
23
+    print "<select name=\"$name\" id='$id' $attributes>";
24
+    foreach (array_keys($values) as $v) {
25
+        if ($v == $default)
26
+            $sel = 'selected="selected"';
27
+        else
28
+            $sel = "";
29 29
 
30
-		$v = trim($v);
30
+        $v = trim($v);
31 31
 
32
-		print "<option $sel value=\"$v\">".$values[$v]."</option>";
33
-	}
32
+        print "<option $sel value=\"$v\">".$values[$v]."</option>";
33
+    }
34 34
 
35
-	print "</select>";
35
+    print "</select>";
36 36
 }
37 37
 
38 38
 function print_hidden($name, $value) {
39
-	print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"$name\" value=\"$value\">";
39
+    print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"$name\" value=\"$value\">";
40 40
 }
41 41
 
42 42
 function print_checkbox($id, $checked, $value = "", $attributes = "") {
43
-	$checked_str = $checked ? "checked" : "";
44
-	$value_str = $value ? "value=\"$value\"" : "";
43
+    $checked_str = $checked ? "checked" : "";
44
+    $value_str = $value ? "value=\"$value\"" : "";
45 45
 
46
-	print "<input dojoType=\"dijit.form.CheckBox\" id=\"$id\" $value_str $checked_str $attributes name=\"$id\">";
46
+    print "<input dojoType=\"dijit.form.CheckBox\" id=\"$id\" $value_str $checked_str $attributes name=\"$id\">";
47 47
 }
48 48
 
49 49
 function print_button($type, $value, $attributes = "") {
50
-	print "<p><button dojoType=\"dijit.form.Button\" $attributes type=\"$type\">$value</button>";
50
+    print "<p><button dojoType=\"dijit.form.Button\" $attributes type=\"$type\">$value</button>";
51 51
 }
52 52
 
53 53
 function print_radio($id, $default, $true_is, $values, $attributes = "") {
54
-	foreach ($values as $v) {
54
+    foreach ($values as $v) {
55 55
 
56
-		if ($v == $default)
57
-			$sel = "checked";
58
-		else
59
-			$sel = "";
56
+        if ($v == $default)
57
+            $sel = "checked";
58
+        else
59
+            $sel = "";
60 60
 
61
-		if ($v == $true_is) {
62
-			$sel .= " value=\"1\"";
63
-		} else {
64
-			$sel .= " value=\"0\"";
65
-		}
61
+        if ($v == $true_is) {
62
+            $sel .= " value=\"1\"";
63
+        } else {
64
+            $sel .= " value=\"0\"";
65
+        }
66 66
 
67
-		print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\"
67
+        print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\"
68 68
 				type=\"radio\" $sel $attributes name=\"$id\">&nbsp;$v&nbsp;";
69 69
 
70
-	}
70
+    }
71 71
 }
72 72
 
73 73
 function print_feed_multi_select($id, $default_ids = [],
74
-						   $attributes = "", $include_all_feeds = true,
75
-						   $root_id = null, $nest_level = 0) {
74
+                            $attributes = "", $include_all_feeds = true,
75
+                            $root_id = null, $nest_level = 0) {
76 76
 
77
-	$pdo = DB::pdo();
77
+    $pdo = DB::pdo();
78 78
 
79
-	print_r(in_array("CAT:6",$default_ids));
79
+    print_r(in_array("CAT:6",$default_ids));
80 80
 
81
-	if (!$root_id) {
82
-		print "<select multiple=\true\" id=\"$id\" name=\"$id\" $attributes>";
83
-		if ($include_all_feeds) {
84
-			$is_selected = (in_array("0", $default_ids)) ? "selected=\"1\"" : "";
85
-			print "<option $is_selected value=\"0\">".__('All feeds')."</option>";
86
-		}
87
-	}
81
+    if (!$root_id) {
82
+        print "<select multiple=\true\" id=\"$id\" name=\"$id\" $attributes>";
83
+        if ($include_all_feeds) {
84
+            $is_selected = (in_array("0", $default_ids)) ? "selected=\"1\"" : "";
85
+            print "<option $is_selected value=\"0\">".__('All feeds')."</option>";
86
+        }
87
+    }
88 88
 
89
-	if (get_pref('ENABLE_FEED_CATS')) {
89
+    if (get_pref('ENABLE_FEED_CATS')) {
90 90
 
91
-		if (!$root_id) $root_id = null;
91
+        if (!$root_id) $root_id = null;
92 92
 
93
-		$sth = $pdo->prepare("SELECT id,title,
93
+        $sth = $pdo->prepare("SELECT id,title,
94 94
 				(SELECT COUNT(id) FROM ttrss_feed_categories AS c2 WHERE
95 95
 					c2.parent_cat = ttrss_feed_categories.id) AS num_children
96 96
 				FROM ttrss_feed_categories
97 97
 				WHERE owner_uid = :uid AND
98 98
 				(parent_cat = :root_id OR (:root_id IS NULL AND parent_cat IS NULL)) ORDER BY title");
99 99
 
100
-		$sth->execute([":uid" => $_SESSION['uid'], ":root_id" => $root_id]);
100
+        $sth->execute([":uid" => $_SESSION['uid'], ":root_id" => $root_id]);
101 101
 
102
-		while ($line = $sth->fetch()) {
102
+        while ($line = $sth->fetch()) {
103 103
 
104
-			for ($i = 0; $i < $nest_level; $i++)
105
-				$line["title"] = " - " . $line["title"];
104
+            for ($i = 0; $i < $nest_level; $i++)
105
+                $line["title"] = " - " . $line["title"];
106 106
 
107
-			$is_selected = in_array("CAT:".$line["id"], $default_ids) ? "selected=\"1\"" : "";
107
+            $is_selected = in_array("CAT:".$line["id"], $default_ids) ? "selected=\"1\"" : "";
108 108
 
109
-			printf("<option $is_selected value='CAT:%d'>%s</option>",
110
-				$line["id"], htmlspecialchars($line["title"]));
109
+            printf("<option $is_selected value='CAT:%d'>%s</option>",
110
+                $line["id"], htmlspecialchars($line["title"]));
111 111
 
112
-			if ($line["num_children"] > 0)
113
-				print_feed_multi_select($id, $default_ids, $attributes,
114
-					$include_all_feeds, $line["id"], $nest_level+1);
112
+            if ($line["num_children"] > 0)
113
+                print_feed_multi_select($id, $default_ids, $attributes,
114
+                    $include_all_feeds, $line["id"], $nest_level+1);
115 115
 
116
-			$f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds
116
+            $f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds
117 117
 					WHERE cat_id = ? AND owner_uid = ? ORDER BY title");
118 118
 
119
-			$f_sth->execute([$line['id'], $_SESSION['uid']]);
119
+            $f_sth->execute([$line['id'], $_SESSION['uid']]);
120 120
 
121
-			while ($fline = $f_sth->fetch()) {
122
-				$is_selected = (in_array($fline["id"], $default_ids)) ? "selected=\"1\"" : "";
121
+            while ($fline = $f_sth->fetch()) {
122
+                $is_selected = (in_array($fline["id"], $default_ids)) ? "selected=\"1\"" : "";
123 123
 
124
-				$fline["title"] = " + " . $fline["title"];
124
+                $fline["title"] = " + " . $fline["title"];
125 125
 
126
-				for ($i = 0; $i < $nest_level; $i++)
127
-					$fline["title"] = " - " . $fline["title"];
126
+                for ($i = 0; $i < $nest_level; $i++)
127
+                    $fline["title"] = " - " . $fline["title"];
128 128
 
129
-				printf("<option $is_selected value='%d'>%s</option>",
130
-					$fline["id"], htmlspecialchars($fline["title"]));
131
-			}
132
-		}
129
+                printf("<option $is_selected value='%d'>%s</option>",
130
+                    $fline["id"], htmlspecialchars($fline["title"]));
131
+            }
132
+        }
133 133
 
134
-		if (!$root_id) {
135
-			$is_selected = in_array("CAT:0", $default_ids) ? "selected=\"1\"" : "";
134
+        if (!$root_id) {
135
+            $is_selected = in_array("CAT:0", $default_ids) ? "selected=\"1\"" : "";
136 136
 
137
-			printf("<option $is_selected value='CAT:0'>%s</option>",
138
-				__("Uncategorized"));
137
+            printf("<option $is_selected value='CAT:0'>%s</option>",
138
+                __("Uncategorized"));
139 139
 
140
-			$f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds
140
+            $f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds
141 141
 					WHERE cat_id IS NULL AND owner_uid = ? ORDER BY title");
142
-			$f_sth->execute([$_SESSION['uid']]);
142
+            $f_sth->execute([$_SESSION['uid']]);
143 143
 
144
-			while ($fline = $f_sth->fetch()) {
145
-				$is_selected = in_array($fline["id"], $default_ids) ? "selected=\"1\"" : "";
144
+            while ($fline = $f_sth->fetch()) {
145
+                $is_selected = in_array($fline["id"], $default_ids) ? "selected=\"1\"" : "";
146 146
 
147
-				$fline["title"] = " + " . $fline["title"];
147
+                $fline["title"] = " + " . $fline["title"];
148 148
 
149
-				for ($i = 0; $i < $nest_level; $i++)
150
-					$fline["title"] = " - " . $fline["title"];
149
+                for ($i = 0; $i < $nest_level; $i++)
150
+                    $fline["title"] = " - " . $fline["title"];
151 151
 
152
-				printf("<option $is_selected value='%d'>%s</option>",
153
-					$fline["id"], htmlspecialchars($fline["title"]));
154
-			}
155
-		}
152
+                printf("<option $is_selected value='%d'>%s</option>",
153
+                    $fline["id"], htmlspecialchars($fline["title"]));
154
+            }
155
+        }
156 156
 
157
-	} else {
158
-		$sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds
157
+    } else {
158
+        $sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds
159 159
 				WHERE owner_uid = ? ORDER BY title");
160
-		$sth->execute([$_SESSION['uid']]);
160
+        $sth->execute([$_SESSION['uid']]);
161 161
 
162
-		while ($line = $sth->fetch()) {
162
+        while ($line = $sth->fetch()) {
163 163
 
164
-			$is_selected = (in_array($line["id"], $default_ids)) ? "selected=\"1\"" : "";
164
+            $is_selected = (in_array($line["id"], $default_ids)) ? "selected=\"1\"" : "";
165 165
 
166
-			printf("<option $is_selected value='%d'>%s</option>",
167
-				$line["id"], htmlspecialchars($line["title"]));
168
-		}
169
-	}
166
+            printf("<option $is_selected value='%d'>%s</option>",
167
+                $line["id"], htmlspecialchars($line["title"]));
168
+        }
169
+    }
170 170
 
171
-	if (!$root_id) {
172
-		print "</select>";
173
-	}
171
+    if (!$root_id) {
172
+        print "</select>";
173
+    }
174 174
 }
175 175
 
176 176
 function print_feed_cat_select($id, $default_id,
177
-							   $attributes, $include_all_cats = true, $root_id = null, $nest_level = 0) {
177
+                                $attributes, $include_all_cats = true, $root_id = null, $nest_level = 0) {
178 178
 
179
-	if (!$root_id) {
180
-		print "<select id=\"$id\" name=\"$id\" default=\"$default_id\" $attributes>";
181
-	}
179
+    if (!$root_id) {
180
+        print "<select id=\"$id\" name=\"$id\" default=\"$default_id\" $attributes>";
181
+    }
182 182
 
183
-	$pdo = DB::pdo();
183
+    $pdo = DB::pdo();
184 184
 
185
-	if (!$root_id) $root_id = null;
185
+    if (!$root_id) $root_id = null;
186 186
 
187
-	$sth = $pdo->prepare("SELECT id,title,
187
+    $sth = $pdo->prepare("SELECT id,title,
188 188
 				(SELECT COUNT(id) FROM ttrss_feed_categories AS c2 WHERE
189 189
 					c2.parent_cat = ttrss_feed_categories.id) AS num_children
190 190
 				FROM ttrss_feed_categories
191 191
 				WHERE owner_uid = :uid AND
192 192
 				  (parent_cat = :root_id OR (:root_id IS NULL AND parent_cat IS NULL)) ORDER BY title");
193
-	$sth->execute([":uid" => $_SESSION['uid'], ":root_id" => $root_id]);
194
-
195
-	$found = 0;
196
-
197
-	while ($line = $sth->fetch()) {
198
-		++$found;
199
-
200
-		if ($line["id"] == $default_id) {
201
-			$is_selected = "selected=\"1\"";
202
-		} else {
203
-			$is_selected = "";
204
-		}
205
-
206
-		for ($i = 0; $i < $nest_level; $i++)
207
-			$line["title"] = " - " . $line["title"];
208
-
209
-		if ($line["title"])
210
-			printf("<option $is_selected value='%d'>%s</option>",
211
-				$line["id"], htmlspecialchars($line["title"]));
212
-
213
-		if ($line["num_children"] > 0)
214
-			print_feed_cat_select($id, $default_id, $attributes,
215
-				$include_all_cats, $line["id"], $nest_level+1);
216
-	}
217
-
218
-	if (!$root_id) {
219
-		if ($include_all_cats) {
220
-			if ($found > 0) {
221
-				print "<option disabled=\"1\">--------</option>";
222
-			}
223
-
224
-			if ($default_id == 0) {
225
-				$is_selected = "selected=\"1\"";
226
-			} else {
227
-				$is_selected = "";
228
-			}
229
-
230
-			print "<option $is_selected value=\"0\">".__('Uncategorized')."</option>";
231
-		}
232
-		print "</select>";
233
-	}
193
+    $sth->execute([":uid" => $_SESSION['uid'], ":root_id" => $root_id]);
194
+
195
+    $found = 0;
196
+
197
+    while ($line = $sth->fetch()) {
198
+        ++$found;
199
+
200
+        if ($line["id"] == $default_id) {
201
+            $is_selected = "selected=\"1\"";
202
+        } else {
203
+            $is_selected = "";
204
+        }
205
+
206
+        for ($i = 0; $i < $nest_level; $i++)
207
+            $line["title"] = " - " . $line["title"];
208
+
209
+        if ($line["title"])
210
+            printf("<option $is_selected value='%d'>%s</option>",
211
+                $line["id"], htmlspecialchars($line["title"]));
212
+
213
+        if ($line["num_children"] > 0)
214
+            print_feed_cat_select($id, $default_id, $attributes,
215
+                $include_all_cats, $line["id"], $nest_level+1);
216
+    }
217
+
218
+    if (!$root_id) {
219
+        if ($include_all_cats) {
220
+            if ($found > 0) {
221
+                print "<option disabled=\"1\">--------</option>";
222
+            }
223
+
224
+            if ($default_id == 0) {
225
+                $is_selected = "selected=\"1\"";
226
+            } else {
227
+                $is_selected = "";
228
+            }
229
+
230
+            print "<option $is_selected value=\"0\">".__('Uncategorized')."</option>";
231
+        }
232
+        print "</select>";
233
+    }
234 234
 }
235 235
 
236 236
 function stylesheet_tag($filename, $id = false) {
237
-	$timestamp = filemtime($filename);
237
+    $timestamp = filemtime($filename);
238 238
 
239
-	$id_part = $id ? "id=\"$id\"" : "";
239
+    $id_part = $id ? "id=\"$id\"" : "";
240 240
 
241
-	return "<link rel=\"stylesheet\" $id_part type=\"text/css\" data-orig-href=\"$filename\" href=\"$filename?$timestamp\"/>\n";
241
+    return "<link rel=\"stylesheet\" $id_part type=\"text/css\" data-orig-href=\"$filename\" href=\"$filename?$timestamp\"/>\n";
242 242
 }
243 243
 
244 244
 function javascript_tag($filename) {
245
-	$query = "";
245
+    $query = "";
246 246
 
247
-	if (!(strpos($filename, "?") === false)) {
248
-		$query = substr($filename, strpos($filename, "?")+1);
249
-		$filename = substr($filename, 0, strpos($filename, "?"));
250
-	}
247
+    if (!(strpos($filename, "?") === false)) {
248
+        $query = substr($filename, strpos($filename, "?")+1);
249
+        $filename = substr($filename, 0, strpos($filename, "?"));
250
+    }
251 251
 
252
-	$timestamp = filemtime($filename);
252
+    $timestamp = filemtime($filename);
253 253
 
254
-	if ($query) $timestamp .= "&$query";
254
+    if ($query) $timestamp .= "&$query";
255 255
 
256
-	return "<script type=\"text/javascript\" charset=\"utf-8\" src=\"$filename?$timestamp\"></script>\n";
256
+    return "<script type=\"text/javascript\" charset=\"utf-8\" src=\"$filename?$timestamp\"></script>\n";
257 257
 }
258 258
 
259 259
 function format_warning($msg, $id = "") {
260
-	return "<div class=\"alert\" id=\"$id\">$msg</div>";
260
+    return "<div class=\"alert\" id=\"$id\">$msg</div>";
261 261
 }
262 262
 
263 263
 function format_notice($msg, $id = "") {
264
-	return "<div class=\"alert alert-info\" id=\"$id\">$msg</div>";
264
+    return "<div class=\"alert alert-info\" id=\"$id\">$msg</div>";
265 265
 }
266 266
 
267 267
 function format_error($msg, $id = "") {
268
-	return "<div class=\"alert alert-danger\" id=\"$id\">$msg</div>";
268
+    return "<div class=\"alert alert-danger\" id=\"$id\">$msg</div>";
269 269
 }
270 270
 
271 271
 function print_notice($msg) {
272
-	return print format_notice($msg);
272
+    return print format_notice($msg);
273 273
 }
274 274
 
275 275
 function print_warning($msg) {
276
-	return print format_warning($msg);
276
+    return print format_warning($msg);
277 277
 }
278 278
 
279 279
 function print_error($msg) {
280
-	return print format_error($msg);
280
+    return print format_error($msg);
281 281
 }
282 282
 
283 283
 function format_inline_player($url, $ctype) {
284 284
 
285
-	$entry = "";
285
+    $entry = "";
286 286
 
287
-	$url = htmlspecialchars($url);
287
+    $url = htmlspecialchars($url);
288 288
 
289
-	if (strpos($ctype, "audio/") === 0) {
289
+    if (strpos($ctype, "audio/") === 0) {
290 290
 
291
-		$entry .= "<div class='inline-player'>";
291
+        $entry .= "<div class='inline-player'>";
292 292
 
293
-		if ($_SESSION["hasAudio"] && (strpos($ctype, "ogg") !== false ||
294
-				$_SESSION["hasMp3"])) {
293
+        if ($_SESSION["hasAudio"] && (strpos($ctype, "ogg") !== false ||
294
+                $_SESSION["hasMp3"])) {
295 295
 
296
-			$entry .= "<audio preload=\"none\" controls>
296
+            $entry .= "<audio preload=\"none\" controls>
297 297
 					<source type=\"$ctype\" src=\"$url\"/>
298 298
 					</audio> ";
299 299
 
300
-		}
300
+        }
301 301
 
302
-		if ($entry) $entry .= "<a target=\"_blank\" rel=\"noopener noreferrer\"
302
+        if ($entry) $entry .= "<a target=\"_blank\" rel=\"noopener noreferrer\"
303 303
 				href=\"$url\">" . basename($url) . "</a>";
304 304
 
305
-		$entry .= "</div>";
305
+        $entry .= "</div>";
306 306
 
307
-		return $entry;
307
+        return $entry;
308 308
 
309
-	}
309
+    }
310 310
 
311
-	return "";
311
+    return "";
312 312
 }
313 313
 
314 314
 function print_label_select($name, $value, $attributes = "") {
315 315
 
316
-	$pdo = Db::pdo();
316
+    $pdo = Db::pdo();
317 317
 
318
-	$sth = $pdo->prepare("SELECT caption FROM ttrss_labels2
318
+    $sth = $pdo->prepare("SELECT caption FROM ttrss_labels2
319 319
 			WHERE owner_uid = ? ORDER BY caption");
320
-	$sth->execute([$_SESSION['uid']]);
320
+    $sth->execute([$_SESSION['uid']]);
321 321
 
322
-	print "<select default=\"$value\" name=\"" . htmlspecialchars($name) .
323
-		"\" $attributes>";
322
+    print "<select default=\"$value\" name=\"" . htmlspecialchars($name) .
323
+        "\" $attributes>";
324 324
 
325
-	while ($line = $sth->fetch()) {
325
+    while ($line = $sth->fetch()) {
326 326
 
327
-		$issel = ($line["caption"] == $value) ? "selected=\"1\"" : "";
327
+        $issel = ($line["caption"] == $value) ? "selected=\"1\"" : "";
328 328
 
329
-		print "<option value=\"".htmlspecialchars($line["caption"])."\"
329
+        print "<option value=\"".htmlspecialchars($line["caption"])."\"
330 330
 				$issel>" . htmlspecialchars($line["caption"]) . "</option>";
331 331
 
332
-	}
332
+    }
333 333
 
334 334
 #		print "<option value=\"ADD_LABEL\">" .__("Add label...") . "</option>";
335 335
 
336
-	print "</select>";
336
+    print "</select>";
337 337
 
338 338
 
339 339
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 	$pdo = DB::pdo();
78 78
 
79
-	print_r(in_array("CAT:6",$default_ids));
79
+	print_r(in_array("CAT:6", $default_ids));
80 80
 
81 81
 	if (!$root_id) {
82 82
 		print "<select multiple=\true\" id=\"$id\" name=\"$id\" $attributes>";
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		while ($line = $sth->fetch()) {
103 103
 
104 104
 			for ($i = 0; $i < $nest_level; $i++)
105
-				$line["title"] = " - " . $line["title"];
105
+				$line["title"] = " - ".$line["title"];
106 106
 
107 107
 			$is_selected = in_array("CAT:".$line["id"], $default_ids) ? "selected=\"1\"" : "";
108 108
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
 			if ($line["num_children"] > 0)
113 113
 				print_feed_multi_select($id, $default_ids, $attributes,
114
-					$include_all_feeds, $line["id"], $nest_level+1);
114
+					$include_all_feeds, $line["id"], $nest_level + 1);
115 115
 
116 116
 			$f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds
117 117
 					WHERE cat_id = ? AND owner_uid = ? ORDER BY title");
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 			while ($fline = $f_sth->fetch()) {
122 122
 				$is_selected = (in_array($fline["id"], $default_ids)) ? "selected=\"1\"" : "";
123 123
 
124
-				$fline["title"] = " + " . $fline["title"];
124
+				$fline["title"] = " + ".$fline["title"];
125 125
 
126 126
 				for ($i = 0; $i < $nest_level; $i++)
127
-					$fline["title"] = " - " . $fline["title"];
127
+					$fline["title"] = " - ".$fline["title"];
128 128
 
129 129
 				printf("<option $is_selected value='%d'>%s</option>",
130 130
 					$fline["id"], htmlspecialchars($fline["title"]));
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 			while ($fline = $f_sth->fetch()) {
145 145
 				$is_selected = in_array($fline["id"], $default_ids) ? "selected=\"1\"" : "";
146 146
 
147
-				$fline["title"] = " + " . $fline["title"];
147
+				$fline["title"] = " + ".$fline["title"];
148 148
 
149 149
 				for ($i = 0; $i < $nest_level; $i++)
150
-					$fline["title"] = " - " . $fline["title"];
150
+					$fline["title"] = " - ".$fline["title"];
151 151
 
152 152
 				printf("<option $is_selected value='%d'>%s</option>",
153 153
 					$fline["id"], htmlspecialchars($fline["title"]));
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 		}
205 205
 
206 206
 		for ($i = 0; $i < $nest_level; $i++)
207
-			$line["title"] = " - " . $line["title"];
207
+			$line["title"] = " - ".$line["title"];
208 208
 
209 209
 		if ($line["title"])
210 210
 			printf("<option $is_selected value='%d'>%s</option>",
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
 		if ($line["num_children"] > 0)
214 214
 			print_feed_cat_select($id, $default_id, $attributes,
215
-				$include_all_cats, $line["id"], $nest_level+1);
215
+				$include_all_cats, $line["id"], $nest_level + 1);
216 216
 	}
217 217
 
218 218
 	if (!$root_id) {
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	$query = "";
246 246
 
247 247
 	if (!(strpos($filename, "?") === false)) {
248
-		$query = substr($filename, strpos($filename, "?")+1);
248
+		$query = substr($filename, strpos($filename, "?") + 1);
249 249
 		$filename = substr($filename, 0, strpos($filename, "?"));
250 250
 	}
251 251
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 		}
301 301
 
302 302
 		if ($entry) $entry .= "<a target=\"_blank\" rel=\"noopener noreferrer\"
303
-				href=\"$url\">" . basename($url) . "</a>";
303
+				href=\"$url\">".basename($url)."</a>";
304 304
 
305 305
 		$entry .= "</div>";
306 306
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 			WHERE owner_uid = ? ORDER BY caption");
320 320
 	$sth->execute([$_SESSION['uid']]);
321 321
 
322
-	print "<select default=\"$value\" name=\"" . htmlspecialchars($name) .
322
+	print "<select default=\"$value\" name=\"".htmlspecialchars($name).
323 323
 		"\" $attributes>";
324 324
 
325 325
 	while ($line = $sth->fetch()) {
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 		$issel = ($line["caption"] == $value) ? "selected=\"1\"" : "";
328 328
 
329 329
 		print "<option value=\"".htmlspecialchars($line["caption"])."\"
330
-				$issel>" . htmlspecialchars($line["caption"]) . "</option>";
330
+				$issel>".htmlspecialchars($line["caption"])."</option>";
331 331
 
332 332
 	}
333 333
 
Please login to merge, or discard this patch.
install/index.php 2 patches
Indentation   +261 added lines, -261 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  discard block
 block discarded – undo
1 1
 <?php
2
-	function stylesheet_tag($filename, $id = false) {
3
-		$timestamp = filemtime($filename);
2
+    function stylesheet_tag($filename, $id = false) {
3
+        $timestamp = filemtime($filename);
4 4
 
5
-		$id_part = $id ? "id=\"$id\"" : "";
5
+        $id_part = $id ? "id=\"$id\"" : "";
6 6
 
7
-		return "<link rel=\"stylesheet\" $id_part type=\"text/css\" href=\"$filename?$timestamp\"/>\n";
8
-	}
7
+        return "<link rel=\"stylesheet\" $id_part type=\"text/css\" href=\"$filename?$timestamp\"/>\n";
8
+    }
9 9
 
10
-	function javascript_tag($filename) {
11
-		$query = "";
10
+    function javascript_tag($filename) {
11
+        $query = "";
12 12
 
13
-		if (!(strpos($filename, "?") === false)) {
14
-			$query = substr($filename, strpos($filename, "?")+1);
15
-			$filename = substr($filename, 0, strpos($filename, "?"));
16
-		}
13
+        if (!(strpos($filename, "?") === false)) {
14
+            $query = substr($filename, strpos($filename, "?")+1);
15
+            $filename = substr($filename, 0, strpos($filename, "?"));
16
+        }
17 17
 
18
-		$timestamp = filemtime($filename);
18
+        $timestamp = filemtime($filename);
19 19
 
20
-		if ($query) $timestamp .= "&$query";
20
+        if ($query) $timestamp .= "&$query";
21 21
 
22
-		return "<script type=\"text/javascript\" charset=\"utf-8\" src=\"$filename?$timestamp\"></script>\n";
23
-	}
22
+        return "<script type=\"text/javascript\" charset=\"utf-8\" src=\"$filename?$timestamp\"></script>\n";
23
+    }
24 24
 ?>
25 25
 <!DOCTYPE html>
26 26
 <html>
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		textarea { font-size : 12px; }
32 32
 	</style>
33 33
 	<?php
34
-		echo stylesheet_tag("../css/default.css");
35
-		echo javascript_tag("../lib/prototype.js");
36
-		echo javascript_tag("../lib/dojo/dojo.js");
37
-		echo javascript_tag("../lib/dojo/tt-rss-layer.js");
38
-	?>
34
+        echo stylesheet_tag("../css/default.css");
35
+        echo javascript_tag("../lib/prototype.js");
36
+        echo javascript_tag("../lib/dojo/dojo.js");
37
+        echo javascript_tag("../lib/dojo/tt-rss-layer.js");
38
+    ?>
39 39
 </head>
40 40
 <body class="flat ttrss_utility installer">
41 41
 
@@ -50,149 +50,149 @@  discard block
 block discarded – undo
50 50
 
51 51
 <?php
52 52
 
53
-	// could be needed because of existing config.php
54
-	function define_default($param, $value) {
55
-		//
56
-	}
53
+    // could be needed because of existing config.php
54
+    function define_default($param, $value) {
55
+        //
56
+    }
57 57
 
58
-	function make_password($length = 12) {
59
-		$password = "";
60
-		$possible = "0123456789abcdfghjkmnpqrstvwxyzABCDFGHJKMNPQRSTVWXYZ*%+^";
58
+    function make_password($length = 12) {
59
+        $password = "";
60
+        $possible = "0123456789abcdfghjkmnpqrstvwxyzABCDFGHJKMNPQRSTVWXYZ*%+^";
61 61
 
62
-		$i = 0;
62
+        $i = 0;
63 63
 
64
-		while ($i < $length) {
64
+        while ($i < $length) {
65 65
 
66
-			try {
67
-				$idx = function_exists("random_int") ? random_int(0, strlen($possible) - 1) : mt_rand(0, strlen($possible) - 1);
68
-			} catch (Exception $e) {
69
-				$idx = mt_rand(0, strlen($possible) - 1);
70
-			}
66
+            try {
67
+                $idx = function_exists("random_int") ? random_int(0, strlen($possible) - 1) : mt_rand(0, strlen($possible) - 1);
68
+            } catch (Exception $e) {
69
+                $idx = mt_rand(0, strlen($possible) - 1);
70
+            }
71 71
 
72
-			$char = substr($possible, $idx, 1);
72
+            $char = substr($possible, $idx, 1);
73 73
 
74
-			if (!strstr($password, $char)) {
75
-				$password .= $char;
76
-				$i++;
77
-			}
78
-		}
74
+            if (!strstr($password, $char)) {
75
+                $password .= $char;
76
+                $i++;
77
+            }
78
+        }
79 79
 
80
-		return $password;
81
-	}
80
+        return $password;
81
+    }
82 82
 
83 83
 
84
-	function sanity_check($db_type) {
85
-		$errors = array();
84
+    function sanity_check($db_type) {
85
+        $errors = array();
86 86
 
87
-		if (version_compare(PHP_VERSION, '5.6.0', '<')) {
88
-			array_push($errors, "PHP version 5.6.0 or newer required. You're using " . PHP_VERSION . ".");
89
-		}
87
+        if (version_compare(PHP_VERSION, '5.6.0', '<')) {
88
+            array_push($errors, "PHP version 5.6.0 or newer required. You're using " . PHP_VERSION . ".");
89
+        }
90 90
 
91
-		if (!function_exists("curl_init") && !ini_get("allow_url_fopen")) {
92
-			array_push($errors, "PHP configuration option allow_url_fopen is disabled, and CURL functions are not present. Either enable allow_url_fopen or install PHP extension for CURL.");
93
-		}
91
+        if (!function_exists("curl_init") && !ini_get("allow_url_fopen")) {
92
+            array_push($errors, "PHP configuration option allow_url_fopen is disabled, and CURL functions are not present. Either enable allow_url_fopen or install PHP extension for CURL.");
93
+        }
94 94
 
95
-		if (!function_exists("json_encode")) {
96
-			array_push($errors, "PHP support for JSON is required, but was not found.");
97
-		}
95
+        if (!function_exists("json_encode")) {
96
+            array_push($errors, "PHP support for JSON is required, but was not found.");
97
+        }
98 98
 
99
-		if (!class_exists("PDO")) {
100
-			array_push($errors, "PHP support for PDO is required but was not found.");
101
-		}
99
+        if (!class_exists("PDO")) {
100
+            array_push($errors, "PHP support for PDO is required but was not found.");
101
+        }
102 102
 
103
-		if (!function_exists("mb_strlen")) {
104
-			array_push($errors, "PHP support for mbstring functions is required but was not found.");
105
-		}
103
+        if (!function_exists("mb_strlen")) {
104
+            array_push($errors, "PHP support for mbstring functions is required but was not found.");
105
+        }
106 106
 
107
-		if (!function_exists("hash")) {
108
-			array_push($errors, "PHP support for hash() function is required but was not found.");
109
-		}
107
+        if (!function_exists("hash")) {
108
+            array_push($errors, "PHP support for hash() function is required but was not found.");
109
+        }
110 110
 
111
-		if (!function_exists("iconv")) {
112
-			array_push($errors, "PHP support for iconv is required to handle multiple charsets.");
113
-		}
111
+        if (!function_exists("iconv")) {
112
+            array_push($errors, "PHP support for iconv is required to handle multiple charsets.");
113
+        }
114 114
 
115
-		if (ini_get("safe_mode")) {
116
-			array_push($errors, "PHP safe mode setting is obsolete and not supported by tt-rss.");
117
-		}
115
+        if (ini_get("safe_mode")) {
116
+            array_push($errors, "PHP safe mode setting is obsolete and not supported by tt-rss.");
117
+        }
118 118
 
119
-		if (!class_exists("DOMDocument")) {
120
-			array_push($errors, "PHP support for DOMDocument is required, but was not found.");
121
-		}
119
+        if (!class_exists("DOMDocument")) {
120
+            array_push($errors, "PHP support for DOMDocument is required, but was not found.");
121
+        }
122 122
 
123
-		return $errors;
124
-	}
123
+        return $errors;
124
+    }
125 125
 
126
-	function print_error($msg) {
127
-		print "<div class='alert alert-error'>$msg</div>";
128
-	}
126
+    function print_error($msg) {
127
+        print "<div class='alert alert-error'>$msg</div>";
128
+    }
129 129
 
130
-	function print_notice($msg) {
131
-		print "<div class=\"alert alert-info\">$msg</div>";
132
-	}
130
+    function print_notice($msg) {
131
+        print "<div class=\"alert alert-info\">$msg</div>";
132
+    }
133 133
 
134
-	function pdo_connect($host, $user, $pass, $db, $type, $port = false) {
134
+    function pdo_connect($host, $user, $pass, $db, $type, $port = false) {
135 135
 
136
-		$db_port = $port ? ';port=' . $port : '';
137
-		$db_host = $host ? ';host=' . $host : '';
136
+        $db_port = $port ? ';port=' . $port : '';
137
+        $db_host = $host ? ';host=' . $host : '';
138 138
 
139
-		try {
140
-			$pdo = new PDO($type . ':dbname=' . $db . $db_host . $db_port,
141
-				$user,
142
-				$pass);
139
+        try {
140
+            $pdo = new PDO($type . ':dbname=' . $db . $db_host . $db_port,
141
+                $user,
142
+                $pass);
143 143
 
144
-			return $pdo;
145
-		} catch (Exception $e) {
146
-		    print "<div class='alert alert-danger'>" . $e->getMessage() . "</div>";
147
-		    return null;
144
+            return $pdo;
145
+        } catch (Exception $e) {
146
+            print "<div class='alert alert-danger'>" . $e->getMessage() . "</div>";
147
+            return null;
148 148
         }
149
-	}
150
-
151
-	function make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS,
152
-			$DB_PORT, $SELF_URL_PATH) {
153
-
154
-		$data = explode("\n", file_get_contents("../config.php-dist"));
155
-
156
-		$rv = "";
157
-
158
-		$finished = false;
159
-
160
-		foreach ($data as $line) {
161
-			if (preg_match("/define\('DB_TYPE'/", $line)) {
162
-				$rv .= "\tdefine('DB_TYPE', '$DB_TYPE');\n";
163
-			} else if (preg_match("/define\('DB_HOST'/", $line)) {
164
-				$rv .= "\tdefine('DB_HOST', '$DB_HOST');\n";
165
-			} else if (preg_match("/define\('DB_USER'/", $line)) {
166
-				$rv .= "\tdefine('DB_USER', '$DB_USER');\n";
167
-			} else if (preg_match("/define\('DB_NAME'/", $line)) {
168
-				$rv .= "\tdefine('DB_NAME', '$DB_NAME');\n";
169
-			} else if (preg_match("/define\('DB_PASS'/", $line)) {
170
-				$rv .= "\tdefine('DB_PASS', '$DB_PASS');\n";
171
-			} else if (preg_match("/define\('DB_PORT'/", $line)) {
172
-				$rv .= "\tdefine('DB_PORT', '$DB_PORT');\n";
173
-			} else if (preg_match("/define\('SELF_URL_PATH'/", $line)) {
174
-				$rv .= "\tdefine('SELF_URL_PATH', '$SELF_URL_PATH');\n";
175
-			} else if (!$finished) {
176
-				$rv .= "$line\n";
177
-			}
178
-
179
-			if (preg_match("/\?\>/", $line)) {
180
-				$finished = true;
181
-			}
182
-		}
183
-
184
-		return $rv;
185
-	}
186
-
187
-	function is_server_https() {
188
-		return (!empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] != 'off')) || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https');
189
-	}
190
-
191
-	function make_self_url_path() {
192
-		$url_path = (is_server_https() ? 'https://' :  'http://') . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
193
-
194
-		return $url_path;
195
-	}
149
+    }
150
+
151
+    function make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS,
152
+            $DB_PORT, $SELF_URL_PATH) {
153
+
154
+        $data = explode("\n", file_get_contents("../config.php-dist"));
155
+
156
+        $rv = "";
157
+
158
+        $finished = false;
159
+
160
+        foreach ($data as $line) {
161
+            if (preg_match("/define\('DB_TYPE'/", $line)) {
162
+                $rv .= "\tdefine('DB_TYPE', '$DB_TYPE');\n";
163
+            } else if (preg_match("/define\('DB_HOST'/", $line)) {
164
+                $rv .= "\tdefine('DB_HOST', '$DB_HOST');\n";
165
+            } else if (preg_match("/define\('DB_USER'/", $line)) {
166
+                $rv .= "\tdefine('DB_USER', '$DB_USER');\n";
167
+            } else if (preg_match("/define\('DB_NAME'/", $line)) {
168
+                $rv .= "\tdefine('DB_NAME', '$DB_NAME');\n";
169
+            } else if (preg_match("/define\('DB_PASS'/", $line)) {
170
+                $rv .= "\tdefine('DB_PASS', '$DB_PASS');\n";
171
+            } else if (preg_match("/define\('DB_PORT'/", $line)) {
172
+                $rv .= "\tdefine('DB_PORT', '$DB_PORT');\n";
173
+            } else if (preg_match("/define\('SELF_URL_PATH'/", $line)) {
174
+                $rv .= "\tdefine('SELF_URL_PATH', '$SELF_URL_PATH');\n";
175
+            } else if (!$finished) {
176
+                $rv .= "$line\n";
177
+            }
178
+
179
+            if (preg_match("/\?\>/", $line)) {
180
+                $finished = true;
181
+            }
182
+        }
183
+
184
+        return $rv;
185
+    }
186
+
187
+    function is_server_https() {
188
+        return (!empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] != 'off')) || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https');
189
+    }
190
+
191
+    function make_self_url_path() {
192
+        $url_path = (is_server_https() ? 'https://' :  'http://') . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
193
+
194
+        return $url_path;
195
+    }
196 196
 
197 197
 ?>
198 198
 
@@ -202,32 +202,32 @@  discard block
 block discarded – undo
202 202
 
203 203
 <?php
204 204
 
205
-	if (file_exists("../config.php")) {
206
-		require "../config.php";
205
+    if (file_exists("../config.php")) {
206
+        require "../config.php";
207 207
 
208
-		if (!defined('_INSTALLER_IGNORE_CONFIG_CHECK')) {
209
-			print_error("Error: config.php already exists in tt-rss directory; aborting.");
208
+        if (!defined('_INSTALLER_IGNORE_CONFIG_CHECK')) {
209
+            print_error("Error: config.php already exists in tt-rss directory; aborting.");
210 210
 
211
-			print "<form method='GET' action='../index.php'>
211
+            print "<form method='GET' action='../index.php'>
212 212
 				<button type='submit' dojoType='dijit.form.Button' class='alt-primary'>Return to Tiny Tiny RSS</button>
213 213
 				</form>";
214
-			exit;
215
-		}
216
-	}
217
-
218
-	@$op = $_REQUEST['op'];
219
-
220
-	@$DB_HOST = strip_tags($_POST['DB_HOST']);
221
-	@$DB_TYPE = strip_tags($_POST['DB_TYPE']);
222
-	@$DB_USER = strip_tags($_POST['DB_USER']);
223
-	@$DB_NAME = strip_tags($_POST['DB_NAME']);
224
-	@$DB_PASS = strip_tags($_POST['DB_PASS']);
225
-	@$DB_PORT = strip_tags($_POST['DB_PORT']);
226
-	@$SELF_URL_PATH = strip_tags($_POST['SELF_URL_PATH']);
227
-
228
-	if (!$SELF_URL_PATH) {
229
-		$SELF_URL_PATH = preg_replace("/\/install\/$/", "/", make_self_url_path());
230
-	}
214
+            exit;
215
+        }
216
+    }
217
+
218
+    @$op = $_REQUEST['op'];
219
+
220
+    @$DB_HOST = strip_tags($_POST['DB_HOST']);
221
+    @$DB_TYPE = strip_tags($_POST['DB_TYPE']);
222
+    @$DB_USER = strip_tags($_POST['DB_USER']);
223
+    @$DB_NAME = strip_tags($_POST['DB_NAME']);
224
+    @$DB_PASS = strip_tags($_POST['DB_PASS']);
225
+    @$DB_PORT = strip_tags($_POST['DB_PORT']);
226
+    @$SELF_URL_PATH = strip_tags($_POST['SELF_URL_PATH']);
227
+
228
+    if (!$SELF_URL_PATH) {
229
+        $SELF_URL_PATH = preg_replace("/\/install\/$/", "/", make_self_url_path());
230
+    }
231 231
 ?>
232 232
 
233 233
 <form action="" method="post">
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 	<h2>Database settings</h2>
237 237
 
238 238
 	<?php
239
-		$issel_pgsql = $DB_TYPE == "pgsql" ? "selected='selected'" : "";
240
-		$issel_mysql = $DB_TYPE == "mysql" ? "selected='selected'" : "";
241
-	?>
239
+        $issel_pgsql = $DB_TYPE == "pgsql" ? "selected='selected'" : "";
240
+        $issel_mysql = $DB_TYPE == "mysql" ? "selected='selected'" : "";
241
+    ?>
242 242
 
243 243
 	<fieldset>
244 244
 		<label>Database type:</label>
@@ -292,87 +292,87 @@  discard block
 block discarded – undo
292 292
 	<h2>Checking configuration</h2>
293 293
 
294 294
 	<?php
295
-		$errors = sanity_check($DB_TYPE);
295
+        $errors = sanity_check($DB_TYPE);
296 296
 
297
-		if (count($errors) > 0) {
298
-			print "<p>Some configuration tests failed. Please correct them before continuing.</p>";
297
+        if (count($errors) > 0) {
298
+            print "<p>Some configuration tests failed. Please correct them before continuing.</p>";
299 299
 
300
-			print "<ul>";
300
+            print "<ul>";
301 301
 
302
-			foreach ($errors as $error) {
303
-				print "<li style='color : red'>$error</li>";
304
-			}
302
+            foreach ($errors as $error) {
303
+                print "<li style='color : red'>$error</li>";
304
+            }
305 305
 
306
-			print "</ul>";
306
+            print "</ul>";
307 307
 
308
-			exit;
309
-		}
308
+            exit;
309
+        }
310 310
 
311
-		$notices = array();
311
+        $notices = array();
312 312
 
313
-		if (!function_exists("curl_init")) {
314
-			array_push($notices, "It is highly recommended to enable support for CURL in PHP.");
315
-		}
313
+        if (!function_exists("curl_init")) {
314
+            array_push($notices, "It is highly recommended to enable support for CURL in PHP.");
315
+        }
316 316
 
317
-		if (function_exists("curl_init") && ini_get("open_basedir")) {
318
-			array_push($notices, "CURL and open_basedir combination breaks support for HTTP redirects. See the FAQ for more information.");
319
-		}
317
+        if (function_exists("curl_init") && ini_get("open_basedir")) {
318
+            array_push($notices, "CURL and open_basedir combination breaks support for HTTP redirects. See the FAQ for more information.");
319
+        }
320 320
 
321
-		if (!function_exists("idn_to_ascii")) {
322
-			array_push($notices, "PHP support for Internationalization Functions is required to handle Internationalized Domain Names.");
323
-		}
321
+        if (!function_exists("idn_to_ascii")) {
322
+            array_push($notices, "PHP support for Internationalization Functions is required to handle Internationalized Domain Names.");
323
+        }
324 324
 
325 325
         if ($DB_TYPE == "mysql" && !function_exists("mysqli_connect")) {
326 326
             array_push($notices, "PHP extension for MySQL (mysqli) is missing. This may prevent legacy plugins from working.");
327 327
         }
328 328
 
329 329
         if ($DB_TYPE == "pgsql" && !function_exists("pg_connect")) {
330
-			array_push($notices, "PHP extension for PostgreSQL is missing. This may prevent legacy plugins from working.");
330
+            array_push($notices, "PHP extension for PostgreSQL is missing. This may prevent legacy plugins from working.");
331 331
         }
332 332
 
333
-		if (count($notices) > 0) {
334
-			print_notice("Configuration check succeeded with minor problems:");
333
+        if (count($notices) > 0) {
334
+            print_notice("Configuration check succeeded with minor problems:");
335 335
 
336
-			print "<ul>";
336
+            print "<ul>";
337 337
 
338
-			foreach ($notices as $notice) {
339
-				print "<li>$notice</li>";
340
-			}
338
+            foreach ($notices as $notice) {
339
+                print "<li>$notice</li>";
340
+            }
341 341
 
342
-			print "</ul>";
343
-		} else {
344
-			print_notice("Configuration check succeeded.");
345
-		}
342
+            print "</ul>";
343
+        } else {
344
+            print_notice("Configuration check succeeded.");
345
+        }
346 346
 
347
-	?>
347
+    ?>
348 348
 
349 349
 	<h2>Checking database</h2>
350 350
 
351 351
 	<?php
352
-		$pdo = pdo_connect($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME, $DB_TYPE, $DB_PORT);
352
+        $pdo = pdo_connect($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME, $DB_TYPE, $DB_PORT);
353 353
 
354
-		if (!$pdo) {
355
-			print_error("Unable to connect to database using specified parameters (driver: $DB_TYPE).");
356
-			exit;
357
-		}
354
+        if (!$pdo) {
355
+            print_error("Unable to connect to database using specified parameters (driver: $DB_TYPE).");
356
+            exit;
357
+        }
358 358
 
359
-		print_notice("Database test succeeded.");
360
-	?>
359
+        print_notice("Database test succeeded.");
360
+    ?>
361 361
 
362 362
 	<h2>Initialize database</h2>
363 363
 
364 364
 	<p>Before you can start using tt-rss, database needs to be initialized. Click on the button below to do that now.</p>
365 365
 
366 366
 	<?php
367
-		$res = $pdo->query("SELECT true FROM ttrss_feeds");
367
+        $res = $pdo->query("SELECT true FROM ttrss_feeds");
368 368
 
369
-		if ($res && $res->fetch()) {
370
-			print_error("Some tt-rss data already exists in this database. If you continue with database initialization your current data <b>WILL BE LOST</b>.");
371
-			$need_confirm = true;
372
-		} else {
373
-			$need_confirm = false;
374
-		}
375
-	?>
369
+        if ($res && $res->fetch()) {
370
+            print_error("Some tt-rss data already exists in this database. If you continue with database initialization your current data <b>WILL BE LOST</b>.");
371
+            $need_confirm = true;
372
+        } else {
373
+            $need_confirm = false;
374
+        }
375
+    ?>
376 376
 
377 377
 	<table><tr><td>
378 378
 	<form method="post">
@@ -415,44 +415,44 @@  discard block
 block discarded – undo
415 415
 
416 416
 	<?php
417 417
 
418
-		} else if ($op == 'installschema' || $op == 'skipschema') {
418
+        } else if ($op == 'installschema' || $op == 'skipschema') {
419 419
 
420
-			$pdo = pdo_connect($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME, $DB_TYPE, $DB_PORT);
420
+            $pdo = pdo_connect($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME, $DB_TYPE, $DB_PORT);
421 421
 
422
-			if (!$pdo) {
423
-				print_error("Unable to connect to database using specified parameters.");
424
-				exit;
425
-			}
422
+            if (!$pdo) {
423
+                print_error("Unable to connect to database using specified parameters.");
424
+                exit;
425
+            }
426 426
 
427
-			if ($op == 'installschema') {
427
+            if ($op == 'installschema') {
428 428
 
429
-				print "<h2>Initializing database...</h2>";
429
+                print "<h2>Initializing database...</h2>";
430 430
 
431
-				$lines = explode(";", preg_replace("/[\r\n]/", "",
431
+                $lines = explode(";", preg_replace("/[\r\n]/", "",
432 432
                     file_get_contents("../schema/ttrss_schema_".basename($DB_TYPE).".sql")));
433 433
 
434
-				foreach ($lines as $line) {
435
-					if (strpos($line, "--") !== 0 && $line) {
436
-						$res = $pdo->query($line);
434
+                foreach ($lines as $line) {
435
+                    if (strpos($line, "--") !== 0 && $line) {
436
+                        $res = $pdo->query($line);
437 437
 
438
-						if (!$res) {
439
-							print_notice("Query: $line");
440
-							print_error("Error: " . implode(", ", $pdo->errorInfo()));
438
+                        if (!$res) {
439
+                            print_notice("Query: $line");
440
+                            print_error("Error: " . implode(", ", $pdo->errorInfo()));
441 441
                         }
442
-					}
443
-				}
442
+                    }
443
+                }
444 444
 
445
-				print_notice("Database initialization completed.");
445
+                print_notice("Database initialization completed.");
446 446
 
447
-			} else {
448
-				print_notice("Database initialization skipped.");
449
-			}
447
+            } else {
448
+                print_notice("Database initialization skipped.");
449
+            }
450 450
 
451
-			print "<h2>Generated configuration file</h2>";
451
+            print "<h2>Generated configuration file</h2>";
452 452
 
453
-			print "<p>Copy following text and save as <code>config.php</code> in tt-rss main directory. It is suggested to read through the file to the end in case you need any options changed fom default values.</p>";
453
+            print "<p>Copy following text and save as <code>config.php</code> in tt-rss main directory. It is suggested to read through the file to the end in case you need any options changed fom default values.</p>";
454 454
 
455
-			print "<p>After copying the file, you will be able to login with default username and password combination: <code>admin</code> and <code>password</code>. Don't forget to change the password immediately!</p>"; ?>
455
+            print "<p>After copying the file, you will be able to login with default username and password combination: <code>admin</code> and <code>password</code>. Don't forget to change the password immediately!</p>"; ?>
456 456
 
457 457
 			<form action="" method="post">
458 458
 				<input type="hidden" name="op" value="saveconfig">
@@ -464,9 +464,9 @@  discard block
 block discarded – undo
464 464
 				<input type="hidden" name="DB_TYPE" value="<?php echo $DB_TYPE ?>"/>
465 465
 				<input type="hidden" name="SELF_URL_PATH" value="<?php echo $SELF_URL_PATH ?>"/>
466 466
 			<?php print "<textarea rows='20' style='width : 100%'>";
467
-			echo make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS,
468
-				$DB_PORT, $SELF_URL_PATH);
469
-			print "</textarea>"; ?>
467
+            echo make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS,
468
+                $DB_PORT, $SELF_URL_PATH);
469
+            print "</textarea>"; ?>
470 470
 
471 471
 			<hr/>
472 472
 
@@ -476,40 +476,40 @@  discard block
 block discarded – undo
476 476
 				<p><button type="submit" dojoType='dijit.form.Button' class='alt-primary'>Save configuration</button></p>
477 477
 				</form>
478 478
 			<?php } else {
479
-				print_error("Unfortunately, parent directory is not writable, so we're unable to save config.php automatically.");
480
-			}
479
+                print_error("Unfortunately, parent directory is not writable, so we're unable to save config.php automatically.");
480
+            }
481 481
 
482
-		   print_notice("You can generate the file again by changing the form above.");
482
+            print_notice("You can generate the file again by changing the form above.");
483 483
 
484
-		} else if ($op == "saveconfig") {
484
+        } else if ($op == "saveconfig") {
485 485
 
486
-			print "<h2>Saving configuration file to parent directory...</h2>";
486
+            print "<h2>Saving configuration file to parent directory...</h2>";
487 487
 
488
-			if (!file_exists("../config.php")) {
488
+            if (!file_exists("../config.php")) {
489 489
 
490
-				$fp = fopen("../config.php", "w");
490
+                $fp = fopen("../config.php", "w");
491 491
 
492
-				if ($fp) {
493
-					$written = fwrite($fp, make_config($DB_TYPE, $DB_HOST,
494
-						$DB_USER, $DB_NAME, $DB_PASS,
495
-						$DB_PORT, $SELF_URL_PATH));
492
+                if ($fp) {
493
+                    $written = fwrite($fp, make_config($DB_TYPE, $DB_HOST,
494
+                        $DB_USER, $DB_NAME, $DB_PASS,
495
+                        $DB_PORT, $SELF_URL_PATH));
496 496
 
497
-					if ($written > 0) {
498
-						print_notice("Successfully saved config.php. You can try <a href=\"..\">loading tt-rss now</a>.");
497
+                    if ($written > 0) {
498
+                        print_notice("Successfully saved config.php. You can try <a href=\"..\">loading tt-rss now</a>.");
499 499
 
500
-					} else {
501
-						print_notice("Unable to write into config.php in tt-rss directory.");
502
-					}
500
+                    } else {
501
+                        print_notice("Unable to write into config.php in tt-rss directory.");
502
+                    }
503 503
 
504
-					fclose($fp);
505
-				} else {
506
-					print_error("Unable to open config.php in tt-rss directory for writing.");
507
-				}
508
-			} else {
509
-				print_error("config.php already present in tt-rss directory, refusing to overwrite.");
510
-			}
511
-		}
512
-	?>
504
+                    fclose($fp);
505
+                } else {
506
+                    print_error("Unable to open config.php in tt-rss directory for writing.");
507
+                }
508
+            } else {
509
+                print_error("config.php already present in tt-rss directory, refusing to overwrite.");
510
+            }
511
+        }
512
+    ?>
513 513
 
514 514
 </div>
515 515
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 		$query = "";
12 12
 
13 13
 		if (!(strpos($filename, "?") === false)) {
14
-			$query = substr($filename, strpos($filename, "?")+1);
14
+			$query = substr($filename, strpos($filename, "?") + 1);
15 15
 			$filename = substr($filename, 0, strpos($filename, "?"));
16 16
 		}
17 17
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		$errors = array();
86 86
 
87 87
 		if (version_compare(PHP_VERSION, '5.6.0', '<')) {
88
-			array_push($errors, "PHP version 5.6.0 or newer required. You're using " . PHP_VERSION . ".");
88
+			array_push($errors, "PHP version 5.6.0 or newer required. You're using ".PHP_VERSION.".");
89 89
 		}
90 90
 
91 91
 		if (!function_exists("curl_init") && !ini_get("allow_url_fopen")) {
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
 
134 134
 	function pdo_connect($host, $user, $pass, $db, $type, $port = false) {
135 135
 
136
-		$db_port = $port ? ';port=' . $port : '';
137
-		$db_host = $host ? ';host=' . $host : '';
136
+		$db_port = $port ? ';port='.$port : '';
137
+		$db_host = $host ? ';host='.$host : '';
138 138
 
139 139
 		try {
140
-			$pdo = new PDO($type . ':dbname=' . $db . $db_host . $db_port,
140
+			$pdo = new PDO($type.':dbname='.$db.$db_host.$db_port,
141 141
 				$user,
142 142
 				$pass);
143 143
 
144 144
 			return $pdo;
145 145
 		} catch (Exception $e) {
146
-		    print "<div class='alert alert-danger'>" . $e->getMessage() . "</div>";
146
+		    print "<div class='alert alert-danger'>".$e->getMessage()."</div>";
147 147
 		    return null;
148 148
         }
149 149
 	}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 
191 191
 	function make_self_url_path() {
192
-		$url_path = (is_server_https() ? 'https://' :  'http://') . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
192
+		$url_path = (is_server_https() ? 'https://' : 'http://').$_SERVER["HTTP_HOST"].parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
193 193
 
194 194
 		return $url_path;
195 195
 	}
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 
438 438
 						if (!$res) {
439 439
 							print_notice("Query: $line");
440
-							print_error("Error: " . implode(", ", $pdo->errorInfo()));
440
+							print_error("Error: ".implode(", ", $pdo->errorInfo()));
441 441
                         }
442 442
 					}
443 443
 				}
Please login to merge, or discard this patch.