OSDN Git Service

6145226fc4ded7bfd7a467c1f0cd741b402ecaa1
[idb/iDB-Extras.git.git] / webinstaller / webinstall.php
1 <?php
2 /*
3     This program is free software; you can redistribute it and/or modify
4     it under the terms of the Revised BSD License.
5
6     This program is distributed in the hope that it will be useful,
7     but WITHOUT ANY WARRANTY; without even the implied warranty of
8     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9     Revised BSD License for more details.
10
11     Copyright 2004-2010 iDB Support - http://idb.berlios.de/
12     Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/
13
14     $FileInfo: webinstall.php - Last Update: 09/24/2010 Ver 3.0 - Author: cooldude2k $
15 */
16 @ob_start();
17 // FTP Download Info
18 $FTPURL = "ftp.berlios.de";
19 $FTPUSER = "anonymous";
20 $FTPPASS = "";
21 $FTPPATH = "/pub/idb/nighty-ver/";
22 // HTTP Download Info
23 $HTTPURL = "http://download.berlios.de/idb/";
24 // File Name Info for both FTP and HTTP
25 $TARGZFILE = "iDB.tar.gz";
26 $TARFILE = "iDB.tar";
27 require_once("./untar.php");
28 $mydir = addslashes(str_replace("\\","/",dirname(__FILE__)."/"));
29 $conn_id = ftp_connect($FTPURL,21,90);
30 $login_result = ftp_login($conn_id, $FTPUSER, $FTPPASS);
31 if((!$conn_id)||(!$login_result)) {
32 $tarhandle = fopen("./".$TARGZFILE, "a+");
33 fwrite($tarhandle,file_get_contents($HTTPURL.$TARGZFILE));
34 fclose($tarhandle);
35 chmod("./".$TARGZFILE,0777);
36 } else {
37 ftp_pasv($conn_id, true);
38 ftp_chdir($conn_id, $FTPPATH);
39 ftp_get($conn_id, "./".$TARGZFILE, "./".$TARGZFILE, FTP_BINARY);
40 ftp_close($conn_id); }
41 gunzip("./".$TARGZFILE,"./".$TARFILE);
42 unlink("./".$TARGZFILE);
43 unlink("./LICENSE");
44 untar("./".$TARFILE,"./");
45 unlink("./".$TARFILE);
46 unlink("./untar.php");
47 unlink("./webinstall.php");
48 header("Location: ./install.php");
49 ?>