PageRenderTime 59ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/source/admincp/admincp_forums.php

https://github.com/jinbo51/DiscuzX
PHP | 2193 lines | 2099 code | 88 blank | 6 comment | 184 complexity | 9a7759d0d783f6ab1964a88742f59a74 MD5 | raw file
Possible License(s): BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: admincp_forums.php 33377 2013-06-04 04:03:30Z andyzheng $
  7. */
  8. if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
  9. exit('Access Denied');
  10. }
  11. cpheader();
  12. $operation = empty($operation) ? 'admin' : $operation;
  13. $fid = intval(getgpc('fid'));
  14. if($operation == 'admin') {
  15. if(!submitcheck('editsubmit')) {
  16. shownav('forum', 'forums_admin');
  17. showsubmenu('forums_admin');
  18. showtips('forums_admin_tips');
  19. require_once libfile('function/forumlist');
  20. $forums = str_replace("'", "\'", forumselect(false, 0, 0, 1));
  21. ?>
  22. <script type="text/JavaScript">
  23. var forumselect = '<?php echo $forums;?>';
  24. var rowtypedata = [
  25. [[1, ''], [1,'<input type="text" class="txt" name="newcatorder[]" value="0" />', 'td25'], [5, '<div><input name="newcat[]" value="<?php cplang('forums_admin_add_category_name', null, true);?>" size="20" type="text" class="txt" /><a href="javascript:;" class="deleterow" onClick="deleterow(this)"><?php cplang('delete', null, true);?></a></div>']],
  26. [[1, ''], [1,'<input type="text" class="txt" name="neworder[{1}][]" value="0" />', 'td25'], [5, '<div class="board"><input name="newforum[{1}][]" value="<?php cplang('forums_admin_add_forum_name', null, true);?>" size="20" type="text" class="txt" /><a href="javascript:;" class="deleterow" onClick="deleterow(this)"><?php cplang('delete', null, true);?></a><select name="newinherited[{1}][]"><option value=""><?php cplang('forums_edit_newinherited', null, true);?></option>' + forumselect + '</select></div>']],
  27. [[1, ''], [1,'<input type="text" class="txt" name="neworder[{1}][]" value="0" />', 'td25'], [5, '<div class="childboard"><input name="newforum[{1}][]" value="<?php cplang('forums_admin_add_forum_name', null, true);?>" size="20" type="text" class="txt" /><a href="javascript:;" class="deleterow" onClick="deleterow(this)"><?php cplang('delete', null, true);?></a>&nbsp;<label><input name="inherited[{1}][]" type="checkbox" class="checkbox" value="1">&nbsp;<?php cplang('forums_edit_inherited', null, true);?></label></div>']],
  28. ];
  29. </script>
  30. <?php
  31. showformheader('forums');
  32. echo '<div style="height:30px;line-height:30px;"><a href="javascript:;" onclick="show_all()">'.cplang('show_all').'</a> | <a href="javascript:;" onclick="hide_all()">'.cplang('hide_all').'</a> <input type="text" id="srchforumipt" class="txt" /> <input type="submit" class="btn" value="'.cplang('search').'" onclick="return srchforum()" /></div>';
  33. showtableheader('');
  34. showsubtitle(array('', 'display_order', 'forums_admin_name', '', 'forums_moderators', '<a href="javascript:;" onclick="if(getmultiids()) location.href=\''.ADMINSCRIPT.'?action=forums&operation=edit&multi=\' + getmultiids();return false;">'.$lang['multiedit'].'</a>'));
  35. $forumcount = C::t('forum_forum')->fetch_forum_num();
  36. $query = C::t('forum_forum')->fetch_all_forum_for_sub_order();
  37. $groups = $forums = $subs = $fids = $showed = array();
  38. foreach($query as $forum) {
  39. if($forum['type'] == 'group') {
  40. $groups[$forum['fid']] = $forum;
  41. } elseif($forum['type'] == 'sub') {
  42. $subs[$forum['fup']][] = $forum;
  43. } else {
  44. $forums[$forum['fup']][] = $forum;
  45. }
  46. $fids[] = $forum['fid'];
  47. }
  48. foreach ($groups as $id => $gforum) {
  49. $toggle = $forumcount > 50 && count($forums[$id]) > 2;
  50. $showed[] = showforum($gforum, 'group', '', $toggle);
  51. if(!empty($forums[$id])) {
  52. foreach ($forums[$id] as $forum) {
  53. $showed[] = showforum($forum);
  54. $lastfid = 0;
  55. if(!empty($subs[$forum['fid']])) {
  56. foreach ($subs[$forum['fid']] as $sub) {
  57. $showed[] = showforum($sub, 'sub');
  58. $lastfid = $sub['fid'];
  59. }
  60. }
  61. showforum($forum, $lastfid, 'lastchildboard');
  62. }
  63. }
  64. showforum($gforum, '', 'lastboard');
  65. }
  66. if(count($fids) != count($showed)) {
  67. foreach($fids as $fid) {
  68. if(!in_array($fid, $showed)) {
  69. C::t('forum_forum')->update($fid, array('fup' => '0', 'type' => 'forum'));
  70. }
  71. }
  72. }
  73. showforum($gforum, '', 'last');
  74. showsubmit('editsubmit');
  75. showtablefooter();
  76. showformfooter();
  77. } else {
  78. $usergroups = array();
  79. $query = C::t('common_usergroup')->range();
  80. foreach($query as $group) {
  81. $usergroups[$group['groupid']] = $group;
  82. }
  83. if(is_array($_GET['order'])) {
  84. foreach($_GET['order'] as $fid => $value) {
  85. C::t('forum_forum')->update($fid, array('name' => $_GET['name'][$fid], 'displayorder' => $_GET['order'][$fid]));
  86. }
  87. }
  88. if(is_array($_GET['newcat'])) {
  89. foreach($_GET['newcat'] as $key => $forumname) {
  90. if(empty($forumname)) {
  91. continue;
  92. }
  93. $fid = C::t('forum_forum')->insert(array('type' => 'group', 'name' => $forumname, 'status' => 1, 'displayorder' => $_GET['newcatorder'][$key]), 1);
  94. C::t('forum_forumfield')->insert(array('fid' => $fid));
  95. }
  96. }
  97. $table_forum_columns = array('fup', 'type', 'name', 'status', 'displayorder', 'styleid', 'allowsmilies',
  98. 'allowhtml', 'allowbbcode', 'allowimgcode', 'allowanonymous', 'allowpostspecial', 'alloweditrules',
  99. 'alloweditpost', 'modnewposts', 'recyclebin', 'jammer', 'forumcolumns', 'threadcaches', 'disablewatermark', 'disablethumb',
  100. 'autoclose', 'simple', 'allowside', 'allowfeed');
  101. $table_forumfield_columns = array('fid', 'attachextensions', 'threadtypes', 'viewperm', 'postperm', 'replyperm',
  102. 'getattachperm', 'postattachperm', 'postimageperm');
  103. if(is_array($_GET['newforum'])) {
  104. foreach($_GET['newforum'] as $fup => $forums) {
  105. $fupforum = C::t('forum_forum')->get_forum_by_fid($fup);
  106. if(empty($fupforum)) continue;
  107. if($fupforum['fup']) {
  108. $groupforum = C::t('forum_forum')->get_forum_by_fid($fupforum['fup']);
  109. } else {
  110. $groupforum = $fupforum;
  111. }
  112. foreach($forums as $key => $forumname) {
  113. if(empty($forumname) || strlen($forumname) > 50) continue;
  114. $forum = $forumfields = array();
  115. $inheritedid = !empty($_GET['inherited'][$fup]) ? $fup : (!empty($_GET['newinherited'][$fup][$key]) ? $_GET['newinherited'][$fup][$key] : '');
  116. if(!empty($inheritedid)) {
  117. $forum = C::t('forum_forum')->get_forum_by_fid($inheritedid);
  118. $forumfield = C::t('forum_forum')->get_forum_by_fid($inheritedid, null, 'forumfield');
  119. foreach($table_forum_columns as $field) {
  120. $forumfields[$field] = $forum[$field];
  121. }
  122. foreach($table_forumfield_columns as $field) {
  123. $forumfields[$field] = $forumfield[$field];
  124. }
  125. } else {
  126. $forumfields['allowsmilies'] = $forumfields['allowbbcode'] = $forumfields['allowimgcode'] = 1;
  127. $forumfields['allowpostspecial'] = 1;
  128. $forumfields['allowside'] = 0;
  129. $forumfields['allowfeed'] = 0;
  130. $forumfields['recyclebin'] = 1;
  131. }
  132. $forumfields['fup'] = $fup ? $fup : 0;
  133. $forumfields['type'] = $fupforum['type'] == 'forum' ? 'sub' : 'forum';
  134. $forumfields['styleid'] = $groupforum['styleid'];
  135. $forumfields['name'] = $forumname;
  136. $forumfields['status'] = 1;
  137. $forumfields['displayorder'] = $_GET['neworder'][$fup][$key];
  138. $data = array();
  139. foreach($table_forum_columns as $field) {
  140. if(isset($forumfields[$field])) {
  141. $data[$field] = $forumfields[$field];
  142. }
  143. }
  144. $forumfields['fid'] = $fid = C::t('forum_forum')->insert($data, 1);
  145. $data = array();
  146. $forumfields['threadtypes'] = copy_threadclasses($forumfields['threadtypes'], $fid);
  147. foreach($table_forumfield_columns as $field) {
  148. if(isset($forumfields[$field])) {
  149. $data[$field] = $forumfields[$field];
  150. }
  151. }
  152. C::t('forum_forumfield')->insert($data);
  153. foreach(C::t('forum_moderator')->fetch_all_by_fid($fup, false) as $mod) {
  154. if($mod['inherited'] || $fupforum['inheritedmod']) {
  155. C::t('forum_moderator')->insert(array('uid' => $mod['uid'], 'fid' => $fid, 'inherited' => 1), false, true);
  156. }
  157. }
  158. }
  159. }
  160. }
  161. updatecache('forums');
  162. cpmsg('forums_update_succeed', 'action=forums', 'succeed');
  163. }
  164. } elseif($operation == 'moderators' && $fid) {
  165. if(!submitcheck('modsubmit')) {
  166. $forum = C::t('forum_forum')->fetch($fid);
  167. shownav('forum', 'forums_moderators_edit');
  168. showsubmenu(cplang('forums_moderators_edit').' - '.$forum['name']);
  169. showtips('forums_moderators_tips');
  170. showformheader("forums&operation=moderators&fid=$fid&");
  171. showtableheader('', 'fixpadding');
  172. showsubtitle(array('', 'display_order', 'username', 'usergroups', 'forums_moderators_inherited'));
  173. $modgroups = C::t('common_admingroup')->fetch_all_merge_usergroup(array_keys(C::t('common_usergroup')->fetch_all_by_radminid(0)));
  174. $groupselect = '<select name="newgroup">';
  175. foreach($modgroups as $modgroup) {
  176. if($modgroup['radminid'] == 3) {
  177. $groupselect .= '<option value="'.$modgroup['admingid'].'">'.$modgroup['grouptitle'].'</option>';
  178. }
  179. $modgroups[$modgroup['admingid']] = $modgroup['grouptitle'];
  180. }
  181. $groupselect .= '</select>';
  182. $moderators = C::t('forum_moderator')->fetch_all_by_fid($fid);
  183. $uids = array_keys($moderators);
  184. if($uids) {
  185. $users = C::t('common_member')->fetch_all($uids);
  186. }
  187. foreach($moderators as $mod) {
  188. showtablerow('', array('class="td25"', 'class="td28"'), array(
  189. '<input type="checkbox" class="checkbox" name="delete[]" value="'.$mod[uid].'"'.($mod['inherited'] ? ' disabled' : '').' />',
  190. '<input type="text" class="txt" name="displayordernew['.$mod[uid].']" value="'.$mod[displayorder].'" size="2" />',
  191. "<a href=\"".ADMINSCRIPT."?mod=forum&action=members&operation=group&uid=$mod[uid]\" target=\"_blank\">{$users[$mod['uid']]['username']}</a>",
  192. $modgroups[$users[$mod['uid']]['groupid']],
  193. cplang($mod['inherited'] ? 'yes' : 'no'),
  194. ));
  195. }
  196. if($forum['type'] == 'group' || $forum['type'] == 'sub') {
  197. $checked = $forum['type'] == 'group' ? 'checked' : '';
  198. $disabled = 'disabled';
  199. } else {
  200. $checked = $forum['inheritedmod'] ? 'checked' : '';
  201. $disabled = '';
  202. }
  203. showtablerow('', array('class="td25"', 'class="td28"'), array(
  204. cplang('add_new'),
  205. '<input type="text" class="txt" name="newdisplayorder" value="0" size="2" />',
  206. '<input type="text" class="txt" name="newmoderator" value="" size="20" />',
  207. $groupselect,
  208. ''
  209. ));
  210. showsubmit('modsubmit', 'submit', 'del', '<input class="checkbox" type="checkbox" name="inheritedmodnew" value="1" '.$checked.' '.$disabled.' id="inheritedmodnew" /><label for="inheritedmodnew">'.cplang('forums_moderators_inherit').'</label>');
  211. showtablefooter();
  212. showformfooter();
  213. } else {
  214. $forum = C::t('forum_forum')->fetch($fid);
  215. $inheritedmodnew = $_GET['inheritedmodnew'];
  216. if($forum['type'] == 'group') {
  217. $inheritedmodnew = 1;
  218. } elseif($forum['type'] == 'sub') {
  219. $inheritedmodnew = 0;
  220. }
  221. if(!empty($_GET['delete']) || $_GET['newmoderator'] || (bool)$forum['inheritedmod'] != (bool)$inheritedmodnew) {
  222. $fidarray = $newmodarray = $origmodarray = array();
  223. if($forum['type'] == 'group') {
  224. $query = C::t('forum_forum')->fetch_all_fids(1, 'forum', $fid);
  225. foreach($query as $sub) {
  226. $fidarray[] = $sub['fid'];
  227. }
  228. $query = C::t('forum_forum')->fetch_all_fids(1, 'sub', $fidarray);
  229. foreach($query as $sub) {
  230. $fidarray[] = $sub['fid'];
  231. }
  232. } elseif($forum['type'] == 'forum') {
  233. $query = C::t('forum_forum')->fetch_all_fids(1, 'sub', $fid);
  234. foreach($query as $sub) {
  235. $fidarray[] = $sub['fid'];
  236. }
  237. }
  238. if(is_array($_GET['delete'])) {
  239. foreach($_GET['delete'] as $uid) {
  240. C::t('forum_moderator')->delete_by_uid_fid_inherited($uid, $fid, $fidarray);
  241. }
  242. $excludeuids = array();
  243. $deleteuids = '\''.implode('\',\'', $_GET['delete']).'\'';
  244. foreach(C::t('forum_moderator')->fetch_all_by_uid($_GET['delete']) as $mod) {
  245. $excludeuids[] = $mod['uid'];
  246. }
  247. $usergroups = array();
  248. $query = C::t('common_usergroup')->range();
  249. foreach($query as $group) {
  250. $usergroups[$group['groupid']] = $group;
  251. }
  252. $members = C::t('common_member')->fetch_all($_GET['delete'], false, 0);
  253. foreach($members as $uid => $member) {
  254. if(!in_array($uid, $excludeuids) && !in_array($member['adminid'], array(1,2))) {
  255. if($usergroups[$member['groupid']]['type'] == 'special' && $usergroups[$member['groupid']]['radminid'] != 3) {
  256. $adminidnew = -1;
  257. $groupidnew = $member['groupid'];
  258. } else {
  259. $adminidnew = 0;
  260. foreach($usergroups as $group) {
  261. if($group['type'] == 'member' && $member['credits'] >= $group['creditshigher'] && $member['credits'] < $group['creditslower']) {
  262. $groupidnew = $group['groupid'];
  263. break;
  264. }
  265. }
  266. }
  267. C::t('common_member')->update($member['uid'], array('adminid'=>$adminidnew, 'groupid'=>$groupidnew));
  268. }
  269. }
  270. }
  271. if($_GET['newmoderator']) {
  272. $member = C::t('common_member')->fetch_by_username($_GET['newmoderator']);
  273. if(!$member) {
  274. cpmsg_error('members_edit_nonexistence');
  275. } else {
  276. $newmodarray[] = $member['uid'];
  277. $membersetarr = array();
  278. if(!in_array($member['adminid'],array(1,2,3,4,5,6,7,8,-1))) {
  279. $membersetarr['groupid'] = $_GET['newgroup'];
  280. }
  281. if(!in_array($member['adminid'],array(1,2))) {
  282. $membersetarr['adminid'] = '3';
  283. }
  284. if(!empty($membersetarr)) {
  285. C::t('common_member')->update($member['uid'], $membersetarr);
  286. }
  287. C::t('forum_moderator')->insert(array(
  288. 'uid' => $member['uid'],
  289. 'fid' => $fid,
  290. 'displayorder' => $_GET['newdisplayorder'],
  291. 'inherited' => '0',
  292. ), false, true);
  293. }
  294. }
  295. if((bool)$forum['inheritedmod'] != (bool)$inheritedmodnew) {
  296. foreach(C::t('forum_moderator')->fetch_all_by_fid_inherited($fid) as $mod) {
  297. $origmodarray[] = $mod['uid'];
  298. if(!$forum['inheritedmod'] && $inheritedmodnew) {
  299. $newmodarray[] = $mod['uid'];
  300. }
  301. }
  302. if($forum['inheritedmod'] && !$inheritedmodnew) {
  303. C::t('forum_moderator')->delete_by_uid_fid($origmodarray, $fidarray);
  304. }
  305. }
  306. foreach($newmodarray as $uid) {
  307. C::t('forum_moderator')->insert(array(
  308. 'uid' => $uid,
  309. 'fid' => $fid,
  310. 'displayorder' => $_GET['newdisplayorder'],
  311. 'inherited' => '0',
  312. ), false, true);
  313. if($inheritedmodnew) {
  314. foreach($fidarray as $ifid) {
  315. C::t('forum_moderator')->insert(array(
  316. 'uid' => $uid,
  317. 'fid' => $ifid,
  318. 'inherited' => '1',
  319. ), false, true);
  320. }
  321. }
  322. }
  323. if($forum['type'] == 'group') {
  324. $inheritedmodnew = 1;
  325. } elseif($forum['type'] == 'sub') {
  326. $inheritedmodnew = 0;
  327. }
  328. C::t('forum_forum')->update($fid, array('inheritedmod' => $inheritedmodnew));
  329. }
  330. if(is_array($_GET['displayordernew'])) {
  331. foreach($_GET['displayordernew'] as $uid => $order) {
  332. C::t('forum_moderator')->update_by_fid_uid($fid, $uid, array(
  333. 'displayorder' => $order,
  334. ));
  335. }
  336. }
  337. $fidarray[] = $fid;
  338. foreach($fidarray as $fid) {
  339. $moderators = $tab = '';
  340. $modorder = array();
  341. $modmemberarray = C::t('forum_moderator')->fetch_all_no_inherited_by_fid($fid);
  342. foreach($modmemberarray as $moduid => $modmember) {
  343. $modorder[] = $moduid;
  344. }
  345. $members = C::t('common_member')->fetch_all_username_by_uid($modorder);
  346. foreach($modorder as $mod) {
  347. if(!$members[$mod]) {
  348. continue;
  349. }
  350. $moderators .= $tab.addslashes($members[$mod]);
  351. $tab = "\t";
  352. }
  353. C::t('forum_forumfield')->update($fid, array('moderators' => $moderators));
  354. }
  355. cpmsg('forums_moderators_update_succeed', "mod=forum&action=forums&operation=moderators&fid=$fid", 'succeed');
  356. }
  357. } elseif($operation == 'merge') {
  358. $source = $_GET['source'];
  359. $target = $_GET['target'];
  360. if(!submitcheck('mergesubmit') || $source == $target) {
  361. require_once libfile('function/forumlist');
  362. loadcache('forums');
  363. $forumselect = "<select name=\"%s\">\n<option value=\"\">&nbsp;&nbsp;> ".cplang('select')."</option><option value=\"\">&nbsp;</option>".str_replace('%', '%%', forumselect(FALSE, 0, 0, TRUE)).'</select>';
  364. shownav('forum', 'forums_merge');
  365. showsubmenu('forums_merge');
  366. showformheader('forums&operation=merge');
  367. showtableheader();
  368. showsetting('forums_merge_source', '', '', sprintf($forumselect, 'source'));
  369. showsetting('forums_merge_target', '', '', sprintf($forumselect, 'target'));
  370. showsubmit('mergesubmit');
  371. showtablefooter();
  372. showformfooter();
  373. } else {
  374. if(C::t('forum_forum')->check_forum_exists(array($source,$target)) != 2) {
  375. cpmsg_error('forums_nonexistence');
  376. }
  377. if(C::t('forum_forum')->fetch_forum_num('', $source)) {
  378. cpmsg_error('forums_merge_source_sub_notnull');
  379. }
  380. C::t('forum_thread')->update_by_fid($source, array('fid' => $target));
  381. loadcache('posttableids');
  382. $posttableids = $_G['cache']['posttableids'] ? $_G['cache']['posttableids'] : array('0');
  383. foreach($posttableids as $id) {
  384. C::t('forum_post')->update_fid_by_fid($id, $source, $target);
  385. }
  386. $sourceforum = C::t('forum_forum')->fetch_info_by_fid($source);
  387. $targetforum = C::t('forum_forum')->fetch_info_by_fid($target);
  388. $sourcethreadtypes = (array)dunserialize($sourceforum['threadtypes']);
  389. $targethreadtypes = (array)dunserialize($targetforum['threadtypes']);
  390. $targethreadtypes['types'] = array_merge((array)$targethreadtypes['types'], (array)$sourcethreadtypes['types']);
  391. $targethreadtypes['icons'] = array_merge((array)$targethreadtypes['icons'], (array)$sourcethreadtypes['icons']);
  392. C::t('forum_forum')->update($target, array('threads' => $targetforum['threads'] + $sourceforum['threads'], 'posts' => $targetforum['posts'] + $sourceforum['posts']));
  393. C::t('forum_forumfield')->update($target, array('threadtypes' => serialize($targethreadtypes)));
  394. C::t('forum_threadclass')->update_by_fid($source, array('fid' => $target));
  395. C::t('forum_forum')->delete_by_fid($source);
  396. C::t('home_favorite')->delete_by_id_idtype($source, 'fid');
  397. C::t('forum_moderator')->delete_by_fid($source);
  398. C::t('common_member_forum_buylog')->delete_by_fid($target);
  399. $log_handler = Cloud::loadClass('Cloud_Service_SearchHelper');
  400. $log_handler->myThreadLog('mergeforum', array('fid' => $source, 'otherid' => $target));
  401. $query = C::t('forum_access')->fetch_all_by_fid_uid($source);
  402. foreach($query as $access) {
  403. C::t('forum_access')->insert(array('uid' => $access['uid'], 'fid' => $target, 'allowview' => $access['allowview'], 'allowpost' => $access['allowpost'], 'allowreply' => $access['allowreply'], 'allowgetattach' => $access['allowgetattach']), false, true);
  404. }
  405. C::t('forum_access')->delete_by_fid($source);
  406. C::t('forum_thread')->clear_cache(array($source,$target), 'forumdisplay_');
  407. updatecache('forums');
  408. cpmsg('forums_merge_succeed', 'action=forums', 'succeed');
  409. }
  410. } elseif($operation == 'edit') {
  411. require_once libfile('function/forumlist');
  412. require_once libfile('function/domain');
  413. $highlight = getgpc('highlight');
  414. $anchor = getgpc('anchor');
  415. list($pluginsetting, $pluginvalue) = get_pluginsetting('forums');
  416. $multiset = 0;
  417. if(empty($_GET['multi'])) {
  418. $fids = $fid;
  419. } else {
  420. $multiset = 1;
  421. if(is_array($_GET['multi'])) {
  422. $fids = $_GET['multi'];
  423. } else {
  424. $_GET['multi'] = explode(',', $_GET['multi']);
  425. $fids = &$_GET['multi'];
  426. }
  427. }
  428. if(count($_GET['multi']) == 1) {
  429. $fids = $_GET['multi'][0];
  430. $multiset = 0;
  431. }
  432. if(empty($fids)) {
  433. cpmsg('forums_edit_nonexistence', 'action=forums&operation=edit'.(!empty($highlight) ? "&highlight=$highlight" : '').(!empty($anchor) ? "&anchor=$anchor" : ''), 'form', array(), '<select name="fid">'.forumselect(FALSE, 0, 0, TRUE).'</select>');
  434. }
  435. $mforum = array();
  436. $perms = array('viewperm', 'postperm', 'replyperm', 'getattachperm', 'postattachperm', 'postimageperm');
  437. $query = C::t('forum_forum')->fetch_all_info_by_fids($fids);
  438. if(empty($query)) {
  439. cpmsg('forums_nonexistence', '', 'error');
  440. } else {
  441. foreach($query as $forum) {
  442. if(isset($pluginvalue[$forum['fid']])) {
  443. $forum['plugin'] = $pluginvalue[$forum['fid']];
  444. }
  445. $mforum[] = $forum;
  446. }
  447. }
  448. $dactionarray = array();
  449. $allowthreadtypes = !in_array('threadtypes', $dactionarray);
  450. $forumkeys = C::t('common_setting')->fetch('forumkeys', true);
  451. $rules = array();
  452. foreach(C::t('common_credit_rule')->fetch_all_by_action(array('reply', 'post', 'digest', 'postattach', 'getattach')) as $value) {
  453. $rules[$value['rid']] = $value;
  454. }
  455. $navs = array();
  456. foreach(C::t('common_nav')->fetch_all_by_navtype_type(0, 5) as $nav) {
  457. $navs[$nav['identifier']] = $nav['id'];
  458. }
  459. if(!submitcheck('detailsubmit')) {
  460. $anchor = in_array($_GET['anchor'], array('basic', 'extend', 'posts', 'attachtype', 'credits', 'threadtypes', 'threadsorts', 'perm', 'plugin')) ? $_GET['anchor'] : 'basic';
  461. shownav('forum', 'forums_edit');
  462. loadcache('forums');
  463. $forumselect = '';
  464. $sgid = 0;
  465. foreach($_G['cache']['forums'] as $forums) {
  466. $checked = $fid == $forums['fid'] || in_array($forums['fid'], $_GET['multi']);
  467. if($forums['type'] == 'group') {
  468. $sgid = $forums['fid'];
  469. $forumselect .= '</div><em class="cl">'.
  470. '<span class="right"><input name="checkall_'.$forums['fid'].'" onclick="checkAll(\'value\', this.form, '.$forums['fid'].', \'checkall_'.$forums['fid'].'\')" type="checkbox" class="vmiddle checkbox" /></span>'.
  471. '<span class="pointer" onclick="sdisplay(\'g_'.$forums['fid'].'\', this)"><img src="static/image/admincp/desc.gif" class="vmiddle" /></span> <span class="pointer" onclick="location.href=\''.ADMINSCRIPT.'?action=forums&operation=edit&switch=yes&fid='.$forums['fid'].'\'">'.$forums['name'].'</span></em><div id="g_'.$forums['fid'].'" style="display:">';
  472. } elseif($forums['type'] == 'forum') {
  473. $forumselect .= '<input class="left checkbox ck" chkvalue="'.$sgid.'" name="multi[]" value="'.$forums['fid'].'" type="checkbox" '.($checked ? 'checked="checked" ' : '').'/><a class="f'.($checked ? ' current"' : '').'" href="###" onclick="location.href=\''.ADMINSCRIPT.'?action=forums&operation=edit&switch=yes&fid='.$forums['fid'].($mforum[0]['type'] != 'group' ? '&anchor=\'+currentAnchor' : '\'').'+\'&scrolltop=\'+scrollTopBody()">'.$forums['name'].'</a>';
  474. } elseif($forums['type'] == 'sub') {
  475. $forumselect .= '<input class="left checkbox ck" chkvalue="'.$sgid.'" name="multi[]" value="'.$forums['fid'].'" type="checkbox" '.($checked ? 'checked="checked" ' : '').'/><a class="s'.($checked ? ' current"' : '').'" href="###" onclick="location.href=\''.ADMINSCRIPT.'?action=forums&operation=edit&switch=yes&fid='.$forums['fid'].($mforum[0]['type'] != 'group' ? '&anchor=\'+currentAnchor' : '\'').'+\'&scrolltop=\'+scrollTopBody()">'.$forums['name'].'</a>';
  476. }
  477. }
  478. $forumselect = '<span id="fselect" class="right popupmenu_dropmenu" onmouseover="showMenu({\'ctrlid\':this.id,\'pos\':\'34\'});$(\'fselect_menu\').style.top=(parseInt($(\'fselect_menu\').style.top)-scrollTopBody())+\'px\';$(\'fselect_menu\').style.left=(parseInt($(\'fselect_menu\').style.left)-document.documentElement.scrollLeft-20)+\'px\'">'.cplang('forums_edit_switch').'<em>&nbsp;&nbsp;</em></span>'.
  479. '<div id="fselect_menu" class="popupmenu_popup" style="display:none"><div class="fsel"><div>'.$forumselect.'</div></div><div class="cl"><input type="button" class="btn right" onclick="$(\'menuform\').submit()" value="'.cplang('forums_multiedit').'" /></div></div>';
  480. showformheader('', '', 'menuform', 'get');
  481. showhiddenfields(array('action' => 'forums', 'operation' => 'edit'));
  482. if(count($mforum) == 1 && $mforum[0]['type'] == 'group') {
  483. showsubmenu(cplang('forums_cat_detail').(count($mforum) == 1 ? ' - '.$mforum[0]['name'].'(gid:'.$mforum[0]['fid'].')' : ''), array(), $forumselect);
  484. } else {
  485. if($multiset && !in_array($anchor, array('basic', 'extend', 'posts', 'perm', 'plugin'))) {
  486. $anchor = 'basic';
  487. }
  488. showsubmenuanchors(cplang('forums_edit').(count($mforum) == 1 ? ' - '.$mforum[0]['name'].'(fid:'.$mforum[0]['fid'].')' : ''), array(
  489. array('forums_edit_basic', 'basic', $anchor == 'basic'),
  490. array('forums_edit_extend', 'extend', $anchor == 'extend'),
  491. array('forums_edit_posts', 'posts', $anchor == 'posts'),
  492. array('forums_edit_perm', 'perm', $anchor == 'perm'),
  493. !$multiset ? array('forums_edit_credits', 'credits', $anchor == 'credits') : array(),
  494. !$multiset ? array(array('menu' => 'usergroups_edit_other', 'submenu' => array(
  495. array('forums_edit_threadtypes', 'threadtypes', $anchor == 'threadtypes'),
  496. array('forums_edit_threadsorts', 'threadsorts', $anchor == 'threadsorts'),
  497. !$multiset ? array('forums_edit_attachtype', 'attachtype', $anchor == 'attachtype') : array(),
  498. !$pluginsetting ? array() : array('forums_edit_plugin', 'plugin', $anchor == 'plugin'),
  499. ))) : array(),
  500. $multiset && $pluginsetting ? array('forums_edit_plugin', 'plugin', $anchor == 'plugin') : array(),
  501. ), $forumselect);
  502. }
  503. showformfooter();
  504. $groups = array();
  505. $query = C::t('common_usergroup')->range_orderby_credit();
  506. foreach($query as $group) {
  507. $group['type'] = $group['type'] == 'special' && $group['radminid'] ? 'specialadmin' : $group['type'];
  508. $groups[$group['type']][] = $group;
  509. }
  510. $styleselect = "<select name=\"styleidnew\"><option value=\"0\">$lang[use_default]</option>";
  511. foreach(C::t('common_style')->fetch_all_data(false, false) as $style) {
  512. $styleselect .= "<option value=\"$style[styleid]\" ".
  513. ($style['styleid'] == $mforum[0]['styleid'] ? 'selected="selected"' : NULL).
  514. ">$style[name]</option>\n";
  515. }
  516. $styleselect .= '</select>';
  517. if(!$multiset) {
  518. $attachtypes = '';
  519. foreach(C::t('forum_attachtype')->fetch_all_by_fid($fid) as $type) {
  520. $type['maxsize'] = round($type['maxsize'] / 1024);
  521. $attachtypes .= showtablerow('', array('class="td25"', 'class="td24"'), array(
  522. "<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"$type[id]\" />",
  523. "<input type=\"text\" class=\"txt\" size=\"10\" name=\"extension[$type[id]]\" value=\"$type[extension]\" />",
  524. "<input type=\"text\" class=\"txt\" size=\"15\" name=\"maxsize[$type[id]]\" value=\"$type[maxsize]\" />"
  525. ), TRUE);
  526. }
  527. } else {
  528. showtips('setting_multi_tips');
  529. }
  530. showformheader("forums&operation=edit&fid=$fid&", 'enctype');
  531. showhiddenfields(array('type' => $mforum[0]['type']));
  532. if(count($mforum) == 1 && $mforum[0]['type'] == 'group') {
  533. $mforum[0]['extra'] = dunserialize($mforum[0]['extra']);
  534. showtableheader();
  535. showsetting('forums_edit_basic_cat_name', 'namenew', $mforum[0]['name'], 'text');
  536. showsetting('forums_edit_basic_cat_name_color', 'extranew[namecolor]', $mforum[0]['extra']['namecolor'], 'color');
  537. showsetting('forums_edit_basic_cat_style', '', '', $styleselect);
  538. showsetting('forums_edit_extend_forum_horizontal', 'forumcolumnsnew', $mforum[0]['forumcolumns'], 'text');
  539. showsetting('forums_edit_extend_cat_sub_horizontal', 'catforumcolumnsnew', $mforum[0]['catforumcolumns'], 'text');
  540. if(!empty($_G['setting']['domain']['root']['forum'])) {
  541. showsetting('forums_edit_extend_domain', '', '', 'http://<input type="text" name="domainnew" class="txt" value="'.$mforum[0]['domain'].'" style="width:100px; margin-right:0px;" >.'.$_G['setting']['domain']['root']['forum']);
  542. } else {
  543. showsetting('forums_edit_extend_domain', 'domainnew', '', 'text', 'disabled');
  544. }
  545. showsetting('forums_cat_display', 'statusnew', $mforum[0]['status'], 'radio');
  546. showsetting('forums_edit_basic_shownav', 'shownavnew', array_key_exists($mforum[0]['fid'], $navs) ? 1 : 0, 'radio');
  547. showtablefooter();
  548. showtips('setting_seo_forum_tips', 'seo_tips', true, 'setseotips');
  549. showtableheader();
  550. showsetting('forums_edit_basic_seotitle', 'seotitlenew', dhtmlspecialchars($mforum[0]['seotitle']), 'text');
  551. showsetting('forums_edit_basic_keyword', 'keywordsnew', dhtmlspecialchars($mforum[0]['keywords']), 'text');
  552. showsetting('forums_edit_basic_seodescription', 'seodescriptionnew', dhtmlspecialchars($mforum[0]['seodescription']), 'textarea');
  553. showsubmit('detailsubmit');
  554. showtablefooter();
  555. } else {
  556. require_once libfile('function/editor');
  557. if($multiset) {
  558. $_G['showsetting_multi'] = 0;
  559. $_G['showsetting_multicount'] = count($mforum);
  560. foreach($mforum as $forum) {
  561. $_G['showtableheader_multi'][] = '<a href="javascript:;" onclick="location.href=\''.ADMINSCRIPT.'?action=forums&operation=edit&fid='.$forum['fid'].'&anchor=\'+$(\'cpform\').anchor.value;return false">'.$forum['name'].'(fid:'.$forum['fid'].')</a>';
  562. }
  563. }
  564. $mfids = array();
  565. foreach($mforum as $forum) {
  566. $fid = $forum['fid'];
  567. $mfids[] = $fid;
  568. if(!$multiset) {
  569. $fupselect = "<select name=\"fupnew\">\n";
  570. $query = C::t('forum_forum')->fetch_all_info_by_ignore_fid($fid);
  571. foreach($query as $fup) {
  572. $fups[] = $fup;
  573. }
  574. if(is_array($fups)) {
  575. foreach($fups as $forum1) {
  576. if($forum1['type'] == 'group') {
  577. $selected = $forum1['fid'] == $forum['fup'] ? "selected=\"selected\"" : NULL;
  578. $fupselect .= "<option value=\"$forum1[fid]\" $selected>$forum1[name]</option>\n";
  579. foreach($fups as $forum2) {
  580. if($forum2['type'] == 'forum' && $forum2['fup'] == $forum1['fid']) {
  581. $selected = $forum2['fid'] == $forum['fup'] ? "selected=\"selected\"" : NULL;
  582. $fupselect .= "<option value=\"$forum2[fid]\" $selected>&nbsp; &gt; $forum2[name]</option>\n";
  583. }
  584. }
  585. }
  586. }
  587. foreach($fups as $forum0) {
  588. if($forum0['type'] == 'forum' && $forum0['fup'] == 0) {
  589. $selected = $forum0['fid'] == $forum['fup'] ? "selected=\"selected\"" : NULL;
  590. $fupselect .= "<option value=\"$forum0[fid]\" $selected>$forum0[name]</option>\n";
  591. }
  592. }
  593. }
  594. $fupselect .= '</select>';
  595. if($forum['threadtypes']) {
  596. $forum['threadtypes'] = dunserialize($forum['threadtypes']);
  597. $forum['threadtypes']['status'] = 1;
  598. } else {
  599. $forum['threadtypes'] = array('status' => 0, 'required' => 0, 'listable' => 0, 'prefix' => 0, 'options' => array());
  600. }
  601. if($forum['threadsorts']) {
  602. $forum['threadsorts'] = dunserialize($forum['threadsorts']);
  603. $forum['threadsorts']['status'] = 1;
  604. } else {
  605. $forum['threadsorts'] = array('status' => 0, 'required' => 0, 'listable' => 0, 'prefix' => 0, 'options' => array());
  606. }
  607. $typeselect = $sortselect = '';
  608. $query = C::t('forum_threadtype')->fetch_all_for_order();
  609. $typeselect = getthreadclasses_html($fid);
  610. foreach($query as $type) {
  611. $typeselected = array();
  612. $enablechecked = '';
  613. $keysort = $type['special'] ? 'threadsorts' : 'threadtypes';
  614. if(isset($forum[$keysort]['types'][$type['typeid']])) {
  615. $enablechecked = ' checked="checked"';
  616. }
  617. $showtype = TRUE;
  618. loadcache('threadsort_option_'.$type['typeid']);
  619. if($type['special'] && !$_G['cache']['threadsort_option_'.$type['typeid']]) {
  620. $showtype = FALSE;
  621. }
  622. if($type['special']) {
  623. $typeselected[3] = $forum['threadsorts']['show'][$type['typeid']] ? ' checked="checked"' : '';
  624. $sortselect .= $showtype ? showtablerow('', array('class="td25"'), array(
  625. '<input type="checkbox" name="threadsortsnew[options][enable]['.$type['typeid'].']" value="1" class="checkbox"'.$enablechecked.' />',
  626. $type['name'],
  627. $type['description'],
  628. "<input class=\"checkbox\" type=\"checkbox\" name=\"threadsortsnew[options][show][{$type[typeid]}]\" value=\"3\" $typeselected[3] />",
  629. "<input class=\"radio\" type=\"radio\" name=\"threadsortsnew[defaultshow]\" value=\"$type[typeid]\" ".($forum['threadsorts']['defaultshow'] == $type['typeid'] ? 'checked' : '')." />"
  630. ), TRUE) : '';
  631. }
  632. }
  633. $forum['creditspolicy'] = $forum['creditspolicy'] ? dunserialize($forum['creditspolicy']) : array();
  634. }
  635. if($forum['autoclose']) {
  636. $forum['autoclosetime'] = abs($forum['autoclose']);
  637. $forum['autoclose'] = $forum['autoclose'] / abs($forum['autoclose']);
  638. }
  639. if($forum['threadplugin']) {
  640. $forum['threadplugin'] = dunserialize($forum['threadplugin']);
  641. }
  642. $simplebin = sprintf('%08b', $forum['simple']);
  643. $forum['defaultorderfield'] = bindec(substr($simplebin, 0, 2));
  644. $forum['defaultorder'] = ($forum['simple'] & 32) ? 1 : 0;
  645. $forum['subforumsindex'] = bindec(substr($simplebin, 3, 2));
  646. $forum['subforumsindex'] = $forum['subforumsindex'] == 0 ? -1 : ($forum['subforumsindex'] == 2 ? 0 : 1);
  647. $forum['simple'] = $forum['simple'] & 1;
  648. $forum['modrecommend'] = $forum['modrecommend'] ? dunserialize($forum['modrecommend']) : '';
  649. $forum['formulaperm'] = dunserialize($forum['formulaperm']);
  650. $forum['medal'] = $forum['formulaperm']['medal'];
  651. $forum['formulapermmessage'] = $forum['formulaperm']['message'];
  652. $forum['formulapermusers'] = $forum['formulaperm']['users'];
  653. $forum['formulaperm'] = $forum['formulaperm'][0];
  654. $forum['extra'] = dunserialize($forum['extra']);
  655. $forum['threadsorts']['default'] = $forum['threadsorts']['defaultshow'] ? 1 : 0;
  656. $_G['multisetting'] = $multiset ? 1 : 0;
  657. showmultititle();
  658. showtagheader('div', 'basic', $anchor == 'basic');
  659. if(!$multiset) {
  660. showtips('forums_edit_tips');
  661. }
  662. showtableheader('forums_edit_basic', 'nobottom');
  663. showsetting('forums_edit_basic_name', 'namenew', $forum['name'], 'text');
  664. showsetting('forums_edit_base_name_color', 'extranew[namecolor]', $forum['extra']['namecolor'], 'color');
  665. if(!$multiset) {
  666. if($forum['icon']) {
  667. $valueparse = parse_url($forum['icon']);
  668. if(isset($valueparse['host'])) {
  669. $forumicon = $forum['icon'];
  670. } else {
  671. $forumicon = $_G['setting']['attachurl'].'common/'.$forum['icon'].'?'.random(6);
  672. }
  673. $forumiconhtml = '<label><input type="checkbox" class="checkbox" name="deleteicon" value="yes" /> '.$lang['delete'].'</label><br /><img src="'.$forumicon.'" /><br />';
  674. }
  675. showsetting('forums_edit_basic_icon', 'iconnew', $forum['icon'], 'filetext', '', 0, $forumiconhtml);
  676. showsetting('forums_edit_basic_icon_width', 'extranew[iconwidth]', $forum['extra']['iconwidth'], 'text');
  677. if($forum['banner']) {
  678. $valueparse = parse_url($forum['banner']);
  679. if(isset($valueparse['host'])) {
  680. $forumbanner = $forum['banner'];
  681. } else {
  682. $forumbanner = $_G['setting']['attachurl'].'common/'.$forum['banner'].'?'.random(6);
  683. }
  684. $forumbannerhtml = '<label><input type="checkbox" class="checkbox" name="deletebanner" value="yes" /> '.$lang['delete'].'</label><br /><img src="'.$forumbanner.'" /><br />';
  685. }
  686. showsetting('forums_edit_basic_banner', 'bannernew', $forum['banner'], 'filetext', '', 0, $forumbannerhtml);
  687. }
  688. showsetting('forums_edit_basic_display', 'statusnew', $forum['status'], 'radio');
  689. showsetting('forums_edit_basic_shownav', 'shownavnew', array_key_exists($fid, $navs) ? 1 : 0, 'radio');
  690. if(!$multiset) {
  691. showsetting('forums_edit_basic_up', '', '', $fupselect);
  692. }
  693. showsetting('forums_edit_basic_redirect', 'redirectnew', $forum['redirect'], 'text');
  694. showsetting('forums_edit_basic_description', 'descriptionnew', htmlspecialchars_decode(html2bbcode($forum['description'])), 'textarea');
  695. showsetting('forums_edit_basic_rules', 'rulesnew', htmlspecialchars_decode(html2bbcode($forum['rules'])), 'textarea');
  696. showsetting('forums_edit_basic_keys', 'keysnew', $forumkeys[$fid], 'text');
  697. if(!empty($_G['setting']['domain']['root']['forum'])) {
  698. $iname = $multiset ? "multinew[{$_G[showsetting_multi]}][domainnew]" : 'domainnew';
  699. showsetting('forums_edit_extend_domain', '', '', 'http://<input type="text" name="'.$iname.'" class="txt" value="'.$forum['domain'].'" style="width:100px; margin-right:0px;" >.'.$_G['setting']['domain']['root']['forum']);
  700. } elseif(!$multiset) {
  701. showsetting('forums_edit_extend_domain', 'domainnew', '', 'text', 'disabled');
  702. }
  703. showtablefooter();
  704. if(!$multiset) {
  705. showtips('setting_seo_forum_tips', 'seo_tips', true, 'setseotips');
  706. }
  707. showtableheader();
  708. showsetting('forums_edit_basic_seotitle', 'seotitlenew', dhtmlspecialchars($forum['seotitle']), 'text');
  709. showsetting('forums_edit_basic_keyword', 'keywordsnew', dhtmlspecialchars($forum['keywords']), 'text');
  710. showsetting('forums_edit_basic_seodescription', 'seodescriptionnew', dhtmlspecialchars($forum['seodescription']), 'textarea');
  711. showtablefooter();
  712. showtagfooter('div');
  713. showtagheader('div', 'extend', $anchor == 'extend');
  714. if(!$multiset) {
  715. showtips('forums_edit_tips');
  716. }
  717. showtableheader('forums_edit_extend', 'nobottom');
  718. showsetting('forums_edit_extend_style', '', '', $styleselect);
  719. if($forum['type'] != 'sub') {
  720. showsetting('forums_edit_extend_sub_horizontal', 'forumcolumnsnew', $forum['forumcolumns'], 'text');
  721. showsetting('forums_edit_extend_subforumsindex', array('subforumsindexnew', array(
  722. array(-1, cplang('default')),
  723. array(1, cplang('yes')),
  724. array(0, cplang('no'))
  725. ), 1), $forum['subforumsindex'], 'mradio');
  726. showsetting('forums_edit_extend_simple', 'simplenew', $forum['simple'], 'radio');
  727. } else {
  728. if($_GET['multi']) {
  729. showsetting('forums_edit_extend_sub_horizontal', '', '', cplang('forums_edit_sub_multi_tips'));
  730. showsetting('forums_edit_extend_subforumsindex', '', '', cplang('forums_edit_sub_multi_tips'));
  731. showsetting('forums_edit_extend_simple', '', '', cplang('forums_edit_sub_multi_tips'));
  732. }
  733. }
  734. showsetting('forums_edit_extend_widthauto', array('widthautonew', array(
  735. array(0, cplang('default')),
  736. array(-1, cplang('forums_edit_extend_widthauto_-1')),
  737. array(1, cplang('forums_edit_extend_widthauto_1')),
  738. ), 1), $forum['widthauto'], 'mradio');
  739. showsetting('forums_edit_extend_picstyle', 'picstylenew', $forum['picstyle'], 'radio');
  740. showsetting('forums_edit_extend_allowside', 'allowsidenew', $forum['allowside'], 'radio');
  741. showsetting('forums_edit_extend_recommend_top', 'allowglobalsticknew', $forum['allowglobalstick'], 'radio');
  742. showsetting('forums_edit_extend_defaultorderfield', array('defaultorderfieldnew', array(
  743. array(0, cplang('forums_edit_extend_order_lastpost')),
  744. array(1, cplang('forums_edit_extend_order_starttime')),
  745. array(2, cplang('forums_edit_extend_order_replies')),
  746. array(3, cplang('forums_edit_extend_order_views'))
  747. )), $forum['defaultorderfield'], 'mradio');
  748. showsetting('forums_edit_extend_defaultorder', array('defaultordernew', array(
  749. array(0, cplang('forums_edit_extend_order_desc')),
  750. array(1, cplang('forums_edit_extend_order_asc'))
  751. )), $forum['defaultorder'], 'mradio');
  752. if($_G['setting']['allowreplybg']) {
  753. $replybghtml = '';
  754. if($forum['replybg']) {
  755. $replybghtml = '<label><input type="checkbox" class="checkbox" name="delreplybg" value="yes" /> '.$lang['delete'].'</label><br /><img src="'.$_G['setting']['attachurl'].'common/'.$forum['replybg'].'" width="200px" />';
  756. }
  757. if($forum['replybg']) {
  758. $replybgurl = parse_url($forum['replybg']);
  759. }
  760. showsetting('forums_edit_extend_reply_background', 'replybgnew', (!$replybgurl['host'] ? str_replace($_G['setting']['attachurl'].'common/', '', $forum['replybg']) : $forum['replybg']), 'filetext', '', 0, $replybghtml);
  761. }
  762. showsetting('forums_edit_extend_threadcache', 'threadcachesnew', $forum['threadcaches'], 'text');
  763. showsetting('forums_edit_extend_relatedgroup', 'relatedgroupnew', $forum['relatedgroup'], 'text');
  764. showsetting('forums_edit_extend_edit_rules', 'alloweditrulesnew', $forum['alloweditrules'], 'radio');
  765. showsetting('forums_edit_extend_disablecollect', 'disablecollectnew', $forum['disablecollect'], 'radio');
  766. showsetting('forums_edit_extend_recommend', 'modrecommendnew[open]', $forum['modrecommend']['open'], 'radio', '', 1);
  767. showsetting('forums_edit_extend_recommend_sort', array('modrecommendnew[sort]', array(
  768. array(1, cplang('forums_edit_extend_recommend_sort_auto')),
  769. array(0, cplang('forums_edit_extend_recommend_sort_manual')),
  770. array(2, cplang('forums_edit_extend_recommend_sort_mix')))), $forum['modrecommend']['sort'], 'mradio');
  771. showsetting('forums_edit_extend_recommend_orderby', array('modrecommendnew[orderby]', array(
  772. array(0, cplang('forums_edit_extend_recommend_orderby_dateline')),
  773. array(1, cplang('forums_edit_extend_recommend_orderby_lastpost')),
  774. array(2, cplang('forums_edit_extend_recommend_orderby_views')),
  775. array(3, cplang('forums_edit_extend_recommend_orderby_replies')),
  776. array(4, cplang('forums_edit_extend_recommend_orderby_digest')),
  777. array(5, cplang('forums_edit_extend_recommend_orderby_recommend')),
  778. array(6, cplang('forums_edit_extend_recommend_orderby_heats')),
  779. )), $forum['modrecommend']['orderby'], 'mradio');
  780. showsetting('forums_edit_extend_recommend_num', 'modrecommendnew[num]', $forum['modrecommend']['num'], 'text');
  781. showsetting('forums_edit_extend_recommend_imagenum', 'modrecommendnew[imagenum]', $forum['modrecommend']['imagenum'], 'text');
  782. showsetting('forums_edit_extend_recommend_imagesize', array('modrecommendnew[imagewidth]', 'modrecommendnew[imageheight]'), array(intval($forum['modrecommend']['imagewidth']), intval($forum['modrecommend']['imageheight'])), 'multiply');
  783. showsetting('forums_edit_extend_recommend_maxlength', 'modrecommendnew[maxlength]', $forum['modrecommend']['maxlength'], 'text');
  784. showsetting('forums_edit_extend_recommend_cachelife', 'modrecommendnew[cachelife]', $forum['modrecommend']['cachelife'], 'text');
  785. showsetting('forums_edit_extend_recommend_dateline', 'modrecommendnew[dateline]', $forum['modrecommend']['dateline'], 'text');
  786. showtablefooter();
  787. showtagfooter('div');
  788. showtagheader('div', 'posts', $anchor == 'posts');
  789. if(!$multiset) {
  790. showtips('forums_edit_tips');
  791. }
  792. showtableheader('forums_edit_posts', 'nobottom');
  793. showsetting('forums_edit_posts_modposts', array('modnewpostsnew', array(
  794. array(0, cplang('none')),
  795. array(1, cplang('forums_edit_posts_modposts_threads')),
  796. array(2, cplang('forums_edit_posts_modposts_posts'))
  797. )), $forum['modnewposts'], 'mradio');
  798. showsetting('forums_edit_posts_alloweditpost', 'alloweditpostnew', $forum['alloweditpost'], 'radio');
  799. showsetting('forums_edit_posts_recyclebin', 'recyclebinnew', $forum['recyclebin'], 'radio');
  800. showsetting('forums_edit_posts_html', 'allowhtmlnew', $forum['allowhtml'], 'radio');
  801. showsetting('forums_edit_posts_bbcode', 'allowbbcodenew', $forum['allowbbcode'], 'radio');
  802. showsetting('forums_edit_posts_imgcode', 'allowimgcodenew', $forum['allowimgcode'], 'radio');
  803. showsetting('forums_edit_posts_mediacode', 'allowmediacodenew', $forum['allowmediacode'], 'radio');
  804. showsetting('forums_edit_posts_smilies', 'allowsmiliesnew', $forum['allowsmilies'], 'radio');
  805. showsetting('forums_edit_posts_jammer', 'jammernew', $forum['jammer'], 'radio');
  806. showsetting('forums_edit_posts_anonymous', 'allowanonymousnew', $forum['allowanonymous'], 'radio');
  807. showsetting('forums_edit_posts_disablethumb', 'disablethumbnew', $forum['disablethumb'], 'radio');
  808. showsetting('forums_edit_posts_disablewatermark', 'disablewatermarknew', $forum['disablewatermark'], 'radio');
  809. showsetting('forums_edit_posts_allowpostspecial', array('allowpostspecialnew', array(
  810. cplang('thread_poll'),
  811. cplang('thread_trade'),
  812. cplang('thread_reward'),
  813. cplang('thread_activity'),
  814. cplang('thread_debate')
  815. )), $forum['allowpostspecial'], 'binmcheckbox');
  816. $threadpluginarray = '';
  817. if(is_array($_G['setting']['threadplugins'])) foreach($_G['setting']['threadplugins'] as $tpid => $data) {
  818. $threadpluginarray[] = array($tpid, $data['name']);
  819. }
  820. if($threadpluginarray) {
  821. showsetting('forums_edit_posts_threadplugin', array('threadpluginnew', $threadpluginarray), $forum['threadplugin'], 'mcheckbox');
  822. }
  823. showsetting('forums_edit_posts_allowspecialonly', 'allowspecialonlynew', $forum['allowspecialonly'], 'radio');
  824. showsetting('forums_edit_posts_autoclose', array('autoclosenew', array(
  825. array(0, cplang('forums_edit_posts_autoclose_none'), array('autoclose_time' => 'none')),
  826. array(1, cplang('forums_edit_posts_autoclose_dateline'), array('autoclose_time' => '')),
  827. array(-1, cplang('forums_edit_posts_autoclose_lastpost'), array('autoclose_time' => ''))
  828. )), $forum['autoclose'], 'mradio');
  829. showtagheader('tbody', 'autoclose_time', $forum['autoclose'], 'sub');
  830. showsetting('forums_edit_posts_autoclose_time', 'autoclosetimenew', $forum['autoclosetime'], 'text');
  831. showtagfooter('tbody');
  832. showsetting('forums_edit_posts_attach_ext', 'attachextensionsnew', $forum['attachextensions'], 'text');
  833. showsetting('forums_edit_posts_allowfeed', 'allowfeednew', $forum['allowfeed'], 'radio');
  834. showsetting('forums_edit_posts_commentitem', 'commentitemnew', $forum['commentitem'], 'textarea');
  835. showsetting('forums_edit_posts_noantitheft', 'noantitheftnew', $forum['noantitheft'], 'radio');
  836. showsetting('forums_edit_posts_noforumhidewater', 'noforumhidewaternew', $forum['noforumhidewater'], 'radio');
  837. showsetting('forums_edit_posts_noforumrecommend', 'noforumrecommendnew', $forum['noforumrecommend'], 'radio');
  838. showtablefooter();
  839. showtagfooter('div');
  840. if(!$multiset) {
  841. showtagheader('div', 'attachtype', $anchor == 'attachtype');
  842. showtips('forums_edit_attachtype_tips');
  843. showtableheader();
  844. showtablerow('class="partition"', array('class="td25"', 'class="td24"'), array(cplang('del'), cplang('misc_attachtype_ext'), cplang('misc_attachtype_maxsize')));
  845. echo $attachtypes;
  846. echo '<tr><td></td><td colspan="2"><div><a href="###" onclick="addrow(this, 1)" class="addtr">'.$lang['misc_attachtype_add'].'</a></div></tr>';
  847. showtablefooter();
  848. showtagfooter('div');
  849. showtagheader('div', 'credits', $anchor == 'credits');
  850. if(!$multiset) {
  851. showtips('forums_edit_tips');
  852. }
  853. showtableheader('forums_edit_credits_policy', 'fixpadding');
  854. echo '<tr class="header"><th>'.cplang('credits_id').'</th><th>'.cplang('setting_credits_policy_cycletype').'</th><th>'.cplang('setting_credits_policy_rewardnum').'</th><th class="td25">'.cplang('custom').'</th>';
  855. foreach($_G['setting']['extcredits'] as $i => $extcredit) {
  856. echo '<th>'.$extcredit['title'].'</th>';
  857. }
  858. echo '<th>&nbsp;</th></tr>';
  859. if(is_array($_G['setting']['extcredits'])) {
  860. foreach($rules as $rid => $rule) {
  861. $globalrule = $rule;
  862. $readonly = $checked = '';
  863. if(isset($forum['creditspolicy'][$rule['action']])) {
  864. $rule = $forum['creditspolicy'][$rule['action']];
  865. $checked = ' checked="checked"';
  866. } else {
  867. for($i = 1; $i <= 8; $i++) {
  868. $rule['extcredits'.$i] = '';
  869. }
  870. $readonly = ' readonly="readonly" style="display:none;"';
  871. }
  872. $usecustom = '<input type="checkbox" name="usecustom['.$rule['rid'].']" onclick="modifystate(this);" value="1" class="checkbox" '.$checked.' />';
  873. $tdarr = array($rule['rulename'], $rule['rid'] ? cplang('setting_credits_policy_cycletype_'.$rule['cycletype']) : 'N/A', $rule['rid'] && $rule['cycletype'] ? $rule['rewardnum'] : 'N/A', $usecustom);
  874. for($i = 1; $i <= 8; $i++) {
  875. if($_G['setting']['extcredits'][$i]) {
  876. array_push($tdarr, '<input type="text" name="creditnew['.$rule['rid'].']['.$i.']" class="txt smtxt" value="'.$rule['extcredits'.$i].'" '.$readonly.' /><span class="sml">('.($globalrule['extcredits'.$i]).')</span>');
  877. }
  878. }
  879. $opstr = '<a href="'.ADMINSCRIPT.'?action=credits&operation=edit&rid='.$rule['rid'].'&fid='.$fid.'" title="" class="act">'.cplang('edit').'</a>';
  880. array_push($tdarr, $opstr);
  881. showtablerow('', array_fill(4, count($_G['setting']['extcredits']) + 4, 'width="70"'), $tdarr);
  882. }
  883. }
  884. showtablerow('', 'class="lineheight" colspan="13"', cplang('forums_edit_credits_comment', array('fid' => $fid)));
  885. showtablefooter();
  886. print <<<EOF
  887. <script type="text/javascript">
  888. function modifystate(custom) {
  889. var trObj = custom.parentNode.parentNode;
  890. var inputsObj = trObj.getElementsByTagName('input');
  891. for(key in inputsObj) {
  892. var obj = inputsObj[key];
  893. if(typeof obj == 'object' && obj.type != 'checkbox') {
  894. obj.value = '';
  895. obj.readOnly = custom.checked ? false : true;
  896. obj.style.display = obj.readOnly ? 'none' : '';
  897. }
  898. }
  899. }
  900. </script>
  901. EOF;
  902. showtagfooter('div');
  903. }
  904. if($allowthreadtypes && !$multiset) {
  905. $lang_forums_edit_threadtypes_use_cols = cplang('forums_edit_threadtypes_use_cols');
  906. $lang_forums_edit_threadtypes_use_choice = cplang('forums_edit_threadtypes_use_choice');
  907. echo <<<EOT
  908. <script type="text/JavaScript">
  909. var rowtypedata = [
  910. [
  911. [1,'', 'td25'],
  912. [1,'<input type="text" size="2" name="newdisplayorder[]" value="0" />'],
  913. [1,'<input type="text" name="newname[]" />'],
  914. [1,'<input type="text" name="newicon[]" />'],
  915. [1,'<input type="hidden" name="newenable[]" value="1"><input type="checkbox" class="checkbox" checked="checked" disabled/>'],
  916. [1,'<input type="checkbox" class="checkbox" name="newmoderators[]" value="1" />'],
  917. [1,'']
  918. ],
  919. [
  920. [1,'', 'td25'],
  921. [1,'<input name="newextension[]" type="text" class="txt" size="10">', 'td24'],
  922. [1,'<input name="newmaxsize[]" type="text" class="txt" size="15">']
  923. ]
  924. ];
  925. </script>
  926. EOT;
  927. showtagheader('div', 'threadtypes', $anchor == 'threadtypes');
  928. if(!$multiset) {
  929. showtips('forums_edit_tips');
  930. }
  931. showtableheader('forums_edit_threadtypes_config', 'nobottom');
  932. showsetting('forums_edit_threadtypes_status', array('threadtypesnew[status]', array(
  933. array(1, cplang('yes'), array('threadtypes_config' => '', 'threadtypes_manage' => '')),
  934. array(0, cplang('no'), array('th…

Large files files are truncated, but you can click here to view the full file