1<?php if (!defined('BB2_CORE')) die('I said no cheating!'); 2 3function bb2_admin_pages() { 4 if (function_exists('current_user_can')) { 5 // The new 2.x way 6 if (current_user_can('manage_options')) { 7 $bb2_is_admin = true; 8 } 9 } else { 10 // The old 1.x way 11 global $user_ID; 12 if (user_can_edit_user($user_ID, 0)) { 13 $bb2_is_admin = true; 14 } 15 } 16 17 if ($bb2_is_admin) { 18 add_options_page(__("Bad Behavior"), __("Bad Behavior"), 8, 'bb2_options', 'bb2_options'); 19 } 20} 21 22function bb2_options() 23{ 24 $settings = bb2_read_settings(); 25 26 if ($_POST) { 27 if ($_POST['display_stats']) { 28 $settings['display_stats'] = true; 29 } else { 30 $settings['display_stats'] = false; 31 } 32 if ($_POST['strict']) { 33 $settings['strict'] = true; 34 } else { 35 $settings['strict'] = false; 36 } 37 if ($_POST['verbose']) { 38 $settings['verbose'] = true; 39 } else { 40 $settings['verbose'] = false; 41 } 42 bb2_write_settings($settings); 43?> 44 <div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div> 45<?php 46 } 47?> 48 <div class="wrap"> 49 <h2><?php _e("Bad Behavior"); ?></h2> 50 <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> 51 <p>For more information please visit the <a href="http://www.bad-behavior.ioerror.us/">Bad Behavior</a> homepage.</p> 52 <p>If you find Bad Behavior valuable, please consider making a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=error%40ioerror%2eus&item_name=Bad%20Behavior%20<?php echo BB2_VERSION; ?>%20%28From%20Admin%29&no_shipping=1&cn=Comments%20about%20Bad%20Behavior&tax=0¤cy_code=USD&bn=PP%2dDonationsBF&charset=UTF%2d8">financial contribution</a> to further development of Bad Behavior.</p> 53 54 <fieldset class="options"> 55 <legend><?php _e('Statistics'); ?></legend> 56 <?php bb2_insert_stats(true); ?> 57 <p><label><input type="checkbox" name="display_stats" value="true" <?php if ($settings['display_stats']) { ?>checked="checked" <?php } ?>/> <?php _e('Display statistics in blog footer'); ?></label></p> 58 </fieldset> 59 60 <fieldset class="options"> 61 <legend><?php _e('Logging'); ?></legend> 62 <p><label><input type="checkbox" name="verbose" value="true" <?php if ($settings['verbose']) { ?>checked="checked" <?php } ?>/> <?php _e('Verbose HTTP request logging'); ?></label></p> 63 <legend><?php _e('Strict Mode'); ?></legend> 64 <p><label><input type="checkbox" name="strict" value="true" <?php if ($settings['strict']) { ?>checked="checked" <?php } ?>/> <?php _e('Strict checking (blocks more spam but may block some people)'); ?></label></p> 65 </fieldset> 66 67 <p class="submit"><input type="submit" name="submit" value="<?php _e('Update »'); ?>" /></p> 68 </form> 69 </div> 70<?php 71} 72 73add_action('admin_menu', 'bb2_admin_pages'); 74 75?> 76