<?php
// Settings-Page
function geo_capblack_option_page() {
?>
	<script type="text/javascript">
	function copyover(from, to) {
		content = document.getElementById(from).options[document.getElementById(from).options.selectedIndex].value;
		document.getElementById(to).value = document.getElementById(to).value + "\n" + content;
	}
	</script>
	
	<?php
	require_once(WP_PLUGIN_DIR . '/geo-captcha-geo-blacklist/geo-captcha-blacklist-data.php');
	?>
	<div class="wrap geocaptcha">
		<div id="icon-geo-captcha-blacklist" class="icon32"><br /></div><h2><?php _e('Geo Captcha', 'geo-captcha-blacklist'); ?> &bull; <?php _e('Settings', 'geo-captcha-blacklist'); ?></h2>
		<div id="poststuff">
			<form method="post" id="geo_settings" action="">
				<div class="postbox" style="width: 48%; float: right;">
					<h3><?php _e('Blacklisted Countries (Can NEVER comment)', 'geo-captcha-blacklist'); ?>*</h3>
					<div class="inside">
						<div style="float: left;"><textarea cols="5" rows="5" id="geo_capblack_black" name="geo_capblack_black"><?php echo get_option("geo_capblack_black"); ?></textarea></div>
						<div>
							<input type="button" name="copy" value="&larr;" onclick="copyover('listing2', 'geo_capblack_black');" />
							<select id="listing2">
							<?php echo $geo_available_countries_list; ?>
							</select>
						</div>
						<p style="clear: both;"><small>* <?php _e('Insert the country codes (ISO 3166-1, A-2) for the countries which donot need to insert a captcha code seperated with new lines.', 'geo-captcha-blacklist'); ?></small></p>
					</div>
				</div>
				
				<div class="postbox" style="width: 48%;">
					<h3><?php _e('Captcha-free Countries', 'geo-captcha-blacklist'); ?>*</h3>
					<div class="inside">
						<div style="float: left;"><textarea cols="5" rows="5" id="geo_capblack_legal" name="geo_capblack_legal"><?php echo get_option("geo_capblack_legal"); ?></textarea></div>
						<div>
							<input type="button" name="copy" value="&larr;" onclick="copyover('listing', 'geo_capblack_legal');" />
							<select id="listing">
								<?php echo $geo_available_countries_list; ?>
							</select>
							</div>
							<p style="clear: both;"><small>* <?php _e('Insert the country codes (ISO 3166-1, A-2) for the countries which donot need to insert a captcha code seperated with new lines.', 'geo-captcha-blacklist'); ?></small></p>
					</div>
				</div>
				
				<div class="postbox">
					 <h3><?php _e('General Settings', 'geo-captcha-blacklist'); ?></h3>
					 <div class="inside">
						<p><?php _e('Use Geo Captcha for comments?', 'geo-captcha-blacklist'); ?></p>
						<?php if(1 == get_option("geo_capblack_comments")) :  ?>
							<p><label for="geo_capblack_comments_yes"><?php _e('Yes', 'geo-captcha-blacklist'); ?></label> <input type="radio" id="geo_capblack_comments_yes" name="geo_capblack_comments" value="1" checked="checked" /> 
							<label for="geo_capblack_comments_no"><?php _e('No', 'geo-captcha-blacklist'); ?></label> <input type="radio" id="geo_capblack_comments_no" name="geo_capblack_comments" value="0" /></p>
						<?php else : ?>	  
							<p><label for="geo_capblack_comments_yes"><?php _e('Yes', 'geo-captcha-blacklist'); ?></label> <input type="radio" id="geo_capblack_comments_yes" name="geo_capblack_comments" value="1" /> 
							<label for="geo_capblack_comments_no"><?php _e('No', 'geo-captcha-blacklist'); ?></label> <input type="radio" id="geo_capblack_comments_no" name="geo_capblack_comments" value="0" checked="checked" /></p>
						<?php endif; ?>
							
						<p><?php _e('Use Geo Captcha for registration?', 'geo-captcha-blacklist'); ?></p>
						<?php if(1 == get_option("geo_capblack_registration")) :  ?>
							<p><label for="geo_capblack_registration_yes"><?php _e('Yes', 'geo-captcha-blacklist'); ?></label> <input type="radio" id="captcha_registration_yes" name="geo_capblack_registration" value="1" checked="checked" /> 
							<label for="geo_capblack_registration_no"><?php _e('No', 'geo-captcha-blacklist'); ?></label> <input type="radio" id="geo_capblack_registration_no" name="geo_capblack_registration" value="0" /></p>
						<?php else : ?>	  
							<p><label for="geo_capblack_registration_yes"><?php _e('Yes', 'geo-captcha-blacklist'); ?></label> <input type="radio" id="geo_capblack_registration_yes" name="geo_capblack_registration" value="1" /> 
							<label for="geo_capblack_registration_no"><?php _e('No', 'geo-captcha-blacklist'); ?></label> <input type="radio" id="geo_capblack_registration_no" name="geo_capblack_registration" value="0" checked="checked" /></p>
						<?php endif; ?>
				  
						<p><?php _e('Log ips?', 'geo-captcha-blacklist'); ?></p>
						<?php if(1 == get_option("geo_capblack_log_ips")) :  ?>
							<p><label for="log_ips_yes"><?php _e('Yes', 'geo-captcha-blacklist'); ?></label> <input type="radio" id="log_ips_yes" name="geo_capblack_log_ips" value="1" checked="checked" /> 
							<label for="log_ips_no"><?php _e('No', 'geo-captcha-blacklist'); ?></label> <input type="radio" id="log_ips_no" name="geo_capblack_log_ips" value="0" />
						<?php else : ?>	  
							<p><label for="log_ips_yes"><?php _e('Yes', 'geo-captcha-blacklist'); ?></label> <input type="radio" id="log_ips_yes" name="geo_capblack_log_ips" value="1" /> 
							<label for="log_ips_no"><?php _e('No', 'geo-captcha-blacklist'); ?></label> <input type="radio" id="log_ips_no" name="geo_capblack_log_ips" value="0" checked="checked" />
						<?php endif; ?>
						<br />
						<small><?php _e('Please turn this setting to No if you are not allowed to log ips in your country!', 'geo-captcha-blacklist'); ?></small></p>
					</div>
				</div>
				  
				<input type="submit" class="button-primary" value="<?php _e('Save', 'geo-captcha-blacklist'); ?>" />
				<input name="action" value="changesettings" type="hidden" />
			</form>
		</div>
	</div>
	
<?php
}
?>