PageRenderTime 18ms CodeModel.GetById 10ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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