@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
43 | - * Load the data of an album |
|
44 | - * |
|
45 | - * @param int $album_id |
|
46 | - * @return bool True if the album was loaded |
|
47 | - * @throws \OutOfBoundsException if the album does not exist |
|
48 | - */ |
|
43 | + * Load the data of an album |
|
44 | + * |
|
45 | + * @param int $album_id |
|
46 | + * @return bool True if the album was loaded |
|
47 | + * @throws \OutOfBoundsException if the album does not exist |
|
48 | + */ |
|
49 | 49 | public function load($album_id) |
50 | 50 | { |
51 | 51 | $sql_array = array( |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | - * Check whether the album_user is the user who wants to do something |
|
111 | - * |
|
112 | - * @param int $album_id |
|
113 | - * @param mixed $user_id If false the current user will be compared |
|
114 | - * @return bool True if the user is the owner of the album |
|
115 | - * @throws \DomainException if the user is not the owner of the album |
|
116 | - */ |
|
110 | + * Check whether the album_user is the user who wants to do something |
|
111 | + * |
|
112 | + * @param int $album_id |
|
113 | + * @param mixed $user_id If false the current user will be compared |
|
114 | + * @return bool True if the user is the owner of the album |
|
115 | + * @throws \DomainException if the user is not the owner of the album |
|
116 | + */ |
|
117 | 117 | public function validate_owner($album_id, $user_id = false) |
118 | 118 | { |
119 | 119 | $album_id = (int) $album_id; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | else |
168 | 168 | { |
169 | - $contest_data['contest_start'] = gmmktime((int) $m[4], (int) $m[5], 0, (int) $m[2], (int) $m[3], (int) $m[1]) - $time->getOffset();// - $offset; |
|
169 | + $contest_data['contest_start'] = gmmktime((int) $m[4], (int) $m[5], 0, (int) $m[2], (int) $m[3], (int) $m[1]) - $time->getOffset(); // - $offset; |
|
170 | 170 | } |
171 | 171 | if (!preg_match('#(\\d{4})-(\\d{1,2})-(\\d{1,2}) (\\d{1,2}):(\\d{2})#', $contest_data['contest_rating'], $m)) |
172 | 172 | { |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | else if (!$start_date_error) |
177 | 177 | { |
178 | - $contest_data['contest_rating'] = gmmktime($m[4], $m[5], 0, $m[2], $m[3], $m[1]) - $contest_data['contest_start'] - $time->getOffset();//- $offset; |
|
178 | + $contest_data['contest_rating'] = gmmktime($m[4], $m[5], 0, $m[2], $m[3], $m[1]) - $contest_data['contest_start'] - $time->getOffset(); //- $offset; |
|
179 | 179 | } |
180 | 180 | if (!preg_match('#(\\d{4})-(\\d{1,2})-(\\d{1,2}) (\\d{1,2}):(\\d{2})#', $contest_data['contest_end'], $m)) |
181 | 181 | { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | else if (!$start_date_error) |
186 | 186 | { |
187 | - $contest_data['contest_end'] = gmmktime($m[4], $m[5], 0, $m[2], $m[3], $m[1]) - $contest_data['contest_start'] - $time->getOffset();//- $offset; |
|
187 | + $contest_data['contest_end'] = gmmktime($m[4], $m[5], 0, $m[2], $m[3], $m[1]) - $contest_data['contest_start'] - $time->getOffset(); //- $offset; |
|
188 | 188 | } |
189 | 189 | if (!$start_date_error && !$date_error) |
190 | 190 | { |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | $album_data = $this->gallery_album->get_info($album_id); |
711 | 711 | |
712 | 712 | $sql = 'UPDATE ' . $this->albums_table . ' |
713 | - SET parent_id = ' . (int) $subalbums_to_id .' |
|
713 | + SET parent_id = ' . (int) $subalbums_to_id . ' |
|
714 | 714 | WHERE parent_id = ' . (int) $album_id . ' |
715 | 715 | AND album_user_id = ' . (int) $this->user_id; |
716 | 716 | $this->db->sql_query($sql); |
@@ -738,13 +738,13 @@ discard block |
||
738 | 738 | // Resync tree |
739 | 739 | $sql = 'UPDATE ' . $this->albums_table . ' |
740 | 740 | SET right_id = right_id - ' . (int) $diff . ' |
741 | - WHERE left_id < ' . (int) $album_data['right_id'] . ' AND right_id > ' . (int) $album_data['right_id']. ' |
|
741 | + WHERE left_id < ' . (int) $album_data['right_id'] . ' AND right_id > ' . (int) $album_data['right_id'] . ' |
|
742 | 742 | AND album_user_id = ' . (int) $this->user_id; |
743 | 743 | $this->db->sql_query($sql); |
744 | 744 | |
745 | 745 | $sql = 'UPDATE ' . $this->albums_table . ' |
746 | 746 | SET left_id = left_id - ' . (int) $diff . ', right_id = right_id - ' . (int) $diff . ' |
747 | - WHERE left_id > ' . (int) $album_data['right_id']. ' |
|
747 | + WHERE left_id > ' . (int) $album_data['right_id'] . ' |
|
748 | 748 | AND album_user_id = ' . (int) $this->user_id; |
749 | 749 | $this->db->sql_query($sql); |
750 | 750 | |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | // Now do the dirty job |
1038 | 1038 | $sql = 'UPDATE ' . $this->albums_table . ' |
1039 | 1039 | SET left_id = left_id + CASE |
1040 | - WHEN left_id BETWEEN ' . (int) $move_up_left . ' AND ' . (int) $move_up_right . ' THEN -' .(int) $diff_up . ' |
|
1040 | + WHEN left_id BETWEEN ' . (int) $move_up_left . ' AND ' . (int) $move_up_right . ' THEN -' . (int) $diff_up . ' |
|
1041 | 1041 | ELSE ' .(int) $diff_down . ' |
1042 | 1042 | END, |
1043 | 1043 | right_id = right_id + CASE |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | $log_action = implode('_', array($log_action_images, $log_action_albums)); |
818 | 818 | |
819 | 819 | /** |
820 | - * Log what we did |
|
821 | - */ |
|
820 | + * Log what we did |
|
821 | + */ |
|
822 | 822 | switch ($log_action) |
823 | 823 | { |
824 | 824 | case 'MOVE_IMAGES_MOVE_ALBUMS': |
@@ -908,14 +908,14 @@ discard block |
||
908 | 908 | $this->gallery_notification->delete_albums($from_id); |
909 | 909 | |
910 | 910 | /** |
911 | - * Event related to moving album content |
|
912 | - * |
|
913 | - * @event phpbbgallery.core.album.manage.move_album_content |
|
914 | - * @var int from_id Album we are moving from |
|
915 | - * @var int to_id Album we are moving to |
|
916 | - * @var bool sync Should we sync the albums data |
|
917 | - * @since 1.2.0 |
|
918 | - */ |
|
911 | + * Event related to moving album content |
|
912 | + * |
|
913 | + * @event phpbbgallery.core.album.manage.move_album_content |
|
914 | + * @var int from_id Album we are moving from |
|
915 | + * @var int to_id Album we are moving to |
|
916 | + * @var bool sync Should we sync the albums data |
|
917 | + * @since 1.2.0 |
|
918 | + */ |
|
919 | 919 | $vars = array('from_id', 'to_id', 'sync'); |
920 | 920 | extract($this->dispatcher->trigger_event('phpbbgallery.core.album.manage.move_album_content', compact($vars))); |
921 | 921 | |
@@ -1017,12 +1017,12 @@ discard block |
||
1017 | 1017 | $this->gallery_config->set('num_comments', (int) $row['num_comments']); |
1018 | 1018 | |
1019 | 1019 | /** |
1020 | - * Event delete album content |
|
1021 | - * |
|
1022 | - * @event phpbbgallery.core.album.manage.delete_album_content |
|
1023 | - * @var int album_id Album we are deleting |
|
1024 | - * @since 1.2.0 |
|
1025 | - */ |
|
1020 | + * Event delete album content |
|
1021 | + * |
|
1022 | + * @event phpbbgallery.core.album.manage.delete_album_content |
|
1023 | + * @var int album_id Album we are deleting |
|
1024 | + * @since 1.2.0 |
|
1025 | + */ |
|
1026 | 1026 | $vars = array('album_id'); |
1027 | 1027 | extract($this->dispatcher->trigger_event('phpbbgallery.core.album.manage.delete_album_content', compact($vars))); |
1028 | 1028 | |
@@ -1045,11 +1045,11 @@ discard block |
||
1045 | 1045 | public function move_album_by($album_row, $action = 'move_up', $steps = 1) |
1046 | 1046 | { |
1047 | 1047 | /** |
1048 | - * Fetch all the siblings between the module's current spot |
|
1049 | - * and where we want to move it to. If there are less than $steps |
|
1050 | - * siblings between the current spot and the target then the |
|
1051 | - * module will move as far as possible |
|
1052 | - */ |
|
1048 | + * Fetch all the siblings between the module's current spot |
|
1049 | + * and where we want to move it to. If there are less than $steps |
|
1050 | + * siblings between the current spot and the target then the |
|
1051 | + * module will move as far as possible |
|
1052 | + */ |
|
1053 | 1053 | $sql = 'SELECT album_id, album_name, left_id, right_id |
1054 | 1054 | FROM ' . $this->albums_table . ' |
1055 | 1055 | WHERE parent_id = ' . (int) $album_row['parent_id'] . ' |
@@ -1071,12 +1071,12 @@ discard block |
||
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | /** |
1074 | - * $left_id and $right_id define the scope of the nodes that are affected by the move. |
|
1075 | - * $diff_up and $diff_down are the values to subtract or add to each node's left_id |
|
1076 | - * and right_id in order to move them up or down. |
|
1077 | - * $move_up_left and $move_up_right define the scope of the nodes that are moving |
|
1078 | - * up. Other nodes in the scope of ($left_id, $right_id) are considered to move down. |
|
1079 | - */ |
|
1074 | + * $left_id and $right_id define the scope of the nodes that are affected by the move. |
|
1075 | + * $diff_up and $diff_down are the values to subtract or add to each node's left_id |
|
1076 | + * and right_id in order to move them up or down. |
|
1077 | + * $move_up_left and $move_up_right define the scope of the nodes that are moving |
|
1078 | + * up. Other nodes in the scope of ($left_id, $right_id) are considered to move down. |
|
1079 | + */ |
|
1080 | 1080 | if ($action == 'move_up') |
1081 | 1081 | { |
1082 | 1082 | $left_id = $target['left_id']; |
@@ -216,8 +216,7 @@ discard block |
||
216 | 216 | if ($this->user->data['user_timezone'] == '') |
217 | 217 | { |
218 | 218 | $timezone = 'UTC'; |
219 | - } |
|
220 | - else |
|
219 | + } else |
|
221 | 220 | { |
222 | 221 | $timezone = $this->user->data['user_timezone']; |
223 | 222 | } |
@@ -229,8 +228,7 @@ discard block |
||
229 | 228 | { |
230 | 229 | $errors[] = sprintf($this->language->lang('CONTEST_START_INVALID'), $contest_data['contest_start']); |
231 | 230 | $start_date_error = true; |
232 | - } |
|
233 | - else |
|
231 | + } else |
|
234 | 232 | { |
235 | 233 | $contest_data['contest_start'] = gmmktime((int) $m[4], (int) $m[5], 0, (int) $m[2], (int) $m[3], (int) $m[1]) - $time->getOffset();// - $offset; |
236 | 234 | } |
@@ -238,8 +236,7 @@ discard block |
||
238 | 236 | { |
239 | 237 | $errors[] = sprintf($this->language->lang('CONTEST_RATING_INVALID'), $contest_data['contest_rating']); |
240 | 238 | $date_error = true; |
241 | - } |
|
242 | - else if (!$start_date_error) |
|
239 | + } else if (!$start_date_error) |
|
243 | 240 | { |
244 | 241 | $contest_data['contest_rating'] = gmmktime($m[4], $m[5], 0, $m[2], $m[3], $m[1]) - $contest_data['contest_start'] - $time->getOffset();//- $offset; |
245 | 242 | } |
@@ -247,8 +244,7 @@ discard block |
||
247 | 244 | { |
248 | 245 | $errors[] = sprintf($this->language->lang('CONTEST_END_INVALID'), $contest_data['contest_end']); |
249 | 246 | $date_error = true; |
250 | - } |
|
251 | - else if (!$start_date_error) |
|
247 | + } else if (!$start_date_error) |
|
252 | 248 | { |
253 | 249 | $contest_data['contest_end'] = gmmktime($m[4], $m[5], 0, $m[2], $m[3], $m[1]) - $contest_data['contest_start'] - $time->getOffset();//- $offset; |
254 | 250 | } |
@@ -336,8 +332,7 @@ discard block |
||
336 | 332 | |
337 | 333 | $album_data_sql['left_id'] = $row['right_id']; |
338 | 334 | $album_data_sql['right_id'] = $row['right_id'] + 1; |
339 | - } |
|
340 | - else |
|
335 | + } else |
|
341 | 336 | { |
342 | 337 | $sql = 'UPDATE ' . $this->albums_table . ' |
343 | 338 | SET left_id = left_id + 2, right_id = right_id + 2 |
@@ -354,8 +349,7 @@ discard block |
||
354 | 349 | $album_data_sql['left_id'] = $row['left_id'] + 1; |
355 | 350 | $album_data_sql['right_id'] = $row['left_id'] + 2; |
356 | 351 | } |
357 | - } |
|
358 | - else |
|
352 | + } else |
|
359 | 353 | { |
360 | 354 | if (!$add_on_top) |
361 | 355 | { |
@@ -368,8 +362,7 @@ discard block |
||
368 | 362 | |
369 | 363 | $album_data_sql['left_id'] = $row['right_id'] + 1; |
370 | 364 | $album_data_sql['right_id'] = $row['right_id'] + 2; |
371 | - } |
|
372 | - else |
|
365 | + } else |
|
373 | 366 | { |
374 | 367 | $sql = 'UPDATE ' . $this->albums_table . ' |
375 | 368 | SET left_id = left_id + 2, right_id = right_id + 2 |
@@ -402,8 +395,7 @@ discard block |
||
402 | 395 | $this->db->sql_query($sql); |
403 | 396 | } |
404 | 397 | $this->gallery_log->add_log('admin', 'add', $album_data['album_id'], 0, array('LOG_ALBUM_ADD', $album_data['album_name'])); |
405 | - } |
|
406 | - else |
|
398 | + } else |
|
407 | 399 | { |
408 | 400 | $row = $this->gallery_album->get_info($album_data_sql['album_id']); |
409 | 401 | $reset_marked_images = false; |
@@ -414,22 +406,19 @@ discard block |
||
414 | 406 | // Changing a contest to category? No! |
415 | 407 | $errors[] = $this->language->lang('ALBUM_WITH_CONTEST_NO_TYPE_CHANGE'); |
416 | 408 | return $errors; |
417 | - } |
|
418 | - else if ($row['album_type'] != (int) \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST) |
|
409 | + } else if ($row['album_type'] != (int) \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST) |
|
419 | 410 | { |
420 | 411 | // Changing a album to contest? No! |
421 | 412 | // Changing a category to contest? No! |
422 | 413 | $errors[] = $this->language->lang('ALBUM_NO_TYPE_CHANGE_TO_CONTEST'); |
423 | 414 | return $errors; |
424 | - } |
|
425 | - else if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_UPLOAD) |
|
415 | + } else if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_UPLOAD) |
|
426 | 416 | { |
427 | 417 | // Changing a category to a album? Yes! |
428 | 418 | // Reset the data (you couldn't upload directly in a cat, you must use a album) |
429 | 419 | $album_data_sql['album_images'] = $album_data_sql['album_images_real'] = $album_data_sql['album_last_image_id'] = $album_data_sql['album_last_user_id'] = $album_data_sql['album_last_image_time'] = $album_data_sql['album_contest'] = 0; |
430 | 420 | $album_data_sql['album_last_username'] = $album_data_sql['album_last_user_colour'] = $album_data_sql['album_last_image_name'] = ''; |
431 | - } |
|
432 | - else if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_UPLOAD && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT) |
|
421 | + } else if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_UPLOAD && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_CAT) |
|
433 | 422 | { |
434 | 423 | // Changing a album to a category? Yes! |
435 | 424 | // we're turning a uploadable album into a non-uploadable album |
@@ -440,22 +429,18 @@ discard block |
||
440 | 429 | if ($to_album_id) |
441 | 430 | { |
442 | 431 | $errors = $this->move_album_content($album_data_sql['album_id'], $to_album_id); |
443 | - } |
|
444 | - else |
|
432 | + } else |
|
445 | 433 | { |
446 | 434 | return array($this->language->lang('NO_DESTINATION_ALBUM')); |
447 | 435 | } |
448 | - } |
|
449 | - else if ($album_data_sql['type_action'] == 'delete') |
|
436 | + } else if ($album_data_sql['type_action'] == 'delete') |
|
450 | 437 | { |
451 | 438 | $errors = $this->delete_album_content($album_data_sql['album_id']); |
452 | - } |
|
453 | - else |
|
439 | + } else |
|
454 | 440 | { |
455 | 441 | return array($this->language->lang('NO_ALBUM_ACTION')); |
456 | 442 | } |
457 | - } |
|
458 | - else if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST) |
|
443 | + } else if ($row['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST && $album_data_sql['album_type'] == (int) \phpbbgallery\core\block::TYPE_CONTEST) |
|
459 | 444 | { |
460 | 445 | // Changing a contest to contest? Yes! |
461 | 446 | // We need to check for the contest_data |
@@ -483,8 +468,7 @@ discard block |
||
483 | 468 | if ($row['album_id'] != $album_data_sql['parent_id']) |
484 | 469 | { |
485 | 470 | $errors = $this->move_album($album_data_sql['album_id'], $album_data_sql['parent_id']); |
486 | - } |
|
487 | - else |
|
471 | + } else |
|
488 | 472 | { |
489 | 473 | $album_data_sql['parent_id'] = $row['parent_id']; |
490 | 474 | } |
@@ -627,13 +611,11 @@ discard block |
||
627 | 611 | if ($to_data['right_id'] > $from_data['right_id']) |
628 | 612 | { |
629 | 613 | $diff = '+ ' . ($to_data['right_id'] - $from_data['right_id'] - 1); |
630 | - } |
|
631 | - else |
|
614 | + } else |
|
632 | 615 | { |
633 | 616 | $diff = '- ' . abs($to_data['right_id'] - $from_data['right_id'] - 1); |
634 | 617 | } |
635 | - } |
|
636 | - else |
|
618 | + } else |
|
637 | 619 | { |
638 | 620 | $sql = 'SELECT MAX(right_id) AS right_id |
639 | 621 | FROM ' . $this->albums_table . ' |
@@ -679,14 +661,12 @@ discard block |
||
679 | 661 | { |
680 | 662 | $log_action_images = 'IMAGES'; |
681 | 663 | $errors = array_merge($errors, $this->delete_album_content($album_id)); |
682 | - } |
|
683 | - else if ($action_images == 'move') |
|
664 | + } else if ($action_images == 'move') |
|
684 | 665 | { |
685 | 666 | if (!$images_to_id) |
686 | 667 | { |
687 | 668 | $errors[] = $this->language->lang('NO_DESTINATION_ALBUM'); |
688 | - } |
|
689 | - else |
|
669 | + } else |
|
690 | 670 | { |
691 | 671 | $log_action_images = 'MOVE_IMAGES'; |
692 | 672 | |
@@ -700,8 +680,7 @@ discard block |
||
700 | 680 | if (!$row) |
701 | 681 | { |
702 | 682 | $errors[] = $this->language->lang('NO_ALBUM'); |
703 | - } |
|
704 | - else |
|
683 | + } else |
|
705 | 684 | { |
706 | 685 | $images_to_name = $row['album_name']; |
707 | 686 | $errors = array_merge($errors, $this->move_album_content($album_id, $images_to_id)); |
@@ -735,14 +714,12 @@ discard block |
||
735 | 714 | $sql = 'DELETE FROM ' . $this->albums_table . ' |
736 | 715 | WHERE ' . $this->db->sql_in_set('album_id', $album_ids); |
737 | 716 | $this->db->sql_query($sql); |
738 | - } |
|
739 | - else if ($action_subalbums == 'move') |
|
717 | + } else if ($action_subalbums == 'move') |
|
740 | 718 | { |
741 | 719 | if (!$subalbums_to_id) |
742 | 720 | { |
743 | 721 | $errors[] = $this->language->lang('NO_DESTINATION_ALBUM'); |
744 | - } |
|
745 | - else |
|
722 | + } else |
|
746 | 723 | { |
747 | 724 | $log_action_albums = 'MOVE_ALBUMS'; |
748 | 725 | |
@@ -756,8 +733,7 @@ discard block |
||
756 | 733 | if (!$row) |
757 | 734 | { |
758 | 735 | $errors[] = $this->language->lang('NO_ALBUM'); |
759 | - } |
|
760 | - else |
|
736 | + } else |
|
761 | 737 | { |
762 | 738 | $subalbums_to_name = $row['album_name']; |
763 | 739 | |
@@ -792,8 +768,7 @@ discard block |
||
792 | 768 | { |
793 | 769 | return $errors; |
794 | 770 | } |
795 | - } |
|
796 | - else |
|
771 | + } else |
|
797 | 772 | { |
798 | 773 | $diff = 2; |
799 | 774 | $sql = 'DELETE FROM ' . $this->albums_table . ' |
@@ -1087,8 +1062,7 @@ discard block |
||
1087 | 1062 | |
1088 | 1063 | $move_up_left = $album_row['left_id']; |
1089 | 1064 | $move_up_right = $album_row['right_id']; |
1090 | - } |
|
1091 | - else |
|
1065 | + } else |
|
1092 | 1066 | { |
1093 | 1067 | $left_id = $album_row['left_id']; |
1094 | 1068 | $right_id = $target['right_id']; |
@@ -149,8 +149,7 @@ discard block |
||
149 | 149 | if (!$sql_limit) |
150 | 150 | { |
151 | 151 | $result = $this->db->sql_query($sql); |
152 | - } |
|
153 | - else |
|
152 | + } else |
|
154 | 153 | { |
155 | 154 | $result = $this->db->sql_query_limit($sql, $sql_limit); |
156 | 155 | } |
@@ -446,8 +445,7 @@ discard block |
||
446 | 445 | 'BLOCK_NAME' => $block_name ? $block_name : '' , |
447 | 446 | 'U_BLOCK' => $u_block ? $u_block : $this->helper->route('phpbbgallery_core_search_egosearch'), |
448 | 447 | )); |
449 | - } |
|
450 | - else |
|
448 | + } else |
|
451 | 449 | { |
452 | 450 | $this->template->assign_block_vars('imageblock', array( |
453 | 451 | 'BLOCK_NAME' => $block_name ? $block_name : $this->language->lang('RECENT_IMAGES'), |
@@ -505,8 +503,7 @@ discard block |
||
505 | 503 | 'phpbbgallery_core_search_egosearch_page',), |
506 | 504 | 'params' => array()), 'pagination', 'page', $count, $limit, $start |
507 | 505 | ); |
508 | - } |
|
509 | - else |
|
506 | + } else |
|
510 | 507 | { |
511 | 508 | $this->template->assign_vars(array( |
512 | 509 | 'TOTAL_IMAGES' => $this->language->lang('VIEW_ALBUM_IMAGES', $count), |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $this->template->assign_block_vars('commentrow', array( |
315 | 315 | 'COMMENT_ID' => (int) $var['comment_id'], |
316 | 316 | 'U_DELETE' => ($this->gallery_auth->acl_check('m_comments', $album_tmp['album_id'], $album_tmp['album_user_id']) || ($this->gallery_auth->acl_check('c_delete', $album_tmp['album_id'], $album_tmp['album_user_id']) && ($var['comment_user_id'] == $this->user->data['user_id']) && $this->user->data['is_registered'])) ? $this->helper->route('phpbbgallery_core_comment_delete', array('image_id' => $var['comment_image_id'], 'comment_id' => $var['comment_id'])) : false, |
317 | - 'U_EDIT' => $this->gallery_auth->acl_check('c_edit', $album_tmp['album_id'], $album_tmp['album_user_id'])? $this->helper->route('phpbbgallery_core_comment_edit', array('image_id' => $var['comment_image_id'], 'comment_id' => $var['comment_id'])) : false, |
|
317 | + 'U_EDIT' => $this->gallery_auth->acl_check('c_edit', $album_tmp['album_id'], $album_tmp['album_user_id']) ? $this->helper->route('phpbbgallery_core_comment_edit', array('image_id' => $var['comment_image_id'], 'comment_id' => $var['comment_id'])) : false, |
|
318 | 318 | 'U_QUOTE' => ($this->gallery_auth->acl_check('c_post', $album_tmp['album_id'], $album_tmp['album_user_id'])) ? $this->helper->route('phpbbgallery_core_comment_add', array('image_id' => $var['comment_image_id'], 'comment_id' => $var['comment_id'])) : false, |
319 | 319 | 'U_COMMENT' => $this->helper->route('phpbbgallery_core_image', array('image_id' => $var['comment_image_id'])) . '#comment_' . $var['comment_id'], |
320 | 320 | 'POST_AUTHOR_FULL' => (string) $this->user_loader->get_username($var['comment_user_id'], 'full'), |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | if ($user > 0) |
448 | 448 | { |
449 | 449 | $this->template->assign_block_vars('imageblock', array( |
450 | - 'BLOCK_NAME' => $block_name ? $block_name : '' , |
|
450 | + 'BLOCK_NAME' => $block_name ? $block_name : '', |
|
451 | 451 | 'U_BLOCK' => $u_block ? $u_block : $this->helper->route('phpbbgallery_core_search_egosearch'), |
452 | 452 | )); |
453 | 453 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | $this->db->sql_freeresult($result); |
548 | 548 | $count = $row['count']; |
549 | 549 | $sql_array['SELECT'] = '* , a.album_name, a.album_status, a.album_user_id, a.album_id'; |
550 | - $sql_array['LEFT_JOIN'] = array( |
|
550 | + $sql_array['LEFT_JOIN'] = array( |
|
551 | 551 | array( |
552 | 552 | 'FROM' => array($this->albums_table => 'a'), |
553 | 553 | 'ON' => 'a.album_id = i.image_album_id', |
@@ -243,9 +243,9 @@ |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
246 | - * Get all recent images the user has access to |
|
247 | - * return (int) $images_count |
|
248 | - */ |
|
246 | + * Get all recent images the user has access to |
|
247 | + * return (int) $images_count |
|
248 | + */ |
|
249 | 249 | public function recent_count() |
250 | 250 | { |
251 | 251 | $this->gallery_auth->load_user_permissions($this->user->data['user_id']); |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
234 | - * We need to disable the "last-modified" caching for guests and in cases of image-errors, |
|
235 | - * so that they can view them, if they logged in or the error was fixed. |
|
236 | - */ |
|
234 | + * We need to disable the "last-modified" caching for guests and in cases of image-errors, |
|
235 | + * so that they can view them, if they logged in or the error was fixed. |
|
236 | + */ |
|
237 | 237 | public function disable_browser_cache() |
238 | 238 | { |
239 | 239 | $this->browser_cache = false; |
@@ -460,12 +460,12 @@ discard block |
||
460 | 460 | } |
461 | 461 | |
462 | 462 | /** |
463 | - * Delete file from disc. |
|
464 | - * |
|
465 | - * @param mixed $files String with filename or an array of filenames |
|
466 | - * Array-Format: $image_id => $filename |
|
467 | - * @param array $locations Array of valid url::path()s where the image should be deleted from |
|
468 | - */ |
|
463 | + * Delete file from disc. |
|
464 | + * |
|
465 | + * @param mixed $files String with filename or an array of filenames |
|
466 | + * Array-Format: $image_id => $filename |
|
467 | + * @param array $locations Array of valid url::path()s where the image should be deleted from |
|
468 | + */ |
|
469 | 469 | public function delete($files, $locations = array('thumbnail', 'medium', 'upload')) |
470 | 470 | { |
471 | 471 | if (!is_array($files)) |
@@ -294,13 +294,13 @@ |
||
294 | 294 | |
295 | 295 | if (($this->image_size['height'] / $max_height) > ($this->image_size['width'] / $max_width)) |
296 | 296 | { |
297 | - $this->thumb_height = $max_height; |
|
298 | - $this->thumb_width = round($max_width * (($this->image_size['width'] / $max_width) / ($this->image_size['height'] / $max_height))); |
|
297 | + $this->thumb_height = $max_height; |
|
298 | + $this->thumb_width = round($max_width * (($this->image_size['width'] / $max_width) / ($this->image_size['height'] / $max_height))); |
|
299 | 299 | } |
300 | 300 | else |
301 | 301 | { |
302 | - $this->thumb_height = round($max_height * (($this->image_size['height'] / $max_height) / ($this->image_size['width'] / $max_width))); |
|
303 | - $this->thumb_width = $max_width; |
|
302 | + $this->thumb_height = round($max_height * (($this->image_size['height'] / $max_height) / ($this->image_size['width'] / $max_width))); |
|
303 | + $this->thumb_width = $max_width; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | $image_copy = (($this->gd_version == self::GDLIB1) ? @imagecreate($this->thumb_width, $this->thumb_height + $additional_height) : @imagecreatetruecolor($this->thumb_width, $this->thumb_height + $additional_height)); |
@@ -161,8 +161,7 @@ discard block |
||
161 | 161 | if (isset($this->image_size['file'])) |
162 | 162 | { |
163 | 163 | $file_size = $this->image_size['file']; |
164 | - } |
|
165 | - else if ($force_filesize) |
|
164 | + } else if ($force_filesize) |
|
166 | 165 | { |
167 | 166 | $file_size = @filesize($this->image_source); |
168 | 167 | } |
@@ -296,8 +295,7 @@ discard block |
||
296 | 295 | { |
297 | 296 | $this->thumb_height = $max_height; |
298 | 297 | $this->thumb_width = round($max_width * (($this->image_size['width'] / $max_width) / ($this->image_size['height'] / $max_height))); |
299 | - } |
|
300 | - else |
|
298 | + } else |
|
301 | 299 | { |
302 | 300 | $this->thumb_height = round($max_height * (($this->image_size['height'] / $max_height) / ($this->image_size['width'] / $max_width))); |
303 | 301 | $this->thumb_width = $max_width; |
@@ -407,8 +405,7 @@ discard block |
||
407 | 405 | { |
408 | 406 | $this->image_source = $get_wm_name; |
409 | 407 | $this->read_image(); |
410 | - } |
|
411 | - else |
|
408 | + } else |
|
412 | 409 | { |
413 | 410 | $this->watermark_size = getimagesize($this->watermark_source); |
414 | 411 | switch ($this->watermark_size['mime']) |
@@ -437,16 +434,14 @@ discard block |
||
437 | 434 | if ($watermark_position & $phpbb_gallery_constants::WATERMARK_LEFT) |
438 | 435 | { |
439 | 436 | $dst_x = 5; |
440 | - } |
|
441 | - else if ($watermark_position & $phpbb_gallery_constants::WATERMARK_RIGHT) |
|
437 | + } else if ($watermark_position & $phpbb_gallery_constants::WATERMARK_RIGHT) |
|
442 | 438 | { |
443 | 439 | $dst_x = ($this->image_size['width'] - $this->watermark_size[0] - 5); |
444 | 440 | } |
445 | 441 | if ($watermark_position & $phpbb_gallery_constants::WATERMARK_TOP) |
446 | 442 | { |
447 | 443 | $dst_y = 5; |
448 | - } |
|
449 | - else if ($watermark_position & $phpbb_gallery_constants::WATERMARK_MIDDLE) |
|
444 | + } else if ($watermark_position & $phpbb_gallery_constants::WATERMARK_MIDDLE) |
|
450 | 445 | { |
451 | 446 | $dst_y = (($this->image_size['height'] * 0.5) - ($this->watermark_size[1] * 0.5)); |
452 | 447 | } |
@@ -122,13 +122,13 @@ |
||
122 | 122 | } |
123 | 123 | if ($recent) |
124 | 124 | { |
125 | - $block_name = $this->language->lang('RECENT_IMAGES'); |
|
125 | + $block_name = $this->language->lang('RECENT_IMAGES'); |
|
126 | 126 | $u_block = ' '; |
127 | 127 | $this->gallery_search->recent($this->gallery_config->get('rrc_profile_items'), -1, $event['member']['user_id'], 'rrc_profile_display', $block_name, $u_block); |
128 | 128 | } |
129 | 129 | if ($random) |
130 | 130 | { |
131 | - $block_name = $this->language->lang('RANDOM_IMAGES'); |
|
131 | + $block_name = $this->language->lang('RANDOM_IMAGES'); |
|
132 | 132 | $u_block = ' '; |
133 | 133 | $this->gallery_search->random($this->gallery_config->get('rrc_profile_items'), $event['member']['user_id'], 'rrc_profile_display', $block_name, $u_block); |
134 | 134 | } |
@@ -146,8 +146,7 @@ |
||
146 | 146 | 'U_GALLERY_IMAGES_ALLOW' => true, |
147 | 147 | 'U_GALLERY_IMAGES' => $user_info['user_images'], |
148 | 148 | )); |
149 | - } |
|
150 | - else |
|
149 | + } else |
|
151 | 150 | { |
152 | 151 | $this->template->assign_vars(array( |
153 | 152 | 'U_GALLERY_IMAGES_ALLOW' => true, |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
186 | - * Delete comments |
|
187 | - * |
|
188 | - * @param mixed $comment_ids Array or integer with comment_id we delete. |
|
189 | - */ |
|
186 | + * Delete comments |
|
187 | + * |
|
188 | + * @param mixed $comment_ids Array or integer with comment_id we delete. |
|
189 | + */ |
|
190 | 190 | public function delete_comments($comment_ids) |
191 | 191 | { |
192 | 192 | $comment_ids = $this->cast_mixed_int2array($comment_ids); |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
219 | - * Delete comments for given image_ids |
|
220 | - * |
|
221 | - * @param mixed $image_ids Array or integer with image_id where we delete the comments. |
|
222 | - * @param bool $reset_stats Shall we also reset the statistics? We can save that query, when the images are deleted anyway. |
|
223 | - */ |
|
219 | + * Delete comments for given image_ids |
|
220 | + * |
|
221 | + * @param mixed $image_ids Array or integer with image_id where we delete the comments. |
|
222 | + * @param bool $reset_stats Shall we also reset the statistics? We can save that query, when the images are deleted anyway. |
|
223 | + */ |
|
224 | 224 | public function delete_images($image_ids, $reset_stats = false) |
225 | 225 | { |
226 | 226 | $image_ids = $this->cast_mixed_int2array($image_ids); |
@@ -94,7 +94,7 @@ |
||
94 | 94 | 'comment_time' => time(), |
95 | 95 | ); |
96 | 96 | |
97 | - $this->db->sql_query('INSERT INTO ' .$this->comments_table .' ' . $this->db->sql_build_array('INSERT', $data)); |
|
97 | + $this->db->sql_query('INSERT INTO ' . $this->comments_table . ' ' . $this->db->sql_build_array('INSERT', $data)); |
|
98 | 98 | $newest_comment_id = (int) $this->db->sql_nextid(); |
99 | 99 | $this->config->inc('num_comments', 1); |
100 | 100 |
@@ -244,8 +244,7 @@ |
||
244 | 244 | if (is_array($ids)) |
245 | 245 | { |
246 | 246 | return array_map('intval', $ids); |
247 | - } |
|
248 | - else |
|
247 | + } else |
|
249 | 248 | { |
250 | 249 | return array((int) $ids); |
251 | 250 | } |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
98 | - * Remove images from watch-list |
|
99 | - * |
|
100 | - * @param mixed $image_ids Array or integer with image_id where we delete from the watch-list. |
|
101 | - * @param mixed $user_ids If not set, it uses the currents user_id |
|
102 | - */ |
|
98 | + * Remove images from watch-list |
|
99 | + * |
|
100 | + * @param mixed $image_ids Array or integer with image_id where we delete from the watch-list. |
|
101 | + * @param mixed $user_ids If not set, it uses the currents user_id |
|
102 | + */ |
|
103 | 103 | public function remove($image_ids, $user_ids = false) |
104 | 104 | { |
105 | 105 | $image_ids = self::cast_mixed_int2array($image_ids); |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
115 | - * Remove albums from watch-list |
|
116 | - * |
|
117 | - * @param mixed $album_ids Array or integer with album_id where we delete from the watch-list. |
|
118 | - * @param mixed $user_ids If not set, it uses the currents user_id |
|
119 | - */ |
|
115 | + * Remove albums from watch-list |
|
116 | + * |
|
117 | + * @param mixed $album_ids Array or integer with album_id where we delete from the watch-list. |
|
118 | + * @param mixed $user_ids If not set, it uses the currents user_id |
|
119 | + */ |
|
120 | 120 | public function remove_albums($album_ids, $user_ids = false) |
121 | 121 | { |
122 | 122 | $album_ids = self::cast_mixed_int2array($album_ids); |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
132 | - * Delete given image_ids from watch-list |
|
133 | - * |
|
134 | - * @param mixed $image_ids Array or integer with image_id where we delete from watch-list. |
|
135 | - */ |
|
132 | + * Delete given image_ids from watch-list |
|
133 | + * |
|
134 | + * @param mixed $image_ids Array or integer with image_id where we delete from watch-list. |
|
135 | + */ |
|
136 | 136 | public function delete_images($image_ids) |
137 | 137 | { |
138 | 138 | $image_ids = self::cast_mixed_int2array($image_ids); |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | |
145 | 145 | |
146 | 146 | /** |
147 | - * Delete given album_ids from watch-list |
|
148 | - * |
|
149 | - * @param mixed $album_ids Array or integer with album_id where we delete from watch-list. |
|
150 | - */ |
|
147 | + * Delete given album_ids from watch-list |
|
148 | + * |
|
149 | + * @param mixed $album_ids Array or integer with album_id where we delete from watch-list. |
|
150 | + */ |
|
151 | 151 | public function delete_albums($album_ids) |
152 | 152 | { |
153 | 153 | $album_ids = self::cast_mixed_int2array($album_ids); |
@@ -244,8 +244,7 @@ |
||
244 | 244 | if (is_array($ids)) |
245 | 245 | { |
246 | 246 | return array_map('intval', $ids); |
247 | - } |
|
248 | - else |
|
247 | + } else |
|
249 | 248 | { |
250 | 249 | return array((int) $ids); |
251 | 250 | } |
@@ -14,27 +14,27 @@ discard block |
||
14 | 14 | { |
15 | 15 | |
16 | 16 | /** |
17 | - * Gallery Auth Object |
|
18 | - * @var \phpbbgallery\core\auth\auth |
|
19 | - */ |
|
17 | + * Gallery Auth Object |
|
18 | + * @var \phpbbgallery\core\auth\auth |
|
19 | + */ |
|
20 | 20 | protected $auth; |
21 | 21 | |
22 | 22 | /** |
23 | - * Config Object |
|
24 | - * @var \phpbb\config\config |
|
25 | - */ |
|
23 | + * Config Object |
|
24 | + * @var \phpbb\config\config |
|
25 | + */ |
|
26 | 26 | protected $config; |
27 | 27 | |
28 | 28 | /** |
29 | - * Template Object |
|
30 | - * @var \phpbb\template\template |
|
31 | - */ |
|
29 | + * Template Object |
|
30 | + * @var \phpbb\template\template |
|
31 | + */ |
|
32 | 32 | protected $template; |
33 | 33 | |
34 | 34 | /** |
35 | - * User Object |
|
36 | - * @var \phpbb\user |
|
37 | - */ |
|
35 | + * User Object |
|
36 | + * @var \phpbb\user |
|
37 | + */ |
|
38 | 38 | protected $user; |
39 | 39 | |
40 | 40 | /** |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
65 | - * User authorisation levels output |
|
66 | - * |
|
67 | - * @param int $album_id The current album the user is in. |
|
68 | - * @param int $album_status The albums status bit. |
|
69 | - * @param int $album_user_id The user-id of the album owner. Saves us a call to the cache if it is set. |
|
70 | - * @return null |
|
71 | - * |
|
72 | - * borrowed from phpBB3 |
|
73 | - * @author: phpBB Group |
|
74 | - * @function: gen_forum_auth_level |
|
75 | - */ |
|
65 | + * User authorisation levels output |
|
66 | + * |
|
67 | + * @param int $album_id The current album the user is in. |
|
68 | + * @param int $album_status The albums status bit. |
|
69 | + * @param int $album_user_id The user-id of the album owner. Saves us a call to the cache if it is set. |
|
70 | + * @return null |
|
71 | + * |
|
72 | + * borrowed from phpBB3 |
|
73 | + * @author: phpBB Group |
|
74 | + * @function: gen_forum_auth_level |
|
75 | + */ |
|
76 | 76 | public function display($album_id, $album_status, $album_user_id = -1) |
77 | 77 | { |
78 | 78 | $locked = ($album_status == ITEM_LOCKED && !$this->auth->acl_check('m_', $album_id, $album_user_id)) ? true : false; |
@@ -12,21 +12,21 @@ discard block |
||
12 | 12 | |
13 | 13 | class auth |
14 | 14 | { |
15 | - const SETTING_PERMISSIONS = -39839; |
|
16 | - const PERSONAL_ALBUM = -3; |
|
15 | + const SETTING_PERMISSIONS = -39839; |
|
16 | + const PERSONAL_ALBUM = -3; |
|
17 | 17 | const OWN_ALBUM = -2; |
18 | - const PUBLIC_ALBUM = 0; |
|
18 | + const PUBLIC_ALBUM = 0; |
|
19 | 19 | |
20 | 20 | const ACCESS_ALL = 0; |
21 | - const ACCESS_REGISTERED = 1; |
|
22 | - const ACCESS_NOT_FOES = 2; |
|
23 | - const ACCESS_FRIENDS = 3; |
|
24 | - const ACCESS_SPECIAL_FRIENDS = 4; |
|
21 | + const ACCESS_REGISTERED = 1; |
|
22 | + const ACCESS_NOT_FOES = 2; |
|
23 | + const ACCESS_FRIENDS = 3; |
|
24 | + const ACCESS_SPECIAL_FRIENDS = 4; |
|
25 | 25 | |
26 | 26 | // ACL - slightly different |
27 | - const ACL_NO = 0; |
|
28 | - const ACL_YES = 1; |
|
29 | - const ACL_NEVER = 2; |
|
27 | + const ACL_NO = 0; |
|
28 | + const ACL_YES = 1; |
|
29 | + const ACL_NEVER = 2; |
|
30 | 30 | |
31 | 31 | static protected $_permission_i = array('i_view', 'i_watermark', 'i_upload', 'i_approve', 'i_edit', 'i_delete', 'i_report', 'i_rate'); |
32 | 32 | static protected $_permission_c = array('c_read', 'c_post', 'c_edit', 'c_delete'); |
@@ -167,17 +167,17 @@ discard block |
||
167 | 167 | $sql_select .= " MAX($permission) as $permission,"; |
168 | 168 | } |
169 | 169 | |
170 | - $this->_auth_data[self::OWN_ALBUM] = new \phpbbgallery\core\auth\set(); |
|
170 | + $this->_auth_data[self::OWN_ALBUM] = new \phpbbgallery\core\auth\set(); |
|
171 | 171 | $this->_auth_data_never[self::OWN_ALBUM] = new \phpbbgallery\core\auth\set(); |
172 | 172 | $this->_auth_data[self::PERSONAL_ALBUM] = new \phpbbgallery\core\auth\set(); |
173 | - $this->_auth_data_never[self::PERSONAL_ALBUM] = new \phpbbgallery\core\auth\set(); |
|
173 | + $this->_auth_data_never[self::PERSONAL_ALBUM] = new \phpbbgallery\core\auth\set(); |
|
174 | 174 | |
175 | 175 | foreach ($albums as $album) |
176 | 176 | { |
177 | 177 | if ($album['album_user_id'] == self::PUBLIC_ALBUM) |
178 | 178 | { |
179 | - $this->_auth_data[$album['album_id']] = new \phpbbgallery\core\auth\set(); |
|
180 | - $this->_auth_data_never[$album['album_id']] = new \phpbbgallery\core\auth\set(); |
|
179 | + $this->_auth_data[$album['album_id']] = new \phpbbgallery\core\auth\set(); |
|
180 | + $this->_auth_data_never[$album['album_id']] = new \phpbbgallery\core\auth\set(); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | |
356 | 356 | $zebra = null; |
357 | 357 | |
358 | - $albums = array();//@todo $this->cache->obtain_album_list(); |
|
358 | + $albums = array(); //@todo $this->cache->obtain_album_list(); |
|
359 | 359 | foreach ($albums as $album) |
360 | 360 | { |
361 | 361 | if (!$album['album_auth_access'] || ($album['album_user_id'] == self::PUBLIC_ALBUM))# || ($album['album_user_id'] == $user_id)) |
@@ -130,9 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | $this->unserialize_auth_data($cached_permissions); |
132 | 132 | return; |
133 | - } |
|
134 | - |
|
135 | - else if ($user_id != $this->user->user_id) |
|
133 | + } else if ($user_id != $this->user->user_id) |
|
136 | 134 | { |
137 | 135 | $this->user->set_user_id($user_id); |
138 | 136 | $cached_permissions = $this->user->get_data('user_permissions'); |
@@ -252,8 +250,7 @@ discard block |
||
252 | 250 | if (!isset($acl_array[$key])) |
253 | 251 | { |
254 | 252 | $acl_array[$key] = $key . '::' . $a_id; |
255 | - } |
|
256 | - else |
|
253 | + } else |
|
257 | 254 | { |
258 | 255 | $acl_array[$key] .= ':' . $a_id; |
259 | 256 | } |
@@ -302,8 +299,7 @@ discard block |
||
302 | 299 | if ($data[$permission] == self::ACL_NEVER) |
303 | 300 | { |
304 | 301 | $this->_auth_data_never[$album_id]->set_bit(self::$_permissions_flipped[$permission], true); |
305 | - } |
|
306 | - else if ($data[$permission] == self::ACL_YES) |
|
302 | + } else if ($data[$permission] == self::ACL_YES) |
|
307 | 303 | { |
308 | 304 | $this->_auth_data[$album_id]->set_bit(self::$_permissions_flipped[$permission], true); |
309 | 305 | if (substr($permission, 0, 2) == 'm_') |
@@ -311,8 +307,7 @@ discard block |
||
311 | 307 | $this->_auth_data[$album_id]->set_bit(self::$_permissions_flipped['m_'], true); |
312 | 308 | } |
313 | 309 | } |
314 | - } |
|
315 | - else |
|
310 | + } else |
|
316 | 311 | { |
317 | 312 | $this->_auth_data[$album_id]->set_count($permission, $data[$permission]); |
318 | 313 | } |
@@ -358,17 +353,17 @@ discard block |
||
358 | 353 | $albums = array();//@todo $this->cache->obtain_album_list(); |
359 | 354 | foreach ($albums as $album) |
360 | 355 | { |
361 | - if (!$album['album_auth_access'] || ($album['album_user_id'] == self::PUBLIC_ALBUM))# || ($album['album_user_id'] == $user_id)) |
|
356 | + if (!$album['album_auth_access'] || ($album['album_user_id'] == self::PUBLIC_ALBUM)) { |
|
357 | + # || ($album['album_user_id'] == $user_id)) |
|
362 | 358 | { |
363 | 359 | continue; |
364 | 360 | } |
365 | - else if ($user_id == ANONYMOUS) |
|
361 | + } else if ($user_id == ANONYMOUS) |
|
366 | 362 | { |
367 | 363 | // Level 1: No guests |
368 | 364 | $this->_auth_data[$album['album_id']] = new \phpbbgallery\core\auth\set(); |
369 | 365 | continue; |
370 | - } |
|
371 | - else if ($album['album_auth_access'] == self::ACCESS_NOT_FOES) |
|
366 | + } else if ($album['album_auth_access'] == self::ACCESS_NOT_FOES) |
|
372 | 367 | { |
373 | 368 | if ($zebra == null) |
374 | 369 | { |
@@ -380,8 +375,7 @@ discard block |
||
380 | 375 | $this->_auth_data[$album['album_id']] = new \phpbbgallery\core\auth\set(); |
381 | 376 | continue; |
382 | 377 | } |
383 | - } |
|
384 | - else if ($album['album_auth_access'] == self::ACCESS_SPECIAL_FRIENDS) |
|
378 | + } else if ($album['album_auth_access'] == self::ACCESS_SPECIAL_FRIENDS) |
|
385 | 379 | { |
386 | 380 | if ($zebra == null) |
387 | 381 | { |
@@ -393,8 +387,7 @@ discard block |
||
393 | 387 | $this->_auth_data[$album['album_id']] = new \phpbbgallery\core\auth\set(); |
394 | 388 | continue; |
395 | 389 | } |
396 | - } |
|
397 | - else if ($album['album_auth_access'] == self::ACCESS_FRIENDS) |
|
390 | + } else if ($album['album_auth_access'] == self::ACCESS_FRIENDS) |
|
398 | 391 | { |
399 | 392 | if ($zebra == null) |
400 | 393 | { |
@@ -428,21 +421,18 @@ discard block |
||
428 | 421 | if ($row['foe']) |
429 | 422 | { |
430 | 423 | $zebra['foe'][] = (int) $row['user_id']; |
431 | - } |
|
432 | - else |
|
424 | + } else |
|
433 | 425 | { |
434 | 426 | if (isset($row['bff'])) |
435 | 427 | { |
436 | 428 | if ($row['bff']) |
437 | 429 | { |
438 | 430 | $zebra['bff'][] = (int) $row['user_id']; |
439 | - } |
|
440 | - else |
|
431 | + } else |
|
441 | 432 | { |
442 | 433 | $zebra['friend'][] = (int) $row['user_id']; |
443 | 434 | } |
444 | - } |
|
445 | - else |
|
435 | + } else |
|
446 | 436 | { |
447 | 437 | $zebra['friend'][] = (int) $row['user_id']; |
448 | 438 | } |
@@ -487,16 +477,13 @@ discard block |
||
487 | 477 | if (in_array($album_author, $zebra_array['foe'])) |
488 | 478 | { |
489 | 479 | $state = 1; |
490 | - } |
|
491 | - else if (in_array($album_author, $zebra_array['friend'])) |
|
480 | + } else if (in_array($album_author, $zebra_array['friend'])) |
|
492 | 481 | { |
493 | 482 | $state = 3; |
494 | - } |
|
495 | - else if (in_array($album_author, $zebra_array['bff'])) |
|
483 | + } else if (in_array($album_author, $zebra_array['bff'])) |
|
496 | 484 | { |
497 | 485 | $state = 4; |
498 | - } |
|
499 | - else |
|
486 | + } else |
|
500 | 487 | { |
501 | 488 | $state = 2; |
502 | 489 | } |
@@ -543,12 +530,10 @@ discard block |
||
543 | 530 | if (is_array($user_ids)) |
544 | 531 | { |
545 | 532 | $sql_where = 'WHERE ' . $this->db->sql_in_set('user_id', array_map('intval', $user_ids)); |
546 | - } |
|
547 | - else if ($user_ids == 'all') |
|
533 | + } else if ($user_ids == 'all') |
|
548 | 534 | { |
549 | 535 | $sql_where = ''; |
550 | - } |
|
551 | - else |
|
536 | + } else |
|
552 | 537 | { |
553 | 538 | $sql_where = 'WHERE user_id = ' . (int) $user_ids; |
554 | 539 | } |
@@ -617,8 +602,7 @@ discard block |
||
617 | 602 | if ($this->user->is_user($u_id)) |
618 | 603 | { |
619 | 604 | $p_id = self::OWN_ALBUM; |
620 | - } |
|
621 | - else |
|
605 | + } else |
|
622 | 606 | { |
623 | 607 | if (!isset($this->_auth_data[$a_id])) |
624 | 608 | { |
@@ -700,12 +684,10 @@ discard block |
||
700 | 684 | if ($this->user->is_user($album['album_user_id'])) |
701 | 685 | { |
702 | 686 | $a_id = self::OWN_ALBUM; |
703 | - } |
|
704 | - else if ($album['album_user_id'] > self::PUBLIC_ALBUM) |
|
687 | + } else if ($album['album_user_id'] > self::PUBLIC_ALBUM) |
|
705 | 688 | { |
706 | 689 | $a_id = self::PERSONAL_ALBUM; |
707 | - } |
|
708 | - else |
|
690 | + } else |
|
709 | 691 | { |
710 | 692 | $a_id = $album['album_id']; |
711 | 693 | } |
@@ -755,8 +737,7 @@ discard block |
||
755 | 737 | if ($album_data['album_user_id'] != 0) |
756 | 738 | { |
757 | 739 | $sql = 'SELECT * FROM ' . $this->table_permissions . ' WHERE ' . $this->db->sql_in_set('perm_system', array(-2, -3)); |
758 | - } |
|
759 | - else |
|
740 | + } else |
|
760 | 741 | { |
761 | 742 | $sql = 'SELECT * FROM ' . $this->table_permissions . ' WHERE perm_album_id = ' . (int) $album_id; |
762 | 743 | } |
@@ -41,57 +41,57 @@ discard block |
||
41 | 41 | protected $acl_cache = array(); |
42 | 42 | |
43 | 43 | /** |
44 | - * Cache object |
|
45 | - * @var \phpbbgallery\core\cache |
|
46 | - */ |
|
44 | + * Cache object |
|
45 | + * @var \phpbbgallery\core\cache |
|
46 | + */ |
|
47 | 47 | protected $cache; |
48 | 48 | |
49 | 49 | /** |
50 | - * Database object |
|
51 | - * @var \phpbb\db\driver\driver |
|
52 | - */ |
|
50 | + * Database object |
|
51 | + * @var \phpbb\db\driver\driver |
|
52 | + */ |
|
53 | 53 | protected $db; |
54 | 54 | |
55 | 55 | /** |
56 | - * Gallery user object |
|
57 | - * @var \phpbbgallery\core\user |
|
58 | - */ |
|
56 | + * Gallery user object |
|
57 | + * @var \phpbbgallery\core\user |
|
58 | + */ |
|
59 | 59 | protected $user; |
60 | 60 | |
61 | 61 | /** |
62 | - * phpBB user object |
|
63 | - * @var \phpbb\user |
|
64 | - */ |
|
62 | + * phpBB user object |
|
63 | + * @var \phpbb\user |
|
64 | + */ |
|
65 | 65 | protected $phpbb_user; |
66 | 66 | |
67 | 67 | /** |
68 | - * phpBB auth object |
|
69 | - * @var \phpbb\auth\auth |
|
70 | - */ |
|
68 | + * phpBB auth object |
|
69 | + * @var \phpbb\auth\auth |
|
70 | + */ |
|
71 | 71 | protected $auth; |
72 | 72 | |
73 | 73 | /** |
74 | - * Gallery permissions table |
|
75 | - * @var string |
|
76 | - */ |
|
74 | + * Gallery permissions table |
|
75 | + * @var string |
|
76 | + */ |
|
77 | 77 | protected $table_permissions; |
78 | 78 | |
79 | 79 | /** |
80 | - * Gallery permission roles table |
|
81 | - * @var string |
|
82 | - */ |
|
80 | + * Gallery permission roles table |
|
81 | + * @var string |
|
82 | + */ |
|
83 | 83 | protected $table_roles; |
84 | 84 | |
85 | 85 | /** |
86 | - * Gallery users table |
|
87 | - * @var string |
|
88 | - */ |
|
86 | + * Gallery users table |
|
87 | + * @var string |
|
88 | + */ |
|
89 | 89 | protected $table_users; |
90 | 90 | |
91 | 91 | /** |
92 | - * Gallery albums table |
|
93 | - * @var string |
|
94 | - */ |
|
92 | + * Gallery albums table |
|
93 | + * @var string |
|
94 | + */ |
|
95 | 95 | protected $table_albums; |
96 | 96 | |
97 | 97 | /** |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
342 | - * Merge the NEVER-options into the YES-options by removing the YES, if it is set. |
|
343 | - */ |
|
342 | + * Merge the NEVER-options into the YES-options by removing the YES, if it is set. |
|
343 | + */ |
|
344 | 344 | protected function merge_acl_row() |
345 | 345 | { |
346 | 346 | foreach ($this->_auth_data as $album_id => $obj) |
@@ -585,14 +585,14 @@ discard block |
||
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
588 | - * Get permission |
|
589 | - * |
|
590 | - * @param string $acl One of the permissions, Exp: i_view |
|
591 | - * @param int $a_id The album_id, from which we want to have the permissions |
|
592 | - * @param int $u_id The user_id from the album-owner. If not specified we need to get it from the cache. |
|
593 | - * |
|
594 | - * @return bool Is the user allowed to do the $acl? |
|
595 | - */ |
|
588 | + * Get permission |
|
589 | + * |
|
590 | + * @param string $acl One of the permissions, Exp: i_view |
|
591 | + * @param int $a_id The album_id, from which we want to have the permissions |
|
592 | + * @param int $u_id The user_id from the album-owner. If not specified we need to get it from the cache. |
|
593 | + * |
|
594 | + * @return bool Is the user allowed to do the $acl? |
|
595 | + */ |
|
596 | 596 | public function acl_check($acl, $a_id, $u_id = -1) |
597 | 597 | { |
598 | 598 | $bit = self::$_permissions_flipped[$acl]; |
@@ -655,12 +655,12 @@ discard block |
||
655 | 655 | } |
656 | 656 | |
657 | 657 | /** |
658 | - * Does the user have the permission for any album? |
|
659 | - * |
|
660 | - * @param string $acl One of the permissions, Exp: i_view; *_count permissions are not allowed! |
|
661 | - * |
|
662 | - * @return bool Is the user allowed to do the $acl? |
|
663 | - */ |
|
658 | + * Does the user have the permission for any album? |
|
659 | + * |
|
660 | + * @param string $acl One of the permissions, Exp: i_view; *_count permissions are not allowed! |
|
661 | + * |
|
662 | + * @return bool Is the user allowed to do the $acl? |
|
663 | + */ |
|
664 | 664 | public function acl_check_global($acl) |
665 | 665 | { |
666 | 666 | $bit = self::$_permissions_flipped[$acl]; |
@@ -692,16 +692,16 @@ discard block |
||
692 | 692 | } |
693 | 693 | |
694 | 694 | /** |
695 | - * Get albums by permission |
|
696 | - * |
|
697 | - * @param string $acl One of the permissions, Exp: i_view; *_count permissions are not allowed! |
|
698 | - * @param string $return Type of the return value. array returns an array, else it's a string. |
|
699 | - * bool means it only checks whether the user has the permission anywhere. |
|
700 | - * @param bool $display_in_rrc Only return albums, that have the display_in_rrc-flag set. |
|
701 | - * @param bool $display_pegas Include personal galleries in the list. |
|
702 | - * |
|
703 | - * @return mixed $album_ids, either as list or array. |
|
704 | - */ |
|
695 | + * Get albums by permission |
|
696 | + * |
|
697 | + * @param string $acl One of the permissions, Exp: i_view; *_count permissions are not allowed! |
|
698 | + * @param string $return Type of the return value. array returns an array, else it's a string. |
|
699 | + * bool means it only checks whether the user has the permission anywhere. |
|
700 | + * @param bool $display_in_rrc Only return albums, that have the display_in_rrc-flag set. |
|
701 | + * @param bool $display_pegas Include personal galleries in the list. |
|
702 | + * |
|
703 | + * @return mixed $album_ids, either as list or array. |
|
704 | + */ |
|
705 | 705 | public function acl_album_ids($acl, $return = 'array', $display_in_rrc = false, $display_pegas = true) |
706 | 706 | { |
707 | 707 | $bit = self::$_permissions_flipped[$acl]; |