• [MOD] Bridge: 4images 1.7.7 - vBulletin 3.8.3+ and 4.0.2 4 0 5 1
Currently:  

Author Topic: [MOD] Bridge: 4images 1.7.7 - vBulletin 3.8.3+ and 4.0.2  (Read 235038 times)

0 Members and 1 Guest are viewing this topic.

Offline denisnovikov

  • Test group
  • Full Member
  • *
  • Posts: 125
    • View Profile
[MOD] Bridge: 4images 1.7.7 - vBulletin 3.8.3+ and 4.0.2
« on: January 17, 2009, 02:38:45 PM »
Last update: 04 Mar 2010: known to work without any additional tuning with latest vBulletin 4.0.2

Index

  • Introduction
  • Demo
  • List of changed files
  • Installation
  • Notes
  • Known issues
  • Version history
  • Extras
  • Merging with other Mods

Introduction

This mod allows to use both 4images and vBulletin application transparently for users as they are one application. Registration and login are handling by the vBulletin app, users are creating into 4images database “on-the-fly”, on logged in user first request any of the 4images pages.


Demo

Thanks to Nicky for hosting live demo at:
httpx://www.nicky.net/demo/4images/
httpx://www.nicky.net/demo/vBulletin/
Updated: 4images 1.7.7 + vBulletin 4.0.2


List of changed files

New files:
   includes/vb.php
   global_usefulstuff.php

Modified:
   config.php
   global.php
   includes/sessions.php
   includes/page_header.php
   admin/admin_global.php
   admin/index.php
   templates/default/user_loginform.html


Installation

Step 1. New files

Download new files (newfiles.zip) and place them:
   a) vb.php into includes directory;
   b) global_usefulstuff.php into root directory of the 4images installation

Step 2. config.php

Add at the end of the file, before “?>” symbols:

Code: [Select]
define('VBULLETIN3_BRIDGE_ON', true);
define('VBULLETIN3_PATH', realpath(realpath(dirname(__FILE__)).'<vb_root>').'/');
define('VBULLETIN3_URL', '<vb_url>');

Where:
<vb_root> is relative path from the 4images’ root to vBulletin root. For example, if you have installed both apps at the same directory on your server and your vBulletin is located into ‘vBulletin’ directory (as it done at the Nicky’s server), type there: “/../vBulletin/” (without quotes). Note, on some servers small and caps letters are differ, so put it exactly as it named.
<vb_url> is your vBulletin installation relative to the root of server url, as users type it’s address in their web-browsers. Back to the Nicky’s installation, it should be “/vBulletin/” (again without quotes).


Step 3. global.php

Locate:

Code: [Select]
//-----------------------------------------------------
//--- Useful Stuff ------------------------------------
//-----------------------------------------------------
...
...
tons of code here
...
...
//-----------------------------------------------------
//--- Start DB ----------------------------------------
//-----------------------------------------------------

Remove everything between these two sections (“Useful Stuff” and “Start DB”) and a following code instead of deleted lines:

Code: [Select]
include(ROOT_PATH.'global_usefulstuff.php');

Step 4. includes/sessions.php

Locate somewhere around line 178:

Code: [Select]
function login($user_name = "", $user_password = "", $auto_login = 0, $set_auto_login = 1) {
Replace with:

Code: [Select]
function login($user_name = "", $user_password = "", $auto_login = 0, $set_auto_login = 1, $do_md5 = true) {
Locate somewhere around line 191:

Code: [Select]
$user_password = md5($user_password);
Replace with:

Code: [Select]
if($do_md5 == true) $user_password = md5($user_password);
Locate somewhere around line 418:

Code: [Select]
// Get Userinfo
$session_info = $site_sess->return_session_info();
$user_info = $site_sess->return_user_info();

Add following code after:

Code: [Select]
include_once(realpath(dirname(__FILE__)).'/vb.php');


Step 5. includes/page_header.php

Locate:

Code: [Select]
Copyright &copy; 2002-'.date('Y').' <a href="http://www.4homepages.de" target="_blank">4homepages.de</a>
</p>
',

Add following code right after:

Code: [Select]
"login_user_name_form_field" => (!empty($login_user_name_form_field)) ? $login_user_name_form_field : 'user_name',
"login_user_password_form_field" => (!empty($login_user_password_form_field)) ? $login_user_password_form_field : 'user_password',
"login_auto_form_field" => (!empty($login_auto_form_field)) ? $login_auto_form_field : 'auto_login',
"login_additional_form_fields" => (!empty($login_additional_form_fields)) ? $login_additional_form_fields : '',


Step 6. admin/admin_global.php

Locate:

Code: [Select]
// Include default languages
Add following code before:

Code: [Select]
// Default form
$login_admin_form_action = $site_sess->url(ROOT_PATH."admin/index.php");;
$login_admin_name_form_field = 'loginusername';
$login_admin_password_form_field = 'loginpassword';
$login_admin_additional_form_fields = '';

// Overwrite form if necessary
if(defined('VBULLETIN3_BRIDGE_ON') && VBULLETIN3_BRIDGE_ON === true){
$login_admin_form_action = $site_sess->url(VBULLETIN3_URL."login.php?do=login");
$login_admin_name_form_field = 'vb_login_username';
$login_admin_password_form_field = 'vb_login_password';
$login_admin_additional_form_fields = '<input type="hidden" name="do" value="login" />';
}



Locate:

Code: [Select]
<form action="<?php echo $site_sess->url(ROOT_PATH."admin/index.php"); ?>" method="post">
Replace with:

Code: [Select]
<form action="<?php echo $login_admin_form_action?>" method="post">
<?php echo $login_admin_additional_form_fields?>

Locate:

Code: [Select]
<td><input type="text" name="loginusername" size="<?php echo $textinput_size2?>"></td>
<td><input type="password" name="loginpassword" size="<?php echo $textinput_size2?>"></td>

Replace with:

Code: [Select]
<td><input type="text" name="<?php echo $login_admin_name_form_field?>" size="<?php echo $textinput_size2?>"></td>
<td><input type="password" name="<?php echo $login_admin_password_form_field?>" size="<?php echo $textinput_size2?>"></td>


Step 7. admin/index.php

Locate (at around lines 60-70):

Code: [Select]
if ($action == "head") {
?>
<html dir="<?php echo $lang['direction']; ?>">

Add following code right before "?>" symbols:

Code: [Select]
// switch back admin logout url if no integration
if(!defined('VBULLETIN3_BRIDGE_ON') || VBULLETIN3_BRIDGE_ON !== true){
$url_logout = $site_sess->url(ROOT_PATH."admin/index.php?logout=1");
}

Locate:

Code: [Select]
<td align="right"><b><a href="<?php echo $site_sess->url(ROOT_PATH."index.php"); ?>" target="_blank"><?php echo $lang['goto_homepage']; ?></a>&nbsp;|&nbsp;<a href="<?php echo $site_sess->url(ROOT_PATH."admin/index.php?logout=1"); ?>" target="_top"><?php echo $lang['logout']; ?></a>&nbsp;&nbsp;</b></TD>
Replace with:

Code: [Select]
<td align="right"><b><a href="<?php echo $site_sess->url(ROOT_PATH."index.php"); ?>" target="_blank"><?php echo $lang['goto_homepage']; ?></a>&nbsp;|&nbsp;<a href="<?php echo $url_logout?>" target="_top"><?php echo $lang['logout']; ?></a>&nbsp;&nbsp;</b></TD>

Step 8. templates/default/user_loginform.html

Locate:

Code: [Select]
<input type="text" size="10" name="user_name" class="logininput" />
Replace with:

Code: [Select]
<input type="text" size="10" name="{login_user_name_form_field}" class="logininput" />

Locate:

Code: [Select]
<input type="password" size="10" name="user_password" class="logininput" />
Replace with:

Code: [Select]
<input type="password" size="10" name="{login_user_password_form_field}" class="logininput" />
{login_additional_form_fields}

Locate:

Code: [Select]
<td><input type="checkbox" name="auto_login" value="1" /></td>
Replace with:

Code: [Select]
<td><input type="checkbox" name="{login_auto_form_field}" value="1" /></td>

Notes

Please make sure when installing applications you have admin account on both 4images and vBulletin apps with the same user name and password.


Known issues

When switching bridge off users can’t login to 4images anymore from the native 4images form. However they still exists in 4images database and could request for new password.


Version history

0.1 - initial release
0.2 - security fix (thanks to nic_bck for reporting: http://www.4homepages.de/forum/index.php?topic=23892.msg132782#msg132782)
0.3 - upgraded to 4images 1.7.7; doesn't let user which is not confirmed his email login into 4images -- only his own CP panel on vBulletin.
0.4 - now all default templates from 4images 1.7.7 are bridge ready (modded.zip, newfiles.zip); when user changes his email in vBulletin on the next login it will be updated into 4images also (thanks to Sun); now after user registered at vBulletin his join date will be also transferred as soon as he will come to 4images (thanks again to Sun); tested with vBulletin 3.8.4
0.5 - fix for the changed user's email was not actually updated into 4images DB.
0.6 - additional condition before change email: user has to have proper vBulletin session so when user logging out of vBulletin and refreshing 4images page his email will not be changed to the empty string (thanks Sun for reporting).

Extras

Users, who already have installed 4images and have users in it, can download userexport.php (attached to post - ue.zip), place it into root directory of 4image after installing bridge and run it from the browser. Existing 4images users should appear now in vBulletin.

Download already modded 4images 1.7.7 archive (attached to post modded.zip).

Download this instruction in printer friendly pdf (attached to post - bridge-step-by-step.pdf).


Please feel free to post bugs/questions/etc. here or via pm. Languages accepted: Russian, English.

Have fun ;)


Merging with other Mods

[MOD] Language select & [MOD] Multi-Language support for any text
http://www.4homepages.de/forum/index.php?topic=4743.0
http://www.4homepages.de/forum/index.php?topic=6749.0


Known problem: doesn't work simultaneously with Bridge.

Fix:

Find in includes/sessions.php:

Code: [Select]
include_once(realpath(dirname(__FILE__)).'/vb.php');
Replace with:

Code: [Select]
$temporaryLanguage = $l;
include_once(realpath(dirname(__FILE__)).'/vb.php');
$l = $temporaryLanguage;

« Last Edit: January 02, 2015, 11:24:10 PM by Nicky »
check

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Bridge: 4images - vBulletin
« Reply #1 on: January 17, 2009, 03:00:10 PM »
hi denis ...

... thanks for sharing this modification for using 4images and vBulletin ...
... and what a great stuff ... installations instructions as pdf-files ...  8O
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline denisnovikov

  • Test group
  • Full Member
  • *
  • Posts: 125
    • View Profile
Re: [MOD] Bridge: 4images - vBulletin
« Reply #2 on: January 17, 2009, 03:03:50 PM »
hi denis ...

... thanks for sharing this modification for using 4images and vBulletin ...
... and what a great stuff ... installations instructions as pdf-files ...  8O

Hi, it was not a problem to export to pdf as I was writing this text in gui editor, not right in the form on board :) Or do you mean it's bad to post pdfs? :D

Edit: thanks for moving into releases!
check

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Bridge: 4images - vBulletin
« Reply #3 on: January 17, 2009, 03:10:49 PM »
... as I said ... a great stuff ... and a new standard for mod publication ... !
... thanks again ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [MOD] Bridge: 4images - vBulletin
« Reply #4 on: January 17, 2009, 03:20:26 PM »
hi denis,

thank you for posting this bridge. great thing!
notice to the users: it was tested with 4images 1.7.6 and vBulletin 3.7.4 up to 3.8.0
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Bridge: 4images - vBulletin
« Reply #5 on: January 17, 2009, 08:59:59 PM »
I'm sorry I didn't pay attention to the beta testing of this mod, but now I have two questions:
1. what is the point of step 3?
2. can we have a separate package with only needed (new) files, so people don't need download 1.4mb file just for these two files.

P.S.
Since this mod is pretty much vB version dependent, the vB version should be mentioned if not in the title, then at least in the original instructions ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline denisnovikov

  • Test group
  • Full Member
  • *
  • Posts: 125
    • View Profile
Re: [MOD] Bridge: 4images - vBulletin
« Reply #6 on: January 17, 2009, 09:44:42 PM »
1. what is the point of step 3?

Some magic :D I realized this part of "globals" should be reloaded after initializing vBulletin core :)

2. can we have a separate package with only needed (new) files, so people don't need download 1.4mb file just for these two files.

Yeah, sure! My fault! Thanks!

Since this mod is pretty much vB version dependent, the vB version should be mentioned if not in the title, then at least in the original instructions ;)

Dunno how much it depended on vBulletin version, did you try install it with other than 3.7.4 .. 3.8.0 versions?
check

Offline Dblockn05

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: [MOD] Bridge: 4images 1.7.6 - vBulletin 3.7.4+
« Reply #7 on: January 21, 2009, 04:24:25 PM »
Very nice mod, I will be installing it this afternoon.  Do you plan on releasing it on vbulletin.org?  A lot of members are probably eager for this.

Hella thanks for taking your time to do this.

Offline denisnovikov

  • Test group
  • Full Member
  • *
  • Posts: 125
    • View Profile
Re: [MOD] Bridge: 4images 1.7.6 - vBulletin 3.7.4+
« Reply #8 on: January 21, 2009, 04:26:28 PM »
Very nice mod, I will be installing it this afternoon.  Do you plan on releasing it on vbulletin.org?  A lot of members are probably eager for this.

Hella thanks for taking your time to do this.

Thanks, please feel free to report bugs :)
As for releasing it on vBulletin forums, maybe later a bit :)

check

Offline kirby

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: [MOD] Bridge: 4images 1.7.6 - vBulletin 3.7.4+
« Reply #9 on: January 30, 2009, 03:38:44 PM »
Thank you, been waiting for this one for a while, very easy to follow :)

But is there a way to show "Last X posts" on the 4images gallery main page?

Offline denisnovikov

  • Test group
  • Full Member
  • *
  • Posts: 125
    • View Profile
Re: [MOD] Bridge: 4images 1.7.6 - vBulletin 3.7.4+
« Reply #10 on: January 30, 2009, 04:00:15 PM »
Thank you, been waiting for this one for a while, very easy to follow :)

But is there a way to show "Last X posts" on the 4images gallery main page?

Thanks to you for using it :)

Yes, guess it's possible to extend vb.php so it will have this info also somewhere in usersession. Will see later  :wink:
check

Offline kirby

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: [MOD] Bridge: 4images 1.7.6 - vBulletin 3.7.4+
« Reply #11 on: January 30, 2009, 04:52:18 PM »
Thank you, been waiting for this one for a while, very easy to follow :)

But is there a way to show "Last X posts" on the 4images gallery main page?

Thanks to you for using it :)

Yes, guess it's possible to extend vb.php so it will have this info also somewhere in usersession. Will see later  :wink:

Well thanks in advance :) even just as it is, this is definitly my fav mod  :mrgreen:

Offline riansyah

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: [MOD] Bridge: 4images 1.7.6 - vBulletin 3.7.4+
« Reply #12 on: February 07, 2009, 05:11:22 PM »
Hello,

I have the problem.

when I register a new member and then i'm login then show this error

An unexpected error occured. Please try again later.

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\4images\includes\db_mysql.php:192) in C:\AppServ\www\4images\includes\functions.php on line 114

then i check my database user 4images, it's not be added a new user on 4images users tables and only added on vbulletin user tables

anyone help me..


Regards
riansyah

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [MOD] Bridge: 4images 1.7.6 - vBulletin 3.7.4+
« Reply #13 on: February 08, 2009, 10:44:46 PM »
hi,

this is strange,

because, i tested it on xampp(windows) and like you can see it on our demo page which is on linux.

i have to mentioned it, that it was tested without any mods on both sides.
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline denisnovikov

  • Test group
  • Full Member
  • *
  • Posts: 125
    • View Profile
Re: [MOD] Bridge: 4images 1.7.6 - vBulletin 3.7.4+
« Reply #14 on: February 09, 2009, 09:26:43 AM »
Hello,

I have the problem.

when I register a new member and then i'm login then show this error

An unexpected error occured. Please try again later.

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\4images\includes\db_mysql.php:192) in C:\AppServ\www\4images\includes\functions.php on line 114

then i check my database user 4images, it's not be added a new user on 4images users tables and only added on vbulletin user tables

anyone help me..


Regards
riansyah

Hi, can you switch bridge off and see if 4images installation works standalone? I guess problem is somewhere in your settings/configurations.
check