--- delicious.module.orig	2006-07-24 02:12:36.000000000 +0100
+++ delicious.module	2007-04-03 10:55:40.000000000 +0100
@@ -18,7 +18,7 @@
 
 // SET up AS a define because the API docs say this is likely to change at some point.
 define(DELICIOUS_BASE_URL, 'http://del.icio.us/');
-define(DELICIOUS_API_URL, 'http://del.icio.us/api/');
+define(DELICIOUS_API_URL, 'https://api.del.icio.us/v1/');
 define(DELICIOUS_UPDATE_URL, 'posts/update');
 define(DELICIOUS_POSTS_URL, 'posts/all');
 
@@ -63,7 +63,7 @@ function delicious_link($type, $node = 0
 
   if ($type == 'node' && _delicious_nodetype_applicable($node->type)) {
     if (variable_get("delicious_crosslink", 0)) {
-      $links[] = '<a href="' . _delicious_term_link($node) . 'del.icio.us links</a>';
+      $links['delicious'] = array('title' => 'find similar content on del.icio.us','href' =>  _delicious_term_link($node)     ); 
     }
   }
 
@@ -73,10 +73,10 @@ function delicious_link($type, $node = 0
 //
 // _settings() hook
 //
-function delicious_settings() {
-
-  // Build a list of node types
-  foreach (node_list() AS $type) {
+function delicious_admin_settings() {  
+	
+ // Build a list of node types
+    foreach (node_get_types() AS $type => $name) { 
     $node_type = node_invoke($type, 'node_name');
     $nodes[$type] = $node_type ? $node_type : $type;
   }
@@ -101,7 +101,7 @@ function delicious_settings() {
     '#options' => $nodes,
     '#description' => t('SELECT all node types that allow crosslinking and/or smarttagging.'),
   );
-  return $form;
+  return system_settings_form($form);
 }
 
 //
@@ -144,9 +144,12 @@ function delicious_menu($may_cache) {
     $items[] = array(
       'path' => 'admin/settings/delicious',
       'title' => t('delicious settings'),
-      'access' => user_access('administer delicious'),
-      'callback' => 'delicious_settings',
-      'type' => MENU_ITEM
+      'description' => t('Delicious Mmmm.'),
+      'access' => user_access('administer site configuration'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('delicious_admin_settings'),
+      'type' => MENU_NORMAL_ITEM
+
     );
     $items[] = array(
       'path' => 'admin/delicious',
@@ -211,7 +214,7 @@ function delicious_menu($may_cache) {
 
 	  // provide CSS information about actuators (stolen from taxonomy_dhtml basically)
 	  $module = drupal_get_path('module', 'delicious');
-	  theme_add_style($module . '/delicious.css');
+	  drupal_add_css($module . '/delicious.css');
 	  drupal_add_js($module . '/delicious.js');
   }
   
@@ -235,8 +238,9 @@ function delicious_nodeapi(&$node, $op, 
           $uname = db_result(db_query("SELECT user FROM {delicious_user} WHERE uid=$node->uid"));
         }
         if ($uname) {
-          $node->body = _delicious_tag_text($node->body, $uname);
-          $node->teaser = _delicious_tag_text($node->teaser, $uname);
+           $node->content['teaser'] = array( '#value' => _delicious_tag_text($node->teaser, $uname), '#weight' => 10);
+           $node->content['body'] = array('#value' => _delicious_tag_text($node->body, $uname), '#weight' => 10 );
+
         }
       } 
       break;
@@ -390,7 +394,7 @@ function delicious_page_user($uid = 0) {
 //
 function delicious_page_settings() {
   $uid = arg(1);
-  $output = delicious_page_settings_form($uid, $existence);
+  $output = drupal_get_form('delicious_page_settings_form',$uid);  
   return $output;
 }
 
@@ -467,7 +471,7 @@ function delicious_page_settings_form($u
     );
   }
   
-  return drupal_get_form('delicious_page_settings', $form);
+  return $form ; 
 }
 
 function delicious_page_settings_submit($form_id, $form_values) {
@@ -528,33 +532,43 @@ function delicious_admin_edit($block = 0
     return drupal_access_denied();
   }
 
-  $output = delicious_block_form($block);
+  $output = drupal_get_form('delicious_block_form',$block);
 
   return $output;
 }
 
+
+function delicious_admin_delete_confirm_submit($form_id, $form_values) {
+  if ($form_values['confirm']) {
+    delicious_delete_block($form_values['block']);
+  }
+  return 'admin/delicious';
+}
+
 function delicious_admin_delete($dbid = 0) {
   $block = delicious_load_block($dbid);
   if ($block['title'] == '') {
     return drupal_access_denied();
   }
+  
+  return drupal_get_form('delicious_admin_delete_confirm', $dbid);
+}
+
+function delicious_admin_delete_confirm_page() {  return drupal_get_form('delicious_admin_delete_confirm', arg(1));}
+
+function delicious_admin_delete_confirm($dbid){
+
 
   $form['block'] = array('#type' => 'value', '#value' => $dbid);
-  return confirm_form('delicious_admin_delete_confirm', $form,
+  return confirm_form($form,
     t('Are you sure you want to delete %title?', array('%title' => $block['title'])), 
     $_GET['destination'] ? $_GET['destination'] : 'admin/delicious', 
     t('This action cannot be undone.'),
     t('Delete'), t('Cancel')  
   );
+	
 }
-
-function delicious_admin_delete_confirm_submit($form_id, $form_values) {
-  if ($form_values['confirm']) {
-    delicious_delete_block($form_values['block']);
-  }
-  return 'admin/delicious';
-}
-
+  
 //
 // display add/edit block form
 //
@@ -605,13 +619,13 @@ function delicious_block_form($dbid = 0)
     );
   }
 
-  return drupal_get_form('delicious_block_edit', $form);
+  return $form ; 
 }
 
 //
 // save block to db
 //
-function delicious_block_edit_submit($form_id, $form_values) {
+function delicious_block_form_submit($form_id, $form_values) {
   if ($form_values['dbid']) {
     db_query("UPDATE {delicious_block} SET title='%s', users='%s', tags='%s', maxentries=%d WHERE dbid=%d", $form_values['title'], $form_values['users'], $form_values['tags'], $form_values['maxentries'], $form_values['dbid']);
   }
@@ -633,7 +647,7 @@ function delicious_load_block($block) {
 //
 // delete a block from db
 //
-function delicious_delete_block($block) {
+function delicious_delete_block($block) { 
   db_query("DELETE FROM {delicious_block} WHERE dbid=%d", $block);
 }
 
@@ -915,7 +929,7 @@ function _delicious_tag_string($text, $t
       $deliciousLink = "<a href='$path'><img src='$modulepath/deliciousIcon.gif' class='delicious-icon'></a>";
       
       if (!preg_match('/<.+>/',$text)) {
-        $text = preg_replace('/(\b'.$tag.'\b)/i','$1'.$deliciousLink,$text);
+        $text = preg_replace($tag,'$1',$deliciousLink,$text);
       } else {
         $text = preg_replace('/(?<=>)([^<]+)?(\b'.$tag.'\b)/i','$1$2'.$deliciousLink,$text);
       }
@@ -1025,5 +1039,5 @@ function theme_delicious_user($uid) {
 }
 
 function _delicious_get_link($obj) {
-  return "<a href='$obj->href' title='$obj->extended' class='delicious_node'>$obj->description</a>";
+  return "<a href='$obj->href' title='$obj->extended' class='delicious_node'>".stripslashes($obj->description)."</a>";
 }
