PageRenderTime 64ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/01.Source/01.CORE/modules/news/funcs/rss.php

http://creative-portal.googlecode.com/
PHP | 70 lines | 57 code | 7 blank | 6 comment | 7 complexity | c6d2ba78fac9bdf0c03e03f344ddd78d MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /**
  3. * @Project NUKEVIET 3.0
  4. * @Author VINADES (contact@vinades.vn)
  5. * @Copyright (C) 2010 VINADES. All rights reserved
  6. * @Createdate Apr 20, 2010 10:47:41 AM
  7. */
  8. if ( ! defined( 'NV_IS_MOD_NEWS' ) )
  9. {
  10. die( 'Stop!!!' );
  11. }
  12. $channel = array();
  13. $items = array();
  14. $channel['title'] = $global_config['site_name'] . ' RSS: ' . $module_info['custom_title'];
  15. $channel['link'] = NV_MY_DOMAIN . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name;
  16. $channel['atomlink'] = NV_MY_DOMAIN . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=rss";
  17. $channel['description'] = $global_config['site_description'];
  18. $catid = 0;
  19. if ( isset( $array_op[1] ) )
  20. {
  21. $alias_cat_url = $array_op[1];
  22. $cattitle = "";
  23. foreach ( $global_array_cat as $catid_i => $array_cat_i )
  24. {
  25. if ( $alias_cat_url == $array_cat_i['alias'] )
  26. {
  27. $catid = $catid_i;
  28. break;
  29. }
  30. }
  31. }
  32. if ( ! empty( $catid ) )
  33. {
  34. $channel['title'] = $global_config['site_name'] . ' RSS: ' . $module_info['custom_title'] . ' - ' . $global_array_cat[$catid]['title'];
  35. $channel['link'] = NV_MY_DOMAIN . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=rss/" . $alias_cat_url;
  36. $channel['description'] = $global_array_cat[$catid]['description'];
  37. $sql = "SELECT id, listcatid, publtime, title, alias, hometext, homeimgfile FROM `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid . "` WHERE inhome='1' AND publtime < " . NV_CURRENTTIME . " AND (exptime=0 OR exptime >" . NV_CURRENTTIME . ") ORDER BY publtime DESC LIMIT 30";
  38. }
  39. else
  40. {
  41. $sql = "SELECT id, listcatid, publtime, title, alias, hometext, homeimgfile FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE inhome='1' AND publtime < " . NV_CURRENTTIME . " AND (exptime=0 OR exptime >" . NV_CURRENTTIME . ") ORDER BY publtime DESC LIMIT 30";
  42. }
  43. if ( $module_info['rss'] )
  44. {
  45. $result = $db->sql_query( $sql );
  46. while ( list( $id, $listcatid, $publtime, $title, $alias, $hometext, $homeimgfile ) = $db->sql_fetchrow( $result ) )
  47. {
  48. $arr_catid = explode( ',', $listcatid );
  49. $catid_i = end( $arr_catid );
  50. $catalias = $global_array_cat[$catid_i]['alias'];
  51. $rimages = ( ! empty( $homeimgfile ) ) ? "<img src=\"" . NV_MY_DOMAIN . NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module_name . "/" . $homeimgfile . "\" width=\"100\" align=\"left\" border=\"0\">" : "";
  52. $items[] = array( //
  53. 'title' => $title, //
  54. 'link' => NV_MY_DOMAIN . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=" . $catalias . '/' . $alias . '-' . $id, //
  55. 'guid' => $module_name . '_' . $id, //
  56. 'description' => $rimages . $hometext, //
  57. 'pubdate' => $publtime //
  58. );
  59. }
  60. }
  61. nv_rss_generate( $channel, $items );
  62. die();
  63. ?>