Changeset 550 for trunk/gallery.php
- Timestamp:
- 06/30/08 13:45:19 (4 years ago)
- File:
-
- 1 edited
-
trunk/gallery.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gallery.php
r546 r550 1 1 <?php 2 #error_reporting(E_ALL); 3 include_once(dirname(__FILE__)."/plog-load_config.php"); 4 //include("plog-globals.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 following 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 // Some Estonian remarks was here ?!? 60 61 define('THEME_DIR', dirname(__FILE__) . '/themes/' . $config['theme_dir']); 62 define('THEME_URL', $config['theme_url']); 2 /* This is a backwords compatible file to make old installations work correctly */ 3 include_once(dirname(__FILE__)."/plogger.php"); 63 4 64 5 function the_gallery_head() { 65 plogger_head(); 66 67 $use_file = 'head.php'; 68 if (file_exists(THEME_DIR . "/" . $use_file)) { 69 include(THEME_DIR . "/" . $use_file); 70 } else { 71 include(dirname(__FILE__).'/themes/default/'.$use_file); 72 } 6 return the_plogger_gallery_head(); 73 7 } 74 8 75 9 function the_gallery(){ 76 // collections mode (show all albums within a collection) 77 // it's the default 78 $use_file = "collections.php"; 79 if ($GLOBALS['plogger_level'] == "picture"){ 80 $use_file = 'picture.php'; 81 } 82 elseif ($GLOBALS['plogger_level'] == "search"){ 83 if ($GLOBALS['plogger_mode'] == "slideshow") { 84 $use_file = 'slideshow.php'; 85 } else { 86 $use_file = 'search.php'; 87 } 88 } 89 elseif ($GLOBALS['plogger_level'] == "album") { 90 // Album level display mode (display all pictures within album) 91 if ($GLOBALS['plogger_mode'] == "slideshow") { 92 $use_file = 'slideshow.php'; 93 } else { 94 $use_file = 'album.php'; 95 } 96 } 97 else if ($GLOBALS['plogger_level'] == "collection") { 98 $use_file = 'collection.php'; 99 } 100 101 // if the theme does not have the requested file, then use the one from the default template 102 if (file_exists(THEME_DIR . "/" . $use_file)) { 103 include(THEME_DIR . "/" . $use_file); 104 } else { 105 include(dirname(__FILE__).'/themes/default/'.$use_file); 106 } 107 } 10 return the_plogger_gallery(); 11 } 108 12 ?>
Note: See TracChangeset
for help on using the changeset viewer.
