summaryrefslogtreecommitdiff
path: root/main.php
blob: 9b57f6be223076fa506385aefbaa0327149f2105 (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
<?php
/**
* Gallery2 Remote support for fisheye
*
* @package  fisheye
* @version  $Header$
* @author   spider <spider@steelsun.com>
* @author   tylerbello <tylerbello@gmail.com>
*/

// +----------------------------------------------------------------------+
// | Copyright (c) 2004, bitweaver.org
// +----------------------------------------------------------------------+
// | All Rights Reserved. See below for details and a complete list of authors.
// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
// |
// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
// | -> see http://phpdocu.sourceforge.net/
// +----------------------------------------------------------------------+
// | Authors: spider <spider@steelsun.com>
// +----------------------------------------------------------------------+

/**
 * Setup
 */
namespace Bitweaver\Fisheye;

chdir( dirname( __FILE__ ) );
require_once '../kernel/includes/setup_inc.php';
use Bitweaver\KernelTools;

//Point of access for FisheyeRemote requests
$gFisheyeRemote = new FisheyeRemote();

// Fisheye allows directories to below to multiple parents - not in gallery. This confuses some clients
// We pad with a random number for uniqueness
foreach( [ 'g2_itemId', 'set_albumName' ] as $key ) {
	if( !empty( $_POST['g2_form'][$key] ) && $_POST['g2_form'][$key] > 1 ) {
		$_POST['g2_form'][$key] = substr( $_POST['g2_form'][$key], 0, strlen( $_POST['g2_form'][$key] ) - 2 );
	}
	if( !empty( $_GET['g2_form'][$key] ) && $_GET['g2_form'][$key] > 1 ) {
		$_GET['g2_form'][$key] = substr( $_GET['g2_form'][$key], 0, strlen( $_GET['g2_form'][$key] ) - 2 );
	}
	if( !empty( $_REQUEST[$key] ) && $_REQUEST[$key] > 1 ) {
		$_REQUEST[$key] = substr( $_REQUEST[$key], 0, strlen( $_REQUEST[$key] ) - 2 );
	}
}

if( !empty( $_REQUEST['g2_form'] ) ){
	$gFisheyeRemote->processRequest( !empty( $_GET['g2_form'] ) ? $_GET['g2_form'] : [], !empty( $_POST['g2_form'] ? $_POST['g2_form'] : []) );
} elseif( !empty( $_REQUEST['g2_itemId'] ) ) {
	//If we don't have g2_form, they must be asking the gallery to be opened upon export completion
	$gallery = new FisheyeGallery();
	$gallery = $gallery->lookup(['content_id' => $_REQUEST['g2_itemId'] ]);
	KernelTools::bit_redirect( $gallery->getDisplayUrl() );
}