--- /Users/christo/Desktop/iedestroyer/iedestroyer.module	2007-01-16 01:44:46.000000000 -0500
+++ /Users/christo/Desktop/iedestroyer.module	2007-09-27 02:03:49.000000000 -0400
@@ -1,272 +1,276 @@
-<?php
-// $Id: iedestroyer.module,v 1.6 2007/01/16 06:44:46 deekayen Exp $
-
-/**
- * @file
- * Display a banner and/or block to convert Internet Explorer users to Firefox
- *
- * @author David Kent Norman
- * @link http://drupal.org/node/66987
- * @link http://deekayen.net/iedestroyer
- */
-
-// DEFAULTS
-define('IEDESTROYER_ENABLED', 0);
-define('IEDESTROYER_VISIBILITY', 0);
-
-/**
- * Implementation of hook_help().
- *
- * @return string
- */
-function iedestroyer_help($section) {
-  switch ($section) {
-    case 'admin/block/configure/iedestroyer/0':
-      return t('This block only displays when visitors are using Internet Explorer.');
-      break;
-  }
-}
-
-function iedestroyer_init() {
-  $path = drupal_get_path('module', 'iedestroyer');
-
-  if (variable_get('iedestroyer_enabled', IEDESTROYER_ENABLED) && _iedestroyer_should_display_page()) {
-    if (file_exists("$path/iedestroyer.js")) {
-      drupal_add_js("$path/iedestroyer.js");
-    }
-  }
-}
-
-function iedestroyer_menu($maycache) {
-  $items = array();
-  $items[] = array(
-    'path' => 'admin/settings/iedestroyer',
-    'title' => t('IE Destroyer'),
-    'description' => t('Change what type of banner displays.'),
-    'callback' => 'drupal_get_form',
-    'callback arguments' => 'iedestroyer_admin_settings',
-    'access' => user_access('administer site configuration'),
-    'type' => MENU_NORMAL_ITEM
-  );
-  return $items;
-}
-/**
- * Implementation of hook_block().
- */
-function iedestroyer_block($op = 'list', $delta = 0, $edit = array()) {
-  $edit = $_POST['edit'];
-  switch($op) {
-  case 'list':
-    $blocks[0]['info'] = 'IE Destroyer';
-    return $blocks;
-    break;
-
-  case 'configure':
-    $form['iedestroyer_block_firefoxbutton'] = array(
-      '#type' => 'textarea',
-      '#title' => t('Block content'),
-      '#default_value' => variable_get('iedestroyer_block_firefoxbutton', _iedestroyer_default_firefoxbutton()),
-      '#cols' => 70, '#rows' => 9,
-      '#required' => true,
-      '#default_value' => variable_get('iedestroyer_firefoxbutton', _iedestroyer_default_firefoxbutton()),
-      '#description' => t('Insert your Firefox referral HTML. You can earn referral income from Google through AdSense:<br />').
-'<script type="text/javascript"><!--
-google_ad_client = "pub-1105343943158891";
-google_ad_output = "textlink";
-google_ad_format = "ref_text";
-google_cpa_choice = "CAAQidTQgAIaCDFyD7PiBqtPKN2uuIEB";
-google_ad_channel = "7588513660";
-//--></script>
-<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
-</script>');
-    return $form;
-    break;
-
-  case 'save':
-    variable_set('iedestroyer_block_firefoxbutton', $edit['iedestroyer_block_firefoxbutton']);
-
-  case 'view':
-    if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'msie') !== FALSE) {
-      $block['subject'] = t('Download Firefox');
-      $block['content'] = variable_get('iedestroyer_block_firefoxbutton', _iedestroyer_default_firefoxbutton());
-      return $block;
-    }
-    break;
-  }
-}
-
-function iedestroyer_admin_settings() {
-  $form = array();
-
-  $form['iedestroyer_settings'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('IE Destroyer settings')
-  );
-  $form['iedestroyer_settings']['iedestroyer_enabled'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Enable IE Destroyer banner'),
-    '#default_value' => variable_get('iedestroyer_enabled', IEDESTROYER_ENABLED)
-  );
-  $form['iedestroyer_settings']['iedestroyer_die'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Stop output after Firefox banner'),
-    '#description' => t('Shows only the banner - normal output will not be shown'),
-    '#default_value' => variable_get('iedestroyer_die', 0)
-  );
-
-  $form['iedestroyer_adsense_settings'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Firefox referral link'),
-    '#collapsible' => true,
-    '#collapsed' => true
-  );
-  $form['iedestroyer_adsense_settings']['iedestroyer_firefoxbutton'] = array(
-    '#type' => 'textarea',
-    '#title' => t('Your Firefox referral button'),
-    '#cols' => 70, '#rows' => 9,
-    '#required' => true,
-    '#default_value' => variable_get('iedestroyer_firefoxbutton', _iedestroyer_default_firefoxbutton()),
-    '#description' => t('Insert your Firefox referral code. You can earn referral income from Google through AdSense:<br />').
-'<script type="text/javascript"><!--
-google_ad_client = "pub-1105343943158891";
-google_ad_output = "textlink";
-google_ad_format = "ref_text";
-google_cpa_choice = "CAAQidTQgAIaCDFyD7PiBqtPKN2uuIEB";
-google_ad_channel = "7588513660";
-//--></script>
-<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
-</script>');
-
-  $form['iedestroyer_page'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Specific page configuration'),
-    '#collapsible' => true,
-    '#collapsed' => true
-  );
-  $form['iedestroyer_page']['iedestroyer_visibility'] = array(
-    '#type' => 'radios',
-    '#title' => t('Show on specific pages'),
-    '#default_value' => variable_get('iedestroyer_visibility', IEDESTROYER_VISIBILITY),
-    '#options' => array(t('Show on every page except the listed pages.'),
-      t('Show on only the listed pages.'),
-      t('Show if the following PHP code returns TRUE (PHP-mode, experts only).'))
-  );
-  $form['iedestroyer_page']['iedestroyer_access_pages'] = array(
-    '#type' => 'textarea',
-    '#title' => t('Pages'),
-    '#cols' => 70, '#rows' => 5,
-    '#default_value' => variable_get('iedestroyer_access_pages', ''),
-    '#description' => t('Enter one page per line as Drupal paths.  The "*" character is a wildcard. Example paths are <em>blog</em> for every personal blog. "<em>&lt;front&gt;</em>" is the front page.')
-  );
-
-  $form['iedestroyer_output'] = array(
-    '#type' => 'textarea',
-    '#title' => t('Output HTML'),
-    '#cols' => 70, '#rows' => 20,
-    '#default_value' => variable_get('iedestroyer_output', _iedestroyer_default()),
-    '#description' => t('Only configure this script if you want to make changes to the displayed banner. Any occurence of [adsense_button] will be replaced with the referral button code from the Google AdSense settings section of this page.')
-  );
-  return system_settings_form($form);
-}
-
-function iedestroyer_banner() {
-  if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'msie') === FALSE) {
-    return;
-  }
-  if (_iedestroyer_should_display_page()) {
-    $output = _iedestroyer_default();
-
-    echo str_replace('[adsense_button]', variable_get('iedestroyer_firefoxbutton', _iedestroyer_default_firefoxbutton()), $output);
-    if (variable_get('iedestroyer_die', 0)) {
-      exit('</body></html>');
-    }
-
-  }
-}
-
-/**
- * This theme hook is here to provide some compatibility
- * with nonphptemplate themes.  Just in theory, though.
- */
-function theme_iedestroyer() {
-  iedestroyer_banner();
-}
-
-function _iedestroyer_should_display_page() {
-  $page_match = FALSE;
-  $visibility = (int)variable_get('iedestroyer_visibility', IEDESTROYER_VISIBILITY);
-  $pages = variable_get('iedestroyer_access_pages', '');
-
-  if (variable_get('iedestroyer_enabled', IEDESTROYER_ENABLED) == 0) {
-    return $page_match;
-  }
-
-  if ($pages) {
-    if ($visibility < 2) {
-      $path = drupal_get_path_alias($_GET['q']);
-      $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($pages, '/')) .')$/';
-      $page_match = !($visibility xor preg_match($regexp, $path));
-    }
-    else {
-      $page_match = drupal_eval($block->pages);
-    }
-  }
-  else {
-    if ($visibility === 0) {
-      $page_match = TRUE;
-    }
-  }
-
-  return $page_match;
-}
-
-function _iedestroyer_default() {
-
-return <<<EOT
-<div id="iedestroyer" style="display: block;">
-
-<br /><br />
-
-<div style="padding: 20px; background-color: #ffffbb; font-family: arial; font-size: 15px; font-weight: normal; color: #111111; line-height: 17px;">
-
-<div style="width: 630px; margin: 0 auto 0 auto; text-align: left">
-
-<div style="padding-left: 10px; padding-top: 0px; float: right;">
-
-[adsense_button]
-
-</div>
-
-<strong>We see you're using Internet Explorer, which is not compatible with this site. We strongly suggest downloading Firefox. We think you'll like it better:</strong>
-<ul>
-  <li>Firefox protects you from viruses, spyware, and pop-ups.</li>
-  <li>Enjoy improvements to performance, ease of use, and privacy.</li>
-  <li>Features like tabbed browsing make reading webpages easier.</li>
-  <li>Use Live Bookmarks that update themselves automatically with the latest content from the Web.</li>
-  <li>Automatic updates and faster browsing.</li>
-  <li>It's easy to import your favorites and settings.</li>
-</ul>
-
-Click the button on the right to download Firefox. <strong>It's free.</strong>
-<br /><br />
-<input type="button" onclick="hideIEdestroyer_banner()" value="Continue without Firefox &gt;&gt;" />
-
-<br /><br />
-
-</div></div></div>
-EOT;
-}
-
-function _iedestroyer_default_firefoxbutton() {
-
-return '<script type="text/javascript"><!--
-google_ad_client = "pub-1105343943158891";
-google_ad_width = 125;
-google_ad_height = 125;
-google_ad_format = "125x125_as_rimg";
-google_cpa_choice = "CAAQ_f-XhAIaCDgvi727fxoIKK2293M";
-google_ad_channel = "7588513660";
-//--></script>
-<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
-</script>';
+<?php
+// $Id: iedestroyer.module,v 1.6.2.2 2007/01/29 23:07:20 deekayen Exp $
+
+/**
+ * @file
+ * Display a banner and/or block to convert Internet Explorer users to Firefox
+ *
+ * @author David Kent Norman
+ * @link http://drupal.org/node/66987
+ * @link http://deekayen.net/iedestroyer
+ */
+
+// DEFAULTS
+define('IEDESTROYER_ENABLED', 0);
+define('IEDESTROYER_VISIBILITY', 0);
+
+/**
+ * Implementation of hook_help().
+ *
+ * @return string
+ */
+function iedestroyer_help($section) {
+  switch ($section) {
+    case 'admin/block/configure/iedestroyer/0':
+      return t('This block only displays when visitors are using Internet Explorer.');
+      break;
+  }
+}
+
+function iedestroyer_init() {
+  // common.inc doesn't load till a full bootstrap, whereas init is before that
+  require_once 'includes/common.inc';
+
+  $path = drupal_get_path('module', 'iedestroyer');
+
+  if (variable_get('iedestroyer_enabled', IEDESTROYER_ENABLED) && _iedestroyer_should_display_page()) {
+    if (file_exists("$path/iedestroyer.js")) {
+      drupal_add_js("$path/iedestroyer.js");
+    }
+  }
+}
+
+function iedestroyer_menu($maycache) {
+  $items = array();
+  $items[] = array(
+    'path' => 'admin/settings/iedestroyer',
+    'title' => t('IE Destroyer'),
+    'description' => t('Change what type of banner displays.'),
+    'callback' => 'drupal_get_form',
+    'callback arguments' => 'iedestroyer_admin_settings',
+    'access' => user_access('administer site configuration'),
+    'type' => MENU_NORMAL_ITEM
+  );
+  return $items;
+}
+/**
+ * Implementation of hook_block().
+ */
+function iedestroyer_block($op = 'list', $delta = 0, $edit = array()) {
+  $edit = $_POST['edit'];
+  switch($op) {
+  case 'list':
+    $blocks[0]['info'] = 'IE Destroyer';
+    return $blocks;
+    break;
+
+  case 'configure':
+    $form['iedestroyer_block_firefoxbutton'] = array(
+      '#type' => 'textarea',
+      '#title' => t('Block content'),
+      '#default_value' => variable_get('iedestroyer_block_firefoxbutton', _iedestroyer_default_firefoxbutton()),
+      '#cols' => 70, '#rows' => 9,
+      '#required' => true,
+      '#default_value' => variable_get('iedestroyer_firefoxbutton', _iedestroyer_default_firefoxbutton()),
+      '#description' => t('Insert your Firefox referral HTML. You can earn referral income from Google through AdSense:<br />').
+'<script type="text/javascript"><!--
+google_ad_client = "pub-1105343943158891";
+google_ad_output = "textlink";
+google_ad_format = "ref_text";
+google_cpa_choice = "CAAQidTQgAIaCDFyD7PiBqtPKN2uuIEB";
+google_ad_channel = "7588513660";
+//--></script>
+<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+</script>');
+    return $form;
+    break;
+
+  case 'save':
+    variable_set('iedestroyer_block_firefoxbutton', $edit['iedestroyer_block_firefoxbutton']);
+
+  case 'view':
+    if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'msie') !== FALSE) {
+      $block['subject'] = t('Download Firefox');
+      $block['content'] = variable_get('iedestroyer_block_firefoxbutton', _iedestroyer_default_firefoxbutton());
+      return $block;
+    }
+    break;
+  }
+}
+
+function iedestroyer_admin_settings() {
+  $form = array();
+
+  $form['iedestroyer_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('IE Destroyer settings')
+  );
+  $form['iedestroyer_settings']['iedestroyer_enabled'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable IE Destroyer banner'),
+    '#default_value' => variable_get('iedestroyer_enabled', IEDESTROYER_ENABLED)
+  );
+  $form['iedestroyer_settings']['iedestroyer_die'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Stop output after Firefox banner'),
+    '#description' => t('Shows only the banner - normal output will not be shown'),
+    '#default_value' => variable_get('iedestroyer_die', 0)
+  );
+
+  $form['iedestroyer_adsense_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Firefox referral link'),
+    '#collapsible' => true,
+    '#collapsed' => true
+  );
+  $form['iedestroyer_adsense_settings']['iedestroyer_firefoxbutton'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Your Firefox referral button'),
+    '#cols' => 70, '#rows' => 9,
+    '#required' => true,
+    '#default_value' => variable_get('iedestroyer_firefoxbutton', _iedestroyer_default_firefoxbutton()),
+    '#description' => t('Insert your Firefox referral code. You can earn referral income from Google through AdSense:<br />').
+'<script type="text/javascript"><!--
+google_ad_client = "pub-1105343943158891";
+google_ad_output = "textlink";
+google_ad_format = "ref_text";
+google_cpa_choice = "CAAQidTQgAIaCDFyD7PiBqtPKN2uuIEB";
+google_ad_channel = "7588513660";
+//--></script>
+<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+</script>');
+
+  $form['iedestroyer_page'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Specific page configuration'),
+    '#collapsible' => true,
+    '#collapsed' => true
+  );
+  $form['iedestroyer_page']['iedestroyer_visibility'] = array(
+    '#type' => 'radios',
+    '#title' => t('Show on specific pages'),
+    '#default_value' => variable_get('iedestroyer_visibility', IEDESTROYER_VISIBILITY),
+    '#options' => array(t('Show on every page except the listed pages.'),
+      t('Show on only the listed pages.'),
+      t('Show if the following PHP code returns TRUE (PHP-mode, experts only).'))
+  );
+  $form['iedestroyer_page']['iedestroyer_access_pages'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Pages'),
+    '#cols' => 70, '#rows' => 5,
+    '#default_value' => variable_get('iedestroyer_access_pages', ''),
+    '#description' => t('Enter one page per line as Drupal paths.  The "*" character is a wildcard. Example paths are <em>blog</em> for every personal blog. "<em>&lt;front&gt;</em>" is the front page.')
+  );
+
+  $form['iedestroyer_output'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Output HTML'),
+    '#cols' => 70, '#rows' => 20,
+    '#default_value' => variable_get('iedestroyer_output', _iedestroyer_default()),
+    '#description' => t('Only configure this script if you want to make changes to the displayed banner. Any occurence of [adsense_button] will be replaced with the referral button code from the Google AdSense settings section of this page.')
+  );
+  return system_settings_form($form);
+}
+
+function iedestroyer_banner() {
+  if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'msie') === FALSE) {
+    return;
+  }
+  if (_iedestroyer_should_display_page()) {
+
+		$output = variable_get('iedestroyer_output',_iedestroyer_default());
+
+    echo str_replace('[adsense_button]', variable_get('iedestroyer_firefoxbutton', _iedestroyer_default_firefoxbutton()), $output);
+    if (variable_get('iedestroyer_die', 0)) {
+      exit('</body></html>');
+    }
+
+  }
+}
+
+/**
+ * This theme hook is here to provide some compatibility
+ * with nonphptemplate themes.  Just in theory, though.
+ */
+function theme_iedestroyer() {
+  iedestroyer_banner();
+}
+
+function _iedestroyer_should_display_page() {
+  $page_match = FALSE;
+  $visibility = (int)variable_get('iedestroyer_visibility', IEDESTROYER_VISIBILITY);
+  $pages = variable_get('iedestroyer_access_pages', '');
+
+  if (variable_get('iedestroyer_enabled', IEDESTROYER_ENABLED) == 0) {
+    return $page_match;
+  }
+
+  if ($pages) {
+    if ($visibility < 2) {
+      $path = drupal_get_path_alias($_GET['q']);
+      $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($pages, '/')) .')$/';
+      $page_match = !($visibility xor preg_match($regexp, $path));
+    }
+    else {
+      $page_match = drupal_eval($block->pages);
+    }
+  }
+  else {
+    if ($visibility === 0) {
+      $page_match = TRUE;
+    }
+  }
+
+  return $page_match;
+}
+
+function _iedestroyer_default() {
+
+return <<<EOT
+<div id="iedestroyer" style="display: block;">
+
+<br /><br />
+
+<div style="padding: 20px; background-color: #ffffbb; font-family: arial; font-size: 15px; font-weight: normal; color: #111111; line-height: 17px;">
+
+<div style="width: 630px; margin: 0 auto 0 auto; text-align: left">
+
+<div style="padding-left: 10px; padding-top: 0px; float: right;">
+
+[adsense_button]
+
+</div>
+
+<strong>We see you're using Internet Explorer, which is not compatible with this site. Some pages on this site will organize wrongly. This is a problem created by Microsoft's Internet Explorer. We strongly suggest downloading and using Firefox instead. We think you'll like it better:</strong>
+<ul>
+  <li>Firefox protects you from viruses, spyware, and pop-ups.</li>
+  <li>Enjoy improvements to performance, ease of use, and privacy.</li>
+  <li>Features like tabbed browsing make reading webpages easier.</li>
+  <li>Use Live Bookmarks that update themselves automatically with the latest content from the Web.</li>
+  <li>Automatic updates and faster browsing.</li>
+  <li>It's easy to import your favorites and settings.</li>
+</ul>
+
+Click the button on the right to download Firefox. <strong>It's free.</strong>
+<br /><br />
+<input type="button" onclick="hideIEdestroyer_banner()" value="Continue without Firefox &gt;&gt;" />
+
+<br /><br />
+
+</div></div></div>
+EOT;
+}
+
+function _iedestroyer_default_firefoxbutton() {
+
+return '<script type="text/javascript"><!--
+google_ad_client = "pub-1105343943158891";
+google_ad_width = 125;
+google_ad_height = 125;
+google_ad_format = "125x125_as_rimg";
+google_cpa_choice = "CAAQ_f-XhAIaCDgvi727fxoIKK2293M";
+google_ad_channel = "7588513660";
+//--></script>
+<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+</script>';
 }
\ No newline at end of file
