aExtras['extra']['ext'])) return true; if (!($iFileId = (int)$oAlert->iObject)) return false; if (!($aFile = $this->_oDb->getRow("SELECT * FROM `RayVideoFiles` WHERE `ID` = $iFileId"))) return false; global $sIncPath; global $sModulesPath; global $sFilesPath; global $sFilesUrl; global $oDb; require_once($sIncPath . 'db.inc.php'); $sModule = "video"; $sModulePath = $sModulesPath . $sModule . '/inc/'; require_once($sModulesPath . $sModule . '/inc/header.inc.php'); require_once($sModulesPath . $sModule . '/inc/constants.inc.php'); require_once($sModulesPath . $sModule . '/inc/functions.inc.php'); require_once($sModulesPath . $sModule . '/inc/customFunctions.inc.php'); $sOverride = false; switch($aFile['Status']) { case STATUS_PENDING: case STATUS_PROCESSING: $sOverride = $this->_oTemplate->addCss(array('default.css', 'common.css', 'general.css'), true) . MsgBox(_t('_sys_media_processing')); break; case STATUS_DISAPPROVED: if (!isAdmin()) { $sOverride = $this->_oTemplate->addCss(array('default.css', 'common.css', 'general.css'), true) . MsgBox(_t('_sys_media_disapproved')); break; } case STATUS_APPROVED: if (file_exists($sFilesPath . $iFileId . M4V_EXTENSION)) { $sToken = getToken($iFileId); if (file_exists($sFilesPath . $iFileId . '.webm')) $sSourceWebm = ''; $sFlash = getApplicationContent('video','player',array('id' => $iFileId, 'user' => getLoggedId(), 'password' => clear_xss($_COOKIE['memberPassword'])),true); $sId = 'bx-media-' . genRndPwd(8, false); $sJs = $sSourceWebm ? // if no .webm video available - we need nice fallback in firefox and other browsers with no mp4 support '' : ' var eMedia = document.createElement("video"); if (eMedia.canPlayType && !eMedia.canPlayType("video/x-m4v")) { var sReplace = "' . bx_js_string(BX_H5AV_FALLBACK ? $sFlash : 'Your browser doesn\'t support this media playback.', BX_ESCAPE_STR_QUOTE) . '"; $("#' . $sId . '").replaceWith(sReplace); }'; $sJs .= $aFile['Time'] ? // if length is not set '' : ' eFile.on("canplay", function (e) { $.post("' . BX_DOL_URL_ROOT . 'flash/XML.php", { module: "video", action: "updateFileTime", id: ' . $iFileId . ', time: parseInt(this.duration * 1000) }); });'; $sAutoPlay = TRUE_VAL == getSettingValue('video', 'autoPlay') && class_exists('BxVideosPageView') ? 'autoplay' : ''; $sFilePoster = 'flash/modules/video/files/' . $iFileId . '.jpg'; $sPoster = file_exists(BX_DIRECTORY_PATH_ROOT . $sFilePoster) ? ' poster="' . BX_DOL_URL_ROOT . $sFilePoster . '" ' : ''; $sOverride = ' '; break; } case STATUS_FAILED: default: if (!BX_H5AV_FALLBACK || !file_exists($sFilesPath . $iFileId . FLV_EXTENSION)) $sOverride = $this->_oTemplate->addCss(array('default.css', 'common.css', 'general.css'), true) . MsgBox(_t('_sys_media_not_found')); break; } if ($sOverride) $oAlert->aExtras['override'] = $sOverride; return true; } /** * Video Convert */ function serviceResponseVideoConvert ($oAlert) { if (!($iFileId = (int)$oAlert->iObject)) return false; if (!$oAlert->aExtras['result']) return true; $sFfmpegPath = $oAlert->aExtras['ffmpeg']; $sTempFile = $oAlert->aExtras['tmp_file']; $iBitrate = $oAlert->aExtras['bitrate']; $sSize = $oAlert->aExtras['size']; $sPlayFile = $sTempFile . '.webm'; if (!file_exists($sTempFile)) $sTempFile .= '.flv'; $sCommand = $sFfmpegPath . " -y -i " . $sTempFile . " -acodec libvorbis -b:a 128k -ar 44100 -b:v {$iBitrate}k -s {$sSize} " . $sPlayFile; popen($sCommand, "r"); return true; } /** * Video Delete */ function serviceResponseVideoDelete ($oAlert) { if (!($iFileId = (int)$oAlert->iObject)) return false; $oMain = BxDolModule::getInstance('BxVideosModule'); @unlink($oMain->_oConfig->getFilesPath() . $iFileId . '.webm'); return true; } /** * Audio Player */ function serviceResponseAudioPlayer ($oAlert) { if (!($iFileId = (int)$oAlert->iObject)) return false; if (!($aFile = $this->_oDb->getRow("SELECT * FROM `RayMp3Files` WHERE `ID` = $iFileId"))) return false; global $sIncPath; global $sModulesPath; global $sModule; global $sFilesPath; global $sFilesPathMp3; global $oDb; require_once($sIncPath . 'db.inc.php'); $sModule = "mp3"; $sModulePath = $sModulesPath . $sModule . '/inc/'; require_once($sModulesPath . $sModule . '/inc/header.inc.php'); require_once($sModulesPath . $sModule . '/inc/constants.inc.php'); require_once($sModulesPath . $sModule . '/inc/functions.inc.php'); require_once($sModulesPath . $sModule . '/inc/customFunctions.inc.php'); $sOverride = false; switch($aFile['Status']) { case STATUS_PENDING: case STATUS_PROCESSING: $sOverride = $this->_oTemplate->addCss(array('default.css', 'common.css', 'general.css'), true) . MsgBox(_t('_sys_media_processing')); break; case STATUS_DISAPPROVED: if (!isAdmin()) { $sOverride = $this->_oTemplate->addCss(array('default.css', 'common.css', 'general.css'), true) . MsgBox(_t('_sys_media_disapproved')); break; } case STATUS_APPROVED: if (file_exists($GLOBALS['sFilesPathMp3'] . $iFileId . MP3_EXTENSION)) { $sToken = getMp3Token($iFileId); if (file_exists($GLOBALS['sFilesPathMp3'] . $iFileId . '.ogg')) $sSourceOgg = ''; $sFlash = getApplicationContent('mp3', 'player', array('id' => $iFileId, 'user' => getLoggedId(), 'password' => clear_xss($_COOKIE['memberPassword'])), true); $sId = 'bx-media-' . genRndPwd(8, false); $sJs = $sSourceOgg ? // if no .ogg audio available - we need nice fallback in firefox and other browsers with no mp3 support '' : ' var eMedia = document.createElement("audio"); if (eMedia.canPlayType && !eMedia.canPlayType("audio/mpeg")) { var sReplace = "' . bx_js_string(BX_H5AV_FALLBACK ? $sFlash : 'Your browser doesn\'t support this media playback.', BX_ESCAPE_STR_QUOTE) . '"; $("#' . $sId . '").replaceWith(sReplace); }'; $sJs .= $aFile['Time'] ? // if length is not set '' : ' eFile.on("canplay", function (e) { $.post("' . BX_DOL_URL_ROOT . 'flash/XML.php", { module: "mp3", action: "updateFileTime", id: ' . $iFileId . ', time: parseInt(this.duration * 1000) }); });'; $sAutoPlay = TRUE_VAL == getSettingValue('mp3', 'autoPlay') && class_exists('BxSoundsPageView') ? 'autoplay' : ''; $sFilePoster = 'flash/modules/mp3/files/default.png'; $sPoster = file_exists(BX_DIRECTORY_PATH_ROOT . $sFilePoster) ? ' poster="' . BX_DOL_URL_ROOT . $sFilePoster . '" ' : ''; $sOverride = ' '; break; } case STATUS_FAILED: default: $sOverride = $this->_oTemplate->addCss(array('default.css', 'common.css', 'general.css'), true) . MsgBox(_t('_sys_media_not_found')); break; } $oAlert->aExtras['override'] = $sOverride; return true; } /** * Audio Convert */ function serviceResponseAudioConvert ($oAlert) { if (!($iFileId = (int)$oAlert->iObject)) return false; if (!$oAlert->aExtras['result']) return true; $sFfmpegPath = $oAlert->aExtras['ffmpeg']; $sTempFile = $oAlert->aExtras['tmp_file']; $iBitrate = $oAlert->aExtras['bitrate']; $sPlayFile = $sTempFile . '.ogg'; $sCommand = $sFfmpegPath . " -y -i " . $sTempFile . MP3_EXTENSION . " -vn -b:a " . $iBitrate . "k -acodec libvorbis " . $sPlayFile; popen($sCommand, "r"); return true; } /** * Audio Delete */ function serviceResponseAudioDelete ($oAlert) { if (!($iFileId = (int)$oAlert->iObject)) return false; $oMain = BxDolModule::getInstance('BxSoundsModule'); @unlink($oMain->_oConfig->getFilesPath() . $iFileId . '.ogg'); return true; } /** * Cmts Player */ function serviceResponseCmtsPlayer ($oAlert) { if (!($iFileId = (int)$oAlert->iObject)) return false; if (!($aFile = $this->_oDb->getRow("SELECT * FROM `RayVideo_commentsFiles` WHERE `ID` = $iFileId"))) return false; global $sIncPath; global $sModulesPath; global $sFilesPath; global $sFilesUrl; global $oDb; require_once($sIncPath . 'db.inc.php'); $sModule = "video_comments"; $sModulePath = $sModulesPath . $sModule . '/inc/'; require_once($sModulesPath . $sModule . '/inc/header.inc.php'); require_once($sModulesPath . $sModule . '/inc/constants.inc.php'); require_once($sModulesPath . $sModule . '/inc/functions.inc.php'); require_once($sModulesPath . $sModule . '/inc/customFunctions.inc.php'); $sOverride = false; switch($aFile['Status']) { case VC_STATUS_DISAPPROVED: $sOverride = $this->_oTemplate->addCss(array('default.css', 'common.css', 'general.css'), true) . MsgBox(_t('_sys_media_disapproved')); break; case VC_STATUS_PENDING: case VC_STATUS_PROCESSING: $sOverride = $this->_oTemplate->addCss(array('default.css', 'common.css', 'general.css'), true) . MsgBox(_t('_sys_media_processing')); break; case VC_STATUS_APPROVED: if (file_exists($sFilesPath . $iFileId . VC_M4V_EXTENSION)) { $sToken = _getToken($iFileId); if (file_exists($sFilesPath . $iFileId . '.webm')) $sSourceWebm = ''; $sFlash = $oAlert->aExtras['data']; $sId = 'bx-media-' . genRndPwd(8, false); $sOverride = ' ' . ($sSourceWebm ? // if no .webm video available - we need nice fallback in firefox and other browsers with no mp4 support '' : ''); break; } case VC_STATUS_FAILED: default: if (!BX_H5AV_FALLBACK || !file_exists($sFilesPath . $iFileId . FLV_EXTENSION)) $sOverride = $this->_oTemplate->addCss(array('default.css', 'common.css', 'general.css'), true) . MsgBox(_t('_sys_media_not_found')); break; } if ($sOverride) $oAlert->aExtras['data'] = $sOverride; return true; } /** * Cmts Convert */ function serviceResponseCmtsConvert ($oAlert) { if (!($iFileId = (int)$oAlert->iObject)) return false; if (!$oAlert->aExtras['result']) return true; $sFfmpegPath = $oAlert->aExtras['ffmpeg']; $sTempFile = $oAlert->aExtras['tmp_file']; $iBitrate = $oAlert->aExtras['bitrate']; $sSize = $oAlert->aExtras['size']; $sPlayFile = $sTempFile . '.webm'; $sCommand = $sFfmpegPath . " -y -i " . $sTempFile . " -acodec libvorbis -b:a 128k -ar 44100 -b:v {$iBitrate}k -s {$sSize} " . $sPlayFile; popen($sCommand, "r"); return true; } /** * Cmts Delete */ function serviceResponseCmtsDelete ($oAlert) { if (!($iFileId = (int)$oAlert->iObject)) return false; @unlink($oAlert->aExtras['files_path'] . $iFileId . '.webm'); return true; } }