Ejemplo n.º 1
0
$pid = intval($_GET['pid']);
//init
$pa = new PhotoAlbum($aid);
//get details
$info = $pa->getAlbumInfo();
$photos = $pa->getAlbumPhotos();
$photo_info = $pa->getPhotoInfo($pid);
$comments = $pa->getComments($pid, true);
//Set pages/submenu
$_pages[AT_PA_BASENAME . 'albums.php?id=' . $aid]['title'] = _AT('pa_albums') . ' - ' . $info['name'];
$_pages[AT_PA_BASENAME . 'albums.php?id=' . $aid]['parent'] = AT_PA_BASENAME . 'index.php';
$_pages[AT_PA_BASENAME . 'albums.php?id=' . $aid]['children'] = array(AT_PA_BASENAME . 'photo.php');
$_pages[AT_PA_BASENAME . 'photo.php']['parent'] = AT_PA_BASENAME . 'albums.php?id=' . $aid;
//TODO: Validate users, using permission and course album control.
if ($info['member_id'] != $_SESSION['member_id'] && $info['type_id'] != AT_PA_TYPE_PERSONAL) {
    $visible_albums = $pa->getAlbums($_SESSION['member_id'], $info['type_id']);
    if (!isset($visible_albums[$aid]) && $info['permission'] == AT_PA_PRIVATE_ALBUM) {
        //TODO msg;
        $msg->addError("ACCESS_DENIED");
        header('location: index.php');
        exit;
    }
}
if ($pa->checkPhotoPriv($pid, $_SESSION['member_id']) || $pa->checkAlbumPriv($_SESSION['member_id'])) {
    $action_permission = true;
} else {
    $action_permission = false;
}
//run a quick query to get the next and previous id
if (sizeof($photos) > 1) {
    $sql = 'SELECT id, ordering FROM %spa_photos WHERE album_id=%d AND (ordering=%d OR ordering=%d) ORDER BY ordering';
Ejemplo n.º 2
0
{
    $a = strtotime($a['created_date']);
    $b = strtotime($b['created_date']);
    if ($a == $b) {
        return 0;
    }
    return $a < $b ? 1 : -1;
}
global $db, $_base_href;
$record_limit = 3;
//Numero massimo dei possibili sottocontenuti visualizzabili nella home-page
$cnt = 0;
// count number of returned forums
//grab comments and if new course album/photo
$pa = new PhotoAlbum();
if (is_array($pa->getAlbums($_SESSION['member_id'], AT_PA_TYPE_MY_ALBUM))) {
    if (!is_array($visible_albums)) {
        $visible_albums = array();
    }
    $visible_albums = $pa->getAlbums($_SESSION['member_id'], AT_PA_TYPE_MY_ALBUM);
}
if (is_array($pa->getAlbums($_SESSION['member_id'], AT_PA_TYPE_COURSE_ALBUM))) {
    if (!is_array($visible_albums)) {
        $visible_albums = array();
    }
    $visible_albums = array_merge($visible_albums, $pa->getAlbums($_SESSION['member_id'], AT_PA_TYPE_COURSE_ALBUM));
}
//$visible_albums = $pa->getAlbums($_SESSION['member_id'], AT_PA_TYPE_MY_ALBUM);
//$visible_albums = array_merge(array($pa->getAlbums($_SESSION['member_id'], AT_PA_TYPE_COURSE_ALBUM)),
//					$pa->getAlbums($_SESSION['member_id'], AT_PA_TYPE_MY_ALBUM));
//check if there are any albums
Ejemplo n.º 3
0
/* http://atutor.ca													   */
/*																	   */
/* This program is free software. You can redistribute it and/or	   */
/* modify it under the terms of the GNU General Public License		   */
/* as published by the Free Software Foundation.					   */
/***********************************************************************/
// $Id$
define('AT_INCLUDE_PATH', '../../../include/');
require AT_INCLUDE_PATH . 'vitals.inc.php';
include AT_PA_INCLUDE . 'lib.inc.php';
include AT_PA_INCLUDE . 'classes/PhotoAlbum.class.php';
//$_custom_css = $_base_path . AT_PA_BASENAME . 'module.css'; // use a custom stylesheet
//instantiate obj
$pa = new PhotoAlbum();
$type = AT_PA_TYPE_COURSE_ALBUM;
$album_count = sizeof($pa->getAlbums($_SESSION['member_id'], $type));
//paginator settings
$page = intval($_GET['p']);
$last_page = ceil($album_count / AT_PA_ALBUMS_PER_PAGE);
if (!$page || $page < 0) {
    $page = 1;
} elseif ($page > $last_page) {
    $page = $last_page;
}
$count = ($page - 1) * AT_PA_ALBUMS_PER_PAGE + 1;
$offset = ($page - 1) * AT_PA_ALBUMS_PER_PAGE;
$albums = $pa->getAlbums($_SESSION['member_id'], $type, $offset);
include AT_INCLUDE_PATH . 'header.inc.php';
$savant->assign('albums', $albums);
$savant->assign('page', $page);
$savant->assign('type', $type);
Ejemplo n.º 4
0
{
    $a = strtotime($a['created_date']);
    $b = strtotime($b['created_date']);
    if ($a == $b) {
        return 0;
    }
    return $a < $b ? 1 : -1;
}
global $db, $_base_href;
$record_limit = 3;
//Numero massimo dei possibili sottocontenuti visualizzabili nella home-page
$cnt = 0;
// count number of returned forums
//grab comments and if new course album/photo
$pa = new PhotoAlbum();
$visible_albums = array_merge($pa->getAlbums($_SESSION['member_id'], AT_PA_TYPE_COURSE_ALBUM), $pa->getAlbums($_SESSION['member_id'], AT_PA_TYPE_MY_ALBUM));
//check if there are any albums
if (empty($visible_albums)) {
    return 0;
}
foreach ($visible_albums as $album) {
    $album_ids .= $album['id'] . ', ';
}
$album_ids = substr($album_ids, 0, strlen($albums_ids) - 2);
//album comments
$sql = 'SELECT * FROM ' . TABLE_PREFIX . 'pa_album_comments WHERE album_id IN (' . $album_ids . ') ORDER BY created_date DESC';
$result = mysql_query($sql, $db);
while ($row = mysql_fetch_assoc($result)) {
    $all_comments[] = $row;
}
//photo comments