event_thread.class.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. <?php
  2. /**
  3. * [疯狂活动(xj_event.{modulename})] (C)2012-2099 Powered by 逍遥设计.
  4. * Version: 1.0
  5. * Date: 2012-9-11 12:03
  6. */
  7. if (!defined('IN_DISCUZ')) {
  8. exit('Access Denied');
  9. }
  10. define('EVENT_NAME', lang('plugin/xj_event', 'fabuhd'));
  11. define('EVENT_BUTTONTEXT', lang('plugin/xj_event', 'fabuhd'));
  12. define('EVENT_ICON', 'images/event.gif');
  13. loadcache('plugin');
  14. class threadplugin_xj_event {
  15. public $name = EVENT_NAME;
  16. //主题类型名称
  17. public $iconfile = EVENT_ICON;
  18. //发布主题链接中的前缀图标
  19. public $buttontext = EVENT_BUTTONTEXT;
  20. //发帖时按钮文字
  21. public function newthread($fid) {
  22. global $_G;
  23. if (file_exists(DISCUZ_ROOT . './source/plugin/xj_event/module/eventurl/view.php')) { //外链活动跳转
  24. $module_eventurl = true;
  25. }
  26. $extcredits = $_G['setting']['extcredits'];
  27. $citys = explode("\r\n", $_G['cache']['plugin']['xj_event']['city']);
  28. $tmp = explode("\n", $_G['cache']['plugin']['xj_event']['event_offline_class']);
  29. $offlineclass = array();
  30. foreach ($tmp as $key => $value) {
  31. $offlineclass[] = explode("|", $value);
  32. }
  33. $tmp = explode("\n", $_G['cache']['plugin']['xj_event']['event_online_class']);
  34. $onlineclass = array();
  35. foreach ($tmp as $key => $value) {
  36. $onlineclass[] = explode("|", $value);
  37. }
  38. $userfield = unserialize($_G['setting']['activityfield']);
  39. //新的报名字段
  40. $myuserfield = DB::fetch_all("SELECT * FROM " . DB::table('xj_event_field') . " ORDER BY id");
  41. $activity['ufield']['userfield'] = array('realname', 'mobile');
  42. //获取模板
  43. $tmp = explode("\n", $_G['cache']['plugin']['xj_event']['event_template']);
  44. $event_template = array();
  45. foreach ($tmp as $key => $value) {
  46. $ctmp = array();
  47. $ctmp = explode("|", $value);
  48. $ctmp[0] = str_replace("\r", '', $ctmp[0]);
  49. $ctmp[1] = str_replace("\r", '', $ctmp[1]);
  50. $event_template[] = $ctmp;
  51. }
  52. $forumlist = $this -> forumselect(false, 0, 0, true);
  53. //二级地区分类调用
  54. if ($_G['cache']['plugin']['xj_event']['event_city']) {
  55. $lang_province = lang('spacecp', 'district_level_1');
  56. $lang_city = lang('spacecp', 'district_level_2');
  57. $province = DB::fetch_all("SELECT * FROM " . DB::table('common_district') . " WHERE level = 1");
  58. $city = DB::fetch_all("SELECT * FROM " . DB::table('common_district') . " WHERE level = 2 order by upid");
  59. $i = 0;
  60. $tempid = 1;
  61. foreach ($city as $key => $value) {
  62. if ($value['upid'] != $tempid) {
  63. $i = 0;
  64. $tempid = $value['upid'];
  65. }
  66. $city[$key]['displayorder'] = $i;
  67. $i++;
  68. }
  69. };
  70. include template('xj_event:post_event');
  71. return $return;
  72. }
  73. public function newthread_submit($fid, $tid) {
  74. global $_G;
  75. if (!in_array('mobile', $_GET['userfield']) && $_GET['seccode'] == 1) {
  76. showmessage(lang('plugin/xj_event', 'qylbmdxbtzlxbx'));
  77. }
  78. }
  79. public function newthread_submit_end($fid, $tid, $pid) {
  80. global $_G;
  81. date_default_timezone_set('Asia/Shanghai');
  82. $items = DB::fetch(DB::query("SELECT * FROM " . DB::table('forum_post') . " WHERE tid = '$tid'"));
  83. $pid = $items['pid'];
  84. $postclass = intval($_GET['postclass']);
  85. $starttime = @strtotime($_GET['starttime']);
  86. $endtime = @strtotime($_GET['endtime']);
  87. $offlineclass = intval($_GET['offlineclass']);
  88. $onlineclass = intval($_GET['onlineclass']);
  89. $citys = addslashes($_GET['citys']);
  90. $event_address = addslashes($_GET['event_address']);
  91. $event_number = intval($_GET['event_number']);
  92. $event_number_man = intval($_GET['event_number_man']);
  93. $event_number_woman = intval($_GET['event_number_woman']);
  94. $event_number_max = intval($_GET['event_number_max']);
  95. $use_extcredits_num = intval($_GET['use_extcredits_num']);
  96. $use_extcredits = intval($_GET['use_extcredits']);
  97. $use_cost = doubleval($_GET['use_cost']);
  98. $activityexpiration = @strtotime($_GET['activityexpiration']);
  99. //截止时间
  100. $activitybegin = @strtotime($_GET['activitybegin']);
  101. //截止时间
  102. $eventorder = intval($_GET['eventorder']);
  103. foreach ($_GET['userfield'] as $value) {
  104. $tmp[] = addslashes($value);
  105. }
  106. $userfield = serialize($tmp);
  107. $setting['event_admin'] = explode(',', $_GET['event_admin']);
  108. $setting['noverify'] = intval($_GET['noverify']);
  109. $setting['statements'] = intval($_GET['statements']);
  110. $setting['eventzy_enable'] = intval($_GET['eventzy_enable']);
  111. $setting['eventzy_name'] = addslashes($_GET['eventzy_name']);
  112. $setting['eventzy_fid'] = intval($_GET['eventzy_fid']);
  113. $setting['eventzy_xz'] = intval($_GET['eventzy_xz']);
  114. $setting['eventpay'] = intval($_GET['eventpay']);
  115. $setting['eventaa'] = intval($_GET['eventaa']);
  116. $setting['seccode'] = intval($_GET['seccode']);
  117. $setting['reply'] = intval($_GET['reply']);
  118. $setting['nodaibaoming'] = intval($_GET['nodaibaoming']);
  119. $setting['success_sms'] = intval($_GET['success_sms']);
  120. $setting['vip_discount'] = $_GET['vip_discount'];
  121. $setting['app_benefit'] = $_GET['app_benefit'];
  122. //APP报名优惠
  123. $setting['event_url'] = $_GET['event_url'];
  124. //活动场次
  125. if ($_GET['sessionstr']) {
  126. $tmparray = explode("\r\n", $_GET['sessionstr']);
  127. $sessionarray = array();
  128. foreach ($tmparray as $value) {
  129. $tmpvalue = explode("=", $value);
  130. $sessionarray[$tmpvalue[0]] = $tmpvalue[1];
  131. }
  132. $setting['session'] = $sessionarray;
  133. }
  134. //更多选项
  135. foreach ($_GET['setting_itemname'] as $key => $value) {
  136. $tmparray = array();
  137. if ($value) {
  138. $tmparray['itemname'] = addslashes($value);
  139. $tmparray['itemcontent'] = addslashes($_GET['setting_itemcontent'][$key]);
  140. $setting['moreitem'][] = $tmparray;
  141. }
  142. }
  143. //多种报名费用
  144. $setting['cost'] = array();
  145. $i = 1;
  146. foreach ($_GET['cost_price'] as $key => $value) {
  147. $value = floatval($value);
  148. if ($_GET['cost_name'][$key]) {
  149. $setting['cost'][$i]['cost_name'] = $_GET['cost_name'][$key];
  150. $setting['cost'][$i]['cost_price'] = $_GET['cost_price'][$key];
  151. $setting['cost'][$i]['cost_credits'] = $_GET['cost_credits'][$key];
  152. $setting['cost'][$i]['cost_youhui'] = $_GET['cost_youhui'][$key];
  153. $setting['cost'][$i]['id'] = $i;
  154. }
  155. $i++;
  156. }
  157. //活动联系电话
  158. $setting['tel'] = addslashes($_GET['tel']);
  159. //新报名字段
  160. $setting['myuserfield'] = $_GET['myuserfield'];
  161. $setting_str = serialize($setting);
  162. $activityaid = intval($_GET['activityaid']);
  163. convertunusedattach($activityaid, $tid, $pid);
  164. $activityaid_url = addslashes($_GET['activityaid_url']);
  165. DB::query("INSERT INTO " . DB::table('xj_event') . "
  166. (tid, postclass, starttime, endtime, offlineclass, onlineclass, citys, event_address, event_number, event_number_man, event_number_woman, event_number_max, use_extcredits_num, use_extcredits, use_cost, activitybegin, activityexpiration, userfield,activityaid, activityaid_url,setting,eventorder)
  167. VALUES
  168. ('$tid', '$postclass', '$starttime', '$endtime', '$offlineclass', '$onlineclass', '$citys', '$event_address', '$event_number', '$event_number_man', '$event_number_woman', '$event_number_max', '$use_extcredits_num', '$use_extcredits', '$use_cost', '$activitybegin' , '$activityexpiration' ,'$userfield','$activityaid' ,'$activityaid_url','$setting_str','$eventorder') ");
  169. }
  170. public function editpost($fid, $tid) {
  171. global $_G;
  172. if (file_exists(DISCUZ_ROOT . './source/plugin/xj_event/module/eventurl/view.php')) { //外链活动跳转
  173. $module_eventurl = true;
  174. }
  175. $items = DB::fetch(DB::query("SELECT * FROM " . DB::table('xj_event') . " WHERE tid = '$tid'"));
  176. $extcredits = $_G['setting']['extcredits'];
  177. $citys = explode("\r\n", $_G['cache']['plugin']['xj_event']['city']);
  178. $tmp = explode("\n", $_G['cache']['plugin']['xj_event']['event_offline_class']);
  179. $offlineclass = array();
  180. foreach ($tmp as $key => $value) {
  181. $offlineclass[] = explode("|", $value);
  182. }
  183. $tmp = explode("\n", $_G['cache']['plugin']['xj_event']['event_online_class']);
  184. $onlineclass = array();
  185. foreach ($tmp as $key => $value) {
  186. $onlineclass[] = explode("|", $value);
  187. }
  188. $starttime = dgmdate($items['starttime'], 'dt');
  189. $endtime = dgmdate($items['endtime'], 'dt');
  190. $activitybegin = dgmdate($items['activitybegin'], 'dt');
  191. $activityexpiration = dgmdate($items['activityexpiration'], 'dt');
  192. $selectuserfield = unserialize($items['userfield']);
  193. $userfield = unserialize($_G['setting']['activityfield']);
  194. //新的报名字段
  195. $myuserfield = DB::fetch_all("SELECT * FROM " . DB::table('xj_event_field') . " ORDER BY id");
  196. $setting = unserialize($items['setting']);
  197. $setting['event_admin'] = implode(',', $setting['event_admin']);
  198. //活动场次
  199. $sessionarray = array();
  200. foreach ($setting['session'] as $key => $value) {
  201. $sessionarray[] = $key . '=' . $value;
  202. }
  203. $sessionstr = implode("\r\n", $sessionarray);
  204. if (!$items['activityaid'] and $items['activityaid_url']) {
  205. $imgurl = $items['activityaid_url'];
  206. } else {
  207. $imgurl = getforumimg($items['activityaid'], 0, 360, 230, 'fixnone');
  208. }
  209. $forumlist = $this -> forumselect(false, 0, $setting['eventzy_fid'], true);
  210. //二级地区分类调用
  211. if ($_G['cache']['plugin']['xj_event']['event_city']) {
  212. $lang_province = lang('spacecp', 'district_level_1');
  213. $lang_city = lang('spacecp', 'district_level_2');
  214. $province = DB::fetch_all("SELECT * FROM " . DB::table('common_district') . " WHERE level = 1");
  215. $city = DB::fetch_all("SELECT * FROM " . DB::table('common_district') . " WHERE level = 2 order by upid");
  216. $i = 0;
  217. $tempid = 1;
  218. if ($items['citys']) {
  219. $upid = intval(DB::result_first("SELECT upid FROM " . DB::table('common_district') . " WHERE name = '" . $items['citys'] . "'"));
  220. $items['province'] = DB::result_first("SELECT name FROM " . DB::table('common_district') . " WHERE id = $upid");
  221. }
  222. foreach ($city as $key => $value) {
  223. if ($value['upid'] != $tempid) {
  224. $i = 0;
  225. $tempid = $value['upid'];
  226. }
  227. $city[$key]['displayorder'] = $i;
  228. $i++;
  229. }
  230. }
  231. include template('xj_event:edit_event');
  232. return $return;
  233. }
  234. public function editpost_submit($fid, $tid) {
  235. global $_G;
  236. if (!in_array('mobile', $_GET['userfield']) && $_GET['seccode'] == 1) {
  237. showmessage(lang('plugin/xj_event', 'qylbmdxbtzlxbx'));
  238. }
  239. }
  240. public function editpost_submit_end($fid, $tid) {
  241. global $_G;
  242. date_default_timezone_set('Asia/Shanghai');
  243. $items = DB::fetch(DB::query("SELECT * FROM " . DB::table('forum_post') . " WHERE tid = '$tid' AND first=1"));
  244. //获取当前的设置
  245. $event = DB::fetch_first("SELECT setting FROM " . DB::table('xj_event') . " WHERE tid='$tid'");
  246. $setting = unserialize($event['setting']);
  247. $pid = $items['pid'];
  248. $postclass = intval($_GET['postclass']);
  249. $starttime = strtotime($_GET['starttime']);
  250. $endtime = strtotime($_GET['endtime']);
  251. $offlineclass = intval($_GET['offlineclass']);
  252. $onlineclass = intval($_GET['onlineclass']);
  253. $citys = addslashes($_GET['citys']);
  254. $event_address = addslashes($_GET['event_address']);
  255. $event_number = intval($_GET['event_number']);
  256. if ($_GET['sexxz']) {
  257. $event_number_man = intval($_GET['event_number_man']);
  258. $event_number_woman = intval($_GET['event_number_woman']);
  259. } else {
  260. $event_number_man = 0;
  261. $event_number_woman = 0;
  262. };
  263. $event_number_max = intval($_GET['event_number_max']);
  264. $use_extcredits_num = $_GET['use_extcredits_num'] ? intval($_GET['use_extcredits_num']) : $event['use_extcredits_num'];
  265. $use_extcredits = $_GET['use_extcredits'] ? intval($_GET['use_extcredits']) : $event['use_extcredits'];
  266. $use_cost = doubleval($_GET['use_cost']);
  267. $activitybegin = strtotime($_GET['activitybegin']);
  268. $activityexpiration = strtotime($_GET['activityexpiration']);
  269. //截止时间
  270. $eventorder = $_GET['eventorder'] ? intval($_GET['eventorder']) : $event['eventorder'];
  271. foreach ($_GET['userfield'] as $value) {
  272. $tmp[] = addslashes($value);
  273. }
  274. $userfield = serialize($tmp);
  275. if (!$_G['mobile']) {
  276. $setting['event_admin'] = explode(',', $_GET['event_admin']);
  277. $setting['eventzy_enable'] = intval($_GET['eventzy_enable']);
  278. $setting['eventzy_name'] = addslashes($_GET['eventzy_name']);
  279. $setting['eventzy_fid'] = intval($_GET['eventzy_fid']);
  280. $setting['eventzy_xz'] = intval($_GET['eventzy_xz']);
  281. $setting['eventaa'] = intval($_GET['eventaa']);
  282. $setting['seccode'] = intval($_GET['seccode']);
  283. $setting['success_sms'] = intval($_GET['success_sms']);
  284. $setting['app_benefit'] = $_GET['app_benefit'];
  285. //APP报名优惠
  286. }
  287. $setting['eventpay'] = intval($_GET['eventpay']);
  288. $setting['vip_discount'] = $_GET['vip_discount'];
  289. $setting['nodaibaoming'] = intval($_GET['nodaibaoming']);
  290. $setting['reply'] = intval($_GET['reply']);
  291. $setting['noverify'] = intval($_GET['noverify']);
  292. $setting['statements'] = intval($_GET['statements']);
  293. $setting['event_url'] = $_GET['event_url'];
  294. //活动场次
  295. if ($_GET['sessionstr']) {
  296. $tmparray = explode("\r\n", $_GET['sessionstr']);
  297. $sessionarray = array();
  298. foreach ($tmparray as $value) {
  299. $tmpvalue = explode("=", $value);
  300. $sessionarray[$tmpvalue[0]] = $tmpvalue[1];
  301. }
  302. $setting['session'] = $sessionarray;
  303. } else {
  304. $setting['session'] = '';
  305. }
  306. //更多选项
  307. $setting['moreitem'] = array();
  308. foreach ($_GET['setting_itemname'] as $key => $value) {
  309. $tmparray = array();
  310. if ($value) {
  311. $tmparray['itemname'] = addslashes($value);
  312. $tmparray['itemcontent'] = addslashes($_GET['setting_itemcontent'][$key]);
  313. $setting['moreitem'][] = $tmparray;
  314. }
  315. }
  316. //多种报名费用
  317. $setting['cost'] = array();
  318. $i = 1;
  319. foreach ($_GET['cost_price'] as $key => $value) {
  320. $value = floatval($value);
  321. if ($_GET['cost_name'][$key]) {
  322. $setting['cost'][$i]['cost_name'] = $_GET['cost_name'][$key];
  323. $setting['cost'][$i]['cost_price'] = $_GET['cost_price'][$key];
  324. $setting['cost'][$i]['cost_credits'] = $_GET['cost_credits'][$key];
  325. $setting['cost'][$i]['cost_youhui'] = $_GET['cost_youhui'][$key];
  326. $setting['cost'][$i]['id'] = $i;
  327. }
  328. $i++;
  329. }
  330. //活动联系电话
  331. if (!$_G['mobile']) {
  332. $setting['tel'] = addslashes($_GET['tel']);
  333. }
  334. //新报名字段
  335. $setting['myuserfield'] = $_GET['myuserfield'];
  336. $setting_str = serialize($setting);
  337. //活动图片编辑处理
  338. $activity = DB::fetch(DB::query("SELECT activityaid FROM " . DB::table('xj_event') . " WHERE tid = '$tid'"));
  339. $activityaid = $activity['activityaid'];
  340. if ($activityaid && $activityaid != $_GET['activityaid']) {
  341. $attach = C::t('forum_attachment_n') -> fetch('tid:' . $_G['tid'], $activityaid);
  342. C::t('forum_attachment') -> delete($activityaid);
  343. C::t('forum_attachment_n') -> delete('tid:' . $_G['tid'], $activityaid);
  344. dunlink($attach);
  345. }
  346. if ($_GET['activityaid']) {
  347. $threadimageaid = intval($_GET['activityaid']);
  348. $activityaid = intval($_GET['activityaid']);
  349. convertunusedattach($_GET['activityaid'], $tid, $pid);
  350. }
  351. if (strpos($_GET['activityaid_url'], 'ttp://') > 0) {
  352. $activityaid = 0;
  353. }
  354. $activityaid_url = addslashes($_GET['activityaid_url']);
  355. DB::query("UPDATE " . DB::table('xj_event') . " set tid='$tid', postclass='$postclass', starttime='$starttime', endtime='$endtime', offlineclass='$offlineclass', onlineclass='$onlineclass', citys='$citys', event_address='$event_address', event_number='$event_number', event_number_man='$event_number_man', event_number_woman='$event_number_woman', event_number_max='$event_number_max', use_extcredits_num='$use_extcredits_num', use_extcredits='$use_extcredits', use_cost='$use_cost', activitybegin='$activitybegin', activityexpiration='$activityexpiration', userfield='$userfield',activityaid='$activityaid' , activityaid_url='$activityaid_url',setting = '$setting_str',eventorder='$eventorder' WHERE tid = '{$tid}'");
  356. }
  357. public function viewthread($tid) {
  358. global $_G;
  359. $items = DB::fetch(DB::query("SELECT * FROM " . DB::table('xj_event') . " WHERE tid = '$tid'"));
  360. $setting = unserialize($items['setting']);
  361. if (file_exists(DISCUZ_ROOT . './source/plugin/xj_event/module/eventurl/view.php')) { //外链活动跳转
  362. $module_eventurl = true;
  363. @include DISCUZ_ROOT . './source/plugin/xj_event/module/eventurl/view.php';
  364. if($admineventurl){
  365. return $return;
  366. }
  367. }
  368. if (file_exists(DISCUZ_ROOT . './source/plugin/xj_event/module/wsqcenter/event_view.php')) {
  369. if ($_G['mobile']) {
  370. if (strpos($_SERVER['HTTP_REFERER'], 'wsq.discuz.com') > 0) {
  371. } else {
  372. header("Location:" . $_G['siteurl'] . "plugin.php?id=xj_event:wsqcenter&mod=event_view&tid=$tid" . ($_GET['icode'] ? '&icode=' . $_GET['icode'] : ''));
  373. }
  374. }
  375. }
  376. $timestamp = time();
  377. $extcredits = $_G['setting']['extcredits'];
  378. //活动专题跳转判断
  379. if (!checkmobile()) {
  380. if ($setting['project']['openproject'] && (($_G['groupid'] > 1 && $_G['uid'] != $items['uid']) || !$_G['uid'])) {
  381. if ($setting['project']['openprojectauto']) {
  382. header("Location: plugin.php?id=xj_event:project_show&tid=$tid");
  383. }
  384. }
  385. }
  386. if ($items['postclass'] == 1) {
  387. $postclass = lang('plugin/xj_event', 'xxhd');
  388. $tmp = explode("\n", $_G['cache']['plugin']['xj_event']['event_offline_class']);
  389. foreach ($tmp as $key => $value) {
  390. $eventclass = explode("|", $value);
  391. if ($eventclass[0] == $items['offlineclass']) {
  392. break;
  393. }
  394. }
  395. } else {
  396. $postclass = lang('plugin/xj_event', 'xshd');
  397. $tmp = explode("\n", $_G['cache']['plugin']['xj_event']['event_online_class']);
  398. foreach ($tmp as $key => $value) {
  399. $eventclass = explode("|", $value);
  400. if ($eventclass[0] == $items['onlineclass']) {
  401. break;
  402. }
  403. }
  404. }
  405. foreach ($extcredits as $key => $value) {
  406. if ($key == $items['use_extcredits']) {
  407. $extcredit_title = $value['title'];
  408. }
  409. }
  410. $citys = $items['citys'];
  411. $starttime = dgmdate($items['starttime'], 'dt');
  412. $endtime = dgmdate($items['endtime'], 'dt');
  413. $activityexpiration = dgmdate($items['activityexpiration'], 'dt');
  414. if (!$items['activityaid'] and $items['activityaid_url']) {
  415. $imgurl = $items['activityaid_url'];
  416. } else {
  417. //$imgurl = $this->_getpicurl($items['activityaid'],$tid);
  418. $imgurl = getforumimg($items['activityaid'], 0, 360, 230, 'fixnone');
  419. }
  420. $userfield = unserialize($items['userfield']);
  421. $selectuserfield = unserialize($items['userfield']);
  422. if ($selectuserfield) {
  423. if ($selectuserfield) {
  424. $htmls = $settings = array();
  425. require_once libfile('function/profile');
  426. foreach ($selectuserfield as $fieldid) {
  427. if (empty($ufielddata['userfield'])) {
  428. $memberprofile = C::t('common_member_profile') -> fetch($_G['uid']);
  429. foreach ($selectuserfield as $val) {
  430. if ($val == 'birthday') {
  431. $ufielddata['userfield']['birthyear'] = $memberprofile['birthyear'];
  432. $ufielddata['userfield']['birthmonth'] = $memberprofile['birthmonth'];
  433. }
  434. $ufielddata['userfield'][$val] = $memberprofile[$val];
  435. }
  436. unset($memberprofile);
  437. }
  438. $html = profile_setting($fieldid, $ufielddata['userfield'], false, true);
  439. if ($html) {
  440. $settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid];
  441. $htmls[$fieldid] = $html;
  442. }
  443. }
  444. }
  445. } else {
  446. $selectuserfield = '';
  447. }
  448. $hg = DB::fetch_first("SELECT * FROM " . DB::table('xj_eventthread') . " WHERE eid=" . intval($items['eid']) . " and sort=1");
  449. //报名通过总人数
  450. $applycountnumber = DB::result_first("SELECT SUM(applynumber) FROM " . DB::table('xj_eventapply') . " WHERE tid='$tid' and verify=1");
  451. $applycountnumber = !$applycountnumber ? 0 : $applycountnumber;
  452. $applycountnumberd = DB::result_first("SELECT SUM(applynumber) FROM " . DB::table('xj_eventapply') . " WHERE tid='$tid' and verify=0");
  453. $applycountnumberd = !$applycountnumberd ? 0 : $applycountnumberd;
  454. //报名时可能选择的人数
  455. $items['event_number_max'] = $items['event_number_max'] > 0 ? $items['event_number_max'] : 1;
  456. $applynumber = array();
  457. for ($i = 1; $i <= $items['event_number_max']; $i++) {
  458. $applynumber[] = $i;
  459. }
  460. //报名审核状态
  461. $apply = DB::fetch_first("SELECT applyid,pay_state,verify,seccode FROM " . DB::table('xj_eventapply') . " WHERE tid='$tid' and uid=" . $_G['uid']);
  462. $verify = $apply['verify'];
  463. $pay_state = $apply['pay_state'];
  464. //判断是不是管理团队
  465. $event_admin = false;
  466. if ($_G['username']) {
  467. if (in_array($_G['username'], $setting['event_admin'])) {
  468. $event_admin = true;
  469. }
  470. }
  471. //活动管理列表
  472. $event_adminlist = implode(',', $setting['event_admin']);
  473. //回复才可以报名
  474. $bmbtnshow = true;
  475. if ($setting['reply']) {
  476. $replys = DB::result_first("SELECT count(*) FROM " . DB::table('forum_post') . " WHERE tid='$tid' AND first<>1 AND invisible>=0 AND authorid = " . $_G['uid']);
  477. if ($replys < 1) {
  478. $bmbtnshow = false;
  479. }
  480. }
  481. //二级地区分类调用
  482. if ($_G['cache']['plugin']['xj_event']['event_city']) {
  483. $lang_province = lang('spacecp', 'district_level_1');
  484. $lang_city = lang('spacecp', 'district_level_2');
  485. if ($items['citys']) {
  486. $upid = intval(DB::result_first("SELECT upid FROM " . DB::table('common_district') . " WHERE name = '" . $items['citys'] . "'"));
  487. if ($upid) {
  488. $items['province'] = DB::result_first("SELECT name FROM " . DB::table('common_district') . " WHERE id = $upid");
  489. }
  490. }
  491. }
  492. if ($setting['vip_discount'] === '') {
  493. } else {
  494. $vip_price = $items['use_cost'] - $setting['vip_discount'];
  495. }
  496. if ($setting['onlysubscribeweixin'] && $_G['cache']['plugin']['xj_wxmessage']['wxlogin']) { //仅限关注微信报名,获取是否关注
  497. require_once DISCUZ_ROOT . './source/plugin/xj_wxmessage/class/core.class.php';
  498. $xj_wxmessagecore = new xj_wxmessagecore();
  499. $res = $xj_wxmessagecore->getweixinuserinfo($_G['uid']);
  500. $weixinsubscribe = $res['subscribe'];
  501. }
  502. include template('xj_event:viewthread_event');
  503. return $return;
  504. }
  505. /**
  506. * 通过aid获取图片链接
  507. */
  508. public function _getpicurl($aid, $tid) {
  509. global $_G;
  510. $return = '';
  511. if ($aid) {
  512. $picatt = DB::fetch_first("SELECT remote,attachment,thumb FROM " . DB::table(getattachtablebytid($tid)) . " WHERE aid='{$aid}'");
  513. if ($picatt['remote']) {
  514. $picatt['attachment'] = $_G['setting']['ftp']['attachurl'] . 'forum/' . $picatt['attachment'];
  515. $picatt['attachment'] = substr($picatt['attachment'], 0, 7) != 'http://' ? 'http://' . $picatt['attachment'] : $picatt['attachment'];
  516. } else {
  517. $picatt['attachment'] = $_G['setting']['attachurl'] . 'forum/' . $picatt['attachment'];
  518. }
  519. }
  520. $return = $picatt['attachment'];
  521. return $return;
  522. }
  523. public function forumselect($groupselectable = false, $arrayformat = 0, $selectedfid = 0, $showhide = false, $evalue = false, $special = 0) {
  524. global $_G;
  525. if (!isset($_G['cache']['forums'])) {
  526. loadcache('forums');
  527. }
  528. $forumcache = &$_G['cache']['forums'];
  529. $forumlist = $arrayformat ? array() : '<optgroup label="&nbsp;">';
  530. foreach ($forumcache as $forum) {
  531. if (!$forum['status'] && !$showhide) {
  532. continue;
  533. }
  534. if ($selectedfid) {
  535. if (!is_array($selectedfid)) {
  536. $selected = $selectedfid == $forum['fid'] ? ' selected' : '';
  537. } else {
  538. $selected = in_array($forum['fid'], $selectedfid) ? ' selected' : '';
  539. }
  540. }
  541. if ($forum['type'] == 'group') {
  542. if ($arrayformat) {
  543. $forumlist[$forum['fid']]['name'] = $forum['name'];
  544. } else {
  545. $forumlist .= $groupselectable ? '<option value="' . ($evalue ? 'gid_' : '') . $forum['fid'] . '" class="bold">--' . $forum['name'] . '</option>' : '</optgroup><optgroup label="--' . $forum['name'] . '">';
  546. }
  547. $visible[$forum['fid']] = true;
  548. } elseif ($forum['type'] == 'forum' && isset($visible[$forum['fup']]) && (!$forum['viewperm'] || ($forum['viewperm'] && forumperm($forum['viewperm'])) || strstr($forum['users'], "\t$_G[uid]\t")) && (!$special || (substr($forum['allowpostspecial'], -$special, 1)))) {
  549. if ($arrayformat) {
  550. $forumlist[$forum['fup']]['sub'][$forum['fid']] = $forum['name'];
  551. } else {
  552. $forumlist .= '<option value="' . ($evalue ? 'fid_' : '') . $forum['fid'] . '"' . $selected . '>' . $forum['name'] . '</option>';
  553. }
  554. $visible[$forum['fid']] = true;
  555. } elseif ($forum['type'] == 'sub' && isset($visible[$forum['fup']]) && (!$forum['viewperm'] || ($forum['viewperm'] && forumperm($forum['viewperm'])) || strstr($forum['users'], "\t$_G[uid]\t")) && (!$special || substr($forum['allowpostspecial'], -$special, 1))) {
  556. if ($arrayformat) {
  557. $forumlist[$forumcache[$forum['fup']]['fup']]['child'][$forum['fup']][$forum['fid']] = $forum['name'];
  558. } else {
  559. $forumlist .= '<option value="' . ($evalue ? 'fid_' : '') . $forum['fid'] . '"' . $selected . '>&nbsp; &nbsp; &nbsp; ' . $forum['name'] . '</option>';
  560. }
  561. }
  562. }
  563. if (!$arrayformat) {
  564. $forumlist .= '</optgroup>';
  565. $forumlist = str_replace('<optgroup label="&nbsp;"></optgroup>', '', $forumlist);
  566. }
  567. return $forumlist;
  568. }
  569. }