/** * @return Constructor. */ public function __construct(BASE_CLASS_WidgetParameter $paramObj) { parent::__construct(); $clipService = VWVC_BOL_ClipService::getInstance(); $count = isset($paramObj->customParamList['clipCount']) ? (int) $paramObj->customParamList['clipCount'] : 4; $lang = OW::getLanguage(); $this->assign('showTitles', $paramObj->customParamList['showTitles']); /** $latest = $clipService->findClipsList('latest', 1, $count); if ( $latest ) { $latest[0]['code'] = $this->prepareClipCode($latest[0]['code'], $latest[0]['provider']); } $this->assign('latest', $latest); */ $online = $clipService->findClipsList('online', 1, $count); if ($online) { $online[0]['code'] = $this->prepareClipCode($online[0]['code'], $latest[0]['provider']); } $this->assign('online', $online); if (!$latest && !OW::getUser()->isAuthorized('vwvc', 'add')) { $this->setVisible(false); return; } /** $featured = $clipService->findClipsList('featured', 1, $count); if ( $featured ) { $featured[0]['code'] = $this->prepareClipCode($featured[0]['code'], $featured[0]['provider']); } $this->assign('featured', $featured); */ $toprated = $clipService->findClipsList('toprated', 1, $count); if ($toprated) { $toprated[0]['code'] = $this->prepareClipCode($toprated[0]['code'], $toprated[0]['provider']); } $this->assign('toprated', $toprated); $menuItems['latest'] = array('label' => $lang->text('vwvc', 'menu_latest'), 'id' => 'vwvc-widget-menu-latest', 'contId' => 'vwvc-widget-latest', 'active' => true); /** if ( $featured ) { $menuItems['featured'] = array( 'label' => $lang->text('vwvc', 'menu_featured'), 'id' => 'vwvc-widget-menu-featured', 'contId' => 'vwvc-widget-featured', ); } */ $menuItems['toprated'] = array('label' => $lang->text('vwvc', 'menu_toprated'), 'id' => 'vwvc-widget-menu-toprated', 'contId' => 'vwvc-widget-toprated'); if (!$paramObj->customizeMode) { $this->addComponent('menu', new BASE_CMP_WidgetMenu($menuItems)); } $this->assign('items', $menuItems); $toolbars = self::getToolbar(); $this->assign('toolbars', $toolbars); if ($latest) { $this->setSettingValue(self::SETTING_TOOLBAR, $toolbars['latest']); } }
/** * Class constructor * * @param string $listType * @param int $count * @param string $tag * @param int $userId */ public function __construct(array $params) { parent::__construct(); $listType = isset($params['type']) ? $params['type'] : ''; $count = isset($params['count']) ? $params['count'] : 5; // $count = 5; $tag = isset($params['tag']) ? $params['tag'] : ''; $userId = isset($params['userId']) ? $params['userId'] : null; $this->clipService = VWVC_BOL_ClipService::getInstance(); $page = isset($_GET['page']) && (int) $_GET['page'] ? (int) $_GET['page'] : 1; // $clipsPerPage = $this->clipService->getClipPerPageConfig(); $clipsPerPage = 10; if ($userId) { $clips = $this->clipService->findUserClipsList($userId, $page, $clipsPerPage); $records = $this->clipService->findUserClipsCount($userId); } else { if (strlen($tag)) { $clips = $this->clipService->findTaggedClipsList($tag, $page, $clipsPerPage); $records = $this->clipService->findTaggedClipsCount($tag); } else { $clips = $this->clipService->findClipsList($listType, $page, $clipsPerPage); $records = $this->clipService->findClipsCount($listType); } } $this->assign('listType', $listType); if ($clips) { $this->assign('no_content', null); $this->assign('clips', $clips); $userIds = array(); foreach ($clips as $clip) { if (!in_array($clip['userId'], $userIds)) { array_push($userIds, $clip['userId']); } } $names = BOL_UserService::getInstance()->getDisplayNamesForList($userIds); $this->assign('displayNames', $names); $usernames = BOL_UserService::getInstance()->getUserNamesForList($userIds); $this->assign('usernames', $usernames); // Paging $pages = (int) ceil($records / $clipsPerPage); $paging = new BASE_CMP_Paging($page, $pages, 10); $this->assign('paging', $paging->render()); $this->assign('count', $count); } else { $this->assign('no_content', OW::getLanguage()->text('vwvc', 'no_vwvc_found')); } }
/** * Class constructor * * @param int $exclude * @param int $itemsNum */ public function __construct(array $params) { parent::__construct(); $exclude = $params['exclude']; $itemsNum = $params['itemsNum']; $this->clipService = VWVC_BOL_ClipService::getInstance(); $userId = $this->clipService->findClipOwner($exclude); if (!$userId) { $this->setVisible(false); } else { $clips = $this->clipService->findUserClipsList($userId, 1, $itemsNum, $exclude); if (!$clips) { $this->setVisible(false); } $this->assign('clips', $clips); } }
/** * @return Constructor. */ public function __construct(BASE_CLASS_WidgetParameter $paramObj) { parent::__construct(); $clipService = VWVC_BOL_ClipService::getInstance(); $count = isset($paramObj->customParamList['clipCount']) ? (int) $paramObj->customParamList['clipCount'] : 4; $userId = $paramObj->additionalParamList['entityId']; $showTitles = $paramObj->customParamList['showTitles']; $this->assign('showTitles', $showTitles); $clips = $clipService->findUserClipsList($userId, 1, $count); if ($clips) { if (!$showTitles) { $clips[0]['code'] = $this->prepareClipCode($clips[0]['code'], $clips[0]['provider']); } $this->assign('clips', $clips); $totalClips = $clipService->findUserClipsCount($userId); $this->assign('clipCount', $totalClips); } else { $this->assign('clips', null); $this->assign('clipCount', 0); $totalClips = 0; if (!$paramObj->customizeMode) { $this->setVisible(false); } } // privacy check $viewerId = OW::getUser()->getId(); $ownerMode = $userId == $viewerId; $modPermissions = OW::getUser()->isAuthorized('vwvc'); if (!$ownerMode && !$modPermissions) { $privacyParams = array('action' => 'vwvc_view_vwvc', 'ownerId' => $userId, 'viewerId' => $viewerId); $event = new OW_Event('privacy_check_permission', $privacyParams); try { OW::getEventManager()->trigger($event); } catch (RedirectException $e) { $this->setVisible(false); } } $userName = BOL_UserService::getInstance()->getUserName($userId); $this->assign('user', $userName); $lang = OW::getLanguage(); $this->setSettingValue(self::SETTING_TOOLBAR, array(array('label' => $lang->text('vwvc', 'total_vwvc', array('total' => $totalClips))), array('label' => $lang->text('base', 'view_all'), 'href' => OW::getRouter()->urlForRoute('vwvc_user_vwvc_list', array('user' => $userName))))); }
function vwvc_on_change_privacy(OW_Event $e) { $params = $e->getParams(); $userId = (int) $params['userId']; $actionList = $params['actionList']; if (empty($actionList['vwvc_view_vwvc'])) { return; } VWVC_BOL_ClipService::getInstance()->updateUserClipsPrivacy($userId, $actionList['vwvc_view_vwvc']); }
/** * Updates vwvc clip * * @return boolean */ public function process() { $values = $this->getValues(); $clipService = VWVC_BOL_ClipService::getInstance(); $language = OW::getLanguage(); if ($values['id']) { $clip = $clipService->findClipById($values['id']); if ($clip) { $clip->title = htmlspecialchars($values['room_name']); $clip->description = htmlspecialchars($values['description']); $clip->welcome = htmlspecialchars($values['welcome']); $cam = $values['resolution']; $camArr = explode("x", $cam); $clip->camWidth = $camArr[0]; $clip->camHeight = $camArr[1]; $clip->camFPS = $values['camera_fps']; $clip->micRate = $values['microphone_rate']; $clip->soundQuality = $values['soundQuality']; $clip->camBandwidth = $values['bandwidth']; $clip->background_url = $values['background_url']; $clip->layoutCode = htmlspecialchars($values['layout_code']); $permission = $values['fill_window'] . "|"; $permission .= $values['show_camera_settings'] . "|"; $permission .= $values['advanced_camera_settings'] . "|"; $permission .= $values['configure_source'] . "|"; $permission .= $values['disable_video'] . "|"; $permission .= $values['disable_sound'] . "|"; $permission .= $values['panel_rooms'] . "|"; $permission .= $values['panel_users'] . "|"; $permission .= $values['panel_files'] . "|"; $permission .= $values['file_upload'] . "|"; $permission .= $values['file_delete'] . "|"; $permission .= $values['tutorial'] . "|"; $permission .= $values['auto_view_cameras'] . "|"; $permission .= $values['show_timer'] . "|"; $permission .= $values['write_text'] . "|"; $permission .= $values['regular_watch'] . "|"; $permission .= $values['new_watch'] . "|"; $permission .= $values['private_textchat'] . "|"; $permission .= $values['administrator'] . "|"; $permission .= $values['verbose_level'] . "|"; $clip->permission = $permission; $clip->floodProtection = $values['flood_protection']; $clip->filterRegex = $values['filter_regex']; $clip->filterReplace = $values['filter_replace']; $clip->user_list = $values['user_list']; $clip->moderator_list = $values['moderator_list']; $clip->modifDatetime = time(); $description = UTIL_HtmlTag::stripJs($values['description']); $description = UTIL_HtmlTag::stripTags($description, array('frame', 'style'), array(), true); $clip->description = $description; if ($clipService->updateClip($clip)) { BOL_TagService::getInstance()->updateEntityTags($clip->id, 'vwvc', TagsField::getTags($values['tags'])); return array('result' => true, 'id' => $clip->id); } } } else { return array('result' => false, 'id' => $clip->id); } return false; }
public function __construct(BASE_CLASS_WidgetParameter $params) { parent::__construct(); if (empty($params->additionalParamList['entityId'])) { $userId = OW::getUser()->getId(); } else { $userId = $params->additionalParamList['entityId']; } $friendsIdList = OW::getEventManager()->call('plugin.friends.get_friend_list', array('userId' => OW::getUser()->getId())); $count = 25; $this->clipService = VWVC_BOL_ClipService::getInstance(); $clips = $this->clipService->findClipsList('online', '1', $count); $friendsCount = count($friendsIdList); $result = array(); $resultx = ""; foreach ($friendsIdList as $friendId) { $resultx = $this->clipService->findClipsByFriendId($friendId, $clips); if ($resultx != "") { array_push($result, $resultx); } } $html = ""; if ($result != "") { foreach ($result as $part) { $partx = explode(":", $part); $displayName = BOL_UserService::getInstance()->getDisplayName($partx[0]); $html .= $displayName . " "; $active_in = OW::getLanguage()->text('vwvc', 'active_in'); $html .= $active_in; $roomIdx = explode("|", $partx[1]); foreach ($roomIdx as $roomId) { $clipx = $this->clipService->findClipById($roomId); $urlRoom = OW::getRouter()->urlForRoute('vwview_clip', array('id' => $roomId)); $html .= ' <a href ="' . $urlRoom . '">' . $clipx->title . '</a>'; } $html .= "<br />"; } $this->assign('content', $html); // $this->assign('content', var_dump ($resultx)); } else { $this->assign('content', OW::getLanguage()->text('vwvc', 'no_active_room')); } }
/** * Adds vwvc clip * * @return boolean */ public function process() { $values = $this->getValues(); $clipService = VWVC_BOL_ClipService::getInstance(); $clip = new VWVC_BOL_Clip(); $clip->title = htmlspecialchars($values['room_name']); $clip->description = htmlspecialchars($values['description']); $clip->welcome = htmlspecialchars($values['welcome']); $cam = $values['resolution']; $camArr = explode("x", $cam); $clip->camWidth = $camArr[0]; $clip->camHeight = $camArr[1]; $clip->camFPS = $values['camera_fps']; $clip->micRate = $values['microphone_rate']; $clip->soundQuality = $values['soundQuality']; $clip->camBandwidth = $values['bandwidth']; $clip->background_url = $values['background_url']; $clip->layoutCode = htmlspecialchars($values['layout_code']); $permission = $values['fill_window'] . "|"; $permission .= $values['show_camera_settings'] . "|"; $permission .= $values['advanced_camera_settings'] . "|"; $permission .= $values['configure_source'] . "|"; $permission .= $values['disable_video'] . "|"; $permission .= $values['disable_sound'] . "|"; $permission .= $values['panel_rooms'] . "|"; $permission .= $values['panel_users'] . "|"; $permission .= $values['panel_files'] . "|"; $permission .= $values['file_upload'] . "|"; $permission .= $values['file_delete'] . "|"; $permission .= $values['tutorial'] . "|"; $permission .= $values['auto_view_cameras'] . "|"; $permission .= $values['show_timer'] . "|"; $permission .= $values['write_text'] . "|"; $permission .= $values['regular_watch'] . "|"; $permission .= $values['new_watch'] . "|"; $permission .= $values['private_textchat'] . "|"; $permission .= $values['administrator'] . "|"; $permission .= $values['verbose_level'] . "|"; $clip->permission = $permission; $clip->floodProtection = $values['flood_protection']; $clip->filterRegex = $values['filter_regex']; $clip->filterReplace = $values['filter_replace']; $clip->user_list = $values['user_list']; $clip->moderator_list = $values['moderator_list']; $clip->online = "no"; $clip->onlineCount = 0; $clip->onlineUser = "******"; $clip->onlineUsers = "0"; $description = UTIL_HtmlTag::stripJs($values['description']); $description = UTIL_HtmlTag::stripTags($description, array('frame', 'style'), array(), true); $clip->description = $description; $clip->userId = OW::getUser()->getId(); // $clip->code = UTIL_HtmlTag::stripJs($values['code']); // $prov = new VideoProviders($clip->code); $privacy = OW::getEventManager()->call('plugin.privacy.get_privacy', array('ownerId' => $clip->userId, 'action' => 'videoconference_view_video')); // $clip->provider = $prov->detectProvider(); $clip->addDatetime = time(); $clip->modifDatetime = time(); $config = OW::getConfig(); $status = $config->getValue('vwvc', 'status'); $clip->status = $status; $clip->privacy = mb_strlen($privacy) ? $privacy : 'everybody'; $eventParams = array('pluginKey' => 'vwvc', 'action' => 'add_vwvc'); if (OW::getEventManager()->call('usercredits.check_balance', $eventParams) === true) { OW::getEventManager()->call('usercredits.track_action', $eventParams); } if ($clipService->addClip($clip)) { BOL_TagService::getInstance()->updateEntityTags($clip->id, 'vwvc', TagsField::getTags($values['tags'])); // Newsfeed $event = new OW_Event('feed.action', array('pluginKey' => 'vwvc', 'entityType' => 'vwvc_comments', 'entityId' => $clip->id, 'userId' => $clip->userId)); OW::getEventManager()->trigger($event); return array('result' => true, 'id' => $clip->id); } return false; }
/** * Class constructor * * @param int $clipId */ public function __construct(array $params) { parent::__construct(); $clipId = $params['id']; $this->clipService = VWVC_BOL_ClipService::getInstance(); $clip = $this->clipService->findClipById($clipId); $room_name = $clip->title; $params = $clip->description . '^'; $params .= $clip->welcome . '^'; $params .= $clip->camWidth . '^'; $params .= $clip->camHeight . '^'; $params .= $clip->camFPS . '^'; $params .= $clip->micRate . '^'; $params .= $clip->camBandwidth . '^'; $params .= $clip->background_url . '^'; $params .= $clip->layoutCode . '^'; $params .= $clip->filterRegex . '^'; $params .= $clip->filterReplace . '^'; $params .= $clip->floodProtection . '^'; $params .= $clip->permission . '^'; $params .= $clip->user_list . '^'; $params .= $clip->moderator_list . '^'; $config = OW::getConfig(); $settings = $config->getValue('vwvc', 'p2pGroup') . '^'; $settings .= $config->getValue('vwvc', 'camMaxBandwidth') . '^'; $settings .= $config->getValue('vwvc', 'bufferLive') . '^'; $settings .= $config->getValue('vwvc', 'bufferFull') . '^'; $settings .= $config->getValue('vwvc', 'bufferLivePlayback') . '^'; $settings .= $config->getValue('vwvc', 'bufferFullPlayback') . '^'; $settings .= $config->getValue('vwvc', 'disableBandwidthDetection') . '^'; $settings .= $config->getValue('vwvc', 'disableUploadDetection') . '^'; $settings .= $config->getValue('vwvc', 'limitByBandwidth') . '^'; $settings .= $config->getValue('vwvc', 'ws_ads') . '^'; $settings .= $config->getValue('vwvc', 'adsTimeout') . '^'; $settings .= $config->getValue('vwvc', 'adsInterval') . '^'; $settings .= $config->getValue('vwvc', 'statusInterval') . '^'; $settings .= $config->getValue('vwvc', 'videos_per_page') . '^'; $settings .= $config->getValue('vwvc', 'server') . '^'; $settings .= $config->getValue('vwvc', 'serverAMF') . '^'; $settings .= $config->getValue('vwvc', 'serverRTMFP') . '^'; // new codec setting, etc $cSettings = $config->getValue('vwvc', 'videoCodec') . '^'; $cSettings .= $config->getValue('vwvc', 'codecProfile') . '^'; $cSettings .= $config->getValue('vwvc', 'codecLevel') . '^'; $cSettings .= $config->getValue('vwvc', 'soundCodec') . '^'; $cSettings .= $config->getValue('vwvc', 'enableRTMP') . '^'; $cSettings .= $config->getValue('vwvc', 'enableP2P') . '^'; $cSettings .= $config->getValue('vwvc', 'supportRTMP') . '^'; $cSettings .= $config->getValue('vwvc', 'supportP2P') . '^'; $cSettings .= $config->getValue('vwvc', 'alwaysRTMP') . '^'; $cSettings .= $config->getValue('vwvc', '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); } // userLink and userPicture $userLink = $userService->getUserUrl($userId); $userPicture = BOL_AvatarService::getInstance()->getAvatarUrl($userId); $baseSwfUrl = $config->getValue('vwvc', 'baseSwf_url'); $room = $room_name . '^' . $params . $settings . $username . '^' . $usernameOwner . '^' . $userId . '^' . $userLink . '^' . $userPicture . '^' . $cSettings; // create sessions/$sessionid file $sessionsPath = 'ow_plugins/vwvideoconference/vc/sessions'; @chmod($sessionsPath, 0777); $sessionName = "vcs" . 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("sessionNameVc", $sessionName, time() + 180, '/'); $urlRoom = OW::getRouter()->urlForRoute('vwview_list', array('listType' => 'latest')); setcookie("urlRoomVc", $urlRoom, time() + 86400, '/'); $srcSwfUrl = $baseSwfUrl . "videowhisper_conference.swf?room=" . $room_name; $code = '<embed width="100%" height="600px" 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); }
<?php /** * This software is intended for use with Oxwall Free Community Software http://www.oxwall.org/ and is * licensed under The BSD license. * --- * Copyright (c) 2011, Oxwall Foundation * All rights reserved. * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: * * - Redistributions of source code must retain the above copyright notice, this list of conditions and * the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and * the following disclaimer in the documentation and/or other materials provided with the distribution. * * - Neither the name of the Oxwall Foundation nor the names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ VWVC_BOL_ClipService::getInstance()->cleanupPluginContent();