forked from RomanSixty/Feed-on-Feeds
-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.php
executable file
·205 lines (177 loc) · 6.9 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
<?php
/*
* This file is part of FEED ON FEEDS - http://feedonfeeds.com/
*
* install.php - creates tables and cache directory, if they don't exist
*
*
* Copyright (C) 2004-2007 Stephen Minutillo
* [email protected] - http://minutillo.com/steve/
*
* Distributed under the GPL - see LICENSE
*
*/
define('VERSION_REQUIRED_PHP', '5.0.0');
define('VERSION_REQUIRED_CURL', '7.10.5');
$install_early_warn = NULL;
try {
require_once 'fof-install.php';
} catch (Exception $e) {
$install_early_warn .= "<div class='trouble'>Trouble encountered: <span class='warn'><pre>" . $e->GetMessage() . "</pre></span> Trying to continue...</div>\n";
}
fof_set_content_type();
?>
<!DOCTYPE html>
<html>
<head>
<title>Feed on Feeds - Installation</title>
<link rel="stylesheet" href="fof.css" media="screen" />
<script src="fof.js" type="text/javascript"></script>
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
<style>
body {
font-family: georgia;
font-size: 16px;
}
div {
background: #eee;
border: 1px solid black;
width: 75%;
margin: 5em auto;
padding: 1.5em;
}
hr {
height:0;
border:0;
border-top:1px solid #999;
}
.fail { color: red; }
.pass { color: green; }
.warn { color: #a60; }
.exists {
margin:.25em auto;
padding:0;
border:0;
font-size:70%;
}
</style>
</head>
<body>
<?php
if (!empty($install_early_warn)) {
echo $install_early_warn;
}
?>
<div>
<center style="font-size: 20px;">
<h1><a href="http://feedonfeeds.com/">Feed on Feeds</a> - Installation</h1>
</center>
<br>
<?php
if (isset($_POST['password']) && isset($_POST['password2'])) {
if ($_POST['password'] == $_POST['password2']) {
fof_db_add_user_all(1, 'admin', $_POST['password'], 'admin');
fof_log("admin user created");
echo '<center><b>OK! Setup complete! <a href=".">Login as admin</a>, and start subscribing!</center></b>';
echo '</div></body></html>';
exit();
} else {
echo "<center><span class='fail'>Passwords do not match!</span></center><br><br>";
}
} else {
fof_log("install started");
?>
<h2>Checking compatibility...</h2>
<?php
$compat_fatal = 0;
$php_ok = (function_exists('version_compare') && version_compare(phpversion(), VERSION_REQUIRED_PHP, '>='));
$compat_fatal |= fof_install_compat_notice($php_ok, "PHP", "Your PHP version is too old!", "Feed on Feeds requires at least PHP version " . VERSION_REQUIRED_PHP, 1);
$compat_fatal |= fof_install_compat_notice(extension_loaded('xml'), "XML", "Your PHP installation is missing the XML extension!", "This is required by Feed on Feeds.", 1);
$compat_fatal |= fof_install_compat_notice(extension_loaded('pcre'), "PCRE", "Your PHP installation is missing the PCRE extension!", "This is required by Feed on Feeds.", 1);
$compat_fatal |= fof_install_compat_notice(extension_loaded('pdo'), "PDO", "Your PHP installation is missing the PDO extension!", "This is required by Feed on Feeds.", 1);
$mysql_ok = extension_loaded('pdo_mysql');
$sqlite_ok = extension_loaded('pdo_sqlite');
$compat_fatal |= fof_install_compat_notice($sqlite_ok,
"SQLite",
"Your PHP installation does not support the SQLite database" . (defined('USE_SQLITE') ? ", but you have configured Feed on Feeds to use this database!" : "."),
defined('USE_SQLITE') ? "PHP will need to support this database, or you must configure a different one." : "This is not required if another database is available.",
defined('USE_SQLITE'));
$compat_fatal |= fof_install_compat_notice($mysql_ok,
"MySQL",
"Your PHP installation does not support the MySQL database" . (defined('USE_MYSQL') ? ", but you have configured Feed on Feeds to use this database!" : "."),
defined('USE_MYSQL') ? "PHP will need to support this database, or you must configure a different one." : "This is not required if another database is available.",
defined('USE_MYSQL'));
$compat_fatal |= fof_install_compat_notice($sqlite_ok || $mysql_ok, "PDO database", "Your PHP installation is missing a supported PDO database extension!", "This is required by Feed on Feeds.", 1);
$curl_ok = (extension_loaded('curl') && version_compare(get_curl_version(), VERSION_REQUIRED_CURL, '>='));
$compat_fatal |= fof_install_compat_notice($curl_ok, "cURL", "Your PHP installation is either missing the cURL extension, or it is too old!", "cURL version " . VERSION_REQUIRED_CURL . " or later is required to be able to subscribe to https or digest authenticated feeds.");
$compat_fatal |= fof_install_compat_notice(extension_loaded('zlib'), "zlib", "Your PHP installation is missing the zlib extension!", "Feed on Feeds will not be able to save bandwidth by requesting compressed feeds.");
$compat_fatal |= fof_install_compat_notice(extension_loaded('iconv'), "iconv", "Your PHP installation is missing the iconv extension!", "The number of international languages that Feed on Feeds can handle will be reduced.");
$compat_fatal |= fof_install_compat_notice(extension_loaded('mbstring'), "mbstring", "Your PHP installation is missing the mbstring extension!", "The number of international languages that Feed on Feeds can handle will be reduced.");
$compat_fatal |= fof_install_compat_notice(class_exists('finfo'), 'fileinfo', 'Your PHP installation is missing the fileinfo extension!', 'Some feed\'s icons may not be displayed.');
if ($compat_fatal) {
echo "</div></body></html>";
exit();
}
?>
<br>Minimum requirements met!
<hr>
<h2>Checking cache directory...</h2>
<?php
if (!fof_install_datadir()) {
echo "</div></body></html>\n";
exit();
}
?>
<br>Data directory ready.
<hr>
<h2>Creating tables...</h2>
<?php
fof_install_database(fof_install_schema(), 1);
?>
<br>Tables exist.
<hr>
<h2>Updating tables...</h2>
<?php
fof_install_database_update_old_tables();
?>
<br>Tables up to date.
<hr>
<h2>Inserting initial data...</h2>
<?php
fof_install_database_populate();
?>
<br>Data initialized.
<hr>
<h2>Checking cache directory...</h2>
<?php
if (!fof_install_cachedir()) {
echo "</div></body></html>\n";
exit();
}
?>
<br>Cache directory ready.
<hr>
<?php
}
?>
<h2>Checking admin user...</h2>
<?php
if (!fof_install_user_level_exists('admin')) {
?>
You now need to choose an initial password for the 'admin' account:<br>
<form method="POST">
<table>
<tr><td>Password:</td><td><input type=password name=password></td></tr>
<tr><td>Password again:</td><td><input type=password name=password2></td></tr>
</table>
<input type=submit value="Set Password">
</form>
<?php
} else {
?>
<br>'admin' account already exists.
<br><b><center>OK! Setup complete! <a href=".">Login as admin</a>, and start subscribing!</center></b>
<?php
}
?>
</div></body></html>