<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>CpmFetch Installer - Release 2.0.0</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
TD {
	font-size : 10pt;
	font-family : Verdana;
	color : #FFFFFF;
	font-weight: none;
}
.error {
	font-size : 10pt;
	font-family : Verdana;
	color : maroon;
	font-weight: bold;
}

.code {
			 border-style: solid;
			 border-width: thin;
			 border-color: #000000;
			 background-color:#FFFFFF;
			 padding: 5px;
			 width:90%;
			 font-size : 10pt;
			 color: #000000;
}

</style>

</head>
<body bgcolor="#a2907d">

<table width="770" border="0" cellpadding="0" cellspacing="0" bgcolor="#c8beb6" align="center">
<TR>
<TD>
<table width="100%" border="0" cellpadding="3" cellspacing="1">
<TR bgcolor="#a2907d"><TD height="50" align="center">
<p>
CpmFetch Installer for release 2.0.0<br>
<A href="<?php print $SUPPORT_WEBSITE_URL; ?>"><?php print $SUPPORT_WEBSITE_URL; ?></A>
</p>
</TD>
</TR>
<TR bgcolor="#a2907d"><TD height="50">

<?php

error_reporting(E_ALL);
ini_set('display_errors',1);  // 0 is off, 1 is on
include "./cpmfetch.php";


if ($ERRMSG) {
	print '<p><div span="error">Important information - install has been halted.<br/>';
	print $ERRMSG;
	print '</div></p>';

	switch ($ERRINSTCODE) {
	case (10):
		?>
		<p>This error means that you have attempted to override the defaults and
		submit a different path by using the do=install-path command.  You need to
		submit a second parameter named path which would provide the location of the
		Coppermine Photo Gallery directory.</p>

		<p>You may override the default settings by entering the relative path from the CpmFetch folder
		to the location of the Coppermine Photo Gallery by entering it here.</p>  

		<p>
		<form action="install.php" enctype="application/x-www-form-urlencoded" method="GET">
		<INPUT type="hidden" name="do" value="install-path">
		<INPUT type="text" name="path" size="60" maxlength="60">&nbsp;&nbsp;<INPUT type="submit">
		</form>
		</p>

		<?php
		break;
	case (20):
		?>
		<p>This means that the installer could not find the Coppermine Photo Gallery
		config file where it expected it to be, or where you have overriden it to be.</p>

		<p>The recommened place to install cpmfetch is inside the Gallery directory in a 
		subdirectory named cpmfetch.</p>

		You may override the default settings by entering the relative path from the CpmFetch folder
		to the location of the Coppermine Photo Gallery by entering it here.  

		<p>
		<form action="install.php" enctype="application/x-www-form-urlencoded" method="GET">
		<INPUT type="hidden" name="do" value="install-path">
		<INPUT type="text" name="path" size="60" maxlength="60">&nbsp;&nbsp;<INPUT type="submit">
		</form>
		</p>

		<?php
		break;
	case (30):
		?>
		<p>This means that the installer could not find the Coppermine Photo Gallery
		initialization file where it expected it to be, or where you have overriden it to be.</p>

		<p>The recommened place to install cpmfetch is inside the Gallery directory in a 
		subdirectory named cpmfetch.</p>
		<?php
		break;

	case (35):
		?>
		<p>The install has detected a configuration file for cpmfetch exists.  The version of the config file (<?php echo $CONFIG_WRITTEN_VERSION; ?>) is not compatible with the version of CpmFetch (<?php echo $INSTALLER_VERSION ?>) you are trying to install.  The last version requiring a change was <?php echo $LAST_FLAGGED_VERSION ?>.  You will need to re-run the install program. By clicking the link below, the install will re-run, possibly overwriting changes you have made manually to the cpmfetch_config.php file.  We recommend making a copy, or taking some notes if you have actually changed anything.</p>

		<p><a href="install.php<?php echo $INSTALLPARAMETERS; ?>">Click here to re-run the install [RECOMMENED].</a></p>

		<?php
		break;

	case (36):
		?>
		<p>The install detected an existing cpmfetch_config.php file (<?php echo $CONFIG_WRITTEN_VERSION; ?>) that is compatible with the current code (<?php echo $INSTALLER_VERSION ?>).  You do not need to re-run the install program again.  Some reasons why you may want to:</p>

		<ul>
		<LI>You've made changes to the Coppermine Photo Gallery configuration</LI>
		<LI>You've messed up the cpmfetch_config.php file</LI>
		<LI>Bridged CPG with a forum of some sort</LI>
		</ul>

		<p><A href="install.php<?php echo $INSTALLPARAMETERS; ?>">Click here to run the install [OPTIONAL].</A><br>
		or close this window to avoid overwriting.
		</p>

		<?php
		break;

	case (37):
		?>
		<p>The install has detected a configuration file for cpmfetch exists.  The version of the config file (<?php echo $CONFIG_WRITTEN_VERSION; ?>) is newer than the version of the installer (<?php echo $INSTALLER_VERSION ?>).  This typically means you are downgrading from a newer version to an older verison of CpmFetch.  If not, this is a bug.  You will need to re-run the install program. By clicking the link below, the install will re-run, possibly overwriting changes you have made manually to the cpmfetch_config.php file.  We recommend making a copy, or taking some notes if you have actually changed anything.</p>

		<p><a href="install.php<?php echo $INSTALLPARAMETERS; ?>">Click here to re-run the install [RECOMMENED].</a></p>

		<?php
		break;

	case (40):
		?>
		<p>The installer could not connect to the database defined in the Coppermine Photo
		Gallery config file.  Possible reasons for this are:</p>
		<ul>
		<LI>Are you using the correct config file?</LI>
		<LI>Is your database down or unavailable</LI>
		</ul>

		<?php
		break;
	case (50):
		?>
		<p>The installer connected to the database, but encountered a problem when querying the
		configuration tables.</p>

		<?php
		break;
	case (60):
		?>
		<p>This means that the installer did find the Coppermine Photo Gallery
		initialization file but was unable to open it for reading.</p>
		<p>Please be sure that the web server has sufficent rights to this file.</p>
		<?php
		break;
	case (70):
		?>
		<p>This means that the installer cannot write to the CpmFetch configuration file.  Please be
		sure you have sufficent rights to write to this location.</p>

		<p>You can fix this problem, then  
		<A href="install.php<?php echo $INSTALLPARAMETERS; ?>">click here</A> or simply run the install later.
		</p>

		<?php
		break;
	case (80):
		?>
		<p>An error occured while writing to the CpmFetch configuration file.  Please be
		sure you have sufficent rights to write to this location, enough disk space, etc.</p>
		<?php
		break;
	default:
		?>
		<p>An unknown error has occured.  Probably worth contact support about.</p>
		<?php
		break;
	}

} else {

?>

</TD>
</TR>

<TR bgcolor="#a2907d"><TD height="50">

<?php if (! is_writable("./tmp/feed.xml")) { ?>
<p>Possible problem if you will be doing RSS:<br />
cpmfetch/tmp/feed.xml is not writeable by the web server.  This will only affect you if you intend on using the RSS feed generation of CpmFetch.  If not, you can ignore this error.
<?php } ?>

<?php 
	$objCpm = new cpm("cpmfetch_config.php");
	$imagecount = $objCpm->cpm_getMediaCount();
	if ($imagecount == 0) {

?>

<p>The install was able to connect to your gallery, but it appears there are no images currently available (or at least public).  Because of this, we cannot show you example images.</p>

<p>But we suspect it all went okay.</p>

<p>Here is some example code, if you want to add these images into your home page and your cpmfetch directory is inside your gallery directory (which is named <em>gallery</em>) it would look like this:</p>

<pre class="code">
&lt;?php
  include "./gallery/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
  $objCpm->cpm_viewLastAddedMedia(1,4);
  $objCpm->cpm_close();
?&gt;
</pre>


<?php } else { ?>


<p>Test images - found a total of <?php print $imagecount; ?> images:<br>
If all went well, you will see some random images from your gallery displayed here.  If not, you may in fact have a problem and will need to seek help <A href="<?php print $SUPPORT_FORUM_URL; ?>" target="_blank">by clicking here</A>.</p>

<div align="center">
<?php 
//	$objCpm = new cpm("cpmfetch_config.php");
//	$objCpm->cpm_debugMode(true);

	$objCpm->cpm_viewLastAddedMedia(1,4,array("subtitle" => "{{pHits}} views"));
	$objCpm->cpm_close();
?>
</div>

<p>These images were found and displayed by using the following PHP code:</p>

<div align="left">
<pre class="code">
&lt;?php
  include "./cpmfetch.php";
  $objCpm = new cpm("./cpmfetch_config.php");
  $objCpm->cpm_viewLastAddedMedia(1,4);
  $objCpm->cpm_close();
?&gt;
</pre>

<p>Please note:  Unless you are running this code from the same directory as the cpmfetch_config.php file,
you need to alter that path so it can be found.  The same goes for the include statement.</p>

<p>For example, if you want to add these images into your home page and your cpmfetch directory is inside your
gallery directory (which is named <em>gallery</em>) it would look more like this:</p>

<pre class="code">
&lt;?php
  include "./gallery/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
  $objCpm->cpm_viewLastAddedMedia(1,4);
  $objCpm->cpm_close();
?&gt;
</pre>


<?php } ?>


<p>Please see the <A href="<?php print $SUPPORT_WEBSITE_URL; ?>" target="_blank">web site</A> or the included documentation for more information.</p>

</div>


</TD>
</TR>


<TR bgcolor="#a2907d"><TD height="50">
<p>Warnings:<br>
CpmFetch draws configuration information from your CPG database when this installer is run.  If you make any significant changes to the CPG configuration, you will need to re-run this installer.  Most changes to the CPG config will not require this to be done.  Some times that you may want to include:
</p>
<ul>
<LI>You've made changes to the Coppermine Photo Gallery configuration</LI>
<LI>You've messed up the cpmfetch_config.php file beyond repair</LI>
<LI>Bridged CPG with a forum of some sort</LI>
</ul>

</TD>
</TR>

<?php

}  // end of else

?>

<TR bgcolor="#a2907d"><TD height="50">
<p>Debug Information:<br>
If you have problems with this installation, you may be asked to provide all or some of the following information.  Support for CpmFetch is handled on the Coppermine Photo Gallery forums <A href="<?php print $SUPPORT_FORUM_URL; ?>" target="_blank">in this particular board</A>.</p>

<pre class="code">

<?php printArray($DBGO,"\n"); ?>

</pre>

</TD>
</TR>

<TR bgcolor="#a2907d">
<TD height="50" align="center">
<p>CpmFetch was written and is maintained by W.B.Chmura (aka Vuud).  Documentation support is provided soley through the <A href="<?php print $SUPPORT_WEBSITE_URL; ?>" target="_blank">cpmfetch web site at <?php print $SUPPORT_WEBSITE_URL; ?></A> and interactive support throught the <A href="<?php print $SUPPORT_FORUM_URL; ?>" target="_blank">Coppermine Photo Gallery Forums</A>.</p>
</TD>
</TR>
</TD></TR>
</TD></TR></table>

</body>
</html>



