Browse code

verbleibende syntaxfehler und codingstyle korrigieren

Hanno authored on 26/06/2018 14:11:33
Showing 4 changed files
... ...
@@ -85,7 +85,7 @@ foreach ($domains as $dom) {
85 85
           $output .= "<tr><td>".internal_link('dns_edit', $rec['fqdn'], "id={$rec['id']}")."</td><td>".strtoupper($rec['type'])."</td><td>$data</td><td>{$rec['ttl']} Sek.</td><td>".internal_link('save', '<img src="'.$prefix.'images/delete.png" width="16" height="16" alt="löschen" title="Account löschen" />', "id={$rec['id']}&type=dns&action=delete")."</td></tr>\n";
86 86
         }
87 87
         #$output .= '</table><br />';
88
-    
88
+
89 89
       }*/
90 90
 }
91 91
 
... ...
@@ -42,12 +42,12 @@ if ($sure === null) {
42 42
     }
43 43
     are_you_sure("action=delete&id={$id}", "Möchten Sie den Hostname ".$fqdn." für den DynDNS-Account {$dyndns['handle']} wirklich löschen?");
44 44
 } elseif ($sure === true) {
45
-      delete_dns_record($id);
46
-      if (! $debugmode) {
47
-          header("Location: dyndns_hostnames?id=".$dyndns['id']);
48
-      }
49
-  } elseif ($sure === false) {
50
-      if (! $debugmode) {
51
-          header("Location: dyndns_hostnames?id=".$dyndns['id']);
52
-      }
53
-  }
45
+    delete_dns_record($id);
46
+    if (! $debugmode) {
47
+        header("Location: dyndns_hostnames?id=".$dyndns['id']);
48
+    }
49
+} elseif ($sure === false) {
50
+    if (! $debugmode) {
51
+        header("Location: dyndns_hostnames?id=".$dyndns['id']);
52
+    }
53
+}
... ...
@@ -8,7 +8,7 @@ Written 2008-2018 by schokokeks.org Hosting, namely
8 8
 
9 9
 To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10 10
 
11
-You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
11
+You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
12 12
 http://creativecommons.org/publicdomain/zero/1.0/
13 13
 
14 14
 Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
... ...
@@ -20,17 +20,19 @@ require_once('session/checkuser.php');
20 20
 
21 21
 function send_customer_token($customerno)
22 22
 {
23
-  $customerno = (int) $customerno;
24
-  $token = get_customer_token($customerno);
25
-  $customer = get_customer_info($customerno);
26
-  if ($customer['email'] == '')
27
-    system_failure('Für Ihr Kundenkonto ist keine E-Mail-Adresse eingetragen. Diese Funktion steht Ihnen daher nicht zur Verfügung.')
28
-  $anrede = "Sehr geehrte Damen und Herren";
29
-  if ($customer['title'] == 'Herr')
30
-    $anrede = "Sehr geehrter Herr {$customer['name']}";
31
-  elseif ($customer['title'] == 'Frau')
32
-    $anrede = "Sehr geehrte Frau {$customer['name']}";
33
-  $msg = "{$anrede},
23
+    $customerno = (int) $customerno;
24
+    $token = get_customer_token($customerno);
25
+    $customer = get_customer_info($customerno);
26
+    if ($customer['email'] == '') {
27
+        system_failure('Für Ihr Kundenkonto ist keine E-Mail-Adresse eingetragen. Diese Funktion steht Ihnen daher nicht zur Verfügung.');
28
+    }
29
+    $anrede = "Sehr geehrte Damen und Herren";
30
+    if ($customer['title'] == 'Herr') {
31
+        $anrede = "Sehr geehrter Herr {$customer['name']}";
32
+    } elseif ($customer['title'] == 'Frau') {
33
+        $anrede = "Sehr geehrte Frau {$customer['name']}";
34
+    }
35
+    $msg = "{$anrede},
34 36
 
35 37
 Sie haben auf unserem Web-Administrations-Interface ein neues
36 38
 Passwort für Ihren Kunden-Zugang angefordert.
... ...
@@ -51,19 +53,16 @@ Diese Prozedur müssen Sie bis spätestens 24 Stunden nach Erhalt
51 53
 dieser Nachricht durchführen, sonst verliert das Token seine
52 54
 Gültigkeit.
53 55
 ";
54
-  send_mail($customer['email'], "Passwortanforderung fuer Webinterface", $msg);
56
+    send_mail($customer['email'], "Passwortanforderung fuer Webinterface", $msg);
55 57
 }
56 58
 
57 59
 
58 60
 
59 61
 function send_mail($address, $subject, $body)
60 62
 {
61
-  if (strstr($subject, "\n") !== false)
62
-    die("Zeilenumbruch im subject!");
63
-  $header = "From: schokokeks.org Web Administration <noreply@schokokeks.org>\r\nReply-To: root@schokokeks.org\r\nContent-Type: text/plain; charset=\"utf-8\"\r\nContent-Transfer-Encoding: 8bit";
64
-  mail($address, $subject, $body, $header);
63
+    if (strstr($subject, "\n") !== false) {
64
+        die("Zeilenumbruch im subject!");
65
+    }
66
+    $header = "From: schokokeks.org Web Administration <noreply@schokokeks.org>\r\nReply-To: root@schokokeks.org\r\nContent-Type: text/plain; charset=\"utf-8\"\r\nContent-Transfer-Encoding: 8bit";
67
+    mail($address, $subject, $body, $header);
65 68
 }
66
-
67
-
68
-
69
-?>
... ...
@@ -8,7 +8,7 @@ Written 2008-2018 by schokokeks.org Hosting, namely
8 8
 
9 9
 To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10 10
 
11
-You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
11
+You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
12 12
 http://creativecommons.org/publicdomain/zero/1.0/
13 13
 
14 14
 Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
... ...
@@ -18,61 +18,58 @@ require_once('session/checkuser.php');
18 18
 
19 19
 function customer_has_email($customerno, $email)
20 20
 {
21
-  $customerno = (int) $customerno;
22
-  $email = db_escape_string($email);
23
-  $result = db_query("SELECT NULL FROM kundendaten.kunden WHERE id=".$customerno." AND (email='".$email."' OR email_extern='{$email}' OR email_rechnung='{$email'}');");
24
-  return ($result->rowCount() > 0);
21
+    $customerno = (int) $customerno;
22
+    $email = db_escape_string($email);
23
+    $result = db_query("SELECT NULL FROM kundendaten.kunden WHERE id=".$customerno." AND (email='".$email."' OR email_extern='{$email}' OR email_rechnung='{$email}');");
24
+    return ($result->rowCount() > 0);
25 25
 }
26 26
 
27 27
 
28 28
 function validate_token($customerno, $token)
29 29
 {
30
-  expire_tokens();
31
-  $customerno = (int) $customerno;
32
-  $token = db_escape_string($token);
33
-  $result = db_query("SELECT NULL FROM kundendaten.kunden WHERE id={$customerno} AND token='{$token}';");
34
-  return ($result->rowCount() > 0);
30
+    expire_tokens();
31
+    $customerno = (int) $customerno;
32
+    $token = db_escape_string($token);
33
+    $result = db_query("SELECT NULL FROM kundendaten.kunden WHERE id={$customerno} AND token='{$token}';");
34
+    return ($result->rowCount() > 0);
35 35
 }
36 36
 
37 37
 
38 38
 function expire_tokens()
39 39
 {
40
-  $expire = "1 DAY";
41
-  db_query("UPDATE kundendaten.kunden SET token=NULL, token_create=NULL WHERE token_create < NOW() - INTERVAL {$expire};");
40
+    $expire = "1 DAY";
41
+    db_query("UPDATE kundendaten.kunden SET token=NULL, token_create=NULL WHERE token_create < NOW() - INTERVAL {$expire};");
42 42
 }
43 43
 
44 44
 function invalidate_customer_token($customerno)
45 45
 {
46
-  $customerno = (int) $customerno;
47
-  db_query("UPDATE kundendaten.kunden SET token=NULL, token_create=NULL WHERE id={$customerno} LIMIT 1;");
46
+    $customerno = (int) $customerno;
47
+    db_query("UPDATE kundendaten.kunden SET token=NULL, token_create=NULL WHERE id={$customerno} LIMIT 1;");
48 48
 }
49 49
  
50 50
 function create_token($customerno)
51 51
 {
52
-  $customerno = (int) $customerno;
53
-  expire_tokens();
54
-  $result = db_query("SELECT token_create FROM kundendaten.kunden WHERE id={$customerno} AND token_create IS NOT NULL;");
55
-  if ($result->rowCount() > 0)
56
-  {
57
-    $res = $result->fetch(PDO::FETCH_OBJ)->token_create;
58
-    input_error("Sie haben diese Funktion kürzlich erst benutzt, an Ihre E-Mail-Adresse wurde bereits am {$res} eine Nachricht verschickt. Sie können diese Funktion erst nach Ablauf von 24 Stunden erneut benutzen.");
59
-    return false;
60
-  }
61
-  $token = random_string(10);
62
-  db_query("UPDATE kundendaten.kunden SET token='{$token}', token_create=now() WHERE id={$customerno} LIMIT 1;");
63
-  return true;
52
+    $customerno = (int) $customerno;
53
+    expire_tokens();
54
+    $result = db_query("SELECT token_create FROM kundendaten.kunden WHERE id={$customerno} AND token_create IS NOT NULL;");
55
+    if ($result->rowCount() > 0) {
56
+        $res = $result->fetch(PDO::FETCH_OBJ)->token_create;
57
+        input_error("Sie haben diese Funktion kürzlich erst benutzt, an Ihre E-Mail-Adresse wurde bereits am {$res} eine Nachricht verschickt. Sie können diese Funktion erst nach Ablauf von 24 Stunden erneut benutzen.");
58
+        return false;
59
+    }
60
+    $token = random_string(10);
61
+    db_query("UPDATE kundendaten.kunden SET token='{$token}', token_create=now() WHERE id={$customerno} LIMIT 1;");
62
+    return true;
64 63
 }
65 64
 
66 65
 
67 66
 function get_customer_token($customerno)
68 67
 {
69
-  $customerno = (int) $customerno;
70
-  expire_tokens();
71
-  $result = db_query("SELECT token FROM kundendaten.kunden WHERE id={$customerno} AND token IS NOT NULL;");
72
-  if ($result->rowCount() < 1)
73
-    system_failure("Kann das Token nicht auslesen!");
74
-  return $result->fetch(PDO::FETCH_OBJ)->token;
68
+    $customerno = (int) $customerno;
69
+    expire_tokens();
70
+    $result = db_query("SELECT token FROM kundendaten.kunden WHERE id={$customerno} AND token IS NOT NULL;");
71
+    if ($result->rowCount() < 1) {
72
+        system_failure("Kann das Token nicht auslesen!");
73
+    }
74
+    return $result->fetch(PDO::FETCH_OBJ)->token;
75 75
 }
76
-
77
-
78
-?>