bernd commited on 2009-10-05 20:37:39
Zeige 3 geänderte Dateien mit 14 Einfügungen und 9 Löschungen.
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1490 87cf0b9e-d624-0410-a070-f6ee81989793
| ... | ... |
@@ -12,7 +12,7 @@ $section = 'dns_dyndns'; |
| 12 | 12 |
|
| 13 | 13 |
$new = true; |
| 14 | 14 |
$dyndns = array(); |
| 15 |
-if ($_REQUEST['id']) |
|
| 15 |
+if (isset($_REQUEST['id'])) |
|
| 16 | 16 |
{
|
| 17 | 17 |
$dyndns = get_dyndns_account($_REQUEST['id']); |
| 18 | 18 |
$new = false; |
| ... | ... |
@@ -20,11 +20,11 @@ if ($_REQUEST['id']) |
| 20 | 20 |
|
| 21 | 21 |
|
| 22 | 22 |
$username_http = $_SESSION['userinfo']['username']; |
| 23 |
-if ($dyndns['handle']) |
|
| 23 |
+if (isset($dyndns['handle'])) |
|
| 24 | 24 |
$username_http .= "_{$dyndns['handle']}";
|
| 25 | 25 |
|
| 26 | 26 |
$http_update_info = ''; |
| 27 |
-if ($dyndns['password']) |
|
| 27 |
+if (isset($dyndns['password'])) |
|
| 28 | 28 |
$http_update_info = ' Lassen Sie das Passworteingabefeld unberührt um das bestehende Passwort zu erhalten. Entfernen Sie das bestehende Passwort um das HTTP-Update zu deaktivieren.'; |
| 29 | 29 |
|
| 30 | 30 |
|
| ... | ... |
@@ -55,27 +55,28 @@ if (! $new ) |
| 55 | 55 |
aktuelle Adresse: '.$dyndns['address'].' |
| 56 | 56 |
</div>'; |
| 57 | 57 |
|
| 58 |
-$form = '<p><label for="handle">Bezeichnung:</label> <input type="text" name="handle" id="handle" value="'.$dyndns['handle'].'" onkeyup="updateUsernameHTTP()" /></p> |
|
| 58 |
+$form = '<p><label for="handle">Bezeichnung:</label> <input type="text" name="handle" id="handle" value="'.(isset($dyndns['handle']) ? $dyndns['handle'] : '').'" onkeyup="updateUsernameHTTP()" /></p> |
|
| 59 | 59 |
|
| 60 | 60 |
<h4>Update per HTTPs</h4> |
| 61 | 61 |
<p style="margin-left: 2em;">Geben Sie hier ein Passwort ein um das Update per HTTPs zu aktivieren.'.$http_update_info.'</p> |
| 62 | 62 |
<p style="margin-left: 2em;">Benutzername: <strong><span id="username_http">'.$username_http.'</span></strong></p> |
| 63 |
-<p style="margin-left: 2em;"><label for="password_http">Passwort:</label> <input type="password" id="password_http" name="password_http" value="'.($dyndns['password'] ? '************' : '').'" /></p> |
|
| 63 |
+<p style="margin-left: 2em;"><label for="password_http">Passwort:</label> <input type="password" id="password_http" name="password_http" value="'.(isset($dyndns['password']) ? '************' : '').'" /></p> |
|
| 64 | 64 |
|
| 65 | 65 |
<h4>Update per SSH</h4> |
| 66 | 66 |
<p style="margin-left: 2em;">Kopieren Sie Ihren SSH-public-Key im OpenSSH-Format in dieses Eingabefeld um das Update per SSH zu aktivieren.</p> |
| 67 |
-<p style="margin-left: 2em; vertical-align: middle;"><label for="sshkey">SSH Public-Key:</label><br /><textarea style="height: 10em; width: 80%;" id="sshkey" name="sshkey">'.$dyndns['sshkey'].'</textarea></p> |
|
| 67 |
+<p style="margin-left: 2em; vertical-align: middle;"><label for="sshkey">SSH Public-Key:</label><br /><textarea style="height: 10em; width: 80%;" id="sshkey" name="sshkey">'.(isset($dyndns['sshkey']) ? $dyndns['sshkey'] : '').'</textarea></p> |
|
| 68 | 68 |
|
| 69 | 69 |
<p style="margin-left: 2em;"><input type="submit" value="Speichern" /></p> |
| 70 | 70 |
'; |
| 71 | 71 |
|
| 72 | 72 |
|
| 73 |
-$output .= html_form('dyndns_edit', 'save', 'type=dyndns&action=edit&id='.$_REQUEST['id'], $form);
|
|
| 73 |
+$output .= html_form('dyndns_edit', 'save', 'type=dyndns&action=edit&'.(isset($_REQUEST['id']) ? 'id='.$_REQUEST['id'] : ''), $form);
|
|
| 74 | 74 |
|
| 75 |
-$records = get_dyndns_records($_REQUEST['id']); |
|
| 76 | 75 |
|
| 77 | 76 |
if (! $new ) |
| 78 | 77 |
{
|
| 78 |
+ $records = get_dyndns_records($_REQUEST['id']); |
|
| 79 |
+ |
|
| 79 | 80 |
$output .= '<h4>Folgende DNS-records sind mit diesem DynDNS-Account verknüpft:</h4> |
| 80 | 81 |
|
| 81 | 82 |
<ul>'; |
| ... | ... |
@@ -39,6 +39,10 @@ function get_dyndns_account($id) |
| 39 | 39 |
function create_dyndns_account($handle, $password_http, $sshkey) |
| 40 | 40 |
{
|
| 41 | 41 |
$uid = (int) $_SESSION['userinfo']['uid']; |
| 42 |
+ |
|
| 43 |
+ if ($password_http == '' && $sshkey == '') |
|
| 44 |
+ system_failure('Sie müssen entweder einen SSH-Key oder ein Passwort zum Web-Update eingeben.');
|
|
| 45 |
+ |
|
| 42 | 46 |
$handle = maybe_null(mysql_real_escape_string(filter_input_username($handle))); |
| 43 | 47 |
$sshkey = maybe_null(mysql_real_escape_string(filter_input_general($sshkey))); |
| 44 | 48 |
|