Random Image block on PostNuke Rogue 0.714

Crazy_Para

Joined: 2002-08-20
Posts: 4
Posted: Thu, 2002-08-22 15:27

Hi guys sorry to be a pain in the ass but I am in the 'learning' process of teaching myself php so I am totally clueless to my problem.

I installed the block for random pictures to be shown from my gallery so it can be shown on the home page as a block, now the problem is only ONE picture showed up and after killing my refresh page button a thousand times this is the error that kept coming up:

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>Warning: rand() expects parameter 2 to be long, string given in /htdocs/www/modules/gallery/block-random.php on line 138
ERROR: requested index [] out of bounds [11]
Fatal error: Call to a member function on a non-object in /htdocs/www/modules/gallery/classes/Album.php on line 570</TD></TR></TABLE><!-- BBCode End -->

Any ideas guys? please email me if you can at

The Gallery is one of the best photo albums I have seen for the web - and even better intagrated into postnuke. Thank you guys.

 
daoist

Joined: 2002-08-22
Posts: 38
Posted: Fri, 2002-08-23 12:45

same problem here.

the random image worked exactly once, and then gives me the same error every time.

Postnuke .72
php 4.2.2

 
joyfulcity
joyfulcity's picture

Joined: 2002-08-20
Posts: 3
Posted: Fri, 2002-08-23 14:36

Random Image Block searches through all your albums and will store all albums with permission that allows EVERYBODY group to read will be stored into an array. Therefore if you have assigned specific permissions to all your albums, which means that there is no EVERYBODY group, than you may experience strange behaviour.

Solution? Try this, for some of your albums, include the EVERYBODY group into the permissions, remember to include the EVERYBODY permissions for your sub-albums too. Than delete the cache file ../your_album_directory/block-random.cache than try again.

Other than inflating my session counts, it works great. Have not had time to figure out this part yet :smile:

My site
<!-- BBCode Start --><A HREF="http://www.joyfulcity.com" TARGET="_blank">JoyFulCity.Com</A><!-- BBCode End -->

Quote:
same problem here.

the random image worked exactly once, and then gives me the same error every time.

Postnuke .72
php 4.2.2

 
daoist

Joined: 2002-08-22
Posts: 38
Posted: Fri, 2002-08-23 18:37

i haven't messed with any of the perms for any of my galleries, and there is no block-random.cache file, so i dunno what's up here.

i'll go learn php to debug this script i guess. oh well, another thing for the ol' resume i guess. :-/

 
eilko

Joined: 2002-08-24
Posts: 1
Posted: Sat, 2002-08-24 09:13

change the readCache() function in the block_random.php

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
function readCache() {
global $cache;
if ($fd = fs_fopen(CACHE_FILE, "r")) {
while ($line = fgets($fd, 4096)) {
list($key, $val) = explode("/", trim($line));
$cache[$key] = $val;
}
fclose($fd);
}
}
</TD></TR></TABLE><!-- BBCode End -->

Random block works fine now with Postnuke 7.14

 
Suede

Joined: 2002-07-19
Posts: 5
Posted: Tue, 2002-08-27 22:47

You are a godsend thankee!!

 
spadver
spadver's picture

Joined: 2002-08-31
Posts: 2
Posted: Sat, 2002-08-31 14:25
Quote:
change the readCache() function in the block_random.php

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
function readCache() {
global $cache;
if ($fd = fs_fopen(CACHE_FILE, "r")) {
while ($line = fgets($fd, 4096)) {
list($key, $val) = explode("/", trim($line));
$cache[$key] = $val;
}
fclose($fd);
}
}
</TD></TR></TABLE><!-- BBCode End -->

Yes! It works in PostNuke 0.714 :smile:
But!!! It gives enother bug! :sad:

After that the counter of PostNuke in block "Who us online" begin count each refresh as new guest!

Who one can fix it? :???:

 
brew

Joined: 2002-09-18
Posts: 14
Posted: Wed, 2002-09-18 21:53

Yes the fix worked great!

But I have the same problem also with the guest count.

Does anyone have a solution to this?

Thanks!

Brew