<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
/**
* @version $Id: install.supacart.php 617 2007-01-04 19:43:08Z soeren_nb $
* @package SupaCart
* @subpackage core
* See COPYRIGHT.php for copyright notices and details.
* @license GNU/GPL Version 2, see LICENSE.php
* SupaCart is free software, originally derived from Virtuemart. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*
* http://www.supacart.com
*/
function supacart_is_installed() {
global $database, $mosConfig_absolute_path, $mosConfig_dbprefix,
$VMVERSION, $shortversion, $myVersion, $version_info;
//add SupaCart admin menu image
$database->setQuery( "UPDATE #__components SET admin_menu_img = '../administrator/components/com_supacart/favicon.ico' WHERE admin_menu_link = 'option=com_supacart'");
$database->query();
$option = 'com_supacart';
$installfile = dirname( __FILE__ ) . "/install.php";
$database->setQuery( "SHOW TABLES LIKE '".$mosConfig_dbprefix."scart_%'" );
$vm_tables = $database->loadObjectList();
if( file_exists( $mosConfig_absolute_path.'/administrator/components/'.$option.'/classes/htmlTools.class.php' )
&& count( $vm_tables)> 30 ) {
// SupaCart is installed! But is it an older version that needs to be updated?
$database->setQuery( 'SELECT id, params FROM `#__components` WHERE name = \'supacart_version\'' );
$database->loadObject( $old_version );
if( $old_version && file_exists( $mosConfig_absolute_path.'/administrator/components/com_supacart/classes/htmlTools.class.php')) {
$version_info = new mosParameters( $old_version->params );
include_once( $mosConfig_absolute_path.'/administrator/components/'.$option.'/version.php' );
$VMVERSION = new vmVersion();
$result = version_compare( $version_info->get( 'RELEASE' ), '1.0.5' );
// IF we need to update, version_compare has returned -1, that means that the current version is lower than 1.0.5
if( $result == -1 ) {
return false;
}
}
@unlink( $installfile );
if( ( file_exists($installfile)) || !file_exists(dirname( __FILE__ ) . "/supacart.cfg.php")) {
die('<h2>SupaCart Installation Notice</h2>
<p>You already have installed SupaCart.</p>
<p>You MUST
<ol>
<li>DELETE the file <strong>'.$installfile.'</strong>,</li>
<li>RENAME the file <strong>supacart.cfg-dist.php</strong> to <strong>supacart.cfg.php</strong></li>
</ol>before you can use SupaCart.
</p>');
}
else {
mosRedirect('index2.php?option=com_supacart');
}
}
return false;
}
function com_install() {
global $mosConfig_absolute_path, $mosConfig_dbprefix, $database,
$VMVERSION, $myVersion, $shortversion, $version_info;
include( $mosConfig_absolute_path. "/administrator/components/com_supacart/version.php" );
if( !isset( $shortversion )) {
$shortversion = $VMVERSION->PRODUCT . " " . $VMVERSION->RELEASE . " " . $VMVERSION->DEV_STATUS. " ";
$myVersion = $shortversion . " [".$VMVERSION->CODENAME ."] <br />" . $VMVERSION->RELDATE . " "
. $VMVERSION->RELTIME . " " . $VMVERSION->RELTZ;
}
?>
<link rel="stylesheet" href="components/com_supacart/install.css" type="text/css" />
<div align="center">
<table width="100%" border="0">
<tr>
<td valign="middle" align="center">
<div id="ctr" align="center">
<div class="install">
<div align="center"><h2>Welcome to <?php echo $shortversion ?>!</h2></div>
<div class="clr"></div>
<pre><?php echo $myVersion ?></pre>
<h1>The first step of the Installation was <font color="green">SUCCESSFUL</font></h1>
<table>
<tr>
<td width="40%">Basic Installation has been finished. You can use SupaCart in a moment after having clicked on a link below.<br/></td>
<td width="20%"> </td>
<td width="40%">To fill your Shop with dummy products, and to see how things can be set up,
you can install some Sample Data now.
</td>
</tr>
<tr><td> </td><td> </td></tr>
<tr>
<td width="40%" rowspan="3">
<a title="Go directly to the Shop >>" onclick="alert('Please don\'t interrupt the next Step! \n It is essential for running SupaCart.');" name="Button1" class="button" href="index2.php?option=com_supacart&install_type=newinstall">Go directly to the Shop >></a>
</td>
<td width="20%"> </td>
<td width="40%">
<a name="Button2" onclick="alert('Please don\'t interrupt the next Step! \n It is essential for running SupaCart.');" class="button" title="Install SAMPLE DATA (UK Based) >>" href="index2.php?option=com_supacart&install_type=newinstall&install_sample_data=true&sample_data_type=uk">Install SAMPLE DATA (UK Based) >></a>
</td>
</tr>
<tr><td> </td><td> </td></tr>
<tr>
<td width="20%"> </td>
<td width="40%">
<a name="Button3" onclick="alert('Please don\'t interrupt the next Step! \n It is essential for running SupaCart.');" class="button" title="Install SAMPLE DATA (US Based) >>" href="index2.php?option=com_supacart&install_type=newinstall&install_sample_data=true&sample_data_type=us">Install SAMPLE DATA (US Based) >></a>
</td>
</tr>
<tr>
<td align="center" colspan="3"><br /><br /><hr /><br /></td>
</tr>
<tr>
<td align="center" colspan="3">Go to <a href="http://www.supacart.com" target="_blank">supacart.com</a> for further Help</td>
</tr>
</table>
<div class="clr"></div>
</div>
</td>
</tr>
</table>
</div>
<?php
}
?>