Просмотр файла admin/admin_democracy.php

Размер файла: 17.66Kb
  1. <?php
  2. /***************************************************************************
  3. * mides.ru
  4. * -------------------
  5. ***************************************************************************/
  6. define('IN_PHPBB', 1);
  7.  
  8. if (!empty($setmodules))
  9. {
  10. $filename = basename(__FILE__);
  11. $module['General'][$lang['reputation_democracy']] = $filename;
  12. return;
  13. }
  14.  
  15. $phpbb_root_path = './../';
  16. require($phpbb_root_path . 'extension.inc');
  17. require('./pagestart.' . $phpEx);
  18. require($phpbb_root_path . 'includes/functions_reputation.' . $phpEx);
  19.  
  20. define('REPUTATION_MIN', -100000);
  21. define('WARNINGS_MAX', 100000);
  22.  
  23. $mode = isset($HTTP_GET_VARS['mode']) ? $HTTP_GET_VARS['mode'] : '';
  24.  
  25. if (isset($HTTP_POST_VARS['resync']))
  26. {
  27. db_query('UPDATE {USERS_TABLE} SET user_reputation = 0, user_reputation_plus = 0, user_warnings = 0');
  28.  
  29. $result = db_query('SELECT user_id, SUM(modification = {REPUTATION_INC}) AS reputation_plus, SUM(modification = {REPUTATION_DEC}) AS reputation_minus, SUM(modification = {REPUTATION_WARNING} OR modification = {REPUTATION_BAN}) AS warnings
  30. FROM {REPUTATION_TABLE}
  31. WHERE modification IN({REPUTATION_INC}, {REPUTATION_DEC}, {REPUTATION_WARNING}, {REPUTATION_BAN})
  32. GROUP BY user_id');
  33.  
  34. while ($row = $db->sql_fetchrow($result))
  35. {
  36. $reputation = $row['reputation_plus'] - $row['reputation_minus'];
  37. db_query('UPDATE {USERS_TABLE} SET user_reputation = %d, user_reputation_plus = %d, user_warnings = %d
  38. WHERE user_id = %d',
  39. $reputation, $row['reputation_plus'], $row['warnings'], $row['user_id']);
  40. }
  41.  
  42. db_query('UPDATE {POSTS_TABLE} SET post_reviews = 0');
  43.  
  44. $result = db_query('SELECT post_id, COUNT(*) AS reviews
  45. FROM {REPUTATION_TABLE}
  46. WHERE modification IN({REPUTATION_INC}, {REPUTATION_DEC})
  47. GROUP BY post_id');
  48.  
  49. while ($row = $db->sql_fetchrow($result))
  50. {
  51. db_query('UPDATE {POSTS_TABLE} SET post_reviews = %d WHERE post_id = %d', $row['reviews'], $row['post_id']);
  52. }
  53.  
  54. $result = db_query('SELECT r.id, r.forum_id AS review_forum_id, p.post_id, p.forum_id AS post_forum_id
  55. FROM {REPUTATION_TABLE} r LEFT JOIN {POSTS_TABLE} p ON r.post_id = p.post_id
  56. WHERE p.forum_id <> r.forum_id OR (r.post_id <> {NO_ID} AND p.post_id IS NULL)');
  57.  
  58. $no_post = ''; $wrong_forum = array();
  59.  
  60. while ($row = $db->sql_fetchrow($result))
  61. {
  62. if (!$row['post_id'])
  63. {
  64. $no_post .= ($no_post ? ',' : '') . $row['id'];
  65. }
  66. elseif ($row['review_forum_id'] != $row['post_forum_id'])
  67. {
  68. if (isset($wrong_forum[$row['post_forum_id']]))
  69. {
  70. $wrong_forum[$row['post_forum_id']] .= ',' . $row['id'];
  71. }
  72. else
  73. {
  74. $wrong_forum[$row['post_forum_id']] = $row['id'];
  75. }
  76. }
  77. }
  78.  
  79. if ($no_post)
  80. {
  81. db_query('UPDATE {REPUTATION_TABLE} SET post_id = {NO_ID} WHERE id IN(%s)', $no_post);
  82. }
  83. foreach ($wrong_forum as $forum_id => $review_ids)
  84. {
  85. db_query('UPDATE {REPUTATION_TABLE} SET forum_id = %d WHERE id IN(%s)', $forum_id, $review_ids);
  86. }
  87.  
  88. $links = sprintf($lang['Click_return_reputation_index'], '<a href="' . append_sid("admin_democracy.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');
  89. $message = '<br />' . $lang['reputation_success'] . '<br /><br />' . $links . '<br /><br />';
  90. message_die(GENERAL_MESSAGE, $message);
  91. }
  92.  
  93. if (!isset($HTTP_POST_VARS['confirm']))
  94. {
  95. $template->set_filenames(array(
  96. "body" => 'admin/reputation_body.tpl')
  97. );
  98.  
  99. $auth_idx = array(AUTH_ALL => 3, AUTH_REG => 0, AUTH_MOD => 1, AUTH_ADMIN => 2);
  100.  
  101. $reputation_auth = array();
  102. foreach ($reputation_auth_keys as $i => $key)
  103. {
  104. $reputation_auth[$key] = $auth_idx[$board_config['reputation_perms'][$i]];
  105. }
  106.  
  107. $prepare_keys = array('reputation_days_req', 'reputation_posts_req', 'reputation_warnings_req', 'reputation_points_req', 'reputation_time_limit', 'reputation_rotation_limit', 'reputation_most_respected', 'reputation_least_respected', 'reputation_fixed', 'reputation_modifiable', 'reputation_delete_days', 'reputation_ban_warnings', 'reputation_check_rate');
  108. foreach ($prepare_keys as $key)
  109. {
  110. foreach (explode('%s', $lang[$key]) as $i => $part)
  111. {
  112. $lang[$key . '_' . $i] = $part;
  113. }
  114. }
  115.  
  116. function decode_expiration($expiration)
  117. {
  118. $mode = count($expiration);
  119. if ($mode == 2)
  120. {
  121. $min = empty($expiration[0]) ? '' : $expiration[0];
  122. $max = empty($expiration[1]) ? '' : $expiration[1];
  123. }
  124. else
  125. {
  126. $min = empty($expiration[0]) ? 3 : $expiration[0];
  127. $max = $min + 7;
  128. }
  129. return array($mode, $min, $max);
  130. }
  131.  
  132. list($warn_expire_mode, $warn_expire_min, $warn_expire_max) = decode_expiration($board_config['reputation_warning_expire']);
  133. list($ban_expire_mode, $ban_expire_min, $ban_expire_max) = decode_expiration($board_config['reputation_ban_expire']);
  134. $delete_expired = $board_config['reputation_delete_expired'] != -1;
  135.  
  136. $template->assign_vars(array(
  137. 'L_DEMOCRACY' => $lang['reputation_democracy'],
  138. 'L_DEMOCRACY_EXP' => $lang['reputation_democracy_exp'],
  139. 'L_CHECK_CONFIRM' => $lang['reputation_check_confirm'],
  140. 'L_SUBMIT' => $lang['Submit'],
  141. 'L_RESET' => $lang['Reset'],
  142. 'L_CONFIRM' => $lang['Confirm'],
  143. 'L_USER' => $lang['Forum_REG'],
  144. 'L_MODERATOR' => $lang['Forum_MOD'],
  145. 'L_ADMIN' => $lang['Forum_ADMIN'],
  146.  
  147. 'L_ENABLE_REPUTATION' => $lang['reputation_enable'],
  148. 'L_ENABLE_WARNINGS' => $lang['reputation_enable_warnings'],
  149. 'L_ENABLE_REPORTS' => $lang['reports_enabled'],
  150. 'L_REPUTATION_OPTIONS' => $lang['reputation_reputation_options'],
  151. 'L_WARNINGS_OPTIONS' => $lang['reputation_warnings_options'],
  152. 'L_REPORTS_OPTIONS' => $lang['reputation_reports_options'],
  153. 'L_POSITIVE_ONLY' => $lang['reputation_positive_only'],
  154. 'L_POSITIVE_ONLY_EXP' => $lang['reputation_positive_only_exp'],
  155. 'L_EMPTY_REVIEWS' => $lang['reputation_empty_reviews'],
  156. 'L_ACCESS_RIGHTS' => $lang['reputation_access_rights'],
  157. 'L_ADD_REP' => $lang['reputation_add_rep'],
  158. 'L_ADD_REP_NONPOST' => $lang['reputation_add_rep_nonpost'],
  159. 'L_EDIT_REP' => $lang['reputation_edit_rep'],
  160. 'L_DELETE_REP' => $lang['reputation_delete_rep'],
  161. 'L_NO_LIMITS' => $lang['reputation_no_limits'],
  162. 'L_WARN' => $lang['reputation_warn'],
  163. 'L_WARN_NONPOST' => $lang['reputation_warn_nonpost'],
  164. 'L_BAN' => $lang['reputation_ban'],
  165. 'L_BAN_NONPOST' => $lang['reputation_ban_nonpost'],
  166. 'L_EDIT_WARNS' => $lang['reputation_edit_warns'],
  167. 'L_DELETE_WARNS' => $lang['reputation_delete_warns'],
  168. 'L_NOT_APPLICABLE' => $lang['reputation_not_applicable'],
  169. 'L_ANONYMOUS_VIEW_REP' => $lang['reputation_anonymous_view_rep'],
  170. 'L_ANONYMOUS_VIEW_WARNS' => $lang['reputation_anonymous_view_warns'],
  171. 'L_REPUTATION_PERMS_NOTE' => $lang['reputation_perms_notes'],
  172. 'L_WARNINGS_PERMS_NOTE' => $lang['reputation_warn_perms_notes'],
  173.  
  174. 'L_DAYS_REQ_0' => $lang['reputation_days_req_0'],
  175. 'L_DAYS_REQ_1' => $lang['reputation_days_req_1'],
  176. 'L_POSTS_REQ_0' => $lang['reputation_posts_req_0'],
  177. 'L_POSTS_REQ_1' => $lang['reputation_posts_req_1'],
  178. 'L_WARNINGS_REQ_0' => $lang['reputation_warnings_req_0'],
  179. 'L_WARNINGS_REQ_1' => $lang['reputation_warnings_req_1'],
  180. 'L_REPUTATION_REQ_0' => $lang['reputation_points_req_0'],
  181. 'L_REPUTATION_REQ_1' => $lang['reputation_points_req_1'],
  182. 'L_TIME_LIMIT_0' => $lang['reputation_time_limit_0'],
  183. 'L_TIME_LIMIT_1' => $lang['reputation_time_limit_1'],
  184. 'L_ROTATION_LIMIT_0' => $lang['reputation_rotation_limit_0'],
  185. 'L_ROTATION_LIMIT_1' => $lang['reputation_rotation_limit_1'],
  186. 'L_ROTATION_LIMIT_EXP' => $lang['reputation_rotation_limit_exp'],
  187. 'L_MOST_RESPECTED_0' => $lang['reputation_most_respected_0'],
  188. 'L_MOST_RESPECTED_1' => $lang['reputation_most_respected_1'],
  189. 'L_LEAST_RESPECTED_0' => $lang['reputation_least_respected_0'],
  190. 'L_LEAST_RESPECTED_1' => $lang['reputation_least_respected_1'],
  191. 'L_REPUTATION_DISPLAY' => $lang['reputation_display'],
  192. 'L_DISPLAY_SUM' => $lang['reputation_display_sum'],
  193. 'L_DISPLAY_PLUSMINUS' => $lang['reputation_display_plusminus'],
  194.  
  195. 'L_INFINITE' => $lang['reputation_infinite'],
  196. 'L_INFINITE_EXP' => $lang['reputation_infinite_exp'],
  197. 'L_INFINITE_BAN_EXP' => $lang['reputation_infinite_ban_exp'],
  198. 'L_FIXED_0' => $lang['reputation_fixed_0'],
  199. 'L_FIXED_1' => $lang['reputation_fixed_1'],
  200. 'L_MODIFIABLE_0' => $lang['reputation_modifiable_0'],
  201. 'L_MODIFIABLE_1' => $lang['reputation_modifiable_1'],
  202. 'L_MODIFIABLE_2' => $lang['reputation_modifiable_2'],
  203. 'L_MODIFIABLE_EXP' => $lang['reputation_modifiable_exp'],
  204. 'L_STORE' => $lang['reputation_store'],
  205. 'L_DELETE_DAYS_0' => $lang['reputation_delete_days_0'],
  206. 'L_DELETE_DAYS_1' => $lang['reputation_delete_days_1'],
  207. 'L_BAN_WARNINGS_0' => $lang['reputation_ban_warnings_0'],
  208. 'L_BAN_WARNINGS_1' => $lang['reputation_ban_warnings_1'],
  209. 'L_BAN_WARNINGS_EXP' => $lang['reputation_ban_warnings_exp'],
  210. 'L_CHECK_RATE_0' => $lang['reputation_check_rate_0'],
  211. 'L_CHECK_RATE_1' => $lang['reputation_check_rate_1'],
  212. 'L_CHECK_RATE_EXP' => $lang['reputation_check_rate_exp'],
  213. 'L_REPORTS_COLOR' => $lang['reputation_reports_color'],
  214. 'L_REPORTS_COLOR_EXP' => $lang['reputation_reports_color_exp'],
  215.  
  216. 'L_EXPIRED_WARNINGS' => $lang['reputation_expired_warnings'],
  217. 'L_WARNING_EXPIRY' => $lang['reputation_warning_expiry'],
  218. 'L_BAN_EXPIRY' => $lang['reputation_ban_expiry'],
  219. 'L_INDEX_PAGE' => $lang['reputation_index_page'],
  220. 'L_PREREQUIREMENTS' => $lang['reputation_prerequirements'],
  221. 'L_LIMITS' => $lang['reputation_limits'],
  222.  
  223. 'L_MAINTENANCE' => $lang['reputation_maintenance'],
  224. 'L_RESYNC' => $lang['reputation_resync'],
  225. 'L_RESYNC_EXP' => $lang['reputation_resync_exp'],
  226.  
  227. 'S_REPUTATION_CHECKED' => $board_config['reputation_enabled'] ? 'checked="checked" ' : '',
  228. 'S_POSITIVE_ONLY' => $board_config['reputation_positive_only'] ? 'checked="checked" ' : '',
  229. 'S_EMPTY_REVIEWS' => $board_config['reputation_empty_reviews'] ? 'checked="checked" ' : '',
  230. 'S_WARNINGS_CHECKED' => $board_config['warnings_enabled'] ? 'checked="checked" ' : '',
  231. 'S_REPORTS_CHECKED' => $board_config['reports_enabled'] ? 'checked="checked" ' : '',
  232. 'S_DAYS_REQ' => $board_config['reputation_days_req'],
  233. 'S_POSTS_REQ' => $board_config['reputation_posts_req'],
  234. 'S_WARNINGS_REQ' => ($board_config['reputation_warnings_req'] != WARNINGS_MAX) ? $board_config['reputation_warnings_req'] : '0',
  235. 'S_REPUTATION_REQ' => ($board_config['reputation_points_req'] != REPUTATION_MIN) ? $board_config['reputation_points_req'] : '7',
  236. 'S_TIME_LIMIT' => $board_config['reputation_time_limit'],
  237. 'S_ROTATION_LIMIT' => $board_config['reputation_rotation_limit'],
  238. 'S_ADD_REP_CHECKED_' . $reputation_auth['auth_add_rep'] => 'checked="checked" ',
  239. 'S_ADD_REP_NONPOST_CHECKED_' . $reputation_auth['auth_add_rep_nonpost'] => 'checked="checked" ',
  240. 'S_EDIT_REP_CHECKED_' . $reputation_auth['auth_edit_rep'] => 'checked="checked" ',
  241. 'S_DELETE_REP_CHECKED_' . $reputation_auth['auth_delete_rep'] => 'checked="checked" ',
  242. 'S_NO_LIMITS_CHECKED_' . $reputation_auth['auth_no_limits'] => 'checked="checked" ',
  243. 'S_WARN_CHECKED_' . $reputation_auth['auth_warn'] => 'checked="checked" ',
  244. 'S_WARN_NONPOST_CHECKED_' . $reputation_auth['auth_warn_nonpost'] => 'checked="checked" ',
  245. 'S_BAN_CHECKED_' . $reputation_auth['auth_ban'] => 'checked="checked" ',
  246. 'S_BAN_NONPOST_CHECKED_' . $reputation_auth['auth_ban_nonpost'] => 'checked="checked" ',
  247. 'S_EDIT_WARN_CHECKED_' . $reputation_auth['auth_edit_warn'] => 'checked="checked" ',
  248. 'S_DELETE_WARN_CHECKED_' . $reputation_auth['auth_delete_warn'] => 'checked="checked" ',
  249. 'S_REPUTATION_ACTION' => append_sid("admin_democracy.$phpEx"),
  250. 'S_DELETE_EXPIRED_CHECKED_' . ($delete_expired ? '1' : '0') => 'checked="checked" ',
  251. 'S_DELETE_EXPIRED_DAYS' => ($delete_expired ? $board_config['reputation_delete_expired'] : '0'),
  252. 'S_EXPIRE_MODE_' . $warn_expire_mode => 'checked="checked" ',
  253. 'S_EXPIRE_FIXED' => $warn_expire_min,
  254. 'S_EXPIRE_MIN' => $warn_expire_min,
  255. 'S_EXPIRE_MAX' => $warn_expire_max,
  256. 'S_BAN_EXPIRE_MODE_' . $ban_expire_mode => 'checked="checked" ',
  257. 'S_BAN_EXPIRE_FIXED' => $ban_expire_min,
  258. 'S_BAN_EXPIRE_MIN' => $ban_expire_min,
  259. 'S_BAN_EXPIRE_MAX' => $ban_expire_max,
  260. 'S_BAN_WARNINGS' => $board_config['reputation_ban_warnings'],
  261. 'S_BAN_WARNINGS_CHECKED' => $board_config['reputation_ban_warnings'] ? 'checked="checked" ' : '',
  262. 'S_MOST_RESPECTED' => $board_config['reputation_most_respected'],
  263. 'S_LEAST_RESPECTED' => $board_config['reputation_least_respected'],
  264. 'S_MOD_NOREP_CHECKED' => $board_config['reputation_mod_norep'] ? 'checked="checked" ' : '',
  265. 'S_ADMIN_NOREP_CHECKED' => $board_config['reputation_admin_norep'] ? 'checked="checked" ' : '',
  266. 'S_ANONYMOUS_VIEW_REP_CHECKED' => $reputation_auth['auth_view_rep'] ? 'checked="checked" ' : '',
  267. 'S_ANONYMOUS_VIEW_WARNS_CHECKED' => $reputation_auth['auth_view_warns'] ? 'checked="checked" ' : '',
  268. 'S_ENABLE_DAYS_REQ' => $board_config['reputation_days_req'] ? 'checked="checked" ' : '',
  269. 'S_ENABLE_POSTS_REQ' => $board_config['reputation_posts_req'] ? 'checked="checked" ' : '',
  270. 'S_ENABLE_WARNINGS_REQ' => ($board_config['reputation_warnings_req'] != WARNINGS_MAX) ? 'checked="checked" ' : '',
  271. 'S_ENABLE_REPUTATION_REQ' => ($board_config['reputation_points_req'] != REPUTATION_MIN) ? 'checked="checked" ' : '',
  272. 'S_ENABLE_TIME_LIMIT' => $board_config['reputation_time_limit'] ? 'checked="checked" ' : '',
  273. 'S_ENABLE_ROTATION_LIMIT' => $board_config['reputation_rotation_limit'] ? 'checked="checked" ' : '',
  274. 'S_ENABLE_MOST_RESPECTED' => $board_config['reputation_most_respected'] ? 'checked="checked" ' : '',
  275. 'S_ENABLE_LEAST_RESPECTED' => $board_config['reputation_least_respected'] ? 'checked="checked" ' : '',
  276. 'S_CHECK_RATE' => $board_config['reputation_check_rate'],
  277. 'S_REPORTS_COLOR' => $board_config['reputation_reports_color'],
  278. 'S_REPUTATION_DISPLAY_' . $board_config['reputation_display'] => 'checked="checked" ',
  279.  
  280. 'AUTH_REG' => AUTH_REG,
  281. 'AUTH_MOD' => AUTH_MOD,
  282. 'AUTH_ADMIN' => AUTH_ADMIN,
  283.  
  284. 'REPUTATION_SUM' => REPUTATION_SUM,
  285. 'REPUTATION_PLUSMINUS' => REPUTATION_PLUSMINUS,
  286. ));
  287.  
  288. $template->pparse("body");
  289.  
  290. include('./page_footer_admin.'.$phpEx);
  291. }
  292. else
  293. {
  294. function positive($val)
  295. {
  296. $val = intval($val);
  297. return $val > 0 ? $val : 0;
  298. }
  299. function expiration($prefix)
  300. {
  301. global $HTTP_POST_VARS;
  302.  
  303. switch ($HTTP_POST_VARS[$prefix . '_mode'])
  304. {
  305. case '1':
  306. return positive($HTTP_POST_VARS[$prefix . '_fixed']);
  307. case '2':
  308. return positive($HTTP_POST_VARS[$prefix . '_min']) . ',' . positive($HTTP_POST_VARS[$prefix . '_max']);
  309. default: // case '0':
  310. return '';
  311. }
  312. }
  313.  
  314. $new_config = array(
  315. 'reputation_enabled' => intval(isset($HTTP_POST_VARS['reputation'])),
  316. 'warnings_enabled' => intval(isset($HTTP_POST_VARS['warnings'])),
  317. 'reports_enabled' => intval(isset($HTTP_POST_VARS['reports'])),
  318. 'reputation_positive_only' => intval(isset($HTTP_POST_VARS['positive_only'])),
  319. 'reputation_empty_reviews' => intval(isset($HTTP_POST_VARS['empty_reviews'])),
  320. 'reputation_admin_norep' => intval(isset($HTTP_POST_VARS['admin_norep'])),
  321. 'reputation_mod_norep' => intval(isset($HTTP_POST_VARS['mod_norep'])),
  322.  
  323. 'reputation_days_req' => isset($HTTP_POST_VARS['enable_days_req']) ? positive($HTTP_POST_VARS['days_req']) : '0',
  324. 'reputation_posts_req' => isset($HTTP_POST_VARS['enable_posts_req']) ? positive($HTTP_POST_VARS['posts_req']) : '0',
  325. 'reputation_warnings_req' => isset($HTTP_POST_VARS['enable_warnings_req']) ? positive($HTTP_POST_VARS['warnings_req']) : WARNINGS_MAX,
  326. 'reputation_points_req' => isset($HTTP_POST_VARS['enable_reputation_req']) ? intval($HTTP_POST_VARS['reputation_req']) : REPUTATION_MIN,
  327. 'reputation_time_limit' => isset($HTTP_POST_VARS['enable_time_limit']) ? positive($HTTP_POST_VARS['time_limit']) : '0',
  328. 'reputation_rotation_limit' => isset($HTTP_POST_VARS['enable_rotation_limit']) ? positive($HTTP_POST_VARS['rotation_limit']) : '0',
  329. 'reputation_most_respected' => isset($HTTP_POST_VARS['enable_most_respected']) ? positive($HTTP_POST_VARS['most_respected']) : '0',
  330. 'reputation_least_respected' => isset($HTTP_POST_VARS['enable_least_respected']) ? positive($HTTP_POST_VARS['least_respected']) : '0',
  331. 'reputation_ban_warnings' => isset($HTTP_POST_VARS['enable_ban_warnings']) ? positive($HTTP_POST_VARS['ban_warnings']) : '0',
  332.  
  333. 'reputation_display' => intval($HTTP_POST_VARS['reputation_display']),
  334.  
  335. 'reputation_delete_expired' => !empty($HTTP_POST_VARS['enable_delete_expired']) ? positive($HTTP_POST_VARS['delete_expired']) : '-1',
  336.  
  337. 'reputation_check_rate' => positive($HTTP_POST_VARS['check_rate']),
  338. 'reputation_reports_color' => trim($HTTP_POST_VARS['reports_color']),
  339.  
  340. 'reputation_warning_expire' => expiration('expire'),
  341. 'reputation_ban_expire' => expiration('ban_expire'),
  342. );
  343.  
  344. $reputation_auth = array(
  345. isset($HTTP_POST_VARS['anonymous_view_rep']) ? AUTH_ALL : AUTH_REG,
  346. isset($HTTP_POST_VARS['anonymous_view_warns']) ? AUTH_ALL : AUTH_REG,
  347. );
  348. for ($i = 2; $i < count($reputation_auth_keys); ++$i)
  349. {
  350. $key = $reputation_auth_keys[$i];
  351. $reputation_auth[] = isset($HTTP_POST_VARS[$key]) ? intval($HTTP_POST_VARS[$key]) : AUTH_ADMIN;
  352. }
  353. $new_config['reputation_perms'] = implode(',', $reputation_auth);
  354.  
  355. foreach ($new_config as $name => $value)
  356. {
  357. db_query("UPDATE {CONFIG_TABLE} SET config_value = '%s' WHERE config_name = '%s'", $value, $name);
  358. }
  359.  
  360. cache_set(RESPECTED_CACHE);
  361.  
  362. $links = sprintf($lang['Click_return_reputation_index'], '<a href="' . append_sid("admin_democracy.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');
  363. $message = '<br />' . $lang['Config_updated'] . '<br /><br />' . $links . '<br /><br />';
  364. message_die(GENERAL_MESSAGE, $message);
  365. }
  366.  
  367. ?>