summaryrefslogtreecommitdiff
path: root/includes/image_lookup_inc.php
diff options
context:
space:
mode:
authormodela bitweaver <spiderr@bitweaver.org>2021-02-02 12:10:53 -0500
committermodela bitweaver <spiderr@bitweaver.org>2021-02-02 12:10:53 -0500
commit5c6319e71df90b5adf98d145c06095d64356c311 (patch)
tree5bf6435af4caed312727916a458df6474b0169c3 /includes/image_lookup_inc.php
parent1086b09bdce0b69ea6bf1c931cc0b6f3967921da (diff)
downloadfisheye-5c6319e71df90b5adf98d145c06095d64356c311.tar.gz
fisheye-5c6319e71df90b5adf98d145c06095d64356c311.tar.bz2
fisheye-5c6319e71df90b5adf98d145c06095d64356c311.zip
move _inc and classes to includes/classes and use PKG_CLASS/INCLUDE_PATH constants
Diffstat (limited to 'includes/image_lookup_inc.php')
-rw-r--r--includes/image_lookup_inc.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/includes/image_lookup_inc.php b/includes/image_lookup_inc.php
new file mode 100644
index 0000000..8de4b0e
--- /dev/null
+++ b/includes/image_lookup_inc.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * @version $Header$
+ * @package fisheye
+ * @subpackage functions
+ */
+
+global $gContent, $gGallery;
+
+
+if( $gContent = FisheyeImage::lookup( $_REQUEST ) ) {
+ // nothing to do. ::lookup will do a full load
+} else {
+ $gContent = new FisheyeImage();
+ $imageId = NULL;
+}
+
+if( !empty( $_REQUEST['gallery_path'] ) ) {
+ $_REQUEST['gallery_path'] = rtrim( $_REQUEST['gallery_path'], '/' );
+ $gContent->setGalleryPath( $_REQUEST['gallery_path'] );
+ $matches = array();
+ $tail = strrpos( $_REQUEST['gallery_path'], '/' );
+ $_REQUEST['gallery_id'] = substr( $_REQUEST['gallery_path'], $tail + 1 );
+}
+if( empty( $_REQUEST['gallery_id'] ) ) {
+ if( $parents = $gContent->getParentGalleries() ) {
+ $gal = current( $parents );
+ $gContent->setGalleryPath( '/'.$gal['gallery_id'] );
+ $_REQUEST['gallery_id'] = $gal['gallery_id'];
+ }
+}
+// the image is considered the primary content, however the gallery is useful
+if( !empty($_REQUEST['gallery_id']) && is_numeric($_REQUEST['gallery_id']) ) {
+ $gGallery = FisheyeGallery::lookup( $_REQUEST );
+ $gBitSmarty->assignByRef('gGallery', $gGallery);
+ $gBitSmarty->assignByRef('galleryId', $_REQUEST['gallery_id']);
+}
+
+// This user does not own this gallery and they have not been granted the permission to edit this gallery
+$gContent->verifyViewPermission();
+
+$gBitSmarty->assignByRef('gContent', $gContent);
+$gBitSmarty->assignByRef('imageId', $gContent->mImageId );
+
+
+?>