include_class('tours'); include_class('m2'); // type is only used on initial entry, not on an actual submit $to = Tour::get($_GET['id']); if (!db::isError($to)) { $doSubmit = false; if (!$_POST['area']) { $type = $_REQUEST['type'] == 'av' ? 'av' : 'photos'; $ma = $type == 'av' ? $to->getAVAreaObject() : $to->getPhotoAreaObject(); } else { if ($_POST['area'] == $to->getAVAreaID() || $_POST['area'] == $to->getPhotoAreaID()) { $doSubmit = true; } } if ($doSubmit) { $ma = MediaArea::get($_POST['area']); if (!db::isError($ma)) { if ($_POST['localfile']) { $res = $ma->addMediaUpload('mediafile', $to); } else { if ($_POST['url']) { $res = $ma->addMediaRemote($_POST['url'], $to); } else { if ($_POST['toAdd'] == 'all') { $keepCopy = $_POST['copyFromIncoming'] ? 1 : 0; $res = $ma->addAllMediaIncoming($keepCopy, $to); } else { if ($_POST['incoming_file']) { $keepCopy = $_POST['copyFromIncoming'] ? 1 : 0; $res = $ma->addMediaIncoming($_POST['incoming_file'], $keepCopy, $to); }
function registerMedia($mediaType) { $type = $mediaType == 'av' ? 'av' : 'photos'; if (User::isAdmin()) { if ($type == 'av' && $this->av_area_id < 1 || $type == 'photos' && $this->photo_area_id < 1) { $areaTitle = $type == 'av' ? "Show Audio/Video: " : "Show Photos: "; $areaIDField = $type == 'av' ? "av_area_id" : "photo_area_id"; if ($type == 'av') { $allowed_extensions = MEDIA_EXTENSIONS_ALLOWED_AV; $display = "list"; } else { $allowed_extensions = MEDIA_EXTENSIONS_ALLOWED_PHOTO; $display = "grid"; } $ma = MediaArea::add(0, $areaTitle . $this->name, null, $allowed_extensions, $display); if (db::isError($ma)) { return $ma; } $ma->activate(); $q = "update Shows set {$areaIDField} = " . $ma->getID() . " where ID = {$this->ID}"; $r = mysql_query($q); if (!$r) { return Error::MySQL(); } else { return $r; } } else { return Error::create("A show with an ID of {$this->ID} is already registered."); } } else { return Error::create('Only an admin user may authorize a show for media.'); } }
<?php include 'base.php'; User::protect(); include_class('general_media'); include_class('m2'); $id = $_GET['id'] > 0 && is_numeric($_GET['id']) ? $_GET['id'] : 0; $gm = new GeneralMedia(); if ($id != 0) { $ma = MediaArea::get($id); if (!db::isError($ma)) { $gm->setAreaObject($ma); $isNotGeneralMedia = !$ma->isGeneralMedia(); } } if ($_POST['submit'] && !db::isError($ma)) { $res = $ma->updateInformation($_POST, $gm); if (!db::isError($res)) { header('Location: media.php?id=' . $ma->getID()); exit; } } $editors = array('description'); $section = 'media'; $page_title = 'Edit Media Area'; include 'layout/header.php'; if ($isNotGeneralMedia) { Error::outputDialog('Return to Media', 'media.php', 'You may only edit general media here. Any media that has been added to a specific band member, show or release must be edited in its appropriate section.'); } else { if (!db::isError($ma)) { ?>
<?php include 'base.php'; User::protect(); include_class('general_media'); include_class('m2'); $media = new Media(); $ma = MediaArea::get($_REQUEST['id']); if ($_GET['task'] == 'update' && !db::isError($ma)) { $res = $ma->updatePreferences($_POST); if (!db::isError($res)) { header('Location: media_preferences.php?id=' . $_GET['id']); } } $page_title = 'Media Preferences'; $stylesheet = 'popup.css'; include 'layout/header_popup.php'; if (!db::isError($ma)) { if (User::isAdmin()) { if ($_GET['task'] == 'edit') { ?> <h1>edit media area</h1> <div class="inset"> <form id="edit_entry" action="<?php echo $PHP_SELF; ?> ?task=update&id=<?php echo $_GET['id']; ?> " method="post">
$breadcrumb = array(); $trail = $ma->getAreaTrail(); if ($trail) { foreach ($trail as $maBC) { $mediaArea = new SectionTemplate(); $mediaArea->file = "media_breadcrumb.php"; $mediaArea->args['activeArea'] = $ma; $mediaArea->args['area'] = $maBC; $breadcrumb[] = $mediaArea; } } else { unset($breadcrumb); } } if (!$ma) { $areaList = MediaArea::getGeneralAreas(1); $title = "Rich Media"; } else { $media = new SectionTemplate(); $media->file = $ma->getDisplay() == 'grid' ? "gallery.php" : "media_list.php"; $media->args['area'] =& $ma; if (USE_MOD_REWRITE) { $media->args['url'] = '/gm/' . $ma->getID() . '/'; } else { $media->args['url'] = SITE_WEB_DIRECTORY . '/media.php?id=' . $ma->getID(); } } $areas = array(); if (count($areaList) > 0) { foreach ($areaList as $a) { $areaT = new SectionTemplate();
} ?> </div> <?php } if (db::isError($res)) { $res->outputList(); } if (User::isAdmin()) { if (!db::isError($ma)) { ?> <h1>areas:</h1> <?php $areas = isset($maAdd) && !db::isError($maAdd) ? $maAdd->getAreas() : MediaArea::getAreas(); if ($areas) { ?> <ul class="sub-list"> <?php foreach ($areas as $a) { ?> <li><b><a href="<?php echo $PHP_SELF; ?> ?area=<?php echo $a->getID(); ?> &id=<?php echo $ma->getID(); ?>
function moveDown($filterObj = null) { if ($filterObj) { $proceed = $filterObj->validateMediaOperation("MOVEDOWN"); if (db::isError($proceed)) { return $proceed; } } $a = MediaArea::get($this->area_id); if (!db::isError($a)) { $a->updateDisplayOrder(); } $q = "select display_order from DarkRoom_Media_to_Areas where ID = {$this->ID}"; $r = mysql_query($q); if (!$r) { return Error::MySQL(); } $row = mysql_fetch_assoc($r); if ($row['display_order']) { $this->display_order = $row['display_order']; } $newDO = $this->display_order + 1; $r1 = mysql_query("update DarkRoom_Media_to_Areas set display_order = {$this->display_order} where display_order = {$newDO} and area_id = {$this->area_id}"); $r2 = mysql_query("\tupdate DarkRoom_Media_to_Areas set display_order = {$newDO} where ID = {$this->ID}"); if ($r1 && $r2) { return true; } else { $e = new Error(); $e->add(mysql_error()); return $e; } }
$gm = new GeneralMedia(); if ($id != 0) { $ma = MediaArea::get($id); if (!db::isError($ma)) { $isNotGeneralMedia = !$ma->isGeneralMedia(); } } if ($_POST['submit'] && !db::isError($ma)) { $displayType = $_POST['mediaType'] == 'av' ? 'list' : 'grid'; if (!$_POST['title']) { $title = '(untitled area)'; } else { $title = $_POST['title']; } $allowed = $_POST['mediaType'] == 'av' ? MEDIA_EXTENSIONS_ALLOWED_AV : MEDIA_EXTENSIONS_ALLOWED_PHOTO; $res = $ma ? $ma->add(1, $title, $_POST['description'], $allowed, $displayType) : MediaArea::add(1, $title, $_POST['description'], $allowed, $displayType); if (!db::isError($res)) { header('Location: media.php?id=' . $res->getID()); } } $editors = array('description'); $section = 'media'; $page_title = 'Add Media Area'; include 'layout/header.php'; ?> <div id="breadcrumb"> <a href="index.php">Audition ></a> <a href="media.php">Media ></a> <?php if (is_object($ma)) { $breadcrumb = $ma->getAreaTrail();
function registerMedia($mediaType) { $type = $mediaType == 'av' ? 'av' : 'photos'; $e = new Error(); if (User::isAdmin()) { if ($type == 'av' && $this->av_area_id < 1 || $type == 'photos' && $this->photo_area_id < 1) { $areaTitle = $type == 'av' ? "Band Member Audio/Video: " : "Band Member Photos: "; $areaIDField = $type == 'av' ? "av_area_id" : "photo_area_id"; if ($type == 'av') { $allowed_extensions = MEDIA_EXTENSIONS_ALLOWED_AV; $display = "list"; } else { $allowed_extensions = MEDIA_EXTENSIONS_ALLOWED_PHOTO; $display = "grid"; } $uo = $this->getUserObject(); $ma = MediaArea::add(0, $areaTitle . $uo->getFirstName() . ' ' . $uo->getLastName(), null, $allowed_extensions, $display); $ma->activate(); $q = "update Band_Members set {$areaIDField} = " . $ma->getID() . " where ID = {$this->ID}"; $r = mysql_query($q); if (!$r) { $e->add(mysql_error()); return $e; } else { return $r; } } else { $e->add("A band member with an ID of {$this->ID} is already registered."); } } else { $e->add('Only an admin user may authorize a member for media.'); return $e; } }
<?php if (db::isError($res)) { $res->outputList(); } ?> <h1>sub-areas:</h1> <div class="inset"> <?php if (User::isAdmin()) { ?> <a href="media_area_add.php">Add Area</a> <?php } $mas = MediaArea::getGeneralAreas(); if ($mas) { ?> <ul> <?php foreach ($mas as $a) { ?> <li><b><a href="<?php echo $PHP_SELF; ?> ?id=<?php echo $a->getID(); ?> "><?php echo $a->getTitle(); ?>
function registerMedia() { if (User::isAdmin()) { if ($this->av_area_id < 1) { $areaTitle = "Track Audio/Video: "; $allowed_extensions = MEDIA_EXTENSIONS_ALLOWED_AV; $display = "list"; $ma = MediaArea::add(0, $areaTitle . $this->title, null, $allowed_extensions, $display); if (db::isError($ma)) { return $ma; } $ma->activate(); $q = "update Release_Tracks set av_area_id = " . $ma->getID() . " where ID = {$this->ID}"; $r = mysql_query($q); if (!$r) { return Error::MySQL(); } else { return $r; } return $r; } else { return Error::create("A track with an ID of {$this->ID} is already registered."); } } else { return Error::create('Only an admin user may authorize a track for media.'); } }