Index: bookmarks2.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bookmarks2/bookmarks2.install,v
retrieving revision 1.2
diff -u -r1.2 bookmarks2.install
--- bookmarks2.install	18 Jun 2006 14:08:22 -0000	1.2
+++ bookmarks2.install	16 Dec 2007 09:17:38 -0000
@@ -1,11 +1,14 @@
 <?php
 // $Id: bookmarks2.install,v 1.2 2006/06/18 14:08:22 deekayen Exp $
 
+/**
+ * Implementation of hook_install()
+ */
 function bookmarks2_install() {
   switch ($GLOBALS['db_type']) {
     case 'mysql':
     case 'mysqli':
-      db_query("CREATE TABLE bookmarks2 (
+      db_query("CREATE TABLE {bookmarks2} (
         uid int(10) unsigned NOT NULL,
         url varchar(128) NOT NULL,
         title varchar(128) NOT NULL,
@@ -17,7 +20,7 @@
         KEY uid (uid),
         KEY fid (fid))");
 
-      db_query("CREATE TABLE bookmarks2_folders (
+      db_query("CREATE TABLE {bookmarks2_folders} (
         fid mediumint(8) unsigned NOT NULL auto_increment,
         f_parent_id mediumint(8) unsigned NOT NULL default '0',
         uid int(10) unsigned NOT NULL default '0',
@@ -27,7 +30,7 @@
         KEY uid (uid),
         KEY f_parent_id (f_parent_id))");
 
-      db_query("CREATE TABLE bookmarks2_prefs (
+      db_query("CREATE TABLE {bookmarks2_prefs} (
         uid int(10) unsigned NOT NULL,
         options tinyint(3) unsigned NOT NULL default '0',
         pword_key varbinary(100) NULL DEFAULT NULL,
@@ -35,12 +38,24 @@
   }
 }
 
+/**
+ * Implementation of hook_uninstall()
+ */
+function bookmarks2_uninstall() {
+  db_query('DROP TABLE {bookmarks2}');
+  db_query('DROP TABLE {bookmarks2_folders}');
+  db_query('DROP TABLE {bookmarks2_prefs}');
+  
+  variable_del('bookmarks2_login_reminder_enabled');
+  variable_del('bookmarks2_link_crop_size');
+}
+
 function bookmarks2_update_1() {
   $ret = array();
   switch ($GLOBALS['db_type']) {
     case 'mysql':
     case 'mysqli':
-      $ret[] = update_sql("ALTER TABLE bookmarks2_prefs CHANGE pword_hash pword_key VARBINARY(100) NULL DEFAULT NULL");
+      $ret[] = update_sql("ALTER TABLE {bookmarks2_prefs} CHANGE pword_hash pword_key VARBINARY(100) NULL DEFAULT NULL");
   }
   return $ret;
 }
\ No newline at end of file
Index: bookmarks2.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bookmarks2/bookmarks2.module,v
retrieving revision 1.8
diff -u -r1.8 bookmarks2.module
--- bookmarks2.module	6 Nov 2006 22:01:03 -0000	1.8
+++ bookmarks2.module	16 Dec 2007 09:17:39 -0000
@@ -61,7 +61,7 @@
   $access = user_access('access bookmarks2');
 
   // Main menu item
-  $items[] = array('path' => "bookmarks2/$user->uid", 'title' => t('my bookmarks'),
+  $items[] = array('path' => "bookmarks2/$user->uid", 'title' => t('My bookmarks'),
                     'callback' => 'bookmarks2_page', 'access' => $access, 'type' => MENU_NORMAL_ITEM);
 
   // Top level tabs
@@ -86,15 +86,9 @@
   $items[] = array('path' => "bookmarks2/$user->uid/rss.xml", 'title' => t('feed'),
     'callback' => 'bookmarks2_feed', 'access' => $access,
     'type' => MENU_CALLBACK);
-  $items[] = array(
-    'path' => 'admin/settings/bookmarks2',
-    'title' => t('Bookmarks2'),
-    'description' => t('Configure link cropping and login reminder encryption.'),
-    'callback' => 'drupal_get_form',
-    'callback arguments' => 'bookmarks2_admin_settings',
-    'access' => user_access('administer site configuration'),
-    'type' => MENU_NORMAL_ITEM
-  );
+  $items[] = array('path' => "admin/settings/bookmarks2", 'title' => t('Bookmarks Settings'),
+    'callback' => 'drupal_get_form', 'callback arguments' => array('bookmarks2_admin_settings'), 'access' => user_access("access administration pages"), 'weight' => 25,
+    'type' => MENU_NORMAL_ITEM);
   return $items;
 }
 
@@ -128,8 +122,18 @@
     // Print bookmarks list as an item list
     $output = (count($bookmarks) ? theme('item_list', $bookmarks) : t('You have no bookmarks.'));
     $links = array(
-      l(t('quick link'), "bookmarks2/$user->uid/add/quick", array('title' => t('Bookmark the current page.')), 'title='. urlencode(drupal_get_title())),
-      l(t('manage'), "bookmarks2/$user->uid")
+      array(
+        'title' => t('quick link'),
+        'href' => "bookmarks2/$user->uid/add/quick",
+        'attributes' => array(
+          'title' => t('Bookmark the current page.'),
+        ),
+        'query' => 'title='. urlencode(drupal_get_title()),
+      ),
+      array(
+        'title' => t('manage'),
+        'href' => "bookmarks2/$user->uid",
+      ),
     );
     $output .= '<div class="links">'. theme('links', $links) .'</div>';
 
@@ -196,7 +200,7 @@
 function bookmarks2_page() {
   global $user;
 
-  $edit = $_POST['edit'];
+  $edit = $_POST;
   $op   = $_POST['op'];
 
   switch (($op ? $op : arg(2))) {
@@ -208,12 +212,12 @@
       elseif (arg(3) == 'weblink') {
         $edit = bookmarks2_load_weblink(arg(4));
       }
-      $output = bookmarks2_form($edit);
+      $output = drupal_get_form('bookmarks2_form',$edit);
       break;
 
     case 'edit':
       $title = t('Edit bookmark');
-      $output = ($url = urldecode($_GET['url'])) ? bookmarks2_form(bookmarks2_load($url)) : drupal_set_message(t('Bookmark cannot be edited, because it is not in your list.'), 'error');
+      $output = ($url = urldecode($_GET['url'])) ? drupal_get_form('bookmarks2_form',bookmarks2_load($url)) : drupal_set_message(t('Bookmark cannot be edited, because it is not in your list.'), 'error');
       break;
 
     case t('Save'):
@@ -223,7 +227,7 @@
         drupal_goto("bookmarks2/$user->uid");
       }
       else {
-        $output = bookmarks2_form($edit);
+        $output = drupal_get_form('bookmarks2_form',$edit);
       }
       break;
 
@@ -234,17 +238,17 @@
 
     case 'addfolder':
       $title = t('Create new folder');
-      $output = _bookmarks2_folder_form($edit);
+      $output = drupal_get_form('bookmarks2_folder_form',$edit);
       break;
 
     case 'folderedit':
       $title = t('Edit folder');
-      $output = ($fid = $_GET['fid']) ? _bookmarks2_folder_form(_bookmarks2_folder_load($fid)) : drupal_set_message(t('Folder cannot be edited, because it is not in your list.'), 'error');
+      $output = ($fid = $_GET['fid']) ? drupal_get_form('bookmarks2_folder_form',_bookmarks2_folder_load($fid)) : drupal_set_message(t('Folder cannot be edited, because it is not in your list.'), 'error');
       break;
 
     case 'config':
       $title = t('Configure bookmark preferences');
-      $output = _bookmarks2_config();
+      $output = drupal_get_form('_bookmarks2_config');
       break;
 
     case t('Save folder'):
@@ -286,10 +290,19 @@
     return drupal_goto("bookmarks2/{$user->uid}");
   }
 
-  $form['url'] = array('#type' => 'hidden', '#value' => $_GET['url']);
-  return confirm_form('bookmarks2_delete_confirm', $form, t('Are you sure you want to delete this bookmark?'), "bookmarks2/{$user->uid}", '', t('Delete'), t('Cancel'));
+  return drupal_get_form('bookmarks2_delete_confirm', $_GET['url'], $user->uid);
+}
+
+
+function bookmarks2_delete_confirm($url, $uid)
+{
+  $form['url'] = array('#type' => 'hidden', '#value' => $url);
+
+
+  return confirm_form($form, t('Are you sure you want to delete this bookmark?'), "bookmarks2/{$uid}", '', t('Delete'), t('Cancel'));
 }
 
+
 /**
  * Actually deletes a bookmark after a confirmation on a previous screen
  *
@@ -319,10 +332,19 @@
     return drupal_goto("bookmarks2/{$user->uid}");
   }
 
-  $form['fid'] = array('#type' => 'hidden', '#value' => (int)$_GET['fid']);
-  return confirm_form('bookmarks2_folder_delete_confirm', $form, t('Are you sure you want to delete this folder?'), "bookmarks2/{$user->uid}", '', t('Delete'), t('Cancel'));
+  return drupal_get_form('bookmarks2_folder_delete_confirm', $_GET['fid'], $user->uid);
 }
 
+
+function bookmarks2_folder_delete_confirm($fid, $uid)
+{
+  $form['fid'] = array('#type' => 'hidden', '#value' => (int)$fid);
+
+
+  return confirm_form($form, t('Are you sure you want to delete this folder?'), "bookmarks2/{$uid}", '', t('Delete'), t('Cancel'));
+}
+
+
 /**
  * Delete a folder, all its children, and the associated bookmarks
  *
@@ -466,7 +488,7 @@
     '#type' => 'submit',
     '#value' => t('Save')
   );
-  return drupal_get_form('bookmarks2_form', $form);
+  return $form;
 }
 
 /**
@@ -475,7 +497,7 @@
  * @param array $edit
  * @return string
  */
-function _bookmarks2_folder_form($edit = null) {
+function bookmarks2_folder_form($edit = null) {
   $form['details'] = array(
     '#type' => 'fieldset',
     '#title' => t('Folder details')
@@ -505,7 +527,7 @@
     '#value' => 'Save folder'
   );
 
-  return drupal_get_form('bookmarks2_folder_form', $form);
+  return $form;
 }
 
 /**
@@ -545,7 +567,7 @@
     '#value' => 'Save bookmark preferences'
   );
 
-  return drupal_get_form('_bookmarks2_config', $form);
+  return $form;
 }
 
 /**
@@ -680,7 +702,7 @@
  */
 function bookmarks2_overview() {
   global $user;
-  $key = isset($_POST['edit']['overview_key']) ? $_POST['edit']['overview_key'] : '';
+  $key = isset($_POST['overview_key']) ? $_POST['overview_key'] : '';
 
   $output = '';
   $header = array();
@@ -718,7 +740,7 @@
     if (_bookmarks2_key_isset()) {
       $output .= '<form action="" method="post" id="bookmarks2_key">
 <div><fieldset class=" collapsible"><legend>'. t('Reveal password reminders') .'</legend><div class="form-item">
- <input type="password" maxlength="" name="edit[overview_key]" id="edit-key"  size="20"  class="form-text" />
+ <input type="password" maxlength="" name="overview_key" id="edit-key"  size="20"  class="form-text" />
  <div class="description">'. t('Enter your password reminder key to decrypt and reveal your saved passwords') .'</div>
 </div><input type="submit" name="op" value="'. t('Display password reminders') .'" class="form-submit" />
 </fieldset></div></form>';
@@ -762,7 +784,7 @@
     }
   }
 
-  $output .= _bookmarks2_overview_folders($link_display, 0, $key, $crypt_ok, $good_key);
+  $output .= drupal_get_form('_bookmarks2_overview_folders', $link_display, 0, $key, $crypt_ok, $good_key);
   $output .= (count($rows) == 0) ? t('You have no bookmarks.') : theme('table', $header, $rows);
   return $output;
 }
@@ -791,7 +813,7 @@
         '#collapsed' => true
       );
     }
-    if ($child = _bookmarks2_overview_folders($link_display, $folder_data->fid, $key, $crypt_ok, $good_key)) {
+    if ($child = drupal_get_form('_bookmarks2_overview_folders', $link_display, $folder_data->fid, $key, $crypt_ok, $good_key)) {
       $form[$folder_data->fid]['child'] = array(
         '#value' => $child
       );
@@ -840,7 +862,7 @@
       );
     }
   }
-  return drupal_get_form('bookmark_folders', $form);
+  return $form;
 }
 
 /**
@@ -982,6 +1004,7 @@
     $form['bookmarks2_login_reminder'] = array('#type' => 'markup', '#value' => t('The mcrypt extension of PHP must be installed on this server for login reminders to work.'));
     $form['bookmarks2_login_reminder_enabled'] = array('#type' => 'hidden', '#value' => '0');
   }
+
   return system_settings_form($form);
 }
 
@@ -1114,4 +1137,4 @@
   return strcmp(_bookmarks2_fetch_key(), _bookmarks2_hash_key($key)) === 0;
 }
 
-?>
+
