示例#1
0
 /**
  * Returns class instance
  *
  * @return VWVR_BOL_ClipService
  */
 public static function getInstance()
 {
     if (null === self::$classInstance) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
示例#2
0
 /**
  * Class constructor
  *
  * @param int $exclude 
  * @param int $itemsNum
  */
 public function __construct(array $params)
 {
     parent::__construct();
     $exclude = $params['exclude'];
     $itemsNum = $params['itemsNum'];
     $this->clipService = VWVR_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);
     }
 }
示例#3
0
 /**
  * Class constructor
  *
  * @param int $clipId
  */
 public function __construct(array $params)
 {
     parent::__construct();
     $clipId = $params['id'];
     $this->clipService = VWVR_BOL_ClipService::getInstance();
     $clip = $this->clipService->findClipById($clipId);
     $config = OW::getConfig();
     $room_name = $clip->title;
     $params = $clip->recordingId . '^';
     $params .= $clip->description . '^';
     $settings .= $config->getValue('vwvr', 'recordLimit') . '^';
     $settings .= $config->getValue('vwvr', 'camWidth') . '^';
     $settings .= $config->getValue('vwvr', 'camHeight') . '^';
     $settings .= $config->getValue('vwvr', 'camFPS') . '^';
     $settings .= $config->getValue('vwvr', 'micRate') . '^';
     $settings .= $config->getValue('vwvr', 'camBandwidth') . '^';
     $settings .= $config->getValue('vwvr', 'layoutCode') . '^';
     $settings .= $config->getValue('vwvr', 'showCamSettings') . '^';
     $settings .= $config->getValue('vwvr', 'advancedCamSettings') . '^';
     $settings .= $config->getValue('vwvr', 'fillWindow') . '^';
     $settings .= $config->getValue('vwvr', 'server') . '^';
     $settings .= $config->getValue('vwvr', 'serverAMF') . '^';
     $settings .= $config->getValue('vwvr', 'camMaxBandwidth') . '^';
     $settings .= $config->getValue('vwvr', 'bufferLive') . '^';
     $settings .= $config->getValue('vwvr', 'bufferFull') . '^';
     $settings .= $config->getValue('vwvr', 'bufferLivePlayback') . '^';
     $settings .= $config->getValue('vwvr', 'bufferFullPlayback') . '^';
     // room owner
     $idOwner = $clip->userId;
     $usernameOwner = BOL_UserService::getInstance()->getUsername($idOwner);
     $urlRoom = OW::getRouter()->urlForRoute('vwview_list_vr', array('listType' => 'latest'));
     $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('vwvr', 'baseSwf_url');
     $srcSwfUrl = $baseSwfUrl . "streamplayer.swf?streamName=" . urlencode($room_name . $clip->recordingId) . "&serverRTMP=" . urlencode($config->getValue('vwvr', 'server')) . "&templateURL=";
     $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);
 }
示例#4
0
 /**
  * @return Constructor.
  */
 public function __construct(BASE_CLASS_WidgetParameter $paramObj)
 {
     parent::__construct();
     $clipService = VWVR_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('vwvr', '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('vwvr', 'menu_latest'), 'id' => 'vwvr-widget-menu-latest', 'contId' => 'vwvr-widget-latest', 'active' => true);
     /**        if ( $featured )
             {
                 $menuItems['featured'] = array(
                     'label' => $lang->text('vwvr', 'menu_featured'),
                     'id' => 'vwvr-widget-menu-featured',
                     'contId' => 'vwvr-widget-featured',
                 );
             }
     */
     $menuItems['toprated'] = array('label' => $lang->text('vwvr', 'menu_toprated'), 'id' => 'vwvr-widget-menu-toprated', 'contId' => 'vwvr-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']);
     }
 }
示例#5
0
 /**
  * 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 = VWVR_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('vwvr', 'no_vwvr_found'));
     }
 }
示例#6
0
 /**
  * @return Constructor.
  */
 public function __construct(BASE_CLASS_WidgetParameter $paramObj)
 {
     parent::__construct();
     $clipService = VWVR_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('vwvr');
     if (!$ownerMode && !$modPermissions) {
         $privacyParams = array('action' => 'vwvr_view_vwvr', '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('vwvr', 'total_vwvr', array('total' => $totalClips))), array('label' => $lang->text('base', 'view_all'), 'href' => OW::getRouter()->urlForRoute('vwvr_user_vwvr_list', array('user' => $userName)))));
 }
示例#7
0
<?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.
 */
VWVR_BOL_ClipService::getInstance()->cleanupPluginContent();
示例#8
0
文件: init.php 项目: vazahat/dudex
function vwvr_on_change_privacy(OW_Event $e)
{
    $params = $e->getParams();
    $userId = (int) $params['userId'];
    $actionList = $params['actionList'];
    if (empty($actionList['vwvr_view_vwvr'])) {
        return;
    }
    VWVR_BOL_ClipService::getInstance()->updateUserClipsPrivacy($userId, $actionList['vwvr_view_vwvr']);
}
示例#9
0
 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 = VWVR_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 . "&nbsp;";
             $active_in = OW::getLanguage()->text('vwvr', 'active_in');
             $html .= $active_in;
             $roomIdx = explode("|", $partx[1]);
             foreach ($roomIdx as $roomId) {
                 $clipx = $this->clipService->findClipById($roomId);
                 $urlRoom = OW::getRouter()->urlForRoute('vwview_clip_vr', array('id' => $roomId));
                 $html .= '&nbsp;<a href ="' . $urlRoom . '">' . $clipx->room_name . '</a>';
             }
             $html .= "<br />";
         }
         $this->assign('content', $html);
         //        $this->assign('content', var_dump ($resultx));
     } else {
         $this->assign('content', OW::getLanguage()->text('vwvr', 'no_active_room'));
     }
 }
示例#10
0
文件: vwvr.php 项目: vazahat/dudex
 /**
  * Updates vwvr clip
  *
  * @return boolean
  */
 public function process()
 {
     $values = $this->getValues();
     $clipService = VWVR_BOL_ClipService::getInstance();
     $language = OW::getLanguage();
     if ($values['id']) {
         $clip = $clipService->findClipById($values['id']);
         if ($clip) {
             $clip->room_name = htmlspecialchars($values['room_name']);
             $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, 'vwvr', TagsField::getTags($values['tags']));
                 return array('result' => true, 'id' => $clip->id);
             }
         }
     } else {
         return array('result' => false, 'id' => $clip->id);
     }
     return false;
 }
示例#11
0
文件: add.php 项目: vazahat/dudex
 /**
  * Adds vwvr clip
  *
  * @return boolean
  */
 public function process()
 {
     $values = $this->getValues();
     $clipService = VWVR_BOL_ClipService::getInstance();
     $clip = new VWVR_BOL_Clip();
     $clip->room_name = htmlspecialchars($values['room_name']);
     $description = UTIL_HtmlTag::stripJs($values['description']);
     $description = UTIL_HtmlTag::stripTags($description, array('frame', 'style'), array(), true);
     $clip->description = $description;
     $clip->userId = OW::getUser()->getId();
     $room_nameArr = explode("-", $_COOKIE["video_recorded"]);
     $room_namex = $room_nameArr[0];
     // title
     $recordingIdx = $room_nameArr[1];
     $clip->recordingId = "-" . $recordingIdx;
     $clip->title = $room_namex;
     //        $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' => 'videorecorder_view_video'));
     //        $clip->provider = $prov->detectProvider();
     $clip->addDatetime = time();
     $config = OW::getConfig();
     $status = $config->getValue('vwvr', 'status');
     $clip->status = $status;
     $clip->privacy = mb_strlen($privacy) ? $privacy : 'everybody';
     $eventParams = array('pluginKey' => 'vwvr', 'action' => 'add_vwvr');
     if (OW::getEventManager()->call('usercredits.check_balance', $eventParams) === true) {
         OW::getEventManager()->call('usercredits.track_action', $eventParams);
     }
     // add clip to video plugin
     $isVideoActive = OW::getPluginManager()->isPluginActive('video');
     if ($isVideoActive) {
         $clipServiceVideo = VIDEO_BOL_ClipService::getInstance();
         $clipVideo = new VIDEO_BOL_Clip();
         $clipVideo->title = htmlspecialchars($values['room_name']);
         $clipVideo->description = $description;
         $clipVideo->userId = OW::getUser()->getId();
         $clipVideo->code = '<iframe width="420" height="315" src="' . $config->getValue('vwvr', 'baseSwf_url') . 'streamplayer.swf?streamName=' . $room_namex . $clip->recordingId . '&serverRTMP=' . $config->getValue('vwvr', 'server') . '&templateURL=" frameborder="0" allowfullscreen="allowfullscreen"></iframe>';
         $prov = new VideoProviders($clipVideo->code);
         $clipVideo->provider = $prov->detectProvider();
         $privacy = OW::getEventManager()->call('plugin.privacy.get_privacy', array('ownerId' => $clipVideo->userId, 'action' => 'video_view_video'));
         $clipVideo->addDatetime = time();
         $clipVideo->status = 'approved';
         $clipVideo->privacy = mb_strlen($privacy) ? $privacy : 'everybody';
         $clipServiceVideo->addClip($clipVideo);
     }
     // videowhisper
     // get record path
     $recordPath = $config->getValue('vwvr', 'recordPath');
     $recordPathArr = explode('/', $recordPath);
     $recordPathArrCount = count($recordPathArr);
     for ($i = 1; $i < $recordPathArrCount; $i++) {
         $recorded .= "/" . $recordPathArr[$i];
         if (!is_dir($recorded)) {
             mkdir($recorded);
         }
     }
     // get streams directory
     $dirname = 'streams';
     if (file_exists('../../' . $dirname)) {
         $dir = '../../' . $dirname;
     } elseif (file_exists('../../../' . $dirname)) {
         $dir = '../../../' . $dirname;
     } elseif (file_exists('../../../../' . $dirname)) {
         $dir = '../../../../' . $dirname;
     } elseif (file_exists('../../../../../' . $dirname)) {
         $dir = '../../../../../' . $dirname;
     } elseif (file_exists('../../../../../../' . $dirname)) {
         $dir = '../../../../../../' . $dirname;
     }
     // $streamsPath = realpath($dir);
     $streamsPath = realpath("../" . $dir);
     // convert and copy, or just copy
     $filename = $_COOKIE["video_recorded"];
     $old = $streamsPath . "/streams/" . $filename;
     $new = $recordPath . "/" . $filename;
     $ffmpeg = trim(shell_exec('type -P ffmpeg'));
     if (empty($ffmpeg)) {
         copy($old . '.flv', $new . '.flv');
     } else {
         shell_exec($ffmpeg . ' -i ' . $old . '.flv -sameq -ar 22050 ' . $new . '.mp4');
     }
     if ($clipService->addClip($clip)) {
         BOL_TagService::getInstance()->updateEntityTags($clip->id, 'vwvr', TagsField::getTags($values['tags']));
         // Newsfeed
         $event = new OW_Event('feed.action', array('pluginKey' => 'vwvr', 'entityType' => 'vwvr_comments', 'entityId' => $clip->id, 'userId' => $clip->userId));
         OW::getEventManager()->trigger($event);
         return array('result' => true, 'id' => $clip->id);
     }
     return false;
 }