summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-21 10:18:17 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-21 10:18:17 +0100
commitc1f8c88595ceb9746045b9376443246faac4c808 (patch)
tree70c53c480c77c88354f4c9db9946f85852aba6bf
parente65ef31360e434b5993c7e81d5557383a83f4466 (diff)
downloadfisheye-c1f8c88595ceb9746045b9376443246faac4c808.tar.gz
fisheye-c1f8c88595ceb9746045b9376443246faac4c808.tar.bz2
fisheye-c1f8c88595ceb9746045b9376443246faac4c808.zip
Tidy automatic generation of sitemap
-rw-r--r--sitemap.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/sitemap.php b/sitemap.php
new file mode 100644
index 0000000..dde3956
--- /dev/null
+++ b/sitemap.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * @package fisheye
+ * @subpackage functions
+ */
+
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\Fisheye\FisheyeGallery;
+use Bitweaver\Fisheye\FisheyeImage;
+
+$gBitSystem->verifyPackage( 'fisheye' );
+
+$gSiteMapHash = [];
+
+$gallery = new FisheyeGallery();
+$listHash = [ 'max_records' => -1, 'no_thumbnails' => true ];
+if( $galleries = $gallery->getList( $listHash ) ) {
+ foreach( $galleries as $row ) {
+ $url = FisheyeGallery::getDisplayUrlFromHash( $row );
+ if( empty( $url ) ) continue;
+ $gSiteMapHash['g'.$row['gallery_id']] = [
+ 'loc' => BIT_BASE_URI . $url,
+ 'lastmod' => date( 'Y-m-d', $row['last_modified'] ),
+ 'changefreq' => 'monthly',
+ 'priority' => 0.6,
+ ];
+ }
+}
+
+$image = new FisheyeImage();
+$listHash = [ 'max_records' => -1, 'no_thumbnails' => true ];
+if( $images = $image->getList( $listHash ) ) {
+ foreach( $images as $row ) {
+ $url = FisheyeImage::getDisplayUrlFromHash( $row );
+ if( empty( $url ) ) continue;
+ $gSiteMapHash['i'.$row['image_id']] = [
+ 'loc' => BIT_BASE_URI . $url,
+ 'lastmod' => date( 'Y-m-d', $row['last_modified'] ),
+ 'changefreq' => 'monthly',
+ 'priority' => 0.5,
+ ];
+ }
+}
+
+$gBitSmarty->assign( 'gSiteMapHash', $gSiteMapHash );
+$gBitThemes->setFormatHeader( 'xml' );
+header( 'Content-Type: application/xml; charset=utf-8' );
+$gBitSystem->display( 'bitpackage:kernel/sitemap.tpl' );