<?php

include 'base.php';
User::protect();
include_class('releases');
include_class('release_tracks');
include_class('m2');
$section = 'releases';
$rt = ReleaseTrack::get($_GET['id']);
if (!db::isError($rt)) {
    $r = $rt->getReleaseObject();
    $ma = $rt->getAVAreaObject();
    switch ($_GET['task']) {
        case 'register_media':
            $res = $rt->registerMedia();
            if (!db::isError($res)) {
                header('Location: release_track_media.php?id=' . $_GET['id']);
            }
            break;
        case 'rescan':
            if (!db::isError($ma)) {
                $res = $ma->rescan($rt);
                if (!db::isError($res)) {
                    header('Location: release_track_media.php?id=' . $_GET['id']);
                }
            }
            break;
        case 'move_up':
            if (!db::isError($ma)) {
                $mi = MediaInstance::get($_GET['media_instance_id']);
                if (!db::isError($mi)) {
 function update($postArray)
 {
     $db = new db();
     if (User::isAdmin()) {
         $title = $db->sanitize_to_db($postArray['title']);
         $number = $db->sanitize_to_db($postArray['number']);
         $length = $db->sanitize_to_db($postArray['length']);
         if ($postArray['length'] != "") {
             $length = $db->sanitize_to_db($postArray['length']);
             $length = "'00:{$length}'";
         } else {
             $length = "null";
         }
         $meta_information = $db->sanitize_to_db($postArray['meta_information']);
         $lyrics = $db->sanitize_to_db($postArray['lyrics']);
         if (!$title) {
             $title = '(untitled track)';
         }
         $r = @mysql_query("update Release_Tracks set title='{$title}', number='{$number}', meta_information = '{$meta_information}', lyrics = '{$lyrics}', length = {$length} where ID = {$this->ID}");
         if (!$r) {
             return Error::MySQL();
         } else {
             return ReleaseTrack::get($this->ID);
         }
     } else {
         return Error::create("You are not allowed to update tracks.");
     }
 }
Example #3
0
if ($_GET['id']) {
    $r = Release::get($_GET['id']);
    if ($_GET['media_instance_id'] > 0) {
        $mi = MediaInstance::get($_GET['media_instance_id']);
        if (!db::isError($mi) && !db::isError($r)) {
            if (($mi->getAreaID() == $r->getAVAreaID() || $mi->getAreaID() == $r->getPhotoAreaID()) && $r->isActive()) {
                $view = 'media';
                $media = new SectionTemplate();
                $media->file = "media_detail.php";
                $media->args['media'] = $mi;
                $media->args['exitURL'] = USE_MOD_REWRITE ? '/releases/' . $r->getID() . '/' : '/releases.php?id=' . $r->getID();
            }
        }
    } else {
        if ($_GET['trackID']) {
            $tr = ReleaseTrack::get($_GET['trackID']);
            if (!db::isError($tr)) {
                if ($tr->getReleaseID() == $r->getID()) {
                    if (USE_MOD_REWRITE) {
                        $releaseLink = '<a href="' . SITE_WEB_DIRECTORY . '/releases/' . $r->getID() . '">Return to release</a>';
                    } else {
                        $releaseLink = '<a href="' . SITE_WEB_DIRECTORY . '/releases.php?id=' . $r->getID() . '">Return to release</a>';
                    }
                    $view = 'track-detail';
                    $detail = new SectionTemplate();
                    $detail->file = "release_track_detail.php";
                    $detail->args['track'] = $tr;
                }
            }
        }
    }
Example #4
0
 function addTrack($postArray)
 {
     $db = new db();
     include_class('text');
     if (User::isAdmin()) {
         $title = $db->sanitize_to_db($postArray['title']);
         $number = $db->sanitize_to_db($postArray['number']);
         if ($postArray['length'] != "") {
             $length = $db->sanitize_to_db($postArray['length']);
             $length = "'00:{$length}'";
         } else {
             $length = "null";
         }
         if (!Text::isRTELoaded('description')) {
             $postArray['lyrics'] = nl2br($postArray['lyrics']);
         }
         if (!Text::isRTELoaded('description')) {
             $postArray['meta_information'] = nl2br($postArray['meta_information']);
         }
         $meta_information = $db->sanitize_to_db($postArray['meta_information']);
         $lyrics = $db->sanitize_to_db($postArray['lyrics']);
         if (!$title) {
             $title = '(untitled track)';
         }
         $r = @mysql_query("insert into Release_Tracks (title, number, meta_information, lyrics, length, release_id) values ('{$title}', '{$number}', '{$meta_information}', '{$lyrics}', {$length}, '{$this->ID}')");
         if (!$r) {
             return Error::MySQL();
         } else {
             $rt = ReleaseTrack::get(mysql_insert_id());
             return $rt;
         }
     } else {
         return Error::create("You are not allowed to add tracks to a release.");
     }
 }