PageRenderTime 46ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/themes/stopdesign/index.php

https://github.com/dirkhusemann/zenphoto
PHP | 217 lines | 213 code | 4 blank | 0 comment | 28 complexity | e771359e57585001c4a93923cb813fad MD5 | raw file
  1. <?php
  2. if (!defined('WEBPATH')) die();
  3. require_once('normalizer.php');
  4. header('Last-Modified: ' . gmdate('D, d M Y H:i:s').' GMT');
  5. ?>
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  8. <head>
  9. <?php zp_apply_filter('theme_head'); ?>
  10. <title><?php echo getBareGalleryTitle(); ?></title>
  11. <meta http-equiv="content-type" content="text/html; charset=<?php echo getOption('charset'); ?>" />
  12. <link rel="stylesheet" type="text/css" media="screen, projection" href="<?php echo $_zp_themeroot ?>/css/master.css" />
  13. <?php
  14. printRSSHeaderLink('Gallery','Gallery RSS');
  15. setOption('thumb_crop_width', 85, false);
  16. setOption('thumb_crop_height', 85, false);
  17. $archivepageURL = html_encode(getGalleryIndexURL());
  18. ?>
  19. </head>
  20. <body class="index">
  21. <?php zp_apply_filter('theme_body_open'); ?>
  22. <?php echo getGalleryTitle(); ?><?php if (getOption('Allow_search')) { printSearchForm(''); } ?>
  23. <div id="content">
  24. <h1><?php echo getGalleryTitle(); ?></h1>
  25. <div class="galleries">
  26. <h2><?php echo gettext('Recently Updated Galleries'); ?></h2>
  27. <ul>
  28. <?php
  29. $counter = 0;
  30. setOption('gallery_sorttype', 'ID', false); // set the sort type so we get most recent albums
  31. setOption('gallery_sortdirection', '1', false);
  32. while (next_album() and $counter < 6):
  33. ?>
  34. <li class="gal">
  35. <h3><a href="<?php echo html_encode(getAlbumLinkURL());?>" title="<?php printf(gettext("View album: %s"),getAnnotatedAlbumTitle()); ?>"><?php printAlbumTitle(); ?></a></h3>
  36. <a href="<?php echo html_encode(getAlbumLinkURL());?>" title="<?php printf(gettext("View album: %s"), getAnnotatedAlbumTitle());?>" class="img"><?php printCustomAlbumThumbImage(getAnnotatedAlbumTitle(), null, 210, 59, getOption('Gallery_image_crop_width'), getOption('Gallery_image_crop_height')); ?></a>
  37. <p>
  38. <?php
  39. $anumber = getNumAlbums();
  40. $inumber = getNumImages();
  41. if ($anumber > 0 || $inumber > 0) {
  42. echo '<p><em>(';
  43. if ($anumber == 0) {
  44. if ($inumber != 0) {
  45. printf(ngettext('%u photo','%u photos', $inumber), $inumber);
  46. }
  47. } else if ($anumber == 1) {
  48. if ($inumber > 0) {
  49. printf(ngettext('1 album,&nbsp;%u photo','1 album,&nbsp;%u photos', $inumber), $inumber);
  50. } else {
  51. printf(gettext('1 album'));
  52. }
  53. } else {
  54. if ($inumber == 1) {
  55. printf(ngettext('%u album,&nbsp;1 photo','%u albums,&nbsp;1 photo', $anumber), $anumber);
  56. } else if ($inumber > 0) {
  57. printf(ngettext('%1$u album,&nbsp;%2$s','%1$u albums,&nbsp;%2$s', $anumber), $anumber, sprintf(ngettext('%u photo','%u photos',$inumber),$inumber));
  58. } else {
  59. printf(ngettext('%u album','%u albums', $anumber), $anumber);
  60. }
  61. }
  62. echo ')</em><br />';
  63. }
  64. $text = getAlbumDesc();
  65. if(strlen($text) > 50) {
  66. $text = preg_replace("/[^ ]*$/", '', sanitize(substr($text, 0, 50),1)) . "...";
  67. }
  68. echo $text;
  69. ?></p>
  70. <div class="date"><?php printAlbumDate(); ?></div>
  71. </li>
  72. <?php
  73. if ($counter == 2) {
  74. echo "</ul><ul>";
  75. }
  76. $counter++;
  77. endwhile;
  78. ?>
  79. </ul>
  80. <p class="mainbutton"><a href="<?php echo $archivepageURL; ?>" class="btn"><img src="<?php echo $_zp_themeroot ?>/images/btn_gallery_archive.gif" width="118" height="21" alt="<?php echo gettext('Gallery Archive'); ?>" /></a></p>
  81. </div>
  82. <div id="secondary">
  83. <div class="module">
  84. <h2>Description</h2>
  85. <?php printGalleryDesc(); ?>
  86. </div>
  87. <div class="module">
  88. <?php $selector = getOption('Mini_slide_selector'); ?>
  89. <ul id="randomlist">
  90. <?php
  91. switch($selector) {
  92. case 'Recent images':
  93. if (function_exists('getImageStatistic')) {
  94. echo '<h2>'.gettext('Recent images').'</h2>';
  95. $images = getImageStatistic(12, "latest");
  96. $c = 0;
  97. foreach ($images as $image) {
  98. if (is_valid_image($image->filename)) {
  99. if ($c++ < 6) {
  100. echo "<li><table><tr><td>\n";
  101. $imageURL = html_encode(getURL($image));
  102. if ($image->getWidth() >= $image->getHeight()) {
  103. $iw = 44;
  104. $ih = NULL;
  105. $cw = 44;
  106. $ch = 33;
  107. } else {
  108. $iw = NULL;
  109. $ih = 44;
  110. $ch = 44;
  111. $cw = 33;
  112. }
  113. echo '<a href="'.$imageURL.'" title="'.gettext("View image:").' '.
  114. html_encode($image->getTitle()) . '"><img src="' .
  115. html_encode($image->getCustomImage(NULL, $iw, $ih, $cw, $ch, NULL, NULL, true)) .
  116. '" alt="' . html_encode($image->getTitle()) . "\"/></a>\n";
  117. echo "</td></tr></table></li>\n";
  118. }
  119. }
  120. }
  121. break;
  122. }
  123. case 'Random images':
  124. echo '<h2>'.gettext('Random images').'</h2>';
  125. for ($i=1; $i<=6; $i++) {
  126. echo "<li><table><tr><td>\n";
  127. $randomImage = getRandomImages();
  128. if (is_object($randomImage)) {
  129. $randomImageURL = html_encode(getURL($randomImage));
  130. if ($randomImage->getWidth() >= $randomImage->getHeight()) {
  131. $iw = 44;
  132. $ih = NULL;
  133. $cw = 44;
  134. $ch = 33;
  135. } else {
  136. $iw = NULL;
  137. $ih = 44;
  138. $ch = 44;
  139. $cw = 33;
  140. }
  141. echo '<a href="' . $randomImageURL . '" title="'.gettext("View image:").' ' . html_encode($randomImage->getTitle()) . '">' .
  142. '<img src="' . html_encode($randomImage->getCustomImage(NULL, $iw, $ih, $cw, $ch, NULL, NULL, true)) .
  143. '" alt="'.html_encode($randomImage->getTitle()).'"';
  144. echo "/></a></td></tr></table></li>\n";
  145. }
  146. }
  147. break;
  148. }
  149. ?>
  150. </ul>
  151. </div>
  152. <div class="module">
  153. <h2><?php echo gettext("Gallery data"); ?></h2>
  154. <table cellspacing="0" class="gallerydata">
  155. <tr>
  156. <th><a href="<?php echo $archivepageURL; ?>"><?php echo gettext('Galleries'); ?></a></th>
  157. <td><?php $albumNumber = getNumAlbums(); echo $albumNumber ?></td>
  158. <td></td>
  159. </tr>
  160. <tr>
  161. <th><?php echo gettext('Photos'); ?></th>
  162. <td><?php $photosArray = query_single_row("SELECT count(*) FROM ".prefix('images')); $photosNumber = array_shift($photosArray); echo $photosNumber ?></td>
  163. <td><?php printRSSLink('Gallery','','','',true,'i'); ?></td>
  164. </tr>
  165. <?php if (function_exists('printCommentForm')) { ?>
  166. <tr>
  167. <th><?php echo gettext('Comments'); ?></th>
  168. <td><?php $commentsArray = query_single_row("SELECT count(*) FROM ".prefix('comments')." WHERE inmoderation = 0"); $commentsNumber = array_shift($commentsArray); echo $commentsNumber ?></td>
  169. <td><?php printRSSLink('Comments','','','',true,'i'); ?></td>
  170. </tr>
  171. <?php } ?>
  172. </table>
  173. </div>
  174. </div>
  175. </div>
  176. <p id="path">
  177. <?php printHomeLink('', ' > '); ?>
  178. <?php echo getGalleryTitle(); ?>
  179. </p>
  180. <div id="footer">
  181. <p>
  182. <?php
  183. if (function_exists('printContactForm')) {
  184. printCustomPageURL(gettext('Contact us'), 'contact', '', '');
  185. echo '<br />';
  186. }
  187. if (!zp_loggedin() && function_exists('printRegistrationForm')) {
  188. printCustomPageURL(gettext('Register for this site'), 'register', '', '');
  189. echo '<br />';
  190. }
  191. if (function_exists('printLanguageSelector')) {
  192. printLanguageSelector();
  193. echo '<br />';
  194. }
  195. ?>
  196. <?php echo gettext('<a href="http://stopdesign.com/templates/photos/">Photo Templates</a> from Stopdesign.'); ?>
  197. <?php printZenphotoLink(); ?>
  198. </p>
  199. <?php
  200. if (function_exists('printUserLogin_out')) {
  201. printUserLogin_out("");
  202. }
  203. ?>
  204. </div>
  205. <?php
  206. printAdminToolbox();
  207. zp_apply_filter('theme_body_close');
  208. ?>
  209. </body>
  210. </html>