Version 1.3.0
This commit is contained in:
1 parent
7ef3d1712a
commit
f87d29ba65
290 files changed
+50206
-17930
No files matched your search
@@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<title>Hivemail -> IPB Set Up</title>
|
||||
|
||||
<style type='text/css'>
|
||||
body
|
||||
{
|
||||
background-color:#FFF;
|
||||
background-image: url(http://www.invisionboard.com/tutorial/hivemail/img/bg.jpg);
|
||||
background-repeat: repeat-y;
|
||||
padding: 0px;
|
||||
margin: 10px;
|
||||
font-family: verdana;
|
||||
font-size:12px;
|
||||
text-align:center;
|
||||
}
|
||||
table
|
||||
{
|
||||
font-family: verdana;
|
||||
font-size:11px;
|
||||
}
|
||||
img { border:0px }
|
||||
.headline { font-family:"Trebuchet MS", verdana, arial, sans-serif; font-size:40px;font-weight:bold }
|
||||
.subline { font-family:"Trebuchet MS", verdana, arial, sans-serif; font-size:18px;color:#009 }
|
||||
#wrapper { text-align:left; margin-left:auto;margin-right:auto;width:90% }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
<span class="headline">Integrating HiveMail with IPB 1.2</span>
|
||||
<br />
|
||||
An Invision Power Board Guide detailing how to set up your HiveMail installation with IPB.
|
||||
<br />
|
||||
<br />
|
||||
<span class="subline">Required Components</span>
|
||||
<br /><br />
|
||||
You should have already installed HiveMail (1.2+) into a directory called "mail" on your server, in the same root folder as the one
|
||||
that contains your IPB forums folder.
|
||||
<br /><br />
|
||||
<b>An example structure</b>
|
||||
<br />
|
||||
/home/domain/public_html/mail/
|
||||
<br />/home/domain/public_html/forums/
|
||||
|
||||
<br /><br />
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left" width="95%" style="padding-right:6px" valign="top">
|
||||
<span class="subline">Configuring the files</span>
|
||||
<br /><br />
|
||||
Before you go any further, you may need to edit one of the included IPB files.
|
||||
<br /><br />If you are using HiveMail 1.2.1, they you <b>do not</b> need to edit any files.
|
||||
<br /><br />If you are using any version previous to 1.2.1, then you'll need to open "invision_plugin.php" and change the arrowed line in the picture to: <kbd>define( 'HIVE_TBL', '' )</kbd> or you will receive errors!
|
||||
</td>
|
||||
<td align="center" width="5%" valign="top"><a href="http://www.invisionboard.com/tutorial/hivemail/img/hive_code.jpg" target="_blank"><img src="http://www.invisionboard.com/tutorial/hivemail/img/hive_code_thumb.jpg" alt="IMG" /></a><br />Click picture to enlarge</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br /><br />
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left" width="95%" style="padding-right:6px" valign="top">
|
||||
<span class="subline">Uploading the files</span>
|
||||
<br /><br />
|
||||
<b>Upload the following files</b>
|
||||
<br /><br />Where "forums" is shown, this is your IPB installation, it does not have to be forums.
|
||||
<br /><br />
|
||||
<kbd>/forums/modules/ipb_member_sync.php
|
||||
<br /><br />/forums/modules/mod_hivemail.php
|
||||
<br /><br />/forums/register.php
|
||||
<br /><br />/mail/includes/invision_plugin.php</kdb>
|
||||
</td>
|
||||
<td align="center" width="5%" valign="top"><a href="http://www.invisionboard.com/tutorial/hivemail/img/hive_dir.jpg" target="_blank"><img src="http://www.invisionboard.com/tutorial/hivemail/img/hive_dir_thumb.jpg" alt="IMG" /></a><br />Click picture to enlarge</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br /><br />
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left" width="95%" style="padding-right:6px" valign="top">
|
||||
<span class="subline">Configuring HiveMail</span>
|
||||
<br /><br />
|
||||
<b>Log into the HiveMail admin center</b>
|
||||
<br />
|
||||
<ul>
|
||||
<li>Under "HiveMail" click on "Options" in the menu.
|
||||
<li>When the options menu has loaded, click option 13 "vBulletin Integration"
|
||||
<li>Complete the form in a similar way show by the screenshot, mentally substituting "vBulletin" for "IPB"
|
||||
</ul>
|
||||
<br />
|
||||
If you enabled "Allow regular registration", your members can register for HiveMail outside of the board, if not enabled, clicking on the "Sign Up" button on the HiveMail index page
|
||||
will take your visitor to the IPB registration page (with the option of HiveMail email). If you visitor is already registered and logged into IPB, they will be taken to a dedicated HiveMail signup page.
|
||||
<br /><br />
|
||||
<a href="http://www.invisionboard.com/tutorial/hivemail/img/hive_ipb_reg.jpg" target="_blank">Show IPB Reg Form Screen Shot</a> · <a href="http://www.invisionboard.com/tutorial/hivemail/img/hive_ipb_cp.jpg" target="_blank">Show IPB HiveMail Sign Up Page</a>
|
||||
</td>
|
||||
<td align="center" width="5%" valign="top"><a href="http://www.invisionboard.com/tutorial/hivemail/img/hive_options.jpg" target="_blank"><img src="http://www.invisionboard.com/tutorial/hivemail/img/hive_options_thumb.jpg" alt="IMG" /></a><br />Click picture to enlarge</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br /><br />
|
||||
<span class="subline">That's it! You're all done!</span>
|
||||
<br /><br />
|
||||
<br />
|
||||
~Matt for IPS, Inc. Aug 03
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,355 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board v1.2 Module File
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2003 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Member Sync Module File
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: 7th July 2003
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
|
|
||||
| USAGE:
|
||||
| ------
|
||||
|
|
||||
| This module is designed to hold any module modifications to with registration
|
||||
| It doesn't do much in itself, but custom code can be added to handle
|
||||
| synchronization, etc.
|
||||
|
|
||||
| - on_create_account: Is called upon successful account creation
|
||||
| - on_register_form: Is called when the form is displayed
|
||||
| - on_login: Is called when logged in succcessfully
|
||||
| - on_delete: Is called when member deleted (single, multiple)
|
||||
| - on_email_change: When email address change is confirmed
|
||||
| - on_profile_update: When profile is updated (msn, sig, etc)
|
||||
| - on_pass_change: When password is updated
|
||||
| - on_group_change: When the member's membergroup has changed
|
||||
| - on_name_change: When the member's name has been changed
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
class ipb_member_sync
|
||||
{
|
||||
var $class = "";
|
||||
var $hiveid = 0;
|
||||
var $html = "";
|
||||
var $hive = "";
|
||||
|
||||
function ipb_member_sync()
|
||||
{
|
||||
global $DB, $ibforums;
|
||||
|
||||
if ( $ibforums->member['id'] )
|
||||
{
|
||||
$DB->query("SELECT id, hiveuserid FROM ibf_member_extra WHERE id={$ibforums->member['id']}");
|
||||
|
||||
$r = $DB->fetch_row();
|
||||
|
||||
$this->hiveid = intval($r['hiveuserid']);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// register_class($class)
|
||||
//
|
||||
// Register a $this-> with this class
|
||||
//
|
||||
//-----------------------------------------------
|
||||
|
||||
function register_class($class)
|
||||
{
|
||||
$this->class = &$class;
|
||||
$this->error = "";
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// on_create_account($member)
|
||||
//
|
||||
// $member = array( 'id', 'name', 'email',
|
||||
// 'password', 'mgroup'...etc)
|
||||
//
|
||||
//-----------------------------------------------
|
||||
|
||||
function on_create_account($member)
|
||||
{
|
||||
global $DB, $std, $ibforums;
|
||||
|
||||
//---- START
|
||||
|
||||
//-------------------------------------------
|
||||
// Add hivemail account?
|
||||
//-------------------------------------------
|
||||
|
||||
$ibforums->input['hive_username'] = trim($ibforums->input['hive_username']);
|
||||
|
||||
if ( $ibforums->input['hive_username'] != "" )
|
||||
{
|
||||
|
||||
define('IPB_PLUGIN', true);
|
||||
require_once('../mail/includes/invision_plugin.php');
|
||||
|
||||
$this->hive = new invision_plugin();
|
||||
|
||||
$this->hive->hivemail_register_user($member, true);
|
||||
|
||||
if ( $this->hive->hive_error != "" )
|
||||
{
|
||||
$ibforums->lang['thing_name_taken'] = sprintf( $ibforums->lang['thing_name_taken'] , 'Board Email Address' );
|
||||
$ibforums->lang['incorrect_thing_name'] = sprintf( $ibforums->lang['incorrect_thing_name'], 'Board Email Address' );
|
||||
|
||||
$this->class->show_reg_form($this->hive->hive_error);
|
||||
$this->error = 1;
|
||||
$this->hive->destructor();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->hive->destructor();
|
||||
}
|
||||
|
||||
//---- END
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// on_register_form()
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------
|
||||
|
||||
function on_register_form()
|
||||
{
|
||||
global $DB, $std, $ibforums;
|
||||
|
||||
//---- START
|
||||
|
||||
//-------------------------------------------
|
||||
// HiveMail integration
|
||||
// As register_form is defualt action, we can
|
||||
// either show the hivemail entry in the reg
|
||||
// form if they are not a member, or we can
|
||||
// show the hive mail only sign up form
|
||||
//-------------------------------------------
|
||||
|
||||
if ( $this->hive == "" )
|
||||
{
|
||||
define('IPB_PLUGIN', true);
|
||||
require_once('../mail/includes/invision_plugin.php');
|
||||
|
||||
$this->hive = new invision_plugin();
|
||||
}
|
||||
|
||||
if ( $ibforums->member['id'] )
|
||||
{
|
||||
//-------------------------------------------
|
||||
// They are a member, are they a hivemail member?
|
||||
//-------------------------------------------
|
||||
|
||||
if ( $this->hiveid AND $hiveuser = $this->hive->DB_Hive->query_first("SELECT userid FROM ".HIVE_TBL."user WHERE userid = {$this->hiveid}"))
|
||||
{
|
||||
//-------------------------------------------
|
||||
// yeah, chuck 'em to ucp then
|
||||
//-------------------------------------------
|
||||
|
||||
if ( $ibforums->input['mailsignup'] )
|
||||
{
|
||||
$this->hive->destructor();
|
||||
$std->boink_it( $ibforums->base_url.'act=UserCP' );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//-------------------------------------------
|
||||
// Forward them to the IPB module to show
|
||||
// mail only sign-up
|
||||
//-------------------------------------------
|
||||
|
||||
if ( $ibforums->input['mailsignup'] )
|
||||
{
|
||||
$this->hive->destructor();
|
||||
$std->boink_it( $ibforums->base_url.'act=module&module=hivemail&show=forumform' );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//-------------------------------------------
|
||||
// Normal reg form! chop in hivemail option
|
||||
//-------------------------------------------
|
||||
|
||||
$extra = $this->class->html->field_entry(
|
||||
'Enter a username for your own board email account',
|
||||
'This is optional, please leave blank if you do not wish to get an email account.<br />Only letters and numbers please.',
|
||||
$this->class->html->field_textinput('hive_username', $ibforums->input['hive_username'])." <select name='hive_userdomain' class='forminput'>".$this->hive->hive_domainname_options."</select>"
|
||||
);
|
||||
|
||||
$this->class->output = str_replace( "<!--IBF.MODULES.EXTRA-->", $extra, $this->class->output );
|
||||
|
||||
}
|
||||
|
||||
$this->hive->destructor();
|
||||
|
||||
//---- END
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// on_login()
|
||||
//
|
||||
// $member = array( 'id', 'name', 'email', 'pass')
|
||||
// ...etc
|
||||
//-----------------------------------------------
|
||||
|
||||
function on_login($member=array())
|
||||
{
|
||||
global $DB, $std, $ibforums;
|
||||
|
||||
//---- START
|
||||
|
||||
|
||||
|
||||
//---- END
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// on_delete($ids)
|
||||
//
|
||||
// $ids = array | integer
|
||||
// If array, will contain list of ids
|
||||
//-----------------------------------------------
|
||||
|
||||
function on_delete($ids=array())
|
||||
{
|
||||
global $DB, $std, $ibforums;
|
||||
|
||||
$type = "";
|
||||
|
||||
//---- START
|
||||
|
||||
if ( is_array($ids) and count($ids) > 0 )
|
||||
{
|
||||
$type = arr;
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = int;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//---- END
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// on_email_change($id, $new_email)
|
||||
//
|
||||
// $id = int member_id
|
||||
// $new_email = string new email address
|
||||
//-----------------------------------------------
|
||||
|
||||
function on_email_change($id, $new_email)
|
||||
{
|
||||
global $DB, $std, $ibforums;
|
||||
|
||||
//---- START
|
||||
|
||||
|
||||
//---- END
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// on_pass_change($id, $new_raw)
|
||||
//
|
||||
// $id = int member_id
|
||||
// $new_raw = string new plain text password
|
||||
//-----------------------------------------------
|
||||
|
||||
function on_pass_change($id, $new_raw)
|
||||
{
|
||||
global $DB, $std, $ibforums;
|
||||
|
||||
//---- START
|
||||
|
||||
//-------------------------------------------
|
||||
// HiveMail integration
|
||||
// Update hivemail passy
|
||||
//-------------------------------------------
|
||||
|
||||
if ( $this->hive == "" )
|
||||
{
|
||||
define('IPB_PLUGIN', true);
|
||||
require_once('../mail/includes/invision_plugin.php');
|
||||
|
||||
$this->hive = new invision_plugin();
|
||||
}
|
||||
|
||||
$this->hive->hivemail_update_password(md5($new_raw), $id);
|
||||
|
||||
$this->hive->destructor();
|
||||
|
||||
//---- END
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// on_profile_update($member)
|
||||
//
|
||||
// 'website','icq_number','aim_name','yahoo','msnname','integ_msg'
|
||||
// 'location','interests', 'title'
|
||||
// 'id'
|
||||
//-----------------------------------------------
|
||||
|
||||
function on_profile_update( $member=array(), $custom_fields=array() )
|
||||
{
|
||||
global $DB, $std, $ibforums;
|
||||
|
||||
//---- START
|
||||
|
||||
|
||||
//---- END
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// on_group_change()
|
||||
//
|
||||
// $id = int member_id
|
||||
// $new_group = new int() group id
|
||||
//-----------------------------------------------
|
||||
|
||||
function on_group_change( $id, $new_group )
|
||||
{
|
||||
global $DB, $std, $ibforums;
|
||||
|
||||
//---- START
|
||||
|
||||
|
||||
//---- END
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// on_name_change()
|
||||
//
|
||||
// $id = int member_id
|
||||
// $new_group = new name
|
||||
//-----------------------------------------------
|
||||
|
||||
function on_name_change( $id, $new_name )
|
||||
{
|
||||
global $DB, $std, $ibforums;
|
||||
|
||||
//---- START
|
||||
|
||||
|
||||
//---- END
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board v1.2 Module File
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2003 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
| > Hive Mail Module
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: 8th July 2003
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
//=====================================
|
||||
// Define class, this must be the same
|
||||
// in all modules
|
||||
//=====================================
|
||||
|
||||
class module extends module_loader
|
||||
{
|
||||
|
||||
var $class = "";
|
||||
var $module = "";
|
||||
var $html = "";
|
||||
|
||||
var $result = "";
|
||||
var $hive = "";
|
||||
var $hiveid = "";
|
||||
|
||||
function module()
|
||||
{
|
||||
global $ibforums, $DB, $std, $print;
|
||||
|
||||
//-------------------------------------------
|
||||
// Load skin / lang stuff
|
||||
//-------------------------------------------
|
||||
|
||||
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_register', $ibforums->lang_id);
|
||||
$this->html = $std->load_template('skin_register');
|
||||
|
||||
//-------------------------------------------
|
||||
// Are we a hivemail member?
|
||||
//-------------------------------------------
|
||||
|
||||
$DB->query("SELECT id, hiveuserid FROM ibf_member_extra WHERE id={$ibforums->member['id']}");
|
||||
|
||||
$r = $DB->fetch_row();
|
||||
|
||||
$this->hiveid = intval($r['hiveuserid']);
|
||||
|
||||
//-------------------------------------------
|
||||
// Load Hivemail plug in
|
||||
//-------------------------------------------
|
||||
|
||||
define('IPB_PLUGIN', true);
|
||||
require_once('../mail/includes/invision_plugin.php');
|
||||
|
||||
$this->hive = new invision_plugin();
|
||||
|
||||
//-------------------------------------------
|
||||
// If we're not a member...
|
||||
//-------------------------------------------
|
||||
|
||||
if ( ! $ibforums->member['id'] )
|
||||
{
|
||||
$std->boink_it( $ibforums->base_url );
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
// Do we already have a hivemail membership?
|
||||
//-------------------------------------------
|
||||
|
||||
if ( $this->hiveid AND $hiveuser = $this->hive->DB_Hive->query_first("SELECT userid FROM ".HIVE_TBL."user WHERE userid = {$this->hiveid}"))
|
||||
{
|
||||
$this->hive->destructor();
|
||||
$std->boink_it( $ibforums->base_url );
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
// Whatcha doin'? Yes - you?
|
||||
//-------------------------------------------
|
||||
|
||||
switch( $ibforums->input['show'] )
|
||||
{
|
||||
case 'forumform':
|
||||
$this->show_forumform();
|
||||
break;
|
||||
case 'addmail':
|
||||
$this->add_mail();
|
||||
|
||||
default:
|
||||
$this->show_forumform();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function add_mail()
|
||||
{
|
||||
global $ibforums, $DB, $std, $print;
|
||||
|
||||
$hive_username = trim($ibforums->input['hive_username']);
|
||||
|
||||
//------------------------------------------
|
||||
// Check for errors
|
||||
//------------------------------------------
|
||||
|
||||
if ( $hive_username == "" )
|
||||
{
|
||||
$this->show_forumform('js_blanks');
|
||||
}
|
||||
|
||||
$this->hive->hivemail_register_user($ibforums->member, false);
|
||||
|
||||
if ( $this->hive->hive_error != "" )
|
||||
{
|
||||
$ibforums->lang['thing_name_taken'] = sprintf( $ibforums->lang['thing_name_taken'] , 'Board Email Address' );
|
||||
$ibforums->lang['incorrect_thing_name'] = sprintf( $ibforums->lang['incorrect_thing_name'], 'Board Email Address' );
|
||||
|
||||
$this->show_forumform($this->hive->hive_error);
|
||||
$this->error = 1;
|
||||
$this->hive->destructor();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->hive->destructor();
|
||||
|
||||
$print->redirect_screen("your email account has been created, forwarding you to the email log-in page", "/mail/index.php", 1);
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// Show Forum Form
|
||||
//
|
||||
// Show the already reg'd member's mail form
|
||||
//
|
||||
//------------------------------------------
|
||||
|
||||
function show_forumform($errors="")
|
||||
{
|
||||
global $ibforums, $DB, $std, $print;
|
||||
|
||||
$this->page_title = "Sign up for your email account";
|
||||
|
||||
$hidden = "";
|
||||
$action = $ibforums->base_url.'act=module&module=hivemail&show=addmail';
|
||||
|
||||
$content = $this->html->field_entry('Account Name:',
|
||||
'The password for your email account will be the same as your forum account.<br />Letters and numbers only please.',
|
||||
$this->html->field_textinput('hive_username', $ibforums->input['hive_username'])." <select name='hive_userdomain' class='forminput'>".$this->hive->hive_domainname_options."</select>"
|
||||
);
|
||||
|
||||
if ($errors != "")
|
||||
{
|
||||
$this->output .= $this->html->errors( $ibforums->lang[$errors] );
|
||||
}
|
||||
|
||||
$this->output .= $this->html->tmpl_form($action, $hidden, $this->page_title, $content );
|
||||
|
||||
$print->add_output("$this->output");
|
||||
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board v1.2 HiveMail register.php file
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2003 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// This file allows Hive Mail to integrate to IPB without restructuring too much
|
||||
|
||||
// Simply direct to IPB's register.
|
||||
|
||||
require "./conf_global.php";
|
||||
|
||||
$url = $INFO['board_url'].'/index.'.$INFO['php_ext'].'?act=Reg&mailsignup=1&coppa_pass=1';
|
||||
|
||||
@header("Location: $url");
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,284 @@
|
||||
<?php
|
||||
//
|
||||
// +-------------------------------------------------------------+
|
||||
// | HiveMail version 1.2 (English)
|
||||
// | Copyright ©2002-2003 Chen Avinadav <chen@hivemail.com>
|
||||
// +-------------------------------------------------------------+
|
||||
// | HIVEMAIL IS NOT FREE SOFTWARE
|
||||
// | If you have downloaded this software from a website other
|
||||
// | than www.hivemail.com or if you have otherwise received
|
||||
// | this software from someone who is not a representative of
|
||||
// | this organization you are involved in an illegal activity.
|
||||
// | License agreement: http://www.hivemail.com/license.html
|
||||
// +-------------------------------------------------------------+
|
||||
// |
|
||||
// | INVISION POWER BOARD v1.2 (RC2+) INTEGRATION
|
||||
// |
|
||||
// +-------------------------------------------------------------+
|
||||
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Stop people from calling this file directly
|
||||
//-------------------------------------------------------
|
||||
|
||||
if ( ! defined('IPB_PLUGIN') )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
class invision_plugin
|
||||
{
|
||||
var $hive_error = "";
|
||||
var $hive_options = array();
|
||||
var $this_folder = "";
|
||||
var $DB_Hive = "";
|
||||
|
||||
|
||||
function invision_plugin()
|
||||
{
|
||||
|
||||
//=========================================
|
||||
// EDIT THIS IF NEEDED
|
||||
//=========================================
|
||||
|
||||
define( 'HIVE_TBL', 'hive_' );
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Change to right directory
|
||||
//-------------------------------------------------------
|
||||
|
||||
$this->this_folder = getcwd();
|
||||
|
||||
chdir(dirname(__FILE__));
|
||||
|
||||
//-------------------------------------------------------
|
||||
// We are outside the admin CP
|
||||
//-------------------------------------------------------
|
||||
|
||||
define('INADMIN', false);
|
||||
|
||||
define('VB_PLUGIN', 1 );
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Start database connection
|
||||
//-------------------------------------------------------
|
||||
|
||||
require('../includes/config.php');
|
||||
require('../includes/db_mysql.php');
|
||||
|
||||
if ( ! function_exists('version_compare') or version_compare(phpversion(), '4.2.0') < 0 )
|
||||
{
|
||||
$config['server'] .= ':3306';
|
||||
}
|
||||
|
||||
$this->DB_Hive = new DB_MySQL($config, true, true);
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Get all common functions
|
||||
//-------------------------------------------------------
|
||||
|
||||
require('../includes/init.php');
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Get options
|
||||
//-------------------------------------------------------
|
||||
|
||||
while ( $setting = $this->DB_Hive->fetch_array($settings, 'SELECT * FROM '.HIVE_TBL.'setting') )
|
||||
{
|
||||
$this->hive_options["$setting[variable]"] = $setting['value'];
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// The domain names array
|
||||
//-------------------------------------------------------
|
||||
|
||||
$this->hive_options['domainnames'] = preg_split("#\r?\n#", $this->hive_options['domainname']);
|
||||
$this->hive_options['domainname'] = $this->hive_options['domainnames'][0];
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Create the option list of domain names
|
||||
//-------------------------------------------------------
|
||||
|
||||
$this->hive_domainname_options = '';
|
||||
|
||||
if ( is_array($this->hive_options['domainnames']) and count($this->hive_options['domainnames']) > 0 )
|
||||
{
|
||||
foreach ( $this->hive_options['domainnames'] as $curdomainname )
|
||||
{
|
||||
$this->hive_domainname_options .= "<option value=\"$curdomainname\"".iif($userdomain == $curdomainname, ' selected="selected"', '').">$curdomainname</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Creates a user
|
||||
//-------------------------------------------------------
|
||||
|
||||
function hivemail_register_user($member, $onreg = true)
|
||||
{
|
||||
global $ibforums, $DB, $std;
|
||||
|
||||
if ( ! $this->hive_options['regopen'] )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$hive_username = trim($ibforums->input['hive_username']);
|
||||
$hive_userdomain = trim($ibforums->input['hive_userdomain']);
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Domain name
|
||||
//-------------------------------------------------------
|
||||
|
||||
if ( ! in_array( $hive_userdomain, $this->hive_options['domainnames'] ) )
|
||||
{
|
||||
$hive_userdomain = $hive_options['domainname'];
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Some error checking
|
||||
//-------------------------------------------------------
|
||||
|
||||
if ($this->DB_Hive->query_first("SELECT username FROM ".HIVE_TBL."user WHERE username = '$hive_username'"))
|
||||
{
|
||||
if ($onreg)
|
||||
{
|
||||
$this->delete_reg_user($member['id']);
|
||||
}
|
||||
|
||||
$this->hive_error = 'thing_name_taken';
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
elseif ( preg_match('#[^a-z0-9_.]#i', $hive_username) or preg_match('#^[^a-z]#i', $hive_username) or strlen($hive_username) < 2 )
|
||||
{
|
||||
if ($onreg)
|
||||
{
|
||||
$this->delete_reg_user($member['id']);
|
||||
}
|
||||
|
||||
$this->hive_error = 'incorrect_thing_name';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Create user
|
||||
//-------------------------------------------------------
|
||||
|
||||
$this->DB_Hive->query("
|
||||
INSERT INTO ".HIVE_TBL."user
|
||||
(userid, username, password, usergroupid, skinid, realname, regdate, lastvisit, cols, birthday, options, replyto, font, timezone, soundid, domain, vbuserid, altemail)
|
||||
VALUES
|
||||
(NULL, '".addslashes($hive_username)."', '".addslashes($member['password'])."', ".iif($this->hive_options['moderate'], 3, 2).", ".$this->hive_options['defaultskin'].", '".addslashes($member['name'])."', ".TIMENOW.", ".TIMENOW.", '".addslashes(USER_DEFAULTCOLS)."', '".addslashes('0')."', ".USER_DEFAULTBITS.", '".addslashes($hive_username.$hive_userdomain)."', 'Verdana|10|Regular|Black|None', '".addslashes('0')."', ".intval($this->DB_Hive->get_field('SELECT soundid FROM '.HIVE_TBL.'sound WHERE userid <= 0 ORDER BY userid LIMIT 1')).", '".addslashes($ibforums->input['hive_userdomain'])."', {$member['id']}, '".addslashes($member['email'])."')
|
||||
");
|
||||
|
||||
$hive_userid = $this->DB_Hive->insert_id();
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Log user in
|
||||
//-------------------------------------------------------
|
||||
|
||||
if ($onreg)
|
||||
{
|
||||
$userid = $member['id'];
|
||||
ini_set('session.name', 'hivesession');
|
||||
session_start();
|
||||
$std->my_setcookie(session_name(), session_id(), TIMENOW + (60 * 60 * 24 * 365));
|
||||
$_SESSION['userid'] = $hive_userid;
|
||||
$_SESSION['password'] = md5(md5($member['password']));
|
||||
$_SESSION['ipaddress'] = md5(IPADDRESS);
|
||||
$_SESSION['staylogged'] = 365;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Update Invision's database
|
||||
//-------------------------------------------------------
|
||||
|
||||
if ( ! $DB->field_exists( 'hiveuserid', 'ibf_member_extra' ) )
|
||||
{
|
||||
$DB->query("ALTER TABLE ibf_member_extra ADD hiveuserid mediumint(8) NOT NULL DEFAULT ''");
|
||||
}
|
||||
|
||||
$DB->query("SELECT id, hiveuserid FROM ibf_member_extra WHERE id={$member['id']}");
|
||||
|
||||
if ( $r = $DB->fetch_row() )
|
||||
{
|
||||
// User _extra exists, update...
|
||||
|
||||
$DB->query("UPDATE ibf_member_extra SET hiveuserid=$hive_userid WHERE id={$member['id']}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// User _extra doesn't exist...
|
||||
|
||||
$DB->query("INSERT INTO ibf_member_extra SET hiveuserid=$hive_userid, id={$member['id']}");
|
||||
}
|
||||
|
||||
return $hive_userid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Delete new reg. user if error during registration
|
||||
//-------------------------------------------------------
|
||||
|
||||
function delete_reg_user($userid)
|
||||
{
|
||||
global $DB;
|
||||
|
||||
$DB->query("DELETE FROM ibf_members WHERE id=$userid");
|
||||
$DB->query("DELETE FROM ibf_member_extra WHERE id=$userid");
|
||||
$DB->query("DELETE FROM ibf_pfields_content WHERE member_id=$userid");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Updates the user's hivemail password
|
||||
//-------------------------------------------------------
|
||||
|
||||
function hivemail_update_password($password, $userid)
|
||||
{
|
||||
$this->DB_Hive->query("
|
||||
UPDATE ".HIVE_TBL."user
|
||||
SET password = '".addslashes($password)."'
|
||||
WHERE vbuserid = $userid
|
||||
");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Desctructor
|
||||
//-------------------------------------------------------
|
||||
|
||||
function destructor()
|
||||
{
|
||||
chdir($this->this_folder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function stripslashesarray($array) {
|
||||
if (is_array($array)) {
|
||||
foreach($array as $key => $val) {
|
||||
if (is_array($val)) {
|
||||
$array["$key"] = stripslashesarray($val);
|
||||
} elseif (is_string($val)) {
|
||||
if (get_cfg_var('magic_quotes_sybase')) {
|
||||
$array["$key"] = str_replace("''", "'", $val);
|
||||
} else {
|
||||
$array["$key"] = stripslashes($val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
function iif($eval, $true, $false = '') {
|
||||
return (($eval == true) ? ($true) : ($false));
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user