PageRenderTime 41ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/music/rssdata.php

http://nukeviet-music.googlecode.com/
PHP | 87 lines | 61 code | 15 blank | 11 comment | 2 complexity | 86ab9618771d2c791bc5eb4d3adbd67b MD5 | raw file
  1. <?php
  2. /**
  3. * @Project NUKEVIET-MUSIC
  4. * @Author Phan Tan Dung (phantandung92@gmail.com)
  5. * @Copyright (C) 2011 Freeware
  6. * @Createdate 26/01/2011 09:09 AM
  7. */
  8. if( ! defined( 'NV_IS_MOD_RSS' ) ) die( 'Stop!!!' );
  9. $rssarray = array();
  10. // Get lang
  11. $path_lang_ini = NV_ROOTDIR . "/modules/" . $mod_file . "/language/rss.ini";
  12. $xml = simplexml_load_file( $path_lang_ini );
  13. if( $xml !== false )
  14. {
  15. $xmllanguage_tmp = $xml->xpath( 'language' );
  16. $language_tmp = ( array )$xmllanguage_tmp[0];
  17. $lang_rss = ( array )$language_tmp[NV_LANG_INTERFACE];
  18. // Gift RSS
  19. $rssarray[1] = array(
  20. 'catid' => 1,
  21. 'parentid' => 0,
  22. 'title' => $lang_rss['rss_gift'],
  23. 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $mod_name . "&amp;" . NV_OP_VARIABLE . "=rss/" . change_alias( $lang_rss['rss_gift'] ) //
  24. );
  25. // Playlist RSS
  26. $rssarray[2] = array(
  27. 'catid' => 2,
  28. 'parentid' => 0,
  29. 'title' => $lang_rss['rss_play_list'],
  30. 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $mod_name . "&amp;" . NV_OP_VARIABLE . "=rss/" . change_alias( $lang_rss['rss_play_list'] ) //
  31. );
  32. // Music RSS
  33. $result2 = $db->sql_query( "SELECT `id`, `title` FROM `" . NV_PREFIXLANG . "_" . $mod_data . "_category` ORDER BY `title`" );
  34. $num_this_rss = $db->sql_numrows( $result2 );
  35. $rssarray[3] = array(
  36. 'catid' => 3,
  37. 'parentid' => 0,
  38. 'title' => $lang_rss['rss_music'],
  39. 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $mod_name . "&amp;" . NV_OP_VARIABLE . "=rss/" . change_alias( $lang_rss['rss_music'] ) //
  40. );
  41. while( list( $catid, $title ) = $db->sql_fetchrow( $result2 ) )
  42. {
  43. $next_key = count( $rssarray ) + 1;
  44. $rssarray[$next_key] = array(
  45. 'catid' => $next_key,
  46. 'parentid' => 3,
  47. 'title' => $title,
  48. 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $mod_name . "&amp;" . NV_OP_VARIABLE . "=rss/" . change_alias( $lang_rss['rss_music'] ) . "/" . change_alias( $title ) //
  49. );
  50. }
  51. // Video RSS
  52. $result2 = $db->sql_query( "SELECT `id`, `title` FROM `" . NV_PREFIXLANG . "_" . $mod_data . "_video_category` ORDER BY `title`" );
  53. $num_this_rss = $db->sql_numrows( $result2 );
  54. $video_key = count( $rssarray ) + 1;
  55. $rssarray[$video_key] = array(
  56. 'catid' => $video_key,
  57. 'parentid' => 0,
  58. 'title' => $lang_rss['rss_video'],
  59. 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $mod_name . "&amp;" . NV_OP_VARIABLE . "=rss/" . change_alias( $lang_rss['rss_video'] ) //
  60. );
  61. while( list( $catid, $title ) = $db->sql_fetchrow( $result2 ) )
  62. {
  63. $next_key = count( $rssarray ) + 1;
  64. $rssarray[$next_key] = array(
  65. 'catid' => $next_key,
  66. 'parentid' => $video_key,
  67. 'title' => $title,
  68. 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $mod_name . "&amp;" . NV_OP_VARIABLE . "=rss/" . change_alias( $lang_rss['rss_video'] ) . "/" . change_alias( $title ) //
  69. );
  70. }
  71. }
  72. ?>