vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Menalto's G2 integration into VB3 (https://vborg.vbsupport.ru/showthread.php?t=80478)

whodah 12-30-2005 12:24 AM

i was asked to post a copy of my .htaccess file.

for reference, my setup is:

www.domain.com/forums.php

www.domain.com/gallery2/

this file is located both in my web root directory and in my gallery2/ directory (perhaps redundantly in the 2nd location for that matter!)

Code:

# BEGIN Url Rewrite section
# (Automatically generated.  Do not edit this section)
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
    RewriteCond %{REQUEST_FILENAME} !gallery2\.php
    RewriteRule .  -  [L]


    RewriteCond %{THE_REQUEST} \ /v/(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !gallery2\.php
    RewriteRule .  /gallery2.php?g2_view=core.ShowItem  [QSA,L]

    RewriteCond %{THE_REQUEST} \ /d/([0-9]+)-([0-9]+)/([^\/]+)(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !gallery2\.php
    RewriteRule .  /./gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2  [QSA,L]

    RewriteCond %{THE_REQUEST} \ /v/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !gallery2\.php
    RewriteRule .  /gallery2.php?g2_view=core.ShowItem&g2_path=%1  [QSA,L]

</IfModule>

# END Url Rewrite section


ZED28 12-30-2005 12:30 AM

Hey Whodah! Refresh my memory - it's been a while but enabling re-write in VB screws up the VB links right? Was the solution to hardcode them all?

whodah 12-30-2005 12:43 AM

ya :( at least in 3.0.x...

i had to hardcode my navbar links, logo, and i think some footer links...

GuaRRand 12-30-2005 06:04 AM

1 Attachment(s)
Workx great on my VB3.5 site.
http://www.glcoti.com/gallery2.php


ONly things that still bug me are the way the gallery is "shown" in the "who is online" page.

And that you dont get a nice "gallery" button in your postbit.
If anyone knows how to get that in, let me know!!!

AquilaEagle 12-30-2005 05:14 PM

Can this be made into a Plugin? :)

seanw088 01-04-2006 02:19 AM

Hey guys, I understand that with the salt stuff going on, a VB registered user won't be able to login directly to the gallery. That's cool with me, in fact I'd prefer that.

However, before I go through all the work of setting this up (and buying another license for this new site), I have a question. I already have over 100 registered users and I just launched my G2 site last week (woohoo!). I really, really don't want to have to ask them to all re-register in vB, then upload their content again. Is there ANY way at all to migrate users from G2, into vB, then require that logins come thru vB?

I'll jump through any hoops I have to if I can keep my users from having to jump through hoops. :)

Thanks in advance, and here's to hopin!
-Sean

seanw088 01-05-2006 01:12 PM

Anyone? Bueller? You guys still on holiday vacations? hehe... :) Should I ask this question in another forum as well?

ZED28 01-08-2006 02:10 PM

I have this working with VB 3.5.2 and the latest stable release of Gallery. The one thing I've noticed is the performance hit when I enable the re-write module. With it enabled, I get a not-so-smooth transitions between gallery pages - meaning a white page flashes up between them while in none re-write mode, I don't and it looks way smoother.

I also get errors reported by the browser when running the re-write module, I don't if I disable it. The errors are shown below.

Anyone else experiencing this?

http://www.lfsresource.com/stuff/errors.jpg

fringehead 01-09-2006 09:33 PM

One problem I have with this integration is the following:

When the user is inside a photo folder and clicks on login, they
will get the login relative to their position and then get an error.
What would I have to hardcode to get them directed to the proper
vbulletin login? I also have a few footer links like admin which are
needing to be hardcoded as well.. What template do I edit for them?

Thanks!!

Sean

matttpf 01-11-2006 04:31 PM

Quote:

Originally Posted by AquilaEagle
Can this be made into a Plugin? :)

i second this motion, i have a lot of members galleries but im not anywhere near technical enough to do this, so a plugin would be fantastic!

whodah 01-11-2006 05:13 PM

Quote:

Originally Posted by fringehead
One problem I have with this integration is the following:

When the user is inside a photo folder and clicks on login, they
will get the login relative to their position and then get an error.
What would I have to hardcode to get them directed to the proper
vbulletin login? I also have a few footer links like admin which are
needing to be hardcoded as well.. What template do I edit for them?

Thanks!!

Sean

heya! see post #41 in this thread. i also edited the first post w/ a note to see post #41 also just now for future visitors! :)

Quote:

Originally Posted by seanw088
Hey guys, I understand that with the salt stuff going on, a VB registered user won't be able to login directly to the gallery. That's cool with me, in fact I'd prefer that.

However, before I go through all the work of setting this up (and buying another license for this new site), I have a question. I already have over 100 registered users and I just launched my G2 site last week (woohoo!). I really, really don't want to have to ask them to all re-register in vB, then upload their content again. Is there ANY way at all to migrate users from G2, into vB, then require that logins come thru vB?

I'll jump through any hoops I have to if I can keep my users from having to jump through hoops. :)

Thanks in advance, and here's to hopin!
-Sean

heya! not sure... :( i don't know enough about vB's salt (or salt in general - unless it's the salt on my saltwater aquarium site, ha!). but perhaps someone else can chime in?

edited the first post w/ a bit more info at the very end for new readers! if you guys think anything else should be up in there, lmk!

i do plan on migrating to 3.5.x soon... it was gonna be the 1st of this year but didn't happen, heh!

if nobody has converted this to a plugin by then, i'll probably look into it.

SilVert 01-11-2006 07:21 PM

Quote:

Originally Posted by whodah
if nobody has converted this to a plugin by then, i'll probably look into it.


whish i could wait for that :(

my unknowledgeable ass is going to attempt this gallery integration soon(probobly this week). going to take a while as this is only my 2nd or 3rd attempt at anythign related to VBB other than the stuff built in(databases scare me ;))

but, wanted to thank you guys ahead of time for all the work youv done so far :) hopefully it will make my have less work to do :)

ZED28 01-14-2006 03:24 AM

Quote:

Originally Posted by SilVert
whish i could wait for that :(

my unknowledgeable ass is going to attempt this gallery integration soon(probobly this week). going to take a while as this is only my 2nd or 3rd attempt at anythign related to VBB other than the stuff built in(databases scare me ;))

but, wanted to thank you guys ahead of time for all the work youv done so far :) hopefully it will make my have less work to do :)

No worries SilVert, it's a pretty painless experience! :D In fact, your Gallery2 and VB installs will still remain quiet sepetate entities after the integration. It's the special gallery2.php page that does all of the work.

The only issues I have are with the mod_rewrite functionality as it slows the Gallery down considerably and has a few strange behaviour tendancies that I am fighting to overcome. But the mod_rewrite is just fluff really, the rest is pretty simple and straightforward.

voleibolmurcia 01-17-2006 02:13 PM

The integration of the Menalto´s G2 includes the style or theme?

If the answers is not, how could i make it? Thanks.

dodgechargerfan 01-17-2006 05:47 PM

Could this work across hosts?

I have my main vB site on one host and my Gallery running on another.
Would it work with the right changes to the paths?

SilVert 01-19-2006 06:28 PM

well.. i haev made it this far ;)

i have gallery installed(damn nice installer IMO :)). i can log into gallery in "stand alone" mode.

but when i goto the gallery.php file i get an error:
"Fatal error: Call to undefined function: iserror() in <location of files>/httpdocs/forum/gallery.php on line 74"

i just cant grasp where iserror() shoudl have been defined or anything... anybody got anythign on this?

my gallery is located at racersden.net/gallery, and the forum is at racersden.net/forum... the php file is in the forum directory...

SilVert 01-23-2006 07:17 PM

just thought about this... is it REQUIRED to have the gallery in a sub folder of the forum directory?

and also, the index file in the gallery directory, could i just have that file have a meta refresh to the VBB embed page or is that index file required?

manuka 02-25-2006 02:56 AM

Quote:

Originally Posted by SilVert
just thought about this... is it REQUIRED to have the gallery in a sub folder of the forum directory?

and also, the index file in the gallery directory, could i just have that file have a meta refresh to the VBB embed page or is that index file required?

no it's not - i've been working on this issue with some positive results so far. it needs a bit of fine-tuning but if you use the following code and change the file names/paths where necessary you can have a top-level embedded gallery:

Code:

<?php

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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'photos'); // 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(
    'galley2',
);

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

);

// ######################### REQUIRE BACK-END ############################
chdir("./forum/"); 
require_once('./global.php');

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

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

$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'] : 'MAYHEM PHOTOS';

function runGallery() {
    global $bbuserinfo;
                chdir("../photos/");
                require_once('embed.php');
   
                $data = array();
       
    // if anonymous user, set g2 activeUser to null
                $uid = $bbuserinfo['userid'] = 0 ? '' : $bbuserinfo['userid'];
 
                // initiate G2
                // you need to edit the following 4 lines to suite your VB3/G2 install!!!
                // this is setup for a install that looks like:
                //    public_html/VB/<vb files>
                //    public_html/gallery2/<gallery2 files>
                // and also setup for a VB3 tempalte 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... i.e. if you've changed it
                // to forums.php or something of the like.
                $ret = GalleryEmbed::init(array('embedUri' => 'photos.php',
                                    'embedPath' => '/',
                                                'relativeG2Path' => 'photos/',
                                    'loginRedirect' => 'index.php',
                                    'activeUserId' => $uid));
                                               
    if ($ret->isError())
        {
          if ($ret->getErrorCode() & ERROR_MISSING_OBJECT)
          {
            // check if there's no G2 user mapped to the activeUserId
            $ret = GalleryEmbed::isExternalIdMapped($uid, 'GalleryUser');
            if ($ret->isError() && ($ret->getErrorCode() & ERROR_MISSING_OBJECT))
            {
                // user not mapped, map create G2 user now
                // Get Arguments for the new user:
                $args['fullname']    =  $bbuserinfo['username'];
                $args['username']    = $bbuserinfo['username'];
                $args['hashedpassword'] =  $bbuserinfo['password'];
                $args['hashmethod'] =    'md5';
                $args['email']      =  $bbuserinfo['email'];
                $args['language']  =  $bbuserinfo['lang_code'];
                $args['creationtimestamp']  =  $bbuserinfo['joindate'];
                 
                $retcreate = GalleryEmbed :: createUser($uid, $args);
                if (!$retcreate->isSuccess())
                {
                    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->isError()) {
                    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') . '");');

?>

see if that works for you

cerndeosil 02-25-2006 06:24 PM

All this stuff is way too techie for me. I have one of my admins who does all the really techie stuff for me on my forum. But unfortunately we haven't been able to find a way for him to get access to this site.

We're running 3.5.3 and have been looking into setting up the Menalto Gallery on our forum The Moot and all these code posts have my head spinning. Have any of the posts in this thread been found to work with 3.5.3? If so, could someone post a link to the relevant post so I can pass on the details to my admin friend?

Thanks folks. :)

Mike

manuka 02-28-2006 07:25 AM

I only seem to get that error when the vBulletin admin views the gallery2 pages. Can anyone suggest a workaround so that the vBulletin admin can also view the gallery2 pages and not have to login via the 'backend'?

Any help would be much appreciated!

Quote:

Originally Posted by Oloh
I am getting this error:

Code:

line: 96, 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 166 (gallerystatus::error)
in modules/core/classes/GalleryEmbed.class at line 300 (galleryuser::create)
in /usr/www/users/oloh/silkyvenom/forums/vgfaces.php at line 93 (galleryembed::createuser)
in /usr/www/users/oloh/silkyvenom/forums/vgfaces.php at line 47

My vgfaces.php is:

Code:

<?php

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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'vgfaces'); // 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(
    'cmpspages_vgfaces',
);

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

);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

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

$navbits = array();
$navbits[$parent] = 'vgFaces';

$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 $bbuserinfo;
                require_once('../vgfaces/embed.php');
   
                $data = array();
       
    // if anonymous user, set g2 activeUser to null
                $uid = $bbuserinfo['userid'] = 0 ? '' : $bbuserinfo['userid'];
 
                // initiate G2
                // you need to edit the following 4 lines to suite your VB3/G2 install!!!
                // this is setup for a install that looks like:
                //    public_html/VB/<vb files>
                //    public_html/gallery2/<gallery2 files>
                // and also setup for a VB3 tempalte 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... i.e. if you've changed it
                // to forums.php or something of the like.
                $ret = GalleryEmbed::init(array('embedUri' => 'vgfaces.php',
                                    'embedPath' => '/forums',
                                                'relativeG2Path' => '../vgfaces',
                                    'loginRedirect' => 'index.php',
                                    'activeUserId' => $uid));
                                               
    if ($ret->isError())
        {
          if ($ret->getErrorCode() & ERROR_MISSING_OBJECT)
          {
            // check if there's no G2 user mapped to the activeUserId
            $ret = GalleryEmbed::isExternalIdMapped($uid, 'GalleryUser');
            if ($ret->isError() && ($ret->getErrorCode() & ERROR_MISSING_OBJECT))
            {
                // user not mapped, map create G2 user now
                // Get Arguments for the new user:
                $args['fullname']    =  $bbuserinfo['username'];
                $args['username']    = $bbuserinfo['username'];
                $args['hashedpassword'] =  $bbuserinfo['password'];
                $args['hashmethod'] =    'md5';
                $args['email']      =  $bbuserinfo['email'];
                $args['language']  =  $bbuserinfo['lang_code'];
                $args['creationtimestamp']  =  $bbuserinfo['joindate'];
                 
                $retcreate = GalleryEmbed :: createUser($uid, $args);
                if (!$retcreate->isSuccess())
                {
                    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->isError()) {
                    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('cmpspages_vgfaces') . '");');

?>


Anyone able to help? Note, I have Gallery 2 running under a different MySQL database than vbulletin...is that a problem?

Seems like there is not much support for this mod anymore - shame really because there are a lot of requests on the Gallery forums for support or advice. If anyone can provide an answer to my question above, I will be eternally grateful. Alternatively, if I find an answer I will post it here.

SilVert 03-01-2006 09:18 PM

ok guys, iv done so much mucking around i truly have no idea what i really did, lol. i think that i finally found where to put the correct file path, lol. ugh, well, now i just need to verify that it is working 100%, but at this point the integration LOOKs to have worked :)

here is the integration file for my site:
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(
    'gallery',
);

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

);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

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

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

$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('../gallery/embed.php');
   
                $data = array();
       
    // if anonymous user, set g2 activeUser to null
                $uid = $vbulletin->userinfo['userid'] = 0 ? '' : $vbulletin->userinfo['userid'];
 
                // initiate G2
                // you need to edit the following 4 lines to suite your VB3/G2 install!!!
                // this is setup for a install that looks like:
                //    public_html/VB/<vb files>
                //    public_html/gallery2/<gallery2 files>
                // and also setup for a VB3 tempalte 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... i.e. if you've changed it
                // to forums.php or something of the like.
                $ret = GalleryEmbed::init(array('embedUri' => 'gallery.php',
                                    'embedPath' => '/forum',
                                                'relativeG2Path' => '../gallery',
                                    'loginRedirect' => 'index.php',
                                    'activeUserId' => $uid));                       
    if ($ret->isError())
        {
          if ($ret->getErrorCode() & ERROR_MISSING_OBJECT)
          {
            // check if there's no G2 user mapped to the activeUserId
            $ret = GalleryEmbed::isExternalIdMapped($uid, 'GalleryUser');
            if ($ret->isError() && ($ret->getErrorCode() & ERROR_MISSING_OBJECT))
            {
                // user not mapped, map 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->isSuccess())
                {
                    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->isError()) {
                    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('gallery') . '");');

?>

Quote:

Originally Posted by manuka
I only seem to get that error when the vBulletin admin views the gallery2 pages. Can anyone suggest a workaround so that the vBulletin admin can also view the gallery2 pages and not have to login via the 'backend'?

Any help would be much appreciated!



Seems like there is not much support for this mod anymore - shame really because there are a lot of requests on the Gallery forums for support or advice. If anyone can provide an answer to my question above, I will be eternally grateful. Alternatively, if I find an answer I will post it here.

are you talking about going directly to the gallery page and having to type the SALT password or whatever it is?

me being no coder, you would have to somehow interpret the code through a program(or more php code possibly) that would pull out the offending code at the front and back of the PW, before the encryption(if any) of the password :)




and hell, while im post whoring up this thread ;)

how hard would it be to limit who can upload by a group in VBB... i know the group numbers that i would like to allow to upload, but i dont have the coding knowledge to limit so only they can upload but everybody else can view. also, would it be possible to automatically add them to the "registered" or whatever group in Gallery. or are these steps that i will have to do?

manuka 03-03-2006 05:25 AM

Quote:

Originally Posted by SilVert
are you talking about going directly to the gallery page and having to type the SALT password or whatever it is?

me being no coder, you would have to somehow interpret the code through a program(or more php code possibly) that would pull out the offending code at the front and back of the PW, before the encryption(if any) of the password :)




and hell, while im post whoring up this thread ;)

how hard would it be to limit who can upload by a group in VBB... i know the group numbers that i would like to allow to upload, but i dont have the coding knowledge to limit so only they can upload but everybody else can view. also, would it be possible to automatically add them to the "registered" or whatever group in Gallery. or are these steps that i will have to do?

I achieved what you are talking about by creating a group of users from within the gallery2 admin CP and then assigning them full access. It's a bit of duplication - but it works and is uncomplicated.

And.... I have a site set up that views the photos from outside the 'http://www.mysite.com/photos/' directory. So the 'backend' I refer to is the gallery2 admin cp access from within the 'http://www.mysite.com/photos/' directory. It helps keep other forum users out of that area because they *probably* won't think to look there. And I found I was using too many folders, so this helped reduce the number of sub-directories on the site.

SilVert 03-03-2006 04:04 PM

Quote:

Originally Posted by manuka
I achieved what you are talking about by creating a group of users from within the gallery2 admin CP and then assigning them full access. It's a bit of duplication - but it works and is uncomplicated.

And.... I have a site set up that views the photos from outside the 'http://www.mysite.com/photos/' directory. So the 'backend' I refer to is the gallery2 admin cp access from within the 'http://www.mysite.com/photos/' directory. It helps keep other forum users out of that area because they *probably* won't think to look there. And I found I was using too many folders, so this helped reduce the number of sub-directories on the site.

Im talkign abotu an automated add to group, or verify that a user is a member. i could see it being fairly simple to code.

user created > verify membership of group XX
if yes, add to full access group
if no(or else) add to everyone group(not allowed to upload photos)

or that is how i see it working ;)

i dont understand what you are refering to in your 2nd paragraph :) (could be the night of drinking last night catching up ;))

Burley 03-09-2006 08:32 AM

I was wondering how far along you are in implementing G2 into vb 3.5.X

I'm really interested in having it installed aswell!

defcon_420 03-10-2006 07:46 AM

Quote:

Originally Posted by Burley
I was wondering how far along you are in implementing G2 into vb 3.5.X

I'm really interested in having it installed aswell!

indeed, i was just about to upgrade to the new vbulletin and then i seen its not imbedded yet :(

lookin forward to G2 being intergrated into vb3 :banana:

SilVert 03-10-2006 08:27 PM

Burley, defcon_420, look at post 101...

that code works on MY VB 3.5.2 install. i am working on getting the code to add a user to a group right now.. i just cant get it to work yet. im stealing the code from AdminGroupEdit.inc. its in there, but i cant get it to work yet in teh gallery integration script.

if anybody has some insight or anything to help me along i would be gratefull. the guys who made this thread and supported it for the 1st few pages are still not on VB 3.5 i belive. i sent them both PM's a month or so ago and there are only a few people on VB 3.5.x and have it working.

but as i said, post 101 has the code to get the users created. i have tested it with 2 of my moderators right now, but i do not want to make it public UNTIL i get the automated group adidtions... i just dont have that code working yet :) i check this thread every other day or so, if you need some help il do what i can for ya(not much sadly) :)

Zilvia 03-12-2006 08:31 PM

Quote:

Originally Posted by defcon_420
indeed, i was just about to upgrade to the new vbulletin and then i seen its not imbedded yet :(

lookin forward to G2 being intergrated into vb3 :banana:

As well here. We are having issues with Coopermine integrating into vb 3.5.x and want to use G2.

Burley 03-13-2006 01:33 PM

So it looks like you have done it! CoOl!

I would like to help you out, but have no idea where to start!
I'm a complete noob when it comes to coding, but I need it so I'm gonna try.

I think I'll start integrating G2 in a day or 2, I'll keep you posted!

SilVert 03-13-2006 04:44 PM

Quote:

Originally Posted by Burley
So it looks like you have done it! CoOl!

I would like to help you out, but have no idea where to start!
I'm a complete noob when it comes to coding, but I need it so I'm gonna try.

I think I'll start integrating G2 in a day or 2, I'll keep you posted!

its really easy. the install takes 10-15 if it is the 1st time you have ever done it(20 times later you willl only need 3 minutes ;)).

i could really use the help with aut adding to a group.

i think this is the right code:
Code:

GalleryEmbed::addUserToGroup( )
might be nice to get a check as well to see if x user is in x group as well, but 1 step at a time ;)

I cant seem to get any auto adding to work with it. i either get a error(which dosent help at all) or the page displays fine, then i haev no user created(it does work without this code) and definetly not in the group....

johnmont 03-20-2006 04:14 PM

I got the integration working (somewhat) OK with 3.5.4 and gallery 2.0.4. But I took the plunge and installed 2.1RC and got the following error message from php:

Fatal error: Call to undefined function: iserror() in ~/forums/gallery.php on line 77

Where is the function isError() and is it gone from 2.1 as opposed to 2.0.4?
I did a multi file text search and can't find a function isError() in any of the files. Any suggestions would be appreciated.

(i've also posted over at the gallery2 website)

SilVert 03-20-2006 04:36 PM

Quote:

Originally Posted by johnmont
I got the integration working (somewhat) OK with 3.5.4 and gallery 2.0.4. But I took the plunge and installed 2.1RC and got the following error message from php:

Fatal error: Call to undefined function: iserror() in ~/forums/gallery.php on line 77

Where is the function isError() and is it gone from 2.1 as opposed to 2.0.4?
I did a multi file text search and can't find a function isError() in any of the files. Any suggestions would be appreciated.

(i've also posted over at the gallery2 website)

i had the same problem... i had to remove the CVS version i was using and reinstall the latest stable build. 2.1 i think is the latest.

took me a month or so to figure this out finally.

SilVert 03-21-2006 07:59 PM

nevermind... jsut saw your post and ?Variable? fixed the issue. man, whish i did that a month or so ago ;)

now, sombody get that stupid auto group adition to work! ;)

fringehead 03-26-2006 09:55 PM

So you have upgraded and are running 2.1? It's working without any issues?
I am going to give it a try. Definitely backing up the codebase, database and config file in case I need to revert to the old version.

I'll let you know how it goes!

Sean

Brent H 03-27-2006 04:55 AM

Anyone have Gallery 2.1 working with 3.5.4?

Here is my config file with a couple changes as outlined in the integration notes on the Gallery site:
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 G2'

$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(
'./gallery2/embed.php');
    
        
$data = array();
    
    
// if anonymous user, set g2 activeUser to null
        
$uid $vbulletin->userinfo['userid'] = '' $vbulletin->userinfo['userid']; 
 
        
// initiate G2 
        // you need to edit the following 4 lines to suite your VB3/G2 install!!!
        // this is setup for a install that looks like:
        //     public_html/VB/<vb files>
        //     public_html/gallery2/<gallery2 files>
        // and also setup for a VB3 tempalte 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... i.e. 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->isError()) 
        { 
           if (
$ret->getErrorCode() & ERROR_MISSING_OBJECT
           { 
             
// check if there's no G2 user mapped to the activeUserId 
             
$ret GalleryEmbed::isExternalIdMapped($uid'GalleryUser'); 
             if (
$ret->isError() && ($ret->getErrorCode() & ERROR_MISSING_OBJECT)) 
             { 
                 
// user not mapped, map 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->isSuccess()) 
                 { 
                    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->isError()) { 
                    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 keep getting this error:
Fatal error: Call to undefined function: iserror() in /home/paranorm/public_html/gallery2.php on line 74

Not sure what to do....

SilVert 03-27-2006 08:05 PM

Quote:

Originally Posted by Brent H
Anyone have Gallery 2.1 working with 3.5.4?

Here is my config file with a couple changes as outlined in the integration notes on the Gallery site:
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 G2'

$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(
'./gallery2/embed.php');
    
        
$data = array();
    
    
// if anonymous user, set g2 activeUser to null
        
$uid $vbulletin->userinfo['userid'] = '' $vbulletin->userinfo['userid']; 
 
        
// initiate G2 
        // you need to edit the following 4 lines to suite your VB3/G2 install!!!
        // this is setup for a install that looks like:
        //     public_html/VB/<vb files>
        //     public_html/gallery2/<gallery2 files>
        // and also setup for a VB3 tempalte 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... i.e. 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->isError()) 
        { 
           if (
$ret->getErrorCode() & ERROR_MISSING_OBJECT
           { 
             
// check if there's no G2 user mapped to the activeUserId 
             
$ret GalleryEmbed::isExternalIdMapped($uid'GalleryUser'); 
             if (
$ret->isError() && ($ret->getErrorCode() & ERROR_MISSING_OBJECT)) 
             { 
                 
// user not mapped, map 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->isSuccess()) 
                 { 
                    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->isError()) { 
                    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 keep getting this error:
Fatal error: Call to undefined function: iserror() in /home/paranorm/public_html/gallery2.php on line 74

Not sure what to do....

looks like you are having the same problem as me.... i think the IsError() is a invalid path somewhere... i have yet to find it...

Brent H 03-28-2006 05:27 AM

With some help from a member over on Menalto's site, I've got Gallery 2.1 and vBulletin 3.5.4 working together.

The only problem I've come across is when the user first accesses the gallery (causing the gallery to create the new user) I get this error:

Code:

Fatal error: Call to a member function on a non-object in /home/paranorm/public_html/gallery2.php on line 96
If they refresh the page, the problem disappears and everything works perfectly.

Here is my gallery2.php file, updated to work with Gallery 2.1 and vBulletin 3.5.4.

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('./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(
'/home/paranorm/public_html/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' => 'http://www.paranormalis.com/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->isSuccess())
{
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->isError()) {
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', true);

// 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') . '");');

?>

Maybe someone here can shed some light on this error and help me get it working 100%...

SilVert 03-28-2006 06:57 PM

if you go into notepad, and hit ctrl-G then tell it to goto line 96.. what is on that line...

Brent H 03-28-2006 09:47 PM

PHP Code:

if ($ret->isError()) 

That's what's there, along with a bunch of other stuff associated with that line below it.

SilVert 03-29-2006 07:08 PM

Quote:

Originally Posted by Brent H
PHP Code:

if ($ret->isError()) 

That's what's there, along with a bunch of other stuff associated with that line below it.

ugh.. i hate that isError() BS... that is the exact error i am having... probobly was on the same line...

i alreayd have a user created(my username) from previous attempts and since i dotn haev to create that account again, the integration script runs fine... so the script is working other than that part. the isError() part is what i have been having issues with from day ?1?...

there is a post that ?joshmount? made over on teh G2 integration section, he did nto respond to me asking for more info as of yesterday afternoon. i wish i could find where this problem was comming from... such a PITA.. and since VBB is closed source, Valiant or anybody over on the G2 forums wont help too much, but they will help with the G2 related issues :) helpfull normaly to :)

alright, i MIGHT have fixed the isError() BS...

try going into your gallery admin panel. goto the mod rewrite/URL rewrite.. scroll to the bottom and uncheck the "Show Item", and "Download Item". after you hit save you will probobly get somethign saying that your integration file does not exist... that is fine... if you hit back and refresh teh page the settings will have taken(mod rewrite does nto work yet).

then attempt to display the page again. after you login make your user an admin, then i got another browser(i use firefix as my default, so IE is my test browser) and login as a bogus user... that is the best way to test IMO :)

let me knwo how it goes :)

johnmont 03-30-2006 03:42 AM

Figured it out guys. The error caused by: if ($ret->isError()) is caused -- among other things -- that if things go correctly when doing the embed, nothing is returned by the $ret= statements. So what you need to do is:

Change:
Code:

$retcreate = GalleryEmbed :: createUser($uid, $args);
if (!$retcreate->isSuccess())

To:
Code:

$retcreate = GalleryEmbed :: createUser($uid, $args);
if ($retcreate)


First, I believe that $retcreate->isSuccess() is no longer used. In the new paradigm of this version, if you do something and its successful, you get nothing returned back to $ret. Only when there is an error, then you get something back in $ret.

So my replacement says, "if you get something back"...which is essentially what the previous statment said: "if what you get back is not successful"


Change:
Code:

$ret = GalleryEmbed::checkActiveUser($uid);
if ($ret->isError()) {

To:
Code:

$ret = GalleryEmbed::checkActiveUser($uid);
if ($ret) {

Basically the same dealio. In the original, you were saying "if what is returned is an error then....". Now, this says "if you get anything back the...". And since you only get something back when there is an error, then its doing the same thing.


All times are GMT. The time now is 10:03 AM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03210 seconds
  • Memory Usage 2,220KB
  • 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
  • (11)bbcode_code_printable
  • (5)bbcode_php_printable
  • (16)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