function handle() { $media = MediaInfo::getInfo($this->mid); if (!$media || !$media->isVisible) { throw new VoiceException("No media"); } $playlist = $this->playlistDb->getInfo($this->lid); if (!$playlist) { throw new VoiceException("No playlist"); } if ($playlist->userid != $this->userid) { throw new VoiceException("Mismatch userid"); } $playlist->addMediaId($this->mid); $this->playlistDb->updateInfo($playlist); $this->assign('status', 'ok'); $this->assign('title', $playlist->title); }
function initialize() { $this->checkSession(); $this->assignSession(); if ($_REQUEST['memory']) { $string = $_REQUEST['memory']; $string = str_replace('\\"', '"', $string); /////bug of browzer ? $this->memory = json_decode($string, true); } if ($_REQUEST['program']) { $this->memory = array('program' => $_REQUEST['program']); } if ($_REQUEST['playlist_id']) { $this->memory = array('program' => PlaylistProgram::NAME, 'pid' => $_REQUEST['playlist_id']); return; } if ($_REQUEST['mid']) { $mid = $_REQUEST['mid']; $this->media = MediaInfo::getInfo($mid, array('detail' => true)); return; } }
function initialize() { $path = $_SERVER['PHP_SELF']; $cells = mb_split('/', $path); $filename = array_pop($cells); $key = array_pop($cells); $userid = array_pop($cells); $file = mb_split('\\.', $filename); $mid = $file[0]; $ext = $file[1]; if ($ext != "mp3") { throw new VoiceException(self::ERROR_INVALID_FORMAT); } $_REQUEST[LoginSession::SESSION_USERID] = $userid; $_REQUEST[LoginSession::SESSION_KEY] = $key; if (!LoginSession::get()->check()) { throw new VoiceException(self::ERROR_NO_SESSION); } $this->info = MediaInfo::getInfo($mid); if (!$this->info) { throw new VoiceException(self::ERROR_NO_INFO); } }
function addMedia(&$medias, $vid) { if (!$vid) { throw new VoiceMessageException('NO_MEDIA_INFO'); } $info = MediaInfo::getInfo($vid); if (!$info) { return; } $medias[] = $info; }
function nextInfo() { $playlistInfo = $this->getPlaylistInfo(); $mid = $playlistInfo->getMediaId($this->index + 1); return MediaInfo::getInfo($mid); }