No changes between revisions
/photogallery/install/index.html
0,0 → 1,27
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>singapore setup</title>
<link rel="stylesheet" type="text/css" href="../docs/docstyle.css" />
</head>
 
<body>
 
<h1>singapore Setup</h1>
 
<p>Welcome to the singapore setup process. This should take no more than a minute.</p>
 
<ul>
<li><a href="install.php">Install singapore</a></li>
<li><a href="uninstall.php">Uninstall singapore</a></li>
<!--<li><a href="migrate.php">Migrate database information</a></li>-->
<li><a href="../">Return to singapore</a></li>
</ul>
 
<p>Once you have completed the setup process you must delete or protect this
<code>install/</code> directory to prevent unauthorised access.</p>
 
</body>
</html>
/photogallery/install/install.inc.php
0,0 → 1,258
<?php
 
/**
* Contains functions used during the install process.
*
* @author Tamlyn Rhodes <tam at zenology dot co dot uk>
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License
* @copyright (c)2003-2005 Tamlyn Rhodes
* @version $Id: install.inc.php,v 1.4 2006/01/22 03:25:37 tamlyn Exp $
*/
 
/**
* Test server configuration.
* @return bool true if no errors occurred; false otherwise
*/
function testServer()
{
setupHeader("Testing PHP version");
setupMessage("PHP version is ".phpversion());
$bits = explode(".",phpversion());
if(strcmp($bits[0],"4")<0 || strcmp($bits[0],"4")==0 && strcmp($bits[1],"1")<0)
return setupError("singapore requires PHP 4.1.0 or higher ");
$success = true;
setupHeader("Testing PHP configuration");
//setupMessage("If any of these tests fail, you may be able to change the configuration ".
// "directive (specified in brackets) either in php.ini or by adding ".
// "<code>ini_set(\"<b>directive_name</b>, 1)</code> to <code>includes/header.php</code>");
 
if(!ini_get("safe_mode")) setupMessage("Safe mode disabled");
else $success &= setupError("PHP is running in 'safe mode' (<code>safe_mode</code>). Singapore may still function correctly but safe mode operation is not supported");
$session_save_path = ini_get("session.save_path");
if(!empty($session_save_path) && is_writable($session_save_path) || ini_get("session.save_handler")!="files") setupMessage("Session save path seems to be correctly specified");
else $success &= setupError("Session save path does not exist or is not writable (<code>session.save_path</code>). Singapore will function but you may not be able to use the admin interface");
 
if(ini_get("session.use_trans_sid")) setupMessage("Transparent session id support enabled");
else setupMessage("Transparent session id support disabled (<code>use_trans_sid</code>). Singapore will function but will <b>require</b> cookies for the admin interface to function");
 
if(ini_get("file_uploads")) setupMessage("File uploading enabled");
else $success &= setupError("File uploading disabled (<code>file_uploads</code>). Singapore will function but you will not be able to upload images via the admin interface");
 
$upload_tmp_dir = ini_get("upload_tmp_dir");
if(empty($upload_tmp_dir) || is_writable($upload_tmp_dir)) setupMessage("Upload temp directory seems to be correctly specified");
else $success &= setupError("Upload directory directory does not exist or is not writable (<code>upload_tmp_dir</code>). Singapore will function but you may not be able to upload images via the admin interface");
//setupMessage("Maximum upload size is ".floor(ini_get("upload_max_filesize")/1024)."KB. You will not be able to upload files larger than this via the admin interface");
if(ini_get("allow_url_fopen")) setupMessage("Remote file handling enabled");
else $success &= setupError("Remote file handling disabled (<code>allow_url_fopen</code>). Singapore will function but you will not be able to generate thumbnails for remotely hosted files");
setupHeader("Testing for config file");
if(file_exists($GLOBALS['basePath']."singapore.ini")) setupMessage("Config file found");
else $success &= setupError("Config file not found - singapore.ini must be located in the root singapore directory");
setupHeader("Testing for GD");
//get phpinfo data
ob_start();
phpinfo(8);
$phpinfo = ob_get_contents();
ob_end_clean();
//find gd version
$phpinfo = strip_tags($phpinfo);
$phpinfo = stristr($phpinfo,"gd version");
$phpinfo = stristr($phpinfo,"version");
if(!$phpinfo) $success &= setupError("GD not found. You may be able to use ImageMagick instead");
else {
//extract text version and number version
$gd_version_text = substr($phpinfo,0,strpos($phpinfo,"\n"));
$gd_version_number = substr($gd_version_text,0,strpos($gd_version_text,"."));
$gd_version_number = substr($gd_version_number, strlen($gd_version_number)-1);
setupMessage("Found GD: $gd_version_text");
if($gd_version_number=="1") setupMessage("Please change the <code>thumbnail_software</code> option in singapore.ini to \"gd1\". Note: GD1 produces very poor quality thumbnails so please use GD2 or ImageMagick if available");
}
setupHeader("Testing for ImageMagick");
$foundIM = exec("mogrify");
$whereIM = exec("whereis mogrify");
if($foundIM) {
if($whereIM) setupMessage("Found ImageMagick at $whereIM");
else setupMessage("Found ImageMagick");
setupMessage("To take advantage of ImageMagick change the <code>thumbnail_software</code> option in singapore.ini to \"im\"");
} else setupMessage("ImageMagick not found but that doesn't mean it's not there. If it really is not available you may be able to install it yourself (even without shell access to the server)");
return $success;
}
 
 
/**
* Creates cache and logs directories required to run singapore and ensures
* all required directories are writeable.
* @return bool true if no errors occurred; false otherwise
*/
function createDirectories($config)
{
$success = true;
setupHeader("Creating directories");
if(is_writable($config->base_path.$config->pathto_data_dir)) {
setupMessage("Data directory is writable");
if(file_exists($config->base_path.$config->pathto_cache))
if(is_writable($config->base_path.$config->pathto_cache))
setupMessage("Cache directory already exists at ".$config->base_path.$config->pathto_cache." and is writable");
else
$success = setupError("Cache directory already exists at ".$config->base_path.$config->pathto_cache." but is not writable. Please CHMOD to 777");
else
if(mkdir($config->base_path.$config->pathto_cache, $config->directory_mode)) {
@chmod($config->base_path.$config->pathto_cache, $config->directory_mode);
setupMessage("Created cache directory at ".$config->base_path.$config->pathto_cache);
} else
$success = setupError("Could not create cache directory at ".$config->base_path.$config->pathto_cache);
if($config->track_views)
if(file_exists($config->base_path.$config->pathto_logs))
if(is_writable($config->base_path.$config->pathto_logs))
setupMessage("Logs directory already exists at ".$config->base_path.$config->pathto_logs." and is writable");
else
$success = setupError("Logs directory already exists at ".$config->base_path.$config->pathto_logs." but is not writable. Please CHMOD to 777");
else
if(mkdir($config->base_path.$config->pathto_logs, $config->directory_mode)) {
@chmod($config->base_path.$config->pathto_logs, $config->directory_mode);
setupMessage("Created logs directory at ".$config->base_path.$config->pathto_logs);
} else
$success = setupError("Could not create logs directory at ".$config->base_path.$config->pathto_logs);
else
setupMessage("View logging disabled. Logs directory not created");
}
else
$success = setupError("Data directory (".$config->base_path.$config->pathto_data_dir.") is not writable. Please CHMOD to 777");
 
return $success;
}
 
/**
* Creates the tables and inserts the default users.
* @param sgIO_sql pointer to a singapore SQL backend object
*/
function sqlCreateTables(&$io) {
$success = true;
setupHeader("Creating tables");
if(@$io->query("SELECT * FROM ".$io->config->sql_prefix."galleries"))
setupMessage("'".$io->config->sql_prefix."galleries' table already exists - skipped");
elseif($io->query("CREATE TABLE ".$io->config->sql_prefix."galleries (".
"id varchar(250) NOT NULL, ".
"lang varchar(16) NOT NULL DEFAULT '', ".
"filename varchar(200), ".
"owner varchar(32), ".
"groups varchar(64), ".
"permissions int UNSIGNED, ".
"categories varchar(255), ".
"name varchar(255), ".
"artist varchar(255), ".
"email varchar(255), ".
"copyright varchar(255), ".
"description text, ".
"summary text, ".
"date varchar(255),".
"hits smallint UNSIGNED,".
"lasthit int UNSIGNED,".
"PRIMARY KEY (id, lang)".
")")) setupMessage("'".$io->config->sql_prefix."galleries' table created");
else
$success = setupError("Unable to create '".$io->config->sql_prefix."galleries' table:".$io->error());
if(@$io->query("SELECT * FROM ".$io->config->sql_prefix."images"))
setupMessage("'".$io->config->sql_prefix."images' table already exists - skipped");
elseif($io->query("CREATE TABLE ".$io->config->sql_prefix."images (".
"galleryid varchar(250) NOT NULL, ".
"filename varchar(200) NOT NULL, ".
"lang varchar(16) NOT NULL DEFAULT '', ".
"thumbnail varchar(255), ".
"owner varchar(32), ".
"groups varchar(64), ".
"permissions int, ".
"categories varchar(64), ".
"name varchar(255), ".
"artist varchar(255), ".
"email varchar(255), ".
"copyright varchar(255), ".
"description text, ".
"width smallint UNSIGNED, ".
"height smallint UNSIGNED, ".
"type tinyint UNSIGNED, ".
"location varchar(255), ".
"date varchar(255), ".
"camera varchar(255), ".
"lens varchar(255), ".
"film varchar(255), ".
"darkroom text, ".
"digital text, ".
"hits smallint UNSIGNED,".
"lasthit int UNSIGNED,".
"PRIMARY KEY (galleryid, filename, lang)".
")")) setupMessage("'".$io->config->sql_prefix."images' table created");
else
$success = setupError("Unable to create '".$io->config->sql_prefix."images' table:".$io->error());
if(@$io->query("SELECT * FROM ".$io->config->sql_prefix."users"))
setupMessage("'".$io->config->sql_prefix."users' table already exists - skipped");
elseif($io->query("CREATE TABLE ".$io->config->sql_prefix."users (".
"username varchar(32) NOT NULL, ".
"userpass char(32) NOT NULL, ".
"permissions int UNSIGNED, ".
"groups varchar(64), ".
"email varchar(255), ".
"fullname varchar(255), ".
"description varchar(255), ".
"stats varchar(255), ".
"PRIMARY KEY (username)".
")")) {
setupMessage("'".$io->config->sql_prefix."users' table created");
if($io->query("INSERT INTO ".$io->config->sql_prefix."users VALUES".
'("admin", "5f4dcc3b5aa765d61d8327deb882cf99", 1024, "", "", "Administrator", "Default administrator account", "")') &&
$io->query("INSERT INTO ".$io->config->sql_prefix."users VALUES".
'("guest", "5f4dcc3b5aa765d61d8327deb882cf99", 0, "", "", "Guest", "Restricted use account for guests who do not have a user account", "")'))
setupMessage("Inserted default users into '".$io->config->sql_prefix."users' table");
else
$success = setupError("Unable to insert default users into '".$io->config->sql_prefix."users' table:".$io->error());
} else
$success = setupError("Unable to create '".$io->config->sql_prefix."users' table:".$io->error());
return $success;
}
 
 
//output functions
function setupHeader($var)
{
echo "\n</p>\n\n<h2>{$var}</h2>\n\n<p>\n";
}
 
/**
* Print an information message. Always returns true.
* @return true
*/
function setupMessage($var)
{
echo "{$var}.<br />\n";
return true;
}
 
/**
* Print an error message. Always returns false.
* @return false
*/
function setupError($var)
{
echo "<span class=\"error\">{$var}</span>.<br />\n";
return false;
}
 
?>
/photogallery/install/install.php
0,0 → 1,151
<?php
 
/**
* Performs necessary actions to install singapore.
*
* @author Tamlyn Rhodes <tam at zenology dot co dot uk>
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License
* @copyright (c)2003, 2004 Tamlyn Rhodes
* @version $Id: install.php,v 1.6 2006/02/04 02:12:12 tamlyn Exp $
*/
 
//path to singapore root
$basePath = "../";
 
require_once "install.inc.php";
require_once $basePath."includes/config.class.php";
 
//determine current step in setup process
$setupStep = isset($_REQUEST["step"]) ? $_REQUEST["step"] : "test";
 
if($setupStep=="phpinfo") {
phpinfo();
exit;
}
 
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>singapore setup</title>
<link rel="stylesheet" type="text/css" href="../docs/docstyle.css" />
</head>
 
<body>
 
<?php
//if file is parsed by php then this block will never be executed
if(false) {
?>
</p>
 
<h1>Oh dear...</h1>
 
<p>PHP is not installed or is not configured correctly. See the
<a href="http://www.php.net/manual/">PHP manual</a> for more information.
 
<?php
} //end php test
 
switch($setupStep) {
case "test" :
setupHeader("Step 1 of 2: Test Server");
setupMessage("Attempting to find out if your server is capable of running singapore");
setupMessage("No changes are made at this time");
if(testServer()) {
setupHeader("OK");
setupMessage("All tests completed successfully");
} else {
setupHeader("Oops!");
setupError("One or more problems were encountered. You may want to fix them and <a href=\"install.php?step=test\">retry this step</a>");
}
echo '<br /><a href="index.html">&lt;&lt; Previous: welcome</a>';
echo ' | <a href="install.php?step=phpinfo">View PHP configuration</a>';
echo ' | <a href="install.php?step=database">Next: setup database &gt;&gt;</a>';
//echo ' | <a href="index.html">Finish</a>';
//echo ' | <a href="install.php?step=directories">Next: create directories &gt;&gt;</a>';
break;
case "directories" :
setupHeader("Step 2 of 3: Create Directories");
setupMessage("Setup will now create the directories necessary to store thumbnails and logs");
//create config object
$config = new sgConfig($basePath."singapore.ini");
$config->pathto_logs = $config->pathto_data_dir."logs/";
$config->pathto_cache = $config->pathto_data_dir."cache/";
$config->base_path = $basePath;
if(createDirectories($config)) {
setupHeader("OK");
setupMessage("This step completed successfully");
} else {
setupHeader("Oops!");
setupError('There was a problem. Please fix it and <a href="install.php?step=directories">retry this step</a>');
}
echo '<br /><a href="install.php?step=test">&lt;&lt; Previous: test server</a>';
echo ' | <a href="install.php?step=database">Next: setup database &gt;&gt;</a>';
break;
case "database" :
setupHeader("Step 2 of 2: Setup Database");
//create config object
$config =& sgConfig::getInstance();
$config->loadConfig($basePath."singapore.ini");
$config->base_path = $basePath;
switch($config->io_handler) {
case "csv" :
setupMessage("The default CSV file database does not require any further setting up");
setupHeader("OK");
setupMessage("This step completed successfully");
break;
case "mysql" :
include_once $basePath."includes/io_mysql.class.php";
$config->loadConfig($basePath."secret.ini.php");
setupMessage("Setup will now create the tables necessary to run singapore on a MySQL database");
setupHeader("Connecting to database");
$io = new sgIO_mysql();
if(!$io) setupError("Error connecting to database. Please ensure database settings are correct");
if(sqlCreateTables($io)) {
setupHeader("OK");
setupMessage("This step completed successfully");
} else {
setupHeader("Oops!");
setupError('There was a problem. Please fix it and <a href="install.php?step=database">retry this step</a>');
}
break;
case "sqlite" :
include_once $basePath."includes/io_sqlite.class.php";
setupMessage("Setup will now create the database and tables necessary to run singapore on SQLite");
setupHeader("Opening database file");
$io = new sgIO_sqlite();
if(!$io) {
setupError("Error connecting to database. Please ensure database settings are correct");
break;
} else setupMessage("Success");
if(sqlCreateTables($io)) {
setupHeader("OK");
setupMessage("This step completed successfully");
} else {
setupHeader("Oops!");
setupError('There was a problem. Please fix it and <a href="install.php?step=database">retry this step</a>');
}
break;
default :
setupError("Unrecognised io_handler.");
}
setupMessage("Don't forget to delete or protect this <code>install</code> directory to prevent unauthorised access");
echo '<br /><a href="install.php?step=test">&lt;&lt; Previous: test server</a>';
//echo '<br /><a href="install.php?step=directories">&lt;&lt; Previous: create directories</a>';
echo ' | <a href="index.html">Finish</a>';
break;
}
?>
 
</body>
</html>
/photogallery/install/migrate.inc.php
0,0 → 1,95
<?php
 
/**
* Contains functions used during the database migration process.
*
* @author Tamlyn Rhodes <tam at zenology dot co dot uk>
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License
* @copyright (c)2003, 2004 Tamlyn Rhodes
* @version $Id: migrate.inc.php,v 1.2 2004/12/15 17:04:56 tamlyn Exp $
*/
 
 
function setPerms($obj) {
$obj->permissions = 0;
if(!empty($_POST["sgGrpRead"])) $obj->permissions |= SG_GRP_READ;
if(!empty($_POST["sgGrpEdit"])) $obj->permissions |= SG_GRP_EDIT;
if(!empty($_POST["sgGrpAdd"])) $obj->permissions |= SG_GRP_ADD;
if(!empty($_POST["sgGrpDelete"])) $obj->permissions |= SG_GRP_DELETE;
if(!empty($_POST["sgWldRead"])) $obj->permissions |= SG_WLD_READ;
if(!empty($_POST["sgWldEdit"])) $obj->permissions |= SG_WLD_EDIT;
if(!empty($_POST["sgWldAdd"])) $obj->permissions |= SG_WLD_ADD;
if(!empty($_POST["sgWldDelete"])) $obj->permissions |= SG_WLD_DELETE;
$obj->groups = $_REQUEST["sgGroups"];
$obj->owner = $_REQUEST["sgOwner"];
return $obj;
}
 
 
function convertDirectory ($path, $io_in, $io_out)
{
if (is_dir($path)) {
$gallery = $io_in->getGallery($path);
echo "<ul><li>Checking $path<br />\n";
if($gallery) {
if($gallery->summary != "" && empty($_REQUEST["convertOverwrite"]))
echo "Did NOT overwrite non-empty summary in $path<br />\n";
else {
if($_REQUEST["convertType"]!='none')
$gallery->summary = $gallery->desc;
if($_REQUEST["convertType"]=='move')
$gallery->desc = "";
}
 
$gallery = setPerms($gallery);
for($i=0; $i<count($gallery->images); $i++)
$gallery->images[$i] = setPerms($gallery->images[$i]);
if($io_out->putGallery($gallery))
echo "Successfully converted $path<br />\n";
else
echo "Problem saving data file for $path<br />\n";
} else
echo "Skipping $path<br />\n";
$d = dir($path);
while (($file = $d->read()) !== false) {
if ($file == '.' || $file == '..') continue;
$path = $d->path."/".$file;
if (is_dir($path)) {
convertDirectory($path);
}
}
echo "</li></ul>\n";
}
}
 
//output functions
function setupHeader($var)
{
echo "\n</p>\n\n<h2>{$var}</h2>\n\n<p>\n";
}
 
/**
* Print an information message. Always returns true.
* @return true
*/
function setupMessage($var)
{
echo "{$var}.<br />\n";
return true;
}
 
/**
* Print an error message. Always returns false.
* @return false
*/
function setupError($var)
{
echo "<span class=\"error\">{$var}</span>.<br />\n";
return false;
}
 
?>
/photogallery/install/migrate.php
0,0 → 1,203
<?php
 
//permissions bit flags
define("SG_GRP_READ", 1);
define("SG_GRP_EDIT", 2);
define("SG_GRP_ADD", 4);
define("SG_GRP_DELETE", 8);
define("SG_WLD_READ", 16);
define("SG_WLD_EDIT", 32);
define("SG_WLD_ADD", 64);
define("SG_WLD_DELETE", 128);
 
$basePath = "../";
 
//determine current step in setup process
$setupStep = isset($_REQUEST["step"]) ? $_REQUEST["step"] : "choose";
 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>singapore database migration</title>
<link rel="stylesheet" type="text/css" href="../docs/docstyle.css" />
</head>
 
<body>
 
<?php
 
require_once $basePath."includes/config.class.php";
require_once $basePath."includes/gallery.class.php";
require_once $basePath."includes/image.class.php";
$config = new sgConfig($basePath."singapore.ini");
 
 
switch($setupStep) {
case "select" :
setupHeader("Step 1 of 2: Select databases");
setupMessage("Nothing is deleted at this time");
makeWritable($basePath);
setupHeader("OK");
setupMessage("This step completed successfully");
setupHeader("WARNING!");
setupMessage("The following step will delete all gallery, image and user information from the currently selected database. Gallery directories and image files will not be deleted but all extended information (e.g. name, artist, copyright etc.) will be irretrievably lost");
echo '<br /><a href="index.html">Finish</a>';
echo ' | <a href="uninstall.php?step=database">Next: I AM SURE I WANT TO delete database information &gt;&gt;</a>';
break;
case "defaults" :
setupHeader("Step 2 of 3: Select default permissions");
setupMessage("Nothing is deleted at this time");
makeWritable($basePath);
setupHeader("OK");
setupMessage("This step completed successfully");
setupHeader("WARNING!");
setupMessage("The following step will delete all gallery, image and user information from the currently selected database. Gallery directories and image files will not be deleted but all extended information (e.g. name, artist, copyright etc.) will be irretrievably lost");
echo '<br /><a href="index.html">Finish</a>';
echo ' | <a href="uninstall.php?step=database">Next: I AM SURE I WANT TO delete database information &gt;&gt;</a>';
break;
case "convert" :
setupHeader("Step 2 of 2: Delete database information");
//create config object
$config = new sgConfig($basePath."singapore.ini");
$config->loadConfig($basePath."secret.ini.php");
$config->base_path = $basePath;
//include base classes
require_once $basePath."includes/io.class.php";
require_once $basePath."includes/io_sql.class.php";
switch($config->io_handler) {
case "csv" :
setupMessage("The default CSV file database does not require uninstalling");
setupHeader("OK");
setupMessage("This step completed successfully");
break;
case "mysql" :
require_once $basePath."includes/io_mysql.class.php";
setupMessage("Setup will now delete all gallery, image and user information");
setupHeader("Connecting to MySQL database");
$io = new sgIO_mysql($config);
if(!$io) {
setupError("Error connecting to database. Please ensure database settings are correct");
break;
} else setupMessage("Connected");
if(sqlDropTables($io)) {
setupHeader("OK");
setupMessage("This step completed successfully");
} else {
setupHeader("Oops!");
setupError('There was a problem. Please fix it and <a href="migrate.php?step=database">retry this step</a>');
}
break;
case "sqlite" :
setupMessage("Setup will now delete all gallery, image and user information");
setupHeader("Deleting SQLite database file");
if(unlink($basePath.$config->pathto_data_dir."sqlite.dat")) {
setupMessage("Deleted database file '".$basePath.$config->pathto_data_dir."sqlite.dat'");
setupHeader("OK");
setupMessage("This step completed successfully");
} else {
setupError("Unable to delete database file '".$basePath.$config->pathto_data_dir."sqlite.dat'");
setupHeader("Oops!");
setupError('There was a problem. Please fix it and <a href="migrate.php?step=database">retry this step</a>');
}
break;
default :
setupError("Unrecognised io_handler");
}
echo '<br /><a href="uninstall.php?step=reset">&lt;&lt; Previous: Reset permissions</a>';
echo ' | <a href="index.html">Finish</a>';
break;
}
 
if(isset($_REQUEST["convertType"])) {
 
require_once $basePath."includes/config.class.php";
require_once $basePath."includes/gallery.class.php";
require_once $basePath."includes/image.class.php";
require_once $basePath."includes/io.class.php";
require_once $basePath."includes/io_sql.class.php";
$config = new sgConfig($basePath."singapore.ini");
$config->base_path = $basePath;
//echo "<ul>\n";
convertDirectory($config->base_path.$config->pathto_galleries);
//echo "</ul>\n";
echo "<p>All operations complete.</p>\n";
 
} else { ?>
<p>This will convert all your metadata files from singapore 0.9.6, 0.9.7, 0.9.8 or 0.9.9 to 0.9.10.</p>
 
<form method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
<h3>summary field</h3>
<p>There is a new gallery summary field that is displayed instead of the
description in the parent gallery. You can choose to either copy or move the
old description field to the summary field or leave both untouched:</p>
 
<p><input type="radio" class="radio" name="convertType" value="copy" checked="true" /> Copy<br />
<input type="radio" class="radio" name="convertType" value="move" /> Move<br />
<input type="radio" class="radio" name="convertType" value="none" /> Neither<br />
 
<p>By default only empty summary fields will be written to. Check this option to
allow the summary field to be overwritten <input type="checkbox" class="checkbox" name="convertOverwrite" /></p>
 
<h3>permissions</h3>
 
<p>This version introduces multiple authorised users and image &amp; gallery
permissions. Please choose the default permissions that you would like all
objects to be set to. The default permissions selected below are recommended as
they will make all images &amp; galleries readable by everyone but only
modifiable by administrators. See the readme for more information on the
permissions model used by singapore.</p>
<table>
<tr>
<td>Owner</td>
<td><input type="text" name="sgOwner" value="__nobody__" /></td>
</tr>
<tr>
<td>Groups</td>
<td><input type="text" name="sgGroups" value="" /></td>
</tr>
<tr>
<td>Group permissions</td>
<td><div class="inputbox">
<input type="checkbox" class="checkbox" name="sgGrpRead" checked="true"/> Read
<input type="checkbox" class="checkbox" name="sgGrpEdit" /> Edit
<input type="checkbox" class="checkbox" name="sgGrpAdd" /> Add
<input type="checkbox" class="checkbox" name="sgGrpDelete" /> Delete
</div></td>
</tr>
<tr>
<td>World permissions</td>
<td><div class="inputbox">
<input type="checkbox" class="checkbox" name="sgWldRead" checked="true"/> Read
<input type="checkbox" class="checkbox" name="sgWldEdit" /> Edit
<input type="checkbox" class="checkbox" name="sgWldAdd" /> Add
<input type="checkbox" class="checkbox" name="sgWldDelete" /> Delete
</div></td>
</tr>
</table>
 
 
<p>Please note that while the script will create backups of your metadata files
it is highly recommended that you create your own backups for added security.</p>
 
<input type="submit" class="button" value="Go" /></p>
</form>
<?php } ?>
 
<p><a href="index.html">Return</a> to tools.</p>
 
</body>
</html>
/photogallery/install/uninstall.inc.php
0,0 → 1,91
<?php
 
/**
* Contains functions used during the uninstall process.
*
* @author Tamlyn Rhodes <tam at zenology dot co dot uk>
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License
* @copyright (c)2003, 2004 Tamlyn Rhodes
* @version $Id: uninstall.inc.php,v 1.1 2004/12/02 12:01:59 tamlyn Exp $
*/
 
/**
* Recursively attempts to make all files and directories in $dir writable
*
* @param string full directory name (must end with /)
*/
function makeWritable($dir)
{
if (is_dir($dir)) {
$d = dir($dir);
while (($file = $d->read()) !== false) {
if ($file == '.' || $file == '..') continue;
$fullfile = $d->path . $file;
if(!is_writable($fullfile) && @chmod($fullfile,0777))
setupMessage("Made $fullfile writable");
if (is_dir($fullfile))
makeWritable($fullfile."/");
}
}
}
 
 
/**
* Drops all tables created by singapore.
* @param sgIO_sql pointer to a singapore SQL backend object
*/
function sqlDropTables($io) {
$success = true;
setupHeader("Deleting tables");
if(!$io->query("SELECT * FROM ".$io->config->sql_prefix."galleries"))
setupMessage("'".$io->config->sql_prefix."galleries' table not found - skipped");
elseif($io->query("DROP TABLE ".$io->config->sql_prefix."galleries"))
setupMessage("'".$io->config->sql_prefix."galleries' table deleted");
else
$success = setupError("Unable to delete '".$io->config->sql_prefix."galleries' table:".$io->error());
if(!$io->query("SELECT * FROM ".$io->config->sql_prefix."images"))
setupMessage("'".$io->config->sql_prefix."images' table not found - skipped");
elseif($io->query("DROP TABLE ".$io->config->sql_prefix."images"))
setupMessage("'".$io->config->sql_prefix."images' table deleted");
else
$success = setupError("Unable to delete '".$io->config->sql_prefix."images' table:".$io->error());
if(!$io->query("SELECT * FROM ".$io->config->sql_prefix."users"))
setupMessage("'".$io->config->sql_prefix."users' table not found - skipped");
elseif($io->query("DROP TABLE ".$io->config->sql_prefix."users"))
setupMessage("'".$io->config->sql_prefix."users' table deleted");
else
$success = setupError("Unable to delete '".$io->config->sql_prefix."users' table:".$io->error());
return $success;
}
 
 
//output functions
function setupHeader($var)
{
echo "\n</p>\n\n<h2>{$var}</h2>\n\n<p>\n";
}
 
/**
* Print an information message. Always returns true.
* @return true
*/
function setupMessage($var)
{
echo "{$var}.<br />\n";
return true;
}
 
/**
* Print an error message. Always returns false.
* @return false
*/
function setupError($var)
{
echo "<span class=\"error\">{$var}</span>.<br />\n";
return false;
}
 
?>
/photogallery/install/uninstall.php
0,0 → 1,107
<?php
 
/**
* Performs necessary actions to uninstall singapore.
*
* @author Tamlyn Rhodes <tam at zenology dot co dot uk>
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License
* @copyright (c)2003, 2004 Tamlyn Rhodes
* @version $Id: uninstall.php,v 1.3 2006/01/20 12:31:08 tamlyn Exp $
*/
 
//path to singapore root
$basePath = "../";
 
require_once "uninstall.inc.php";
require_once $basePath."includes/config.class.php";
 
//determine current step in setup process
$setupStep = isset($_REQUEST["step"]) ? $_REQUEST["step"] : "reset";
 
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>singapore setdown</title>
<link rel="stylesheet" type="text/css" href="../docs/docstyle.css" />
</head>
 
<body>
 
<?php
 
switch($setupStep) {
case "reset" :
setupHeader("Step 1 of 2: Reset permissions");
setupMessage("Resetting file permissions on server-generated content");
setupMessage("Nothing is deleted at this time");
makeWritable($basePath);
setupHeader("OK");
setupMessage("This step completed successfully");
setupHeader("WARNING!");
setupMessage("The following step will delete all gallery, image and user information from the currently selected database. Gallery directories and image files will not be deleted but all extended information (e.g. name, artist, copyright etc.) will be irretrievably lost");
echo '<br /><a href="index.html">Finish</a>';
echo ' | <a href="uninstall.php?step=database">Next: I AM SURE I WANT TO delete database information &gt;&gt;</a>';
break;
case "database" :
setupHeader("Step 2 of 2: Delete database information");
//create config object
$config =& sgConfig::getInstance();
$config->loadConfig($basePath."singapore.ini");
$config->base_path = $basePath;
switch($config->io_handler) {
case "csv" :
setupMessage("The default CSV file database does not require uninstalling");
setupHeader("OK");
setupMessage("This step completed successfully");
break;
case "mysql" :
$config->loadConfig($basePath."secret.ini.php");
include_once $basePath."includes/io_mysql.class.php";
setupMessage("Setup will now delete all gallery, image and user information");
setupHeader("Connecting to MySQL database");
$io = new sgIO_mysql($config);
if(!$io) {
setupError("Error connecting to database. Please ensure database settings are correct");
break;
} else setupMessage("Connected");
if(sqlDropTables($io)) {
setupHeader("OK");
setupMessage("This step completed successfully");
} else {
setupHeader("Oops!");
setupError('There was a problem. Please fix it and <a href="uninstall.php?step=database">retry this step</a>');
}
break;
case "sqlite" :
$config->loadConfig($basePath."secret.ini.php");
setupMessage("Setup will now delete all gallery, image and user information");
setupHeader("Deleting SQLite database file");
if(unlink($basePath.$config->pathto_data_dir."sqlite.dat")) {
setupMessage("Deleted database file '".$basePath.$config->pathto_data_dir."sqlite.dat'");
setupHeader("OK");
setupMessage("This step completed successfully");
} else {
setupError("Unable to delete database file '".$basePath.$config->pathto_data_dir."sqlite.dat'");
setupHeader("Oops!");
setupError('There was a problem. Please fix it and <a href="uninstall.php?step=database">retry this step</a>');
}
break;
default :
setupError("Unrecognised io_handler");
}
echo '<br /><a href="uninstall.php?step=reset">&lt;&lt; Previous: Reset permissions</a>';
echo ' | <a href="index.html">Finish</a>';
break;
}
?>
 
</body>
</html>
/photogallery/singapore_gallery_files/install/migrate.inc.php
File deleted
\ No newline at end of file
/photogallery/singapore_gallery_files/install/uninstall.inc.php
File deleted
\ No newline at end of file
/photogallery/singapore_gallery_files/install/index.html
File deleted
/photogallery/singapore_gallery_files/install/install.php
File deleted
/photogallery/singapore_gallery_files/install/migrate.php
File deleted
\ No newline at end of file
/photogallery/singapore_gallery_files/install/uninstall.php
File deleted
/photogallery/singapore_gallery_files/install/install.inc.php
File deleted
\ No newline at end of file