? .svn
? LICENSE.txt
? drupalvb_total_d6_20080702.patch
? drupalvb_total_d6_20080703.patch
? drupalvb_total_d6_20080818.patch
Index: CHANGELOG.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/CHANGELOG.txt,v
retrieving revision 1.7.4.25
diff -r1.7.4.25 CHANGELOG.txt
1c1
< // $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 $
9d8
< #271663 by sun: Updated vBulletin version compatibility note.
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/README.txt,v
retrieving revision 1.8.4.5
diff -r1.8.4.5 README.txt
1c1
< /* $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 $ */
38c38
< * vBulletin 3.6.x / 3.7.x
---
> * vBulletin 3.6.x
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 -r1.1.2.5 drupalvb.admin-pages.inc
128,129c128,129
< 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'];
132c132
<   variable_set('drupalvb_db_prefix', $form_values['db_prefix']);
---
>   variable_set('drupalvb_db_prefix', $form_state['values']['db_prefix']);
169,170c169,170
< 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']) {
183a184
>   drupal_set_message('Number found: '. count($options));
185,186c186,188
<     $form['variables'][$key]['name'] = array('#value' => check_plain($key));
<     $form['variables'][$key]['value'] = array('#value' => check_plain($value));
---
>     $form['variables'][$key]['#type'] = 'item';
>     $form['variables'][$key]['#title'] = check_plain($key);
>     $form['variables'][$key]['#value'] = check_plain($value);
Index: drupalvb.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/drupalvb.inc,v
retrieving revision 1.6.2.6
diff -r1.6.2.6 drupalvb.inc
160,168d159
<  * 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()'));
< }
< 
< /**
192a184,187
> function drupalvb_last_insert_id($table, $field) {
>   return db_result(drupalvb_db_query('SELECT LAST_INSERT_ID()'));
> }
> 
Index: drupalvb.inc.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/drupalvb.inc.php,v
retrieving revision 1.9.4.13
diff -r1.9.4.13 drupalvb.inc.php
107c107
<   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) {
149c149
<   $userid = db_last_insert_id('user', 'userid');
---
>   $userid = drupalvb_last_insert_id('user', 'userid');
349,350c349,352
<     $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);
Index: drupalvb.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/drupalvb.info,v
retrieving revision 1.2.4.1
diff -r1.2.4.1 drupalvb.info
3a4,10
> 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 -r1.1.2.4 drupalvb.install
5,27c5,7
<  * 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.
---
>  * @file 
>  * Install file for drupalvb module.
>  * 
29,32d8
< function drupalvb_uninstall() {
<   db_query("DROP TABLE {drupalvb_users}");
< }
< 
34c10
<  * Move vB database url from settings.php into a variable.
---
>  * Implementation of hook_install().
36,49c12,15
< 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_install() {
>   drupal_install_schema('drupalvb');
>   require_once drupal_get_path('module', 'drupalvb') .'/drupalvb.inc';
>   _drupalvb_init_user_map();
53c19
<  * Install user id mapping table.
---
>  * Implementation of hook_schema().
55,65c21,31
< 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 */;");
---
> 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')
>     ),
>   );
67,71c33
<       require_once drupal_get_path('module', 'drupalvb') .'/drupalvb.inc';
<       _drupalvb_init_user_map();
<       break;
<   }
<   return $ret;
---
>   return $schema;
75c37,39
<  * Update block configuration variables.
---
>  * Implementation of hook_uninstall().
>  *
>  * @todo Variable clean-up.
77,102c41,42
< 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');
104d43
< 
Index: drupalvb.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalvb/drupalvb.module,v
retrieving revision 1.11.4.13
diff -r1.11.4.13 drupalvb.module
16,17c16,17
< function drupalvb_help($section) {
<   switch ($section) {
---
> function drupalvb_help($path, $arg) {
>   switch ($path) {
36c36
<       return filter_filter('process', 2, NULL, file_get_contents(dirname(__FILE__). '/README.txt'));
---
>       return filter_filter('process', 2, NULL, file_get_contents(dirname(__FILE__) .'/README.txt'));
43c43
< function drupalvb_menu($may_cache) {
---
> function drupalvb_menu() {
45,92c45,84
<   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,
>   );
113a106,179
>  * 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') {
>     
>     require_once drupal_get_path('module', 'drupalvb') .'/drupalvb.inc';
>     // Splice in our validate handler for authentication if user is performing a vb login.
>     if (!empty($form_state['post']['name']) && drupalvb_db_is_valid()) {
>       $username = $form_state['post']['name'];
>       if ($vbuser = db_fetch_array(drupalvb_db_query("SELECT userid, password, salt, email FROM {user} WHERE username = '%s'", $username))) {
>         $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']);
>   
>   // If this user already exists in the drupal instance, then we skip over the rest of this validate.
>   $finduser = user_load(array('name' => $username));
>   if ($finduser->uid) {
>     return TRUE;
>   }
>   
>   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;
>     }
>   } 
> }
> 
> /**
116c182
< function drupalvb_info($field = 0) {
---
> /*function drupalvb_info($field = 0) {
126c192
< }
---
> }*/
131c197
< function drupalvb_auth($username, $password, $server = NULl) {
---
> /*function drupalvb_auth($username, $password, $server = NULl) {
157c223
<       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'));
161c227
< }
---
> }*/
199c265
<   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) {
210c276
<     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);
231c297
<     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']));
235c301
<     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);
249c315
<     $vbuser = db_fetch_array(drupalvb_db_query("SELECT u.username, ub.liftdate FROM {user} u LEFT JOIN {userban} ub ON ub.userid = u.userid WHERE u.userid != %d AND LOWER(u.username) = LOWER('%s')", $userid, $edit['name']));
---
>     $vbuser = db_fetch_array(drupalvb_db_query("SELECT u.username, ub.liftdate FROM {user} u LEFT JOIN {userban} ub ON ub.userid = u.userid WHERE u.userid <> %d AND LOWER(u.username) = LOWER('%s')", $userid, $edit['name']));
259c325
<   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) {
304c370
<       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);
329c395
<     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);
537a604,614
>  * Implementation of hook_theme().
>  */
> function drupalvb_theme() {
>   return array(
>     'drupalvb_block_recent' => array(
>       'arguments' => array('recent' => NULL, 'vb_options' => NULL),
>     ),
>   );
> }
> 
> /**
544c621
<     $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>' : '');
547c624
<   $output .= l(t('View the forum'), $vb_options['bburl']);
---
>   $output .= l('View the forum', $vb_options['bburl']);
560c637
<   $output = '<p>'. "Below is a list of private messages you have received.  You may click on a user's name to see their profile, a message's title to view it, or a reply link to message the user in return." . '</p>';
---
>   $output = "<p>Below is a list of private messages you have received.  You may click on a user's name to see their profile, a message's title to view it, or a reply link to message the user in return.</p>";
576c653
<     $result = drupalvb_db_query("SELECT pm.pmid, pm.userid, pm.messageread, pmtext.fromusername, pmtext.fromuserid, pmtext.title, pmtext.message, pmtext.dateline FROM {pmtext} AS pmtext LEFT JOIN {pm} AS pm ON (pm.pmtextid = pmtext.pmtextid) WHERE pm.userid = %d AND pm.folderid != -1 ORDER BY pmtext.dateline DESC", $userinfo['userid']);
---
>     $result = drupalvb_db_query("SELECT pm.pmid, pm.userid, pm.messageread, pmtext.fromusername, pmtext.fromuserid, pmtext.title, pmtext.message, pmtext.dateline FROM {pmtext} AS pmtext LEFT JOIN {pm} AS pm ON (pm.pmtextid = pmtext.pmtextid) WHERE pm.userid = %d AND pm.folderid <> -1 ORDER BY pmtext.dateline DESC", $userinfo['userid']);
