group.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <?php
  2. function get_group_location($cate_id = 0, $str = '')
  3. {
  4. global $db;
  5. global $db_mymps;
  6. global $group_class;
  7. global $city;
  8. $raquo = $GLOBALS['mymps_global']['cfg_raquo'];
  9. $location = '当前位置:<a href="' . ($city['domain'] ? $city['domain'] : $GLOBALS['mymps_global']['SiteUrl']) . '">' . $city['cityname'] . $GLOBALS['mymps_global']['SiteName'] . '</a>' . ' <code>' . $raquo . '</code> ' . ' <a href="' . $city['domain'] . plugin_url(CURSCRIPT, array('cate_id' => 0)) . '">' . $city[cityname] . '团购活动</a>';
  10. $page_title = $city['cityname'] . '团购活动-' . $GLOBALS['mymps_global']['SiteName'];
  11. if (!empty($cate_id)) {
  12. $page_title = htmlspecialchars($group_class[$cate_id]['cate_name']) . '-' . $page_title;
  13. $location .= ' <code> ' . $raquo . ' </code> <a href="' . $city['domain'] . $group_class[$cate_id]['cate_uri'] . '">' . htmlspecialchars($group_class[$cate_id]['cate_name']) . '</a>';
  14. }
  15. $page_title = $GLOBALS['mymps_global']['SiteCity'] . ($GLOBALS['areaid'] ? get_areaname($GLOBALS['areaid']) : '') . $page_title;
  16. if (!empty($str)) {
  17. $page_title = $str . '-' . $page_title;
  18. $location .= ' <code>' . $raquo . '</code> &nbsp;' . $str;
  19. }
  20. $cur = array('page_title' => $page_title, 'location' => $location);
  21. unset($page_title);
  22. unset($cat);
  23. unset($location);
  24. unset($type);
  25. unset($group_class);
  26. return $cur;
  27. }
  28. define('IN_SMT', true);
  29. define('CURSCRIPT', 'group');
  30. define('IN_MYMPS', true);
  31. define('DIR_NAV', dirname(__FILE__));
  32. require_once DIR_NAV . '/include/global.php';
  33. require_once MYMPS_DATA . '/config.php';
  34. require_once MYMPS_DATA . '/config.db.php';
  35. require_once MYMPS_INC . '/db.class.php';
  36. ifsiteopen();
  37. $id = isset($id) ? intval($id) : '';
  38. $cate_id = isset($cate_id) ? intval($cate_id) : 0;
  39. $data = $pluginsettings = '';
  40. $areaid = isset($areaid) ? intval($areaid) : 0;
  41. $page = isset($page) ? intval($page) : 1;
  42. !ifplugin(CURSCRIPT) && exit('管理员已禁用或未安装团购插件...');
  43. if (!submit_check(CURSCRIPT . '_submit')) {
  44. require_once DIR_NAV . '/plugin/group/include/functions.php';
  45. require_once MYMPS_DATA . '/grouplevel.inc.php';
  46. $group_class = get_group_class();
  47. if ($id) {
  48. $group = $db->getRow('SELECT * FROM `' . $db_mymps . 'group` WHERE groupid = \'' . $id . '\' AND glevel > \'0\'');
  49. if (!$group['groupid']) {
  50. write_msg('该团购活动不存在或者尚未通过审核!', $mymps_global['SiteUrl']);
  51. }
  52. $group['remaindate'] = intval(($group['enddate'] - $timestamp) / 86400);
  53. $data = '';
  54. @include MYMPS_DATA . '/caches/area_option_static.php';
  55. $group['areaname'] = $data ? $data[$group['areaid']]['areaname'] : $db->getOne('SELECT areaname FROM `' . $db_mymps . 'area` WHERE areaid = \'' . $group['areaid'] . '\'');
  56. $data = NULL;
  57. $group['content'] = replace_insidelink($group['content'], 'group');
  58. $share = array();
  59. $share['title'] = urlencode($group['gname']);
  60. $share['url'] = plugin_url(CURSCRIPT, array('id' => $group['groupid']));
  61. $loc = get_group_location($group['cate_id'], $group['gname']);
  62. $page_title = $loc['page_title'];
  63. $location = $loc['location'];
  64. $advertisement = get_advertisement('other');
  65. $adveritems = $city['advertisement'];
  66. $advertisement = $advertisement['all'];
  67. $hotgroup = mymps_get_groups(15, 1);
  68. globalassign();
  69. include mymps_tpl('view');
  70. }
  71. else {
  72. $area_class = cat_list('area', 0, 0, false, 1);
  73. $area_class = array_merge(array(
  74. array('areaid' => '', 'areaname' => '全部')
  75. ), $area_class);
  76. if (is_array($area_class)) {
  77. foreach ($area_class as $areakey => $areaval) {
  78. $area_class[$areakey]['uri'] = plugin_url(CURSCRIPT, array('cate_id' => $cate_id, 'areaid' => $areaval['areaid']));
  79. $area_class[$areakey]['select'] = $areaval['areaid'] == $areaid ? '1' : 0;
  80. }
  81. }
  82. $where = 'WHERE glevel > \'0\'';
  83. if ($cate_id) {
  84. $where .= ' AND cate_id = \'' . $cate_id . '\'';
  85. }
  86. if ($cityid) {
  87. $where .= ' AND cityid = \'' . $cityid . '\'';
  88. }
  89. if ($areaid) {
  90. $where .= ' AND areaid = \'' . $areaid . '\'';
  91. }
  92. $rows_num = $db->getOne('SELECT COUNT(groupid) FROM `' . $db_mymps . 'group` ' . $where);
  93. $param = setParam(array('cateid', 'areaid'));
  94. $group = page1('SELECT * FROM `' . $db_mymps . 'group` ' . $where . ' ORDER BY displayorder DESC');
  95. $list = array();
  96. foreach ($group as $k => $v) {
  97. $list[$v['groupid']]['groupid'] = $v['groupid'];
  98. $list[$v['groupid']]['gname'] = $v['gname'];
  99. $list[$v['groupid']]['des'] = clear_html($v['des']);
  100. $list[$v['groupid']]['enddate'] = $v['enddate'];
  101. $list[$v['groupid']]['meetdate'] = $v['meetdate'];
  102. $list[$v['groupid']]['gaddress'] = $v['gaddress'];
  103. $list[$v['groupid']]['glevel'] = $v['glevel'];
  104. $list[$v['groupid']]['signintotal'] = $v['signintotal'];
  105. $list[$v['groupid']]['commenturl'] = $v['commenturl'];
  106. $list[$v['groupid']]['pre_picture'] = $v['pre_picture'];
  107. $list[$v['groupid']]['uri'] = plugin_url('group', array('id' => $v['groupid']));
  108. }
  109. $page_view = page2();
  110. $hotgroup = mymps_get_groups('15', 1);
  111. $hotgroup = $hotgroup ? $hotgroup : array();
  112. $loc = get_group_location($cate_id);
  113. $page_title = empty($cate_id) && empty($areaid) ? ($pluginsettings[CURSCRIPT]['seotitle'] ? $pluginsettings[CURSCRIPT]['seotitle'] : $loc['page_title']) : $loc['page_title'];
  114. $page_title = str_replace('{city}', $city['cityname'], $page_title);
  115. $location = $loc['location'];
  116. $seo = array();
  117. $seo['keywords'] = str_replace('{city}', $city['cityname'], $pluginsettings[CURSCRIPT]['seokeywords']);
  118. $seo['description'] = str_replace('{city}', $city['cityname'], $pluginsettings[CURSCRIPT]['seodescription']);
  119. $advertisement = get_advertisement('other');
  120. $adveritems = $city['advertisement'];
  121. $advertisement = $advertisement['all'];
  122. globalassign();
  123. include mymps_tpl('index');
  124. }
  125. }
  126. else {
  127. $sname = $sname ? mhtmlspecialchars($sname) : '';
  128. $id = isset($id) ? intval($id) : '';
  129. $qqmsn = isset($qqmsn) ? mhtmlspecialchars($qqmsn) : '';
  130. $tel = isset($tel) ? mhtmlspecialchars($tel) : '';
  131. $signinip = GetIP();
  132. $sex = isset($sex) ? mhtmlspecialchars($sex) : '';
  133. $message = isset($message) ? textarea_post_change($message) : '';
  134. $totalnumber = isset($totalnumber) ? intval($totalnumber) : '';
  135. $age = isset($age) ? mhtmlspecialchars($age) : '';
  136. if (empty($id)) {
  137. write_msg('您报名的团购活动不存在!');
  138. }
  139. if (empty($sname)) {
  140. write_msg('姓名不能为空!');
  141. }
  142. if (!($randcode = mymps_chk_randcode($checkcode))) {
  143. write_msg('验证码输入错误,请返回重新输入');
  144. }
  145. $db->query('UPDATE `' . $db_mymps . 'group` SET signintotal = signintotal + 1 WHERE groupid = \'' . $id . '\'');
  146. $db->query('INSERT INTO `' . $db_mymps . 'group_signin` (groupid,sname,sex,tel,age,qqmsn,signinip,dateline,totalnumber,message) VALUES (\'' . $id . '\',\'' . $sname . '\',\'' . $sex . '\',\'' . $tel . '\',\'' . $age . '\',\'' . $qqmsn . '\',\'' . $signinip . '\',\'' . $timestamp . '\',\'' . $totalnumber . '\',\'' . $message . '\')');
  147. write_msg('报名提交成功,我们会尽快与您取得联系!', plugin_url(CURSCRIPT, array('id' => $id)));
  148. }
  149. is_object($db) && $db->Close();
  150. $city = $maincity = NULL;
  151. unset($city);
  152. unset($maincity);
  153. ?>