PHP Nuke + G2
drumicube
Joined: 2005-01-07
Posts: 32 |
![]() |
Concerning the Id, i have never found anything to get it without a SQL request, and this code is very standard (it comes from a very used user login block). If you know something better, i'm really interessed ! But, you're idea is very good, i thought the Id number was necessary, but lately i noticed username are also supported (anything in fact, right ?), this should work and i will get it without database request. Concerning the Hook, i haven't give it a try yet, but i think it's quite annoying. I haven't seen any block or module doing such things, i'm quite sure the only solution will be to edit the CMS itself during user registration/modification or removal, ouch... |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
@ExternalId: Yes, you can use the username instead of the uid. But I consider that a bad hack. Are you sure usernames are unique in phpnuke? externalId must be something unique and uid is certainly unique. I'd use uid, but try to find a way to get it without a db query. Ask another php nuke dev, there must be some global var or function that returns the bloody current user or uid. @hook: i'm quite sure phpnuke doesn't feature events and hooks. phpnuke is old and obsolete. sorry for that statement, but compared to the "new kids on the block", it's really obsolete. And if it has no event / hook system, it doesn't make sense to hack something like that together just for this module. |
|
drumicube
Joined: 2005-01-07
Posts: 32 |
![]() |
@InternalId: i have fixed this, and it was quite stupid ! @Admin Stuff, i have follow the advice from mindless, i'm now using fetchUsersForGroup to get the admin ID. I have now all i need to correctly map G2 admins to phpnuke: so i will focus myself on the multiple admins problem. Why not creating a tiny interface allowing the end user to map admins has he would like ? I have also added the update users function, no problem to report about it. I'm quite confident about the rest, except the hook of course... |
|
c4actbe
![]()
Joined: 2004-09-01
Posts: 83 |
![]() |
Hey, Fatal error: Cannot redeclare class bbcode in /home/c4actbe/portablemediaplayers.com/modules/gallery/lib/bbcode/bbcode.class on line 15: 15 i tried to temp. rename this class but it introduced even more probems any ideas how to resolve this? |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
oh, that's just great. I expected to have some conflicts with adodb, but bbcode? well then. we will have to examine the differences between bbcode in cpg and g2 and think about solutions. stay tuned. |
|
bharat
![]()
Joined: 2002-05-21
Posts: 7994 |
![]() |
We can rename the bbcode class to avoid this. We should do so -- this is going to be a conflict point for us. That's why I named all the core classes GalleryXxx so that we didn't have some random class named User that conflicted with a class of the same name in *Nuke Valiant, if you want to rename the bbcode class to something else (GalleryBbcode?) I'll happily review the change. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
maybe later, got exams these days... |
|
c4actbe
![]()
Joined: 2004-09-01
Posts: 83 |
![]() |
Did anyone bump into the problem that thumbs of top level albums are not loading under nuke? |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
1. do the thumbs show up correctly if G2 is not embedded? just browse to the standalone G2 url. 2. only thumbs of top level albums, everything else works? thumbs of subalbums work? |
|
c4actbe
![]()
Joined: 2004-09-01
Posts: 83 |
![]() |
1. Yes. Everything is OK in standalone. example of picture address on the top level [embedded and missing]: example of picture address on the top level [standalone]: example of picture address on the NON-top level [embedded and OK]: example of picture address on NON top level [standalone]: |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
index.php?name=gallery2gallery/main.php&g2_view=core:DownloadItem&g2_itemId=45&g2_serialNumber=4 is this now cpg-nuke? FYI: the bbcode issue will be resolved in a few days. |
|
c4actbe
![]()
Joined: 2004-09-01
Posts: 83 |
![]() |
yes, it is an OLD cpgnuke... bbcode problem was with new version. _______ Actual gallery is in nukeroot/gallery/ folder thanks! |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
c4actbe, the bbcode issue should now be gone. I fixed this after the beta release, so you have to get the most recent cvs version, perhaps tomorrows nightly snapshot. you can check lib/bbcode/bbcode.class, if the class name is BBCode, it's still the old version. if it's GalleryBbcode, it's fixed. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
drumicube, please check out http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&p=128419#128419 . |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
drumicube has updated his phpnuke integration. i don't know if this css things are fixed, but some user stuff has been improved, he says. take a look at the second Readme... |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
drumicube included the css fix from dmovali. the next nightly snapshot will have the improved phpnuke integration. drumicube, feel free to announce the changes yourself ;) |
|
drumicube
Joined: 2005-01-07
Posts: 32 |
![]() |
Thanks to dmolavin the CSS issue is now solved ! To access the G2 Admin panel, simply log yourself as the admin in phpnuke, it's the same process as in phpnuke: Admin login override Normal user login. Minors updates have also been added, i have cleaned and tested the module in most various situations to check for errors messages, it should be ok. But if you find something wrong please send us a feedback. TODO: The user integration is still static, and i'm actually working on account sync: The main entry point i have choosen is the following. G2 user will be added on the fly, if the mapping between G2 and phpnuke failed ! If you have a better suggestion, feel free to propose it ! |
|
drumicube
Joined: 2005-01-07
Posts: 32 |
![]() |
Ok good news, i have user creation on the fly and it works nicely ! Just after the G2 init in the main index.php of the module: $ret = GalleryEmbed::init(array( I insert this: // --------------------------------------------- // if g2 user don't exists create him on the fly // --------------------------------------------- if ($ret->isError() && ($ret->getErrorCode() & ERROR_MISSING_OBJECT)) { // full reinit of G2 as the first one failed (through a datastorage error if not done) $initret = GalleryEmbed :: init(array ('embedUri' => $g2embedparams[embedUri], 'relativeG2Path' => $g2embedparams[relativeG2Path], 'loginRedirect' => $g2embedparams[loginRedirect], 'activeUserId' => '', 'activeLanguage' => $g2currentlang, 'fullInit' => $fullInit)); if (!$initret->isSuccess()) { echo'G2 did not return a success status upon an init request. Here is the error message from G2: <br /> [#(1)]'.$initret->getAsHtml(); return false; } // Load all existing phpnuke <-> G2 mappings list ($listret, $mapsbyentityid, $mapsbyexternalid) = g2getallexternalIdmappings(); if (!$listret) { return false; } $query='SELECT user_id, name, username, user_password, user_email, user_lang, user_regdate FROM '.$user_prefix."_users WHERE `user_id`='".$uid."'"; $result=$db->sql_query($query); $sqluserdata = $db->sql_fetchrow($result); $nukeuser_regdate = $sqluserdata['user_regdate']; list( $regmonth, $regday, $regyear ) = split( " ", $nukeuser_regdate ); $regphpusertimestamp = mktime( 0, 0, 0, $regmonth, $regday, $regyear ); $nukeuser_lang = $sqluserdata['user_lang']; $nukeuser_uname = $sqluserdata['username']; // Get Arguments for the new user: $args['fullname'] = $sqluserdata['name']; $args['username'] = $nukeuser_uname; $args['hashedpassword'] = $sqluserdata['user_password']; $args['hashmethod'] = 'md5'; $args['email'] = $sqluserdata['user_email']; $args['language'] = $Phpnuke2G2Lang[$nukeuser_lang]; $args['creationtimestamp'] = $regphpusertimestamp; if (!isset ($mapsbyexternalid[$nukeuser_id])) { $retcreate = GalleryEmbed :: createUser($uid, $args); if (!$retcreate->isSuccess()) { g2_message('Failed to create G2 user with extId ['.$uid.']. Here is the error message from G2: <br />'.$retcreate->getAsHtml()); return false; } if (!g2addexternalMapEntry($nukeuser_uname, $uid, 0)) { return false; } // fully reload the main page, for the new user to take effect header("Location: modules.php?name=gallery2"); } } // ---------------------------- // End user creation on the fly // ---------------------------- It's just a sample and it's not finished yet (certainly tomorow), so excuse me in advance if everything is not correct (return in erorr case for instance...) Some questions which made me suspicious: Feel free to give your comments... Of course, it will not manage User update or removal ! :wink: |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
drumicube, yes that how i imagined it would be done. Quote:
echo'G2 did not return a success status upon an init request. Here is the error message from G2: <br /> [#(1)]'.$initret->getAsHtml(); the [#(1)] style is only valid for xaraya. in xaraya, #(1) gets replaced by an argument. phpnuke works differently. so just omit this [#(1)] thing. Quote:
g2getallexternalIdmappings 1. why do you do this? 2. why do you check "if (!isset ($mapsbyexternalid[$nukeuser_id]))" ? because you are not sure about the error_missing_object? @reinit: good as it is. but $fullInit does not have to be parametrizable there, you want a fullinit. - after the user creation, you want to call GalleryEmbed::done(); and then call GalleryEmbed::init() again, but this time with the $uid again and after this, call handlerequest. i don't understand your last two questions. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
New GalleryEmbed method: isExternalIdMapped($externalId, $entityType). Usage: $ret = GalleryEmbed::init(...activeUserId => $uid, ...); if ($ret->isError()) { if ($ret->getErrorCode() & ERROR_MISSING_OBJECT) { // check if the 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 $ret = GalleryEmbed::createUser(....); // check $ret error code $ret = GalleryEmbed::checkActiveUser($activeUserId); // check $ret error code } else { // a real problem, handle it, i.e. raise error or echo error message } } else { // a real problem, handle it, i.e. raise error or echo error message } } $g2data = GalleryEmbed::handleRequest(); forget the additional ::init and done() calls mentioned in the previous posts. |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
http://www.nukedgallery.net/postp8324.html#8324 has a method of breaking up the phpNuke user database into segments of 100 users to prevent php max execution time errors on large databases. it does *not* use the new embed method described above, as I didn't read this post until after I finished my code. |
|
drumicube
Joined: 2005-01-07
Posts: 32 |
![]() |
Don't care about it, i have updated your addon to take advantage of new embed method. |
|
drumicube
Joined: 2005-01-07
Posts: 32 |
![]() |
here is the new update: $ret = GalleryEmbed::init(array( 'embedUri' => $g2embedparams[embedUri], 'relativeG2Path' => $g2embedparams[relativeG2Path], 'loginRedirect' => $g2embedparams[loginRedirect], 'activeUserId' => "$uid", 'activeLanguage' =>$g2currentlang)); 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 $query='SELECT user_id, name, username, user_password, user_email, user_lang, user_regdate FROM '.$user_prefix."_users WHERE `user_id`='".$uid."'"; $result=$db->sql_query($query); $sqluserdata = $db->sql_fetchrow($result); $nukeuser_regdate = $sqluserdata['user_regdate']; list( $regmonth, $regday, $regyear ) = split( " ", $nukeuser_regdate ); $regphpusertimestamp = mktime( 0, 0, 0, $regmonth, $regday, $regyear ); $nukeuser_lang = $sqluserdata['user_lang']; $nukeuser_uname = $sqluserdata['username']; // Get Arguments for the new user: $args['fullname'] = $sqluserdata['name']; $args['username'] = $nukeuser_uname; $args['hashedpassword'] = $sqluserdata['user_password']; $args['hashmethod'] = 'md5'; $args['email'] = $sqluserdata['user_email']; $args['language'] = $Phpnuke2G2Lang[$nukeuser_lang]; $args['creationtimestamp'] = $regphpusertimestamp; $retcreate = GalleryEmbed :: createUser($uid, $args); if (!$retcreate->isSuccess()) { echo 'Failed to create G2 user with extId ['.$uid.']. Here is the error message from G2: <br />'.$retcreate->getAsHtml(); return false; } if (!g2addexternalMapEntry($nukeuser_uname, $uid, 0)) { return false; } // Full G2 reinit with the new created user $ret = GalleryEmbed :: init(array ('embedUri' => $g2embedparams[embedUri], 'relativeG2Path' => $g2embedparams[relativeG2Path], 'loginRedirect' => $g2embedparams[loginRedirect], 'activeUserId' => "$uid", 'activeLanguage' => $g2currentlang, 'fullInit' => 'true')); } else { echo 'G2 did not return a success status. Here is the error message from G2: <br />'.$ret->getAsHtml(); } } else { echo 'G2 did not return a success status. Here is the error message from G2: <br />'.$ret->getAsHtml(); } }
The good thing is: Thanks to you, now it works without the header location call. As usual Valiant, i send you the code right now for a CVS update. Cheers. |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
new problem, clean, fresh G2 install (0.9.9 core): The error message wrote:
Failed to create G2 user with extId [admin]. Here is the error message from G2: Note that the standalone is fine: |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
dmolavi, does php-nuke not have user ids (uid)? this would be the only reason why it is mapping users with the username... the line that stopped the process was i looked at the php-nuke mod code in index.php, it looks ok. drumicube, |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
no, the line that failed is this: $retcreate = GalleryEmbed :: createUser($uid, $args); if (!$retcreate->isSuccess()) { echo 'Failed to create G2 user with extId ['.$uid.']. Here is the error message from G2: <br />'.$retcreate->getAsHtml(); return false; } phpnuke's uid field is "user_id"...not "uid"...the problem is that when logged into phpnuke as admin, the uid gets set to "admin", which screws up this sql: $query='SELECT user_id, name, username, user_password, user_email, user_lang, user_regdate FROM '.$user_prefix."_users WHERE `user_id`='".$uid."'";
if i'm not logged into phpnuke as admin, it works just fine, which might explain why you can't see the error message actually, why is it calling the createuser method anyway? i'm not trying to create a new user, just view the album. does the embedding now create a user everytime someone just tries to view the gallery? |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
actually, the error occurs where is said, but that's another story. |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
got a fix. Replace with: Find: if (is_admin($admin)) { // we log as an admin $uid='admin'; } Replace with: if (is_admin($admin)) { $admin_array = base64_decode($admin); $admin_array = explode(":", $admin_array); $admin_user = $admin_array[0]; $query='SELECT user_id FROM '.$user_prefix."_users WHERE `username`='".$admin_user."'"; $result=$db->sql_query($query); $sqluserdata = $db->sql_fetchrow($result); $uid = $sqluserdata[0]; } |
|
tf5_bassist
Joined: 2004-08-14
Posts: 8 |
![]() |
Alright... So i made those changes in the index.php file in the modules folder... and this is what it gave me: Failed to create G2 user with extId [3]. Here is the error message from G2: * in modules/core/classes/GalleryUser.class at line 167 (gallerystatus::error) Sorry, such file doesn't exist... I'm completely confused on how to get this to work, been on it for two days now... and i can't even get to the G2 module admin page in PHPNuke.. all changes to gallery2.php i've been hand-editing. Speaking of which, here's what i have in that file: <? $g2embedparams = array ( 'embedphpfile' => '/home/down-pou/public_html/boredom/gallery2', 'embedUri' => 'http://boredom.down-pour.net/modules.php?name=gallery2', 'relativeG2Path' => '/home/down-pou/public_html/boredom/gallery2/', 'loginRedirect' => 'modules.php?name=Your_Account', 'activeUserId' => '0', ); $g2mainparams = array ( 'showSidebar' => 'false', ); $g2configurationdone = 'true'; ?> it looks right to me... Any suggestions? |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
- 'activeUserId' => '' for anonymous users, not '0'. 'embedUri' => 'http://boredom.down-pour.net/modules.php?name=gallery2', 'relativeG2Path' => '/home/down-pou/public_html/boredom/gallery2/', all wrong. perhaps the rest is wrong too, don't know. 'embedUri' => 'modules.php?name=gallery2', 'relativeG2Path' => 'gallery2/', but this won't change the error you have there. don't know why you get it. perhaps you should start from scratch, empty the database table g2_externalIdmap and try again. |
|
tf5_bassist
Joined: 2004-08-14
Posts: 8 |
![]() |
i could... although i went through and did this as SOON as i got it working in standalone... This install isn't even 24 hours old yet... would there be a problem if i'm only running PHPNuke 7.0? |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
tf5_bassist, who knows. probably the guys at www.nukedgallery.net know more. |
|
Brujo
Joined: 2002-10-26
Posts: 20 |
![]() |
Hi, i installed the latest CSV embeded G2 in phpnuke 7.6 for testing and i found a small issue. If i enter the Gallery, all german umlauts in the left Navigation Blocks of Nuke are changed in some other Characters (like G�stebuch and not as Gästebuch). If i leave the gallery the Umlauts are shown normal again. BTW in the G2 Menus the Umlauts are shown correctly only in Phpnuke not Brujo |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
make sure the <meta charset of phpnuke is utf-8 |
|
Grayhawlk
Joined: 2005-07-25
Posts: 2 |
![]() |
Trying to put G2 into PHP-Nuke 7.5 Warning: main(modules/gallery2/admin/language/lang-english.php): failed to open stream: No such file or directory in /home/moggle/public_html/admin/case/case.gallery2.php on line 23 Warning: main(): Failed opening 'modules/gallery2/admin/language/lang-english.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/moggle/public_html/admin/case/case.gallery2.php on line 23 Warning: main(modules/gallery2/modules/gallery2/admin/index.php): failed to open stream: No such file or directory in /home/moggle/public_html/admin/case/case.gallery2.php on line 33 Warning: main(modules/gallery2/modules/gallery2/admin/index.php): failed to open stream: No such file or directory in /home/moggle/public_html/admin/case/case.gallery2.php on line 33 Warning: main(): Failed opening 'modules/gallery2/modules/gallery2/admin/index.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/moggle/public_html/admin/case/case.gallery2.php on line 33 |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
yeah, you've got some old files there. you need to download the new integration package. |
|
skl
Joined: 2005-08-17
Posts: 7 |
![]() |
Hi boys! I'm integrated gallery 2 to nuke 7. Everything is fine, but,,, I need to change gallery's charset from utf-8 to iso-... becuase in nuke i'm using iso and many special characters looks funny when gallery module loaded. How can i change it??? (change nuke to utf-8 is certainly the worst answer!!! i tried already :D) After the integration the Hungarian language changed to English. I can select all languages on the site administration page, but in every cases everything still in English. i can't figure out the reason. Help me dudes! |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
when you say "everything still in English", are you referring to the G2 admin panel in phpnuke when it asks for your embedURI, etc? |
|
skl
Joined: 2005-08-17
Posts: 7 |
![]() |
no! the whole gallery page in english except 1 word "galéria" in hungarian |
|
mindless
![]()
Joined: 2004-01-04
Posts: 8601 |
![]() |
po files are not used at runtime.. you must compile them into mo files. run lib/tools/po/update-all-translations.pl or do gmake install in each po dir. |
|
skl
Joined: 2005-08-17
Posts: 7 |
![]() |
sounds good!! will report the results thnx |
|
mindless
![]()
Joined: 2004-01-04
Posts: 8601 |
![]() |
skl, oh, there's also a UTF-8 <meta> tag added in GalleryTemplateAdapter.class, function head(). (maybe not used in your embedded env, not sure.. check html source of page to see if meta tag for UTF-8 is in there) |
|
skl
Joined: 2005-08-17
Posts: 7 |
![]() |
i don't have this directory lib/tools/.... in my full package downloaded from here: |
|
skl
Joined: 2005-08-17
Posts: 7 |
![]() |
i found the tools in the developers pack alreary! but i don't know how to use... i made a little mod. in nuke to by-pass the charset prob. in my theme in theme.php i repleaced blocks(left); with if ( strstr ( $name , "gallery2" ) ) { /* no left blocks when gallery pages loads*/ } else { blocks(left); } + $name given to themeheader's globals in this case only the nukes header visible only beside gallery. Anyway, i changed the charset but the same prob. appeared in gallery as in nuke before. my big prob is still the language. i can select any languages, the gallery always shown in english only. I can't realise how is it possible, but if i delete all english "locale" directories, gallery still works in english as before i tried to print out the variables in index.php after this line: $g2currentlang = $phpnuke2G2Lang[$currentlang]; included : echo $g2currentlang; echo $currentlang;
if nuke in english the result was "en english" so, nuke give the information and gallery reveive it as well. what is the prob??? Could you help me? |
|
jjaomni
Joined: 2003-06-17
Posts: 11 |
![]() |
any news on mod_rewrite support? |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
the embedded rewrite module will make friendly urls for you |
|
SanderBroek
Joined: 2005-08-23
Posts: 11 |
![]() |
I got this message: Error (ERROR_PLATFORM_FAILURE) : in modules/core/classes/GalleryTemplate.class at line 260 (gallerystatus::error) in modules/core/classes/GalleryTemplate.class at line 200 (gallerytemplate::_initcompiledtemplatedir) in modules/core/classes/GalleryTheme.class at line 961 (gallerytemplate::fetch) in modules/core/classes/GalleryView.class at line 285 (matrixtheme::loadtemplate) in main.php at line 289 (showitemview::doloadtemplate) in main.php at line 90 in modules/core/classes/GalleryEmbed.class at line 155 in /home/httpd/vhosts/hockeybase.nl/httpdocs/modules/gallery2/index.php at line 137 (galleryembed::handlerequest) in /home/httpd/vhosts/hockeybase.nl/httpdocs/modules.php at line 55 I took these steps: - Installed G2 succesfully After accessing the module i got my website with above message. I'm using phpnuke 7.7. I don't have the foggiest idea what's going wrong. |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
http://www.nukedgallery.net/postt1843.html has your answer. |
|
SanderBroek
Joined: 2005-08-23
Posts: 11 |
![]() |
dmolavi wrote:
http://www.nukedgallery.net/postt1843.html has your answer. I read this thread before posting here. But it didn't solve the problem. Checked permissions again a few secs ago, but the complete g2data-folder is set to 777. |
|
ArcAiN6
Joined: 2005-09-02
Posts: 24 |
![]() |
Just wondering if there is a workaround yet for Impervious's particular situation... as phpnuke's claim to fame sort of is the fact that one can simply addon to it by adding thier content to the modules directory... redirects gone haywire??? i think gallery is trying to load main.php but trying to load it from / instead of /modules/gallery/ URI issue? |
|