Ejemplo n.º 1
0
 public function edit(array $params)
 {
     if (!isset($params['id']) || !($id = (int) $params['id'])) {
         throw new Redirect404Exception();
         return;
     }
     $clip = $this->clipService->findClipById($id);
     if (!$clip) {
         throw new Redirect404Exception();
     }
     $language = OW_Language::getInstance();
     // is moderator
     $modPermissions = OW::getUser()->isAuthorized('vwls');
     $this->assign('moderatorMode', $modPermissions);
     $contentOwner = (int) $this->clipService->findClipOwner($id);
     $userId = OW::getUser()->getId();
     $ownerMode = $contentOwner == $userId;
     $this->assign('ownerMode', $ownerMode);
     if (!$ownerMode && !$modPermissions) {
         $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCtrlViewDir() . 'authorization_failed.html');
         return;
     }
     $videoEditForm = new vwlsEditForm($clip->id);
     $this->addForm($videoEditForm);
     $videoEditForm->getElement('id')->setValue($clip->id);
     $videoEditForm->getElement('room_name')->setValue($clip->title);
     $videoEditForm->getElement('description')->setValue($clip->description);
     $videoEditForm->getElement('room_limit')->setValue($clip->roomLimit);
     $videoEditForm->getElement('user_list')->setValue($clip->user_list);
     $videoEditForm->getElement('moderator_list')->setValue($clip->moderator_list);
     $videoEditForm->getElement('welcome')->setValue($clip->welcome);
     $resolution = $clip->camWidth . "x" . $clip->camHeight;
     $videoEditForm->getElement('resolution')->setValue($resolution);
     $videoEditForm->getElement('camera_fps')->setValue($clip->camFPS);
     $videoEditForm->getElement('microphone_rate')->setValue($clip->micRate);
     $videoEditForm->getElement('soundQuality')->setValue($clip->soundQuality);
     $videoEditForm->getElement('bandwidth')->setValue($clip->camBandwidth);
     $videoEditForm->getElement('flood_protection')->setValue($clip->floodProtection);
     $videoEditForm->getElement('label_color')->setValue($clip->labelColor);
     $videoEditForm->getElement('welcome2')->setValue($clip->welcome2);
     $videoEditForm->getElement('offline_message')->setValue($clip->offlineMessage);
     $videoEditForm->getElement('flood_protection2')->setValue($clip->floodProtection2);
     $videoEditForm->getElement('filter_regex')->setValue($clip->filterRegex);
     $videoEditForm->getElement('filter_replace')->setValue($clip->filterReplace);
     $videoEditForm->getElement('layout_code')->setValue($clip->layoutCode);
     $permissions = $clip->permission;
     $permission = explode("|", $permissions);
     $videoEditForm->getElement('show_camera_settings')->setValue($permission[0]);
     $videoEditForm->getElement('advanced_camera_settings')->setValue($permission[1]);
     $videoEditForm->getElement('configure_source')->setValue($permission[2]);
     $videoEditForm->getElement('only_video')->setValue($permission[3]);
     $videoEditForm->getElement('no_video')->setValue($permission[4]);
     $videoEditForm->getElement('no_embeds')->setValue($permission[5]);
     $videoEditForm->getElement('show_timer')->setValue($permission[6]);
     $videoEditForm->getElement('write_text')->setValue($permission[7]);
     $videoEditForm->getElement('private_textchat')->setValue($permission[8]);
     $videoEditForm->getElement('fill_window')->setValue($permission[9]);
     $videoEditForm->getElement('write_text2')->setValue($permission[10]);
     $videoEditForm->getElement('enable_video')->setValue($permission[11]);
     $videoEditForm->getElement('enable_chat')->setValue($permission[12]);
     $videoEditForm->getElement('enable_users')->setValue($permission[13]);
     $videoEditForm->getElement('fill_window2')->setValue($permission[14]);
     $videoEditForm->getElement('verbose_level')->setValue($permission[15]);
     if (OW::getRequest()->isPost() && $videoEditForm->isValid($_POST)) {
         $res = $videoEditForm->process();
         OW::getFeedback()->info($language->text('vwls', 'clip_updated'));
         $this->redirect(OW::getRouter()->urlForRoute('vwview_clip_ls', array('id' => $res['id'])));
     }
     OW::getDocument()->setHeading($language->text('vwls', 'tb_vwedit_clip_ls'));
     OW::getDocument()->setHeadingIconClass('ow_ic_vwls');
     OW::getDocument()->setTitle($language->text('vwls', 'tb_vwedit_clip_ls'));
 }
Ejemplo n.º 2
0
 /**
  * Class constructor
  *
  * @param int $clipId
  */
 public function __construct(array $params)
 {
     parent::__construct();
     $clipId = $params['id'];
     $this->clipService = VWLS_BOL_ClipService::getInstance();
     $clip = $this->clipService->findClipById($clipId);
     $room_name = $clip->title;
     $params = $clip->description . '^';
     $params .= $clip->roomLimit . '^';
     $params .= $clip->welcome . '^';
     $params .= $clip->welcome2 . '^';
     $params .= $clip->offlineMessage . '^';
     $params .= $clip->camWidth . '^';
     $params .= $clip->camHeight . '^';
     $params .= $clip->camFPS . '^';
     $params .= $clip->micRate . '^';
     $params .= $clip->camBandwidth . '^';
     $params .= $clip->labelColor . '^';
     $params .= $clip->layoutCode . '^';
     $params .= $clip->filterRegex . '^';
     $params .= $clip->filterReplace . '^';
     $params .= $clip->floodProtection . '^';
     $params .= $clip->floodProtection2 . '^';
     $params .= $clip->permission . '^';
     $params .= $clip->user_list . '^';
     $params .= $clip->moderator_list . '^';
     $params .= $clip->layoutCode2 . '^';
     $config = OW::getConfig();
     $settings = $config->getValue('vwls', 'server') . '^';
     $settings .= $config->getValue('vwls', 'serverAMF') . '^';
     $settings .= $config->getValue('vwls', 'serverRTMFP') . '^';
     $settings .= $config->getValue('vwls', 'p2pGroup') . '^';
     $settings .= $config->getValue('vwls', 'tokenKey') . '^';
     $settings .= $config->getValue('vwls', 'snapshotsTime') . '^';
     $settings .= $config->getValue('vwls', 'camMaxBandwidth') . '^';
     $settings .= $config->getValue('vwls', 'bufferLive') . '^';
     $settings .= $config->getValue('vwls', 'bufferFull') . '^';
     $settings .= $config->getValue('vwls', 'bufferLive2') . '^';
     $settings .= $config->getValue('vwls', 'bufferFull2') . '^';
     $settings .= $config->getValue('vwls', 'disableBandwidthDetection') . '^';
     $settings .= $config->getValue('vwls', 'limitByBandwidth') . '^';
     $settings .= $config->getValue('vwls', 'generateSnapshots') . '^';
     $settings .= $config->getValue('vwls', 'externalInterval') . '^';
     $settings .= $config->getValue('vwls', 'externalInterval2') . '^';
     $settings .= $config->getValue('vwls', 'ws_ads') . '^';
     $settings .= $config->getValue('vwls', 'adsTimeout') . '^';
     $settings .= $config->getValue('vwls', 'adsInterval') . '^';
     $settings .= $config->getValue('vwls', 'statusInterval') . '^';
     // new codec setting, etc
     $cSettings = $config->getValue('vwls', 'videoCodec') . '^';
     $cSettings .= $config->getValue('vwls', 'codecProfile') . '^';
     $cSettings .= $config->getValue('vwls', 'codecLevel') . '^';
     $cSettings .= $config->getValue('vwls', 'soundCodec') . '^';
     $cSettings .= $config->getValue('vwls', 'enableRTMP') . '^';
     $cSettings .= $config->getValue('vwls', 'enableP2P') . '^';
     $cSettings .= $config->getValue('vwls', 'supportRTMP') . '^';
     $cSettings .= $config->getValue('vwls', 'supportP2P') . '^';
     $cSettings .= $config->getValue('vwls', 'alwaysRTMP') . '^';
     $cSettings .= $config->getValue('vwls', 'alwaysP2P') . '^';
     $cSettings .= $clip->soundQuality . '^';
     // room owner
     $idOwner = $clip->userId;
     $usernameOwner = BOL_UserService::getInstance()->getUsername($idOwner);
     $userId = OW::getUser()->getId();
     // visitor
     $userService = BOL_UserService::getInstance();
     $user = $userService->findUserById($userId);
     if (isset($user)) {
         $username = $user->getUsername();
     } else {
         $username = "******" . base_convert(time() - 1224350000 . rand(0, 10), 10, 36);
     }
     $baseSwfUrl = $config->getValue('vwls', 'baseSwf_url');
     $set = $config->getValue('vwls', 'server');
     // userLink and userPicture
     $userLink = $userService->getUserUrl($userId);
     $userPicture = BOL_AvatarService::getInstance()->getAvatarUrl($userId);
     $room = $room_name . '^' . $params . $settings . $username . '^' . $usernameOwner . '^' . $userId . '^' . $userLink . '^' . $userPicture . '^' . $cSettings;
     // create sessions/$sessionid file
     $sessionsPath = 'ow_plugins/vwlivestreaming/ls/sessions';
     @chmod($sessionsPath, 0777);
     $sessionName = "vlv" . base_convert(time() - 1112340000 . rand(0, 10), 10, 36);
     $filename = $sessionsPath . '/' . $sessionName . '.vwf';
     $handle = fopen($filename, "x+");
     $roomContent = $room;
     fwrite($handle, $roomContent);
     fclose($handle);
     // send file name to _login
     setcookie("sessionNameLv", $sessionName, time() + 180, '/');
     $srcSwfUrl = $baseSwfUrl . "live_video.swf?n=" . $room_name;
     $code = '<embed width="100%" height="450px" scale="noscale" salign="lt" src="' . $srcSwfUrl . '" bgcolor="#777777" base="' . $baseSwfUrl . '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent"></embed>';
     $this->assign('clipCode', $code);
 }