<?
    $GLOBALS
['highlight'] = 'graphix';

    require_once(
'include/functions/image_overall_rating.php');
    require_once(
'include/functions/image_overall_type.php');
    require_once(
'include/functions/image_voting.php');
    require_once(
'include/functions/comments.php');
    
    
$_id = isset($_GET['i']) ? intval($_GET['i']) : 0;

    
$images mysql_query("SELECT * FROM images WHERE id = " sq($_id));
    if (!
$images_row mysql_fetch_array($images))
    {
        echo(
'Sorry, that image could not be found.');
        die;
    }
    
    include(
'include/parts/header.php');
?>
    
<div class="header">
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>
<td><a href="?s=graphix">Graphix</a> - Image [ <?= $_id ?> ]</td>
<td align="right">Uploaded By <?= get_username($images_row['user_id'], 1?> On <?= nice_date($images_row['posted_on']) ?></td>
</tr></table>
</div>

<div class="content" style="padding: 0px 0px 5px 5px;">
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td width="50%" nowrap>
<?
    $previous 
'';
    
$user_images_prev mysql_query("SELECT id FROM images WHERE id < " sq($_id) . " ORDER BY id DESC LIMIT 3");
    for (
$i 1$i <= 3$i++)
    {
        
$user_images_prev_row mysql_fetch_array($user_images_prev);
        
$previous box_image_top(''$user_images_prev_row 0) . ($user_images_prev_row '<a href="?s=image&i=' $user_images_prev_row['id'] . '"><img src="?g=thumb&i=' $user_images_prev_row['id'] . '" width="100" height="75" border="0" style="border: 0px;"></a>' '<img src="?g=thumb&i=0" width="100" height="75" border="0" style="border: 0px;">') . box_image_bottom() . $previous;
    }
    echo 
$previous;
    
    echo 
'</td><td valign="top" nowrap>' "\r\n";

    
$next '';
    
$user_images_next mysql_query("SELECT id FROM images WHERE id > " sq($_id) . " ORDER BY id LIMIT 3");        
    for (
$i 1$i <= 3$i++)
    {
        
$user_images_next_row mysql_fetch_array($user_images_next);
        
$next box_image_top('float: right;'$user_images_next_row 0) . ($user_images_next_row '<a href="?s=image&i=' $user_images_next_row['id'] . '"><img src="?g=thumb&i=' $user_images_next_row['id'] . '" width="100" height="75" border="0" style="border: 0px;"></a>' '<img src="?g=thumb&i=0" width="100" height="75" border="0" style="border: 0px;">') . box_image_bottom() . $next;
    }
    echo 
$next;
?>
</td></tr></table>
</div>

<?
    
echo '<div class="header">';
    
image_voting($_id);
    echo 
'</div>';

    echo 
'<div class="content">';
    echo 
'<center><img src="?g=full&i=' $_id '" width="' $images_row['width'] . '" height="' $images_row['height'] . '" alt=""></center>' "\r\n";
    echo 
'</div>';

    if (
$GLOBALS['auth']['root'])
    {
        echo 
'<div class="header">';
        echo 
'Administration: <a href="?a=image_delete&i=' $_id '&b=' str_replace('&''@'$_SERVER['QUERY_STRING']) . '">Delete Image</a> | <a href="?a=image_rotate&i=' $_id '&degrees=270&b=' str_replace('&''@'$_SERVER['QUERY_STRING']) . '" onclick="return confirmLink(this, \'Rotate image left...\')">Rotate Left</a> | <a href="?a=image_rotate&i=' $_id '&degrees=180&&b=' str_replace('&''@'$_SERVER['QUERY_STRING']) . '" onclick="return confirmLink(this, \'Flip image...\')">Flip</a> | <a href="?a=image_rotate&i=' $_id '&degrees=90&b=' str_replace('&''@'$_SERVER['QUERY_STRING']) . '" onclick="return confirmLink(this, \'Rotate image right...\')">Rotate Right</a>';
        echo 
'</div>';
    }
    
    
comments($_id'images');

    include(
'include/parts/footer.php');
?>