-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwordpress.php
More file actions
executable file
·162 lines (149 loc) · 4.3 KB
/
wordpress.php
File metadata and controls
executable file
·162 lines (149 loc) · 4.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
error_reporting(0);
function deleteDir($dirPath)
{
if (!is_dir($dirPath)) {
throw new InvalidArgumentException("$dirPath must be a directory");
}
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$dirPath .= '/';
}
$files = glob($dirPath.'*', GLOB_MARK);
foreach ($files as $file) {
if (is_dir($file)) {
self::deleteDir($file);
} else {
unlink($file);
}
}
rmdir($dirPath);
}
/*
This file will install EasySite.
*/
$downloadlocation = 'https://github.com/alwaysontop617/easySITE/archive/master.zip';
$folder = 'easySITE-master/';
if (isset($_POST['p'])) {
if (file_exists('wp-admin') && file_exists('wp-content') && file_exists('wp-includes')) {
} else {
die();
}
if (file_exists($folder.'system.php')) {
deleteDir('application');
deleteDir('data');
deleteDir('plugins');
deleteDir('system');
unlink($folder.'README.md');
}
//start the install
if (file_exists($folder.'system.php')) {
unlink($folder.'system.php');
}
echo 'Grabbing Installation files from '.$downloadlocation;
file_put_contents('master.zip', file_get_contents($downloadlocation));
echo '<br>Extracting to '.realpath('.');
$zip = new ZipArchive();
$res = $zip->open('master.zip');
if ($res === true) {
$zip->extractTo(realpath('.'));
$zip->close();
}
unlink($folder.'index.php');
$files = scandir('easySITE-master');
$oldfolder = $folder;
$newfolder = realpath('.').'/';
foreach ($files as $fname) {
if ($fname != '.' && $fname != '..') {
rename($oldfolder.$fname, $newfolder.$fname);
}
}
deleteDir('easySITE-master');
echo '<br>Integrating System(This might take some time)...';
unlink('index.php');
$wordpressindex = "
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/*
* Installation of easySITE wordpress integration
* @package easySite
* Do not remove any code below this line
*
*/
error_reporting(0);
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
require('system.php');
die();
";
file_put_contents('index.php', $wordpressindex);
echo '<br>The installation is complete, you may now check it out by adding the ?adm123 tag!!';
}
?>
<!doctype html>
<html>
<head>
<title>Installation</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
body {
background-color: #f0f0f2;
margin: 0;
padding: 0;
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
div {
width: 600px;
margin: 5em auto;
padding: 50px;
background-color: #fff;
border-radius: 1em;
}
a:link, a:visited {
color: #38488f;
text-decoration: none;
}
@media (max-width: 700px) {
body {
background-color: #fff;
}
div {
width: auto;
margin: 0 auto;
border-radius: 0;
padding: 1em;
}
}
</style>
</head>
<body>
<div>
<h1>Installation</h1>
<p><?php
if (file_exists('wp-admin') && file_exists('wp-content') && file_exists('wp-includes')) {
echo 'We detected you are using wordpress. You may continue to install the system.';
if (!file_exists('install.lock') && isset($_GET['ndsf'])) {
echo 'In order to use the installation files, you must create a file named install.lock. This was created to put a stop to hackers.';
die();
}
} else {
echo 'This system cannot find wordpress unsupported, please place this file in your wordpress directory!!';
die();
}
?></p>
<p><form method="POST" action="#"><input type="submit" name="p" value="Start Installation"></form></p>
</div>
</body>
</html>