Problems with Random_Block .41 on PostNuke 0.723

Askim
Askim's picture

Joined: 2002-12-27
Posts: 2
Posted: Fri, 2002-12-27 15:23

(and also another block (gallery_new))

When adding this Block to my Webside I get this errors on my frontpage, I'm running PostNuke 0.723, on SuSE Linux 8.1 Pro, using Apache 1.36 and PHP 4.22, I did got some other errors, but they did have some thing to do with Permissions and is know correctet, but after that corrections I got this errors:

<!-- BBCode Start --><A HREF="http://pn.dembel.org/modules.php?op=modload&amp;name=phpBB_14&amp;file=index&amp;action=viewtopic&amp;topic=11" TARGET="_blank">More Info</A><!-- BBCode End --> can be found here (From my Gallery_New problem)

I'm running latest CVS version of Gallery.

Warning: extract() expects first argument to be an array in /srv/www/htdocs/gallery/init.php on line 60

Warning: extract() expects first argument to be an array in /srv/www/htdocs/gallery/init.php on line 61

Warning: extract() expects first argument to be an array in /srv/www/htdocs/gallery/init.php on line 62

Warning: Invalid argument supplied for foreach() in /srv/www/htdocs/gallery/init.php on line 64

<!-- BBCode Start --><A HREF="http://www.heima.info" TARGET="_blank">My homepage</A><!-- BBCode End -->
I have deactivated this blocks due to this errors

Block Gallery_New and Block Gallery_Random have the exact same problems!

wbr

Joe

 
dodofreak
dodofreak's picture

Joined: 2002-12-09
Posts: 75
Posted: Fri, 2002-12-27 19:21

I'm running almost the same setup, but using PostNuke 0.723, RH Linux 6.2, using Apache 1.3.23 and PHP 4.2.3, Gallery 1.3.2.

Maybe the latest CVS version of gallery has some issues with Random Block?

 
Askim
Askim's picture

Joined: 2002-12-27
Posts: 2
Posted: Fri, 2002-12-27 20:26

Just got answer from Anonym user, Reigster globals = On, does fix this, it was Off (as default on PHP 4.2.x)

that was the trix

But thanx anyway... :roll:

 
dodofreak
dodofreak's picture

Joined: 2002-12-09
Posts: 75
Posted: Fri, 2002-12-27 20:34

So, does that mean that Gallery 1.3.2 requires register globals = on?

I had it on too, just never really gave it a second thought....

 
stevewil
stevewil's picture

Joined: 2003-01-24
Posts: 2
Posted: Fri, 2003-01-24 15:56

First off, thanks for the nice bit of programming to get gallery out to the front page of our postnuke site. Very sweet.

We, too, noticed that by switching register globals = on in php.ini that the problem described above disappears. However, like the rest of the postnuke community, we'd like to go with the security flow which compels us to turn register globals off. Any ideas how we might fix this so that we can turn register globals off?

Here's a snippet of code from the affected region of gallery/init.php:

Quote:
/*
* If register_globals is off, then extract all HTTP variables into the global
* namespace.
*/
if (!$gallery->register_globals) {
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
extract($HTTP_COOKIE_VARS);

foreach($HTTP_POST_FILES as $key => $value) {
${$key."_name"} = $value["name"];
${$key."_size"} = $value["size"];
${$key."_type"} = $value["type"];
${$key} = $value["tmp_name"];
}
}

:eek: thanks...

 
joerg
joerg's picture

Joined: 2002-10-12
Posts: 77
Posted: Fri, 2003-01-24 19:16

Hi,

I thought a little bit an made a patch for init.php which solves these issues. The patch is for the latest cvs version from init.php!

Quote:
--- cvs/gallery/init.php 2003-01-17 07:40:19.000000000 +0100
+++ own/gallery/init.php 2003-01-24 19:45:32.000000000 +0100
@@ -57,18 +57,27 @@
* namespace.
*/
if (!$gallery->register_globals) {
- extract($HTTP_GET_VARS);
- extract($HTTP_POST_VARS);
- extract($HTTP_COOKIE_VARS);
+ if (is_array($HTTP_GET_VARS)) {
+ extract($HTTP_GET_VARS);
+ }
+ if (is_array($HTTP_POST_VARS)) {
+ extract($HTTP_POST_VARS);
+ }
+ if (is_array($HTTP_COOKIE_VARS)) {
+ extract($HTTP_COOKIE_VARS);
+ }

- foreach($HTTP_POST_FILES as $key => $value) {
- ${$key."_name"} = $value["name"];
- ${$key."_size"} = $value["size"];
- ${$key."_type"} = $value["type"];
- ${$key} = $value["tmp_name"];
+ if (is_array($HTTP_POST_FILES)) {
+
+ foreach($HTTP_POST_FILES as $key => $value) {
+ ${$key."_name"} = $value["name"];
+ ${$key."_size"} = $value["size"];
+ ${$key."_type"} = $value["type"];
+ ${$key} = $value["tmp_name"];
+ }
+
}
}
-
/* Load bootstrap code */
if (substr(PHP_OS, 0, 3) == 'WIN') {
include($GALLERY_BASEDIR . "platform/fs_win32.php");

As you can see it's not much to change. We only check if the variables inside the extract function are really arrays. Normally they are, but not when init.php is called by the block.

I'll ask Bharat to get this into the cvs. For now you have to patch it on your own. Please give me feedback, if it works for you.

Jörg

 
stevewil
stevewil's picture

Joined: 2003-01-24
Posts: 2
Posted: Mon, 2003-01-27 05:49

Thanks, Jörg:

The block now works very well with register_globals off. Well done! Thanks, again... :grin:

 
levigator

Joined: 2002-11-11
Posts: 6
Posted: Tue, 2003-02-18 19:42

how do i apply that patch?

 
joerg
joerg's picture

Joined: 2002-10-12
Posts: 77
Posted: Tue, 2003-02-18 20:23

Hello,

you don't have to apply the patch anymore. Bharat commited the patch to the current CVS tree. Get the latest version of gallery from the CVS at sourceforge.

Jörg

 
levigator

Joined: 2002-11-11
Posts: 6
Posted: Thu, 2003-02-20 20:39

Thanks, I grabbed the newest init.php but now I am getting this error:

Quote:
Fatal error: Call to undefined function: checkifonlineoroffline() in /home/bort/public_html/printsite/html/modules/gallery/init.php on line 101

I can't find anyone else on this forum with a similar error.

 
khel

Joined: 2003-03-13
Posts: 1
Posted: Thu, 2003-03-13 02:25
Quote:
Thanks, I grabbed the newest init.php but now I am getting this error:
>> Fatal error: Call to undefined function: checkifonlineoroffline() in /home/bort/public_html/printsite/html/modules/gallery/init.php on line 101 <<

I can't find anyone else on this forum with a similar error.

I have exactly the same error :???: and cannot find a fix for it :cry:
... and applying joerg's patch to the original init.php file didn't work either..

 
budroni

Joined: 2003-11-10
Posts: 8
Posted: Sun, 2003-11-16 06:18

I got the latest version tonite and still have this error:

Warning: Invalid argument supplied for foreach() in /my/path/to/website/gallery/block-random.php on line 165
No photo chosen.