This repository has been archived by the owner on Jun 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
imagedb.inc.php
executable file
·73 lines (64 loc) · 1.62 KB
/
imagedb.inc.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
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
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/* TODO it would be hot to pass stored session information in the database to limit extraneous object generation */
/* figure out where we are in the world */
// FIXME -- this breaks when included from within subdirectories! (e.g. imagedb.js.php)
//define ("IMAGEDB_PATH", dirname(__FILE__));
//define ("IMAGEDB_URL", dirname($_SERVER["PHP_SELF"]));
define("IMAGEDB_PATH", "/Volumes/Users Volume/Users/seth/Sites/sandbox/imagedb");
define("IMAGEDB_URL", "/sandbox/imagedb");
require_once (IMAGEDB_PATH . "/config.inc.php");
require_once (IMAGEDB_PATH . "/includes.inc.php");
include_once (IMAGEDB_PATH . "/plugins.inc.php");
/* initialize the objects used to build pages */
$IDB = new Container (new Database (MYSQL_SERVER, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE));
if (isset($IDB) == false)
{
exit;
}
if (isset($_REQUEST["container"]))
{
try
{
$CONTAINER = new Container((int) $_REQUEST["container"], $IDB);
}
catch (ExceptionContainer $e)
{
unset ($CONTAINER);
}
}
if (isset($_REQUEST["image"]))
{
try
{
if (isset($CONTAINER))
$ITEM = new Image((int) $_REQUEST["image"], $CONTAINER);
else
$ITEM = new Image((int) $_REQUEST["image"], $IDB);
}
catch (ExceptionContainer $e)
{
unset ($ITEM);
}
if (isset($ITEM) && isset($CONTAINER) == false)
$CONTAINER = $ITEM->getContainer();
}
if (isset($_REQUEST["path"]))
{
if (isset($CONTAINER))
{
$PATH = urldecodePath ($_REQUEST["path"], $CONTAINER);
if (isImagePath($_REQUEST["path"]) && isset($ITEM) == false)
{
try
{
$ITEM = new Image ($PATH, $CONTAINER);
}
catch (ExceptionPath $e)
{
unset ($PATH);
unset ($ITEM);
}
}
}
}
?>