Changeset 550 for trunk

Show
Ignore:
Timestamp:
06/30/08 13:45:19 (5 months ago)
Author:
sidtheduck
Message:

+ BIG Plogger restructure
+ fixing miscellaneous small bug fixes (RSS validation, beginnings of $_GET switch script integration, etc.)

Location:
trunk
Files:
9 added
4 removed
69 modified
60 copied
18 moved

Legend:

Unmodified
Added
Removed
  • trunk/gallery.php

    r546 r550  
    11<?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 */ 
     3include_once(dirname(__FILE__)."/plogger.php"); 
    634 
    645function 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(); 
    737} 
    748 
    759function 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} 
    10812?> 
  • trunk/index.php

    r511 r550  
    33 * Plogger - A web based photo gallery 
    44 * Copyright (C) 2005 Mike Johnson 
    5  *  
     5 * 
    66 * This program is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or (at 
    99 * your option) any later version. 
    10  *  
     10 * 
    1111 * This program is distributed in the hope that it will be useful, but 
    1212 * WITHOUT ANY WARRANTY; without even the implied warranty of 
    1313 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
    1414 * General Public License for more details. 
    15  *  
     15 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
     
    2121<?php require("gallery.php"); ?> 
    2222<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    23  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    24   
    25 <html xml:lang="<?php echo $language; ?>" lang="<?php echo $language; ?>" xmlns="http://www.w3.org/1999/xhtml">  
     23        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     24 
     25<html xml:lang="<?php echo $language; ?>" lang="<?php echo $language; ?>" xmlns="http://www.w3.org/1999/xhtml"> 
    2626 
    2727        <head> 
     
    3030        </head> 
    3131 
    32         <body>  
     32        <body> 
    3333                <?php the_gallery(); ?> 
    34          
     34 
    3535        </body> 
    3636 
  • trunk/plog-admin/_install.php

    r546 r550  
    11<?php 
    22error_reporting(E_ERROR); 
    3 require(dirname(__FILE__) . '/plog-globals.php'); 
    4 require(PLOGGER_DIR . 'plog-functions.php'); 
    5 require(PLOGGER_DIR . 'lib/plogger/install_functions.php'); 
     3require_once(dirname(dirname(__FILE__)).'/plog-globals.php'); 
     4require_once(PLOGGER_DIR.'plog-includes/plog-functions.php'); 
     5require_once(PLOGGER_DIR.'plog-admin/includes/install-functions.php'); 
    66 
    77// serve the config file 
    88if (!empty($_POST['dlconfig']) && !empty($_SESSION['plogger_config'])) { 
    9   header('Content-type: application/octet-stream'); 
    10   header('Content-Disposition: attachment; filename="plog-config.php"'); 
    11   print $_SESSION['plogger_config']; 
    12   die(); 
    13 }; 
     9        header('Content-type: application/octet-stream'); 
     10        header('Content-Disposition: attachment; filename="plog-config.php"'); 
     11        print $_SESSION['plogger_config']; 
     12        exit(); 
     13} 
    1414 
    1515// Create the SQL tables and try to proceed to the admin interface. 
     
    1919        if (empty($mysql)) { 
    2020                create_tables(); 
    21                 configure_plogger($_SESSION["install_values"]);   // undefined index install_values 
    22                 require(PLOGGER_DIR . "plog-load_config.php"); 
     21                configure_plogger($_SESSION['install_values']);   // undefined index install_values 
     22                require_once(PLOGGER_DIR."plog-load-config.php"); 
    2323                connect_db(); 
    2424                $col = add_collection(plog_tr("Plogger test collection"),plog_tr("Feel free to delete it")); 
     
    2727                        $alb = add_album(plog_tr("Plogger test album"),plog_tr("feel free to delete it"),$col['id']); 
    2828                } 
    29                 unset($_SESSION["plogger_config"]); 
    30                 unset($_SESSION["install_values"]); 
    31                 header("Location: admin/index.php"); 
     29                unset($_SESSION['plogger_config']); 
     30                unset($_SESSION['install_values']); 
     31                header("Location: index.php"); 
    3232                exit; 
    33         }; 
    34 }; 
     33        } 
     34} 
    3535?> 
    3636<html> 
     
    4040        </head> 
    4141        <body> 
    42                 <img src="graphics/plogger.gif" alt="Plogger"> 
     42                <img src="images/plogger.gif" alt="Plogger"> 
    4343<?php 
    4444if (empty($_POST['proceed'])) { 
    4545        do_install($_POST); 
    4646} else { 
    47         require(PLOGGER_DIR . 'lib/plogger/form_setup_complete.php'); 
    48 }; 
     47        require(PLOGGER_DIR.'plog-admin/includes/install-form-setup-complete.php'); 
     48} 
    4949?> 
    5050</body> 
  • trunk/plog-admin/_upgrade.php

    r509 r550  
    11<?php 
    2  
    32error_reporting(E_ERROR); 
    4  
    53echo ' 
    64        <html> 
    75                <head> 
    86                        <title>Upgrade Plogger</title> 
    9                         <link rel="stylesheet" type="text/css" href="admin/../css/admin.css"> 
     7                        <link rel="stylesheet" type="text/css" href="css/admin.css"> 
    108                </head> 
    119                <body> 
    12                 <img src="graphics/plogger.gif" alt="Plogger"> 
     10                <img src="images/plogger.gif" alt="Plogger"> 
    1311                <h1>Performing Upgrade...</h1>'; 
    1412         
    1513// This is the upgrade file for upgrading your Plogger gallery from Beta 1 
    16 $workdir = getcwd(); 
     14$workdir = dirname(dirname(__FILE__)); 
    1715if (file_exists($workdir.'/plog-connect.php')) 
    1816{ 
     
    2321                print $workdir . " is not writable, but I need to create a new file in it"; 
    2422                exit; 
    25         }; 
     23        } 
    2624 
    2725        // now parse DB connection parameters out of plog-connect 
     
    5048        if (!$fh) { 
    5149                die("Could not write plog-config.php, please make the file writable and then try running this script again"); 
    52         }; 
     50        } 
    5351        fwrite($fh,"<?php\n"); 
    5452        fwrite($fh,$cfg_file); 
     
    5755 
    5856        unlink($workdir.'/plog-connect.php'); 
    59         print "Done!<br/>"; 
    60  
    61 }; 
     57        print "Done!<br />"; 
     58 
     59} 
    6260 
    6361function makeDirs($strPath, $mode = 0777) //creates directory tree recursively 
     
    7270        while($row = mysql_fetch_array($res,MYSQL_NUM)) { 
    7371                if ($row[0] == $column) $found = true; 
    74         }; 
     72        } 
    7573        if (!$found) { 
    7674                print "<li>Adding new field $column to database."; 
     
    7876        } else { 
    7977                print "<li>$column already present in database."; 
    80         }; 
     78        } 
    8179} 
    8280 
     
    8785        while($row = mysql_fetch_array($res,MYSQL_NUM)) {