[cpg1.4.x]: Critical Avatar / Comment Error - Bridged with Phpbb [cpg1.4.x]: Critical Avatar / Comment Error - Bridged with Phpbb
 

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

[cpg1.4.x]: Critical Avatar / Comment Error - Bridged with Phpbb

Started by WinterWulf, August 23, 2008, 04:21:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WinterWulf

Hello,
First I would like to thank Stramm for making such a lovely mod - just having the option to turn off all of the extra statistics and speed up my gallery is  enough to use it! But now, down to business:

Problem:

  • I get a critical error when I try to comment on a picture.
  • I get a critical error when I try to view a picture that has a comment.

What I use:
Workaround:

  • Disabling user avatars (Mini Thumbs Required)



DeBuging data:



On trying to comment"
While executing query "SELECT  AS avatar_url FROM `MySQL_Databasename`.users WHERE user_id='2'" on Resource id #16

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 'AS avatar_url FROM `MySQL_Databasename`.users WHERE user_id='2'' at line 1


On trying to view the same image I commented on with the same account:
While executing query "SELECT  AS avatar_url FROM `MySQL_Databasename`.users WHERE user_id='2'" on Resource id #16

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 'AS avatar_url FROM `MySQL_Databasename`.users WHERE user_id='2'' at line 1




Additional Notes and Thoughts:















Mini Tabs enabled?Yes
Mini Tabs set to the same size as avatars in PhpBB?Yes
Any problems in the past with Stephen's Bridge, Coppermine or PhpBB?      No
PhpBB file for avatars:images/avatars/upload
PhpBB file for avatar galleryimages/avatars/gallery

I am thinking that coppermine is having a hard time finding the file with the avatars in it. It may be easyier (less coding) to make it one of coppermine's albums since PhpBB already has a form I can change the paths in. Another benifit would be allowing members to contribute to the usable avatar gallery. However, coppermine seems to store images in files based on their users not on which album they are in; thus this method may actualy take longer to implement.

Thank you very much for your time

Stramm

phpbb 3.x isn't supported yet... there's no bridge file modded to work together with the modpack so as with each other not compatible bridge you'll get a fatal error. With some effort it shouldn't be a problem to adapt the bridge. In other threads I've written what you need to do. 

WinterWulf

I spent about 4 hours yesterday searching around this forum and the PhpBB forum for a fix. I implemented a few simple changes (like re-loading some files) but they didn't help. However, 4 hours of searching does make one tired so it is quite possible that I missed something. I also didn't pay much attention to the threads about gallerys bridged with SMF (since I am using PhpBB); however those might be exactly what I am looking for since they seem to deal with changing paths.

*Takes out a large meat clever* I backed up my files again yesterday, and I have a bit of time today - I might as well hack up some code and see what happens. *Snaps on a surgeon's mask* Yes, I have done this opperation many times before, Mr.Code, with Java, Javascript, LSL and more- even some Ruby. Er, well, no I don't have any experiance with MySQL or Php or much with databases - yes, I am sure this is a good idea, Mr.Code! Yes, I do sort of know what I'm doing! *Takes out an anesthesia mask* Don't worry Mr.Code, if anything goes too horribly wrong, we can always undo it.



What will happen to Mr.Code? Will they make him stronger, faster and smarter than before, gentlemen? Will we find out that his surgeon is an artist, not a doctor, Jim? Will there be more corny plays on quotes? Tune in next time to find out!



P.S. even though they aren't tecnicaly compatible they do work rather well together (in my opinion, anyways).

Stramm

Basically you use an existing bridge file that you can find in the modpack package as example (phpbb 2.x or smf 1.x). That bridge file you compare to the one from th original package. You'll see that you just need to add a few lines of code. These depend on the database layout of your forum app. Here you need to get these (and the way the app manages the avatars and the pms). Now you can start modding the bridge file for your forum app.

WinterWulf

Toke me a while to figure this all out, (my boss had extra work for me and for some reason I didn't understand exactly what Stramm ment) but I think I am on the verge of getting this to work! Unfortunatly, I have run into my dreaded nemisis, Mr.Syntax. Having only a vague understanding of how php works, I have run out of ideas on how to tweak my code; my sidekick, Mr.Internet, isn't in a very helpful mood, either (I can't seem to find any answers there). I will continue to search and tweak but if anyone here would like to fix my handy-(read:messy)work for me (and then let me know what I did wrong so I don't do it again) I would be greatful.


define('AVATAR_PATH', $BRIDGE['relative_path_to_config_file'].'/download/file.php?avatar='.$BRIDGE['avatar_path'].'/');


This ends up giving me this link:http://www.domain.com/phpbbfile/download/file.php?avatar=/1_9999999999.gif
Instead of this link:http://www.domain.com/phpbbfile/download/file.php?avatar=1_9999999999.gif

Stramm

You've hardcoded the avatar path as it looks to me, so some stuff is not necessary. That not necessary code leads to the trailing slash you don't want to have.

-> try removing
.$BRIDGE['avatar_path'].'/'

$BRIDGE['avatar_path'] is a variable that the system reads from the database. That entry is added when running the bridgemanager. However the bridgemanager needs some modifications, too. I've of course only added them for the supported bridges. The solution is what you did (hardcoding) or you'll have to use a tool like phpmyadmin to add the path to the db and then just use $BRIDGE['avatar_path']

WinterWulf

Ah, thank you- it works perfectly now!


For use with:

How to install:


1. Open the file phpbb3.inc.php in the bridge folder
2.                   'avatar_url' => 'user_avatar'
   );

//mod define Avatar path
define('AVATAR_PATH', $BRIDGE['relative_path_to_config_file'].'/download/file.php?avatar=');
change the /download/file.php?avatar= to the file phpbb3.0.2 acesses to load avatars (minus the relative path at the begining and the #_##########.gif part at the end) (if you don't know what file this is, go to your phpbb forum and right click on any avatar you see then click "properties" to see where it is being loaded from. The path you see will look something like this:"http://www.domain.com/phpbbfile/download/file.php?avatar=[/u]1_9999999999.gif" the part you will use is in bold and underlined).

3. Add the code after this section of code:
// Table field names
$this->field = array(
  'username' => 'username', // name of 'username' field in users table
  'user_id' => 'user_id', // name of 'id' field in users table
  'password' => 'user_password', // name of 'password' field in users table
  'email' => 'user_email', // name of 'email' field in users table
  'regdate' => 'user_regdate', // name of 'registered' field in users table
  'active' => 'user_active', // is user account active?
  'lastvisit' => 'user_lastvisit', // name of 'location' field in users table
  'location' => 'user_from', // name of 'location' field in users table
  'website' => 'user_website', // name of 'website' field in users table
  'usertbl_group_id' => 'group_id', // name of 'group id' field in users table
but before this section: // Pages to redirect to
$this->page = array(



the code you have edited (and surrondding portions) will look something like this after you are done:


// Table field names
$this->field = array(
  'username' => 'username', // name of 'username' field in users table
  'user_id' => 'user_id', // name of 'id' field in users table
  'password' => 'user_password', // name of 'password' field in users table
  'email' => 'user_email', // name of 'email' field in users table
  'regdate' => 'user_regdate', // name of 'registered' field in users table
  'active' => 'user_active', // is user account active?
  'lastvisit' => 'user_lastvisit', // name of 'location' field in users table
  'location' => 'user_from', // name of 'location' field in users table
  'website' => 'user_website', // name of 'website' field in users table
  'usertbl_group_id' => 'group_id', // name of 'group id' field in users table
                            'avatar_url' => 'user_avatar'
   );

//mod define Avatar path
define('AVATAR_PATH', $BRIDGE['relative_path_to_config_file'].'/download/file.php?avatar=');

// Pages to redirect to
$this->page = array(


Notes:

You may have to limit users to only using avatars they upload (no using images from other sites or a gallery) but I have not tested this. Also, if you change the avatar folder that phpbb uses later, you will have to update your bridge file.



Thanks agian for all your help on getting this little mod to work, Stramm!

WinterWulf

QuoteThanks agian for all your help on getting this little mod to work, Stramm!
And by that, I mean the help with getting my tweak to your huge modpack to work, of course.

Stramm

Thanks for your work. I'm sure that's very helpful for a lot of modpack users.

EC

Thanks a lot! It works also for me on my bridged gallery.
Elena