haodai.class.php 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * By:cr180 QQ:250997329
  4. * Date: 2013年12月9日 02:53:41
  5. * 这个脚本比较简单 只是读取了插件已缓存好的数据 帖子列表页 帖子页插入了推荐信息
  6. */
  7. !defined('IN_DISCUZ') && exit('Access Denied');
  8. class plugin_dzapp_haodai {
  9. function common() {
  10. global $_G;
  11. include_once DISCUZ_ROOT.'./data/dzapp_haodai_config.php';
  12. $_G['cache']['plugin']['dzapp_haodai']['API_citynames_1231'] = HD_CITY;
  13. $_G['cache']['plugin']['dzapp_haodai']['forumlisthot'] = unserialize($_G['cache']['plugin']['dzapp_haodai']['forumlisthot']);
  14. return;
  15. }
  16. }
  17. class plugin_dzapp_haodai_forum extends plugin_dzapp_haodai {
  18. function forumdisplay_top_output() {
  19. global $_G;
  20. if(!in_array($_G['fid'],$_G['cache']['plugin']['dzapp_haodai']['forumlisthot'])) return;
  21. if(file_exists(DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_filter_goufang.php')){
  22. include_once DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_filter_goufang.php';
  23. $goufang = $filter['filter'];
  24. }
  25. if(file_exists(DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_filter_gouche.php')){
  26. include_once DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_filter_gouche.php';
  27. $gouche = $filter['filter'];
  28. }
  29. if(file_exists(DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_filter_xiaofei.php')){
  30. include_once DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_filter_xiaofei.php';
  31. $xiaofei = $filter['filter'];
  32. }
  33. if(file_exists(DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_dkgl_'.$_G['cache']['plugin']['dzapp_haodai']['API_citynames_1231'].'.php')){
  34. include_once DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_dkgl_'.$_G['cache']['plugin']['dzapp_haodai']['API_citynames_1231'].'.php';
  35. $dkgl_article = $dkgl_article['items'];
  36. }
  37. if(!file_exists(DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_filter_goufang.php') && !file_exists(DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_filter_gouche.php') && !file_exists(DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_filter_xiaofei.php')){
  38. return '<div style="display:none">'.
  39. '<iframe width="0" height="0" src="plugin.php?id=dzapp_haodai"></iframe>'.
  40. '<iframe width="0" height="0" src="plugin.php?id=dzapp_haodai&action=search&xd_type=goufang"></iframe>'.
  41. '<iframe width="0" height="0" src="plugin.php?id=dzapp_haodai&action=search&xd_type=gouche"></iframe>'.
  42. '<iframe width="0" height="0" src="plugin.php?id=dzapp_haodai&action=search&xd_type=xiaofei"></iframe>'.
  43. '</div>';
  44. }
  45. $haodaistyle = 1;
  46. include_once template('dzapp_haodai:hook_forum');
  47. return $haodai_html;
  48. }
  49. function viewthread_postsightmlafter_output() {
  50. global $_G,$postlist;
  51. $return = array();
  52. if(!in_array($_G['fid'],$_G['cache']['plugin']['dzapp_haodai']['forumlisthot'])) return;
  53. if(file_exists(DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_jyfx_'.$_G['cache']['plugin']['dzapp_haodai']['API_citynames_1231'].'.php')){
  54. include_once DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_jyfx_'.$_G['cache']['plugin']['dzapp_haodai']['API_citynames_1231'].'.php';
  55. $jyfx_article = $jyfx_article['items'];
  56. }
  57. if(file_exists(DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_dkgl_'.$_G['cache']['plugin']['dzapp_haodai']['API_citynames_1231'].'.php')){
  58. include_once DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_dkgl_'.$_G['cache']['plugin']['dzapp_haodai']['API_citynames_1231'].'.php';
  59. $dkgl_article = $dkgl_article['items'];
  60. }
  61. if(file_exists(DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_dkzx_'.$_G['cache']['plugin']['dzapp_haodai']['API_citynames_1231'].'.php')){
  62. include_once DISCUZ_ROOT.'./data/sysdata/cache_dzapp_haodai_dkzx_'.$_G['cache']['plugin']['dzapp_haodai']['API_citynames_1231'].'.php';
  63. $dkzx_article = $dkzx_article['items'];
  64. }
  65. $haodai_article = array_merge($jyfx_article,$dkgl_article,$dkzx_article);
  66. if(!$haodai_article) return;
  67. shuffle($haodai_article);
  68. $haodaistyle = 2;
  69. include_once template('dzapp_haodai:hook_forum');
  70. foreach($postlist as $key => $post){
  71. if($post['first']){
  72. $return[] = $haodai_html;
  73. }else{
  74. $return[] = '';
  75. }
  76. }
  77. return $return;
  78. }
  79. }
  80. ?>