1 | <?php
|
---|
2 | #error_reporting(E_ALL);
|
---|
3 | include("plog-globals.php");
|
---|
4 | include_once("plog-load_config.php");
|
---|
5 | include_once("plog-functions.php");
|
---|
6 |
|
---|
7 | global $config;
|
---|
8 |
|
---|
9 | // process path here - is set if mod_rewrite is in use
|
---|
10 | if (!empty($_REQUEST["path"])) {
|
---|
11 | // the followling line calculates the path in the album and excludes any subdirectories if
|
---|
12 | // Plogger is installed in one
|
---|
13 | $path = join("/",array_diff(explode("/",$_SERVER["REQUEST_URI"]),explode("/",$_SERVER["PHP_SELF"])));
|
---|
14 | $resolved_path = resolve_path($path);
|
---|
15 | if (is_array($resolved_path)) {
|
---|
16 | $_GET["level"] = $resolved_path["level"];
|
---|
17 | $_GET["id"] = $resolved_path["id"];
|
---|
18 | if (isset($resolved_path['mode'])) {
|
---|
19 | $_GET['mode'] = $resolved_path['mode'];
|
---|
20 | };
|
---|
21 |
|
---|
22 | // get page number from url, if present
|
---|
23 | $parts = parse_url($_SERVER["REQUEST_URI"]);
|
---|
24 | if (isset($parts["query"])) {
|
---|
25 | parse_str($parts["query"],$query_parts);
|
---|
26 | if (!empty($query_parts["plog_page"])) $_GET["plog_page"] = $query_parts["plog_page"];
|
---|
27 | };
|
---|
28 | $path = $parts["path"];
|
---|
29 | };
|
---|
30 | };
|
---|
31 |
|
---|
32 | // Set sorting session variables if they are passed
|
---|
33 | if (isset($_GET['sortby'])) {
|
---|
34 | $_SESSION['plogger_sortby'] = $_GET['sortby'];
|
---|
35 | };
|
---|
36 |
|
---|
37 | if (isset($_GET['sortdir'])) {
|
---|
38 | $_SESSION['plogger_sortdir'] = $_GET['sortdir'];
|
---|
39 | };
|
---|
40 |
|
---|
41 | // The three GET parameters that it accepts are
|
---|
42 | // $level = "collection", "album", or "picture"
|
---|
43 | // $id = id number of collection, album, or picture
|
---|
44 | // $n = starting element (for pagination) go from n to n + max_thumbs (in global config)
|
---|
45 |
|
---|
46 | // use plogger specific variables to avoid name clashes if Plogger is embedded
|
---|
47 |
|
---|
48 |
|
---|
49 |
|
---|
50 | $GLOBALS['plogger_level'] = isset($_GET["level"]) ? $_GET["level"] : '';
|
---|
51 | $GLOBALS['plogger_id'] = isset($_GET["id"]) ? intval($_GET["id"]) : 0;
|
---|
52 | $GLOBALS['plogger_mode'] = isset($_GET["mode"]) ? $_GET["mode"] : '';
|
---|
53 |
|
---|
54 | $allowed_levels = array('collections','collection','album','picture','search');
|
---|
55 | if (!in_array($GLOBALS['plogger_level'],$allowed_levels)) {
|
---|
56 | $GLOBALS['plogger_level'] = 'collections';
|
---|
57 | };
|
---|
58 |
|
---|
59 | // niisiis, mul on need 2 funktsiooni ja ma pean need mergema
|
---|
60 | // vana mingi teise failiga, et ma saaks plogger korrektselt integreerida
|
---|
61 | // noh, proovime siis.
|
---|
62 |
|
---|
63 | define('THEME_DIR', dirname(__FILE__) . '/themes/' . $config['theme_dir']);
|
---|
64 | define('THEME_URL', $config['theme_url']);
|
---|
65 |
|
---|
66 | function the_gallery_head() {
|
---|
67 | plogger_head();
|
---|
68 |
|
---|
69 | $use_file = 'head.php';
|
---|
70 | if (file_exists(THEME_DIR . "/" . $use_file)) {
|
---|
71 | include(THEME_DIR . "/" . $use_file);
|
---|
72 | } else {
|
---|
73 | include(dirname(__FILE__).'/themes/default/'.$use_file);
|
---|
74 | }
|
---|
75 | }
|
---|
76 |
|
---|
77 | function the_gallery(){
|
---|
78 | // collections mode (show all albums within a collection)
|
---|
79 | // it's the default
|
---|
80 | $use_file = "collections.php";
|
---|
81 | if ($GLOBALS['plogger_level'] == "picture"){
|
---|
82 | $use_file = 'picture.php';
|
---|
83 | }
|
---|
84 | elseif ($GLOBALS['plogger_level'] == "search"){
|
---|
85 | if ($GLOBALS['plogger_mode'] == "slideshow") {
|
---|
86 | $use_file = 'slideshow.php';
|
---|
87 | } else {
|
---|
88 | $use_file = 'search.php';
|
---|
89 | };
|
---|
90 | }
|
---|
91 | elseif ($GLOBALS['plogger_level'] == "album") {
|
---|
92 | // Album level display mode (display all pictures within album)
|
---|
93 | if ($GLOBALS['plogger_mode'] == "slideshow") {
|
---|
94 | $use_file = 'slideshow.php';
|
---|
95 | } else {
|
---|
96 | $use_file = 'album.php';
|
---|
97 | };
|
---|
98 | }
|
---|
99 | else if ($GLOBALS['plogger_level'] == "collection") {
|
---|
100 | $use_file = 'collection.php';
|
---|
101 | };
|
---|
102 |
|
---|
103 | // if the theme does not have the requested file, then use the one from the default template
|
---|
104 | if (file_exists(THEME_DIR . "/" . $use_file)) {
|
---|
105 | include(THEME_DIR . "/" . $use_file);
|
---|
106 | } else {
|
---|
107 | include(dirname(__FILE__).'/themes/default/'.$use_file);
|
---|
108 | }
|
---|
109 | }
|
---|
110 | ?>
|
---|