event_post.inc.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * [³¬¼¶»î¶¯(xj_event.{modulename})] (C)2012-2099 Powered by åÐÒ£¹¤×÷ÊÒ.
  4. * Version: 1.0
  5. * Date: 2012-9-15 10:27
  6. */
  7. if(!defined('IN_DISCUZ')) {
  8. exit('Access Denied');
  9. }
  10. $allowthreadplugin = $_G['setting']['threadplugins'] ? C::t('common_setting')->fetch('allowthreadplugin', true) : array();
  11. $mythread = $allowthreadplugin[$_G['groupid']];
  12. if(!in_array('xj_event',$mythread)){
  13. showmessage(lang('plugin/xj_event', 'nmyfbhddqx'));
  14. }
  15. $forumlist = forumselect(FALSE, 0, $fid, TRUE);
  16. include template('xj_event:event_post');
  17. function forumselect($groupselectable = FALSE, $arrayformat = 0, $selectedfid = 0, $showhide = FALSE, $evalue = FALSE, $special = 0) {
  18. global $_G;
  19. $items = array();
  20. $query = DB::query("select A.fid FROM ".DB::table('forum_forum')." A,".DB::table('forum_forumfield')." B WHERE A.fid = B.fid and A.type<>'group' and A.status=1 and B.threadplugin like '%xj_event%'");
  21. while($value = DB::fetch($query)){
  22. $items[] = $value['fid'];
  23. }
  24. if(!isset($_G['cache']['forums'])) {
  25. loadcache('forums');
  26. }
  27. $forumcache = &$_G['cache']['forums'];
  28. $forumlist = $arrayformat ? array() : '<optgroup label="&nbsp;">';
  29. foreach($forumcache as $forum) {
  30. if(!$forum['status'] && !$showhide) {
  31. continue;
  32. }
  33. if($selectedfid) {
  34. if(!is_array($selectedfid)) {
  35. $selected = $selectedfid == $forum['fid'] ? ' selected' : '';
  36. } else {
  37. $selected = in_array($forum['fid'], $selectedfid) ? ' selected' : '';
  38. }
  39. }
  40. if($forum['type'] == 'group') {
  41. if($arrayformat) {
  42. $forumlist[$forum['fid']]['name'] = $forum['name'];
  43. } else {
  44. $forumlist .= $groupselectable ? '<option value="'.($evalue ? 'gid_' : '').$forum['fid'].'" class="bold">--'.$forum['name'].'</option>' : '</optgroup><optgroup label="--'.$forum['name'].'">';
  45. }
  46. $visible[$forum['fid']] = true;
  47. } 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)))) {
  48. if($arrayformat) {
  49. $forumlist[$forum['fup']]['sub'][$forum['fid']] = $forum['name'];
  50. } else {
  51. if(in_array($forum['fid'],$items)){
  52. $forumlist .= '<option value="'.($evalue ? 'fid_' : '').$forum['fid'].'"'.$selected.'>'.$forum['name'].'</option>';
  53. }
  54. }
  55. $visible[$forum['fid']] = true;
  56. } 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))) {
  57. if($arrayformat) {
  58. $forumlist[$forumcache[$forum['fup']]['fup']]['child'][$forum['fup']][$forum['fid']] = $forum['name'];
  59. } else {
  60. if(in_array($forum['fid'],$items)){
  61. $forumlist .= '<option value="'.($evalue ? 'fid_' : '').$forum['fid'].'"'.$selected.'>&nbsp; &nbsp; &nbsp; '.$forum['name'].'</option>';
  62. }
  63. }
  64. }
  65. }
  66. if(!$arrayformat) {
  67. $forumlist .= '</optgroup>';
  68. $forumlist = str_replace('<optgroup label="&nbsp;"></optgroup>', '', $forumlist);
  69. }
  70. return $forumlist;
  71. }
  72. ?>