information.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <?php
  2. define('IN_SMT', true);
  3. define('CURSCRIPT', 'information');
  4. define('IN_MYMPS', true);
  5. require_once dirname(__FILE__) . '/include/global.php';
  6. require_once MYMPS_DATA . '/config.php';
  7. require_once MYMPS_DATA . '/config.db.php';
  8. require_once MYMPS_INC . '/db.class.php';
  9. $id = isset($id) ? intval($id) : 0;
  10. ifsiteopen();
  11. runcron();
  12. $cache = get_cache_config();
  13. require_once MYMPS_INC . '/cachepages.class.php';
  14. $cachepages = new cachepages($cache['info']['time'], 'info_' . $id);
  15. $cachetime = $cache['info']['time'];
  16. $cachepages->cacheCheck();
  17. unset($cache);
  18. $seo = $seo ? $seo : get_seoset();
  19. $rewrite = $seo['seo_force_info'];
  20. if ($rewrite != 'active') {
  21. $mayimobile = get_mobile_settings();
  22. $mayimobile['mobiledomain'] = $mayimobile['mobiledomain'] ? $mayimobile['mobiledomain'] : $mymps_global['SiteUrl'] . '/m';
  23. $mayimobile['mobileuri'] = $mayimobile['mobiledomain'] . ($_SERVER['HTTP_X_ORIGINAL_URL'] ? $_SERVER['HTTP_X_ORIGINAL_URL'] : $_SERVER['REQUEST_URI']);
  24. if ($ifmobile) {
  25. write_msg('', $mayimobile['mobileuri']);
  26. exit();
  27. }
  28. }
  29. $info = $db->getRow('SELECT a.*,b.areaname,c.parentid,c.template_info,c.usecoin,c.modid FROM `' . $db_mymps . 'information` AS a LEFT JOIN `' . $db_mymps . 'area` AS b ON a.areaid = b.areaid LEFT JOIN `' . $db_mymps . 'category` AS c ON a.catid = c.catid WHERE a.id = \'' . $id . '\' AND a.info_level > 0');
  30. if (!$info) {
  31. write_msg('该信息不存在或已被删除!', $mymps_global['SiteUrl']);
  32. }
  33. if (empty($info['info_level'])) {
  34. write_msg('该信息尚未通过审核!', $mymps_global['SiteUrl']);
  35. }
  36. if ($info['usecoin'] < 0) {
  37. require_once MYMPS_INC . '/member.class.php';
  38. if (!$member_log->chk_in()) {
  39. $info['usecoin'] = '-1';
  40. }
  41. else {
  42. $info['usecoin'] = 0;
  43. }
  44. }
  45. $info['caturi'] = $rewrite == 'rewrite_py' ? $mymps_global['SiteUrl'] . '/' . $info['dir_typename'] . '/' : Rewrite('category', array('catid' => $info['catid'], 'dir_typename' => $info['dir_typename']));
  46. $advertisement = get_advertisement('info');
  47. $adveritems = $advertisement['items'];
  48. $advertisement['type'] = $advertisement['all'] ? (is_array($advertisement[$info['catid']]['type']) ? array_merge($advertisement['all']['type'], $advertisement[$info['catid']]['type']) : $advertisement['all']['type']) : $advertisement[$info['catid']]['type'];
  49. $info['description'] = mhtmlspecialchars(clear_html($info['content']));
  50. $info['zhiding'] = 1 < $info['upgrade_type'] || 1 < $info['upgrade_type_index'] ? 1 : 0;
  51. $info['endtime'] = get_info_life_time($info['endtime']);
  52. $info['contactview'] = $info['endtime'] == '<font color=red>已过期</font>' && $mymps_global['cfg_info_if_gq'] != 1 ? 0 : 1;
  53. $info['tel_base64'] = base64_encode($info['tel']);
  54. $info['tel'] = part_tel($info['tel']);
  55. $info['content'] = replace_insidelink($info['content'], 'information');
  56. if ($info['ismember'] == 1 && $info['userid']) {
  57. $member = get_member_info($info['userid']);
  58. $member['if_corp'] = $mymps_global['cfg_if_corp'] != 1 ? 0 : $member['if_corp'];
  59. $group = get_member_group('', $info['userid']);
  60. if ($member['userid'] && $group['member_contact'] == 0 && $info['ismember'] == '1') {
  61. $info['tel'] = $mymps_global['SiteTel'];
  62. $info['qq'] = $mymps_global['SiteQQ'];
  63. $info['email'] = $mymps_global['SiteEmail'];
  64. }
  65. $info['userid'] = $member['if_corp'] == 1 ? '<a title="' . $member['tname'] . '" target=_blank href="' . Rewrite('store', array('uid' => $member['id'])) . '">' . cutstr($member['tname'], 28) . '</a>' : '<a target=_blank href="' . Rewrite('space', array('user' => $info['userid'])) . '">' . $info['userid'] . '</a>';
  66. }
  67. else if ($info['userid']) {
  68. $member = get_member_info($info['userid']);
  69. $info['userid'] = '<a href="' . Rewrite('space', array('user' => $info['userid'])) . '" target=_blank>' . $info[userid] . '</a>';
  70. }
  71. else {
  72. $info['userid'] = $info['contact_who'];
  73. }
  74. if (function_exists('gd_info') && $mymps_global['cfg_info_if_img'] == 1) {
  75. $info['qqnum'] = $info['qq'] ? '<img src="' . $mymps_global['SiteUrl'] . '/' . $mymps_global['cfg_authcodefile'] . '?part=contact&wid=130&strings=' . base64_encode($info['qq']) . '">' : $info['qq'];
  76. $info['email'] = $info['email'] ? '<img src="' . $mymps_global['SiteUrl'] . '/' . $mymps_global['cfg_authcodefile'] . '?part=contact&wid=230&strings=' . base64_encode($info['email']) . '">' : $info['email'];
  77. $info['telephone'] = $info['tel'] ? '<img src="' . $mymps_global['SiteUrl'] . '/' . $mymps_global['cfg_authcodefile'] . '?part=contact&wid=130&strings=' . base64_encode($info['tel']) . '">' : $info['tel'];
  78. }
  79. else {
  80. $info['qqnum'] = $info['qq'];
  81. $info['telephone'] = $info['tel'];
  82. }
  83. $info['ip'] = $info['ip'] != '' ? part_ip($info['ip']) : '';
  84. if (1 < $info['modid']) {
  85. $extr = $db->getRow('SELECT * FROM `' . $db_mymps . 'information_' . $info[modid] . '` WHERE id =\'' . $id . '\'');
  86. if (is_array($extr)) {
  87. $des = get_info_option_array();
  88. unset($extr['iid']);
  89. unset($extr['id']);
  90. unset($extr['content']);
  91. foreach ($extr as $k => $v) {
  92. $val = get_info_option_titval($des[$k], $v);
  93. $arr['title'] = $val['title'];
  94. $arr['value'] = $val['value'];
  95. $info['extra'][] = $arr;
  96. $info[$k] = $val['value'];
  97. }
  98. $des = NULL;
  99. }
  100. }
  101. $info['image'] = $info['img_path'] != '' ? $db->getAll('SELECT prepath,path FROM `' . $db_mymps . 'info_img` WHERE infoid = \'' . $id . '\' ORDER BY id ASC') : false;
  102. $pdetail = ($info['img_path'] != '' ? '【图】' : '') . $info['title'] . '-' . $mymps_global['SiteCity'] . $info['areaname'] . $info['catname'] . '-' . $mymps_global['SiteName'];
  103. $loc = get_location('category', $info['catid'], '', '', $pdetail);
  104. $location = $loc['location'];
  105. $page_title = $loc['page_title'];
  106. $cat = array();
  107. $cat['catid'] = $info['catid'];
  108. $cat['parentid'] = $info['parentid'];
  109. if (0 < $cat['parentid']) {
  110. $flag = array_reverse(get_parent_cats('category', $cat['parentid']));
  111. $cat['parentid'] = $flag[0]['catid'];
  112. }
  113. $info['img_path'] = $info['img_path'] ? $info['img_path'] : '/images/nophoto.jpg';
  114. $relate_cat = get_categories_tree($info['parentid']);
  115. $latest_info = mymps_get_infos(10, '', '', '', $info['catid']);
  116. globalassign();
  117. include mymps_tpl($info['template_info'] ? $info['template_info'] : 'info');
  118. is_object($db) && $db->Close();
  119. $cachetime && $cachepages->caching();
  120. $advertisement = NULL;
  121. unset($advertisement);
  122. ?>