PHP-Fusion and Coppermine Photo Gallery integration - Page 3 PHP-Fusion and Coppermine Photo Gallery integration - Page 3
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

PHP-Fusion and Coppermine Photo Gallery integration

Started by Mr T, July 12, 2005, 11:50:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Horizon

I've not done anything since the last post, but at the moment I can't to come in the gallery in aggregate  (http://neformatas.net/galerija/ ) any ideas mates what's going on? There can I manager this bridge?

Please help me.

xphermg

Hi All!

I just did this last night and I love it.. cept for one small problem, my users can upload, they get this error:

Sorry there is no album where you are allowed to upload files

File: /home/beyond/public_html/pictures/upload.php - Line: 874

Now, I've gone into Groups and and modified it, I'm just not sure what is going wrong.  Any suggestions?

Joachim Müller


batbaru1

I know it must be in front of me somewhere but I can't find any info on where to actually get the bridge (and associated usage info). Can someone help?


clutch23097

any idea how do I got this error?

$this->boardurl = 'http://localhost/';; require_once('http://psrc.epinoy.com/config.php');
Fatal error: Call to a member function authenticate() on a non-object in /home/vhosts/psrc.epinoy.com/public_html/photogallery/include/init.inc.php on line 270

many thanks...

KristianS

Nice thread :-) Just what I was looking for!

Installed and working fine!

I have a question though...I can see someone already asked the same without luck...so I will try to bring it to life...

Fusion has two types of groups...1) then pre-defined (admin, superadmin, users...) 2) User-defined

In the bridge posted in here, I only get group 1. I really need group 2...Can someone point me in the right direction?

Thank you!

Br
Kristian

KristianS

Some more info to my last post:

My bridge table in the cpg db is empty when i browse it? Has something gone wrong? or should I fill it manually? to activate the groups?

Nibbler

The bridge file does not support user defined groups, probably because I was not aware of their existence.

KristianS

Can you help or can you specify what areas I need to look into to modify the bridge. It is something that would help all fusion users wanting to use Coppermine. I'll be happy to give a try, but need some pointers...

Some details.

Basically the four groups that are now loaded through the bridge (or are they hardcode in the array?) are SuperGroups. You can only belong to one of these...SuperAdmin, Admins, Users, Guest. The other groups are subgroups to these. You can belong to many sub_groups.

Br
KristianS

Nibbler

You need to fix this to read in the user defined groups from the database:


function collect_groups()
{

$udb_groups = array(103 =>'Super Administrators', 102=> 'Administrators', 101=>'Members', 100=> 'Guests');

return $udb_groups;

}


and then make sure the users get put into the correct groups.

Set

$this->multigroups = 1;

near the top of the file and add an implementation of get_groups() - see other bridge files for examples.

You should be able to do all this by only modifying the phpfusion bridge file.

KristianS

Hey again,

What does this switch do?
$this->multigroups = 0;

When I change it to 1 I get a fatal error.

I have updated the collect group function and without setting the above to 1 it collects the correct groups.

Without changing anything the button "Assign album" (http://../cpg1410/usermgr.php?op=group_alb_access&gid=1) then this links to a list of my users within fusion. I would expect that this function would open a box containing available albums...Any ideas?

The get_groups function what should it do? should collect the users for the groups? and add them to the coppermine tables? I confued about the named perhaps...since I already collected the groups...

br
Kristian


Nibbler

multigroups means you need to provide a get_groups() function to get all the groups the user is in. Without this you get the simpler method of a single group for the user.

It says assigned albums, not assign albums. This is not related to what you are doing.

collect_groups() retrieves the list of all available groups that exist. This is only called during a group sync (via bridge manager or a groups page visit).
get_groups() gets the groups that the currently logged in user is a member of. This is called every time.

I'd love to be able to help you more with actual code, but I just don't have the time currently.


KristianS

No problem, this was a great help. The problem is that the bridge files are not over commented...so I need to ask :-)

I'll be back!

KristianS

Ok, here is where i've gotten so far...


function get_groups( &$user )
{
//$groups = array($user['group_id'] - 100);
$sql = cpg_db_query("SELECT user_groups, user_level FROM {$this->usertable} WHERE {$this->field['user_id']}='{$user['id']}' and user_groups <> '' and user_level <> '';");

$user_level=mysql_result($sql,0,"user_level");
$user_groups=mysql_result($sql,0,"user_groups");

$groups = explode(".", $user_groups);
array_push($groups,$user_level);

print_r(array_values($groups));

return $groups;
}


I havent really looked at php before so if I have done something less secure etc. pls advice....Anyway here is my problem:

Error log from CPG:


While executing query "SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM cpg1410_usergroups WHERE group_id in (1,4,103,)" on 0

mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1



It seems that the array might have an extra entry or something since it adds that last "," which crashes the SQL....but can't figure it out since a print of the array gives: Array (
  • => [1] => 1 [2] => 4 [3] => 103 )

    Any suggestions?

    Br
    Kristian

KristianS

Ok, more input:

It seems that in the file: udb_base.inc.php there is a check for the value primary group. This is empty, in which case it adds an empty value to the array...Where is this set and what should I do about it?

if (!in_array($pri_group, $groups)) array_push($groups, $pri_group);

KristianS

Ok I believe I have cracked it :-)

The bridge now reads the userdefined groups and adds them to the CPG tables when ever you click on the groups tab (logged in as admin). Also it reads the fusion users userdefined groups and the users current user_level. Depending of the level the user gets admin rights in CPG as well.

I would like some review, since i'am a major newbie at this (e.g. first php script ever).

Pls test/review for the following:

Security issues
Stability
Excessive use of variables etc.

Br
Kristian

KristianS

New version fixed bug if a user didn't belong to a user_defined group and only had a supergroup.

gaagaa

i dont what i did wrong but after i put bridge on the server, when i go to gallery it redirect me to fusion site but nothing happend.. when ia back to gallery i'm still not logged..:((((