\n"; echo "\n"; echo " \n"; echo " Poweradmin\n"; echo " \n"; echo " \n"; echo " "; echo " \n"; echo " \n"; if (!isset($_POST['step']) || !is_numeric($_POST['step'])) { $step = 1; } else { $step = $_POST['step']; } echo "

Poweradmin

\n"; echo "

" . _('Installation step') . " " . $step . "

\n"; switch ($step) { case 1: $step++; echo "
\n"; echo " I prefer to proceed in english.
\n"; echo " Ik ga graag verder in het Nederlands.
\n"; echo " Ich mache in Deutsch weiter.
\n"; echo " 日本語で続ける
\n"; echo " Chcę kontynuować po polsku.
\n"; echo " Je préfère continuer en français.
\n"; echo " Jeg ønsker å forsette på norsk.
\n"; echo " "; echo " "; echo "
\n"; break; case 2: $step++; echo "

" . _('This installer expects you to have a PowerDNS database accessable from this server. This installer also expects you to have never ran Poweradmin before, or that you want to overwrite the Poweradmin part of the database. If you have had Poweradmin running before, any data in the following tables will be destroyed: perm_items, perm_templ, perm_templ_items, users and zones. This installer will, of course, not touch the data in the PowerDNS tables of the database. However, it is recommended that you create a backup of your database before proceeding.') . "

\n"; echo "

" . _('The alternative for this installer is a manual installation. Refer to the poweradmin.org website if you want to go down that road.') . "

\n"; echo "

" . _('Finally, if you see any errors during the installation process, a problem report would be appreciated. You can report problems (and ask for help) on the poweradmin mailinglist.') . "

"; echo "

" . _('Do you want to proceed now?') . "

\n"; echo "
"; echo ""; echo ""; echo ""; echo "
"; break; case 3: $step++; echo "

" . _('To prepare the database for using Poweradmin, the installer needs to modify the PowerDNS database. It will add a number of tables and it will fill these tables with some data. If the tables are already present, the installer will drop them first.') . "

"; echo "

" . _('To do all of this, the installer needs to access the database with an account which has sufficient rights. If you trust the installer, you may give it the username and password of the database user root. Otherwise, make sure the user has enough rights, before actually proceeding.') . "

"; echo "
"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
" . _('Username') . "" . _('The username to use to connect to the database, make sure the username has sufficient rights to perform administrative task to the PowerDNS database (the installer wants to drop, create and fill tables to the database).') . "
" . _('Password') . "" . _('The password for this username.') . "
" . _('Database type') . "" . "" . _('The type of the PowerDNS database.') . "
" . _('Hostname') . "" . _('The hostname on which the PowerDNS database resides. Frequently, this will be "localhost".') . "
" . _('DB Port') . "" . _('The port the database server is listening on.') . "
" . _('Database') . "" . _('The name of the PowerDNS database.') . "" . "" . _('The path and filename to the PowerDNS SQLite database.') . "
" . _('Poweradmin administrator password') . "" . _('The password of the Poweradmin administrator. This administrator has full rights to Poweradmin using the web interface.') . "
\n"; echo "
\n"; echo ""; echo ""; echo ""; echo "
"; break; case 4: $step++; echo "

" . _('Updating database...') . " "; include_once("../inc/config-me.inc.php"); $db_user = $_POST['user']; $db_pass = $_POST['pass']; $db_host = $_POST['host']; $db_port = $_POST['dbport']; $db_name = $_POST['name']; $db_type = $_POST['type']; if ($db_type == 'sqlite') { $db_file = $db_name; } $pa_pass = $_POST['pa_pass']; require_once("../inc/database.inc.php"); $db = dbConnect(); $db->loadModule('Manager'); $db->loadModule('Extended'); include_once("database-structure.inc.php"); $current_tables = $db->listTables(); foreach ($def_tables as $table) { if (in_array($table['table_name'], $current_tables)) $db->dropTable($table['table_name']); $db->createTable($table['table_name'], $table['fields'], $table['options']); } $fill_perm_items = $db->prepare('INSERT INTO perm_items VALUES (?, ?, ?)'); $db->extended->executeMultiple($fill_perm_items, $def_permissions); if (method_exists($fill_perm_items, 'free')) { $fill_perm_items->free(); } foreach ($def_remaining_queries as $user_query) { $db->query($user_query); } echo _('done!') . "

"; echo "

" . _('Now we will gather all details for the configuration itself.') . "

\n"; echo "
"; echo " "; echo " "; if ($db_type != 'sqlite') { echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; ; echo " \n"; echo " \n"; echo " \n"; echo "
" . _('Username') . "" . _('The username for Poweradmin. This new user will have limited rights only.') . "
" . _('Password') . "" . _('The password for this username.') . "
" . _('Hostmaster') . "" . _('When creating SOA records and no hostmaster is provided, this value here will be used. Should be in the form "hostmaster.example.net".') . "
" . _('Primary nameserver') . "" . _('When creating new zones using the template, this value will be used as primary nameserver. Should be like "ns1.example.net".') . "
" . _('Secondary nameserver') . "" . _('When creating new zones using the template, this value will be used as secondary nameserver. Should be like "ns2.example.net".') . "
"; echo "
\n"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; break; case 5: $step++; $db_user = $_POST['db_user']; $db_pass = $_POST['db_pass']; $db_host = $_POST['db_host']; $db_port = $_POST['db_port']; $db_name = $_POST['db_name']; $db_type = $_POST['db_type']; if ($db_type == 'sqlite') { $db_file = $db_name; } else { $pa_db_user = $_POST['pa_db_user']; $pa_db_pass = $_POST['pa_db_pass']; } $pa_pass = $_POST['pa_pass']; $dns_hostmaster = $_POST['dns_hostmaster']; $dns_ns1 = $_POST['dns_ns1']; $dns_ns2 = $_POST['dns_ns2']; $db_layer = 'PDO'; require_once("../inc/database.inc.php"); $db = dbConnect(); include_once("database-structure.inc.php"); echo "

" . _('You now want to give limited rights to Poweradmin so it can update the data in the tables. To do this, you should create a new user and give it rights to select, delete, insert and update records in the PowerDNS database.') . " "; if ($db_type == 'mysql') { $pa_db_host = $db_host; $sql = 'SELECT USER()'; $result = $db->queryRow($sql); if (isset($result['user()'])) { $current_db_user = $result['user()']; $pa_db_host = substr($current_db_user, strpos($current_db_user, '@') + 1); } echo _('In MySQL you should now perform the following command:') . "

"; echo "

GRANT SELECT, INSERT, UPDATE, DELETE
ON " . $db_name . ".*
TO '" . $pa_db_user . "'@'" . $pa_db_host . "'
IDENTIFIED BY '" . $pa_db_pass . "';

"; } elseif ($db_type == 'pgsql') { echo _('On PgSQL you would use:') . "

"; echo "

$ createuser -E -P " . $pa_db_user . "
" . "Enter password for new role: " . $pa_db_pass . "
" . "Enter it again: " . $pa_db_pass . "
" . "Shall the new role be a superuser? (y/n) n
" . "Shall the new user be allowed to create databases? (y/n) n
" . "Shall the new user be allowed to create more new users? (y/n) n
" . "CREATE USER
" . "$ psql " . $db_name . "
"; echo "psql> "; foreach ($grantTables as $tableName) { echo "GRANT SELECT, INSERT, DELETE, UPDATE ON " . $tableName . " TO " . $pa_db_user . ";
"; } foreach ($grantSequences as $sequenceName) { echo "GRANT USAGE, SELECT ON SEQUENCE " . $sequenceName . " TO " . $pa_db_user . ";
"; } echo "

\n"; } echo "

" . _('After you have added the new user, proceed with this installation procedure.') . "

\n"; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; if ($db_type != 'sqlite') { echo ""; echo ""; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; break; case 6: $step++; require_once("../inc/database.inc.php"); global $db_layer; $db_type = $_POST['db_type']; $pa_pass = $_POST['pa_pass']; $db_port = $_POST['db_port']; $config = "" . _('The installer was able to write to the file "') . $local_config_file . _('". A basic configuration, based on the details you have given, has been created.') . "

\n"; } else { echo "

" . _('The installer is unable to write to the file "') . $local_config_file . _('" (which is in itself good). The configuration is printed here. You should now create the file "') . $local_config_file . _('" in the Poweradmin root directory yourself. It should contain the following few lines:') . "

\n"; echo "
";
            echo htmlentities($config);
            echo "
"; } echo "
"; echo ""; echo ""; echo ""; echo ""; echo "
"; break; case 7: $step++; echo "

" . _('Now we have finished the configuration.') . "

"; echo "

" . _('If you want support for the URLs used by other dynamic DNS providers, run "cp install/htaccess.dist .htaccess" and enable mod_rewrite in Apache.') . "

"; echo "

" . _('You should (must!) remove the directory "install/" from the Poweradmin root directory. You will not be able to use Poweradmin if it exists. Do it now.') . "

"; echo "

" . _('After you have removed the directory, you can login to Poweradmin with username "admin" and password "') . $_POST['pa_pass'] . _('". You are highly encouraged to change these as soon as you are logged in.') . "

"; break; default: break; } include_once('../inc/version.inc.php'); echo "
"; echo "a complete(r) poweradmin v$VERSION - credits"; echo "
";