1
gstarrett
XoopsGallery comments error
  • 2003/4/25 4:00

  • gstarrett

  • Friend of XOOPS

  • Posts: 174

  • Since: 2002/3/12


Hi all--I'm still working on understanding all the ins & outs of the new XOOPS + Smarty + XoopsGallery and was hoping someone could point me in the right direction.

When I add a comment, and look at the /include/comment_form.php (included by /modules/XoopsGallery/comment_new.php) hidden inputs, the "extra_param" values are blank. I think I MAY have found the source of the problem. in /include/comment_form.php line 109 says:
Quote:
$hidden_value = isset(${$extra_param}) ? htmlspecialchars(${$extra_param}, ENT_QUOTES) : '';


...and it is NOT including the values. However, when I change register_globals to ON, it works. Should I correct the above line, or is it the responsibility of the /modules/XoopsGallery/comment_new.php to set them in the first place? I looked for a generic "HTTP_GET|POST_VARS to Local vars" routine, but didn't find any one place--it looks like the modules are responsible for the pulling in, but I'm not sure.

Where does the patch need to go? XOOPS core or XoopsGallery? I've seen other posts about "some modules don't work correctly yet with register_globals off", could this be why??

I am just starting to dip my toe into the new Xoops2 setup, but it looks very nice so far (albeit a bit of a learning curve--I've only started OO programming and am very new to it in PHP and it's a little "spread out"). Any help is appreciated.

Regards,

Glen Starrett

2
gstarrett
Re: XoopsGallery comments error
  • 2003/4/25 19:23

  • gstarrett

  • Friend of XOOPS

  • Posts: 174

  • Since: 2002/3/12


Bump. Anyone? Should I direct this toward anyone in particular? I looked through the wiki but it didn't help (maybe I just didn't see the correct secion?).

3
onokazu
Re: XoopsGallery comments error
  • 2003/4/28 16:56

  • onokazu

  • XOOPS Founder

  • Posts: 617

  • Since: 2001/12/13


This has been fixed on CVS. You can download the fixed file here.

4
gstarrett
Re: XoopsGallery comments error
  • 2003/4/29 19:05

  • gstarrett

  • Friend of XOOPS

  • Posts: 174

  • Since: 2002/3/12


Thanks for looking into this. I took a look at the fix and it only partially corrects the problem. The post_comment.php now looks only to the GET query for the information, but not to POST query. When you post a new comment, the $commentnav "post comment" button is a POST query to the comments form and therefore the values aren't passed properly.

$extra_params .= isset($HTTP_POST_VARS[$extra_param]) ? $extra_param.'='.$HTTP_POST_VARS[$extra_param].'&' : isset($HTTP_GET_VARS[$extra_param]) ? $extra_param.'='.$HTTP_GET_VARS[$extra_param].'&' $extra_param.'=&';

Would something like that do the trick? Probably better to seperate into a seperate utility sub.

function GetGPLVar($param) {
    if isset(
$HTTP_POST_VARS[$param]) {
        return 
$HTTP_POST_VARS[$param]
    } elseif isset(
$HTTP_GET_VARS[$param]) {
        return 
$HTTP_POST_VARS[$param]
    } else {
        return isset(${
$param}) ? ${$param} : ''
    
}
...

    
$extra_params .= $extra_param.'='.GetGPLVar($extra_param).'&'

...

I know there's a more appropriate place for something like this, but I'm not familiar enough with XOOPS core yet to even guess. Also please pardon my hack|buggy PHP coding, I don't have time to properly test the code now or look up the XOOPS coding standards.

Thanks for all the great work.

5
gstarrett
Re: XoopsGallery comments error
  • 2003/5/14 21:48

  • gstarrett

  • Friend of XOOPS

  • Posts: 174

  • Since: 2002/3/12


I have created a patch that fixes the problem. I'll have to post the patch to bugzilla since I can't seem to attach anything here (the patch is plain text, but a bit lengthy for a post).

Here is the bug report with the patch attached.

Thanks!

6
Shufflebug
Re: XoopsGallery comments error
  • 2003/8/31 19:20

  • Shufflebug

  • Just popping in

  • Posts: 40

  • Since: 2002/6/19


Many thanks, that fix saved my day

I'll post it to the other related threads !

Shufflebug

7
gstarrett
Re: XoopsGallery comments error
  • 2003/8/31 19:38

  • gstarrett

  • Friend of XOOPS

  • Posts: 174

  • Since: 2002/3/12


Glad it could help. Note thought that there are a number of issues in running register_globals off, particularly in XoopsGallery. This patch fixes the ones in relation to comments, but it does not fix them all--and I've stopped chasing them because I found out our ISP for our public site runs with register_globals ON -- it just didn't seem worth the time once I found out.

More fixes for XoopsGallery here and here

Best of luck. Hopefully all these XoopsGallery fixes can be rolled into one so we stop getting posts like "Is there ANY gallery module that WORKS "...

Once XoopsGallery IS working, it is a very nice setup.



8
gstarrett
Re: XoopsGallery comments error
  • 2003/8/31 19:53

  • gstarrett

  • Friend of XOOPS

  • Posts: 174

  • Since: 2002/3/12


Followup: The effect of this patch HAS already been included in XOOPS 2.0.3, so it NOT help if you're running XOOPS 2.0.3 or later!!

I just confirmed this with the fresh DL of XOOPS 2.0.3. Note that the update is not my patch verbatum, they did it a different way that had effectivly the same results.


9
knight
Re: XoopsGallery comments error
  • 2003/9/10 4:35

  • knight

  • Just popping in

  • Posts: 29

  • Since: 2002/12/29


hi i m using xoops2.03
but it seem like it still having some problem
i check my db, it show
albumName=&id=&xoops_imageid=&

it seem like the extraparam never been assign..
its this xoopsgallery problem ? or xoopscomment problem ?


10
gstarrett
Re: XoopsGallery comments error
  • 2003/9/10 7:52

  • gstarrett

  • Friend of XOOPS

  • Posts: 174

  • Since: 2002/3/12


What version of PHP are you using, and is register_globals on or off? The way they implemented the register_globals workaround I believe only works in PHP 4+.

I believe they did it that way because the default in PHP 3 was for it to be on, but that changed in 4... so as long as you are at default value for register_globals, you're OK. However, if you've changed your PHP 3 install to have register_globals off then the XOOPS global registration won't work.

For those using XOOPS 2.0.3+ with PHP 3 and register_globals off, please note: My fix works for PHP 3 or 4, but you should use caution implementing it since it was written for an earlier versino of XOOPS (2.0.2).

Login

Who's Online

108 user(s) are online (77 user(s) are browsing Support Forums)


Members: 0


Guests: 108


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits