/** * 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 = '<source type=\'audio/ogg; codecs="vorbis"\' src="' . BX_DOL_URL_ROOT . "flash/modules/mp3/get_file.php?id=" . $iFileId . "&token=" . $sToken . '&ext=ogg" />'; } $sFlash = getApplicationContent('mp3', 'player', array('id' => $iFileId, 'user' => getLoggedId(), 'password' => clear_xss($_COOKIE['memberPassword'])), true); $sId = 'bx-media-' . genRndPwd(8, false); $sJs = $sSourceOgg ? '' : ' var eMedia = document.createElement("audio"); if (eMedia.canPlayType && !eMedia.canPlayType("audio/mpeg")) { var sReplace = "' . bx_js_string(BX_H5AV_FALLBACK ? $sFlash : '<b>Your browser doesn\'t support this media playback.</b>', BX_ESCAPE_STR_QUOTE) . '"; $("#' . $sId . '").replaceWith(sReplace); }'; $sJs .= $aFile['Time'] ? '' : ' 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' : ''; $sOverride = ' <audio controls ' . $sAutoPlay . ' preload="auto" autobuffer style="width:100%" id="' . $sId . '"> <source type=\'audio/mpeg; codecs="mp3"\' src="' . BX_DOL_URL_ROOT . "flash/modules/mp3/get_file.php?id=" . $iFileId . "&token=" . $sToken . '" /> ' . $sSourceOgg . ' ' . (BX_H5AV_FALLBACK ? $sFlash : '<b>Can not playback media - your browser doesn\'t support HTML5 audio/video tag.</b>') . ' </audio> <script> var eFile = $("#' . $sId . '"); eFile.on("play", function () { var ePlaying = this; $("audio").each(function () { if (this != ePlaying) this.pause(); }); }); ' . $sJs . ' </script>'; 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; }
$iLength = count($aImageData); for ($i = 0; $i < $iLength; $i++) { $aImageData[$i] = base_convert($aImageData[$i], 36, 10); } if ($iLength != $iWidth * $iHeight || !function_exists("imagecreatetruecolor")) { break; } //--- Create Image Resource ---// $rImage = @imagecreatetruecolor($iWidth, $iHeight); for ($i = 0, $y = 0; $y < $iHeight; $y++) { for ($x = 0; $x < $iWidth; $x++, $i++) { @imagesetpixel($rImage, $x, $y, $aImageData[$i]); } } //--- Save image file ---// $sUser = process_db_input($_REQUEST['user']); if (empty($sId)) { $sId = $sUser . TEMP_FILE_NAME; } $sFileName = $sFilesPathMp3 . $sId . SCREENSHOT_EXT; @imagejpeg($rImage, $sFileName, 100); break; case 'getToken': $sToken = getMp3Token($sId); if (empty($sToken)) { $sContents = parseXml($aXmlTemplates['result'], "msgFileNotFound", FAILED_VAL); } else { $sContents = parseXml($aXmlTemplates['result'], $sToken, SUCCESS_VAL); } break; }