| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @author Mambo Foundation Inc see README.php 5 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 6 * See COPYRIGHT.php for copyright notices and details. 7 * @license GNU/GPL Version 2, see LICENSE.php 8 * 9 * Redistributions of files must retain the above copyright notice. 10 * 11 * Mambo is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation; version 2 of the License. 14 */ 15 16 /** ensure this file is being included by a parent file */ 17 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 18 19 global $mosConfig_absolute_path, $mosConfig_live_site; 20 21 $type = $params->get( 'type', 'jpg' ); 22 $folder = $params->get( 'folder' ); 23 $link = $params->get( 'link' ); 24 $width = $params->get( 'width' ); 25 $height = $params->get( 'height' ); 26 $moduleclass_sfx = $params->get( 'moduleclass_sfx' ); 27 28 $abspath_folder = $mosConfig_absolute_path .'/'. $folder; 29 $the_array = array(); 30 $the_image = array(); 31 32 if (is_dir($abspath_folder)) { 33 if ($handle = opendir($abspath_folder)) { 34 while (false !== ($file = readdir($handle))) { 35 if ($file != '.' && $file != '..' && $file != 'CVS' && $file != 'index.html' ) { 36 $the_array[] = $file; 37 } 38 } 39 } 40 closedir($handle); 41 42 foreach ($the_array as $img) { 43 if (!is_dir($abspath_folder .'/'. $img)) { 44 if (eregi($type, $img)) { 45 $the_image[] = $img; 46 } 47 } 48 } 49 50 if (!$the_image) { 51 echo 'No images'; 52 } else { 53 54 $i = count($the_image); 55 $random = mt_rand(0, $i - 1); 56 $image_name = $the_image[$random]; 57 58 $i = $abspath_folder . '/'. $image_name; 59 $size = getimagesize ($i); 60 61 if ($width == '') { 62 $width = 100; 63 } 64 if ($height == '') { 65 $coeff = $size[0]/$size[1]; 66 $height = (int) ($width/$coeff); 67 } 68 69 $image = $mosConfig_live_site .'/'. $folder .'/'. $image_name; 70 71 if ($link) { 72 echo "<a href=\"" . $link . "\" target=\"_self\">\n"; 73 } 74 75 } 76 ?> 77 <div align="center"> 78 <?php 79 if ($link) { 80 ?> 81 <a href="<?php echo $link; ?>" target="_self"> 82 <?php 83 } 84 ?> 85 <?php if (isset($image, $image_name, $folder)) { ?> 86 <img src="<?php echo $image; ?>" border="0" width="<?php echo $width; ?>" height="<?php echo $height; ?>" alt="<?php echo $image_name; ?>" /><br /> 87 <?php 88 if ($link) { 89 ?> 90 </a> 91 <?php 92 } 93 } 94 ?> 95 </div> 96 <?php 97 } 98 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |