$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}&image_id={$image_id}&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&album_id={$album_id}&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&submode=delete&album_id={$album_id}&image_id={$image_id}") : '', 'U_EDIT' => $s_allowed_edit ? phpbb_gallery_url::append_sid('posting', "mode=image&submode=edit&album_id={$album_id}&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&submode=report&album_id={$album_id}&image_id={$image_id}") : '', 'U_STATUS' => $s_allowed_status ? phpbb_gallery_url::append_sid('mcp', "mode=queue_details&album_id={$album_id}&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}&image_id={$image_id}" . '][img]' . generate_board_url(false) . '/' . phpbb_gallery_url::path('relative') . "image.{$phpEx}?album_id={$album_id}&image_id={$image_id}&mode=thumbnail" . '[/img][/url]' : '', 'IMAGE_URL' => phpbb_gallery_config::get('disp_image_url') ? phpbb_gallery_url::path('full') . "image.{$phpEx}?album_id={$album_id}&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&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&submode=" . ($image_data['favorite_id'] ? 'un' : '') . "favorite&album_id={$album_id}&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&submode=" . ($image_data['watch_id'] ? 'un' : '') . "watch&album_id={$album_id}&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}&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')) {
Beispiel #2
0
 public static function report($mode, $album_id, $album_data)
 {
     global $config, $db, $template, $user;
     $start = request_var('start', 0);
     $sort_key = request_var('sk', 'image_time');
     $sort_dir = request_var('sd', 'DESC') == 'DESC' ? 'DESC' : 'ASC';
     $images_per_page = $config['topics_per_page'];
     $count_images = 0;
     if (!in_array($sort_key, self::$allowed_sort_params)) {
         $sort_key = 'image_time';
     }
     $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 = '';
     }
     if ($mode == 'report_open') {
         $report_status = REPORT_OPEN;
     } else {
         $report_status = REPORT_LOCKED;
     }
     $sql_array = array('SELECT' => 'COUNT(i.image_id) images', 'FROM' => array(GALLERY_REPORTS_TABLE => 'r'), 'LEFT_JOIN' => array(array('FROM' => array(GALLERY_IMAGES_TABLE => 'i'), 'ON' => 'r.report_image_id = i.image_id')), 'WHERE' => "r.report_album_id = {$album_id} AND r.report_status = {$report_status} {$m_status}");
     $sql = $db->sql_build_query('SELECT', $sql_array);
     $result = $db->sql_query($sql);
     $count_images = (int) $db->sql_fetchfield('images');
     $db->sql_freeresult($result);
     $sql_array = array('SELECT' => 'r.*, u.username reporter_name, u.user_colour reporter_colour, m.username mod_username, m.user_colour mod_user_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(USERS_TABLE => 'm'), 'ON' => 'r.report_manager = m.user_id'), array('FROM' => array(GALLERY_IMAGES_TABLE => 'i'), 'ON' => 'r.report_image_id = i.image_id')), 'WHERE' => "r.report_album_id = {$album_id} AND r.report_status = {$report_status} {$m_status}", 'ORDER_BY' => $sort_key . ' ' . $sort_dir);
     $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('THUMBNAIL' => generate_image_link('fake_thumbnail', phpbb_gallery_config::get('link_thumbnail'), $row['image_id'], $row['image_name'], $album_id), 'REPORTER' => get_username_string('full', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']), 'UPLOADER' => get_username_string('full', $row['image_user_id'], $row['image_username'], $row['image_user_colour']), 'REPORT_ID' => $row['report_id'], 'REPORT_MOD' => $row['report_manager'] ? get_username_string('full', $row['report_manager'], $row['mod_username'], $row['mod_user_colour']) : '', 'REPORT_TIME' => $user->format_date($row['report_time']), 'IMAGE_TIME' => $user->format_date($row['image_time']), 'IMAGE_NAME' => $row['image_name'], 'U_IMAGE' => phpbb_gallery_url::append_sid('image', "album_id={$album_id}&amp;image_id=" . $row['image_id']), 'U_IMAGE_PAGE' => phpbb_gallery_url::append_sid('mcp', 'mode=report_details&amp;album_id=' . $album_id . '&amp;option_id=' . $row['report_id'])));
     }
     $db->sql_freeresult($result);
     if ($report_status == REPORT_LOCKED) {
         $desc_string = $user->lang('WAITING_REPORTED_DONE', $count_images);
     } else {
         $desc_string = $user->lang('WAITING_REPORTED_IMAGE', $count_images);
     }
     $template->assign_vars(array('S_SORT_DESC' => $sort_dir == 'DESC' ? true : false, 'S_SORT_KEY' => $sort_key, 'TITLE' => $user->lang['REPORTED_IMAGES'], 'DESCRIPTION' => $desc_string, 'PAGINATION' => generate_pagination(phpbb_gallery_url::append_sid('mcp', "mode={$mode}&amp;album_id={$album_id}&amp;sd={$sort_dir}&amp;sk={$sort_key}"), $count_images, $images_per_page, $start), 'PAGE_NUMBER' => on_page($count_images, $images_per_page, $start), 'TOTAL_IMAGES' => $count_images == 1 ? $user->lang['VIEW_ALBUM_IMAGE'] : sprintf($user->lang['VIEW_ALBUM_IMAGES'], $count_images), 'S_REPORT_LIST' => true, 'S_REPORTER' => true, 'S_MARK' => true));
     $template->assign_vars(array('REPORTED_IMG' => $user->img('icon_topic_reported', 'IMAGE_REPORTED'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'phpbb_gallery_image::STATUS_UNAPPROVED'), 'S_MCP_ACTION' => phpbb_gallery_url::append_sid('mcp', "mode={$mode}&amp;album_id={$album_id}"), 'DISP_FAKE_THUMB' => phpbb_gallery_config::get('mini_thumbnail_disp'), 'FAKE_THUMB_SIZE' => phpbb_gallery_config::get('mini_thumbnail_size')));
 }
Beispiel #3
0
 public static function slideshow($query_result)
 {
     global $db, $user;
     $images = array();
     if (in_array('highslide', self::$plugins)) {
         $trigger_message = $user->lang['SLIDE_SHOW_HIGHSLIDE'];
         while ($row = $db->sql_fetchrow($query_result)) {
             $images[] = generate_image_link('image_name', 'highslide', $row['image_id'], $row['image_name'], $row['image_album_id']);
         }
     } elseif (in_array('shadowbox', self::$plugins)) {
         $trigger_message = $user->lang['SLIDE_SHOW_SHADOWBOX'];
         while ($row = $db->sql_fetchrow($query_result)) {
             $images[] = generate_image_link('image_name', 'shadowbox_slideshow', $row['image_id'], $row['image_name'], $row['image_album_id']);
         }
     } elseif (in_array('lytebox', self::$plugins)) {
         $trigger_message = $user->lang['SLIDE_SHOW_LYTEBOX'];
         while ($row = $db->sql_fetchrow($query_result)) {
             $images[] = generate_image_link('image_name', 'lytebox_slideshow', $row['image_id'], $row['image_name'], $row['image_album_id']);
         }
     } else {
         trigger_error('MISSING_SLIDESHOW_PLUGIN');
     }
     return $trigger_message . '<br /><br />' . implode(', ', $images);
 }