|
From: OryNider <ory...@us...> - 2008-03-07 03:28:32
|
Update of /cvsroot/mxbb/mx_radio/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29322/includes Modified Files: common.php Log Message: Index: common.php =================================================================== RCS file: /cvsroot/mxbb/mx_radio/includes/common.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** common.php 1 Mar 2008 18:33:42 -0000 1.4 --- common.php 7 Mar 2008 03:26:26 -0000 1.5 *************** *** 44,65 **** // // 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); } --- 44,74 ---- // + // Cache settings + // + $use_cache = 1; + + // // 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"); } *************** *** 97,119 **** // ================================================================================ ! // ! // Get radio Settings from config table ! // ! ! if( defined('_RADIO_CONFIG') ) { $radio_config = array(); ! $sql = "SELECT * FROM ".RADIO_CONFIG_TABLE; ! if( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, "Couldn't query radio config table", "", __LINE__, __FILE__, $sql); ! } ! else { ! while($row = $db->sql_fetchrow($result)) { ! $radio_config[$row['config_name']] = $row['config_value']; } } } --- 106,140 ---- // ================================================================================ ! if (($mx_cache->get('radio_config')) && ($use_cache)) ! { ! $radio_config = $mx_cache->get('radio_config'); ! } ! else if(defined('_RADIO_CONFIG')) { $radio_config = array(); ! $sql = "SELECT * FROM " . RADIO_CONFIG_TABLE; ! ! if (!($result = $db->sql_query($sql))) { ! if (!function_exists('mx_message_die')) { ! die("Couldnt query radio_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 radio_config information', '', __LINE__, __FILE__, $sql ); + } + } + + while ($row = $db->sql_fetchrow($result)) + { + $radio_config[$row['config_name']] = $row['config_value']; + } + $db->sql_freeresult($result); + + if ($use_cache) + { + $mx_cache->put('radio_config', $radio_config); } } *************** *** 122,125 **** --- 143,199 ---- $period = $radio_config['check_period'] * 1000; + // Settings by lsn (hb...@ho...) + $hostandport = explode("//", $radio_config['radio_FileName']); + + //Trasfer Protocol + if ($hostandport[0]) + { + $protocol_type = $hostandport[0]; + } + else + { + $protocol_type = 'http:'; + } + + //Domain + $hostname = $hostandport[1]; + + // Shoutcast Ip or Host + $host = explode(":", $hostname); + + if ($host[0]) + { + $radio_ip = $host[0]; + } + elseif ($hostname) + { + $radio_ip = $hostname; + } + else + { + $radio_ip = '127.0.0.0'; //localhost + } + + // Shoutcast Port + $port = explode("/", $host[1]); + + if ($port[0]) + { + $radio_port = $port[0]; + } + elseif ($host[1]) + { + $radio_port = $host[1]; + } + else + { + $radio_port = '80'; + } + + $mount = "/"; // Used for alternate path to "Streaming URL" -- leave as "/" for the default setup. + + $wmpmode = ($protocol_type == 'icyx:') ? 'icyx://' : 'http://'; // AAC VS MPEG + $mimetype = ($protocol_type == 'icyx:') ? 'audio/aacp' : 'audio/x-mpeg'; // AAC VS MPEG + // ================================================================================ // [ COMMON FUNCTIONS ] |