Random block and Gallery 1.4-rc1

ZippySLC

Joined: 2003-01-21
Posts: 9
Posted: Fri, 2003-08-22 15:15

I just upgraded to 1.4-rc1 on my site and now the random image block is broken.

It keeps telling me that my configuration was created with an old version of gallery, even though I have updated the config and the gallery itself works fine (both within and outside of Postnuke)

Any ideas?

 
Warren
Warren's picture

Joined: 2002-07-24
Posts: 794
Posted: Fri, 2003-08-22 15:22

You will need to stick with something pre 1.4.1-cvs-b12 for the time being as the code is fixed or someone can post the fixed code here for you to mod.

 
ZippySLC

Joined: 2003-01-21
Posts: 9
Posted: Fri, 2003-08-22 15:31

If someone can post the code to mod, I'd appreciate it.

 
Warren
Warren's picture

Joined: 2002-07-24
Posts: 794
Posted: Fri, 2003-08-22 16:01

My mistake. Unless others have it running on their 1.4 versions, I'll have to suggest you go back to 1.3.4 stable. The PostNuke Random Block has not been updated since then. See Jörg's site What version did you upgrade from?

 
ZippySLC

Joined: 2003-01-21
Posts: 9
Posted: Fri, 2003-08-22 17:52

1.3.4

 
jure

Joined: 2003-06-06
Posts: 5
Posted: Fri, 2003-08-29 10:04

There is a random block on this site and it's obviously working with 1.4.1. Perhaps dev team will be so kind and release the code.

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Fri, 2003-08-29 12:59

This site (running 1.4.1-cvs-b1) uses the standalone random block, not the PostNuke random block. The standalone block should still work fine (though it has a couple of small known bugs... ask about them if they crop up).

-Beckett (

)

 
jure

Joined: 2003-06-06
Posts: 5
Posted: Sat, 2003-08-30 11:43

Thank you for your prompt reply. I've tried the random photo block, but I have one problem.
I put block-random.php in /modules/gallery folder, modified index.php with"block-random.php" line, created a new PHP block with
include("http://your.server/modules.php?op=modload&name=your-gallery-name&file=index&include=block-random.php"); , but i see only

Quote:
Warning: Failed opening 'http://lds.si.cx/modules.php?op=modload&name=Galerija LDS Kamnik &file=index&include=block-random.php' for inclusion (include_path='.:/usr/share/pear') in /home/lds/public_html/includes/blocks/php.php(51) : eval()'d code on line 1

instead of an image.
I have entered my URL and the name of the gallery (Galerija LDS Kamnik)in above code.
Is it important where albums folder is? I have it in root directory of the site, so I wonder if that is a problem?

 
LGK

Joined: 2003-08-31
Posts: 6
Posted: Sun, 2003-08-31 18:40

I'm getting

Warning: rand() expects parameter 2 to be long, string given in /www/htdocs/modules/gallery/block-random.php on line 138
ERROR: requested index [] out of bounds [47]
Fatal error: Call to a member function on a non-object in /www/htdocs/modules/gallery/classes/Album.php on line 702

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Mon, 2003-09-01 05:16

:: jure ::

Try renaming your Gallery module to not have any spaces. If that doesn't work, we'll try something else.

:: LGK ::
You've found one of the bugs I mentioned. :)
In block-random.php find this line:
$choose = rand(1, $count);
and replace it with
$choose = rand(1, (int) $count);

As for the out of bounds error, remember that the cache file only updates once every 24 hours. If you remove it, it will update again right away.

-Beckett (

)

 
blackcat

Joined: 2003-09-20
Posts: 3
Posted: Sat, 2003-09-20 21:29
ZippySLC wrote:
I just upgraded to 1.4-rc1 on my site and now the random image block is broken.

It keeps telling me that my configuration was created with an old version of gallery, even though I have updated the config and the gallery itself works fine (both within and outside of Postnuke)

Any ideas?

I've just spent the last 3 hours chasing this down and now have mine working with Gallery V1.4-pl1. Before anyone rushes off to mod their online version, just bear in mind that I was hacking a test version on my test server and could suffer any hardship that followed. Make sure you can too :wink:

I offer no guarantees with this, but I think I got to the root of the problem.

For those wanting to get straight to it, here's what you have to do:

The gallerySanityCheck() function in the util.php file located in the root gallery folder makes a check between the version number stored in config.php and that stored in Version.php using this line if ($gallery->app->config_version != $gallery->config_version). The first part of the check $gallery->app->config_version returns the value 48. The second part, $gallery->config_version, returns nothing, then the configuration error message is generated.

To correct it, the $gallery->config_version variable has to be brought into scope within the function. Add the following line highlighted in red to the function located in the util.php file starting at line 993:

function gallerySanityCheck() {
global $gallery;
global $GALLERY_BASEDIR;
require($GALLERY_BASEDIR."Version.php");

if (!fs_file_exists($GALLERY_BASEDIR . "config.php") ||
brok...

The $gallery->config_version variable will also now return 48 from the Version.php file and will allow the random image to be generated.

I'm not sure why the require directive for the Version.php file in init.php isn't allowing this variable to be seen, but the include directive for the config.php file is allowing the other variable. I'm sure one of the experts here can shed some further light on the subject. :D

 
[TA]-Gator

Joined: 2003-09-15
Posts: 4
Posted: Tue, 2003-09-23 21:30

Thanks for the info blackcat...It worked like a champ :D

 
blackcat

Joined: 2003-09-20
Posts: 3
Posted: Tue, 2003-09-23 21:47

Thanks mate. Nice it's been of use to someone :D

 
flasher

Joined: 2002-11-13
Posts: 33
Posted: Tue, 2003-09-23 22:22
Warning: main(errors/configure_instructions.php) [function.main]: failed to create stream: None file or directory of this type in /home/www/html/modules/gallery/errors/reconfigure.php on line 13 

Fatal error: main() [function.main]: Failed opening required 'errors/configure_instructions.php' (include_path='.:/usr/local/lib/php') in /home/www/html/modules/gallery/errors/reconfigure.php on line 13 

Whatr means this error ?

 
blackcat

Joined: 2003-09-20
Posts: 3
Posted: Wed, 2003-09-24 16:29

It's trying to include the errors/configure_instructions.php file from the modules/gallery/errors directory, but can't as it says it doesn't exist.

Have you checked the errors directory to make sure the file is there?

 
agentn

Joined: 2003-05-29
Posts: 11
Posted: Sat, 2003-10-11 00:57

Blackcat: "You Da Man" That worked like a charm.

Now, do you have any clever ideas on how to make "Last Gallery Updates" block work simultaneously with "Random Photo" block?

It can't now because the declare the same header or something.

 
oregano

Joined: 2003-04-21
Posts: 11
Posted: Mon, 2003-11-10 18:27

AMEN - Blackcat is Da Man - worked great for me as well.

Thanks!

:)

 
mikel

Joined: 2003-11-17
Posts: 4
Posted: Tue, 2003-11-18 22:21
Quote:
To correct it, the $gallery->config_version variable has to be brought into scope within the function. Add the following line highlighted in red to the function located in the util.php file starting at line 993:

function gallerySanityCheck() {
global $gallery;
global $GALLERY_BASEDIR;
require($GALLERY_BASEDIR."Version.php");

BlackCat - I mod'ed the file as suggested. The random block image now shows up, but am getting this WARNING right above the image:

Quote:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in .../modules/gallery/classes/database/mysql/Database.php on line 37

Which is:

function fetch_row($results) {
  $row = mysql_fetch_row($results);
   return $row;
}

Using PN 7.2.6 / Gallery 1.4.1-RC3.

Can see on: mikesjourneys.com

Odd note after I posted the above: Only get this warning if logged into site. If not logged in, don't get the warning .... hmmmmm :-?

 
ZippySLC

Joined: 2003-01-21
Posts: 9
Posted: Mon, 2003-11-24 22:43

The same thing happened to me when I tried the fix. Same exact mySQL error.

 
Warren
Warren's picture

Joined: 2002-07-24
Posts: 794
Posted: Mon, 2003-11-24 23:19

This should fix your problem: Photo Block.

 
ZippySLC

Joined: 2003-01-21
Posts: 9
Posted: Tue, 2003-11-25 00:04

Thanks - that fixed it!

 
mikel

Joined: 2003-11-17
Posts: 4
Posted: Tue, 2003-11-25 07:00

Yup, that fixed the problem for me too !! :D

 
gwyers

Joined: 2004-01-16
Posts: 3
Posted: Thu, 2004-02-05 17:42

function gallerySanityCheck() {
global $gallery;
global $GALLERY_BASEDIR;
require($GALLERY_BASEDIR."Version.php");

if (!fs_file_exists($GALLERY_BASEDIR . "config.php") ||
brok...

Thanks, great help because it now works....