[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/include/inc_module/mod_bad-behavior/bad-behavior/ -> admin.inc.php (source)

   1  <?php if (!defined('BB2_CORE')) die('I said no cheating!');
   2  /* This techncially belongs a level up, with the WordPress code. It'll be moved soon. */
   3  
   4  function bb2_admin_pages() {
   5      if (function_exists('current_user_can')) {
   6          // The new 2.x way
   7          if (current_user_can('manage_options')) {
   8              $bb2_is_admin = true;
   9          }
  10      } else {
  11          // The old 1.x way
  12          global $user_ID;
  13          if (user_can_edit_user($user_ID, 0)) {
  14              $bb2_is_admin = true;
  15          }
  16      }
  17  
  18      if ($bb2_is_admin) {
  19          add_options_page(__("Bad Behavior"), __("Bad Behavior"), 8, 'bb2_options', 'bb2_options');
  20      }
  21  }
  22  
  23  function bb2_options()
  24  {
  25      $settings = bb2_read_settings();
  26  
  27      if ($_POST) {
  28          if ($_POST['display_stats']) {
  29              $settings['display_stats'] = true;
  30          } else {
  31              $settings['display_stats'] = false;
  32          }
  33          if ($_POST['strict']) {
  34              $settings['strict'] = true;
  35          } else {
  36              $settings['strict'] = false;
  37          }
  38          if ($_POST['verbose']) {
  39              $settings['verbose'] = true;
  40          } else {
  41              $settings['verbose'] = false;
  42          }
  43          if ($_POST['logging']) {
  44              if ($_POST['logging'] == 'verbose') {
  45                  $settings['verbose'] = true;
  46                  $settings['logging'] = true;
  47              } else if ($_POST['logging'] == 'normal') {
  48                  $settings['verbose'] = false;
  49                  $settings['logging'] = true;
  50              } else {
  51                  $settings['verbose'] = false;
  52                  $settings['logging'] = false;
  53              }
  54          } else {
  55              $settings['verbose'] = false;
  56              $settings['logging'] = false;
  57          }
  58          bb2_write_settings($settings);
  59  ?>
  60      <div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div>
  61  <?php
  62      }
  63  ?>
  64      <div class="wrap">
  65      <h2><?php _e("Bad Behavior"); ?></h2>
  66      <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
  67      <p>For more information please visit the <a href="http://www.bad-behavior.ioerror.us/">Bad Behavior</a> homepage.</p>
  68      <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&currency_code=USD&bn=PP%2dDonationsBF&charset=UTF%2d8">financial contribution</a> to further development of Bad Behavior.</p>
  69  
  70      <fieldset class="options">
  71      <legend><?php _e('Statistics'); ?></legend>
  72      <?php bb2_insert_stats(true); ?>
  73      <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>
  74      </fieldset>
  75  
  76      <fieldset class="options">
  77      <legend><?php _e('Logging'); ?></legend>
  78      <p><label><input type="radio" name="logging" value="verbose" <?php if ($settings['verbose'] && $settings['logging']) { ?>checked="checked" <?php } ?>/> <?php _e('Verbose HTTP request logging'); ?></label></p>
  79      <p><label><input type="radio" name="logging" value="normal" <?php if ($settings['logging'] && !$settings['verbose']) { ?>checked="checked" <?php } ?>/> <?php _e('Normal HTTP request logging (recommended)'); ?></label></p>
  80      <p><label><input type="radio" name="logging" value="false" <?php if (!$settings['logging']) { ?>checked="checked" <?php } ?>/> <?php _e('Do not log HTTP requests (not recommended)'); ?></label></p>
  81      </fieldset>
  82  
  83      <fieldset class="options">
  84      <legend><?php _e('Strict Mode'); ?></legend>
  85      <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>
  86      </fieldset>
  87  
  88      <p class="submit"><input type="submit" name="submit" value="<?php _e('Update &raquo;'); ?>" /></p>
  89      </form>
  90      </div>
  91  <?php
  92  }
  93  
  94  add_action('admin_menu', 'bb2_admin_pages');
  95  
  96  ?>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7