Exemple #1
0
        $db->sql_freeresult($result);
        $init_block = true;
        for ($i = 0, $end = count($images); $i < $end; $i += phpbb_gallery_config::get('album_columns')) {
            if ($init_block) {
                $template->assign_block_vars('imageblock', array('BLOCK_NAME' => $album_data['album_name']));
                $init_block = false;
            }
            $template->assign_block_vars('imageblock.imagerow', array());
            for ($j = $i, $end_columns = $i + phpbb_gallery_config::get('album_columns'); $j < $end_columns; $j++) {
                if ($j >= $end) {
                    $template->assign_block_vars('imageblock.imagerow.no_image', array());
                    continue;
                }
                // Assign the image to the template-block
                $images[$j]['album_name'] = $album_data['album_name'];
                phpbb_gallery_image::assign_block('imageblock.imagerow.image', $images[$j], $album_data['album_status'], phpbb_gallery_config::get('album_display'), $album_data['album_user_id']);
            }
        }
    }
    // Is it a personal album, and does the user have permissions to create more?
    if ($album_data['album_user_id'] == $user->data['user_id']) {
        if (phpbb_gallery::$auth->acl_check('i_upload', phpbb_gallery_auth::OWN_ALBUM) && !phpbb_gallery::$auth->acl_check('album_unlimited', phpbb_gallery_auth::OWN_ALBUM)) {
            $sql = 'SELECT COUNT(album_id) albums
				FROM ' . GALLERY_ALBUMS_TABLE . '
				WHERE album_user_id = ' . $user->data['user_id'];
            $result = $db->sql_query($sql);
            $albums = (int) $db->sql_fetchfield('albums');
            $db->sql_freeresult($result);
            if ($albums < phpbb_gallery::$auth->acl_check('album_count', phpbb_gallery_auth::OWN_ALBUM)) {
                $allowed_create = true;
            }
             }
         }
     } else {
         for ($i = 0, $end = count($rowset); $i < $end; $i += $columns_per_page) {
             if ($init_block) {
                 $template->assign_block_vars('imageblock', array('U_BLOCK' => $u_search, 'BLOCK_NAME' => $l_search_title ? $l_search_title : $l_search_matches));
                 $init_block = false;
             }
             $template->assign_block_vars('imageblock.imagerow', array());
             for ($j = $i, $end_columns = $i + $columns_per_page; $j < $end_columns; $j++) {
                 if ($j >= $end) {
                     $template->assign_block_vars('imageblock.imagerow.noimage', array());
                     continue;
                 }
                 // Assign the image to the template-block
                 phpbb_gallery_image::assign_block('imageblock.imagerow.image', $rowset[$j], $rowset[$j]['album_status'], phpbb_gallery_config::get('search_display'), $rowset[$j]['album_user_id']);
             }
         }
     }
 } else {
     $sql_array = array('SELECT' => 'c.*, i.*', 'FROM' => array(GALLERY_COMMENTS_TABLE => 'c'), 'LEFT_JOIN' => array(array('FROM' => array(GALLERY_IMAGES_TABLE => 'i'), 'ON' => 'c.comment_image_id = i.image_id')), 'WHERE' => $sql_where, 'ORDER_BY' => $sql_order);
     $sql = $db->sql_build_query('SELECT', $sql_array);
     $result = $db->sql_query($sql);
     while ($commentrow = $db->sql_fetchrow($result)) {
         $image_id = $commentrow['image_id'];
         $album_id = $commentrow['image_album_id'];
         $template->assign_block_vars('commentrow', array('U_COMMENT' => phpbb_gallery_url::append_sid('image_page', "album_id={$album_id}&amp;image_id={$image_id}") . '#' . $commentrow['comment_id'], 'COMMENT_ID' => $commentrow['comment_id'], 'TIME' => $user->format_date($commentrow['comment_time']), 'TEXT' => generate_text_for_display($commentrow['comment'], $commentrow['comment_uid'], $commentrow['comment_bitfield'], 7), 'U_DELETE' => phpbb_gallery::$auth->acl_check('m_comments', $album_id) || phpbb_gallery::$auth->acl_check('c_delete', $album_id) && $commentrow['comment_user_id'] == $user->data['user_id'] && $user->data['is_registered'] ? phpbb_gallery_url::append_sid('posting', "album_id={$album_id}&amp;image_id={$image_id}&amp;mode=comment&amp;submode=delete&amp;comment_id=" . $commentrow['comment_id']) : '', 'U_EDIT' => phpbb_gallery::$auth->acl_check('m_comments', $album_id) || phpbb_gallery::$auth->acl_check('c_edit', $album_id) && $commentrow['comment_user_id'] == $user->data['user_id'] && $user->data['is_registered'] ? phpbb_gallery_url::append_sid('posting', "album_id={$album_id}&amp;image_id={$image_id}&amp;mode=comment&amp;submode=edit&amp;comment_id=" . $commentrow['comment_id']) : '', 'U_INFO' => $auth->acl_get('a_') ? phpbb_gallery_url::append_sid('mcp', 'mode=whois&amp;ip=' . $commentrow['comment_user_ip']) : '', 'UC_THUMBNAIL' => phpbb_gallery_image::generate_link('thumbnail', phpbb_gallery_config::get('link_thumbnail'), $commentrow['image_id'], $commentrow['image_name'], $commentrow['image_album_id']), 'UC_IMAGE_NAME' => phpbb_gallery_image::generate_link('image_name', phpbb_gallery_config::get('link_image_name'), $commentrow['image_id'], $commentrow['image_name'], $commentrow['image_album_id']), 'IMAGE_AUTHOR' => get_username_string('full', $commentrow['image_user_id'], $commentrow['image_username'], $commentrow['image_user_colour']), 'IMAGE_TIME' => $user->format_date($commentrow['image_time']), 'POST_AUTHOR_FULL' => get_username_string('full', $commentrow['comment_user_id'], $commentrow['comment_username'], $commentrow['comment_user_colour']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $commentrow['comment_user_id'], $commentrow['comment_username'], $commentrow['comment_user_colour']), 'POST_AUTHOR' => get_username_string('username', $commentrow['comment_user_id'], $commentrow['comment_username'], $commentrow['comment_user_colour']), 'U_POST_AUTHOR' => get_username_string('profile', $commentrow['comment_user_id'], $commentrow['comment_username'], $commentrow['comment_user_colour'])));
     }
     $db->sql_freeresult($result);
     $template->assign_vars(array('DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_COMMENT'), 'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_COMMENT'), 'INFO_IMG' => $user->img('icon_post_info', 'IP'), 'MINI_POST_IMG' => $user->img('icon_post_target_unread', 'COMMENT'), 'PROFILE_IMG' => $user->img('icon_user_profile', 'READ_PROFILE')));
 }
Exemple #3
0
 /**
  * Put the images into the template.
  */
 private function display_images()
 {
     global $template, $user;
     if (!empty($this->recent_images)) {
         $num = 0;
         $template->assign_block_vars($this->template_block_images, array('U_BLOCK' => phpbb_gallery_url::append_sid('search', 'search_id=recent'), 'BLOCK_NAME' => $user->lang['RECENT_IMAGES'], 'S_COL_WIDTH' => 100 / $this->num_columns . '%', 'S_COLS' => $this->num_columns));
         foreach ($this->recent_images as $image) {
             if ($num % $this->num_columns == 0) {
                 $template->assign_block_vars($this->template_block_images . '.imagerow', array());
             }
             phpbb_gallery_image::assign_block($this->template_block_images . '.imagerow.image', $this->images_data[$image], $this->images_data[$image]['album_status'], $this->get_display(), $this->images_data[$image]['album_user_id']);
             $num++;
         }
         while ($num % $this->num_columns > 0) {
             $template->assign_block_vars($this->template_block_images . '.imagerow.no_image', array());
             $num++;
         }
     }
     if (!empty($this->random_images)) {
         $num = 0;
         $template->assign_block_vars($this->template_block_images, array('U_BLOCK' => phpbb_gallery_url::append_sid('search', 'search_id=random'), 'BLOCK_NAME' => $user->lang['RANDOM_IMAGES'], 'S_COL_WIDTH' => 100 / $this->num_columns . '%', 'S_COLS' => $this->num_columns));
         foreach ($this->random_images as $image) {
             if ($num % $this->num_columns == 0) {
                 $template->assign_block_vars($this->template_block_images . '.imagerow', array());
             }
             phpbb_gallery_image::assign_block($this->template_block_images . '.imagerow.image', $this->images_data[$image], $this->images_data[$image]['album_status'], $this->get_display(), $this->images_data[$image]['album_user_id']);
             $num++;
         }
         while ($num % $this->num_columns > 0) {
             $template->assign_block_vars($this->template_block_images . '.imagerow.no_image', array());
             $num++;
         }
     }
     if (!empty($this->contest_images)) {
         foreach ($this->contest_images as $contest => $contest_data) {
             $num = 0;
             $template->assign_block_vars($this->template_block_images, array('U_BLOCK' => phpbb_gallery_url::append_sid('album', 'album_id=' . $contest_data['album_id'] . '&amp;sk=ra&amp;sd=d'), 'BLOCK_NAME' => sprintf($user->lang['CONTEST_WINNERS_OF'], $contest_data['album_name']), 'S_CONTEST_BLOCK' => true, 'S_COL_WIDTH' => '33%', 'S_COLS' => 3));
             foreach ($contest_data['images'] as $image) {
                 if ($num % phpbb_gallery_contest::NUM_IMAGES == 0) {
                     $template->assign_block_vars($this->template_block_images . '.imagerow', array());
                 }
                 if (!empty($this->images_data[$image])) {
                     phpbb_gallery_image::assign_block($this->template_block_images . '.imagerow.image', $this->images_data[$image], $this->images_data[$image]['album_status'], $this->get_display(), $this->images_data[$image]['album_user_id']);
                     $num++;
                 }
             }
             while ($num % phpbb_gallery_contest::NUM_IMAGES > 0) {
                 $template->assign_block_vars($this->template_block_images . '.imagerow.no_image', array());
                 $num++;
             }
         }
     }
     $template->assign_vars(array('S_THUMBNAIL_SIZE' => phpbb_gallery_config::get('thumbnail_height') + 20 + (phpbb_gallery_config::get('thumbnail_infoline') ? phpbb_gallery_constants::THUMBNAIL_INFO_HEIGHT : 0)));
 }