Пример #1
0
 protected function set_personal_settings()
 {
     if ($this->request->is_set_post('submit')) {
         $gallery_settings = array('watch_own' => $this->request->variable('watch_own', false), 'watch_com' => $this->request->variable('watch_com', false), 'user_allow_comments' => $this->request->variable('allow_comments', false));
         $additional_settings = array();
         /**
          * Event set personal settings
          *
          * @event phpbbgallery.core.ucp.set_settings_submit
          * @var	array	additional_settings		array of additional settings
          * @since 1.2.0
          */
         $vars = array('additional_settings');
         extract($this->dispatcher->trigger_event('phpbbgallery.core.ucp.set_settings_submit', compact($vars)));
         $gallery_settings = array_merge($gallery_settings, $additional_settings);
         if (!$this->config['phpbb_gallery_allow_comments'] || !$this->config['phpbb_gallery_comment_user_control']) {
             unset($gallery_settings['user_allow_comments']);
         }
         $this->gallery_user->set_user_id($this->user->data['user_id']);
         $this->gallery_user->update_data($gallery_settings);
         meta_refresh(3, $this->u_action);
         trigger_error($this->user->lang['WATCH_CHANGED'] . '<br /><br />' . sprintf($this->user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'));
     }
     /**
      * Event no submit personal settings
      *
      * @event phpbbgallery.core.ucp.set_settings_nosubmit
      * @since 1.2.0
      */
     $this->dispatcher->dispatch('phpbbgallery.core.ucp.set_settings_nosubmit');
     $this->template->assign_vars(array('S_PERSONAL_SETTINGS' => true, 'S_UCP_ACTION' => $this->u_action, 'L_TITLE' => $this->user->lang['UCP_GALLERY_SETTINGS'], 'L_TITLE_EXPLAIN' => $this->user->lang['WATCH_NOTE'], 'S_WATCH_OWN' => $this->gallery_user->get_data('watch_own'), 'S_WATCH_COM' => $this->gallery_user->get_data('watch_com'), 'S_ALLOW_COMMENTS' => $this->gallery_user->get_data('user_allow_comments'), 'S_COMMENTS_ENABLED' => $this->config['phpbb_gallery_allow_comments'] && $this->config['phpbb_gallery_comment_user_control']));
 }
Пример #2
0
 /**
  * Get albums by permission
  *
  * @param	string	$acl			One of the permissions, Exp: i_view; *_count permissions are not allowed!
  * @param	string	$return			Type of the return value. array returns an array, else it's a string.
  *									bool means it only checks whether the user has the permission anywhere.
  * @param	bool	$display_in_rrc	Only return albums, that have the display_in_rrc-flag set.
  * @param	bool	$display_pegas	Include personal galleries in the list.
  *
  * @return	mixed					$album_ids, either as list or array.
  */
 public function acl_album_ids($acl, $return = 'array', $display_in_rrc = false, $display_pegas = true)
 {
     $bit = self::$_permissions_flipped[$acl];
     if (!is_int($bit)) {
         // No support for *_count permissions.
         return $return == 'array' ? array() : '';
     }
     $album_list = '';
     $album_array = array();
     $albums = $this->cache->get_albums();
     foreach ($albums as $album) {
         if ($this->user->is_user($album['album_user_id'])) {
             $a_id = self::OWN_ALBUM;
         } else {
             if ($album['album_user_id'] > self::PUBLIC_ALBUM) {
                 $a_id = self::PERSONAL_ALBUM;
             } else {
                 $a_id = $album['album_id'];
             }
         }
         if ($this->_auth_data[$a_id]->get_bit($bit) && (!$display_in_rrc || $display_in_rrc && $album['display_in_rrc']) && ($display_pegas || $album['album_user_id'] == self::PUBLIC_ALBUM)) {
             if ($return == 'bool') {
                 return true;
             }
             $album_list .= ($album_list ? ', ' : '') . $album['album_id'];
             $album_array[] = (int) $album['album_id'];
         }
     }
     if ($return == 'bool') {
         return false;
     }
     return $return == 'array' ? $album_array : $album_list;
 }
Пример #3
0
    /**
     * Image Controller
     *	Route: gallery/image_id/{image_id}
     *
     * @param int	$image_id	Image ID
     * @return Symfony\Component\HttpFoundation\Response A Symfony Response object
     */
    public function base($image_id, $page = 0)
    {
        $this->user->add_lang_ext('phpbbgallery/core', array('gallery'));
        try {
            $sql = 'SELECT *
			FROM ' . $this->table_images . '
			WHERE image_id = ' . (int) $image_id;
            $result = $this->db->sql_query($sql);
            $this->data = $this->db->sql_fetchrow($result);
            $this->db->sql_freeresult($result);
            if (!$this->data) {
                // Image does not exist
                throw new \OutOfBoundsException('INVALID_IMAGE');
            }
            $this->loader->load($this->data['image_album_id']);
        } catch (\Exception $e) {
            return $this->error($e->getMessage(), 404);
        }
        $album_id = (int) $this->data['image_album_id'];
        $album_data = $this->loader->get($album_id);
        $this->check_permissions($album_id, $album_data['album_user_id'], $this->data['image_status'], $album_data['album_auth_access']);
        $this->display->generate_navigation($album_data);
        if (!$this->user->data['is_bot'] && isset($this->user->data['session_page']) && (strpos($this->user->data['session_page'], '&image_id=' . $image_id) === false || isset($this->user->data['session_created']))) {
            $sql = 'UPDATE ' . $this->table_images . '
				SET image_view_count = image_view_count + 1
				WHERE image_id = ' . $image_id;
            $this->db->sql_query($sql);
        }
        // Do stuff here
        $page_title = $this->data['image_name'];
        if ($page > 1) {
            $page_title .= ' - ' . $this->user->lang('PAGE_TITLE_NUMBER', $page);
        }
        $s_allowed_delete = $s_allowed_edit = $s_allowed_status = false;
        if (($this->gallery_auth->acl_check('m_', $album_id, $album_data['album_user_id']) || $this->data['image_user_id'] == $this->user->data['user_id']) && $this->user->data['user_id'] != ANONYMOUS) {
            //$s_user_allowed = (($this->data['image_user_id'] == $this->user->data['user_id']) && ($album_data['album_status'] != phpbb_ext_gallery_core_album::STATUS_LOCKED));
            $s_user_allowed = $this->data['image_user_id'] == $this->user->data['user_id'] && $album_data['album_status'] != 1;
            $s_allowed_delete = $this->gallery_auth->acl_check('i_delete', $album_id, $album_data['album_user_id']) && $s_user_allowed || $this->gallery_auth->acl_check('m_delete', $album_id, $album_data['album_user_id']);
            $s_allowed_edit = $this->gallery_auth->acl_check('i_edit', $album_id, $album_data['album_user_id']) && $s_user_allowed || $this->gallery_auth->acl_check('m_edit', $album_id, $album_data['album_user_id']);
            $s_quick_mod = $s_allowed_delete || $s_allowed_edit || $this->gallery_auth->acl_check('m_status', $album_id, $album_data['album_user_id']) || $this->gallery_auth->acl_check('m_move', $album_id, $album_data['album_user_id']);
            $this->user->add_lang_ext('phpbbgallery/core', 'gallery_mcp');
            $this->template->assign_vars(array('S_MOD_ACTION' => $this->helper->route('phpbbgallery_moderate_image', array('image_id' => $image_id)), 'S_QUICK_MOD' => $s_quick_mod, 'S_QM_MOVE' => $this->gallery_auth->acl_check('m_move', $album_id, $album_data['album_user_id']), 'S_QM_EDIT' => $s_allowed_edit, 'S_QM_DELETE' => $s_allowed_delete, 'S_QM_REPORT' => $this->gallery_auth->acl_check('m_report', $album_id, $album_data['album_user_id']), 'S_QM_STATUS' => $this->gallery_auth->acl_check('m_status', $album_id, $album_data['album_user_id']), 'S_IMAGE_REPORTED' => $this->data['image_reported'] ? true : false, 'U_IMAGE_REPORTED' => $this->data['image_reported'] ? $this->helper->route('phpbbgallery_moderate_image', array('image_id' => $image_id)) : '', 'S_STATUS_APPROVED' => $this->data['image_status'] == \phpbbgallery\core\image\image::STATUS_APPROVED, 'S_STATUS_UNAPPROVED' => $this->data['image_status'] == \phpbbgallery\core\image\image::STATUS_UNAPPROVED, 'S_STATUS_LOCKED' => $this->data['image_status'] == \phpbbgallery\core\image\image::STATUS_LOCKED));
        }
        $image_desc = generate_text_for_display($this->data['image_desc'], $this->data['image_desc_uid'], $this->data['image_desc_bitfield'], 7);
        // Let's see if we can get next end prev
        $sort_key = $this->request->variable('sk', $album_data['album_sort_key'] ? $album_data['album_sort_key'] : $this->config['phpbb_gallery_default_sort_key']);
        $sort_dir = $this->request->variable('sd', $album_data['album_sort_dir'] ? $album_data['album_sort_dir'] : $this->config['phpbb_gallery_default_sort_dir']);
        if (in_array($sort_key, array('r', 'ra'))) {
            $sql_help_sort = ', image_id ' . ($sort_dir == 'd' ? 'ASC' : 'DESC');
        } else {
            $sql_help_sort = ', image_id ' . ($sort_dir == 'd' ? 'DESC' : 'ASC');
        }
        $limit_days = array();
        $sort_by_text = array('t' => $this->user->lang['TIME'], 'n' => $this->user->lang['IMAGE_NAME'], 'vc' => $this->user->lang['GALLERY_VIEWS'], 'u' => $this->user->lang['SORT_USERNAME']);
        $sort_by_sql = array('t' => 'image_time', 'n' => 'image_name_clean', 'vc' => 'image_view_count', 'u' => 'image_username_clean');
        if ($this->config['phpbb_gallery_allow_rates']) {
            $sort_by_text['ra'] = $this->user->lang['RATING'];
            $sort_by_sql['ra'] = 'image_rate_points';
            $sort_by_text['r'] = $this->user->lang['RATES_COUNT'];
            $sort_by_sql['r'] = 'image_rates';
        }
        if ($this->config['phpbb_gallery_allow_comments']) {
            $sort_by_text['c'] = $this->user->lang['COMMENTS'];
            $sort_by_sql['c'] = 'image_comments';
            $sort_by_text['lc'] = $this->user->lang['NEW_COMMENT'];
            $sort_by_sql['lc'] = 'image_last_comment';
        }
        gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
        $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . ($sort_dir == 'd' ? 'DESC' : 'ASC');
        $sql_sort_order .= $sql_help_sort;
        // Let's see if there is prieveus image
        $sql = 'SELECT *
			FROM ' . $this->table_images . '
			WHERE image_album_id = ' . (int) $album_id . "\n\t\t\t\tAND image_status <> 3\n\t\t\tORDER BY {$sql_sort_order}" . $sql_help_sort;
        $result = $this->db->sql_query($sql);
        $images_array = array();
        while ($row = $this->db->sql_fetchrow($result)) {
            $images_array[] = $row;
        }
        $cur = 0;
        foreach ($images_array as $id => $var) {
            if ($var['image_id'] == $image_id) {
                $cur = $id;
            }
        }
        $next = $prev = false;
        if (count($images_array) > $cur + 1) {
            $next = array('image_id' => $images_array[$cur + 1]['image_id'], 'image_name' => $images_array[$cur + 1]['image_name']);
        }
        if ($cur > 0) {
            $prev = array('image_id' => $images_array[$cur - 1]['image_id'], 'image_name' => $images_array[$cur - 1]['image_name']);
        }
        $this->db->sql_freeresult($result);
        $this->template->assign_vars(array('UC_NEXT_IMAGE' => $next ? $this->gallery_config->get('disp_nextprev_thumbnail') ? '<a href="' . $this->helper->route('phpbbgallery_image', array('image_id' => $next['image_id'])) . '"><img style="max-width: 70px; max-height: 70px;" src="' . $this->helper->route('phpbbgallery_image_file_mini', array('image_id' => $next['image_id'])) . '" alt="' . $next['image_name'] . '"></a>' : '<a href="' . $this->helper->route('phpbbgallery_image', array('image_id' => $next['image_id'])) . '">' . $next['image_name'] . ' &raquo;&raquo; </a>' : '', 'UC_PREV_IMAGE' => $prev ? $this->gallery_config->get('disp_nextprev_thumbnail') ? '<a href="' . $this->helper->route('phpbbgallery_image', array('image_id' => $prev['image_id'])) . '"><img style="max-width: 70px; max-height: 70px;" src="' . $this->helper->route('phpbbgallery_image_file_mini', array('image_id' => $prev['image_id'])) . '" alt="' . $prev['image_name'] . '"></a>' : '<a href="' . $this->helper->route('phpbbgallery_image', array('image_id' => $prev['image_id'])) . '">&laquo;&laquo; ' . $prev['image_name'] . '</a>' : '', 'U_VIEW_ALBUM' => $this->helper->route('phpbbgallery_album', array('album_id' => $album_id)), 'UC_IMAGE' => $this->helper->route('phpbbgallery_image_file_medium', array('image_id' => $image_id)), 'U_DELETE' => $s_allowed_delete ? $this->helper->route('phpbbgallery_image_delete', array('image_id' => $image_id)) : '', 'U_EDIT' => $s_allowed_edit ? $this->helper->route('phpbbgallery_image_edit', array('image_id' => $image_id)) : '', 'U_REPORT' => $this->gallery_auth->acl_check('i_report', $album_id, $album_data['album_user_id']) && $this->data['image_user_id'] != $this->user->data['user_id'] ? $this->helper->route('phpbbgallery_image_report', array('image_id' => $image_id)) : '', 'U_STATUS' => $s_allowed_status ? $this->helper->route('phpbbgallery_moderate_image', array('image_id' => $image_id)) : '', 'CONTEST_RANK' => $this->data['image_contest_rank'] ? $this->user->lang('CONTEST_RESULT_' . $this->data['image_contest_rank']) : '', 'IMAGE_NAME' => $this->data['image_name'], 'IMAGE_DESC' => $image_desc, 'IMAGE_BBCODE' => $this->config['allow_bbcode'] ? '[image]' . $image_id . '[/image]' : '', 'IMAGE_IMGURL_BBCODE' => $this->config['phpbb_gallery_disp_image_url'] ? '[url=' . $this->url->get_uri($this->helper->route('phpbbgallery_image', array('image_id' => $image_id))) . '][img]' . $this->url->get_uri($this->helper->route('phpbbgallery_image_file_mini', array('image_id' => $image_id))) . '[/img][/url]' : '', 'IMAGE_URL' => $this->config['phpbb_gallery_disp_image_url'] ? $this->url->get_uri($this->helper->route('phpbbgallery_image', array('image_id' => $image_id))) : '', 'IMAGE_TIME' => $this->user->format_date($this->data['image_time']), 'IMAGE_VIEW' => $this->data['image_view_count'], 'POSTER_IP' => $this->auth->acl_get('a_') ? $this->data['image_user_ip'] : '', 'U_POSTER_WHOIS' => $this->auth->acl_get('a_') ? append_sid('mcp', 'mode=whois&amp;ip=' . $this->data['image_user_ip']) : '', 'S_ALBUM_ACTION' => $this->helper->route('phpbbgallery_image', array('image_id' => $image_id)), 'U_RETURN_LINK' => $this->helper->route('phpbbgallery_album', array('album_id' => $album_id)), 'S_RETURN_LINK' => $this->user->lang('RETURN_TO', $album_data['album_name'])));
        switch ($this->gallery_config->get('link_imagepage')) {
            case 'image':
                $this->template->assign_vars(array('UC_IMAGE_ACTION' => $this->helper->route('phpbbgallery_image_file_source', array('image_id' => $image_id))));
                break;
            case 'next':
                if ($next) {
                    $this->template->assign_vars(array('UC_IMAGE_ACTION' => $this->helper->route('phpbbgallery_image', array('image_id' => $next['image_id']))));
                }
                break;
        }
        $image_data = $this->data;
        /**
         * Event view image
         *
         * @event phpbbgallery.core.viewimage
         * @var	int		image_id		id of the image we are viewing
         * @var	array	image_data		All the data related to the image
         * @var	array	album_data		All the data related to the album image is part of
         * @var	string	page_title		Page title
         * @since 1.2.0
         */
        $vars = array('image_id', 'image_data', 'album_data', 'page_title');
        extract($this->dispatcher->trigger_event('phpbbgallery.core.viewimage', compact($vars)));
        $this->data = $image_data;
        $user_id = $this->data['image_user_id'];
        $sql = $this->db->sql_build_query('SELECT', array('SELECT' => 'u.*, gu.personal_album_id, gu.user_images', 'FROM' => array(USERS_TABLE => 'u'), 'LEFT_JOIN' => array(array('FROM' => array($this->table_users => 'gu'), 'ON' => 'gu.user_id = u.user_id')), 'WHERE' => 'u.user_id = ' . $this->data['image_user_id']));
        $result = $this->db->sql_query($sql);
        $user_cache = array();
        while ($row = $this->db->sql_fetchrow($result)) {
            \phpbbgallery\core\user::add_user_to_cache($user_cache, $row);
        }
        $this->db->sql_freeresult($result);
        $user_cache[$user_id]['username'] = $this->data['image_username'] ? $this->data['image_username'] : $this->user->lang['GUEST'];
        $this->template->assign_vars(array('POSTER_FULL' => get_username_string('full', $user_id, $user_cache[$user_id]['username'], $user_cache[$user_id]['user_colour']), 'POSTER_COLOUR' => get_username_string('colour', $user_id, $user_cache[$user_id]['username'], $user_cache[$user_id]['user_colour']), 'POSTER_USERNAME' => get_username_string('username', $user_id, $user_cache[$user_id]['username'], $user_cache[$user_id]['user_colour']), 'U_POSTER' => get_username_string('profile', $user_id, $user_cache[$user_id]['username'], $user_cache[$user_id]['user_colour']), 'POSTER_SIGNATURE' => $user_cache[$user_id]['sig'], 'POSTER_RANK_TITLE' => $user_cache[$user_id]['rank_title'], 'POSTER_RANK_IMG' => $user_cache[$user_id]['rank_image'], 'POSTER_RANK_IMG_SRC' => $user_cache[$user_id]['rank_image_src'], 'POSTER_JOINED' => $user_cache[$user_id]['joined'], 'POSTER_POSTS' => $user_cache[$user_id]['posts'], 'POSTER_AVATAR' => $user_cache[$user_id]['avatar'], 'POSTER_WARNINGS' => $user_cache[$user_id]['warnings'], 'POSTER_AGE' => $user_cache[$user_id]['age'], 'POSTER_ONLINE_IMG' => $user_id == ANONYMOUS || !$this->config['load_onlinetrack'] ? '' : ($user_cache[$user_id]['online'] ? $this->user->img('icon_user_online', 'ONLINE') : $this->user->img('icon_user_offline', 'OFFLINE')), 'S_POSTER_ONLINE' => $user_id == ANONYMOUS || !$this->config['load_onlinetrack'] ? false : ($user_cache[$user_id]['online'] ? true : false), 'U_POSTER_PROFILE' => $user_cache[$user_id]['profile'], 'U_POSTER_SEARCH' => $user_cache[$user_id]['search'], 'U_POSTER_PM' => $user_id != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && ($user_cache[$user_id]['allow_pm'] || $this->auth->acl_gets('a_', 'm_')) ? append_sid('./ucp.php', 'i=pm&amp;mode=compose&amp;u=' . $user_id) : '', 'U_POSTER_EMAIL' => $this->auth->acl_gets('a_') || !$this->config['board_hide_emails'] ? $user_cache[$user_id]['email'] : false, 'U_POSTER_JABBER' => $user_cache[$user_id]['jabber'], 'U_POSTER_GALLERY' => $user_cache[$user_id]['gallery_album'], 'POSTER_GALLERY_IMAGES' => $user_cache[$user_id]['gallery_images'], 'U_POSTER_GALLERY_SEARCH' => $user_cache[$user_id]['gallery_search']));
        // Add ratings
        if ($this->gallery_config->get('allow_rates')) {
            $rating = new \phpbbgallery\core\rating($image_id, $image_data, $album_data);
            $user_rating = $rating->get_user_rating($this->user->data['user_id']);
            // Check: User didn't rate yet, has permissions, it's not the users own image and the user is logged in
            if (!$user_rating && $rating->is_allowed()) {
                $rating->display_box();
            }
            $this->template->assign_vars(array('IMAGE_RATING' => $rating->get_image_rating($user_rating), 'S_ALLOWED_TO_RATE' => !$user_rating && $rating->is_allowed(), 'S_VIEW_RATE' => $this->gallery_auth->acl_check('i_rate', $album_id, $album_data['album_user_id']) ? true : false, 'S_RATE_ACTION' => $this->helper->route('phpbbgallery_image_rate', array('image_id' => $image_id))));
            unset($rating);
        }
        /**
         * Posting comment
         */
        $comments_disabled = !$this->gallery_config->get('allow_comments') || $this->gallery_config->get('comment_user_control') && !$image_data['image_allow_comments'];
        if (!$comments_disabled && $this->gallery_auth->acl_check('c_post', $album_id, $album_data['album_user_id']) && $album_data['album_status'] != $this->album->get_status_locked() && ($image_data['image_status'] != $this->image->get_status_locked() || $this->gallery_auth->acl_check('m_status', $album_id, $album_data['album_user_id']))) {
            add_form_key('gallery');
            $this->user->add_lang('posting');
            $this->url->_include('functions_posting', 'phpbb');
            $bbcode_status = $this->config['allow_bbcode'] ? true : false;
            $smilies_status = $this->config['allow_smilies'] ? true : false;
            $img_status = $bbcode_status ? true : false;
            $url_status = $this->config['allow_post_links'] ? true : false;
            $flash_status = false;
            $quote_status = true;
            include_once $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
            // Build custom bbcodes array
            display_custom_bbcodes();
            // Build smilies array
            generate_smilies('inline', 0);
            //$s_hide_comment_input = (time() < ($album_data['contest_start'] + $album_data['contest_end'])) ? true : false;
            $s_hide_comment_input = false;
            $this->template->assign_vars(array('S_ALLOWED_TO_COMMENT' => true, 'S_HIDE_COMMENT_INPUT' => $s_hide_comment_input, 'BBCODE_STATUS' => $bbcode_status ? sprintf($this->user->lang['BBCODE_IS_ON'], '<a href="' . $this->url->append_sid('phpbb', 'faq', 'mode=bbcode') . '">', '</a>') : sprintf($this->user->lang['BBCODE_IS_OFF'], '<a href="' . $this->url->append_sid('phpbb', 'faq', 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $img_status ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $flash_status ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $smilies_status ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $bbcode_status && $url_status ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'S_SIGNATURE_CHECKED' => $this->user->optionget('attachsig') ? ' checked="checked"' : '', 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_SMILIES_ALLOWED' => $smilies_status, 'S_LINKS_ALLOWED' => $url_status, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_URL' => $url_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => $quote_status, 'L_COMMENT_LENGTH' => sprintf($this->user->lang['COMMENT_LENGTH'], $this->gallery_config->get('comment_length'))));
            if ($this->misc->display_captcha('comment')) {
                global $phpbb_container;
                $captcha = $phpbb_container->get('captcha.factory')->get_instance($this->config['captcha_plugin']);
                $captcha->init(CONFIRM_POST);
                $this->template->assign_vars(array('S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template()));
            }
            // Different link, when we rate and dont comment
            if (!$s_hide_comment_input) {
                //$this->template->assign_var('S_COMMENT_ACTION', append_sid($this->url->path('full') . 'comment/' . $image_id . '/add/0'));
                $this->template->assign_var('S_COMMENT_ACTION', $this->helper->route('phpbbgallery_comment_add', array('image_id' => $image_id, 'comment_id' => 0)));
            }
        } else {
            if ($this->gallery_config->get('comment_user_control') && !$image_data['image_allow_comments']) {
                $this->template->assign_var('S_COMMENTS_DISABLED', true);
            }
        }
        /**
         * Listing comment
         */
        if ($this->gallery_config->get('allow_comments') && $this->gallery_auth->acl_check('c_read', $album_id, $album_data['album_user_id'])) {
            $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'));
        }
        return $this->helper->render('gallery/viewimage_body.html', $page_title);
    }