@@ -235,7 +235,10 @@ discard block |
||
235 | 235 | $salt = substr(bin2hex(get_random_bytes(125)), 0, 250); |
236 | 236 | $pwd_hash = encrypt_password($tmp_user_pwd, $salt, true); |
237 | 237 | |
238 | - if (!$login) return; // no blank usernames |
|
238 | + if (!$login) { |
|
239 | + return; |
|
240 | + } |
|
241 | + // no blank usernames |
|
239 | 242 | |
240 | 243 | $sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE |
241 | 244 | login = ?"); |
@@ -294,10 +297,11 @@ discard block |
||
294 | 297 | |
295 | 298 | $message = T_sprintf("Changed password of user %s to %s", "<strong>$login</strong>", "<strong>$tmp_user_pwd</strong>"); |
296 | 299 | |
297 | - if ($format_output) |
|
298 | - print_notice($message); |
|
299 | - else |
|
300 | - print $message; |
|
300 | + if ($format_output) { |
|
301 | + print_notice($message); |
|
302 | + } else { |
|
303 | + print $message; |
|
304 | + } |
|
301 | 305 | |
302 | 306 | } |
303 | 307 | } |
@@ -365,7 +369,9 @@ discard block |
||
365 | 369 | $sort = $this->validate_field($sort, |
366 | 370 | ["login", "access_level", "created", "num_feeds", "created", "last_login"], "login"); |
367 | 371 | |
368 | - if ($sort != "login") $sort = "$sort DESC"; |
|
372 | + if ($sort != "login") { |
|
373 | + $sort = "$sort DESC"; |
|
374 | + } |
|
369 | 375 | |
370 | 376 | $sth = $this->pdo->prepare("SELECT |
371 | 377 | tu.id, |
@@ -437,10 +443,11 @@ discard block |
||
437 | 443 | } |
438 | 444 | |
439 | 445 | public function validate_field($string, $allowed, $default = "") { |
440 | - if (in_array($string, $allowed)) |
|
441 | - return $string; |
|
442 | - else |
|
443 | - return $default; |
|
446 | + if (in_array($string, $allowed)) { |
|
447 | + return $string; |
|
448 | + } else { |
|
449 | + return $default; |
|
450 | + } |
|
444 | 451 | } |
445 | 452 | |
446 | 453 | } |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | public function log_error($errno, $errstr, $file, $line, $context) { |
7 | 7 | |
8 | 8 | // separate PDO connection object is used for logging |
9 | - if (!$this->pdo) $this->pdo = Db::instance()->pdo_connect(); |
|
9 | + if (!$this->pdo) { |
|
10 | + $this->pdo = Db::instance()->pdo_connect(); |
|
11 | + } |
|
10 | 12 | |
11 | 13 | if ($this->pdo && get_schema_version() > 117) { |
12 | 14 | |
@@ -22,8 +24,9 @@ discard block |
||
22 | 24 | ]; |
23 | 25 | |
24 | 26 | foreach ($server_params as $n => $p) { |
25 | - if (isset($_SERVER[$p])) |
|
26 | - $context .= "\n$n: " . $_SERVER[$p]; |
|
27 | + if (isset($_SERVER[$p])) { |
|
28 | + $context .= "\n$n: " . $_SERVER[$p]; |
|
29 | + } |
|
27 | 30 | } |
28 | 31 | |
29 | 32 | // passed error message may contain invalid unicode characters, failing to insert an error here |
@@ -8,12 +8,15 @@ discard block |
||
8 | 8 | $this->pdo = Db::pdo(); |
9 | 9 | $this->cache = array(); |
10 | 10 | |
11 | - if ($_SESSION["uid"]) $this->cache(); |
|
11 | + if ($_SESSION["uid"]) { |
|
12 | + $this->cache(); |
|
13 | + } |
|
12 | 14 | } |
13 | 15 | |
14 | 16 | public static function get() { |
15 | - if (self::$instance == null) |
|
16 | - self::$instance = new self(); |
|
17 | + if (self::$instance == null) { |
|
18 | + self::$instance = new self(); |
|
19 | + } |
|
17 | 20 | |
18 | 21 | return self::$instance; |
19 | 22 | } |
@@ -22,7 +25,9 @@ discard block |
||
22 | 25 | $user_id = $_SESSION["uid"]; |
23 | 26 | @$profile = $_SESSION["profile"]; |
24 | 27 | |
25 | - if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null; |
|
28 | + if (!is_numeric($profile) || !$profile || get_schema_version() < 63) { |
|
29 | + $profile = null; |
|
30 | + } |
|
26 | 31 | |
27 | 32 | $sth = $this->pdo->prepare("SELECT |
28 | 33 | value,ttrss_prefs_types.type_name as type_name,ttrss_prefs.pref_name AS pref_name |
@@ -61,7 +66,9 @@ discard block |
||
61 | 66 | return $this->convert($tuple["value"], $tuple["type"]); |
62 | 67 | } |
63 | 68 | |
64 | - if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null; |
|
69 | + if (!is_numeric($profile) || !$profile || get_schema_version() < 63) { |
|
70 | + $profile = null; |
|
71 | + } |
|
65 | 72 | |
66 | 73 | $sth = $this->pdo->prepare("SELECT |
67 | 74 | value,ttrss_prefs_types.type_name as type_name |
@@ -105,7 +112,9 @@ discard block |
||
105 | 112 | } |
106 | 113 | |
107 | 114 | public function write($pref_name, $value, $user_id = false, $strip_tags = true) { |
108 | - if ($strip_tags) $value = strip_tags($value); |
|
115 | + if ($strip_tags) { |
|
116 | + $value = strip_tags($value); |
|
117 | + } |
|
109 | 118 | |
110 | 119 | if (!$user_id) { |
111 | 120 | $user_id = $_SESSION["uid"]; |
@@ -114,7 +123,9 @@ discard block |
||
114 | 123 | $profile = null; |
115 | 124 | } |
116 | 125 | |
117 | - if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null; |
|
126 | + if (!is_numeric($profile) || !$profile || get_schema_version() < 63) { |
|
127 | + $profile = null; |
|
128 | + } |
|
118 | 129 | |
119 | 130 | $type_name = ""; |
120 | 131 | $current_value = ""; |
@@ -130,8 +141,9 @@ discard block |
||
130 | 141 | WHERE pref_name = ? AND type_id = ttrss_prefs_types.id"); |
131 | 142 | $sth->execute([$pref_name]); |
132 | 143 | |
133 | - if ($row = $sth->fetch()) |
|
134 | - $type_name = $row["type_name"]; |
|
144 | + if ($row = $sth->fetch()) { |
|
145 | + $type_name = $row["type_name"]; |
|
146 | + } |
|
135 | 147 | |
136 | 148 | } else if ($current_value == $value) { |
137 | 149 | return; |
@@ -31,7 +31,9 @@ |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | public function escape_string($s, $strip_tags = true) { |
34 | - if ($strip_tags) $s = strip_tags($s); |
|
34 | + if ($strip_tags) { |
|
35 | + $s = strip_tags($s); |
|
36 | + } |
|
35 | 37 | |
36 | 38 | return pg_escape_string($s); |
37 | 39 | } |
@@ -4,10 +4,11 @@ discard block |
||
4 | 4 | private $last_error; |
5 | 5 | |
6 | 6 | public function connect($host, $user, $pass, $db, $port) { |
7 | - if ($port) |
|
8 | - $this->link = mysqli_connect($host, $user, $pass, $db, $port); |
|
9 | - else |
|
10 | - $this->link = mysqli_connect($host, $user, $pass, $db); |
|
7 | + if ($port) { |
|
8 | + $this->link = mysqli_connect($host, $user, $pass, $db, $port); |
|
9 | + } else { |
|
10 | + $this->link = mysqli_connect($host, $user, $pass, $db); |
|
11 | + } |
|
11 | 12 | |
12 | 13 | if ($this->link) { |
13 | 14 | $this->init(); |
@@ -20,7 +21,9 @@ discard block |
||
20 | 21 | } |
21 | 22 | |
22 | 23 | public function escape_string($s, $strip_tags = true) { |
23 | - if ($strip_tags) $s = strip_tags($s); |
|
24 | + if ($strip_tags) { |
|
25 | + $s = strip_tags($s); |
|
26 | + } |
|
24 | 27 | |
25 | 28 | return mysqli_real_escape_string($this->link, $s); |
26 | 29 | } |
@@ -30,7 +30,9 @@ discard block |
||
30 | 30 | $omap = array(); |
31 | 31 | |
32 | 32 | foreach ($imap[1] as $sequence => $action) { |
33 | - if (!isset($omap[$action])) $omap[$action] = array(); |
|
33 | + if (!isset($omap[$action])) { |
|
34 | + $omap[$action] = array(); |
|
35 | + } |
|
34 | 36 | |
35 | 37 | array_push($omap[$action], $sequence); |
36 | 38 | } |
@@ -40,7 +42,9 @@ discard block |
||
40 | 42 | $cur_section = ""; |
41 | 43 | foreach ($info as $section => $hotkeys) { |
42 | 44 | |
43 | - if ($cur_section) print "<li> </li>"; |
|
45 | + if ($cur_section) { |
|
46 | + print "<li> </li>"; |
|
47 | + } |
|
44 | 48 | print "<li><h3>" . $section . "</h3></li>"; |
45 | 49 | $cur_section = $section; |
46 | 50 |
@@ -56,11 +56,13 @@ discard block |
||
56 | 56 | public static function update_cache($owner_uid, $id, $labels = false, $force = false) { |
57 | 57 | $pdo = Db::pdo(); |
58 | 58 | |
59 | - if ($force) |
|
60 | - Labels::clear_cache($id); |
|
59 | + if ($force) { |
|
60 | + Labels::clear_cache($id); |
|
61 | + } |
|
61 | 62 | |
62 | - if (!$labels) |
|
63 | - $labels = Article::get_article_labels($id); |
|
63 | + if (!$labels) { |
|
64 | + $labels = Article::get_article_labels($id); |
|
65 | + } |
|
64 | 66 | |
65 | 67 | $labels = json_encode($labels); |
66 | 68 | |
@@ -84,7 +86,9 @@ discard block |
||
84 | 86 | |
85 | 87 | $label_id = Labels::find_id($label, $owner_uid); |
86 | 88 | |
87 | - if (!$label_id) return; |
|
89 | + if (!$label_id) { |
|
90 | + return; |
|
91 | + } |
|
88 | 92 | |
89 | 93 | $pdo = Db::pdo(); |
90 | 94 | |
@@ -102,7 +106,9 @@ discard block |
||
102 | 106 | |
103 | 107 | $label_id = Labels::find_id($label, $owner_uid); |
104 | 108 | |
105 | - if (!$label_id) return; |
|
109 | + if (!$label_id) { |
|
110 | + return; |
|
111 | + } |
|
106 | 112 | |
107 | 113 | $pdo = Db::pdo(); |
108 | 114 | |
@@ -128,7 +134,9 @@ discard block |
||
128 | 134 | } |
129 | 135 | |
130 | 136 | public static function remove($id, $owner_uid) { |
131 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
137 | + if (!$owner_uid) { |
|
138 | + $owner_uid = $_SESSION["uid"]; |
|
139 | + } |
|
132 | 140 | |
133 | 141 | $pdo = Db::pdo(); |
134 | 142 | $tr_in_progress = false; |
@@ -168,12 +176,16 @@ discard block |
||
168 | 176 | |
169 | 177 | } |
170 | 178 | |
171 | - if (!$tr_in_progress) $pdo->commit(); |
|
179 | + if (!$tr_in_progress) { |
|
180 | + $pdo->commit(); |
|
181 | + } |
|
172 | 182 | } |
173 | 183 | |
174 | 184 | public static function create($caption, $fg_color = '', $bg_color = '', $owner_uid = false) { |
175 | 185 | |
176 | - if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
|
186 | + if (!$owner_uid) { |
|
187 | + $owner_uid = $_SESSION['uid']; |
|
188 | + } |
|
177 | 189 | |
178 | 190 | $pdo = Db::pdo(); |
179 | 191 | |
@@ -198,7 +210,9 @@ discard block |
||
198 | 210 | $result = $sth->rowCount(); |
199 | 211 | } |
200 | 212 | |
201 | - if (!$tr_in_progress) $pdo->commit(); |
|
213 | + if (!$tr_in_progress) { |
|
214 | + $pdo->commit(); |
|
215 | + } |
|
202 | 216 | |
203 | 217 | return $result; |
204 | 218 | } |
@@ -36,7 +36,9 @@ discard block |
||
36 | 36 | |
37 | 37 | public static function log($message, $level = 0) { |
38 | 38 | |
39 | - if (!Debug::$enabled || Debug::$loglevel < $level) return false; |
|
39 | + if (!Debug::$enabled || Debug::$loglevel < $level) { |
|
40 | + return false; |
|
41 | + } |
|
40 | 42 | |
41 | 43 | $ts = strftime("%H:%M:%S", time()); |
42 | 44 | if (function_exists('posix_getpid')) { |
@@ -73,8 +75,9 @@ discard block |
||
73 | 75 | |
74 | 76 | fclose($fp); |
75 | 77 | |
76 | - if (Debug::$quiet) |
|
77 | - return; |
|
78 | + if (Debug::$quiet) { |
|
79 | + return; |
|
80 | + } |
|
78 | 81 | |
79 | 82 | } else { |
80 | 83 | user_error("Unable to open debugging log file: " . Debug::$logfile, E_USER_WARNING); |
@@ -14,7 +14,9 @@ |
||
14 | 14 | if ($login && defined('AUTH_AUTO_CREATE') && AUTH_AUTO_CREATE) { |
15 | 15 | $user_id = $this->find_user_by_login($login); |
16 | 16 | |
17 | - if (!$password) $password = make_password(); |
|
17 | + if (!$password) { |
|
18 | + $password = make_password(); |
|
19 | + } |
|
18 | 20 | |
19 | 21 | if (!$user_id) { |
20 | 22 | $salt = substr(bin2hex(get_random_bytes(125)), 0, 250); |