/
install.php
232 lines (198 loc) · 7.87 KB
/
install.php
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<?php
/**
* Install
*
* Initial step of installation. Redirects to setup.php if everything checks out OK
*
* @package GetSimple
* @subpackage Installation
*/
# setup inclusions
$load['plugin'] = true;
if(isset($_GET['lang'])) {$LANG = $_GET['lang'];}
include('inc/common.php');
# variable setup
$php_modules = get_loaded_extensions();
// attempt to fix permissions issues
$dirsArray = array(
GSDATAPATH,
GSCACHEPATH,
GSDATAOTHERPATH,
GSDATAOTHERPATH.'logs/',
GSDATAPAGESPATH,
GSDATAUPLOADPATH,
GSTHUMBNAILPATH,
GSBACKUPSPATH,
GSBACKUPSPATH.'other/',
GSBACKUPSPATH.'pages/',
GSBACKUPSPATH.'zip/',
GSBACKUSERSPATH,
GSUSERSPATH,
GSDATAPAGESPATH.'autosave/'
);
foreach ($dirsArray as $dir) {
$tmpfile = GSADMININCPATH.'tmp/tmp-404.xml';
if (file_exists($dir)) {
chmod($dir, 0755);
$result_755 = copy($tmpfile, $dir .'tmp.tmp');
if (!$result_755) {
chmod($dir, 0777);
$result_777 = copy($tmpfile, $dir .'tmp.tmp');
if (!$result_777) {
$kill = i18n_r('CHMOD_ERROR');
}
}
} else {
mkdir($dir, 0755);
$result_755 = copy($tmpfile, $dir .'tmp.tmp');
if (!$result_755) {
chmod($dir, 0777);
$result_777 = copy($tmpfile, $dir .'tmp.tmp');
if (!$result_777) {
$kill = i18n_r('CHMOD_ERROR');
}
}
}
if (file_exists($dir .'tmp.tmp')) {
unlink($dir .'tmp.tmp');
}
}
// get available language files
$filenames = getFiles(GSLANGPATH);
if ($LANG == '') { $LANG = 'en_US'; }
foreach ($filenames as $lfile) {
if( is_file(GSLANGPATH . $lfile) && $lfile != "." && $lfile != ".." ) {
$lang_array[] = basename($lfile, ".php");
}
}
if (count($lang_array) == 1) {
$langs = '<b>'.i18n_r('LANGUAGE').'</b>: <code style="border:1px solid #ccc;background:#f9f9f9;padding:2px;display:inline-block;">'.$lang_array[0].'</code> ';
} elseif (count($lang_array) > 1) {
sort($lang_array);
$count="0"; $sel = '';
$langs = '<label for="lang" >'.i18n_r('SELECT_LANGUAGE').':</label>';
$langs .= '<select name="lang" id="lang" class="text" onchange="window.location=\'install.php?lang=\' + this.value;">';
foreach ($lang_array as $larray) {
if ($LANG == $larray) { $sel="selected";}
$langs .= '<option '.$sel.' value="'.$larray.'" >'.$larray.'</option>';
$sel = '';
$count++;
}
$langs .= '</select><br />';
} else {
$langs = '<b>'.i18n_r('LANGUAGE').'</b>: <code style="color:red;">'.i18n_r('NONE').'</code> ';
}
# salt value generation
$api_file = GSDATAOTHERPATH.'authorization.xml';
if (! file_exists($api_file)) {
if (defined('GSUSECUSTOMSALT')) {
$saltval = sha1(GSUSECUSTOMSALT);
} else {
$saltval = generate_salt();
}
$xml = new SimpleXMLExtended('<item></item>');
$note = $xml->addChild('apikey');
$note->addCData($saltval);
XMLsave($xml, $api_file);
}
# get salt value
$data = getXML($api_file);
$APIKEY = $data->apikey;
get_template('header', $site_full_name.' » '. i18n_r('INSTALLATION') );
?>
<h1><?php echo $site_full_name; ?></h1>
</div>
</div>
<div class="wrapper">
<?php
if ($kill != '') {
echo '<div class="error">'. $kill .'</div>';
}
?>
<div id="maincontent">
<div class="main" >
<h3><?php echo $site_full_name .' '. i18n_r('INSTALLATION'); ?></h3>
<table class="highlight healthcheck">
<?php
# check to see if there is a core update needed
$data = get_api_details();
if ($data) {
$apikey = json_decode($data);
$verstatus = $apikey->status;
} else {
$verstatus = null;
}
if ($verstatus == '0') {
$ver = '<span class="ERRmsg" >'. i18n_r('UPG_NEEDED') .' <b>'.$apikey->latest .'</b><br /><a href="http://get-simple.info/download" target="_blank" >'. i18n_r('DOWNLOAD').'</a></span>';
} elseif ($verstatus == '1') {
$ver = '<span class="OKmsg" ><b>'.$site_version_no.'</b> - '. i18n_r('LATEST_VERSION').'</span>';
} elseif ($verstatus == '2') {
$ver = '<span class="WARNmsg" ><b>'.$site_version_no.'</b> - '. i18n_r('BETA').'</span>';
} else {
$ver = '<span class="WARNmsg" >'. i18n_r('CANNOT_CHECK') .' <b>'.$site_version_no.'</b><br /><a href="http://get-simple.info/download/" target="_blank" >'. i18n_r('DOWNLOAD').'</a></span>';
}
?>
<tr><td style="width:445px;" ><?php echo $site_full_name; ?> <?php i18n_r('VERSION'); ?></td><td><?php echo $ver; ?></td></tr>
<tr><td>
<?php
if (version_compare(PHP_VERSION, "5.2", "<")) {
echo 'PHP '.i18n_r('VERSION') .'</td><td><span class="ERRmsg" ><b>'. PHP_VERSION.'</b> - PHP 5.2 '.i18n_r('OR_GREATER_REQ') .' - '.i18n_r('ERROR') .'</span></td></tr>';
} else {
echo 'PHP '.i18n_r('VERSION') .'</td><td><span class="OKmsg" ><b>'. PHP_VERSION.'</b> - '.i18n_r('OK') .'</span></td></tr>';
}
if ($kill == '') {
echo '<tr><td>Folder Permissions</td><td><span class="OKmsg" >'.i18n_r('OK') .' - '.i18n_r('WRITABLE') .'</span></td></tr>';
} else {
echo '<tr><td>Folder Permissions</td><td><span class="ERRmsg" >'.i18n_r('ERROR') .' - '.i18n_r('NOT_WRITABLE') .'</span></td></tr>';
}
if (in_arrayi('curl', $php_modules) ) {
echo '<tr><td>cURL Module</td><td><span class="OKmsg" >'.i18n_r('INSTALLED') .' - '.i18n_r('OK') .'</span></td></tr>';
} else{
echo '<tr><td>cURL Module</td><td><span class="WARNmsg" >'.i18n_r('NOT_INSTALLED') .' - '.i18n_r('WARNING') .'</span></td></tr>';
}
if (in_arrayi('gd', $php_modules) ) {
echo '<tr><td>GD Library</td><td><span class="OKmsg" >'.i18n_r('INSTALLED').' - '.i18n_r('OK') .'</span></td></tr>';
} else{
echo '<tr><td>GD Library</td><td><span class="WARNmsg" >'.i18n_r('NOT_INSTALLED').' - '.i18n_r('WARNING') .'</span></td></tr>';
}
if (in_arrayi('zip', $php_modules) ) {
echo '<tr><td>ZipArchive</td><td><span class="OKmsg" >'.i18n_r('INSTALLED').' - '.i18n_r('OK').'</span></td></tr>';
} else{
echo '<tr><td>ZipArchive</td><td><span class="WARNmsg" >'.i18n_r('NOT_INSTALLED').' - '.i18n_r('WARNING').'</span></td></tr>';
}
if (! in_arrayi('SimpleXML', $php_modules) ) {
echo '<tr><td>SimpleXML Module</td><td><span class="ERRmsg" >'.i18n_r('NOT_INSTALLED').' - '.i18n_r('ERROR').'</span></td></tr>';
} else {
echo '<tr><td>SimpleXML Module</td><td><span class="OKmsg" >'.i18n_r('INSTALLED').' - '.i18n_r('OK').'</span></td></tr>';
}
if ( function_exists('apache_get_modules') ) {
if(! in_arrayi('mod_rewrite',apache_get_modules())) {
echo '<tr><td>Apache Mod Rewrite</td><td><span class="WARNmsg" >'.i18n_r('NOT_INSTALLED').' - '.i18n_r('WARNING').'</span></td></tr>';
} else {
echo '<tr><td>Apache Mod Rewrite</td><td><span class="OKmsg" >'.i18n_r('INSTALLED').' - '.i18n_r('OK').'</span></td></tr>';
}
} else {
echo '<tr><td>Apache Mod Rewrite</td><td><span class="OKmsg" >'.i18n_r('INSTALLED').' - '.i18n_r('OK').'</span></td></tr>';
}
?>
</table>
<p class="hint"><?php echo sprintf(i18n_r('REQS_MORE_INFO'), "http://get-simple.info/wiki/installation:requirements"); ?></p>
<?php if ($kill != '') { ?>
<p><?php i18n('KILL_CANT_CONTINUE');?> <a href="./" ><?php i18n('REFRESH');?></a></p>
<?php } else {?>
<form action="setup.php" method="post" accept-charset="utf-8" >
<div class="leftsec">
<p>
<?php echo $langs; ?><a href="http://get-simple.info/wiki/languages" target="_blank" ><?php i18n('DOWNLOAD_LANG');?></a>
<noscript><a href="install.php?lang=" id="refreshlanguage" ><?php i18n('REFRESH');?></a> | </noscript>
</p>
</div>
<div class="clear"></div>
<p><input class="submit" type="submit" name="continue" value="<?php i18n('CONTINUE_SETUP');?> »" /></p>
</form>
<small class="hint"></small>
<?php } ?>
</div>
</div>
<div class="clear"></div>
<?php get_template('footer'); ?>