Upload as User Upload as User
 

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

Upload as User

Started by Ravage, February 29, 2004, 06:13:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ravage

This feature was very helpful when I used photopost was wondering if there was a mod for this feature for admins to use.

Casper

Not exactly sure what you want.  If it is simply to be able to upload the same way as your users, that is already here, just use the 'upload picture' link.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Ravage

I have it intergrated with VB3 and it doesn't give an options to do that.

Only options are:

Album
Picture    
Picture title    
Picture description    
Keywords (separate with spaces)

Omen

I think he means he wants the ability to make it look like someone else uploaded the file...

A dropdown list of all members.... He selects "Joe" and upload a file...
Then when viewing the file, "Joe" will be listed as the person who uploaded it...

(i think)

Ravage


Nibbler

OK, there are several changes for this...

1) Upload.php

Under:


array($lang_upload_php['picture'], 'userpicture', 1),


add:


array('Upload as','upload_as',4,32),


( 'Upload as' can be in your own langauge)

Under:


case 3 :
form_textarea($element[0], $element[1], $element[3]);
break;


add:


case 4 :
if (GALLERY_ADMIN_MODE) form_input($element[0], $element[1], $element[3]);
break;


2) db_input.php

Under:


$keywords = addslashes($HTTP_POST_VARS['keywords']);


add:


$upload_as = addslashes($HTTP_POST_VARS['upload_as']);


find:


$result = add_picture($album, $filepath, $picture_name, $title, $caption, $keywords, $user1, $user2, $user3, $user4, $category, $raw_ip, $hdr_ip);


change it to:


$result = add_picture($album, $filepath, $picture_name, $title, $caption, $keywords, $user1, $user2, $user3, $user4, $category, $raw_ip, $hdr_ip, $upload_as);


3) picmgmt.inc.php

find:


function add_picture($aid, $filepath, $filename, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $category = 0, $raw_ip = '', $hdr_ip = '')


change it to:


function add_picture($aid, $filepath, $filename, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $category = 0, $raw_ip = '', $hdr_ip = '',$upload_as)


find:


            // User ID is not recorded when in admin mode (ie. for batch uploads)
            $user_id = GALLERY_ADMIN_MODE ? 0 : USER_ID;
                        $username=$USER_DATA['user_name'] ;


replace it with


            // User ID is not recorded when in admin mode (ie. for batch uploads)
            If (GALLERY_ADMIN_MODE)
                {
                 $username = $upload_as;
                 If (defined('UDB_INTEGRATION'))
                        {
                         $result = db_query("SELECT user_id FROM phpbb_users WHERE username = '$username'");
                        } else {
                                $result = db_query("SELECT user_id FROM {$CONFIG['TABLE_USERS']} WHERE user_name = '$username'");
                                }
                 $record = mysql_fetch_array($result);
                 $user_id = $record[0];
                } else {
                $user_name = $USER_DATA['user_name'];
                $user_id = $USER_DATA['user_id'];
                }


(change phpbb_users to your own user table if you use a non-phpbb integration)

Just enter the name of the user you are uploading as, and it should work  :D

Ravage

Error Popped up.

There was an error while processing a database query

I did do the edits correct and changed phpbb_users to userbecuase of the VB3 intergration.

I think becuase I'm using the VB3 intergration but it may still be looking into the coppermine databae for the user.

Nibbler

It should cope with db integration, worked with my phpbb setup, so I suggest you enable debug mode and see what the actual error is. I am not familiar with vb3, so I dont know what the user table looks like.

Casper

Did you change the 'phpbb_users' to 'vb3_users' (or whatever your vb3 users table is called), or just to 'users'
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Ravage

my table is only called user

there is no prefix on my database.
any ideas?

I did the debug mode. Its looking in the coppermine database for user not the vbulletin database.

Nibbler

Somewhere at the start of your init.inc.php there should be an uncommented line defining UDB_INTEGRATION. It is this that the mod will check to decide which table to look in. This should have been set as part of your integration procedure. If all else fails just change the "SELECT user_id FROM {$CONFIG['TABLE_USERS']} WHERE user_name = '$username'" to whatever it needs to be for vb3.

Ravage

my vb3 database is called VBulletin
the user table is called user

what do I change the line to?

Casper

That means this line in the mod above;
$result = db_query("SELECT user_id FROM phpbb_users WHERE username = '$username'");

needs to be changed to this;
$result = db_query("SELECT user_id FROM VBulletin_user WHERE username = '$username'");
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Nibbler

EDIT:

Looking at the bridge file, it should be:

"SELECT userid FROM VBulletin.user WHERE username = '$username'"

Ravage

Ok I got it to work. Is wasn't the second select it was the first one.

$result = db_query("SELECT user_id FROM phpbb_users WHERE username = '$username'");

I replace that one with the edited line and it work. When I replace the second one same error popped up. Thx for the help.

Nibbler

Ah, I didn't take into account the possibility of seperate databases when I wrote that.

Zeitgeist

Is there any way to get this mod t o work with the current version? I've cleanly put in all parts except the last and I can't seem to get it to work, tried some different ways to put it in but none worked and I got database error when trying to upload with it.
I love GauGau!

Nibbler

It won't work with 1.3 as the upload system is all changed.

WitchyMama

so there is no way to have something similar to this in the current release? damn  :-\\

Scottie32

Does any one no how to get a forgotton PW lol ???