Project Integration IPB 1.3 and G1.4.4

JimBeam

Joined: 2003-05-01
Posts: 24
Posted: Mon, 2005-05-23 10:17

Okie I've done a search with the help of valiant I've found a similar integration but its just that the gallery version is 1.4.1 or 1.4.3. Some of the codes are pretty much different thus I was unable to locate or try to play around. I'll post it up on the next thread.

 
JimBeam

Joined: 2003-05-01
Posts: 24
Posted: Mon, 2005-05-23 10:18
Embedding Gallery into Invision Power Board 1.3.1 
Author: Shadow Wolf / Ouranos / copland 007 / windrider 
Version: 1.2 
Updated: 07/08/2004 
Website: http://www.protoculturex.com/index.php?pid=9 

This hack should allow you to get Gallery v1.4.3 to use the Invision 
Boards Members Database information. Still could use some work 
(like Skin Support) and probably other AdminCP functionality. But 
hopefully this will be enough to get you started with having a 
Photo Album for your Invision Board site. 

Requires: 
InvisionBoard 1.3.1 (http://www.invisionboard.com) 
Gallery v1.4.3-RC2 (http://gallery.menalto.com) 

Credits: 
- Original code written by copland007. 
- Code changed by windrider. (mjb@braindead.net) 
-- Added minimal AdminCP support. 
-- Removed hardcoded Groups from User.php/UserDB.php 
Now the group access is controled from AdminCP. 
-- Removed other hardcoded strings. 
- Code modified by Ouranos (ouranos@cyberatom.com) 
-- Added compatibility with the latest IPB version. 
-- Don't need API. 
- Code changed by Shadow Wolf 
-- Corrected errors in install.txt. 
-- Tested with v1.4.3-RC2. 


For more information on embedding gallery in general you can look at: 
http://www.txraves.org/code/?item=embeddinggallery 

Things to still do: 
Add skin support. 
*/ 

First create a "gallery" directory in your forums root and install a standalone Gallery using their install process into this directory. 
Once installed you can then begin to hack away. 

****************************** 

Upload db_hack.php into forums root. (where your conf_global.php file exists) 
Load the db_hack.php file in your web browser. 
Once hack is done delete the db_hack.php file. 

****************************** 


Make an "invisionboard" directory under <gallery dir>/classes/ 
Upload the supplied User.php and UserDB.php files into <gallery dir>/classes/invisionboard/ 

****************************** 


Upload all files supplied in html_wrap into <gallery dir>/html_wrap/ 
These files (especially 'wrapper.header') will require a bit 'extra' modification to make it match your site 
until I or someone can write a good Skin integration. 
But they are well adapted to the default skin. 

****************************** 


Open <forum dir>/sources/Admin/ad_groups.php 
Find: 

'g_attach_max' => $IN['g_attach_max'], 
'g_avatar_upload' => $IN['g_avatar_upload'], 
'g_calendar_post' => $IN['g_calendar_post'], 

Add Below: 

'g_gallery_createalbum' => $IN['g_gallery_createalbum'], 
'g_gallery_moderate' => $IN['g_gallery_moderate'], 

Find: 

$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can add events to the calendar?$guest_legend</b>" , 
$SKIN->form_yes_no("g_calendar_post", $group['g_calendar_post'] ) 
) ); 
Add Below: 

$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can create Gallery albums?</b>" , 
$SKIN->form_yes_no("g_gallery_createalbum", $group['g_gallery_createalbum'] ) 
) ); 

Find: 
$ADMIN->html .= $SKIN->start_table( "Moderation Permissions", "Allow or deny this group moderation abilities" ); 

Add Below: 
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can moderate Gallery albums?</b>" , 
$SKIN->form_yes_no("g_gallery_moderate", $group['g_gallery_moderate'] ) 
) ); 

Save your changes 

****************************** 

Open <forum dir>/skin/s1/skin_global.php 
<forum dir>/skin/s1/skin_csite.php 

Find: 

& &&<img src="{$ibforums->vars['img_url']}/atb_members.gif" border="0" alt="" />&<a href='{$ibforums->base_url}act=Members'>{$ibforums->lang['tb_mlist']}</a> 


Add Below: 

& &&<img src="{$ibforums->vars['img_url']}/atb_members.gif" border="0" alt="" />&<a href='{$ibforums->vars['board_url']}/gallery/index.php'>{$ibforums->lang['tb_gallery']}</a> 

NB: You can replace atb_members.gif by any icon. 

Save your changes 

****************************** 

Open <forum dir>/lang/en/lang_global.php 

(If you have additionnal languages you can edit this file : <forum dir>/lang/<language id>/lang_global.php) 

Find: 

'tb_mlist' => "Members", 

Add Below: 

'tb_gallery' => "Gallery", 

Save your changes 

****************************** 


Open <gallery dir>/util.php 

Find: 
/* Needed for phpBB2 */ 
global $userdata; 
global $board_config; 
global $HTTP_COOKIE_VARS; 

Add Below: 
/* Needed for IBF */ 
global $ibforum; 

Find: 
$args["set_albumName"] = $gallery->session->albumName; 
} 
} 

Add Below: 

case 'invisionboard': 
$args["s"] = $ibforums->session_id; 
break; 


Save your changes 

****************************** 

Open <gallery dir>/init.php 

Find: 
<? 
// Hack prevention. 
$sensitiveList = array("gallery", "GALLERY_BASEDIR"); 
foreach ($sensitiveList as $sensitive) { 
if (!empty($HTTP_GET_VARS[$sensitive]) || 
!empty($HTTP_POST_VARS[$sensitive]) || 
!empty($HTTP_COOKIE_VARS[$sensitive]) || 
!empty($HTTP_POST_FILES[$sensitive])) { 
print "Security violation\n"; 
exit; 
} 
} 
?> 

Add Below: 
<? 
// START - Invision Embedding 
$GALLERY_EMBEDDED_INSIDE = "invisionboard"; 
$GALLERY_EMBEDDED_INSIDE_TYPE = "invisionboard"; 

$root_path = "../"; //EDIT:: Set to the path of your Forums Directory. 

class Debug { 
function startTimer() { 
global $starttime; 
$mtime = microtime (); 
$mtime = explode (' ', $mtime); 
$mtime = $mtime[1] + $mtime[0]; 
$starttime = $mtime; 
} 
function endTimer() { 
global $starttime; 
$mtime = microtime (); 
$mtime = explode (' ', $mtime); 
$mtime = $mtime[1] + $mtime[0]; 
$endtime = $mtime; 
$totaltime = round (($endtime - $starttime), 5); 
return $totaltime; 
} 
} 

class info { 

var $member = array(); 
var $input = array(); 
var $session_id = ""; 
var $base_url = ""; 
var $vars = ""; 
var $skin_id = "s1"; // Skin Dir name 
var $skin_rid = "1"; // Real skin id (numerical only) 
var $lang_id = "fr"; 
var $skin = ""; 
var $lang = ""; 
var $server_load = 0; 
var $version = "v1.0.1"; 
var $lastclick = ""; 
var $location = ""; 

function info() { 
global $sess, $std, $DB, $root_path, $INFO; 

$this->vars = &$INFO; 

$this->vars['TEAM_ICON_URL'] = $INFO['html_url'] . '/team_icons'; 
$this->vars['AVATARS_URL'] = $INFO['html_url'] . '/avatars'; 
$this->vars['EMOTICONS_URL'] = $INFO['html_url'] . '/emoticons'; 
$this->vars['mime_img'] = $INFO['html_url'] . '/mime_types'; 

} 
} 


//-------------------------------- 
// Import $INFO, now! 
//-------------------------------- 
require $root_path."/forum/conf_global.php"; 

//-------------------------------- 
// The clocks a' tickin' 
//-------------------------------- 

$Debug = new Debug; 
$Debug->startTimer(); 

//-------------------------------- 
// Require our global functions 
//-------------------------------- 

require $root_path."/forum/sources/functions.php"; 
$std = new FUNC; 
$print = new display(); 
$sess = new session(); 

//-------------------------------- 
// Load the DB driver and such 
//-------------------------------- 

$INFO['sql_driver'] = !$INFO['sql_driver'] ? 'mySQL' : $INFO['sql_driver']; 

$to_require = $root_path."/forum/sources/Drivers/".$INFO['sql_driver'].".php"; 
require ($to_require); 

$DB = new db_driver; 

$DB->obj['sql_database'] = $INFO['sql_database']; 
$DB->obj['sql_user'] = $INFO['sql_user']; 

$DB->obj['sql_pass'] = $INFO['sql_pass']; 
$DB->obj['sql_host'] = $INFO['sql_host']; 
$DB->obj['sql_tbl_prefix'] = $INFO['sql_tbl_prefix']; 

// Get a DB connection 

$DB->connect(); 

//-------------------------------- 
// Wrap it all up in a nice easy to 
// transport super class 
//-------------------------------- 

$ibforums = new info(); 

//-------------------------------- 
// Set up our vars 
//-------------------------------- 
$ibforums->vars['tmpl_dir'] = "../templates/"; 
$ibforums->input = $std->parse_incoming(); 
$ibforums->member = $sess->authorise(); 
$ibforums->skin = $std->load_skin(); 
$ibforums->lastclick = $sess->last_click; 
$ibforums->location = $sess->location; 
$ibforums->session_id = $sess->session_id; 

if ($ibforums->member['id'] and ( $std->my_getcookie('hide_sess') ) ) 
{ 
$ibforums->session_id = ""; 
} 

$ibforums->base_url = $ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext'].'?s='.$ibforums->session_id; 

$ibforums->skin_rid = $ibforums->skin['set_id']; 
$ibforums->skin_id = 's'.$ibforums->skin['set_id']; 

$ibforums->vars['img_url'] = 'style_images/' . $ibforums->skin['set_id']; 

//-------------------------------- 
// Set up our language choice 
//-------------------------------- 

$ibforums->lang_id = $ibforums->member['language'] ? $ibforums->member['language'] : 'en'; 

if ( ($ibforums->lang_id != 'en') and (! is_dir( $root_path."lang/".$ibforums->lang_id ) ) ) 
{ 
$ibforums->lang_id = 'en'; 
} 

require $root_path."/forum/lang/".$ibforums->lang_id."/lang_global.php"; 

$ibforums->lang = $lang; 

unset($lang); 

//-------------------------------- 
require $root_path."/forum/Skin/".$ibforums->skin_id."/skin_global.php"; 
$skin_universal = new skin_global(); 

// *************************************** 
// END - Invision Embedding 
?> 

Find: (around line +/- 312) 

if (isset($GALLERY_EMBEDDED_INSIDE)) { 
/* Okay, we are embedded */ 
switch($GALLERY_EMBEDDED_INSIDE_TYPE) { 

Add Below: 

// START - Invision Embedding 
case 'invisionboard': 
include($GALLERY_BASEDIR . "classes/Database.php"); 
include($GALLERY_BASEDIR . "classes/database/mysql/Database.php"); 
include($GALLERY_BASEDIR . "classes/invisionboard/UserDB.php"); 
include($GALLERY_BASEDIR . "classes/invisionboard/User.php"); 

$gallery->database{$INFO['sql_database']} = new MySQL_Database( 
$INFO['sql_host'], 
$INFO['sql_user'], 
$INFO['sql_pass'], 
$INFO['sql_database']); 
$gallery->database{$INFO['sql_database']}->$INFO['sql_tbl_prefix']; 

/* Load our user database (and user object) */ 
$gallery->userDB = new Gallery_UserDB; 

$gallery->session->username = $ibforums->member['name']; 
$gallery->user = $gallery->userDB->getUserByUsername($gallery->session->username); 

if ($gallery->session->username) { 
// -- load user object by specifying userid instead of username 
$gallery->user = $gallery->userDB->getUserByUid($ibforums->member['id']); 
} 
break; 
// END - Invision Embedding 
?> 

Save your changes 

****************************** 


Upload all the file changes if you haven't already. 

Go into AdminCP and modify the groups you want to have access to Gallery for creating albums and/or moderation access. SuperMods and Admins already have Moderation access to the Gallery. But also added a specific function for Gallery moderation if you need/want it. 

****************************** 
 
JimBeam

Joined: 2003-05-01
Posts: 24
Posted: Mon, 2005-05-23 10:23

The problem rises from below. I cannot locate the files and I believe the method is totally different thus I can't find a place to insert the global $ibforum;

Open <gallery dir>/util.php 

Find: 
/* Needed for phpBB2 */ 
global $userdata; 
global $board_config; 
global $HTTP_COOKIE_VARS; 

Add Below: 
/* Needed for IBF */ 
global $ibforum; 

Find: 
$args["set_albumName"] = $gallery->session->albumName; 
} 
} 

Add Below: 

case 'invisionboard': 
$args["s"] = $ibforums->session_id; 
break; 


Save your changes 

****************************** 

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-05-23 10:25

Is this thread about G1.x or porting the integration to G2?

And all G1.x integration code won't help much when integrating G2, it's a whole different story.
Well, at least you could copy the invision part of the G1.x integration for the G2 integration.

 
JimBeam

Joined: 2003-05-01
Posts: 24
Posted: Mon, 2005-05-23 10:26

Once again, this is another stumbling block for me. I hope someone can point me somewhere to try or help with this.

Open <gallery dir>/init.php 

Find: 
<? 
// Hack prevention. 
$sensitiveList = array("gallery", "GALLERY_BASEDIR"); 
foreach ($sensitiveList as $sensitive) { 
if (!empty($HTTP_GET_VARS[$sensitive]) || 
!empty($HTTP_POST_VARS[$sensitive]) || 
!empty($HTTP_COOKIE_VARS[$sensitive]) || 
!empty($HTTP_POST_FILES[$sensitive])) { 
print "Security violation\n"; 
exit; 
} 
} 
?> 

Add Below: 
<? 
// START - Invision Embedding 
$GALLERY_EMBEDDED_INSIDE = "invisionboard"; 
$GALLERY_EMBEDDED_INSIDE_TYPE = "invisionboard"; 

$root_path = "../"; //EDIT:: Set to the path of your Forums Directory. 

class Debug { 
function startTimer() { 
global $starttime; 
$mtime = microtime (); 
$mtime = explode (' ', $mtime); 
$mtime = $mtime[1] + $mtime[0]; 
$starttime = $mtime; 
} 
function endTimer() { 
global $starttime; 
$mtime = microtime (); 
$mtime = explode (' ', $mtime); 
$mtime = $mtime[1] + $mtime[0]; 
$endtime = $mtime; 
$totaltime = round (($endtime - $starttime), 5); 
return $totaltime; 
} 
} 

class info { 

var $member = array(); 
var $input = array(); 
var $session_id = ""; 
var $base_url = ""; 
var $vars = ""; 
var $skin_id = "s1"; // Skin Dir name 
var $skin_rid = "1"; // Real skin id (numerical only) 
var $lang_id = "fr"; 
var $skin = ""; 
var $lang = ""; 
var $server_load = 0; 
var $version = "v1.0.1"; 
var $lastclick = ""; 
var $location = ""; 

function info() { 
global $sess, $std, $DB, $root_path, $INFO; 

$this->vars = &$INFO; 

$this->vars['TEAM_ICON_URL'] = $INFO['html_url'] . '/team_icons'; 
$this->vars['AVATARS_URL'] = $INFO['html_url'] . '/avatars'; 
$this->vars['EMOTICONS_URL'] = $INFO['html_url'] . '/emoticons'; 
$this->vars['mime_img'] = $INFO['html_url'] . '/mime_types'; 

} 
} 


//-------------------------------- 
// Import $INFO, now! 
//-------------------------------- 
require $root_path."/forum/conf_global.php"; 

//-------------------------------- 
// The clocks a' tickin' 
//-------------------------------- 

$Debug = new Debug; 
$Debug->startTimer(); 

//-------------------------------- 
// Require our global functions 
//-------------------------------- 

require $root_path."/forum/sources/functions.php"; 
$std = new FUNC; 
$print = new display(); 
$sess = new session(); 

//-------------------------------- 
// Load the DB driver and such 
//-------------------------------- 

$INFO['sql_driver'] = !$INFO['sql_driver'] ? 'mySQL' : $INFO['sql_driver']; 

$to_require = $root_path."/forum/sources/Drivers/".$INFO['sql_driver'].".php"; 
require ($to_require); 

$DB = new db_driver; 

$DB->obj['sql_database'] = $INFO['sql_database']; 
$DB->obj['sql_user'] = $INFO['sql_user']; 

$DB->obj['sql_pass'] = $INFO['sql_pass']; 
$DB->obj['sql_host'] = $INFO['sql_host']; 
$DB->obj['sql_tbl_prefix'] = $INFO['sql_tbl_prefix']; 

// Get a DB connection 

$DB->connect(); 

//-------------------------------- 
// Wrap it all up in a nice easy to 
// transport super class 
//-------------------------------- 

$ibforums = new info(); 

//-------------------------------- 
// Set up our vars 
//-------------------------------- 
$ibforums->vars['tmpl_dir'] = "../templates/"; 
$ibforums->input = $std->parse_incoming(); 
$ibforums->member = $sess->authorise(); 
$ibforums->skin = $std->load_skin(); 
$ibforums->lastclick = $sess->last_click; 
$ibforums->location = $sess->location; 
$ibforums->session_id = $sess->session_id; 

if ($ibforums->member['id'] and ( $std->my_getcookie('hide_sess') ) ) 
{ 
$ibforums->session_id = ""; 
} 

$ibforums->base_url = $ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext'].'?s='.$ibforums->session_id; 

$ibforums->skin_rid = $ibforums->skin['set_id']; 
$ibforums->skin_id = 's'.$ibforums->skin['set_id']; 

$ibforums->vars['img_url'] = 'style_images/' . $ibforums->skin['set_id']; 

//-------------------------------- 
// Set up our language choice 
//-------------------------------- 

$ibforums->lang_id = $ibforums->member['language'] ? $ibforums->member['language'] : 'en'; 

if ( ($ibforums->lang_id != 'en') and (! is_dir( $root_path."lang/".$ibforums->lang_id ) ) ) 
{ 
$ibforums->lang_id = 'en'; 
} 

require $root_path."/forum/lang/".$ibforums->lang_id."/lang_global.php"; 

$ibforums->lang = $lang; 

unset($lang); 

//-------------------------------- 
require $root_path."/forum/Skin/".$ibforums->skin_id."/skin_global.php"; 
$skin_universal = new skin_global(); 

// *************************************** 
// END - Invision Embedding 
?> 

Find: (around line +/- 312) 

if (isset($GALLERY_EMBEDDED_INSIDE)) { 
/* Okay, we are embedded */ 
switch($GALLERY_EMBEDDED_INSIDE_TYPE) { 

Add Below: 

// START - Invision Embedding 
case 'invisionboard': 
include($GALLERY_BASEDIR . "classes/Database.php"); 
include($GALLERY_BASEDIR . "classes/database/mysql/Database.php"); 
include($GALLERY_BASEDIR . "classes/invisionboard/UserDB.php"); 
include($GALLERY_BASEDIR . "classes/invisionboard/User.php"); 

$gallery->database{$INFO['sql_database']} = new MySQL_Database( 
$INFO['sql_host'], 
$INFO['sql_user'], 
$INFO['sql_pass'], 
$INFO['sql_database']); 
$gallery->database{$INFO['sql_database']}->$INFO['sql_tbl_prefix']; 

/* Load our user database (and user object) */ 
$gallery->userDB = new Gallery_UserDB; 

$gallery->session->username = $ibforums->member['name']; 
$gallery->user = $gallery->userDB->getUserByUsername($gallery->session->username); 

if ($gallery->session->username) { 
// -- load user object by specifying userid instead of username 
$gallery->user = $gallery->userDB->getUserByUid($ibforums->member['id']); 
} 
break; 
// END - Invision Embedding 
?> 

Save your changes 
 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-05-23 10:35

perhaps you've missed my answer (scroll up).
what is this about?