? .svn
? LICENSE.txt
? drupalvb_total_d6_20080702.patch
Index: CHANGELOG.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/CHANGELOG.txt,v
retrieving revision 1.7.4.25
diff -u -p -r1.7.4.25 CHANGELOG.txt
--- CHANGELOG.txt	19 Jun 2008 04:39:39 -0000	1.7.4.25
+++ CHANGELOG.txt	2 Jul 2008 21:43:20 -0000
@@ -1,4 +1,4 @@
-// $Id: CHANGELOG.txt,v 1.7.4.25 2008/06/19 04:39:39 sun Exp $
+// $Id: CHANGELOG.txt,v 1.7.4.24 2008/05/08 10:03:40 sun Exp $
 
 Drupal vB x.x-x.x, xxxx-xx-xx
 -----------------------------
@@ -6,7 +6,6 @@ Drupal vB x.x-x.x, xxxx-xx-xx
 
 Drupal vB 5.x-2.x, xxxx-xx-xx
 -----------------------------
-#271663 by sun: Updated vBulletin version compatibility note.
 
 
 Drupal vB 5.x-2.0, 2008-05-08
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/README.txt,v
retrieving revision 1.8.4.5
diff -u -p -r1.8.4.5 README.txt
--- README.txt	19 Jun 2008 04:39:39 -0000	1.8.4.5
+++ README.txt	2 Jul 2008 21:43:20 -0000
@@ -1,4 +1,4 @@
-/* $Id: README.txt,v 1.8.4.5 2008/06/19 04:39:39 sun Exp $ */
+/* $Id: README.txt,v 1.8.4.4 2008/05/08 10:15:34 sun Exp $ */
 
 -- SUMMARY --
 
@@ -35,7 +35,7 @@ Bug reports, feature suggestions and lat
 
 -- REQUIREMENTS --
 
-* vBulletin 3.6.x / 3.7.x
+* vBulletin 3.6.x
 
 
 -- INSTALLATION --
Index: drupalvb.admin-pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/drupalvb.admin-pages.inc,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 drupalvb.admin-pages.inc
--- drupalvb.admin-pages.inc	1 May 2008 20:47:36 -0000	1.1.2.5
+++ drupalvb.admin-pages.inc	2 Jul 2008 21:43:20 -0000
@@ -125,11 +125,11 @@ function drupalvb_settings_database() {
   return $form;
 }
 
-function drupalvb_settings_database_submit($form_id, $form_values) {
-  $url = $form_values['scheme'] .'://'. $form_values['user'] .':'. $form_values['pass'] .'@'. $form_values['host'] .'/'. $form_values['path'];
+function drupalvb_settings_database_submit($form, &$form_state) {
+  $url = $form_state['values']['scheme'] .'://'. $form_state['values']['user'] .':'. $form_state['values']['pass'] .'@'. $form_state['values']['host'] .'/'. $form_state['values']['path'];
   variable_set('drupalvb_db', $url);
   variable_set('drupalvb_db_is_default', (is_array($GLOBALS['db_url']) ? $GLOBALS['db_url']['default'] == $url : $GLOBALS['db_url'] == $url));
-  variable_set('drupalvb_db_prefix', $form_values['db_prefix']);
+  variable_set('drupalvb_db_prefix', $form_state['values']['db_prefix']);
 }
 
 /**
@@ -166,8 +166,8 @@ function drupalvb_settings_actions() {
 /**
  * Form submit callback for action form.
  */
-function drupalvb_settings_actions_submit($form_id, $form_values) {
-  switch ($form_values['action']) {
+function drupalvb_settings_actions_submit($form, &$form_state) {
+  switch ($form_state['values']['action']) {
     case 'export':
       drupalvb_export_drupal_users();
       drupal_set_message(t('Drupal users have been exported to vBulletin.'));
Index: drupalvb.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/drupalvb.inc,v
retrieving revision 1.6.2.6
diff -u -p -r1.6.2.6 drupalvb.inc
--- drupalvb.inc	1 May 2008 19:55:16 -0000	1.6.2.6
+++ drupalvb.inc	2 Jul 2008 21:43:20 -0000
@@ -157,15 +157,6 @@ function drupalvb_db_query($query) {
 }
 
 /**
- * Returns the last insert id.
- *
- * Borrowed from Drupal 6.
- */
-function db_last_insert_id($table, $field) {
-  return db_result(drupalvb_db_query('SELECT LAST_INSERT_ID()'));
-}
-
-/**
  * Initialize DrupalvB's user mapping table upon installation.
  *
  * Note: We can't do this in a single query, because Drupal's and vB's tables
Index: drupalvb.inc.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/drupalvb.inc.php,v
retrieving revision 1.9.4.13
diff -u -p -r1.9.4.13 drupalvb.inc.php
--- drupalvb.inc.php	6 May 2008 07:54:27 -0000	1.9.4.13
+++ drupalvb.inc.php	2 Jul 2008 21:43:20 -0000
@@ -104,7 +104,7 @@ function drupalvb_get_ip() {
  */
 function drupalvb_create_user($account, $edit) {
   // Ensure we are not duplicating a user.
-  if (db_num_rows(drupalvb_db_query("SELECT userid FROM {user} WHERE username = '%s'", $edit['name'])) > 0) {
+    if (db_result(drupalvb_db_query("SELECT count(*) FROM {user} WHERE username = '%s'", $edit['name'])) > 0) {
     return FALSE;
   }
 
@@ -346,8 +346,10 @@ function drupalvb_get_recent_posts($scop
     else if ($scope == 'daily') {
       $datecut = time() - 86400;
     }
-    $result = drupalvb_db_query("SELECT postid FROM {post} WHERE dateline > %d", $datecut);
-    $posts = db_num_rows($result);
+    
+    $result = drupalvb_db_query("SELECT count(*) FROM {post} WHERE dateline > %d", $datecut);
+    
+    $posts = db_result($result);
   }
   else {
     $posts = 0;
Index: drupalvb.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/drupalvb.info,v
retrieving revision 1.2.4.1
diff -u -p -r1.2.4.1 drupalvb.info
--- drupalvb.info	30 Apr 2008 01:20:06 -0000	1.2.4.1
+++ drupalvb.info	2 Jul 2008 21:43:20 -0000
@@ -1,3 +1,10 @@
 ; $Id: drupalvb.info,v 1.2.4.1 2008/04/30 01:20:06 sun Exp $
 name = Drupal vB
 description = Integrate your Drupal site with vBulletin forums.
+core=6.x
+
+; Information added by drupal.org packaging script on 2008-05-08
+version = "5.x-2.0"
+project = "drupalvb"
+datestamp = "1210242305"
+
Index: drupalvb.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/drupalvb.install,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 drupalvb.install
--- drupalvb.install	1 May 2008 22:52:25 -0000	1.1.2.4
+++ drupalvb.install	2 Jul 2008 21:43:20 -0000
@@ -5,100 +5,34 @@
  * Implementation of hook_install().
  */
 function drupalvb_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query("CREATE TABLE {drupalvb_users} (
-          uid int(10) unsigned NOT NULL default '0',
-          userid int(10) unsigned NOT NULL default '0',
-          PRIMARY KEY (uid),
-          KEY userid (userid)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-
-      require_once drupal_get_path('module', 'drupalvb') .'/drupalvb.inc';
-      _drupalvb_init_user_map();
-      break;
-  }
-}
-
-/**
- * Implementation of hook_uninstall().
- *
- * @todo Variable clean-up.
- */
-function drupalvb_uninstall() {
-  db_query("DROP TABLE {drupalvb_users}");
+  drupal_install_schema('drupalvb');
+  require_once drupal_get_path('module', 'drupalvb') .'/drupalvb.inc';
+  _drupalvb_init_user_map();
 }
 
 /**
- * Move vB database url from settings.php into a variable.
+ * Implementation of hook_schema().
  */
-function drupalvb_update_5100() {
-  global $db_url;
-  
-  $ret = array();
-  if (is_array($db_url) && !empty($db_url['vbulletin'])) {
-    variable_set('drupalvb_db', $db_url['vbulletin']);
-  }
-  else {
-    variable_set('drupalvb_db', $db_url);
-  }
-  require_once drupal_get_path('module', 'drupalvb') .'/drupalvb.inc.php';
-  $config = drupalvb_get_config();
-  variable_set('drupalvb_db_prefix', $config['Database']['tableprefix']);
-  return $ret;
-}
+function drupalvb_schema() {
+  $schema['drupalvb_users'] = array(
+    'fields' => array(
+      'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
+      'userid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
+    ),
+    'primary key' => array('uid'),
+    'indexes' => array(
+      'userid' => array('userid')
+    ),
+  );
 
-/**
- * Install user id mapping table.
- */
-function drupalvb_update_5200() {
-  $ret = array();
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("CREATE TABLE {drupalvb_users} (
-          uid int(10) unsigned NOT NULL default '0',
-          userid int(10) unsigned NOT NULL default '0',
-          PRIMARY KEY (uid),
-          KEY userid (userid)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-
-      require_once drupal_get_path('module', 'drupalvb') .'/drupalvb.inc';
-      _drupalvb_init_user_map();
-      break;
-  }
-  return $ret;
+  return $schema;
 }
 
 /**
- * Update block configuration variables.
+ * Implementation of hook_uninstall().
+ *
+ * @todo Variable clean-up.
  */
-function drupalvb_update_5201() {
-  $ret = array();
-  // Recent threads/posts.
-  variable_set('drupalvb_block_recent_type', variable_get('drupalvb_block_0_type', 'threads'));
-  variable_del('drupalvb_block_0_type');
-  variable_set('drupalvb_block_recent_count', variable_get('drupalvb_block_0', 5));
-  variable_del('drupalvb_block_0');
-  variable_set('drupalvb_block_recent_limit', variable_get('drupalvb_block_0_limit', 7));
-  variable_del('drupalvb_block_0_limit');
-  $authors = (variable_get('drupalvb_block_0_name', 'no') == 'no' ? 0 : 1);
-  variable_set('drupalvb_block_recent_authors', $authors);
-  variable_del('drupalvb_block_0_name');
-  $ret[] = update_sql("UPDATE {blocks} SET delta = 'recent' WHERE module = 'drupalvb' AND delta = 0");
-  $ret[] = update_sql("UPDATE {blocks_roles} SET delta = 'recent' WHERE module = 'drupalvb' AND delta = 0");
-  // User info.
-  variable_set('drupalvb_block_user', variable_get('drupalvb_block_1', array('newposts' => 'newposts', 'recent' => 'recent', 'online' => 'online', 'pms' => 'pms')));
-  variable_del('drupalvb_block_1');
-  $ret[] = update_sql("UPDATE {blocks} SET delta = 'user' WHERE module = 'drupalvb' AND delta = 1");
-  $ret[] = update_sql("UPDATE {blocks_roles} SET delta = 'user' WHERE module = 'drupalvb' AND delta = 1");
-  // Overall statistics.
-  variable_set('drupalvb_block_stats', variable_get('drupalvb_block_2', array('threads' => 'threads', 'posts' => 'posts', 'tmembers' => 'tmembers', 'amembers' => 'amembers')));
-  variable_del('drupalvb_block_2');
-  $ret[] = update_sql("UPDATE {blocks} SET delta = 'stats' WHERE module = 'drupalvb' AND delta = 2");
-  $ret[] = update_sql("UPDATE {blocks_roles} SET delta = 'stats' WHERE module = 'drupalvb' AND delta = 2");
-  
-  return $ret;
+function drupalvb_uninstall() {
+  drupal_uninstall_schema('drupalvb');
 }
-
Index: drupalvb.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/drupalvb.module,v
retrieving revision 1.11.4.13
diff -u -p -r1.11.4.13 drupalvb.module
--- drupalvb.module	8 May 2008 10:03:40 -0000	1.11.4.13
+++ drupalvb.module	2 Jul 2008 21:43:20 -0000
@@ -13,8 +13,8 @@ require_once drupal_get_path('module', '
 /**
  * Implementation of hook_help().
  */
-function drupalvb_help($section) {
-  switch ($section) {
+function drupalvb_help($path, $arg) {
+  switch ($path) {
     case 'admin/settings#description':
       return t('Allows basic integration of Drupal with a vBulletin forum.');
 
@@ -40,56 +40,48 @@ function drupalvb_help($section) {
 /**
  * Implementation of menu_hook().
  */
-function drupalvb_menu($may_cache) {
+function drupalvb_menu() {
   $items = array();
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/settings/drupalvb',
-      'title' => t('Drupal vB integration'),
-      'callback' => 'drupalvb_settings',
-      'callback arguments' => array('integration'),
-      'description' => t('Configure integration of Drupal with vBulletin forum.'),
-      'access' => user_access('administer drupalvb'),
-    );
-    $items[] = array(
-      'path' => 'admin/settings/drupalvb/integration',
-      'title' => t('Integration'),
-      'type' => MENU_DEFAULT_LOCAL_TASK,
-      'weight' => -10,
-    );
-    $items[] = array(
-      'path' => 'admin/settings/drupalvb/database',
-      'title' => t('Database'),
-      'callback' => 'drupalvb_settings',
-      'callback arguments' => array('database'),
-      'access' => user_access('administer drupalvb'),
-      'type' => MENU_LOCAL_TASK,
-    );
-    $items[] = array(
-      'path' => 'admin/settings/drupalvb/actions',
-      'title' => t('Actions'),
-      'callback' => 'drupalvb_settings',
-      'callback arguments' => array('actions'),
-      'access' => user_access('administer drupalvb'),
-      'type' => MENU_LOCAL_TASK,
-      'weight' => 10,
-    );
-    $items[] = array(
-      'path' => 'admin/settings/drupalvb/variables',
-      'title' => t('Variables'),
-      'callback' => 'drupalvb_settings',
-      'callback arguments' => array('variables'),
-      'access' => user_access('access devel information'),
-      'type' => MENU_LOCAL_TASK,
-      'weight' => 88,
-    );
-    $items[] = array(
-      'path' => 'drupalvb/pms',
-      'callback' => 'drupalvb_private_messages',
-      'access' => user_access('access content'),
-      'type' => MENU_CALLBACK,
-    );
-  }
+  $items['admin/settings/drupalvb'] = array(
+    'title' => 'Drupal vB integration',
+    'page callback' => 'drupalvb_settings',
+    'page arguments' => array('integration'),
+    'description' => 'Configure integration of Drupal with vBulletin forum.',
+    'access arguments' => array('administer drupalvb'),
+  );
+  $items['admin/settings/drupalvb/integration'] = array(
+    'title' => 'Integration',
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+    'weight' => -10,
+  );
+  $items['admin/settings/drupalvb/database'] = array(
+    'title' => 'Database',
+    'page callback' => 'drupalvb_settings',
+    'page arguments' => array('database'),
+    'access arguments' => array('administer drupalvb'),
+    'type' => MENU_LOCAL_TASK,
+  );
+  $items['admin/settings/drupalvb/actions'] = array(
+    'title' => 'Actions',
+    'page callback' => 'drupalvb_settings',
+    'page arguments' => array('actions'),
+    'access arguments' => array('administer drupalvb'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 10,
+  );
+  $items['admin/settings/drupalvb/variables'] = array(
+    'title' => 'Variables',
+    'page callback' => 'drupalvb_settings',
+    'page arguments' => array('variables'),
+    'access arguments' => array('access devel information'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 88,
+  );
+  $items['drupalvb/pms'] = array(
+    'page callback' => 'drupalvb_private_messages',
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK,
+  );
   return $items;
 }
 
@@ -111,9 +103,73 @@ function drupalvb_settings($form = 'inte
 }
 
 /**
+ * Implements hook_form_alter().
+ * 
+ * This replaces the hook_info() and hook_auth() code from Drupal 5.
+ *
+ * @param unknown_type $form
+ * @param unknown_type $form_state
+ * @param unknown_type $form_id
+ */
+function drupalvb_form_alter(&$form, $form_state, $form_id) {
+  if ($form_id == 'user_login_block' || $form_id == 'user_login') {
+    // Splice in our validate handler for authentication if user is performing a vb login.
+    if (!empty($form_state['post']['name']) && drupalvb_db_is_valid()) {
+      if ($vbuser = db_fetch_array(drupalvb_db_query("SELECT userid, password, salt, email FROM {user} WHERE username = '%s'", $username))) {
+        //$key = array_search('user_login_authenticate_validate', $form['#validate']);
+        // We want to run our login_validate before the standard login validate.
+        $form['#validate'] = array('_drupalvb_login_validate') + $form['#validate']; //array('logintoboggan_user_login_validate') + $form['#validate'];
+      }
+    }
+  }
+}
+
+/*
+ * Used to validate the login - in case the user exists on the vbbulletin.
+ */
+function _drupalvb_login_validate($form, &$form_state) {
+  global $user;
+
+  if ($user->uid) {
+    return;
+  }
+  
+  $username = $form_state['values']['name'];
+  $password = trim($form_state['values']['pass']);
+  
+  require_once drupal_get_path('module', 'drupalvb') .'/drupalvb.inc';
+  if (!drupalvb_db_is_valid()) {
+    return;
+  }
+  
+  if ($vbuser = db_fetch_array(drupalvb_db_query("SELECT userid, password, salt, email FROM {user} WHERE username = '%s'", $username))) {
+    // Rebuild the password.
+    $vbpassword = md5(md5($password) . $vbuser['salt']);
+    if ($vbuser['password'] === $vbpassword) {
+      // Register this user in Drupal. user_authenticate() will store a
+      // randomly generated password and no user data at all otherwise.
+      // Note that if the username already exists, user_save will happily return FALSE.
+      $userinfo = array(
+        'name' => $username,
+        'pass' => $password,
+        'mail' => $vbuser['email'],
+        'init' => $username,
+        'status' => 1,
+        'authname_drupalvb' => $username,
+      );
+      $user = user_save('', $userinfo);
+      if ($user) {
+        watchdog('user', 'New external user: %user using module %module.', array('%user' => $name, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit'));
+      }
+      return TRUE;
+    }
+  } 
+}
+
+/**
  * Implementation of hook_info().
  */
-function drupalvb_info($field = 0) {
+/*function drupalvb_info($field = 0) {
   $info['name'] = 'vBulletin';
   $info['protocol'] = 'DB';
 
@@ -123,12 +179,12 @@ function drupalvb_info($field = 0) {
   else {
     return $info;
   }
-}
+}*/
 
 /**
  * Implementation of hook_auth().
  */
-function drupalvb_auth($username, $password, $server = NULl) {
+/*function drupalvb_auth($username, $password, $server = NULl) {
   if (!variable_get('drupalvb_dual_login', TRUE)) {
     return;
   }
@@ -154,11 +210,11 @@ function drupalvb_auth($username, $passw
         'authname_drupalvb' => $username,
       );
       $user = user_save('', $userinfo);
-      watchdog('user', t('New external user: %user using module %module.', array('%user' => $name, '%module' => $module)), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit'));
+      watchdog('user', 'New external user: %user using module %module.', array('%user' => $name, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit'));
       return TRUE;
     }
   }
-}
+}*/
 
 /**
  * Implementation of hook_user().
@@ -196,7 +252,7 @@ function drupalvb_user($op, &$edit, &$ac
  */
 function drupalvb_user_login($account) {
   // If user does not exist in vB, create one.
-  if (db_num_rows(drupalvb_db_query("SELECT userid FROM {user} WHERE username = '%s'", $account->name)) < 1) {
+  if (db_result(drupalvb_db_query("SELECT count(*) FROM {user} WHERE username = '%s'", $account->name)) < 1) {
     drupalvb_create_user($account, (array)$account);
   }
   // Set last activity time and ensure user mapping.
@@ -207,7 +263,7 @@ function drupalvb_user_login($account) {
   }
   else {
     drupal_set_message(t('Login to forums failed.'), 'error');
-    watchdog('drupalvb', t('Login failed for forum user %user.', array('%user' => $account->name)), WATCHDOG_ERROR);
+    watchdog('drupalvb', 'Login failed for forum user %user.', array('%user' => $account->name), WATCHDOG_ERROR);
     return FALSE;
   }
 }
@@ -228,11 +284,11 @@ function drupalvb_user_logout($account) 
     drupalvb_db_query("UPDATE {user} SET lastvisit = %d WHERE username = '%s'", time(), $userinfo['username']);
     drupalvb_db_query("DELETE FROM {session} WHERE userid = '%s'", $userinfo['userid']);
     $num = TRUE;
-    watchdog('drupalvb', t('Forum session closed for user %username (@uid).', array('%username' => $userinfo['username'], '@uid' => $userinfo['userid'])));
+    watchdog('drupalvb', 'Forum session closed for user %username (@uid).', array('%username' => $userinfo['username'], '@uid' => $userinfo['userid']));
   }
   // If the user doesn't exist... then how the heck did they log in??
   if (!$num) {
-    watchdog('drupalvb', t('Attempt to logout forum user %user who does not exist!', array('%user' => $account->name)), WATCHDOG_ERROR);
+    watchdog('drupalvb', 'Attempt to logout forum user %user who does not exist!', array('%user' => $account->name), WATCHDOG_ERROR);
   }
 
   // Remove all vB cookies for current user.
@@ -256,7 +312,7 @@ function drupalvb_user_validate($uid, &$
   }
 
   // Validate the e-mail address.
-  if (db_num_rows(drupalvb_db_query("SELECT userid FROM {user} WHERE userid != %d AND LOWER(email) = LOWER('%s')", $userid, $edit['mail'])) > 0) {
+  if (db_result(drupalvb_db_query("SELECT count(*) FROM {user} WHERE userid != %d AND LOWER(email) = LOWER('%s')", $userid, $edit['mail'])) > 0) {
     form_set_error('mail', t('The e-mail address %email is already registered. <a href="@password">Have you forgotten your password?</a>', array('%email' => $edit['mail'], '@password' => url('user/password'))));
   }
 }
@@ -301,7 +357,7 @@ function drupalvb_user_update($account, 
     }
     else {
       drupal_set_message(t('Update failed. Notifying system administrator.'), 'error');
-      watchdog('drupalvb', t('Failed to update a forum account for user %user.', array('%user' => $account->name)), WATCHDOG_ERROR);
+      watchdog('drupalvb', 'Failed to update a forum account for user %user.', array('%user' => $account->name), WATCHDOG_ERROR);
     }
   }
 
@@ -326,7 +382,7 @@ function drupalvb_user_delete($account) 
     db_query("DELETE FROM {drupalvb_users} WHERE userid = %d", $userid);
   }
   else {
-    watchdog('drupalvb', t('Attempt to delete user %user who does not exist!', array('%user' => $account->name)), WATCHDOG_ERROR);
+    watchdog('drupalvb', 'Attempt to delete user %user who does not exist!', array('%user' => $account->name), WATCHDOG_ERROR);
   }
 }
 
@@ -535,16 +591,27 @@ function drupalvb_block($op = 'list', $d
 }
 
 /**
+ * Implementation of hook_theme().
+ */
+function drupalvb_theme() {
+  return array(
+    'drupalvb_block_recent' => array(
+      'arguments' => array('recent' => NULL, 'vb_options' => NULL),
+    ),
+  );
+}
+
+/**
  * Generate HTML for Recent threads/posts block.
  */
 function theme_drupalvb_block_recent($recent, $vb_options) {
   $items = array();
   $display_authors = variable_get('drupalvb_block_recent_authors', 0);
   foreach ($recent as $item) {
-    $items[] = l($item['title'], $item['url'], array(), $item['query'], $item['fragment']) . ($display_authors ? ' <em>'. $item['name'] .'</em>' : '');
+    $items[] = l($item['title'], $item['url'], array('query' => $item['query'], 'fragment' => $item['fragment'])) . ($display_authors ? ' <em>'. $item['name'] .'</em>' : '');
   }
   $output = theme('item_list', $items);
-  $output .= l(t('View the forum'), $vb_options['bburl']);
+  $output .= l('View the forum', $vb_options['bburl']);
   return $output;
 }
 
