|
From: OryNider <ory...@us...> - 2008-03-06 03:11:52
|
Update of /cvsroot/mxbb/mx_shotcast/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5080/includes Modified Files: common.php Added Files: detectScript.htm Removed Files: shotcast_class.php Log Message: version 2.0 --- shotcast_class.php DELETED --- --- NEW FILE: detectScript.htm --- <?php // // Security check // if( !defined('IN_PORTAL') ) { die("Hacking attempt"); } ?> <!-- // Create ActiveX objects for later checks for WMP versions. --> <OBJECT CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" HEIGHT="0" ID="WMP64" WIDTH="0" STYLE="visibility: hidden;"></OBJECT> <OBJECT CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" HEIGHT="0" ID="WMP7" WIDTH="0" STYLE="visibility: hidden;"></OBJECT> <SCRIPT TYPE="text/javascript"> <!-- // var detectableWithVB = false; var pluginFound = false; var cType = '<?=$mimetype;?>'; var radioStat = '<?=$radio->stat;?>'; function checkSong(){ var xmlHttp; try{ xmlHttp = new XMLHttpRequest(); } catch (e){ try{ xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e){ try{ xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ return false; } } } xmlHttp.onreadystatechange = function(){ if(xmlHttp.readyState == 4){ document.getElementById('songtitle').innerHTML = xmlHttp.responseText; setTimeout('Ajax()',25000); } } xmlHttp.open("GET","<?=$module_root_path;?>cur_song.<?=$phpEx;?>",true); xmlHttp.send(null); } function embedInfo(embed){ var player = ''; var plugin = ''; if(embed == 'real'){ player = '<b>Real player</b>'; if(!detectReal()){ plugin = '<a href="http://www.real.com/realplayer.html">» Download Realplayer</a>'; } else{ plugin = '» No plugins seems<br> to be needed'; } } else if(embed == 'wmp6'){ player = '<b>Windows Media</b>'; if(!detectWindowsMedia()){ plugin = '<a href="http://www.microsoft.com/windows/windowsmedia/">» Download WMP</a>'; if(AXcompatible()){ plugin += '<br><a href="http://activex.microsoft.com/activex/controls/mplayer/sv/nsmp2inf.cab#Version=6,4,5,715">»Download Plugin</a>'; } } else{ plugin = '» No plugins seems<br> to be needed'; } } else if(embed == 'wmp7'){ player = '<b>Windows Media</b>'; if(!detectWindowsMedia()){ plugin = '<a href="http://www.microsoft.com/windows/windowsmedia/">» Download WMP</a>'; } else{ plugin = '» No plugins seems<br> to be needed'; } } else if(embed == 'wmpo'){ player = '<b>Windows Media</b>'; if(!detectWindowsMedia()){ plugin = '<a href="http://www.microsoft.com/windows/windowsmedia/">» Download WMP</a>'; } else{ plugin = '» No plugins seems<br> to be needed'; } } else if(embed == 'quicktime'){ player = '<b>QuickTime</b><br><div style="font-size: 8px;">(Enable mp3 mime-type)</div>'; if(!detectQuickTime()){ plugin = '<a href="http://www.apple.com/quicktime/download/">» Download QT</a>'; if(AXcompatible()){ plugin += '<br><a href="http://www.apple.com/qtactivex/qtplugin.cab">» Download Plugin</a>'; } } else{ plugin = '» No plugins seems<br> to be needed'; } } else if(embed == 'aac_wmp'){ player = '<b>Windows Media</b>'; plugin = ''; if(!detectWindowsMedia()){ plugin += '<a href="http://www.microsoft.com/windows/windowsmedia/">» Download WMP</a><br>'; } plugin += '<a href="http://retro-radio.net/plugin/setup_AAC_aacPlus_plugin_1_0_36.exe">» AAC plugin f. WMP</a>'; } else if(embed == 'winampX'){ player = 'Winamp ActiveX'; if(AXcompatible()){ plugin = '<a href="http://pdl.stream.aol.com/downloads/aol/unagi/ampx_en_dl.cab">» Download Plugin</a>'; } } document.getElementById('infoPlayer').innerHTML = player; document.getElementById('infoPlugin').innerHTML = plugin; } function changeEmbed(){ var embed = document.getElementById('embedchoise'); if(embed.value && embed.value != "auto" && embed.value != "wmp"){ embedInfo(embed.value); } else if(embed.value == "wmp"){ embedInfo(detectWMPEmbed(embed.value)); } else{ embedInfo(detectEmbed()); } } function playR(){ var embed = document.getElementById('embedchoise'); var frame = document.getElementById('embedFrame'); if(embed.value && embed.value != "auto" && embed.value != "wmp"){ frame.src = "<?=$module_root_path;?>play.<?=$phpEx;?>?embed=" + embed.value; embedInfo(embed.value); } else if(embed.value == "wmp"){ frame.src = "play.<?=$phpEx;?>?embed=" + detectWMPEmbed(embed.value); embedInfo(detectWMPEmbed(embed.value)); embedFrame.reload(true); } else{ frame.src = "<?=$module_root_path;?>play.<?=$phpEx;?>"; embedInfo(detectEmbed()); } document.getElementById('eq').src = '<?=$module_root_path;?>images/<?=SKIN;?>/equalizer_play.gif'; } function stopR(){ document.getElementById('embedFrame').src = ""; document.getElementById('eq').src = '<?=$module_root_path;?>images/<?=SKIN;?>/equalizer_stop.gif'; } function stopWinampx() { winampx.Deinitialize(); } function AXcompatible(){ if (window.ActiveXObject) { return true; } return false; } function canDetectPlugins() { if( detectableWithVB || (navigator.plugins && navigator.plugins.length > 0) ) { return true; } else { return false; } } function detectQuickTime() { pluginFound = detectPlugin('QuickTime'); // if not found, try to detect with VisualBasic if(!pluginFound && detectableWithVB) { pluginFound = detectQuickTimeActiveXControl(); } return pluginFound; } function detectReal() { pluginFound = detectPlugin('RealPlayer'); // if not found, try to detect with VisualBasic if(!pluginFound && detectableWithVB) { pluginFound = (detectActiveXControl('rmocx.RealPlayer G2 Control') || detectActiveXControl('RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)') || detectActiveXControl('RealVideo.RealVideo(tm) ActiveX Control (32-bit)')); } return pluginFound; } function detectWindowsMedia() { pluginFound = detectPlugin('Windows Media Player'); // if not found, try to detect with VisualBasic if(!pluginFound && detectableWithVB) { pluginFound = detectActiveXControl('MediaPlayer.MediaPlayer.1'); } return pluginFound; } function detectPlugin() { // allow for multiple checks in a single pass var daPlugins = detectPlugin.arguments; // consider pluginFound to be false until proven true var pluginFound = false; // if plugins array is there and not fake if (navigator.plugins && navigator.plugins.length > 0) { var pluginsArrayLength = navigator.plugins.length; // for each plugin... for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) { // loop through all desired names and check each against the current plugin name var numFound = 0; for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) { // if desired plugin name is found in either plugin name or description if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || (navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) { // this name was found numFound++; } } // now that we have checked all the required names against this one plugin, // if the number we found matches the total number provided then we were successful if(numFound == daPlugins.length) { pluginFound = true; // if we've found the plugin, we can stop looking through at the rest of the plugins break; } } } return pluginFound; } // detectPlugin // Here we write out the VBScript block for MSIE Windows if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) { document.writeln('<script language="VBscript">'); document.writeln('\'do a one-time test for a version of VBScript that can handle this code'); document.writeln('detectableWithVB = False'); document.writeln('If ScriptEngineMajorVersion >= 2 then'); document.writeln(' detectableWithVB = True'); document.writeln('End If'); document.writeln('\'this next function will detect most plugins'); document.writeln('Function detectActiveXControl(activeXControlName)'); document.writeln(' on error resume next'); document.writeln(' detectActiveXControl = False'); document.writeln(' If detectableWithVB Then'); document.writeln(' detectActiveXControl = IsObject(CreateObject(activeXControlName))'); document.writeln(' End If'); document.writeln('End Function'); document.writeln('\'and the following function handles QuickTime'); document.writeln('Function detectQuickTimeActiveXControl()'); document.writeln(' on error resume next'); document.writeln(' detectQuickTimeActiveXControl = False'); document.writeln(' If detectableWithVB Then'); document.writeln(' detectQuickTimeActiveXControl = False'); document.writeln(' hasQuickTimeChecker = false'); document.writeln(' Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")'); document.writeln(' If IsObject(hasQuickTimeChecker) Then'); document.writeln(' If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then '); document.writeln(' detectQuickTimeActiveXControl = True'); document.writeln(' End If'); document.writeln(' End If'); document.writeln(' End If'); document.writeln('End Function'); document.writeln('</scr' + 'ipt>'); } function detectOS(){ var OS = "unknown"; if (navigator.appVersion.indexOf("Win")!=-1) OS = "win"; if (navigator.appVersion.indexOf("Mac")!=-1) OS = "mac"; if (navigator.appVersion.indexOf("X11")!=-1) OS = "unix"; if (navigator.appVersion.indexOf("Linux")!=-1) OS = "linux"; return OS; } function detectWMPEmbed(){ if(this.cType == "audio/aacp"){ return 'aac_wmp'; } if(canDetectPlugins() && detectWindowsMedia() && AXcompatible()){ fHasWMP = false; WMPVer = "unknown"; try{ if (document.WMP64.FileName == ""){ WMPVer = "6.4"; } fHasWMP = true; } catch(e){}; try{ if(document.WMP7.URL == ""){ WMPVer = document.WMP7.versionInfo; } fHasWMP = true; } catch(e){}; if(fHasWMP == true && WMPVer != 'unknown'){ WMPVer = parseFloat(WMPVer); if(WMPVer == 6.4){ return 'wmp6'; } } } return 'wmp7'; } function detectEmbed() { if(this.cType == "audio/aacp"){ if(AXcompatible()){ return 'winampX'; } return detectWMPEmbed(); } if(canDetectPlugins()){ if(detectReal()){ return 'real'; } else if(detectWindowsMedia()){ return detectWMPEmbed(); } else if(detectQuickTime()){ return 'quicktime'; } } if(AXcompatible()){ return 'winampX'; } var OS = detectOS(); if(OS == "mac"){ return 'quicktime'; } else if(OS == "unix" || OS == "linux"){ return 'real'; } return detectWMPEmbed(); } // --> </SCRIPT> Index: common.php =================================================================== RCS file: /cvsroot/mxbb/mx_shotcast/includes/common.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** common.php 1 Mar 2008 18:32:11 -0000 1.6 --- common.php 6 Mar 2008 03:09:36 -0000 1.7 *************** *** 29,33 **** } ! $mx_user->set_module_default_style('_core'); // For compatibility with core 2.8.x // --- 29,36 ---- } ! //$mx_user->set_module_default_style('_core'); // For compatibility with core 2.8.x ! ! // Cache settings ! $use_cache = 1; // *************** *** 38,47 **** $sql = "SELECT * FROM " . MODULE_TABLE . " WHERE module_name = '$module_name'"; ! if( !($result = $db->sql_query($sql)) ) { ! mx_message_die(GENERAL_ERROR, "Couldn't obtain the module informations from database", '', __LINE__, __FILE__, $sql); } ! while( $module = $db->sql_fetchrow($result) ) { $music_module_copy = $module['module_copy']; --- 41,50 ---- $sql = "SELECT * FROM " . MODULE_TABLE . " WHERE module_name = '$module_name'"; ! if(!($result = $db->sql_query($sql))) { ! mx_message_die(GENERAL_ERROR, "Couldn't obtain shotcast module informations from database", '', __LINE__, __FILE__, $sql); } ! while($module = $db->sql_fetchrow($result)) { $music_module_copy = $module['module_copy']; *************** *** 63,82 **** // Load language files. // ! if( file_exists($module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx) ) ! { ! include($module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx); ! } ! else { ! include($module_root_path . 'language/lang_english/lang_admin.' . $phpEx); } ! //Load main laguage file ! if( file_exists($module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx) ) { ! include($module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx); } else { ! include($module_root_path . 'language/lang_english/lang_main.' . $phpEx); } --- 66,89 ---- // Load language files. // ! $default_lang = ($mx_user->lang['default_lang']) ? $mx_user->lang['default_lang'] : (($board_config['default_lang']) ? $board_config['default_lang'] : 'english'); ! ! //Main module lang ! if ((@include $module_root_path . "language/lang_" . $default_lang . "/lang_main.$phpEx") === false) { ! if ((@include $module_root_path . "language/lang_english/lang_main.$phpEx") === false) ! { ! mx_message_die(CRITICAL_ERROR, 'Language file ' . $module_root_path . "language/lang_" . $default_lang . "/lang_main.$phpEx" . ' couldn\'t be opened.'); ! } ! $default_lang = 'english'; } ! ! //Admin Module Lang ! if( file_exists($module_root_path . "language/lang_" . $default_lang . "/lang_admin.$phpEx") ) { ! include($module_root_path . "language/lang_" . $default_lang . "/lang_admin.$phpEx"); } else { ! include($module_root_path . "language/lang_english/lang_admin.$phpEx"); } *************** *** 117,135 **** // Get radio Settings from config table // ! if( defined('IN_SHOTCAST') ) { $shotcast_config = array(); ! $sql = "SELECT * FROM ".SHOTCAST_CONFIG_TABLE; ! if( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, "Couldn't query shotcast config table", "", __LINE__, __FILE__, $sql); ! } ! else { ! while( $row = $db->sql_fetchrow($result) ) { ! $shotcast_config[$row['config_name']] = $row['config_value']; } } } --- 124,158 ---- // Get radio Settings from config table // ! if (($mx_cache->get('shotcast_config')) && ($use_cache)) ! { ! $shotcast_config = $mx_cache->get('shotcast_config'); ! } ! else if(defined('IN_SHOTCAST')) { $shotcast_config = array(); ! $sql = "SELECT * FROM " . SHOTCAST_CONFIG_TABLE; ! ! if (!($result = $db->sql_query($sql))) { ! if (!function_exists('mx_message_die')) { ! die("Couldnt query shotcast_config information, Allso this hosting or server is using a cache optimizer not compatible with MX-Publisher or just lost connection to database wile query."); } + else + { + mx_message_die( GENERAL_ERROR, 'Couldnt query shotcast_config information', '', __LINE__, __FILE__, $sql ); + } + } + + while ($row = $db->sql_fetchrow($result)) + { + $shotcast_config[$row['config_name']] = $row['config_value']; + } + $db->sql_freeresult($result); + + if ($use_cache) + { + $mx_cache->put('shotcast_config', $shotcast_config); } } |