install/index.php
changeset 165 cc0763252b89
parent 159 abe711eddd45
child 178 4f7540d1c07d
equal deleted inserted replaced
164:4c6adb48dcfd 165:cc0763252b89
   111 			"<option value=\"mysql\">MySQL</option>" . 
   111 			"<option value=\"mysql\">MySQL</option>" . 
   112 			"<option value=\"pgsql\">PostgreSQL</option>" . 
   112 			"<option value=\"pgsql\">PostgreSQL</option>" . 
   113 			"</td>\n";
   113 			"</td>\n";
   114 		echo "  <td>" . _('The type of the PowerDNS database.') . "</td>\n";
   114 		echo "  <td>" . _('The type of the PowerDNS database.') . "</td>\n";
   115 		echo " </tr>\n";
   115 		echo " </tr>\n";
       
   116                 echo "  <tr>\n";
       
   117 		echo "   <td>" . _('Poweradmin administrator password') . "</td>\n";
       
   118 		echo "   <td><input type=\"text\" name=\"pa_pass\" value=\"\"></td>\n";
       
   119 		echo "   <td>" . _('The password of the Poweradmin administrator. This administrator has full rights to Poweradmin using the web interface.') . "</td>\n";
       
   120 		echo "  </tr>\n";
   116 		echo "</table>\n";
   121 		echo "</table>\n";
   117 		echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">";
   122 		echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">";
   118 		echo "<input type=\"hidden\" name=\"language\" value=\"" . $language . "\">";
   123 		echo "<input type=\"hidden\" name=\"language\" value=\"" . $language . "\">";
   119 		echo "<input type=\"submit\" name=\"submit\" value=\"" . _('Go to step') . " " . $step . "\">";
   124 		echo "<input type=\"submit\" name=\"submit\" value=\"" . _('Go to step') . " " . $step . "\">";
   120 		echo "</form>";
   125 		echo "</form>";
   122 
   127 
   123 	case 4:
   128 	case 4:
   124 		$step++;
   129 		$step++;
   125 		echo "<p>" . _('Updating database...') . " ";
   130 		echo "<p>" . _('Updating database...') . " ";
   126 		include_once("../inc/config-me.inc.php");
   131 		include_once("../inc/config-me.inc.php");
   127 		include_once("database-structure.inc.php");
       
   128 		$db_user = $_POST['user'];
   132 		$db_user = $_POST['user'];
   129 		$db_pass = $_POST['pass'];
   133 		$db_pass = $_POST['pass'];
   130 		$db_host = $_POST['host'];
   134 		$db_host = $_POST['host'];
   131 		$db_name = $_POST['name'];
   135 		$db_name = $_POST['name'];
   132 		$db_type = $_POST['type'];
   136 		$db_type = $_POST['type'];
       
   137 		$pa_pass = $_POST['pa_pass'];
   133 		require_once("../inc/database.inc.php");
   138 		require_once("../inc/database.inc.php");
   134 		$db = dbConnect();
   139 		$db = dbConnect();
   135 		$db->loadModule('Manager');
   140 		$db->loadModule('Manager');
   136 		$db->loadModule('Extended');
   141 		$db->loadModule('Extended');
       
   142 		include_once("database-structure.inc.php");
   137 		$current_tables = $db->listTables();
   143 		$current_tables = $db->listTables();
   138 		foreach ($def_tables as $table) {
   144 		foreach ($def_tables as $table) {
   139 			if (in_array($table['table_name'], $current_tables)) $db->dropTable($table['table_name']);
   145 			if (in_array($table['table_name'], $current_tables)) $db->dropTable($table['table_name']);
   140 			$db->createTable($table['table_name'], $table['fields']);
   146 			$db->createTable($table['table_name'], $table['fields']);
   141 		}
   147 		}
   177 		echo "  </tr>\n";
   183 		echo "  </tr>\n";
   178 		echo "</table>";
   184 		echo "</table>";
   179 		echo "<input type=\"hidden\" name=\"db_host\" value=\"" . $db_host . "\">";
   185 		echo "<input type=\"hidden\" name=\"db_host\" value=\"" . $db_host . "\">";
   180 		echo "<input type=\"hidden\" name=\"db_name\" value=\"" . $db_name . "\">";
   186 		echo "<input type=\"hidden\" name=\"db_name\" value=\"" . $db_name . "\">";
   181 		echo "<input type=\"hidden\" name=\"db_type\" value=\"" . $db_type . "\">";
   187 		echo "<input type=\"hidden\" name=\"db_type\" value=\"" . $db_type . "\">";
       
   188 		echo "<input type=\"hidden\" name=\"pa_pass\" value=\"" . $pa_pass . "\">";
   182 		echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">";
   189 		echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">";
   183 		echo "<input type=\"hidden\" name=\"language\" value=\"" . $language . "\">";
   190 		echo "<input type=\"hidden\" name=\"language\" value=\"" . $language . "\">";
   184 		echo "<input type=\"submit\" name=\"submit\" value=\"" . _('Go to step') . " " . $step . "\">";
   191 		echo "<input type=\"submit\" name=\"submit\" value=\"" . _('Go to step') . " " . $step . "\">";
   185 		echo "</form>";
   192 		echo "</form>";
   186 		break;
   193 		break;
   190 		$db_user = $_POST['db_user'];
   197 		$db_user = $_POST['db_user'];
   191 		$db_pass = $_POST['db_pass'];
   198 		$db_pass = $_POST['db_pass'];
   192 		$db_host = $_POST['db_host'];
   199 		$db_host = $_POST['db_host'];
   193 		$db_name = $_POST['db_name'];
   200 		$db_name = $_POST['db_name'];
   194 		$db_type = $_POST['db_type'];
   201 		$db_type = $_POST['db_type'];
       
   202 		$pa_pass = $_POST['pa_pass'];
   195 		$dns_hostmaster = $_POST['dns_hostmaster'];
   203 		$dns_hostmaster = $_POST['dns_hostmaster'];
   196 		$dns_ns1 = $_POST['dns_ns1'];
   204 		$dns_ns1 = $_POST['dns_ns1'];
   197 		$dns_ns2 = $_POST['dns_ns2'];
   205 		$dns_ns2 = $_POST['dns_ns2'];
   198 
   206 
   199 		echo "<p>" . _('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.') . " ";
   207 		echo "<p>" . _('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.') . " ";
   219 		echo "<input type=\"hidden\" name=\"db_host\" value=\"" . $db_host . "\">";
   227 		echo "<input type=\"hidden\" name=\"db_host\" value=\"" . $db_host . "\">";
   220 		echo "<input type=\"hidden\" name=\"db_name\" value=\"" . $db_name . "\">";
   228 		echo "<input type=\"hidden\" name=\"db_name\" value=\"" . $db_name . "\">";
   221 		echo "<input type=\"hidden\" name=\"db_type\" value=\"" . $db_type . "\">";
   229 		echo "<input type=\"hidden\" name=\"db_type\" value=\"" . $db_type . "\">";
   222 		echo "<input type=\"hidden\" name=\"db_user\" value=\"" . $db_user . "\">";
   230 		echo "<input type=\"hidden\" name=\"db_user\" value=\"" . $db_user . "\">";
   223 		echo "<input type=\"hidden\" name=\"db_pass\" value=\"" . $db_pass . "\">";
   231 		echo "<input type=\"hidden\" name=\"db_pass\" value=\"" . $db_pass . "\">";
       
   232 		echo "<input type=\"hidden\" name=\"pa_pass\" value=\"" . $pa_pass . "\">";
   224 		echo "<input type=\"hidden\" name=\"dns_hostmaster\" value=\"" . $dns_hostmaster . "\">";
   233 		echo "<input type=\"hidden\" name=\"dns_hostmaster\" value=\"" . $dns_hostmaster . "\">";
   225 		echo "<input type=\"hidden\" name=\"dns_ns1\" value=\"" . $dns_ns1 . "\">";
   234 		echo "<input type=\"hidden\" name=\"dns_ns1\" value=\"" . $dns_ns1 . "\">";
   226 		echo "<input type=\"hidden\" name=\"dns_ns2\" value=\"" . $dns_ns2 . "\">";
   235 		echo "<input type=\"hidden\" name=\"dns_ns2\" value=\"" . $dns_ns2 . "\">";
   227 		echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">";
   236 		echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">";
   228 		echo "<input type=\"hidden\" name=\"language\" value=\"" . $language . "\">";
   237 		echo "<input type=\"hidden\" name=\"language\" value=\"" . $language . "\">";
   230 		echo "</form>";
   239 		echo "</form>";
   231 		break;
   240 		break;
   232 	
   241 	
   233 	case 6:
   242 	case 6:
   234 		$step++;
   243 		$step++;
       
   244 		$pa_pass = $_POST['pa_pass'];
   235 		$config = "<?php\n\n" .
   245 		$config = "<?php\n\n" .
   236 			"\$db_host\t\t= \"" . $_POST['db_host'] . "\";\n" .
   246 			"\$db_host\t\t= \"" . $_POST['db_host'] . "\";\n" .
   237 			"\$db_user\t\t= \"" . $_POST['db_user'] . "\";\n" .
   247 			"\$db_user\t\t= \"" . $_POST['db_user'] . "\";\n" .
   238 			"\$db_pass\t\t= \"" . $_POST['db_pass'] . "\";\n" .
   248 			"\$db_pass\t\t= \"" . $_POST['db_pass'] . "\";\n" .
   239 			"\$db_name\t\t= \"" . $_POST['db_name'] . "\";\n" .
   249 			"\$db_name\t\t= \"" . $_POST['db_name'] . "\";\n" .
   256 			echo "<pre>";
   266 			echo "<pre>";
   257 			echo htmlentities($config);
   267 			echo htmlentities($config);
   258 			echo "</pre>";
   268 			echo "</pre>";
   259 		};
   269 		};
   260 		echo "<form method=\"post\">";
   270 		echo "<form method=\"post\">";
       
   271 		echo "<input type=\"hidden\" name=\"pa_pass\" value=\"" . $pa_pass . "\">";
   261 		echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">";
   272 		echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">";
   262 		echo "<input type=\"hidden\" name=\"language\" value=\"" . $language . "\">";
   273 		echo "<input type=\"hidden\" name=\"language\" value=\"" . $language . "\">";
   263 		echo "<input type=\"submit\" name=\"submit\" value=\"" . _('Go to step') . " " . $step . "\">";
   274 		echo "<input type=\"submit\" name=\"submit\" value=\"" . _('Go to step') . " " . $step . "\">";
   264 		echo "</form>";
   275 		echo "</form>";
   265 		break;
   276 		break;
   266 
   277 
   267 	case 7:
   278 	case 7:
   268 		$step++;
   279 		$step++;
   269 		echo "<p>" . _('Now we have finished the configuration, 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.') . "</p>";
   280 		echo "<p>" . _('Now we have finished the configuration, 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.') . "</p>";
   270 		echo "<p>" . _('After you have removed the directory, you can login to <a href="index.php">Poweradmin</a> with username "admin" and password "admin". You are highly encouraged to change these as soon as you are logged in.') . "</p>";
   281 		echo "<p>" . _('After you have removed the directory, you can login to <a href="index.php">Poweradmin</a> with username "admin" and password "') . $_POST['pa_pass'] . _('". You are highly encouraged to change these as soon as you are logged in.') . "</p>";
   271 		break;
   282 		break;
   272 
   283 
   273 	default:
   284 	default:
   274 		break;
   285 		break;
   275 }
   286 }