$msg"; } function print_notice($msg) { print "
$msg
"; } function db_connect($host, $user, $pass, $db, $type) { if ($type == "pgsql") { $string = "dbname=$db user=$user"; if ($pass) { $string .= " password=$pass"; } if ($host) { $string .= " host=$host"; } if (defined('DB_PORT')) { $string = "$string port=" . DB_PORT; } $link = pg_connect($string); return $link; } else if ($type == "mysql") { $link = mysql_connect($host, $user, $pass); if ($link) { $result = mysql_select_db($db, $link); return $link; } } } function db_query($link, $query, $type, $die_on_error = true) { if ($type == "pgsql") { $result = pg_query($link, $query); if (!$result) { $query = htmlspecialchars($query); // just in case if ($die_on_error) { die("Query $query failed [$result]: " . ($link ? pg_last_error($link) : "No connection")); } } return $result; } else if ($type == "mysql") { $result = mysql_query($query, $link); if (!$result) { $query = htmlspecialchars($query); if ($die_on_error) { die("Query $query failed: " . ($link ? mysql_error($link) : "No connection")); } } return $result; } } ?>

Tiny Tiny RSS Installer

Database settings

Checking configuration

0) { print "

Some configuration tests failed. Please correct them before continuing.

"; print ""; exit; } ?>

Checking database

Initialize database

Before you can start using tt-rss, database needs to be initialized. Click on the button below to do that now.

Initializing database..."; $lines = explode(";", preg_replace("/[\r\n]/", "", file_get_contents("../schema/ttrss_schema_".basename($DB_TYPE).".sql"))); foreach ($lines as $line) { if (strpos($line, "--") !== 0 && $line) { db_query($link, $line, $DB_TYPE); } } print_notice("Database initialization completed."); } else { print_notice("Database initialization skipped."); } print "

Generated configuration file

"; 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.

"; } ?>