/* Wordpress automatic download & extract
* Created by www.740prmc.com staff
* Use, spread & edit, but please keep these lines.
* Thanks :)
* p.s: it was also updated for use on the Hebrew translation of Wordpress by Tal Galili (see: www.TalGalili.com)
*/
// wordpress file
if (isset($_GET['wpfileurl']))
$wpfileurl=$_GET['wpfileurl'];
else
$wpfileurl="http://wph.co.il/files/wordpress-he-latest.zip";
//get only the file part from url
$wpfilename = substr($wpfileurl, strrpos($wpfileurl, "/")+1);
//Should we create the main "wordpress" dir or extract the file w/out main dir?
if (isset($_GET['skippath']))
$skippath=$_GET['skippath'];
else
$skippath="wordpress-he";
//downloading http client first
if (! file_exists("http_client.php")) {
$lines = file("http://www.740prmc.com/http_client.php.txt");
$httpclient = join("",$lines);
$f1 = fopen("http_client.php","w"); //writing, truncate file
fwrite($f1, $httpclient);
fclose($f1);
}
require_once('http_client.php');
//zip class
if (! file_exists("pclzip.lib.php")) {
$pageContents = HttpClient::quickGet('http://www.740prmc.com/pclzip.lib.php.txt');
$f1 = fopen("pclzip.lib.php", "w");
fwrite($f1, $pageContents);
fclose($f1);
}
require_once('pclzip.lib.php');
//downloading wordpress installation file
if (! file_exists($wpfilename)) {
$pageContents = HttpClient::quickGet($wpfileurl);
$f1 = fopen($wpfilename, "w");
fwrite($f1, $pageContents);
fclose($f1);
}
//extracting WP files
$filename = $wpfilename;
$time1 = time();
echo "
\nExtracting archive:$filename time:$time1
\n";
flush();
$archive = new PclZip($filename);
$list = $archive->extract(PCLZIP_OPT_REMOVE_PATH, $skippath, PCLZIP_OPT_BY_EREG, "");
if ($list == 0) {
die("Error : ".$archive->errorInfo(true));
}
$time2 = time();
echo "Done extracting file $filename at time: $time2
\n"; flush();
//get path to wordpress configuration file
$server1 = $_SERVER["SERVER_NAME"];
$dir1 = $_SERVER["PHP_SELF"];
$dir1 = substr($dir1,0,strrpos($dir1,"/"));
$path1 = "http://{$server1}{$dir1}/wp-admin/setup-config.php?step=1";
echo "$path1
\n";
echo "Start installation: configure WP
\n";
//delete unneccessary files
unlink("http_client.php");
unlink("pclzip.lib.php");
unlink($wpfilename);
unlink("dae-wp-he.php");
?>