コード例 #1
0
ファイル: delete_album.php プロジェクト: genaromendezl/ATutor
/* 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');
    if ($info['type_id'] == AT_PA_TYPE_COURSE_ALBUM) {
コード例 #2
0
ファイル: lib.inc.php プロジェクト: vicentborja/ATutor
/**
 * 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;
}
コード例 #3
0
ファイル: edit_album.php プロジェクト: genaromendezl/ATutor
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
$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;
コード例 #4
0
ファイル: lib.inc.php プロジェクト: genaromendezl/ATutor
/**
 * 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;
}