How to setup Gallery2 (2.3) embeded in PHPGedview

slimmehenkie

Joined: 2007-01-03
Posts: 26
Posted: Thu, 2009-01-01 09:59

Hi,

To run gallery2 in the PHPGedview (Genealogy program), you might need to modify some files in order to
have the gallery working. What I did is described below:

Note: You need to watch the url in your browser to see where your system is finding the module.php
Example: If you select gallery from PHPGedview than your webbrouwser might indicate something like :
'http://www.yourdomain.com/module.php?mod=gallery2'
In that case the modification on PGV.php as described below is not required.

Your browser is showing :
'http://www.yourdomain.com/subfolder/module.php?mod=gallery2'
In that case you need (for now) change the PGV.php file to have the correct link to your site.

Modify PGV.PHP (search for $url):

function mod_gallery2_load($uid)
{
global $SERVER_URL, $language_settings, $LANGUAGE, $modinfo, $pgv_lang;

$user_id=get_user_id($uid); // $uid is the gallery2 user-name, $user_id is the PGV user-id

// Rebuild the url, just to be sure we have a clean one
$bits = parse_url($SERVER_URL);
if(isset($bits['query'])){$bits['query'] = "&{$bits['query']}";}else{$bits['query'] = '';}
if(isset($bits['fragment'])){$bits['fragment'] = "#{$bits['fragment']}";}else{$bits['fragment'] = '';}
$url = "{$bits['scheme']}://{$bits['host']}/subfolder/module.php?mod=gallery2{$bits['query']}{$bits['fragment']}";

Then look for (2 times) the 'g2Uri' => G2EmbedDiscoveryUtilities::normalizeG2Uri($modinfo['Gallery2']['path']),

To have gallery working and displaying the pictures, these lines should be commented out by to dashes
// 'g2Uri' => G2EmbedDiscoveryUtilities::normalizeG2Uri($modinfo['Gallery2']['path']),
and replace them with:

'g2Uri' => "/subfolder/modules/gallery2/",

In order to see the right pictures and templates, I need to define the BaseUri in CONFIG.PHP to :

$gallery->setConfig('galleryBaseUrl', '');
$gallery->setConfig('baseUri', '');

End of mods.

Regards,

Rick.

Login or register to post comments
eisenadler

Joined: 2009-02-13
Posts: 2
Posted: Fri, 2009-02-13 14:58

I followed the instructions, but get a security violation error when trying to access the gallery. When I hover over the gallery link in PGV, the URL looks like: http://mydomain/module.php?mod=gallery2. Therefore I didn't modify pgv.php and only made the changes you suggested to make in config.php. When I click the gallery link, the browser gets redirected to http://mydomain/main.php?mod=gallery2. Here is what the browser shows as well as the error log:

Security Violation

The action you attempted is not permitted.

Back to the Gallery
Error Detail +
Error (ERROR_BAD_PARAMETER) : Smarty error: The template 'themes/matrix/templates/theme.tpl' does not exist.

* in modules/core/classes/GallerySmarty.class at line 76 (GalleryCoreApi::error)
* in modules/core/classes/GalleryTemplate.class at line 442 (GallerySmarty::trigger_error)
* in ??? at line 0 (GalleryTemplate::resourceGetTemplate)
* in lib/smarty/Smarty.class.php at line 1559
* in lib/smarty/Smarty.class.php at line 1414 (Smarty::_fetch_resource_info)
* in lib/smarty/Smarty.class.php at line 1260 (Smarty::_compile_resource)
* in modules/core/classes/GallerySmarty.class at line 61 (Smarty::fetch)
* in modules/core/classes/GalleryTemplate.class at line 219 (GallerySmarty::fetch)
* in /DOCROOT/main.php at line 521 (GalleryTemplate::fetch)
* in /DOCROOT/main.php at line 104
* in /DOCROOT/main.php at line 88

realpath(/DOCROOT/modules/gallery2/modules/core/classes/../../../) realpath(/DOCROOT/modules/gallery2/) (mysqli): SET NAMES "utf8" (mysqli): update g2_SequenceEventLog set id=LAST_INSERT_ID(id+1); (mysqli): UPDATE g2_EventLogMap SET g_userId=5, g_type='Gallery Error', g_summary='Smarty error: The template \'themes/matrix/templates/theme.tpl\' does not exist.', g_details='Error (ERROR_BAD_PARAMETER) : Smarty error: The template \'themes/matrix/templates/theme.tpl\' does not exist. in modules/core/classes/GallerySmarty.class at line 76 (GalleryCoreApi::error) in modules/core/classes/GalleryTemplate.class at line 442 (GallerySmarty::trigger_error) in ??? at line 0 (GalleryTemplate::resourceGetTemplate) in lib/smarty/Smarty.class.php at line 1559 in lib/smarty/Smarty.class.php at line 1414 (Smarty::_fetch_resource_info) in lib/smarty/Smarty.class.php at line 1260 (Smarty::_compile_resource) in modules/core/classes/GallerySmarty.class at line 61 (Smarty::fetch) in modules/core/classes/GalleryTemplate.class at line 219 (GallerySmarty::fetch) in /DOCROOT/main.php at line 521 (GalleryTemplate::fetch) in /DOCROOT/main.php at line 104 in /DOCROOT/main.php at line 88 Request variables: Array ( [view] => core.ShowItem [itemId] => 7 ) ', g_location='http://mydomain/main.php?mod=gallery2', g_client='undisclosed_ip', g_timestamp=1234533096, g_referer=NULL WHERE g_id=26 (mysqli): INSERT INTO g2_EventLogMap (g_id, g_userId, g_type, g_summary, g_details, g_location, g_client, g_timestamp, g_referer) VALUES (26,5,'Gallery Error','Smarty error: The template \'themes/matrix/templates/theme.tpl\' does not exist.','Error (ERROR_BAD_PARAMETER) : Smarty error: The template \'themes/matrix/templates/theme.tpl\' does not exist. in modules/core/classes/GallerySmarty.class at line 76 (GalleryCoreApi::error) in modules/core/classes/GalleryTemplate.class at line 442 (GallerySmarty::trigger_error) in ??? at line 0 (GalleryTemplate::resourceGetTemplate) in lib/smarty/Smarty.class.php at line 1559 in lib/smarty/Smarty.class.php at line 1414 (Smarty::_fetch_resource_info) in lib/smarty/Smarty.class.php at line 1260 (Smarty::_compile_resource) in modules/core/classes/GallerySmarty.class at line 61 (Smarty::fetch) in modules/core/classes/GalleryTemplate.class at line 219 (GallerySmarty::fetch) in /DOCROOT/main.php at line 521 (GalleryTemplate::fetch) in /DOCROOT/main.php at line 104 in /DOCROOT/main.php at line 88 Request variables: Array ( [view] => core.ShowItem [itemId] => 7 ) ','http://mydomain/main.php?mod=gallery2','undisclosed_ip',1234533096,NULL) (mysqli): ROLLBACK

I'm using PGV 4.2 and gallery 2.3.
Thanks for the help.

Login or register to post comments
slimmehenkie

Joined: 2007-01-03
Posts: 26
Posted: Fri, 2009-02-13 19:44

Hi eisenadler,

It looks like a template is missing, part of the matrix theme. Could you verify that the file themes/matrix/templates/theme.tpl is located on your server?

Further more you could find on the following link more details on how to install gallery2 in phpgedview :
http://sourceforge.net/tracker/index.php?func=detail&aid=2485050&group_id=55456&atid=477081

Hope you can solve the problem.

Rick.

Login or register to post comments
eisenadler

Joined: 2009-02-13
Posts: 2
Posted: Mon, 2009-02-16 18:40

Rick,

Thanks for the link to the files on sourceforge. I got the problem fixed by following the latest readme file there and using the updated code for index.php. One other thing I had to do to get the online installer working was I had to create a symlink from my docroot to modules/gallery2/install. Once I did that, I was able to get it installed and working. Thanks for your help!

Sean

Login or register to post comments
slimmehenkie

Joined: 2007-01-03
Posts: 26
Posted: Mon, 2009-02-16 19:01

Dear Sean,

Thanks for your feedback. Glad that thinks worked out for you.

Regards,

Rick.

Login or register to post comments
teaguew

Joined: 2009-03-15
Posts: 6
Posted: Sun, 2009-03-15 18:40

Hi! I just installed G2 (2.3) to a phpGedView 4.1.5 site. I made the config.php changes but I saw the right URL so I didn't change pgv.php. When I am not logged in to phpGedView, I can click on the Gallery button and see G2 just fine. If I log in to phpGedView and click on Gallery, I get an http 500 error. Any suggestions?

Thanks!

Login or register to post comments
slimmehenkie

Joined: 2007-01-03
Posts: 26
Posted: Sun, 2009-03-15 21:01

Dear Teaguew,

Where this error comes from is unknown to me. It is a internal server error.
Did you also look at the link which is in the message of 3-1-09 ? It is a patch for using gallery in phpgedview.
The patch is based on the latest version of phpgedview but I think it should also work on 4.1.5 as I remember.
If you don't succeed, let me know so we could try to solve this.

Login or register to post comments
teaguew

Joined: 2009-03-15
Posts: 6
Posted: Sun, 2009-03-15 21:12

Slimmehenkie,

Thanks. Can you tell me the subject of the message? Also, I'm in the USm so I'm not sure whether 3-1-09 is March 1 or January 3.

Thanks!

Login or register to post comments
slimmehenkie

Joined: 2007-01-03
Posts: 26
Posted: Mon, 2009-03-16 05:18

Teaguew,

The message in this forum is at the 3th of January 2009 but here is the link again:
http://sourceforge.net/tracker/index.php?func=detail&aid=2485050&group_id=55456&atid=477081

Keep me posted on your progress.

Rick.

Login or register to post comments
teaguew

Joined: 2009-03-15
Posts: 6
Posted: Wed, 2009-03-18 01:32

Thanks! I checked the readme file. I'm mystified. My pgv.php file doesn't have the line

$url = "{$bits['scheme']}://{$bits['host']}/module.php?mod=gallery2{$bits['query']}{$bits['fragment']}";

anywhere in it, and the line

g2Uri' => G2EmbedDiscoveryUtilities::normalizeG2Uri($modinfo['Gallery2']['path']),

only appears once. I forgot I had already seen the readme file and made the change to the one instance of the "g2Uri' =>" that was there.

Login or register to post comments
slimmehenkie

Joined: 2007-01-03
Posts: 26
Posted: Wed, 2009-03-18 05:46

Hi Teaguew,

Thats in the new release. On 4.1.5 I used the following configuration:
part of PGV.PHP:

$ret = GalleryEmbed::init(array(
'embedUri' => "/phpgedview/index.php?mod=gallery2",
// 'embedUri' => "{$SERVER_URL}{$sep}index.php?mod=gallery2",
// 'g2Uri' => "/gallery2/",
'g2Uri' => "/phpgedview/modules/gallery2/",
// 'g2Uri' => G2EmbedDiscoveryUtilities::normalizeG2Uri($modinfo['Gallery2']['path']),

Note: the /phpgedview/index.php?mod=gallery2 needs to be determent appending on your configuration. If you installed phpgedview in the root of your website
then it would be /index.php?mod=gallery2 ( the same for the g2Uri)!

In config.php I configured the lines :

$gallery->setConfig('galleryBaseUrl', '');
$gallery->setConfig('baseUri', '');

The gallery2.php in the /modules folder contains:

<?php exit; ?>
[Module]
type = PGV_MOD_SIMPLE

[Gallery2]
; Path to your Gallery install, no trailing seperator please.
path = modules/gallery2

Hope this will get gallery2 on phpgedview 4.1.5 working for you.
Keep me posted.

Rick.

Login or register to post comments
teaguew

Joined: 2009-03-15
Posts: 6
Posted: Mon, 2009-03-23 02:26

slimmehenkie

I took another approach ... I upgraded my phpGedView and re-did the mods per the PGV wiki and your instructions. No more 500 error, but now I see this:

An error occurred during the on-the-fly user creation.
Error (ERROR_MISSING_OBJECT)
in modules/core/classes/helpers/GalleryUserHelper_medium.class at line 143 (GalleryCoreApi::error)
in modules/core/classes/GalleryCoreApi.class at line 606 (GalleryUserHelper_medium::fetchUserByUserName)
in pgv.php at line 108 (GalleryCoreApi::fetchUserByUserName)
in index.php at line 39
in index.php at line 34
in /home/heypopan/public_html/familytree/module.php at line 72

Login or register to post comments
slimmehenkie

Joined: 2007-01-03
Posts: 26
Posted: Mon, 2009-03-23 05:33

Hi Teaguew,

When you have this error :

An error occurred during the on-the-fly user creation.

Error (ERROR_MISSING_OBJECT)

You could change the method of encryption in PGV.PHP by:

'hashmethod'=>'crypt' -> 'hashmethod'=>'phpass'

This change should solve the problem.

Regards,
Rick.

Login or register to post comments
zeppfrog

Joined: 2009-11-03
Posts: 2
Posted: Sat, 2009-11-07 23:48

This thread should have started with "Did you download and install Gallery2 into your phpgedview modules folder? Did you overwrite the new Gallery2 index.php with the one that came with PhpGedView? If so, continue. (cause Gallery2 doesnt come with pgv.) Sure, seems like common sense, but its not. Common sense would have been a working link in PGV in the first place. With an option to enable/disable in a control panel.

Login or register to post comments