diff -ur adsense/adsense.info adsense-new/adsense.info
--- adsense/adsense.info	2008-02-13 07:00:14.000000000 -0500
+++ adsense-new/adsense.info	2008-02-16 13:43:16.000000000 -0500
@@ -4,9 +4,11 @@
 name = AdSense core and API
 description = Displays Google AdSense ads on your site to earn revenue. Provides an API for revenue sharing on web sites.
 package = Adsense
+core = 6.x
 
 ; Information added by drupal.org packaging script on 2008-02-13
-version = "5.x-2.x-dev"
+version = "6.x-2.x-dev"
+core = "6.x"
 project = "adsense"
 datestamp = "1202904014"
 
diff -ur adsense/adsense.install adsense-new/adsense.install
--- adsense/adsense.install	2008-02-09 20:24:19.000000000 -0500
+++ adsense-new/adsense.install	2008-02-16 13:42:04.000000000 -0500
@@ -3,43 +3,79 @@
 //
 // 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');
-  }
+function adsense_schema() {
+  $schema['adsense_clicks'] = array(
+    'description' => t(' ??? '),
+    'fields' => array(
+      'aid' => array(
+        'type' => 'int',
+        'size' => 10,
+        'not null' => TRUE,
+        // ?? How to specify AUTO_INCREMENT ??
+      ),
+      'ip' => array(
+        'type' => 'varchar',
+        'length' => 15,
+        'default' => '0'
+      ),
+      'timestamp' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'path' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => ''
+      )
+    ),
+    'primary key' => array('aid'),
+    'indexes' => array(
+      'timestamp' => array('timestamp')
+    )
+  );
 }
 
+// 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}');
+  drupal_uninstall_schema('adsense_clicks');
+  // ?? Has this following changed for drupal 6 ??
   db_query("DELETE FROM {variable} WHERE name LIKE 'adsense_%'");
 }
 
@@ -48,11 +84,7 @@
 }
 
 function adsense_update_2() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query("ALTER TABLE {adsense_clicks} ADD `path` varchar(255) default ''");
-      break;
-  }
+  $ret = array();
+  db_add_field($ret, 'adsense_clicks', 'path', array('type' => 'varchar', 'length' => 255, 'default' => ''));
 }
 
diff -ur adsense/adsense.module adsense-new/adsense.module
--- adsense/adsense.module	2008-02-12 21:10:59.000000000 -0500
+++ adsense-new/adsense.module	2008-02-16 13:53:18.000000000 -0500
@@ -117,8 +117,8 @@
 /**
  * Implementation of hook_help().
  */
-function adsense_help($section) {
-  switch ($section) {
+function adsense_help($path, $art) {
+  switch ($path) {
     case 'admin/settings/adsense':
       return t('<p>@revision @date</p>', array('@revision' => trim('$Revision: 1.66.2.1 $', ' $'), '@date' => trim('$Date: 2008/02/13 02:10:59 $', ' $')));
   }
@@ -157,7 +157,7 @@
     if (variable_get(ADSENSE_CLICK_TRACKING, 0)) {
       $access = user_access('view clicks');
       $items[] = array(
-        'path' => 'admin/logs/adsense',
+        'path' => 'admin/reports/adsense',
         'title' => t('AdSense clicks'),
         'description' => t('Track AdSense clicks.'),
         'callback' => 'adsense_click_log',
@@ -166,7 +166,7 @@
         );
 
       $items[] = array(
-        'path' => 'admin/logs/adsense/top_pages',
+        'path' => 'admin/reports/adsense/top_pages',
         'title' => t('Top pages'),
         'callback' => 'adsense_click_top_pages',
         'type' => MENU_NORMAL_ITEM,
@@ -174,7 +174,7 @@
         );
 
       $items[] = array(
-        'path' => 'admin/logs/adsense/by_day',
+        'path' => 'admin/reports/adsense/by_day',
         'title' => t('By day'),
         'callback' => 'adsense_click_by_day',
         'type' => MENU_NORMAL_ITEM,
@@ -207,7 +207,7 @@
 }
 
 function adsense_admin_module_settings($module) {
-  $function = $module . '_adsense';
+  $function = $module .'_adsense';
   $form = $function('settings');
 
   return system_settings_form($form);
@@ -216,7 +216,7 @@
 function adsense_admin_settings() {
   // force a display of errors, if any
   $module = variable_get(ADSENSE_ID_MODULE, 'adsense_basic');
-  $function = $module . '_adsense';
+  $function = $module .'_adsense';
   $error = $function('status');
 
   $form = array();
@@ -461,7 +461,7 @@
     '#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'))),
+    '#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(
@@ -1011,7 +1011,7 @@
     // Not cached. Format an ad
     $ad = _adsense_format($format, $group, $channel);
     // Add it to cache
-    cache_set($cache_key, 'cache', $ad, CACHE_PERMANENT);
+    cache_set($cache_key, $ad);
   }
 
   return $ad;
@@ -1453,7 +1453,7 @@
   $module = variable_get(ADSENSE_ID_MODULE, 'adsense_basic');
 
   // Compose the function to be called
-  $function = $module . '_adsense';
+  $function = $module .'_adsense';
   // Call the function
   if (!function_exists($function)) {
     adsense_error(ADSENSE_ERROR_NO_MODULE);
@@ -1467,7 +1467,7 @@
 }
 
 function adsense_error($error_code) {
-  switch($error_code) {
+  switch ($error_code) {
     case ADSENSE_ERROR_NO_MODULE:
       $text = t('No Google Adsense client ID choosing module is enabled. Please check your settings.');
       break;
@@ -1502,7 +1502,7 @@
   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);
+      ip_address(), time(), $path);
   }
 }
 
@@ -1745,7 +1745,7 @@
 
     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');
diff -ur adsense/adsense_basic.info adsense-new/adsense_basic.info
--- adsense/adsense_basic.info	2008-02-13 07:00:14.000000000 -0500
+++ adsense-new/adsense_basic.info	2008-02-16 13:43:25.000000000 -0500
@@ -3,11 +3,13 @@
 
 name = Adsense basic
 description = Configuration for Adsense for a basic single owner site, with no revenue sharing.
-dependencies = adsense
+dependencies[] = adsense
+core = 6.x
 package = Adsense
 
 ; Information added by drupal.org packaging script on 2008-02-13
-version = "5.x-2.x-dev"
+version = "6.x-2.x-dev"
+core = "6.x"
 project = "adsense"
 datestamp = "1202904014"
 
diff -ur adsense/adsense_basic.module adsense-new/adsense_basic.module
--- adsense/adsense_basic.module	2008-02-12 21:10:59.000000000 -0500
+++ adsense-new/adsense_basic.module	2008-02-16 13:19:42.000000000 -0500
@@ -30,7 +30,7 @@
   $module = 'adsense_basic';
   include_once(drupal_get_path('module', $module) .'/'. $module .'_help.inc');
   
-  $function = $module . '_adsense';
+  $function = $module .'_adsense';
   $error_flag = $function('status');
 
   $form['help'] = array(
diff -ur adsense/revenue_sharing_basic.info adsense-new/revenue_sharing_basic.info
--- adsense/revenue_sharing_basic.info	2008-02-13 07:00:14.000000000 -0500
+++ adsense-new/revenue_sharing_basic.info	2008-02-16 13:43:53.000000000 -0500
@@ -3,11 +3,14 @@
 
 name = Adsense revenue sharing basic
 description = Basic revenue sharing for the Google Adsense module
-dependencies = adsense profile
+dependencies[] = adsense
+dependencies[] = profile
 package = Adsense
+core = 6.x
 
 ; Information added by drupal.org packaging script on 2008-02-13
-version = "5.x-2.x-dev"
+version = "6.x-2.x-dev"
+core = "6.x"
 project = "adsense"
 datestamp = "1202904014"
 
diff -ur adsense/revenue_sharing_basic.module adsense-new/revenue_sharing_basic.module
--- adsense/revenue_sharing_basic.module	2008-02-12 21:10:59.000000000 -0500
+++ adsense-new/revenue_sharing_basic.module	2008-02-16 13:54:35.000000000 -0500
@@ -282,7 +282,7 @@
 }
 
 function revenue_sharing_basic_error($error_code) {
-  switch($error_code) {
+  switch ($error_code) {
     case REVENUE_SHARING_BASIC_ERROR_CACHING_ENABLED:
       $text = t('Drupal page cache is enabled. This causes conflicts with revenue sharing, since the pages are stored in the cache and are not dynamically generated. If you experience issues with revenue sharing, then disable the page cache.');
       break;
