@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | $ERRORS[0] = ""; |
8 | 8 | |
9 | 9 | $ERRORS[1] = __("This program requires XmlHttpRequest " . |
10 | - "to function properly. Your browser doesn't seem to support it."); |
|
10 | + "to function properly. Your browser doesn't seem to support it."); |
|
11 | 11 | |
12 | 12 | $ERRORS[2] = __("This program requires cookies " . |
13 | - "to function properly. Your browser doesn't seem to support them."); |
|
13 | + "to function properly. Your browser doesn't seem to support them."); |
|
14 | 14 | |
15 | 15 | $ERRORS[3] = __("Backend sanity check failed."); |
16 | 16 | |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | $ERRORS[15] = __("Encoding data as JSON failed"); |
42 | 42 | |
43 | 43 | if ($_REQUEST['mode'] == 'js') { |
44 | - header("Content-Type: text/javascript; charset=UTF-8"); |
|
44 | + header("Content-Type: text/javascript; charset=UTF-8"); |
|
45 | 45 | |
46 | - print "var ERRORS = [];\n"; |
|
46 | + print "var ERRORS = [];\n"; |
|
47 | 47 | |
48 | - foreach ($ERRORS as $id => $error) { |
|
48 | + foreach ($ERRORS as $id => $error) { |
|
49 | 49 | |
50 | - $error = preg_replace("/\n/", "", $error); |
|
51 | - $error = preg_replace("/\"/", "\\\"", $error); |
|
50 | + $error = preg_replace("/\n/", "", $error); |
|
51 | + $error = preg_replace("/\"/", "\\\"", $error); |
|
52 | 52 | |
53 | - print "ERRORS[$id] = \"$error\";\n"; |
|
54 | - } |
|
53 | + print "ERRORS[$id] = \"$error\";\n"; |
|
54 | + } |
|
55 | 55 | } |
@@ -6,10 +6,10 @@ |
||
6 | 6 | |
7 | 7 | $ERRORS[0] = ""; |
8 | 8 | |
9 | -$ERRORS[1] = __("This program requires XmlHttpRequest " . |
|
9 | +$ERRORS[1] = __("This program requires XmlHttpRequest ". |
|
10 | 10 | "to function properly. Your browser doesn't seem to support it."); |
11 | 11 | |
12 | -$ERRORS[2] = __("This program requires cookies " . |
|
12 | +$ERRORS[2] = __("This program requires cookies ". |
|
13 | 13 | "to function properly. Your browser doesn't seem to support them."); |
14 | 14 | |
15 | 15 | $ERRORS[3] = __("Backend sanity check failed."); |
@@ -173,29 +173,29 @@ discard block |
||
173 | 173 | /** |
174 | 174 | * Maximum matrix size for maximum version (version 40 is 177*177 matrix). |
175 | 175 | */ |
176 | - define('QRSPEC_WIDTH_MAX', 177); |
|
176 | + define('QRSPEC_WIDTH_MAX', 177); |
|
177 | 177 | |
178 | 178 | // ----------------------------------------------------- |
179 | 179 | |
180 | 180 | /** |
181 | 181 | * Matrix index to get width from $capacity array. |
182 | 182 | */ |
183 | - define('QRCAP_WIDTH', 0); |
|
183 | + define('QRCAP_WIDTH', 0); |
|
184 | 184 | |
185 | - /** |
|
185 | + /** |
|
186 | 186 | * Matrix index to get number of words from $capacity array. |
187 | 187 | */ |
188 | - define('QRCAP_WORDS', 1); |
|
188 | + define('QRCAP_WORDS', 1); |
|
189 | 189 | |
190 | - /** |
|
190 | + /** |
|
191 | 191 | * Matrix index to get remainder from $capacity array. |
192 | 192 | */ |
193 | - define('QRCAP_REMINDER', 2); |
|
193 | + define('QRCAP_REMINDER', 2); |
|
194 | 194 | |
195 | - /** |
|
195 | + /** |
|
196 | 196 | * Matrix index to get error correction level from $capacity array. |
197 | 197 | */ |
198 | - define('QRCAP_EC', 3); |
|
198 | + define('QRCAP_EC', 3); |
|
199 | 199 | |
200 | 200 | // ----------------------------------------------------- |
201 | 201 | |
@@ -204,33 +204,33 @@ discard block |
||
204 | 204 | /** |
205 | 205 | * Number of header bits for structured mode |
206 | 206 | */ |
207 | - define('STRUCTURE_HEADER_BITS', 20); |
|
207 | + define('STRUCTURE_HEADER_BITS', 20); |
|
208 | 208 | |
209 | - /** |
|
209 | + /** |
|
210 | 210 | * Max number of symbols for structured mode |
211 | 211 | */ |
212 | - define('MAX_STRUCTURED_SYMBOLS', 16); |
|
212 | + define('MAX_STRUCTURED_SYMBOLS', 16); |
|
213 | 213 | |
214 | 214 | // ----------------------------------------------------- |
215 | 215 | |
216 | - // Masks |
|
216 | + // Masks |
|
217 | 217 | |
218 | - /** |
|
218 | + /** |
|
219 | 219 | * Down point base value for case 1 mask pattern (concatenation of same color in a line or a column) |
220 | 220 | */ |
221 | - define('N1', 3); |
|
221 | + define('N1', 3); |
|
222 | 222 | |
223 | - /** |
|
223 | + /** |
|
224 | 224 | * Down point base value for case 2 mask pattern (module block of same color) |
225 | 225 | */ |
226 | 226 | define('N2', 3); |
227 | 227 | |
228 | - /** |
|
228 | + /** |
|
229 | 229 | * Down point base value for case 3 mask pattern (1:1:3:1:1(dark:bright:dark:bright:dark)pattern in a line or a column) |
230 | 230 | */ |
231 | 231 | define('N3', 40); |
232 | 232 | |
233 | - /** |
|
233 | + /** |
|
234 | 234 | * Down point base value for case 4 mask pattern (ration of dark modules in whole) |
235 | 235 | */ |
236 | 236 | define('N4', 10); |
@@ -264,12 +264,12 @@ discard block |
||
264 | 264 | |
265 | 265 | // for compaibility with PHP4 |
266 | 266 | if (!function_exists('str_split')) { |
267 | - /** |
|
268 | - * Convert a string to an array (needed for PHP4 compatibility) |
|
269 | - * @param string $string The input string. |
|
270 | - * @param int $split_length Maximum length of the chunk. |
|
271 | - * @return If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element. |
|
272 | - */ |
|
267 | + /** |
|
268 | + * Convert a string to an array (needed for PHP4 compatibility) |
|
269 | + * @param string $string The input string. |
|
270 | + * @param int $split_length Maximum length of the chunk. |
|
271 | + * @return If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element. |
|
272 | + */ |
|
273 | 273 | public function str_split($string, $split_length=1) { |
274 | 274 | if ((strlen($string) > $split_length) OR (!$split_length)) { |
275 | 275 | do { |
@@ -2622,7 +2622,7 @@ discard block |
||
2622 | 2622 | } |
2623 | 2623 | |
2624 | 2624 | /** |
2625 | - * Return block number 1 |
|
2625 | + * Return block number 1 |
|
2626 | 2626 | * @param array $spec |
2627 | 2627 | * @return int value |
2628 | 2628 | */ |
@@ -180,12 +180,12 @@ discard block |
||
180 | 180 | /** |
181 | 181 | * Matrix index to get width from $capacity array. |
182 | 182 | */ |
183 | - define('QRCAP_WIDTH', 0); |
|
183 | + define('QRCAP_WIDTH', 0); |
|
184 | 184 | |
185 | 185 | /** |
186 | 186 | * Matrix index to get number of words from $capacity array. |
187 | 187 | */ |
188 | - define('QRCAP_WORDS', 1); |
|
188 | + define('QRCAP_WORDS', 1); |
|
189 | 189 | |
190 | 190 | /** |
191 | 191 | * Matrix index to get remainder from $capacity array. |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | /** |
196 | 196 | * Matrix index to get error correction level from $capacity array. |
197 | 197 | */ |
198 | - define('QRCAP_EC', 3); |
|
198 | + define('QRCAP_EC', 3); |
|
199 | 199 | |
200 | 200 | // ----------------------------------------------------- |
201 | 201 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | /** |
205 | 205 | * Number of header bits for structured mode |
206 | 206 | */ |
207 | - define('STRUCTURE_HEADER_BITS', 20); |
|
207 | + define('STRUCTURE_HEADER_BITS', 20); |
|
208 | 208 | |
209 | 209 | /** |
210 | 210 | * Max number of symbols for structured mode |
@@ -218,12 +218,12 @@ discard block |
||
218 | 218 | /** |
219 | 219 | * Down point base value for case 1 mask pattern (concatenation of same color in a line or a column) |
220 | 220 | */ |
221 | - define('N1', 3); |
|
221 | + define('N1', 3); |
|
222 | 222 | |
223 | 223 | /** |
224 | 224 | * Down point base value for case 2 mask pattern (module block of same color) |
225 | 225 | */ |
226 | - define('N2', 3); |
|
226 | + define('N2', 3); |
|
227 | 227 | |
228 | 228 | /** |
229 | 229 | * Down point base value for case 3 mask pattern (1:1:3:1:1(dark:bright:dark:bright:dark)pattern in a line or a column) |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @param int $split_length Maximum length of the chunk. |
271 | 271 | * @return If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element. |
272 | 272 | */ |
273 | - public function str_split($string, $split_length=1) { |
|
273 | + public function str_split($string, $split_length = 1) { |
|
274 | 274 | if ((strlen($string) > $split_length) OR (!$split_length)) { |
275 | 275 | do { |
276 | 276 | $c = strlen($string); |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // |
482 | 482 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // |
483 | 483 | 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, // |
484 | - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, // |
|
484 | + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, // |
|
485 | 485 | -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // |
486 | 486 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, // |
487 | 487 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // |
@@ -494,47 +494,47 @@ discard block |
||
494 | 494 | * @access protected |
495 | 495 | */ |
496 | 496 | protected $capacity = array( |
497 | - array( 0, 0, 0, array( 0, 0, 0, 0)), // |
|
498 | - array( 21, 26, 0, array( 7, 10, 13, 17)), // 1 |
|
499 | - array( 25, 44, 7, array( 10, 16, 22, 28)), // |
|
500 | - array( 29, 70, 7, array( 15, 26, 36, 44)), // |
|
501 | - array( 33, 100, 7, array( 20, 36, 52, 64)), // |
|
502 | - array( 37, 134, 7, array( 26, 48, 72, 88)), // 5 |
|
503 | - array( 41, 172, 7, array( 36, 64, 96, 112)), // |
|
504 | - array( 45, 196, 0, array( 40, 72, 108, 130)), // |
|
505 | - array( 49, 242, 0, array( 48, 88, 132, 156)), // |
|
506 | - array( 53, 292, 0, array( 60, 110, 160, 192)), // |
|
507 | - array( 57, 346, 0, array( 72, 130, 192, 224)), // 10 |
|
508 | - array( 61, 404, 0, array( 80, 150, 224, 264)), // |
|
509 | - array( 65, 466, 0, array( 96, 176, 260, 308)), // |
|
510 | - array( 69, 532, 0, array( 104, 198, 288, 352)), // |
|
511 | - array( 73, 581, 3, array( 120, 216, 320, 384)), // |
|
512 | - array( 77, 655, 3, array( 132, 240, 360, 432)), // 15 |
|
513 | - array( 81, 733, 3, array( 144, 280, 408, 480)), // |
|
514 | - array( 85, 815, 3, array( 168, 308, 448, 532)), // |
|
515 | - array( 89, 901, 3, array( 180, 338, 504, 588)), // |
|
516 | - array( 93, 991, 3, array( 196, 364, 546, 650)), // |
|
517 | - array( 97, 1085, 3, array( 224, 416, 600, 700)), // 20 |
|
518 | - array(101, 1156, 4, array( 224, 442, 644, 750)), // |
|
519 | - array(105, 1258, 4, array( 252, 476, 690, 816)), // |
|
520 | - array(109, 1364, 4, array( 270, 504, 750, 900)), // |
|
521 | - array(113, 1474, 4, array( 300, 560, 810, 960)), // |
|
522 | - array(117, 1588, 4, array( 312, 588, 870, 1050)), // 25 |
|
523 | - array(121, 1706, 4, array( 336, 644, 952, 1110)), // |
|
524 | - array(125, 1828, 4, array( 360, 700, 1020, 1200)), // |
|
525 | - array(129, 1921, 3, array( 390, 728, 1050, 1260)), // |
|
526 | - array(133, 2051, 3, array( 420, 784, 1140, 1350)), // |
|
527 | - array(137, 2185, 3, array( 450, 812, 1200, 1440)), // 30 |
|
528 | - array(141, 2323, 3, array( 480, 868, 1290, 1530)), // |
|
529 | - array(145, 2465, 3, array( 510, 924, 1350, 1620)), // |
|
530 | - array(149, 2611, 3, array( 540, 980, 1440, 1710)), // |
|
531 | - array(153, 2761, 3, array( 570, 1036, 1530, 1800)), // |
|
532 | - array(157, 2876, 0, array( 570, 1064, 1590, 1890)), // 35 |
|
533 | - array(161, 3034, 0, array( 600, 1120, 1680, 1980)), // |
|
534 | - array(165, 3196, 0, array( 630, 1204, 1770, 2100)), // |
|
535 | - array(169, 3362, 0, array( 660, 1260, 1860, 2220)), // |
|
536 | - array(173, 3532, 0, array( 720, 1316, 1950, 2310)), // |
|
537 | - array(177, 3706, 0, array( 750, 1372, 2040, 2430)) // 40 |
|
497 | + array(0, 0, 0, array(0, 0, 0, 0)), // |
|
498 | + array(21, 26, 0, array(7, 10, 13, 17)), // 1 |
|
499 | + array(25, 44, 7, array(10, 16, 22, 28)), // |
|
500 | + array(29, 70, 7, array(15, 26, 36, 44)), // |
|
501 | + array(33, 100, 7, array(20, 36, 52, 64)), // |
|
502 | + array(37, 134, 7, array(26, 48, 72, 88)), // 5 |
|
503 | + array(41, 172, 7, array(36, 64, 96, 112)), // |
|
504 | + array(45, 196, 0, array(40, 72, 108, 130)), // |
|
505 | + array(49, 242, 0, array(48, 88, 132, 156)), // |
|
506 | + array(53, 292, 0, array(60, 110, 160, 192)), // |
|
507 | + array(57, 346, 0, array(72, 130, 192, 224)), // 10 |
|
508 | + array(61, 404, 0, array(80, 150, 224, 264)), // |
|
509 | + array(65, 466, 0, array(96, 176, 260, 308)), // |
|
510 | + array(69, 532, 0, array(104, 198, 288, 352)), // |
|
511 | + array(73, 581, 3, array(120, 216, 320, 384)), // |
|
512 | + array(77, 655, 3, array(132, 240, 360, 432)), // 15 |
|
513 | + array(81, 733, 3, array(144, 280, 408, 480)), // |
|
514 | + array(85, 815, 3, array(168, 308, 448, 532)), // |
|
515 | + array(89, 901, 3, array(180, 338, 504, 588)), // |
|
516 | + array(93, 991, 3, array(196, 364, 546, 650)), // |
|
517 | + array(97, 1085, 3, array(224, 416, 600, 700)), // 20 |
|
518 | + array(101, 1156, 4, array(224, 442, 644, 750)), // |
|
519 | + array(105, 1258, 4, array(252, 476, 690, 816)), // |
|
520 | + array(109, 1364, 4, array(270, 504, 750, 900)), // |
|
521 | + array(113, 1474, 4, array(300, 560, 810, 960)), // |
|
522 | + array(117, 1588, 4, array(312, 588, 870, 1050)), // 25 |
|
523 | + array(121, 1706, 4, array(336, 644, 952, 1110)), // |
|
524 | + array(125, 1828, 4, array(360, 700, 1020, 1200)), // |
|
525 | + array(129, 1921, 3, array(390, 728, 1050, 1260)), // |
|
526 | + array(133, 2051, 3, array(420, 784, 1140, 1350)), // |
|
527 | + array(137, 2185, 3, array(450, 812, 1200, 1440)), // 30 |
|
528 | + array(141, 2323, 3, array(480, 868, 1290, 1530)), // |
|
529 | + array(145, 2465, 3, array(510, 924, 1350, 1620)), // |
|
530 | + array(149, 2611, 3, array(540, 980, 1440, 1710)), // |
|
531 | + array(153, 2761, 3, array(570, 1036, 1530, 1800)), // |
|
532 | + array(157, 2876, 0, array(570, 1064, 1590, 1890)), // 35 |
|
533 | + array(161, 3034, 0, array(600, 1120, 1680, 1980)), // |
|
534 | + array(165, 3196, 0, array(630, 1204, 1770, 2100)), // |
|
535 | + array(169, 3362, 0, array(660, 1260, 1860, 2220)), // |
|
536 | + array(173, 3532, 0, array(720, 1316, 1950, 2310)), // |
|
537 | + array(177, 3706, 0, array(750, 1372, 2040, 2430)) // 40 |
|
538 | 538 | ); |
539 | 539 | |
540 | 540 | /** |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | */ |
544 | 544 | protected $lengthTableBits = array( |
545 | 545 | array(10, 12, 14), |
546 | - array( 9, 11, 13), |
|
547 | - array( 8, 16, 16), |
|
548 | - array( 8, 10, 12) |
|
546 | + array(9, 11, 13), |
|
547 | + array(8, 16, 16), |
|
548 | + array(8, 10, 12) |
|
549 | 549 | ); |
550 | 550 | |
551 | 551 | /** |
@@ -554,47 +554,47 @@ discard block |
||
554 | 554 | * @access protected |
555 | 555 | */ |
556 | 556 | protected $eccTable = array( |
557 | - array(array( 0, 0), array( 0, 0), array( 0, 0), array( 0, 0)), // |
|
558 | - array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)), // 1 |
|
559 | - array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)), // |
|
560 | - array(array( 1, 0), array( 1, 0), array( 2, 0), array( 2, 0)), // |
|
561 | - array(array( 1, 0), array( 2, 0), array( 2, 0), array( 4, 0)), // |
|
562 | - array(array( 1, 0), array( 2, 0), array( 2, 2), array( 2, 2)), // 5 |
|
563 | - array(array( 2, 0), array( 4, 0), array( 4, 0), array( 4, 0)), // |
|
564 | - array(array( 2, 0), array( 4, 0), array( 2, 4), array( 4, 1)), // |
|
565 | - array(array( 2, 0), array( 2, 2), array( 4, 2), array( 4, 2)), // |
|
566 | - array(array( 2, 0), array( 3, 2), array( 4, 4), array( 4, 4)), // |
|
567 | - array(array( 2, 2), array( 4, 1), array( 6, 2), array( 6, 2)), // 10 |
|
568 | - array(array( 4, 0), array( 1, 4), array( 4, 4), array( 3, 8)), // |
|
569 | - array(array( 2, 2), array( 6, 2), array( 4, 6), array( 7, 4)), // |
|
570 | - array(array( 4, 0), array( 8, 1), array( 8, 4), array(12, 4)), // |
|
571 | - array(array( 3, 1), array( 4, 5), array(11, 5), array(11, 5)), // |
|
572 | - array(array( 5, 1), array( 5, 5), array( 5, 7), array(11, 7)), // 15 |
|
573 | - array(array( 5, 1), array( 7, 3), array(15, 2), array( 3, 13)), // |
|
574 | - array(array( 1, 5), array(10, 1), array( 1, 15), array( 2, 17)), // |
|
575 | - array(array( 5, 1), array( 9, 4), array(17, 1), array( 2, 19)), // |
|
576 | - array(array( 3, 4), array( 3, 11), array(17, 4), array( 9, 16)), // |
|
577 | - array(array( 3, 5), array( 3, 13), array(15, 5), array(15, 10)), // 20 |
|
578 | - array(array( 4, 4), array(17, 0), array(17, 6), array(19, 6)), // |
|
579 | - array(array( 2, 7), array(17, 0), array( 7, 16), array(34, 0)), // |
|
580 | - array(array( 4, 5), array( 4, 14), array(11, 14), array(16, 14)), // |
|
581 | - array(array( 6, 4), array( 6, 14), array(11, 16), array(30, 2)), // |
|
582 | - array(array( 8, 4), array( 8, 13), array( 7, 22), array(22, 13)), // 25 |
|
583 | - array(array(10, 2), array(19, 4), array(28, 6), array(33, 4)), // |
|
584 | - array(array( 8, 4), array(22, 3), array( 8, 26), array(12, 28)), // |
|
585 | - array(array( 3, 10), array( 3, 23), array( 4, 31), array(11, 31)), // |
|
586 | - array(array( 7, 7), array(21, 7), array( 1, 37), array(19, 26)), // |
|
587 | - array(array( 5, 10), array(19, 10), array(15, 25), array(23, 25)), // 30 |
|
588 | - array(array(13, 3), array( 2, 29), array(42, 1), array(23, 28)), // |
|
589 | - array(array(17, 0), array(10, 23), array(10, 35), array(19, 35)), // |
|
590 | - array(array(17, 1), array(14, 21), array(29, 19), array(11, 46)), // |
|
591 | - array(array(13, 6), array(14, 23), array(44, 7), array(59, 1)), // |
|
592 | - array(array(12, 7), array(12, 26), array(39, 14), array(22, 41)), // 35 |
|
593 | - array(array( 6, 14), array( 6, 34), array(46, 10), array( 2, 64)), // |
|
594 | - array(array(17, 4), array(29, 14), array(49, 10), array(24, 46)), // |
|
595 | - array(array( 4, 18), array(13, 32), array(48, 14), array(42, 32)), // |
|
596 | - array(array(20, 4), array(40, 7), array(43, 22), array(10, 67)), // |
|
597 | - array(array(19, 6), array(18, 31), array(34, 34), array(20, 61)) // 40 |
|
557 | + array(array(0, 0), array(0, 0), array(0, 0), array(0, 0)), // |
|
558 | + array(array(1, 0), array(1, 0), array(1, 0), array(1, 0)), // 1 |
|
559 | + array(array(1, 0), array(1, 0), array(1, 0), array(1, 0)), // |
|
560 | + array(array(1, 0), array(1, 0), array(2, 0), array(2, 0)), // |
|
561 | + array(array(1, 0), array(2, 0), array(2, 0), array(4, 0)), // |
|
562 | + array(array(1, 0), array(2, 0), array(2, 2), array(2, 2)), // 5 |
|
563 | + array(array(2, 0), array(4, 0), array(4, 0), array(4, 0)), // |
|
564 | + array(array(2, 0), array(4, 0), array(2, 4), array(4, 1)), // |
|
565 | + array(array(2, 0), array(2, 2), array(4, 2), array(4, 2)), // |
|
566 | + array(array(2, 0), array(3, 2), array(4, 4), array(4, 4)), // |
|
567 | + array(array(2, 2), array(4, 1), array(6, 2), array(6, 2)), // 10 |
|
568 | + array(array(4, 0), array(1, 4), array(4, 4), array(3, 8)), // |
|
569 | + array(array(2, 2), array(6, 2), array(4, 6), array(7, 4)), // |
|
570 | + array(array(4, 0), array(8, 1), array(8, 4), array(12, 4)), // |
|
571 | + array(array(3, 1), array(4, 5), array(11, 5), array(11, 5)), // |
|
572 | + array(array(5, 1), array(5, 5), array(5, 7), array(11, 7)), // 15 |
|
573 | + array(array(5, 1), array(7, 3), array(15, 2), array(3, 13)), // |
|
574 | + array(array(1, 5), array(10, 1), array(1, 15), array(2, 17)), // |
|
575 | + array(array(5, 1), array(9, 4), array(17, 1), array(2, 19)), // |
|
576 | + array(array(3, 4), array(3, 11), array(17, 4), array(9, 16)), // |
|
577 | + array(array(3, 5), array(3, 13), array(15, 5), array(15, 10)), // 20 |
|
578 | + array(array(4, 4), array(17, 0), array(17, 6), array(19, 6)), // |
|
579 | + array(array(2, 7), array(17, 0), array(7, 16), array(34, 0)), // |
|
580 | + array(array(4, 5), array(4, 14), array(11, 14), array(16, 14)), // |
|
581 | + array(array(6, 4), array(6, 14), array(11, 16), array(30, 2)), // |
|
582 | + array(array(8, 4), array(8, 13), array(7, 22), array(22, 13)), // 25 |
|
583 | + array(array(10, 2), array(19, 4), array(28, 6), array(33, 4)), // |
|
584 | + array(array(8, 4), array(22, 3), array(8, 26), array(12, 28)), // |
|
585 | + array(array(3, 10), array(3, 23), array(4, 31), array(11, 31)), // |
|
586 | + array(array(7, 7), array(21, 7), array(1, 37), array(19, 26)), // |
|
587 | + array(array(5, 10), array(19, 10), array(15, 25), array(23, 25)), // 30 |
|
588 | + array(array(13, 3), array(2, 29), array(42, 1), array(23, 28)), // |
|
589 | + array(array(17, 0), array(10, 23), array(10, 35), array(19, 35)), // |
|
590 | + array(array(17, 1), array(14, 21), array(29, 19), array(11, 46)), // |
|
591 | + array(array(13, 6), array(14, 23), array(44, 7), array(59, 1)), // |
|
592 | + array(array(12, 7), array(12, 26), array(39, 14), array(22, 41)), // 35 |
|
593 | + array(array(6, 14), array(6, 34), array(46, 10), array(2, 64)), // |
|
594 | + array(array(17, 4), array(29, 14), array(49, 10), array(24, 46)), // |
|
595 | + array(array(4, 18), array(13, 32), array(48, 14), array(42, 32)), // |
|
596 | + array(array(20, 4), array(40, 7), array(43, 22), array(10, 67)), // |
|
597 | + array(array(19, 6), array(18, 31), array(34, 34), array(20, 61)) // 40 |
|
598 | 598 | ); |
599 | 599 | |
600 | 600 | /** |
@@ -604,9 +604,9 @@ discard block |
||
604 | 604 | * @access protected |
605 | 605 | */ |
606 | 606 | protected $alignmentPattern = array( |
607 | - array( 0, 0), |
|
608 | - array( 0, 0), array(18, 0), array(22, 0), array(26, 0), array(30, 0), // 1- 5 |
|
609 | - array(34, 0), array(22, 38), array(24, 42), array(26, 46), array(28, 50), // 6-10 |
|
607 | + array(0, 0), |
|
608 | + array(0, 0), array(18, 0), array(22, 0), array(26, 0), array(30, 0), // 1- 5 |
|
609 | + array(34, 0), array(22, 38), array(24, 42), array(26, 46), array(28, 50), // 6-10 |
|
610 | 610 | array(30, 54), array(32, 58), array(34, 62), array(26, 46), array(26, 48), // 11-15 |
611 | 611 | array(26, 50), array(30, 54), array(30, 56), array(30, 58), array(34, 62), // 16-20 |
612 | 612 | array(28, 50), array(26, 50), array(30, 54), array(28, 54), array(32, 58), // 21-25 |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | foreach ($qrTab as $line) { |
680 | 680 | $arrAdd = array(); |
681 | 681 | foreach (str_split($line) as $char) { |
682 | - $arrAdd[] = ($char=='1')?1:0; |
|
682 | + $arrAdd[] = ($char == '1') ? 1 : 0; |
|
683 | 683 | } |
684 | 684 | $barcode_array['bcode'][] = $arrAdd; |
685 | 685 | } |
@@ -704,8 +704,8 @@ discard block |
||
704 | 704 | $len = count($frame); |
705 | 705 | // the frame is square (width = height) |
706 | 706 | foreach ($frame as &$frameLine) { |
707 | - for ($i=0; $i<$len; $i++) { |
|
708 | - $frameLine[$i] = (ord($frameLine[$i])&1)?'1':'0'; |
|
707 | + for ($i = 0; $i < $len; $i++) { |
|
708 | + $frameLine[$i] = (ord($frameLine[$i]) & 1) ? '1' : '0'; |
|
709 | 709 | } |
710 | 710 | } |
711 | 711 | return $frame; |
@@ -755,10 +755,10 @@ discard block |
||
755 | 755 | $this->dir = -1; |
756 | 756 | $this->bit = -1; |
757 | 757 | // inteleaved data and ecc codes |
758 | - for ($i=0; $i < ($this->dataLength + $this->eccLength); $i++) { |
|
758 | + for ($i = 0; $i < ($this->dataLength + $this->eccLength); $i++) { |
|
759 | 759 | $code = $this->getCode(); |
760 | 760 | $bit = 0x80; |
761 | - for ($j=0; $j<8; $j++) { |
|
761 | + for ($j = 0; $j < 8; $j++) { |
|
762 | 762 | $addr = $this->getNextPosition(); |
763 | 763 | $this->setFrameAt($addr, 0x02 | (($bit & $code) != 0)); |
764 | 764 | $bit = $bit >> 1; |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | } |
767 | 767 | // remainder bits |
768 | 768 | $j = $this->getRemainder($this->version); |
769 | - for ($i=0; $i<$j; $i++) { |
|
769 | + for ($i = 0; $i < $j; $i++) { |
|
770 | 770 | $addr = $this->getNextPosition(); |
771 | 771 | $this->setFrameAt($addr, 0x02); |
772 | 772 | } |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | } |
857 | 857 | $this->x = $x; |
858 | 858 | $this->y = $y; |
859 | - } while(ord($this->frame[$y][$x]) & 0x80); |
|
859 | + } while (ord($this->frame[$y][$x]) & 0x80); |
|
860 | 860 | return array('x'=>$x, 'y'=>$y); |
861 | 861 | } |
862 | 862 | |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | $dataPos = 0; |
878 | 878 | $eccPos = 0; |
879 | 879 | $endfor = $this->rsBlockNum1($spec); |
880 | - for ($i=0; $i < $endfor; ++$i) { |
|
880 | + for ($i = 0; $i < $endfor; ++$i) { |
|
881 | 881 | $ecc = array_slice($this->ecccode, $eccPos); |
882 | 882 | $this->rsblocks[$blockNo] = array(); |
883 | 883 | $this->rsblocks[$blockNo]['dataLength'] = $dl; |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | $this->rsblocks[$blockNo]['eccLength'] = $el; |
886 | 886 | $ecc = $this->encode_rs_char($rs, $this->rsblocks[$blockNo]['data'], $ecc); |
887 | 887 | $this->rsblocks[$blockNo]['ecc'] = $ecc; |
888 | - $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc); |
|
888 | + $this->ecccode = array_merge(array_slice($this->ecccode, 0, $eccPos), $ecc); |
|
889 | 889 | $dataPos += $dl; |
890 | 890 | $eccPos += $el; |
891 | 891 | $blockNo++; |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | return -1; |
901 | 901 | } |
902 | 902 | $endfor = $this->rsBlockNum2($spec); |
903 | - for ($i=0; $i < $endfor; ++$i) { |
|
903 | + for ($i = 0; $i < $endfor; ++$i) { |
|
904 | 904 | $ecc = array_slice($this->ecccode, $eccPos); |
905 | 905 | $this->rsblocks[$blockNo] = array(); |
906 | 906 | $this->rsblocks[$blockNo]['dataLength'] = $dl; |
@@ -953,8 +953,8 @@ discard block |
||
953 | 953 | */ |
954 | 954 | protected function writeFormatInformation($width, &$frame, $mask, $level) { |
955 | 955 | $blacks = 0; |
956 | - $format = $this->getFormatInfo($mask, $level); |
|
957 | - for ($i=0; $i<8; ++$i) { |
|
956 | + $format = $this->getFormatInfo($mask, $level); |
|
957 | + for ($i = 0; $i < 8; ++$i) { |
|
958 | 958 | if ($format & 1) { |
959 | 959 | $blacks += 2; |
960 | 960 | $v = 0x85; |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | } |
970 | 970 | $format = $format >> 1; |
971 | 971 | } |
972 | - for ($i=0; $i<7; ++$i) { |
|
972 | + for ($i = 0; $i < 7; ++$i) { |
|
973 | 973 | if ($format & 1) { |
974 | 974 | $blacks += 2; |
975 | 975 | $v = 0x85; |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | * @return int mask |
1035 | 1035 | */ |
1036 | 1036 | protected function mask4($x, $y) { |
1037 | - return (((int)($y / 2)) + ((int)($x / 3))) & 1; |
|
1037 | + return (((int) ($y / 2)) + ((int) ($x / 3))) & 1; |
|
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | /** |
@@ -1076,13 +1076,13 @@ discard block |
||
1076 | 1076 | */ |
1077 | 1077 | protected function generateMaskNo($maskNo, $width, $frame) { |
1078 | 1078 | $bitMask = array_fill(0, $width, array_fill(0, $width, 0)); |
1079 | - for ($y=0; $y<$width; ++$y) { |
|
1080 | - for ($x=0; $x<$width; ++$x) { |
|
1079 | + for ($y = 0; $y < $width; ++$y) { |
|
1080 | + for ($x = 0; $x < $width; ++$x) { |
|
1081 | 1081 | if (ord($frame[$y][$x]) & 0x80) { |
1082 | 1082 | $bitMask[$y][$x] = 0; |
1083 | 1083 | } else { |
1084 | 1084 | $maskFunc = call_user_func(array($this, 'mask'.$maskNo), $x, $y); |
1085 | - $bitMask[$y][$x] = ($maskFunc == 0)?1:0; |
|
1085 | + $bitMask[$y][$x] = ($maskFunc == 0) ? 1 : 0; |
|
1086 | 1086 | } |
1087 | 1087 | } |
1088 | 1088 | } |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | * @param boolean $maskGenOnly |
1099 | 1099 | * @return int b |
1100 | 1100 | */ |
1101 | - protected function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly=false) { |
|
1101 | + protected function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly = false) { |
|
1102 | 1102 | $b = 0; |
1103 | 1103 | $bitMask = array(); |
1104 | 1104 | $bitMask = $this->generateMaskNo($maskNo, $width, $s); |
@@ -1106,12 +1106,12 @@ discard block |
||
1106 | 1106 | return; |
1107 | 1107 | } |
1108 | 1108 | $d = $s; |
1109 | - for ($y=0; $y<$width; ++$y) { |
|
1110 | - for ($x=0; $x<$width; ++$x) { |
|
1109 | + for ($y = 0; $y < $width; ++$y) { |
|
1110 | + for ($x = 0; $x < $width; ++$x) { |
|
1111 | 1111 | if ($bitMask[$y][$x] == 1) { |
1112 | - $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int)$bitMask[$y][$x]); |
|
1112 | + $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int) $bitMask[$y][$x]); |
|
1113 | 1113 | } |
1114 | - $b += (int)(ord($d[$y][$x]) & 1); |
|
1114 | + $b += (int) (ord($d[$y][$x]) & 1); |
|
1115 | 1115 | } |
1116 | 1116 | } |
1117 | 1117 | return $b; |
@@ -1139,20 +1139,20 @@ discard block |
||
1139 | 1139 | */ |
1140 | 1140 | protected function calcN1N3($length) { |
1141 | 1141 | $demerit = 0; |
1142 | - for ($i=0; $i<$length; ++$i) { |
|
1142 | + for ($i = 0; $i < $length; ++$i) { |
|
1143 | 1143 | if ($this->runLength[$i] >= 5) { |
1144 | 1144 | $demerit += (N1 + ($this->runLength[$i] - 5)); |
1145 | 1145 | } |
1146 | 1146 | if ($i & 1) { |
1147 | - if (($i >= 3) AND ($i < ($length-2)) AND ($this->runLength[$i] % 3 == 0)) { |
|
1148 | - $fact = (int)($this->runLength[$i] / 3); |
|
1149 | - if (($this->runLength[$i-2] == $fact) |
|
1150 | - AND ($this->runLength[$i-1] == $fact) |
|
1151 | - AND ($this->runLength[$i+1] == $fact) |
|
1152 | - AND ($this->runLength[$i+2] == $fact)) { |
|
1153 | - if (($this->runLength[$i-3] < 0) OR ($this->runLength[$i-3] >= (4 * $fact))) { |
|
1147 | + if (($i >= 3) AND ($i < ($length - 2)) AND ($this->runLength[$i] % 3 == 0)) { |
|
1148 | + $fact = (int) ($this->runLength[$i] / 3); |
|
1149 | + if (($this->runLength[$i - 2] == $fact) |
|
1150 | + AND ($this->runLength[$i - 1] == $fact) |
|
1151 | + AND ($this->runLength[$i + 1] == $fact) |
|
1152 | + AND ($this->runLength[$i + 2] == $fact)) { |
|
1153 | + if (($this->runLength[$i - 3] < 0) OR ($this->runLength[$i - 3] >= (4 * $fact))) { |
|
1154 | 1154 | $demerit += N3; |
1155 | - } elseif ((($i+3) >= $length) OR ($this->runLength[$i+3] >= (4 * $fact))) { |
|
1155 | + } elseif ((($i + 3) >= $length) OR ($this->runLength[$i + 3] >= (4 * $fact))) { |
|
1156 | 1156 | $demerit += N3; |
1157 | 1157 | } |
1158 | 1158 | } |
@@ -1171,17 +1171,17 @@ discard block |
||
1171 | 1171 | protected function evaluateSymbol($width, $frame) { |
1172 | 1172 | $head = 0; |
1173 | 1173 | $demerit = 0; |
1174 | - for ($y=0; $y<$width; ++$y) { |
|
1174 | + for ($y = 0; $y < $width; ++$y) { |
|
1175 | 1175 | $head = 0; |
1176 | 1176 | $this->runLength[0] = 1; |
1177 | 1177 | $frameY = $frame[$y]; |
1178 | 1178 | if ($y > 0) { |
1179 | - $frameYM = $frame[$y-1]; |
|
1179 | + $frameYM = $frame[$y - 1]; |
|
1180 | 1180 | } |
1181 | - for ($x=0; $x<$width; ++$x) { |
|
1181 | + for ($x = 0; $x < $width; ++$x) { |
|
1182 | 1182 | if (($x > 0) AND ($y > 0)) { |
1183 | - $b22 = ord($frameY[$x]) & ord($frameY[$x-1]) & ord($frameYM[$x]) & ord($frameYM[$x-1]); |
|
1184 | - $w22 = ord($frameY[$x]) | ord($frameY[$x-1]) | ord($frameYM[$x]) | ord($frameYM[$x-1]); |
|
1183 | + $b22 = ord($frameY[$x]) & ord($frameY[$x - 1]) & ord($frameYM[$x]) & ord($frameYM[$x - 1]); |
|
1184 | + $w22 = ord($frameY[$x]) | ord($frameY[$x - 1]) | ord($frameYM[$x]) | ord($frameYM[$x - 1]); |
|
1185 | 1185 | if (($b22 | ($w22 ^ 1)) & 1) { |
1186 | 1186 | $demerit += N2; |
1187 | 1187 | } |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | $head = 1; |
1192 | 1192 | $this->runLength[$head] = 1; |
1193 | 1193 | } elseif ($x > 0) { |
1194 | - if ((ord($frameY[$x]) ^ ord($frameY[$x-1])) & 1) { |
|
1194 | + if ((ord($frameY[$x]) ^ ord($frameY[$x - 1])) & 1) { |
|
1195 | 1195 | $head++; |
1196 | 1196 | $this->runLength[$head] = 1; |
1197 | 1197 | } else { |
@@ -1199,18 +1199,18 @@ discard block |
||
1199 | 1199 | } |
1200 | 1200 | } |
1201 | 1201 | } |
1202 | - $demerit += $this->calcN1N3($head+1); |
|
1202 | + $demerit += $this->calcN1N3($head + 1); |
|
1203 | 1203 | } |
1204 | - for ($x=0; $x<$width; ++$x) { |
|
1204 | + for ($x = 0; $x < $width; ++$x) { |
|
1205 | 1205 | $head = 0; |
1206 | 1206 | $this->runLength[0] = 1; |
1207 | - for ($y=0; $y<$width; ++$y) { |
|
1207 | + for ($y = 0; $y < $width; ++$y) { |
|
1208 | 1208 | if (($y == 0) AND (ord($frame[$y][$x]) & 1)) { |
1209 | 1209 | $this->runLength[0] = -1; |
1210 | 1210 | $head = 1; |
1211 | 1211 | $this->runLength[$head] = 1; |
1212 | 1212 | } elseif ($y > 0) { |
1213 | - if ((ord($frame[$y][$x]) ^ ord($frame[$y-1][$x])) & 1) { |
|
1213 | + if ((ord($frame[$y][$x]) ^ ord($frame[$y - 1][$x])) & 1) { |
|
1214 | 1214 | $head++; |
1215 | 1215 | $this->runLength[$head] = 1; |
1216 | 1216 | } else { |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | } |
1219 | 1219 | } |
1220 | 1220 | } |
1221 | - $demerit += $this->calcN1N3($head+1); |
|
1221 | + $demerit += $this->calcN1N3($head + 1); |
|
1222 | 1222 | } |
1223 | 1223 | return $demerit; |
1224 | 1224 | } |
@@ -1237,8 +1237,8 @@ discard block |
||
1237 | 1237 | $checked_masks = array(0, 1, 2, 3, 4, 5, 6, 7); |
1238 | 1238 | if (QR_FIND_FROM_RANDOM !== false) { |
1239 | 1239 | $howManuOut = 8 - (QR_FIND_FROM_RANDOM % 9); |
1240 | - for ($i = 0; $i < $howManuOut; ++$i) { |
|
1241 | - $remPos = rand (0, count($checked_masks)-1); |
|
1240 | + for ($i = 0; $i < $howManuOut; ++$i) { |
|
1241 | + $remPos = rand(0, count($checked_masks) - 1); |
|
1242 | 1242 | unset($checked_masks[$remPos]); |
1243 | 1243 | $checked_masks = array_values($checked_masks); |
1244 | 1244 | } |
@@ -1250,8 +1250,8 @@ discard block |
||
1250 | 1250 | $blacks = 0; |
1251 | 1251 | $blacks = $this->makeMaskNo($i, $width, $frame, $mask); |
1252 | 1252 | $blacks += $this->writeFormatInformation($width, $mask, $i, $level); |
1253 | - $blacks = (int)(100 * $blacks / ($width * $width)); |
|
1254 | - $demerit = (int)((int)(abs($blacks - 50) / 5) * N4); |
|
1253 | + $blacks = (int) (100 * $blacks / ($width * $width)); |
|
1254 | + $demerit = (int) ((int) (abs($blacks - 50) / 5) * N4); |
|
1255 | 1255 | $demerit += $this->evaluateSymbol($width, $mask); |
1256 | 1256 | if ($demerit < $minDemerit) { |
1257 | 1257 | $minDemerit = $demerit; |
@@ -1276,7 +1276,7 @@ discard block |
||
1276 | 1276 | if ($pos >= strlen($str)) { |
1277 | 1277 | return false; |
1278 | 1278 | } |
1279 | - return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9'))); |
|
1279 | + return ((ord($str[$pos]) >= ord('0')) && (ord($str[$pos]) <= ord('9'))); |
|
1280 | 1280 | } |
1281 | 1281 | |
1282 | 1282 | /** |
@@ -1307,8 +1307,8 @@ discard block |
||
1307 | 1307 | } elseif ($this->isalnumat($this->dataStr, $pos)) { |
1308 | 1308 | return QR_MODE_AN; |
1309 | 1309 | } elseif ($this->hint == QR_MODE_KJ) { |
1310 | - if ($pos+1 < strlen($this->dataStr)) { |
|
1311 | - $d = $this->dataStr[$pos+1]; |
|
1310 | + if ($pos + 1 < strlen($this->dataStr)) { |
|
1311 | + $d = $this->dataStr[$pos + 1]; |
|
1312 | 1312 | $word = (ord($c) << 8) | ord($d); |
1313 | 1313 | if (($word >= 0x8140 && $word <= 0x9ffc) OR ($word >= 0xe040 && $word <= 0xebbf)) { |
1314 | 1314 | return QR_MODE_KJ; |
@@ -1325,7 +1325,7 @@ discard block |
||
1325 | 1325 | protected function eatNum() { |
1326 | 1326 | $ln = $this->lengthIndicator(QR_MODE_NM, $this->version); |
1327 | 1327 | $p = 0; |
1328 | - while($this->isdigitat($this->dataStr, $p)) { |
|
1328 | + while ($this->isdigitat($this->dataStr, $p)) { |
|
1329 | 1329 | $p++; |
1330 | 1330 | } |
1331 | 1331 | $run = $p; |
@@ -1341,7 +1341,7 @@ discard block |
||
1341 | 1341 | if ($mode == QR_MODE_AN) { |
1342 | 1342 | $dif = $this->estimateBitsModeNum($run) + 4 + $ln |
1343 | 1343 | + $this->estimateBitsModeAn(1) // + 4 + la |
1344 | - - $this->estimateBitsModeAn($run + 1);// - 4 - la |
|
1344 | + - $this->estimateBitsModeAn($run + 1); // - 4 - la |
|
1345 | 1345 | if ($dif > 0) { |
1346 | 1346 | return $this->eatAn(); |
1347 | 1347 | } |
@@ -1355,13 +1355,13 @@ discard block |
||
1355 | 1355 | * @return int run |
1356 | 1356 | */ |
1357 | 1357 | protected function eatAn() { |
1358 | - $la = $this->lengthIndicator(QR_MODE_AN, $this->version); |
|
1358 | + $la = $this->lengthIndicator(QR_MODE_AN, $this->version); |
|
1359 | 1359 | $ln = $this->lengthIndicator(QR_MODE_NM, $this->version); |
1360 | 1360 | $p = 0; |
1361 | - while($this->isalnumat($this->dataStr, $p)) { |
|
1361 | + while ($this->isalnumat($this->dataStr, $p)) { |
|
1362 | 1362 | if ($this->isdigitat($this->dataStr, $p)) { |
1363 | 1363 | $q = $p; |
1364 | - while($this->isdigitat($this->dataStr, $q)) { |
|
1364 | + while ($this->isdigitat($this->dataStr, $q)) { |
|
1365 | 1365 | $q++; |
1366 | 1366 | } |
1367 | 1367 | $dif = $this->estimateBitsModeAn($p) // + 4 + la |
@@ -1395,7 +1395,7 @@ discard block |
||
1395 | 1395 | */ |
1396 | 1396 | protected function eatKanji() { |
1397 | 1397 | $p = 0; |
1398 | - while($this->identifyMode($p) == QR_MODE_KJ) { |
|
1398 | + while ($this->identifyMode($p) == QR_MODE_KJ) { |
|
1399 | 1399 | $p += 2; |
1400 | 1400 | } |
1401 | 1401 | $this->items = $this->appendNewInputItem($this->items, QR_MODE_KJ, $p, str_split($this->dataStr)); |
@@ -1411,14 +1411,14 @@ discard block |
||
1411 | 1411 | $ln = $this->lengthIndicator(QR_MODE_NM, $this->version); |
1412 | 1412 | $p = 1; |
1413 | 1413 | $dataStrLen = strlen($this->dataStr); |
1414 | - while($p < $dataStrLen) { |
|
1414 | + while ($p < $dataStrLen) { |
|
1415 | 1415 | $mode = $this->identifyMode($p); |
1416 | 1416 | if ($mode == QR_MODE_KJ) { |
1417 | 1417 | break; |
1418 | 1418 | } |
1419 | 1419 | if ($mode == QR_MODE_NM) { |
1420 | 1420 | $q = $p; |
1421 | - while($this->isdigitat($this->dataStr, $q)) { |
|
1421 | + while ($this->isdigitat($this->dataStr, $q)) { |
|
1422 | 1422 | $q++; |
1423 | 1423 | } |
1424 | 1424 | $dif = $this->estimateBitsMode8($p) // + 4 + l8 |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | } |
1432 | 1432 | } elseif ($mode == QR_MODE_AN) { |
1433 | 1433 | $q = $p; |
1434 | - while($this->isalnumat($this->dataStr, $q)) { |
|
1434 | + while ($this->isalnumat($this->dataStr, $q)) { |
|
1435 | 1435 | $q++; |
1436 | 1436 | } |
1437 | 1437 | $dif = $this->estimateBitsMode8($p) // + 4 + l8 |
@@ -1524,7 +1524,7 @@ discard block |
||
1524 | 1524 | * @param array $bstream |
1525 | 1525 | * @return array input item |
1526 | 1526 | */ |
1527 | - protected function newInputItem($mode, $size, $data, $bstream=null) { |
|
1527 | + protected function newInputItem($mode, $size, $data, $bstream = null) { |
|
1528 | 1528 | $setData = array_slice($data, 0, $size); |
1529 | 1529 | if (count($setData) < $size) { |
1530 | 1530 | $setData = array_merge($setData, array_fill(0, ($size - count($setData)), 0)); |
@@ -1547,23 +1547,23 @@ discard block |
||
1547 | 1547 | * @return array input item |
1548 | 1548 | */ |
1549 | 1549 | protected function encodeModeNum($inputitem, $version) { |
1550 | - $words = (int)($inputitem['size'] / 3); |
|
1550 | + $words = (int) ($inputitem['size'] / 3); |
|
1551 | 1551 | $inputitem['bstream'] = array(); |
1552 | 1552 | $val = 0x1; |
1553 | 1553 | $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, $val); |
1554 | 1554 | $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_NM, $version), $inputitem['size']); |
1555 | - for ($i=0; $i < $words; ++$i) { |
|
1556 | - $val = (ord($inputitem['data'][$i*3 ]) - ord('0')) * 100; |
|
1557 | - $val += (ord($inputitem['data'][$i*3+1]) - ord('0')) * 10; |
|
1558 | - $val += (ord($inputitem['data'][$i*3+2]) - ord('0')); |
|
1555 | + for ($i = 0; $i < $words; ++$i) { |
|
1556 | + $val = (ord($inputitem['data'][$i * 3]) - ord('0')) * 100; |
|
1557 | + $val += (ord($inputitem['data'][$i * 3 + 1]) - ord('0')) * 10; |
|
1558 | + $val += (ord($inputitem['data'][$i * 3 + 2]) - ord('0')); |
|
1559 | 1559 | $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 10, $val); |
1560 | 1560 | } |
1561 | 1561 | if ($inputitem['size'] - $words * 3 == 1) { |
1562 | - $val = ord($inputitem['data'][$words*3]) - ord('0'); |
|
1562 | + $val = ord($inputitem['data'][$words * 3]) - ord('0'); |
|
1563 | 1563 | $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, $val); |
1564 | 1564 | } elseif (($inputitem['size'] - ($words * 3)) == 2) { |
1565 | - $val = (ord($inputitem['data'][$words*3 ]) - ord('0')) * 10; |
|
1566 | - $val += (ord($inputitem['data'][$words*3+1]) - ord('0')); |
|
1565 | + $val = (ord($inputitem['data'][$words * 3]) - ord('0')) * 10; |
|
1566 | + $val += (ord($inputitem['data'][$words * 3 + 1]) - ord('0')); |
|
1567 | 1567 | $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 7, $val); |
1568 | 1568 | } |
1569 | 1569 | return $inputitem; |
@@ -1576,13 +1576,13 @@ discard block |
||
1576 | 1576 | * @return array input item |
1577 | 1577 | */ |
1578 | 1578 | protected function encodeModeAn($inputitem, $version) { |
1579 | - $words = (int)($inputitem['size'] / 2); |
|
1579 | + $words = (int) ($inputitem['size'] / 2); |
|
1580 | 1580 | $inputitem['bstream'] = array(); |
1581 | 1581 | $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x02); |
1582 | 1582 | $inputitem['bstream'] = $this->appendNum(v, $this->lengthIndicator(QR_MODE_AN, $version), $inputitem['size']); |
1583 | - for ($i=0; $i < $words; ++$i) { |
|
1584 | - $val = (int)$this->lookAnTable(ord($inputitem['data'][$i*2 ])) * 45; |
|
1585 | - $val += (int)$this->lookAnTable(ord($inputitem['data'][$i*2+1])); |
|
1583 | + for ($i = 0; $i < $words; ++$i) { |
|
1584 | + $val = (int) $this->lookAnTable(ord($inputitem['data'][$i * 2])) * 45; |
|
1585 | + $val += (int) $this->lookAnTable(ord($inputitem['data'][$i * 2 + 1])); |
|
1586 | 1586 | $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 11, $val); |
1587 | 1587 | } |
1588 | 1588 | if ($inputitem['size'] & 1) { |
@@ -1602,7 +1602,7 @@ discard block |
||
1602 | 1602 | $inputitem['bstream'] = array(); |
1603 | 1603 | $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x4); |
1604 | 1604 | $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_8B, $version), $inputitem['size']); |
1605 | - for ($i=0; $i < $inputitem['size']; ++$i) { |
|
1605 | + for ($i = 0; $i < $inputitem['size']; ++$i) { |
|
1606 | 1606 | $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 8, ord($inputitem['data'][$i])); |
1607 | 1607 | } |
1608 | 1608 | return $inputitem; |
@@ -1617,9 +1617,9 @@ discard block |
||
1617 | 1617 | protected function encodeModeKanji($inputitem, $version) { |
1618 | 1618 | $inputitem['bstream'] = array(); |
1619 | 1619 | $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x8); |
1620 | - $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_KJ, $version), (int)($inputitem['size'] / 2)); |
|
1621 | - for ($i=0; $i<$inputitem['size']; $i+=2) { |
|
1622 | - $val = (ord($inputitem['data'][$i]) << 8) | ord($inputitem['data'][$i+1]); |
|
1620 | + $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_KJ, $version), (int) ($inputitem['size'] / 2)); |
|
1621 | + for ($i = 0; $i < $inputitem['size']; $i += 2) { |
|
1622 | + $val = (ord($inputitem['data'][$i]) << 8) | ord($inputitem['data'][$i + 1]); |
|
1623 | 1623 | if ($val <= 0x9ffc) { |
1624 | 1624 | $val -= 0x8140; |
1625 | 1625 | } else { |
@@ -1664,7 +1664,7 @@ discard block |
||
1664 | 1664 | $inputitem['bstream'] = $this->appendBitstream($inputitem['bstream'], $st1['bstream']); |
1665 | 1665 | $inputitem['bstream'] = $this->appendBitstream($inputitem['bstream'], $st2['bstream']); |
1666 | 1666 | } else { |
1667 | - switch($inputitem['mode']) { |
|
1667 | + switch ($inputitem['mode']) { |
|
1668 | 1668 | case QR_MODE_NM: { |
1669 | 1669 | $inputitem = $this->encodeModeNum($inputitem, $version); |
1670 | 1670 | break; |
@@ -1742,7 +1742,7 @@ discard block |
||
1742 | 1742 | $parity = 0; |
1743 | 1743 | foreach ($items as $item) { |
1744 | 1744 | if ($item['mode'] != QR_MODE_ST) { |
1745 | - for ($i=$item['size']-1; $i>=0; --$i) { |
|
1745 | + for ($i = $item['size'] - 1; $i >= 0; --$i) { |
|
1746 | 1746 | $parity ^= $item['data'][$i]; |
1747 | 1747 | } |
1748 | 1748 | } |
@@ -1757,8 +1757,8 @@ discard block |
||
1757 | 1757 | * @return boolean true or false |
1758 | 1758 | */ |
1759 | 1759 | protected function checkModeNum($size, $data) { |
1760 | - for ($i=0; $i<$size; ++$i) { |
|
1761 | - if ((ord($data[$i]) < ord('0')) OR (ord($data[$i]) > ord('9'))){ |
|
1760 | + for ($i = 0; $i < $size; ++$i) { |
|
1761 | + if ((ord($data[$i]) < ord('0')) OR (ord($data[$i]) > ord('9'))) { |
|
1762 | 1762 | return false; |
1763 | 1763 | } |
1764 | 1764 | } |
@@ -1771,9 +1771,9 @@ discard block |
||
1771 | 1771 | * @return int number of bits |
1772 | 1772 | */ |
1773 | 1773 | protected function estimateBitsModeNum($size) { |
1774 | - $w = (int)$size / 3; |
|
1774 | + $w = (int) $size / 3; |
|
1775 | 1775 | $bits = $w * 10; |
1776 | - switch($size - $w * 3) { |
|
1776 | + switch ($size - $w * 3) { |
|
1777 | 1777 | case 1: { |
1778 | 1778 | $bits += 4; |
1779 | 1779 | break; |
@@ -1795,7 +1795,7 @@ discard block |
||
1795 | 1795 | * @return value |
1796 | 1796 | */ |
1797 | 1797 | protected function lookAnTable($c) { |
1798 | - return (($c > 127)?-1:$this->anTable[$c]); |
|
1798 | + return (($c > 127) ?-1 : $this->anTable[$c]); |
|
1799 | 1799 | } |
1800 | 1800 | |
1801 | 1801 | /** |
@@ -1805,7 +1805,7 @@ discard block |
||
1805 | 1805 | * @return boolean true or false |
1806 | 1806 | */ |
1807 | 1807 | protected function checkModeAn($size, $data) { |
1808 | - for ($i=0; $i<$size; ++$i) { |
|
1808 | + for ($i = 0; $i < $size; ++$i) { |
|
1809 | 1809 | if ($this->lookAnTable(ord($data[$i])) == -1) { |
1810 | 1810 | return false; |
1811 | 1811 | } |
@@ -1819,7 +1819,7 @@ discard block |
||
1819 | 1819 | * @return int number of bits |
1820 | 1820 | */ |
1821 | 1821 | protected function estimateBitsModeAn($size) { |
1822 | - $w = (int)($size / 2); |
|
1822 | + $w = (int) ($size / 2); |
|
1823 | 1823 | $bits = $w * 11; |
1824 | 1824 | if ($size & 1) { |
1825 | 1825 | $bits += 6; |
@@ -1842,7 +1842,7 @@ discard block |
||
1842 | 1842 | * @return int number of bits |
1843 | 1843 | */ |
1844 | 1844 | protected function estimateBitsModeKanji($size) { |
1845 | - return (int)(($size / 2) * 13); |
|
1845 | + return (int) (($size / 2) * 13); |
|
1846 | 1846 | } |
1847 | 1847 | |
1848 | 1848 | /** |
@@ -1855,8 +1855,8 @@ discard block |
||
1855 | 1855 | if ($size & 1) { |
1856 | 1856 | return false; |
1857 | 1857 | } |
1858 | - for ($i=0; $i<$size; $i+=2) { |
|
1859 | - $val = (ord($data[$i]) << 8) | ord($data[$i+1]); |
|
1858 | + for ($i = 0; $i < $size; $i += 2) { |
|
1859 | + $val = (ord($data[$i]) << 8) | ord($data[$i + 1]); |
|
1860 | 1860 | if (($val < 0x8140) OR (($val > 0x9ffc) AND ($val < 0xe040)) OR ($val > 0xebbf)) { |
1861 | 1861 | return false; |
1862 | 1862 | } |
@@ -1875,7 +1875,7 @@ discard block |
||
1875 | 1875 | if ($size <= 0) { |
1876 | 1876 | return false; |
1877 | 1877 | } |
1878 | - switch($mode) { |
|
1878 | + switch ($mode) { |
|
1879 | 1879 | case QR_MODE_NM: { |
1880 | 1880 | return $this->checkModeNum($size, $data); |
1881 | 1881 | } |
@@ -1910,7 +1910,7 @@ discard block |
||
1910 | 1910 | $version = 1; |
1911 | 1911 | } |
1912 | 1912 | foreach ($items as $item) { |
1913 | - switch($item['mode']) { |
|
1913 | + switch ($item['mode']) { |
|
1914 | 1914 | case QR_MODE_NM: { |
1915 | 1915 | $bits = $this->estimateBitsModeNum($item['size']); |
1916 | 1916 | break; |
@@ -1936,7 +1936,7 @@ discard block |
||
1936 | 1936 | } |
1937 | 1937 | $l = $this->lengthIndicator($item['mode'], $version); |
1938 | 1938 | $m = 1 << $l; |
1939 | - $num = (int)(($item['size'] + $m - 1) / $m); |
|
1939 | + $num = (int) (($item['size'] + $m - 1) / $m); |
|
1940 | 1940 | $bits += $num * (4 + $l); |
1941 | 1941 | } |
1942 | 1942 | return $bits; |
@@ -1953,7 +1953,7 @@ discard block |
||
1953 | 1953 | do { |
1954 | 1954 | $prev = $version; |
1955 | 1955 | $bits = $this->estimateBitStreamSize($items, $prev); |
1956 | - $version = $this->getMinimumVersion((int)(($bits + 7) / 8), $this->level); |
|
1956 | + $version = $this->getMinimumVersion((int) (($bits + 7) / 8), $this->level); |
|
1957 | 1957 | if ($version < 0) { |
1958 | 1958 | return -1; |
1959 | 1959 | } |
@@ -1970,9 +1970,9 @@ discard block |
||
1970 | 1970 | */ |
1971 | 1971 | protected function lengthOfCode($mode, $version, $bits) { |
1972 | 1972 | $payload = $bits - 4 - $this->lengthIndicator($mode, $version); |
1973 | - switch($mode) { |
|
1973 | + switch ($mode) { |
|
1974 | 1974 | case QR_MODE_NM: { |
1975 | - $chunks = (int)($payload / 10); |
|
1975 | + $chunks = (int) ($payload / 10); |
|
1976 | 1976 | $remain = $payload - $chunks * 10; |
1977 | 1977 | $size = $chunks * 3; |
1978 | 1978 | if ($remain >= 7) { |
@@ -1983,7 +1983,7 @@ discard block |
||
1983 | 1983 | break; |
1984 | 1984 | } |
1985 | 1985 | case QR_MODE_AN: { |
1986 | - $chunks = (int)($payload / 11); |
|
1986 | + $chunks = (int) ($payload / 11); |
|
1987 | 1987 | $remain = $payload - $chunks * 11; |
1988 | 1988 | $size = $chunks * 2; |
1989 | 1989 | if ($remain >= 6) { |
@@ -1992,15 +1992,15 @@ discard block |
||
1992 | 1992 | break; |
1993 | 1993 | } |
1994 | 1994 | case QR_MODE_8B: { |
1995 | - $size = (int)($payload / 8); |
|
1995 | + $size = (int) ($payload / 8); |
|
1996 | 1996 | break; |
1997 | 1997 | } |
1998 | 1998 | case QR_MODE_KJ: { |
1999 | - $size = (int)(($payload / 13) * 2); |
|
1999 | + $size = (int) (($payload / 13) * 2); |
|
2000 | 2000 | break; |
2001 | 2001 | } |
2002 | 2002 | case QR_MODE_ST: { |
2003 | - $size = (int)($payload / 8); |
|
2003 | + $size = (int) ($payload / 8); |
|
2004 | 2004 | break; |
2005 | 2005 | } |
2006 | 2006 | default: { |
@@ -2050,7 +2050,7 @@ discard block |
||
2050 | 2050 | if ($bits < 0) { |
2051 | 2051 | return -1; |
2052 | 2052 | } |
2053 | - $ver = $this->getMinimumVersion((int)(($bits + 7) / 8), $this->level); |
|
2053 | + $ver = $this->getMinimumVersion((int) (($bits + 7) / 8), $this->level); |
|
2054 | 2054 | if ($ver < 0) { |
2055 | 2055 | return -1; |
2056 | 2056 | } elseif ($ver > $this->version) { |
@@ -2078,14 +2078,14 @@ discard block |
||
2078 | 2078 | return $this->appendNum($bstream, $maxbits - $bits, 0); |
2079 | 2079 | } |
2080 | 2080 | $bits += 4; |
2081 | - $words = (int)(($bits + 7) / 8); |
|
2081 | + $words = (int) (($bits + 7) / 8); |
|
2082 | 2082 | $padding = array(); |
2083 | 2083 | $padding = $this->appendNum($padding, $words * 8 - $bits + 4, 0); |
2084 | 2084 | $padlen = $maxwords - $words; |
2085 | 2085 | if ($padlen > 0) { |
2086 | 2086 | $padbuf = array(); |
2087 | - for ($i=0; $i<$padlen; ++$i) { |
|
2088 | - $padbuf[$i] = ($i&1)?0x11:0xec; |
|
2087 | + for ($i = 0; $i < $padlen; ++$i) { |
|
2088 | + $padbuf[$i] = ($i & 1) ? 0x11 : 0xec; |
|
2089 | 2089 | } |
2090 | 2090 | $padding = $this->appendBytes($padding, $padlen, $padbuf); |
2091 | 2091 | } |
@@ -2148,7 +2148,7 @@ discard block |
||
2148 | 2148 | protected function newFromNum($bits, $num) { |
2149 | 2149 | $bstream = $this->allocate($bits); |
2150 | 2150 | $mask = 1 << ($bits - 1); |
2151 | - for ($i=0; $i<$bits; ++$i) { |
|
2151 | + for ($i = 0; $i < $bits; ++$i) { |
|
2152 | 2152 | if ($num & $mask) { |
2153 | 2153 | $bstream[$i] = 1; |
2154 | 2154 | } else { |
@@ -2167,10 +2167,10 @@ discard block |
||
2167 | 2167 | */ |
2168 | 2168 | protected function newFromBytes($size, $data) { |
2169 | 2169 | $bstream = $this->allocate($size * 8); |
2170 | - $p=0; |
|
2171 | - for ($i=0; $i<$size; ++$i) { |
|
2170 | + $p = 0; |
|
2171 | + for ($i = 0; $i < $size; ++$i) { |
|
2172 | 2172 | $mask = 0x80; |
2173 | - for ($j=0; $j<8; ++$j) { |
|
2173 | + for ($j = 0; $j < 8; ++$j) { |
|
2174 | 2174 | if ($data[$i] & $mask) { |
2175 | 2175 | $bstream[$p] = 1; |
2176 | 2176 | } else { |
@@ -2239,12 +2239,12 @@ discard block |
||
2239 | 2239 | if ($size == 0) { |
2240 | 2240 | return array(); |
2241 | 2241 | } |
2242 | - $data = array_fill(0, (int)(($size + 7) / 8), 0); |
|
2243 | - $bytes = (int)($size / 8); |
|
2242 | + $data = array_fill(0, (int) (($size + 7) / 8), 0); |
|
2243 | + $bytes = (int) ($size / 8); |
|
2244 | 2244 | $p = 0; |
2245 | - for ($i=0; $i<$bytes; $i++) { |
|
2245 | + for ($i = 0; $i < $bytes; $i++) { |
|
2246 | 2246 | $v = 0; |
2247 | - for ($j=0; $j<8; $j++) { |
|
2247 | + for ($j = 0; $j < 8; $j++) { |
|
2248 | 2248 | $v = $v << 1; |
2249 | 2249 | $v |= $bstream[$p]; |
2250 | 2250 | $p++; |
@@ -2253,7 +2253,7 @@ discard block |
||
2253 | 2253 | } |
2254 | 2254 | if ($size & 7) { |
2255 | 2255 | $v = 0; |
2256 | - for ($j=0; $j<($size & 7); $j++) { |
|
2256 | + for ($j = 0; $j < ($size & 7); $j++) { |
|
2257 | 2257 | $v = $v << 1; |
2258 | 2258 | $v |= $bstream[$p]; |
2259 | 2259 | $p++; |
@@ -2276,8 +2276,8 @@ discard block |
||
2276 | 2276 | * @param int $replLen length of the repl string |
2277 | 2277 | * @return array srctab |
2278 | 2278 | */ |
2279 | - protected function qrstrset($srctab, $x, $y, $repl, $replLen=false) { |
|
2280 | - $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl)); |
|
2279 | + protected function qrstrset($srctab, $x, $y, $repl, $replLen = false) { |
|
2280 | + $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false) ?substr($repl, 0, $replLen) : $repl, $x, ($replLen !== false) ? $replLen : strlen($repl)); |
|
2281 | 2281 | return $srctab; |
2282 | 2282 | } |
2283 | 2283 | |
@@ -2297,7 +2297,7 @@ discard block |
||
2297 | 2297 | * @param int $level error correction level |
2298 | 2298 | * @return int ECC size (bytes) |
2299 | 2299 | */ |
2300 | - protected function getECCLength($version, $level){ |
|
2300 | + protected function getECCLength($version, $level) { |
|
2301 | 2301 | return $this->capacity[$version][QRCAP_EC][$level]; |
2302 | 2302 | } |
2303 | 2303 | |
@@ -2326,8 +2326,8 @@ discard block |
||
2326 | 2326 | * @return int version number |
2327 | 2327 | */ |
2328 | 2328 | protected function getMinimumVersion($size, $level) { |
2329 | - for ($i=1; $i <= QRSPEC_VERSION_MAX; ++$i) { |
|
2330 | - $words = $this->capacity[$i][QRCAP_WORDS] - $this->capacity[$i][QRCAP_EC][$level]; |
|
2329 | + for ($i = 1; $i <= QRSPEC_VERSION_MAX; ++$i) { |
|
2330 | + $words = $this->capacity[$i][QRCAP_WORDS] - $this->capacity[$i][QRCAP_EC][$level]; |
|
2331 | 2331 | if ($words >= $size) { |
2332 | 2332 | return $i; |
2333 | 2333 | } |
@@ -2397,14 +2397,14 @@ discard block |
||
2397 | 2397 | $ecc = $this->getECCLength($version, $level); |
2398 | 2398 | if ($b2 == 0) { |
2399 | 2399 | $spec[0] = $b1; |
2400 | - $spec[1] = (int)($data / $b1); |
|
2401 | - $spec[2] = (int)($ecc / $b1); |
|
2400 | + $spec[1] = (int) ($data / $b1); |
|
2401 | + $spec[2] = (int) ($ecc / $b1); |
|
2402 | 2402 | $spec[3] = 0; |
2403 | 2403 | $spec[4] = 0; |
2404 | 2404 | } else { |
2405 | 2405 | $spec[0] = $b1; |
2406 | - $spec[1] = (int)($data / ($b1 + $b2)); |
|
2407 | - $spec[2] = (int)($ecc / ($b1 + $b2)); |
|
2406 | + $spec[1] = (int) ($data / ($b1 + $b2)); |
|
2407 | + $spec[2] = (int) ($ecc / ($b1 + $b2)); |
|
2408 | 2408 | $spec[3] = $b2; |
2409 | 2409 | $spec[4] = $spec[1] + 1; |
2410 | 2410 | } |
@@ -2429,8 +2429,8 @@ discard block |
||
2429 | 2429 | ); |
2430 | 2430 | $yStart = $oy - 2; |
2431 | 2431 | $xStart = $ox - 2; |
2432 | - for ($y=0; $y < 5; $y++) { |
|
2433 | - $frame = $this->qrstrset($frame, $xStart, $yStart+$y, $finder[$y]); |
|
2432 | + for ($y = 0; $y < 5; $y++) { |
|
2433 | + $frame = $this->qrstrset($frame, $xStart, $yStart + $y, $finder[$y]); |
|
2434 | 2434 | } |
2435 | 2435 | return $frame; |
2436 | 2436 | } |
@@ -2450,7 +2450,7 @@ discard block |
||
2450 | 2450 | if ($d < 0) { |
2451 | 2451 | $w = 2; |
2452 | 2452 | } else { |
2453 | - $w = (int)(($width - $this->alignmentPattern[$version][0]) / $d + 2); |
|
2453 | + $w = (int) (($width - $this->alignmentPattern[$version][0]) / $d + 2); |
|
2454 | 2454 | } |
2455 | 2455 | if ($w * $w - 3 == 1) { |
2456 | 2456 | $x = $this->alignmentPattern[$version][0]; |
@@ -2460,15 +2460,15 @@ discard block |
||
2460 | 2460 | } |
2461 | 2461 | $cx = $this->alignmentPattern[$version][0]; |
2462 | 2462 | $wo = $w - 1; |
2463 | - for ($x=1; $x < $wo; ++$x) { |
|
2463 | + for ($x = 1; $x < $wo; ++$x) { |
|
2464 | 2464 | $frame = $this->putAlignmentMarker($frame, 6, $cx); |
2465 | - $frame = $this->putAlignmentMarker($frame, $cx, 6); |
|
2465 | + $frame = $this->putAlignmentMarker($frame, $cx, 6); |
|
2466 | 2466 | $cx += $d; |
2467 | 2467 | } |
2468 | 2468 | $cy = $this->alignmentPattern[$version][0]; |
2469 | - for ($y=0; $y < $wo; ++$y) { |
|
2469 | + for ($y = 0; $y < $wo; ++$y) { |
|
2470 | 2470 | $cx = $this->alignmentPattern[$version][0]; |
2471 | - for ($x=0; $x < $wo; ++$x) { |
|
2471 | + for ($x = 0; $x < $wo; ++$x) { |
|
2472 | 2472 | $frame = $this->putAlignmentMarker($frame, $cx, $cy); |
2473 | 2473 | $cx += $d; |
2474 | 2474 | } |
@@ -2523,7 +2523,7 @@ discard block |
||
2523 | 2523 | "\xc1\xc0\xc0\xc0\xc0\xc0\xc1", |
2524 | 2524 | "\xc1\xc1\xc1\xc1\xc1\xc1\xc1" |
2525 | 2525 | ); |
2526 | - for ($y=0; $y < 7; $y++) { |
|
2526 | + for ($y = 0; $y < 7; $y++) { |
|
2527 | 2527 | $frame = $this->qrstrset($frame, $ox, ($oy + $y), $finder[$y]); |
2528 | 2528 | } |
2529 | 2529 | return $frame; |
@@ -2536,7 +2536,7 @@ discard block |
||
2536 | 2536 | */ |
2537 | 2537 | protected function createFrame($version) { |
2538 | 2538 | $width = $this->capacity[$version][QRCAP_WIDTH]; |
2539 | - $frameLine = str_repeat ("\0", $width); |
|
2539 | + $frameLine = str_repeat("\0", $width); |
|
2540 | 2540 | $frame = array_fill(0, $width, $frameLine); |
2541 | 2541 | // Finder pattern |
2542 | 2542 | $frame = $this->putFinderPattern($frame, 0, 0); |
@@ -2544,7 +2544,7 @@ discard block |
||
2544 | 2544 | $frame = $this->putFinderPattern($frame, 0, $width - 7); |
2545 | 2545 | // Separator |
2546 | 2546 | $yOffset = $width - 7; |
2547 | - for ($y=0; $y < 7; ++$y) { |
|
2547 | + for ($y = 0; $y < 7; ++$y) { |
|
2548 | 2548 | $frame[$y][7] = "\xc0"; |
2549 | 2549 | $frame[$y][$width - 8] = "\xc0"; |
2550 | 2550 | $frame[$yOffset][7] = "\xc0"; |
@@ -2552,22 +2552,22 @@ discard block |
||
2552 | 2552 | } |
2553 | 2553 | $setPattern = str_repeat("\xc0", 8); |
2554 | 2554 | $frame = $this->qrstrset($frame, 0, 7, $setPattern); |
2555 | - $frame = $this->qrstrset($frame, $width-8, 7, $setPattern); |
|
2555 | + $frame = $this->qrstrset($frame, $width - 8, 7, $setPattern); |
|
2556 | 2556 | $frame = $this->qrstrset($frame, 0, $width - 8, $setPattern); |
2557 | 2557 | // Format info |
2558 | 2558 | $setPattern = str_repeat("\x84", 9); |
2559 | 2559 | $frame = $this->qrstrset($frame, 0, 8, $setPattern); |
2560 | 2560 | $frame = $this->qrstrset($frame, $width - 8, 8, $setPattern, 8); |
2561 | 2561 | $yOffset = $width - 8; |
2562 | - for ($y=0; $y < 8; ++$y,++$yOffset) { |
|
2562 | + for ($y = 0; $y < 8; ++$y, ++$yOffset) { |
|
2563 | 2563 | $frame[$y][8] = "\x84"; |
2564 | 2564 | $frame[$yOffset][8] = "\x84"; |
2565 | 2565 | } |
2566 | 2566 | // Timing pattern |
2567 | 2567 | $wo = $width - 15; |
2568 | - for ($i=1; $i < $wo; ++$i) { |
|
2569 | - $frame[6][7+$i] = chr(0x90 | ($i & 1)); |
|
2570 | - $frame[7+$i][6] = chr(0x90 | ($i & 1)); |
|
2568 | + for ($i = 1; $i < $wo; ++$i) { |
|
2569 | + $frame[6][7 + $i] = chr(0x90 | ($i & 1)); |
|
2570 | + $frame[7 + $i][6] = chr(0x90 | ($i & 1)); |
|
2571 | 2571 | } |
2572 | 2572 | // Alignment pattern |
2573 | 2573 | $frame = $this->putAlignmentPattern($version, $frame, $width); |
@@ -2575,16 +2575,16 @@ discard block |
||
2575 | 2575 | if ($version >= 7) { |
2576 | 2576 | $vinf = $this->getVersionPattern($version); |
2577 | 2577 | $v = $vinf; |
2578 | - for ($x=0; $x<6; ++$x) { |
|
2579 | - for ($y=0; $y<3; ++$y) { |
|
2580 | - $frame[($width - 11)+$y][$x] = chr(0x88 | ($v & 1)); |
|
2578 | + for ($x = 0; $x < 6; ++$x) { |
|
2579 | + for ($y = 0; $y < 3; ++$y) { |
|
2580 | + $frame[($width - 11) + $y][$x] = chr(0x88 | ($v & 1)); |
|
2581 | 2581 | $v = $v >> 1; |
2582 | 2582 | } |
2583 | 2583 | } |
2584 | 2584 | $v = $vinf; |
2585 | - for ($y=0; $y<6; ++$y) { |
|
2586 | - for ($x=0; $x<3; ++$x) { |
|
2587 | - $frame[$y][$x+($width - 11)] = chr(0x88 | ($v & 1)); |
|
2585 | + for ($y = 0; $y < 6; ++$y) { |
|
2586 | + for ($x = 0; $x < 3; ++$x) { |
|
2587 | + $frame[$y][$x + ($width - 11)] = chr(0x88 | ($v & 1)); |
|
2588 | 2588 | $v = $v >> 1; |
2589 | 2589 | } |
2590 | 2590 | } |
@@ -2755,16 +2755,16 @@ discard block |
||
2755 | 2755 | if (($symsize < 0) OR ($symsize > 8)) { |
2756 | 2756 | return $rs; |
2757 | 2757 | } |
2758 | - if (($fcr < 0) OR ($fcr >= (1<<$symsize))) { |
|
2758 | + if (($fcr < 0) OR ($fcr >= (1 << $symsize))) { |
|
2759 | 2759 | return $rs; |
2760 | 2760 | } |
2761 | - if (($prim <= 0) OR ($prim >= (1<<$symsize))) { |
|
2761 | + if (($prim <= 0) OR ($prim >= (1 << $symsize))) { |
|
2762 | 2762 | return $rs; |
2763 | 2763 | } |
2764 | - if (($nroots < 0) OR ($nroots >= (1<<$symsize))) { |
|
2764 | + if (($nroots < 0) OR ($nroots >= (1 << $symsize))) { |
|
2765 | 2765 | return $rs; |
2766 | 2766 | } |
2767 | - if (($pad < 0) OR ($pad >= ((1<<$symsize) -1 - $nroots))) { |
|
2767 | + if (($pad < 0) OR ($pad >= ((1 << $symsize) - 1 - $nroots))) { |
|
2768 | 2768 | return $rs; |
2769 | 2769 | } |
2770 | 2770 | $rs = array(); |
@@ -2774,13 +2774,13 @@ discard block |
||
2774 | 2774 | $rs['alpha_to'] = array_fill(0, ($rs['nn'] + 1), 0); |
2775 | 2775 | $rs['index_of'] = array_fill(0, ($rs['nn'] + 1), 0); |
2776 | 2776 | // PHP style macro replacement ;) |
2777 | - $NN =& $rs['nn']; |
|
2778 | - $A0 =& $NN; |
|
2777 | + $NN = & $rs['nn']; |
|
2778 | + $A0 = & $NN; |
|
2779 | 2779 | // Generate Galois field lookup tables |
2780 | 2780 | $rs['index_of'][0] = $A0; // log(zero) = -inf |
2781 | 2781 | $rs['alpha_to'][$A0] = 0; // alpha**-inf = 0 |
2782 | 2782 | $sr = 1; |
2783 | - for ($i=0; $i<$rs['nn']; ++$i) { |
|
2783 | + for ($i = 0; $i < $rs['nn']; ++$i) { |
|
2784 | 2784 | $rs['index_of'][$sr] = $i; |
2785 | 2785 | $rs['alpha_to'][$i] = $sr; |
2786 | 2786 | $sr <<= 1; |
@@ -2800,21 +2800,21 @@ discard block |
||
2800 | 2800 | $rs['nroots'] = $nroots; |
2801 | 2801 | $rs['gfpoly'] = $gfpoly; |
2802 | 2802 | // Find prim-th root of 1, used in decoding |
2803 | - for ($iprim=1; ($iprim % $prim) != 0; $iprim += $rs['nn']) { |
|
2803 | + for ($iprim = 1; ($iprim % $prim) != 0; $iprim += $rs['nn']) { |
|
2804 | 2804 | ; // intentional empty-body loop! |
2805 | 2805 | } |
2806 | - $rs['iprim'] = (int)($iprim / $prim); |
|
2806 | + $rs['iprim'] = (int) ($iprim / $prim); |
|
2807 | 2807 | $rs['genpoly'][0] = 1; |
2808 | 2808 | |
2809 | 2809 | |
2810 | - for ($i = 0,$root=$fcr*$prim; $i < $nroots; $i++, $root += $prim) { |
|
2811 | - $rs['genpoly'][$i+1] = 1; |
|
2810 | + for ($i = 0, $root = $fcr * $prim; $i < $nroots; $i++, $root += $prim) { |
|
2811 | + $rs['genpoly'][$i + 1] = 1; |
|
2812 | 2812 | // Multiply rs->genpoly[] by @**(root + x) |
2813 | 2813 | for ($j = $i; $j > 0; --$j) { |
2814 | 2814 | if ($rs['genpoly'][$j] != 0) { |
2815 | - $rs['genpoly'][$j] = $rs['genpoly'][$j-1] ^ $rs['alpha_to'][$this->modnn($rs, $rs['index_of'][$rs['genpoly'][$j]] + $root)]; |
|
2815 | + $rs['genpoly'][$j] = $rs['genpoly'][$j - 1] ^ $rs['alpha_to'][$this->modnn($rs, $rs['index_of'][$rs['genpoly'][$j]] + $root)]; |
|
2816 | 2816 | } else { |
2817 | - $rs['genpoly'][$j] = $rs['genpoly'][$j-1]; |
|
2817 | + $rs['genpoly'][$j] = $rs['genpoly'][$j - 1]; |
|
2818 | 2818 | } |
2819 | 2819 | } |
2820 | 2820 | // rs->genpoly[0] can never be zero |
@@ -2835,26 +2835,26 @@ discard block |
||
2835 | 2835 | * @return parity array |
2836 | 2836 | */ |
2837 | 2837 | protected function encode_rs_char($rs, $data, $parity) { |
2838 | - $MM =& $rs['mm']; // bits per symbol |
|
2839 | - $NN =& $rs['nn']; // the total number of symbols in a RS block |
|
2840 | - $ALPHA_TO =& $rs['alpha_to']; // the address of an array of NN elements to convert Galois field elements in index (log) form to polynomial form |
|
2841 | - $INDEX_OF =& $rs['index_of']; // the address of an array of NN elements to convert Galois field elements in polynomial form to index (log) form |
|
2842 | - $GENPOLY =& $rs['genpoly']; // an array of NROOTS+1 elements containing the generator polynomial in index form |
|
2843 | - $NROOTS =& $rs['nroots']; // the number of roots in the RS code generator polynomial, which is the same as the number of parity symbols in a block |
|
2844 | - $FCR =& $rs['fcr']; // first consecutive root, index form |
|
2845 | - $PRIM =& $rs['prim']; // primitive element, index form |
|
2846 | - $IPRIM =& $rs['iprim']; // prim-th root of 1, index form |
|
2847 | - $PAD =& $rs['pad']; // the number of pad symbols in a block |
|
2848 | - $A0 =& $NN; |
|
2838 | + $MM = & $rs['mm']; // bits per symbol |
|
2839 | + $NN = & $rs['nn']; // the total number of symbols in a RS block |
|
2840 | + $ALPHA_TO = & $rs['alpha_to']; // the address of an array of NN elements to convert Galois field elements in index (log) form to polynomial form |
|
2841 | + $INDEX_OF = & $rs['index_of']; // the address of an array of NN elements to convert Galois field elements in polynomial form to index (log) form |
|
2842 | + $GENPOLY = & $rs['genpoly']; // an array of NROOTS+1 elements containing the generator polynomial in index form |
|
2843 | + $NROOTS = & $rs['nroots']; // the number of roots in the RS code generator polynomial, which is the same as the number of parity symbols in a block |
|
2844 | + $FCR = & $rs['fcr']; // first consecutive root, index form |
|
2845 | + $PRIM = & $rs['prim']; // primitive element, index form |
|
2846 | + $IPRIM = & $rs['iprim']; // prim-th root of 1, index form |
|
2847 | + $PAD = & $rs['pad']; // the number of pad symbols in a block |
|
2848 | + $A0 = & $NN; |
|
2849 | 2849 | $parity = array_fill(0, $NROOTS, 0); |
2850 | - for ($i=0; $i < ($NN - $NROOTS - $PAD); $i++) { |
|
2850 | + for ($i = 0; $i < ($NN - $NROOTS - $PAD); $i++) { |
|
2851 | 2851 | $feedback = $INDEX_OF[$data[$i] ^ $parity[0]]; |
2852 | 2852 | if ($feedback != $A0) { |
2853 | 2853 | // feedback term is non-zero |
2854 | 2854 | // This line is unnecessary when GENPOLY[NROOTS] is unity, as it must |
2855 | 2855 | // always be for the polynomials constructed by init_rs() |
2856 | 2856 | $feedback = $this->modnn($rs, $NN - $GENPOLY[$NROOTS] + $feedback); |
2857 | - for ($j=1; $j < $NROOTS; ++$j) { |
|
2857 | + for ($j = 1; $j < $NROOTS; ++$j) { |
|
2858 | 2858 | $parity[$j] ^= $ALPHA_TO[$this->modnn($rs, $feedback + $GENPOLY[($NROOTS - $j)])]; |
2859 | 2859 | } |
2860 | 2860 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $new_feed_id = $row['id']; |
238 | 238 | } else { |
239 | 239 | $row = $this->pdo->query("SELECT MAX(id) AS id FROM ttrss_archived_feeds")->fetch(); |
240 | - $new_feed_id = (int)$row['id'] + 1; |
|
240 | + $new_feed_id = (int) $row['id'] + 1; |
|
241 | 241 | |
242 | 242 | $sth = $this->pdo->prepare("INSERT INTO ttrss_archived_feeds |
243 | 243 | (id, owner_uid, title, feed_url, site_url, created) |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | /* GET["cmode"] = 0 - mark as read, 1 - as unread, 2 - toggle */ |
288 | 288 | public function catchupSelected() { |
289 | 289 | $ids = explode(",", clean($_REQUEST["ids"])); |
290 | - $cmode = (int)clean($_REQUEST["cmode"]); |
|
290 | + $cmode = (int) clean($_REQUEST["cmode"]); |
|
291 | 291 | |
292 | 292 | Article::catchupArticlesById($ids, $cmode); |
293 | 293 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | |
297 | 297 | public function markSelected() { |
298 | 298 | $ids = explode(",", clean($_REQUEST["ids"])); |
299 | - $cmode = (int)clean($_REQUEST["cmode"]); |
|
299 | + $cmode = (int) clean($_REQUEST["cmode"]); |
|
300 | 300 | |
301 | 301 | $this->markArticlesById($ids, $cmode); |
302 | 302 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | |
306 | 306 | public function publishSelected() { |
307 | 307 | $ids = explode(",", clean($_REQUEST["ids"])); |
308 | - $cmode = (int)clean($_REQUEST["cmode"]); |
|
308 | + $cmode = (int) clean($_REQUEST["cmode"]); |
|
309 | 309 | |
310 | 310 | $this->publishArticlesById($ids, $cmode); |
311 | 311 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | print "<ul>"; |
344 | 344 | while ($line = $sth->fetch()) { |
345 | - print "<li>" . $line["caption"] . "</li>"; |
|
345 | + print "<li>".$line["caption"]."</li>"; |
|
346 | 346 | } |
347 | 347 | print "</ul>"; |
348 | 348 | } |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | |
579 | 579 | if ($msg) { |
580 | 580 | Logger::get()->log_error(E_USER_WARNING, |
581 | - $msg, 'client-js:' . $file, $line, $context); |
|
581 | + $msg, 'client-js:'.$file, $line, $context); |
|
582 | 582 | |
583 | 583 | echo json_encode(array("message" => "HOST_ERROR_LOGGED")); |
584 | 584 | } else { |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | $content = json_decode($content, true); |
603 | 603 | |
604 | 604 | if ($content && isset($content["changeset"])) { |
605 | - if ($git_timestamp < (int)$content["changeset"]["timestamp"] && |
|
605 | + if ($git_timestamp < (int) $content["changeset"]["timestamp"] && |
|
606 | 606 | $git_commit != $content["changeset"]["id"]) { |
607 | 607 | |
608 | 608 | $rv = $content["changeset"]; |
@@ -11,7 +11,9 @@ discard block |
||
11 | 11 | $_SESSION["profile"] = (int) clean($_REQUEST["id"]); |
12 | 12 | |
13 | 13 | // default value |
14 | - if (!$_SESSION["profile"]) $_SESSION["profile"] = null; |
|
14 | + if (!$_SESSION["profile"]) { |
|
15 | + $_SESSION["profile"] = null; |
|
16 | + } |
|
15 | 17 | } |
16 | 18 | |
17 | 19 | public function remprofiles() { |
@@ -173,7 +175,9 @@ discard block |
||
173 | 175 | if ($row = $sth->fetch()) { |
174 | 176 | $feed_id = $row["id"]; |
175 | 177 | } else { |
176 | - if (!$title) $title = '[Unknown]'; |
|
178 | + if (!$title) { |
|
179 | + $title = '[Unknown]'; |
|
180 | + } |
|
177 | 181 | |
178 | 182 | $sth = $this->pdo->prepare("INSERT INTO ttrss_feeds |
179 | 183 | (owner_uid,feed_url,site_url,title,cat_id,auth_login,auth_pass,update_method) |
@@ -216,7 +220,9 @@ discard block |
||
216 | 220 | private function archive_article($id, $owner_uid) { |
217 | 221 | $this->pdo->beginTransaction(); |
218 | 222 | |
219 | - if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
|
223 | + if (!$owner_uid) { |
|
224 | + $owner_uid = $_SESSION['uid']; |
|
225 | + } |
|
220 | 226 | |
221 | 227 | $sth = $this->pdo->prepare("SELECT feed_id FROM ttrss_user_entries |
222 | 228 | WHERE ref_id = ? AND owner_uid = ?"); |
@@ -278,8 +284,9 @@ discard block |
||
278 | 284 | 'seq' => $seq |
279 | 285 | ]; |
280 | 286 | |
281 | - if ($seq % 2 == 0) |
|
282 | - $reply['runtime-info'] = make_runtime_info(); |
|
287 | + if ($seq % 2 == 0) { |
|
288 | + $reply['runtime-info'] = make_runtime_info(); |
|
289 | + } |
|
283 | 290 | |
284 | 291 | print json_encode($reply); |
285 | 292 | } |
@@ -353,7 +360,9 @@ discard block |
||
353 | 360 | $payload = json_decode(clean($_REQUEST["payload"]), false); |
354 | 361 | $mode = clean($_REQUEST["mode"]); |
355 | 362 | |
356 | - if (!$payload || !is_array($payload)) return; |
|
363 | + if (!$payload || !is_array($payload)) { |
|
364 | + return; |
|
365 | + } |
|
357 | 366 | |
358 | 367 | if ($mode == 1) { |
359 | 368 | foreach ($payload as $feed) { |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | $sth = $this->pdo->prepare("SELECT link FROM ttrss_entries, ttrss_user_entries |
14 | 14 | WHERE id = ? AND id = ref_id AND owner_uid = ? |
15 | 15 | LIMIT 1"); |
16 | - $sth->execute([$id, $_SESSION['uid']]); |
|
16 | + $sth->execute([$id, $_SESSION['uid']]); |
|
17 | 17 | |
18 | 18 | if ($row = $sth->fetch()) { |
19 | 19 | $article_url = $row['link']; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | $sth = $pdo->prepare("SELECT int_id FROM ttrss_user_entries WHERE |
78 | 78 | ref_id = ? AND owner_uid = ? LIMIT 1"); |
79 | - $sth->execute([$ref_id, $owner_uid]); |
|
79 | + $sth->execute([$ref_id, $owner_uid]); |
|
80 | 80 | |
81 | 81 | if ($row = $sth->fetch()) { |
82 | 82 | $int_id = $row['int_id']; |
@@ -616,22 +616,22 @@ discard block |
||
616 | 616 | |
617 | 617 | public static function purge_orphans() { |
618 | 618 | |
619 | - // purge orphaned posts in main content table |
|
619 | + // purge orphaned posts in main content table |
|
620 | 620 | |
621 | - if (DB_TYPE == "mysql") |
|
622 | - $limit_qpart = "LIMIT 5000"; |
|
623 | - else |
|
624 | - $limit_qpart = ""; |
|
621 | + if (DB_TYPE == "mysql") |
|
622 | + $limit_qpart = "LIMIT 5000"; |
|
623 | + else |
|
624 | + $limit_qpart = ""; |
|
625 | 625 | |
626 | - $pdo = Db::pdo(); |
|
627 | - $res = $pdo->query("DELETE FROM ttrss_entries WHERE |
|
626 | + $pdo = Db::pdo(); |
|
627 | + $res = $pdo->query("DELETE FROM ttrss_entries WHERE |
|
628 | 628 | NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id) $limit_qpart"); |
629 | 629 | |
630 | - if (Debug::enabled()) { |
|
631 | - $rows = $res->rowCount(); |
|
632 | - Debug::log("Purged $rows orphaned posts."); |
|
633 | - } |
|
634 | - } |
|
630 | + if (Debug::enabled()) { |
|
631 | + $rows = $res->rowCount(); |
|
632 | + Debug::log("Purged $rows orphaned posts."); |
|
633 | + } |
|
634 | + } |
|
635 | 635 | |
636 | 636 | public static function catchupArticlesById($ids, $cmode, $owner_uid = false) { |
637 | 637 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | public static function create_published_article($title, $url, $content, $labels_str, |
31 | 31 | $owner_uid) { |
32 | 32 | |
33 | - $guid = 'SHA1:' . sha1("ttshared:" . $url . $owner_uid); // include owner_uid to prevent global GUID clash |
|
33 | + $guid = 'SHA1:'.sha1("ttshared:".$url.$owner_uid); // include owner_uid to prevent global GUID clash |
|
34 | 34 | |
35 | 35 | if (!$content) { |
36 | 36 | $pluginhost = new PluginHost(); |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | content = ?, content_hash = ? WHERE id = ?"); |
86 | 86 | $sth->execute([$content, $content_hash, $ref_id]); |
87 | 87 | |
88 | - if (DB_TYPE == "pgsql"){ |
|
88 | + if (DB_TYPE == "pgsql") { |
|
89 | 89 | $sth = $pdo->prepare("UPDATE ttrss_entries |
90 | 90 | SET tsvector_combined = to_tsvector( :ts_content) |
91 | 91 | WHERE id = :id"); |
92 | 92 | $params = [ |
93 | - ":ts_content" => mb_substr(strip_tags($content ), 0, 900000), |
|
93 | + ":ts_content" => mb_substr(strip_tags($content), 0, 900000), |
|
94 | 94 | ":id" => $ref_id]; |
95 | 95 | $sth->execute($params); |
96 | 96 | } |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | |
131 | 131 | if ($row = $sth->fetch()) { |
132 | 132 | $ref_id = $row["id"]; |
133 | - if (DB_TYPE == "pgsql"){ |
|
133 | + if (DB_TYPE == "pgsql") { |
|
134 | 134 | $sth = $pdo->prepare("UPDATE ttrss_entries |
135 | 135 | SET tsvector_combined = to_tsvector( :ts_content) |
136 | 136 | WHERE id = :id"); |
137 | 137 | $params = [ |
138 | - ":ts_content" => mb_substr(strip_tags($content ), 0, 900000), |
|
138 | + ":ts_content" => mb_substr(strip_tags($content), 0, 900000), |
|
139 | 139 | ":id" => $ref_id]; |
140 | 140 | $sth->execute($params); |
141 | 141 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | print_hidden("op", "article"); |
174 | 174 | print_hidden("method", "setArticleTags"); |
175 | 175 | |
176 | - print "<header class='horizontal'>" . __("Tags for this article (separated by commas):")."</header>"; |
|
176 | + print "<header class='horizontal'>".__("Tags for this article (separated by commas):")."</header>"; |
|
177 | 177 | |
178 | 178 | print "<section>"; |
179 | 179 | print "<textarea dojoType='dijit.form.SimpleTextarea' rows='4' |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | |
195 | 195 | public function setScore() { |
196 | 196 | $ids = explode(",", clean($_REQUEST['id'])); |
197 | - $score = (int)clean($_REQUEST['score']); |
|
197 | + $score = (int) clean($_REQUEST['score']); |
|
198 | 198 | |
199 | 199 | $ids_qmarks = arr_qmarks($ids); |
200 | 200 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | $sth->execute(array_merge([$score], $ids, [$_SESSION['uid']])); |
205 | 205 | |
206 | - print json_encode(["id" => $ids, "score" => (int)$score]); |
|
206 | + print json_encode(["id" => $ids, "score" => (int) $score]); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | public function getScore() { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | $score = $row['score']; |
217 | 217 | |
218 | - print json_encode(["id" => $id, "score" => (int)$score]); |
|
218 | + print json_encode(["id" => $id, "score" => (int) $score]); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | |
294 | 294 | print "<ul>"; |
295 | 295 | while ($line = $sth->fetch()) { |
296 | - print "<li>" . $line["tag_name"] . "</li>"; |
|
296 | + print "<li>".$line["tag_name"]."</li>"; |
|
297 | 297 | } |
298 | 298 | print "</ul>"; |
299 | 299 | } |
@@ -432,21 +432,21 @@ discard block |
||
432 | 432 | if (!$hide_images) { |
433 | 433 | $encsize = ''; |
434 | 434 | if ($entry['height'] > 0) |
435 | - $encsize .= ' height="' . intval($entry['height']) . '"'; |
|
435 | + $encsize .= ' height="'.intval($entry['height']).'"'; |
|
436 | 436 | if ($entry['width'] > 0) |
437 | - $encsize .= ' width="' . intval($entry['width']) . '"'; |
|
437 | + $encsize .= ' width="'.intval($entry['width']).'"'; |
|
438 | 438 | $rv .= "<p><img |
439 | 439 | alt=\"".htmlspecialchars($entry["filename"])."\" |
440 | - src=\"" .htmlspecialchars($entry["url"]) . "\" |
|
441 | - " . $encsize . " /></p>"; |
|
440 | + src=\"" .htmlspecialchars($entry["url"])."\" |
|
441 | + " . $encsize." /></p>"; |
|
442 | 442 | } else { |
443 | 443 | $rv .= "<p><a target=\"_blank\" rel=\"noopener noreferrer\" |
444 | 444 | href=\"".htmlspecialchars($entry["url"])."\" |
445 | - >" .htmlspecialchars($entry["url"]) . "</a></p>"; |
|
445 | + >" .htmlspecialchars($entry["url"])."</a></p>"; |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | if ($entry['title']) { |
449 | - $rv.= "<div class=\"enclosure_title\">${entry['title']}</div>"; |
|
449 | + $rv .= "<div class=\"enclosure_title\">${entry['title']}</div>"; |
|
450 | 450 | } |
451 | 451 | } |
452 | 452 | } |
@@ -461,13 +461,13 @@ discard block |
||
461 | 461 | } |
462 | 462 | |
463 | 463 | $rv .= "<div class=\"attachments\" dojoType=\"fox.form.DropDownButton\">". |
464 | - "<span>" . __('Attachments')."</span>"; |
|
464 | + "<span>".__('Attachments')."</span>"; |
|
465 | 465 | |
466 | 466 | $rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
467 | 467 | |
468 | 468 | foreach ($entries as $entry) { |
469 | 469 | if ($entry["title"]) |
470 | - $title = " — " . truncate_string($entry["title"], 30); |
|
470 | + $title = " — ".truncate_string($entry["title"], 30); |
|
471 | 471 | else |
472 | 472 | $title = ""; |
473 | 473 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | $filename = ""; |
478 | 478 | |
479 | 479 | $rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")' |
480 | - dojoType=\"dijit.MenuItem\">".$filename . $title."</div>"; |
|
480 | + dojoType=\"dijit.MenuItem\">".$filename.$title."</div>"; |
|
481 | 481 | |
482 | 482 | }; |
483 | 483 | |
@@ -546,10 +546,10 @@ discard block |
||
546 | 546 | $tags_str = ""; |
547 | 547 | |
548 | 548 | for ($i = 0; $i < $maxtags; $i++) { |
549 | - $tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.open({feed:'".$tags[$i]."'})\">" . $tags[$i] . "</a>, "; |
|
549 | + $tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.open({feed:'".$tags[$i]."'})\">".$tags[$i]."</a>, "; |
|
550 | 550 | } |
551 | 551 | |
552 | - $tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2); |
|
552 | + $tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str) - 2); |
|
553 | 553 | |
554 | 554 | if (count($tags) > $maxtags) |
555 | 555 | $tags_str .= ", …"; |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | if (!$article_image && !$article_stream) { |
742 | 742 | $tmpdoc = new DOMDocument(); |
743 | 743 | |
744 | - if (@$tmpdoc->loadHTML('<?xml encoding="UTF-8">' . mb_substr($content, 0, 131070))) { |
|
744 | + if (@$tmpdoc->loadHTML('<?xml encoding="UTF-8">'.mb_substr($content, 0, 131070))) { |
|
745 | 745 | $tmpxpath = new DOMXPath($tmpdoc); |
746 | 746 | $elems = $tmpxpath->query('(//img[@src]|//video[@poster]|//iframe[contains(@src , "youtube.com/embed/")])'); |
747 | 747 | |
@@ -749,8 +749,8 @@ discard block |
||
749 | 749 | if ($e->nodeName == "iframe") { |
750 | 750 | $matches = []; |
751 | 751 | if (preg_match("/\/embed\/([\w-]+)/", $e->getAttribute("src"), $matches)) { |
752 | - $article_image = "https://img.youtube.com/vi/" . $matches[1] . "/hqdefault.jpg"; |
|
753 | - $article_stream = "https://youtu.be/" . $matches[1]; |
|
752 | + $article_image = "https://img.youtube.com/vi/".$matches[1]."/hqdefault.jpg"; |
|
753 | + $article_stream = "https://youtu.be/".$matches[1]; |
|
754 | 754 | break; |
755 | 755 | } |
756 | 756 | } else if ($e->nodeName == "video") { |
@@ -57,10 +57,16 @@ discard block |
||
57 | 57 | |
58 | 58 | $rc = false; |
59 | 59 | |
60 | - if (!$title) $title = $url; |
|
61 | - if (!$title && !$url) return false; |
|
60 | + if (!$title) { |
|
61 | + $title = $url; |
|
62 | + } |
|
63 | + if (!$title && !$url) { |
|
64 | + return false; |
|
65 | + } |
|
62 | 66 | |
63 | - if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) return false; |
|
67 | + if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) { |
|
68 | + return false; |
|
69 | + } |
|
64 | 70 | |
65 | 71 | $pdo = Db::pdo(); |
66 | 72 | |
@@ -271,7 +277,9 @@ discard block |
||
271 | 277 | $tags_str = $this->format_tags_string($tags); |
272 | 278 | $tags_str_full = join(", ", $tags); |
273 | 279 | |
274 | - if (!$tags_str_full) $tags_str_full = __("no tags"); |
|
280 | + if (!$tags_str_full) { |
|
281 | + $tags_str_full = __("no tags"); |
|
282 | + } |
|
275 | 283 | |
276 | 284 | print json_encode([ |
277 | 285 | "id" => (int) $id, |
@@ -320,10 +328,11 @@ discard block |
||
320 | 328 | |
321 | 329 | foreach ($ids as $id) { |
322 | 330 | |
323 | - if ($assign) |
|
324 | - Labels::add_article($id, $label, $_SESSION["uid"]); |
|
325 | - else |
|
326 | - Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
331 | + if ($assign) { |
|
332 | + Labels::add_article($id, $label, $_SESSION["uid"]); |
|
333 | + } else { |
|
334 | + Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
335 | + } |
|
327 | 336 | |
328 | 337 | $labels = $this->get_article_labels($id, $_SESSION["uid"]); |
329 | 338 | |
@@ -384,14 +393,18 @@ discard block |
||
384 | 393 | $width = $line["width"]; |
385 | 394 | $height = $line["height"]; |
386 | 395 | |
387 | - if (!$ctype) $ctype = __("unknown type"); |
|
396 | + if (!$ctype) { |
|
397 | + $ctype = __("unknown type"); |
|
398 | + } |
|
388 | 399 | |
389 | 400 | //$filename = substr($url, strrpos($url, "/")+1); |
390 | 401 | $filename = basename($url); |
391 | 402 | |
392 | 403 | $player = format_inline_player($url, $ctype); |
393 | 404 | |
394 | - if ($player) array_push($entries_inline, $player); |
|
405 | + if ($player) { |
|
406 | + array_push($entries_inline, $player); |
|
407 | + } |
|
395 | 408 | |
396 | 409 | # $entry .= " <a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\" rel=\"noopener noreferrer\">" . |
397 | 410 | # $filename . " (" . $ctype . ")" . "</a>"; |
@@ -419,8 +432,9 @@ discard block |
||
419 | 432 | |
420 | 433 | foreach ($entries as $entry) { |
421 | 434 | |
422 | - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin) |
|
423 | - $retval = $plugin->hook_render_enclosure($entry, $hide_images); |
|
435 | + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin) { |
|
436 | + $retval = $plugin->hook_render_enclosure($entry, $hide_images); |
|
437 | + } |
|
424 | 438 | |
425 | 439 | |
426 | 440 | if ($retval) { |
@@ -431,10 +445,12 @@ discard block |
||
431 | 445 | |
432 | 446 | if (!$hide_images) { |
433 | 447 | $encsize = ''; |
434 | - if ($entry['height'] > 0) |
|
435 | - $encsize .= ' height="' . intval($entry['height']) . '"'; |
|
436 | - if ($entry['width'] > 0) |
|
437 | - $encsize .= ' width="' . intval($entry['width']) . '"'; |
|
448 | + if ($entry['height'] > 0) { |
|
449 | + $encsize .= ' height="' . intval($entry['height']) . '"'; |
|
450 | + } |
|
451 | + if ($entry['width'] > 0) { |
|
452 | + $encsize .= ' width="' . intval($entry['width']) . '"'; |
|
453 | + } |
|
438 | 454 | $rv .= "<p><img |
439 | 455 | alt=\"".htmlspecialchars($entry["filename"])."\" |
440 | 456 | src=\"" .htmlspecialchars($entry["url"]) . "\" |
@@ -466,15 +482,17 @@ discard block |
||
466 | 482 | $rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
467 | 483 | |
468 | 484 | foreach ($entries as $entry) { |
469 | - if ($entry["title"]) |
|
470 | - $title = " — " . truncate_string($entry["title"], 30); |
|
471 | - else |
|
472 | - $title = ""; |
|
485 | + if ($entry["title"]) { |
|
486 | + $title = " — " . truncate_string($entry["title"], 30); |
|
487 | + } else { |
|
488 | + $title = ""; |
|
489 | + } |
|
473 | 490 | |
474 | - if ($entry["filename"]) |
|
475 | - $filename = truncate_middle(htmlspecialchars($entry["filename"]), 60); |
|
476 | - else |
|
477 | - $filename = ""; |
|
491 | + if ($entry["filename"]) { |
|
492 | + $filename = truncate_middle(htmlspecialchars($entry["filename"]), 60); |
|
493 | + } else { |
|
494 | + $filename = ""; |
|
495 | + } |
|
478 | 496 | |
479 | 497 | $rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")' |
480 | 498 | dojoType=\"dijit.MenuItem\">".$filename . $title."</div>"; |
@@ -492,7 +510,9 @@ discard block |
||
492 | 510 | |
493 | 511 | $a_id = $id; |
494 | 512 | |
495 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
513 | + if (!$owner_uid) { |
|
514 | + $owner_uid = $_SESSION["uid"]; |
|
515 | + } |
|
496 | 516 | |
497 | 517 | $pdo = Db::pdo(); |
498 | 518 | |
@@ -510,7 +530,9 @@ discard block |
||
510 | 530 | WHERE ref_id = ? AND owner_uid = ?"); |
511 | 531 | $csth->execute([$id, $owner_uid]); |
512 | 532 | |
513 | - if ($row = $csth->fetch()) $tag_cache = $row["tag_cache"]; |
|
533 | + if ($row = $csth->fetch()) { |
|
534 | + $tag_cache = $row["tag_cache"]; |
|
535 | + } |
|
514 | 536 | } |
515 | 537 | |
516 | 538 | if ($tag_cache) { |
@@ -551,8 +573,9 @@ discard block |
||
551 | 573 | |
552 | 574 | $tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2); |
553 | 575 | |
554 | - if (count($tags) > $maxtags) |
|
555 | - $tags_str .= ", …"; |
|
576 | + if (count($tags) > $maxtags) { |
|
577 | + $tags_str .= ", …"; |
|
578 | + } |
|
556 | 579 | |
557 | 580 | return $tags_str; |
558 | 581 | } |
@@ -560,7 +583,9 @@ discard block |
||
560 | 583 | |
561 | 584 | public static function format_article_labels($labels) { |
562 | 585 | |
563 | - if (!is_array($labels)) return ''; |
|
586 | + if (!is_array($labels)) { |
|
587 | + return ''; |
|
588 | + } |
|
564 | 589 | |
565 | 590 | $labels_str = ""; |
566 | 591 | |
@@ -618,10 +643,11 @@ discard block |
||
618 | 643 | |
619 | 644 | // purge orphaned posts in main content table |
620 | 645 | |
621 | - if (DB_TYPE == "mysql") |
|
622 | - $limit_qpart = "LIMIT 5000"; |
|
623 | - else |
|
624 | - $limit_qpart = ""; |
|
646 | + if (DB_TYPE == "mysql") { |
|
647 | + $limit_qpart = "LIMIT 5000"; |
|
648 | + } else { |
|
649 | + $limit_qpart = ""; |
|
650 | + } |
|
625 | 651 | |
626 | 652 | $pdo = Db::pdo(); |
627 | 653 | $res = $pdo->query("DELETE FROM ttrss_entries WHERE |
@@ -635,7 +661,9 @@ discard block |
||
635 | 661 | |
636 | 662 | public static function catchupArticlesById($ids, $cmode, $owner_uid = false) { |
637 | 663 | |
638 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
664 | + if (!$owner_uid) { |
|
665 | + $owner_uid = $_SESSION["uid"]; |
|
666 | + } |
|
639 | 667 | |
640 | 668 | $pdo = Db::pdo(); |
641 | 669 | |
@@ -685,7 +713,9 @@ discard block |
||
685 | 713 | public static function get_article_labels($id, $owner_uid = false) { |
686 | 714 | $rv = array(); |
687 | 715 | |
688 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
716 | + if (!$owner_uid) { |
|
717 | + $owner_uid = $_SESSION["uid"]; |
|
718 | + } |
|
689 | 719 | |
690 | 720 | $pdo = Db::pdo(); |
691 | 721 | |
@@ -699,10 +729,11 @@ discard block |
||
699 | 729 | if ($label_cache) { |
700 | 730 | $tmp = json_decode($label_cache, true); |
701 | 731 | |
702 | - if (!$tmp || $tmp["no-labels"] == 1) |
|
703 | - return $rv; |
|
704 | - else |
|
705 | - return $tmp; |
|
732 | + if (!$tmp || $tmp["no-labels"] == 1) { |
|
733 | + return $rv; |
|
734 | + } else { |
|
735 | + return $tmp; |
|
736 | + } |
|
706 | 737 | } |
707 | 738 | } |
708 | 739 | |
@@ -721,10 +752,11 @@ discard block |
||
721 | 752 | array_push($rv, $rk); |
722 | 753 | } |
723 | 754 | |
724 | - if (count($rv) > 0) |
|
725 | - Labels::update_cache($owner_uid, $id, $rv); |
|
726 | - else |
|
727 | - Labels::update_cache($owner_uid, $id, array("no-labels" => 1)); |
|
755 | + if (count($rv) > 0) { |
|
756 | + Labels::update_cache($owner_uid, $id, $rv); |
|
757 | + } else { |
|
758 | + Labels::update_cache($owner_uid, $id, array("no-labels" => 1)); |
|
759 | + } |
|
728 | 760 | |
729 | 761 | return $rv; |
730 | 762 | } |
@@ -772,28 +804,33 @@ discard block |
||
772 | 804 | } |
773 | 805 | } |
774 | 806 | |
775 | - if (!$article_image) |
|
776 | - foreach ($enclosures as $enc) { |
|
807 | + if (!$article_image) { |
|
808 | + foreach ($enclosures as $enc) { |
|
777 | 809 | if (strpos($enc["content_type"], "image/") !== FALSE) { |
778 | 810 | $article_image = $enc["content_url"]; |
811 | + } |
|
779 | 812 | break; |
780 | 813 | } |
781 | 814 | } |
782 | 815 | |
783 | - if ($article_image) |
|
784 | - $article_image = rewrite_relative_url($site_url, $article_image); |
|
816 | + if ($article_image) { |
|
817 | + $article_image = rewrite_relative_url($site_url, $article_image); |
|
818 | + } |
|
785 | 819 | |
786 | - if ($article_stream) |
|
787 | - $article_stream = rewrite_relative_url($site_url, $article_stream); |
|
820 | + if ($article_stream) { |
|
821 | + $article_stream = rewrite_relative_url($site_url, $article_stream); |
|
822 | + } |
|
788 | 823 | } |
789 | 824 | |
790 | 825 | $cache = new DiskCache("images"); |
791 | 826 | |
792 | - if ($article_image && $cache->exists(sha1($article_image))) |
|
793 | - $article_image = $cache->getUrl(sha1($article_image)); |
|
827 | + if ($article_image && $cache->exists(sha1($article_image))) { |
|
828 | + $article_image = $cache->getUrl(sha1($article_image)); |
|
829 | + } |
|
794 | 830 | |
795 | - if ($article_stream && $cache->exists(sha1($article_stream))) |
|
796 | - $article_stream = $cache->getUrl(sha1($article_stream)); |
|
831 | + if ($article_stream && $cache->exists(sha1($article_stream))) { |
|
832 | + $article_stream = $cache->getUrl(sha1($article_stream)); |
|
833 | + } |
|
797 | 834 | |
798 | 835 | return [$article_image, $article_stream]; |
799 | 836 | } |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | if (get_pref("ENABLE_API_ACCESS", $uid)) { |
77 | - if (authenticate_user($login, $password, false, Auth_Base::AUTH_SERVICE_API)) { // try login with normal password |
|
77 | + if (authenticate_user($login, $password, false, Auth_Base::AUTH_SERVICE_API)) { // try login with normal password |
|
78 | 78 | $this->wrap(self::STATUS_OK, array("session_id" => session_id(), |
79 | 79 | "api_level" => self::API_LEVEL)); |
80 | 80 | } else if (authenticate_user($login, $password_base64, false, Auth_Base::AUTH_SERVICE_API)) { // else try with base64_decoded password |
81 | - $this->wrap(self::STATUS_OK, array("session_id" => session_id(), |
|
81 | + $this->wrap(self::STATUS_OK, array("session_id" => session_id(), |
|
82 | 82 | "api_level" => self::API_LEVEL)); |
83 | 83 | } else { // else we are not logged in |
84 | 84 | user_error("Failed login attempt for $login from {$_SERVER['REMOTE_ADDR']}", E_USER_WARNING); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | - foreach (array(-2,-1,0) as $cat_id) { |
|
172 | + foreach (array(-2, -1, 0) as $cat_id) { |
|
173 | 173 | if ($include_empty || !$this->isCategoryEmpty($cat_id)) { |
174 | 174 | $unread = getFeedUnread($cat_id, true); |
175 | 175 | |
@@ -190,11 +190,11 @@ discard block |
||
190 | 190 | |
191 | 191 | if (is_numeric($feed_id)) $feed_id = (int) $feed_id; |
192 | 192 | |
193 | - $limit = (int)clean($_REQUEST["limit"]); |
|
193 | + $limit = (int) clean($_REQUEST["limit"]); |
|
194 | 194 | |
195 | 195 | if (!$limit || $limit >= 200) $limit = 200; |
196 | 196 | |
197 | - $offset = (int)clean($_REQUEST["skip"]); |
|
197 | + $offset = (int) clean($_REQUEST["skip"]); |
|
198 | 198 | $filter = clean($_REQUEST["filter"]); |
199 | 199 | $is_cat = API::param_to_bool(clean($_REQUEST["is_cat"])); |
200 | 200 | $show_excerpt = API::param_to_bool(clean($_REQUEST["show_excerpt"])); |
@@ -202,14 +202,14 @@ discard block |
||
202 | 202 | /* all_articles, unread, adaptive, marked, updated */ |
203 | 203 | $view_mode = clean($_REQUEST["view_mode"]); |
204 | 204 | $include_attachments = API::param_to_bool(clean($_REQUEST["include_attachments"])); |
205 | - $since_id = (int)clean($_REQUEST["since_id"]); |
|
205 | + $since_id = (int) clean($_REQUEST["since_id"]); |
|
206 | 206 | $include_nested = API::param_to_bool(clean($_REQUEST["include_nested"])); |
207 | 207 | $sanitize_content = !isset($_REQUEST["sanitize"]) || |
208 | 208 | API::param_to_bool($_REQUEST["sanitize"]); |
209 | 209 | $force_update = API::param_to_bool(clean($_REQUEST["force_update"])); |
210 | 210 | $has_sandbox = API::param_to_bool(clean($_REQUEST["has_sandbox"])); |
211 | - $excerpt_length = (int)clean($_REQUEST["excerpt_length"]); |
|
212 | - $check_first_id = (int)clean($_REQUEST["check_first_id"]); |
|
211 | + $excerpt_length = (int) clean($_REQUEST["excerpt_length"]); |
|
212 | + $check_first_id = (int) clean($_REQUEST["check_first_id"]); |
|
213 | 213 | $include_header = API::param_to_bool(clean($_REQUEST["include_header"])); |
214 | 214 | |
215 | 215 | $_SESSION['hasSandbox'] = $has_sandbox; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $article_ids = explode(",", clean($_REQUEST["article_ids"])); |
254 | 254 | $mode = (int) clean($_REQUEST["mode"]); |
255 | 255 | $data = clean($_REQUEST["data"]); |
256 | - $field_raw = (int)clean($_REQUEST["field"]); |
|
256 | + $field_raw = (int) clean($_REQUEST["field"]); |
|
257 | 257 | |
258 | 258 | $field = ""; |
259 | 259 | $set_to = ""; |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | "updated" => (int) strtotime($line["updated"]), |
361 | 361 | "feed_id" => $line["feed_id"], |
362 | 362 | "attachments" => $attachments, |
363 | - "score" => (int)$line["score"], |
|
363 | + "score" => (int) $line["score"], |
|
364 | 364 | "feed_title" => $line["feed_title"], |
365 | 365 | "note" => $line["note"], |
366 | 366 | "lang" => $line["lang"] |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | } |
435 | 435 | |
436 | 436 | public function getLabels() { |
437 | - $article_id = (int)clean($_REQUEST['article_id']); |
|
437 | + $article_id = (int) clean($_REQUEST['article_id']); |
|
438 | 438 | |
439 | 439 | $rv = array(); |
440 | 440 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | } |
460 | 460 | |
461 | 461 | array_push($rv, array( |
462 | - "id" => (int)Labels::label_to_feed_id($line['id']), |
|
462 | + "id" => (int) Labels::label_to_feed_id($line['id']), |
|
463 | 463 | "caption" => $line['caption'], |
464 | 464 | "fg_color" => $line['fg_color'], |
465 | 465 | "bg_color" => $line['bg_color'], |
@@ -644,10 +644,10 @@ discard block |
||
644 | 644 | $row = array( |
645 | 645 | "feed_url" => $line["feed_url"], |
646 | 646 | "title" => $line["title"], |
647 | - "id" => (int)$line["id"], |
|
648 | - "unread" => (int)$unread, |
|
647 | + "id" => (int) $line["id"], |
|
648 | + "unread" => (int) $unread, |
|
649 | 649 | "has_icon" => $has_icon, |
650 | - "cat_id" => (int)$line["cat_id"], |
|
650 | + "cat_id" => (int) $line["cat_id"], |
|
651 | 651 | "last_updated" => (int) strtotime($line["last_updated"]), |
652 | 652 | "order_id" => (int) $line["order_id"], |
653 | 653 | ); |
@@ -748,12 +748,12 @@ discard block |
||
748 | 748 | if (!is_array($labels)) $labels = Article::get_article_labels($line["id"]); |
749 | 749 | |
750 | 750 | $headline_row = array( |
751 | - "id" => (int)$line["id"], |
|
751 | + "id" => (int) $line["id"], |
|
752 | 752 | "guid" => $line["guid"], |
753 | 753 | "unread" => API::param_to_bool($line["unread"]), |
754 | 754 | "marked" => API::param_to_bool($line["marked"]), |
755 | 755 | "published" => API::param_to_bool($line["published"]), |
756 | - "updated" => (int)strtotime($line["updated"]), |
|
756 | + "updated" => (int) strtotime($line["updated"]), |
|
757 | 757 | "is_updated" => $is_updated, |
758 | 758 | "title" => $line["title"], |
759 | 759 | "link" => $line["link"], |
@@ -786,17 +786,16 @@ discard block |
||
786 | 786 | |
787 | 787 | $headline_row["labels"] = $labels; |
788 | 788 | |
789 | - $headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] : |
|
790 | - $feed_title; |
|
789 | + $headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] : $feed_title; |
|
791 | 790 | |
792 | - $headline_row["comments_count"] = (int)$line["num_comments"]; |
|
791 | + $headline_row["comments_count"] = (int) $line["num_comments"]; |
|
793 | 792 | $headline_row["comments_link"] = $line["comments"]; |
794 | 793 | |
795 | 794 | $headline_row["always_display_attachments"] = API::param_to_bool($line["always_display_enclosures"]); |
796 | 795 | |
797 | 796 | $headline_row["author"] = $line["author"]; |
798 | 797 | |
799 | - $headline_row["score"] = (int)$line["score"]; |
|
798 | + $headline_row["score"] = (int) $line["score"]; |
|
800 | 799 | $headline_row["note"] = $line["note"]; |
801 | 800 | $headline_row["lang"] = $line["lang"]; |
802 | 801 | |
@@ -858,7 +857,7 @@ discard block |
||
858 | 857 | $_REQUEST['mode'] = 2; |
859 | 858 | $_REQUEST['force_show_empty'] = $include_empty; |
860 | 859 | |
861 | - if ($pf){ |
|
860 | + if ($pf) { |
|
862 | 861 | $data = $pf->makefeedtree(); |
863 | 862 | $this->wrap(self::STATUS_OK, array("categories" => $data)); |
864 | 863 | } else { |
@@ -5,9 +5,9 @@ discard block |
||
5 | 5 | const NEVER_GROUP_FEEDS = [ -6, 0 ]; |
6 | 6 | const NEVER_GROUP_BY_DATE = [ -2, -1, -3 ]; |
7 | 7 | |
8 | - private $params; |
|
8 | + private $params; |
|
9 | 9 | |
10 | - function csrf_ignore($method) { |
|
10 | + function csrf_ignore($method) { |
|
11 | 11 | $csrf_ignored = array("index", "quickaddfeed", "search"); |
12 | 12 | |
13 | 13 | return array_search($method, $csrf_ignored) !== false; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | //$reply .= "<option value=\"catchupPage()\">".__('Mark as read')."</option>"; |
102 | 102 | |
103 | 103 | $reply .= "<option value=\"App.displayDlg('".__("Show as feed")."','generatedFeed', '$feed_id:$is_cat:$rss_link')\">". |
104 | - __('Show as feed')."</option>"; |
|
104 | + __('Show as feed')."</option>"; |
|
105 | 105 | |
106 | 106 | $reply .= "</select>"; |
107 | 107 | |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | $method_split = explode(":", $method); |
134 | 134 | |
135 | 135 | if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) { |
136 | - $sth = $this->pdo->prepare("UPDATE ttrss_feeds |
|
136 | + $sth = $this->pdo->prepare("UPDATE ttrss_feeds |
|
137 | 137 | SET last_updated = '1970-01-01', last_update_started = '1970-01-01' |
138 | 138 | WHERE id = ?"); |
139 | - $sth->execute([$feed]); |
|
139 | + $sth->execute([$feed]); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | if ($method_split[0] == "MarkAllReadGR") { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | "include_children" => $include_children, |
198 | 198 | "check_first_id" => $check_first_id, |
199 | 199 | "skip_first_id_check" => $skip_first_id_check, |
200 | - "order_by" => $order_by |
|
200 | + "order_by" => $order_by |
|
201 | 201 | ); |
202 | 202 | |
203 | 203 | $qfh_ret = $this->queryFeedHeadlines($params); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | $headlines_count = 0; |
237 | 237 | |
238 | - if (is_object($result)) { |
|
238 | + if (is_object($result)) { |
|
239 | 239 | while ($line = $result->fetch(PDO::FETCH_ASSOC)) { |
240 | 240 | |
241 | 241 | ++$headlines_count; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { |
249 | 249 | $line = $p->hook_query_headlines($line, 250, false); |
250 | 250 | } |
251 | - } |
|
251 | + } |
|
252 | 252 | |
253 | 253 | $id = $line["id"]; |
254 | 254 | |
@@ -295,53 +295,53 @@ discard block |
||
295 | 295 | |
296 | 296 | if (!$line["feed_title"]) $line["feed_title"] = ""; |
297 | 297 | |
298 | - $line["buttons_left"] = ""; |
|
299 | - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) { |
|
300 | - $line["buttons_left"] .= $p->hook_article_left_button($line); |
|
301 | - } |
|
298 | + $line["buttons_left"] = ""; |
|
299 | + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) { |
|
300 | + $line["buttons_left"] .= $p->hook_article_left_button($line); |
|
301 | + } |
|
302 | 302 | |
303 | - $line["buttons"] = ""; |
|
304 | - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_BUTTON) as $p) { |
|
305 | - $line["buttons"] .= $p->hook_article_button($line); |
|
306 | - } |
|
303 | + $line["buttons"] = ""; |
|
304 | + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_BUTTON) as $p) { |
|
305 | + $line["buttons"] .= $p->hook_article_button($line); |
|
306 | + } |
|
307 | 307 | |
308 | - $line["content"] = sanitize($line["content"], |
|
309 | - $line['hide_images'], false, $line["site_url"], $highlight_words, $line["id"]); |
|
308 | + $line["content"] = sanitize($line["content"], |
|
309 | + $line['hide_images'], false, $line["site_url"], $highlight_words, $line["id"]); |
|
310 | 310 | |
311 | - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_CDM) as $p) { |
|
312 | - $line = $p->hook_render_article_cdm($line); |
|
313 | - } |
|
311 | + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_CDM) as $p) { |
|
312 | + $line = $p->hook_render_article_cdm($line); |
|
313 | + } |
|
314 | 314 | |
315 | - $line['content'] = DiskCache::rewriteUrls($line['content']); |
|
315 | + $line['content'] = DiskCache::rewriteUrls($line['content']); |
|
316 | 316 | |
317 | - if ($line['note']) |
|
318 | - $line['note'] = Article::format_article_note($id, $line['note']); |
|
319 | - else |
|
320 | - $line['note'] = ""; |
|
317 | + if ($line['note']) |
|
318 | + $line['note'] = Article::format_article_note($id, $line['note']); |
|
319 | + else |
|
320 | + $line['note'] = ""; |
|
321 | 321 | |
322 | - if (!get_pref("CDM_EXPANDED")) { |
|
323 | - $line["cdm_excerpt"] = "<span class='collapse'> |
|
322 | + if (!get_pref("CDM_EXPANDED")) { |
|
323 | + $line["cdm_excerpt"] = "<span class='collapse'> |
|
324 | 324 | <i class='material-icons' onclick='return Article.cdmUnsetActive(event)' |
325 | 325 | title=\"" . __("Collapse article") . "\">remove_circle</i></span>"; |
326 | 326 | |
327 | - if (get_pref('SHOW_CONTENT_PREVIEW')) { |
|
328 | - $line["cdm_excerpt"] .= "<span class='excerpt'>" . $line["content_preview"] . "</span>"; |
|
329 | - } |
|
330 | - } |
|
327 | + if (get_pref('SHOW_CONTENT_PREVIEW')) { |
|
328 | + $line["cdm_excerpt"] .= "<span class='excerpt'>" . $line["content_preview"] . "</span>"; |
|
329 | + } |
|
330 | + } |
|
331 | 331 | |
332 | - $line["enclosures"] = Article::format_article_enclosures($id, $line["always_display_enclosures"], |
|
333 | - $line["content"], $line["hide_images"]); |
|
332 | + $line["enclosures"] = Article::format_article_enclosures($id, $line["always_display_enclosures"], |
|
333 | + $line["content"], $line["hide_images"]); |
|
334 | 334 | |
335 | - if ($line["orig_feed_id"]) { |
|
335 | + if ($line["orig_feed_id"]) { |
|
336 | 336 | |
337 | - $ofgh = $this->pdo->prepare("SELECT * FROM ttrss_archived_feeds |
|
337 | + $ofgh = $this->pdo->prepare("SELECT * FROM ttrss_archived_feeds |
|
338 | 338 | WHERE id = ? AND owner_uid = ?"); |
339 | - $ofgh->execute([$line["orig_feed_id"], $_SESSION['uid']]); |
|
339 | + $ofgh->execute([$line["orig_feed_id"], $_SESSION['uid']]); |
|
340 | 340 | |
341 | - if ($tmp_line = $ofgh->fetch()) { |
|
342 | - $line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ]; |
|
343 | - } |
|
344 | - } |
|
341 | + if ($tmp_line = $ofgh->fetch()) { |
|
342 | + $line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ]; |
|
343 | + } |
|
344 | + } |
|
345 | 345 | |
346 | 346 | $line["updated_long"] = make_local_datetime($line["updated"],true); |
347 | 347 | $line["updated"] = make_local_datetime($line["updated"], false, false, false, true); |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $line['feed_icon'] = "<i class='icon-no-feed material-icons'>rss_feed</i>"; |
364 | 364 | } |
365 | 365 | |
366 | - //setting feed headline background color, needs to change text color based on dark/light |
|
366 | + //setting feed headline background color, needs to change text color based on dark/light |
|
367 | 367 | $fav_color = $line['favicon_avg_color']; |
368 | 368 | |
369 | 369 | require_once "colors.php"; |
@@ -377,18 +377,18 @@ discard block |
||
377 | 377 | } |
378 | 378 | |
379 | 379 | if (isset($rgba_cache[$feed_id])) { |
380 | - $line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)'; |
|
381 | - } |
|
380 | + $line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)'; |
|
381 | + } |
|
382 | 382 | |
383 | 383 | /* we don't need those */ |
384 | 384 | |
385 | - foreach (["date_entered", "guid", "last_published", "last_marked", "tag_cache", "favicon_avg_color", |
|
386 | - "uuid", "label_cache", "yyiw"] as $k) |
|
387 | - unset($line[$k]); |
|
385 | + foreach (["date_entered", "guid", "last_published", "last_marked", "tag_cache", "favicon_avg_color", |
|
386 | + "uuid", "label_cache", "yyiw"] as $k) |
|
387 | + unset($line[$k]); |
|
388 | 388 | |
389 | 389 | array_push($reply['content'], $line); |
390 | 390 | } |
391 | - } |
|
391 | + } |
|
392 | 392 | |
393 | 393 | if (!$headlines_count) { |
394 | 394 | |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | $reply['headlines']['is_cat'] = (bool) $cat_view; |
571 | 571 | |
572 | 572 | $reply['headlines-info'] = ["count" => (int) $headlines_count, |
573 | - "disable_cache" => (bool) $disable_cache]; |
|
573 | + "disable_cache" => (bool) $disable_cache]; |
|
574 | 574 | |
575 | 575 | // this is parsed by handleRpcJson() on first viewfeed() to set cdm expanded, etc |
576 | 576 | $reply['runtime-info'] = make_runtime_info(); |
@@ -578,9 +578,9 @@ discard block |
||
578 | 578 | $reply_json = json_encode($reply); |
579 | 579 | |
580 | 580 | if (!$reply_json) { |
581 | - $reply_json = json_encode(["error" => ["code" => 15, |
|
582 | - "message" => json_last_error_msg()]]); |
|
583 | - } |
|
581 | + $reply_json = json_encode(["error" => ["code" => 15, |
|
582 | + "message" => json_last_error_msg()]]); |
|
583 | + } |
|
584 | 584 | |
585 | 585 | print $reply_json; |
586 | 586 | |
@@ -780,9 +780,9 @@ discard block |
||
780 | 780 | $sth->execute([$feed_id, $_SESSION['uid']]); |
781 | 781 | |
782 | 782 | if (!$sth->fetch()) { |
783 | - print "Access denied."; |
|
784 | - return; |
|
785 | - } |
|
783 | + print "Access denied."; |
|
784 | + return; |
|
785 | + } |
|
786 | 786 | |
787 | 787 | $refetch_checked = isset($_REQUEST["force_refetch"]) ? "checked" : ""; |
788 | 788 | $rehash_checked = isset($_REQUEST["force_rehash"]) ? "checked" : ""; |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | } else { |
1231 | 1231 | $icon = self::getIconFile($id); |
1232 | 1232 | |
1233 | - if ($icon && file_exists($icon)) { |
|
1233 | + if ($icon && file_exists($icon)) { |
|
1234 | 1234 | return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); |
1235 | 1235 | } |
1236 | 1236 | } |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | public static function getFeedTitle($id, $cat = false) { |
1243 | - $pdo = Db::pdo(); |
|
1243 | + $pdo = Db::pdo(); |
|
1244 | 1244 | |
1245 | 1245 | if ($cat) { |
1246 | 1246 | return Feeds::getCategoryTitle($id); |
@@ -1271,10 +1271,10 @@ discard block |
||
1271 | 1271 | |
1272 | 1272 | } else if (is_numeric($id) && $id > 0) { |
1273 | 1273 | |
1274 | - $sth = $pdo->prepare("SELECT title FROM ttrss_feeds WHERE id = ?"); |
|
1275 | - $sth->execute([$id]); |
|
1274 | + $sth = $pdo->prepare("SELECT title FROM ttrss_feeds WHERE id = ?"); |
|
1275 | + $sth->execute([$id]); |
|
1276 | 1276 | |
1277 | - if ($row = $sth->fetch()) { |
|
1277 | + if ($row = $sth->fetch()) { |
|
1278 | 1278 | return $row["title"]; |
1279 | 1279 | } else { |
1280 | 1280 | return "Unknown feed ($id)"; |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | |
1294 | 1294 | if ($cat >= 0) { |
1295 | 1295 | |
1296 | - if (!$cat) $cat = null; |
|
1296 | + if (!$cat) $cat = null; |
|
1297 | 1297 | |
1298 | 1298 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds |
1299 | 1299 | WHERE (cat_id = :cat OR (:cat IS NULL AND cat_id IS NULL)) |
@@ -1333,7 +1333,7 @@ discard block |
||
1333 | 1333 | WHERE article_id = ref_id AND unread = true |
1334 | 1334 | AND ttrss_user_entries.owner_uid = ?"); |
1335 | 1335 | $sth->execute([$owner_uid]); |
1336 | - $row = $sth->fetch(); |
|
1336 | + $row = $sth->fetch(); |
|
1337 | 1337 | |
1338 | 1338 | return $row["unread"]; |
1339 | 1339 | } |
@@ -1381,7 +1381,7 @@ discard block |
||
1381 | 1381 | return __("Labels"); |
1382 | 1382 | } else { |
1383 | 1383 | |
1384 | - $pdo = Db::pdo(); |
|
1384 | + $pdo = Db::pdo(); |
|
1385 | 1385 | |
1386 | 1386 | $sth = $pdo->prepare("SELECT title FROM ttrss_feed_categories WHERE |
1387 | 1387 | id = ?"); |
@@ -1417,7 +1417,7 @@ discard block |
||
1417 | 1417 | $pdo = Db::pdo(); |
1418 | 1418 | |
1419 | 1419 | // WARNING: due to highly dynamic nature of this query its going to quote parameters |
1420 | - // right before adding them to SQL part |
|
1420 | + // right before adding them to SQL part |
|
1421 | 1421 | |
1422 | 1422 | $feed = $params["feed"]; |
1423 | 1423 | $limit = isset($params["limit"]) ? $params["limit"] : 30; |
@@ -1661,7 +1661,7 @@ discard block |
||
1661 | 1661 | $ssth = $pdo->prepare("SELECT title,site_url,last_error,last_updated |
1662 | 1662 | FROM ttrss_feeds WHERE id = ? AND owner_uid = ?"); |
1663 | 1663 | $ssth->execute([$feed, $owner_uid]); |
1664 | - $row = $ssth->fetch(); |
|
1664 | + $row = $ssth->fetch(); |
|
1665 | 1665 | |
1666 | 1666 | $feed_title = $row["title"]; |
1667 | 1667 | $feed_site_url = $row["site_url"]; |
@@ -1899,9 +1899,9 @@ discard block |
||
1899 | 1899 | public static function getFeedCategory($feed) { |
1900 | 1900 | $pdo = Db::pdo(); |
1901 | 1901 | |
1902 | - $sth = $pdo->prepare("SELECT cat_id FROM ttrss_feeds |
|
1902 | + $sth = $pdo->prepare("SELECT cat_id FROM ttrss_feeds |
|
1903 | 1903 | WHERE id = ?"); |
1904 | - $sth->execute([$feed]); |
|
1904 | + $sth->execute([$feed]); |
|
1905 | 1905 | |
1906 | 1906 | if ($row = $sth->fetch()) { |
1907 | 1907 | return $row["cat_id"]; |
@@ -1911,20 +1911,20 @@ discard block |
||
1911 | 1911 | |
1912 | 1912 | } |
1913 | 1913 | |
1914 | - function color_of($name) { |
|
1915 | - $colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b", |
|
1916 | - "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416", |
|
1917 | - "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ]; |
|
1914 | + function color_of($name) { |
|
1915 | + $colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b", |
|
1916 | + "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416", |
|
1917 | + "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ]; |
|
1918 | 1918 | |
1919 | - $sum = 0; |
|
1919 | + $sum = 0; |
|
1920 | 1920 | |
1921 | - for ($i = 0; $i < strlen($name); $i++) { |
|
1922 | - $sum += ord($name[$i]); |
|
1923 | - } |
|
1921 | + for ($i = 0; $i < strlen($name); $i++) { |
|
1922 | + $sum += ord($name[$i]); |
|
1923 | + } |
|
1924 | 1924 | |
1925 | - $sum %= count($colormap); |
|
1925 | + $sum %= count($colormap); |
|
1926 | 1926 | |
1927 | - return $colormap[$sum]; |
|
1927 | + return $colormap[$sum]; |
|
1928 | 1928 | } |
1929 | 1929 | |
1930 | 1930 | public static function get_feeds_from_html($url, $content) { |
@@ -398,21 +398,21 @@ discard block |
||
398 | 398 | $message = $query_error_override; |
399 | 399 | } else { |
400 | 400 | switch ($view_mode) { |
401 | - case "unread": |
|
402 | - $message = __("No unread articles found to display."); |
|
403 | - break; |
|
404 | - case "updated": |
|
405 | - $message = __("No updated articles found to display."); |
|
406 | - break; |
|
407 | - case "marked": |
|
408 | - $message = __("No starred articles found to display."); |
|
409 | - break; |
|
410 | - default: |
|
411 | - if ($feed < LABEL_BASE_INDEX) { |
|
412 | - $message = __("No articles found to display. You can assign articles to labels manually from article header context menu (applies to all selected articles) or use a filter."); |
|
413 | - } else { |
|
414 | - $message = __("No articles found to display."); |
|
415 | - } |
|
401 | + case "unread": |
|
402 | + $message = __("No unread articles found to display."); |
|
403 | + break; |
|
404 | + case "updated": |
|
405 | + $message = __("No updated articles found to display."); |
|
406 | + break; |
|
407 | + case "marked": |
|
408 | + $message = __("No starred articles found to display."); |
|
409 | + break; |
|
410 | + default: |
|
411 | + if ($feed < LABEL_BASE_INDEX) { |
|
412 | + $message = __("No articles found to display. You can assign articles to labels manually from article header context menu (applies to all selected articles) or use a filter."); |
|
413 | + } else { |
|
414 | + $message = __("No articles found to display."); |
|
415 | + } |
|
416 | 416 | } |
417 | 417 | } |
418 | 418 | |
@@ -874,29 +874,29 @@ discard block |
||
874 | 874 | // TODO: all this interval stuff needs some generic generator function |
875 | 875 | |
876 | 876 | switch ($mode) { |
877 | - case "1day": |
|
878 | - if (DB_TYPE == "pgsql") { |
|
879 | - $date_qpart = "date_entered < NOW() - INTERVAL '1 day' "; |
|
880 | - } else { |
|
881 | - $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 DAY) "; |
|
882 | - } |
|
883 | - break; |
|
884 | - case "1week": |
|
885 | - if (DB_TYPE == "pgsql") { |
|
886 | - $date_qpart = "date_entered < NOW() - INTERVAL '1 week' "; |
|
887 | - } else { |
|
888 | - $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 WEEK) "; |
|
889 | - } |
|
890 | - break; |
|
891 | - case "2week": |
|
892 | - if (DB_TYPE == "pgsql") { |
|
893 | - $date_qpart = "date_entered < NOW() - INTERVAL '2 week' "; |
|
894 | - } else { |
|
895 | - $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 2 WEEK) "; |
|
896 | - } |
|
897 | - break; |
|
898 | - default: |
|
899 | - $date_qpart = "true"; |
|
877 | + case "1day": |
|
878 | + if (DB_TYPE == "pgsql") { |
|
879 | + $date_qpart = "date_entered < NOW() - INTERVAL '1 day' "; |
|
880 | + } else { |
|
881 | + $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 DAY) "; |
|
882 | + } |
|
883 | + break; |
|
884 | + case "1week": |
|
885 | + if (DB_TYPE == "pgsql") { |
|
886 | + $date_qpart = "date_entered < NOW() - INTERVAL '1 week' "; |
|
887 | + } else { |
|
888 | + $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 WEEK) "; |
|
889 | + } |
|
890 | + break; |
|
891 | + case "2week": |
|
892 | + if (DB_TYPE == "pgsql") { |
|
893 | + $date_qpart = "date_entered < NOW() - INTERVAL '2 week' "; |
|
894 | + } else { |
|
895 | + $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 2 WEEK) "; |
|
896 | + } |
|
897 | + break; |
|
898 | + default: |
|
899 | + $date_qpart = "true"; |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | if (is_numeric($feed)) { |
@@ -1212,28 +1212,28 @@ discard block |
||
1212 | 1212 | |
1213 | 1213 | public static function getFeedIcon($id) { |
1214 | 1214 | switch ($id) { |
1215 | - case 0: |
|
1216 | - return "archive"; |
|
1217 | - case -1: |
|
1218 | - return "star"; |
|
1219 | - case -2: |
|
1220 | - return "rss_feed"; |
|
1221 | - case -3: |
|
1222 | - return "whatshot"; |
|
1223 | - case -4: |
|
1224 | - return "inbox"; |
|
1225 | - case -6: |
|
1226 | - return "restore"; |
|
1227 | - default: |
|
1228 | - if ($id < LABEL_BASE_INDEX) { |
|
1229 | - return "label"; |
|
1230 | - } else { |
|
1231 | - $icon = self::getIconFile($id); |
|
1215 | + case 0: |
|
1216 | + return "archive"; |
|
1217 | + case -1: |
|
1218 | + return "star"; |
|
1219 | + case -2: |
|
1220 | + return "rss_feed"; |
|
1221 | + case -3: |
|
1222 | + return "whatshot"; |
|
1223 | + case -4: |
|
1224 | + return "inbox"; |
|
1225 | + case -6: |
|
1226 | + return "restore"; |
|
1227 | + default: |
|
1228 | + if ($id < LABEL_BASE_INDEX) { |
|
1229 | + return "label"; |
|
1230 | + } else { |
|
1231 | + $icon = self::getIconFile($id); |
|
1232 | 1232 | |
1233 | 1233 | if ($icon && file_exists($icon)) { |
1234 | - return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); |
|
1235 | - } |
|
1234 | + return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); |
|
1236 | 1235 | } |
1236 | + } |
|
1237 | 1237 | } |
1238 | 1238 | |
1239 | 1239 | return false; |
@@ -2201,102 +2201,102 @@ discard block |
||
2201 | 2201 | $commandpair = explode(":", mb_strtolower($k), 2); |
2202 | 2202 | |
2203 | 2203 | switch ($commandpair[0]) { |
2204 | - case "title": |
|
2205 | - if ($commandpair[1]) { |
|
2206 | - array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ". |
|
2207 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%') ."))"); |
|
2208 | - } else { |
|
2209 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2204 | + case "title": |
|
2205 | + if ($commandpair[1]) { |
|
2206 | + array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ". |
|
2207 | + $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%') ."))"); |
|
2208 | + } else { |
|
2209 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2210 | 2210 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2211 | - array_push($search_words, $k); |
|
2212 | - } |
|
2213 | - break; |
|
2214 | - case "author": |
|
2215 | - if ($commandpair[1]) { |
|
2216 | - array_push($query_keywords, "($not (LOWER(author) LIKE ". |
|
2217 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
2218 | - } else { |
|
2219 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2211 | + array_push($search_words, $k); |
|
2212 | + } |
|
2213 | + break; |
|
2214 | + case "author": |
|
2215 | + if ($commandpair[1]) { |
|
2216 | + array_push($query_keywords, "($not (LOWER(author) LIKE ". |
|
2217 | + $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
2218 | + } else { |
|
2219 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2220 | 2220 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2221 | - array_push($search_words, $k); |
|
2222 | - } |
|
2223 | - break; |
|
2224 | - case "note": |
|
2225 | - if ($commandpair[1]) { |
|
2226 | - if ($commandpair[1] == "true") |
|
2227 | - array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
2228 | - else if ($commandpair[1] == "false") |
|
2229 | - array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
2230 | - else |
|
2231 | - array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
2232 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
2233 | - } else { |
|
2234 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2221 | + array_push($search_words, $k); |
|
2222 | + } |
|
2223 | + break; |
|
2224 | + case "note": |
|
2225 | + if ($commandpair[1]) { |
|
2226 | + if ($commandpair[1] == "true") |
|
2227 | + array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
2228 | + else if ($commandpair[1] == "false") |
|
2229 | + array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
2230 | + else |
|
2231 | + array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
2232 | + $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
2233 | + } else { |
|
2234 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2235 | 2235 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2236 | - if (!$not) array_push($search_words, $k); |
|
2237 | - } |
|
2238 | - break; |
|
2239 | - case "star": |
|
2236 | + if (!$not) array_push($search_words, $k); |
|
2237 | + } |
|
2238 | + break; |
|
2239 | + case "star": |
|
2240 | 2240 | |
2241 | - if ($commandpair[1]) { |
|
2242 | - if ($commandpair[1] == "true") |
|
2243 | - array_push($query_keywords, "($not (marked = true))"); |
|
2244 | - else |
|
2245 | - array_push($query_keywords, "($not (marked = false))"); |
|
2246 | - } else { |
|
2247 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2241 | + if ($commandpair[1]) { |
|
2242 | + if ($commandpair[1] == "true") |
|
2243 | + array_push($query_keywords, "($not (marked = true))"); |
|
2244 | + else |
|
2245 | + array_push($query_keywords, "($not (marked = false))"); |
|
2246 | + } else { |
|
2247 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2248 | 2248 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2249 | - if (!$not) array_push($search_words, $k); |
|
2250 | - } |
|
2251 | - break; |
|
2252 | - case "pub": |
|
2253 | - if ($commandpair[1]) { |
|
2254 | - if ($commandpair[1] == "true") |
|
2255 | - array_push($query_keywords, "($not (published = true))"); |
|
2256 | - else |
|
2257 | - array_push($query_keywords, "($not (published = false))"); |
|
2249 | + if (!$not) array_push($search_words, $k); |
|
2250 | + } |
|
2251 | + break; |
|
2252 | + case "pub": |
|
2253 | + if ($commandpair[1]) { |
|
2254 | + if ($commandpair[1] == "true") |
|
2255 | + array_push($query_keywords, "($not (published = true))"); |
|
2256 | + else |
|
2257 | + array_push($query_keywords, "($not (published = false))"); |
|
2258 | 2258 | |
2259 | - } else { |
|
2260 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2259 | + } else { |
|
2260 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2261 | 2261 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2262 | - if (!$not) array_push($search_words, $k); |
|
2263 | - } |
|
2264 | - break; |
|
2265 | - case "unread": |
|
2266 | - if ($commandpair[1]) { |
|
2267 | - if ($commandpair[1] == "true") |
|
2268 | - array_push($query_keywords, "($not (unread = true))"); |
|
2269 | - else |
|
2270 | - array_push($query_keywords, "($not (unread = false))"); |
|
2262 | + if (!$not) array_push($search_words, $k); |
|
2263 | + } |
|
2264 | + break; |
|
2265 | + case "unread": |
|
2266 | + if ($commandpair[1]) { |
|
2267 | + if ($commandpair[1] == "true") |
|
2268 | + array_push($query_keywords, "($not (unread = true))"); |
|
2269 | + else |
|
2270 | + array_push($query_keywords, "($not (unread = false))"); |
|
2271 | 2271 | |
2272 | - } else { |
|
2273 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2272 | + } else { |
|
2273 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2274 | 2274 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2275 | - if (!$not) array_push($search_words, $k); |
|
2276 | - } |
|
2277 | - break; |
|
2278 | - default: |
|
2279 | - if (strpos($k, "@") === 0) { |
|
2275 | + if (!$not) array_push($search_words, $k); |
|
2276 | + } |
|
2277 | + break; |
|
2278 | + default: |
|
2279 | + if (strpos($k, "@") === 0) { |
|
2280 | 2280 | |
2281 | - $user_tz_string = get_pref('USER_TIMEZONE', $_SESSION['uid']); |
|
2282 | - $orig_ts = strtotime(substr($k, 1)); |
|
2283 | - $k = date("Y-m-d", convert_timestamp($orig_ts, $user_tz_string, 'UTC')); |
|
2281 | + $user_tz_string = get_pref('USER_TIMEZONE', $_SESSION['uid']); |
|
2282 | + $orig_ts = strtotime(substr($k, 1)); |
|
2283 | + $k = date("Y-m-d", convert_timestamp($orig_ts, $user_tz_string, 'UTC')); |
|
2284 | 2284 | |
2285 | - //$k = date("Y-m-d", strtotime(substr($k, 1))); |
|
2285 | + //$k = date("Y-m-d", strtotime(substr($k, 1))); |
|
2286 | 2286 | |
2287 | - array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH('$k')) $not = '$k')"); |
|
2288 | - } else { |
|
2287 | + array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH('$k')) $not = '$k')"); |
|
2288 | + } else { |
|
2289 | 2289 | |
2290 | - if (DB_TYPE == "pgsql") { |
|
2291 | - $k = mb_strtolower($k); |
|
2292 | - array_push($search_query_leftover, $not ? "!$k" : $k); |
|
2293 | - } else { |
|
2294 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2290 | + if (DB_TYPE == "pgsql") { |
|
2291 | + $k = mb_strtolower($k); |
|
2292 | + array_push($search_query_leftover, $not ? "!$k" : $k); |
|
2293 | + } else { |
|
2294 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2295 | 2295 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2296 | - } |
|
2297 | - |
|
2298 | - if (!$not) array_push($search_words, $k); |
|
2299 | 2296 | } |
2297 | + |
|
2298 | + if (!$not) array_push($search_words, $k); |
|
2299 | + } |
|
2300 | 2300 | } |
2301 | 2301 | } |
2302 | 2302 |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | require_once "colors.php"; |
3 | 3 | |
4 | 4 | class Feeds extends Handler_Protected { |
5 | - const NEVER_GROUP_FEEDS = [ -6, 0 ]; |
|
6 | - const NEVER_GROUP_BY_DATE = [ -2, -1, -3 ]; |
|
5 | + const NEVER_GROUP_FEEDS = [ -6, 0]; |
|
6 | + const NEVER_GROUP_BY_DATE = [ -2, -1, -3]; |
|
7 | 7 | |
8 | 8 | private $params; |
9 | 9 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | $reply = ""; |
29 | 29 | |
30 | - $rss_link = htmlspecialchars(get_self_url_prefix() . |
|
30 | + $rss_link = htmlspecialchars(get_self_url_prefix(). |
|
31 | 31 | "/public.php?op=rss&id=$feed_id$cat_q$search_q"); |
32 | 32 | |
33 | 33 | $reply .= "<span class='left'>"; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | if ($error) |
52 | - $reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>"; |
|
52 | + $reply .= " <i title=\"".htmlspecialchars($error)."\" class='material-icons icon-error'>error</i>"; |
|
53 | 53 | |
54 | 54 | $reply .= "</span>"; |
55 | 55 | $reply .= "<span id='feed_current_unread' style='display: none'></span>"; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $sth->execute([$feed]); |
140 | 140 | } |
141 | 141 | |
142 | - if ($method_split[0] == "MarkAllReadGR") { |
|
142 | + if ($method_split[0] == "MarkAllReadGR") { |
|
143 | 143 | $this->catchup_feed($method_split[1], false); |
144 | 144 | } |
145 | 145 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | if (!get_pref('SHOW_CONTENT_PREVIEW')) { |
244 | 244 | $line["content_preview"] = ""; |
245 | 245 | } else { |
246 | - $line["content_preview"] = "— " . truncate_string(strip_tags($line["content"]), 250); |
|
246 | + $line["content_preview"] = "— ".truncate_string(strip_tags($line["content"]), 250); |
|
247 | 247 | |
248 | 248 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { |
249 | 249 | $line = $p->hook_query_headlines($line, 250, false); |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | if (!get_pref("CDM_EXPANDED")) { |
323 | 323 | $line["cdm_excerpt"] = "<span class='collapse'> |
324 | 324 | <i class='material-icons' onclick='return Article.cdmUnsetActive(event)' |
325 | - title=\"" . __("Collapse article") . "\">remove_circle</i></span>"; |
|
325 | + title=\"" . __("Collapse article")."\">remove_circle</i></span>"; |
|
326 | 326 | |
327 | 327 | if (get_pref('SHOW_CONTENT_PREVIEW')) { |
328 | - $line["cdm_excerpt"] .= "<span class='excerpt'>" . $line["content_preview"] . "</span>"; |
|
328 | + $line["cdm_excerpt"] .= "<span class='excerpt'>".$line["content_preview"]."</span>"; |
|
329 | 329 | } |
330 | 330 | } |
331 | 331 | |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | $ofgh->execute([$line["orig_feed_id"], $_SESSION['uid']]); |
340 | 340 | |
341 | 341 | if ($tmp_line = $ofgh->fetch()) { |
342 | - $line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ]; |
|
342 | + $line["orig_feed"] = [$tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"]]; |
|
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
346 | - $line["updated_long"] = make_local_datetime($line["updated"],true); |
|
346 | + $line["updated_long"] = make_local_datetime($line["updated"], true); |
|
347 | 347 | $line["updated"] = make_local_datetime($line["updated"], false, false, false, true); |
348 | 348 | |
349 | 349 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | } |
378 | 378 | |
379 | 379 | if (isset($rgba_cache[$feed_id])) { |
380 | - $line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)'; |
|
380 | + $line['feed_bg_color'] = 'rgba('.implode(",", $rgba_cache[$feed_id]).',0.3)'; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | /* we don't need those */ |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | |
422 | 422 | $reply['content'] .= "<p><span class=\"text-muted\">"; |
423 | 423 | |
424 | - $sth = $this->pdo->prepare("SELECT " . SUBSTRING_FOR_DATE . "(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds |
|
424 | + $sth = $this->pdo->prepare("SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds |
|
425 | 425 | WHERE owner_uid = ?"); |
426 | 426 | $sth->execute([$_SESSION['uid']]); |
427 | 427 | $row = $sth->fetch(); |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | |
440 | 440 | if ($num_errors > 0) { |
441 | 441 | $reply['content'] .= "<br/>"; |
442 | - $reply['content'] .= "<a class=\"text-muted\" href=\"#\" onclick=\"CommonDialogs.showFeedsWithErrors()\">" . |
|
443 | - __('Some feeds have update errors (click for details)') . "</a>"; |
|
442 | + $reply['content'] .= "<a class=\"text-muted\" href=\"#\" onclick=\"CommonDialogs.showFeedsWithErrors()\">". |
|
443 | + __('Some feeds have update errors (click for details)')."</a>"; |
|
444 | 444 | } |
445 | 445 | $reply['content'] .= "</span></p></div>"; |
446 | 446 | |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | $reply['headlines']['is_cat'] = false; |
636 | 636 | |
637 | 637 | $reply['headlines']['toolbar'] = ''; |
638 | - $reply['headlines']['content'] = "<div class='whiteBox'>". $error . "</div>"; |
|
638 | + $reply['headlines']['content'] = "<div class='whiteBox'>".$error."</div>"; |
|
639 | 639 | |
640 | 640 | $reply['headlines-info'] = array("count" => 0, |
641 | 641 | "unread" => 0, |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | print "<fieldset>"; |
670 | 670 | |
671 | 671 | if (get_pref('ENABLE_FEED_CATS')) { |
672 | - print "<label class='inline'>" . __('Place in category:') . "</label> "; |
|
672 | + print "<label class='inline'>".__('Place in category:')."</label> "; |
|
673 | 673 | print_feed_cat_select("cat", false, 'dojoType="fox.form.Select"'); |
674 | 674 | } |
675 | 675 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | print "</section>"; |
679 | 679 | |
680 | 680 | print '<div id="feedDlg_feedsContainer" style="display : none"> |
681 | - <header>' . __('Available feeds') . '</header> |
|
681 | + <header>' . __('Available feeds').'</header> |
|
682 | 682 | <section> |
683 | 683 | <fieldset> |
684 | 684 | <select id="feedDlg_feedContainerSelect" |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | |
744 | 744 | if (DB_TYPE == "pgsql") { |
745 | 745 | print "<fieldset>"; |
746 | - print "<label class='inline'>" . __("Language:") . "</label>"; |
|
746 | + print "<label class='inline'>".__("Language:")."</label>"; |
|
747 | 747 | print_select("search_language", get_pref('DEFAULT_SEARCH_LANGUAGE'), Pref_Feeds::get_ts_languages(), |
748 | 748 | "dojoType='fox.form.Select' title=\"".__('Used for word stemming')."\""); |
749 | 749 | print "</fieldset>"; |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | Debug::set_enabled(true); |
773 | 773 | Debug::set_loglevel($_REQUEST["xdebug"]); |
774 | 774 | |
775 | - $feed_id = (int)$_REQUEST["feed_id"]; |
|
775 | + $feed_id = (int) $_REQUEST["feed_id"]; |
|
776 | 776 | @$do_update = $_REQUEST["action"] == "do_update"; |
777 | 777 | $csrf_token = $_REQUEST["csrf_token"]; |
778 | 778 | |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | </script> |
812 | 812 | |
813 | 813 | <div class="container"> |
814 | - <h1>Feed Debugger: <?php echo "$feed_id: " . $this->getFeedTitle($feed_id) ?></h1> |
|
814 | + <h1>Feed Debugger: <?php echo "$feed_id: ".$this->getFeedTitle($feed_id) ?></h1> |
|
815 | 815 | <div class="content"> |
816 | 816 | <form method="GET" action=""> |
817 | 817 | <input type="hidden" name="op" value="feeds"> |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | } else if ($n_feed >= 0) { |
1075 | 1075 | |
1076 | 1076 | if ($n_feed != 0) { |
1077 | - $match_part = "feed_id = " . (int)$n_feed; |
|
1077 | + $match_part = "feed_id = ".(int) $n_feed; |
|
1078 | 1078 | } else { |
1079 | 1079 | $match_part = "feed_id IS NULL"; |
1080 | 1080 | } |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | (owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method,auth_pass_encrypted) |
1185 | 1185 | VALUES (?, ?, ?, ?, ?, ?, 0, false)"); |
1186 | 1186 | |
1187 | - $sth->execute([$_SESSION['uid'], $url, "[Unknown]", $cat_id, (string)$auth_login, (string)$auth_pass]); |
|
1187 | + $sth->execute([$_SESSION['uid'], $url, "[Unknown]", $cat_id, (string) $auth_login, (string) $auth_pass]); |
|
1188 | 1188 | |
1189 | 1189 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds WHERE feed_url = ? |
1190 | 1190 | AND owner_uid = ?"); |
@@ -1203,11 +1203,11 @@ discard block |
||
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | public static function getIconFile($feed_id) { |
1206 | - return ICONS_DIR . "/$feed_id.ico"; |
|
1206 | + return ICONS_DIR."/$feed_id.ico"; |
|
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | public static function feedHasIcon($id) { |
1210 | - return is_file(ICONS_DIR . "/$id.ico") && filesize(ICONS_DIR . "/$id.ico") > 0; |
|
1210 | + return is_file(ICONS_DIR."/$id.ico") && filesize(ICONS_DIR."/$id.ico") > 0; |
|
1211 | 1211 | } |
1212 | 1212 | |
1213 | 1213 | public static function getFeedIcon($id) { |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | $icon = self::getIconFile($id); |
1232 | 1232 | |
1233 | 1233 | if ($icon && file_exists($icon)) { |
1234 | - return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); |
|
1234 | + return ICONS_URL."/".basename($icon)."?".filemtime($icon); |
|
1235 | 1235 | } |
1236 | 1236 | } |
1237 | 1237 | } |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | |
1304 | 1304 | $cat_feeds = array(); |
1305 | 1305 | while ($line = $sth->fetch()) { |
1306 | - array_push($cat_feeds, "feed_id = " . (int)$line["id"]); |
|
1306 | + array_push($cat_feeds, "feed_id = ".(int) $line["id"]); |
|
1307 | 1307 | } |
1308 | 1308 | |
1309 | 1309 | if (count($cat_feeds) == 0) return 0; |
@@ -1517,7 +1517,7 @@ discard block |
||
1517 | 1517 | } |
1518 | 1518 | |
1519 | 1519 | if ($limit > 0) { |
1520 | - $limit_query_part = "LIMIT " . (int)$limit; |
|
1520 | + $limit_query_part = "LIMIT ".(int) $limit; |
|
1521 | 1521 | } |
1522 | 1522 | |
1523 | 1523 | $allow_archived = false; |
@@ -1544,7 +1544,7 @@ discard block |
||
1544 | 1544 | implode(",", $subcats).")"; |
1545 | 1545 | |
1546 | 1546 | } else { |
1547 | - $query_strategy_part = "cat_id = " . $pdo->quote($feed); |
|
1547 | + $query_strategy_part = "cat_id = ".$pdo->quote($feed); |
|
1548 | 1548 | } |
1549 | 1549 | |
1550 | 1550 | } else { |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | $vfeed_query_part = "ttrss_feeds.title AS feed_title,"; |
1555 | 1555 | |
1556 | 1556 | } else { |
1557 | - $query_strategy_part = "feed_id = " . $pdo->quote($feed); |
|
1557 | + $query_strategy_part = "feed_id = ".$pdo->quote($feed); |
|
1558 | 1558 | } |
1559 | 1559 | } else if ($feed == 0 && !$cat_view) { // archive virtual feed |
1560 | 1560 | $query_strategy_part = "feed_id IS NULL"; |
@@ -1676,7 +1676,7 @@ discard block |
||
1676 | 1676 | $content_query_part = "content, "; |
1677 | 1677 | |
1678 | 1678 | if ($limit_query_part) { |
1679 | - $offset_query_part = "OFFSET " . (int)$offset; |
|
1679 | + $offset_query_part = "OFFSET ".(int) $offset; |
|
1680 | 1680 | } else { |
1681 | 1681 | $offset_query_part = ""; |
1682 | 1682 | } |
@@ -1765,7 +1765,7 @@ discard block |
||
1765 | 1765 | $res = $pdo->query($query); |
1766 | 1766 | |
1767 | 1767 | if ($row = $res->fetch()) { |
1768 | - $first_id = (int)$row["id"]; |
|
1768 | + $first_id = (int) $row["id"]; |
|
1769 | 1769 | |
1770 | 1770 | if ($offset > 0 && $first_id && $check_first_id && $first_id != $check_first_id) { |
1771 | 1771 | return array(-1, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words, $first_id, $vfeed_query_part != "", $query_error_override); |
@@ -1912,9 +1912,9 @@ discard block |
||
1912 | 1912 | } |
1913 | 1913 | |
1914 | 1914 | function color_of($name) { |
1915 | - $colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b", |
|
1916 | - "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416", |
|
1917 | - "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ]; |
|
1915 | + $colormap = ["#1cd7d7", "#d91111", "#1212d7", "#8e16e5", "#7b7b7b", |
|
1916 | + "#39f110", "#0bbea6", "#ec0e0e", "#1534f2", "#b9e416", |
|
1917 | + "#479af2", "#f36b14", "#10c7e9", "#1e8fe7", "#e22727"]; |
|
1918 | 1918 | |
1919 | 1919 | $sum = 0; |
1920 | 1920 | |
@@ -1978,13 +1978,13 @@ discard block |
||
1978 | 1978 | |
1979 | 1979 | // support schema-less urls |
1980 | 1980 | if (strpos($url, '//') === 0) { |
1981 | - $url = 'https:' . $url; |
|
1981 | + $url = 'https:'.$url; |
|
1982 | 1982 | } |
1983 | 1983 | |
1984 | 1984 | if (strpos($url, '://') === false) { |
1985 | - $url = 'http://' . $url; |
|
1985 | + $url = 'http://'.$url; |
|
1986 | 1986 | } else if (substr($url, 0, 5) == 'feed:') { |
1987 | - $url = 'http:' . substr($url, 5); |
|
1987 | + $url = 'http:'.substr($url, 5); |
|
1988 | 1988 | } |
1989 | 1989 | |
1990 | 1990 | //prepend slash if the URL has no slash in it |
@@ -2034,7 +2034,7 @@ discard block |
||
2034 | 2034 | |
2035 | 2035 | $sth = $pdo->prepare("INSERT INTO ttrss_feed_categories (owner_uid,title,parent_cat,order_id) |
2036 | 2036 | VALUES (?, ?, ?, ?)"); |
2037 | - $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int)$order_id]); |
|
2037 | + $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int) $order_id]); |
|
2038 | 2038 | |
2039 | 2039 | if (!$tr_in_progress) $pdo->commit(); |
2040 | 2040 | |
@@ -2134,7 +2134,7 @@ discard block |
||
2134 | 2134 | $sth->execute([$feed_id]); |
2135 | 2135 | |
2136 | 2136 | } else { |
2137 | - $sth = $pdo->prepare("DELETE FROM ttrss_user_entries |
|
2137 | + $sth = $pdo->prepare("DELETE FROM ttrss_user_entries |
|
2138 | 2138 | USING ttrss_user_entries, ttrss_entries |
2139 | 2139 | WHERE ttrss_entries.id = ref_id AND |
2140 | 2140 | marked = false AND |
@@ -2204,7 +2204,7 @@ discard block |
||
2204 | 2204 | case "title": |
2205 | 2205 | if ($commandpair[1]) { |
2206 | 2206 | array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ". |
2207 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%') ."))"); |
|
2207 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
2208 | 2208 | } else { |
2209 | 2209 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
2210 | 2210 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
@@ -2214,7 +2214,7 @@ discard block |
||
2214 | 2214 | case "author": |
2215 | 2215 | if ($commandpair[1]) { |
2216 | 2216 | array_push($query_keywords, "($not (LOWER(author) LIKE ". |
2217 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
2217 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
2218 | 2218 | } else { |
2219 | 2219 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
2220 | 2220 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
@@ -2229,7 +2229,7 @@ discard block |
||
2229 | 2229 | array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
2230 | 2230 | else |
2231 | 2231 | array_push($query_keywords, "($not (LOWER(note) LIKE ". |
2232 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
2232 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
2233 | 2233 | } else { |
2234 | 2234 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
2235 | 2235 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
@@ -2306,7 +2306,7 @@ discard block |
||
2306 | 2306 | |
2307 | 2307 | // if there's no joiners consider this a "simple" search and |
2308 | 2308 | // concatenate everything with &, otherwise don't try to mess with tsquery syntax |
2309 | - if (preg_match("/[&|]/", implode(" " , $search_query_leftover))) { |
|
2309 | + if (preg_match("/[&|]/", implode(" ", $search_query_leftover))) { |
|
2310 | 2310 | $tsquery = $pdo->quote(implode(" ", $search_query_leftover)); |
2311 | 2311 | } else { |
2312 | 2312 | $tsquery = $pdo->quote(implode(" & ", $search_query_leftover)); |
@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | $feed_id, $is_cat, $search, |
18 | 18 | $error, $feed_last_updated) { |
19 | 19 | |
20 | - if ($is_cat) $cat_q = "&is_cat=$is_cat"; |
|
20 | + if ($is_cat) { |
|
21 | + $cat_q = "&is_cat=$is_cat"; |
|
22 | + } |
|
21 | 23 | |
22 | 24 | if ($search) { |
23 | 25 | $search_q = "&q=$search"; |
@@ -48,8 +50,9 @@ discard block |
||
48 | 50 | $reply .= strip_tags($feed_title); |
49 | 51 | } |
50 | 52 | |
51 | - if ($error) |
|
52 | - $reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>"; |
|
53 | + if ($error) { |
|
54 | + $reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>"; |
|
55 | + } |
|
53 | 56 | |
54 | 57 | $reply .= "</span>"; |
55 | 58 | $reply .= "<span id='feed_current_unread' style='display: none'></span>"; |
@@ -127,8 +130,12 @@ discard block |
||
127 | 130 | $rgba_cache = array(); |
128 | 131 | $topmost_article_ids = array(); |
129 | 132 | |
130 | - if (!$offset) $offset = 0; |
|
131 | - if ($method == "undefined") $method = ""; |
|
133 | + if (!$offset) { |
|
134 | + $offset = 0; |
|
135 | + } |
|
136 | + if ($method == "undefined") { |
|
137 | + $method = ""; |
|
138 | + } |
|
132 | 139 | |
133 | 140 | $method_split = explode(":", $method); |
134 | 141 | |
@@ -274,14 +281,17 @@ discard block |
||
274 | 281 | $label_cache = json_decode($label_cache, true); |
275 | 282 | |
276 | 283 | if ($label_cache) { |
277 | - if ($label_cache["no-labels"] == 1) |
|
278 | - $labels = array(); |
|
279 | - else |
|
280 | - $labels = $label_cache; |
|
284 | + if ($label_cache["no-labels"] == 1) { |
|
285 | + $labels = array(); |
|
286 | + } else { |
|
287 | + $labels = $label_cache; |
|
288 | + } |
|
281 | 289 | } |
282 | 290 | } |
283 | 291 | |
284 | - if (!is_array($labels)) $labels = Article::get_article_labels($id); |
|
292 | + if (!is_array($labels)) { |
|
293 | + $labels = Article::get_article_labels($id); |
|
294 | + } |
|
285 | 295 | |
286 | 296 | $labels_str = "<span class=\"HLLCTR-$id\">"; |
287 | 297 | $labels_str .= Article::format_article_labels($labels); |
@@ -293,7 +303,9 @@ discard block |
||
293 | 303 | array_push($topmost_article_ids, $id); |
294 | 304 | } |
295 | 305 | |
296 | - if (!$line["feed_title"]) $line["feed_title"] = ""; |
|
306 | + if (!$line["feed_title"]) { |
|
307 | + $line["feed_title"] = ""; |
|
308 | + } |
|
297 | 309 | |
298 | 310 | $line["buttons_left"] = ""; |
299 | 311 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) { |
@@ -314,10 +326,11 @@ discard block |
||
314 | 326 | |
315 | 327 | $line['content'] = DiskCache::rewriteUrls($line['content']); |
316 | 328 | |
317 | - if ($line['note']) |
|
318 | - $line['note'] = Article::format_article_note($id, $line['note']); |
|
319 | - else |
|
320 | - $line['note'] = ""; |
|
329 | + if ($line['note']) { |
|
330 | + $line['note'] = Article::format_article_note($id, $line['note']); |
|
331 | + } else { |
|
332 | + $line['note'] = ""; |
|
333 | + } |
|
321 | 334 | |
322 | 335 | if (!get_pref("CDM_EXPANDED")) { |
323 | 336 | $line["cdm_excerpt"] = "<span class='collapse'> |
@@ -350,10 +363,11 @@ discard block |
||
350 | 363 | $line['imported'] = T_sprintf("Imported at %s", |
351 | 364 | make_local_datetime($line["date_entered"], false)); |
352 | 365 | |
353 | - if ($line["tag_cache"]) |
|
354 | - $tags = explode(",", $line["tag_cache"]); |
|
355 | - else |
|
356 | - $tags = false; |
|
366 | + if ($line["tag_cache"]) { |
|
367 | + $tags = explode(",", $line["tag_cache"]); |
|
368 | + } else { |
|
369 | + $tags = false; |
|
370 | + } |
|
357 | 371 | |
358 | 372 | $line["tags_str"] = Article::format_tags_string($tags); |
359 | 373 | |
@@ -383,8 +397,9 @@ discard block |
||
383 | 397 | /* we don't need those */ |
384 | 398 | |
385 | 399 | foreach (["date_entered", "guid", "last_published", "last_marked", "tag_cache", "favicon_avg_color", |
386 | - "uuid", "label_cache", "yyiw"] as $k) |
|
387 | - unset($line[$k]); |
|
400 | + "uuid", "label_cache", "yyiw"] as $k) { |
|
401 | + unset($line[$k]); |
|
402 | + } |
|
388 | 403 | |
389 | 404 | array_push($reply['content'], $line); |
390 | 405 | } |
@@ -474,7 +489,9 @@ discard block |
||
474 | 489 | $order_by = $_REQUEST["order_by"]; |
475 | 490 | $check_first_id = $_REQUEST["fid"]; |
476 | 491 | |
477 | - if (is_numeric($feed)) $feed = (int) $feed; |
|
492 | + if (is_numeric($feed)) { |
|
493 | + $feed = (int) $feed; |
|
494 | + } |
|
478 | 495 | |
479 | 496 | /* Feed -5 is a special case: it is used to display auxiliary information |
480 | 497 | * when there's nothing to load - e.g. no stuff in fresh feed */ |
@@ -562,10 +579,11 @@ discard block |
||
562 | 579 | $disable_cache = $ret[3]; |
563 | 580 | $reply['headlines'] = $ret[4]; |
564 | 581 | |
565 | - if (!$next_unread_feed) |
|
566 | - $reply['headlines']['id'] = $feed; |
|
567 | - else |
|
568 | - $reply['headlines']['id'] = $next_unread_feed; |
|
582 | + if (!$next_unread_feed) { |
|
583 | + $reply['headlines']['id'] = $feed; |
|
584 | + } else { |
|
585 | + $reply['headlines']['id'] = $next_unread_feed; |
|
586 | + } |
|
569 | 587 | |
570 | 588 | $reply['headlines']['is_cat'] = (bool) $cat_view; |
571 | 589 | |
@@ -851,7 +869,9 @@ discard block |
||
851 | 869 | |
852 | 870 | public static function catchup_feed($feed, $cat_view, $owner_uid = false, $mode = 'all', $search = false) { |
853 | 871 | |
854 | - if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
|
872 | + if (!$owner_uid) { |
|
873 | + $owner_uid = $_SESSION['uid']; |
|
874 | + } |
|
855 | 875 | |
856 | 876 | $pdo = Db::pdo(); |
857 | 877 | |
@@ -1026,7 +1046,9 @@ discard block |
||
1026 | 1046 | |
1027 | 1047 | $pdo = Db::pdo(); |
1028 | 1048 | |
1029 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
1049 | + if (!$owner_uid) { |
|
1050 | + $owner_uid = $_SESSION["uid"]; |
|
1051 | + } |
|
1030 | 1052 | |
1031 | 1053 | if ($unread_only) { |
1032 | 1054 | $unread_qpart = "unread = true"; |
@@ -1142,7 +1164,9 @@ discard block |
||
1142 | 1164 | |
1143 | 1165 | $url = Feeds::fix_url($url); |
1144 | 1166 | |
1145 | - if (!$url || !Feeds::validate_feed_url($url)) return array("code" => 2); |
|
1167 | + if (!$url || !Feeds::validate_feed_url($url)) { |
|
1168 | + return array("code" => 2); |
|
1169 | + } |
|
1146 | 1170 | |
1147 | 1171 | $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass); |
1148 | 1172 | |
@@ -1170,7 +1194,9 @@ discard block |
||
1170 | 1194 | $url = key($feedUrls); |
1171 | 1195 | } |
1172 | 1196 | |
1173 | - if (!$cat_id) $cat_id = null; |
|
1197 | + if (!$cat_id) { |
|
1198 | + $cat_id = null; |
|
1199 | + } |
|
1174 | 1200 | |
1175 | 1201 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds |
1176 | 1202 | WHERE feed_url = ? AND owner_uid = ?"); |
@@ -1287,13 +1313,17 @@ discard block |
||
1287 | 1313 | |
1288 | 1314 | public static function getCategoryUnread($cat, $owner_uid = false) { |
1289 | 1315 | |
1290 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
1316 | + if (!$owner_uid) { |
|
1317 | + $owner_uid = $_SESSION["uid"]; |
|
1318 | + } |
|
1291 | 1319 | |
1292 | 1320 | $pdo = Db::pdo(); |
1293 | 1321 | |
1294 | 1322 | if ($cat >= 0) { |
1295 | 1323 | |
1296 | - if (!$cat) $cat = null; |
|
1324 | + if (!$cat) { |
|
1325 | + $cat = null; |
|
1326 | + } |
|
1297 | 1327 | |
1298 | 1328 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds |
1299 | 1329 | WHERE (cat_id = :cat OR (:cat IS NULL AND cat_id IS NULL)) |
@@ -1306,7 +1336,9 @@ discard block |
||
1306 | 1336 | array_push($cat_feeds, "feed_id = " . (int)$line["id"]); |
1307 | 1337 | } |
1308 | 1338 | |
1309 | - if (count($cat_feeds) == 0) return 0; |
|
1339 | + if (count($cat_feeds) == 0) { |
|
1340 | + return 0; |
|
1341 | + } |
|
1310 | 1342 | |
1311 | 1343 | $match_part = implode(" OR ", $cat_feeds); |
1312 | 1344 | |
@@ -1341,7 +1373,9 @@ discard block |
||
1341 | 1373 | |
1342 | 1374 | // only accepts real cats (>= 0) |
1343 | 1375 | public static function getCategoryChildrenUnread($cat, $owner_uid = false) { |
1344 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
1376 | + if (!$owner_uid) { |
|
1377 | + $owner_uid = $_SESSION["uid"]; |
|
1378 | + } |
|
1345 | 1379 | |
1346 | 1380 | $pdo = Db::pdo(); |
1347 | 1381 | |
@@ -1361,7 +1395,9 @@ discard block |
||
1361 | 1395 | |
1362 | 1396 | public static function getGlobalUnread($user_id = false) { |
1363 | 1397 | |
1364 | - if (!$user_id) $user_id = $_SESSION["uid"]; |
|
1398 | + if (!$user_id) { |
|
1399 | + $user_id = $_SESSION["uid"]; |
|
1400 | + } |
|
1365 | 1401 | |
1366 | 1402 | $pdo = Db::pdo(); |
1367 | 1403 | |
@@ -1396,7 +1432,9 @@ discard block |
||
1396 | 1432 | } |
1397 | 1433 | |
1398 | 1434 | public static function getLabelUnread($label_id, $owner_uid = false) { |
1399 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
1435 | + if (!$owner_uid) { |
|
1436 | + $owner_uid = $_SESSION["uid"]; |
|
1437 | + } |
|
1400 | 1438 | |
1401 | 1439 | $pdo = Db::pdo(); |
1402 | 1440 | |
@@ -1491,8 +1529,9 @@ discard block |
||
1491 | 1529 | |
1492 | 1530 | $unread = getFeedUnread($feed, $cat_view); |
1493 | 1531 | |
1494 | - if ($cat_view && $feed > 0 && $include_children) |
|
1495 | - $unread += Feeds::getCategoryChildrenUnread($feed); |
|
1532 | + if ($cat_view && $feed > 0 && $include_children) { |
|
1533 | + $unread += Feeds::getCategoryChildrenUnread($feed); |
|
1534 | + } |
|
1496 | 1535 | |
1497 | 1536 | if ($unread > 0) { |
1498 | 1537 | $view_query_part = " unread = true AND "; |
@@ -1604,7 +1643,9 @@ discard block |
||
1604 | 1643 | $allow_archived = true; |
1605 | 1644 | $ignore_vfeed_group = true; |
1606 | 1645 | |
1607 | - if (!$override_order) $override_order = "last_read DESC"; |
|
1646 | + if (!$override_order) { |
|
1647 | + $override_order = "last_read DESC"; |
|
1648 | + } |
|
1608 | 1649 | |
1609 | 1650 | } else if ($feed == -3) { // fresh virtual feed |
1610 | 1651 | $query_strategy_part = "unread = true AND score >= 0"; |
@@ -1715,13 +1756,16 @@ discard block |
||
1715 | 1756 | LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)"; |
1716 | 1757 | } |
1717 | 1758 | |
1718 | - if ($vfeed_query_part) $vfeed_query_part .= "favicon_avg_color,"; |
|
1759 | + if ($vfeed_query_part) { |
|
1760 | + $vfeed_query_part .= "favicon_avg_color,"; |
|
1761 | + } |
|
1719 | 1762 | |
1720 | 1763 | $first_id = 0; |
1721 | 1764 | $first_id_query_strategy_part = $query_strategy_part; |
1722 | 1765 | |
1723 | - if ($feed == -3) |
|
1724 | - $first_id_query_strategy_part = "true"; |
|
1766 | + if ($feed == -3) { |
|
1767 | + $first_id_query_strategy_part = "true"; |
|
1768 | + } |
|
1725 | 1769 | |
1726 | 1770 | if (DB_TYPE == "pgsql") { |
1727 | 1771 | $sanity_interval_qpart = "date_entered >= NOW() - INTERVAL '1 hour' AND"; |
@@ -1853,7 +1897,9 @@ discard block |
||
1853 | 1897 | $query_strategy_part ORDER BY $order_by |
1854 | 1898 | $limit_query_part $offset_query_part"; |
1855 | 1899 | |
1856 | - if ($_REQUEST["debug"]) print $query; |
|
1900 | + if ($_REQUEST["debug"]) { |
|
1901 | + print $query; |
|
1902 | + } |
|
1857 | 1903 | |
1858 | 1904 | $res = $pdo->query($query); |
1859 | 1905 | } |
@@ -2003,18 +2049,23 @@ discard block |
||
2003 | 2049 | } |
2004 | 2050 | } |
2005 | 2051 | |
2006 | - if ($url != "http:///") |
|
2007 | - return $url; |
|
2008 | - else |
|
2009 | - return ''; |
|
2052 | + if ($url != "http:///") { |
|
2053 | + return $url; |
|
2054 | + } else { |
|
2055 | + return ''; |
|
2056 | + } |
|
2010 | 2057 | } |
2011 | 2058 | |
2012 | 2059 | public static function add_feed_category($feed_cat, $parent_cat_id = false, $order_id = 0) { |
2013 | 2060 | |
2014 | - if (!$feed_cat) return false; |
|
2061 | + if (!$feed_cat) { |
|
2062 | + return false; |
|
2063 | + } |
|
2015 | 2064 | |
2016 | 2065 | $feed_cat = mb_substr($feed_cat, 0, 250); |
2017 | - if (!$parent_cat_id) $parent_cat_id = null; |
|
2066 | + if (!$parent_cat_id) { |
|
2067 | + $parent_cat_id = null; |
|
2068 | + } |
|
2018 | 2069 | |
2019 | 2070 | $pdo = Db::pdo(); |
2020 | 2071 | $tr_in_progress = false; |
@@ -2036,7 +2087,9 @@ discard block |
||
2036 | 2087 | VALUES (?, ?, ?, ?)"); |
2037 | 2088 | $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int)$order_id]); |
2038 | 2089 | |
2039 | - if (!$tr_in_progress) $pdo->commit(); |
|
2090 | + if (!$tr_in_progress) { |
|
2091 | + $pdo->commit(); |
|
2092 | + } |
|
2040 | 2093 | |
2041 | 2094 | return true; |
2042 | 2095 | } |
@@ -2048,7 +2101,9 @@ discard block |
||
2048 | 2101 | |
2049 | 2102 | public static function get_feed_access_key($feed_id, $is_cat, $owner_uid = false) { |
2050 | 2103 | |
2051 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
2104 | + if (!$owner_uid) { |
|
2105 | + $owner_uid = $_SESSION["uid"]; |
|
2106 | + } |
|
2052 | 2107 | |
2053 | 2108 | $is_cat = bool_to_sql_bool($is_cat); |
2054 | 2109 | |
@@ -2086,7 +2141,9 @@ discard block |
||
2086 | 2141 | */ |
2087 | 2142 | public static function purge_feed($feed_id, $purge_interval) { |
2088 | 2143 | |
2089 | - if (!$purge_interval) $purge_interval = Feeds::feed_purge_interval($feed_id); |
|
2144 | + if (!$purge_interval) { |
|
2145 | + $purge_interval = Feeds::feed_purge_interval($feed_id); |
|
2146 | + } |
|
2090 | 2147 | |
2091 | 2148 | $pdo = Db::pdo(); |
2092 | 2149 | |
@@ -2106,7 +2163,9 @@ discard block |
||
2106 | 2163 | return; |
2107 | 2164 | } |
2108 | 2165 | |
2109 | - if (!$owner_uid) return; |
|
2166 | + if (!$owner_uid) { |
|
2167 | + return; |
|
2168 | + } |
|
2110 | 2169 | |
2111 | 2170 | if (FORCE_ARTICLE_PURGE == 0) { |
2112 | 2171 | $purge_unread = get_pref("PURGE_UNREAD_ARTICLES", |
@@ -2116,10 +2175,11 @@ discard block |
||
2116 | 2175 | $purge_interval = FORCE_ARTICLE_PURGE; |
2117 | 2176 | } |
2118 | 2177 | |
2119 | - if (!$purge_unread) |
|
2120 | - $query_limit = " unread = false AND "; |
|
2121 | - else |
|
2122 | - $query_limit = ""; |
|
2178 | + if (!$purge_unread) { |
|
2179 | + $query_limit = " unread = false AND "; |
|
2180 | + } else { |
|
2181 | + $query_limit = ""; |
|
2182 | + } |
|
2123 | 2183 | |
2124 | 2184 | $purge_interval = (int) $purge_interval; |
2125 | 2185 | |
@@ -2166,8 +2226,10 @@ discard block |
||
2166 | 2226 | $purge_interval = $row["purge_interval"]; |
2167 | 2227 | $owner_uid = $row["owner_uid"]; |
2168 | 2228 | |
2169 | - if ($purge_interval == 0) $purge_interval = get_pref( |
|
2229 | + if ($purge_interval == 0) { |
|
2230 | + $purge_interval = get_pref( |
|
2170 | 2231 | 'PURGE_OLD_DAYS', $owner_uid); |
2232 | + } |
|
2171 | 2233 | |
2172 | 2234 | return $purge_interval; |
2173 | 2235 | |
@@ -2185,10 +2247,11 @@ discard block |
||
2185 | 2247 | |
2186 | 2248 | $pdo = Db::pdo(); |
2187 | 2249 | |
2188 | - if ($search_language) |
|
2189 | - $search_language = $pdo->quote(mb_strtolower($search_language)); |
|
2190 | - else |
|
2191 | - $search_language = $pdo->quote("english"); |
|
2250 | + if ($search_language) { |
|
2251 | + $search_language = $pdo->quote(mb_strtolower($search_language)); |
|
2252 | + } else { |
|
2253 | + $search_language = $pdo->quote("english"); |
|
2254 | + } |
|
2192 | 2255 | |
2193 | 2256 | foreach ($keywords as $k) { |
2194 | 2257 | if (strpos($k, "-") === 0) { |
@@ -2223,56 +2286,68 @@ discard block |
||
2223 | 2286 | break; |
2224 | 2287 | case "note": |
2225 | 2288 | if ($commandpair[1]) { |
2226 | - if ($commandpair[1] == "true") |
|
2227 | - array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
2228 | - else if ($commandpair[1] == "false") |
|
2229 | - array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
2230 | - else |
|
2231 | - array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
2289 | + if ($commandpair[1] == "true") { |
|
2290 | + array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
2291 | + } else if ($commandpair[1] == "false") { |
|
2292 | + array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
2293 | + } else { |
|
2294 | + array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
2232 | 2295 | $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
2296 | + } |
|
2233 | 2297 | } else { |
2234 | 2298 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
2235 | 2299 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2236 | - if (!$not) array_push($search_words, $k); |
|
2300 | + if (!$not) { |
|
2301 | + array_push($search_words, $k); |
|
2302 | + } |
|
2237 | 2303 | } |
2238 | 2304 | break; |
2239 | 2305 | case "star": |
2240 | 2306 | |
2241 | 2307 | if ($commandpair[1]) { |
2242 | - if ($commandpair[1] == "true") |
|
2243 | - array_push($query_keywords, "($not (marked = true))"); |
|
2244 | - else |
|
2245 | - array_push($query_keywords, "($not (marked = false))"); |
|
2308 | + if ($commandpair[1] == "true") { |
|
2309 | + array_push($query_keywords, "($not (marked = true))"); |
|
2310 | + } else { |
|
2311 | + array_push($query_keywords, "($not (marked = false))"); |
|
2312 | + } |
|
2246 | 2313 | } else { |
2247 | 2314 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
2248 | 2315 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2249 | - if (!$not) array_push($search_words, $k); |
|
2316 | + if (!$not) { |
|
2317 | + array_push($search_words, $k); |
|
2318 | + } |
|
2250 | 2319 | } |
2251 | 2320 | break; |
2252 | 2321 | case "pub": |
2253 | 2322 | if ($commandpair[1]) { |
2254 | - if ($commandpair[1] == "true") |
|
2255 | - array_push($query_keywords, "($not (published = true))"); |
|
2256 | - else |
|
2257 | - array_push($query_keywords, "($not (published = false))"); |
|
2323 | + if ($commandpair[1] == "true") { |
|
2324 | + array_push($query_keywords, "($not (published = true))"); |
|
2325 | + } else { |
|
2326 | + array_push($query_keywords, "($not (published = false))"); |
|
2327 | + } |
|
2258 | 2328 | |
2259 | 2329 | } else { |
2260 | 2330 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
2261 | 2331 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2262 | - if (!$not) array_push($search_words, $k); |
|
2332 | + if (!$not) { |
|
2333 | + array_push($search_words, $k); |
|
2334 | + } |
|
2263 | 2335 | } |
2264 | 2336 | break; |
2265 | 2337 | case "unread": |
2266 | 2338 | if ($commandpair[1]) { |
2267 | - if ($commandpair[1] == "true") |
|
2268 | - array_push($query_keywords, "($not (unread = true))"); |
|
2269 | - else |
|
2270 | - array_push($query_keywords, "($not (unread = false))"); |
|
2339 | + if ($commandpair[1] == "true") { |
|
2340 | + array_push($query_keywords, "($not (unread = true))"); |
|
2341 | + } else { |
|
2342 | + array_push($query_keywords, "($not (unread = false))"); |
|
2343 | + } |
|
2271 | 2344 | |
2272 | 2345 | } else { |
2273 | 2346 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
2274 | 2347 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2275 | - if (!$not) array_push($search_words, $k); |
|
2348 | + if (!$not) { |
|
2349 | + array_push($search_words, $k); |
|
2350 | + } |
|
2276 | 2351 | } |
2277 | 2352 | break; |
2278 | 2353 | default: |
@@ -2295,7 +2370,9 @@ discard block |
||
2295 | 2370 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2296 | 2371 | } |
2297 | 2372 | |
2298 | - if (!$not) array_push($search_words, $k); |
|
2373 | + if (!$not) { |
|
2374 | + array_push($search_words, $k); |
|
2375 | + } |
|
2299 | 2376 | } |
2300 | 2377 | } |
2301 | 2378 | } |
@@ -1568,8 +1568,8 @@ |
||
1568 | 1568 | public static function remove_feed($id, $owner_uid) { |
1569 | 1569 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_UNSUBSCRIBE_FEED) as $p) { |
1570 | 1570 | if (! $p->hook_unsubscribe_feed($id, $owner_uid)) { |
1571 | - user_error("Feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING); |
|
1572 | - return; |
|
1571 | + user_error("Feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING); |
|
1572 | + return; |
|
1573 | 1573 | } |
1574 | 1574 | } |
1575 | 1575 |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | while ($line = $sth->fetch()) { |
61 | 61 | |
62 | 62 | $cat = array(); |
63 | - $cat['id'] = 'CAT:' . $line['id']; |
|
64 | - $cat['bare_id'] = (int)$line['id']; |
|
63 | + $cat['id'] = 'CAT:'.$line['id']; |
|
64 | + $cat['bare_id'] = (int) $line['id']; |
|
65 | 65 | $cat['name'] = $line['title']; |
66 | 66 | $cat['items'] = array(); |
67 | 67 | $cat['checkbox'] = false; |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | |
94 | 94 | while ($feed_line = $fsth->fetch()) { |
95 | 95 | $feed = array(); |
96 | - $feed['id'] = 'FEED:' . $feed_line['id']; |
|
97 | - $feed['bare_id'] = (int)$feed_line['id']; |
|
96 | + $feed['id'] = 'FEED:'.$feed_line['id']; |
|
97 | + $feed['bare_id'] = (int) $feed_line['id']; |
|
98 | 98 | $feed['auxcounter'] = -1; |
99 | 99 | $feed['name'] = $feed_line['title']; |
100 | 100 | $feed['checkbox'] = false; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $feed['icon'] = Feeds::getFeedIcon($feed_line['id']); |
104 | 104 | $feed['param'] = make_local_datetime( |
105 | 105 | $feed_line['last_updated'], true); |
106 | - $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0); |
|
106 | + $feed['updates_disabled'] = (int) ($feed_line['update_interval'] < 0); |
|
107 | 107 | |
108 | 108 | array_push($items, $feed); |
109 | 109 | } |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | $feed_id = PluginHost::pfeed_to_feed_id($feed['id']); |
152 | 152 | |
153 | 153 | $item = array(); |
154 | - $item['id'] = 'FEED:' . $feed_id; |
|
155 | - $item['bare_id'] = (int)$feed_id; |
|
154 | + $item['id'] = 'FEED:'.$feed_id; |
|
155 | + $item['bare_id'] = (int) $feed_id; |
|
156 | 156 | $item['auxcounter'] = -1; |
157 | 157 | $item['name'] = $feed['title']; |
158 | 158 | $item['checkbox'] = false; |
@@ -216,8 +216,8 @@ discard block |
||
216 | 216 | |
217 | 217 | while ($line = $sth->fetch()) { |
218 | 218 | $cat = array(); |
219 | - $cat['id'] = 'CAT:' . $line['id']; |
|
220 | - $cat['bare_id'] = (int)$line['id']; |
|
219 | + $cat['id'] = 'CAT:'.$line['id']; |
|
220 | + $cat['bare_id'] = (int) $line['id']; |
|
221 | 221 | $cat['auxcounter'] = -1; |
222 | 222 | $cat['name'] = $line['title']; |
223 | 223 | $cat['items'] = array(); |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | |
262 | 262 | while ($feed_line = $fsth->fetch()) { |
263 | 263 | $feed = array(); |
264 | - $feed['id'] = 'FEED:' . $feed_line['id']; |
|
265 | - $feed['bare_id'] = (int)$feed_line['id']; |
|
264 | + $feed['id'] = 'FEED:'.$feed_line['id']; |
|
265 | + $feed['bare_id'] = (int) $feed_line['id']; |
|
266 | 266 | $feed['auxcounter'] = -1; |
267 | 267 | $feed['name'] = $feed_line['title']; |
268 | 268 | $feed['checkbox'] = false; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $feed_line['last_updated'], true); |
273 | 273 | $feed['unread'] = -1; |
274 | 274 | $feed['type'] = 'feed'; |
275 | - $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0); |
|
275 | + $feed['updates_disabled'] = (int) ($feed_line['update_interval'] < 0); |
|
276 | 276 | |
277 | 277 | array_push($cat['items'], $feed); |
278 | 278 | } |
@@ -296,8 +296,8 @@ discard block |
||
296 | 296 | |
297 | 297 | while ($feed_line = $fsth->fetch()) { |
298 | 298 | $feed = array(); |
299 | - $feed['id'] = 'FEED:' . $feed_line['id']; |
|
300 | - $feed['bare_id'] = (int)$feed_line['id']; |
|
299 | + $feed['id'] = 'FEED:'.$feed_line['id']; |
|
300 | + $feed['bare_id'] = (int) $feed_line['id']; |
|
301 | 301 | $feed['auxcounter'] = -1; |
302 | 302 | $feed['name'] = $feed_line['title']; |
303 | 303 | $feed['checkbox'] = false; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $feed_line['last_updated'], true); |
308 | 308 | $feed['unread'] = -1; |
309 | 309 | $feed['type'] = 'feed'; |
310 | - $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0); |
|
310 | + $feed['updates_disabled'] = (int) ($feed_line['update_interval'] < 0); |
|
311 | 311 | |
312 | 312 | array_push($root['items'], $feed); |
313 | 313 | } |
@@ -348,11 +348,11 @@ discard block |
||
348 | 348 | |
349 | 349 | Debug::log("$prefix C: $item_id P: $parent_id"); |
350 | 350 | |
351 | - $bare_item_id = substr($item_id, strpos($item_id, ':')+1); |
|
351 | + $bare_item_id = substr($item_id, strpos($item_id, ':') + 1); |
|
352 | 352 | |
353 | 353 | if ($item_id != 'root') { |
354 | 354 | if ($parent_id && $parent_id != 'root') { |
355 | - $parent_bare_id = substr($parent_id, strpos($parent_id, ':')+1); |
|
355 | + $parent_bare_id = substr($parent_id, strpos($parent_id, ':') + 1); |
|
356 | 356 | $parent_qpart = $parent_bare_id; |
357 | 357 | } else { |
358 | 358 | $parent_qpart = null; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | if ($cat && is_array($cat)) { |
372 | 372 | foreach ($cat as $item) { |
373 | 373 | $id = $item['_reference']; |
374 | - $bare_id = substr($id, strpos($id, ':')+1); |
|
374 | + $bare_id = substr($id, strpos($id, ':') + 1); |
|
375 | 375 | |
376 | 376 | Debug::log("$prefix [$order_id] $id/$bare_id"); |
377 | 377 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | |
390 | 390 | } else if (strpos($id, "CAT:") === 0) { |
391 | 391 | $this->process_category_order($data_map, $item['_reference'], $item_id, |
392 | - $nest_level+1); |
|
392 | + $nest_level + 1); |
|
393 | 393 | |
394 | 394 | $sth = $this->pdo->prepare("UPDATE ttrss_feed_categories |
395 | 395 | SET order_id = ? WHERE id = ? AND |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | $sth->execute([$feed_id, $_SESSION['uid']]); |
447 | 447 | |
448 | 448 | if ($sth->fetch()) { |
449 | - @unlink(ICONS_DIR . "/$feed_id.ico"); |
|
449 | + @unlink(ICONS_DIR."/$feed_id.ico"); |
|
450 | 450 | |
451 | 451 | $sth = $this->pdo->prepare("UPDATE ttrss_feeds SET favicon_avg_color = NULL where id = ?"); |
452 | 452 | $sth->execute([$feed_id]); |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | header("Content-type: text/html"); |
458 | 458 | |
459 | 459 | if (is_uploaded_file($_FILES['icon_file']['tmp_name'])) { |
460 | - $tmp_file = tempnam(CACHE_DIR . '/upload', 'icon'); |
|
460 | + $tmp_file = tempnam(CACHE_DIR.'/upload', 'icon'); |
|
461 | 461 | |
462 | 462 | $result = move_uploaded_file($_FILES['icon_file']['tmp_name'], |
463 | 463 | $tmp_file); |
@@ -480,8 +480,8 @@ discard block |
||
480 | 480 | $sth->execute([$feed_id, $_SESSION['uid']]); |
481 | 481 | |
482 | 482 | if ($sth->fetch()) { |
483 | - @unlink(ICONS_DIR . "/$feed_id.ico"); |
|
484 | - if (rename($icon_file, ICONS_DIR . "/$feed_id.ico")) { |
|
483 | + @unlink(ICONS_DIR."/$feed_id.ico"); |
|
484 | + if (rename($icon_file, ICONS_DIR."/$feed_id.ico")) { |
|
485 | 485 | |
486 | 486 | $sth = $this->pdo->prepare("UPDATE ttrss_feeds SET favicon_avg_color = '' WHERE id = ?"); |
487 | 487 | $sth->execute([$feed_id]); |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | |
541 | 541 | print "<fieldset>"; |
542 | 542 | |
543 | - print "<label>" . __('URL:') . "</label> "; |
|
543 | + print "<label>".__('URL:')."</label> "; |
|
544 | 544 | print "<input dojoType='dijit.form.ValidationTextBox' required='1' |
545 | 545 | placeHolder=\"".__("Feed URL")."\" |
546 | 546 | regExp='^(http|https)://.*' style='width : 300px' |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | |
564 | 564 | print "<fieldset>"; |
565 | 565 | |
566 | - print "<label>" . __('Place in category:') . "</label> "; |
|
566 | + print "<label>".__('Place in category:')."</label> "; |
|
567 | 567 | |
568 | 568 | print_feed_cat_select("cat_id", $cat_id, |
569 | 569 | 'dojoType="fox.form.Select"'); |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | |
578 | 578 | print "<fieldset>"; |
579 | 579 | |
580 | - print "<label>" . __('Site URL:') . "</label> "; |
|
580 | + print "<label>".__('Site URL:')."</label> "; |
|
581 | 581 | print "<input dojoType='dijit.form.ValidationTextBox' required='1' |
582 | 582 | placeHolder=\"".__("Site URL")."\" |
583 | 583 | regExp='^(http|https)://.*' style='width : 300px' |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | |
596 | 596 | print "<fieldset>"; |
597 | 597 | |
598 | - print "<label>" . __('Language:') . "</label> "; |
|
598 | + print "<label>".__('Language:')."</label> "; |
|
599 | 599 | print_select("feed_language", $feed_language, $this::get_ts_languages(), |
600 | 600 | 'dojoType="fox.form.Select"'); |
601 | 601 | |
@@ -626,10 +626,10 @@ discard block |
||
626 | 626 | |
627 | 627 | print "<fieldset>"; |
628 | 628 | |
629 | - print "<label>" . __('Article purging:') . "</label> "; |
|
629 | + print "<label>".__('Article purging:')."</label> "; |
|
630 | 630 | |
631 | 631 | print_select_hash("purge_interval", $purge_interval, $purge_intervals, |
632 | - 'dojoType="fox.form.Select" ' . |
|
632 | + 'dojoType="fox.form.Select" '. |
|
633 | 633 | ((FORCE_ARTICLE_PURGE == 0) ? "" : 'disabled="1"')); |
634 | 634 | |
635 | 635 | print "</fieldset>"; |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | print "<fieldset class='narrow'>"; |
737 | 737 | |
738 | 738 | print "<label class='checkbox'><input dojoType='dijit.form.CheckBox' type='checkbox' id='cache_images' |
739 | - name='cache_images' $checked> ". __('Cache media')."</label>"; |
|
739 | + name='cache_images' $checked> ".__('Cache media')."</label>"; |
|
740 | 740 | |
741 | 741 | print "</fieldset>"; |
742 | 742 | |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | |
819 | 819 | print "<fieldset>"; |
820 | 820 | |
821 | - print "<label>" . __('Place in category:') . "</label> "; |
|
821 | + print "<label>".__('Place in category:')."</label> "; |
|
822 | 822 | |
823 | 823 | print_feed_cat_select("cat_id", false, |
824 | 824 | 'disabled="1" dojoType="fox.form.Select"'); |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | if (DB_TYPE == "pgsql") { |
834 | 834 | print "<fieldset>"; |
835 | 835 | |
836 | - print "<label>" . __('Language:') . "</label> "; |
|
836 | + print "<label>".__('Language:')."</label> "; |
|
837 | 837 | print_select("feed_language", "", $this::get_ts_languages(), |
838 | 838 | 'disabled="1" dojoType="fox.form.Select"'); |
839 | 839 | |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | |
867 | 867 | print "<fieldset>"; |
868 | 868 | |
869 | - print "<label>" . __('Article purging:') . "</label> "; |
|
869 | + print "<label>".__('Article purging:')."</label> "; |
|
870 | 870 | |
871 | 871 | print_select_hash("purge_interval", "", $purge_intervals, |
872 | 872 | 'disabled="1" dojoType="fox.form.Select"'); |
@@ -1026,12 +1026,12 @@ discard block |
||
1026 | 1026 | ":purge_intl" => $purge_intl, |
1027 | 1027 | ":auth_login" => $auth_login, |
1028 | 1028 | ":auth_pass" => $auth_pass, |
1029 | - ":private" => (int)$private, |
|
1030 | - ":cache_images" => (int)$cache_images, |
|
1031 | - ":hide_images" => (int)$hide_images, |
|
1032 | - ":include_in_digest" => (int)$include_in_digest, |
|
1033 | - ":always_display_enclosures" => (int)$always_display_enclosures, |
|
1034 | - ":mark_unread_on_update" => (int)$mark_unread_on_update, |
|
1029 | + ":private" => (int) $private, |
|
1030 | + ":cache_images" => (int) $cache_images, |
|
1031 | + ":hide_images" => (int) $hide_images, |
|
1032 | + ":include_in_digest" => (int) $include_in_digest, |
|
1033 | + ":always_display_enclosures" => (int) $always_display_enclosures, |
|
1034 | + ":mark_unread_on_update" => (int) $mark_unread_on_update, |
|
1035 | 1035 | ":feed_language" => $feed_language, |
1036 | 1036 | ":id" => $feed_id, |
1037 | 1037 | ":uid" => $_SESSION['uid']]); |
@@ -1062,57 +1062,57 @@ discard block |
||
1062 | 1062 | |
1063 | 1063 | switch ($k) { |
1064 | 1064 | case "title": |
1065 | - $qpart = "title = " . $this->pdo->quote($feed_title); |
|
1065 | + $qpart = "title = ".$this->pdo->quote($feed_title); |
|
1066 | 1066 | break; |
1067 | 1067 | |
1068 | 1068 | case "feed_url": |
1069 | - $qpart = "feed_url = " . $this->pdo->quote($feed_url); |
|
1069 | + $qpart = "feed_url = ".$this->pdo->quote($feed_url); |
|
1070 | 1070 | break; |
1071 | 1071 | |
1072 | 1072 | case "update_interval": |
1073 | - $qpart = "update_interval = " . $this->pdo->quote($upd_intl); |
|
1073 | + $qpart = "update_interval = ".$this->pdo->quote($upd_intl); |
|
1074 | 1074 | break; |
1075 | 1075 | |
1076 | 1076 | case "purge_interval": |
1077 | - $qpart = "purge_interval =" . $this->pdo->quote($purge_intl); |
|
1077 | + $qpart = "purge_interval =".$this->pdo->quote($purge_intl); |
|
1078 | 1078 | break; |
1079 | 1079 | |
1080 | 1080 | case "auth_login": |
1081 | - $qpart = "auth_login = " . $this->pdo->quote($auth_login); |
|
1081 | + $qpart = "auth_login = ".$this->pdo->quote($auth_login); |
|
1082 | 1082 | break; |
1083 | 1083 | |
1084 | 1084 | case "auth_pass": |
1085 | - $qpart = "auth_pass =" . $this->pdo->quote($auth_pass). ", auth_pass_encrypted = false"; |
|
1085 | + $qpart = "auth_pass =".$this->pdo->quote($auth_pass).", auth_pass_encrypted = false"; |
|
1086 | 1086 | break; |
1087 | 1087 | |
1088 | 1088 | case "private": |
1089 | - $qpart = "private = " . $this->pdo->quote($private); |
|
1089 | + $qpart = "private = ".$this->pdo->quote($private); |
|
1090 | 1090 | break; |
1091 | 1091 | |
1092 | 1092 | case "include_in_digest": |
1093 | - $qpart = "include_in_digest = " . $this->pdo->quote($include_in_digest); |
|
1093 | + $qpart = "include_in_digest = ".$this->pdo->quote($include_in_digest); |
|
1094 | 1094 | break; |
1095 | 1095 | |
1096 | 1096 | case "always_display_enclosures": |
1097 | - $qpart = "always_display_enclosures = " . $this->pdo->quote($always_display_enclosures); |
|
1097 | + $qpart = "always_display_enclosures = ".$this->pdo->quote($always_display_enclosures); |
|
1098 | 1098 | break; |
1099 | 1099 | |
1100 | 1100 | case "mark_unread_on_update": |
1101 | - $qpart = "mark_unread_on_update = " . $this->pdo->quote($mark_unread_on_update); |
|
1101 | + $qpart = "mark_unread_on_update = ".$this->pdo->quote($mark_unread_on_update); |
|
1102 | 1102 | break; |
1103 | 1103 | |
1104 | 1104 | case "cache_images": |
1105 | - $qpart = "cache_images = " . $this->pdo->quote($cache_images); |
|
1105 | + $qpart = "cache_images = ".$this->pdo->quote($cache_images); |
|
1106 | 1106 | break; |
1107 | 1107 | |
1108 | 1108 | case "hide_images": |
1109 | - $qpart = "hide_images = " . $this->pdo->quote($hide_images); |
|
1109 | + $qpart = "hide_images = ".$this->pdo->quote($hide_images); |
|
1110 | 1110 | break; |
1111 | 1111 | |
1112 | 1112 | case "cat_id": |
1113 | 1113 | if (get_pref('ENABLE_FEED_CATS')) { |
1114 | 1114 | if ($cat_id) { |
1115 | - $qpart = "cat_id = " . $this->pdo->quote($cat_id); |
|
1115 | + $qpart = "cat_id = ".$this->pdo->quote($cat_id); |
|
1116 | 1116 | } else { |
1117 | 1117 | $qpart = 'cat_id = NULL'; |
1118 | 1118 | } |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | break; |
1124 | 1124 | |
1125 | 1125 | case "feed_language": |
1126 | - $qpart = "feed_language = " . $this->pdo->quote($feed_language); |
|
1126 | + $qpart = "feed_language = ".$this->pdo->quote($feed_language); |
|
1127 | 1127 | break; |
1128 | 1128 | |
1129 | 1129 | } |
@@ -1184,14 +1184,14 @@ discard block |
||
1184 | 1184 | |
1185 | 1185 | $error_button = "<button dojoType=\"dijit.form.Button\" |
1186 | 1186 | onclick=\"CommonDialogs.showFeedsWithErrors()\" id=\"errorButton\">" . |
1187 | - __("Feeds with errors") . "</button>"; |
|
1187 | + __("Feeds with errors")."</button>"; |
|
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | $inactive_button = "<button dojoType=\"dijit.form.Button\" |
1191 | 1191 | id=\"pref_feeds_inactive_btn\" |
1192 | 1192 | style=\"display : none\" |
1193 | 1193 | onclick=\"dijit.byId('feedTree').showInactiveFeeds()\">" . |
1194 | - __("Inactive feeds") . "</button>"; |
|
1194 | + __("Inactive feeds")."</button>"; |
|
1195 | 1195 | |
1196 | 1196 | $feed_search = clean($_REQUEST["search"]); |
1197 | 1197 | |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | </div>"; |
1214 | 1214 | |
1215 | 1215 | print "<div dojoType=\"fox.form.DropDownButton\">". |
1216 | - "<span>" . __('Select')."</span>"; |
|
1216 | + "<span>".__('Select')."</span>"; |
|
1217 | 1217 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
1218 | 1218 | print "<div onclick=\"dijit.byId('feedTree').model.setAllChecked(true)\" |
1219 | 1219 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | print "</div></div>"; |
1223 | 1223 | |
1224 | 1224 | print "<div dojoType=\"fox.form.DropDownButton\">". |
1225 | - "<span>" . __('Feeds')."</span>"; |
|
1225 | + "<span>".__('Feeds')."</span>"; |
|
1226 | 1226 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
1227 | 1227 | print "<div onclick=\"CommonDialogs.quickAddFeed()\" |
1228 | 1228 | dojoType=\"dijit.MenuItem\">".__('Subscribe to feed')."</div>"; |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | |
1239 | 1239 | if (get_pref('ENABLE_FEED_CATS')) { |
1240 | 1240 | print "<div dojoType=\"fox.form.DropDownButton\">". |
1241 | - "<span>" . __('Categories')."</span>"; |
|
1241 | + "<span>".__('Categories')."</span>"; |
|
1242 | 1242 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
1243 | 1243 | print "<div onclick=\"dijit.byId('feedTree').createCategory()\" |
1244 | 1244 | dojoType=\"dijit.MenuItem\">".__('Add category')."</div>"; |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | print "<div dojoType='dijit.layout.AccordionPane' |
1306 | 1306 | title='<i class=\"material-icons\">import_export</i> ".__('OPML')."'>"; |
1307 | 1307 | |
1308 | - print "<h3>" . __("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.") . "</h3>"; |
|
1308 | + print "<h3>".__("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.")."</h3>"; |
|
1309 | 1309 | |
1310 | 1310 | print_notice("Only main settings profile can be migrated using OPML."); |
1311 | 1311 | |
@@ -1322,7 +1322,7 @@ discard block |
||
1322 | 1322 | <input type='hidden' name='op' value='dlg'> |
1323 | 1323 | <input type='hidden' name='method' value='importOpml'> |
1324 | 1324 | <button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return Helpers.OPML.import();\" type=\"submit\">" . |
1325 | - __('Import OPML') . "</button>"; |
|
1325 | + __('Import OPML')."</button>"; |
|
1326 | 1326 | |
1327 | 1327 | print "</form>"; |
1328 | 1328 | |
@@ -1330,22 +1330,22 @@ discard block |
||
1330 | 1330 | |
1331 | 1331 | print "<button dojoType='dijit.form.Button' |
1332 | 1332 | onclick='Helpers.OPML.export()' >" . |
1333 | - __('Export OPML') . "</button>"; |
|
1333 | + __('Export OPML')."</button>"; |
|
1334 | 1334 | |
1335 | 1335 | print " <label class='checkbox'>"; |
1336 | 1336 | print_checkbox("include_settings", true, "1", ""); |
1337 | - print " " . __("Include settings"); |
|
1337 | + print " ".__("Include settings"); |
|
1338 | 1338 | print "</label>"; |
1339 | 1339 | |
1340 | 1340 | print "</form>"; |
1341 | 1341 | |
1342 | 1342 | print "<p/>"; |
1343 | 1343 | |
1344 | - print "<h2>" . __("Published OPML") . "</h2>"; |
|
1344 | + print "<h2>".__("Published OPML")."</h2>"; |
|
1345 | 1345 | |
1346 | - print "<p>" . __('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.') . |
|
1347 | - " " . |
|
1348 | - __("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.") . "</p>"; |
|
1346 | + print "<p>".__('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.'). |
|
1347 | + " ". |
|
1348 | + __("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.")."</p>"; |
|
1349 | 1349 | |
1350 | 1350 | print "<button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return App.displayDlg('".__("Public OPML URL")."','pubOPMLUrl')\">". |
1351 | 1351 | __('Display published OPML URL')."</button> "; |
@@ -1358,10 +1358,10 @@ discard block |
||
1358 | 1358 | print "<div dojoType=\"dijit.layout.AccordionPane\" |
1359 | 1359 | title=\"<i class='material-icons'>share</i> ".__('Published & shared articles / Generated feeds')."\">"; |
1360 | 1360 | |
1361 | - print "<h3>" . __('Published articles can be subscribed by anyone who knows the following URL:') . "</h3>"; |
|
1361 | + print "<h3>".__('Published articles can be subscribed by anyone who knows the following URL:')."</h3>"; |
|
1362 | 1362 | |
1363 | - $rss_url = '-2::' . htmlspecialchars(get_self_url_prefix() . |
|
1364 | - "/public.php?op=rss&id=-2&view-mode=all_articles");; |
|
1363 | + $rss_url = '-2::'.htmlspecialchars(get_self_url_prefix(). |
|
1364 | + "/public.php?op=rss&id=-2&view-mode=all_articles"); ; |
|
1365 | 1365 | |
1366 | 1366 | print "<button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return App.displayDlg('".__("Show as feed")."','generatedFeed', '$rss_url')\">". |
1367 | 1367 | __('Display URL')."</button> "; |
@@ -1390,7 +1390,7 @@ discard block |
||
1390 | 1390 | $cat_unread = Feeds::getCategoryUnread($cat_id); |
1391 | 1391 | } |
1392 | 1392 | |
1393 | - $obj['id'] = 'CAT:' . $cat_id; |
|
1393 | + $obj['id'] = 'CAT:'.$cat_id; |
|
1394 | 1394 | $obj['items'] = array(); |
1395 | 1395 | $obj['name'] = Feeds::getCategoryTitle($cat_id); |
1396 | 1396 | $obj['type'] = 'category'; |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | if ($unread === false) |
1411 | 1411 | $unread = getFeedUnread($feed_id, false); |
1412 | 1412 | |
1413 | - $obj['id'] = 'FEED:' . $feed_id; |
|
1413 | + $obj['id'] = 'FEED:'.$feed_id; |
|
1414 | 1414 | $obj['name'] = $title; |
1415 | 1415 | $obj['unread'] = (int) $unread; |
1416 | 1416 | $obj['type'] = 'feed'; |
@@ -1446,7 +1446,7 @@ discard block |
||
1446 | 1446 | |
1447 | 1447 | print "<div dojoType='fox.Toolbar'>"; |
1448 | 1448 | print "<div dojoType='fox.form.DropDownButton'>". |
1449 | - "<span>" . __('Select')."</span>"; |
|
1449 | + "<span>".__('Select')."</span>"; |
|
1450 | 1450 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
1451 | 1451 | print "<div onclick=\"Tables.select('inactive-feeds-list', true)\" |
1452 | 1452 | dojoType='dijit.MenuItem'>".__('All')."</div>"; |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | |
1504 | 1504 | print "<div dojoType=\"fox.Toolbar\">"; |
1505 | 1505 | print "<div dojoType=\"fox.form.DropDownButton\">". |
1506 | - "<span>" . __('Select')."</span>"; |
|
1506 | + "<span>".__('Select')."</span>"; |
|
1507 | 1507 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
1508 | 1508 | print "<div onclick=\"Tables.select('error-feeds-list', true)\" |
1509 | 1509 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -1567,7 +1567,7 @@ discard block |
||
1567 | 1567 | |
1568 | 1568 | public static function remove_feed($id, $owner_uid) { |
1569 | 1569 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_UNSUBSCRIBE_FEED) as $p) { |
1570 | - if (! $p->hook_unsubscribe_feed($id, $owner_uid)) { |
|
1570 | + if (!$p->hook_unsubscribe_feed($id, $owner_uid)) { |
|
1571 | 1571 | user_error("Feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING); |
1572 | 1572 | return; |
1573 | 1573 | } |
@@ -1599,7 +1599,7 @@ discard block |
||
1599 | 1599 | $res = $pdo->query("SELECT MAX(id) AS id FROM ttrss_archived_feeds"); |
1600 | 1600 | $row = $res->fetch(); |
1601 | 1601 | |
1602 | - $new_feed_id = (int)$row['id'] + 1; |
|
1602 | + $new_feed_id = (int) $row['id'] + 1; |
|
1603 | 1603 | |
1604 | 1604 | $sth = $pdo->prepare("INSERT INTO ttrss_archived_feeds |
1605 | 1605 | (id, owner_uid, title, feed_url, site_url, created) |
@@ -1631,8 +1631,8 @@ discard block |
||
1631 | 1631 | |
1632 | 1632 | $pdo->commit(); |
1633 | 1633 | |
1634 | - if (file_exists(ICONS_DIR . "/$id.ico")) { |
|
1635 | - unlink(ICONS_DIR . "/$id.ico"); |
|
1634 | + if (file_exists(ICONS_DIR."/$id.ico")) { |
|
1635 | + unlink(ICONS_DIR."/$id.ico"); |
|
1636 | 1636 | } |
1637 | 1637 | |
1638 | 1638 | CCache::remove($id, $owner_uid); |
@@ -1656,7 +1656,7 @@ discard block |
||
1656 | 1656 | |
1657 | 1657 | if (get_pref('ENABLE_FEED_CATS')) { |
1658 | 1658 | print "<fieldset>"; |
1659 | - print "<label>" . __('Place in category:') . "</label> "; |
|
1659 | + print "<label>".__('Place in category:')."</label> "; |
|
1660 | 1660 | print_feed_cat_select("cat", false, 'dojoType="fox.form.Select"'); |
1661 | 1661 | print "</fieldset>"; |
1662 | 1662 | } |
@@ -1665,7 +1665,7 @@ discard block |
||
1665 | 1665 | |
1666 | 1666 | print "<div id='feedDlg_loginContainer' style='display : none'>"; |
1667 | 1667 | |
1668 | - print "<header>" . __("Authentication") . "</header>"; |
|
1668 | + print "<header>".__("Authentication")."</header>"; |
|
1669 | 1669 | print "<section>"; |
1670 | 1670 | |
1671 | 1671 | print "<input dojoType='dijit.form.TextBox' name='login' placeHolder=\"".__("Login")."\"> |
@@ -1784,12 +1784,12 @@ discard block |
||
1784 | 1784 | $sth->execute([$_SESSION['uid']]); |
1785 | 1785 | |
1786 | 1786 | if ($row = $sth->fetch()) { |
1787 | - print (int)$row["num_inactive"]; |
|
1787 | + print (int) $row["num_inactive"]; |
|
1788 | 1788 | } |
1789 | 1789 | } |
1790 | 1790 | |
1791 | 1791 | public static function subscribe_to_feed_url() { |
1792 | - $url_path = get_self_url_prefix() . |
|
1792 | + $url_path = get_self_url_prefix(). |
|
1793 | 1793 | "/public.php?op=subscribe&feed_url=%s"; |
1794 | 1794 | return $url_path; |
1795 | 1795 | } |
@@ -42,10 +42,11 @@ discard block |
||
42 | 42 | |
43 | 43 | private function get_category_items($cat_id) { |
44 | 44 | |
45 | - if (clean($_REQUEST['mode']) != 2) |
|
46 | - $search = $_SESSION["prefs_feed_search"]; |
|
47 | - else |
|
48 | - $search = ""; |
|
45 | + if (clean($_REQUEST['mode']) != 2) { |
|
46 | + $search = $_SESSION["prefs_feed_search"]; |
|
47 | + } else { |
|
48 | + $search = ""; |
|
49 | + } |
|
49 | 50 | |
50 | 51 | // first one is set by API |
51 | 52 | $show_empty_cats = clean($_REQUEST['force_show_empty']) || |
@@ -76,8 +77,9 @@ discard block |
||
76 | 77 | $num_children = $this->calculate_children_count($cat); |
77 | 78 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
78 | 79 | |
79 | - if ($num_children > 0 || $show_empty_cats) |
|
80 | - array_push($items, $cat); |
|
80 | + if ($num_children > 0 || $show_empty_cats) { |
|
81 | + array_push($items, $cat); |
|
82 | + } |
|
81 | 83 | |
82 | 84 | } |
83 | 85 | |
@@ -117,10 +119,11 @@ discard block |
||
117 | 119 | |
118 | 120 | public function makefeedtree() { |
119 | 121 | |
120 | - if (clean($_REQUEST['mode']) != 2) |
|
121 | - $search = $_SESSION["prefs_feed_search"]; |
|
122 | - else |
|
123 | - $search = ""; |
|
122 | + if (clean($_REQUEST['mode']) != 2) { |
|
123 | + $search = $_SESSION["prefs_feed_search"]; |
|
124 | + } else { |
|
125 | + $search = ""; |
|
126 | + } |
|
124 | 127 | |
125 | 128 | $root = array(); |
126 | 129 | $root['id'] = 'root'; |
@@ -231,8 +234,9 @@ discard block |
||
231 | 234 | $num_children = $this->calculate_children_count($cat); |
232 | 235 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
233 | 236 | |
234 | - if ($num_children > 0 || $show_empty_cats) |
|
235 | - array_push($root['items'], $cat); |
|
237 | + if ($num_children > 0 || $show_empty_cats) { |
|
238 | + array_push($root['items'], $cat); |
|
239 | + } |
|
236 | 240 | |
237 | 241 | $root['param'] += count($cat['items']); |
238 | 242 | } |
@@ -279,8 +283,9 @@ discard block |
||
279 | 283 | |
280 | 284 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items'])); |
281 | 285 | |
282 | - if (count($cat['items']) > 0 || $show_empty_cats) |
|
283 | - array_push($root['items'], $cat); |
|
286 | + if (count($cat['items']) > 0 || $show_empty_cats) { |
|
287 | + array_push($root['items'], $cat); |
|
288 | + } |
|
284 | 289 | |
285 | 290 | $num_children = $this->calculate_children_count($root); |
286 | 291 | $root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
@@ -343,8 +348,9 @@ discard block |
||
343 | 348 | private function process_category_order(&$data_map, $item_id, $parent_id = false, $nest_level = 0) { |
344 | 349 | |
345 | 350 | $prefix = ""; |
346 | - for ($i = 0; $i < $nest_level; $i++) |
|
347 | - $prefix .= " "; |
|
351 | + for ($i = 0; $i < $nest_level; $i++) { |
|
352 | + $prefix .= " "; |
|
353 | + } |
|
348 | 354 | |
349 | 355 | Debug::log("$prefix C: $item_id P: $parent_id"); |
350 | 356 | |
@@ -409,8 +415,9 @@ discard block |
||
409 | 415 | #file_put_contents("/tmp/saveorder.json", clean($_POST['payload'])); |
410 | 416 | #$data = json_decode(file_get_contents("/tmp/saveorder.json"), true); |
411 | 417 | |
412 | - if (!is_array($data['items'])) |
|
413 | - $data['items'] = json_decode($data['items'], true); |
|
418 | + if (!is_array($data['items'])) { |
|
419 | + $data['items'] = json_decode($data['items'], true); |
|
420 | + } |
|
414 | 421 | |
415 | 422 | # print_r($data['items']); |
416 | 423 | |
@@ -494,7 +501,9 @@ discard block |
||
494 | 501 | } |
495 | 502 | } |
496 | 503 | |
497 | - if (is_file($icon_file)) @unlink($icon_file); |
|
504 | + if (is_file($icon_file)) { |
|
505 | + @unlink($icon_file); |
|
506 | + } |
|
498 | 507 | |
499 | 508 | print $rc; |
500 | 509 | return; |
@@ -590,8 +599,9 @@ discard block |
||
590 | 599 | if (DB_TYPE == "pgsql") { |
591 | 600 | $feed_language = $row["feed_language"]; |
592 | 601 | |
593 | - if (!$feed_language) |
|
594 | - $feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE'); |
|
602 | + if (!$feed_language) { |
|
603 | + $feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE'); |
|
604 | + } |
|
595 | 605 | |
596 | 606 | print "<fieldset>"; |
597 | 607 | |
@@ -1404,11 +1414,13 @@ discard block |
||
1404 | 1414 | $obj = array(); |
1405 | 1415 | $feed_id = (int) $feed_id; |
1406 | 1416 | |
1407 | - if (!$title) |
|
1408 | - $title = Feeds::getFeedTitle($feed_id, false); |
|
1417 | + if (!$title) { |
|
1418 | + $title = Feeds::getFeedTitle($feed_id, false); |
|
1419 | + } |
|
1409 | 1420 | |
1410 | - if ($unread === false) |
|
1411 | - $unread = getFeedUnread($feed_id, false); |
|
1421 | + if ($unread === false) { |
|
1422 | + $unread = getFeedUnread($feed_id, false); |
|
1423 | + } |
|
1412 | 1424 | |
1413 | 1425 | $obj['id'] = 'FEED:' . $feed_id; |
1414 | 1426 | $obj['name'] = $title; |
@@ -1738,7 +1750,9 @@ discard block |
||
1738 | 1750 | |
1739 | 1751 | |
1740 | 1752 | private function update_feed_access_key($feed_id, $is_cat, $owner_uid = false) { |
1741 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
1753 | + if (!$owner_uid) { |
|
1754 | + $owner_uid = $_SESSION["uid"]; |
|
1755 | + } |
|
1742 | 1756 | |
1743 | 1757 | // clear old value and generate new one |
1744 | 1758 | $sth = $this->pdo->prepare("DELETE FROM ttrss_access_keys |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | "ENABLE_API_ACCESS" => array(__("Enable API"), __("Allows accessing this account through the API")), |
83 | 83 | "ENABLE_FEED_CATS" => array(__("Enable categories")), |
84 | 84 | "FEEDS_SORT_BY_UNREAD" => array(__("Sort feeds by unread articles count"), ""), |
85 | - "FRESH_ARTICLE_MAX_AGE" => array(__("Maximum age of fresh articles"), "<strong>" . __("hours") . "</strong>"), |
|
85 | + "FRESH_ARTICLE_MAX_AGE" => array(__("Maximum age of fresh articles"), "<strong>".__("hours")."</strong>"), |
|
86 | 86 | "HIDE_READ_FEEDS" => array(__("Hide read feeds")), |
87 | 87 | "HIDE_READ_SHOWS_SPECIAL" => array(__("Always show special feeds"), __("While hiding read feeds")), |
88 | 88 | "LONG_DATE_FORMAT" => array(__("Long date format"), __("Syntax is identical to PHP <a href='http://php.net/manual/function.date.php'>date()</a> function.")), |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | if ($_SESSION["auth_module"] == "auth_internal") { |
405 | 405 | |
406 | - print "<div dojoType='dijit.layout.ContentPane' title=\"" . __('App passwords') . "\">"; |
|
406 | + print "<div dojoType='dijit.layout.ContentPane' title=\"".__('App passwords')."\">"; |
|
407 | 407 | |
408 | 408 | print_notice("You can create separate passwords for API clients. Using one is required if you enable OTP."); |
409 | 409 | |
@@ -415,11 +415,11 @@ discard block |
||
415 | 415 | |
416 | 416 | print "<button style='float : left' class='alt-primary' dojoType='dijit.form.Button' |
417 | 417 | onclick=\"Helpers.AppPasswords.generate()\">" . |
418 | - __('Generate new password') . "</button> "; |
|
418 | + __('Generate new password')."</button> "; |
|
419 | 419 | |
420 | 420 | print "<button style='float : left' class='alt-danger' dojoType='dijit.form.Button' |
421 | 421 | onclick=\"Helpers.AppPasswords.removeSelected()\">" . |
422 | - __('Remove selected passwords') . "</button>"; |
|
422 | + __('Remove selected passwords')."</button>"; |
|
423 | 423 | |
424 | 424 | print "</div>"; # content pane |
425 | 425 | } |
@@ -474,13 +474,13 @@ discard block |
||
474 | 474 | print_notice("You will need to generate app passwords for the API clients if you enable OTP."); |
475 | 475 | |
476 | 476 | if (function_exists("imagecreatefromstring")) { |
477 | - print "<h3>" . __("Scan the following code by the Authenticator application or copy the key manually") . "</h3>"; |
|
477 | + print "<h3>".__("Scan the following code by the Authenticator application or copy the key manually")."</h3>"; |
|
478 | 478 | |
479 | 479 | $csrf_token = $_SESSION["csrf_token"]; |
480 | 480 | print "<img alt='otp qr-code' src='backend.php?op=pref-prefs&method=otpqrcode&csrf_token=$csrf_token'>"; |
481 | 481 | } else { |
482 | 482 | print_error("PHP GD functions are required to generate QR codes."); |
483 | - print "<h3>" . __("Use the following OTP key with a compatible Authenticator application") . "</h3>"; |
|
483 | + print "<h3>".__("Use the following OTP key with a compatible Authenticator application")."</h3>"; |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | print "<form dojoType='dijit.form.Form' id='changeOtpForm'>"; |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | print "<fieldset class='prefs'>"; |
648 | 648 | |
649 | 649 | print "<label for='CB_$pref_name'>"; |
650 | - print $item['short_desc'] . ":"; |
|
650 | + print $item['short_desc'].":"; |
|
651 | 651 | print "</label>"; |
652 | 652 | |
653 | 653 | $value = $item['value']; |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | print "</select>"; |
685 | 685 | |
686 | 686 | print " <button dojoType=\"dijit.form.Button\" class='alt-info' |
687 | - onclick=\"Helpers.customizeCSS()\">" . __('Customize') . "</button>"; |
|
687 | + onclick=\"Helpers.customizeCSS()\">" . __('Customize')."</button>"; |
|
688 | 688 | |
689 | 689 | print " <button dojoType='dijit.form.Button' onclick='window.open(\"https://tt-rss.org/wiki/Themes\")'> |
690 | 690 | <i class='material-icons'>open_in_new</i> ".__("More themes...")."</button>"; |
@@ -747,12 +747,12 @@ discard block |
||
747 | 747 | $has_serial = ($cert_serial) ? "false" : "true"; |
748 | 748 | |
749 | 749 | print "<button dojoType='dijit.form.Button' disabled='$has_serial' |
750 | - onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '$cert_serial')\">" . |
|
751 | - __('Register') . "</button>"; |
|
750 | + onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '$cert_serial')\">". |
|
751 | + __('Register')."</button>"; |
|
752 | 752 | |
753 | 753 | print "<button dojoType='dijit.form.Button' class='alt-danger' |
754 | 754 | onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '')\">" . |
755 | - __('Clear') . "</button>"; |
|
755 | + __('Clear')."</button>"; |
|
756 | 756 | |
757 | 757 | print "<button dojoType='dijit.form.Button' class='alt-info' |
758 | 758 | onclick='window.open(\"https://tt-rss.org/wiki/SSL%20Certificate%20Authentication\")'> |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | id=\"$pref_name\" regexp=\"[012]?\d:\d\d\" placeHolder=\"12:00\" |
764 | 764 | name=\"$pref_name\" value=\"$value\">"; |
765 | 765 | |
766 | - $item['help_text'] .= ". " . T_sprintf("Current server time: %s", date("H:i")); |
|
766 | + $item['help_text'] .= ". ".T_sprintf("Current server time: %s", date("H:i")); |
|
767 | 767 | } else { |
768 | 768 | $regexp = ($type_name == 'integer') ? 'regexp="^\d*$"' : ''; |
769 | 769 | |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | print_warning("Your PHP configuration has open_basedir restrictions enabled. Some plugins relying on CURL for functionality may not work correctly."); |
850 | 850 | } |
851 | 851 | |
852 | - $feed_handler_whitelist = [ "Af_Comics" ]; |
|
852 | + $feed_handler_whitelist = ["Af_Comics"]; |
|
853 | 853 | |
854 | 854 | $feed_handlers = array_merge( |
855 | 855 | PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FEED_FETCHED), |
@@ -861,9 +861,9 @@ discard block |
||
861 | 861 | |
862 | 862 | if (count($feed_handlers) > 0) { |
863 | 863 | print_error( |
864 | - T_sprintf("The following plugins use per-feed content hooks. This may cause excessive data usage and origin server load resulting in a ban of your instance: <b>%s</b>" , |
|
864 | + T_sprintf("The following plugins use per-feed content hooks. This may cause excessive data usage and origin server load resulting in a ban of your instance: <b>%s</b>", |
|
865 | 865 | implode(", ", array_map(function($plugin) { return get_class($plugin); }, $feed_handlers)) |
866 | - ) . " (<a href='https://tt-rss.org/wiki/FeedHandlerPlugins' target='_blank'>".__("More info...")."</a>)" |
|
866 | + )." (<a href='https://tt-rss.org/wiki/FeedHandlerPlugins' target='_blank'>".__("More info...")."</a>)" |
|
867 | 867 | ); |
868 | 868 | } |
869 | 869 | |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | <label class='checkbox description text-muted' id='PLABEL-$name'> |
893 | 893 | <input disabled='1' |
894 | 894 | dojoType='dijit.form.CheckBox' $checked type='checkbox'> |
895 | - ".htmlspecialchars($about[1]). "</label>"; |
|
895 | + ".htmlspecialchars($about[1])."</label>"; |
|
896 | 896 | |
897 | 897 | if (@$about[4]) { |
898 | 898 | print "<button dojoType='dijit.form.Button' class='alt-info' |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | print "<div dojoType='fox.Toolbar'>"; |
1155 | 1155 | |
1156 | 1156 | print "<div dojoType='fox.form.DropDownButton'>". |
1157 | - "<span>" . __('Select')."</span>"; |
|
1157 | + "<span>".__('Select')."</span>"; |
|
1158 | 1158 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
1159 | 1159 | print "<div onclick=\"Tables.select('pref-profiles-list', true)\" |
1160 | 1160 | dojoType='dijit.MenuItem'>".__('All')."</div>"; |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | $is_active = ""; |
1193 | 1193 | } |
1194 | 1194 | |
1195 | - print "<td width='100%'><span>" . __("Default profile") . " $is_active</span></td>"; |
|
1195 | + print "<td width='100%'><span>".__("Default profile")." $is_active</span></td>"; |
|
1196 | 1196 | |
1197 | 1197 | print "</tr>"; |
1198 | 1198 | |
@@ -1214,7 +1214,7 @@ discard block |
||
1214 | 1214 | |
1215 | 1215 | print "<td><span dojoType='dijit.InlineEditBox' |
1216 | 1216 | width='300px' autoSave='false' |
1217 | - profile-id='$profile_id'>" . $edit_title . |
|
1217 | + profile-id='$profile_id'>".$edit_title. |
|
1218 | 1218 | "<script type='dojo/method' event='onChange' args='item'> |
1219 | 1219 | var elem = this; |
1220 | 1220 | dojo.xhrPost({ |
@@ -1263,13 +1263,13 @@ discard block |
||
1263 | 1263 | |
1264 | 1264 | private function appPasswordList() { |
1265 | 1265 | print "<div dojoType='fox.Toolbar'>"; |
1266 | - print "<div dojoType='fox.form.DropDownButton'>" . |
|
1267 | - "<span>" . __('Select') . "</span>"; |
|
1266 | + print "<div dojoType='fox.form.DropDownButton'>". |
|
1267 | + "<span>".__('Select')."</span>"; |
|
1268 | 1268 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
1269 | 1269 | print "<div onclick=\"Tables.select('app-password-list', true)\" |
1270 | - dojoType=\"dijit.MenuItem\">" . __('All') . "</div>"; |
|
1270 | + dojoType=\"dijit.MenuItem\">" . __('All')."</div>"; |
|
1271 | 1271 | print "<div onclick=\"Tables.select('app-password-list', false)\" |
1272 | - dojoType=\"dijit.MenuItem\">" . __('None') . "</div>"; |
|
1272 | + dojoType=\"dijit.MenuItem\">" . __('None')."</div>"; |
|
1273 | 1273 | print "</div></div>"; |
1274 | 1274 | print "</div>"; #toolbar |
1275 | 1275 | |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | |
1295 | 1295 | print "<td align='center'> |
1296 | 1296 | <input onclick='Tables.onRowChecked(this)' dojoType='dijit.form.CheckBox' type='checkbox'></td>"; |
1297 | - print "<td>" . htmlspecialchars($row["title"]) . "</td>"; |
|
1297 | + print "<td>".htmlspecialchars($row["title"])."</td>"; |
|
1298 | 1298 | |
1299 | 1299 | print "<td align='right' class='text-muted'>"; |
1300 | 1300 | print make_local_datetime($row['created'], false); |
@@ -1314,7 +1314,7 @@ discard block |
||
1314 | 1314 | private function encryptAppPassword($password) { |
1315 | 1315 | $salt = substr(bin2hex(get_random_bytes(24)), 0, 24); |
1316 | 1316 | |
1317 | - return "SSHA-512:".hash('sha512', $salt . $password). ":$salt"; |
|
1317 | + return "SSHA-512:".hash('sha512', $salt.$password).":$salt"; |
|
1318 | 1318 | } |
1319 | 1319 | |
1320 | 1320 | public function deleteAppPassword() { |
@@ -160,7 +160,9 @@ discard block |
||
160 | 160 | $boolean_prefs = explode(",", clean($_POST["boolean_prefs"])); |
161 | 161 | |
162 | 162 | foreach ($boolean_prefs as $pref) { |
163 | - if (!isset($_POST[$pref])) $_POST[$pref] = 'false'; |
|
163 | + if (!isset($_POST[$pref])) { |
|
164 | + $_POST[$pref] = 'false'; |
|
165 | + } |
|
164 | 166 | } |
165 | 167 | |
166 | 168 | $need_reload = false; |
@@ -180,11 +182,15 @@ discard block |
||
180 | 182 | } |
181 | 183 | break; |
182 | 184 | case 'USER_LANGUAGE': |
183 | - if (!$need_reload) $need_reload = $_SESSION["language"] != $value; |
|
185 | + if (!$need_reload) { |
|
186 | + $need_reload = $_SESSION["language"] != $value; |
|
187 | + } |
|
184 | 188 | break; |
185 | 189 | |
186 | 190 | case 'USER_CSS_THEME': |
187 | - if (!$need_reload) $need_reload = get_pref($pref_name) != $value; |
|
191 | + if (!$need_reload) { |
|
192 | + $need_reload = get_pref($pref_name) != $value; |
|
193 | + } |
|
188 | 194 | break; |
189 | 195 | } |
190 | 196 | |
@@ -616,8 +622,9 @@ discard block |
||
616 | 622 | $pref_name = $line["pref_name"]; |
617 | 623 | $short_desc = $this->getShortDesc($pref_name); |
618 | 624 | |
619 | - if (!$short_desc) |
|
620 | - continue; |
|
625 | + if (!$short_desc) { |
|
626 | + continue; |
|
627 | + } |
|
621 | 628 | |
622 | 629 | $prefs_available[$pref_name] = [ |
623 | 630 | 'type_name' => $line["type_name"], |
@@ -669,7 +676,9 @@ discard block |
||
669 | 676 | $themes = array_filter($themes, "theme_exists"); |
670 | 677 | asort($themes); |
671 | 678 | |
672 | - if (!theme_exists($value)) $value = "default.php"; |
|
679 | + if (!theme_exists($value)) { |
|
680 | + $value = "default.php"; |
|
681 | + } |
|
673 | 682 | |
674 | 683 | print "<select name='$pref_name' id='$pref_name' dojoType='fox.form.Select'>"; |
675 | 684 | |
@@ -728,14 +737,15 @@ discard block |
||
728 | 737 | $disabled = ""; |
729 | 738 | } |
730 | 739 | |
731 | - if ($type_name == 'integer') |
|
732 | - print "<input dojoType=\"dijit.form.NumberSpinner\" |
|
740 | + if ($type_name == 'integer') { |
|
741 | + print "<input dojoType=\"dijit.form.NumberSpinner\" |
|
733 | 742 | required='1' $disabled |
734 | 743 | name=\"$pref_name\" value=\"$value\">"; |
735 | - else |
|
736 | - print "<input dojoType=\"dijit.form.TextBox\" |
|
744 | + } else { |
|
745 | + print "<input dojoType=\"dijit.form.TextBox\" |
|
737 | 746 | required='1' $regexp $disabled |
738 | 747 | name=\"$pref_name\" value=\"$value\">"; |
748 | + } |
|
739 | 749 | |
740 | 750 | } else if ($pref_name == "SSL_CERT_SERIAL") { |
741 | 751 | |
@@ -770,8 +780,9 @@ discard block |
||
770 | 780 | print "<input dojoType=\"dijit.form.ValidationTextBox\" $regexp name=\"$pref_name\" value=\"$value\">"; |
771 | 781 | } |
772 | 782 | |
773 | - if ($item['help_text']) |
|
774 | - print "<div class='help-text text-muted'><label for='CB_$pref_name'>".$item['help_text']."</label></div>"; |
|
783 | + if ($item['help_text']) { |
|
784 | + print "<div class='help-text text-muted'><label for='CB_$pref_name'>".$item['help_text']."</label></div>"; |
|
785 | + } |
|
775 | 786 | |
776 | 787 | print "</fieldset>"; |
777 | 788 | } |
@@ -1108,10 +1119,11 @@ discard block |
||
1108 | 1119 | } |
1109 | 1120 | |
1110 | 1121 | public function setplugins() { |
1111 | - if (is_array(clean($_REQUEST["plugins"]))) |
|
1112 | - $plugins = join(",", clean($_REQUEST["plugins"])); |
|
1113 | - else |
|
1114 | - $plugins = ""; |
|
1122 | + if (is_array(clean($_REQUEST["plugins"]))) { |
|
1123 | + $plugins = join(",", clean($_REQUEST["plugins"])); |
|
1124 | + } else { |
|
1125 | + $plugins = ""; |
|
1126 | + } |
|
1115 | 1127 | |
1116 | 1128 | set_pref("_ENABLED_PLUGINS", $plugins); |
1117 | 1129 | } |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | |
81 | 81 | if (strpos($feed_id, "CAT:") === 0) { |
82 | 82 | $cat_id = (int) substr($feed_id, 4); |
83 | - array_push($scope_inner_qparts, "cat_id = " . $this->pdo->quote($cat_id)); |
|
83 | + array_push($scope_inner_qparts, "cat_id = ".$this->pdo->quote($cat_id)); |
|
84 | 84 | } else if ($feed_id > 0) { |
85 | - array_push($scope_inner_qparts, "feed_id = " . $this->pdo->quote($feed_id)); |
|
85 | + array_push($scope_inner_qparts, "feed_id = ".$this->pdo->quote($feed_id)); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | 89 | if (count($scope_inner_qparts) > 0) { |
90 | - array_push($scope_qparts, "(" . implode(" OR ", $scope_inner_qparts) . ")"); |
|
90 | + array_push($scope_qparts, "(".implode(" OR ", $scope_inner_qparts).")"); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | array_push($filter["rules"], $rule); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | if (count($scope_qparts) == 0) $scope_qparts = ["true"]; |
102 | 102 | |
103 | - $glue = $filter['match_any_rule'] ? " OR " : " AND "; |
|
103 | + $glue = $filter['match_any_rule'] ? " OR " : " AND "; |
|
104 | 104 | $scope_qpart = join($glue, $scope_qparts); |
105 | 105 | |
106 | 106 | if (!$scope_qpart) $scope_qpart = "true"; |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | |
147 | 147 | $content_preview = $line["content_preview"]; |
148 | 148 | |
149 | - $tmp = "<li><span class='title'>" . $line["title"] . "</span><br/>" . |
|
150 | - "<span class='feed'>" . $line['feed_title'] . "</span>, <span class='date'>" . mb_substr($line["date_entered"], 0, 16) . "</span>" . |
|
151 | - "<div class='preview text-muted'>" . $content_preview . "</div>" . |
|
149 | + $tmp = "<li><span class='title'>".$line["title"]."</span><br/>". |
|
150 | + "<span class='feed'>".$line['feed_title']."</span>, <span class='date'>".mb_substr($line["date_entered"], 0, 16)."</span>". |
|
151 | + "<div class='preview text-muted'>".$content_preview."</div>". |
|
152 | 152 | "</li>"; |
153 | 153 | |
154 | 154 | array_push($rv, $tmp); |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | foreach ($feeds as $feed_id) { |
204 | 204 | |
205 | 205 | if (strpos($feed_id, "CAT:") === 0) { |
206 | - $feed_id = (int)substr($feed_id, 4); |
|
206 | + $feed_id = (int) substr($feed_id, 4); |
|
207 | 207 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
208 | 208 | } else { |
209 | 209 | if ($feed_id) |
210 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
210 | + array_push($feeds_fmt, Feeds::getFeedTitle((int) $feed_id)); |
|
211 | 211 | else |
212 | 212 | array_push($feeds_fmt, __("All feeds")); |
213 | 213 | } |
@@ -218,8 +218,7 @@ discard block |
||
218 | 218 | } else { |
219 | 219 | |
220 | 220 | $where = $line["cat_filter"] ? |
221 | - Feeds::getCategoryTitle($line["cat_id"]) : |
|
222 | - ($line["feed_id"] ? |
|
221 | + Feeds::getCategoryTitle($line["cat_id"]) : ($line["feed_id"] ? |
|
223 | 222 | Feeds::getFeedTitle($line["feed_id"]) : __("All feeds")); |
224 | 223 | } |
225 | 224 | |
@@ -227,11 +226,11 @@ discard block |
||
227 | 226 | |
228 | 227 | $inverse = $line["inverse"] ? "inverse" : ""; |
229 | 228 | |
230 | - $rv .= "<li class='$inverse'>" . T_sprintf("%s on %s in %s %s", |
|
229 | + $rv .= "<li class='$inverse'>".T_sprintf("%s on %s in %s %s", |
|
231 | 230 | htmlspecialchars($line["reg_exp"]), |
232 | 231 | $line["field"], |
233 | 232 | $where, |
234 | - $line["inverse"] ? __("(inverse)") : "") . "</li>"; |
|
233 | + $line["inverse"] ? __("(inverse)") : "")."</li>"; |
|
235 | 234 | } |
236 | 235 | |
237 | 236 | return $rv; |
@@ -294,12 +293,12 @@ discard block |
||
294 | 293 | //$fg_color = $label_row["fg_color"]; |
295 | 294 | $bg_color = $label_row["bg_color"]; |
296 | 295 | |
297 | - $name[1] = "<i class=\"material-icons\" style='color : $bg_color; margin-right : 4px'>label</i>" . $name[1]; |
|
296 | + $name[1] = "<i class=\"material-icons\" style='color : $bg_color; margin-right : 4px'>label</i>".$name[1]; |
|
298 | 297 | } |
299 | 298 | } |
300 | 299 | |
301 | 300 | $filter = array(); |
302 | - $filter['id'] = 'FILTER:' . $line['id']; |
|
301 | + $filter['id'] = 'FILTER:'.$line['id']; |
|
303 | 302 | $filter['bare_id'] = $line['id']; |
304 | 303 | $filter['name'] = $name[0]; |
305 | 304 | $filter['param'] = $name[1]; |
@@ -357,7 +356,7 @@ discard block |
||
357 | 356 | print "<div dojoType=\"fox.Toolbar\">"; |
358 | 357 | |
359 | 358 | print "<div dojoType=\"fox.form.DropDownButton\">". |
360 | - "<span>" . __('Select')."</span>"; |
|
359 | + "<span>".__('Select')."</span>"; |
|
361 | 360 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
362 | 361 | print "<div onclick=\"dijit.byId('filterEditDlg').selectRules(true)\" |
363 | 362 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -384,12 +383,12 @@ discard block |
||
384 | 383 | $line["feed_id"] = json_decode($line["match_on"], true); |
385 | 384 | } else { |
386 | 385 | if ($line["cat_filter"]) { |
387 | - $feed_id = "CAT:" . (int)$line["cat_id"]; |
|
386 | + $feed_id = "CAT:".(int) $line["cat_id"]; |
|
388 | 387 | } else { |
389 | - $feed_id = (int)$line["feed_id"]; |
|
388 | + $feed_id = (int) $line["feed_id"]; |
|
390 | 389 | } |
391 | 390 | |
392 | - $line["feed_id"] = ["" . $feed_id]; // set item type to string for in_array() |
|
391 | + $line["feed_id"] = ["".$feed_id]; // set item type to string for in_array() |
|
393 | 392 | } |
394 | 393 | |
395 | 394 | unset($line["cat_filter"]); |
@@ -417,7 +416,7 @@ discard block |
||
417 | 416 | print "<div dojoType=\"fox.Toolbar\">"; |
418 | 417 | |
419 | 418 | print "<div dojoType=\"fox.form.DropDownButton\">". |
420 | - "<span>" . __('Select')."</span>"; |
|
419 | + "<span>".__('Select')."</span>"; |
|
421 | 420 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
422 | 421 | print "<div onclick=\"dijit.byId('filterEditDlg').selectActions(true)\" |
423 | 422 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -528,11 +527,11 @@ discard block |
||
528 | 527 | foreach ($feeds as $feed_id) { |
529 | 528 | |
530 | 529 | if (strpos($feed_id, "CAT:") === 0) { |
531 | - $feed_id = (int)substr($feed_id, 4); |
|
530 | + $feed_id = (int) substr($feed_id, 4); |
|
532 | 531 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
533 | 532 | } else { |
534 | 533 | if ($feed_id) |
535 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
534 | + array_push($feeds_fmt, Feeds::getFeedTitle((int) $feed_id)); |
|
536 | 535 | else |
537 | 536 | array_push($feeds_fmt, __("All feeds")); |
538 | 537 | } |
@@ -542,7 +541,7 @@ discard block |
||
542 | 541 | |
543 | 542 | $sth = $this->pdo->prepare("SELECT description FROM ttrss_filter_types |
544 | 543 | WHERE id = ?"); |
545 | - $sth->execute([(int)$rule["filter_type"]]); |
|
544 | + $sth->execute([(int) $rule["filter_type"]]); |
|
546 | 545 | |
547 | 546 | if ($row = $sth->fetch()) { |
548 | 547 | $filter_type = $row["description"]; |
@@ -552,9 +551,9 @@ discard block |
||
552 | 551 | |
553 | 552 | $inverse = isset($rule["inverse"]) ? "inverse" : ""; |
554 | 553 | |
555 | - return "<span class='filterRule $inverse'>" . |
|
554 | + return "<span class='filterRule $inverse'>". |
|
556 | 555 | T_sprintf("%s on %s in %s %s", htmlspecialchars($rule["reg_exp"]), |
557 | - $filter_type, $feed, isset($rule["inverse"]) ? __("(inverse)") : "") . "</span>"; |
|
556 | + $filter_type, $feed, isset($rule["inverse"]) ? __("(inverse)") : "")."</span>"; |
|
558 | 557 | } |
559 | 558 | |
560 | 559 | public function printRuleName() { |
@@ -564,7 +563,7 @@ discard block |
||
564 | 563 | private function getActionName($action) { |
565 | 564 | $sth = $this->pdo->prepare("SELECT description FROM |
566 | 565 | ttrss_filter_actions WHERE id = ?"); |
567 | - $sth->execute([(int)$action["action_id"]]); |
|
566 | + $sth->execute([(int) $action["action_id"]]); |
|
568 | 567 | |
569 | 568 | $title = ""; |
570 | 569 | |
@@ -574,7 +573,7 @@ discard block |
||
574 | 573 | |
575 | 574 | if ($action["action_id"] == 4 || $action["action_id"] == 6 || |
576 | 575 | $action["action_id"] == 7) |
577 | - $title .= ": " . $action["action_param"]; |
|
576 | + $title .= ": ".$action["action_param"]; |
|
578 | 577 | |
579 | 578 | if ($action["action_id"] == 9) { |
580 | 579 | list ($pfclass, $pfaction) = explode(":", $action["action_param"]); |
@@ -584,7 +583,7 @@ discard block |
||
584 | 583 | foreach ($filter_actions as $fclass => $factions) { |
585 | 584 | foreach ($factions as $faction) { |
586 | 585 | if ($pfaction == $faction["action"] && $pfclass == $fclass) { |
587 | - $title .= ": " . $fclass . ": " . $faction["description"]; |
|
586 | + $title .= ": ".$fclass.": ".$faction["description"]; |
|
588 | 587 | break; |
589 | 588 | } |
590 | 589 | } |
@@ -681,7 +680,7 @@ discard block |
||
681 | 680 | $reg_exp = trim($rule["reg_exp"]); |
682 | 681 | $inverse = isset($rule["inverse"]) ? 1 : 0; |
683 | 682 | |
684 | - $filter_type = (int)trim($rule["filter_type"]); |
|
683 | + $filter_type = (int) trim($rule["filter_type"]); |
|
685 | 684 | $match_on = json_encode($rule["feed_id"]); |
686 | 685 | |
687 | 686 | $rsth->execute([$filter_id, $reg_exp, $filter_type, $match_on, $inverse]); |
@@ -695,7 +694,7 @@ discard block |
||
695 | 694 | foreach ($actions as $action) { |
696 | 695 | if ($action) { |
697 | 696 | |
698 | - $action_id = (int)$action["action_id"]; |
|
697 | + $action_id = (int) $action["action_id"]; |
|
699 | 698 | $action_param = $action["action_param"]; |
700 | 699 | $action_param_label = $action["action_param_label"]; |
701 | 700 | |
@@ -704,7 +703,7 @@ discard block |
||
704 | 703 | } |
705 | 704 | |
706 | 705 | if ($action_id == 6) { |
707 | - $action_param = (int)str_replace("+", "", $action_param); |
|
706 | + $action_param = (int) str_replace("+", "", $action_param); |
|
708 | 707 | } |
709 | 708 | |
710 | 709 | $asth->execute([$filter_id, $action_id, $action_param]); |
@@ -773,7 +772,7 @@ discard block |
||
773 | 772 | </div>"; |
774 | 773 | |
775 | 774 | print "<div dojoType=\"fox.form.DropDownButton\">". |
776 | - "<span>" . __('Select')."</span>"; |
|
775 | + "<span>".__('Select')."</span>"; |
|
777 | 776 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
778 | 777 | print "<div onclick=\"dijit.byId('filterTree').model.setAllChecked(true)\" |
779 | 778 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -859,7 +858,7 @@ discard block |
||
859 | 858 | print "<div dojoType='fox.Toolbar'>"; |
860 | 859 | |
861 | 860 | print "<div dojoType='fox.form.DropDownButton'>". |
862 | - "<span>" . __('Select')."</span>"; |
|
861 | + "<span>".__('Select')."</span>"; |
|
863 | 862 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
864 | 863 | print "<div onclick=\"dijit.byId('filterEditDlg').selectRules(true)\" |
865 | 864 | dojoType='dijit.MenuItem'>".__('All')."</div>"; |
@@ -888,7 +887,7 @@ discard block |
||
888 | 887 | print "<div dojoType='fox.Toolbar'>"; |
889 | 888 | |
890 | 889 | print "<div dojoType='fox.form.DropDownButton'>". |
891 | - "<span>" . __('Select')."</span>"; |
|
890 | + "<span>".__('Select')."</span>"; |
|
892 | 891 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
893 | 892 | print "<div onclick=\"dijit.byId('filterEditDlg').selectActions(true)\" |
894 | 893 | dojoType='dijit.MenuItem'>".__('All')."</div>"; |
@@ -992,10 +991,10 @@ discard block |
||
992 | 991 | print "</fieldset>"; |
993 | 992 | |
994 | 993 | print "<fieldset>"; |
995 | - print "<label style='display : inline'>". __("on field") . "</label> "; |
|
994 | + print "<label style='display : inline'>".__("on field")."</label> "; |
|
996 | 995 | print_select_hash("filter_type", $filter_type, $filter_types, |
997 | 996 | 'dojoType="fox.form.Select"'); |
998 | - print "<label style='padding-left : 10px; display : inline'>" . __("in") . "</label> "; |
|
997 | + print "<label style='padding-left : 10px; display : inline'>".__("in")."</label> "; |
|
999 | 998 | |
1000 | 999 | print "</fieldset>"; |
1001 | 1000 | |
@@ -1031,7 +1030,7 @@ discard block |
||
1031 | 1030 | |
1032 | 1031 | if ($action) { |
1033 | 1032 | $action_param = $action["action_param"]; |
1034 | - $action_id = (int)$action["action_id"]; |
|
1033 | + $action_id = (int) $action["action_id"]; |
|
1035 | 1034 | } else { |
1036 | 1035 | $action_param = ""; |
1037 | 1036 | $action_id = 0; |
@@ -1062,8 +1061,8 @@ discard block |
||
1062 | 1061 | $param_hidden = ($action_id == 4 || $action_id == 6) ? |
1063 | 1062 | "" : "display : none"; |
1064 | 1063 | |
1065 | - $label_param_hidden = ($action_id == 7) ? "" : "display : none"; |
|
1066 | - $plugin_param_hidden = ($action_id == 9) ? "" : "display : none"; |
|
1064 | + $label_param_hidden = ($action_id == 7) ? "" : "display : none"; |
|
1065 | + $plugin_param_hidden = ($action_id == 9) ? "" : "display : none"; |
|
1067 | 1066 | |
1068 | 1067 | print "<span id='filterDlg_paramBox' style=\"$param_box_hidden\">"; |
1069 | 1068 | print " "; |
@@ -1082,8 +1081,8 @@ discard block |
||
1082 | 1081 | foreach ($filter_actions as $fclass => $factions) { |
1083 | 1082 | foreach ($factions as $faction) { |
1084 | 1083 | |
1085 | - $filter_action_hash[$fclass . ":" . $faction["action"]] = |
|
1086 | - $fclass . ": " . $faction["description"]; |
|
1084 | + $filter_action_hash[$fclass.":".$faction["action"]] = |
|
1085 | + $fclass.": ".$faction["description"]; |
|
1087 | 1086 | } |
1088 | 1087 | } |
1089 | 1088 | |
@@ -1153,8 +1152,8 @@ discard block |
||
1153 | 1152 | $num_actions -= 1; |
1154 | 1153 | } |
1155 | 1154 | |
1156 | - if ($match_any_rule) $title .= " (" . __("matches any rule") . ")"; |
|
1157 | - if ($inverse) $title .= " (" . __("inverse") . ")"; |
|
1155 | + if ($match_any_rule) $title .= " (".__("matches any rule").")"; |
|
1156 | + if ($inverse) $title .= " (".__("inverse").")"; |
|
1158 | 1157 | |
1159 | 1158 | if ($num_actions > 0) |
1160 | 1159 | $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); |
@@ -21,8 +21,9 @@ discard block |
||
21 | 21 | #file_put_contents("/tmp/saveorder.json", clean($_POST['payload'])); |
22 | 22 | #$data = json_decode(file_get_contents("/tmp/saveorder.json"), true); |
23 | 23 | |
24 | - if (!is_array($data['items'])) |
|
25 | - $data['items'] = json_decode($data['items'], true); |
|
24 | + if (!is_array($data['items'])) { |
|
25 | + $data['items'] = json_decode($data['items'], true); |
|
26 | + } |
|
26 | 27 | |
27 | 28 | $index = 0; |
28 | 29 | |
@@ -98,12 +99,16 @@ discard block |
||
98 | 99 | } |
99 | 100 | } |
100 | 101 | |
101 | - if (count($scope_qparts) == 0) $scope_qparts = ["true"]; |
|
102 | + if (count($scope_qparts) == 0) { |
|
103 | + $scope_qparts = ["true"]; |
|
104 | + } |
|
102 | 105 | |
103 | 106 | $glue = $filter['match_any_rule'] ? " OR " : " AND "; |
104 | 107 | $scope_qpart = join($glue, $scope_qparts); |
105 | 108 | |
106 | - if (!$scope_qpart) $scope_qpart = "true"; |
|
109 | + if (!$scope_qpart) { |
|
110 | + $scope_qpart = "true"; |
|
111 | + } |
|
107 | 112 | |
108 | 113 | $rv = array(); |
109 | 114 | |
@@ -161,7 +166,9 @@ discard block |
||
161 | 166 | |
162 | 167 | public function testFilter() { |
163 | 168 | |
164 | - if (isset($_REQUEST["offset"])) return $this->testFilterDo(); |
|
169 | + if (isset($_REQUEST["offset"])) { |
|
170 | + return $this->testFilterDo(); |
|
171 | + } |
|
165 | 172 | |
166 | 173 | //print __("Articles matching this filter:"); |
167 | 174 | |
@@ -206,10 +213,11 @@ discard block |
||
206 | 213 | $feed_id = (int)substr($feed_id, 4); |
207 | 214 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
208 | 215 | } else { |
209 | - if ($feed_id) |
|
210 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
211 | - else |
|
212 | - array_push($feeds_fmt, __("All feeds")); |
|
216 | + if ($feed_id) { |
|
217 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
218 | + } else { |
|
219 | + array_push($feeds_fmt, __("All feeds")); |
|
220 | + } |
|
213 | 221 | } |
214 | 222 | } |
215 | 223 | |
@@ -396,7 +404,9 @@ discard block |
||
396 | 404 | unset($line["cat_id"]); |
397 | 405 | unset($line["filter_id"]); |
398 | 406 | unset($line["id"]); |
399 | - if (!$line["inverse"]) unset($line["inverse"]); |
|
407 | + if (!$line["inverse"]) { |
|
408 | + unset($line["inverse"]); |
|
409 | + } |
|
400 | 410 | unset($line["match_on"]); |
401 | 411 | |
402 | 412 | $data = htmlspecialchars(json_encode($line)); |
@@ -518,12 +528,16 @@ discard block |
||
518 | 528 | } |
519 | 529 | |
520 | 530 | private function getRuleName($rule) { |
521 | - if (!$rule) $rule = json_decode(clean($_REQUEST["rule"]), true); |
|
531 | + if (!$rule) { |
|
532 | + $rule = json_decode(clean($_REQUEST["rule"]), true); |
|
533 | + } |
|
522 | 534 | |
523 | 535 | $feeds = $rule["feed_id"]; |
524 | 536 | $feeds_fmt = []; |
525 | 537 | |
526 | - if (!is_array($feeds)) $feeds = [$feeds]; |
|
538 | + if (!is_array($feeds)) { |
|
539 | + $feeds = [$feeds]; |
|
540 | + } |
|
527 | 541 | |
528 | 542 | foreach ($feeds as $feed_id) { |
529 | 543 | |
@@ -531,10 +545,11 @@ discard block |
||
531 | 545 | $feed_id = (int)substr($feed_id, 4); |
532 | 546 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
533 | 547 | } else { |
534 | - if ($feed_id) |
|
535 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
536 | - else |
|
537 | - array_push($feeds_fmt, __("All feeds")); |
|
548 | + if ($feed_id) { |
|
549 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
550 | + } else { |
|
551 | + array_push($feeds_fmt, __("All feeds")); |
|
552 | + } |
|
538 | 553 | } |
539 | 554 | } |
540 | 555 | |
@@ -573,8 +588,9 @@ discard block |
||
573 | 588 | $title = __($row["description"]); |
574 | 589 | |
575 | 590 | if ($action["action_id"] == 4 || $action["action_id"] == 6 || |
576 | - $action["action_id"] == 7) |
|
577 | - $title .= ": " . $action["action_param"]; |
|
591 | + $action["action_id"] == 7) { |
|
592 | + $title .= ": " . $action["action_param"]; |
|
593 | + } |
|
578 | 594 | |
579 | 595 | if ($action["action_id"] == 9) { |
580 | 596 | list ($pfclass, $pfaction) = explode(":", $action["action_param"]); |
@@ -644,8 +660,12 @@ discard block |
||
644 | 660 | $sth = $this->pdo->prepare("DELETE FROM ttrss_filters2_actions WHERE filter_id = ?"); |
645 | 661 | $sth->execute([$filter_id]); |
646 | 662 | |
647 | - if (!is_array(clean($_REQUEST["rule"]))) $_REQUEST["rule"] = []; |
|
648 | - if (!is_array(clean($_REQUEST["action"]))) $_REQUEST["action"] = []; |
|
663 | + if (!is_array(clean($_REQUEST["rule"]))) { |
|
664 | + $_REQUEST["rule"] = []; |
|
665 | + } |
|
666 | + if (!is_array(clean($_REQUEST["action"]))) { |
|
667 | + $_REQUEST["action"] = []; |
|
668 | + } |
|
649 | 669 | |
650 | 670 | if ($filter_id) { |
651 | 671 | /* create rules */ |
@@ -1137,7 +1157,9 @@ discard block |
||
1137 | 1157 | $match_any_rule = $row["match_any_rule"]; |
1138 | 1158 | $inverse = $row["inverse"]; |
1139 | 1159 | |
1140 | - if (!$title) $title = __("[No caption]"); |
|
1160 | + if (!$title) { |
|
1161 | + $title = __("[No caption]"); |
|
1162 | + } |
|
1141 | 1163 | |
1142 | 1164 | $title = sprintf(_ngettext("%s (%d rule)", "%s (%d rules)", (int) $num_rules), $title, $num_rules); |
1143 | 1165 | |
@@ -1153,11 +1175,16 @@ discard block |
||
1153 | 1175 | $num_actions -= 1; |
1154 | 1176 | } |
1155 | 1177 | |
1156 | - if ($match_any_rule) $title .= " (" . __("matches any rule") . ")"; |
|
1157 | - if ($inverse) $title .= " (" . __("inverse") . ")"; |
|
1178 | + if ($match_any_rule) { |
|
1179 | + $title .= " (" . __("matches any rule") . ")"; |
|
1180 | + } |
|
1181 | + if ($inverse) { |
|
1182 | + $title .= " (" . __("inverse") . ")"; |
|
1183 | + } |
|
1158 | 1184 | |
1159 | - if ($num_actions > 0) |
|
1160 | - $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); |
|
1185 | + if ($num_actions > 0) { |
|
1186 | + $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); |
|
1187 | + } |
|
1161 | 1188 | |
1162 | 1189 | return [$title, $actions]; |
1163 | 1190 | } |