/upload/admin/admin_board.php

http://torrentpier2.googlecode.com/ · PHP · 162 lines · 136 code · 21 blank · 5 comment · 25 complexity · 0bd65c06eee9870c1b83952c9ca3d842 MD5 · raw file

  1. <?php
  2. // ACP Header - START
  3. if (!empty($setmodules))
  4. {
  5. $module['General']['Configuration'] = basename(__FILE__) .'?mode=config';
  6. $module['Mods']['Configuration'] = basename(__FILE__) .'?mode=config_mods';
  7. return;
  8. }
  9. require('./pagestart.php');
  10. // ACP Header - END
  11. require(INC_DIR .'functions_selects.php');
  12. $mode = isset($_GET['mode']) ? $_GET['mode'] : '';
  13. $return_links = array(
  14. 'index' => '<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'),
  15. 'config' => '<br /><br />'. sprintf($lang['CLICK_RETURN_CONFIG'], '<a href="admin_board.php?mode=config">', '</a>'),
  16. 'config_mods' => '<br /><br />'. sprintf($lang['CLICK_RETURN_CONFIG_MODS'], '<a href="admin_board.php?mode=config_mods">', '</a>')
  17. );
  18. //
  19. // Pull all config data
  20. //
  21. $sql = "SELECT * FROM " . BB_CONFIG;
  22. if(!$result = DB()->sql_query($sql))
  23. {
  24. message_die(CRITICAL_ERROR, "Could not query config information in admin_board", "", __LINE__, __FILE__, $sql);
  25. }
  26. else
  27. {
  28. while( $row = DB()->sql_fetchrow($result) )
  29. {
  30. $config_name = $row['config_name'];
  31. $config_value = $row['config_value'];
  32. $default_config[$config_name] = $config_value;
  33. $new[$config_name] = isset($_POST[$config_name]) ? $_POST[$config_name] : $default_config[$config_name];
  34. if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name])
  35. {
  36. if ($config_name == 'seed_bonus_points' || $config_name == 'seed_bonus_release') $new[$config_name] = serialize($new[$config_name]);
  37. if ($config_name == 'bonus_upload' || $config_name == 'bonus_upload_price') $new[$config_name] = serialize($new[$config_name]);
  38. bb_update_config(array($config_name => $new[$config_name]));
  39. }
  40. }
  41. if( isset($_POST['submit']) )
  42. {
  43. if ($mode == 'config')
  44. {
  45. message_die(GENERAL_MESSAGE, $lang['CONFIG_UPDATED'] . $return_links['config'] . $return_links['index']);
  46. }
  47. elseif ($mode == 'config_mods')
  48. {
  49. message_die(GENERAL_MESSAGE, $lang['CONFIG_UPDATED'] . $return_links['config_mods'] . $return_links['index']);
  50. }
  51. }
  52. }
  53. switch($mode)
  54. {
  55. case 'config_mods':
  56. $template->assign_vars(array(
  57. 'S_CONFIG_ACTION' => 'admin_board.php?mode=config_mods',
  58. 'CONFIG_MODS' => true,
  59. 'REPORTS_ENABLED' => $new['reports_enabled'],
  60. 'MAGNET_LINKS_ENABLED' => $new['magnet_links_enabled'],
  61. 'GENDER' => $new['gender'],
  62. 'CALLSEED' => $new['callseed'],
  63. 'TOR_STATS' => $new['tor_stats'],
  64. 'SHOW_LATEST_NEWS' => $new['show_latest_news'],
  65. 'MAX_NEWS_TITLE' => $new['max_news_title'],
  66. 'LATEST_NEWS_COUNT' => $new['latest_news_count'],
  67. 'LATEST_NEWS_FORUM_ID' => $new['latest_news_forum_id'],
  68. 'SHOW_NETWORK_NEWS' => $new['show_network_news'],
  69. 'MAX_NET_TITLE' => $new['max_net_title'],
  70. 'NETWORK_NEWS_COUNT' => $new['network_news_count'],
  71. 'NETWORK_NEWS_FORUM_ID' => $new['network_news_forum_id'],
  72. 'WHOIS_INFO' => $new['whois_info'],
  73. 'SHOW_MOD_INDEX' => $new['show_mod_index'],
  74. 'BIRTHDAY_ENABLED' => $new['birthday_enabled'],
  75. 'BIRTHDAY_MAX_AGE' => $new['birthday_max_age'],
  76. 'BIRTHDAY_MIN_AGE' => $new['birthday_min_age'],
  77. 'BIRTHDAY_CHECK_DAY' => $new['birthday_check_day'],
  78. 'PREMOD' => $new['premod'],
  79. 'TOR_COMMENT' => $new['tor_comment'],
  80. 'NEW_TPLS' => $new['new_tpls'],
  81. 'SEED_BONUS_ENABLED' => $new['seed_bonus_enabled'],
  82. 'SEED_BONUS_TOR_SIZE' => $new['seed_bonus_tor_size'],
  83. 'SEED_BONUS_USER_REGDATE' => $new['seed_bonus_user_regdate'],
  84. ));
  85. if ($new['seed_bonus_points'] && $new['seed_bonus_release'])
  86. {
  87. $seed_bonus = unserialize($new['seed_bonus_points']);
  88. $seed_release = unserialize($new['seed_bonus_release']);
  89. foreach ($seed_bonus as $i => $row)
  90. {
  91. if (!$row || !$seed_release[$i]) continue;
  92. $template->assign_block_vars('seed_bonus', array(
  93. 'RELEASE' => $seed_release[$i],
  94. 'POINTS' => $row,
  95. ));
  96. }
  97. }
  98. if ($new['bonus_upload'] && $new['bonus_upload_price'])
  99. {
  100. $upload_row = unserialize($new['bonus_upload']);
  101. $price_row = unserialize($new['bonus_upload_price']);
  102. foreach ($upload_row as $i => $row)
  103. {
  104. if (!$row || !$price_row[$i]) continue;
  105. $template->assign_block_vars('bonus_upload', array(
  106. 'UP' => $row,
  107. 'PRICE' => $price_row[$i],
  108. ));
  109. }
  110. }
  111. break;
  112. default:
  113. $template->assign_vars(array(
  114. 'S_CONFIG_ACTION' => 'admin_board.php?mode=config',
  115. 'CONFIG' => true,
  116. 'SITENAME' => htmlCHR($new['sitename']),
  117. 'CONFIG_SITE_DESCRIPTION' => htmlCHR($new['site_desc']),
  118. 'DISABLE_BOARD' => ($new['board_disable']) ? true : false,
  119. 'ALLOW_AUTOLOGIN' => ($new['allow_autologin']) ? true : false,
  120. 'AUTOLOGIN_TIME' => (int) $new['max_autologin_time'],
  121. 'MAX_POLL_OPTIONS' => $new['max_poll_options'],
  122. 'FLOOD_INTERVAL' => $new['flood_interval'],
  123. 'TOPICS_PER_PAGE' => $new['topics_per_page'],
  124. 'POSTS_PER_PAGE' => $new['posts_per_page'],
  125. 'HOT_TOPIC' => $new['hot_threshold'],
  126. 'LANG_SELECT' => language_select($new['default_lang'], 'default_lang', 'language'),
  127. 'DEFAULT_DATEFORMAT' => $new['default_dateformat'],
  128. 'TIMEZONE_SELECT' => tz_select($new['board_timezone'], 'board_timezone'),
  129. 'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'],
  130. 'LOGIN_RESET_TIME' => $new['login_reset_time'],
  131. 'PRUNE_ENABLE' => ($new['prune_enable']) ? true : false,
  132. 'ALLOW_BBCODE' => ($new['allow_bbcode']) ? true : false,
  133. 'ALLOW_SMILIES' => ($new['allow_smilies']) ? true : false,
  134. 'ALLOW_SIG' => ($new['allow_sig']) ? true : false,
  135. 'SIG_SIZE' => $new['max_sig_chars'],
  136. 'ALLOW_NAMECHANGE' => ($new['allow_namechange']) ? true : false,
  137. 'SMILIES_PATH' => $new['smilies_path'],
  138. ));
  139. break;
  140. }
  141. print_page('admin_board.tpl', 'admin');