Ignore:
Timestamp:
06/30/08 13:45:19 (4 years ago)
Author:
sidtheduck
Message:

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

Location:
trunk/plog-admin
Files:
2 moved

Legend:

Unmodified
Added
Removed
  • 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)) { 
    8886                if ($row[0] == $column) $found = true; 
    89         }; 
     87        } 
    9088        if ($found) { 
    9189                print "<li>dropping $column"; 
     
    9492        } else { 
    9593                //print "$column does not exist<br/>"; 
    96         }; 
     94        } 
    9795} 
    9896 
     
    106104} 
    107105 
    108 include("plog-functions.php"); 
    109 include("plog-globals.php"); 
    110 include("plog-config.php"); 
     106include($workdir."/plog-config.php"); 
     107include($workdir."/plog-globals.php"); 
     108include($workdir."/plog-includes/plog-functions.php"); 
     109 
    111110connect_db(); 
    112111$errors = ""; 
     
    195194        $sql = "UPDATE $config_table SET gallery_url = '" . $config['baseurl'] . "'"; 
    196195        mysql_query($sql); 
    197 }; 
     196} 
    198197 
    199198 
     
    255254 
    256255// insert default value (default theme directory) 
    257 $default_theme_dir = dirname(__FILE__)."/". 'themes/default/'; 
     256$default_theme_dir = dirname(__FILE__)."/plog-content/themes/default/""; 
    258257print "<li>Setting default theme directory to $default_theme_dir</li>"; 
    259258$sql = 'UPDATE '.TABLE_PREFIX.'config SET `theme_dir` = \''.$default_theme_dir.'\' WHERE 1'; 
     
    270269$sql = 'ALTER TABLE '.TABLE_PREFIX.'config 
    271270                ADD  (`small_lastmodified` datetime NOT NULL, 
    272                           `large_lastmodified` datetime NOT NULL, 
    273                           `rss_lastmodified` datetime NOT NULL)'; 
     271                `large_lastmodified` datetime NOT NULL, 
     272                `rss_lastmodified` datetime NOT NULL)'; 
    274273 
    275274if (mysql_query($sql)) 
     
    280279                         
    281280echo "</ul>"; 
    282 echo "<p>Reorganizing your images folder..."; 
     281echo "<p>Reorganizing your 'images/' folder..."; 
    283282 
    284283# strip images prefix from pictures table 
     
    324323        $filename = basename($row['path']); 
    325324        $directory = $row['collection_path']."/".$row['album_path']."/"; 
    326         $new_path = "images/".$directory.$filename; 
     325        $new_path = "plog-content/images/".$directory.$filename; 
    327326        if ($row['path'] == $new_path) continue; 
    328327        echo "<li>Moving $row[path] -> $new_path</li>"; 
    329328         
    330329        // move physical file, create directory if necessary and update path in database 
    331         if (!makeDirs("images/".$directory, 0755)) 
     330        if (!makeDirs("plog-content/images/".$directory, 0755)) 
    332331                        echo "<ul><li>Error: Could not create directory $directory!</li></ul>"; 
    333332         
     
    347346echo "</ul>"; 
    348347 
    349 if (!$errors) 
     348if (!$errors) { 
    350349        echo "Your files were successfully reorganized!"; 
    351 else 
     350} else { 
    352351        echo "There were $errors errors, check your permissions settings."; 
     352} 
    353353 
    354354 
     
    376376                        print "failed to convert $tablename to $charset<br/>"; 
    377377                        print mysql_error(); 
    378                 }; 
    379         } 
    380 }; 
    381  
    382 echo "<p>Upgrade has completed!" 
     378                } 
     379        } 
     380} 
     381 
     382echo "<p>Upgrade has completed!</p>" 
    383383?> 
    384  
    385                        
    386                    
Note: See TracChangeset for help on using the changeset viewer.