@@ -1,24 +1,24 @@ |
||
1 | 1 | <?php |
2 | 2 | class No_Title_Counters extends Plugin { |
3 | - private $host; |
|
3 | + private $host; |
|
4 | 4 | |
5 | - public function about() { |
|
6 | - return array(1.0, |
|
7 | - "Remove counters from window title (prevents tab flashing on new articles)", |
|
8 | - "fox"); |
|
9 | - } |
|
5 | + public function about() { |
|
6 | + return array(1.0, |
|
7 | + "Remove counters from window title (prevents tab flashing on new articles)", |
|
8 | + "fox"); |
|
9 | + } |
|
10 | 10 | |
11 | - public function init($host) { |
|
12 | - $this->host = $host; |
|
11 | + public function init($host) { |
|
12 | + $this->host = $host; |
|
13 | 13 | |
14 | - } |
|
14 | + } |
|
15 | 15 | |
16 | - public function get_js() { |
|
17 | - return file_get_contents(__DIR__."/init.js"); |
|
18 | - } |
|
16 | + public function get_js() { |
|
17 | + return file_get_contents(__DIR__."/init.js"); |
|
18 | + } |
|
19 | 19 | |
20 | - public function api_version() { |
|
21 | - return 2; |
|
22 | - } |
|
20 | + public function api_version() { |
|
21 | + return 2; |
|
22 | + } |
|
23 | 23 | |
24 | 24 | } |
@@ -1,63 +1,63 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | class Auth_Internal extends Plugin implements IAuthModule { |
3 | 3 | |
4 | - private $host; |
|
4 | + private $host; |
|
5 | 5 | |
6 | - public function about() { |
|
7 | - return array(1.0, |
|
8 | - "Authenticates against internal tt-rss database", |
|
9 | - "fox", |
|
10 | - true); |
|
11 | - } |
|
6 | + public function about() { |
|
7 | + return array(1.0, |
|
8 | + "Authenticates against internal tt-rss database", |
|
9 | + "fox", |
|
10 | + true); |
|
11 | + } |
|
12 | 12 | |
13 | - /* @var PluginHost $host */ |
|
14 | - public function init($host) { |
|
15 | - $this->host = $host; |
|
16 | - $this->pdo = Db::pdo(); |
|
13 | + /* @var PluginHost $host */ |
|
14 | + public function init($host) { |
|
15 | + $this->host = $host; |
|
16 | + $this->pdo = Db::pdo(); |
|
17 | 17 | |
18 | - $host->add_hook($host::HOOK_AUTH_USER, $this); |
|
19 | - } |
|
18 | + $host->add_hook($host::HOOK_AUTH_USER, $this); |
|
19 | + } |
|
20 | 20 | |
21 | - public function authenticate($login, $password, $service = '') { |
|
21 | + public function authenticate($login, $password, $service = '') { |
|
22 | 22 | |
23 | - $pwd_hash1 = encrypt_password($password); |
|
24 | - $pwd_hash2 = encrypt_password($password, $login); |
|
25 | - $otp = $_REQUEST["otp"]; |
|
23 | + $pwd_hash1 = encrypt_password($password); |
|
24 | + $pwd_hash2 = encrypt_password($password, $login); |
|
25 | + $otp = $_REQUEST["otp"]; |
|
26 | 26 | |
27 | - if (get_schema_version() > 96) { |
|
27 | + if (get_schema_version() > 96) { |
|
28 | 28 | |
29 | - $sth = $this->pdo->prepare("SELECT otp_enabled,salt FROM ttrss_users WHERE |
|
29 | + $sth = $this->pdo->prepare("SELECT otp_enabled,salt FROM ttrss_users WHERE |
|
30 | 30 | login = ?"); |
31 | - $sth->execute([$login]); |
|
31 | + $sth->execute([$login]); |
|
32 | 32 | |
33 | - if ($row = $sth->fetch()) { |
|
34 | - $otp_enabled = $row['otp_enabled']; |
|
33 | + if ($row = $sth->fetch()) { |
|
34 | + $otp_enabled = $row['otp_enabled']; |
|
35 | 35 | |
36 | - if ($otp_enabled) { |
|
36 | + if ($otp_enabled) { |
|
37 | 37 | |
38 | - // only allow app password checking if OTP is enabled |
|
39 | - if ($service && get_schema_version() > 138) { |
|
40 | - return $this->check_app_password($login, $password, $service); |
|
41 | - } |
|
38 | + // only allow app password checking if OTP is enabled |
|
39 | + if ($service && get_schema_version() > 138) { |
|
40 | + return $this->check_app_password($login, $password, $service); |
|
41 | + } |
|
42 | 42 | |
43 | - if ($otp) { |
|
44 | - $base32 = new \OTPHP\Base32(); |
|
43 | + if ($otp) { |
|
44 | + $base32 = new \OTPHP\Base32(); |
|
45 | 45 | |
46 | - $secret = $base32->encode(mb_substr(sha1($row["salt"]), 0, 12), false); |
|
47 | - $secret_legacy = $base32->encode(sha1($row["salt"])); |
|
46 | + $secret = $base32->encode(mb_substr(sha1($row["salt"]), 0, 12), false); |
|
47 | + $secret_legacy = $base32->encode(sha1($row["salt"])); |
|
48 | 48 | |
49 | - $totp = new \OTPHP\TOTP($secret); |
|
50 | - $otp_check = $totp->now(); |
|
49 | + $totp = new \OTPHP\TOTP($secret); |
|
50 | + $otp_check = $totp->now(); |
|
51 | 51 | |
52 | - $totp_legacy = new \OTPHP\TOTP($secret_legacy); |
|
53 | - $otp_check_legacy = $totp_legacy->now(); |
|
52 | + $totp_legacy = new \OTPHP\TOTP($secret_legacy); |
|
53 | + $otp_check_legacy = $totp_legacy->now(); |
|
54 | 54 | |
55 | - if ($otp != $otp_check && $otp != $otp_check_legacy) { |
|
56 | - return false; |
|
57 | - } |
|
58 | - } else { |
|
59 | - $return = urlencode($_REQUEST["return"]); |
|
60 | - ?> |
|
55 | + if ($otp != $otp_check && $otp != $otp_check_legacy) { |
|
56 | + return false; |
|
57 | + } |
|
58 | + } else { |
|
59 | + $return = urlencode($_REQUEST["return"]); |
|
60 | + ?> |
|
61 | 61 | <!DOCTYPE html> |
62 | 62 | <html> |
63 | 63 | <head> |
@@ -87,209 +87,209 @@ discard block |
||
87 | 87 | document.forms[0].otp.focus(); |
88 | 88 | </script> |
89 | 89 | <?php |
90 | - exit; |
|
91 | - } |
|
92 | - } |
|
93 | - } |
|
94 | - } |
|
90 | + exit; |
|
91 | + } |
|
92 | + } |
|
93 | + } |
|
94 | + } |
|
95 | 95 | |
96 | - // check app passwords first but allow regular password as a fallback for the time being |
|
97 | - // if OTP is not enabled |
|
96 | + // check app passwords first but allow regular password as a fallback for the time being |
|
97 | + // if OTP is not enabled |
|
98 | 98 | |
99 | - if ($service && get_schema_version() > 138) { |
|
100 | - $user_id = $this->check_app_password($login, $password, $service); |
|
99 | + if ($service && get_schema_version() > 138) { |
|
100 | + $user_id = $this->check_app_password($login, $password, $service); |
|
101 | 101 | |
102 | - if ($user_id) { |
|
103 | - return $user_id; |
|
104 | - } |
|
105 | - } |
|
102 | + if ($user_id) { |
|
103 | + return $user_id; |
|
104 | + } |
|
105 | + } |
|
106 | 106 | |
107 | - if (get_schema_version() > 87) { |
|
107 | + if (get_schema_version() > 87) { |
|
108 | 108 | |
109 | - $sth = $this->pdo->prepare("SELECT salt FROM ttrss_users WHERE login = ?"); |
|
110 | - $sth->execute([$login]); |
|
109 | + $sth = $this->pdo->prepare("SELECT salt FROM ttrss_users WHERE login = ?"); |
|
110 | + $sth->execute([$login]); |
|
111 | 111 | |
112 | - if ($row = $sth->fetch()) { |
|
113 | - $salt = $row['salt']; |
|
112 | + if ($row = $sth->fetch()) { |
|
113 | + $salt = $row['salt']; |
|
114 | 114 | |
115 | - if ($salt == "") { |
|
115 | + if ($salt == "") { |
|
116 | 116 | |
117 | - $sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE |
|
117 | + $sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE |
|
118 | 118 | login = ? AND (pwd_hash = ? OR pwd_hash = ?)"); |
119 | 119 | |
120 | - $sth->execute([$login, $pwd_hash1, $pwd_hash2]); |
|
120 | + $sth->execute([$login, $pwd_hash1, $pwd_hash2]); |
|
121 | 121 | |
122 | - // verify and upgrade password to new salt base |
|
122 | + // verify and upgrade password to new salt base |
|
123 | 123 | |
124 | - if ($row = $sth->fetch()) { |
|
125 | - // upgrade password to MODE2 |
|
124 | + if ($row = $sth->fetch()) { |
|
125 | + // upgrade password to MODE2 |
|
126 | 126 | |
127 | - $user_id = $row['id']; |
|
127 | + $user_id = $row['id']; |
|
128 | 128 | |
129 | - $salt = substr(bin2hex(get_random_bytes(125)), 0, 250); |
|
130 | - $pwd_hash = encrypt_password($password, $salt, true); |
|
129 | + $salt = substr(bin2hex(get_random_bytes(125)), 0, 250); |
|
130 | + $pwd_hash = encrypt_password($password, $salt, true); |
|
131 | 131 | |
132 | - $sth = $this->pdo->prepare("UPDATE ttrss_users SET |
|
132 | + $sth = $this->pdo->prepare("UPDATE ttrss_users SET |
|
133 | 133 | pwd_hash = ?, salt = ? WHERE login = ?"); |
134 | 134 | |
135 | - $sth->execute([$pwd_hash, $salt, $login]); |
|
135 | + $sth->execute([$pwd_hash, $salt, $login]); |
|
136 | 136 | |
137 | - return $user_id; |
|
137 | + return $user_id; |
|
138 | 138 | |
139 | - } else { |
|
140 | - return false; |
|
141 | - } |
|
139 | + } else { |
|
140 | + return false; |
|
141 | + } |
|
142 | 142 | |
143 | - } else { |
|
144 | - $pwd_hash = encrypt_password($password, $salt, true); |
|
143 | + } else { |
|
144 | + $pwd_hash = encrypt_password($password, $salt, true); |
|
145 | 145 | |
146 | - $sth = $this->pdo->prepare("SELECT id |
|
146 | + $sth = $this->pdo->prepare("SELECT id |
|
147 | 147 | FROM ttrss_users WHERE |
148 | 148 | login = ? AND pwd_hash = ?"); |
149 | - $sth->execute([$login, $pwd_hash]); |
|
149 | + $sth->execute([$login, $pwd_hash]); |
|
150 | 150 | |
151 | - if ($row = $sth->fetch()) { |
|
152 | - return $row['id']; |
|
153 | - } |
|
154 | - } |
|
151 | + if ($row = $sth->fetch()) { |
|
152 | + return $row['id']; |
|
153 | + } |
|
154 | + } |
|
155 | 155 | |
156 | - } else { |
|
157 | - $sth = $this->pdo->prepare("SELECT id |
|
156 | + } else { |
|
157 | + $sth = $this->pdo->prepare("SELECT id |
|
158 | 158 | FROM ttrss_users WHERE |
159 | 159 | login = ? AND (pwd_hash = ? OR pwd_hash = ?)"); |
160 | 160 | |
161 | - $sth->execute([$login, $pwd_hash1, $pwd_hash2]); |
|
161 | + $sth->execute([$login, $pwd_hash1, $pwd_hash2]); |
|
162 | 162 | |
163 | - if ($row = $sth->fetch()) { |
|
164 | - return $row['id']; |
|
165 | - } |
|
166 | - } |
|
167 | - } else { |
|
168 | - $sth = $this->pdo->prepare("SELECT id |
|
163 | + if ($row = $sth->fetch()) { |
|
164 | + return $row['id']; |
|
165 | + } |
|
166 | + } |
|
167 | + } else { |
|
168 | + $sth = $this->pdo->prepare("SELECT id |
|
169 | 169 | FROM ttrss_users WHERE |
170 | 170 | login = ? AND (pwd_hash = ? OR pwd_hash = ?)"); |
171 | 171 | |
172 | - $sth->execute([$login, $pwd_hash1, $pwd_hash2]); |
|
172 | + $sth->execute([$login, $pwd_hash1, $pwd_hash2]); |
|
173 | 173 | |
174 | - if ($row = $sth->fetch()) { |
|
175 | - return $row['id']; |
|
176 | - } |
|
177 | - } |
|
174 | + if ($row = $sth->fetch()) { |
|
175 | + return $row['id']; |
|
176 | + } |
|
177 | + } |
|
178 | 178 | |
179 | - return false; |
|
180 | - } |
|
179 | + return false; |
|
180 | + } |
|
181 | 181 | |
182 | - public function check_password($owner_uid, $password) { |
|
182 | + public function check_password($owner_uid, $password) { |
|
183 | 183 | |
184 | - $sth = $this->pdo->prepare("SELECT salt,login,otp_enabled FROM ttrss_users WHERE |
|
184 | + $sth = $this->pdo->prepare("SELECT salt,login,otp_enabled FROM ttrss_users WHERE |
|
185 | 185 | id = ?"); |
186 | - $sth->execute([$owner_uid]); |
|
186 | + $sth->execute([$owner_uid]); |
|
187 | 187 | |
188 | - if ($row = $sth->fetch()) { |
|
188 | + if ($row = $sth->fetch()) { |
|
189 | 189 | |
190 | - $salt = $row['salt']; |
|
191 | - $login = $row['login']; |
|
190 | + $salt = $row['salt']; |
|
191 | + $login = $row['login']; |
|
192 | 192 | |
193 | - if (!$salt) { |
|
194 | - $password_hash1 = encrypt_password($password); |
|
195 | - $password_hash2 = encrypt_password($password, $login); |
|
193 | + if (!$salt) { |
|
194 | + $password_hash1 = encrypt_password($password); |
|
195 | + $password_hash2 = encrypt_password($password, $login); |
|
196 | 196 | |
197 | - $sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE |
|
197 | + $sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE |
|
198 | 198 | id = ? AND (pwd_hash = ? OR pwd_hash = ?)"); |
199 | 199 | |
200 | - $sth->execute([$owner_uid, $password_hash1, $password_hash2]); |
|
200 | + $sth->execute([$owner_uid, $password_hash1, $password_hash2]); |
|
201 | 201 | |
202 | - return $sth->fetch(); |
|
202 | + return $sth->fetch(); |
|
203 | 203 | |
204 | - } else { |
|
205 | - $password_hash = encrypt_password($password, $salt, true); |
|
204 | + } else { |
|
205 | + $password_hash = encrypt_password($password, $salt, true); |
|
206 | 206 | |
207 | - $sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE |
|
207 | + $sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE |
|
208 | 208 | id = ? AND pwd_hash = ?"); |
209 | 209 | |
210 | - $sth->execute([$owner_uid, $password_hash]); |
|
210 | + $sth->execute([$owner_uid, $password_hash]); |
|
211 | 211 | |
212 | - return $sth->fetch(); |
|
213 | - } |
|
214 | - } |
|
212 | + return $sth->fetch(); |
|
213 | + } |
|
214 | + } |
|
215 | 215 | |
216 | - return false; |
|
217 | - } |
|
216 | + return false; |
|
217 | + } |
|
218 | 218 | |
219 | - public function change_password($owner_uid, $old_password, $new_password) { |
|
219 | + public function change_password($owner_uid, $old_password, $new_password) { |
|
220 | 220 | |
221 | - if ($this->check_password($owner_uid, $old_password)) { |
|
221 | + if ($this->check_password($owner_uid, $old_password)) { |
|
222 | 222 | |
223 | - $new_salt = substr(bin2hex(get_random_bytes(125)), 0, 250); |
|
224 | - $new_password_hash = encrypt_password($new_password, $new_salt, true); |
|
223 | + $new_salt = substr(bin2hex(get_random_bytes(125)), 0, 250); |
|
224 | + $new_password_hash = encrypt_password($new_password, $new_salt, true); |
|
225 | 225 | |
226 | - $sth = $this->pdo->prepare("UPDATE ttrss_users SET |
|
226 | + $sth = $this->pdo->prepare("UPDATE ttrss_users SET |
|
227 | 227 | pwd_hash = ?, salt = ?, otp_enabled = false |
228 | 228 | WHERE id = ?"); |
229 | - $sth->execute([$new_password_hash, $new_salt, $owner_uid]); |
|
229 | + $sth->execute([$new_password_hash, $new_salt, $owner_uid]); |
|
230 | 230 | |
231 | - $_SESSION["pwd_hash"] = $new_password_hash; |
|
231 | + $_SESSION["pwd_hash"] = $new_password_hash; |
|
232 | 232 | |
233 | - $sth = $this->pdo->prepare("SELECT email, login FROM ttrss_users WHERE id = ?"); |
|
234 | - $sth->execute([$owner_uid]); |
|
233 | + $sth = $this->pdo->prepare("SELECT email, login FROM ttrss_users WHERE id = ?"); |
|
234 | + $sth->execute([$owner_uid]); |
|
235 | 235 | |
236 | - if ($row = $sth->fetch()) { |
|
237 | - $mailer = new Mailer(); |
|
236 | + if ($row = $sth->fetch()) { |
|
237 | + $mailer = new Mailer(); |
|
238 | 238 | |
239 | - require_once "lib/MiniTemplator.class.php"; |
|
239 | + require_once "lib/MiniTemplator.class.php"; |
|
240 | 240 | |
241 | - $tpl = new MiniTemplator; |
|
241 | + $tpl = new MiniTemplator; |
|
242 | 242 | |
243 | - $tpl->readTemplateFromFile("templates/password_change_template.txt"); |
|
243 | + $tpl->readTemplateFromFile("templates/password_change_template.txt"); |
|
244 | 244 | |
245 | - $tpl->setVariable('LOGIN', $row["login"]); |
|
246 | - $tpl->setVariable('TTRSS_HOST', SELF_URL_PATH); |
|
245 | + $tpl->setVariable('LOGIN', $row["login"]); |
|
246 | + $tpl->setVariable('TTRSS_HOST', SELF_URL_PATH); |
|
247 | 247 | |
248 | - $tpl->addBlock('message'); |
|
248 | + $tpl->addBlock('message'); |
|
249 | 249 | |
250 | - $tpl->generateOutputToString($message); |
|
250 | + $tpl->generateOutputToString($message); |
|
251 | 251 | |
252 | - $mailer->mail(["to_name" => $row["login"], |
|
253 | - "to_address" => $row["email"], |
|
254 | - "subject" => "[tt-rss] Password change notification", |
|
255 | - "message" => $message]); |
|
252 | + $mailer->mail(["to_name" => $row["login"], |
|
253 | + "to_address" => $row["email"], |
|
254 | + "subject" => "[tt-rss] Password change notification", |
|
255 | + "message" => $message]); |
|
256 | 256 | |
257 | - } |
|
257 | + } |
|
258 | 258 | |
259 | - return __("Password has been changed."); |
|
260 | - } else { |
|
261 | - return "ERROR: ".__('Old password is incorrect.'); |
|
262 | - } |
|
263 | - } |
|
259 | + return __("Password has been changed."); |
|
260 | + } else { |
|
261 | + return "ERROR: ".__('Old password is incorrect.'); |
|
262 | + } |
|
263 | + } |
|
264 | 264 | |
265 | - private function check_app_password($login, $password, $service) { |
|
266 | - $sth = $this->pdo->prepare("SELECT p.id, p.pwd_hash, u.id AS uid |
|
265 | + private function check_app_password($login, $password, $service) { |
|
266 | + $sth = $this->pdo->prepare("SELECT p.id, p.pwd_hash, u.id AS uid |
|
267 | 267 | FROM ttrss_app_passwords p, ttrss_users u |
268 | 268 | WHERE p.owner_uid = u.id AND u.login = ? AND service = ?"); |
269 | - $sth->execute([$login, $service]); |
|
269 | + $sth->execute([$login, $service]); |
|
270 | 270 | |
271 | - while ($row = $sth->fetch()) { |
|
272 | - list ($algo, $hash, $salt) = explode(":", $row["pwd_hash"]); |
|
271 | + while ($row = $sth->fetch()) { |
|
272 | + list ($algo, $hash, $salt) = explode(":", $row["pwd_hash"]); |
|
273 | 273 | |
274 | - if ($algo == "SSHA-512") { |
|
275 | - $test_hash = hash('sha512', $salt.$password); |
|
274 | + if ($algo == "SSHA-512") { |
|
275 | + $test_hash = hash('sha512', $salt.$password); |
|
276 | 276 | |
277 | - if ($test_hash == $hash) { |
|
278 | - $usth = $this->pdo->prepare("UPDATE ttrss_app_passwords SET last_used = NOW() WHERE id = ?"); |
|
279 | - $usth->execute([$row['id']]); |
|
277 | + if ($test_hash == $hash) { |
|
278 | + $usth = $this->pdo->prepare("UPDATE ttrss_app_passwords SET last_used = NOW() WHERE id = ?"); |
|
279 | + $usth->execute([$row['id']]); |
|
280 | 280 | |
281 | - return $row['uid']; |
|
282 | - } |
|
283 | - } else { |
|
284 | - user_error("Got unknown algo of app password for user $login: $algo"); |
|
285 | - } |
|
286 | - } |
|
281 | + return $row['uid']; |
|
282 | + } |
|
283 | + } else { |
|
284 | + user_error("Got unknown algo of app password for user $login: $algo"); |
|
285 | + } |
|
286 | + } |
|
287 | 287 | |
288 | - return false; |
|
289 | - } |
|
288 | + return false; |
|
289 | + } |
|
290 | 290 | |
291 | - public function api_version() { |
|
292 | - return 2; |
|
293 | - } |
|
291 | + public function api_version() { |
|
292 | + return 2; |
|
293 | + } |
|
294 | 294 | |
295 | 295 | } |
@@ -1,38 +1,38 @@ |
||
1 | 1 | <?php |
2 | 2 | class No_Iframes extends Plugin { |
3 | - private $host; |
|
3 | + private $host; |
|
4 | 4 | |
5 | - public function about() { |
|
6 | - return array(1.0, |
|
7 | - "Remove embedded iframes (unless whitelisted)", |
|
8 | - "fox"); |
|
9 | - } |
|
5 | + public function about() { |
|
6 | + return array(1.0, |
|
7 | + "Remove embedded iframes (unless whitelisted)", |
|
8 | + "fox"); |
|
9 | + } |
|
10 | 10 | |
11 | - public function init($host) { |
|
12 | - $this->host = $host; |
|
11 | + public function init($host) { |
|
12 | + $this->host = $host; |
|
13 | 13 | |
14 | - $host->add_hook($host::HOOK_SANITIZE, $this); |
|
15 | - } |
|
14 | + $host->add_hook($host::HOOK_SANITIZE, $this); |
|
15 | + } |
|
16 | 16 | |
17 | - /** |
|
18 | - * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
|
19 | - */ |
|
20 | - public function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes) { |
|
17 | + /** |
|
18 | + * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
|
19 | + */ |
|
20 | + public function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes) { |
|
21 | 21 | |
22 | - $xpath = new DOMXpath($doc); |
|
23 | - $entries = $xpath->query('//iframe'); |
|
22 | + $xpath = new DOMXpath($doc); |
|
23 | + $entries = $xpath->query('//iframe'); |
|
24 | 24 | |
25 | - foreach ($entries as $entry) { |
|
26 | - if (!iframe_whitelisted($entry)) { |
|
27 | - $entry->parentNode->removeChild($entry); |
|
28 | - } |
|
29 | - } |
|
25 | + foreach ($entries as $entry) { |
|
26 | + if (!iframe_whitelisted($entry)) { |
|
27 | + $entry->parentNode->removeChild($entry); |
|
28 | + } |
|
29 | + } |
|
30 | 30 | |
31 | - return array($doc, $allowed_elements, $disallowed_attributes); |
|
32 | - } |
|
31 | + return array($doc, $allowed_elements, $disallowed_attributes); |
|
32 | + } |
|
33 | 33 | |
34 | - public function api_version() { |
|
35 | - return 2; |
|
36 | - } |
|
34 | + public function api_version() { |
|
35 | + return 2; |
|
36 | + } |
|
37 | 37 | |
38 | 38 | } |
@@ -1,142 +1,142 @@ |
||
1 | 1 | <?php |
2 | 2 | class Share extends Plugin { |
3 | - private $host; |
|
3 | + private $host; |
|
4 | 4 | |
5 | - public function about() { |
|
6 | - return array(1.0, |
|
7 | - "Share article by unique URL", |
|
8 | - "fox"); |
|
9 | - } |
|
5 | + public function about() { |
|
6 | + return array(1.0, |
|
7 | + "Share article by unique URL", |
|
8 | + "fox"); |
|
9 | + } |
|
10 | 10 | |
11 | - /* @var PluginHost $host */ |
|
12 | - public function init($host) { |
|
13 | - $this->host = $host; |
|
11 | + /* @var PluginHost $host */ |
|
12 | + public function init($host) { |
|
13 | + $this->host = $host; |
|
14 | 14 | |
15 | - $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); |
|
16 | - $host->add_hook($host::HOOK_PREFS_TAB_SECTION, $this); |
|
17 | - } |
|
15 | + $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); |
|
16 | + $host->add_hook($host::HOOK_PREFS_TAB_SECTION, $this); |
|
17 | + } |
|
18 | 18 | |
19 | - public function get_js() { |
|
20 | - return file_get_contents(dirname(__FILE__)."/share.js"); |
|
21 | - } |
|
19 | + public function get_js() { |
|
20 | + return file_get_contents(dirname(__FILE__)."/share.js"); |
|
21 | + } |
|
22 | 22 | |
23 | - public function get_css() { |
|
24 | - return file_get_contents(dirname(__FILE__)."/share.css"); |
|
25 | - } |
|
23 | + public function get_css() { |
|
24 | + return file_get_contents(dirname(__FILE__)."/share.css"); |
|
25 | + } |
|
26 | 26 | |
27 | - public function get_prefs_js() { |
|
28 | - return file_get_contents(dirname(__FILE__)."/share_prefs.js"); |
|
29 | - } |
|
27 | + public function get_prefs_js() { |
|
28 | + return file_get_contents(dirname(__FILE__)."/share_prefs.js"); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - public function unshare() { |
|
33 | - $id = $_REQUEST['id']; |
|
32 | + public function unshare() { |
|
33 | + $id = $_REQUEST['id']; |
|
34 | 34 | |
35 | - $sth = $this->pdo->prepare("UPDATE ttrss_user_entries SET uuid = '' WHERE int_id = ? |
|
35 | + $sth = $this->pdo->prepare("UPDATE ttrss_user_entries SET uuid = '' WHERE int_id = ? |
|
36 | 36 | AND owner_uid = ?"); |
37 | - $sth->execute([$id, $_SESSION['uid']]); |
|
37 | + $sth->execute([$id, $_SESSION['uid']]); |
|
38 | 38 | |
39 | - print "OK"; |
|
40 | - } |
|
39 | + print "OK"; |
|
40 | + } |
|
41 | 41 | |
42 | - public function hook_prefs_tab_section($id) { |
|
43 | - if ($id == "prefFeedsPublishedGenerated") { |
|
42 | + public function hook_prefs_tab_section($id) { |
|
43 | + if ($id == "prefFeedsPublishedGenerated") { |
|
44 | 44 | |
45 | - print "<h3>".__("You can disable all articles shared by unique URLs here.")."</h3>"; |
|
45 | + print "<h3>".__("You can disable all articles shared by unique URLs here.")."</h3>"; |
|
46 | 46 | |
47 | - print "<button class='alt-danger' dojoType='dijit.form.Button' onclick=\"return Plugins.Share.clearKeys()\">". |
|
48 | - __('Unshare all articles')."</button> "; |
|
47 | + print "<button class='alt-danger' dojoType='dijit.form.Button' onclick=\"return Plugins.Share.clearKeys()\">". |
|
48 | + __('Unshare all articles')."</button> "; |
|
49 | 49 | |
50 | - print "</p>"; |
|
50 | + print "</p>"; |
|
51 | 51 | |
52 | - } |
|
53 | - } |
|
52 | + } |
|
53 | + } |
|
54 | 54 | |
55 | - // Silent |
|
56 | - public function clearArticleKeys() { |
|
57 | - $sth = $this->pdo->prepare("UPDATE ttrss_user_entries SET uuid = '' WHERE |
|
55 | + // Silent |
|
56 | + public function clearArticleKeys() { |
|
57 | + $sth = $this->pdo->prepare("UPDATE ttrss_user_entries SET uuid = '' WHERE |
|
58 | 58 | owner_uid = ?"); |
59 | - $sth->execute([$_SESSION['uid']]); |
|
59 | + $sth->execute([$_SESSION['uid']]); |
|
60 | 60 | |
61 | - return; |
|
62 | - } |
|
61 | + return; |
|
62 | + } |
|
63 | 63 | |
64 | 64 | |
65 | - public function newkey() { |
|
66 | - $id = $_REQUEST['id']; |
|
67 | - $uuid = uniqid_short(); |
|
65 | + public function newkey() { |
|
66 | + $id = $_REQUEST['id']; |
|
67 | + $uuid = uniqid_short(); |
|
68 | 68 | |
69 | - $sth = $this->pdo->prepare("UPDATE ttrss_user_entries SET uuid = ? WHERE int_id = ? |
|
69 | + $sth = $this->pdo->prepare("UPDATE ttrss_user_entries SET uuid = ? WHERE int_id = ? |
|
70 | 70 | AND owner_uid = ?"); |
71 | - $sth->execute([$uuid, $id, $_SESSION['uid']]); |
|
71 | + $sth->execute([$uuid, $id, $_SESSION['uid']]); |
|
72 | 72 | |
73 | - print json_encode(array("link" => $uuid)); |
|
74 | - } |
|
73 | + print json_encode(array("link" => $uuid)); |
|
74 | + } |
|
75 | 75 | |
76 | - public function hook_article_button($line) { |
|
77 | - $img_class = $line['uuid'] ? "shared" : ""; |
|
76 | + public function hook_article_button($line) { |
|
77 | + $img_class = $line['uuid'] ? "shared" : ""; |
|
78 | 78 | |
79 | - return "<i id='SHARE-IMG-".$line['int_id']."' class='material-icons icon-share $img_class' |
|
79 | + return "<i id='SHARE-IMG-".$line['int_id']."' class='material-icons icon-share $img_class' |
|
80 | 80 | style='cursor : pointer' onclick=\"Plugins.Share.shareArticle(".$line['int_id'].")\" |
81 | 81 | title='".__('Share by URL')."'>link</i>"; |
82 | - } |
|
82 | + } |
|
83 | 83 | |
84 | - public function shareArticle() { |
|
85 | - $param = $_REQUEST['param']; |
|
84 | + public function shareArticle() { |
|
85 | + $param = $_REQUEST['param']; |
|
86 | 86 | |
87 | - $sth = $this->pdo->prepare("SELECT uuid FROM ttrss_user_entries WHERE int_id = ? |
|
87 | + $sth = $this->pdo->prepare("SELECT uuid FROM ttrss_user_entries WHERE int_id = ? |
|
88 | 88 | AND owner_uid = ?"); |
89 | - $sth->execute([$param, $_SESSION['uid']]); |
|
89 | + $sth->execute([$param, $_SESSION['uid']]); |
|
90 | 90 | |
91 | - if ($row = $sth->fetch()) { |
|
91 | + if ($row = $sth->fetch()) { |
|
92 | 92 | |
93 | - $uuid = $row['uuid']; |
|
93 | + $uuid = $row['uuid']; |
|
94 | 94 | |
95 | - if (!$uuid) { |
|
96 | - $uuid = uniqid_short(); |
|
95 | + if (!$uuid) { |
|
96 | + $uuid = uniqid_short(); |
|
97 | 97 | |
98 | - $sth = $this->pdo->prepare("UPDATE ttrss_user_entries SET uuid = ? WHERE int_id = ? |
|
98 | + $sth = $this->pdo->prepare("UPDATE ttrss_user_entries SET uuid = ? WHERE int_id = ? |
|
99 | 99 | AND owner_uid = ?"); |
100 | - $sth->execute([$uuid, $param, $_SESSION['uid']]); |
|
101 | - } |
|
100 | + $sth->execute([$uuid, $param, $_SESSION['uid']]); |
|
101 | + } |
|
102 | 102 | |
103 | - print "<header>".__("You can share this article by the following unique URL:")."</header>"; |
|
103 | + print "<header>".__("You can share this article by the following unique URL:")."</header>"; |
|
104 | 104 | |
105 | - $url_path = get_self_url_prefix(); |
|
106 | - $url_path .= "/public.php?op=share&key=$uuid"; |
|
105 | + $url_path = get_self_url_prefix(); |
|
106 | + $url_path .= "/public.php?op=share&key=$uuid"; |
|
107 | 107 | |
108 | - print "<section> |
|
108 | + print "<section> |
|
109 | 109 | <div class='panel text-center'> |
110 | 110 | <a id='gen_article_url' href='$url_path' target='_blank' rel='noopener noreferrer'>$url_path</a> |
111 | 111 | </div> |
112 | 112 | </section>"; |
113 | 113 | |
114 | - /* if (!label_find_id(__('Shared'), $_SESSION["uid"])) |
|
114 | + /* if (!label_find_id(__('Shared'), $_SESSION["uid"])) |
|
115 | 115 | label_create(__('Shared'), $_SESSION["uid"]); |
116 | 116 | |
117 | 117 | label_add_article($ref_id, __('Shared'), $_SESSION['uid']); */ |
118 | 118 | |
119 | 119 | |
120 | - } else { |
|
121 | - print "Article not found."; |
|
122 | - } |
|
120 | + } else { |
|
121 | + print "Article not found."; |
|
122 | + } |
|
123 | 123 | |
124 | - print "<footer class='text-center'>"; |
|
124 | + print "<footer class='text-center'>"; |
|
125 | 125 | |
126 | - print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('shareArticleDlg').unshare()\">". |
|
127 | - __('Unshare article')."</button>"; |
|
126 | + print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('shareArticleDlg').unshare()\">". |
|
127 | + __('Unshare article')."</button>"; |
|
128 | 128 | |
129 | - print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('shareArticleDlg').newurl()\">". |
|
130 | - __('Generate new URL')."</button>"; |
|
129 | + print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('shareArticleDlg').newurl()\">". |
|
130 | + __('Generate new URL')."</button>"; |
|
131 | 131 | |
132 | - print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('shareArticleDlg').hide()\">". |
|
133 | - __('Close this window')."</button>"; |
|
132 | + print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('shareArticleDlg').hide()\">". |
|
133 | + __('Close this window')."</button>"; |
|
134 | 134 | |
135 | - print "</footer>"; |
|
136 | - } |
|
135 | + print "</footer>"; |
|
136 | + } |
|
137 | 137 | |
138 | - public function api_version() { |
|
139 | - return 2; |
|
140 | - } |
|
138 | + public function api_version() { |
|
139 | + return 2; |
|
140 | + } |
|
141 | 141 | |
142 | 142 | } |
@@ -1,23 +1,23 @@ |
||
1 | 1 | <?php |
2 | 2 | class Af_Zz_NoAutoPlay extends Plugin { |
3 | - private $host; |
|
3 | + private $host; |
|
4 | 4 | |
5 | - public function about() { |
|
6 | - return array(1.0, |
|
7 | - "Don't autoplay HTML5 videos", |
|
8 | - "fox"); |
|
9 | - } |
|
5 | + public function about() { |
|
6 | + return array(1.0, |
|
7 | + "Don't autoplay HTML5 videos", |
|
8 | + "fox"); |
|
9 | + } |
|
10 | 10 | |
11 | - public function init($host) { |
|
12 | - $this->host = $host; |
|
13 | - } |
|
11 | + public function init($host) { |
|
12 | + $this->host = $host; |
|
13 | + } |
|
14 | 14 | |
15 | - public function get_js() { |
|
16 | - return file_get_contents(__DIR__."/init.js"); |
|
17 | - } |
|
15 | + public function get_js() { |
|
16 | + return file_get_contents(__DIR__."/init.js"); |
|
17 | + } |
|
18 | 18 | |
19 | - public function api_version() { |
|
20 | - return 2; |
|
21 | - } |
|
19 | + public function api_version() { |
|
20 | + return 2; |
|
21 | + } |
|
22 | 22 | |
23 | 23 | } |
@@ -1,24 +1,24 @@ |
||
1 | 1 | <?php |
2 | 2 | class No_URL_Hashes extends Plugin { |
3 | - private $host; |
|
3 | + private $host; |
|
4 | 4 | |
5 | - public function about() { |
|
6 | - return array(1.0, |
|
7 | - "Disable URL hash usage (e.g. #f=10, etc)", |
|
8 | - "fox"); |
|
9 | - } |
|
5 | + public function about() { |
|
6 | + return array(1.0, |
|
7 | + "Disable URL hash usage (e.g. #f=10, etc)", |
|
8 | + "fox"); |
|
9 | + } |
|
10 | 10 | |
11 | - public function init($host) { |
|
12 | - $this->host = $host; |
|
11 | + public function init($host) { |
|
12 | + $this->host = $host; |
|
13 | 13 | |
14 | - } |
|
14 | + } |
|
15 | 15 | |
16 | - public function get_js() { |
|
17 | - return file_get_contents(__DIR__."/init.js"); |
|
18 | - } |
|
16 | + public function get_js() { |
|
17 | + return file_get_contents(__DIR__."/init.js"); |
|
18 | + } |
|
19 | 19 | |
20 | - public function api_version() { |
|
21 | - return 2; |
|
22 | - } |
|
20 | + public function api_version() { |
|
21 | + return 2; |
|
22 | + } |
|
23 | 23 | |
24 | 24 | } |
@@ -1,28 +1,28 @@ |
||
1 | 1 | <?php |
2 | 2 | class Shorten_Expanded extends Plugin { |
3 | - private $host; |
|
3 | + private $host; |
|
4 | 4 | |
5 | - public function about() { |
|
6 | - return array(1.0, |
|
7 | - "Shorten overly long articles in CDM/expanded", |
|
8 | - "fox"); |
|
9 | - } |
|
5 | + public function about() { |
|
6 | + return array(1.0, |
|
7 | + "Shorten overly long articles in CDM/expanded", |
|
8 | + "fox"); |
|
9 | + } |
|
10 | 10 | |
11 | - public function init($host) { |
|
12 | - $this->host = $host; |
|
11 | + public function init($host) { |
|
12 | + $this->host = $host; |
|
13 | 13 | |
14 | - } |
|
14 | + } |
|
15 | 15 | |
16 | - public function get_css() { |
|
17 | - return file_get_contents(__DIR__."/init.css"); |
|
18 | - } |
|
16 | + public function get_css() { |
|
17 | + return file_get_contents(__DIR__."/init.css"); |
|
18 | + } |
|
19 | 19 | |
20 | - public function get_js() { |
|
21 | - return file_get_contents(__DIR__."/init.js"); |
|
22 | - } |
|
20 | + public function get_js() { |
|
21 | + return file_get_contents(__DIR__."/init.js"); |
|
22 | + } |
|
23 | 23 | |
24 | - public function api_version() { |
|
25 | - return 2; |
|
26 | - } |
|
24 | + public function api_version() { |
|
25 | + return 2; |
|
26 | + } |
|
27 | 27 | |
28 | 28 | } |
@@ -1,38 +1,38 @@ discard block |
||
1 | 1 | <?php |
2 | - if (file_exists("install") && !file_exists("config.php")) { |
|
3 | - header("Location: install/"); |
|
4 | - } |
|
2 | + if (file_exists("install") && !file_exists("config.php")) { |
|
3 | + header("Location: install/"); |
|
4 | + } |
|
5 | 5 | |
6 | - if (!file_exists("config.php")) { |
|
7 | - print "<b>Fatal Error</b>: You forgot to copy |
|
6 | + if (!file_exists("config.php")) { |
|
7 | + print "<b>Fatal Error</b>: You forgot to copy |
|
8 | 8 | <b>config.php-dist</b> to <b>config.php</b> and edit it.\n"; |
9 | - exit; |
|
10 | - } |
|
9 | + exit; |
|
10 | + } |
|
11 | 11 | |
12 | - // we need a separate check here because functions.php might get parsed |
|
13 | - // incorrectly before 5.3 because of :: syntax. |
|
14 | - if (version_compare(PHP_VERSION, '5.6.0', '<')) { |
|
15 | - print "<b>Fatal Error</b>: PHP version 5.6.0 or newer required. You're using ".PHP_VERSION.".\n"; |
|
16 | - exit; |
|
17 | - } |
|
12 | + // we need a separate check here because functions.php might get parsed |
|
13 | + // incorrectly before 5.3 because of :: syntax. |
|
14 | + if (version_compare(PHP_VERSION, '5.6.0', '<')) { |
|
15 | + print "<b>Fatal Error</b>: PHP version 5.6.0 or newer required. You're using ".PHP_VERSION.".\n"; |
|
16 | + exit; |
|
17 | + } |
|
18 | 18 | |
19 | - set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR. |
|
20 | - get_include_path()); |
|
19 | + set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR. |
|
20 | + get_include_path()); |
|
21 | 21 | |
22 | - require_once "autoload.php"; |
|
23 | - require_once "sessions.php"; |
|
24 | - require_once "functions.php"; |
|
25 | - require_once "sanity_check.php"; |
|
26 | - require_once "config.php"; |
|
27 | - require_once "db-prefs.php"; |
|
22 | + require_once "autoload.php"; |
|
23 | + require_once "sessions.php"; |
|
24 | + require_once "functions.php"; |
|
25 | + require_once "sanity_check.php"; |
|
26 | + require_once "config.php"; |
|
27 | + require_once "db-prefs.php"; |
|
28 | 28 | |
29 | - if (!init_plugins()) { |
|
30 | - return; |
|
31 | - } |
|
29 | + if (!init_plugins()) { |
|
30 | + return; |
|
31 | + } |
|
32 | 32 | |
33 | - login_sequence(); |
|
33 | + login_sequence(); |
|
34 | 34 | |
35 | - header('Content-Type: text/html; charset=utf-8'); |
|
35 | + header('Content-Type: text/html; charset=utf-8'); |
|
36 | 36 | |
37 | 37 | ?> |
38 | 38 | <!DOCTYPE html> |
@@ -42,23 +42,23 @@ discard block |
||
42 | 42 | <meta name="viewport" content="initial-scale=1,width=device-width" /> |
43 | 43 | |
44 | 44 | <?php if ($_SESSION["uid"]) { |
45 | - $theme = get_pref("USER_CSS_THEME", false, false); |
|
46 | - if ($theme && theme_exists("$theme")) { |
|
47 | - echo stylesheet_tag(get_theme_path($theme), 'theme_css'); |
|
48 | - } |
|
49 | - } |
|
45 | + $theme = get_pref("USER_CSS_THEME", false, false); |
|
46 | + if ($theme && theme_exists("$theme")) { |
|
47 | + echo stylesheet_tag(get_theme_path($theme), 'theme_css'); |
|
48 | + } |
|
49 | + } |
|
50 | 50 | |
51 | - print_user_stylesheet() |
|
51 | + print_user_stylesheet() |
|
52 | 52 | |
53 | - ?> |
|
53 | + ?> |
|
54 | 54 | <style type="text/css"> |
55 | 55 | <?php |
56 | - foreach (PluginHost::getInstance()->get_plugins() as $n => $p) { |
|
57 | - if (method_exists($p, "get_css")) { |
|
58 | - echo $p->get_css(); |
|
59 | - } |
|
60 | - } |
|
61 | - ?> |
|
56 | + foreach (PluginHost::getInstance()->get_plugins() as $n => $p) { |
|
57 | + if (method_exists($p, "get_css")) { |
|
58 | + echo $p->get_css(); |
|
59 | + } |
|
60 | + } |
|
61 | + ?> |
|
62 | 62 | </style> |
63 | 63 | |
64 | 64 | <link rel="shortcut icon" type="image/png" href="images/favicon.png"/> |
@@ -75,17 +75,17 @@ discard block |
||
75 | 75 | </script> |
76 | 76 | |
77 | 77 | <?php |
78 | - foreach (array("lib/prototype.js", |
|
79 | - "lib/scriptaculous/scriptaculous.js?load=effects,controls", |
|
80 | - "lib/dojo/dojo.js", |
|
81 | - "lib/dojo/tt-rss-layer.js", |
|
82 | - "js/tt-rss.js", |
|
83 | - "js/common.js", |
|
84 | - "errors.php?mode=js") as $jsfile) { |
|
78 | + foreach (array("lib/prototype.js", |
|
79 | + "lib/scriptaculous/scriptaculous.js?load=effects,controls", |
|
80 | + "lib/dojo/dojo.js", |
|
81 | + "lib/dojo/tt-rss-layer.js", |
|
82 | + "js/tt-rss.js", |
|
83 | + "js/common.js", |
|
84 | + "errors.php?mode=js") as $jsfile) { |
|
85 | 85 | |
86 | - echo javascript_tag($jsfile); |
|
86 | + echo javascript_tag($jsfile); |
|
87 | 87 | |
88 | - } ?> |
|
88 | + } ?> |
|
89 | 89 | |
90 | 90 | <script type="text/javascript"> |
91 | 91 | require({cache:{}}); |
@@ -93,22 +93,22 @@ discard block |
||
93 | 93 | |
94 | 94 | <script type="text/javascript"> |
95 | 95 | <?php |
96 | - foreach (PluginHost::getInstance()->get_plugins() as $n => $p) { |
|
97 | - if (method_exists($p, "get_js")) { |
|
98 | - $script = $p->get_js(); |
|
96 | + foreach (PluginHost::getInstance()->get_plugins() as $n => $p) { |
|
97 | + if (method_exists($p, "get_js")) { |
|
98 | + $script = $p->get_js(); |
|
99 | 99 | |
100 | - if ($script) { |
|
101 | - echo "try { |
|
100 | + if ($script) { |
|
101 | + echo "try { |
|
102 | 102 | $script |
103 | 103 | } catch (e) { |
104 | 104 | console.warn('failed to initialize plugin JS: $n', e); |
105 | 105 | }"; |
106 | - } |
|
107 | - } |
|
108 | - } |
|
106 | + } |
|
107 | + } |
|
108 | + } |
|
109 | 109 | |
110 | - init_js_translations(); |
|
111 | - ?> |
|
110 | + init_js_translations(); |
|
111 | + ?> |
|
112 | 112 | </script> |
113 | 113 | |
114 | 114 | <style type="text/css"> |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | <img src='images/indicator_tiny.gif'/> |
149 | 149 | <?php echo __("Loading, please wait..."); ?></div> |
150 | 150 | <?php |
151 | - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FEED_TREE) as $p) { |
|
151 | + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FEED_TREE) as $p) { |
|
152 | 152 | echo $p->hook_feed_tree(); |
153 | - } |
|
153 | + } |
|
154 | 154 | ?> |
155 | 155 | <div id="feedTree"></div> |
156 | 156 | </div> |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | <?php |
225 | 225 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_TOOLBAR_BUTTON) as $p) { |
226 | - echo $p->hook_toolbar_button(); |
|
226 | + echo $p->hook_toolbar_button(); |
|
227 | 227 | } |
228 | 228 | ?> |
229 | 229 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | |
246 | 246 | <?php |
247 | 247 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ACTION_ITEM) as $p) { |
248 | - echo $p->hook_action_item(); |
|
248 | + echo $p->hook_action_item(); |
|
249 | 249 | } |
250 | 250 | ?> |
251 | 251 |
@@ -1,46 +1,46 @@ |
||
1 | 1 | <?php |
2 | - set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR. |
|
3 | - get_include_path()); |
|
4 | - |
|
5 | - require_once "autoload.php"; |
|
6 | - require_once "sessions.php"; |
|
7 | - require_once "functions.php"; |
|
8 | - require_once "sanity_check.php"; |
|
9 | - require_once "config.php"; |
|
10 | - require_once "db.php"; |
|
11 | - require_once "db-prefs.php"; |
|
12 | - |
|
13 | - startup_gettext(); |
|
14 | - |
|
15 | - $script_started = microtime(true); |
|
16 | - |
|
17 | - if (!init_plugins()) { |
|
18 | - return; |
|
19 | - } |
|
20 | - |
|
21 | - if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) { |
|
22 | - ob_start("ob_gzhandler"); |
|
23 | - } |
|
24 | - |
|
25 | - $method = $_REQUEST["op"]; |
|
26 | - |
|
27 | - $override = PluginHost::getInstance()->lookup_handler("public", $method); |
|
28 | - |
|
29 | - if ($override) { |
|
30 | - $handler = $override; |
|
31 | - } else { |
|
32 | - $handler = new Handler_Public($_REQUEST); |
|
33 | - } |
|
34 | - |
|
35 | - if (implements_interface($handler, "IHandler") && $handler->before($method)) { |
|
36 | - if ($method && method_exists($handler, $method)) { |
|
37 | - $handler->$method(); |
|
38 | - } else if (method_exists($handler, 'index')) { |
|
39 | - $handler->index(); |
|
40 | - } |
|
41 | - $handler->after(); |
|
42 | - return; |
|
43 | - } |
|
44 | - |
|
45 | - header("Content-Type: text/plain"); |
|
46 | - print error_json(13); |
|
2 | + set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR. |
|
3 | + get_include_path()); |
|
4 | + |
|
5 | + require_once "autoload.php"; |
|
6 | + require_once "sessions.php"; |
|
7 | + require_once "functions.php"; |
|
8 | + require_once "sanity_check.php"; |
|
9 | + require_once "config.php"; |
|
10 | + require_once "db.php"; |
|
11 | + require_once "db-prefs.php"; |
|
12 | + |
|
13 | + startup_gettext(); |
|
14 | + |
|
15 | + $script_started = microtime(true); |
|
16 | + |
|
17 | + if (!init_plugins()) { |
|
18 | + return; |
|
19 | + } |
|
20 | + |
|
21 | + if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) { |
|
22 | + ob_start("ob_gzhandler"); |
|
23 | + } |
|
24 | + |
|
25 | + $method = $_REQUEST["op"]; |
|
26 | + |
|
27 | + $override = PluginHost::getInstance()->lookup_handler("public", $method); |
|
28 | + |
|
29 | + if ($override) { |
|
30 | + $handler = $override; |
|
31 | + } else { |
|
32 | + $handler = new Handler_Public($_REQUEST); |
|
33 | + } |
|
34 | + |
|
35 | + if (implements_interface($handler, "IHandler") && $handler->before($method)) { |
|
36 | + if ($method && method_exists($handler, $method)) { |
|
37 | + $handler->$method(); |
|
38 | + } else if (method_exists($handler, 'index')) { |
|
39 | + $handler->index(); |
|
40 | + } |
|
41 | + $handler->after(); |
|
42 | + return; |
|
43 | + } |
|
44 | + |
|
45 | + header("Content-Type: text/plain"); |
|
46 | + print error_json(13); |