diff --git a/include/db.php b/include/db.php
index 0479df6a9..a70a1d878 100644
--- a/include/db.php
+++ b/include/db.php
@@ -15,7 +15,7 @@ function db_connect($host, $user, $pass, $db) {
$string .= " host=$host";
}
- if (defined('DB_PORT')) {
+ if (defined('DB_PORT') && DB_PORT) {
$string = "$string port=" . DB_PORT;
}
diff --git a/include/sanity_check.php b/include/sanity_check.php
index 0373196b3..f428550fd 100644
--- a/include/sanity_check.php
+++ b/include/sanity_check.php
@@ -12,6 +12,10 @@
require_once "sanity_config.php";
+ if (file_exists("install") && !file_exists("config.php")) {
+ array_push($errors, "Please copy config.php-dist to config.php or run the installer in install/");
+ }
+
if (strpos(PLUGINS, "auth_") === FALSE) {
array_push($errors, "Please enable at least one authentication module via PLUGINS constant in config.php");
}
diff --git a/index.php b/index.php
index c6698793f..757be9084 100644
--- a/index.php
+++ b/index.php
@@ -1,4 +1,8 @@
Fatal Error: You forgot to copy
config.php-dist to config.php and edit it.\n";
diff --git a/install/index.php b/install/index.php
new file mode 100644
index 000000000..21dd0d8c7
--- /dev/null
+++ b/install/index.php
@@ -0,0 +1,352 @@
+
+
+ Tiny Tiny RSS - Installer
+
+
+
+
+
+
+
+ function sanity_check($db_type) {
+ $errors = array();
+
+ if (version_compare(PHP_VERSION, '5.3.0', '<')) {
+ array_push($errors, "PHP version 5.3.0 or newer required.");
+ }
+
+ if (ini_get("open_basedir")) {
+ array_push($errors, "PHP configuration option open_basedir is not supported. Please disable this in PHP settings file (php.ini).");
+ }
+
+ if (!function_exists("curl_init") && !ini_get("allow_url_fopen")) {
+ array_push($errors, "PHP configuration option allow_url_fopen is disabled, and CURL functions are not present. Either enable allow_url_fopen or install PHP extension for CURL.");
+ }
+
+ if (!function_exists("json_encode")) {
+ array_push($errors, "PHP support for JSON is required, but was not found.");
+ }
+
+ if ($db_type == "mysql" && !function_exists("mysql_connect")) {
+ array_push($errors, "PHP support for MySQL is required for configured $db_type in config.php.");
+ }
+
+ if ($db_type == "pgsql" && !function_exists("pg_connect")) {
+ array_push($errors, "PHP support for PostgreSQL is required for configured $db_type in config.php");
+ }
+
+ if (!function_exists("mb_strlen")) {
+ array_push($errors, "PHP support for mbstring functions is required but was not found.");
+ }
+
+ if (!function_exists("hash")) {
+ array_push($errors, "PHP support for hash() function is required but was not found.");
+ }
+
+ if (!function_exists("ctype_lower")) {
+ array_push($errors, "PHP support for ctype functions are required by HTMLPurifier.");
+ }
+
+ if (!function_exists("iconv")) {
+ array_push($errors, "PHP support for iconv is required to handle multiple charsets.");
+ }
+
+ /* if (ini_get("safe_mode")) {
+ array_push($errors, "PHP safe mode setting is not supported.");
+ } */
+
+ if ((PUBSUBHUBBUB_HUB || PUBSUBHUBBUB_ENABLED) && !function_exists("curl_init")) {
+ array_push($errors, "PHP support for CURL is required for PubSubHubbub.");
+ }
+
+ if (!class_exists("DOMDocument")) {
+ array_push($errors, "PHP support for DOMDocument is required, but was not found.");
+ }
+
+ return $errors;
+ }
+
+ function print_error($msg) {
+ print "
Copy following text and save as config.php in tt-rss main directory. It is suggested to read through the file to the end in case you need any options changed fom default values.
";
+
+ print "";
+
+ print "
You can generate the file again by changing the form above.