forked from powdahound/s3browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
31 lines (25 loc) · 945 Bytes
/
index.php
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
<?php
define('ROOT_DIR', dirname(__FILE__));
require ROOT_DIR.'/include/S3Browser.php';
// Load config
$configFile = ROOT_DIR.'/config.php';
if (!file_exists($configFile)) {
die('config.php is missing. See config-sample.php');
}
$config = include($configFile);
if (!$config['bucket-name'] || !$config['s3-access-key'] ||
!$config['s3-secret-key']) {
die('Please set bucket-name, s3-access-key, and s3-secret-key in'.
' config.php');
}
$s3b = new S3Browser($config['bucket-name'], $config['s3-access-key'],
$config['s3-secret-key']);
$s3b->enableCaching($config['cache-dir'], $config['cache-time']);
// Get current directory from URL
$dir = str_replace($config['base-path'], '', $_SERVER['REQUEST_URI']);
$dir = urldecode($dir);
$files = $s3b->getFiles($dir);
if ($files === null) {
die('Unable to load bucket: '.$config['bucket-name']);
}
include ROOT_DIR.'/themes/'.$config['theme'].'/index.tpl.php';