Пример #1
0
# POSSIBILITY OF SUCH DAMAGE.
#
# show_picture.php
# This shows the selected picture, with information about it.
#
header('Pragma: no-cache');
require 'shared.php';
# Make a connection to the database
$db = get_db_read();
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
if (isset($_GET['picture_id']) == false || is_numeric($_GET['picture_id']) == false) {
    show_error_redirect_back("Invalid picture");
}
$picture_id = $_GET['picture_id'];
# Get the current picture
$picture = get_picture_from_picture_id($picture_id, $db) or show_error_redirect_back("Invalid picture");
# Get the category
$category = get_category_by_category_id($picture['category_id'], $db) or show_error_redirect_back("Invalid picture");
# Get the user
$user = get_user_by_user_id($category['user_id'], $db) or show_error_redirect_back("Invalid picture");
# Check if the category is private
if (!$me && $category['private'] == '1') {
    show_error_redirect_back("Invalid picture");
}
# Get the images in the category
$pictures = get_pictures_by_category_id($category['category_id'], $db);
$prev_picture = null;
$next_picture = null;
# Find the next and previous picture
$done = false;
while (!$done && ($this_picture = array_shift($pictures))) {
Пример #2
0
if (isset($_GET['picture_id']) == false || is_numeric($_GET['picture_id']) == false) {
    show_error_image("Couldn't find picture");
}
if (isset($_GET['tn']) && $_GET['tn'] == "true") {
    $tn = true;
} else {
    $tn = false;
}
$picture_id = $_GET['picture_id'];
$db = get_db_read();
# Check if this board requires registration
if (!$me && $require_registration) {
    show_error_image("Login required");
}
# Get the information on the picture
$picture = get_picture_from_picture_id($picture_id, $db);
# Get information ont he category
$category = get_category_by_category_id($picture['category_id'], $db);
# Die if the picture doesn't exist
if (!$picture) {
    show_error_image("Couldn't find picture");
}
# If they aren't logged in, make sure they have access
if (!$me && $category['private'] == '1') {
    if ($category['private'] == 1) {
        show_error_image("Couldn't find picture");
    }
}
$file = $picture['filename'];
if ($tn == true) {
    show_image("{$upload_directory}/tn-{$file}");