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)

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)


All times are GMT. The time now is 12:38 AM.

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.02771 seconds
  • Memory Usage 1,802KB
  • 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
  • (2)bbcode_code_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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