Update of /cvsroot/phpwiki/phpwiki/themes/Hawaiian/pictures
In directory usw-pr-cvs1:/tmp/cvs-serv17871
Modified Files:
random.php
Log Message:
random image array is read in from dir instead of hard coded. For the Hawaiian theme, random image is not used by default (but still are performance issues)
Index: random.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/themes/Hawaiian/pictures/random.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** random.php 2002/01/02 00:38:27 1.3
--- random.php 2002/01/03 04:28:28 1.4
***************
*** 3,25 ****
rcs_id('$Id$');
! // mt_srand ((double) microtime() * 1000000 / pi()); #not random enough
! // Hmm is this random enough?
! // see http://download.php.net/manual/en/function.srand.php
!
!
! $RandomPictures = array(
! "BeachPalmDusk.jpg",
! "Coastline.jpg",
! "HawaiiMauiFromSpace.jpg",
! "LavaTwilight.jpg",
! "LoihiSeamount.jpg",
! "SteamVolcanoDusk.jpg",
! "SubmersiblePiscesV.jpg",
! "SwimmingPoolWater.jpg",
! "Waterfall.jpg",
! "WhaleRainbow.jpg"
! );
! if (isset($RandomPictures)) {
function my_srand($seed = '') {
static $wascalled = FALSE;
--- 3,71 ----
rcs_id('$Id$');
! // FIXME: This whole file could be refactored and turned in a
! // RandomImage plugin.
! //
! // Performace issues? $SignatureImg does not appear on
! // every page but index.php is loaded every time
! // index.php -> themeinfo.php -> random.php
! //
! /*
! $RandomPictures = array("BeachPalmDusk.jpg", "Coastline.jpg",
! "HawaiiMauiFromSpace.jpg", "LavaTwilight.jpg",
! "LoihiSeamount.jpg", "SteamVolcanoDusk.jpg",
! "SubmersiblePiscesV.jpg", "SwimmingPoolWater.jpg",
! "Waterfall.jpg", "WhaleRainbow.jpg");
! */
!
! // Mac users take note:
! //
! // This function relies on all the image files having filename
! // suffixes, even if the web server uses a "MAGIC files" capability
! // (to automatically assign a mime-type based on the the first few
! // bytes of the file).
! //
! // This code is a variation of function LoadDir in lib/loadsave.php
! // See http://www.php.net/manual/en/function.readdir.php
!
! function imagelist($dirname) {
! if (empty($dirname)) {
! //ignore quietly
! //trigger_error(("dirname is empty"), E_USER_NOTICE);
! //$imagelist = "";
! } else {
! $handle = opendir($dir = $dirname);
! if (empty($handle)) {
! // FIXME: gettext doesn't work in index.php or themeinfo.php
! trigger_error(sprintf(("Unable to open directory '%s' for reading"),
! $dir), E_USER_NOTICE);
! //$imagelist = "";
! } else {
! $imagelist = array();
! while ($fn = readdir($handle)) {
!
! if ($fn[0] == '.' || filetype("$dir/$fn") != 'file')
! continue;
! // FIXME: Use $InlineImages instead of just ".jpg" hardcoded.
! if (substr($fn,-4) == ".jpg")
! array_push($imagelist, "$fn");
!
! }
! closedir($handle);
! }
! }
! return $imagelist;
! }
!
! // FIXME: Will this need to be changed to work on WindowsOS?
! $RandomPictures = imagelist( getcwd() ."/" ."themes/$theme/pictures/" );
!
! if (!empty($RandomPictures)) {
!
! // mt_srand ((double) microtime() * 1000000 / pi())
! //
! // Not random enough... Hmm is this random enough? See
! // http://download.php.net/manual/en/function.srand.php
!
function my_srand($seed = '') {
static $wascalled = FALSE;
***************
*** 32,36 ****
my_srand();
! $SignatureImg = "themes/$theme/pictures/" . $RandomPictures[mt_rand(0,count($RandomPictures)-1)];
}
--- 78,88 ----
my_srand();
!
! // For testing the randomization out, just use $logo instead
! // of #Signature
!
! // $logo = "themes/$theme/pictures/"
! $SignatureImg = "themes/$theme/pictures/"
! . $RandomPictures[mt_rand(0,count($RandomPictures)-1)];
}
|