@@ -825,8 +825,8 @@ |
||
825 | 825 | generate_smilies('inline', 0); |
826 | 826 | |
827 | 827 | /** |
828 | - * Rating-System: now you can comment and rate in one form |
|
829 | - */ |
|
828 | + * Rating-System: now you can comment and rate in one form |
|
829 | + */ |
|
830 | 830 | $s_user_rated = false; |
831 | 831 | if ($this->gallery_config->get('allow_rates')) |
832 | 832 | { |
@@ -125,51 +125,51 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -14,11 +14,11 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -59,11 +59,11 @@ |
||
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 |
@@ -14,40 +14,40 @@ discard block |
||
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 |
||
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 |
@@ -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; |
@@ -751,8 +751,8 @@ discard block |
||
751 | 751 | $log_action = implode('_', array($log_action_images, $log_action_albums)); |
752 | 752 | |
753 | 753 | /** |
754 | - * Log what we did |
|
755 | - */ |
|
754 | + * Log what we did |
|
755 | + */ |
|
756 | 756 | switch ($log_action) |
757 | 757 | { |
758 | 758 | case 'MOVE_IMAGES_MOVE_ALBUMS': |
@@ -842,14 +842,14 @@ discard block |
||
842 | 842 | $this->gallery_notification->delete_albums($from_id); |
843 | 843 | |
844 | 844 | /** |
845 | - * Event related to moving album content |
|
846 | - * |
|
847 | - * @event phpbbgallery.core.album.manage.move_album_content |
|
848 | - * @var int from_id Album we are moving from |
|
849 | - * @var int to_id Album we are moving to |
|
850 | - * @var bool sync Should we sync the albums data |
|
851 | - * @since 1.2.0 |
|
852 | - */ |
|
845 | + * Event related to moving album content |
|
846 | + * |
|
847 | + * @event phpbbgallery.core.album.manage.move_album_content |
|
848 | + * @var int from_id Album we are moving from |
|
849 | + * @var int to_id Album we are moving to |
|
850 | + * @var bool sync Should we sync the albums data |
|
851 | + * @since 1.2.0 |
|
852 | + */ |
|
853 | 853 | $vars = array('from_id', 'to_id', 'sync'); |
854 | 854 | extract($this->dispatcher->trigger_event('phpbbgallery.core.album.manage.move_album_content', compact($vars))); |
855 | 855 | |
@@ -951,12 +951,12 @@ discard block |
||
951 | 951 | $this->gallery_config->set('num_comments', $row['num_comments']); |
952 | 952 | |
953 | 953 | /** |
954 | - * Event delete album content |
|
955 | - * |
|
956 | - * @event phpbbgallery.core.album.manage.delete_album_content |
|
957 | - * @var int album_id Album we are deleting |
|
958 | - * @since 1.2.0 |
|
959 | - */ |
|
954 | + * Event delete album content |
|
955 | + * |
|
956 | + * @event phpbbgallery.core.album.manage.delete_album_content |
|
957 | + * @var int album_id Album we are deleting |
|
958 | + * @since 1.2.0 |
|
959 | + */ |
|
960 | 960 | $vars = array('album_id'); |
961 | 961 | extract($this->dispatcher->trigger_event('phpbbgallery.core.album.manage.delete_album_content', compact($vars))); |
962 | 962 | |
@@ -979,11 +979,11 @@ discard block |
||
979 | 979 | public function move_album_by($album_row, $action = 'move_up', $steps = 1) |
980 | 980 | { |
981 | 981 | /** |
982 | - * Fetch all the siblings between the module's current spot |
|
983 | - * and where we want to move it to. If there are less than $steps |
|
984 | - * siblings between the current spot and the target then the |
|
985 | - * module will move as far as possible |
|
986 | - */ |
|
982 | + * Fetch all the siblings between the module's current spot |
|
983 | + * and where we want to move it to. If there are less than $steps |
|
984 | + * siblings between the current spot and the target then the |
|
985 | + * module will move as far as possible |
|
986 | + */ |
|
987 | 987 | $sql = 'SELECT album_id, album_name, left_id, right_id |
988 | 988 | FROM ' . $this->albums_table . ' |
989 | 989 | WHERE parent_id = ' . (int) $album_row['parent_id'] . ' |
@@ -1005,12 +1005,12 @@ discard block |
||
1005 | 1005 | } |
1006 | 1006 | |
1007 | 1007 | /** |
1008 | - * $left_id and $right_id define the scope of the nodes that are affected by the move. |
|
1009 | - * $diff_up and $diff_down are the values to substract or add to each node's left_id |
|
1010 | - * and right_id in order to move them up or down. |
|
1011 | - * $move_up_left and $move_up_right define the scope of the nodes that are moving |
|
1012 | - * up. Other nodes in the scope of ($left_id, $right_id) are considered to move down. |
|
1013 | - */ |
|
1008 | + * $left_id and $right_id define the scope of the nodes that are affected by the move. |
|
1009 | + * $diff_up and $diff_down are the values to substract or add to each node's left_id |
|
1010 | + * and right_id in order to move them up or down. |
|
1011 | + * $move_up_left and $move_up_right define the scope of the nodes that are moving |
|
1012 | + * up. Other nodes in the scope of ($left_id, $right_id) are considered to move down. |
|
1013 | + */ |
|
1014 | 1014 | if ($action == 'move_up') |
1015 | 1015 | { |
1016 | 1016 | $left_id = $target['left_id']; |
@@ -213,9 +213,9 @@ |
||
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
216 | - * Get all recent images the user has access to |
|
217 | - * return (int) $images_count |
|
218 | - */ |
|
216 | + * Get all recent images the user has access to |
|
217 | + * return (int) $images_count |
|
218 | + */ |
|
219 | 219 | public function recent_count() |
220 | 220 | { |
221 | 221 | $this->gallery_auth->load_user_premissions($this->user->data['user_id']); |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
106 | - * Load the users data from the database and cast it... |
|
107 | - */ |
|
106 | + * Load the users data from the database and cast it... |
|
107 | + */ |
|
108 | 108 | public function load_data() |
109 | 109 | { |
110 | 110 | $this->entry_exists = false; |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
137 | - * Some functions need the data to be loaded or at least checked. |
|
138 | - * So here we loaded if it is not laoded yet and we need it ;) |
|
139 | - */ |
|
137 | + * Some functions need the data to be loaded or at least checked. |
|
138 | + * So here we loaded if it is not laoded yet and we need it ;) |
|
139 | + */ |
|
140 | 140 | public function force_load() |
141 | 141 | { |
142 | 142 | if (is_null($this->entry_exists)) |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
149 | - * Get user-setting, if the user does not have his own settings we fall back to default. |
|
150 | - * |
|
151 | - * @param string $key Column name from the users-table |
|
152 | - * @param bool $default Load default value, if user has no entry |
|
153 | - * @return mixed Returns the value of the column, it it does not exist it returns false. |
|
154 | - */ |
|
149 | + * Get user-setting, if the user does not have his own settings we fall back to default. |
|
150 | + * |
|
151 | + * @param string $key Column name from the users-table |
|
152 | + * @param bool $default Load default value, if user has no entry |
|
153 | + * @return mixed Returns the value of the column, it it does not exist it returns false. |
|
154 | + */ |
|
155 | 155 | public function get_data($key, $default = true) |
156 | 156 | { |
157 | 157 | if (isset($this->data[$key])) |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
220 | - * Updates the users table with the new data. |
|
221 | - * |
|
222 | - * @param array $data Array of data we want to add/update. |
|
223 | - * @return bool Returns true if the columns were updated successfully |
|
224 | - */ |
|
220 | + * Updates the users table with the new data. |
|
221 | + * |
|
222 | + * @param array $data Array of data we want to add/update. |
|
223 | + * @return bool Returns true if the columns were updated successfully |
|
224 | + */ |
|
225 | 225 | private function update($data) |
226 | 226 | { |
227 | 227 | $sql_ary = array_merge($this->validate_data($data), array( |
@@ -240,11 +240,11 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
243 | - * Updates the users table by increasing the values. |
|
244 | - * |
|
245 | - * @param int $num Number of images to add to the counter |
|
246 | - * @return bool Returns true if the columns were updated successfully, else false |
|
247 | - */ |
|
243 | + * Updates the users table by increasing the values. |
|
244 | + * |
|
245 | + * @param int $num Number of images to add to the counter |
|
246 | + * @return bool Returns true if the columns were updated successfully, else false |
|
247 | + */ |
|
248 | 248 | protected function update_image_count($num) |
249 | 249 | { |
250 | 250 | $sql = 'UPDATE ' . $this->gallery_users_table . ' |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
270 | - * Updates the users table with the new data. |
|
271 | - * |
|
272 | - * @param array $data Array of data we want to insert |
|
273 | - * @return bool Returns true if the data was inserted successfully |
|
274 | - */ |
|
270 | + * Updates the users table with the new data. |
|
271 | + * |
|
272 | + * @param array $data Array of data we want to insert |
|
273 | + * @return bool Returns true if the data was inserted successfully |
|
274 | + */ |
|
275 | 275 | private function insert($data) |
276 | 276 | { |
277 | 277 | $sql_ary = array_merge(self::get_default_values(), $this->validate_data($data), array( |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
298 | - * Delete the user from the table. |
|
299 | - */ |
|
298 | + * Delete the user from the table. |
|
299 | + */ |
|
300 | 300 | public function delete() |
301 | 301 | { |
302 | 302 | $sql = 'DELETE FROM ' . $this->gallery_users_table . ' |
@@ -305,10 +305,10 @@ discard block |
||
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
308 | - * Delete the user from the table. |
|
309 | - * |
|
310 | - * @param mixed $user_ids Can either be an array of IDs, one ID or the string 'all' to delete all users. |
|
311 | - */ |
|
308 | + * Delete the user from the table. |
|
309 | + * |
|
310 | + * @param mixed $user_ids Can either be an array of IDs, one ID or the string 'all' to delete all users. |
|
311 | + */ |
|
312 | 312 | public function delete_users($user_ids) |
313 | 313 | { |
314 | 314 | |
@@ -320,12 +320,12 @@ discard block |
||
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
323 | - * Updates the users table with new data. |
|
324 | - * |
|
325 | - * @param mixed $user_ids Can either be an array of IDs, one ID or the string 'all' to update all users. |
|
326 | - * @param array $data Array of data we want to add/update. |
|
327 | - * @return bool Returns true if the columns were updated successfully |
|
328 | - */ |
|
323 | + * Updates the users table with new data. |
|
324 | + * |
|
325 | + * @param mixed $user_ids Can either be an array of IDs, one ID or the string 'all' to update all users. |
|
326 | + * @param array $data Array of data we want to add/update. |
|
327 | + * @return bool Returns true if the columns were updated successfully |
|
328 | + */ |
|
329 | 329 | public function update_users($user_ids, $data) |
330 | 330 | { |
331 | 331 | $sql_ary = array_merge($this->validate_data($data), array( |
@@ -344,11 +344,11 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
347 | - * Builds a valid WHERE-sql-statement, with casted integers, or empty to allow handling all users. |
|
348 | - * |
|
349 | - * @param mixed $user_ids Can either be an array of IDs, one ID or the string 'all' to update all users. |
|
350 | - * @return string The WHERE statement with "WHERE " if needed. |
|
351 | - */ |
|
347 | + * Builds a valid WHERE-sql-statement, with casted integers, or empty to allow handling all users. |
|
348 | + * |
|
349 | + * @param mixed $user_ids Can either be an array of IDs, one ID or the string 'all' to update all users. |
|
350 | + * @return string The WHERE statement with "WHERE " if needed. |
|
351 | + */ |
|
352 | 352 | public function sql_build_where($user_ids) |
353 | 353 | { |
354 | 354 | if (is_array($user_ids) && !empty($user_ids)) |
@@ -368,12 +368,12 @@ discard block |
||
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
371 | - * Validate user data. |
|
372 | - * |
|
373 | - * @param array $data Array of data we need to validate |
|
374 | - * @param bool $inc Are we incrementing the value |
|
375 | - * @return array Array with all allowed keys and their casted and selected values |
|
376 | - */ |
|
371 | + * Validate user data. |
|
372 | + * |
|
373 | + * @param array $data Array of data we need to validate |
|
374 | + * @param bool $inc Are we incrementing the value |
|
375 | + * @return array Array with all allowed keys and their casted and selected values |
|
376 | + */ |
|
377 | 377 | public function validate_data($data, $inc = false) |
378 | 378 | { |
379 | 379 | $validated_data = array(); |
@@ -412,14 +412,14 @@ discard block |
||
412 | 412 | $is_validated = false; |
413 | 413 | |
414 | 414 | /** |
415 | - * Event user validat data |
|
416 | - * |
|
417 | - * @event phpbbgallery.core.user.validate_data |
|
418 | - * @var bool is_validated is value validated |
|
419 | - * @var string name value name |
|
420 | - * @var mixed value value of the value |
|
421 | - * @since 1.2.0 |
|
422 | - */ |
|
415 | + * Event user validat data |
|
416 | + * |
|
417 | + * @event phpbbgallery.core.user.validate_data |
|
418 | + * @var bool is_validated is value validated |
|
419 | + * @var string name value name |
|
420 | + * @var mixed value value of the value |
|
421 | + * @since 1.2.0 |
|
422 | + */ |
|
423 | 423 | $vars = array('is_validated', 'name', 'value'); |
424 | 424 | extract($this->dispatcher->trigger_event('phpbbgallery.core.user.validate_data', compact($vars))); |
425 | 425 | |
@@ -457,12 +457,12 @@ discard block |
||
457 | 457 | $default_values = self::$default_values; |
458 | 458 | |
459 | 459 | /** |
460 | - * Event user validat data |
|
461 | - * |
|
462 | - * @event phpbbgallery.core.user.get_default_values |
|
463 | - * @var array default_values the default values array |
|
464 | - * @since 1.2.0 |
|
465 | - */ |
|
460 | + * Event user validat data |
|
461 | + * |
|
462 | + * @event phpbbgallery.core.user.get_default_values |
|
463 | + * @var array default_values the default values array |
|
464 | + * @since 1.2.0 |
|
465 | + */ |
|
466 | 466 | $vars = array('default_values'); |
467 | 467 | extract($this->dispatcher->trigger_event('phpbbgallery.core.user.get_default_values', compact($vars))); |
468 | 468 | |
@@ -470,8 +470,8 @@ discard block |
||
470 | 470 | } |
471 | 471 | |
472 | 472 | /** |
473 | - * Default values for new users. |
|
474 | - */ |
|
473 | + * Default values for new users. |
|
474 | + */ |
|
475 | 475 | static protected $default_values = array( |
476 | 476 | 'user_images' => 0, |
477 | 477 | 'personal_album_id' => 0, |
@@ -505,111 +505,111 @@ discard block |
||
505 | 505 | include($this->root_path . 'includes/functions_display.' . $this->php_ext); |
506 | 506 | } |
507 | 507 | |
508 | - $now = $this->user->create_datetime(); |
|
509 | - $now = phpbb_gmgetdate($now->getTimestamp() + $now->getOffset()); |
|
510 | - |
|
511 | - // Cache various user specific data ... so we don't have to recompute |
|
512 | - // this each time the same user appears on this page |
|
513 | - if (!isset($user_cache[$user_id])) { |
|
514 | - if ($user_id == ANONYMOUS) { |
|
515 | - $user_cache_data = array( |
|
516 | - 'user_type' => USER_IGNORE, |
|
517 | - 'joined' => '', |
|
518 | - 'posts' => '', |
|
519 | - 'sig' => '', |
|
520 | - 'sig_bbcode_uid' => '', |
|
521 | - 'sig_bbcode_bitfield' => '', |
|
522 | - 'online' => false, |
|
523 | - 'avatar' => ($this->user->optionget('viewavatars')) ? phpbb_get_user_avatar($row) : '', |
|
524 | - 'rank_title' => '', |
|
525 | - 'rank_image' => '', |
|
526 | - 'rank_image_src' => '', |
|
527 | - 'pm' => '', |
|
528 | - 'email' => '', |
|
529 | - 'jabber' => '', |
|
530 | - 'search' => '', |
|
531 | - 'age' => '', |
|
532 | - 'username' => $row['username'], |
|
533 | - 'user_colour' => $row['user_colour'], |
|
534 | - 'contact_user' => '', |
|
535 | - 'warnings' => 0, |
|
536 | - 'allow_pm' => 0, |
|
537 | - ); |
|
538 | - } else { |
|
539 | - $user_sig = ''; |
|
540 | - // We add the signature to every posters entry because enable_sig is post dependent |
|
541 | - if ($row['user_sig'] && $this->config['allow_sig'] && $this->user->optionget('viewsigs')) { |
|
542 | - $user_sig = $row['user_sig']; |
|
543 | - } |
|
544 | - $user_cache_data = array( |
|
545 | - 'user_type' => $row['user_type'], |
|
546 | - 'user_inactive_reason' => $row['user_inactive_reason'], |
|
547 | - 'joined' => $this->user->format_date($row['user_regdate']), |
|
548 | - 'posts' => $row['user_posts'], |
|
549 | - 'warnings' => (isset($row['user_warnings'])) ? $row['user_warnings'] : 0, |
|
550 | - 'sig' => $user_sig, |
|
551 | - 'sig_bbcode_uid' => (!empty($row['user_sig_bbcode_uid'])) ? $row['user_sig_bbcode_uid'] : '', |
|
552 | - 'sig_bbcode_bitfield' => (!empty($row['user_sig_bbcode_bitfield'])) ? $row['user_sig_bbcode_bitfield'] : '', |
|
553 | - 'viewonline' => $row['user_allow_viewonline'], |
|
554 | - 'allow_pm' => $row['user_allow_pm'], |
|
555 | - 'avatar' => ($this->user->optionget('viewavatars')) ? phpbb_get_user_avatar($row) : '', |
|
556 | - 'age' => '', |
|
557 | - 'rank_title' => '', |
|
558 | - 'rank_image' => '', |
|
559 | - 'rank_image_src' => '', |
|
560 | - 'username' => $row['username'], |
|
561 | - 'user_colour' => $row['user_colour'], |
|
562 | - 'contact_user' => $this->user->lang('CONTACT_USER', get_username_string('username', $user_id, $row['username'], $row['user_colour'], $row['username'])), |
|
563 | - 'online' => false, |
|
564 | - 'jabber' => ($this->config['jab_enable'] && $row['user_jabber'] && $this->auth->acl_get('u_sendim')) ? append_sid("{$this->root_path}memberlist.$this->php_ext", "mode=contact&action=jabber&u=$user_id") : '', |
|
565 | - 'search' => ($this->config['load_search'] && $this->auth->acl_get('u_search')) ? append_sid("{$this->root_path}search.$this->php_ext", "author_id=$user_id&sr=posts") : '', |
|
566 | - 'author_full' => get_username_string('full', $user_id, $row['username'], $row['user_colour']), |
|
567 | - 'author_colour' => get_username_string('colour', $user_id, $row['username'], $row['user_colour']), |
|
568 | - 'author_username' => get_username_string('username', $user_id, $row['username'], $row['user_colour']), |
|
569 | - 'author_profile' => get_username_string('profile', $user_id, $row['username'], $row['user_colour']), |
|
570 | - ); |
|
571 | - |
|
572 | - $user_cache[$user_id] = $user_cache_data; |
|
573 | - |
|
574 | - $user_rank_data = phpbb_get_user_rank($row, $row['user_posts']); |
|
575 | - $user_cache[$user_id]['rank_title'] = $user_rank_data['title']; |
|
576 | - $user_cache[$user_id]['rank_image'] = $user_rank_data['img']; |
|
577 | - $user_cache[$user_id]['rank_image_src'] = $user_rank_data['img_src']; |
|
578 | - |
|
579 | - if ((!empty($row['user_allow_viewemail']) && $this->auth->acl_get('u_sendemail')) || $this->auth->acl_get('a_email')) |
|
580 | - { |
|
581 | - $user_cache[$user_id]['email'] = ($this->config['board_email_form'] && $this->config['email_enable']) ? append_sid("{$this->root_path}memberlist.$this->php_ext", "mode=email&u=$user_id") : (($this->config['board_hide_emails'] && !$this->auth->acl_get('a_email')) ? '' : 'mailto:' . $row['user_email']); |
|
582 | - } |
|
583 | - else |
|
584 | - { |
|
585 | - $user_cache[$user_id]['email'] = ''; |
|
586 | - } |
|
587 | - if ($this->config['allow_birthdays'] && !empty($row['user_birthday'])) |
|
588 | - { |
|
589 | - list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $row['user_birthday'])); |
|
590 | - if ($bday_year) |
|
591 | - { |
|
592 | - $diff = $now['mon'] - $bday_month; |
|
593 | - if ($diff == 0) |
|
594 | - { |
|
595 | - $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0; |
|
596 | - } |
|
597 | - else |
|
598 | - { |
|
599 | - $diff = ($diff < 0) ? 1 : 0; |
|
600 | - } |
|
601 | - $user_cache[$user_id]['age'] = (int) ($now['year'] - $bday_year - $diff); |
|
602 | - } |
|
603 | - } |
|
604 | - } |
|
605 | - } |
|
508 | + $now = $this->user->create_datetime(); |
|
509 | + $now = phpbb_gmgetdate($now->getTimestamp() + $now->getOffset()); |
|
510 | + |
|
511 | + // Cache various user specific data ... so we don't have to recompute |
|
512 | + // this each time the same user appears on this page |
|
513 | + if (!isset($user_cache[$user_id])) { |
|
514 | + if ($user_id == ANONYMOUS) { |
|
515 | + $user_cache_data = array( |
|
516 | + 'user_type' => USER_IGNORE, |
|
517 | + 'joined' => '', |
|
518 | + 'posts' => '', |
|
519 | + 'sig' => '', |
|
520 | + 'sig_bbcode_uid' => '', |
|
521 | + 'sig_bbcode_bitfield' => '', |
|
522 | + 'online' => false, |
|
523 | + 'avatar' => ($this->user->optionget('viewavatars')) ? phpbb_get_user_avatar($row) : '', |
|
524 | + 'rank_title' => '', |
|
525 | + 'rank_image' => '', |
|
526 | + 'rank_image_src' => '', |
|
527 | + 'pm' => '', |
|
528 | + 'email' => '', |
|
529 | + 'jabber' => '', |
|
530 | + 'search' => '', |
|
531 | + 'age' => '', |
|
532 | + 'username' => $row['username'], |
|
533 | + 'user_colour' => $row['user_colour'], |
|
534 | + 'contact_user' => '', |
|
535 | + 'warnings' => 0, |
|
536 | + 'allow_pm' => 0, |
|
537 | + ); |
|
538 | + } else { |
|
539 | + $user_sig = ''; |
|
540 | + // We add the signature to every posters entry because enable_sig is post dependent |
|
541 | + if ($row['user_sig'] && $this->config['allow_sig'] && $this->user->optionget('viewsigs')) { |
|
542 | + $user_sig = $row['user_sig']; |
|
543 | + } |
|
544 | + $user_cache_data = array( |
|
545 | + 'user_type' => $row['user_type'], |
|
546 | + 'user_inactive_reason' => $row['user_inactive_reason'], |
|
547 | + 'joined' => $this->user->format_date($row['user_regdate']), |
|
548 | + 'posts' => $row['user_posts'], |
|
549 | + 'warnings' => (isset($row['user_warnings'])) ? $row['user_warnings'] : 0, |
|
550 | + 'sig' => $user_sig, |
|
551 | + 'sig_bbcode_uid' => (!empty($row['user_sig_bbcode_uid'])) ? $row['user_sig_bbcode_uid'] : '', |
|
552 | + 'sig_bbcode_bitfield' => (!empty($row['user_sig_bbcode_bitfield'])) ? $row['user_sig_bbcode_bitfield'] : '', |
|
553 | + 'viewonline' => $row['user_allow_viewonline'], |
|
554 | + 'allow_pm' => $row['user_allow_pm'], |
|
555 | + 'avatar' => ($this->user->optionget('viewavatars')) ? phpbb_get_user_avatar($row) : '', |
|
556 | + 'age' => '', |
|
557 | + 'rank_title' => '', |
|
558 | + 'rank_image' => '', |
|
559 | + 'rank_image_src' => '', |
|
560 | + 'username' => $row['username'], |
|
561 | + 'user_colour' => $row['user_colour'], |
|
562 | + 'contact_user' => $this->user->lang('CONTACT_USER', get_username_string('username', $user_id, $row['username'], $row['user_colour'], $row['username'])), |
|
563 | + 'online' => false, |
|
564 | + 'jabber' => ($this->config['jab_enable'] && $row['user_jabber'] && $this->auth->acl_get('u_sendim')) ? append_sid("{$this->root_path}memberlist.$this->php_ext", "mode=contact&action=jabber&u=$user_id") : '', |
|
565 | + 'search' => ($this->config['load_search'] && $this->auth->acl_get('u_search')) ? append_sid("{$this->root_path}search.$this->php_ext", "author_id=$user_id&sr=posts") : '', |
|
566 | + 'author_full' => get_username_string('full', $user_id, $row['username'], $row['user_colour']), |
|
567 | + 'author_colour' => get_username_string('colour', $user_id, $row['username'], $row['user_colour']), |
|
568 | + 'author_username' => get_username_string('username', $user_id, $row['username'], $row['user_colour']), |
|
569 | + 'author_profile' => get_username_string('profile', $user_id, $row['username'], $row['user_colour']), |
|
570 | + ); |
|
571 | + |
|
572 | + $user_cache[$user_id] = $user_cache_data; |
|
573 | + |
|
574 | + $user_rank_data = phpbb_get_user_rank($row, $row['user_posts']); |
|
575 | + $user_cache[$user_id]['rank_title'] = $user_rank_data['title']; |
|
576 | + $user_cache[$user_id]['rank_image'] = $user_rank_data['img']; |
|
577 | + $user_cache[$user_id]['rank_image_src'] = $user_rank_data['img_src']; |
|
578 | + |
|
579 | + if ((!empty($row['user_allow_viewemail']) && $this->auth->acl_get('u_sendemail')) || $this->auth->acl_get('a_email')) |
|
580 | + { |
|
581 | + $user_cache[$user_id]['email'] = ($this->config['board_email_form'] && $this->config['email_enable']) ? append_sid("{$this->root_path}memberlist.$this->php_ext", "mode=email&u=$user_id") : (($this->config['board_hide_emails'] && !$this->auth->acl_get('a_email')) ? '' : 'mailto:' . $row['user_email']); |
|
582 | + } |
|
583 | + else |
|
584 | + { |
|
585 | + $user_cache[$user_id]['email'] = ''; |
|
586 | + } |
|
587 | + if ($this->config['allow_birthdays'] && !empty($row['user_birthday'])) |
|
588 | + { |
|
589 | + list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $row['user_birthday'])); |
|
590 | + if ($bday_year) |
|
591 | + { |
|
592 | + $diff = $now['mon'] - $bday_month; |
|
593 | + if ($diff == 0) |
|
594 | + { |
|
595 | + $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0; |
|
596 | + } |
|
597 | + else |
|
598 | + { |
|
599 | + $diff = ($diff < 0) ? 1 : 0; |
|
600 | + } |
|
601 | + $user_cache[$user_id]['age'] = (int) ($now['year'] - $bday_year - $diff); |
|
602 | + } |
|
603 | + } |
|
604 | + } |
|
605 | + } |
|
606 | 606 | } |
607 | 607 | |
608 | 608 | /** |
609 | - * Get user personal album |
|
610 | - * Checks and returns users personal album |
|
611 | - * returns (int) $album_id or 0 |
|
612 | - */ |
|
609 | + * Get user personal album |
|
610 | + * Checks and returns users personal album |
|
611 | + * returns (int) $album_id or 0 |
|
612 | + */ |
|
613 | 613 | public function get_own_root_album() |
614 | 614 | { |
615 | 615 | $sql = 'SELECT personal_album_id FROM ' . $this->gallery_users_table . ' WHERE user_id = ' . (int) $this->user_id; |
@@ -619,8 +619,8 @@ discard block |
||
619 | 619 | } |
620 | 620 | |
621 | 621 | /** |
622 | - * Destroy user data and set this class to empty |
|
623 | - */ |
|
622 | + * Destroy user data and set this class to empty |
|
623 | + */ |
|
624 | 624 | public function destroy() |
625 | 625 | { |
626 | 626 | $this->user_id = null; |