PHP Nuke 6.0 and Gallery 1.3.3 or What they didn't tell me!

empower

Joined: 2003-03-18
Posts: 2
Posted: Tue, 2003-03-18 09:52

First thing I got wrong was putting block-random.php in the blocks directory.
It goes in the /modules/gallery/dirctory instead.

Second thing I had to do was edit /modules/gallery/index.php and include "block-random.php" in the $safe_to_include array
add this at the beginning or end of the array
"block-random.php",

Then you need to find the function themesidebox in every theme you use and add the following lines at the beginning:
function themesidebox($title, $content) {
if (@file_exists($content)) {
$fp = fopen ($content, "r");
$content = fread($fp, filesize($content));
fclose ($fp);
$content = "?>$content<?";
$content = eval($content);
} else if (eregi("^http", $content)) {
$fp = fopen ($content, "r");
$content = fread($fp, 65535);
fclose ($fp);
}

What this does is when you creat a html block in PHP Nuke and put a URL in the block it includes the content of that URL instaed of treating the URL as Text.

So the last thing to do is to create the block. So create a html block (just leave file set to none and enter the following in the content area.
http://your.server/modules.php?op=modload&amp;name=your-gallery-name&amp;file=index&amp;include=block-random.php
be careful not to add any unwanted carriage returns in or it wont work. Before saving position the cursor at the end of the line and press delete a couple of times to make sure there aren't any carriage returns on the end.
obviously replace your.server and your-gallery-name with the correct names.

With that done it should all work however I had one more problem which I struck.
I got an error message saying
Warning: rand() expects parameter 2 to be long, string given in ...
I fixed this by editing block-random.php and changing line 138
in function choosePhoto($album) add "+1-1" to the following line as shown
$choose = rand(1, $count+1-1);
this forces $count to be an integer and seems to have fixed this problem.

Hope this helps someone. Most but not all of this info is already in the various messages in this forum but now it is here in one place.