Index: adsense.admin.inc
===================================================================
RCS file: adsense.admin.inc
diff -N adsense.admin.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ adsense.admin.inc	4 Apr 2008 07:41:17 -0000
@@ -0,0 +1,841 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Administrative page callbacks for the adsense module.
+ */
+
+function adsense_admin_settings(&$form_stste) {
+  // force a display of errors, if any
+  $module = variable_get(ADSENSE_ID_MODULE, 'adsense_basic');
+  $function = $module .'_adsense';
+  if (function_exists($function)) {
+    $error = $function('status');
+  }
+
+  $form = array();
+  cache_clear_all('adsense', 'cache', TRUE);
+
+  // We only load the help text if we are in settings, to save memory
+  $module = 'adsense';
+  include_once(drupal_get_path('module', $module) .'/'. $module .'_help.inc');
+
+  $form['help'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#title' => t('Help and instructions'),
+  );
+
+  $help_function = $module .'_help_text';
+  $form['help']['help'] = array(
+    '#type' => 'markup',
+    '#value' => $help_function(),
+  );
+
+  $form['required'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+    '#title' => t('Required parameters'),
+  );
+
+  foreach (module_implements('adsense') as $key => $val) {
+    $list[$val] = $val .' '. l(t('(Settings)'), 'admin/settings/adsense/'. $val);
+  }
+
+  $form['required'][ADSENSE_ID_MODULE] = array(
+    '#type' => 'radios',
+    '#title' => t('Adsense Client ID selection modules'),
+    '#default_value' => variable_get(ADSENSE_ID_MODULE, 'adsense_basic'),
+    '#options' => $list,
+    '#description' => t('This provides a list of modules that are able to select a valid Adsense Client ID. You have to chose one module that selects the Adsense ID for each page view. Only one module can be selected. You can write your own module that selects the ID based on criteria you chose.'),
+  );
+
+  $client = adsense_get_client_id();
+  if (!$client) {
+    adsense_error(ADSENSE_ERROR_NOT_CONFIGURED);
+    return system_settings_form($form);
+  }
+
+  $form['types_colors'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#title' => t('Ad groups'),
+  );
+
+  for ($group=1; $group<ADSENSE_MAX_GROUPS+1; $group++) {
+
+    $form['types_colors']['groups'][$group] = array(
+      '#type' => 'fieldset',
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+      '#title' => t('Group @group attributes', array('@group' => $group)),
+    );
+
+    $form['types_colors']['groups'][$group][ADSENSE_AD_TYPE . $group] = array(
+      '#type' => 'radios',
+      '#title' => t('Ad type'),
+      '#default_value' => variable_get(ADSENSE_AD_TYPE . $group, '000000'),
+      '#options' => array(t('Text'), t('Image'), t('Both')),
+    );
+
+    $form['types_colors']['groups'][$group][ADSENSE_COLOR_TEXT . $group] = array(
+      '#type' => 'textfield',
+      '#title' => t('Ad text color'),
+      '#default_value' => variable_get(ADSENSE_COLOR_TEXT . $group, '000000'),
+      '#size' => 6,
+      '#maxlength' => 6,
+    );
+
+    $form['types_colors']['groups'][$group][ADSENSE_COLOR_BORDER . $group] = array(
+      '#type' => 'textfield',
+      '#title' => t('Ad border color'),
+      '#default_value' => variable_get(ADSENSE_COLOR_BORDER . $group, '336699'),
+      '#size' => 6,
+      '#maxlength' => 6,
+    );
+
+    $form['types_colors']['groups'][$group][ADSENSE_COLOR_BG . $group] = array(
+      '#type' => 'textfield',
+      '#title' => t('Ad background color'),
+      '#default_value' => variable_get(ADSENSE_COLOR_BG . $group, 'FFFFFF'),
+      '#size' => 6,
+      '#maxlength' => 6,
+    );
+
+    $form['types_colors']['groups'][$group][ADSENSE_COLOR_LINK . $group] = array(
+      '#type' => 'textfield',
+      '#title' => t('Ad title color'),
+      '#default_value' => variable_get(ADSENSE_COLOR_LINK . $group, '336699'),
+      '#size' => 6,
+      '#maxlength' => 6,
+    );
+
+    $form['types_colors']['groups'][$group][ADSENSE_COLOR_URL . $group] = array(
+      '#type' => 'textfield',
+      '#title' => t('Ad URL color'),
+      '#default_value' => variable_get(ADSENSE_COLOR_URL . $group, 'FF8C00'),
+      '#size' => 6,
+      '#maxlength' => 6,
+    );
+
+    $form['types_colors']['groups'][$group][ADSENSE_ALT . $group] = array(
+      '#type' => 'select',
+      '#title' => t('Alternate URL color'),
+      '#default_value' => variable_get(ADSENSE_ALT . $group, 0),
+      '#options' => array(t('None'), t('Alternate URL'), t('Alternate color')),
+    );
+
+    $form['types_colors']['groups'][$group][ADSENSE_ALT_INFO . $group] = array(
+      '#type' => 'textfield',
+      '#title' => t('Alternate info'),
+      '#default_value' => variable_get(ADSENSE_ALT_INFO . $group, ''),
+      '#size' => 100,
+      '#maxlength' => 100,
+      '#description' => t('Enter either 6 letter alternate color code, or alternate URL to use'),
+    );
+  }
+
+  $form['types_colors']['search'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#title' => t('AdSense for Search attributes'),
+  );
+
+  $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_TEXT] = array(
+    '#type' => 'textfield',
+    '#title' => t('Text color'),
+    '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_TEXT, '000000'),
+    '#size' => 6,
+    '#maxlength' => 6
+  );
+
+  $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_BORDER] = array(
+    '#type' => 'textfield',
+    '#title' => t('Border color'),
+    '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_BORDER, '336699'),
+    '#size' => 6,
+    '#maxlength' => 6
+  );
+
+  $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_BG] = array(
+    '#type' => 'textfield',
+    '#title' => t('Background color'),
+    '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_BG, 'FFFFFF'),
+    '#size' => 6,
+    '#maxlength' => 6
+  );
+
+  $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_TITLE] = array(
+    '#type' => 'textfield',
+    '#title' => t('Title color'),
+    '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_TITLE, '0000FF'),
+    '#size' => 6,
+    '#maxlength' => 6
+  );
+
+  $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_URL] = array(
+    '#type' => 'textfield',
+    '#title' => t('URL color'),
+    '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_URL, '008000'),
+    '#size' => 6,
+    '#maxlength' => 6
+  );
+
+  $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_VISITED_URL] = array(
+    '#type' => 'textfield',
+    '#title' => t('Visited URL color'),
+    '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_VISITED_URL, '663399'),
+    '#size' => 6,
+    '#maxlength' => 6
+  );
+
+  $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_LIGHT_URL] = array(
+    '#type' => 'textfield',
+    '#title' => t('Light URL color'),
+    '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_LIGHT_URL, '0000FF'),
+    '#size' => 6,
+    '#maxlength' => 6
+  );
+
+  $form['channels'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#title' => t('Custom channels'),
+    '#description' => t('Enter up to !channels custom channels that you have configured in Google AdSense. If you are not using custom channels, or you are only using URL channels, then leave this empty.', array('!channels' => ADSENSE_MAX_CHANNELS)),
+  );
+
+  for ($channel=1; $channel<ADSENSE_MAX_CHANNELS+1; $channel++) {
+    $form['channels'][ADSENSE_AD_CHANNEL . $channel] = array(
+      '#type' => 'textfield',
+      '#title' => t('Custom channel ID ') . $channel,
+      '#default_value' => variable_get(ADSENSE_AD_CHANNEL . $channel, ''),
+      '#size' => 30,
+      '#maxlength' => 30,
+    );
+  }
+
+  $form['visibility'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#title' => t('Visibility'),
+  );
+
+  $form['visibility']['adsense_visibility'] = array(
+    '#type' => 'radios',
+    '#title' => t('Show AdSense on specific pages'),
+    '#default_value' => variable_get(ADSENSE_VISIBILITY, 0),
+    '#options' => array(t('Show on every page except the listed pages.'),
+      t('Show on only the listed pages.')),
+  );
+
+  $form['visibility']['adsense_access_pages'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Pages'),
+    '#default_value' => variable_get(ADSENSE_ACCESS_PAGES, ''),
+    '#cols' => 70,
+    '#rows' => 5,
+    '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are '<em>blog</em>' for the blog page and '<em>blog/*</em>' for every personal blog. '<em>&lt;front&gt;</em>' is the front page."),
+  );
+
+  $form['click_tracking'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#title' => t('Click tracking'),
+  );
+
+  $form['click_tracking'][ADSENSE_CLICK_TRACKING] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable AdSense click tracking?'),
+    '#return_value' => 1,
+    '#default_value' => variable_get(ADSENSE_CLICK_TRACKING, 0),
+    '#description' => t('Logs IP and time of <a href=!url>AdSense clicks</a>. This can be very useful in tracking which of your pages generate the most clicks, as well as help if click fraud is suspected.', array('!url' => url('admin/reports/adsense'))),
+  );
+
+  $form['click_tracking'][ADSENSE_CLICK_TRACKING_NAME_RESOLVE] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable name resolution of IP addresses?'),
+    '#return_value' => 1,
+    '#default_value' => variable_get(ADSENSE_CLICK_TRACKING_NAME_RESOLVE, 0),
+    '#description' => t('Display the domain name instead of the IP address. This can slow down the display of the logs page and tie up a PHP process for several seconds. On some hosting providers it may not be available.'),
+  );
+
+  $form['search'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#title' => t('AdSense Search')
+  );
+
+  $form['search']['box'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+    '#title' => t('Search Box Options'),
+    '#description' => t('Allows users to search the web or the specific site(s) of your choice. Enter the site\'s URL without the last \'/\''),
+  );
+
+  global $base_url;
+  $form['search']['box'][ADSENSE_SEARCH_DOMAIN .'_0'] = array(
+    '#type' => 'textfield',
+    '#field_prefix' => 'http://',
+    '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN .'_0'), str_replace('http://', '', $base_url)),
+    '#size' => 32,
+    '#maxlength' => 255
+  );
+
+  $form['search']['box'][ADSENSE_SEARCH_DOMAIN .'_1'] = array(
+    '#type' => 'textfield',
+    '#field_prefix' => 'http://',
+    '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN .'_1'), ''),
+    '#size' => 32,
+    '#maxlength' => 255
+  );
+
+  $form['search']['box'][ADSENSE_SEARCH_DOMAIN .'_2'] = array(
+    '#type' => 'textfield',
+    '#field_prefix' => 'http://',
+    '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN .'_2'), ''),
+    '#size' => 32,
+    '#maxlength' => 255
+  );
+
+  $form['search']['box'][ADSENSE_SEARCH_LOGO] = array(
+    '#type' => 'radios',
+    '#title' => t('Logo Type'),
+    '#default_value' => variable_get(ADSENSE_SEARCH_LOGO, ADSENSE_SEARCH_LOGO_GOOGLE),
+    '#options' => array(
+      ADSENSE_SEARCH_LOGO_GOOGLE        => t('Google Logo'),
+      ADSENSE_SEARCH_LOGO_ABOVE_TEXTBOX => t('Logo above text box'),
+      ADSENSE_SEARCH_LOGO_ON_BUTTON     => t('"Google Search" on button'),
+    )
+  );
+
+  $form['search']['box'][ADSENSE_SEARCH_BUTTON] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Search button below text box'),
+    '#return_value' => 1,
+    '#default_value' => variable_get(ADSENSE_SEARCH_BUTTON, 0)
+  );
+
+  $box_background_color = variable_get(ADSENSE_SEARCH_COLOR_BOX_BACKGROUND, ADSENSE_SEARCH_COLOR_WHITE);
+  $form['search']['box'][ADSENSE_SEARCH_COLOR_BOX_BACKGROUND] = array(
+    '#type' => 'select',
+    '#title' => t('Background Color'),
+    '#default_value' => $box_background_color,
+    '#options' => array(
+      ADSENSE_SEARCH_COLOR_WHITE => t('White'),
+      ADSENSE_SEARCH_COLOR_BLACK => t('Black'),
+      ADSENSE_SEARCH_COLOR_GRAY  => t('Gray'),
+    )
+  );
+
+  $box_text_color = variable_get(ADSENSE_SEARCH_COLOR_BOX_TEXT, ADSENSE_SEARCH_COLOR_BLACK);
+  if ($box_background_color == ADSENSE_SEARCH_COLOR_BLACK) {
+    $box_text_color = ADSENSE_SEARCH_COLOR_WHITE;
+  }
+  elseif ($box_background_color == ADSENSE_SEARCH_COLOR_WHITE) {
+    $box_text_color = ADSENSE_SEARCH_COLOR_BLACK;
+  }
+
+  $form['search']['box'][ADSENSE_SEARCH_COLOR_BOX_TEXT] = array(
+    '#type' => 'select',
+    '#title' => t('Text Color'),
+    '#default_value' => $box_text_color,
+    '#options' => array(
+      ADSENSE_SEARCH_COLOR_BLACK => t('Black'),
+      ADSENSE_SEARCH_COLOR_WHITE => t('White')
+    )
+  );
+
+  $form['search']['result'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+    '#title' => t('Search Results Style')
+  );
+
+  $form['search']['result'][ADSENSE_SEARCH_COUNTRY] = array(
+    '#type' => 'select',
+    '#title' => t('Country or territory for Google domain'),
+    '#default_value' => variable_get(ADSENSE_SEARCH_COUNTRY, 'www.google.com'),
+    '#options' => array(
+      'www.google.co.uk'  => t('United Kingdom'),
+      'www.google.ca'     => t('Canada'),
+      'www.google.de'     => t('Germany'),
+      'www.google.co.jp'  => t('Japan'),
+      'www.google.fr'     => t('France'),
+      'www.google.com.au' => t('Australia'),
+      'www.google.it'     => t('Italy'),
+      'www.google.at'     => t('Austria'),
+      'www.google.ch'     => t('Switzerland'),
+      'www.google.es'     => t('Spain'),
+      'www.google.nl'     => t('Netherlands'),
+      'www.google.be'     => t('Belgium'),
+      'www.google.dk'     => t('Denmark'),
+      'www.google.se'     => t('Sweden'),
+      'www.google.no'     => t('Norway'),
+      'www.google.com.br' => t('Brazil'),
+      'www.google.pt'     => t('Portugal'),
+      'www.google.fi'     => t('Finland'),
+      'www.google.co.kr'  => t('South Korea'),
+      'www.google.cn'     => t('China'),
+      'www.google.com.hk' => t('Hong Kong'),
+      'www.google.com.tw' => t('Taiwan'),
+      'www.google.com.sg' => t('Singapore'),
+      'www.google.com.af' => t('Afghanistan'),
+      'www.google.com'    => t('Albania'),
+      'www.google.com'    => t('Algeria'),
+      'www.google.as'     => t('American Samoa'),
+      'www.google.com'    => t('Andorra'),
+      'www.google.com'    => t('Angola'),
+      'www.google.off.ai' => t('Anguilla'),
+      'www.google.com'    => t('Antarctica'),
+      'www.google.com.ag' => t('Antigua and Barbuda'),
+      'www.google.com.ar' => t('Argentina'),
+      'www.google.am'     => t('Armenia'),
+      'www.google.com'    => t('Aruba'),
+      'www.google.az'     => t('Azerbaijan'),
+      'www.google.bs'     => t('Bahamas'),
+      'www.google.com.bh' => t('Bahrain'),
+      'www.google.com.bd' => t('Bangladesh'),
+      'www.google.com'    => t('Barbados'),
+      'www.google.com'    => t('Belarus'),
+      'www.google.com.bz' => t('Belize'),
+      'www.google.com'    => t('Benin'),
+      'www.google.com'    => t('Bermuda'),
+      'www.google.com'    => t('Bhutan'),
+      'www.google.com.bo' => t('Bolivia'),
+      'www.google.ba'     => t('Bosnia and Herzegovina'),
+      'www.google.co.bw'  => t('Botswana'),
+      'www.google.com'    => t('Bouvet Island'),
+      'www.google.com'    => t('British Indian Ocean Territory'),
+      'www.google.com.bn' => t('Brunei Darussalam'),
+      'www.google.bg'     => t('Bulgaria'),
+      'www.google.com'    => t('Burkina Faso'),
+      'www.google.bi'     => t('Burundi'),
+      'www.google.com.kh' => t('Cambodia'),
+      'www.google.com'    => t('Cameroon'),
+      'www.google.com'    => t('Cape Verde'),
+      'www.google.com'    => t('Cayman Islands'),
+      'www.google.com'    => t('Central African Republic'),
+      'www.google.com'    => t('Chad'),
+      'www.google.cl'     => t('Chile'),
+      'www.google.com'    => t('Christmas Island'),
+      'www.google.com'    => t('Cocos (Keeling) Islands'),
+      'www.google.com.co' => t('Colombia'),
+      'www.google.com'    => t('Comoros'),
+      'www.google.cg'     => t('Congo'),
+      'www.google.cd'     => t('Congo, Democratic Republic'),
+      'www.google.co.ck'  => t('Cook Islands'),
+      'www.google.co.cr'  => t('Costa Rica'),
+      'www.google.ci'     => t('Cote d&#39;Ivoire'),
+      'www.google.hr'     => t('Croatia'),
+      'www.google.com.cu' => t('Cuba'),
+      'www.google.com'    => t('Cyprus'),
+      'www.google.cz'     => t('Czech Republic'),
+      'www.google.dj'     => t('Djibouti'),
+      'www.google.dm'     => t('Dominica'),
+      'www.google.com.do' => t('Dominican Republic'),
+      'www.google.tp'     => t('East Timor'),
+      'www.google.com.ec' => t('Ecuador'),
+      'www.google.com.eg' => t('Egypt'),
+      'www.google.com.sv' => t('El Salvador'),
+      'www.google.com'    => t('Equatorial Guinea'),
+      'www.google.com'    => t('Eritrea'),
+      'www.google.ee'     => t('Estonia'),
+      'www.google.com.et' => t('Ethiopia'),
+      'www.google.com'    => t('Falkland Islands (Malvinas)'),
+      'www.google.com'    => t('Faroe Islands'),
+      'www.google.com.fj' => t('Fiji'),
+      'www.google.com'    => t('French Guiana'),
+      'www.google.com'    => t('French Polynesia'),
+      'www.google.com'    => t('French Southern Territories'),
+      'www.google.com'    => t('Gabon'),
+      'www.google.gm'     => t('Gambia'),
+      'www.google.ge'     => t('Georgia'),
+      'www.google.com'    => t('Ghana'),
+      'www.google.com.gi' => t('Gibraltar'),
+      'www.google.gr'     => t('Greece'),
+      'www.google.gl'     => t('Greenland'),
+      'www.google.com'    => t('Grenada'),
+      'www.google.gp'     => t('Guadeloupe'),
+      'www.google.com'    => t('Guam'),
+      'www.google.com.gt' => t('Guatemala'),
+      'www.google.com'    => t('Guinea'),
+      'www.google.com'    => t('Guinea-Bissau'),
+      'www.google.gy'     => t('Guyana'),
+      'www.google.ht'     => t('Haiti'),
+      'www.google.com'    => t('Heard and McDonald Islands'),
+      'www.google.hn'     => t('Honduras'),
+      'www.google.hu'     => t('Hungary'),
+      'www.google.is'     => t('Iceland'),
+      'www.google.co.in'  => t('India'),
+      'www.google.co.id'  => t('Indonesia'),
+      'www.google.com'    => t('Iran'),
+      'www.google.com'    => t('Iraq'),
+      'www.google.ie'     => t('Ireland'),
+      'www.google.co.il'  => t('Israel'),
+      'www.google.com.jm' => t('Jamaica'),
+      'www.google.jo'     => t('Jordan'),
+      'www.google.kz'     => t('Kazakhstan'),
+      'www.google.co.ke'  => t('Kenya'),
+      'www.google.ki'     => t('Kiribati'),
+      'www.google.com'    => t('Kuwait'),
+      'www.google.kg'     => t('Kyrgyzstan'),
+      'www.google.la'     => t('Lao People&#39;s Democratic Republic'),
+      'www.google.lv'     => t('Latvia'),
+      'www.google.com'    => t('Lebanon'),
+      'www.google.co.ls'  => t('Lesotho'),
+      'www.google.com'    => t('Liberia'),
+      'www.google.com.ly' => t('Libya'),
+      'www.google.li'     => t('Liechtenstein'),
+      'www.google.lt'     => t('Lithuania'),
+      'www.google.lu'     => t('Luxembourg'),
+      'www.google.com'    => t('Macau'),
+      'www.google.com'    => t('Macedonia'),
+      'www.google.com'    => t('Madagascar'),
+      'www.google.mw'     => t('Malawi'),
+      'www.google.com.my' => t('Malaysia'),
+      'www.google.mv'     => t('Maldives'),
+      'www.google.com'    => t('Mali'),
+      'www.google.com.mt' => t('Malta'),
+      'www.google.com'    => t('Marshall Islands'),
+      'www.google.com'    => t('Martinique'),
+      'www.google.com'    => t('Mauritania'),
+      'www.google.mu'     => t('Mauritius'),
+      'www.google.com'    => t('Mayotte'),
+      'www.google.com.mx' => t('Mexico'),
+      'www.google.fm'     => t('Micronesia'),
+      'www.google.md'     => t('Moldova'),
+      'www.google.com'    => t('Monaco'),
+      'www.google.mn'     => t('Mongolia'),
+      'www.google.ms'     => t('Montserrat'),
+      'www.google.co.ma'  => t('Morocco'),
+      'www.google.com'    => t('Mozambique'),
+      'www.google.com'    => t('Myanmar'),
+      'www.google.com.na' => t('Namibia'),
+      'www.google.nr'     => t('Nauru'),
+      'www.google.com.np' => t('Nepal'),
+      'www.google.com'    => t('Netherlands Antilles'),
+      'www.google.com'    => t('New Caledonia'),
+      'www.google.co.nz'  => t('New Zealand'),
+      'www.google.com.ni' => t('Nicaragua'),
+      'www.google.com'    => t('Niger'),
+      'www.google.com.ng' => t('Nigeria'),
+      'www.google.nu'     => t('Niue'),
+      'www.google.com.nf' => t('Norfolk Island'),
+      'www.google.com'    => t('Northern Mariana Islands'),
+      'www.google.com'    => t('North Korea'),
+      'www.google.com.om' => t('Oman'),
+      'www.google.com.pk' => t('Pakistan'),
+      'www.google.com'    => t('Palau'),
+      'www.google.com'    => t('Palestinian Territory'),
+      'www.google.com.pa' => t('Panama'),
+      'www.google.com'    => t('Papua New Guinea'),
+      'www.google.com.py' => t('Paraguay'),
+      'www.google.com.pe' => t('Peru'),
+      'www.google.com.ph' => t('Philippines'),
+      'www.google.pn'     => t('Pitcairn'),
+      'www.google.pl'     => t('Poland'),
+      'www.google.com.pr' => t('Puerto Rico'),
+      'www.google.com.qa' => t('Qatar'),
+      'www.google.com'    => t('Reunion'),
+      'www.google.ro'     => t('Romania'),
+      'www.google.ru'     => t('Russian Federation'),
+      'www.google.rw'     => t('Rwanda'),
+      'www.google.com'    => t('Saint Kitts and Nevis'),
+      'www.google.com'    => t('Saint Lucia'),
+      'www.google.com.vc' => t('Saint Vincent and the Grenadines'),
+      'www.google.ws'     => t('Samoa'),
+      'www.google.sm'     => t('San Marino'),
+      'www.google.st'     => t('Sao Tome and Principe'),
+      'www.google.com.sa' => t('Saudi Arabia'),
+      'www.google.sn'     => t('Senegal'),
+      'www.google.com'    => t('Serbia and Montenegro'),
+      'www.google.sc'     => t('Seychelles'),
+      'www.google.com'    => t('Sierra Leone'),
+      'www.google.sk'     => t('Slovakia'),
+      'www.google.si'     => t('Slovenia'),
+      'www.google.com.sb' => t('Solomon Islands'),
+      'www.google.com'    => t('Somalia'),
+      'www.google.co.za'  => t('South Africa'),
+      'www.google.com'    => t('South Georgia and The South Sandwich Islands'),
+      'www.google.lk'     => t('Sri Lanka'),
+      'www.google.sh'     => t('St. Helena'),
+      'www.google.com'    => t('St. Pierre and Miquelon'),
+      'www.google.com'    => t('Sudan'),
+      'www.google.com'    => t('Suriname'),
+      'www.google.com'    => t('Svalbard and Jan Mayen Islands'),
+      'www.google.com'    => t('Swaziland'),
+      'www.google.com'    => t('Syria'),
+      'www.google.com.tj' => t('Tajikistan'),
+      'www.google.com'    => t('Tanzania'),
+      'www.google.co.th'  => t('Thailand'),
+      'www.google.com'    => t('Togo'),
+      'www.google.tk'     => t('Tokelau'),
+      'www.google.to'     => t('Tonga'),
+      'www.google.tt'     => t('Trinidad and Tobago'),
+      'www.google.com'    => t('Tunisia'),
+      'www.google.com.tr' => t('Turkey'),
+      'www.google.tm'     => t('Turkmenistan'),
+      'www.google.com'    => t('Turks and Caicos Islands'),
+      'www.google.com'    => t('Tuvalu'),
+      'www.google.co.ug'  => t('Uganda'),
+      'www.google.com.ua' => t('Ukraine'),
+      'www.google.ae'     => t('United Arab Emirates'),
+      'www.google.com'    => t('United States Minor Outlying Islands'),
+      'www.google.com.uy' => t('Uruguay'),
+      'www.google.co.uz'  => t('Uzbekistan'),
+      'www.google.vu'     => t('Vanuatu'),
+      'www.google.com'    => t('Vatican'),
+      'www.google.co.ve'  => t('Venezuela'),
+      'www.google.com.vn' => t('Viet Nam'),
+      'www.google.vg'     => t('Virgin Islands (British)'),
+      'www.google.co.vi'  => t('Virgin Islands (U.S.)'),
+      'www.google.com'    => t('Wallis and Futuna Islands'),
+      'www.google.com'    => t('Western Sahara'),
+      'www.google.com'    => t('Yemen'),
+      'www.google.co.zm'  => t('Zambia'),
+      'www.google.co.zw'  => t('Zimbabwe'),
+      'www.google.com'    => t('United States'),
+    )
+  );
+
+  $form['search']['box'][ADSENSE_SEARCH_LANGUAGE] = array(
+    '#type' => 'select',
+    '#title' => t('Site Language'),
+    '#default_value' => variable_get(ADSENSE_SEARCH_LANGUAGE, 'en'),
+    '#options' => array(
+      'ar'    => t('Arabic'),
+      'bg'    => t('Bulgarian'),
+      'zh-CN' => t('Chinese (simplified)'),
+      'zh-TW' => t('Chinese (traditional)'),
+      'hr'    => t('Croatian'),
+      'cs'    => t('Czech'),
+      'da'    => t('Danish'),
+      'nl'    => t('Dutch'),
+      'en'    => t('English'),
+      'fi'    => t('Finnish'),
+      'fr'    => t('French'),
+      'de'    => t('German'),
+      'el'    => t('Greek'),
+      'iw'    => t('Hebrew'),
+      'hu'    => t('Hungarian'),
+      'in'    => t('Indonesian'),
+      'it'    => t('Italian'),
+      'ja'    => t('Japanese'),
+      'ko'    => t('Korean'),
+      'no'    => t('Norwegian'),
+      'pl'    => t('Polish'),
+      'pt'    => t('Portuguese'),
+      'ro'    => t('Romanian'),
+      'ru'    => t('Russian'),
+      'sk'    => t('Slovak'),
+      'es'    => t('Spanish'),
+      'sv'    => t('Swedish'),
+      'tr'    => t('Turkish')
+    )
+  );
+
+  $form['search']['box'][ADSENSE_SEARCH_ENCODING] = array(
+    '#type' => 'select',
+    '#title' => t('Site Encoding'),
+    '#default_value' => variable_get(ADSENSE_SEARCH_ENCODING, 'UTF-8'),
+    '#options' => array(
+      'ISO-8859-1'   =>  t('West European Latin-1 (ISO-8859-1)'),
+      'ISO-8859-15'  =>  t('West European Latin-9 (ISO-8859-15)'),
+      'windows-1252' =>  t('Western (Windows-1252)'),
+      'ISO-8859-10'  =>  t('Nordic Latin-6 (ISO-8859-10)'),
+      'ISO-8859-7'   =>  t('Greek (ISO-8859-7)'),
+      'Shift_JIS'    =>  t('Japanese (Shift_JIS)'),
+      'EUC-JP'       =>  t('Japanese (EUC-JP)'),
+      'ISO-2022-JP'  =>  t('Japanese (ISO-2022-JP)'),
+      'GB2312'       =>  t('Chinese Simplified (GB2312)'),
+      'GB18030'      =>  t('Chinese Simplified (GB18030)'),
+      'big5'         =>  t('Chinese Traditional (Big5)'),
+      'EUC-KR'       =>  t('Korean (EUC-KR)'),
+      'windows-874'  =>  t('Thai (Windows-874)'),
+      'windows-1258' =>  t('Vietnamese (Windows-1258)'),
+      'ISO-8859-2'   =>  t('Central European Latin-2 (ISO-8859-2)'),
+      'windows-1250' =>  t('Central European (Windows-1250)'),
+      'cp852'        =>  t('Central European (CP852)'),
+      'ISO-8859-9'   =>  t('Turkish Latin-5 (ISO-8859-9)'),
+      'windows-1254' =>  t('Turkish (Windows-1254)'),
+      'ISO-8859-3'   =>  t('South European Latin-3 (ISO-8859-3)'),
+      'ISO-8859-8-I' =>  t('Hebrew (ISO-8859-8-I)'),
+      'windows-1255' =>  t('Hebrew (Windows-1255)'),
+      'windows-1256' =>  t('Arabic (Windows-1256)'),
+      'ISO-8859-5'   =>  t('Cyrillic (ISO-8859-5)'),
+      'KOI8-R'       =>  t('Cyrillic (KOI8-R)'),
+      'windows-1251' =>  t('Cyrillic (Windows-1251)'),
+      'cp-866'       =>  t('Cyrillic/Russian (CP-866)'),
+      'UTF-8'        =>  t('Unicode (UTF-8)')
+    )
+  );
+
+  $textbox_length = $textbox_length > 64 ? 64 : variable_get(ADSENSE_SEARCH_TEXTBOX_LENGTH, 15);
+  $form['search']['box'][ADSENSE_SEARCH_TEXTBOX_LENGTH] = array(
+    '#type' => 'textfield',
+    '#title' => t('Length of text box (Max 64): '),
+    '#default_value' => $textbox_length,
+    '#size' => 2,
+    '#maxlength' => 2
+  );
+
+  $form['search']['result'][ADSENSE_SEARCH_FRAME_WIDTH] = array(
+    '#type' => 'textfield',
+    '#title' => t('Width of results area'),
+    '#default_value' => variable_get(ADSENSE_SEARCH_FRAME_WIDTH, 500),
+    '#size' => 3,
+    '#maxlength' => 3
+  );
+  $form['advanced'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#title' => t('Advanced options'),
+  );
+
+  $form['advanced'][ADSENSE_TEST_MODE] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable test mode?'),
+    '#return_value' => 1,
+    '#default_value' => variable_get(ADSENSE_TEST_MODE, 0),
+    '#description' => t('This enables you to test the AdSense module settings. This can be useful in some situations: for example, testing whether revenue sharing is working properly or not without having to display real ads on your site. It is best to test this after you log out.'),
+  );
+
+  $form['advanced'][ADSENSE_DISABLE] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Disable Google AdSense ads?'),
+    '#return_value' => 1,
+    '#default_value' => variable_get(ADSENSE_DISABLE, 0),
+    '#description' => t('This disables all display of Google AdSense ads from your web site. This is useful in certain situations, such as site upgrades, or if you make a copy of the site for development and test purposes.'),
+  );
+
+  $form['advanced'][ADSENSE_PLACEHOLDER] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Placeholder when ads are disabled?'),
+    '#return_value' => 1,
+    '#default_value' => variable_get(ADSENSE_PLACEHOLDER, 1),
+    '#description' => t('This causes an empty box to be displayed in place of the ads when they are disabled.'),
+  );
+
+  $form['advanced'][ADSENSE_PLACEHOLDER_TEXT] = array(
+    '#type' => 'textarea',
+    '#title' => t('Placeholder text to display'),
+    '#default_value' => variable_get(ADSENSE_PLACEHOLDER_TEXT, t('Google AdSense')),
+    '#cols' => 70,
+    '#rows' => 3,
+    '#description' => t('Enter any text to display as a placeholder when ads are disabled.'),
+  );
+
+  $form['advanced'][ADSENSE_SECTION_TARGETING] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable AdSense section targeting?'),
+    '#return_value' => 1,
+    '#default_value' => variable_get(ADSENSE_SECTION_TARGETING, 1),
+    '#description' => t('This better targets Google ads to the teaser and body of nodes.'),
+  );
+
+
+  return system_settings_form($form);
+}
+
+function adsense_admin_module_settings(&$form_stste, $module) {
+  $function = $module .'_adsense';
+  $form = $function('settings');
+
+  return system_settings_form($form);
+}
+
+/**
+ * Menu callback; presents the "AdSense" log page.
+ */
+function adsense_click_log(&$form_stste) {
+  $header = array(
+    array('data' => t('Timestamp'), 'field' => 'timestamp', 'sort' => 'desc'),
+    array('data' => t('Path'), 'field' => 'path'),
+    array('data' => t('IP/host'), 'field' => 'ip'),
+  );
+
+  $name_resolve = variable_get(ADSENSE_CLICK_TRACKING_NAME_RESOLVE, 0);
+
+  $sql = 'SELECT * FROM {adsense_clicks} '. tablesort_sql($header);
+
+  $result = pager_query($sql, 50);
+  while ($log = db_fetch_object($result)) {
+    if ($name_resolve) {
+      $host = gethostbyaddr($log->ip);
+    }
+    else {
+      $host = $log->ip;
+    }
+
+    $rows[] = array(
+      array('data' => format_date($log->timestamp, 'small'), 'nowrap' => 'nowrap'),
+      _adsense_format_path($log->path),
+      l($host, 'http://whois.domaintools.com/'. $log->ip),
+    );
+  }
+
+  return theme('table', $header, $rows) . theme('pager', NULL, 50, 0);
+}
+
+function adsense_click_top_pages(&$form_stste) {
+  $header = array(
+    array('data' => t('Path'), 'field' => 'path'),
+    array('data' => t('Clicks'), 'field' => 'count', 'sort' => 'desc'),
+    array('data' => t('Last'), 'field' => 'last'),
+  );
+
+  $sql = 'SELECT path, COUNT(*) AS count, MAX(timestamp) AS last FROM {adsense_clicks} GROUP BY path'. tablesort_sql($header);
+
+  $result = pager_query($sql, 50);
+  while ($log = db_fetch_object($result)) {
+    $rows[] = array(
+      array('data' => _adsense_format_path($log->path)),
+      array('data' => $log->count, 'align' => 'right'),
+      array('data' => format_date($log->last, 'small'), 'nowrap' => 'nowrap'),
+    );
+  }
+
+  return theme('table', $header, $rows) . theme('pager', NULL, 50, 0);
+}
+
+function adsense_click_by_day(&$form_stste) {
+  global $db_type;
+  $header = array(
+    array('data' => t('Day'), 'field' => 'day', 'sort' => 'desc'),
+    array('data' => t('Clicks'), 'field' => 'count'),
+  );
+
+  switch ($db_type) {
+    case 'mysql':
+    case 'mysqli':
+      $sql_count = "SELECT COUNT(DISTINCT(FROM_UNIXTIME(timestamp, '%y-%m-%%d'))) FROM {adsense_clicks}";
+      $sql = "SELECT FROM_UNIXTIME(timestamp, '%Y-%m-%%d') AS day, COUNT(*) AS count FROM {adsense_clicks} GROUP BY day" .  tablesort_sql($header);
+      break;
+    case 'pgsql':
+      $sql_count = "SELECT COUNT(DISTINCT(TO_CHAR(timestamp, 'YYYY-MM-DD'))) FROM {adsense_clicks}";
+      $sql = "SELECT TO_CHAR(timestamp, 'YYYY-MM-DD') AS day, COUNT(*) AS count FROM {adsense_clicks} GROUP BY day" .  tablesort_sql($header);
+      break;
+  }
+
+  $result = pager_query($sql, 50, 0, $sql_count);
+  while ($log = db_fetch_object($result)) {
+    $rows[] = array(
+      $log->day,
+      array('data' => $log->count, 'align' => 'right'),
+    );
+  }
+
+  return theme('table', $header, $rows) . theme('pager', NULL, 50, 0);
+}
Index: adsense.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/adsense.info,v
retrieving revision 1.4
diff -u -p -r1.4 adsense.info
--- adsense.info	10 Feb 2008 01:24:19 -0000	1.4
+++ adsense.info	4 Apr 2008 07:41:17 -0000
@@ -1,6 +1,8 @@
 ; $Id: adsense.info,v 1.4 2008/02/10 01:24:19 kbahey Exp $
 ; Copyright 2005-2008 Khalid Baheyeldin http://2bits.com
 
-name = AdSense core and API
+name = AdSense
 description = Displays Google AdSense ads on your site to earn revenue. Provides an API for revenue sharing on web sites.
 package = Adsense
+version = 6.x-1.x-dev
+core = 6.x
Index: adsense.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/adsense.install,v
retrieving revision 1.8
diff -u -p -r1.8 adsense.install
--- adsense.install	10 Feb 2008 01:24:19 -0000	1.8
+++ adsense.install	4 Apr 2008 07:41:17 -0000
@@ -1,58 +1,71 @@
-<?php
-// $Id: adsense.install,v 1.8 2008/02/10 01:24:19 kbahey Exp $
-//
-// Copyright 2005-2008 Khalid Baheyeldin http://2bits.com
-
-function adsense_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      $success = db_query("CREATE TABLE IF NOT EXISTS {adsense_clicks} (
-        aid       INT(10)     NOT NULL AUTO_INCREMENT,
-        ip        VARCHAR(15) DEFAULT '0',
-        timestamp INT(11)     unsigned NOT NULL DEFAULT '0',
-        path      VARCHAR(255) NOT NULL DEFAULT '',
-        PRIMARY KEY  (aid),
-        KEY (timestamp)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      break;
-    case 'pgsql':
-      $success = db_query("CREATE TABLE {adsense_clicks} (
-        aid       SERIAL,
-        ip        VARCHAR(15) DEFAULT '0',
-        timestamp INTEGER NOT NULL DEFAULT '0',
-        path      VARCHAR(255) DEFAULT '',
-        PRIMARY KEY  (aid));");
-      $success = db_query("CREATE INDEX {timestamp} ON {adsense_clicks} (timestamp);");
-      break;
-  }
-
-  if ($success) {
-    drupal_set_message(t('Adsense module table creation successful.'));
-  }
-  else {
-    drupal_set_message(t('Adsense module table creation was unsuccessful.'), 'error');
-  }
-}
-
-/**
- * Implementation of hook_uninstall().
- */
-function adsense_uninstall() {
-  db_query('DROP TABLE {adsense_clicks}');
-  db_query("DELETE FROM {variable} WHERE name LIKE 'adsense_%'");
-}
-
-function adsense_update_1() {
-  adsense_install();
-}
-
-function adsense_update_2() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query("ALTER TABLE {adsense_clicks} ADD `path` varchar(255) default ''");
-      break;
-  }
-}
-
+<?php
+// $Id: adsense.install,v 1.8 2008/02/10 01:24:19 kbahey Exp $
+//
+// Copyright 2005-2008 Khalid Baheyeldin http://2bits.com
+
+/**
+ * Implementation of hook_install().
+ */
+function adsense_install() {
+  drupal_install_schema('adsense');
+}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function adsense_uninstall() {
+  drupal_uninstall_schema('adsense');
+  db_query("DELETE FROM {variable} WHERE name LIKE 'adsense_%'");
+}
+
+function adsense_update_1() {
+  adsense_install();
+}
+
+function adsense_update_2() {
+  $ret = array();
+  db_add_field($ret, 'adsense_clicks', 'path', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''));
+  return $ret;
+}
+
+/**
+ * Implementation of hook_schema().
+ */
+function adsense_schema() {
+  $schema['adsense_clicks'] = array(
+    'description' => t('Store Adsense click record.'),
+    'fields' => array(
+      'aid' => array(
+        'description' => t('The primary key.'),
+        'type' => 'serial',
+        'not null' => TRUE
+      ),
+      'ip' => array(
+        'description' => t('Client IP.'),
+        'type' => 'varchar',
+        'length' => 15,
+        'default' => '0'
+      ),
+      'timestamp' => array(
+        'description' => t('Click time.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0
+      ),
+      'path' => array(
+        'description' => t('Where they click.'),
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => ''
+      ),
+    ),
+    'indexes' => array(
+      'adsense_clicks_timestamp' => array('timestamp'),
+    ),
+    'primary key' => array('aid'),
+  );
+
+  return $schema;
+}
Index: adsense.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/adsense.module,v
retrieving revision 1.66.2.7
diff -u -p -r1.66.2.7 adsense.module
--- adsense.module	1 Apr 2008 02:28:27 -0000	1.66.2.7
+++ adsense.module	4 Apr 2008 07:41:18 -0000
@@ -1,5 +1,5 @@
 <?php
-//$Id: adsense.module,v 1.66.2.7 2008/04/01 02:28:27 kbahey Exp $
+// $Id: adsense.module,v 1.66.2.7 2008/04/01 02:28:27 kbahey Exp $
 
 // Copyright 2005-2008 Khalid Baheyeldin http://2bits.com
 
@@ -121,8 +121,8 @@ function adsense_get_ad_code($format) {
 /**
  * Implementation of hook_help().
  */
-function adsense_help($section) {
-  switch ($section) {
+function adsense_help($path, $arg) {
+  switch ($path) {
     case 'admin/settings/adsense':
       return t('<p>@revision @date</p>', array('@revision' => trim('$Revision: 1.66.2.7 $', ' $'), '@date' => trim('$Date: 2008/04/01 02:28:27 $', ' $')));
   }
@@ -131,75 +131,68 @@ function adsense_help($section) {
 /**
  * Implementation of hook_menu().
  */
-function adsense_menu($may_cache) {
+function adsense_menu() {
   $items = array();
 
-  $access = user_access('administer site configuration');
-  if ($may_cache) {
-    $items[] = array(
-      'path'               => 'admin/settings/adsense',
-      'title'              => t('AdSense'),
-      'description'        => t('Configure Google AdSense Ads. Choose colors, channels, revenue sharing modules and many other options.'),
-      'callback'           => 'drupal_get_form',
-      'callback arguments' => 'adsense_admin_settings',
-      'type'               => MENU_NORMAL_ITEM,
-      'access'             => $access,
+  $items['admin/settings/adsense'] = array(
+    'title' => 'Google AdSense',
+    'description' => 'Configure Google AdSense Ads. Choose colors, channels, revenue sharing modules and many other options.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('adsense_admin_settings'),
+    'access arguments' => array('administer site configuration'),
+    'file' => 'adsense.admin.inc',
+    'type' => MENU_NORMAL_ITEM,
+  );
+
+  $module_list = module_implements('adsense');
+  foreach ($module_list as $key => $module) {
+    $items['admin/settings/adsense/'. $module] = array(
+      'title' => $module,
+      'page callback' => 'drupal_get_form',
+      'page arguments' => array('adsense_admin_module_settings'),
+      'access arguments' => array('administer site configuration'),
+      'file' => 'adsense.admin.inc',
+      'type' => MENU_NORMAL_ITEM,
     );
-
-    $module_list = module_implements('adsense');
-    foreach ($module_list as $key => $module) {
-      $items[] = array(
-        'path'               => 'admin/settings/adsense/'. $module,
-        'title'              => $module,
-        'callback'           => 'drupal_get_form',
-        'callback arguments' => array('adsense_admin_module_settings', $module),
-        'type'               => MENU_NORMAL_ITEM,
-        'access'             => $access,
-      );
-    }
-
-    if (variable_get(ADSENSE_CLICK_TRACKING, 0)) {
-      $access = user_access('view clicks');
-      $items[] = array(
-        'path' => 'admin/logs/adsense',
-        'title' => t('AdSense clicks'),
-        'description' => t('Track AdSense clicks.'),
-        'callback' => 'adsense_click_log',
-        'type' => MENU_NORMAL_ITEM,
-        'access' => $access,
-        );
-
-      $items[] = array(
-        'path' => 'admin/logs/adsense/top_pages',
-        'title' => t('Top pages'),
-        'callback' => 'adsense_click_top_pages',
-        'type' => MENU_NORMAL_ITEM,
-        'access' => $access,
-        );
-
-      $items[] = array(
-        'path' => 'admin/logs/adsense/by_day',
-        'title' => t('By day'),
-        'callback' => 'adsense_click_by_day',
-        'type' => MENU_NORMAL_ITEM,
-        'access' => $access,
-        );
-    }
   }
-  else {
-    $items[] = array(
-      'path'     => 'adsense/counter',
-      'callback' => 'adsense_counter',
-      'access'   => TRUE,
-      'type'     => MENU_CALLBACK,
+
+  if (variable_get(ADSENSE_CLICK_TRACKING, 0)) {
+    $items['admin/reports/adsense'] = array(
+      'title' => 'Google AdSense clicks',
+      'description' => 'Track AdSense clicks.',
+      'page callback' => 'adsense_click_log',
+      'access arguments' => array('view clicks'),
+      'file' => 'adsense.admin.inc',
+      'type' => MENU_NORMAL_ITEM,
+    );
+
+    $items['admin/reports/adsense/top_pages'] = array(
+      'title' => 'Top pages',
+      'page callback' => 'adsense_click_top_pages',
+      'access arguments' => array('view clicks'),
+      'file' => 'adsense.admin.inc',
+      'type' => MENU_NORMAL_ITEM,
+    );
+
+    $items['admin/reports/adsense/by_day'] = array(
+      'title' => 'By day',
+      'page callback' => 'adsense_click_by_day',
+      'access arguments' => array('view clicks'),
+      'file' => 'adsense.admin.inc',
+      'type' => MENU_NORMAL_ITEM,
     );
   }
-  $items[] = array(
-    'path'     => ADSENSE_SEARCH_PATH,
-    'callback' => 'adsense_search',
-    'access'   => user_access('access adsense search result page'),
-    'type'     => MENU_CALLBACK,
+
+  $items['adsense/counter'] = array(
+    'page callback' => 'adsense_counter',
+    'type' => MENU_CALLBACK,
+  );
+  $items[ADSENSE_SEARCH_PATH] = array(
+    'page callback' => 'adsense_search',
+    'access arguments' => array('access adsense search result page'),
+    'type' => MENU_CALLBACK,
   );
+
   return $items;
 }
 
@@ -210,756 +203,6 @@ function adsense_perm() {
   return array('hide adsense', 'view clicks', 'access adsense search result page');
 }
 
-function adsense_admin_module_settings($module) {
-  $function = $module .'_adsense';
-  $form = $function('settings');
-
-  return system_settings_form($form);
-}
-
-function adsense_admin_settings() {
-  // force a display of errors, if any
-  $module = variable_get(ADSENSE_ID_MODULE, 'adsense_basic');
-  $function = $module .'_adsense';
-  if (function_exists($function)) {
-    $error = $function('status');
-  }
-
-  $form = array();
-  cache_clear_all('adsense', 'cache', TRUE);
-
-  // We only load the help text if we are in settings, to save memory
-  $module = 'adsense';
-  include_once(drupal_get_path('module', $module) .'/'. $module .'_help.inc');
-
-  $form['help'] = array(
-    '#type'        => 'fieldset',
-    '#collapsible' => TRUE,
-    '#collapsed'   => TRUE,
-    '#title'       => t('Help and instructions'),
-  );
-
-  $help_function = $module .'_help_text';
-  $form['help']['help'] = array(
-    '#type'  => 'markup',
-    '#value' => $help_function(),
-  );
-
-  $form['required'] = array(
-    '#type'        => 'fieldset',
-    '#collapsible' => TRUE,
-    '#collapsed'   => FALSE,
-    '#title'       => t('Required parameters'),
-  );
-
-  foreach (module_implements('adsense') as $key => $val) {
-    $list[$val] = $val .' '. l(t('(Settings)'), 'admin/settings/adsense/'. $val);
-  }
-
-  $form['required'][ADSENSE_ID_MODULE] = array(
-    '#type'          => 'radios',
-    '#title'         => t('Adsense Client ID selection modules'),
-    '#default_value' => variable_get(ADSENSE_ID_MODULE, 'adsense_basic'),
-    '#options'       => $list,
-    '#description'   => t('This provides a list of modules that are able to select a valid Adsense Client ID. You have to chose one module that selects the Adsense ID for each page view. Only one module can be selected. You can write your own module that selects the ID based on criteria you chose.'),
-  );
-
-  $client = adsense_get_client_id();
-  if (!$client) {
-    adsense_error(ADSENSE_ERROR_NOT_CONFIGURED);
-    return system_settings_form($form);
-  }
-
-  $form['types_colors'] = array(
-    '#type'        => 'fieldset',
-    '#collapsible' => TRUE,
-    '#collapsed'   => TRUE,
-    '#title'       => t('Ad groups'),
-  );
-
-  for ($group=1; $group<ADSENSE_MAX_GROUPS+1; $group++) {
-
-    $form['types_colors']['groups'][$group] = array(
-      '#type' => 'fieldset',
-      '#collapsible' => TRUE,
-      '#collapsed' => TRUE,
-      '#title' => t('Group @group attributes', array('@group' => $group)),
-    );
-
-    $form['types_colors']['groups'][$group][ADSENSE_AD_TYPE . $group] = array(
-      '#type' => 'radios',
-      '#title' => t('Ad type'),
-      '#default_value' => variable_get(ADSENSE_AD_TYPE . $group, '000000'),
-      '#options' => array(t('Text'), t('Image'), t('Both')),
-    );
-
-    $form['types_colors']['groups'][$group][ADSENSE_COLOR_TEXT . $group] = array(
-      '#type' => 'textfield',
-      '#title' => t('Ad text color'),
-      '#default_value' => variable_get(ADSENSE_COLOR_TEXT . $group, '000000'),
-      '#size' => 6,
-      '#maxlength' => 6,
-    );
-
-    $form['types_colors']['groups'][$group][ADSENSE_COLOR_BORDER . $group] = array(
-      '#type' => 'textfield',
-      '#title' => t('Ad border color'),
-      '#default_value' => variable_get(ADSENSE_COLOR_BORDER . $group, '336699'),
-      '#size' => 6,
-      '#maxlength' => 6,
-    );
-
-    $form['types_colors']['groups'][$group][ADSENSE_COLOR_BG . $group] = array(
-      '#type' => 'textfield',
-      '#title' => t('Ad background color'),
-      '#default_value' => variable_get(ADSENSE_COLOR_BG . $group, 'FFFFFF'),
-      '#size' => 6,
-      '#maxlength' => 6,
-    );
-
-    $form['types_colors']['groups'][$group][ADSENSE_COLOR_LINK . $group] = array(
-      '#type' => 'textfield',
-      '#title' => t('Ad title color'),
-      '#default_value' => variable_get(ADSENSE_COLOR_LINK . $group, '336699'),
-      '#size' => 6,
-      '#maxlength' => 6,
-    );
-
-    $form['types_colors']['groups'][$group][ADSENSE_COLOR_URL . $group] = array(
-      '#type' => 'textfield',
-      '#title' => t('Ad URL color'),
-      '#default_value' => variable_get(ADSENSE_COLOR_URL . $group, 'FF8C00'),
-      '#size' => 6,
-      '#maxlength' => 6,
-    );
-
-    $form['types_colors']['groups'][$group][ADSENSE_ALT . $group] = array(
-      '#type' => 'select',
-      '#title' => t('Alternate URL color'),
-      '#default_value' => variable_get(ADSENSE_ALT . $group, 0),
-      '#options' => array(t('None'), t('Alternate URL'), t('Alternate color')),
-    );
-
-    $form['types_colors']['groups'][$group][ADSENSE_ALT_INFO . $group] = array(
-      '#type' => 'textfield',
-      '#title' => t('Alternate info'),
-      '#default_value' => variable_get(ADSENSE_ALT_INFO . $group, ''),
-      '#size' => 100,
-      '#maxlength' => 100,
-      '#description' => t('Enter either 6 letter alternate color code, or alternate URL to use'),
-    );
-  }
-
-  $form['types_colors']['search'] = array(
-    '#type' => 'fieldset',
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-    '#title' => t('AdSense for Search attributes'),
-  );
-
-  $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_TEXT] = array(
-    '#type' => 'textfield',
-    '#title' => t('Text color'),
-    '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_TEXT, '000000'),
-    '#size' => 6,
-    '#maxlength' => 6
-  );
-
-  $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_BORDER] = array(
-    '#type' => 'textfield',
-    '#title' => t('Border color'),
-    '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_BORDER, '336699'),
-    '#size' => 6,
-    '#maxlength' => 6
-  );
-
-  $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_BG] = array(
-    '#type' => 'textfield',
-    '#title' => t('Background color'),
-    '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_BG, 'FFFFFF'),
-    '#size' => 6,
-    '#maxlength' => 6
-  );
-
-  $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_TITLE] = array(
-      '#type' => 'textfield',
-      '#title' => t('Title color'),
-      '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_TITLE, '0000FF'),
-      '#size' => 6,
-      '#maxlength' => 6
-    );
-
-  $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_URL] = array(
-    '#type' => 'textfield',
-    '#title' => t('URL color'),
-    '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_URL, '008000'),
-    '#size' => 6,
-    '#maxlength' => 6
-  );
-
-  $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_VISITED_URL] = array(
-    '#type' => 'textfield',
-    '#title' => t('Visited URL color'),
-    '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_VISITED_URL, '663399'),
-    '#size' => 6,
-    '#maxlength' => 6
-  );
-
-  $form['types_colors']['search'][ADSENSE_SEARCH_COLOR_LIGHT_URL] = array(
-    '#type' => 'textfield',
-    '#title' => t('Light URL color'),
-    '#default_value' => variable_get(ADSENSE_SEARCH_COLOR_LIGHT_URL, '0000FF'),
-    '#size' => 6,
-    '#maxlength' => 6
-  );
-
-  $form['channels'] = array(
-    '#type' => 'fieldset',
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-    '#title' => t('Custom channels'),
-    '#description' => t('Enter up to !channels custom channels that you have configured in Google AdSense. If you are not using custom channels, or you are only using URL channels, then leave this empty.', array('!channels' => ADSENSE_MAX_CHANNELS)),
-  );
-
-  for ($channel=1; $channel<ADSENSE_MAX_CHANNELS+1; $channel++) {
-    $form['channels'][ADSENSE_AD_CHANNEL . $channel] = array(
-      '#type' => 'textfield',
-      '#title' => t('Custom channel ID ') . $channel,
-      '#default_value' => variable_get(ADSENSE_AD_CHANNEL . $channel, ''),
-      '#size' => 30,
-      '#maxlength' => 30,
-    );
-  }
-
-  $form['visibility'] = array(
-    '#type' => 'fieldset',
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-    '#title' => t('Visibility'),
-  );
-
-  $form['visibility']['adsense_visibility'] = array(
-    '#type' => 'radios',
-    '#title' => t('Show AdSense on specific pages'),
-    '#default_value' => variable_get(ADSENSE_VISIBILITY, 0),
-    '#options' => array(t('Show on every page except the listed pages.'),
-      t('Show on only the listed pages.')),
-  );
-
-  $form['visibility']['adsense_access_pages'] = array(
-    '#type' => 'textarea',
-    '#title' => t('Pages'),
-    '#default_value' => variable_get(ADSENSE_ACCESS_PAGES, ''),
-    '#cols' => 70,
-    '#rows' => 5,
-    '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are '<em>blog</em>' for the blog page and '<em>blog/*</em>' for every personal blog. '<em>&lt;front&gt;</em>' is the front page."),
-  );
-
-  $form['click_tracking'] = array(
-    '#type' => 'fieldset',
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-    '#title' => t('Click tracking'),
-  );
-
-  $form['click_tracking'][ADSENSE_CLICK_TRACKING] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Enable AdSense click tracking?'),
-    '#return_value' => 1,
-    '#default_value' => variable_get(ADSENSE_CLICK_TRACKING, 0),
-    '#description' => t('Logs IP and time of <a href=!url>AdSense clicks</a>. This can be very useful in tracking which of your pages generate the most clicks, as well as help if click fraud is suspected.', array('!url' => url('admin/logs/adsense'))),
-  );
-
-  $form['click_tracking'][ADSENSE_CLICK_TRACKING_NAME_RESOLVE] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Enable name resolution of IP addresses?'),
-    '#return_value' => 1,
-    '#default_value' => variable_get(ADSENSE_CLICK_TRACKING_NAME_RESOLVE, 0),
-    '#description' => t('Display the domain name instead of the IP address. This can slow down the display of the logs page and tie up a PHP process for several seconds. On some hosting providers it may not be available.'),
-  );
-
-  $form['search'] = array(
-    '#type' => 'fieldset',
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-    '#title' => t('AdSense Search')
-  );
-
-  $form['search']['box'] = array(
-    '#type' => 'fieldset',
-    '#collapsible' => TRUE,
-    '#collapsed' => FALSE,
-    '#title' => t('Search Box Options'),
-    '#description' => t('Allows users to search the web or the specific site(s) of your choice. Enter the site\'s URL without the last \'/\''),
-  );
-
-  global $base_url;
-  $form['search']['box'][ADSENSE_SEARCH_DOMAIN .'_0'] = array(
-    '#type' => 'textfield',
-    '#field_prefix' => 'http://',
-    '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN .'_0'), str_replace('http://', '', $base_url)),
-    '#size' => 32,
-    '#maxlength' => 255
-  );
-
-  $form['search']['box'][ADSENSE_SEARCH_DOMAIN .'_1'] = array(
-    '#type' => 'textfield',
-    '#field_prefix' => 'http://',
-    '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN .'_1'), ''),
-    '#size' => 32,
-    '#maxlength' => 255
-  );
-
-  $form['search']['box'][ADSENSE_SEARCH_DOMAIN .'_2'] = array(
-    '#type' => 'textfield',
-    '#field_prefix' => 'http://',
-    '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN .'_2'), ''),
-    '#size' => 32,
-    '#maxlength' => 255
-  );
-
-  $form['search']['box'][ADSENSE_SEARCH_LOGO] = array(
-    '#type' => 'radios',
-    '#title' => t('Logo Type'),
-    '#default_value' => variable_get(ADSENSE_SEARCH_LOGO, ADSENSE_SEARCH_LOGO_GOOGLE),
-    '#options' => array(
-      ADSENSE_SEARCH_LOGO_GOOGLE        => t('Google Logo'),
-      ADSENSE_SEARCH_LOGO_ABOVE_TEXTBOX => t('Logo above text box'),
-      ADSENSE_SEARCH_LOGO_ON_BUTTON     => t('"Google Search" on button'),
-    )
-  );
-
-  $form['search']['box'][ADSENSE_SEARCH_BUTTON] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Search button below text box'),
-    '#return_value' => 1,
-    '#default_value' => variable_get(ADSENSE_SEARCH_BUTTON, 0)
-  );
-
-  $box_background_color = variable_get(ADSENSE_SEARCH_COLOR_BOX_BACKGROUND, ADSENSE_SEARCH_COLOR_WHITE);
-  $form['search']['box'][ADSENSE_SEARCH_COLOR_BOX_BACKGROUND] = array(
-    '#type' => 'select',
-    '#title' => t('Background Color'),
-    '#default_value' => $box_background_color,
-    '#options' => array(
-      ADSENSE_SEARCH_COLOR_WHITE => t('White'),
-      ADSENSE_SEARCH_COLOR_BLACK => t('Black'),
-      ADSENSE_SEARCH_COLOR_GRAY  => t('Gray'),
-    )
-  );
-
-  $box_text_color = variable_get(ADSENSE_SEARCH_COLOR_BOX_TEXT, ADSENSE_SEARCH_COLOR_BLACK);
-  if ($box_background_color == ADSENSE_SEARCH_COLOR_BLACK) {
-    $box_text_color = ADSENSE_SEARCH_COLOR_WHITE;
-  }
-  elseif ($box_background_color == ADSENSE_SEARCH_COLOR_WHITE) {
-    $box_text_color = ADSENSE_SEARCH_COLOR_BLACK;
-  }
-
-  $form['search']['box'][ADSENSE_SEARCH_COLOR_BOX_TEXT] = array(
-    '#type' => 'select',
-    '#title' => t('Text Color'),
-    '#default_value' => $box_text_color,
-    '#options' => array(
-      ADSENSE_SEARCH_COLOR_BLACK => t('Black'),
-      ADSENSE_SEARCH_COLOR_WHITE => t('White')
-    )
-  );
-
-  $form['search']['result'] = array(
-    '#type' => 'fieldset',
-    '#collapsible' => TRUE,
-    '#collapsed' => FALSE,
-    '#title' => t('Search Results Style')
-  );
-
-  $form['search']['result'][ADSENSE_SEARCH_COUNTRY] = array(
-    '#type' => 'select',
-    '#title' => t('Country or territory for Google domain'),
-    '#default_value' => variable_get(ADSENSE_SEARCH_COUNTRY, 'www.google.com'),
-    '#options' => array(
-      'www.google.co.uk'  => t('United Kingdom'),
-      'www.google.ca'     => t('Canada'),
-      'www.google.de'     => t('Germany'),
-      'www.google.co.jp'  => t('Japan'),
-      'www.google.fr'     => t('France'),
-      'www.google.com.au' => t('Australia'),
-      'www.google.it'     => t('Italy'),
-      'www.google.at'     => t('Austria'),
-      'www.google.ch'     => t('Switzerland'),
-      'www.google.es'     => t('Spain'),
-      'www.google.nl'     => t('Netherlands'),
-      'www.google.be'     => t('Belgium'),
-      'www.google.dk'     => t('Denmark'),
-      'www.google.se'     => t('Sweden'),
-      'www.google.no'     => t('Norway'),
-      'www.google.com.br' => t('Brazil'),
-      'www.google.pt'     => t('Portugal'),
-      'www.google.fi'     => t('Finland'),
-      'www.google.co.kr'  => t('South Korea'),
-      'www.google.cn'     => t('China'),
-      'www.google.com.hk' => t('Hong Kong'),
-      'www.google.com.tw' => t('Taiwan'),
-      'www.google.com.sg' => t('Singapore'),
-      'www.google.com.af' => t('Afghanistan'),
-      'www.google.com'    => t('Albania'),
-      'www.google.com'    => t('Algeria'),
-      'www.google.as'     => t('American Samoa'),
-      'www.google.com'    => t('Andorra'),
-      'www.google.com'    => t('Angola'),
-      'www.google.off.ai' => t('Anguilla'),
-      'www.google.com'    => t('Antarctica'),
-      'www.google.com.ag' => t('Antigua and Barbuda'),
-      'www.google.com.ar' => t('Argentina'),
-      'www.google.am'     => t('Armenia'),
-      'www.google.com'    => t('Aruba'),
-      'www.google.az'     => t('Azerbaijan'),
-      'www.google.bs'     => t('Bahamas'),
-      'www.google.com.bh' => t('Bahrain'),
-      'www.google.com.bd' => t('Bangladesh'),
-      'www.google.com'    => t('Barbados'),
-      'www.google.com'    => t('Belarus'),
-      'www.google.com.bz' => t('Belize'),
-      'www.google.com'    => t('Benin'),
-      'www.google.com'    => t('Bermuda'),
-      'www.google.com'    => t('Bhutan'),
-      'www.google.com.bo' => t('Bolivia'),
-      'www.google.ba'     => t('Bosnia and Herzegovina'),
-      'www.google.co.bw'  => t('Botswana'),
-      'www.google.com'    => t('Bouvet Island'),
-      'www.google.com'    => t('British Indian Ocean Territory'),
-      'www.google.com.bn' => t('Brunei Darussalam'),
-      'www.google.bg'     => t('Bulgaria'),
-      'www.google.com'    => t('Burkina Faso'),
-      'www.google.bi'     => t('Burundi'),
-      'www.google.com.kh' => t('Cambodia'),
-      'www.google.com'    => t('Cameroon'),
-      'www.google.com'    => t('Cape Verde'),
-      'www.google.com'    => t('Cayman Islands'),
-      'www.google.com'    => t('Central African Republic'),
-      'www.google.com'    => t('Chad'),
-      'www.google.cl'     => t('Chile'),
-      'www.google.com'    => t('Christmas Island'),
-      'www.google.com'    => t('Cocos (Keeling) Islands'),
-      'www.google.com.co' => t('Colombia'),
-      'www.google.com'    => t('Comoros'),
-      'www.google.cg'     => t('Congo'),
-      'www.google.cd'     => t('Congo, Democratic Republic'),
-      'www.google.co.ck'  => t('Cook Islands'),
-      'www.google.co.cr'  => t('Costa Rica'),
-      'www.google.ci'     => t('Cote d&#39;Ivoire'),
-      'www.google.hr'     => t('Croatia'),
-      'www.google.com.cu' => t('Cuba'),
-      'www.google.com'    => t('Cyprus'),
-      'www.google.cz'     => t('Czech Republic'),
-      'www.google.dj'     => t('Djibouti'),
-      'www.google.dm'     => t('Dominica'),
-      'www.google.com.do' => t('Dominican Republic'),
-      'www.google.tp'     => t('East Timor'),
-      'www.google.com.ec' => t('Ecuador'),
-      'www.google.com.eg' => t('Egypt'),
-      'www.google.com.sv' => t('El Salvador'),
-      'www.google.com'    => t('Equatorial Guinea'),
-      'www.google.com'    => t('Eritrea'),
-      'www.google.ee'     => t('Estonia'),
-      'www.google.com.et' => t('Ethiopia'),
-      'www.google.com'    => t('Falkland Islands (Malvinas)'),
-      'www.google.com'    => t('Faroe Islands'),
-      'www.google.com.fj' => t('Fiji'),
-      'www.google.com'    => t('French Guiana'),
-      'www.google.com'    => t('French Polynesia'),
-      'www.google.com'    => t('French Southern Territories'),
-      'www.google.com'    => t('Gabon'),
-      'www.google.gm'     => t('Gambia'),
-      'www.google.ge'     => t('Georgia'),
-      'www.google.com'    => t('Ghana'),
-      'www.google.com.gi' => t('Gibraltar'),
-      'www.google.gr'     => t('Greece'),
-      'www.google.gl'     => t('Greenland'),
-      'www.google.com'    => t('Grenada'),
-      'www.google.gp'     => t('Guadeloupe'),
-      'www.google.com'    => t('Guam'),
-      'www.google.com.gt' => t('Guatemala'),
-      'www.google.com'    => t('Guinea'),
-      'www.google.com'    => t('Guinea-Bissau'),
-      'www.google.gy'     => t('Guyana'),
-      'www.google.ht'     => t('Haiti'),
-      'www.google.com'    => t('Heard and McDonald Islands'),
-      'www.google.hn'     => t('Honduras'),
-      'www.google.hu'     => t('Hungary'),
-      'www.google.is'     => t('Iceland'),
-      'www.google.co.in'  => t('India'),
-      'www.google.co.id'  => t('Indonesia'),
-      'www.google.com'    => t('Iran'),
-      'www.google.com'    => t('Iraq'),
-      'www.google.ie'     => t('Ireland'),
-      'www.google.co.il'  => t('Israel'),
-      'www.google.com.jm' => t('Jamaica'),
-      'www.google.jo'     => t('Jordan'),
-      'www.google.kz'     => t('Kazakhstan'),
-      'www.google.co.ke'  => t('Kenya'),
-      'www.google.ki'     => t('Kiribati'),
-      'www.google.com'    => t('Kuwait'),
-      'www.google.kg'     => t('Kyrgyzstan'),
-      'www.google.la'     => t('Lao People&#39;s Democratic Republic'),
-      'www.google.lv'     => t('Latvia'),
-      'www.google.com'    => t('Lebanon'),
-      'www.google.co.ls'  => t('Lesotho'),
-      'www.google.com'    => t('Liberia'),
-      'www.google.com.ly' => t('Libya'),
-      'www.google.li'     => t('Liechtenstein'),
-      'www.google.lt'     => t('Lithuania'),
-      'www.google.lu'     => t('Luxembourg'),
-      'www.google.com'    => t('Macau'),
-      'www.google.com'    => t('Macedonia'),
-      'www.google.com'    => t('Madagascar'),
-      'www.google.mw'     => t('Malawi'),
-      'www.google.com.my' => t('Malaysia'),
-      'www.google.mv'     => t('Maldives'),
-      'www.google.com'    => t('Mali'),
-      'www.google.com.mt' => t('Malta'),
-      'www.google.com'    => t('Marshall Islands'),
-      'www.google.com'    => t('Martinique'),
-      'www.google.com'    => t('Mauritania'),
-      'www.google.mu'     => t('Mauritius'),
-      'www.google.com'    => t('Mayotte'),
-      'www.google.com.mx' => t('Mexico'),
-      'www.google.fm'     => t('Micronesia'),
-      'www.google.md'     => t('Moldova'),
-      'www.google.com'    => t('Monaco'),
-      'www.google.mn'     => t('Mongolia'),
-      'www.google.ms'     => t('Montserrat'),
-      'www.google.co.ma'  => t('Morocco'),
-      'www.google.com'    => t('Mozambique'),
-      'www.google.com'    => t('Myanmar'),
-      'www.google.com.na' => t('Namibia'),
-      'www.google.nr'     => t('Nauru'),
-      'www.google.com.np' => t('Nepal'),
-      'www.google.com'    => t('Netherlands Antilles'),
-      'www.google.com'    => t('New Caledonia'),
-      'www.google.co.nz'  => t('New Zealand'),
-      'www.google.com.ni' => t('Nicaragua'),
-      'www.google.com'    => t('Niger'),
-      'www.google.com.ng' => t('Nigeria'),
-      'www.google.nu'     => t('Niue'),
-      'www.google.com.nf' => t('Norfolk Island'),
-      'www.google.com'    => t('Northern Mariana Islands'),
-      'www.google.com'    => t('North Korea'),
-      'www.google.com.om' => t('Oman'),
-      'www.google.com.pk' => t('Pakistan'),
-      'www.google.com'    => t('Palau'),
-      'www.google.com'    => t('Palestinian Territory'),
-      'www.google.com.pa' => t('Panama'),
-      'www.google.com'    => t('Papua New Guinea'),
-      'www.google.com.py' => t('Paraguay'),
-      'www.google.com.pe' => t('Peru'),
-      'www.google.com.ph' => t('Philippines'),
-      'www.google.pn'     => t('Pitcairn'),
-      'www.google.pl'     => t('Poland'),
-      'www.google.com.pr' => t('Puerto Rico'),
-      'www.google.com.qa' => t('Qatar'),
-      'www.google.com'    => t('Reunion'),
-      'www.google.ro'     => t('Romania'),
-      'www.google.ru'     => t('Russian Federation'),
-      'www.google.rw'     => t('Rwanda'),
-      'www.google.com'    => t('Saint Kitts and Nevis'),
-      'www.google.com'    => t('Saint Lucia'),
-      'www.google.com.vc' => t('Saint Vincent and the Grenadines'),
-      'www.google.ws'     => t('Samoa'),
-      'www.google.sm'     => t('San Marino'),
-      'www.google.st'     => t('Sao Tome and Principe'),
-      'www.google.com.sa' => t('Saudi Arabia'),
-      'www.google.sn'     => t('Senegal'),
-      'www.google.com'    => t('Serbia and Montenegro'),
-      'www.google.sc'     => t('Seychelles'),
-      'www.google.com'    => t('Sierra Leone'),
-      'www.google.sk'     => t('Slovakia'),
-      'www.google.si'     => t('Slovenia'),
-      'www.google.com.sb' => t('Solomon Islands'),
-      'www.google.com'    => t('Somalia'),
-      'www.google.co.za'  => t('South Africa'),
-      'www.google.com'    => t('South Georgia and The South Sandwich Islands'),
-      'www.google.lk'     => t('Sri Lanka'),
-      'www.google.sh'     => t('St. Helena'),
-      'www.google.com'    => t('St. Pierre and Miquelon'),
-      'www.google.com'    => t('Sudan'),
-      'www.google.com'    => t('Suriname'),
-      'www.google.com'    => t('Svalbard and Jan Mayen Islands'),
-      'www.google.com'    => t('Swaziland'),
-      'www.google.com'    => t('Syria'),
-      'www.google.com.tj' => t('Tajikistan'),
-      'www.google.com'    => t('Tanzania'),
-      'www.google.co.th'  => t('Thailand'),
-      'www.google.com'    => t('Togo'),
-      'www.google.tk'     => t('Tokelau'),
-      'www.google.to'     => t('Tonga'),
-      'www.google.tt'     => t('Trinidad and Tobago'),
-      'www.google.com'    => t('Tunisia'),
-      'www.google.com.tr' => t('Turkey'),
-      'www.google.tm'     => t('Turkmenistan'),
-      'www.google.com'    => t('Turks and Caicos Islands'),
-      'www.google.com'    => t('Tuvalu'),
-      'www.google.co.ug'  => t('Uganda'),
-      'www.google.com.ua' => t('Ukraine'),
-      'www.google.ae'     => t('United Arab Emirates'),
-      'www.google.com'    => t('United States Minor Outlying Islands'),
-      'www.google.com.uy' => t('Uruguay'),
-      'www.google.co.uz'  => t('Uzbekistan'),
-      'www.google.vu'     => t('Vanuatu'),
-      'www.google.com'    => t('Vatican'),
-      'www.google.co.ve'  => t('Venezuela'),
-      'www.google.com.vn' => t('Viet Nam'),
-      'www.google.vg'     => t('Virgin Islands (British)'),
-      'www.google.co.vi'  => t('Virgin Islands (U.S.)'),
-      'www.google.com'    => t('Wallis and Futuna Islands'),
-      'www.google.com'    => t('Western Sahara'),
-      'www.google.com'    => t('Yemen'),
-      'www.google.co.zm'  => t('Zambia'),
-      'www.google.co.zw'  => t('Zimbabwe'),
-      'www.google.com'    => t('United States'),
-    )
-  );
-
-  $form['search']['box'][ADSENSE_SEARCH_LANGUAGE] = array(
-    '#type' => 'select',
-    '#title' => t('Site Language'),
-    '#default_value' => variable_get(ADSENSE_SEARCH_LANGUAGE, 'en'),
-    '#options' => array(
-      'ar'    => t('Arabic'),
-      'bg'    => t('Bulgarian'),
-      'zh-CN' => t('Chinese (simplified)'),
-      'zh-TW' => t('Chinese (traditional)'),
-      'hr'    => t('Croatian'),
-      'cs'    => t('Czech'),
-      'da'    => t('Danish'),
-      'nl'    => t('Dutch'),
-      'en'    => t('English'),
-      'fi'    => t('Finnish'),
-      'fr'    => t('French'),
-      'de'    => t('German'),
-      'el'    => t('Greek'),
-      'iw'    => t('Hebrew'),
-      'hu'    => t('Hungarian'),
-      'in'    => t('Indonesian'),
-      'it'    => t('Italian'),
-      'ja'    => t('Japanese'),
-      'ko'    => t('Korean'),
-      'no'    => t('Norwegian'),
-      'pl'    => t('Polish'),
-      'pt'    => t('Portuguese'),
-      'ro'    => t('Romanian'),
-      'ru'    => t('Russian'),
-      'sk'    => t('Slovak'),
-      'es'    => t('Spanish'),
-      'sv'    => t('Swedish'),
-      'tr'    => t('Turkish')
-    )
-  );
-
-  $form['search']['box'][ADSENSE_SEARCH_ENCODING] = array(
-    '#type' => 'select',
-    '#title' => t('Site Encoding'),
-    '#default_value' => variable_get(ADSENSE_SEARCH_ENCODING, 'UTF-8'),
-    '#options' => array(
-      'ISO-8859-1'   =>  t('West European Latin-1 (ISO-8859-1)'),
-      'ISO-8859-15'  =>  t('West European Latin-9 (ISO-8859-15)'),
-      'windows-1252' =>  t('Western (Windows-1252)'),
-      'ISO-8859-10'  =>  t('Nordic Latin-6 (ISO-8859-10)'),
-      'ISO-8859-7'   =>  t('Greek (ISO-8859-7)'),
-      'Shift_JIS'    =>  t('Japanese (Shift_JIS)'),
-      'EUC-JP'       =>  t('Japanese (EUC-JP)'),
-      'ISO-2022-JP'  =>  t('Japanese (ISO-2022-JP)'),
-      'GB2312'       =>  t('Chinese Simplified (GB2312)'),
-      'GB18030'      =>  t('Chinese Simplified (GB18030)'),
-      'big5'         =>  t('Chinese Traditional (Big5)'),
-      'EUC-KR'       =>  t('Korean (EUC-KR)'),
-      'windows-874'  =>  t('Thai (Windows-874)'),
-      'windows-1258' =>  t('Vietnamese (Windows-1258)'),
-      'ISO-8859-2'   =>  t('Central European Latin-2 (ISO-8859-2)'),
-      'windows-1250' =>  t('Central European (Windows-1250)'),
-      'cp852'        =>  t('Central European (CP852)'),
-      'ISO-8859-9'   =>  t('Turkish Latin-5 (ISO-8859-9)'),
-      'windows-1254' =>  t('Turkish (Windows-1254)'),
-      'ISO-8859-3'   =>  t('South European Latin-3 (ISO-8859-3)'),
-      'ISO-8859-8-I' =>  t('Hebrew (ISO-8859-8-I)'),
-      'windows-1255' =>  t('Hebrew (Windows-1255)'),
-      'windows-1256' =>  t('Arabic (Windows-1256)'),
-      'ISO-8859-5'   =>  t('Cyrillic (ISO-8859-5)'),
-      'KOI8-R'       =>  t('Cyrillic (KOI8-R)'),
-      'windows-1251' =>  t('Cyrillic (Windows-1251)'),
-      'cp-866'       =>  t('Cyrillic/Russian (CP-866)'),
-      'UTF-8'        =>  t('Unicode (UTF-8)')
-    )
-  );
-
-  $textbox_length = $textbox_length > 64 ? 64 : variable_get(ADSENSE_SEARCH_TEXTBOX_LENGTH, 15);
-  $form['search']['box'][ADSENSE_SEARCH_TEXTBOX_LENGTH] = array(
-    '#type' => 'textfield',
-    '#title' => t('Length of text box (Max 64): '),
-    '#default_value' => $textbox_length,
-    '#size' => 2,
-    '#maxlength' => 2
-  );
-
-  $form['search']['result'][ADSENSE_SEARCH_FRAME_WIDTH] = array(
-    '#type' => 'textfield',
-    '#title' => t('Width of results area'),
-    '#default_value' => variable_get(ADSENSE_SEARCH_FRAME_WIDTH, 500),
-    '#size' => 3,
-    '#maxlength' => 3
-  );
-  $form['advanced'] = array(
-    '#type' => 'fieldset',
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-    '#title' => t('Advanced options'),
-  );
-
-  $form['advanced'][ADSENSE_TEST_MODE] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Enable test mode?'),
-    '#return_value' => 1,
-    '#default_value' => variable_get(ADSENSE_TEST_MODE, 0),
-    '#description' => t('This enables you to test the AdSense module settings. This can be useful in some situations: for example, testing whether revenue sharing is working properly or not without having to display real ads on your site. It is best to test this after you log out.'),
-  );
-
-  $form['advanced'][ADSENSE_DISABLE] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Disable Google AdSense ads?'),
-    '#return_value' => 1,
-    '#default_value' => variable_get(ADSENSE_DISABLE, 0),
-    '#description' => t('This disables all display of Google AdSense ads from your web site. This is useful in certain situations, such as site upgrades, or if you make a copy of the site for development and test purposes.'),
-  );
-
-  $form['advanced'][ADSENSE_PLACEHOLDER] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Placeholder when ads are disabled?'),
-    '#return_value' => 1,
-    '#default_value' => variable_get(ADSENSE_PLACEHOLDER, 1),
-    '#description' => t('This causes an empty box to be displayed in place of the ads when they are disabled.'),
-  );
-
-  $form['advanced'][ADSENSE_PLACEHOLDER_TEXT] = array(
-    '#type' => 'textarea',
-    '#title' => t('Placeholder text to display'),
-    '#default_value' => variable_get(ADSENSE_PLACEHOLDER_TEXT, t('Google AdSense')),
-    '#cols' => 70,
-    '#rows' => 3,
-    '#description' => t('Enter any text to display as a placeholder when ads are disabled.'),
-  );
-
-  $form['advanced'][ADSENSE_SECTION_TARGETING] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Enable AdSense section targeting?'),
-    '#return_value' => 1,
-    '#default_value' => variable_get(ADSENSE_SECTION_TARGETING, 1),
-    '#description' => t('This better targets Google ads to the teaser and body of nodes.'),
-  );
-
-
-  return system_settings_form($form);
-}
-
 function adsense_display($format = '160x600', $group = 1, $channel = 1, $slot = '', $referral = 0, $cpa = '') {
   if (!_adsense_validate_dimensions($format)) {
     $ad = '<!--adsense: invalid format: '. $format .'-->';
@@ -1018,7 +261,7 @@ function _adsense_get_ad($format, $group
     $ad = _adsense_format($format, $group, $channel, $slot, $referral, $cpa);
 
     // Add it to cache
-    cache_set($cache_key, 'cache', $ad, CACHE_PERMANENT);
+    cache_set($cache_key, $ad);
   }
 
   return $ad;
@@ -1175,7 +418,7 @@ function _adsense_format($format, $group
   }
   $output .= _adsense_add_nl('google_ad_type = "'. $type    .'";');
   $output .= _adsense_add_nl('google_ad_channel = "'. $channel .'";');
-  
+
   $output .= _adsense_add_nl('google_ad_format = "'. $format  .'";');
   $output .= _adsense_add_nl('google_color_border = "'. $border  .'";');
   $output .= _adsense_add_nl('google_color_bg = "'. $bg      .'";');
@@ -1183,12 +426,12 @@ function _adsense_format($format, $group
   $output .= _adsense_add_nl('google_color_url = "'. $url     .'";');
   $output .= _adsense_add_nl('google_color_text = "'. $text    .'";');
   }
-  
+
   $output .= _adsense_add_nl('google_ad_width = '. $width   .';');
   $output .= _adsense_add_nl('google_ad_height = '. $height  .';');
   // Only add the CPA for a Referral Ad. As of 2/26/08, it is needed even if it's empty.
-  if ($referral) { 
-     $output .= _adsense_add_nl('google_cpa_choice = "'. $cpa .'";');  
+  if ($referral) {
+    $output .= _adsense_add_nl('google_cpa_choice = "'. $cpa .'";');
   }
   $output .= _adsense_add_nl('//--></script>');
   $output .= _adsense_add_nl('<script type="text/javascript"');
@@ -1315,7 +558,7 @@ function _adsense_process_tags($text) {
     'block' => '/\[adsense:block:(\d+)\]/x',
     'tags'  => '/\[adsense:([^:]+):(\d*):(\d*):?(\w*)\]/x',
     'refer' => '/\[adsense:referral:(\w+):(\d*):(\d*):(\w*):([\w-]*)\]/x'
- );
+  );
 
   foreach ($patterns as $mode => $pattern) {
     if (preg_match_all($pattern, $text, $matches, PREG_SET_ORDER)) {
@@ -1433,7 +676,7 @@ function adsense_block($op = 'list', $de
         '#maxlength' => 64,
       );
 
-     $form['ad_referral'] = array(
+      $form['ad_referral'] = array(
         '#title' => t('Referral'),
         '#type' => 'radios',
          '#default_value' => ($ad) ? $ad[4] : 0,
@@ -1441,7 +684,7 @@ function adsense_block($op = 'list', $de
          '#description'   => t('If your ad ID is of the referral type, you must select \'Yes\'.'),
       );
 
-    $form['ad_cpa'] = array(
+      $form['ad_cpa'] = array(
         '#type' => 'textfield',
         '#title' => t('CPA Choice'),
          '#default_value' => ($ad) ? $ad[5] : t(''),
@@ -1560,92 +803,8 @@ function adsense_counter() {
   if (variable_get(ADSENSE_CLICK_TRACKING, 0)) {
     $path = $_GET['u'];
     db_query("INSERT INTO {adsense_clicks} (ip, timestamp, path) values('%s', %d, '%s')",
-      $_SERVER['REMOTE_ADDR'], time(), $path);
-  }
-}
-
-/**
- * Menu callback; presents the "AdSense" log page.
- */
-function adsense_click_log() {
-  $header = array(
-    array('data' => t('Timestamp'), 'field' => 'timestamp', 'sort' => 'desc'),
-    array('data' => t('Path'),      'field' => 'path'),
-    array('data' => t('IP/host'),   'field' => 'ip'),
-  );
-
-  $name_resolve = variable_get(ADSENSE_CLICK_TRACKING_NAME_RESOLVE, 0);
-
-  $sql = 'SELECT * FROM {adsense_clicks} '. tablesort_sql($header);
-
-  $result = pager_query($sql, 50);
-  while ($log = db_fetch_object($result)) {
-    if ($name_resolve) {
-      $host = gethostbyaddr($log->ip);
-    }
-    else {
-      $host = $log->ip;
-    }
-
-    $rows[] = array(
-      array('data' => format_date($log->timestamp, 'small'), 'nowrap' => 'nowrap'),
-      _adsense_format_path($log->path),
-      l($host, 'http://whois.domaintools.com/'. $log->ip),
-    );
+      ip_address(), time(), $path);
   }
-
-  return theme('table', $header, $rows) . theme('pager', NULL, 50, 0);
-}
-
-function adsense_click_top_pages() {
-  $header = array(
-    array('data' => t('Path'),   'field' => 'path'),
-    array('data' => t('Clicks'), 'field' => 'count', 'sort' => 'desc'),
-    array('data' => t('Last'),   'field' => 'last'),
-  );
-
-  $sql = 'SELECT path, COUNT(*) AS count, MAX(timestamp) AS last FROM {adsense_clicks} GROUP BY path'. tablesort_sql($header);
-
-  $result = pager_query($sql, 50);
-  while ($log = db_fetch_object($result)) {
-    $rows[] = array(
-      array('data' => _adsense_format_path($log->path)),
-      array('data' => $log->count, 'align' => 'right'),
-      array('data' => format_date($log->last, 'small'), 'nowrap' => 'nowrap'),
-    );
-  }
-
-  return theme('table', $header, $rows) . theme('pager', NULL, 50, 0);
-}
-
-function adsense_click_by_day() {
-  global $db_type;
-  $header = array(
-    array('data' => t('Day'),    'field' => 'day', 'sort' => 'desc'),
-    array('data' => t('Clicks'), 'field' => 'count'),
-  );
-
-  switch ($db_type) {
-    case 'mysql':
-    case 'mysqli':
-      $sql_count = "SELECT COUNT(DISTINCT(FROM_UNIXTIME(timestamp, '%y-%m-%%d'))) FROM {adsense_clicks}";
-      $sql = "SELECT FROM_UNIXTIME(timestamp, '%Y-%m-%%d') AS day, COUNT(*) AS count FROM {adsense_clicks} GROUP BY day" .  tablesort_sql($header);
-      break;
-    case 'pgsql':
-      $sql_count = "SELECT COUNT(DISTINCT(TO_CHAR(timestamp, 'YYYY-MM-DD'))) FROM {adsense_clicks}";
-      $sql = "SELECT TO_CHAR(timestamp, 'YYYY-MM-DD') AS day, COUNT(*) AS count FROM {adsense_clicks} GROUP BY day" .  tablesort_sql($header);
-      break;
-  }
-
-  $result = pager_query($sql, 50, 0, $sql_count);
-  while ($log = db_fetch_object($result)) {
-    $rows[] = array(
-      $log->day,
-      array('data' => $log->count, 'align' => 'right'),
-    );
-  }
-
-  return theme('table', $header, $rows) . theme('pager', NULL, 50, 0);
 }
 
 // Adsense search functions
@@ -1805,16 +964,16 @@ function adsense_search($op = 'search', 
 
     case 'search':
       // Log the search keys:
-      watchdog('AdSense', t('Keyword') .': <em>'. urldecode($_GET['as_q']) .'</em>', WATCHDOG_NOTICE, 'AdSense for Search');
+      watchdog('AdSense', 'Keyword: <em>'. urldecode($_GET['as_q']) .'</em>', WATCHDOG_NOTICE, 'AdSense for Search');
 
       // Output search results
       $width   = variable_get(ADSENSE_SEARCH_FRAME_WIDTH, '500');
       $domain  = variable_get(ADSENSE_SEARCH_DOMAIN .'_0', $base_url);
       $country = variable_get(ADSENSE_SEARCH_COUNTRY, 'www.google.com');
-    
+
       $output .= _adsense_add_nl(ADSENSE_SEARCH_RESULT_START);
       $output .= _adsense_add_nl('<div id="googleSearchUnitIframe"></div>');
-    
+
       $output .= _adsense_add_nl('<script type="text/javascript">');
       $output .= _adsense_add_nl('  var googleSearchIframeName = \'googleSearchUnitIframe\';');
       $output .= _adsense_add_nl('  var googleSearchFrameWidth = '. $width .';');
Index: adsense_basic.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/adsense_basic.info,v
retrieving revision 1.1
diff -u -p -r1.1 adsense_basic.info
--- adsense_basic.info	10 Feb 2008 01:24:19 -0000	1.1
+++ adsense_basic.info	4 Apr 2008 07:41:18 -0000
@@ -1,7 +1,9 @@
 ; $Id: adsense_basic.info,v 1.1 2008/02/10 01:24:19 kbahey Exp $
 ; Copyright 2005-2008 Khalid Baheyeldin http://2bits.com
 
-name = Adsense basic
+name = Adsense Basic
 description = Configuration for Adsense for a basic single owner site, with no revenue sharing.
-dependencies = adsense
+dependencies[] = adsense
 package = Adsense
+version = 6.x-1.x-dev
+core = 6.x
Index: adsense_basic.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/adsense_basic.install,v
retrieving revision 1.1
diff -u -p -r1.1 adsense_basic.install
--- adsense_basic.install	10 Feb 2008 01:24:19 -0000	1.1
+++ adsense_basic.install	4 Apr 2008 07:41:18 -0000
@@ -1,12 +1,12 @@
-<?php
-// $Id: adsense_basic.install,v 1.1 2008/02/10 01:24:19 kbahey Exp $
-//
-// Copyright 2005-2008 Khalid Baheyeldin http://2bits.com
-
-/**
- * Implementation of hook_uninstall().
- */
-function adsense_basic_uninstall() {
-  db_query("DELETE FROM {variable} WHERE name LIKE 'adsense_basic_%'");
-}
-
+<?php
+// $Id: adsense_basic.install,v 1.1 2008/02/10 01:24:19 kbahey Exp $
+//
+// Copyright 2005-2008 Khalid Baheyeldin http://2bits.com
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function adsense_basic_uninstall() {
+  db_query("DELETE FROM {variable} WHERE name LIKE 'adsense_basic_%'");
+}
+
Index: adsense_basic.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/adsense_basic.module,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 adsense_basic.module
--- adsense_basic.module	1 Apr 2008 02:28:27 -0000	1.1.2.2
+++ adsense_basic.module	4 Apr 2008 07:41:18 -0000
@@ -29,7 +29,7 @@ function adsense_basic_settings() {
   // We only load the help text if we are in settings, to save memory
   $module = 'adsense_basic';
   include_once(drupal_get_path('module', $module) .'/'. $module .'_help.inc');
-  
+
   $function = $module .'_adsense';
   $error_flag = $function('status');
 
@@ -39,7 +39,7 @@ function adsense_basic_settings() {
     '#collapsed'   => TRUE,
     '#title'       => t('Help and instructions'),
   );
-  
+
   $help_function = $module .'_help_text';
   $form['help']['help'] = array(
     '#type'  => 'markup',
Index: adsense_basic_help.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/adsense_basic_help.inc,v
retrieving revision 1.1
diff -u -p -r1.1 adsense_basic_help.inc
--- adsense_basic_help.inc	10 Feb 2008 01:24:19 -0000	1.1
+++ adsense_basic_help.inc	4 Apr 2008 07:41:18 -0000
@@ -7,19 +7,19 @@ function adsense_basic_help_text() {
   $referral_link = 'http://baheyeldin.com/click/476/1';
 
   $output = <<<EOF
-<H2>Overview</H2>
-<P>This module provides a simple way of selecting the Adsense Client ID for a single owner site 
-that does not need revenue sharing.</P>
+<h2>Overview</h2>
+<p>This module provides a simple way of selecting the Adsense Client ID for a single owner site
+that does not need revenue sharing.</p>
 
-<H2>Prerequisites</H2>
-<P>You must have a Google AdSense account before using this module.  If you do not have an account,
-then please consider using <A HREF="$referral_link">the modules author's referral link</A>, which
+<h2>Prerequisites</h2>
+<p>You must have a Google AdSense account before using this module.  If you do not have an account,
+then please consider using <a href="$referral_link">the modules author's referral link</a>, which
 provides us with a referral fee from Google at absolutely no cost to you. This page also contains
-various useful links and resources on AdSense, and how to optimize your site for it.</P>
+various useful links and resources on AdSense, and how to optimize your site for it.</p>
 
-<H2>Configuration</H2>
-<P>To use this module, simply enter your Google Adsense Client ID in the text field, and click 
-the 'Save configuration' button.</P>
+<h2>Configuration</h2>
+<p>To use this module, simply enter your Google Adsense Client ID in the text field, and click
+the 'Save configuration' button.</p>
 EOF;
   return $output;
 }
Index: adsense_click.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/adsense_click.js,v
retrieving revision 1.3
diff -u -p -r1.3 adsense_click.js
--- adsense_click.js	25 Dec 2006 19:44:51 -0000	1.3
+++ adsense_click.js	4 Apr 2008 07:41:18 -0000
@@ -1,28 +1,28 @@
-/* $Id */
-
-/**
- * adsense_click.js - fires counter to log adsense clicks
- */
-var lastStatus = '';
-function aslog(e) {
-  window.focus();
-  if (window.status && (window.status!=lastStatus)) {
-    lastStatus = window.status;
-    var bug = new Image();
-    bug.src = window.location.protocol + '//' + window.location.host + '/adsense/counter' + '?u=' + escape(document.location);
-  }
-}
-
-var iframeObj;
-var elements;
-elements = document.getElementsByTagName("iframe");
-for (var i = 0; i < elements.length; i++) {
-  if(elements[i].src.indexOf('googlesyndication.com') > -1) {
-    if (document.layers) {
-      elements[i].captureEvents(Events.ONFOCUS);
-    }
-    elements[i].onfocus = aslog;
-    iframeObj = elements[i];
-  }
-}
-
+/* $Id */
+
+/**
+ * adsense_click.js - fires counter to log adsense clicks
+ */
+var lastStatus = '';
+function aslog(e) {
+  window.focus();
+  if (window.status && (window.status!=lastStatus)) {
+    lastStatus = window.status;
+    var bug = new Image();
+    bug.src = window.location.protocol + '//' + window.location.host + '/adsense/counter' + '?u=' + escape(document.location);
+  }
+}
+
+var iframeObj;
+var elements;
+elements = document.getElementsByTagName("iframe");
+for (var i = 0; i < elements.length; i++) {
+  if(elements[i].src.indexOf('googlesyndication.com') > -1) {
+    if (document.layers) {
+      elements[i].captureEvents(Events.ONFOCUS);
+    }
+    elements[i].onfocus = aslog;
+    iframeObj = elements[i];
+  }
+}
+
Index: adsense_help.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/adsense_help.inc,v
retrieving revision 1.10.2.3
diff -u -p -r1.10.2.3 adsense_help.inc
--- adsense_help.inc	31 Mar 2008 22:03:53 -0000	1.10.2.3
+++ adsense_help.inc	4 Apr 2008 07:41:19 -0000
@@ -20,189 +20,189 @@ function adsense_help_text() {
   $referral_link = 'http://baheyeldin.com/click/476/1';
 
   $output = <<<EOF
-<H2>Overview</H2>
-<P>This module provides web site admins the factility to display Google AdSense ads on their web site,
-thus earning revenue.</P>
-
-<H2>Prerequisites</H2>
-<P>You must have a Google AdSense account before using this module.  If you do not have an account,
-then please consider using <A HREF="$referral_link">the modules author's referral
-link</A>, which provides us with a referral fee from Google at absolutely no cost to you. This page
-also contains various useful links and resources on AdSense, and how to optimize your site for it.</P>
-
-<H2>Configuration</H2>
-<P>To use this module, you need to select one of the Adsense Client ID selection modules first, and configure
-it correctly. See below for a list of available modules, and their settings page.</P>
+<h2>Overview</h2>
+<p>This module provides web site admins the factility to display Google AdSense ads on their web site,
+thus earning revenue.</p>
+
+<h2>Prerequisites</h2>
+<p>You must have a Google AdSense account before using this module.  If you do not have an account,
+then please consider using <a href="$referral_link">the modules author's referral
+link</a>, which provides us with a referral fee from Google at absolutely no cost to you. This page
+also contains various useful links and resources on AdSense, and how to optimize your site for it.</p>
+
+<h2>Configuration</h2>
+<p>To use this module, you need to select one of the Adsense Client ID selection modules first, and configure
+it correctly. See below for a list of available modules, and their settings page.</p>
 
-<H2>Supported formats</H2>
-<P>Most of Adsense's ad formats are supported.</P>
+<h2>Supported formats</h2>
+<p>Most of Adsense's ad formats are supported.</p>
 $ad_formats_text
 
-<H2>Displaying AdSense ads</H2>
-<P>There are several ways to display ads, summarized as follows:</P>
-<P>Ads can be displayed in pre-defined blocks, in custom blocks, in content or in any phptemplate based theme.</P>
-
-<H3>Using blocks</H3>
-<P>The easiest way to get started with this module is to use one or more of the pre-defined blocks.</P>
-<P>Visit the <A HREF="/admin/build/block">blocks</A> configuration page, and click on the <STRONG>configure</STRONG>
-link of one of the AdSense blocks. You must select a format, a group, and a channel.</P>
-<P>Enable the block, and specify a region for it to be displayed in.</P>
-
-<H3>Using custom PHP code</H3>
-<P>To display ads, you call the function adsense_display() and supply
-it with the following arguments.</P>
-<UL>
-  <LI>Format: This is a string of two numbers with an &quot;x&quot; in between. It can be any valid
-  combination from the list provided above. If not specified, then 160x600 is assumed. 
-  <LI>Group: This is the group that denotes the type (text or image) and color of the ad. This can be 1,
-  2 or 3. If not specified, then 1 is assumed. 
-  <LI>Channel: This is the Custom Channel for the ad, as configured in AdSense. This is an optional parameter
-  and if not specified, then 1 is assumed. If you did not configure any channels, then leave this parameter out. 
-</UL>
-<P>To display ads in blocks, add a new block, make its type &quot;PHP&quot;, and enclose it in PHP tags.</P>
-<PRE>
-<CODE>print adsense_display('120x600', 1, 2);</CODE></PRE><P>
+<h2>Displaying AdSense ads</h2>
+<p>There are several ways to display ads, summarized as follows:</p>
+<p>Ads can be displayed in pre-defined blocks, in custom blocks, in content or in any phptemplate based theme.</p>
+
+<h3>Using blocks</h3>
+<p>The easiest way to get started with this module is to use one or more of the pre-defined blocks.</p>
+<p>Visit the <a href="/admin/build/block">blocks</a> configuration page, and click on the <strong>configure</strong>
+link of one of the AdSense blocks. You must select a format, a group, and a channel.</p>
+<p>Enable the block, and specify a region for it to be displayed in.</p>
+
+<h3>Using custom PHP code</h3>
+<p>To display ads, you call the function adsense_display() and supply
+it with the following arguments.</p>
+<ul>
+  <li>Format: This is a string of two numbers with an &quot;x&quot; in between. It can be any valid
+  combination from the list provided above. If not specified, then 160x600 is assumed.
+  <li>Group: This is the group that denotes the type (text or image) and color of the ad. This can be 1,
+  2 or 3. If not specified, then 1 is assumed.
+  <li>Channel: This is the Custom Channel for the ad, as configured in AdSense. This is an optional parameter
+  and if not specified, then 1 is assumed. If you did not configure any channels, then leave this parameter out.
+</ul>
+<p>To display ads in blocks, add a new block, make its type &quot;PHP&quot;, and enclose it in PHP tags.</p>
+<pre>
+<code>print adsense_display('120x600', 1, 2);</code></pre><p>
 If you want to make sure that you do not get errors if the AdSense module is accidentally disabled or deleted, then
-use the longer form:</P>
-<PRE>
-<CODE>if (module_exists('adsense')) {</CODE>
-<CODE>  print adsense_display('120x600', 2, 4);</CODE>
-<CODE>}</CODE>
-</PRE>
-
-<H3>Using themes</H3>
-<P>You must use a phptemplate-based theme to display ads from within the theme. This requires some familiarity
-with PHP. Edit the appropriate <STRONG>.tpl.php</STRONG> file in your theme directory,
-and add:</P>
-<PRE>
-<CODE>print adsense_display('468x60');</CODE>
-</PRE>
-<P>Make sure you enclose it in PHP tags.</P>
-<P>You could also use the longer format that protects you against deleting or disabling the module:</P>
-<PRE>
-<CODE>if (module_exists('adsense')) {</CODE>
-<CODE>  print adsense_display('120x600', 2, 4);</CODE>
-<CODE>}</CODE>
-</PRE>
+use the longer form:</p>
+<pre>
+<code>if (module_exists('adsense')) {</code>
+<code>  print adsense_display('120x600', 2, 4);</code>
+<code>}</code>
+</pre>
+
+<h3>Using themes</h3>
+<p>You must use a phptemplate-based theme to display ads from within the theme. This requires some familiarity
+with PHP. Edit the appropriate <strong>.tpl.php</strong> file in your theme directory,
+and add:</p>
+<pre>
+<code>print adsense_display('468x60');</code>
+</pre>
+<p>Make sure you enclose it in PHP tags.</p>
+<p>You could also use the longer format that protects you against deleting or disabling the module:</p>
+<pre>
+<code>if (module_exists('adsense')) {</code>
+<code>  print adsense_display('120x600', 2, 4);</code>
+<code>}</code>
+</pre>
 
-<H3>Using tags</H3>
-<P>The tags feature allows placement of ads anywhere in the content.  Please note that content here means any
+<h3>Using tags</h3>
+<p>The tags feature allows placement of ads anywhere in the content.  Please note that content here means any
 part that is passed through Drupal's filter system. Text in the slogan, mission, and footer is normally not
-filtered the same way as text in nodes, so you cannot put tags in those places.</P>
-<P>To enable the tags feature, you have to enable the &quot;AdSense tag&quot; filter in the input format you
+filtered the same way as text in nodes, so you cannot put tags in those places.</p>
+<p>To enable the tags feature, you have to enable the &quot;AdSense tag&quot; filter in the input format you
 are using (such as Full HTML or Filtered HTML) from Administer -&gt; Site configuration -&gt; Input formats.
-Then you have to insert the appropriate tag in your node where you would like the ad to appear.</P>
-<P>Note that filters sometimes may have conflicts, and changing the order can make AdSense work in some cases.</P>
-<P>The tag syntax comes in these variants:</P>
-<DL>
-  <DT>1. [adsense:<EM>format:group:channel:slot</EM>]</DT>
-</DL>
-<P>Where:</P>
-<UL>
-  <LI>format: One of the supported ad formats (such as 468x60). (required)
-  <LI>group: A number corresponding to the ad group this ad belongs to, determines colors.
-  <LI>channel: A number corresponding to the ad channel.
-        <LI>slot: Your ad's slot ID as provided by Google.
-</UL>
-<P>Example:</P>
-<PRE>[adsense:468x60:1:2:0123456789]</PRE><P>
-Display a 468x60 banner with the colors defined in group 1, channel ID 2 and with slot ID 0123456789.</P>
-<DL>
-  <DT>2. [adsense:block:<EM>block_id</EM>]</DT>
-</DL>
-<P>Where:</P>
-<UL>
-  <LI>block_id: The block ID of a custom block with input format of PHP with a call to the adsense_display() function. (required)
-</UL>
-<P>This allows more fine grained visibility control via the block mechanism. The block does not need to be
+Then you have to insert the appropriate tag in your node where you would like the ad to appear.</p>
+<p>Note that filters sometimes may have conflicts, and changing the order can make AdSense work in some cases.</p>
+<p>The tag syntax comes in these variants:</p>
+<dl>
+  <dt>1. [adsense:<em>format:group:channel:slot</em>]</dt>
+</dl>
+<p>Where:</p>
+<ul>
+  <li>format: One of the supported ad formats (such as 468x60). (required)
+  <li>group: A number corresponding to the ad group this ad belongs to, determines colors.
+  <li>channel: A number corresponding to the ad channel.
+        <li>slot: Your ad's slot ID as provided by Google.
+</ul>
+<p>Example:</p>
+<pre>[adsense:468x60:1:2:0123456789]</pre><p>
+Display a 468x60 banner with the colors defined in group 1, channel ID 2 and with slot ID 0123456789.</p>
+<dl>
+  <dt>2. [adsense:block:<em>block_id</em>]</dt>
+</dl>
+<p>Where:</p>
+<ul>
+  <li>block_id: The block ID of a custom block with input format of PHP with a call to the adsense_display() function. (required)
+</ul>
+<p>This allows more fine grained visibility control via the block mechanism. The block does not need to be
 enabled, and therefore will be hidden from the sidebars and other regions. The title of the block will not be
-displayed.</P>
-<P>Example:</P>
-<PRE>[adsense:block:7]</PRE>
-<P>Display the ad code of the block with ID 7.</P>
-<DL>
-  <DT>3. [adsense:referral:<EM>format:group:channel:slot:CPA</EM>]</DT>
-</DL>
-<P>Where:</P>
-<UL>
-  <LI>format: One of the supported ad formats (such as 468x60). (required)
-  <LI>group: A number corresponding to the ad group this ad belongs to, determines colors.
-  <LI>channel: A number corresponding to the ad channel.
-        <LI>slot: Your ad's slot ID as provided by Google.
-        <LI>CPA: Your referral link CPA value.
-</UL>
-<P>Example:</P>
-<PRE>[adsense:referral:468x60:1:2:0123456789:CAAxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]</PRE><P>
+displayed.</p>
+<p>Example:</p>
+<pre>[adsense:block:7]</pre>
+<p>Display the ad code of the block with ID 7.</p>
+<dl>
+  <dt>3. [adsense:referral:<em>format:group:channel:slot:CPA</em>]</dt>
+</dl>
+<p>Where:</p>
+<ul>
+  <li>format: One of the supported ad formats (such as 468x60). (required)
+  <li>group: A number corresponding to the ad group this ad belongs to, determines colors.
+  <li>channel: A number corresponding to the ad channel.
+        <li>slot: Your ad's slot ID as provided by Google.
+        <li>CPA: Your referral link CPA value.
+</ul>
+<p>Example:</p>
+<pre>[adsense:referral:468x60:1:2:0123456789:CAAxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]</pre><p>
 Display a 468x60 banner with the colors defined in group 1, channel ID 2, slot ID 0123456789
-and with CPA value CAAxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.</P>
-<DL>
-  <DT>4. [adsense:flexiblock:<EM>location</EM>]</DT>
-</DL>
-<P>
+and with CPA value CAAxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.</p>
+<dl>
+  <dt>4. [adsense:flexiblock:<em>location</em>]</dt>
+</dl>
+<p>
 This is provided for backward compatibility, but will be deprecated
-in a future release. Use the normal block filter instead.</P>
-<P>Where:</P>
-<UL>
-  <LI>location: A number corresponding to a location in flexiblock that contains only one block with
+in a future release. Use the normal block filter instead.</p>
+<p>Where:</p>
+<ul>
+  <li>location: A number corresponding to a location in flexiblock that contains only one block with
   the call to the adsense_display() function. This allows visibility control via the block mechanism.
   flexiblock must be installed and configured. The title of the flexiblock will not be displayed. (required)
-</UL>
-<P>Example:</P>
-<PRE>[adsense:flexiblock:2]</PRE><P>
-Display the contents of the flexiblock in location 2</P>
+</ul>
+<p>Example:</p>
+<pre>[adsense:flexiblock:2]</pre><p>
+Display the contents of the flexiblock in location 2</p>
 
-<H2>AdSense clicks</H2>
-<P>AdSense clicks are now tracked, and the IP address and timestamp are recorded for each click.
+<h2>AdSense clicks</h2>
+<p>AdSense clicks are now tracked, and the IP address and timestamp are recorded for each click.
 This should help with fraud detection.  There are three reports under Administer -&gt; Logs: the
 default one shows click details, &quot;By date&quot; shows the number of clicks per day by day,
 and &quot;Top pages&quot; shows the top pages of a site that get clicks, the total number of clicks
-it got, and the last click date/time.</P>
-<P>Note that there are some potential limitations with click tracking:</P>
-<UL>
-  <LI>The javascript code does not work in Firefox, and perhaps Opera. Patches to make it work on Firefox
-  would be appreciated. 
-  <LI>Google throws out what it sees as invalid clicks. 
-  <LI>There is a lag of 15 to 20 minutes before Google records the click. 
-  <LI>When using AdLinks, the click on the link is recorded but any subsequent click on links is not recorded
-  (since it is not actually on your site anymore). 
-</UL>
-
-<H2>Hints and Tips</H2>
-  <P>This section has a collection of tips and hints. Please read it before submitting support requests.
-  Also, if you find a useful hint or tip relating to using this module, consider submitting a patch to 
-  the adsense_help.inc file so the community would benefit from it.</P>
+it got, and the last click date/time.</p>
+<p>Note that there are some potential limitations with click tracking:</p>
+<ul>
+  <li>The javascript code does not work in Firefox, and perhaps Opera. Patches to make it work on Firefox
+  would be appreciated.
+  <li>Google throws out what it sees as invalid clicks.
+  <li>There is a lag of 15 to 20 minutes before Google records the click.
+  <li>When using AdLinks, the click on the link is recorded but any subsequent click on links is not recorded
+  (since it is not actually on your site anymore).
+</ul>
+
+<h2>Hints and Tips</h2>
+  <p>This section has a collection of tips and hints. Please read it before submitting support requests.
+  Also, if you find a useful hint or tip relating to using this module, consider submitting a patch to
+  the adsense_help.inc file so the community would benefit from it.</p>
 
-  <H3>Visibility of Ads</H3>
-  <P>The site administrator will not see ads displayed as long as they are logged in. This is by design, in
+  <h3>Visibility of Ads</h3>
+  <p>The site administrator will not see ads displayed as long as they are logged in. This is by design, in
   order not to skew the page views, and not to accidentally click on ads (against Google's policy). Log out
-  to see the ads.</P>
+  to see the ads.</p>
 
-  <P>You can use the advanced options to disable ads and configure a placeholder when you are developing or
-  theming to know where the ads will appear.</P>
+  <p>You can use the advanced options to disable ads and configure a placeholder when you are developing or
+  theming to know where the ads will appear.</p>
 
-  <P>Also, the test mode for ads would help with showing what parameters are used for an ad.</P>
+  <p>Also, the test mode for ads would help with showing what parameters are used for an ad.</p>
 
-  <H3>Ads not showing</H3>
-  <P>If ads are not displayed, that could be caused by several things:</P>
-  <UL>
-    <LI>You are logged in as the site administrator. Log off to see the ads. 
-    <LI>Your site is still new and Google has not indexed it yet. 
-    <LI>Your site has been blacklisted by Google.
-    <LI>The maximum number of ad units has already been displayed. Your page does not have enough content
-    to display more than one or two units. 
-    <LI>Check the page source for comments like this: &lt;!--adsense: ???--&gt;. These give hints to what
-    is going on, and if you know PHP you can trace those in the module's source code. 
-  </UL>
+  <h3>Ads not showing</h3>
+  <p>If ads are not displayed, that could be caused by several things:</p>
+  <ul>
+    <li>You are logged in as the site administrator. Log off to see the ads.
+    <li>Your site is still new and Google has not indexed it yet.
+    <li>Your site has been blacklisted by Google.
+    <li>The maximum number of ad units has already been displayed. Your page does not have enough content
+    to display more than one or two units.
+    <li>Check the page source for comments like this: &lt;!--adsense: ???--&gt;. These give hints to what
+    is going on, and if you know PHP you can trace those in the module's source code.
+  </ul>
 
-  <H3>Module Weight</H3></p>
-  <P>Unless configured otherwise, Drupal normally calls modules in alphabetical order. Insofar as Adsense starts
+  <h3>Module Weight</h3></p>
+  <p>Unless configured otherwise, Drupal normally calls modules in alphabetical order. Insofar as Adsense starts
   with "a," this may occasionally cause conflicts with other installed modules. For example, with <strong>image_attach</strong>
   (a function of the <a href = "http://drupal.org/project/image">image</a> module), Adsense will normally be invoked
-  <strong>first</strong> ("a" coming before "i"); this may interfere with inline styling of images attached to posts.</P>
+  <strong>first</strong> ("a" coming before "i"); this may interfere with inline styling of images attached to posts.</p>
 
-  <P><strong>Solution:</strong> Install and configure the <a href = "http://drupal.org/project/moduleweight">Module Weight</a>
+  <p><strong>Solution:</strong> Install and configure the <a href = "http://drupal.org/project/moduleweight">Module Weight</a>
   module and configure modules to load in the desired order. In this case, giving Image Attach a weight of -1 should resolve the
-  issue.</P>
+  issue.</p>
 
 EOF;
   return $output;
Index: revenue_sharing_basic.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/revenue_sharing_basic.info,v
retrieving revision 1.1
diff -u -p -r1.1 revenue_sharing_basic.info
--- revenue_sharing_basic.info	10 Feb 2008 01:24:19 -0000	1.1
+++ revenue_sharing_basic.info	4 Apr 2008 07:41:19 -0000
@@ -1,7 +1,10 @@
 ; $Id: revenue_sharing_basic.info,v 1.1 2008/02/10 01:24:19 kbahey Exp $
 ; Copyright 2005-2008 Khalid Baheyeldin http://2bits.com
 
-name = Adsense revenue sharing basic
+name = Adsense Revenue Sharing Basic
 description = Basic revenue sharing for the Google Adsense module
-dependencies = adsense profile
+dependencies[] = adsense
+dependencies[] = profile
 package = Adsense
+version = 6.x-1.x-dev
+core = 6.x
Index: revenue_sharing_basic.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/revenue_sharing_basic.install,v
retrieving revision 1.1
diff -u -p -r1.1 revenue_sharing_basic.install
--- revenue_sharing_basic.install	10 Feb 2008 01:24:19 -0000	1.1
+++ revenue_sharing_basic.install	4 Apr 2008 07:41:19 -0000
@@ -1,11 +1,11 @@
-<?php
-// $Id: revenue_sharing_basic.install,v 1.1 2008/02/10 01:24:19 kbahey Exp $
-
-// Copyright 2005-2008 Khalid Baheyeldin http://2bits.com
-
-/**
- * Implementation of hook_uninstall().
- */
-function revenue_sharing_basic_uninstall() {
-  db_query("DELETE FROM {variable} WHERE name LIKE 'revenue_sharing_basic_%'");
-}
+<?php
+// $Id: revenue_sharing_basic.install,v 1.1 2008/02/10 01:24:19 kbahey Exp $
+
+// Copyright 2005-2008 Khalid Baheyeldin http://2bits.com
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function revenue_sharing_basic_uninstall() {
+  db_query("DELETE FROM {variable} WHERE name LIKE 'revenue_sharing_basic_%'");
+}
Index: revenue_sharing_basic.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/revenue_sharing_basic.module,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 revenue_sharing_basic.module
--- revenue_sharing_basic.module	1 Apr 2008 02:28:27 -0000	1.1.2.4
+++ revenue_sharing_basic.module	4 Apr 2008 07:41:19 -0000
@@ -1,5 +1,5 @@
 <?php
-//$Id: revenue_sharing_basic.module,v 1.1.2.4 2008/04/01 02:28:27 kbahey Exp $
+// $Id: revenue_sharing_basic.module,v 1.1.2.4 2008/04/01 02:28:27 kbahey Exp $
 
 // Copyright 2005-2008 Khalid Baheyeldin http://2bits.com
 
@@ -250,7 +250,7 @@ function revenue_sharing_basic_get_clien
   }
 
   list($uid, $type) = $node_info;
-  
+
   // Check the content type we are displaying
   $content = variable_get(REVENUE_SHARING_BASIC_NODE_TYPE . $type, 0);
   if (!$content) {
@@ -274,7 +274,7 @@ function revenue_sharing_basic_get_node_
   }
 
   if (arg(0) == 'node' && is_numeric(arg(1))) {
-    $node = node_load(arg(1));
+    $node = menu_get_object();
 
     // Cache the results
     $nodeinfo['type'] = $node->type;
Index: revenue_sharing_basic_help.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/revenue_sharing_basic_help.inc,v
retrieving revision 1.1
diff -u -p -r1.1 revenue_sharing_basic_help.inc
--- revenue_sharing_basic_help.inc	10 Feb 2008 01:24:19 -0000	1.1
+++ revenue_sharing_basic_help.inc	4 Apr 2008 07:41:23 -0000
@@ -20,49 +20,49 @@ function revenue_sharing_basic_help_text
   $referral_link = 'http://baheyeldin.com/click/476/1';
 
   $output = <<<EOF
-<H2>Overview</H2>
-<P>This module provides web site admins the factility to share revenue from Google AdSense ads with 
-those writing the content on the site, according to certain percentages.</P>
-
-<H2>Prerequisites</H2>
-<P>You must have a Google AdSense account before using this module.  If you do not have an account,
-then please consider using <A HREF="$referral_link">the modules author's referral link</A>, which
+<h2>Overview</h2>
+<p>This module provides web site admins the factility to share revenue from Google AdSense ads with
+those writing the content on the site, according to certain percentages.</p>
+
+<h2>Prerequisites</h2>
+<p>You must have a Google AdSense account before using this module.  If you do not have an account,
+then please consider using <a href="$referral_link">the modules author's referral link</a>, which
 provides us with a referral fee from Google at absolutely no cost to you. This page also contains
-various useful links and resources on AdSense, and how to optimize your site for it.</P>
+various useful links and resources on AdSense, and how to optimize your site for it.</p>
 
-<H2>Revenue sharing</H2>
-<P>For revenue sharing, each author gets a predefined share of ad revenue from clicks occuring on
-nodes they authored.</P>
-<P>In order for the user to be credited they must have a Google AdSense account. As a site admin,
-please advertise <A HREF="$referral_link">the module author's referral link</A>, which provides us
+<h2>Revenue sharing</h2>
+<p>For revenue sharing, each author gets a predefined share of ad revenue from clicks occuring on
+nodes they authored.</p>
+<p>In order for the user to be credited they must have a Google AdSense account. As a site admin,
+please advertise <a href="$referral_link">the module author's referral link</a>, which provides us
 with a referral fee from Google, at absolutely no cost to you. This page also contains various useful
-links and resources on AdSense and how to optimize your site for it.</P>
-<P>Each user must enter their Google AdSense client ID in the profile field you defined above.</P>
+links and resources on AdSense and how to optimize your site for it.</p>
+<p>Each user must enter their Google AdSense client ID in the profile field you defined above.</p>
 
-<H2>Configuration</H2>
-<P>To use this module, you need to do the following first:</P>
-<UL>
-	<LI>
-    <P>Go to <A HREF="/admin/user/profile">Administer -&gt; User management -&gt; Profiles</A> and
+<h2>Configuration</h2>
+<p>To use this module, you need to do the following first:</p>
+<ul>
+  <li>
+    <p>Go to <a href="/admin/user/profile">Administer -&gt; User management -&gt; Profiles</a> and
     create a new profile field of type &quot;single-line textfield&quot;. Name this field something like
     &quot;Google AdSense client ID&quot;, and form name &quot;profile_google_adsense_client_id&quot;. This
-    is a required configuration parameter. At a minimum you should enter this field for user 1. 
-	  </P>
-	  <P>Note that the new profile field must be setup as: &quot;Private field, content only available to privileged
+    is a required configuration parameter. At a minimum you should enter this field for user 1.
+    </p>
+    <p>Note that the new profile field must be setup as: &quot;Private field, content only available to privileged
     users&quot;. All other values are either insecure (others can see the Google Adsense ID of the user), or will
-    not work, so do not use any of them.</P>
-	  <P>If you want to force users to enter a value when they sign up, then use the following settings:</P>
-	  <UL>
-		  <LI>The user must enter a value (checked). 
-		  <LI>Visible in user registration form (checked). 
-	  </UL>
-	  <P>You should enter a descriptive explanation for the Google AdSense client ID, so users know what to
-    enter in this field.</P>
+    not work, so do not use any of them.</p>
+    <p>If you want to force users to enter a value when they sign up, then use the following settings:</p>
+    <ul>
+      <li>The user must enter a value (checked).
+      <li>Visible in user registration form (checked).
+    </ul>
+    <p>You should enter a descriptive explanation for the Google AdSense client ID, so users know what to
+    enter in this field.</p>
 
-	<LI>Go to <A HREF="/user/$uid/edit">My account -&gt; Edit</A>, then click on the category that you defined
+  <li>Go to <a href="/user/$uid/edit">My account -&gt; Edit</a>, then click on the category that you defined
   for the Google AdSense client ID and enter your Google ID, which is something like &quot;pub-9999999999999&quot;,
-  and click Submit. 
-</UL>
+  and click Submit.
+</ul>
 
 EOF;
   return $output;
