vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Gallery 2.1 and vBulletin 3.5.X integration (https://vborg.vbsupport.ru/showthread.php?t=111931)

jklap 06-10-2007 04:02 AM

Joel,

Sure, my g2 and vb are in separate folders-- the trick is that global.php sets up CWD as the current working directory-- and if you are calling/including global.php from outside of the vb directory you have a problem. I made a change to global.php:

Code:

if( !defined(CWD) ) {
  define('CWD', (($getcwd = getcwd()) ? $getcwd : '.'));
}

And then in my embed code (most people here seem to be naming their embed file gallery2.php), I simply do the following:

Code:

define('CWD', '/var/www/html/vb');
require_once(CWD . '/global.php');

Then, continuing on, I include g2 stuff:

Code:

require_once('/var/www/html/g2/embed.php');
Then you init as usual and go on your merry way.

Also, I've noticed that if you are including vb SIMPLY so you can use $vbulletin->userinfo['userid'] to pass into g2, you do not seem to need to include vb/global.php, you can include vb/includes/init.php instead-- it's faster as it doesn't load up a bunch of stuff not needed.

Another side note. If you want to make sure that accessing g2 pages keeps the vb session alive, include the vb stuff as mentioned above, but also make sure to call exec_shut_down() near the end of your script-- this makes vb flush out the session to the db, which then keeps the session alive.

I should note though that I'm not using the vb templating system (fetch_template('gallery2')) to accomplish my display (as this thread discusses). Instead, I simply take the output from the runGallery() call and embed it directly in html in the same script. My script ends up looking like this (obviously pseudocode):

Code:

  set THIS_SCRIPT
  include vb/includes/init.php
  include g2/embed.php
  get userid from $vbulletin->userinfo['userid']
  GalleryEmbed::init( 'embedUrl' => '<<points to this script such as /regstuf/g2.php>>'
    'g2Url' => '<<points to url for g2 directory such as /g2/'
    'activeUserId' => $userid
  )
  $data = GalleryEmbed::handleRequest();
  check isDone, if so, return
  parse header  into javascript,title and css

  <html>
  <head>
  echo $data['javascript']
  echo $data['css']
  </head>
  <body>
  stuff......
  echo $data['bodyHtml']
  </body>
  </html>

  exec_shut_down();

The above is the basics, you should also include error checking and such, I just didn't bother typing.

Also, this works in 3.6.6, 3.6.7 and 3.6.7 PL1

Before you ask me a question, make sure you read this whole thead, cause if you ask something dumb that can be answered by looking at the code or reading this thread like 'what do you mean by set THIS_SCRIPT' or how do you do 'set THIS_SCRIPT, I will ignore you. Think before you ask.



Next....



Looks to me like file access permission errors. Maybe your webserver can no longer can write to your g2data directory?

Your last error leads me to believe your plugins have a path to your embed.php file and embed.php is no longer where it should be.

Look at the paths in the errors and figure out what it's complaining about-- it's all there.


Quote:

Originally Posted by scan-pa (Post 1251653)
I updated the forums to 3.6.7pl and all I get are errors now.

How do I remove everything to do with this mod and gallery 2

here is some of the errors I get when people come to my forum main page and forum index page and admin login page:

Warning: rename(/tmp/0.incndrdBN,/home/centram2/CPAg2data/cache/module/thumbnail/0/0/0.inc) [function.rename]: Permission denied in /gallery2/modules/core/classes/GalleryPlatform.class on line 487

Warning: mkdir(/home/centram2/CPAg2data/cache) [function.mkdir]: Permission denied in /gallery2/modules/core/classes/GalleryPlatform.class on line 624

Warning: rename(/tmp/0.incjeNH1a,/home/centram2/CPAg2data/cache/module/rss/0/0/0.inc) [function.rename]: Permission denied in /gallery2/modules/core/classes/GalleryPlatform.class on line 487

Warning: mkdir(/home/centram2/CPAg2data/cache) [function.mkdir]: Permission denied in /gallery2/modules/core/classes/GalleryPlatform.class on line 624

Warning: rename(/tmp/0.incJIcqty,/home/centram2/CPAg2data/cache/module/panorama/0/0/0.inc) [function.rename]: Permission denied in /gallery2/modules/core/classes/GalleryPlatform.class on line 487

Warning: mkdir(/home/centram2/CPAg2data/cache) [function.mkdir]: Permission denied in /gallery2/modules/core/classes/GalleryPlatform.class on line 624

Warning: rename(/tmp/0.inczi6mWV,/home/centram2/CPAg2data/cache/module/publishxp/0/0/0.inc) [function.rename]: Permission denied in /gallery2/modules/core/classes/GalleryPlatform.class on line 487

Warning: mkdir(/home/centram2/CPAg2data/cache) [function.mkdir]: Permission denied in /gallery2/modules/core/classes/GalleryPlatform.class on line 624

Warning: rename(/tmp/0.inc53owqj,/home/centram2/CPAg2data/cache/module/sizelimit/0/0/0.inc) [function.rename]: Permission denied in /gallery2/modules/core/classes/GalleryPlatform.class on line 487

Warning: mkdir(/home/centram2/CPAg2data/cache) [function.mkdir]: Permission denied

-----------------------------------------------------------------------------

I just want to delete this whole mess and remove it from the system.

Any advice on doing that to restore my forums?

also getting these errors:

Warning: Unknown(/home/centram2/public_html/forum/gallery2/embed.php): failed to open stream: No such file or directory in /includes/class_dm_user.php(1668) : eval()'d code on line 1
Fatal error: (null)() [function.require]: Failed opening required '/home/centram2/public_html/forum/gallery2/embed.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/centram2/public_html/forum/includes/class_dm_user.php(1668) : eval()'d code on line 1


dotJoel 06-11-2007 02:32 PM

Alright,

Before I attempt using the unembeded version I thought I would try the mod first.

http://www.appozone.com/test/gallery.php

Looks like for some reason it includes /test/test/ twice and thus does not display any images.

Any advice appreciated.

Regards,

.Joel

snapshotz 06-15-2007 01:59 PM

i know this isn't a solution for all..but this integration never seems to be solid.
you are better off going with vbdrupal and integrating gallery..I do this on my site with no problems with full group synch between platforms.

cash7c3 06-17-2007 12:27 AM

cool hack

jklap 06-18-2007 01:11 PM

Quote:

Originally Posted by snapshotz (Post 1269075)
i know this isn't a solution for all..but this integration never seems to be solid.
you are better off going with vbdrupal and integrating gallery..I do this on my site with no problems with full group synch between platforms.

As far as this integration being stable, once it is configured and setup right (which is where just about every posted issue I've seen is concerned), there are no stability issues, in fact it is very clean and doesn't contain the overhead of a CMS system- of course this last point is only relevant to those that don't want nor need a CMS.

zincpony 06-28-2007 01:55 AM

anyway to set up access to only admins and super & general mods and have a second gallery for everyone to post into?

and will this work with vb 3.6.7 and gallery 2.2.2??

jklap 06-29-2007 11:19 AM

Basically, all the ideas here are valid for 3.6.X. I'm running 3.6.7 PL1 (uh, as I meantioned above), and Gallery 2.2.1 (although I've looked at the change list for 2.2.2 and I don't see much that would effect it except for the Download image rewriting fix, but thats pretty narrow and only valid if you are using main.php for core.DownloadItem).

Quote:

Originally Posted by zincpony (Post 1278173)
and will this work with vb 3.6.7 and gallery 2.2.2??


zincpony 07-04-2007 02:00 AM

hmmmm, i dont understand what it is that i am doing wrong. when i try to visit gallery2.php its loads up completely empty.

i followed the installation closely, but it doesnt work.

i have it set up as

...site/forum
&
...site/forum/gallery2/

Enigma Aus 07-28-2007 04:12 AM

Quote:

Originally Posted by zincpony (Post 1282375)
hmmmm, i dont understand what it is that i am doing wrong. when i try to visit gallery2.php its loads up completely empty.

i followed the installation closely, but it doesnt work.

i have it set up as

...site/forum
&
...site/forum/gallery2/

I followed it correctly and everything did work...
This tutorial doesn't clarify the correct dir for embedding gallery and vb

My structure is this

...site/forum>vbfiles
&
...site/forum/gallery2/>gallery2 files

The template loads but my images think there at ....site/forum/forum/gallery2

I cant seem to find a way to fix it... :mad:

oldgoat 07-28-2007 10:57 PM

hello to all
i followed the installation instructions and installed gallery 2.1.1, the program installed properly, everything is working as expected, except the navbar links from vbulletin do not show up, as a standalone product the gallery works fine, it also works as a forum link . I am running vbulletin 3.5.4, the url to the site is http://www.freemovie-downloads.net/gallery2/main.php
I have spent over two days trying to figure out what is not working. I cant get gallery2 to be embedded as part of vbulletin. I need some input as to what can be wrong.

vbulletin is in /httpdocs/forum
gallery2 is in /httpdocs/gallery2
gallery2.php is in /httpdocs/forum

gallery2.php

PHP Code:

<?php



// ####################### SET PHP ENVIRONMENT ###########################

error_reporting(E_ALL & ~E_NOTICE);



// #################### DEFINE IMPORTANT CONSTANTS #######################

define('NO_REGISTER_GLOBALS'1);

define('THIS_SCRIPT''gallery2'); // change this depending on your filename



// ################### PRE-CACHE TEMPLATES AND DATA ######################

// get special phrase groups

$phrasegroups = array(



);



// get special data templates from the datastore

$specialtemplates = array(



);



// pre-cache templates used by all actions

$globaltemplates = array(

'gallery2',

);



// pre-cache templates used by specific actions

$actiontemplates = array(



);



// ######################### REQUIRE BACK-END ############################



require_once('./global.php');



// #######################################################################

// ######################## START MAIN SCRIPT ############################

// #######################################################################



$navbits = array();

$navbits[$parent] = 'Gallery';

error_reporting(E_ALL );



$navbits construct_navbits($navbits);

eval(
'$navbar = "' fetch_template('navbar') . '";');



// #######################################################################

// ###################### Begin G2 INTEGRATION CODE ######################

// #######################################################################



$data runGallery();

$data['title'] = (isset($data['title']) && !empty($data['title'])) ? $data['title'] : 'Gallery';



function 
runGallery() {

global 
$vbulletin$userinfo;

require_once(
'usr/local/psa/home/vhosts/freemovie-downloads.net/httpdocs/gallery2/embed.php');



$data = array();



// If it's an anonymous user, set the g2 activeUser to null

$uid $vbulletin->userinfo['userid'] = '' $vbulletin->userinfo['userid'];



// initiate G2

// You need to edit the following 4 lines to suit your VB3 & G2 installations

// This is set up for an install that looks like:

// public_html/VB/<vb files>

// public_html/gallery2/<gallery2 files>

// and also setup for a VB3 template name of 'gallery2'. If you have any

// differences, make those changes here!

// You might need to change 'loginRedirect' if you have your VB3 setup to

// where index.php is not the root page of VB3... Like if you've changed it

// to forums.php or something of the like.



$ret GalleryEmbed::init(array('embedUri' => 'gallery2.php',

'g2Uri' => 'gallery2/',

'loginRedirect' => 'index.php',

'activeUserId' => $uid));

if (
$ret)

{

if (
$ret->getErrorCode() & ERROR_MISSING_OBJECT)

{

// Check if there's no G2 user mapped to the activeUserId

$ret GalleryEmbed::isExternalIdMapped($uid'GalleryUser');

if (
$ret && ($ret->getErrorCode() & ERROR_MISSING_OBJECT))

{

// User not mapped, create G2 user now

// Get Arguments for the new user:

$args['fullname'] = $vbulletin->userinfo['username'];

$args['username'] = $vbulletin->userinfo['username'];

$args['hashedpassword'] = $vbulletin->userinfo['password'];

$args['hashmethod'] = 'md5';

$args['email'] = $vbulletin->userinfo['email'];

$args['language'] = $vbulletin->userinfo['lang_code'];

$args['creationtimestamp'] = $vbulletin->userinfo['joindate'];



$retcreate GalleryEmbed :: createUser($uid$args);

if (
$retcreate)

{

echo 
'<HR>line: '.__LINE__.', Failed to create G2 user with extId ['.$uid.']. Here is the error message from G2: <br />'.$retcreate->getAsHtml();

return 
false;

}

$ret GalleryEmbed::checkActiveUser($uid);

if (
$ret) {

print 
$ret->getAsHtml();

return 
false;

}

}

else

{

echo 
'<HR>line: '.__LINE__.', G2 did not return a success status. Here is the error message from G2: <br />'.$ret->getAsHtml();

return 
false;

}

}

else

{

echo 
'<HR>line: '.__LINE__.', G2 did not return a success status. Here is the error message from G2: <br />'.$ret->getAsHtml();

return 
false;

}

}



// user interface: disable sidebar in G2 and get it as separate HTML to put it into a block

//GalleryCapabilities::set('showSidebar', false);



// handle the G2 request

$g2moddata GalleryEmbed::handleRequest();



// show error message if isDone is not defined

if (!isset($g2moddata['isDone'])) {

$data['bodyHtml'] = 'isDone is not defined, something very bad must have happened.';

return 
$data;

}

// die if it was a binary data (image) request

if ($g2moddata['isDone']) {

exit; 
/* uploads module does this too */

}



// put the body html from G2 into the xaraya template

$data['bodyHtml'] = isset($g2moddata['bodyHtml']) ? $g2moddata['bodyHtml'] : '';



// get the page title, javascript and css links from the <head> html from G2

$title ''$javascript = array(); $css = array();



if (isset(
$g2moddata['headHtml'])) {

list(
$data['title'], $css$javascript) = GalleryEmbed::parseHead($g2moddata['headHtml']);

$data['headHtml'] = $g2moddata['headHtml'];

}



/* Add G2 javascript */

if (!empty($javascript)) {

foreach (
$javascript as $script) {

$data['javascript'] .= "\n".$script;

}

}



/* Add G2 css */

if (!empty($css)) {

foreach (
$css as $style) {

$data['css'] .= "\n".$style;

}

}



// sidebar block

if (isset($g2moddata['sidebarHtml']) && !empty($g2moddata['sidebarHtml'])) {

$data['sidebarHtml'] = $g2moddata['sidebarHtml'];

}



return 
$data;

}

// #######################################################################

// ####################### End G2 integration code #######################

// #######################################################################



eval('print_output("' fetch_template('gallery2') . '");');



?>

thanks in advance

extremesanity 07-29-2007 05:51 AM

For those that are getting the following error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

It has been said before on page 4, but what you need to do is fix an error in the upload plugin. Go to plugin manager > Update Gallery User and edit the following line:

Code:

require_once('/home/website/root/forum/gallery2/embed.php'');
remove the double quote at the end so it looks like:

Code:

require_once('/home/website/root/forum/gallery2/embed.php');

adnedarn 09-05-2007 03:06 AM

I'm having the problem like oldgoat above. I have installed G2 into my vbulleting forums directory. All seems to work, but there are no buttons in the navbar. If you manually browse to the gallery2.php page it's there. I thought maybe it was my skin, but looking at the "more" stock skin, I still dont' see anything in the navbar. I don't even know what to type to get someone started in helping me, sorry. But any help would be much appriciated!
Andrew

also, we're randomly getting the error: unexpected T_CONSTANT_ENCAPSED_STRING
If I remove the double quote as stated above, we cannot post or send PMs at all. We get:

Warning: Unknown(/forums/gallery2/embed.php): failed to open stream: No such file or directory in /includes/class_dm_user.php(1657) : eval()'d code on line 1

Fatal error: (null)() [function.require]: Failed opening required '/forums/gallery2/embed.php' (include_path='.:/usr/local/lib/php') in /homepages/42/d98622539/htdocs/terraforums/forums/includes/class_dm_user.php(1657) : eval()'d code on line 1


Thanks very much :)

Riccardo83 09-08-2007 04:25 AM

wouldnt it be good to release a new version of the integration working for 3.6.8 to cut all those discussion short and makes it easier for people to find the right answer.

im still confused if i just download this integration and leave it as it is, or if i have to edit it after?

RvG2 09-24-2007 01:20 AM

or better release a mod/plugin for this :)

Outrack 09-26-2007 08:59 AM

When I run this mod, I receive the message:

Code:

Warning: require_once() [function.require-once]: open_basedir restriction in effect. File(/public_html/forum/gallery2/embed.php) is not within the allowed path(s): (/home/outrack/:/usr/lib/php:/usr/local/lib/php:/tmp) in /gallery2.php on line 55

Is there anyway to get past this without having to contact my host to remove the open_basedir restriction?

rammbs 10-02-2007 02:10 AM

i got it working to a point that it's showing the header, albums, footer, etc. but it's not taking into account the css. so the albums are all over.

where is a good place to declare the css? tia!

NineVB 10-03-2007 10:14 AM

So, I decided to take a fat chance and try installing Gallery 2.2 (Latest) with vBulletin 3.6.8, and lo and behold it worked. Well, almost.:cool:

Here's what I did:
I created the gallery2 directory within the forum home, as indicated.
But then I struck a small problem. The "Your album" as well as clicking on an image, would take me to /v/<name>.:confused:
So, I then proceeded to move gallery2.php to /gallery2/gallery2.php, (didn't need to change the embed.php line or anything) and nothing came up. I then linked the file back to gallery2.php and it worked. :D No snags yet. (See minor issues below.)

I did try and add the .xml files for the two addons, and also hit a serious snag.:erm:
Trying to add it as a product said this looks like a Plugin...
Ok, so now to add a plugin.
And I had to do a quick crash course. So here goes for those that don't want to do too mouch soul or web searching:

In the add new plugin part:
  1. Select vBulletin in the first dropdown. (Mine contains vDrupal as well.)
  2. Select the Hook Location as userdata_postsave in the first one and userdata_delete in the second one.
  3. The titles are "Update Gallery User" and "Delete Gallery User" respectively.
  4. Now take the first section from "CDATA[" (Not including, in otherwords, first line starts with "require_once") up to before "]]></phpcode" and paste that as the Plugin PHP Code.
  5. Make sure you do this for both parts, that are listed within the xml file.
  6. Ensure that you have enabled the plugins, and you're done.

I am still trying to figure out, how to not pass the gallery out of the vBulletin forums, when you click on "My Gallery" and any images.

This however is not a major issue right now, as I will change the skin to allow you to go back to either the home page or the forum anyway.

Thankyou for all the work Brent. Well done.
Now I need to figure out how to do a group control from vBulletin to gallery, whereby only members of a specific forum group can add images to the gallery.

softsingapore 10-19-2007 12:26 PM

VBB - 3.6.8
vBadvanced CMPS - v3.0 RC2
Gallery - 2

http://www.soft.com.sg
http://www.soft.com.sg/forum
http://www.soft.com.sg/gallery
http://www.soft.com.sg/forum/gallery.php

Hi guys

I have set up as above but somehow I could not get the integration working.

The forum(with CMPS) and gallery are working fine on their own.

Please help me out here.

Thanks.

James





<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'gallery'); // change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(

);

// get special data templates from the datastore
$specialtemplates = array(

);

// pre-cache templates used by all actions
$globaltemplates = array(
'gallery',
);

// pre-cache templates used by specific actions
$actiontemplates = array(

);

require_once('./global.php');

$navbits = array();
$navbits[$parent] = 'Gallery';
error_reporting(E_ALL );

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

$data = runGallery();
$data['title'] = (isset($data['title']) && !empty($data['title'])) ? $data['title'] : 'Gallery';

function runGallery() {
global $vbulletin, $userinfo;
require_once('/hsphere/local/home/jameswoo/soft.com.sg/gallery/embed.php');


$data = array();

// If it's an anonymous user, set the g2 activeUser to null
$uid = $vbulletin->userinfo['userid'] = 0 ? '' : $vbulletin->userinfo['userid'];


$ret = GalleryEmbed::init(array('embedUri' => '/forum/gallery.php',
'g2Uri' => 'http://www.soft.com.sg/gallery/',
'loginRedirect' => 'index.php',
'activeUserId' => $uid));

rammbs 10-28-2007 04:01 AM

@softsingapore, try using the html code (step 2) from this thread :

https://vborg.vbsupport.ru/showthrea...ry+integration


i had the same problem like you where it showed a blank page.


below are my declarations. compare it to yours and see if it will help.

Quote:


$ret = GalleryEmbed::init(array('embedUri' => 'gallery.php',
'g2Uri' => '/pg/',
'loginRedirect' => '../index.php',
'activeUserId' => $uid));


snapshotz 11-20-2007 06:01 PM

anyone figure out how to include group sync?

Eclipsed830 12-29-2007 08:26 AM

Does this allow the VB users username and passwords to be transfered over too, so users don't need to create a new account to upload pictures?

Alteran Ancient 01-22-2008 04:14 PM

Yep. The script Carbon-copies the user's account to the gallery when the navigate to the integrated gallery page.

Also, I'm trying to use this in vB3.7, but http://www.alteranlabs.co.uk/forums/gallery2.php is screwed up; None of the images are there and the formatting is out-of-whack. I've looked at the image path for the placeholders, and it's done "/forums" twice! Any way to rectify this?

stonner 01-31-2008 06:01 PM

I tried this integration with Gallery 2.2 i got this error message:
Quote:

line: 98, Failed to create G2 user with extId [1]. Here is the error message from G2:
Error (ERROR_COLLISION)

* in modules/core/classes/GalleryUser.class at line 149 (gallerycoreapi::error)
* in modules/core/classes/GalleryEmbed.class at line 344 (galleryuser::create)
* in /var/www/forums/gallery2.php at line 95 (galleryembed::createuser)
* in /var/www/forums/gallery2.php at line 50

���������\�w�F���>���e^��3����18��m���O! P[HD�Nf��������tH����Vݥ�V��vr���v�b�t�����&�J� ʯ[�J�{������9�(WY7���O�(��J���b�(M'��|>/Ϸ�Q<�t�+�� ����YvS�j�W�]?�[A[,��a��B�g����Km�NJ��SV��Q�zaZ��M<�9�S�J�oi��2gd lj��o��Ҟ�*@�B/+��^�z��i���x^�l��l���V�{ԭw7�b71 H�h]/qbB��q���;E��J%��tX'� �d�y)+����R��\'!�[�f}9�ݢ����*?1c�r;�t�z� �i����l�������Ty���w��� ��s;��i�/hm��C�v� �q��_tg�a|u����vh�3Z�ރ��x_lq��ufǾ������ $��R�������x�lg�@�ۉ�~8<`������}���:#�{6]�Y(r7��o�gg>D�s����C#F��l'�g��o�ǵ���ժ�T��C�`9� �E3Q����\R�������o���TN�l/. �d��"���GF��zN�p��(��K˞W(|ς(e��3$T�/�v���Bz��^��j�G0���i�V���% ~13I�R{�a^ͰpFYW�c[���� �q��+��$�+SRN�%���$DQ�^m�v��9�ܪ��mb0���ӥ �E� -dLW�+�n�P=]�?����d�\0�n;H7�;�F�@ �;�M�\dHi����6��vn��쇤�H ��M2{���w�?�>��7�P��d��؃6���['S)Ko���i�b���k�r�����k���/���N��$�O)��� # �M�4��~pw�,'c;|�[�}]4�?���ҥ�x�)3ڳ�-=�7bgy�G�ə*:�mRI��s�9����I�b��P�f����Ww���ۻ ��RŞ�a!��vk���ȶ�?a[�v(�w�&��� ���)�!�v2���^0/�uۭ�ST@�C(Xx��T��η2mo����c/��(⋣"����k�6 �UK�'�&f|��>�|'��GIJ��v`T�h����<�hK���c���٦ ���g��/Ģ�<�׎B��|AlB��h=�{ѕ��&�DY�\��AR�3�S�FRQ�H�b�(к ���n�E\��-l�aZq�qB��$�c���%��'^�v�tej����� �BP([/? Z�d)��,#��������{G���9�gb��0^P���v�9<���=�+ ����k܋�W�_�x$�~���2Ql��j���)rX��LXBђ���K� �AY�2�Tϱ?1���&�'�!�>�y�L��*W�_lwib @N]MRI]��L\�Μm?X�ӷ��3�4�12�~�rX ޟ���@�� ��b@��c�kb'�0�H�땼�dz��\�''���v�{�ŅL˨OR�� F�]�:|�<5Vɇ���€$�z�!e� � -e��"S.z�����/��Q'yP��i&%�7��>����#5%�<��gTJ�!"�����G�) �}B2��e +�> B�F�jJ�R9��A�IG�4��C������$�.��� ���ȭ� kAo�q6}ˉPq��+�����Y��rPB>x�\��w���i��{ҫ����d|� �3�*-���(w_)�ޫ'D9�L��g��KI{gE������F����]~��>gufY�:�}yvqzrvݻ8�4�[�L����������_�oxxB���0]���:�2ȕ�Yw�A�f’ة[N���R��� ��A�k�iV��g5���5�ڃ�� l�����O9\䔃��9� -��^X�ޠn�˕�x���(�ה�Oe�XVrz倖���JK��פ2�� s�Ab � %��5*���`�y�A� y��$�.2�RyA ��:���0*K��ji,�UK F ��gݚ�n::بV��p���mC�5\@h��ԭ���bC\�d�� E ��N+�˛�����fu�b; Yi�r� V�;�be(��0ِ/G8��Vc���� ��B��h�}�U�R ��d+��C1����S�0?UsRXf=�L�f��F�rB�ۺ���f�����ߓ� �No��߫�{�*�no���/�#�bx���K�5>�҄ؿ^��l,��n��@ ��!;�`�g��9��Qt���vm:� ��ط�+/�^�yy�J39�������v��sy�v��?En z�UN*(e� =�5b��g�s��ޜ���.h俘fi!� BWa%�/O/o�rIm[�4��RIA�i����N`' j��d3���j�23@j���I�0�[��L�7ȟ}Tx�G3: ��h�=��J��w���;MKX�:Z �������"�tz�״@b6��͋�_��d�=�A�f��Z?֝ �z8.4��V�����s[:�TI=��it(op+$�,��R`��3�L8�?�zi���E��Ц�s�@/��6u?�����AG�27�� �8B�Ey#���O��gjY%,��SSHK�Cx�񎭬�|y��|��㣱[}W�N<;vF sb�3�N������C��^|�ݤ7X�ӣ����o��:��h�`�zu=8����Є>v� ���c�ϝ�_f����8y1h_^�\|�K�˶o1���˛��� ?��|�[{�X����7P���i�{���~+;������ ȀJ��nx�;j6/o>w�(�_��97��}�w�<{�� ϜpJ��`���~RJQ4�U�3(ұ���.�9��9P�1�(�1Mх�VD2�� �u�������ݬc$O��1ʹ�U�W��� Y� ԭʳT|����(�Cf �GF�rmhru�Y��-3Nz$f`1���D-R�*N� Q��F$�-�we�<�m|8DB2��!�A�!��B[#�[��?Mz �xs��lO#v @�u����:�p!?��dr(EA�̯�H�ɵ�>�FMA��<M��q�DCK<��j ��� 掆@/�g�e���x?�Gm凪jU�H�����P�� *+�ӑ��&'X,�D����-2�.��,���5��?� m��+d V�D���C�S���P��.\ǃ+$��ǟ� �?539޴����h�[�]� 7r���⩨�� �h�z���rFm���-���F��8��k�1�r�C-dVc�z��/3�4�e�R�TaȮ��J�"�� yZN�1l����m�#&q��7�V�� j;�Y2i�*�6��[9X�Y9�+�iR���C�"&M�}�Hs5�)�ac�U���Р\��iW�YZmb� 3�7�� )C�FY[�0��}�)����ю�h�Ӏ�i��q��ݓTL�N�9�<*��|�c�)?�P� ���'Q(�9�Շ^z�F��7gWQ�&�q�� ���t�m)�2�9d���TB #Qֵ�m"�0��g��2�[ &������k 4a7��uAm)�~ ��y�L#l��ϢhG�F_���9@Ʈ��SU �-_��Ō}oZZ �=M#���R���G{<9����7�ǭnnlW�g�ll8�{�������֮� o�`$� ���� a(p1t}����8yC�u�~Z��/�9�Xn8 -"�� )������]��˫�+v��|ӑ�h�@�SaV'�!��1�O�۝3^��kN�{"�,��� ��r��ќ3�X�̹���θa�x�����b��o��c��S�i(R�i��a $ږ�6�R� @�+<�Lc�PL��4 �tAo�I D���������h�s�nĽ�).5��ڽ|猠A�2=e��i��w{�P��O�? w V�;�Ҥ�L��n�͌<5�V��)��p$ѣT�6w�&��e����9��Ǿ�� �d�b�s� s�˛!\�]_�n�!F7�f�JM��`5�V���^2A ?G�6��d�I6��B�6�� ާ3�[�� ��8��r���hr*D��O�d��UD"B�琈�5I����mi� 䮘#G�)'E�T�mb,c:�>C?�8)��Gv�#wf�z�:z��[��L��*�iY���#&�{S��� �9t웰 ��I������l�)���OZ��L� ����I��7�E̐��k�l" ]V��<&��O����=ԮLm ��V�W��k�ю�sј�Y�$zm������uц��`9S88hN��q��A:M ���h�@^�D�K�^��?�����F���O"s��S]��7�-tw�O`\�8vL��}h=o�r��D!{4E�q�#q��7:_���Ԩe@-��"���'���G�Q� � (|�� B�28���G!���D*Q\���q,�2 *��pI�z�W���Ž� Iݾ��� |Dqc�v XN����\��\��;v!��^<}l�"�F��Z�}�}�q���ܛ^�'�R�\ *�u�w�?�^�ϭ �u��]�;�׃�/���f�"}� [�����N[xDz�\Ё�a�]�����C��I�Q��Oy�*K�!ϊH��~�2�c����x#ɪ�v��� �.�H��a��}��Z+re�;�s��]Yr��P?%gWFF ϸ 7�;�|��1�H}e���ms��)� �t��+C�G���"�%�P�޺�����P�ՐI_)"x@$���% ���c��@f XSO�t�b~��D(���Ӌ.�ߍ2L�q�Ě!y]���ّ[��9�`z"��gE�/��\o�+��>��N ��%R Փb$�������9Q��&�<�B�;�Z������� �:4�&���@��>}��P��D�s?uF=4�Fҏ��ʓ����6Lހ� �96�-���R�E���>{�R��D_��HJ�x8��j�a1 ��(XSW�h�C8�#�v��`�2)'�tc>�~�>���!�V 7���b �5,(����f� y� ��>�ƨzB�ܫ,��Mx��Iv#Rz�$BSm��ݱ:�J&��#�E�'3k� ��/"��?M-z��|q��R��^���<0eP�{7Z��3t�/��ф@g��˅�44��Bmt�Z5g�I�����%zH�{%)%Y�V�'�V��� ��)JoN4��RD��4<͢?�/+��x|�T�q���ӯoշ6?nn#,��UI�?q�y��2�Ui0�` t<;�MPAƆ�xv�Dl0 �͗�Β��ݕR�g �͕dq�AIM�7�j&�J{Q�%��e��Y\����=2�a��'��Y���^ ��ۮ��;s=_���!�@4 "`v�/�O������1��t�ȉ������\�3:�a%��A���i���Bg�9��� `GzA&3�����sF��؁�5�q�� �0��Q�+��^�ǀ��?��>��}�r�Ugr�HI�$����1����n�N� �t!���,��}��z�V��V���~�=C:�2]=���Y�_ZtA�i��0���/���rRH�̇�i�:7ǝ����3�P�=�%���Y����=?tX����G�qO� ~-"��l h}�E��]�˰)�9�{�dO�1H�_ V�W�O??ɶsV��G����q� �ul(VBd"L�Z 2��(��S�}�~: V��
So i cant use the 2.2 version with vBulletin, no?!

pHluid13 02-13-2008 06:04 AM

Alright, new to vbulletin and this is the first site that I've used it with. I decided to go the way of using gallery2 with my vB install and got this entire integration to work properly.

My setup is as follows in case you need to know:
hswaves2008/forum/(forum files)
hswaves2008/forum/gallery2.php
hswaves2008/forum/index.php (the default file with vbulletin)
hswaves2008/gallery/(gallery files)
hswaves2008/index.php (the vbadvanced CMPS file)

My gallery2.php code:
PHP Code:

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''gallery'); // change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(

);

// get special data templates from the datastore
$specialtemplates = array(

);

// pre-cache templates used by all actions
$globaltemplates = array(
'gallery2',
);

// pre-cache templates used by specific actions
$actiontemplates = array(

);

// ######################### REQUIRE BACK-END ############################

require_once('/kunden/homepages/16/d95423082/htdocs/hswaves2008/forum/global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$navbits = array();
$navbits[$parent] = 'Gallery';
error_reporting(E_ALL );

$navbits construct_navbits($navbits);
eval(
'$navbar = "' fetch_template('navbar') . '";');

// #######################################################################
// ###################### Begin G2 INTEGRATION CODE ######################
// #######################################################################

$data runGallery();
$data['title'] = (isset($data['title']) && !empty($data['title'])) ? $data['title'] : 'Gallery';

function 
runGallery() {
global 
$vbulletin$userinfo;
require_once(
'/kunden/homepages/16/d95423082/htdocs/hswaves2008/gallery/embed.php');

$data = array();

// If it's an anonymous user, set the g2 activeUser to null
$uid $vbulletin->userinfo['userid'] = '' $vbulletin->userinfo['userid'];

// initiate G2
// You need to edit the following 4 lines to suit your VB3 & G2 installations
// This is set up for an install that looks like:
// public_html/VB/<vb files>
// public_html/gallery2/<gallery2 files>
// and also setup for a VB3 template name of 'gallery2'. If you have any
// differences, make those changes here!
// You might need to change 'loginRedirect' if you have your VB3 setup to
// where index.php is not the root page of VB3... Like if you've changed it
// to forums.php or something of the like.

$ret GalleryEmbed::init(array('embedUri' => '../gallery2.php',
'g2Uri' => '/gallery/',
'loginRedirect' => '../index.php',
'activeUserId' => $uid));
if (
$ret)
{
if (
$ret->getErrorCode() & ERROR_MISSING_OBJECT)
{
// Check if there's no G2 user mapped to the activeUserId
$ret GalleryEmbed::isExternalIdMapped($uid'GalleryUser');
if (
$ret && ($ret->getErrorCode() & ERROR_MISSING_OBJECT))
{
// User not mapped, create G2 user now
// Get Arguments for the new user:
$args['fullname'] = $vbulletin->userinfo['username'];
$args['username'] = $vbulletin->userinfo['username'];
$args['hashedpassword'] = $vbulletin->userinfo['password'];
$args['hashmethod'] = 'md5';
$args['email'] = $vbulletin->userinfo['email'];
$args['language'] = $vbulletin->userinfo['lang_code'];
$args['creationtimestamp'] = $vbulletin->userinfo['joindate'];

$retcreate GalleryEmbed :: createUser($uid$args);
if (
$retcreate)
{
echo 
'<HR>line: '.__LINE__.', Failed to create G2 user with extId ['.$uid.']. Here is the error message from G2: <br />'.$retcreate->getAsHtml();
return 
false;
}
$ret GalleryEmbed::checkActiveUser($uid);
if (
$ret) {
print 
$ret->getAsHtml();
return 
false;
}
}
else
{
echo 
'<HR>line: '.__LINE__.', G2 did not return a success status. Here is the error message from G2: <br />'.$ret->getAsHtml();
return 
false;
}
}
else
{
echo 
'<HR>line: '.__LINE__.', G2 did not return a success status. Here is the error message from G2: <br />'.$ret->getAsHtml();
return 
false;
}
}

// user interface: disable sidebar in G2 and get it as separate HTML to put it into a block
//GalleryCapabilities::set('showSidebar', false);

// handle the G2 request
$g2moddata GalleryEmbed::handleRequest();

// show error message if isDone is not defined
if (!isset($g2moddata['isDone'])) {
$data['bodyHtml'] = 'isDone is not defined, something very bad must have happened.';
return 
$data;
}
// die if it was a binary data (image) request
if ($g2moddata['isDone']) {
exit; 
/* uploads module does this too */
}

// put the body html from G2 into the xaraya template
$data['bodyHtml'] = isset($g2moddata['bodyHtml']) ? $g2moddata['bodyHtml'] : '';

// get the page title, javascript and css links from the <head> html from G2
$title ''$javascript = array(); $css = array();

if (isset(
$g2moddata['headHtml'])) {
list(
$data['title'], $css$javascript) = GalleryEmbed::parseHead($g2moddata['headHtml']);
$data['headHtml'] = $g2moddata['headHtml'];
}

/* Add G2 javascript */
if (!empty($javascript)) {
foreach (
$javascript as $script) {
$data['javascript'] .= "\n".$script;
}
}

/* Add G2 css */
if (!empty($css)) {
foreach (
$css as $style) {
$data['css'] .= "\n".$style;
}
}

// sidebar block
if (isset($g2moddata['sidebarHtml']) && !empty($g2moddata['sidebarHtml'])) {
$data['sidebarHtml'] = $g2moddata['sidebarHtml'];
}

return 
$data;
}
// #######################################################################
// ####################### End G2 integration code #######################
// #######################################################################

eval('print_output("' fetch_template('gallery2') . '");');

?>

I am, however, receiving some link errors it seems. I don't have the gallery2.php file posted on the site, but you can definitely go directly to it here: http://www.hswaves.com/forum/gallery2.php

Now, the problem that I am having is this.
1) Click on the image that I uploaded t the gallery. (its the only one there)
2) If you scroll down to where it says "Photo Properties", just under that is an option to click on DETAILS. If you click this link to see more details on the image, the link is broken.

Is there something that I need to do to get these links working properly. I have read this thread through several times and finally got the gallery2.php file working and searched through a couple more times for this issue and to no avail, I have found nothing that addresses this issue. Or maybe I don't know what solution I should be looking for. Any help here would be greatly appreciated.

BTW... I have to say that vBulletin far surpasses any other forum/CMS that I have ever used in the past. I love it and it has been user friendly since day one. Now, tojust get this integration to work properly. Thank You.

Drew Manzella 02-16-2008 08:52 PM

Quick question - does the G2 database need to be in the same database as vB?

I will be starting from scratch on this. I have an existing vB 3.6.8 installation. No Gallery2 at all currently.

I am not currently convinced I need to embed. In fact I am leaning away from it for the simple fact that my forums are a fixed width right now. Letting the galleries break out will up the available width by about 250px. I do however need to unify logins for users. I'd also like to have links to user's galleries in their profiles.

As for Gallery2 version, it sounds like 2.1 will be a bit less painful to get up and running with vB 3.6.8. Is this assumption correct?

pHluid13 02-17-2008 12:23 AM

It has been a few days since I have seen a response. I have tried emailing and PMing a few of the users that responded and seemed proficient in correcting issues with this integration. I have it working and just need one little tweak to get some links working but it doesnt seem like this is supported anymore. No one checks this thread and the last few posts have seen no responses. The last support response was a month or two ago. Anyone out there that can help? Please?

BTW, I have Gallery 2.2 and IB 3.6.8 and it works just fine. The only issue that I am having is the one listed above. I am sure it can be corrected because I have seen a site in action with these two versions. Just waiting for a response from one of the users here. Hope they can help.

Drew Manzella 02-17-2008 02:29 AM

I sort of gathered that.

Maybe you can answer my question about the db since yours is up and running. Did you install G2 to your vB database or are they separate? Does it matter either way?

I looked at your site earlier and the details link wasn't pointing to your forum folder - it was formed as if the folder was in the doc root.

I just looked again now and the details link worked for me.

pHluid13 02-17-2008 03:22 PM

I figured it out last night and it is working for me now. I had one thing set wrong in my gallery2.php file. Looking through this thread over and overhelped me a lot even after I had already looked and looked through it man times a day until I had it right. Here is how you set it up.

install vbulletin to:
domain.com/forum/
install gallery to:
domain.com/gallery/

open up a text editor and insert this code:

PHP Code:

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''gallery'); // change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(

);

// get special data templates from the datastore
$specialtemplates = array(

);

// pre-cache templates used by all actions
$globaltemplates = array(
'gallery2',
);

// pre-cache templates used by specific actions
$actiontemplates = array(

);

// ######################### REQUIRE BACK-END ############################

require_once('/kunden/homepages/16/d95423082/htdocs/hswaves2008/forum/global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$navbits = array();
$navbits[$parent] = 'Gallery';
error_reporting(E_ALL );

$navbits construct_navbits($navbits);
eval(
'$navbar = "' fetch_template('navbar') . '";');

// #######################################################################
// ###################### Begin G2 INTEGRATION CODE ######################
// #######################################################################

$data runGallery();
$data['title'] = (isset($data['title']) && !empty($data['title'])) ? $data['title'] : 'Gallery';

function 
runGallery() {
global 
$vbulletin$userinfo;
require_once(
'/kunden/homepages/16/d95423082/htdocs/hswaves2008/gallery/embed.php');

$data = array();

// If it's an anonymous user, set the g2 activeUser to null
$uid $vbulletin->userinfo['userid'] = '' $vbulletin->userinfo['userid'];

// initiate G2
// You need to edit the following 4 lines to suit your VB3 & G2 installations
// This is set up for an install that looks like:
// public_html/VB/<vb files>
// public_html/gallery2/<gallery2 files>
// and also setup for a VB3 template name of 'gallery2'. If you have any
// differences, make those changes here!
// You might need to change 'loginRedirect' if you have your VB3 setup to
// where index.php is not the root page of VB3... Like if you've changed it
// to forums.php or something of the like.

$ret GalleryEmbed::init(array('embedUri' => 'gallery2.php',
'g2Uri' => '/gallery/',
'loginRedirect' => 'index.php',
'activeUserId' => $uid));
if (
$ret)
{
if (
$ret->getErrorCode() & ERROR_MISSING_OBJECT)
{
// Check if there's no G2 user mapped to the activeUserId
$ret GalleryEmbed::isExternalIdMapped($uid'GalleryUser');
if (
$ret && ($ret->getErrorCode() & ERROR_MISSING_OBJECT))
{
// User not mapped, create G2 user now
// Get Arguments for the new user:
$args['fullname'] = $vbulletin->userinfo['username'];
$args['username'] = $vbulletin->userinfo['username'];
$args['hashedpassword'] = $vbulletin->userinfo['password'];
$args['hashmethod'] = 'md5';
$args['email'] = $vbulletin->userinfo['email'];
$args['language'] = $vbulletin->userinfo['lang_code'];
$args['creationtimestamp'] = $vbulletin->userinfo['joindate'];

$retcreate GalleryEmbed :: createUser($uid$args);
if (
$retcreate)
{
echo 
'<HR>line: '.__LINE__.', Failed to create G2 user with extId ['.$uid.']. Here is the error message from G2: <br />'.$retcreate->getAsHtml();
return 
false;
}
$ret GalleryEmbed::checkActiveUser($uid);
if (
$ret) {
print 
$ret->getAsHtml();
return 
false;
}
}
else
{
echo 
'<HR>line: '.__LINE__.', G2 did not return a success status. Here is the error message from G2: <br />'.$ret->getAsHtml();
return 
false;
}
}
else
{
echo 
'<HR>line: '.__LINE__.', G2 did not return a success status. Here is the error message from G2: <br />'.$ret->getAsHtml();
return 
false;
}
}

// user interface: disable sidebar in G2 and get it as separate HTML to put it into a block
// GalleryCapabilities::set('showSidebar', false);

// handle the G2 request
$g2moddata GalleryEmbed::handleRequest();

// show error message if isDone is not defined
if (!isset($g2moddata['isDone'])) {
$data['bodyHtml'] = 'isDone is not defined, something very bad must have happened.';
return 
$data;
}
// die if it was a binary data (image) request
if ($g2moddata['isDone']) {
exit; 
/* uploads module does this too */
}

// put the body html from G2 into the xaraya template
$data['bodyHtml'] = isset($g2moddata['bodyHtml']) ? $g2moddata['bodyHtml'] : '';

// get the page title, javascript and css links from the <head> html from G2
$title ''$javascript = array(); $css = array();

if (isset(
$g2moddata['headHtml'])) {
list(
$data['title'], $css$javascript) = GalleryEmbed::parseHead($g2moddata['headHtml']);
$data['headHtml'] = $g2moddata['headHtml'];
}

/* Add G2 javascript */
if (!empty($javascript)) {
foreach (
$javascript as $script) {
$data['javascript'] .= "\n".$script;
}
}

/* Add G2 css */
if (!empty($css)) {
foreach (
$css as $style) {
$data['css'] .= "\n".$style;
}
}

// sidebar block
if (isset($g2moddata['sidebarHtml']) && !empty($g2moddata['sidebarHtml'])) {
$data['sidebarHtml'] = $g2moddata['sidebarHtml'];
}

return 
$data;
}
// #######################################################################
// ####################### End G2 integration code #######################
// #######################################################################

eval('print_output("' fetch_template('gallery2') . '");');

?>

This is my code, so you can feel free to copy it and save it as gallery2.php. There are two absolute paths that need to be altered toward the top. If you do a search for hswaves2008, you will find those paths. Put your absolute paths in there. One is for global.php and the other for embed.php. The other part of the code is already set for this type of setup so no need to edit the last part like the initial post of this thread tells you, I have already done it for you.

Save this file and upload to:
domain.com/forum/gallery2.php

Create the new template like Step 4 of the initial post instructs you to do.

That is all. Now you can use the gallery2.php file as the link to your gallery. You will need to edit the css file in gallery to match the colors of your vbulletin or vice-versa.

What this code does is integrate the gallery and the forums when anyone visits that file. When they register for your vbulletin forum, it WILL NOT create a gallery user yet. The user must first visit the gallery2.php file in order for a user account to be created in gallery. As I understand, there are two different db's. One for vbulletin and one for gallery. The password for the gallery will not be the same as the vbulletin forum for the user due to the fact that vbulletin wants to add SALT(password) to the password. When a user visits the gallery2.php file for the second time it will look to see if the user is registered in vbulletin and if so, will look in the gallery db for a user account that matches,and if so then all will be gravy. If you have any further questions, let me know. Im not good at this stuff but if you follow my instructions, it will work now that I have it all figured out.

It just sucks that someone like me has to be support for this for the fact that Im not really good at this stuff and am new to all this coding. Im a first timer to vbulletin, even if I have installed quite a few things in the past. I really would like to know what I am talking about when I help someone. What kind of code do I need to know to tweak this stuff. PHP? If I got a book on PHP, would that help me?

Drew Manzella 02-17-2008 03:37 PM

Thanks man! That is all easy stuff.

I am still unsure about my original DB question though and haven't seen an answer. I ASSume it doesn't matter where the vB database is in relation to the Gallery2 database because it is looking at that globals.php file which best I can tell pulls the user info from the vB database regardless of where it is - it knows where to look.

My question stems from Joomla and the fact that all of the vB integration features for it require the vB database to be installed within the Joomla database and I like to keep things separate.

Chances are, if you did not specifically create a new database for your Gallery2 install, then it dumped it into the vB database.

I think what I will do is just try it with Gallery2 in it's own database. If it doesn't work I am out about 20 minutes of time and it is easy to clean up. I'd rather start there and integrate them later if I need to than integrate them and then have to go back later and correct it.

--------------- Added 17 Feb 2008 at 14:48 ---------------

Ok all I am getting is the white screen. Install paths are as follows:

/chroot/home/mazdaoca/mazdaoca.org/html/community/global.php
/chroot/home/mazdaoca/mazdaoca.org/html/community/gallery/embed.php

Installed in the following:

vB: webroot/community/
G2: webroot/community/gallery/

URL I am using is:

http://www.mazdaoca.org/community/gallery.php

The direct G2 link works fine:

http://www.mazdaoca.org/community/gallery/main.php

VB template "gallery2" has been created and the "head" section contains the code posted in Step 4 of the instructions.

gallery.php is as follows:

Code:

<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'gallery'); // change this depending on your filename
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(
);
// get special data templates from the datastore
$specialtemplates = array(
);
// pre-cache templates used by all actions
$globaltemplates = array(
'gallery2',
);
// pre-cache templates used by specific actions
$actiontemplates = array(
);
// ######################### REQUIRE BACK-END ############################
require_once('/chroot/home/mazdaoca/mazdaoca.org/html/community/global.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
$navbits = array();
$navbits[$parent] = 'Gallery';
error_reporting(E_ALL );
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
// #######################################################################
// ###################### Begin G2 INTEGRATION CODE ######################
// #######################################################################
$data = runGallery();
$data['title'] = (isset($data['title']) && !empty($data['title'])) ? $data['title'] : 'Gallery';
function runGallery() {
global $vbulletin, $userinfo;
require_once('/chroot/home/mazdaoca/mazdaoca.org/html/community/gallery/embed.php');
$data = array();
// If it's an anonymous user, set the g2 activeUser to null
$uid = $vbulletin->userinfo['userid'] = 0 ? '' : $vbulletin->userinfo['userid'];
// initiate G2
// You need to edit the following 4 lines to suit your VB3 & G2 installations
// This is set up for an install that looks like:
// public_html/VB/<vb files>
// public_html/gallery2/<gallery2 files>
// and also setup for a VB3 template name of 'gallery2'. If you have any
// differences, make those changes here!
// You might need to change 'loginRedirect' if you have your VB3 setup to
// where index.php is not the root page of VB3... Like if you've changed it
// to forums.php or something of the like.
$ret = GalleryEmbed::init(array('embedUri' => 'gallery.php',
'g2Uri' => 'http://www.mazdaoca.org/community/gallery/',
'loginRedirect' => 'index.php',
'activeUserId' => $uid));
if ($ret)
{
if ($ret->getErrorCode() & ERROR_MISSING_OBJECT)
{
// Check if there's no G2 user mapped to the activeUserId
$ret = GalleryEmbed::isExternalIdMapped($uid, 'GalleryUser');
if ($ret && ($ret->getErrorCode() & ERROR_MISSING_OBJECT))
{
// User not mapped, create G2 user now
// Get Arguments for the new user:
$args['fullname'] = $vbulletin->userinfo['username'];
$args['username'] = $vbulletin->userinfo['username'];
$args['hashedpassword'] = $vbulletin->userinfo['password'];
$args['hashmethod'] = 'md5';
$args['email'] = $vbulletin->userinfo['email'];
$args['language'] = $vbulletin->userinfo['lang_code'];
$args['creationtimestamp'] = $vbulletin->userinfo['joindate'];
$retcreate = GalleryEmbed :: createUser($uid, $args);
if ($retcreate)
{
echo '<HR>line: '.__LINE__.', Failed to create G2 user with extId ['.$uid.']. Here is the error message from G2: <br />'.$retcreate->getAsHtml();
return false;
}
$ret = GalleryEmbed::checkActiveUser($uid);
if ($ret) {
print $ret->getAsHtml();
return false;
}
}
else
{
echo '<HR>line: '.__LINE__.', G2 did not return a success status. Here is the error message from G2: <br />'.$ret->getAsHtml();
return false;
}
}
else
{
echo '<HR>line: '.__LINE__.', G2 did not return a success status. Here is the error message from G2: <br />'.$ret->getAsHtml();
return false;
}
}
// user interface: disable sidebar in G2 and get it as separate HTML to put it into a block
// GalleryCapabilities::set('showSidebar', false);
// handle the G2 request
$g2moddata = GalleryEmbed::handleRequest();
// show error message if isDone is not defined
if (!isset($g2moddata['isDone'])) {
$data['bodyHtml'] = 'isDone is not defined, something very bad must have happened.';
return $data;
}
// die if it was a binary data (image) request
if ($g2moddata['isDone']) {
exit; /* uploads module does this too */
}
// put the body html from G2 into the xaraya template
$data['bodyHtml'] = isset($g2moddata['bodyHtml']) ? $g2moddata['bodyHtml'] : '';
// get the page title, javascript and css links from the <head> html from G2
$title = ''; $javascript = array(); $css = array();
if (isset($g2moddata['headHtml'])) {
list($data['title'], $css, $javascript) = GalleryEmbed::parseHead($g2moddata['headHtml']);
$data['headHtml'] = $g2moddata['headHtml'];
}
/* Add G2 javascript */
if (!empty($javascript)) {
foreach ($javascript as $script) {
$data['javascript'] .= "\n".$script;
}
}
/* Add G2 css */
if (!empty($css)) {
foreach ($css as $style) {
$data['css'] .= "\n".$style;
}
}
// sidebar block
if (isset($g2moddata['sidebarHtml']) && !empty($g2moddata['sidebarHtml'])) {
$data['sidebarHtml'] = $g2moddata['sidebarHtml'];
}
return $data;
}
// #######################################################################
// ####################### End G2 integration code #######################
// #######################################################################
eval('print_output("' . fetch_template('gallery2') . '");');
?>

When I go to the URL all I get is:

Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1"></HEAD>
<BODY></BODY></HTML>


pHluid13 02-17-2008 07:03 PM

The infamous white page is due to the fact that your php file is not configured properly. You installed your gallery within the forum directory. It has been specified that you need to install the gallery in the root directory of your domain. The first post f this thread is confusing. They state that you need to put the gallery in the root of your vbulletin and then go to say later that the root of your vbulletin is up a directory from the forum folder. If you wish to keep the setup you have now then I believe you need to add something here.

PHP Code:

$ret GalleryEmbed::init(array('embedUri' => 'gallery.php',
'g2Uri' => 'http://www.mazdaoca.org/community/gallery/',
'loginRedirect' => 'index.php'

Your absolute paths are set up correctly, so you need to play with these figures here to get the corect value. I believe your embeduri is incorrect. But I can't say for sure. try putting the embeduri as ../gallery.php. I can't guarantee this will work this way. My suggestion to you would be to go back and install the gallery outside of the community folder. Look at my last post and follow it verbatim. I can guarantee that the way I have it set up will work because I have it set up that way. Or I can at least vouch. At any rate, the white page means that the code that I just quoted above has incorrect values. If you want to play with it then play with those figures.

As for your other question, sorry I didn't understand what you were asking the first time, but yeah, I have two db's one for the vbulletin and one for gallery. They are linked through the gallery2.php file.

Drew Manzella 02-17-2008 07:23 PM

I never saw a post saying it needed to be up a folder, just that it needed to be in my forum root (not webroot).

If I move it up into the webroot then my paths will need to be corrected.

pHluid13 02-17-2008 08:18 PM

Sorry if it wasn't clear. I have my site set up like this:

hswaves2008/forum/(forum files)
hswaves2008/forum/gallery2.php
hswaves2008/forum/index.php (vBulletin's default index)
hswaves2008/gallery/(gallery files)
hswaves2008/index.php (the vbadvanced CMPS file)

I can vouch that it works with this set up. Check the other posts in this thread, most everyone else has the same setup.

Drew Manzella 02-17-2008 08:30 PM

Yeah that is how I am doing it now. Re-uploading the G2 folder as we speak.

I'm not running vbadvance but best I can tell that doesn't matter. This just looks at vB through the globals.php file.

--------------- Added 17 Feb 2008 at 19:56 ---------------

Ok I give up. I tried it 3 times. I am now using your exact structure and exact config.php (updated for my paths) and I am still getting the white window of death.

It is working to an extent. When I try to go to the embeded gallery link nothing happens but if I log into the gallery2 installation my vB username is carried over. I tried logging in with it though and it kicked me out.

Either I am screwing something up with the template or there is an issue in the newest version of G2.

--------------- Added [DATE]1203300302[/DATE] at [TIME]1203300302[/TIME] ---------------

Ok I got it working. I was creating a new "style" and not a new "template".

Next question - how do I set it up so users can create their own galleries - or is this some functionallity that isn't part of this? I assume it is because there would be no need to pull user info if the only purpose of this was to embed G2 in the vB page.

pHluid13 02-18-2008 11:38 AM

there is apparently some code within this thread that puts the private album link in each persons profile. You will need to look for it. Before you do this, I would assume you'd just need to enable private albums for registered users in the gallery.

This is one function that I probably won't install on my site but if you figure it out, it would be nice if you post your solution for those who may look here later for help.

Drew Manzella 02-18-2008 12:07 PM

Yeah I found al that stuff but I am back to getting the white screen of death - and I didn't change anything. It is exactly how it was when it was workig and all of a sudden it just stopped.

:rolleyes:

I am gonna wipe it out and try it 1 more time.

--------------- Added [DATE]1203369864[/DATE] at [TIME]1203369864[/TIME] ---------------

Ok I finally got it all working.

I figured something out - the order in which you do things MATTERS. Every edit to every file needs to be done BEFORE you hit your trigger link for the first time.

Basically my final process (which worked) consisted of:
  1. Upload Gallery to my web server
  2. Run the Gallery install
  3. Add the "user album" plugin
  4. Create my album structure down to the location where user albums will be created
  5. Configure the user album plugin to put the albums where they needed to be
  6. Set all permissions/template options and cascade them
  7. Create the gallery2.php (Or whatever you want to call it) trigger file WITH all edits including corrections and the additional code for usergroup-based creations
  8. Created the Gallery2 template. Don't make the mistake I did and confuse a template with a style. The template you need to create goes WITHIN a style.
  9. Edited the plugin xml file to correct the errors as well as make the specified changes
  10. Uploaded the plugin file to vBulletin
  11. Upload the trigger file to my vBulletin root
  12. Hit the trigger file in a browser
Instantly it created my user album. Uploads worked fine and viewing works fine. Albums are accessible to guests as well so all is working properly but I had to fight it every step of the way to get it here.

Now that it is up and running it does integrate very well. I am going to have my site staff test it for a little while and then I will release it to the masses but if my brief tests are any indication - this is a very workable option for a vB image gallery.

The thing I like the most about it is that it installs and uninstalls without touching anything in vBulletin (other than adding the plugins and template which come out easy enough).

I went through the entire process 3 or 4 times so I am familiar with its removal as well. ;)

So for reference, here is another working install to add to the list of demos:

http://www.mazdaoca.org/community/gallery2.php

m_c 03-03-2008 09:28 AM

I've been trying to get this integrated for the past day, and can get it integrated with vB, to the point it creates the user in Gallery2, and displays the gallery within vB.
However that's as far as I can get.

I think my problem is something to do with how the Gallery 2 permissions are set-up, but I'm not sure how they should be set-up.
I have tried setting up a 'User Ablums' album, and then setting additional permissions, but the permissions then apply to all subalbums.
Can anybody give me a few pointers on how to get past this final hurdle?

I'm running G2.2, with vB 3.6.8 and vBa CMPS v3.0.0

m_c 03-05-2008 10:26 AM

Finally got the user album issue sorted, although I'm still not sure it's working how it's intended (users can create new albums within the defined User Albums album, but they're not created automatically).
The problem turned out to be a problem with the User Album plug-in, but uninstalling, then reinstalling it seems to of cured things. For anybody looking to install from scratch, I'd advise you install gallery2, set-up a test user, and check the test user can create albums and upload before trying to integrate.

I now just need to sort the link problem, which is causing page not found errors.

Cubevisions 03-07-2008 03:26 AM

Is this still alive? How can i integrate just the gallery and vbulletin logins (user table)?

pHluid13 03-29-2008 07:56 PM

The problem I am having with this and this seems to be the last problem I am having is that when a user is on the gallery2.php page, the popups for private messages dont appear if a user has a message. When they click on Options to get the expandable menu, the menu doesn't expand. There are certain features that dont work only in the gallery2.php file. They work fine on the rest of the site. Im guessing there is something missing from the gallery2.php file that allows for the full functionality of the site. Maybe someone can shed some light on my problem.

MrToasty 04-03-2008 11:49 AM

I had this working with gallery 2.0b4 with the old integration scipt... I've just upgraded gallery to 2.2 and have tried every possible combination of variables in the php file and I get nothing but the white screen!!

my setup:-

/forum/(forum files)
/gallery2/(gallery files)
/forum/gallery2.php

My variables (currently, as I've tried 1000 different combinations of relative and absolute paths here):-

Code:

$ret = GalleryEmbed::init(array('embedUri' => 'gallery.php',
'g2Uri' => '/gallery2',
'loginRedirect' => 'index.php',
'activeUserId' => $uid));

Help!?


All times are GMT. The time now is 04:45 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04042 seconds
  • Memory Usage 2,243KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (10)bbcode_code_printable
  • (4)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete