PageRenderTime 347ms CodeModel.GetById 21ms RepoModel.GetById 2ms app.codeStats 0ms

/source/admincp/admincp_forums.php

https://github.com/kuaileshike/upload
PHP | 2132 lines | 2037 code | 89 blank | 6 comment | 188 complexity | e6434f688b192061a19a56355c706540 MD5 | raw file

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 31327 2012-08-13 07:01:41Z liulanbo $
  7. */
  8. if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
  9. exit('Access Denied');
  10. }
  11. cpheader();
  12. $operation = empty($operation) ? 'admin' : $operation;
  13. $fid = 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. $log_handler = Cloud::loadClass('Cloud_Service_SearchHelper');
  399. $log_handler->myThreadLog('mergeforum', array('fid' => $source, 'otherid' => $target));
  400. $query = C::t('forum_access')->fetch_all_by_fid_uid($source);
  401. foreach($query as $access) {
  402. C::t('forum_access')->insert(array('uid' => $access['uid'], 'fid' => $target, 'allowview' => $access['allowview'], 'allowpost' => $access['allowpost'], 'allowreply' => $access['allowreply'], 'allowgetattach' => $access['allowgetattach']));
  403. }
  404. C::t('forum_access')->delete_by_fid($source);
  405. C::t('forum_thread')->clear_cache(array($source,$target), 'forumdisplay_');
  406. updatecache('forums');
  407. cpmsg('forums_merge_succeed', 'action=forums', 'succeed');
  408. }
  409. } elseif($operation == 'edit') {
  410. require_once libfile('function/forumlist');
  411. require_once libfile('function/domain');
  412. $highlight = getgpc('highlight');
  413. $anchor = getgpc('anchor');
  414. list($pluginsetting, $pluginvalue) = get_pluginsetting('forums');
  415. $multiset = 0;
  416. if(empty($_GET['multi'])) {
  417. $fids = $fid;
  418. } else {
  419. $multiset = 1;
  420. if(is_array($_GET['multi'])) {
  421. $fids = $_GET['multi'];
  422. } else {
  423. $_GET['multi'] = explode(',', $_GET['multi']);
  424. $fids = &$_GET['multi'];
  425. }
  426. }
  427. if(count($_GET['multi']) == 1) {
  428. $fids = $_GET['multi'][0];
  429. $multiset = 0;
  430. }
  431. if(empty($fids)) {
  432. 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>');
  433. }
  434. $mforum = array();
  435. $perms = array('viewperm', 'postperm', 'replyperm', 'getattachperm', 'postattachperm', 'postimageperm');
  436. $query = C::t('forum_forum')->fetch_all_info_by_fids($fids);
  437. if(empty($query)) {
  438. cpmsg('forums_nonexistence', '', 'error');
  439. } else {
  440. foreach($query as $forum) {
  441. if(isset($pluginvalue[$forum['fid']])) {
  442. $forum['plugin'] = $pluginvalue[$forum['fid']];
  443. }
  444. $mforum[] = $forum;
  445. }
  446. }
  447. $dactionarray = array();
  448. $allowthreadtypes = !in_array('threadtypes', $dactionarray);
  449. $forumkeys = C::t('common_setting')->fetch('forumkeys', true);
  450. $rules = array();
  451. foreach(C::t('common_credit_rule')->fetch_all_by_action(array('reply', 'post', 'digest', 'postattach', 'getattach')) as $value) {
  452. $rules[$value['rid']] = $value;
  453. }
  454. if(!submitcheck('detailsubmit')) {
  455. $anchor = in_array($_GET['anchor'], array('basic', 'extend', 'posts', 'attachtype', 'credits', 'threadtypes', 'threadsorts', 'perm', 'plugin')) ? $_GET['anchor'] : 'basic';
  456. shownav('forum', 'forums_edit');
  457. loadcache('forums');
  458. $forumselect = '';
  459. $sgid = 0;
  460. foreach($_G['cache']['forums'] as $forums) {
  461. $checked = $fid == $forums['fid'] || in_array($forums['fid'], $_GET['multi']);
  462. if($forums['type'] == 'group') {
  463. $sgid = $forums['fid'];
  464. $forumselect .= '</div><em class="cl">'.
  465. '<span class="right"><input name="checkall_'.$forums['fid'].'" onclick="checkAll(\'value\', this.form, '.$forums['fid'].', \'checkall_'.$forums['fid'].'\')" type="checkbox" class="vmiddle checkbox" /></span>'.
  466. '<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:">';
  467. } elseif($forums['type'] == 'forum') {
  468. $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>';
  469. } elseif($forums['type'] == 'sub') {
  470. $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>';
  471. }
  472. }
  473. $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>'.
  474. '<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>';
  475. showformheader('', '', 'menuform', 'get');
  476. showhiddenfields(array('action' => 'forums', 'operation' => 'edit'));
  477. if(count($mforum) == 1 && $mforum[0]['type'] == 'group') {
  478. showsubmenu(cplang('forums_cat_detail').(count($mforum) == 1 ? ' - '.$mforum[0]['name'].'(gid:'.$mforum[0]['fid'].')' : ''), array(), $forumselect);
  479. } else {
  480. if($multiset && !in_array($anchor, array('basic', 'extend', 'posts', 'perm', 'plugin'))) {
  481. $anchor = 'basic';
  482. }
  483. showsubmenuanchors(cplang('forums_edit').(count($mforum) == 1 ? ' - '.$mforum[0]['name'].'(fid:'.$mforum[0]['fid'].')' : ''), array(
  484. array('forums_edit_basic', 'basic', $anchor == 'basic'),
  485. array('forums_edit_extend', 'extend', $anchor == 'extend'),
  486. array('forums_edit_posts', 'posts', $anchor == 'posts'),
  487. array('forums_edit_perm', 'perm', $anchor == 'perm'),
  488. !$multiset ? array('forums_edit_credits', 'credits', $anchor == 'credits') : array(),
  489. !$multiset ? array(array('menu' => 'usergroups_edit_other', 'submenu' => array(
  490. array('forums_edit_threadtypes', 'threadtypes', $anchor == 'threadtypes'),
  491. array('forums_edit_threadsorts', 'threadsorts', $anchor == 'threadsorts'),
  492. !$multiset ? array('forums_edit_attachtype', 'attachtype', $anchor == 'attachtype') : array(),
  493. !$pluginsetting ? array() : array('forums_edit_plugin', 'plugin', $anchor == 'plugin'),
  494. ))) : array(),
  495. $multiset && $pluginsetting ? array('forums_edit_plugin', 'plugin', $anchor == 'plugin') : array(),
  496. ), $forumselect);
  497. }
  498. showformfooter();
  499. $groups = array();
  500. $query = C::t('common_usergroup')->range_orderby_credit();
  501. foreach($query as $group) {
  502. $group['type'] = $group['type'] == 'special' && $group['radminid'] ? 'specialadmin' : $group['type'];
  503. $groups[$group['type']][] = $group;
  504. }
  505. $styleselect = "<select name=\"styleidnew\"><option value=\"0\">$lang[use_default]</option>";
  506. foreach(C::t('common_style')->fetch_all_data(false, false) as $style) {
  507. $styleselect .= "<option value=\"$style[styleid]\" ".
  508. ($style['styleid'] == $mforum[0]['styleid'] ? 'selected="selected"' : NULL).
  509. ">$style[name]</option>\n";
  510. }
  511. $styleselect .= '</select>';
  512. if(!$multiset) {
  513. $attachtypes = '';
  514. foreach(C::t('forum_attachtype')->fetch_all_by_fid($fid) as $type) {
  515. $type['maxsize'] = round($type['maxsize'] / 1024);
  516. $attachtypes .= showtablerow('', array('class="td25"', 'class="td24"'), array(
  517. "<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"$type[id]\" />",
  518. "<input type=\"text\" class=\"txt\" size=\"10\" name=\"extension[$type[id]]\" value=\"$type[extension]\" />",
  519. "<input type=\"text\" class=\"txt\" size=\"15\" name=\"maxsize[$type[id]]\" value=\"$type[maxsize]\" />"
  520. ), TRUE);
  521. }
  522. } else {
  523. showtips('setting_multi_tips');
  524. }
  525. showformheader("forums&operation=edit&fid=$fid&", 'enctype');
  526. showhiddenfields(array('type' => $mforum[0]['type']));
  527. if(count($mforum) == 1 && $mforum[0]['type'] == 'group') {
  528. $mforum[0]['extra'] = dunserialize($mforum[0]['extra']);
  529. showtableheader();
  530. showsetting('forums_edit_basic_cat_name', 'namenew', $mforum[0]['name'], 'text');
  531. showsetting('forums_edit_basic_cat_name_color', 'extranew[namecolor]', $mforum[0]['extra']['namecolor'], 'color');
  532. showsetting('forums_edit_basic_cat_style', '', '', $styleselect);
  533. showsetting('forums_edit_extend_forum_horizontal', 'forumcolumnsnew', $mforum[0]['forumcolumns'], 'text');
  534. showsetting('forums_edit_extend_cat_sub_horizontal', 'catforumcolumnsnew', $mforum[0]['catforumcolumns'], 'text');
  535. if(!empty($_G['setting']['domain']['root']['forum'])) {
  536. 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']);
  537. } else {
  538. showsetting('forums_edit_extend_domain', 'domainnew', '', 'text', 'disabled');
  539. }
  540. showsetting('forums_cat_display', 'statusnew', $mforum[0]['status'], 'radio');
  541. showtablefooter();
  542. showtips('setting_seo_forum_tips', 'seo_tips', true, 'setseotips');
  543. showtableheader();
  544. showsetting('forums_edit_basic_seotitle', 'seotitlenew', dhtmlspecialchars($mforum[0]['seotitle']), 'text');
  545. showsetting('forums_edit_basic_keyword', 'keywordsnew', dhtmlspecialchars($mforum[0]['keywords']), 'text');
  546. showsetting('forums_edit_basic_seodescription', 'seodescriptionnew', dhtmlspecialchars($mforum[0]['seodescription']), 'textarea');
  547. showsubmit('detailsubmit');
  548. showtablefooter();
  549. } else {
  550. require_once libfile('function/editor');
  551. if($multiset) {
  552. $_G['showsetting_multi'] = 0;
  553. $_G['showsetting_multicount'] = count($mforum);
  554. foreach($mforum as $forum) {
  555. $_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>';
  556. }
  557. }
  558. $mfids = array();
  559. foreach($mforum as $forum) {
  560. $fid = $forum['fid'];
  561. $mfids[] = $fid;
  562. if(!$multiset) {
  563. $fupselect = "<select name=\"fupnew\">\n";
  564. $query = C::t('forum_forum')->fetch_all_info_by_ignore_fid($fid);
  565. foreach($query as $fup) {
  566. $fups[] = $fup;
  567. }
  568. if(is_array($fups)) {
  569. foreach($fups as $forum1) {
  570. if($forum1['type'] == 'group') {
  571. $selected = $forum1['fid'] == $forum['fup'] ? "selected=\"selected\"" : NULL;
  572. $fupselect .= "<option value=\"$forum1[fid]\" $selected>$forum1[name]</option>\n";
  573. foreach($fups as $forum2) {
  574. if($forum2['type'] == 'forum' && $forum2['fup'] == $forum1['fid']) {
  575. $selected = $forum2['fid'] == $forum['fup'] ? "selected=\"selected\"" : NULL;
  576. $fupselect .= "<option value=\"$forum2[fid]\" $selected>&nbsp; &gt; $forum2[name]</option>\n";
  577. }
  578. }
  579. }
  580. }
  581. foreach($fups as $forum0) {
  582. if($forum0['type'] == 'forum' && $forum0['fup'] == 0) {
  583. $selected = $forum0['fid'] == $forum['fup'] ? "selected=\"selected\"" : NULL;
  584. $fupselect .= "<option value=\"$forum0[fid]\" $selected>$forum0[name]</option>\n";
  585. }
  586. }
  587. }
  588. $fupselect .= '</select>';
  589. if($forum['threadtypes']) {
  590. $forum['threadtypes'] = dunserialize($forum['threadtypes']);
  591. $forum['threadtypes']['status'] = 1;
  592. } else {
  593. $forum['threadtypes'] = array('status' => 0, 'required' => 0, 'listable' => 0, 'prefix' => 0, 'options' => array());
  594. }
  595. if($forum['threadsorts']) {
  596. $forum['threadsorts'] = dunserialize($forum['threadsorts']);
  597. $forum['threadsorts']['status'] = 1;
  598. } else {
  599. $forum['threadsorts'] = array('status' => 0, 'required' => 0, 'listable' => 0, 'prefix' => 0, 'options' => array());
  600. }
  601. $typeselect = $sortselect = '';
  602. $query = C::t('forum_threadtype')->fetch_all_for_order();
  603. $typeselect = getthreadclasses_html($fid);
  604. foreach($query as $type) {
  605. $typeselected = array();
  606. $enablechecked = '';
  607. $keysort = $type['special'] ? 'threadsorts' : 'threadtypes';
  608. if(isset($forum[$keysort]['types'][$type['typeid']])) {
  609. $enablechecked = ' checked="checked"';
  610. }
  611. $showtype = TRUE;
  612. loadcache('threadsort_option_'.$type['typeid']);
  613. if($type['special'] && !$_G['cache']['threadsort_option_'.$type['typeid']]) {
  614. $showtype = FALSE;
  615. }
  616. if($type['special']) {
  617. $typeselected[3] = $forum['threadsorts']['show'][$type['typeid']] ? ' checked="checked"' : '';
  618. $sortselect .= $showtype ? showtablerow('', array('class="td25"'), array(
  619. '<input type="checkbox" name="threadsortsnew[options][enable]['.$type['typeid'].']" value="1" class="checkbox"'.$enablechecked.' />',
  620. $type['name'],
  621. $type['description'],
  622. "<input class=\"checkbox\" type=\"checkbox\" name=\"threadsortsnew[options][show][{$type[typeid]}]\" value=\"3\" $typeselected[3] />",
  623. "<input class=\"radio\" type=\"radio\" name=\"threadsortsnew[defaultshow]\" value=\"$type[typeid]\" ".($forum['threadsorts']['defaultshow'] == $type['typeid'] ? 'checked' : '')." />"
  624. ), TRUE) : '';
  625. }
  626. }
  627. $forum['creditspolicy'] = $forum['creditspolicy'] ? dunserialize($forum['creditspolicy']) : array();
  628. }
  629. if($forum['autoclose']) {
  630. $forum['autoclosetime'] = abs($forum['autoclose']);
  631. $forum['autoclose'] = $forum['autoclose'] / abs($forum['autoclose']);
  632. }
  633. if($forum['threadplugin']) {
  634. $forum['threadplugin'] = dunserialize($forum['threadplugin']);
  635. }
  636. $simplebin = sprintf('%08b', $forum['simple']);
  637. $forum['defaultorderfield'] = bindec(substr($simplebin, 0, 2));
  638. $forum['defaultorder'] = ($forum['simple'] & 32) ? 1 : 0;
  639. $forum['subforumsindex'] = bindec(substr($simplebin, 3, 2));
  640. $forum['subforumsindex'] = $forum['subforumsindex'] == 0 ? -1 : ($forum['subforumsindex'] == 2 ? 0 : 1);
  641. $forum['simple'] = $forum['simple'] & 1;
  642. $forum['modrecommend'] = $forum['modrecommend'] ? dunserialize($forum['modrecommend']) : '';
  643. $forum['formulaperm'] = dunserialize($forum['formulaperm']);
  644. $forum['medal'] = $forum['formulaperm']['medal'];
  645. $forum['formulapermmessage'] = $forum['formulaperm']['message'];
  646. $forum['formulapermusers'] = $forum['formulaperm']['users'];
  647. $forum['formulaperm'] = $forum['formulaperm'][0];
  648. $forum['extra'] = dunserialize($forum['extra']);
  649. $forum['threadsorts']['default'] = $forum['threadsorts']['defaultshow'] ? 1 : 0;
  650. $_G['multisetting'] = $multiset ? 1 : 0;
  651. showmultititle();
  652. showtagheader('div', 'basic', $anchor == 'basic');
  653. if(!$multiset) {
  654. showtips('forums_edit_tips');
  655. }
  656. showtableheader('forums_edit_basic', 'nobottom');
  657. showsetting('forums_edit_basic_name', 'namenew', $forum['name'], 'text');
  658. showsetting('forums_edit_base_name_color', 'extranew[namecolor]', $forum['extra']['namecolor'], 'color');
  659. if(!$multiset) {
  660. if($forum['icon']) {
  661. $valueparse = parse_url($forum['icon']);
  662. if(isset($valueparse['host'])) {
  663. $forumicon = $forum['icon'];
  664. } else {
  665. $forumicon = $_G['setting']['attachurl'].'common/'.$forum['icon'].'?'.random(6);
  666. }
  667. $forumiconhtml = '<label><input type="checkbox" class="checkbox" name="deleteicon" value="yes" /> '.$lang['delete'].'</label><br /><img src="'.$forumicon.'" /><br />';
  668. }
  669. showsetting('forums_edit_basic_icon', 'iconnew', $forum['icon'], 'filetext', '', 0, $forumiconhtml);
  670. showsetting('forums_edit_basic_icon_width', 'extranew[iconwidth]', $forum['extra']['iconwidth'], 'text');
  671. if($forum['banner']) {
  672. $valueparse = parse_url($forum['banner']);
  673. if(isset($valueparse['host'])) {
  674. $forumbanner = $forum['banner'];
  675. } else {
  676. $forumbanner = $_G['setting']['attachurl'].'common/'.$forum['banner'].'?'.random(6);
  677. }
  678. $forumbannerhtml = '<label><input type="checkbox" class="checkbox" name="deletebanner" value="yes" /> '.$lang['delete'].'</label><br /><img src="'.$forumbanner.'" /><br />';
  679. }
  680. showsetting('forums_edit_basic_banner', 'bannernew', $forum['banner'], 'filetext', '', 0, $forumbannerhtml);
  681. }
  682. showsetting('forums_edit_basic_display', 'statusnew', $forum['status'], 'radio');
  683. if(!$multiset) {
  684. showsetting('forums_edit_basic_up', '', '', $fupselect);
  685. }
  686. showsetting('forums_edit_basic_redirect', 'redirectnew', $forum['redirect'], 'text');
  687. showsetting('forums_edit_basic_description', 'descriptionnew', str_replace('&amp;', '&', html2bbcode($forum['description'])), 'textarea');
  688. showsetting('forums_edit_basic_rules', 'rulesnew', str_replace('&amp;', '&', html2bbcode($forum['rules'])), 'textarea');
  689. showsetting('forums_edit_basic_keys', 'keysnew', $forumkeys[$fid], 'text');
  690. if(!empty($_G['setting']['domain']['root']['forum'])) {
  691. $iname = $multiset ? "multinew[{$_G[showsetting_multi]}][domainnew]" : 'domainnew';
  692. 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']);
  693. } elseif(!$multiset) {
  694. showsetting('forums_edit_extend_domain', 'domainnew', '', 'text', 'disabled');
  695. }
  696. showtablefooter();
  697. if(!$multiset) {
  698. showtips('setting_seo_forum_tips', 'seo_tips', true, 'setseotips');
  699. }
  700. showtableheader();
  701. showsetting('forums_edit_basic_seotitle', 'seotitlenew', dhtmlspecialchars($forum['seotitle']), 'text');
  702. showsetting('forums_edit_basic_keyword', 'keywordsnew', dhtmlspecialchars($forum['keywords']), 'text');
  703. showsetting('forums_edit_basic_seodescription', 'seodescriptionnew', dhtmlspecialchars($forum['seodescription']), 'textarea');
  704. showtablefooter();
  705. showtagfooter('div');
  706. showtagheader('div', 'extend', $anchor == 'extend');
  707. if(!$multiset) {
  708. showtips('forums_edit_tips');
  709. }
  710. showtableheader('forums_edit_extend', 'nobottom');
  711. showsetting('forums_edit_extend_style', '', '', $styleselect);
  712. if($forum['type'] != 'sub') {
  713. showsetting('forums_edit_extend_sub_horizontal', 'forumcolumnsnew', $forum['forumcolumns'], 'text');
  714. showsetting('forums_edit_extend_subforumsindex', array('subforumsindexnew', array(
  715. array(-1, cplang('default')),
  716. array(1, cplang('yes')),
  717. array(0, cplang('no'))
  718. ), 1), $forum['subforumsindex'], 'mradio');
  719. showsetting('forums_edit_extend_simple', 'simplenew', $forum['simple'], 'radio');
  720. } else {
  721. if($_GET['multi']) {
  722. showsetting('forums_edit_extend_sub_horizontal', '', '', cplang('forums_edit_sub_multi_tips'));
  723. showsetting('forums_edit_extend_subforumsindex', '', '', cplang('forums_edit_sub_multi_tips'));
  724. showsetting('forums_edit_extend_simple', '', '', cplang('forums_edit_sub_multi_tips'));
  725. }
  726. }
  727. showsetting('forums_edit_extend_widthauto', array('widthautonew', array(
  728. array(0, cplang('default')),
  729. array(-1, cplang('forums_edit_extend_widthauto_-1')),
  730. array(1, cplang('forums_edit_extend_widthauto_1')),
  731. ), 1), $forum['widthauto'], 'mradio');
  732. showsetting('forums_edit_extend_picstyle', 'picstylenew', $forum['picstyle'], 'radio');
  733. showsetting('forums_edit_extend_allowside', 'allowsidenew', $forum['allowside'], 'radio');
  734. showsetting('forums_edit_extend_recommend_top', 'allowglobalsticknew', $forum['allowglobalstick'], 'radio');
  735. showsetting('forums_edit_extend_defaultorderfield', array('defaultorderfieldnew', array(
  736. array(0, cplang('forums_edit_extend_order_lastpost')),
  737. array(1, cplang('forums_edit_extend_order_starttime')),
  738. array(2, cplang('forums_edit_extend_order_replies')),
  739. array(3, cplang('forums_edit_extend_order_views'))
  740. )), $forum['defaultorderfield'], 'mradio');
  741. showsetting('forums_edit_extend_defaultorder', array('defaultordernew', array(
  742. array(0, cplang('forums_edit_extend_order_desc')),
  743. array(1, cplang('forums_edit_extend_order_asc'))
  744. )), $forum['defaultorder'], 'mradio');
  745. showsetting('forums_edit_extend_threadcache', 'threadcachesnew', $forum['threadcaches'], 'text');
  746. showsetting('forums_edit_extend_relatedgroup', 'relatedgroupnew', $forum['relatedgroup'], 'text');
  747. showsetting('forums_edit_extend_edit_rules', 'alloweditrulesnew', $forum['alloweditrules'], 'radio');
  748. showsetting('forums_edit_extend_disablecollect', 'disablecollectnew', $forum['disablecollect'], 'radio');
  749. showsetting('forums_edit_extend_recommend', 'modrecommendnew[open]', $forum['modrecommend']['open'], 'radio', '', 1);
  750. showsetting('forums_edit_extend_recommend_sort', array('modrecommendnew[sort]', array(
  751. array(1, cplang('forums_edit_extend_recommend_sort_auto')),
  752. array(0, cplang('forums_edit_extend_recommend_sort_manual')),
  753. array(2, cplang('forums_edit_extend_recommend_sort_mix')))), $forum['modrecommend']['sort'], 'mradio');
  754. showsetting('forums_edit_extend_recommend_orderby', array('modrecommendnew[orderby]', array(
  755. array(0, cplang('forums_edit_extend_recommend_orderby_dateline')),
  756. array(1, cplang('forums_edit_extend_recommend_orderby_lastpost')),
  757. array(2, cplang('forums_edit_extend_recommend_orderby_views')),
  758. array(3, cplang('forums_edit_extend_recommend_orderby_replies')),
  759. array(4, cplang('forums_edit_extend_recommend_orderby_digest')),
  760. array(5, cplang('forums_edit_extend_recommend_orderby_recommend')),
  761. array(6, cplang('forums_edit_extend_recommend_orderby_heats')),
  762. )), $forum['modrecommend']['orderby'], 'mradio');
  763. showsetting('forums_edit_extend_recommend_num', 'modrecommendnew[num]', $forum['modrecommend']['num'], 'text');
  764. showsetting('forums_edit_extend_recommend_imagenum', 'modrecommendnew[imagenum]', $forum['modrecommend']['imagenum'], 'text');
  765. showsetting('forums_edit_extend_recommend_imagesize', array('modrecommendnew[imagewidth]', 'modrecommendnew[imageheight]'), array(intval($forum['modrecommend']['imagewidth']), intval($forum['modrecommend']['imageheight'])), 'multiply');
  766. showsetting('forums_edit_extend_recommend_maxlength', 'modrecommendnew[maxlength]', $forum['modrecommend']['maxlength'], 'text');
  767. showsetting('forums_edit_extend_recommend_cachelife', 'modrecommendnew[cachelife]', $forum['modrecommend']['cachelife'], 'text');
  768. showsetting('forums_edit_extend_recommend_dateline', 'modrecommendnew[dateline]', $forum['modrecommend']['dateline'], 'text');
  769. showtablefooter();
  770. showtagfooter('div');
  771. showtagheader('div', 'posts', $anchor == 'posts');
  772. if(!$multiset) {
  773. showtips('forums_edit_tips');
  774. }
  775. showtableheader('forums_edit_posts', 'nobottom');
  776. showsetting('forums_edit_posts_modposts', array('modnewpostsnew', array(
  777. array(0, cplang('none')),
  778. array(1, cplang('forums_edit_posts_modposts_threads')),
  779. array(2, cplang('forums_edit_posts_modposts_posts'))
  780. )), $forum['modnewposts'], 'mradio');
  781. showsetting('forums_edit_posts_alloweditpost', 'alloweditpostnew', $forum['alloweditpost'], 'radio');
  782. showsetting('forums_edit_posts_recyclebin', 'recyclebinnew', $forum['recyclebin'], 'radio');
  783. showsetting('forums_edit_posts_html', 'allowhtmlnew', $forum['allowhtml'], 'radio');
  784. showsetting('forums_edit_posts_bbcode', 'allowbbcodenew', $forum['allowbbcode'], 'radio');
  785. showsetting('forums_edit_posts_imgcode', 'allowimgcodenew', $forum['allowimgcode'], 'radio');
  786. showsetting('forums_edit_posts_mediacode', 'allowmediacodenew', $forum['allowmediacode'], 'radio');
  787. showsetting('forums_edit_posts_smilies', 'allowsmiliesnew', $forum['allowsmilies'], 'radio');
  788. showsetting('forums_edit_posts_jammer', 'jammernew', $forum['jammer'], 'radio');
  789. showsetting('forums_edit_posts_anonymous', 'allowanonymousnew', $forum['allowanonymous'], 'radio');
  790. showsetting('forums_edit_posts_disablethumb', 'disablethumbnew', $forum['disablethumb'], 'radio');
  791. showsetting('forums_edit_posts_disablewatermark', 'disablewatermarknew', $forum['disablewatermark'], 'radio');
  792. showsetting('forums_edit_posts_allowpostspecial', array('allowpostspecialnew', array(
  793. cplang('thread_poll'),
  794. cplang('thread_trade'),
  795. cplang('thread_reward'),
  796. cplang('thread_activity'),
  797. cplang('thread_debate')
  798. )), $forum['allowpostspecial'], 'binmcheckbox');
  799. $threadpluginarray = '';
  800. if(is_array($_G['setting']['threadplugins'])) foreach($_G['setting']['threadplugins'] as $tpid => $data) {
  801. $threadpluginarray[] = array($tpid, $data['name']);
  802. }
  803. if($threadpluginarray) {
  804. showsetting('forums_edit_posts_threadplugin', array('threadpluginnew', $threadpluginarray), $forum['threadplugin'], 'mcheckbox');
  805. }
  806. showsetting('forums_edit_posts_allowspecialonly', 'allowspecialonlynew', $forum['allowspecialonly'], 'radio');
  807. showsetting('forums_edit_posts_autoclose', array('autoclosenew', array(
  808. array(0, cplang('forums_edit_posts_autoclose_none'), array('autoclose_time' => 'none')),
  809. array(1, cplang('forums_edit_posts_autoclose_dateline'), array('autoclose_time' => '')),
  810. array(-1, cplang('forums_edit_posts_autoclose_lastpost'), array('autoclose_time' => ''))
  811. )), $forum['autoclose'], 'mradio');
  812. showtagheader('tbody', 'autoclose_time', $forum['autoclose'], 'sub');
  813. showsetting('forums_edit_posts_autoclose_time', 'autoclosetimenew', $forum['autoclosetime'], 'text');
  814. showtagfooter('tbody');
  815. showsetting('forums_edit_posts_attach_ext', 'attachextensionsnew', $forum['attachextensions'], 'text');
  816. showsetting('forums_edit_posts_allowfeed', 'allowfeednew', $forum['allowfeed'], 'radio');
  817. showsetting('forums_edit_posts_commentitem', 'commentitemnew', $forum['commentitem'], 'textarea');
  818. showtablefooter();
  819. showtagfooter('div');
  820. if(!$multiset) {
  821. showtagheader('div', 'attachtype', $anchor == 'attachtype');
  822. showtips('forums_edit_attachtype_tips');
  823. showtableheader();
  824. showtablerow('class="partition"', array('class="td25"', 'class="td24"'), array(cplang('del'), cplang('misc_attachtype_ext'), cplang('misc_attachtype_maxsize')));
  825. echo $attachtypes;
  826. echo '<tr><td></td><td colspan="2"><div><a href="###" onclick="addrow(this, 1)" class="addtr">'.$lang['misc_attachtype_add'].'</a></div></tr>';
  827. showtablefooter();
  828. showtagfooter('div');
  829. showtagheader('div', 'credits', $anchor == 'credits');
  830. if(!$multiset) {
  831. showtips('forums_edit_tips');
  832. }
  833. showtableheader('forums_edit_credits_policy', 'fixpadding');
  834. 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>';
  835. foreach($_G['setting']['extcredits'] as $i => $extcredit) {
  836. echo '<th>'.$extcredit['title'].'</th>';
  837. }
  838. echo '<th>&nbsp;</th></tr>';
  839. if(is_array($_G['setting']['extcredits'])) {
  840. foreach($rules as $rid => $rule) {
  841. $globalrule = $rule;
  842. $readonly = $checked = '';
  843. if(isset($forum['creditspolicy'][$rule['action']])) {
  844. $rule = $forum['creditspolicy'][$rule['action']];
  845. $checked = ' checked="checked"';
  846. } else {
  847. for($i = 1; $i <= 8; $i++) {
  848. $rule['extcredits'.$i] = '';
  849. }
  850. $readonly = ' readonly="readonly" style="display:none;"';
  851. }
  852. $usecustom = '<input type="checkbox" name="usecustom['.$rule['rid'].']" onclick="modifystate(this);" value="1" class="checkbox" '.$checked.' />';
  853. $tdarr = array($rule['rulename'], $rule['rid'] ? cplang('setting_credits_policy_cycletype_'.$rule['cycletype']) : 'N/A', $rule['rid'] && $rule['cycletype'] ? $rule['rewardnum'] : 'N/A', $usecustom);
  854. for($i = 1; $i <= 8; $i++) {
  855. if($_G['setting']['extcredits'][$i]) {
  856. 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>');
  857. }
  858. }
  859. $opstr = '<a href="'.ADMINSCRIPT.'?action=credits&operation=edit&rid='.$rule['rid'].'&fid='.$fid.'" title="" class="act">'.cplang('edit').'</a>';
  860. array_push($tdarr, $opstr);
  861. showtablerow('', array_fill(4, count($_G['setting']['extcredits']) + 4, 'width="70"'), $tdarr);
  862. }
  863. }
  864. showtablerow('', 'class="lineheight" colspan="13"', cplang('forums_edit_credits_comment', array('fid' => $fid)));
  865. showtablefooter();
  866. print <<<EOF
  867. <script type="text/javascript">
  868. function modifystate(custom) {
  869. var trObj = custom.parentNode.parentNode;
  870. var inputsObj = trObj.getElementsByTagName('input');
  871. for(key in inputsObj) {
  872. var obj = inputsObj[key];
  873. if(typeof obj == 'object' && obj.type != 'checkbox') {
  874. obj.value = '';
  875. obj.readOnly = custom.checked ? false : true;
  876. obj.style.display = obj.readOnly ? 'none' : '';
  877. }
  878. }
  879. }
  880. </script>
  881. EOF;
  882. showtagfooter('div');
  883. }
  884. if($allowthreadtypes && !$multiset) {
  885. $lang_forums_edit_threadtypes_use_cols = cplang('forums_edit_threadtypes_use_cols');
  886. $lang_forums_edit_threadtypes_use_choice = cplang('forums_edit_threadtypes_use_choice');
  887. echo <<<EOT
  888. <script type="text/JavaScript">
  889. var rowtypedata = [
  890. [
  891. [1,'', 'td25'],
  892. [1,'<input type="text" size="2" name="newdisplayorder[]" value="0" />'],
  893. [1,'<input type="text" name="newname[]" />'],
  894. [1,'<input type="text" name="newicon[]" />'],
  895. [1,'<input type="hidden" name="newenable[]" value="1"><input type="checkbox" class="checkbox" checked="checked" disabled/>'],
  896. [1,'<input type="checkbox" class="checkbox" name="newmoderators[]" value="1" />'],
  897. [1,'']
  898. ],
  899. [
  900. [1,'', 'td25'],
  901. [1,'<input name="newextension[]" type="text" class="txt" size="10">', 'td24'],
  902. [1,'<input name="newmaxsize[]" type="text" class="txt" size="15">']
  903. ]
  904. ];
  905. </script>
  906. EOT;
  907. showtagheader('div', 'threadtypes', $anchor == 'threadtypes');
  908. if(!$multiset) {
  909. showtips('forums_edit_tips');
  910. }
  911. showtableheader('forums_edit_threadtypes_config', 'nobottom');
  912. showsetting('forums_edit_threadtypes_status', array('threadtypesnew[status]', array(
  913. array(1, cplang('yes'), array('threadtypes_config' => '', 'threadtypes_manage' => '')),
  914. array(0, cplang('no'), array('threadtypes_config' => 'none', 'threadtypes_manage' => 'none'))
  915. ), TRUE), $forum['threadtypes']['status'], 'mradio');
  916. showtagheader('tbody', 'threadtypes_config', $forum['threadtypes']['status']);
  917. showsetting('forums_edit_threadtypes_required', 'threadtypesnew[required]', $forum['threadtypes']['required'], 'radio');
  918. showsetting('forums_edit_threadtypes_listable', 'threadtypesnew[listable]', $forum['threadtypes']['listable'], 'radio');
  919. showsetting('forums_edit_threadtypes_prefix',
  920. array(
  921. 'threadtypesnew[prefix]',
  922. array(
  923. array(0, cplang('forums_edit_threadtypes_noprefix')),
  924. array(1, cplang('forums_edit_threadtypes_textonly')),
  925. array(2, cplang('forums_edit_threadtypes_icononly')),
  926. ),
  927. ),
  928. $forum['threadtypes']['prefix'], 'mradio'
  929. );
  930. showtagfooter('tbody');
  931. showtablefooter();
  932. showtagheader('div', 'threadtypes_manage', $forum['threadtypes']['status']);
  933. showtableheader('forums_edit_threadtypes', 'noborder fixpadding');
  934. showsubtitle(array('delete', 'display_order', 'forums_edit_threadtypes_name', 'forums_edit_threadtypes_icon', 'enable', 'forums_edit_threadtypes_moderators'));
  935. echo $typeselect;
  936. echo '<tr><td colspan="7"><div><a href="###" onclick="addrow(this, 0)" class="addtr">'.cplang('threadtype_infotypes_add').'</a></div></td></tr>';
  937. showtablefooter();
  938. showtagfoo

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