function photos_delete_group($group_id) { $group_id = intval($group_id); $sql = "SELECT album_id FROM %spa_groups WHERE group_id=%d"; $rows_groups = queryDB($sql, array(TABLE_PREFIX, $group_id)); foreach ($rows_groups as $row) { $pa = new PhotoAlbum($row['album_id']); $pa->deleteAlbum(); } $sql = "DELETE FROM %spa_groups WHERE group_id=%d"; $result = queryDB($sql, array(TABLE_PREFIX, $group_id)); }
function photos_delete_group($group_id) { global $db; $group_id = intval($group_id); $sql = "SELECT album_id FROM ".TABLE_PREFIX."pa_groups WHERE group_id=$group_id"; $result = mysql_query($sql, $db); while ($row = mysql_fetch_assoc($result)) { $pa = new PhotoAlbum($row['album_id']); $pa->deleteAlbum(); } $sql = "DELETE FROM ".TABLE_PREFIX."pa_groups WHERE group_id=$group_id"; $result = mysql_query($sql, $db); }
public function getAlbums() { $albums = PhotoAlbum::get()->sort('Created DESC'); if ($albums->Exists()) { return $albums->map("ID", "Name", "Please Select"); } else { return array("No albums found"); } }
function handleEdit($p) { $session = SessionHandler::getInstance(); foreach (UserDataField::getAll() as $f) { if (!empty($p['remove_' . $f->id])) { UserSetting::set($session->id, $f->name, 0); continue; } switch ($f->type) { case UserDataField::IMAGE: if ($p[$f->name]['error'] == UPLOAD_ERR_NO_FILE) { continue; } $album = PhotoAlbum::getProfileAlbumId(); $fileId = File::importImage(USER, $p[$f->name], $album); UserSetting::set($session->id, $f->name, $fileId); break; default: UserSetting::set($session->id, $f->name, $p[$f->name]); } } js_redirect('u/profile'); }
/* 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$ $_user_location = 'public'; define('AT_INCLUDE_PATH', '../../../include/'); require AT_INCLUDE_PATH . 'vitals.inc.php'; include AT_PA_INCLUDE . 'classes/PhotoAlbum.class.php'; include AT_PA_INCLUDE . 'classes/SimpleImage.class.php'; include AT_PA_INCLUDE . 'lib.inc.php'; include AT_PA_INCLUDE . 'classes/AjaxMessage.class.php'; //$_custom_css = $_base_path . AT_PA_BASENAME . 'module.css'; // use a custom stylesheet $_custom_head .= '<script src="' . $_base_path . AT_PA_BASENAME . 'include/ajaxupload.js" type="text/javascript"></script>'; $id = intval($_REQUEST['id']); $pa = new PhotoAlbum($id); $info = $pa->getAlbumInfo(); $action_permission = $pa->checkAlbumPriv($_SESSION['member_id']); //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[$id]) && $info['permission'] == AT_PA_PRIVATE_ALBUM) { //TODO msg; $msg->addError("ACCESS_DENIED"); header('location: index.php'); exit; } } //Set pages/submenu $_pages[AT_PA_BASENAME . 'index.php']['children'] = array(AT_PA_BASENAME . 'albums.php'); $_pages[AT_PA_BASENAME . 'albums.php']['title'] = _AT('pa_albums') . ' - ' . $info['name'];
public function OtherAlbums() { $OtherAlbums = PhotoAlbum::get()->exclude("ID", $this->getAlbum()->ID)->filter("PhotoGalleryID", $this->ID)->limit("10"); $OtherAlbumSet = new ArrayList(); if ($OtherAlbums->exists()) { foreach ($OtherAlbums as $OtherAlbum) { if ($OtherAlbum->getComponents("PhotoItems")->exists() and $OtherAlbum->getComponent("PhotoGallery")->exists() and $OtherAlbum->getComponent("AlbumCover")->exists()) { $OtherAlbumSet->push($OtherAlbum); } } } return $OtherAlbumSet; }
/** * Deletes the photoalbum in database and their thumbnails associated. * Used in /photoalbum/actions/executeRefreshPhotoAlbumCollection * * @param PhotoAlbum $photoalbum_object */ public static function deletePhotoAlbum($photoalbum_object, $user) { $photoalbum_object->delete(); Util::deleteThumbnail($photoalbum_object, $user); }
public function getProfilePhotoAlbum() { $profilePhotoAlbum = PhotoAlbum::model()->findByAttributes(array('user_id' => $this->id, 'type' => PhotoAlbum::TYPE_PROFILE)); return $profilePhotoAlbum; }
/** * Return the total personal data usage (in bytes) */ function memoryUsage($member_id) { global $db; $member_id = intval($member_id); if ($member_id < 1) { return false; } $memory_usage = 0; $sql = "SELECT p.* FROM %spa_photos p LEFT JOIN %spa_course_album ca ON p.album_id=ca.album_id WHERE member_id=%d AND ca.course_id IS NULL"; $rows_photos = queryDB($sql, array(TABLE_PREFIX, TABLE_PREFIX, $member_id)); if (count($rows_photos) > 0) { foreach ($rows_photos as $row) { $pa = new PhotoAlbum($row['album_id']); $album_info = $pa->getAlbumInfo(); $photo_info = $pa->getPhotoInfo($row['id']); $album_file_path = getAlbumFilePath($album_info['id'], $album_info['created_date']); $photo_file_path = getPhotoFilePath($photo_info['id'], $photo_info['name'], $photo_info['created_date']); $file = AT_PA_CONTENT_DIR . $album_file_path . DIRECTORY_SEPARATOR . $photo_file_path; if (file_exists($file)) { $memory_usage += filesize($file); } } } return $memory_usage; }
<?php //init $pa = new PhotoAlbum(); ?> <div class="paginator"> <?php print_paginator($this->page, $this->num_rows, 'id=' . $this->album_info['id'], AT_PA_ADMIN_ALBUMS_PER_PAGE, AT_PA_PAGE_WINDOW); ?> </div> <div> <form action="" method="post" name="form"> <table class="data" rules="cols"> <thead> <tr> <th> </th> <th><?php echo _AT('pa_album_name'); ?> </th> <th><?php echo _AT('pa_album_type'); ?> </th> <th><?php echo _AT('pa_album_description'); ?> </th> <th><?php echo _AT('created_by');
/* Inclusive Design Institute */ /* 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$ $_user_location = 'public'; 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(); $keywords = explode(' ', trim($_POST['pa_search'])); $search_results = $pa->search($keywords); $album_count = sizeof($pa->getSharedAlbums(true)); //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->getSharedAlbums(true, $offset); include AT_INCLUDE_PATH . 'header.inc.php';
function cmp($a, $b) { $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));
<?php print_paginator($this->page, $this->num_rows, 'type=' . $this->type, AT_PA_ALBUMS_PER_PAGE, AT_PA_PAGE_WINDOW); ?> </div> <?php } ?> </div> <!-- loop through this --> <?php if (!empty($this->albums)) { ?> <?php foreach ($this->albums as $index => $row) { $pa = new PhotoAlbum($index); ?> <div class="album"> <!-- TODO: If photo is not presense, print another image? --> <div class="image"> <?php $photo_info = $pa->getPhotoInfo($row['photo_id']); if (!empty($photo_info)) { ?> <a href="<?php echo AT_PA_BASENAME . 'albums.php?id=' . $row['id']; ?> "><img src="<?php echo AT_PA_BASENAME . 'get_photo.php?aid=' . $row['id'] . SEP . 'pid=' . $row['photo_id'] . SEP . 'ph=' . getPhotoFilePath($photo_info['id'], '', $photo_info['created_date']); ?> " title="<?php
if ($photo_set_profile) { include AT_PA_INCLUDE . 'lib.inc.php'; include AT_PA_INCLUDE . 'classes/PhotoAlbum.class.php'; //run a check to see if any personal album exists, if not, create one. $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'pa_albums WHERE member_id=' . $_SESSION['member_id'] . ' AND type_id=' . AT_PA_TYPE_PERSONAL; $result = mysql_query($sql, $db); if ($result) { //precondition: Profile Album always exists. $row = mysql_fetch_assoc($result); //album info. $profile_aid = $row['id']; //current profile album id } $pa_profile = new PhotoAlbum($profile_aid); // album id of the GET requests (via set profile picture link) $pa = new PhotoAlbum($aid); $album_info = $pa->getAlbumInfo(); $photo_info = $pa->getPhotoInfo($pid); //Validate users, using permission and course album control. $visible_albums = $pa->getAlbums($_SESSION['member_id'], $photo_info['type_id']); if (!isset($visible_albums[$aid]) && $album_info['permission'] == AT_PA_PRIVATE_ALBUM) { //TODO msg; $msg->addError("ACCESS_DENIED"); header('location: index.php'); exit; } // get the current photo info, and paths $album_file_path = getAlbumFilePath($album_info['id'], $album_info['created_date']); $album_file_path_tn = $album_file_path . '_tn' . DIRECTORY_SEPARATOR; $album_file_path .= DIRECTORY_SEPARATOR; $photo_file_path = getPhotoFilePath($photo_info['id'], $photo_info['name'], $photo_info['created_date']);
function cmp($a, $b) { $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; }
require AT_INCLUDE_PATH . 'vitals.inc.php'; require AT_INCLUDE_PATH . 'lib/mime.inc.php'; include AT_PA_INCLUDE . 'classes/PhotoAlbum.class.php'; include AT_PA_INCLUDE . 'lib.inc.php'; $aid = intval($_GET['aid']); //album id $pid = intval($_GET['pid']); //photo id $ph = $_GET['ph']; //pid hash //To increase security so users can't freely browse thru the album, //add a block here to take in an extra $_GET variable that reads the pid_path //check it against the PhotoFilePath here and see if it matches. //if not, return a "File not found" image. //TODO $pa = new PhotoAlbum($aid); $album_info = $pa->getAlbumInfo(); $photo_info = $pa->getPhotoInfo($pid); $album_file_path = getAlbumFilePath($album_info['id'], $album_info['created_date']); if (isset($_GET['size']) && $_GET['size'] == 'o') { //if original $album_file_path .= DIRECTORY_SEPARATOR; } else { //if thumbnail $album_file_path .= '_tn' . DIRECTORY_SEPARATOR; } $photo_file_path = getPhotoFilePath($photo_info['id'], $photo_info['name'], $photo_info['created_date']); $photo_file_hash = getPhotoFilePath($photo_info['id'], '', $photo_info['created_date']); $file = AT_PA_CONTENT_DIR . $album_file_path . $photo_file_path; //if file does not exist, quit. if (!file_exists($file)) {
define('AT_INCLUDE_PATH', '../../../include/'); require AT_INCLUDE_PATH . 'vitals.inc.php'; include AT_PA_INCLUDE . 'classes/PhotoAlbum.class.php'; //validates if this is me/have the privilege to delete. $pid = intval($_REQUEST['pid']); $aid = intval($_REQUEST['aid']); $comment_id = intval($_REQUEST['comment_id']); //_pages $_pages[AT_PA_BASENAME . 'albums.php?id=' . $aid]['title'] = _AT('pa_albums'); $_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?pid=' . $pid . SEP . 'aid=' . $aid]['title'] = _AT('pa_photo'); $_pages[AT_PA_BASENAME . 'photo.php?pid=' . $pid . SEP . 'aid=' . $aid]['parent'] = AT_PA_BASENAME . 'albums.php?id=' . $aid; $_pages[AT_PA_BASENAME . 'delete_comment.php']['parent'] = AT_PA_BASENAME . 'photo.php?pid=' . $pid . SEP . 'aid=' . $aid; //init $pa = new PhotoAlbum($aid); if ($pid == 0) { //not a photo $isPhoto = false; } else { $isPhoto = true; } //Check permission //owner of comments and album owner can delete comments. if (!$pa->checkCommentPriv($comment_id, $_SESSION['member_id'], $isPhoto) && !$pa->checkAlbumPriv($_SESSION['member_id'])) { $msg->addError('ACCESS_DENIED'); header('Location: index.php'); exit; } if ($_POST['submit_no']) { $msg->addFeedback('CANCELLED');
$pid = intval($_POST['pid']); $aid = intval($_POST['aid']); if (isset($_POST['pid']) && $pid > 0) { $isPhoto = true; $id = $pid; } else { $isPhoto = false; $id = $aid; } //Error checking if (trim($_POST['comment']) == '') { //if comment is empty $msg->addError('PA_EMPTY_COMMENT'); //sql } else { $pa = new PhotoAlbum(); $result = $pa->addComment($id, $_POST['comment'], $_SESSION['member_id'], $isPhoto); if ($result) { //TODO: AJAX $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); } else { $msg->addError('PA_ADD_COMMENT_FAILED'); //sql } } if ($isPhoto) { header('Location: photo.php?pid=' . $pid . SEP . 'aid=' . $aid); } else { header('Location: albums.php?id=' . $aid); } exit;
// $Id$ $_user_location = 'public'; define('AT_INCLUDE_PATH', '../../../include/'); require AT_INCLUDE_PATH . 'vitals.inc.php'; include AT_PA_INCLUDE . 'classes/PhotoAlbum.class.php'; include AT_PA_INCLUDE . 'lib.inc.php'; $aid = intval($_GET['aid']); $pid = intval($_GET['pid']); if (isset($_POST['aid'])) { $aid = intval($_POST['aid']); } if (isset($_POST['pid'])) { $pid = intval($_POST['pid']); } //initialization $pa = new PhotoAlbum($aid); //validation if (!($pa->checkPhotoPriv($pid, $_SESSION['member_id']) || $pa->checkAlbumPriv($_SESSION['member_id']))) { $msg->addError("ACCESS_DENIED"); header('location: index.php'); exit; } //get details if ($pid > 0) { //get only 1 photo $photos = array($pa->getPhotoInfo($pid)); } else { $photos = $pa->getAlbumPhotos(); } $album_info = $pa->getAlbumInfo(); $isadmin = FALSE;
$aid = intval($_REQUEST['id']); $pa = new PhotoAlbum($aid); if (!$pa->checkAlbumPriv($_SESSION['member_id'])) { $msg->addError('ACCESS_DENIED'); header('location: index.php'); exit; } //Set pages/submenu if (admin_authenticate(AT_ADMIN_PRIV_PHOTO_ALBUM, true)) { //this is admin $_pages[AT_PA_BASENAME . 'edit_album.php']['parent'] = AT_PA_BASENAME . 'index_admin.php'; } $album_info = $pa->getAlbumInfo(); //handle Edit album info. if (isset($_POST['submit'])) { $pa = new PhotoAlbum($_POST['aid']); //new object if (isset($_POST['album_type'])) { $album_type = intval($_POST['album_type']) == AT_PA_TYPE_MY_ALBUM ? AT_PA_TYPE_MY_ALBUM : AT_PA_TYPE_COURSE_ALBUM; } else { //default is "my album" 'cause normally user can't create course album. $album_type = AT_PA_TYPE_MY_ALBUM; } //private or shared album? if (isset($_POST['album_permission'])) { $album_permission = $_POST['album_permission'] == AT_PA_SHARED_ALBUM ? AT_PA_SHARED_ALBUM : AT_PA_PRIVATE_ALBUM; } else { $album_permission = AT_PA_PRIVATE_ALBUM; } if (isset($_POST['album_name']) && $_POST['album_name'] != '') { //TODO: photo_id = 0, should default to use the first one after multi-file uploader works
$result = mysql_query($sql, $db); if ($result){ $rows = mysql_num_rows($result); if ($rows==0){ //create one. $pa = new PhotoAlbum(); $result = $pa->createAlbum(_AT('pa_profile_album'), '', '', AT_PA_TYPE_PERSONAL, AT_PA_PRIVATE_ALBUM, $_SESSION['member_id']); $id = mysql_insert_id(); } else { $row = mysql_fetch_assoc($result); //album info. $id = $row['id']; } } //instantiate obj $pa = new PhotoAlbum($id); $info = $pa->getAlbumInfo(); //paginator settings $page = intval($_GET['p']); $photos_count = sizeof($pa->getAlbumPhotos()); $last_page = ceil($photos_count/AT_PA_PHOTOS_PER_PAGE); if (!$page || $page < 0) { $page = 1; } elseif ($page > $last_page){ $page = $last_page; } $count = (($page-1) * AT_PA_PHOTOS_PER_PAGE) + 1; $offset = ($page-1) * AT_PA_PHOTOS_PER_PAGE;
/* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation. */ /***********************************************************************/ // $Id$ $_user_location = 'public'; define('AT_INCLUDE_PATH', '../../../include/'); require AT_INCLUDE_PATH . 'vitals.inc.php'; include AT_INCLUDE_PATH . '../mods/_core/file_manager/filemanager.inc.php'; //clr_dir() //include (AT_INCLUDE_PATH.'lib/filemanager.inc.php'); //clr_dir() include AT_PA_INCLUDE . 'lib.inc.php'; //album_filepath include AT_PA_INCLUDE . 'classes/PhotoAlbum.class.php'; //validates if this is me/have the privilege to delete. $id = intval($_REQUEST['id']); $pa = new PhotoAlbum($id); $info = $pa->getAlbumInfo(); if (!$pa->checkAlbumPriv($_SESSION['member_id'])) { $msg->addError('ACCESS_DENIED'); header('Location: index.php'); exit; } if ($_POST['submit_no']) { $msg->addFeedback('CANCELLED'); Header('Location: index.php'); exit; } if ($_POST['submit_yes']) { //delete $pa->deleteAlbum(); $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
/* Copyright (c) 2002-2010 */ /* Inclusive Design Institute */ /* 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);
/* Copyright (c) 2002-2010 */ /* Inclusive Design Institute */ /* 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(); $album_count = sizeof($pa->getSharedAlbums(true)); //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->getSharedAlbums(true, $offset); include AT_INCLUDE_PATH . 'header.inc.php'; $savant->assign('albums', $albums); $savant->assign('isSharedAlbum', true);
/* 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$ $_user_location = 'public'; define('AT_INCLUDE_PATH', '../../../include/'); require AT_INCLUDE_PATH . 'vitals.inc.php'; include AT_PA_INCLUDE . 'classes/PhotoAlbum.class.php'; include AT_PA_INCLUDE . 'lib.inc.php'; //$_custom_css = $_base_path . AT_PA_BASENAME . 'module.css'; // use a custom stylesheet $_custom_head .= '<script type="text/javascript" src="' . AT_PA_BASENAME . 'include/imageReorderer.js"></script>'; $aid = intval($_GET['aid']); $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;
<?php //init $pa = new PhotoAlbum(); ?> <div class="paginator"> <?php print_paginator($this->page, $this->num_rows, 'id='.$this->album_info['id'], AT_PA_ADMIN_ALBUMS_PER_PAGE, AT_PA_PAGE_WINDOW); ?> </div> <div> <form action="" method="post" name="form"> <table class="data" rules="cols"> <thead> <tr> <th> </th> <th><?php echo _AT('pa_album_name'); ?></th> <th><?php echo _AT('pa_album_type'); ?></th> <th><?php echo _AT('pa_album_description'); ?></th> <th><?php echo _AT('created_by'); ?></th> <th><?php echo _AT('pa_last_updated'); ?></th> </tr> </thead> <tbody> <?php if(!empty($this->albums)): ?> <?php foreach ($this->albums as $aid=>$row): ?> <tr id="r_<?php echo $aid; ?>" onmousedown="jQuery('#album_<?php echo $aid; ?>').attr('checked', true); rowselect(this);"> <td><input type="radio" id="album_<?php echo $aid; ?>" name="aid" value="<?php echo $aid; ?>" /></td> <td><a href="<?php echo AT_PA_BASENAME."admin/edit_photos.php?aid=$aid"; ?>"><?php echo AT_print($row['name'], 'input.text'); ?></a></td> <td><?php echo $pa->getAlbumTypeName($row['type_id']); ?></td> <td><?php echo AT_print($row['description'], 'photo_albums.description'); ?></td> <td><?php echo AT_print(get_display_name($row['member_id']), 'members.full_name'); ?></td> <td><?php echo AT_date(_AT('forum_date_format'), $row['last_updated'], AT_DATE_MYSQL_DATETIME); ?></td>
/* as published by the Free Software Foundation. */ /***********************************************************************/ // $Id$ $_user_location = 'public'; define('AT_INCLUDE_PATH', '../../../include/'); require AT_INCLUDE_PATH . 'vitals.inc.php'; include AT_PA_INCLUDE . 'classes/PhotoAlbum.class.php'; //$_custom_css = $_base_path . AT_PA_BASENAME . 'module.css'; // use a custom stylesheet //quit if this is not a member if (!(isset($_SESSION['member_id']) && $_SESSION['member_id'] > 0)) { $msg->addError('ACCESS_DENIED'); header('Location: index.php'); exit; } //instantiate obj $pa = new PhotoAlbum(); //handles submit if (isset($_POST['submit'])) { //TODO: Check if the user have permission to add a course album // TA and Instructors can if (isset($_POST['album_type'])) { $album_type = intval($_POST['album_type']) == AT_PA_TYPE_MY_ALBUM ? AT_PA_TYPE_MY_ALBUM : AT_PA_TYPE_COURSE_ALBUM; } else { //default is "my album" 'cause normally user can't create course album. $album_type = AT_PA_TYPE_MY_ALBUM; } //private or shared album? if (isset($_POST['album_permission'])) { $album_permission = $_POST['album_permission'] == AT_PA_SHARED_ALBUM ? AT_PA_SHARED_ALBUM : AT_PA_PRIVATE_ALBUM; } else { $album_permission = AT_PA_PRIVATE_ALBUM;
/* 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_INCLUDE_PATH . '../mods/_core/file_manager/filemanager.inc.php'; //clr_dir() //include (AT_INCLUDE_PATH.'lib/filemanager.inc.php'); //clr_dir() 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 admin_authenticate(AT_ADMIN_PRIV_PHOTO_ALBUM); //init $aid = intval($_REQUEST['aid']); $pa = new PhotoAlbum($aid); //handle edit/delete if (isset($_POST['edit'])) { //open up the edit page header('Location: admin/edit_album.php?id=' . $aid); } elseif (isset($_POST['delete'])) { //handle confirmation if ($_POST['submit_no']) { $msg->addFeedback('CANCELLED'); Header('Location: index_admin.php'); exit; } if ($_POST['submit_yes']) { //delete $pa->deleteAlbum(); $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
function handleNew($p) { $session = SessionHandler::getInstance(); $o = new PhotoAlbum(); $o->owner = $session->id; $o->name = $p['name']; $o->time_created = sql_datetime(time()); if ($session->isSuperAdmin && $p['system']) { $o->owner = 0; } // create a system wide album $o->id = $o->store(); js_redirect('u/album/show/' . $session->id . '/' . $o->id); }
/** * Return the total personal data usage (in bytes) */ function memoryUsage($member_id) { global $db; $member_id = intval($member_id); if ($member_id < 1) { return false; } $memory_usage = 0; $sql = 'SELECT p.* FROM ' . TABLE_PREFIX . 'pa_photos p LEFT JOIN ' . TABLE_PREFIX . "pa_course_album ca ON p.album_id=ca.album_id WHERE member_id={$member_id} AND ca.course_id IS NULL"; $result = mysql_query($sql, $db); if ($result) { while ($row = mysql_fetch_assoc($result)) { $pa = new PhotoAlbum($row['album_id']); $album_info = $pa->getAlbumInfo(); $photo_info = $pa->getPhotoInfo($row['id']); $album_file_path = getAlbumFilePath($album_info['id'], $album_info['created_date']); $photo_file_path = getPhotoFilePath($photo_info['id'], $photo_info['name'], $photo_info['created_date']); $file = AT_PA_CONTENT_DIR . $album_file_path . DIRECTORY_SEPARATOR . $photo_file_path; if (file_exists($file)) { $memory_usage += filesize($file); } } } return $memory_usage; }