PageRenderTime 65ms CodeModel.GetById 37ms RepoModel.GetById 0ms app.codeStats 0ms

/Portal_XL50_Premod-3.0.8/phpBB3/portal/radio/radio.php

https://github.com/Lucky65/phpBB-Portal-XL-5.0-italian
PHP | 165 lines | 101 code | 30 blank | 34 comment | 12 complexity | 214440479622f5b214751fcbead89de9 MD5 | raw file
  1. <?php
  2. ///////////////////////////////////////////////////
  3. /// Original Script By: Pelle van der Scheer ///
  4. /// Original Version: 1.4.0 ///
  5. /// Original PHPBB Version: 2.x.x ///
  6. /// ///
  7. /// Modified Author: Insecure ///
  8. /// Modified Author: Stoker ///
  9. /// Modified Version: 2.0.5 ///
  10. /// Modified PHPBB Version: 3.x.x ///
  11. /// Website: www.phpbb3bbcodes.com ///
  12. ///////////////////////////////////////////////////
  13. /**
  14. *
  15. * @package phpBB3
  16. * @version $Id: index.php 8987 2008-10-09 14:17:02Z acydburn $
  17. * @copyright (c) 2005 phpBB Group
  18. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  19. *
  20. */
  21. /**
  22. * @ignore
  23. */
  24. define('IN_PHPBB', true);
  25. $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../../';
  26. $phpEx = substr(strrchr(__FILE__, '.'), 1);
  27. include($phpbb_root_path . 'common.' . $phpEx);
  28. include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
  29. // Start session management
  30. $user->session_begin();
  31. $auth->acl($user->data);
  32. $user->setup('mods/radio');
  33. $station = request_var('station', '', true);
  34. $uiType = request_var('uiType', '', true);
  35. ##Disable Error Reporting
  36. ##error_reporting(0);
  37. ################
  38. ## XML PARSER ##
  39. ################
  40. $xml_file = "radio.xml";
  41. $xml_radio_num = "*LIVESTREAMRADIO*STATION*NUM";
  42. $xml_radio_name = "*LIVESTREAMRADIO*STATION*NAME";
  43. $xml_radio_url = "*LIVESTREAMRADIO*STATION*URL";
  44. $xml_radio_broadband = "*LIVESTREAMRADIO*STATION*BROADBAND";
  45. $xml_radio_type = "*LIVESTREAMRADIO*STATION*TYPE";
  46. $xml_radio_genre = "*LIVESTREAMRADIO*STATION*GENRE";
  47. $radio_array = array();
  48. $counter = 1;
  49. class xml_radio{
  50. var $num, $name, $url, $broadband, $type, $genre;
  51. }
  52. function startTag($parser, $data){
  53. global $current_tag;
  54. $current_tag .= "*$data";
  55. }
  56. function endTag($parser, $data){
  57. global $current_tag;
  58. $tag_key = strrpos($current_tag, '*');
  59. $current_tag = substr($current_tag, 0, $tag_key);
  60. }
  61. function contents($parser, $data){
  62. global $current_tag, $xml_radio_num, $xml_radio_name, $xml_radio_url, $xml_radio_broadband, $xml_radio_type, $xml_radio_genre, $counter, $radio_array;
  63. switch($current_tag){
  64. case $xml_radio_num:
  65. $radio_array[$counter] = new xml_radio();
  66. $radio_array[$counter]->num = $data;
  67. break;
  68. case $xml_radio_name:
  69. $radio_array[$counter]->name = $data;
  70. break;
  71. case $xml_radio_url:
  72. $radio_array[$counter]->url = $data;
  73. break;
  74. case $xml_radio_broadband:
  75. $radio_array[$counter]->broadband = $data;
  76. break;
  77. case $xml_radio_type:
  78. $radio_array[$counter]->type = $data;
  79. break;
  80. case $xml_radio_genre:
  81. $radio_array[$counter]->genre = $data;
  82. $counter++;
  83. break;
  84. }
  85. }
  86. $xml_parser = xml_parser_create();
  87. xml_set_element_handler($xml_parser, "startTag", "endTag");
  88. xml_set_character_data_handler($xml_parser, "contents");
  89. if (!($fp = fopen($xml_file, "r"))) {
  90. die("could not open XML input");
  91. }
  92. while ($data = fread($fp, 4096)) {
  93. if (!xml_parse($xml_parser, $data, feof($fp))) {
  94. die(sprintf("XML error: %s at line %d",
  95. xml_error_string(xml_get_error_code($xml_parser)),
  96. xml_get_current_line_number($xml_parser)));
  97. }
  98. }
  99. xml_parser_free($xml_parser);
  100. ####################
  101. ## end XML Parser ##
  102. ####################
  103. $template->assign_vars(array(
  104. /* Settings */
  105. "WIDTH" => "230",
  106. "HEIGHT" => "270",
  107. "UIType" => $uiType,
  108. "RADIO" => $station,
  109. "SHOW_CONTROLS" => ($uiType == 1) ? '1' : '0',
  110. "SHOW_STATUSBAR" => ($uiType == 1) ? '1' : '0',
  111. "SHOW_DISPLAY" => ($uiType == 1) ? '1' : '0',
  112. /* Now Playing */
  113. "NP_NAME" => ($station == 0) ? '1' : $radio_array[$station]->name,
  114. "NP_URL" => ($station == 0) ? '1' : $radio_array[$station]->url,
  115. "NP_BROADBAND" => ($station == 0) ? '1' : $radio_array[$station]->broadband,
  116. "NP_TYPE" => ($station == 0) ? '1' : $radio_array[$station]->type,
  117. "NP_GENRE" => ($station == 0) ? '1' : $radio_array[$station]->genre
  118. ));
  119. for($x=1;$x<$counter;$x++){
  120. $template->assign_block_vars('xmllist',array(
  121. "NAME" => $radio_array[$x]->name,
  122. "NUM" => $radio_array[$x]->num,
  123. "URL" => $radio_array[$x]->url,
  124. "BROADBAND" => $radio_array[$x]->broadband,
  125. "TYPE" => $radio_array[$x]->type,
  126. "GENRE" => $radio_array[$x]->genre
  127. ));
  128. }
  129. // Output page
  130. page_header($user->lang['TITLE']);
  131. $template->set_filenames(array(
  132. 'body' => 'portal/portal_radio.html')
  133. );
  134. page_footer();
  135. ?>