Completed
Branch master (31e026)
by Stanislav
06:53
created
core/controller/image.php 3 patches
Indentation   +198 added lines, -198 removed lines patch added patch discarded remove patch
@@ -125,51 +125,51 @@  discard block
 block discarded – undo
125 125
 	protected $profile_fields_data;
126 126
 	protected $can_receive_pm_list;
127 127
 
128
-    /**
129
-     * Constructor
130
-     *
131
-     * @param \phpbb\request\request $request
132
-     * @param \phpbb\auth\auth $auth Gallery auth object
133
-     * @param \phpbb\config\config $config Config object
134
-     * @param \phpbb\controller\helper $helper Controller helper object
135
-     * @param \phpbb\db\driver\driver|\phpbb\db\driver\driver_interface $db Database object
136
-     * @param \phpbb\event\dispatcher $dispatcher Event dispatcher object
137
-     * @param \phpbb\pagination $pagination Pagination object
138
-     * @param \phpbb\template\template $template Template object
139
-     * @param \phpbb\user $user User object
140
-     * @param manager $cpf_manager
141
-     * @param \phpbb\language\language $language
142
-     * @param \phpbbgallery\core\album\display $display Albums display object
143
-     * @param \phpbbgallery\core\album\loader $loader Albums display object
144
-     * @param \phpbbgallery\core\album\album $album
145
-     * @param \phpbbgallery\core\image\image $image
146
-     * @param \phpbbgallery\core\auth\auth $gallery_auth
147
-     * @param \phpbbgallery\core\user $gallery_user
148
-     * @param \phpbbgallery\core\config $gallery_config
149
-     * @param \phpbbgallery\core\auth\level $auth_level Gallery auth level object
150
-     * @param \phpbbgallery\core\url $url
151
-     * @param \phpbbgallery\core\misc $misc
152
-     * @param \phpbbgallery\core\comment $comment
153
-     * @param \phpbbgallery\core\report $report
154
-     * @param \phpbbgallery\core\notification\helper $notification_helper
155
-     * @param \phpbbgallery\core\log $gallery_log
156
-     * @param \phpbbgallery\core\moderate $moderate
157
-     * @param \phpbbgallery\core\rating $gallery_rating
158
-     * @param \phpbbgallery\core\block $block
159
-     * @param ContainerInterface $phpbb_container
160
-     * @param string $albums_table Gallery albums table
161
-     * @param string $images_table Gallery images table
162
-     * @param string $users_table Gallery users table
163
-     * @param                                                           $table_comments
164
-     * @param                                                           $phpbb_root_path
165
-     * @param                                                           $php_ext
166
-     * @internal param \phpbbgallery\core\comment $gallery_comment Gallery comment class
167
-     */
128
+	/**
129
+	 * Constructor
130
+	 *
131
+	 * @param \phpbb\request\request $request
132
+	 * @param \phpbb\auth\auth $auth Gallery auth object
133
+	 * @param \phpbb\config\config $config Config object
134
+	 * @param \phpbb\controller\helper $helper Controller helper object
135
+	 * @param \phpbb\db\driver\driver|\phpbb\db\driver\driver_interface $db Database object
136
+	 * @param \phpbb\event\dispatcher $dispatcher Event dispatcher object
137
+	 * @param \phpbb\pagination $pagination Pagination object
138
+	 * @param \phpbb\template\template $template Template object
139
+	 * @param \phpbb\user $user User object
140
+	 * @param manager $cpf_manager
141
+	 * @param \phpbb\language\language $language
142
+	 * @param \phpbbgallery\core\album\display $display Albums display object
143
+	 * @param \phpbbgallery\core\album\loader $loader Albums display object
144
+	 * @param \phpbbgallery\core\album\album $album
145
+	 * @param \phpbbgallery\core\image\image $image
146
+	 * @param \phpbbgallery\core\auth\auth $gallery_auth
147
+	 * @param \phpbbgallery\core\user $gallery_user
148
+	 * @param \phpbbgallery\core\config $gallery_config
149
+	 * @param \phpbbgallery\core\auth\level $auth_level Gallery auth level object
150
+	 * @param \phpbbgallery\core\url $url
151
+	 * @param \phpbbgallery\core\misc $misc
152
+	 * @param \phpbbgallery\core\comment $comment
153
+	 * @param \phpbbgallery\core\report $report
154
+	 * @param \phpbbgallery\core\notification\helper $notification_helper
155
+	 * @param \phpbbgallery\core\log $gallery_log
156
+	 * @param \phpbbgallery\core\moderate $moderate
157
+	 * @param \phpbbgallery\core\rating $gallery_rating
158
+	 * @param \phpbbgallery\core\block $block
159
+	 * @param ContainerInterface $phpbb_container
160
+	 * @param string $albums_table Gallery albums table
161
+	 * @param string $images_table Gallery images table
162
+	 * @param string $users_table Gallery users table
163
+	 * @param                                                           $table_comments
164
+	 * @param                                                           $phpbb_root_path
165
+	 * @param                                                           $php_ext
166
+	 * @internal param \phpbbgallery\core\comment $gallery_comment Gallery comment class
167
+	 */
168 168
 	public function __construct(\phpbb\request\request $request, \phpbb\auth\auth $auth, \phpbb\config\config $config,
169 169
 		\phpbb\controller\helper $helper, \phpbb\db\driver\driver_interface $db,
170 170
 		\phpbb\event\dispatcher $dispatcher, \phpbb\pagination $pagination,
171 171
 		\phpbb\template\template $template, \phpbb\user $user, \phpbb\profilefields\manager $cpf_manager,
172
-        \phpbb\language\language $language, \phpbbgallery\core\album\display $display,
172
+		\phpbb\language\language $language, \phpbbgallery\core\album\display $display,
173 173
 		\phpbbgallery\core\album\loader $loader, \phpbbgallery\core\album\album $album,
174 174
 		\phpbbgallery\core\image\image $image, \phpbbgallery\core\auth\auth $gallery_auth,
175 175
 		\phpbbgallery\core\user $gallery_user, \phpbbgallery\core\config $gallery_config,
@@ -428,15 +428,15 @@  discard block
 block discarded – undo
428 428
 		$image_data = $this->data;
429 429
 
430 430
 		/**
431
-		* Event view image
432
-		*
433
-		* @event phpbbgallery.core.viewimage
434
-		* @var	int		image_id		id of the image we are viewing
435
-		* @var	array	image_data		All the data related to the image
436
-		* @var	array	album_data		All the data related to the album image is part of
437
-		* @var	string	page_title		Page title
438
-		* @since 1.2.0
439
-		*/
431
+		 * Event view image
432
+		 *
433
+		 * @event phpbbgallery.core.viewimage
434
+		 * @var	int		image_id		id of the image we are viewing
435
+		 * @var	array	image_data		All the data related to the image
436
+		 * @var	array	album_data		All the data related to the album image is part of
437
+		 * @var	string	page_title		Page title
438
+		 * @since 1.2.0
439
+		 */
440 440
 		$vars = array('image_id', 'image_data', 'album_data', 'page_title');
441 441
 		extract($this->dispatcher->trigger_event('phpbbgallery.core.viewimage', compact($vars)));
442 442
 
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 
445 445
 		$this->users_id_array[$this->data['image_user_id']] = $this->data['image_user_id'];
446 446
 
447
-        $this->load_users_data();
447
+		$this->load_users_data();
448 448
 
449 449
 		$this->users_data_array[$this->data['image_user_id']]['username'] = ($this->data['image_username']) ? $this->data['image_username'] : $this->language->lang('GUEST');
450 450
 		$this->template->assign_vars(array(
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
 			unset($rating);
500 500
 		}
501 501
 		/**
502
-		* Posting comment
503
-		*/
502
+		 * Posting comment
503
+		 */
504 504
 		$comments_disabled = (!$this->gallery_config->get('allow_comments') || ($this->gallery_config->get('comment_user_control') && !$image_data['image_allow_comments']));
505 505
 		if (!$comments_disabled && $this->gallery_auth->acl_check('c_post', $album_id, $album_data['album_user_id']) && ($album_data['album_status'] != $this->block->get_album_status_locked()) && (($image_data['image_status'] != $this->block->get_image_status_locked()) || $this->gallery_auth->acl_check('m_status', $album_id, $album_data['album_user_id'])))
506 506
 		{
@@ -585,13 +585,13 @@  discard block
 block discarded – undo
585 585
 			$this->template->assign_var('S_COMMENTS_DISABLED', true);
586 586
 		}
587 587
 
588
-        /**
589
-         * Listing comment
590
-         */
591
-        if (($this->gallery_config->get('allow_comments') && $this->gallery_auth->acl_check('c_read', $album_id, $album_data['album_user_id'])) /*&& (time() > ($album_data['contest_start'] + $album_data['contest_end']))*/)
592
-        {
593
-            $this->display_comments($image_id, $this->data, $album_id, $album_data, ($page - 1) * $this->gallery_config->get('items_per_page'), $this->gallery_config->get('items_per_page'));
594
-        }
588
+		/**
589
+		 * Listing comment
590
+		 */
591
+		if (($this->gallery_config->get('allow_comments') && $this->gallery_auth->acl_check('c_read', $album_id, $album_data['album_user_id'])) /*&& (time() > ($album_data['contest_start'] + $album_data['contest_end']))*/)
592
+		{
593
+			$this->display_comments($image_id, $this->data, $album_id, $album_data, ($page - 1) * $this->gallery_config->get('items_per_page'), $this->gallery_config->get('items_per_page'));
594
+		}
595 595
 		return $this->helper->render('gallery/viewimage_body.html', $page_title);
596 596
 	}
597 597
 	protected function display_comments($image_id, $image_data, $album_id, $album_data, $start, $limit)
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 				$this->users_id_array[$row['comment_user_id']] = $row['comment_user_id'];
626 626
 				if ($row['comment_edit_count'] > 0)
627 627
 				{
628
-                    $this->users_id_array[$row['comment_edit_user_id']] = $row['comment_edit_user_id'];
628
+					$this->users_id_array[$row['comment_edit_user_id']] = $row['comment_edit_user_id'];
629 629
 				}
630 630
 			}
631 631
 			$this->db->sql_freeresult($result);
@@ -655,43 +655,43 @@  discard block
 block discarded – undo
655 655
 
656 656
 
657 657
 				// Let's deply new profile
658
-                $poster_id = $row['comment_user_id'];
659
-
660
-                if ($row['comment_edit_count'] > 0)
661
-                {
662
-                    $edit_info = ($row['comment_edit_count'] == 1) ? $this->language->lang('IMAGE_EDITED_TIME_TOTAL') : $this->language->lang('IMAGE_EDITED_TIMES_TOTAL');
663
-                    $edit_info = sprintf($edit_info, get_username_string('full', $row['comment_edit_user_id'], $this->users_data_array[$row['comment_edit_user_id']]['username'], $this->users_data_array[$row['comment_edit_user_id']]['user_colour']), $this->user->format_date($row['comment_edit_time'], false, true), $row['comment_edit_count']);
664
-                }
665
-                $user_deleted = (isset($this->users_data_array[$poster_id]) ? false : true);
666
-                // End signature parsing, only if needed
667
-                if ($this->users_data_array[$poster_id]['sig'] && empty($this->users_data_array[$poster_id]['sig_parsed']))
668
-                {
669
-                    $parse_flags = ($this->users_data_array[$poster_id]['sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
670
-                    $user_cache[$poster_id]['sig'] = generate_text_for_display($this->users_data_array[$poster_id]['sig'], $this->users_data_array[$poster_id]['sig_bbcode_uid'], $this->users_data_array[$poster_id]['sig_bbcode_bitfield'],  $parse_flags, true);
671
-                    $user_cache[$poster_id]['sig_parsed'] = true;
672
-                }
673
-
674
-                $cp_row = array();
675
-                //CPF
676
-                if ($this->config['load_cpf_viewtopic'])
677
-                {
678
-                    $cp_row = (isset($this->profile_fields_data[$poster_id])) ? $this->cpf_manager->generate_profile_fields_template_data($this->profile_fields_data[$poster_id]) : array();
679
-                }
680
-                $can_receive_pm = (
681
-                    // They must be a "normal" user
682
-                    $this->users_data_array[$poster_id]['user_type'] != USER_IGNORE &&
683
-                    // They must not be deactivated by the administrator
684
-                    ($this->users_data_array[$poster_id]['user_type'] != USER_INACTIVE || $this->users_data_array[$poster_id]['user_inactive_reason'] != INACTIVE_MANUAL) &&
685
-                    // They must be able to read PMs
686
-                    in_array($poster_id, $this->can_receive_pm_list) &&
687
-                    // They must allow users to contact via PM
688
-                    (($this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_')) || $this->users_data_array[$poster_id]['allow_pm'])
689
-                );
690
-                $u_pm = '';
691
-                if ($this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $can_receive_pm)
692
-                {
693
-                    $u_pm = append_sid("{$this->phpbb_root_path}ucp.$this->php_ext", 'i=pm&mode=compose');
694
-                }
658
+				$poster_id = $row['comment_user_id'];
659
+
660
+				if ($row['comment_edit_count'] > 0)
661
+				{
662
+					$edit_info = ($row['comment_edit_count'] == 1) ? $this->language->lang('IMAGE_EDITED_TIME_TOTAL') : $this->language->lang('IMAGE_EDITED_TIMES_TOTAL');
663
+					$edit_info = sprintf($edit_info, get_username_string('full', $row['comment_edit_user_id'], $this->users_data_array[$row['comment_edit_user_id']]['username'], $this->users_data_array[$row['comment_edit_user_id']]['user_colour']), $this->user->format_date($row['comment_edit_time'], false, true), $row['comment_edit_count']);
664
+				}
665
+				$user_deleted = (isset($this->users_data_array[$poster_id]) ? false : true);
666
+				// End signature parsing, only if needed
667
+				if ($this->users_data_array[$poster_id]['sig'] && empty($this->users_data_array[$poster_id]['sig_parsed']))
668
+				{
669
+					$parse_flags = ($this->users_data_array[$poster_id]['sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
670
+					$user_cache[$poster_id]['sig'] = generate_text_for_display($this->users_data_array[$poster_id]['sig'], $this->users_data_array[$poster_id]['sig_bbcode_uid'], $this->users_data_array[$poster_id]['sig_bbcode_bitfield'],  $parse_flags, true);
671
+					$user_cache[$poster_id]['sig_parsed'] = true;
672
+				}
673
+
674
+				$cp_row = array();
675
+				//CPF
676
+				if ($this->config['load_cpf_viewtopic'])
677
+				{
678
+					$cp_row = (isset($this->profile_fields_data[$poster_id])) ? $this->cpf_manager->generate_profile_fields_template_data($this->profile_fields_data[$poster_id]) : array();
679
+				}
680
+				$can_receive_pm = (
681
+					// They must be a "normal" user
682
+					$this->users_data_array[$poster_id]['user_type'] != USER_IGNORE &&
683
+					// They must not be deactivated by the administrator
684
+					($this->users_data_array[$poster_id]['user_type'] != USER_INACTIVE || $this->users_data_array[$poster_id]['user_inactive_reason'] != INACTIVE_MANUAL) &&
685
+					// They must be able to read PMs
686
+					in_array($poster_id, $this->can_receive_pm_list) &&
687
+					// They must allow users to contact via PM
688
+					(($this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_')) || $this->users_data_array[$poster_id]['allow_pm'])
689
+				);
690
+				$u_pm = '';
691
+				if ($this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $can_receive_pm)
692
+				{
693
+					$u_pm = append_sid("{$this->phpbb_root_path}ucp.$this->php_ext", 'i=pm&mode=compose');
694
+				}
695 695
 
696 696
 				$comment_row = array(
697 697
 					'U_COMMENT'		=> $this->helper->route('phpbbgallery_core_image', array('image_id'	=> $image_id)) . '#comment_' . $row['comment_id'],
@@ -704,10 +704,10 @@  discard block
 block discarded – undo
704 704
 					'U_EDIT'		=> ($this->gallery_auth->acl_check('m_comments', $album_id, $album_data['album_user_id']) || ($this->gallery_auth->acl_check('c_edit', $album_id, $album_data['album_user_id']) && ($row['comment_user_id'] == $this->user->data['user_id']) && $this->user->data['is_registered'])) ? $this->helper->route('phpbbgallery_core_comment_edit', array('image_id'	=> $image_id, 'comment_id'	=> $row['comment_id'])) : '',
705 705
 					'U_INFO'		=> ($this->auth->acl_get('a_')) ? $this->url->append_sid('mcp', 'mode=whois&ip=' . $row['comment_user_ip']) : '',
706 706
 
707
-                    'POSTER_FULL'		=> get_username_string('full', $poster_id, $this->users_data_array[$poster_id]['username'], $this->users_data_array[$poster_id]['user_colour']),
708
-                    'POSTER_COLOUR'		=> get_username_string('colour', $poster_id, $this->users_data_array[$poster_id]['username'], $this->users_data_array[$poster_id]['user_colour']),
709
-                    'POSTER_USERNAME'	=> get_username_string('username', $poster_id, $this->users_data_array[$poster_id]['username'], $this->users_data_array[$poster_id]['user_colour']),
710
-                    'U_POSTER'			=> get_username_string('profile', $poster_id, $this->users_data_array[$poster_id]['username'], $this->users_data_array[$poster_id]['user_colour']),
707
+					'POSTER_FULL'		=> get_username_string('full', $poster_id, $this->users_data_array[$poster_id]['username'], $this->users_data_array[$poster_id]['user_colour']),
708
+					'POSTER_COLOUR'		=> get_username_string('colour', $poster_id, $this->users_data_array[$poster_id]['username'], $this->users_data_array[$poster_id]['user_colour']),
709
+					'POSTER_USERNAME'	=> get_username_string('username', $poster_id, $this->users_data_array[$poster_id]['username'], $this->users_data_array[$poster_id]['user_colour']),
710
+					'U_POSTER'			=> get_username_string('profile', $poster_id, $this->users_data_array[$poster_id]['username'], $this->users_data_array[$poster_id]['user_colour']),
711 711
 
712 712
 					'SIGNATURE'			=> ($row['comment_signature'] && !$user_deleted) ? $this->users_data_array[$poster_id]['sig'] : '',
713 713
 					'RANK_TITLE'		=> $user_deleted ? '' : $this->users_data_array[$poster_id]['rank_title'],
@@ -725,60 +725,60 @@  discard block
 block discarded – undo
725 725
 					'ONLINE_IMG'		=> ($poster_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? '' : ($user_deleted ? '' : (($this->users_data_array[$poster_id]['online']) ? $this->user->img('icon_user_online', 'ONLINE') : $this->user->img('icon_user_offline', 'OFFLINE'))),
726 726
 					'S_ONLINE'			=> ($poster_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? false : ($user_deleted ? '' : (($this->users_data_array[$poster_id]['online']) ? true : false)),
727 727
 
728
-                    'S_CUSTOM_FIELDS'	=> (isset($cp_row['row']) && count($cp_row['row'])) ? true : false,
729
-                );
730
-                if (isset($cp_row['row']) && count($cp_row['row']))
731
-                {
732
-                    $comment_row = array_merge($comment_row, $cp_row['row']);
733
-                }
728
+					'S_CUSTOM_FIELDS'	=> (isset($cp_row['row']) && count($cp_row['row'])) ? true : false,
729
+				);
730
+				if (isset($cp_row['row']) && count($cp_row['row']))
731
+				{
732
+					$comment_row = array_merge($comment_row, $cp_row['row']);
733
+				}
734 734
 				$this->template->assign_block_vars('commentrow', $comment_row);
735 735
 
736
-                $contact_fields = array(
737
-                    array(
738
-                        'ID'		=> 'pm',
739
-                        'NAME' 		=> $this->language->lang('SEND_PRIVATE_MESSAGE'),
740
-                        'U_CONTACT'	=> $u_pm,
741
-                    ),
742
-                    array(
743
-                        'ID'		=> 'email',
744
-                        'NAME'		=> $this->language->lang('SEND_EMAIL'),
745
-                        'U_CONTACT'	=> $this->users_data_array[$poster_id]['email'],
746
-                    ),
747
-                    array(
748
-                        'ID'		=> 'jabber',
749
-                        'NAME'		=> $this->language->lang('JABBER'),
750
-                        'U_CONTACT'	=> $this->users_data_array[$poster_id]['jabber'],
751
-                    ),
752
-                );
753
-
754
-                foreach ($contact_fields as $field)
755
-                {
756
-                    if ($field['U_CONTACT'])
757
-                    {
758
-                        $this->template->assign_block_vars('commentrow.contact', $field);
759
-                    }
760
-                }
761
-
762
-                if (!empty($cp_row['blockrow']))
763
-                {
764
-                    foreach ($cp_row['blockrow'] as $field_data)
765
-                    {
766
-                        if ($field_data['S_PROFILE_CONTACT'])
767
-                        {
768
-                            $this->template->assign_block_vars('commentrow.contact', array(
769
-                                'ID'		=> $field_data['PROFILE_FIELD_IDENT'],
770
-                                'NAME'		=> $field_data['PROFILE_FIELD_NAME'],
771
-                                'U_CONTACT'	=> $field_data['PROFILE_FIELD_CONTACT'],
772
-                            ));
773
-                        }
774
-                        else
775
-                        {
776
-                            $this->template->assign_block_vars('commentrow.custom_fields', $field_data);
777
-                        }
778
-
779
-
780
-                    }
781
-                }
736
+				$contact_fields = array(
737
+					array(
738
+						'ID'		=> 'pm',
739
+						'NAME' 		=> $this->language->lang('SEND_PRIVATE_MESSAGE'),
740
+						'U_CONTACT'	=> $u_pm,
741
+					),
742
+					array(
743
+						'ID'		=> 'email',
744
+						'NAME'		=> $this->language->lang('SEND_EMAIL'),
745
+						'U_CONTACT'	=> $this->users_data_array[$poster_id]['email'],
746
+					),
747
+					array(
748
+						'ID'		=> 'jabber',
749
+						'NAME'		=> $this->language->lang('JABBER'),
750
+						'U_CONTACT'	=> $this->users_data_array[$poster_id]['jabber'],
751
+					),
752
+				);
753
+
754
+				foreach ($contact_fields as $field)
755
+				{
756
+					if ($field['U_CONTACT'])
757
+					{
758
+						$this->template->assign_block_vars('commentrow.contact', $field);
759
+					}
760
+				}
761
+
762
+				if (!empty($cp_row['blockrow']))
763
+				{
764
+					foreach ($cp_row['blockrow'] as $field_data)
765
+					{
766
+						if ($field_data['S_PROFILE_CONTACT'])
767
+						{
768
+							$this->template->assign_block_vars('commentrow.contact', array(
769
+								'ID'		=> $field_data['PROFILE_FIELD_IDENT'],
770
+								'NAME'		=> $field_data['PROFILE_FIELD_NAME'],
771
+								'U_CONTACT'	=> $field_data['PROFILE_FIELD_CONTACT'],
772
+							));
773
+						}
774
+						else
775
+						{
776
+							$this->template->assign_block_vars('commentrow.custom_fields', $field_data);
777
+						}
778
+
779
+
780
+					}
781
+				}
782 782
 
783 783
 			}
784 784
 			//$this->db->sql_freeresult($result);
@@ -1219,48 +1219,48 @@  discard block
 block discarded – undo
1219 1219
 	}
1220 1220
 
1221 1221
 	protected function load_users_data()
1222
-    {
1223
-
1224
-        $sql = $this->db->sql_build_query('SELECT', array(
1225
-            'SELECT'	=> 'u.*, gu.personal_album_id, gu.user_images',
1226
-            'FROM'		=> array(USERS_TABLE => 'u'),
1227
-
1228
-            'LEFT_JOIN'	=> array(
1229
-                array(
1230
-                    'FROM'	=> array($this->table_users => 'gu'),
1231
-                    'ON'	=> 'gu.user_id = u.user_id'
1232
-                ),
1233
-            ),
1234
-
1235
-            'WHERE'		=> $this->db->sql_in_set('u.user_id', $this->users_id_array),
1236
-        ));
1237
-        $result = $this->db->sql_query($sql);
1238
-
1239
-        while ($row = $this->db->sql_fetchrow($result))
1240
-        {
1241
-            $this->gallery_user->add_user_to_cache($this->users_data_array, $row);
1242
-        }
1243
-        $this->db->sql_freeresult($result);
1244
-
1245
-
1246
-        // Load CPF's
1247
-        $profile_fields_tmp = $this->cpf_manager->grab_profile_fields_data($this->users_id_array);
1248
-        foreach ($profile_fields_tmp as $profile_user_id => $profile_fields)
1249
-        {
1250
-            $this->profile_fields_data[$profile_user_id] = array();
1251
-            foreach ($profile_fields as $used_ident => $profile_field)
1252
-            {
1253
-                if ($profile_field['data']['field_show_on_vt'])
1254
-                {
1255
-                    $this->profile_fields_data[$profile_user_id][$used_ident] = $profile_field;
1256
-                }
1257
-            }
1258
-        }
1259
-        unset($profile_fields_tmp);
1260
-
1261
-        // Get the list of users who can receive private messages
1262
-        $this->can_receive_pm_list = $this->auth->acl_get_list(array_keys($this->users_data_array), 'u_readpm');
1263
-        $this->can_receive_pm_list = (empty($this->can_receive_pm_list) || !isset($this->can_receive_pm_list[0]['u_readpm'])) ? array() : $this->can_receive_pm_list[0]['u_readpm'];
1264
-
1265
-    }
1222
+	{
1223
+
1224
+		$sql = $this->db->sql_build_query('SELECT', array(
1225
+			'SELECT'	=> 'u.*, gu.personal_album_id, gu.user_images',
1226
+			'FROM'		=> array(USERS_TABLE => 'u'),
1227
+
1228
+			'LEFT_JOIN'	=> array(
1229
+				array(
1230
+					'FROM'	=> array($this->table_users => 'gu'),
1231
+					'ON'	=> 'gu.user_id = u.user_id'
1232
+				),
1233
+			),
1234
+
1235
+			'WHERE'		=> $this->db->sql_in_set('u.user_id', $this->users_id_array),
1236
+		));
1237
+		$result = $this->db->sql_query($sql);
1238
+
1239
+		while ($row = $this->db->sql_fetchrow($result))
1240
+		{
1241
+			$this->gallery_user->add_user_to_cache($this->users_data_array, $row);
1242
+		}
1243
+		$this->db->sql_freeresult($result);
1244
+
1245
+
1246
+		// Load CPF's
1247
+		$profile_fields_tmp = $this->cpf_manager->grab_profile_fields_data($this->users_id_array);
1248
+		foreach ($profile_fields_tmp as $profile_user_id => $profile_fields)
1249
+		{
1250
+			$this->profile_fields_data[$profile_user_id] = array();
1251
+			foreach ($profile_fields as $used_ident => $profile_field)
1252
+			{
1253
+				if ($profile_field['data']['field_show_on_vt'])
1254
+				{
1255
+					$this->profile_fields_data[$profile_user_id][$used_ident] = $profile_field;
1256
+				}
1257
+			}
1258
+		}
1259
+		unset($profile_fields_tmp);
1260
+
1261
+		// Get the list of users who can receive private messages
1262
+		$this->can_receive_pm_list = $this->auth->acl_get_list(array_keys($this->users_data_array), 'u_readpm');
1263
+		$this->can_receive_pm_list = (empty($this->can_receive_pm_list) || !isset($this->can_receive_pm_list[0]['u_readpm'])) ? array() : $this->can_receive_pm_list[0]['u_readpm'];
1264
+
1265
+	}
1266 1266
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	public function base($image_id, $page = 0)
229 229
 	{
230 230
 
231
-		$this->language->add_lang( array('gallery'), 'phpbbgallery/core');
231
+		$this->language->add_lang(array('gallery'), 'phpbbgallery/core');
232 232
 		try
233 233
 		{
234 234
 			$sql = 'SELECT *
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 			$this->language->add_lang('posting');
509 509
 			$this->url->_include('functions_posting', 'phpbb');
510 510
 
511
-			$bbcode_status	= ($this->config['allow_bbcode']) ? true : false;
512
-			$smilies_status	= ($this->config['allow_smilies']) ? true : false;
511
+			$bbcode_status = ($this->config['allow_bbcode']) ? true : false;
512
+			$smilies_status = ($this->config['allow_smilies']) ? true : false;
513 513
 			$img_status		= ($bbcode_status) ? true : false;
514 514
 			$url_status		= ($this->config['allow_post_links']) ? true : false;
515 515
 			$flash_status	= false;
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
                 if ($this->users_data_array[$poster_id]['sig'] && empty($this->users_data_array[$poster_id]['sig_parsed']))
668 668
                 {
669 669
                     $parse_flags = ($this->users_data_array[$poster_id]['sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
670
-                    $user_cache[$poster_id]['sig'] = generate_text_for_display($this->users_data_array[$poster_id]['sig'], $this->users_data_array[$poster_id]['sig_bbcode_uid'], $this->users_data_array[$poster_id]['sig_bbcode_bitfield'],  $parse_flags, true);
670
+                    $user_cache[$poster_id]['sig'] = generate_text_for_display($this->users_data_array[$poster_id]['sig'], $this->users_data_array[$poster_id]['sig_bbcode_uid'], $this->users_data_array[$poster_id]['sig_bbcode_bitfield'], $parse_flags, true);
671 671
                     $user_cache[$poster_id]['sig_parsed'] = true;
672 672
                 }
673 673
 
@@ -812,8 +812,8 @@  discard block
 block discarded – undo
812 812
 		$this->display->generate_navigation($album_data);
813 813
 		add_form_key('gallery');
814 814
 		$submit = $this->request->variable('submit', false);
815
-		$image_backlink = append_sid('./gallery/image/'. $image_id);
816
-		$album_backlink = append_sid('./gallery/album/'. $image_data['image_album_id']);
815
+		$image_backlink = append_sid('./gallery/image/' . $image_id);
816
+		$album_backlink = append_sid('./gallery/album/' . $image_data['image_album_id']);
817 817
 		$disp_image_data = $image_data;
818 818
 		$owner_id = $image_data['image_user_id'];
819 819
 		$album_loginlink = './ucp.php?mode=login';
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
 				include_once($this->phpbb_root_path . 'includes/message_parser.' . $this->php_ext);
847 847
 			}
848 848
 			$message_parser = new \parse_message();
849
-			$message_parser->message	= utf8_normalize_nfc($image_desc);
849
+			$message_parser->message = utf8_normalize_nfc($image_desc);
850 850
 			if ($message_parser->message)
851 851
 			{
852 852
 				$message_parser->parse(true, true, true, true, false, true, true, true);
@@ -1002,8 +1002,8 @@  discard block
 block discarded – undo
1002 1002
 		{
1003 1003
 			include_once($this->phpbb_root_path . 'includes/message_parser.' . $this->php_ext);
1004 1004
 		}
1005
-		$message_parser				= new \parse_message();
1006
-		$message_parser->message	= $disp_image_data['image_desc'];
1005
+		$message_parser = new \parse_message();
1006
+		$message_parser->message = $disp_image_data['image_desc'];
1007 1007
 		$message_parser->decode_message($disp_image_data['image_desc_uid']);
1008 1008
 
1009 1009
 		$page_title = $disp_image_data['image_name'];
@@ -1114,8 +1114,8 @@  discard block
 block discarded – undo
1114 1114
 		$album_data = $this->album->get_info($album_id);
1115 1115
 		$this->language->add_lang(array('gallery'), 'phpbbgallery/core');
1116 1116
 		$album_loginlink = './ucp.php?mode=login';
1117
-		$image_backlink = append_sid('./gallery/image/'. $image_id);
1118
-		$album_backlink = append_sid('./gallery/album/'. $image_data['image_album_id']);
1117
+		$image_backlink = append_sid('./gallery/image/' . $image_id);
1118
+		$album_backlink = append_sid('./gallery/album/' . $image_data['image_album_id']);
1119 1119
 		$this->gallery_auth->load_user_premissions($this->user->data['user_id']);
1120 1120
 		if (!$this->gallery_auth->acl_check('i_report', $album_id, $album_data['album_user_id']) || ($image_data['image_user_id'] == $this->user->data['user_id']))
1121 1121
 		{
Please login to merge, or discard this patch.
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -245,8 +245,7 @@  discard block
 block discarded – undo
245 245
 			}
246 246
 
247 247
 			$this->loader->load($this->data['image_album_id']);
248
-		}
249
-		catch (\Exception $e)
248
+		} catch (\Exception $e)
250 249
 		{
251 250
 			throw new \phpbb\exception\http_exception(404, 'INVALID_IMAGE');
252 251
 		}
@@ -306,8 +305,7 @@  discard block
 block discarded – undo
306 305
 		if (in_array($sort_key, array('r', 'ra')))
307 306
 		{
308 307
 			$sql_help_sort = ', image_id ' . (($sort_dir == 'd') ? 'ASC' : 'DESC');
309
-		}
310
-		else
308
+		} else
311 309
 		{
312 310
 			$sql_help_sort = ', image_id ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
313 311
 		}
@@ -532,8 +530,7 @@  discard block
 block discarded – undo
532 530
 			if (isset($album_data['contest_start']))
533 531
 			{
534 532
 				$s_hide_comment_input = (time() < ($album_data['contest_start'] + $album_data['contest_end'])) ? true : false;
535
-			}
536
-			else
533
+			} else
537 534
 			{
538 535
 				$s_hide_comment_input = false;
539 536
 			}
@@ -579,8 +576,7 @@  discard block
 block discarded – undo
579 576
 				//$this->template->assign_var('S_COMMENT_ACTION', append_sid($this->url->path('full') . 'comment/' . $image_id . '/add/0'));
580 577
 				$this->template->assign_var('S_COMMENT_ACTION', $this->helper->route('phpbbgallery_core_comment_add', array('image_id' => $image_id, 'comment_id' => 0)));
581 578
 			}
582
-		}
583
-		else if ($this->gallery_config->get('comment_user_control') && !$image_data['image_allow_comments'])
579
+		} else if ($this->gallery_config->get('comment_user_control') && !$image_data['image_allow_comments'])
584 580
 		{
585 581
 			$this->template->assign_var('S_COMMENTS_DISABLED', true);
586 582
 		}
@@ -770,8 +766,7 @@  discard block
 block discarded – undo
770 766
                                 'NAME'		=> $field_data['PROFILE_FIELD_NAME'],
771 767
                                 'U_CONTACT'	=> $field_data['PROFILE_FIELD_CONTACT'],
772 768
                             ));
773
-                        }
774
-                        else
769
+                        } else
775 770
                         {
776 771
                             $this->template->assign_block_vars('commentrow.custom_fields', $field_data);
777 772
                         }
@@ -899,8 +894,7 @@  discard block
 block discarded – undo
899 894
 					{
900 895
 						$change_image_count = true;
901 896
 					}
902
-				}
903
-				else if ($this->request->variable('change_author', '', true))
897
+				} else if ($this->request->variable('change_author', '', true))
904 898
 				{
905 899
 					$errors[] = $this->language->lang('INVALID_USERNAME');
906 900
 				}
@@ -921,8 +915,7 @@  discard block
 block discarded – undo
921 915
 					{
922 916
 						$personal_album_id = $this->album->generate_personal_album($image_data['image_username'], $image_data['image_user_id'], $image_data['image_user_colour'], $image_user);
923 917
 					}
924
-				}
925
-				else
918
+				} else
926 919
 				{
927 920
 					$personal_album_id = $this->gallery_user->get_data('personal_album_id');
928 921
 					if (!$personal_album_id && $this->gallery_auth->acl_check('i_upload', $this->gallery_auth->get_own_album()))
@@ -1090,8 +1083,7 @@  discard block
 block discarded – undo
1090 1083
 			$this->notification_helper->read('approval', $album_id);
1091 1084
 			$this->url->meta_refresh(3, $album_backlink);
1092 1085
 			trigger_error($message);
1093
-		}
1094
-		else
1086
+		} else
1095 1087
 		{
1096 1088
 			if (isset($_POST['cancel']))
1097 1089
 			{
@@ -1099,8 +1091,7 @@  discard block
 block discarded – undo
1099 1091
 				$message .= '<br />' . sprintf($this->language->lang('CLICK_RETURN_IMAGE'), '<a href="' . $image_backlink . '">', '</a>');
1100 1092
 				$this->url->meta_refresh(3, $image_backlink);
1101 1093
 				trigger_error($message);
1102
-			}
1103
-			else
1094
+			} else
1104 1095
 			{
1105 1096
 				confirm_box(false, 'DELETE_IMAGE2', $s_hidden_fields);
1106 1097
 			}
@@ -1204,8 +1195,7 @@  discard block
 block discarded – undo
1204 1195
 			{
1205 1196
 				// @todo Add "redirect after login" url
1206 1197
 				login_box();
1207
-			}
1208
-			else
1198
+			} else
1209 1199
 			{
1210 1200
 				//return $this->error('NOT_AUTHORISED', 403);
1211 1201
 				redirect('/gallery/album/' . $album_id);
Please login to merge, or discard this patch.
core/migrations/release_1_2_0_add_bbcode.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,8 +53,7 @@  discard block
 block discarded – undo
53 53
 				{
54 54
 					$bbcode_id = NUM_CORE_BBCODES + 1;
55 55
 				}
56
-			}
57
-			else
56
+			} else
58 57
 			{
59 58
 				$bbcode_id = NUM_CORE_BBCODES + 1;
60 59
 			}
@@ -63,8 +62,7 @@  discard block
 block discarded – undo
63 62
 			if ($this->config['enable_mod_rewrite'])
64 63
 			{
65 64
 				$url .= 'gallery/image/';
66
-			}
67
-			else
65
+			} else
68 66
 			{
69 67
 				$url .= 'app.php/gallery/image/';
70 68
 			}
Please login to merge, or discard this patch.
core/migrations/release_1_2_0.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,8 +118,7 @@
 block discarded – undo
118 118
 			if (isset(self::$is_dynamic[$name]))
119 119
 			{
120 120
 				$config->set('phpbb_gallery_' . $name, $value, true);
121
-			}
122
-			else
121
+			} else
123 122
 			{
124 123
 				$config->set('phpbb_gallery_' . $name, $value);
125 124
 			}
Please login to merge, or discard this patch.
core/migrations/release_1_2_0_create_filesystem.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,8 +89,7 @@
 block discarded – undo
89 89
 			if (is_dir($file))
90 90
 			{
91 91
 				$this->recursiveRemoveDirectory($file);
92
-			}
93
-			else
92
+			} else
94 93
 			{
95 94
 				unlink($file);
96 95
 			}
Please login to merge, or discard this patch.
core/ext.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 		'phpbbgallery/acpcleanup',
15 15
 	);
16 16
 	/**
17
-	* Single enable step that installs any included migrations
18
-	*
19
-	* @param mixed $old_state State returned by previous call of this method
20
-	* @return mixed Returns false after last step, otherwise temporary state
21
-	*/
17
+	 * Single enable step that installs any included migrations
18
+	 *
19
+	 * @param mixed $old_state State returned by previous call of this method
20
+	 * @return mixed Returns false after last step, otherwise temporary state
21
+	 */
22 22
 	function enable_step($old_state)
23 23
 	{
24 24
 		switch ($old_state)
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	/**
55
-	* Single disable step that does nothing
56
-	*
57
-	* @param mixed $old_state State returned by previous call of this method
58
-	* @return mixed Returns false after last step, otherwise temporary state
59
-	*/
55
+	 * Single disable step that does nothing
56
+	 *
57
+	 * @param mixed $old_state State returned by previous call of this method
58
+	 * @return mixed Returns false after last step, otherwise temporary state
59
+	 */
60 60
 	function disable_step($old_state)
61 61
 	{
62 62
 		switch ($old_state)
@@ -87,21 +87,21 @@  discard block
 block discarded – undo
87 87
 	}
88 88
 
89 89
 	/**
90
-	* Single purge step that reverts any included and installed migrations
91
-	*
92
-	* @param mixed $old_state State returned by previous call of this method
93
-	* @return mixed Returns false after last step, otherwise temporary state
94
-	*/
90
+	 * Single purge step that reverts any included and installed migrations
91
+	 *
92
+	 * @param mixed $old_state State returned by previous call of this method
93
+	 * @return mixed Returns false after last step, otherwise temporary state
94
+	 */
95 95
 	function purge_step($old_state)
96 96
 	{
97 97
 		switch ($old_state)
98 98
 		{
99 99
 			case '': // Empty means nothing has run yet
100 100
 				/**
101
-				* @todo Remove this try/catch condition once purge_notifications is fixed
102
-				* in the core to work with disabled extensions without fatal errors.
103
-				* https://tracker.phpbb.com/browse/PHPBB3-12435
104
-				*/
101
+				 * @todo Remove this try/catch condition once purge_notifications is fixed
102
+				 * in the core to work with disabled extensions without fatal errors.
103
+				 * https://tracker.phpbb.com/browse/PHPBB3-12435
104
+				 */
105 105
 				try
106 106
 				{
107 107
 					// Purge board rules notifications
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -111,8 +111,7 @@
 block discarded – undo
111 111
 					$phpbb_notifications->purge_notifications('phpbbgallery.core.notification.new_image');
112 112
 					$phpbb_notifications->purge_notifications('phpbbgallery.core.notification.new_comment');
113 113
 					$phpbb_notifications->purge_notifications('phpbbgallery.core.notification.new_report');
114
-				}
115
-				catch (\phpbb\notification\exception $e)
114
+				} catch (\phpbb\notification\exception $e)
116 115
 				{
117 116
 					// continue
118 117
 				}
Please login to merge, or discard this patch.
core/moderate.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@
 block discarded – undo
59 59
 	}
60 60
 
61 61
 	/**
62
-	* Helper function building queues
63
-	* @param	int		$album	album we build queue for
64
-	* @param	int		$page	This queue builder should return objects for MCP queues, so page?
65
-	* @param	int		$per_page	We need how many elements per page
66
-	*/
62
+	 * Helper function building queues
63
+	 * @param	int		$album	album we build queue for
64
+	 * @param	int		$page	This queue builder should return objects for MCP queues, so page?
65
+	 * @param	int		$per_page	We need how many elements per page
66
+	 */
67 67
 	public function build_list($album, $page = 1, $per_page = 0)
68 68
 	{
69 69
 		// So if we are not forcing par page get it from config
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 				'IMAGE_ALBUM_ID'	=> $VAR['image_album_id'],
143 143
 			));
144 144
 			unset($album_tmp);
145
-			$waiting_images ++;
145
+			$waiting_images++;
146 146
 		}
147 147
 		$this->template->assign_vars(array(
148 148
 			'TOTAL_IMAGES_WAITING' => $this->lang->lang('WAITING_UNAPPROVED_IMAGE', (int) $count),
@@ -212,21 +212,21 @@  discard block
 block discarded – undo
212 212
 		{
213 213
 			$status[] = 0;
214 214
 			$status[] = 2;
215
-			$actions['approve']	= 'QUEUES_A_APPROVE';
216
-			$actions['unapprove']	= 'QUEUES_A_UNAPPROVE';
217
-			$actions['lock']	= 'QUEUES_A_LOCK';
215
+			$actions['approve'] = 'QUEUES_A_APPROVE';
216
+			$actions['unapprove'] = 'QUEUES_A_UNAPPROVE';
217
+			$actions['lock'] = 'QUEUES_A_LOCK';
218 218
 		}
219 219
 		if ($this->gallery_auth->acl_check('m_delete', $album['album_id'], $album['album_user_id']))
220 220
 		{
221
-			$actions['delete']	= 'QUEUES_A_DELETE';
221
+			$actions['delete'] = 'QUEUES_A_DELETE';
222 222
 		}
223 223
 		if ($this->gallery_auth->acl_check('m_move', $album['album_id'], $album['album_user_id']))
224 224
 		{
225
-			$actions['move']	= 'QUEUES_A_MOVE';
225
+			$actions['move'] = 'QUEUES_A_MOVE';
226 226
 		}
227 227
 		if ($this->gallery_auth->acl_check('m_report', $album['album_id'], $album['album_user_id']))
228 228
 		{
229
-			$actions['report']	= 'REPORT_A_CLOSE';
229
+			$actions['report'] = 'REPORT_A_CLOSE';
230 230
 		}
231 231
 		$sql = 'SELECT COUNT(DISTINCT image_id) AS count FROM ' . $this->images_table . ' WHERE ' . $this->db->sql_in_set('image_status', $status) . ' AND image_album_id = ' . (int) $album_id;
232 232
 		$result = $this->db->sql_query($sql);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,8 +83,7 @@  discard block
 block discarded – undo
83 83
 			{
84 84
 				$mod_array[] = 0;
85 85
 			}
86
-		}
87
-		else
86
+		} else
88 87
 		{
89 88
 			$mod_array = array($album);
90 89
 		}
@@ -161,8 +160,7 @@  discard block
 block discarded – undo
161 160
 			$this->template->assign_vars(array(
162 161
 				'TOTAL_PAGES'				=> $this->lang->lang('PAGE_TITLE_NUMBER', $page + 1),
163 162
 			));
164
-		}
165
-		else
163
+		} else
166 164
 		{
167 165
 			$this->pagination->generate_template_pagination(array(
168 166
 				'routes' => array(
Please login to merge, or discard this patch.
core/config.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -147,8 +147,7 @@  discard block
 block discarded – undo
147 147
 			if (isset($this->config['phpbb_gallery_' . $option]))
148 148
 			{
149 149
 				$config_ary[$option] = $this->config['phpbb_gallery_' . $option];
150
-			}
151
-			else
150
+			} else
152 151
 			{
153 152
 				$config_ary[$option] = $default;
154 153
 			}
@@ -161,8 +160,7 @@  discard block
 block discarded – undo
161 160
 		if (isset($this->config['phpbb_gallery_' . $key]))
162 161
 		{
163 162
 			return $this->config['phpbb_gallery_' . $key];
164
-		}
165
-		else
163
+		} else
166 164
 		{
167 165
 			return $this->configs_array[$key];
168 166
 		}
Please login to merge, or discard this patch.
core/album/album.php 3 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -14,40 +14,40 @@  discard block
 block discarded – undo
14 14
 
15 15
 class album
16 16
 {
17
-    /** @var \phpbb\db\driver\driver_interface  */
18
-    protected $db;
17
+	/** @var \phpbb\db\driver\driver_interface  */
18
+	protected $db;
19 19
 
20
-    /** @var \phpbb\user  */
21
-    protected $user;
20
+	/** @var \phpbb\user  */
21
+	protected $user;
22 22
 
23
-    /** @var language  */
24
-    protected $language;
23
+	/** @var language  */
24
+	protected $language;
25 25
 
26
-    /** @var \phpbb\profilefields\manager  */
27
-    protected $user_cpf;
26
+	/** @var \phpbb\profilefields\manager  */
27
+	protected $user_cpf;
28 28
 
29
-    /** @var \phpbbgallery\core\auth\auth  */
30
-    protected $gallery_auth;
29
+	/** @var \phpbbgallery\core\auth\auth  */
30
+	protected $gallery_auth;
31 31
 
32
-    /** @var \phpbbgallery\core\cache  */
33
-    protected $gallery_cache;
32
+	/** @var \phpbbgallery\core\cache  */
33
+	protected $gallery_cache;
34 34
 
35
-    /** @var \phpbbgallery\core\block  */
36
-    protected $block;
35
+	/** @var \phpbbgallery\core\block  */
36
+	protected $block;
37 37
 
38
-    /** @var \phpbbgallery\core\config  */
39
-    protected $gallery_config;
38
+	/** @var \phpbbgallery\core\config  */
39
+	protected $gallery_config;
40 40
 
41
-    /** @var  */
42
-    protected $images_table;
41
+	/** @var  */
42
+	protected $images_table;
43 43
 
44
-    /** @var  */
45
-    protected $watch_table;
44
+	/** @var  */
45
+	protected $watch_table;
46 46
 
47
-    /** @var  */
48
-    protected $contest_table;
47
+	/** @var  */
48
+	protected $contest_table;
49 49
 
50
-    /** @var  */
50
+	/** @var  */
51 51
 	protected $albums_table;
52 52
 
53 53
 	/**
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
 	}
464 464
 
465 465
 	/**
466
-	* Create array of album IDs that are public
467
-	*/
466
+	 * Create array of album IDs that are public
467
+	 */
468 468
 	public function get_public_albums()
469 469
 	{
470 470
 		$sql = 'SELECT album_id
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			throw new \phpbb\exception\http_exception(404, 'ALBUM_NOT_EXIST');
127 127
 		}
128 128
 
129
-		if ($extended_info  && !isset($row['contest_id']))
129
+		if ($extended_info && !isset($row['contest_id']))
130 130
 		{
131 131
 			$row['contest_id'] = 0;
132 132
 			$row['contest_rates_start'] = 0;
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 
340 340
 		// Get the album_user_id, so we can keep the user_colour
341 341
 		$sql = 'SELECT album_user_id
342
-			FROM ' . $this->albums_table .'
342
+			FROM ' . $this->albums_table . '
343 343
 			WHERE album_id = ' . (int) $album_id;
344 344
 		$result = $this->db->sql_query($sql);
345 345
 		$album_user_id = $this->db->sql_fetchfield('album_user_id');
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 
348 348
 		// Number of not unapproved images
349 349
 		$sql = 'SELECT COUNT(image_id) images
350
-			FROM ' . $this->images_table .' 
350
+			FROM ' . $this->images_table . ' 
351 351
 			WHERE image_status <> ' . (int) $this->block->get_image_status_unapproved() . '
352 352
 				AND image_status <> ' . (int) $this->block->get_image_status_orphan() . '
353 353
 				AND image_album_id = ' . (int) $album_id;
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 
358 358
 		// Number of total images
359 359
 		$sql = 'SELECT COUNT(image_id) images_real
360
-			FROM ' . $this->images_table .'
360
+			FROM ' . $this->images_table . '
361 361
 			WHERE image_status <> ' . (int) $this->block->get_image_status_orphan() . '
362 362
 				AND image_album_id = ' . (int) $album_id;
363 363
 		$result = $this->db->sql_query($sql);
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 
367 367
 		// Data of the last not unapproved image
368 368
 		$sql = 'SELECT image_id, image_time, image_name, image_username, image_user_colour, image_user_id
369
-			FROM ' . $this->images_table .'
369
+			FROM ' . $this->images_table . '
370 370
 			WHERE image_status <> ' . (int) $this->block->get_image_status_unapproved() . '
371 371
 				AND image_status <> ' . (int) $this->block->get_image_status_orphan() . '
372 372
 				AND image_album_id = ' . (int) $album_id . '
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 		}
406 406
 		$this->db->sql_freeresult($result);
407 407
 
408
-		$sql = 'UPDATE ' . $this->albums_table .' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
408
+		$sql = 'UPDATE ' . $this->albums_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
409 409
 			WHERE album_id = ' . (int) $album_id;
410 410
 		$this->db->sql_query($sql);
411 411
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 			'album_last_username'			=> '',
436 436
 			'album_last_user_colour'		=> $user_colour,
437 437
 		);
438
-		$this->db->sql_query('INSERT INTO ' . $this->albums_table. ' ' . $this->db->sql_build_array('INSERT', $album_data));
438
+		$this->db->sql_query('INSERT INTO ' . $this->albums_table . ' ' . $this->db->sql_build_array('INSERT', $album_data));
439 439
 		$personal_album_id = $this->db->sql_nextid();
440 440
 
441 441
 		$gallery_user->update_data(array(
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -219,8 +219,7 @@  discard block
 block discarded – undo
219 219
 			{
220 220
 				$padding .= '&nbsp; &nbsp;';
221 221
 				$padding_store[$row['parent_id']] = $padding;
222
-			}
223
-			else if ($row['left_id'] > $right + 1)
222
+			} else if ($row['left_id'] > $right + 1)
224 223
 			{
225 224
 				$padding = (isset($padding_store[$row['parent_id']])) ? $padding_store[$row['parent_id']] : '';
226 225
 			}
@@ -246,15 +245,13 @@  discard block
 block discarded – undo
246 245
 			if (($select_id == $this->gallery_auth->get_setting_permissions()) && !$row['album_user_id'])
247 246
 			{
248 247
 				$list = true;
249
-			}
250
-			else if (!$row['album_user_id'])
248
+			} else if (!$row['album_user_id'])
251 249
 			{
252 250
 				if ($this->gallery_auth->acl_check('a_list', $row['album_id'], $row['album_user_id']) || defined('IN_ADMIN'))
253 251
 				{
254 252
 					$list = true;
255 253
 				}
256
-			}
257
-			else if (!$ignore_personals)
254
+			} else if (!$ignore_personals)
258 255
 			{
259 256
 				if ($row['album_user_id'] == $this->user->data['user_id'])
260 257
 				{
@@ -265,16 +262,14 @@  discard block
 block discarded – undo
265 262
 						if ($requested_permission)
266 263
 						{
267 264
 							$requested_own = !$this->gallery_auth->acl_check($requested_permission, $this->gallery_auth->get_own_album());
268
-						}
269
-						else
265
+						} else
270 266
 						{
271 267
 							$requested_own = false; // We need the negated version of true here
272 268
 						}
273 269
 					}
274 270
 					$list = (!$list) ? $access_own : $list;
275 271
 					$disabled = (!$disabled) ? $requested_own : $disabled;
276
-				}
277
-				else if ($row['album_user_id'])
272
+				} else if ($row['album_user_id'])
278 273
 				{
279 274
 					if (!$c_access_personal)
280 275
 					{
@@ -283,8 +278,7 @@  discard block
 block discarded – undo
283 278
 						if ($requested_permission)
284 279
 						{
285 280
 							$requested_personal = !$this->gallery_auth->acl_check($requested_permission, $this->gallery_auth->get_personal_album());
286
-						}
287
-						else
281
+						} else
288 282
 						{
289 283
 							$requested_personal = false; // We need the negated version of true here
290 284
 						}
@@ -296,8 +290,7 @@  discard block
 block discarded – undo
296 290
 			if (($album_user_id != \phpbbgallery\core\block::PUBLIC_ALBUM) && ($album_user_id != $row['album_user_id']))
297 291
 			{
298 292
 				$list = false;
299
-			}
300
-			else if (($album_user_id != \phpbbgallery\core\block::PUBLIC_ALBUM) && ($row['parent_id'] == 0))
293
+			} else if (($album_user_id != \phpbbgallery\core\block::PUBLIC_ALBUM) && ($row['parent_id'] == 0))
301 294
 			{
302 295
 				$disabled = true;
303 296
 			}
@@ -315,8 +308,7 @@  discard block
 block discarded – undo
315 308
 			$gallery_albumbox = "<select name='$select_name' id='$select_name'>";
316 309
 			$gallery_albumbox .= $album_list;
317 310
 			$gallery_albumbox .= '</select>';
318
-		}
319
-		else
311
+		} else
320 312
 		{
321 313
 			$gallery_albumbox = $album_list;
322 314
 		}
@@ -384,8 +376,7 @@  discard block
 block discarded – undo
384 376
 				'album_last_user_colour'	=> $row['image_user_colour'],
385 377
 				'album_last_user_id'		=> $row['image_user_id'],
386 378
 			);
387
-		}
388
-		else
379
+		} else
389 380
 		{
390 381
 			// No approved image, so we clear the columns
391 382
 			$sql_ary = array(
Please login to merge, or discard this patch.
core/album/display.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	public $album_mode;
35 35
 
36 36
 	public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\controller\helper $helper,
37
-								\phpbb\db\driver\driver_interface $db, 	\phpbb\pagination $pagination,
37
+								\phpbb\db\driver\driver_interface $db, \phpbb\pagination $pagination,
38 38
 								\phpbb\request\request $request, \phpbb\template\template $template,
39 39
 								\phpbb\user $user, \phpbb\language\language $language, \phpbbgallery\core\auth\auth $gallery_auth,
40 40
 								\phpbbgallery\core\user $gallery_user, \phpbbgallery\core\misc $misc,
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
 		$sql = 'SELECT a2.*
96 96
 			FROM ' . $this->table_albums . ' a1
97
-			LEFT JOIN ' . $this->table_albums . ' a2 ON (' . $condition .') AND a2.album_user_id = ' . (int) $branch_user_id .'
97
+			LEFT JOIN ' . $this->table_albums . ' a2 ON (' . $condition . ') AND a2.album_user_id = ' . (int) $branch_user_id . '
98 98
 			WHERE a1.album_id = ' . (int) $album_id . '
99 99
 				AND a1.album_user_id = ' . (int) $branch_user_id . '
100 100
 			ORDER BY a2.left_id ' . (($order == 'descending') ? 'ASC' : 'DESC');
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 			'ALBUM_ID' 		=> $album_data['album_id'],
178 178
 			'ALBUM_NAME'	=> $album_data['album_name'],
179 179
 			'ALBUM_DESC'	=> generate_text_for_display($album_data['album_desc'], $album_data['album_desc_uid'], $album_data['album_desc_bitfield'], $album_data['album_desc_options']),
180
-			'ALBUM_CONTEST_START'	=> ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST) ? $this->language->lang('CONTEST_START' . ((($album_data['contest_start']) < time())? 'ED' : 'S'), $this->user->format_date(($album_data['contest_start']), false, true)) : '',
181
-			'ALBUM_CONTEST_RATING'	=> ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST) ? $this->language->lang('CONTEST_RATING_START' . ((($album_data['contest_start'] + $album_data['contest_rating']) < time())? 'ED' : 'S'), $this->user->format_date(($album_data['contest_start'] + $album_data['contest_rating']), false, true)) : '',
182
-			'ALBUM_CONTEST_END'		=> ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST) ? $this->language->lang('CONTEST_END' . ((($album_data['contest_start'] + $album_data['contest_end']) < time())? 'ED' : 'S'), $this->user->format_date(($album_data['contest_start'] + $album_data['contest_end']), false, true)) : '',
180
+			'ALBUM_CONTEST_START'	=> ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST) ? $this->language->lang('CONTEST_START' . ((($album_data['contest_start']) < time()) ? 'ED' : 'S'), $this->user->format_date(($album_data['contest_start']), false, true)) : '',
181
+			'ALBUM_CONTEST_RATING'	=> ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST) ? $this->language->lang('CONTEST_RATING_START' . ((($album_data['contest_start'] + $album_data['contest_rating']) < time()) ? 'ED' : 'S'), $this->user->format_date(($album_data['contest_start'] + $album_data['contest_rating']), false, true)) : '',
182
+			'ALBUM_CONTEST_END'		=> ($album_data['album_type'] == \phpbbgallery\core\block::TYPE_CONTEST) ? $this->language->lang('CONTEST_END' . ((($album_data['contest_start'] + $album_data['contest_end']) < time()) ? 'ED' : 'S'), $this->user->format_date(($album_data['contest_start'] + $album_data['contest_end']), false, true)) : '',
183 183
 			'U_VIEW_ALBUM'	=> $this->helper->route('phpbbgallery_core_album', array('album_id' => $album_data['album_id'])),
184 184
 		));
185 185
 
@@ -691,9 +691,9 @@  discard block
 block discarded – undo
691 691
 				// phpbb_ext_gallery_core_image::generate_link('thumbnail', $phpbb_ext_gallery->config->get('link_thumbnail'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
692 692
 				$lastimage_uc_thumbnail = $row['album_image'] ? generate_board_url() . '/' . $row['album_image'] : $this->helper->route('phpbbgallery_core_image_file_mini', array('image_id' => $row['album_last_image_id']));
693 693
 				// phpbb_ext_gallery_core_image::generate_link('image_name', $phpbb_ext_gallery->config->get('link_image_name'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
694
-				$lastimage_uc_name = '';//@todo phpbb_ext_gallery_core_image::generate_link('image_name', $phpbb_ext_gallery->config->get('link_image_name'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
694
+				$lastimage_uc_name = ''; //@todo phpbb_ext_gallery_core_image::generate_link('image_name', $phpbb_ext_gallery->config->get('link_image_name'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
695 695
 				// phpbb_ext_gallery_core_image::generate_link('lastimage_icon', $phpbb_ext_gallery->config->get('link_image_icon'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
696
-				$lastimage_uc_icon = '';//@todo phpbb_ext_gallery_core_image::generate_link('lastimage_icon', $phpbb_ext_gallery->config->get('link_image_icon'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
696
+				$lastimage_uc_icon = ''; //@todo phpbb_ext_gallery_core_image::generate_link('lastimage_icon', $phpbb_ext_gallery->config->get('link_image_icon'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
697 697
 			}
698 698
 			else
699 699
 			{
Please login to merge, or discard this patch.
Braces   +15 added lines, -25 removed lines patch added patch discarded remove patch
@@ -222,8 +222,7 @@  discard block
 block discarded – undo
222 222
 					SET album_parents = '" . $this->db->sql_escape($album_data['album_parents']) . "'
223 223
 					WHERE parent_id = " . (int) $album_data['parent_id'];
224 224
 				$this->db->sql_query($sql);
225
-			}
226
-			else
225
+			} else
227 226
 			{
228 227
 				$album_parents = unserialize($album_data['album_parents']);
229 228
 			}
@@ -291,16 +290,14 @@  discard block
 block discarded – undo
291 290
 			if (!empty($row['user_id']))
292 291
 			{
293 292
 				$album_moderators[$a_id][] = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
294
-			}
295
-			else
293
+			} else
296 294
 			{
297 295
 				$group_name = (($row['group_type'] == GROUP_SPECIAL) ? $this->language->lang('G_' . $row['group_name']) : $row['group_name']);
298 296
 
299 297
 				if ($this->user->data['user_id'] != ANONYMOUS && !$this->auth->acl_get('u_viewprofile'))
300 298
 				{
301 299
 					$album_moderators[$a_id][] = '<span' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . '>' . $group_name . '</span>';
302
-				}
303
-				else
300
+				} else
304 301
 				{
305 302
 					$album_moderators[$a_id][] = '<a' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . ' href="' . append_sid($this->root_path . 'memberlist.' . $this->php_ext, 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_name . '</a>';
306 303
 				}
@@ -344,8 +341,7 @@  discard block
 block discarded – undo
344 341
 			}
345 342
 			$root_data = array('album_id' => \phpbbgallery\core\block::PUBLIC_ALBUM);
346 343
 			$sql_where = 'a.album_user_id = ' . \phpbbgallery\core\block::PUBLIC_ALBUM;
347
-		}
348
-		else if ($root_data == 'personal')
344
+		} else if ($root_data == 'personal')
349 345
 		{
350 346
 			if ($mark_read == 'albums')
351 347
 			{
@@ -362,8 +358,7 @@  discard block
 block discarded – undo
362 358
 				{
363 359
 					$sql_where .= ' AND u.username_clean NOT ' . $this->db->sql_like_expression(chr($i) . $this->db->any_char);
364 360
 				}
365
-			}
366
-			else if ($first_char)
361
+			} else if ($first_char)
367 362
 			{
368 363
 				$sql_where .= ' AND u.username_clean ' . $this->db->sql_like_expression(substr($first_char, 0, 1) . $this->db->any_char);
369 364
 			}
@@ -407,8 +402,7 @@  discard block
 block discarded – undo
407 402
 					'phpbbgallery_core_search_recent_page',),
408 403
 					'params' => array()), 'pagination', 'page', $num_pegas, $limit, $start
409 404
 			);*/
410
-		}
411
-		else
405
+		} else
412 406
 		{
413 407
 			$sql_where = 'a.left_id > ' . $root_data['left_id'] . ' AND a.left_id < ' . $root_data['right_id'] . ' AND a.album_user_id = ' . $root_data['album_user_id'];
414 408
 		}
@@ -496,10 +490,12 @@  discard block
 block discarded – undo
496 490
 				continue;
497 491
 			}
498 492
 
499
-			if (false)//@todo !$this->gallery_auth->acl_check('a_list', $album_id, $row['album_user_id']))
493
+			if (false) {
494
+				//@todo !$this->gallery_auth->acl_check('a_list', $album_id, $row['album_user_id']))
500 495
 			{
501 496
 				// if the user does not have permissions to list this album, skip everything until next branch
502 497
 				$right_id = $row['right_id'];
498
+			}
503 499
 				continue;
504 500
 			}
505 501
 
@@ -524,8 +520,7 @@  discard block
 block discarded – undo
524 520
 				$album_rows[$parent_id]['album_type_last_image'] = $row['album_type'];
525 521
 				$album_rows[$parent_id]['album_contest_marked'] = $row['contest_marked'];
526 522
 				$album_rows[$parent_id]['orig_album_last_image_time'] = $row['album_last_image_time'];
527
-			}
528
-			else if ($row['album_type'])
523
+			} else if ($row['album_type'])
529 524
 			{
530 525
 				$subalbums[$parent_id][$album_id]['display'] = ($row['display_on_index']) ? true : false;
531 526
 				$subalbums[$parent_id][$album_id]['name'] = $row['album_name'];
@@ -567,16 +562,14 @@  discard block
 block discarded – undo
567 562
 				{
568 563
 					$this->misc->markread('all');
569 564
 					$message = $this->language->lang('RETURN_INDEX', '<a href="' . $redirect . '">', '</a>');
570
-				}
571
-				else
565
+				} else
572 566
 				{
573 567
 					$this->misc->markread('albums', $album_ids);
574 568
 					$message = $this->language->lang('RETURN_ALBUM', '<a href="' . $redirect . '">', '</a>');
575 569
 				}
576 570
 				meta_refresh(3, $redirect);
577 571
 				trigger_error($this->language->lang('ALBUMS_MARKED') . '<br /><br />' . $message);
578
-			}
579
-			else
572
+			} else
580 573
 			{
581 574
 				$message = $this->language->lang('RETURN_PAGE', '<a href="' . $redirect . '">', '</a>');
582 575
 				meta_refresh(3, $redirect);
@@ -654,8 +647,7 @@  discard block
 block discarded – undo
654 647
 							'name'		=> $subalbum_row['name'],
655 648
 							'unread'	=> $subalbum_unread,
656 649
 						);
657
-					}
658
-					else
650
+					} else
659 651
 					{
660 652
 						unset($subalbums[$album_id][$subalbum_id]);
661 653
 					}
@@ -668,8 +660,7 @@  discard block
 block discarded – undo
668 660
 
669 661
 				$l_subalbums = (sizeof($subalbums[$album_id]) == 1) ? $this->language->lang('SUBALBUM') : $this->language->lang('SUBALBUMS');
670 662
 				$folder_image = ($album_unread) ? 'forum_unread_subforum' : 'forum_read_subforum';
671
-			}
672
-			else
663
+			} else
673 664
 			{
674 665
 				$folder_alt = ($album_unread) ? 'NEW_IMAGES' : 'NO_NEW_IMAGES';
675 666
 				$folder_image = ($album_unread) ? 'forum_unread' : 'forum_read';
@@ -694,8 +685,7 @@  discard block
 block discarded – undo
694 685
 				$lastimage_uc_name = '';//@todo phpbb_ext_gallery_core_image::generate_link('image_name', $phpbb_ext_gallery->config->get('link_image_name'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
695 686
 				// phpbb_ext_gallery_core_image::generate_link('lastimage_icon', $phpbb_ext_gallery->config->get('link_image_icon'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
696 687
 				$lastimage_uc_icon = '';//@todo phpbb_ext_gallery_core_image::generate_link('lastimage_icon', $phpbb_ext_gallery->config->get('link_image_icon'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
697
-			}
698
-			else
688
+			} else
699 689
 			{
700 690
 				$lastimage_time = $lastimage_album_type = $lastimage_contest_marked = 0;
701 691
 				$lastimage_uc_fake_thumbnail = $lastimage_uc_thumbnail = $lastimage_uc_name = $lastimage_uc_icon = '';
Please login to merge, or discard this patch.