コード例 #1
0
ファイル: show_picture.php プロジェクト: shifter/ospap
        $prev_picture = $this_picture;
    }
}
if ($next_picture) {
    $next_picture['url'] = "show_picture.php?picture_id=" . $next_picture['picture_id'];
    $next_picture['picture_url'] = "picture.php?picture_id=" . $next_picture['picture_id'];
    $next_picture['tn_url'] = "picture.php?tn=true&picture_id=" . $next_picture['picture_id'];
}
if ($prev_picture) {
    $prev_picture['url'] = "show_picture.php?picture_id=" . $prev_picture['picture_id'];
    $prev_picture['picture_url'] = "picture.php?picture_id=" . $prev_picture['picture_id'];
    $prev_picture['tn_url'] = "picture.php?tn=true&picture_id=" . $prev_picture['picture_id'];
}
$this_picture['url'] = "show_picture.php?picture_id=" . $picture_id;
$this_picture['picture_url'] = "picture.php?picture_id=" . $picture_id;
$this_picture['tn_url'] = "picture.php?tn=true&picture_id=" . $picture_id;
# Get the list of comments
$comments = get_comments_by_picture_id($picture_id, $db);
$new_comments = array();
while ($current_result = array_shift($comments)) {
    # Get information on the poster
    $current_result['comment_poster'] = get_user_by_user_id($current_result['user_id'], $db);
    array_push($new_comments, $current_result);
}
template_display_picture($me, $user, $category, $picture, $next_picture, $prev_picture, $new_comments, $max_height, $max_width);
?>
	
	
	

コード例 #2
0
ファイル: show_user.php プロジェクト: shifter/ospap
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# show_user.php
# This shows a list of the categories owned by the specified user.  If no
# user is specified, it shows everything.
#
header('Pragma: no-cache');
require 'shared.php';
# Make a connection to the database
$db = get_db_read();
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
# Read the user_id parameter
$user_information = null;
if (isset($_GET['user_id']) && is_numeric($_GET['user_id'])) {
    $user_information = get_user_by_user_id($_GET['user_id'], $db);
}
# Get the userinformation, get the category list and display the header
if ($user_information != null) {
    $categories = get_categories_by_user_id($user_information['user_id'], $me, $db);
} else {
    $categories = get_all_categories($me != null, $db);
}
# Display all the categories
$new_categories = array();
foreach ($categories as $category) {
    $category['num_pictures'] = count(get_pictures_by_category_id($category['category_id'], $db));
    $category['last_updated'] = $me ? $category['last_updated'] : $category['last_updated_public'];
    $category['url'] = "show_category.php?category_id=" . $category['category_id'];
    array_push($new_categories, $category);
}
コード例 #3
0
ファイル: show_category.php プロジェクト: shifter/ospap
# This shows a list of the pictures in a category.  Hopefully, eventually, with
# thumbnails.
#
header('Pragma: no-cache');
require 'shared.php';
$db = get_db_read();
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
if (isset($_GET['category_id']) == false || is_numeric($_GET['category_id']) == false) {
    show_error_redirect_back("No category_id specified");
}
$category_id = $_GET['category_id'];
$category_information = get_category_by_category_id($category_id, $db);
if (!$category_information || !$me && $category_information['private'] != 0) {
    show_error_redirect_back("invalid category_id");
}
$user_information = get_user_by_user_id($category_information['user_id'], $db);
# Check if the category is private
$pictures = get_pictures_by_category_id($category_id, $db);
# Display the table of pictures
$new_pictures = array();
foreach ($pictures as $picture) {
    $picture['url'] = "show_picture.php?picture_id=" . $picture['picture_id'];
    $picture['picture_url'] = "picture.php?picture_id=" . $picture['picture_id'];
    $picture['tn_url'] = "picture.php?tn=true&picture_id=" . $picture['picture_id'];
    $picture['num_comments'] = count(get_comments_by_picture_id($picture['picture_id'], $db));
    array_push($new_pictures, $picture);
}
template_display_picture_list($me, $user_information, $category_information, $new_pictures, $thumbnail_height, $thumbnail_width);
?>