drupaltin.module

<?php
// $Id: drupaltin.module,v 5.x-1.0a 2007/02/20 23:06:45 dries Exp $

   /*============================================================================*\ 
   ||                               -= Drupaltin =-                              ||
   ||                                                                            ||
   || By Jordan Starcher                                                         ||
   || drupaltin.module -> /drupal/modules/drupaltin/                             ||
   || Engineered for Drupal 5.x & vB 3.6.x                                       ||
   || Project Version 5.x-1.0a                                                   ||
   || File Version 1.01                                                          ||
   || February 20, 2007                                                          ||
   || Release under the GPL license                                              ||
   ||                                                                            ||
   ||                              Copyright ©2007                               ||
   ||                       http://www.TheOverclocked.com                        ||
   \*============================================================================*/


/**
* Implementation of hook_help()
*/
function drupalvb_help($section = 'admin/help#drupaltin') {
  switch (
$section) {
    case
'admin/modules#description':
      return
t("Integrates users from vBulletin into Drupal without sacrificing usability");
  }
}

/**
* Implementation of hook_perm()
*/
function drupaltin_perm() {
  return array(
'view drupaltin login');
}

/**
* Implementation of hook_block()
*/
function drupaltin_block($op = 'list', $delta = 0, $edit = array()) {
  global
$user;
    if (
$op == 'list') {
   
$blocks[0] = array('info' => t('Drupaltin login form'),
     
'weight' => 0, 'enabled' => 1, 'region' => 'left');
    return
$blocks;
  }
    else if (
$op == 'configure' && $delta == 0) {
    return
$form;
  }
  else if (
$op == 'view') {
    switch(
$delta) {
      case
0:
        if (!
$user->uid) {
         
$block['subject'] = t('User login');
         
$block['content'] = "<script type='text/javascript' src='http://forums.theoverclocked.com/clientscript/vbulletin_md5.js?v=364'></script><div><form action='http://forums.theoverclocked.com/login.php?do=login' method='post' onsubmit='md5hash(vb_login_md5password, vb_login_md5password_utf, 0' id='user-login-form'><div><input type='hidden' name='do' value='login' /><div><input type='hidden' name='url' value='/' /></div><div><input type='hidden' name='vb_login_md5password' /></div><div><input type='hidden' name='vb_login_md5password_utf' /></div><div><input type='hidden' name='s' value='' /></div><div><input type='hidden' name='url' value='http://www.theoverclocked.com' /></div></div>
             <div class='form-item'><label for='edit-name'>Username: <span class='form-required' title='This field is required.'>*</span></label><div><input type='text' class='form-text required' name='vb_login_username' id='edit-name' size='15' maxlength='60' accesskey='u' tabindex='1' /></div></div>
                 <div class='form-item'><label for='edit-pass'>Password: <span class='form-required' title='This field is required.'>*</span></label><div><input type='password' class='form-text required' name='vb_login_password' id='edit-pass' size='15' maxlength='60' tabindex='1' /></div><div><label for='cb_cookieuser'><input type='checkbox' name='cookieuser' value='1' id='cb_cookieuser' tabindex='1' checked='checked' />Remember Me</label></div></div>
            <div><input type='submit' class='button' value='Log In' accesskey='s' tabindex='1' /></div>
                <div class='item-list'>
                    <ul>

                        <li><a href='http://forums.theoverclocked.com/register.php' title='Create a new user account.'>Create new account</a></li>
                        <li><a href='http://forums.theoverclocked.com/login.php?do=lostpw' title='Request new password via e-mail.'>Forgotten Your Password?</a></li>
                    </ul>
                </div>
</form></div>"
;
        }
        return
$block;
    }
  }   
}


function
drupaltin_logout() {
   
header('Location: drupaltin_logout.php?do=logout');
}


/**
* Implementation of hook_menu()
*/
function drupaltin_menu($may_cache) {
        global
$user;
        if (
$may_cache) {
$items[] = array('path' => 'drupaltin_logout', 'title' => t('Log Out'),
     
'callback' => 'drupaltin_logout',
     
'access' => $user->uid, 'weight' => '10', 'type' => MENU_NORMAL_ITEM);
        }
        return
$items;
}
?>