static function get($opt = null) { if (!self::$Instance) { self::$Instance = new self($opt); } return self::$Instance; }
function testMakeCheck_fail() { $date = new DateTime(sprintf("-%d min", ShortSession::ALIVE_TIME_MIN + 1)); $key = ShortSession::get()->make($date); $_REQUEST[ShortSession::SESSION_SHORT] = $key; try { $result = ShortSession::get()->check(); } catch (VoiceException $ex) { return; } $this->fail(); }
function handle() { $voice = $this->voiceDb->getInfo($_REQUEST['voice_id']); switch ($this->command) { case 'deleting': if (!$voice) { break; } ShortSession::get()->updateCookie(); $this->voiceDb->getDetail($voice); $this->assign('mode', 'deleting'); $this->assign('target_voice_info', $voice); break; case 'delete': if (!$voice) { break; } ShortSession::get()->check(); $this->voiceFile->delete($voice); $this->voiceDb->delete($voice); break; case 'editing': if (!$voice) { break; } ShortSession::get()->updateCookie(); $this->voiceDb->getDetail($voice); $this->assign('mode', 'editing'); $this->assign('target_voice_info', $voice); break; case 'edit': ShortSession::get()->check(); $this->handleEdit(); break; } $infos = $this->voiceDb->getInfosByUser($this->userid); $this->assignMySize($infos); if (count($infos) > 0) { $paging = new MediaPaging(); $paging->generate($infos, $this->page); $this->assign('paging', $paging); } $this->assignMyInfos($paging->items); }
function handle() { $medias = $this->getMedias(); if ($this->command) { ShortSession::get()->check(); $this->checkOwnPlaylist($this->play); switch ($this->command) { case 'top': $this->topMedia($medias, $this->index); break; case 'up': $this->upMedia($medias, $this->index); break; case 'down': $this->downMedia($medias, $this->index); break; case 'bottom': $this->bottomMedia($medias, $this->index); break; case 'add': $this->addMedia($medias, $this->mid); break; case 'delete': $this->deleteMedia($medias, $this->index); break; } $ids = array(); foreach ($medias as $media) { $ids[] = $media->mediaid; } $this->play->mediaids = $ids; $this->playDb->updateInfo($this->play); } ShortSession::get()->updateCookie(); $this->assign('media_array', $medias); }
function handle() { switch ($_REQUEST['command']) { case 'edit': case 'update': case 'delete': ShortSession::get()->check(); $this->handleEdit($_REQUEST['command']); break; case 'new': ShortSession::get()->check(); $this->handleNew(); $this->assignPlaylistArray(); break; case 'all': default: ShortSession::get()->updateCookie(); $this->assignPlaylistArray(); break; } $this->assign("mode", $this->mode); $this->assign("step", $this->step); $this->assign("playlist_info", $this->info); }