Example #1
0
                            $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}&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}&image_id={$image_id}&mode=comment&submode=delete&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}&image_id={$image_id}&mode=comment&submode=edit&comment_id=" . $commentrow['comment_id']) : '', 'U_INFO' => $auth->acl_get('a_') ? phpbb_gallery_url::append_sid('mcp', 'mode=whois&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')));
        }
    }
    unset($rowset);
    page_header($l_search_title ? $l_search_title : $user->lang['SEARCH']);
    $template->set_filenames(array('body' => 'gallery/search_results.html'));
    make_jumpbox(phpbb_gallery_url::append_sid('phpbb', 'viewforum'));
    page_footer();
}
$s_albums = phpbb_gallery_album::get_albumbox(false, false, false, 'i_view');
if (!$s_albums) {
    trigger_error('NO_SEARCH');
}
Example #2
0
    public static function details($mode, $option_id, $album_id, $album_data)
    {
        global $db, $template, $user;
        if ($mode == 'queue_details') {
            $sql = 'SELECT *
				FROM ' . GALLERY_IMAGES_TABLE . '
				WHERE image_id = ' . (int) $option_id;
            $result = $db->sql_query_limit($sql, 1);
            $row = $db->sql_fetchrow($result);
            $template->assign_vars(array('IMAGE_STATUS' => $row['image_status'], 'STATUS' => $user->lang['QUEUE_STATUS_' . $row['image_status']], 'REPORT_ID' => $row['image_id']));
            $db->sql_freeresult($result);
        } else {
            if ($mode == 'report_details') {
                $m_status = ' AND i.image_status <> ' . phpbb_gallery_image::STATUS_UNAPPROVED;
                if (phpbb_gallery::$auth->acl_check('m_status', $album_id, $album_data['album_user_id'])) {
                    $m_status = '';
                }
                $sql_array = array('SELECT' => 'r.*, u.username reporter_name, u.user_colour reporter_colour, i.*', 'FROM' => array(GALLERY_REPORTS_TABLE => 'r'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'r.reporter_id = u.user_id'), array('FROM' => array(GALLERY_IMAGES_TABLE => 'i'), 'ON' => 'r.report_image_id = i.image_id')), 'WHERE' => 'r.report_id = ' . $option_id . ' ' . $m_status);
                $sql = $db->sql_build_query('SELECT', $sql_array);
                $result = $db->sql_query_limit($sql, 1);
                $row = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                if ($row === false) {
                    trigger_error('REPORT_NOT_FOUND');
                }
                $template->assign_vars(array('REPORTER' => get_username_string('full', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']), 'REPORT_TIME' => $user->format_date($row['report_time']), 'REPORT_ID' => $row['report_id'], 'REPORT_NOTE' => $row['report_note'], 'REPORT_STATUS' => $row['report_status'] == phpbb_gallery_constants::REPORT_OPEN ? true : false, 'STATUS' => $user->lang['REPORT_STATUS_' . $row['report_status']] . ' ' . $user->lang['QUEUE_STATUS_' . $row['image_status']]));
            }
        }
        $template->assign_vars(array('IMAGE_NAME' => $row['image_name'], 'IMAGE_DESC' => generate_text_for_display($row['image_desc'], $row['image_desc_uid'], $row['image_desc_bitfield'], 7), 'UPLOADER' => get_username_string('full', $row['image_user_id'], $row['image_username'], $row['image_user_colour']), 'IMAGE_TIME' => $user->format_date($row['image_time']), 'UC_IMAGE' => phpbb_gallery_image::generate_link('medium', phpbb_gallery_config::get('link_thumbnail'), $row['image_id'], $row['image_name'], $album_id), 'U_EDIT_IMAGE' => phpbb_gallery_url::append_sid('posting', 'album_id=' . $album_id . '&amp;image_id=' . $row['image_id'] . '&amp;mode=image&amp;submode=edit'), 'U_DELETE_IMAGE' => phpbb_gallery_url::append_sid('posting', 'album_id=' . $album_id . '&amp;image_id=' . $row['image_id'] . '&amp;mode=image&amp;submode=delete'), 'S_MCP_ACTION' => phpbb_gallery_url::append_sid('mcp', "mode=" . ($mode == 'report_details' ? 'report_open' : 'queue_unapproved') . "&amp;album_id={$album_id}")));
    }
Example #3
0
 /**
  * Display albums
  *
  * borrowed from phpBB3
  * @author: phpBB Group
  * @function: display_forums
  */
 public static function display_albums($root_data = '', $display_moderators = true, $return_moderators = false)
 {
     global $auth, $db, $template, $user;
     $album_rows = $subalbums = $album_ids = $album_ids_moderator = $album_moderators = $active_album_ary = array();
     $parent_id = $visible_albums = 0;
     $sql_from = '';
     $mode = request_var('mode', '');
     // Mark albums read?
     $mark_read = request_var('mark', '');
     if ($mark_read == 'all') {
         $mark_read = '';
     }
     if (!$root_data) {
         if ($mark_read == 'albums') {
             $mark_read = 'all';
         }
         $root_data = array('album_id' => self::PUBLIC_ALBUM);
         $sql_where = 'a.album_user_id = ' . self::PUBLIC_ALBUM;
     } else {
         if ($root_data == 'personal') {
             if ($mark_read == 'albums') {
                 $mark_read = 'all';
             }
             $root_data = array('album_id' => 0);
             //@todo: I think this is incorrect!?
             $sql_where = 'a.album_user_id > ' . self::PUBLIC_ALBUM;
             $num_pegas = phpbb_gallery_config::get('num_pegas');
             $first_char = request_var('first_char', '');
             if ($first_char == 'other') {
                 // Loop the ASCII: a-z
                 for ($i = 97; $i < 123; $i++) {
                     $sql_where .= ' AND u.username_clean NOT ' . $db->sql_like_expression(chr($i) . $db->any_char);
                 }
             } else {
                 if ($first_char) {
                     $sql_where .= ' AND u.username_clean ' . $db->sql_like_expression(substr($first_char, 0, 1) . $db->any_char);
                 }
             }
             if ($first_char) {
                 // We do not view all personal albums, so we need to recount, for the pagination.
                 $sql_array = array('SELECT' => 'count(a.album_id) as pgalleries', 'FROM' => array(GALLERY_ALBUMS_TABLE => 'a'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = a.album_user_id')), 'WHERE' => 'a.parent_id = 0 AND ' . $sql_where);
                 $sql = $db->sql_build_query('SELECT', $sql_array);
                 $result = $db->sql_query($sql);
                 $num_pegas = $db->sql_fetchfield('pgalleries');
                 $db->sql_freeresult($result);
             }
             $mode_personal = true;
             $start = request_var('start', 0);
             $limit = phpbb_gallery_config::get('pegas_per_page');
             $template->assign_vars(array('PAGINATION' => generate_pagination(phpbb_gallery_url::append_sid('index', 'mode=' . $mode . ($first_char ? '&amp;first_char=' . $first_char : '')), $num_pegas, $limit, $start), 'TOTAL_PGALLERIES_SHORT' => sprintf($user->lang['TOTAL_PGALLERIES_SHORT'], $num_pegas), 'PAGE_NUMBER' => on_page($num_pegas, $limit, $start)));
         } else {
             $sql_where = 'a.left_id > ' . $root_data['left_id'] . ' AND a.left_id < ' . $root_data['right_id'] . ' AND a.album_user_id = ' . $root_data['album_user_id'];
         }
     }
     $sql_array = array('SELECT' => 'a.*, at.mark_time', 'FROM' => array(GALLERY_ALBUMS_TABLE => 'a'), 'LEFT_JOIN' => array(array('FROM' => array(GALLERY_ATRACK_TABLE => 'at'), 'ON' => 'at.user_id = ' . $user->data['user_id'] . ' AND a.album_id = at.album_id')), 'ORDER_BY' => 'a.album_user_id, a.left_id');
     if (isset($mode_personal)) {
         $sql_array['LEFT_JOIN'][] = array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = a.album_user_id');
         $sql_array['ORDER_BY'] = 'u.username_clean, a.left_id';
     }
     $sql_array['LEFT_JOIN'][] = array('FROM' => array(GALLERY_CONTESTS_TABLE => 'c'), 'ON' => 'c.contest_album_id = a.album_id');
     $sql_array['SELECT'] = $sql_array['SELECT'] . ', c.contest_marked';
     $sql = $db->sql_build_query('SELECT', array('SELECT' => $sql_array['SELECT'], 'FROM' => $sql_array['FROM'], 'LEFT_JOIN' => $sql_array['LEFT_JOIN'], 'WHERE' => $sql_where, 'ORDER_BY' => $sql_array['ORDER_BY']));
     $result = $db->sql_query($sql);
     $album_tracking_info = array();
     $branch_root_id = $root_data['album_id'];
     while ($row = $db->sql_fetchrow($result)) {
         $album_id = $row['album_id'];
         // Mark albums read?
         if ($mark_read == 'albums' || $mark_read == 'all') {
             if (phpbb_gallery::$auth->acl_check('a_list', $album_id, $row['album_user_id'])) {
                 $album_ids[] = $album_id;
                 continue;
             }
         }
         // Category with no members
         if (!$row['album_type'] && $row['left_id'] + 1 == $row['right_id']) {
             continue;
         }
         // Skip branch
         if (isset($right_id)) {
             if ($row['left_id'] < $right_id) {
                 continue;
             }
             unset($right_id);
         }
         if (!phpbb_gallery::$auth->acl_check('a_list', $album_id, $row['album_user_id'])) {
             // if the user does not have permissions to list this album, skip everything until next branch
             $right_id = $row['right_id'];
             continue;
         }
         $album_tracking_info[$album_id] = !empty($row['mark_time']) ? $row['mark_time'] : phpbb_gallery::$user->data('user_lastmark');
         $row['album_images'] = $row['album_images'];
         $row['album_images_real'] = $row['album_images_real'];
         if ($row['parent_id'] == $root_data['album_id'] || $row['parent_id'] == $branch_root_id) {
             if ($row['album_type']) {
                 $album_ids_moderator[] = (int) $album_id;
             }
             // Direct child of current branch
             $parent_id = $album_id;
             $album_rows[$album_id] = $row;
             if (!$row['album_type'] && $row['parent_id'] == $root_data['album_id']) {
                 $branch_root_id = $album_id;
             }
             $album_rows[$parent_id]['album_id_last_image'] = $row['album_id'];
             $album_rows[$parent_id]['album_type_last_image'] = $row['album_type'];
             $album_rows[$parent_id]['album_contest_marked'] = $row['contest_marked'];
             $album_rows[$parent_id]['orig_album_last_image_time'] = $row['album_last_image_time'];
         } else {
             if ($row['album_type']) {
                 $subalbums[$parent_id][$album_id]['display'] = $row['display_on_index'] ? true : false;
                 $subalbums[$parent_id][$album_id]['name'] = $row['album_name'];
                 $subalbums[$parent_id][$album_id]['orig_album_last_image_time'] = $row['album_last_image_time'];
                 $subalbums[$parent_id][$album_id]['children'] = array();
                 if (isset($subalbums[$parent_id][$row['parent_id']]) && !$row['display_on_index']) {
                     $subalbums[$parent_id][$row['parent_id']]['children'][] = $album_id;
                 }
                 $album_rows[$parent_id]['album_images'] += $row['album_images'];
                 $album_rows[$parent_id]['album_images_real'] += $row['album_images_real'];
                 if ($row['album_last_image_time'] > $album_rows[$parent_id]['album_last_image_time']) {
                     $album_rows[$parent_id]['album_last_image_id'] = $row['album_last_image_id'];
                     $album_rows[$parent_id]['album_last_image_name'] = $row['album_last_image_name'];
                     $album_rows[$parent_id]['album_last_image_time'] = $row['album_last_image_time'];
                     $album_rows[$parent_id]['album_last_user_id'] = $row['album_last_user_id'];
                     $album_rows[$parent_id]['album_last_username'] = $row['album_last_username'];
                     $album_rows[$parent_id]['album_last_user_colour'] = $row['album_last_user_colour'];
                     $album_rows[$parent_id]['album_type_last_image'] = $row['album_type'];
                     $album_rows[$parent_id]['album_contest_marked'] = $row['contest_marked'];
                     $album_rows[$parent_id]['album_id_last_image'] = $album_id;
                 }
             }
         }
     }
     $db->sql_freeresult($result);
     // Handle marking albums
     if ($mark_read == 'albums' || $mark_read == 'all') {
         $redirect = build_url('mark', 'hash');
         $token = request_var('hash', '');
         if (check_link_hash($token, 'global')) {
             if ($mark_read == 'all') {
                 phpbb_gallery_misc::markread('all');
                 $message = sprintf($user->lang['RETURN_INDEX'], '<a href="' . $redirect . '">', '</a>');
             } else {
                 phpbb_gallery_misc::markread('albums', $album_ids);
                 $message = sprintf($user->lang['RETURN_ALBUM'], '<a href="' . $redirect . '">', '</a>');
             }
             meta_refresh(3, $redirect);
             trigger_error($user->lang['ALBUMS_MARKED'] . '<br /><br />' . $message);
         } else {
             $message = sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>');
             meta_refresh(3, $redirect);
             trigger_error($message);
         }
     }
     // Grab moderators ... if necessary
     if ($display_moderators) {
         if ($return_moderators) {
             $album_ids_moderator[] = $root_data['album_id'];
         }
         self::get_moderators($album_moderators, $album_ids_moderator);
     }
     // Used to tell whatever we have to create a dummy category or not.
     $last_catless = true;
     foreach ($album_rows as $row) {
         // Empty category
         if ($row['parent_id'] == $root_data['album_id'] && $row['album_type'] == self::TYPE_CAT) {
             $template->assign_block_vars('albumrow', array('S_IS_CAT' => true, 'ALBUM_ID' => $row['album_id'], 'ALBUM_NAME' => $row['album_name'], 'ALBUM_DESC' => generate_text_for_display($row['album_desc'], $row['album_desc_uid'], $row['album_desc_bitfield'], $row['album_desc_options']), 'ALBUM_FOLDER_IMG' => '', 'ALBUM_FOLDER_IMG_SRC' => '', 'ALBUM_IMAGE' => $row['album_image'] ? phpbb_gallery_url::path('phpbb') . $row['album_image'] : '', 'U_VIEWALBUM' => phpbb_gallery_url::append_sid('album', 'album_id=' . $row['album_id'])));
             continue;
         }
         $visible_albums++;
         if ($mode == 'personal' && ($visible_albums <= $start || $visible_albums > $start + $limit)) {
             continue;
         }
         $album_id = $row['album_id'];
         $album_unread = isset($album_tracking_info[$album_id]) && $row['orig_album_last_image_time'] > $album_tracking_info[$album_id] && $user->data['user_id'] != ANONYMOUS ? true : false;
         $folder_image = $folder_alt = $l_subalbums = '';
         $subalbums_list = array();
         // Generate list of subalbums if we need to
         if (isset($subalbums[$album_id])) {
             foreach ($subalbums[$album_id] as $subalbum_id => $subalbum_row) {
                 $subalbum_unread = isset($album_tracking_info[$subalbum_id]) && $subalbum_row['orig_album_last_image_time'] > $album_tracking_info[$subalbum_id] && $user->data['user_id'] != ANONYMOUS ? true : false;
                 if (!$subalbum_unread && !empty($subalbum_row['children']) && $user->data['user_id'] != ANONYMOUS) {
                     foreach ($subalbum_row['children'] as $child_id) {
                         if (isset($album_tracking_info[$child_id]) && $subalbums[$album_id][$child_id]['orig_album_last_image_time'] > $album_tracking_info[$child_id]) {
                             // Once we found an unread child album, we can drop out of this loop
                             $subalbum_unread = true;
                             break;
                         }
                     }
                 }
                 if ($subalbum_row['display'] && $subalbum_row['name']) {
                     $subalbums_list[] = array('link' => phpbb_gallery_url::append_sid('album', 'album_id=' . $subalbum_id), 'name' => $subalbum_row['name'], 'unread' => $subalbum_unread);
                 } else {
                     unset($subalbums[$album_id][$subalbum_id]);
                 }
                 if ($subalbum_unread) {
                     $album_unread = true;
                 }
             }
             $l_subalbums = sizeof($subalbums[$album_id]) == 1 ? $user->lang['SUBALBUM'] . ': ' : $user->lang['SUBALBUMS'] . ': ';
             $folder_image = $album_unread ? 'forum_unread_subforum' : 'forum_read_subforum';
         } else {
             $folder_alt = $album_unread ? 'NEW_IMAGES' : 'NO_NEW_IMAGES';
             $folder_image = $album_unread ? 'forum_unread' : 'forum_read';
         }
         if ($row['album_status'] == self::STATUS_LOCKED) {
             $folder_image = $album_unread ? 'forum_unread_locked' : 'forum_read_locked';
             $folder_alt = 'ALBUM_LOCKED';
         }
         // Create last post link information, if appropriate
         if ($row['album_last_image_id']) {
             $lastimage_name = $row['album_last_image_name'];
             $lastimage_time = $user->format_date($row['album_last_image_time']);
             $lastimage_image_id = $row['album_last_image_id'];
             $lastimage_album_id = $row['album_id_last_image'];
             $lastimage_album_type = $row['album_type_last_image'];
             $lastimage_contest_marked = $row['album_contest_marked'];
             $lastimage_uc_fake_thumbnail = phpbb_gallery_image::generate_link('fake_thumbnail', phpbb_gallery_config::get('link_thumbnail'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
             $lastimage_uc_thumbnail = phpbb_gallery_image::generate_link('thumbnail', phpbb_gallery_config::get('link_thumbnail'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
             $lastimage_uc_name = phpbb_gallery_image::generate_link('image_name', phpbb_gallery_config::get('link_image_name'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
             $lastimage_uc_icon = phpbb_gallery_image::generate_link('lastimage_icon', phpbb_gallery_config::get('link_image_icon'), $lastimage_image_id, $lastimage_name, $lastimage_album_id);
         } else {
             $lastimage_time = $lastimage_image_id = $lastimage_album_id = $lastimage_album_type = 0;
             $lastimage_name = $lastimage_uc_fake_thumbnail = $lastimage_uc_thumbnail = $lastimage_uc_name = $lastimage_uc_icon = '';
         }
         // Output moderator listing ... if applicable
         $l_moderator = $moderators_list = '';
         if ($display_moderators && !empty($album_moderators[$album_id])) {
             $l_moderator = sizeof($album_moderators[$album_id]) == 1 ? $user->lang['MODERATOR'] : $user->lang['MODERATORS'];
             $moderators_list = implode(', ', $album_moderators[$album_id]);
         }
         $s_subalbums_list = array();
         foreach ($subalbums_list as $subalbum) {
             $s_subalbums_list[] = '<a href="' . $subalbum['link'] . '" class="subforum ' . ($subalbum['unread'] ? 'unread' : 'read') . '" title="' . ($subalbum['unread'] ? $user->lang['NEW_IMAGES'] : $user->lang['NO_NEW_IMAGES']) . '">' . $subalbum['name'] . '</a>';
         }
         $s_subalbums_list = (string) implode(', ', $s_subalbums_list);
         $catless = $row['parent_id'] == $root_data['album_id'] ? true : false;
         $template->assign_block_vars('albumrow', array('S_IS_CAT' => false, 'S_NO_CAT' => $catless && !$last_catless, 'S_LOCKED_ALBUM' => $row['album_status'] == self::STATUS_LOCKED ? true : false, 'S_LIST_SUBALBUMS' => $row['display_subalbum_list'] ? true : false, 'S_SUBALBUMS' => sizeof($subalbums_list) ? true : false, 'ALBUM_ID' => $row['album_id'], 'ALBUM_NAME' => $row['album_name'], 'ALBUM_DESC' => generate_text_for_display($row['album_desc'], $row['album_desc_uid'], $row['album_desc_bitfield'], $row['album_desc_options']), 'IMAGES' => $row['album_images'], 'UNAPPROVED_IMAGES' => phpbb_gallery::$auth->acl_check('m_status', $album_id, $row['album_user_id']) ? $row['album_images_real'] - $row['album_images'] : 0, 'ALBUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt), 'ALBUM_FOLDER_IMG_SRC' => $user->img($folder_image, $folder_alt, false, '', 'src'), 'ALBUM_FOLDER_IMG_ALT' => isset($user->lang[$folder_alt]) ? $user->lang[$folder_alt] : '', 'ALBUM_IMAGE' => $row['album_image'] ? phpbb_gallery_url::path('phpbb') . $row['album_image'] : '', 'LAST_IMAGE_TIME' => $lastimage_time, 'LAST_USER_FULL' => $lastimage_album_type == self::TYPE_CONTEST && ($lastimage_contest_marked && !phpbb_gallery::$auth->acl_check('m_status', $album_id, $row['album_user_id'])) ? $user->lang['CONTEST_USERNAME'] : get_username_string('full', $row['album_last_user_id'], $row['album_last_username'], $row['album_last_user_colour']), 'UC_THUMBNAIL' => phpbb_gallery_config::get('mini_thumbnail_disp') ? $lastimage_uc_thumbnail : '', 'UC_FAKE_THUMBNAIL' => phpbb_gallery_config::get('mini_thumbnail_disp') ? $lastimage_uc_fake_thumbnail : '', 'UC_IMAGE_NAME' => $lastimage_uc_name, 'UC_LASTIMAGE_ICON' => $lastimage_uc_icon, 'ALBUM_COLOUR' => get_username_string('colour', $row['album_last_user_id'], $row['album_last_username'], $row['album_last_user_colour']), 'MODERATORS' => $moderators_list, 'SUBALBUMS' => $s_subalbums_list, 'L_SUBALBUM_STR' => $l_subalbums, 'L_ALBUM_FOLDER_ALT' => $folder_alt, 'L_MODERATOR_STR' => $l_moderator, 'U_VIEWALBUM' => phpbb_gallery_url::append_sid('album', 'album_id=' . $row['album_id'])));
         // Assign subforums loop for style authors
         foreach ($subalbums_list as $subalbum) {
             $template->assign_block_vars('albumrow.subalbum', array('U_SUBALBUM' => $subalbum['link'], 'SUBALBUM_NAME' => $subalbum['name'], 'S_UNREAD' => $subalbum['unread']));
         }
         $last_catless = $catless;
     }
     $template->assign_vars(array('U_MARK_ALBUMS' => $user->data['is_registered'] ? phpbb_gallery_url::append_sid('album', 'hash=' . generate_link_hash('global') . '&amp;album_id=' . $root_data['album_id'] . '&amp;mark=albums') : '', 'S_HAS_SUBALBUM' => $visible_albums ? true : false, 'L_SUBFORUM' => $visible_albums == 1 ? $user->lang['SUBALBUM'] : $user->lang['SUBALBUMS'], 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'FAKE_THUMB_SIZE' => phpbb_gallery_config::get('mini_thumbnail_size')));
     if ($return_moderators) {
         return array($active_album_ary, $album_moderators);
     }
     return array($active_album_ary, array());
 }
Example #4
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;
            }
$sql = 'SELECT image_id, image_name
	FROM ' . GALLERY_IMAGES_TABLE . '
	WHERE image_album_id = ' . (int) $album_id . $image_approval_sql . "\n\t\tAND (({$sql_sort_by} = '" . $db->sql_escape($image_data[$sql_sort_by]) . "' AND image_id {$sql_previous_condition} {$image_id})\n\t\tOR {$sql_sort_by} {$sql_previous_condition} '" . $db->sql_escape($image_data[$sql_sort_by]) . "')\n\tORDER BY {$sql_sort_by} {$sql_previous_ordering}";
$result = $db->sql_query_limit($sql, 1);
$previous_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$s_allowed_delete = $s_allowed_edit = $s_allowed_status = false;
if ((phpbb_gallery::$auth->acl_check('m_', $album_id, $album_data['album_user_id']) || $image_data['image_user_id'] == $user->data['user_id']) && $user->data['user_id'] != ANONYMOUS) {
    $s_user_allowed = $image_data['image_user_id'] == $user->data['user_id'] && $album_data['album_status'] != phpbb_gallery_album::STATUS_LOCKED;
    $s_allowed_delete = phpbb_gallery::$auth->acl_check('i_delete', $album_id, $album_data['album_user_id']) && $s_user_allowed || phpbb_gallery::$auth->acl_check('m_delete', $album_id, $album_data['album_user_id']);
    $s_allowed_edit = phpbb_gallery::$auth->acl_check('i_edit', $album_id, $album_data['album_user_id']) && $s_user_allowed || phpbb_gallery::$auth->acl_check('m_edit', $album_id, $album_data['album_user_id']);
    $s_quick_mod = $s_allowed_delete || $s_allowed_edit || phpbb_gallery::$auth->acl_check('m_status', $album_id, $album_data['album_user_id']) || phpbb_gallery::$auth->acl_check('m_move', $album_id, $album_data['album_user_id']);
    $user->add_lang('mods/gallery_mcp');
    $template->assign_vars(array('S_MOD_ACTION' => phpbb_gallery_url::append_sid('mcp', "album_id={$album_id}&amp;image_id={$image_id}&amp;quickmod=1", true, $user->session_id), 'S_QUICK_MOD' => $s_quick_mod, 'S_QM_MOVE' => phpbb_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' => phpbb_gallery::$auth->acl_check('m_report', $album_id, $album_data['album_user_id']), 'S_QM_STATUS' => phpbb_gallery::$auth->acl_check('m_status', $album_id, $album_data['album_user_id']), 'S_IMAGE_REPORTED' => $image_data['image_reported'], 'U_IMAGE_REPORTED' => $image_data['image_reported'] ? phpbb_gallery_url::append_sid('mcp', "mode=report_details&amp;album_id={$album_id}&amp;option_id=" . $image_data['image_reported']) : '', 'S_STATUS_APPROVED' => $image_data['image_status'] == phpbb_gallery_image::STATUS_APPROVED, 'S_STATUS_UNAPPROVED' => $image_data['image_status'] == phpbb_gallery_image::STATUS_UNAPPROVED, 'S_STATUS_LOCKED' => $image_data['image_status'] == phpbb_gallery_image::STATUS_LOCKED));
}
$template->assign_vars(array('U_VIEW_ALBUM' => phpbb_gallery_url::append_sid("album.{$phpEx}", "album_id={$album_id}"), 'UC_PREVIOUS_IMAGE' => !empty($previous_data) && phpbb_gallery_config::get('disp_nextprev_thumbnail') ? generate_image_link('thumbnail', 'image_page', $previous_data['image_id'], $previous_data['image_name'], $album_id) : '', 'UC_PREVIOUS' => !empty($previous_data) ? phpbb_gallery_image::generate_link('image_name_unbold', 'image_page_prev', $previous_data['image_id'], $previous_data['image_name'], $album_id) : '', 'UC_IMAGE' => phpbb_gallery_image::generate_link('medium', phpbb_gallery_config::get('link_imagepage'), $image_id, $image_data['image_name'], $album_id, substr($image_data['image_filename'], 0 - 3) == 'gif' ? true : false, false), 'UC_NEXT_IMAGE' => !empty($next_data) && phpbb_gallery_config::get('disp_nextprev_thumbnail') ? generate_image_link('thumbnail', 'image_page', $next_data['image_id'], $next_data['image_name'], $album_id) : '', 'UC_NEXT' => !empty($next_data) ? phpbb_gallery_image::generate_link('image_name_unbold', 'image_page_next', $next_data['image_id'], $next_data['image_name'], $album_id) : '', 'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_IMAGE'), 'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_IMAGE'), 'REPORT_IMG' => $user->img('icon_post_report', 'REPORT_IMAGE'), 'STATUS_IMG' => $user->img('icon_post_info', 'STATUS_IMAGE'), 'U_DELETE' => $s_allowed_delete ? phpbb_gallery_url::append_sid('posting', "mode=image&amp;submode=delete&amp;album_id={$album_id}&amp;image_id={$image_id}") : '', 'U_EDIT' => $s_allowed_edit ? phpbb_gallery_url::append_sid('posting', "mode=image&amp;submode=edit&amp;album_id={$album_id}&amp;image_id={$image_id}") : '', 'U_REPORT' => phpbb_gallery::$auth->acl_check('i_report', $album_id, $album_data['album_user_id']) && $image_data['image_user_id'] != $user->data['user_id'] ? phpbb_gallery_url::append_sid('posting', "mode=image&amp;submode=report&amp;album_id={$album_id}&amp;image_id={$image_id}") : '', 'U_STATUS' => $s_allowed_status ? phpbb_gallery_url::append_sid('mcp', "mode=queue_details&amp;album_id={$album_id}&amp;option_id={$image_id}") : '', 'CONTEST_RANK' => $image_data['image_contest_rank'] ? $user->lang['CONTEST_RESULT_' . $image_data['image_contest_rank']] : '', 'IMAGE_NAME' => $image_data['image_name'], 'IMAGE_DESC' => generate_text_for_display($image_data['image_desc'], $image_data['image_desc_uid'], $image_data['image_desc_bitfield'], 7), 'IMAGE_BBCODE' => '[album]' . $image_id . '[/album]', 'IMAGE_IMGURL_BBCODE' => phpbb_gallery_config::get('disp_image_url') ? '[url=' . phpbb_gallery_url::path('full') . "image.{$phpEx}?album_id={$album_id}&amp;image_id={$image_id}" . '][img]' . generate_board_url(false) . '/' . phpbb_gallery_url::path('relative') . "image.{$phpEx}?album_id={$album_id}&amp;image_id={$image_id}&amp;mode=thumbnail" . '[/img][/url]' : '', 'IMAGE_URL' => phpbb_gallery_config::get('disp_image_url') ? phpbb_gallery_url::path('full') . "image.{$phpEx}?album_id={$album_id}&amp;image_id={$image_id}" : '', 'IMAGE_TIME' => $user->format_date($image_data['image_time']), 'IMAGE_VIEW' => $image_data['image_view_count'], 'POSTER_IP' => $auth->acl_get('a_') ? $image_data['image_user_ip'] : '', 'U_POSTER_WHOIS' => $auth->acl_get('a_') ? phpbb_gallery_url::append_sid('mcp', 'mode=whois&amp;ip=' . $image_data['image_user_ip']) : '', 'L_BOOKMARK_TOPIC' => $image_data['favorite_id'] ? $user->lang['UNFAVORITE_IMAGE'] : $user->lang['FAVORITE_IMAGE'], 'U_BOOKMARK_TOPIC' => $user->data['user_id'] != ANONYMOUS ? phpbb_gallery_url::append_sid('posting', "mode=image&amp;submode=" . ($image_data['favorite_id'] ? 'un' : '') . "favorite&amp;album_id={$album_id}&amp;image_id={$image_id}") : '', 'L_WATCH_TOPIC' => $image_data['watch_id'] ? $user->lang['UNWATCH_IMAGE'] : $user->lang['WATCH_IMAGE'], 'U_WATCH_TOPIC' => $user->data['user_id'] != ANONYMOUS ? phpbb_gallery_url::append_sid('posting', "mode=image&amp;submode=" . ($image_data['watch_id'] ? 'un' : '') . "watch&amp;album_id={$album_id}&amp;image_id={$image_id}") : '', 'S_WATCHING_TOPIC' => $image_data['watch_id'] ? true : false, 'S_ALBUM_ACTION' => phpbb_gallery_url::append_sid('image_page', "album_id={$album_id}&amp;image_id={$image_id}"), 'U_RETURN_LINK' => phpbb_gallery_url::append_sid('album', "album_id={$album_id}"), 'S_RETURN_LINK' => $album_data['album_name'], 'S_JUMPBOX_ACTION' => phpbb_gallery_url::append_sid('album'), 'ALBUM_JUMPBOX' => phpbb_gallery_album::get_albumbox(false, '', $album_id)));
/**
* Exif-Data
*/
if (phpbb_gallery_config::get('disp_exifdata') && $image_data['image_has_exif'] != phpbb_gallery_exif::UNAVAILABLE && substr($image_data['image_filename'], -4) == '.jpg' && function_exists('exif_read_data') && (phpbb_gallery::$auth->acl_check('m_status', $album_id, $album_data['album_user_id']) || $image_data['image_contest'] != phpbb_gallery_image::IN_CONTEST)) {
    $exif = new phpbb_gallery_exif(phpbb_gallery_url::path('upload') . $image_data['image_filename'], $image_id);
    $exif->interpret($image_data['image_has_exif'], $image_data['image_exif_data']);
    if (!empty($exif->data["EXIF"])) {
        $exif->send_to_template(phpbb_gallery::$user->get_data('user_viewexif'));
    }
    unset($exif);
}
/**
* Rating
*/
if (phpbb_gallery_config::get('allow_rates')) {
Example #6
0
 /**
  * Query the comments and put them into the template.
  */
 private function display_comments()
 {
     if (empty($this->auth_comments)) {
         return;
     }
     global $auth, $db, $template, $user;
     $user->add_lang('viewtopic');
     $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' => $this->sql_where_auth . ' AND ' . $db->sql_in_set('i.image_album_id', $this->auth_comments, false, true), 'ORDER_BY' => 'c.comment_id DESC');
     $sql = $db->sql_build_query('SELECT', $sql_array);
     $result = $db->sql_query_limit($sql, $this->num_comments);
     while ($row = $db->sql_fetchrow($result)) {
         $image_id = (int) $row['image_id'];
         $album_id = (int) $row['image_album_id'];
         $template->assign_block_vars($this->template_block_comments, array('U_COMMENT' => phpbb_gallery_url::append_sid('image_page', "album_id={$album_id}&amp;image_id={$image_id}") . '#comment_' . $row['comment_id'], 'COMMENT_ID' => $row['comment_id'], 'TIME' => $user->format_date($row['comment_time']), 'TEXT' => generate_text_for_display($row['comment'], $row['comment_uid'], $row['comment_bitfield'], 7), 'U_DELETE' => phpbb_gallery::$auth->acl_check('m_comments', $album_id) || phpbb_gallery::$auth->acl_check('c_delete', $album_id) && $row['comment_user_id'] == $user->data['user_id'] && $user->data['is_registered'] ? phpbb_gallery_url::append_sid('comment', "album_id={$album_id}&amp;image_id={$image_id}&amp;mode=delete&amp;comment_id=" . $row['comment_id']) : '', 'U_QUOTE' => phpbb_gallery::$auth->acl_check('c_post', $album_id) ? phpbb_gallery_url::append_sid('comment', "album_id={$album_id}&amp;image_id={$image_id}&amp;mode=add&amp;comment_id=" . $row['comment_id']) : '', 'U_EDIT' => phpbb_gallery::$auth->acl_check('m_comments', $album_id) || phpbb_gallery::$auth->acl_check('c_edit', $album_id) && $row['comment_user_id'] == $user->data['user_id'] && $user->data['is_registered'] ? phpbb_gallery_url::append_sid('comment', "album_id={$album_id}&amp;image_id={$image_id}&amp;mode=edit&amp;comment_id=" . $row['comment_id']) : '', 'U_INFO' => $auth->acl_get('a_') ? phpbb_gallery_url::append_sid('mcp', 'mode=whois&amp;ip=' . $row['comment_user_ip']) : '', 'UC_THUMBNAIL' => phpbb_gallery_image::generate_link('thumbnail', phpbb_gallery_config::get('link_thumbnail'), $row['image_id'], $row['image_name'], $row['image_album_id']), 'UC_IMAGE_NAME' => phpbb_gallery_image::generate_link('image_name', phpbb_gallery_config::get('link_image_name'), $row['image_id'], $row['image_name'], $row['image_album_id']), 'IMAGE_AUTHOR' => get_username_string('full', $row['image_user_id'], $row['image_username'], $row['image_user_colour']), 'IMAGE_TIME' => $user->format_date($row['image_time']), 'POST_AUTHOR_FULL' => get_username_string('full', $row['comment_user_id'], $row['comment_username'], $row['comment_user_colour']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['comment_user_id'], $row['comment_username'], $row['comment_user_colour']), 'POST_AUTHOR' => get_username_string('username', $row['comment_user_id'], $row['comment_username'], $row['comment_user_colour']), 'U_POST_AUTHOR' => get_username_string('profile', $row['comment_user_id'], $row['comment_username'], $row['comment_user_colour'])));
     }
     $db->sql_freeresult($result);
     $template->assign_vars(array('S_COMMENTS' => true, 'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_COMMENT'), 'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_COMMENT'), 'QUOTE_IMG' => $user->img('icon_post_quote', 'QUOTE_COMMENT'), 'INFO_IMG' => $user->img('icon_post_info', 'IP'), 'MINI_POST_IMG' => $user->img('icon_post_target', 'COMMENT'), 'PROFILE_IMG' => $user->img('icon_user_profile', 'READ_PROFILE'), 'COLLAPSE_COMMENTS' => $this->toggle_comments));
 }
    function manage_favorites()
    {
        global $db, $template, $user;
        $action = request_var('action', '');
        $image_id_ary = request_var('image_id_ary', array(0));
        if ($image_id_ary && $action == 'remove_favorite') {
            $sql = 'DELETE FROM ' . GALLERY_FAVORITES_TABLE . '
				WHERE user_id = ' . $user->data['user_id'] . '
					AND ' . $db->sql_in_set('image_id', $image_id_ary);
            $db->sql_query($sql);
            $sql = 'UPDATE ' . GALLERY_IMAGES_TABLE . '
				SET image_favorited = image_favorited - 1
				WHERE ' . $db->sql_in_set('image_id', $image_id_ary);
            $db->sql_query($sql);
            meta_refresh(3, $this->u_action);
            trigger_error($user->lang['UNFAVORITED_IMAGES'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'));
        }
        $start = request_var('start', 0);
        $images_per_page = phpbb_gallery_config::get('album_rows') * phpbb_gallery_config::get('album_columns');
        $total_images = 0;
        $sql = 'SELECT COUNT(image_id) as images
			FROM ' . GALLERY_FAVORITES_TABLE . '
			WHERE user_id = ' . $user->data['user_id'];
        $result = $db->sql_query($sql);
        $total_images = (int) $db->sql_fetchfield('images');
        $db->sql_freeresult($result);
        $sql_array = array('SELECT' => 'f.*, i.*, a.album_name', 'FROM' => array(GALLERY_FAVORITES_TABLE => 'f'), 'LEFT_JOIN' => array(array('FROM' => array(GALLERY_IMAGES_TABLE => 'i'), 'ON' => 'f.image_id = i.image_id'), array('FROM' => array(GALLERY_ALBUMS_TABLE => 'a'), 'ON' => 'a.album_id = i.image_album_id')), 'WHERE' => 'f.user_id = ' . $user->data['user_id']);
        $sql = $db->sql_build_query('SELECT', $sql_array);
        $result = $db->sql_query_limit($sql, $images_per_page, $start);
        while ($row = $db->sql_fetchrow($result)) {
            $template->assign_block_vars('image_row', array('UC_IMAGE_NAME' => phpbb_gallery_image::generate_link('image_name', phpbb_gallery_config::get('link_image_name'), $row['image_id'], $row['image_name'], $row['image_album_id']), 'UC_FAKE_THUMBNAIL' => phpbb_gallery_image::generate_link('fake_thumbnail', phpbb_gallery_config::get('link_thumbnail'), $row['image_id'], $row['image_name'], $row['image_album_id']), 'UPLOADER' => $row['image_contest'] && !phpbb_gallery::$auth->acl_check('m_status', $row['image_album_id']) ? $user->lang['CONTEST_USERNAME'] : get_username_string('full', $row['image_user_id'], $row['image_username'], $row['image_user_colour']), 'IMAGE_TIME' => $user->format_date($row['image_time']), 'ALBUM_NAME' => $row['album_name'], 'IMAGE_ID' => $row['image_id'], 'U_VIEW_ALBUM' => phpbb_gallery_url::append_sid('album', 'album_id=' . $row['image_album_id']), 'U_IMAGE' => phpbb_gallery_url::append_sid('image_page', 'album_id=' . $row['image_album_id'] . '&amp;image_id=' . $row['image_id'])));
        }
        $db->sql_freeresult($result);
        $template->assign_vars(array('S_MANAGE_FAVORITES' => true, 'S_UCP_ACTION' => $this->u_action, 'L_TITLE' => $user->lang['UCP_GALLERY_FAVORITES'], 'L_TITLE_EXPLAIN' => $user->lang['YOUR_FAVORITE_IMAGES'], 'PAGINATION' => generate_pagination(phpbb_gallery_url::append_sid('phpbb', 'ucp', 'i=gallery&amp;mode=manage_favorites'), $total_images, $images_per_page, $start), 'PAGE_NUMBER' => on_page($total_images, $images_per_page, $start), 'TOTAL_IMAGES' => $total_images == 1 ? $user->lang['VIEW_ALBUM_IMAGE'] : sprintf($user->lang['VIEW_ALBUM_IMAGES'], $total_images), 'DISP_FAKE_THUMB' => true, 'FAKE_THUMB_SIZE' => phpbb_gallery_config::get('mini_thumbnail_size')));
    }
Example #8
0
                $sql = 'SELECT image_id, image_name
					FROM ' . GALLERY_IMAGES_TABLE . '
					WHERE ' . $db->sql_in_set('image_id', $image_id_ary);
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    add_log('gallery', $album_id, $row['image_id'], 'LOG_GALLERY_LOCKED', $row['image_name']);
                }
                $db->sql_freeresult($result);
                $success = true;
            } else {
                confirm_box(false, 'QUEUE' . $multiple . '_A_LOCK2', $s_hidden_fields);
            }
            break;
        case 'images_delete':
            if (confirm_box(true)) {
                phpbb_gallery_image::handle_counter($image_id_ary, false);
                // Delete the files
                $sql = 'SELECT image_id, image_name, image_filename
					FROM ' . GALLERY_IMAGES_TABLE . '
					WHERE ' . $db->sql_in_set('image_id', $image_id_ary);
                $result = $db->sql_query($sql);
                $filenames = array();
                while ($row = $db->sql_fetchrow($result)) {
                    $filenames[(int) $row['image_id']] = $image_data['image_filename'];
                    add_log('gallery', $album_id, $row['image_id'], 'LOG_GALLERY_DELETED', $row['image_name']);
                }
                $db->sql_freeresult($result);
                $sql = 'DELETE FROM ' . GALLERY_COMMENTS_TABLE . '
					WHERE ' . $db->sql_in_set('comment_image_id', $image_id_ary);
                $db->sql_query($sql);
                $sql = 'DELETE FROM ' . GALLERY_REPORTS_TABLE . '
Example #9
0
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include 'common.' . $phpEx;
include $phpbb_root_path . 'common.' . $phpEx;
phpbb_gallery::setup(array('mods/gallery'), false);
//phpbb_gallery_url::_include('functions_display', 'phpbb');
// Get general album information
define('S_GALLERY_PLUGINS', false);
/**
* Check whether the requested image & album exit.
*/
$image_id = request_var('image_id', 0);
$image_data = phpbb_gallery_image::get_info($image_id);
$album_id = $image_data['image_album_id'];
$album_data = phpbb_gallery_album::get_info($album_id);
$image_error = '';
$image_filetype = utf8_substr($image_data['image_filename'], strlen($image_data['image_filename']) - 4, 4);
if (!file_exists(phpbb_gallery_url::path('upload') . $image_data['image_filename'])) {
    $sql = 'UPDATE ' . GALLERY_IMAGES_TABLE . ' 
		SET image_filemissing = 1
		WHERE image_id = ' . $image_id;
    $db->sql_query($sql);
    //trigger_error('IMAGE_NOT_EXIST');
    $image_error = 'image_not_exist.jpg';
}
/**
* Check permissions and hotlinking
*/
Example #10
0
            if ($last_image < $row['album_last_image_id']) {
                $last_image = $row['album_last_image_id'];
                $lastimage_name = $row['album_last_image_name'];
                $lastimage_time = $user->format_date($row['album_last_image_time']);
                $lastimage_image_id = $row['album_last_image_id'];
                $lastimage_user_id = $row['album_last_user_id'];
                $lastimage_username = $row['album_last_username'];
                $lastimage_user_colour = $row['album_last_user_colour'];
                $last_image_page_url = phpbb_gallery_url::append_sid('image_page', 'album_id=' . $row['album_id'] . '&amp;image_id=' . $row['album_last_image_id']);
                $last_thumb_url = phpbb_gallery_url::append_sid('thumbnail', 'album_id=' . $row['album_id'] . '&amp;image_id=' . $row['album_last_image_id']);
                $lastimage_album_id = $row['album_id'];
            }
        }
        $db->sql_freeresult($result);
        $template->assign_block_vars('albumrow', array('S_IS_CAT' => true, 'S_NO_CAT' => false, 'S_LIST_SUBALBUMS' => true, 'S_SUBALBUMS' => true, 'U_VIEWALBUM' => phpbb_gallery_url::append_sid('index', 'mode=personal'), 'ALBUM_NAME' => $user->lang['USERS_PERSONAL_ALBUMS']));
        $template->assign_block_vars('albumrow', array('S_IS_CAT' => false, 'S_NO_CAT' => false, 'S_LIST_SUBALBUMS' => true, 'S_SUBALBUMS' => true, 'U_VIEWALBUM' => phpbb_gallery_url::append_sid('index', 'mode=personal'), 'ALBUM_NAME' => $user->lang['USERS_PERSONAL_ALBUMS'], 'ALBUM_FOLDER_IMG' => $user->img('forum_read_subforum', 'no'), 'ALBUM_FOLDER_IMG_SRC' => $user->img('forum_read_subforum', 'no', false, '', 'src'), 'SUBALBUMS' => phpbb_gallery::$auth->acl_check('i_upload', phpbb_gallery_auth::OWN_ALBUM) || phpbb_gallery::$user->get_data('personal_album_id') ? '<a href="' . (phpbb_gallery::$user->get_data('personal_album_id') ? phpbb_gallery_url::append_sid('album', 'album_id=' . phpbb_gallery::$user->get_data('personal_album_id')) : phpbb_gallery_url::append_sid('phpbb', 'ucp', 'i=gallery&amp;mode=manage_albums')) . '">' . $user->data['username'] . '</a>' : '', 'ALBUM_DESC' => '', 'L_MODERATORS' => '', 'L_SUBALBUM_STR' => phpbb_gallery::$auth->acl_check('i_upload', phpbb_gallery_auth::OWN_ALBUM) || phpbb_gallery::$user->get_data('personal_album_id') ? $user->lang['YOUR_PERSONAL_ALBUM'] . ': ' : '', 'MODERATORS' => '', 'IMAGES' => $images, 'UNAPPROVED_IMAGES' => phpbb_gallery::$auth->acl_check('m_status', phpbb_gallery_auth::PERSONAL_ALBUM) ? $images_real - $images : '', 'LAST_IMAGE_TIME' => $lastimage_time, 'LAST_USER_FULL' => get_username_string('full', $lastimage_user_id, $lastimage_username, $lastimage_user_colour), 'UC_FAKE_THUMBNAIL' => phpbb_gallery_config::get('mini_thumbnail_disp') ? phpbb_gallery_image::generate_link('fake_thumbnail', phpbb_gallery_config::get('link_thumbnail'), $lastimage_image_id, $lastimage_name, $lastimage_album_id) : '', 'UC_IMAGE_NAME' => phpbb_gallery_image::generate_link('image_name', phpbb_gallery_config::get('link_image_name'), $lastimage_image_id, $lastimage_name, $lastimage_album_id), 'UC_LASTIMAGE_ICON' => phpbb_gallery_image::generate_link('lastimage_icon', phpbb_gallery_config::get('link_image_icon'), $lastimage_image_id, $lastimage_name, $lastimage_album_id)));
        // Assign subforums loop for style authors
        $template->assign_block_vars('albumrow.subalbum', array('U_SUBALBUM' => phpbb_gallery::$auth->acl_check('i_upload', phpbb_gallery_auth::OWN_ALBUM) ? phpbb_gallery::$user->get_data('personal_album_id') ? phpbb_gallery_url::append_sid('album', 'album_id=' . phpbb_gallery::$user->get_data('personal_album_id')) : phpbb_gallery_url::append_sid('phpbb', 'ucp', 'i=gallery&amp;mode=manage_albums') : '', 'SUBALBUM_NAME' => $user->lang['YOUR_PERSONAL_ALBUM']));
    }
}
/**
* Recent images & comments and random images
*/
/**
* int		array	including all relevent numbers for rows, columns and stuff like that,
* display	int		sum of the options which should be displayed, see gallery/includes/constants.php "// Display-options for RRC-Feature" for values
* modes		int		sum of the modes which should be displayed, see gallery/includes/constants.php "// Mode-options for RRC-Feature" for values
* collapse	bool	collapse comments
* include_pgalleries	bool	include personal albums
* mode_id	string	'user' or 'album' to only display images of a certain user or album
* id		int		user_id for user profile or album_id for view of recent and random images