summaryrefslogtreecommitdiff
path: root/display_fisheye_gallery_inc.php
blob: 5cc3b6dd770931497751fa84b7dd9a85b56d5043 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
 * @version $Header: /cvsroot/bitweaver/_bit_fisheye/display_fisheye_gallery_inc.php,v 1.3 2005/08/01 18:40:07 squareing Exp $
 * @package fisheye
 * @subpackage functions
 */

if( !$gContent->hasUserAccess( 'bit_p_view_fisheye' ) ) {
	if ( !empty($_REQUEST['submit_answer'])) {	// User is attempting to authenticate themseleves to view this gallery
		if( !$gContent->validateUserAccess( $_REQUEST['try_access_answer']) ) {
			$gBitSmarty->assign("failedLogin", "Incorrect Answer");
			$gBitSystem->display("bitpackage:fisheye/authenticate.tpl", "Password Required to view: ".$gContent->getTitle() );
			die;
		}
	} else {
		if( !empty( $gContent->mInfo['access_answer'] ) ) {
			$gBitSystem->display("bitpackage:fisheye/authenticate.tpl", "Password Required to view: ".$gContent->getTitle() );
			die;
		}
		$gBitSystem->fatalError( tra( "You cannot view this image gallery" ) );
	}
}

/**
 * categories setup
 */
if( $gBitSystem->isPackageActive( 'categories' ) ) {
	$cat_obj_type = FISHEYEGALLERY_CONTENT_TYPE_GUID;
	$cat_objid =$gContent->mContentId;
	include_once( CATEGORIES_PKG_PATH.'categories_display_inc.php' );
}


if (!empty($_REQUEST['page']) && is_numeric($_REQUEST['page'])) {
	$page = $_REQUEST['page'];
} else {
	$page = 0;
}

if ($page > $gContent->mInfo['num_pages']) {
	$page = $gContent->mInfo['num_pages'];
} elseif ($page < 1) {
	$page = 1;
}

$imagesPerPage = $gContent->mInfo['rows_per_page'] * $gContent->mInfo['cols_per_page'];
$imageOffset = $imagesPerPage * ($page-1);

$gBitSmarty->assign_by_ref('page', $page);
$gBitSmarty->assign_by_ref('imagesPerPage', $imagesPerPage);
$gBitSmarty->assign_by_ref('imageOffset', $imageOffset);
$gBitSmarty->assign_by_ref('rows_per_page', $gContent->mInfo['rows_per_page']);
$gBitSmarty->assign_by_ref('cols_per_page', $gContent->mInfo['cols_per_page']);

$gContent->loadImages($imageOffset, $imagesPerPage);
$gContent->addHit();

$gBitSystem->setBrowserTitle( $gContent->getTitle().' '.tra('Gallery') );
$gBitSystem->display("bitpackage:fisheye/view_gallery.tpl");

?>