<?php
//Copyright (c) Florian Grannemann
//Last change in version: 2.0 RC 2
/*
******************************************************************************
ADbNewsSender 2
Copyright (C) 2009 Florian Grannemann (hide@address.com)
Website: http://adbnewssender.sf.net
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/
******************************************************************************
*/
//Do not edit anything unless you realy REALY know what you are doing!
$language=addslashes($_POST['language']);
$language=preg_replace("/\.\./", "",$language);
include "$path_to_protected/localisation/lang/$language/lang-setup.php.inc";
include "$path_to_protected/skeleton/public_apis.class.php.inc";
include "$path_to_protected/skeleton/private_apis.class.php.inc";
$MyDB=new ADBNS_DB("$path_to_protected/skeleton/includes/db_defs/","$path_to_protected/database/DBconf.php.inc");
if(!@$MyDB->connect())
{
die($MSG_NO_CONNECTION);
}
$MyCFG= new global_config_rw($MyDB);
//checking if ADBNewsSender 2 is already installed
$oldVersion=$MyCFG->get_config_value("Version");
$installoptions=array();
if(!$oldVersion)
{
//it seems not:
$installoptions[0]="install";
}
else
{
if($MyCFG->version_greater_than($version)==true)
{
$installoptions[0]="reinstall";
$installoptions[1]="update";
}
//checking if version numbers are equal (ignoring whether one or both versions are development versions)
if(preg_match("/ /",$oldVersion))
{
$oldVersion_arr=explode(" ",$oldVersion);
$oldVersion=$oldVersion_arr[0];
}
if(preg_match("/ /",$version))
{
$version_arr=explode(" ",$version);
$version=$version_arr[0];
}
if($oldVersion==$version)
{
$installoptions[0]="reinstall";
}
//let's see if the main version is equal
if($MyCFG->main_version_is_equal($version))
{
//yes:
$installoptions[count($installoptions)]="uninstall";
}
}
print "<H1>ADbNewsSender $version $Step2_WelcomeMSG</H1>";
if(count($installoptions) <1)
{
print $MSG_NO_OPTIONS."<br>";
}
else
{
print $Step2_Select_option;
print "<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\">";
print "<input type=\"hidden\" name=\"language\" value=\"$language\">";
print "<input type=\"hidden\" name=\"step\" value=\"3\">";
$i=0;
while($i < count($installoptions))
{
print "<input type=\"radio\" NAME=\"setupoption\" value=\"".$installoptions[$i]."\"";
if($i==0 || $installoptions[$i] =="update")
{
print " checked ";
}
print ">".$Lang_installoptions[$installoptions[$i]]."<br>";
print "(".$Lang_installoptions_desc[$installoptions[$i]].")";
print "<br>";
$i++;
}
print "<br>";
print "<input type=\"submit\" value=\"$Step2_continue\"></form>";
}
?>