Welcome to Geeklog, Anonymous Friday, March 29 2024 @ 11:44 am EDT

Geeklog Forums

Further integration with Gallery


bas

Anonymous
After having applied the hack published here by John Holmes (thanks a lot by the way), I had a problem with the user permissions in Gallery. When I was logged in as a admin of user Gallery wouldn't recognise me as a valid gallery user.

So after some digging around in both the Geeklog and Gallery code I came to this modification in the init.php (from line 144 onwards) in Gallery :

} else if (!strcmp($GALLERY_EMBEDDED_INSIDE, "geeklog")) {
include_once("/opt/geeklog/public_html/lib-common.php");
include_once("/opt/geeklog/system/lib-database.php");
include($GALLERY_BASEDIR . "classes/gallery/UserDB.php");
include($GALLERY_BASEDIR . "classes/gallery/User.php");

/* Load our user database (and user object) */
$gallery->userDB = new Gallery_UserDB;

if(!empty($_USER['uid'])) {
/* Load their user object with their username as the key */

$result = DB_query("SELECT username FROM WHERE uid = ''");
$U = DB_fetchArray($result);

$gallery->user = $gallery->userDB->getUserByUsername(strtolower($U['username']));
}
} else {

Note: replace /opt/geeklog with the path to your geeklog installation.
Note: this replaces the inclusion of lib-common.php in init.php in John's hack.
Note: Users in Gallery are CASE-SENSITIVE, so I made the mapping to user lower case. You need to define the users in Gallery as lower-case for this hack to work.
Nore : This hack has only been tested on Geeklog 1.3.1 and Gallery 1.2.5

This code provides a mapping with the users of geeklog and the users defined in Gallery. It's not the most elegant solution since it requires two places for user-administration, but it does the job.

The nicest solution would be to create a new User and UserDB class for Gallery that directly use the user-information in Geeklog. This is something I may implement in the future.

Ok have fun,
Bas.

 Quote

Status: offline

squatty

Forum User
Full Member
Registered: 01/21/02
Posts: 269
I tried your code hack on my Geeklog v1.3.1 and Gallery v1.2.5 install and am not able to see the administrator options on Gallery when logged in as admin on Geeklog. Do you know if this will work on a Windows OS running Apache?
In a world without walls and fences, who needs Windows and Gates?
 Quote

Anonymous

Anonymous
I was able to get it to work by hard coding my admin user ID in the following SQL statement: $result = DB_query("SELECT username FROM users WHERE uid = '13'"Wink; I also had to specify the table name. I'm not sure why Gallery can't determine the table or UID field on it's own? At least it works!
 Quote

bas

Anonymous
Hi All, When pasting code into a story it does something strange to it. Between '' in the DB_query line it should read : Should you have any problems with this hack, just drop me a line. Regards, Bas.
 Quote

bas

Anonymous
Ok, let's try one final time!!! The line with the DB_Query should read : $result = DB_query("SELECT username FROM ".$_TABLES['users']." WHERE uid = '".$_USER['uid']."'"Wink; Hope this finally get published correctly :-( Grtx, Bas.
 Quote

Status: offline

squatty

Forum User
Full Member
Registered: 01/21/02
Posts: 269
Works great! Many thanks for your cool hack Smile
In a world without walls and fences, who needs Windows and Gates?
 Quote

Anonymous

Anonymous
Thanks for the hack. Something was weird in my system and I could not log in. So I removed the strtolower function and modified the .users text databases and its backup file so that the 'admin' became 'Admin' and it worked perfectly after that. Nice too for I can now login in directly in GL and I get logged into gallery at the same time. Same with logging out. When I log out of GL I get logged out of Gallery too. This is nice for I could not find the logout for gellery. Is there one? Or did I lose my eyesight for that part. Thanks again for the hacks. PS. I removed all the Nuke code, it bothered me ;o)
 Quote

Status: offline

DaveC

Forum User
Newbie
Registered: 11/08/04
Posts: 6
Location:NZ
(if you use the CODE button when posting code snippets it will publish properly)
 Quote

All times are EDT. The time is now 11:44 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content