rendered paste body<?php/*** @version 0.1 $* @package rollerpics* @copyright (C) 2006 danceskater* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL*/// no direct accessdefined( '_VALID_MOS' ) or die( 'Restricted access' );class HTML_rollerpics { // show a list of available galleries function function showGalleries( $row ) { global $mosConfig_live_site, $params, $Itemid; ?> <ul> <?php foreach ($row as $value) { ?> <li> <b> <?php $link = 'index.php?option=com_rollerpics&id='. $value->id .'&Itemid=' . $Itemid; echo '<a href=" ' . $link . '">' . $value->title . '</a>'; ?> </b> </li> <?php } ?> </ul> <?php } // show thumbnails from a single gallerie function function showThumbs( $id, $folder, $title, $description, $page ) { global $mosConfig_live_site, $params, $Itemid; // number of pictures on index page $layout = $params->get( 'cols' ) * $params->get( 'rows' ); $basedir = $params->get( 'fold' ) . '/' . $folder . '/'; echo $title; // get page number from url if ($page < 1) { $page = 1; } $query = $page * $layout - ($layout-1); for ( $i=0; $i < $layout; $i++){ $image[] = sprintf( '%02d', intval($query+$i) ); } ?> <table align="center" border="0"> <tr> <td align="center"><p>Page <?php echo $page; ?></p></td> <td align="center"><p><?php ?></p></td> <td align="center"> <?php $fname = $folder . '-' . ($query+$layout) . '.jpg'; $nextfile = $basedir . $fname; if (file_exists( $nextfile )) { $page = $page+1; $link = 'index.php?option=com_rollerpics&id='. $id .'&page=' . $page . '&Itemid=' . $Itemid; echo '<a href=" ' . $link . '"> [next page]</a>'; } else { $link = 'index.php?option=com_rollerpics&Itemid=' . $Itemid; echo '<a href=" ' . $link . '"> [gallery index]</a>'; }; ?> </td> </tr> <?php $i=0; for ( $r=1; $r <= $rows; $r++){ ?> <tr> <?php for ( $c=1; $c <= $cols; $c++){ ?> <td><?php $fname = $folder . '-' . ($image[$i]) . '.jpg'; $localfile = $basedir . $fname; if (file_exists( $localfile )) { $link = 'index.php?option=com_rollerpics&id='. $id .'&img_id=' . $image[$i] . '&Itemid=' . $Itemid; $tn = $basedir . 'tn-' . $folder . '-' . $image[$i] . '.jpg'; echo '<a href="' . $link . '"><img src="' . $tn . '" width=150 height=100 border=0 alt="Click Here"></a></td>'; } else { ?> </td> <?php } //end of if statement $i++; } //end of $c for loop ?> </tr> <?php } //end of $r for loop ?> </table> <?php } // display the image function function displayImage( $img_id, $id, $folder, $title, $description, $page ) { global $mosConfig_live_site, $params, $Itemid; // get folder name from url $basedir = $params->get( 'fold' ) . '/' . $folder . '/'; // check for next image $query = $img_id; $query = ($query+1); $idn = sprintf( '%02d', intval( $query ) ); // 01 --> 99 $fname = $folder . '-' . $idn . '.jpg'; $nextfile = $basedir . $fname; // check for prev image $query = $img_id; $query = ($query-1); $idp = sprintf( '%02d', intval( $query ) ); // 01 --> 99 $fname = $folder . '-' . $idp . '.jpg'; $prevfile = $basedir . $fname; // get image number $query = $img_id; $idl = sprintf( '%02d', intval( $query ) ); // 01 --> 99 $fname = $folder . '-' . $idl . '.jpg'; $localfile = $basedir . $fname; // file exists, run the html that displays it if (file_exists( $localfile )) { $imageurl = $basedir . $fname; ?> <table border="0" cellpadding="0" cellspacing="0" align="center"> <tr><td width="640"><?php echo $title; ?></td></tr> <tr> <td> <div align="center"> <!-- test [prev/next] with $nextfile/$prevfile and display correct link --> <?php if (file_exists( $prevfile )) { $link = 'index.php?option=com_rollerpics&id='. $id .'&img_id=' . $idp . '&Itemid=' . $Itemid; echo '<a href="' . $link . '"> [prev] </a>' ; ?> <?php } else { }; $link = 'index.php?option=com_rollerpics&id='. $id .'&Itemid=' . $Itemid; echo '<a href="' . $link . '"> [index] </a>' ; ?> <?php if (file_exists( $nextfile )) { $link = 'index.php?option=com_rollerpics&id='. $id .'&img_id=' . $idn . '&Itemid=' . $Itemid; echo '<a href="' . $link . '"> [next] </a>' ; ?> <?php } else { }; ?> </div> </td> </tr> <!-- display photo --> <tr height="500"> <td> <div align="center"> <img src="<?php echo $imageurl; ?>" border="0"> </div> </td> </tr> <tr> <td> <div align="center"> <!-- test [prev/next] with $nextfile/$prevfile and display correct link --> <?php if (file_exists( $prevfile )) { $link = 'index.php?option=com_rollerpics&id='. $id .'&img_id=' . $idp . '&Itemid=' . $Itemid; echo '<a href="' . $link . '"> [prev] </a>' ; ?> <?php } else { }; $link = 'index.php?option=com_rollerpics&id='. $id .'&Itemid=' . $Itemid; echo '<a href="' . $link . '"> [index] </a>' ; ?> <?php if (file_exists( $nextfile )) { $link = 'index.php?option=com_rollerpics&id='. $id .'&img_id=' . $idn . '&Itemid=' . $Itemid; echo '<a href="' . $link . '"> [next] </a>' ; ?> <?php } else { }; ?> </div> </td> </tr> </table> <?php // if localfile not exist show gallery-index page (currently broken) } else { include('rollerpics.php'); } } // end of display function }?>