96649f21ba18d07757afa9d98998f7a22c0d86a3
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

modules/vmail/save.php   1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

modules/email/save.php   2) /*
modules/email/save.php   3) This file belongs to the Webinterface of schokokeks.org Hosting
modules/email/save.php   4) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

modules/email/save.php   5) Written 2008-2018 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

modules/email/save.php   6)   Bernd Wurst <bernd@schokokeks.org>
modules/email/save.php   7)   Hanno Böck <hanno@schokokeks.org>
modules/email/save.php   8) 
modules/email/save.php   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.
modules/email/save.php  10) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php  11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

modules/email/save.php  12) http://creativecommons.org/publicdomain/zero/1.0/
modules/email/save.php  13) 
modules/email/save.php  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.
modules/email/save.php  15) */
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

modules/vmail/save.php  16) 
modules/vmail/save.php  17) require_once('session/start.php');
modules/vmail/save.php  18) 
modules/vmail/save.php  19) require_once('vmail.php');
modules/vmail/save.php  20) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

modules/email/save.php  21) require_role([ROLE_SYSTEMUSER, ROLE_VMAIL_ACCOUNT]);
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

modules/vmail/save.php  22) 
modules/vmail/save.php  23) require_once("inc/debug.php");
modules/vmail/save.php  24) global $debugmode;
modules/vmail/save.php  25) 
bernd Datums-Check und Daten in u...

bernd authored 12 years ago

modules/email/save.php  26) $section = 'email_vmail';
modules/email/save.php  27) 
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

modules/vmail/save.php  28) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php  29) if ($_GET['action'] == 'edit') {
modules/email/save.php  30)     check_form_token('vmail_edit_mailbox');
modules/email/save.php  31)     $accountlogin = ($_SESSION['role'] == ROLE_VMAIL_ACCOUNT);
modules/email/save.php  32) 
modules/email/save.php  33)     if ($accountlogin) {
modules/email/save.php  34)         $section = 'email_edit';
modules/email/save.php  35)         $id = get_vmail_id_by_emailaddr($_SESSION['mailaccount']);
modules/email/save.php  36)         $account = get_account_details($id, false);
modules/email/save.php  37)         // Leere das, sonst werden die vervielfacht
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

modules/email/save.php  38)         $account['forwards'] = [];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php  39)     } else {
modules/email/save.php  40)         $id = isset($_GET['id']) ? (int) $_GET['id'] : null;
modules/email/save.php  41) 
modules/email/save.php  42)         $account = empty_account();
modules/email/save.php  43)         $account['id'] = null;
modules/email/save.php  44)         if ($id) {
modules/email/save.php  45)             $account['id'] = $id;
Hanno remove whitespace in empty...

Hanno authored 6 years ago

modules/email/save.php  46) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php  47)             $oldaccount = get_account_details($id);
modules/email/save.php  48)             $account['local'] = $oldaccount['local'];
modules/email/save.php  49)             $account['domain'] = $oldaccount['domain'];
modules/email/save.php  50)         } else {
modules/email/save.php  51)             $account['local'] = $_POST['local'];
modules/email/save.php  52)             $account['domain'] = (int) $_POST['domain'];
modules/email/save.php  53)         }
Bernd Wurst wip

Bernd Wurst authored 3 years ago

modules/email/save.php  54)         $account['enableextensions'] = false;
modules/email/save.php  55)         if (isset($_POST['enableextensions']) && $_POST['enableextensions'] == 'yes') {
modules/email/save.php  56)             $account['enableextensions'] = true;
modules/email/save.php  57)         }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php  58)         $account['password'] = $_POST['password'];
modules/email/save.php  59) 
modules/email/save.php  60)         if (($account['password'] == '') && (isset($_POST['mailbox']) && $_POST['mailbox'] == 'yes')) {
modules/email/save.php  61)             system_failure("Sie haben ein leeres Passwort eingegeben!");
modules/email/save.php  62)         }
modules/email/save.php  63)         if ($_POST['password'] == '**********') {
modules/email/save.php  64)             $account['password'] = '';
modules/email/save.php  65)         }
modules/email/save.php  66)         if (!isset($_POST['mailbox']) || (isset($_POST['mailbox']) && $_POST['mailbox'] != 'yes')) {
modules/email/save.php  67)             $account['password'] = null;
modules/email/save.php  68)         }
modules/email/save.php  69)         if (isset($_POST['quota'])) {
modules/email/save.php  70)             $account['quota'] = $_POST['quota'];
modules/email/save.php  71)         }
Hanno remove whitespace in empty...

Hanno authored 6 years ago

modules/email/save.php  72) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php  73)         $account['quota_threshold'] = -1;
modules/email/save.php  74)         if (isset($_POST['quota_notify']) && isset($_POST['quota_threshold']) && $_POST['quota_notify'] == 1) {
modules/email/save.php  75)             $account['quota_threshold'] = $_POST['quota_threshold'];
modules/email/save.php  76)         }
modules/email/save.php  77)     }
modules/email/save.php  78) 
modules/email/save.php  79)     $ar = empty_autoresponder_config();
modules/email/save.php  80)     $valid_from_date = time();
modules/email/save.php  81)     $valid_until_date = null;
modules/email/save.php  82)     if (isset($_POST['ar_valid_from']) && ($_POST['ar_valid_from'] == 'now')) {
modules/email/save.php  83)         $valid_from_date = time();
Bernd Wurst Erlaube nicht mehr das Ände...

Bernd Wurst authored 12 years ago

modules/email/save.php  84)     } else {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php  85)         if (isset($_POST['ar_startdate'])) {
modules/email/save.php  86)             if (date('Y-m-d', strtotime($_POST['ar_startdate'])) != $_POST['ar_startdate']) {
modules/email/save.php  87)                 system_failure('Das Aktivierungs-Datum scheint ungültig zu sein.');
modules/email/save.php  88)             } else {
modules/email/save.php  89)                 $valid_from_date = strtotime($_POST['ar_startdate']);
modules/email/save.php  90)             }
modules/email/save.php  91)         }
Bernd Wurst Erlaube nicht mehr das Ände...

Bernd Wurst authored 12 years ago

modules/email/save.php  92)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php  93)     if ($valid_from_date < time()) {
modules/email/save.php  94)         $valid_from_date = time();
modules/email/save.php  95)         warning('Das Aktivierungs-Datum liegt in der Vergangenheit. Die Funktion wird ab sofort aktiviert.');
bernd VMail-User können ihre Eins...

bernd authored 12 years ago

modules/email/save.php  96)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php  97)     if ($valid_from_date > time() + 365*24*60*60) {
modules/email/save.php  98)         warning('Das Aktivierungs-Datum liegt mehr als ein Jahr in der Zukunft. Bitte prüfen Sie ob Sie das korrekte Jahr gewählt haben.');
bernd VMail-User können ihre Eins...

bernd authored 12 years ago

modules/email/save.php  99)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 100)     if (isset($_POST['ar_valid_until']) && ($_POST['ar_valid_until'] == 'infinity')) {
modules/email/save.php 101)         $valid_until_date = null;
modules/email/save.php 102)     } else {
modules/email/save.php 103)         if (isset($_POST['ar_enddate'])) {
modules/email/save.php 104)             if (date('Y-m-d', strtotime($_POST['ar_enddate'])) != $_POST['ar_enddate']) {
modules/email/save.php 105)                 system_failure('Das Deaktivierungs-Datum scheint ungültig zu sein.');
modules/email/save.php 106)             } else {
modules/email/save.php 107)                 $valid_until_date = strtotime($_POST['ar_enddate']);
modules/email/save.php 108)             }
modules/email/save.php 109)         }
bernd VMail-User können ihre Eins...

bernd authored 12 years ago

modules/email/save.php 110)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 111)     if (!isset($_POST['autoresponder']) || $_POST['autoresponder'] != 'yes') {
modules/email/save.php 112)         $valid_from_date = null;
modules/email/save.php 113)     } else {
modules/email/save.php 114)         if ($valid_until_date && $valid_until_date < time()) {
modules/email/save.php 115)             warning('Das Deaktivierungs-Datum liegt in der Vergangenheit, der Autoresponder wird sofort deaktiviert!');
modules/email/save.php 116)         }
bernd Datums-Check und Daten in u...

bernd authored 12 years ago

modules/email/save.php 117)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 118)     if ($valid_from_date) {
modules/email/save.php 119)         $ar['valid_from'] = date('Y-m-d', $valid_from_date);
modules/email/save.php 120)     } else {
modules/email/save.php 121)         $ar['valid_from'] = null;
bernd Datums-Check und Daten in u...

bernd authored 12 years ago

modules/email/save.php 122)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 123)     if ($valid_until_date) {
modules/email/save.php 124)         $ar['valid_until'] = date('Y-m-d', $valid_until_date);
modules/email/save.php 125)     } else {
modules/email/save.php 126)         $ar['valid_until'] = null;
Bernd Wurst Fehler behoben, durch den d...

Bernd Wurst authored 10 years ago

modules/email/save.php 127)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 128) 
modules/email/save.php 129)     if (isset($_POST['ar_subject']) && $_POST['ar_subject'] == 'custom' && isset($_POST['ar_subject_value']) && chop($_POST['ar_subject_value']) != '') {
modules/email/save.php 130)         $ar['subject'] = chop($_POST['ar_subject_value']);
Bernd Wurst Autoresponder nur noch befr...

Bernd Wurst authored 10 years ago

modules/email/save.php 131)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 132) 
modules/email/save.php 133)     if (isset($_POST['ar_message'])) {
modules/email/save.php 134)         $ar['message'] = $_POST['ar_message'];
bernd Konfiguration des Autorespo...

bernd authored 12 years ago

modules/email/save.php 135)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 136) 
modules/email/save.php 137)     if (isset($_POST['ar_quote'])) {
modules/email/save.php 138)         if ($_POST['ar_quote'] == 'teaser') {
modules/email/save.php 139)             $ar['quote'] = 'teaser';
modules/email/save.php 140)         }
modules/email/save.php 141)         if ($_POST['ar_quote'] == 'inline') {
modules/email/save.php 142)             $ar['quote'] = 'inline';
modules/email/save.php 143)         }
modules/email/save.php 144)         if ($_POST['ar_quote'] == 'attach') {
modules/email/save.php 145)             $ar['quote'] = 'attach';
modules/email/save.php 146)         }
bernd Konfiguration des Autorespo...

bernd authored 12 years ago

modules/email/save.php 147)     }
modules/email/save.php 148) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 149)     if (isset($_POST['ar_from']) && $_POST['ar_from'] == 'custom' && isset($_POST['ar_fromname'])) {
modules/email/save.php 150)         $ar['fromname'] = $_POST['ar_fromname'];
modules/email/save.php 151)     }
Hanno remove whitespace in empty...

Hanno authored 6 years ago

modules/email/save.php 152) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 153)     $account['autoresponder'] = $ar;
modules/email/save.php 154) 
modules/email/save.php 155) 
modules/email/save.php 156) 
modules/email/save.php 157)     if (isset($_POST['forward']) && $_POST['forward'] == 'yes') {
modules/email/save.php 158)         $num = 1;
modules/email/save.php 159)         while (true) {
modules/email/save.php 160)             // Die ersten 50 Einträge in jedem Fall prüfen, danach nur so lange zusätzliche Einträge vorhanden
modules/email/save.php 161)             if (! isset($_POST['forward_to_'.$num]) && $num > 50) {
modules/email/save.php 162)                 break;
modules/email/save.php 163)             }
modules/email/save.php 164)             if (isset($_POST['forward_to_'.$num]) && chop($_POST['forward_to_'.$num]) != '') {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

modules/email/save.php 165)                 $fwd = ["destination" => chop($_POST['forward_to_'.$num])];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 166)                 array_push($account['forwards'], $fwd);
modules/email/save.php 167)             }
modules/email/save.php 168)             $num++;
modules/email/save.php 169)         }
modules/email/save.php 170)         if (count($account['forwards']) == 0) {
modules/email/save.php 171)             system_failure("Bitte mindestens eine Weiterleitungsadresse angeben.");
modules/email/save.php 172)         }
bernd Anpassung auf neues Interface

bernd authored 16 years ago

modules/vmail/save.php 173)     }
bernd diverse spezial/fehlerfälle...

bernd authored 16 years ago

modules/vmail/save.php 174) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 175)     if ($account['password'] === null && count($account['forwards']) == 0) {
modules/email/save.php 176)         system_failure("Entweder eine Mailbox oder eine Weiterleitung muss angegeben werden!");
modules/email/save.php 177)     }
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

modules/vmail/save.php 178) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 179)     DEBUG($account);
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

modules/vmail/save.php 180) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 181)     save_vmail_account($account);
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

modules/vmail/save.php 182) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 183)     if (! ($debugmode || we_have_an_error())) {
modules/email/save.php 184)         if ($accountlogin) {
modules/email/save.php 185)             header('Location: /');
modules/email/save.php 186)         } else {
modules/email/save.php 187)             header('Location: vmail');
modules/email/save.php 188)         }
bernd VMail-User können ihre Eins...

bernd authored 12 years ago

modules/email/save.php 189)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 190) } elseif ($_GET['action'] == 'delete') {
modules/email/save.php 191)     $title = "E-mail-Adresse löschen";
modules/email/save.php 192)     $section = 'vmail_vmail';
modules/email/save.php 193) 
modules/email/save.php 194)     $account = get_account_details((int) $_GET['id']);
modules/email/save.php 195) 
modules/email/save.php 196)     $domain = null;
modules/email/save.php 197)     $domains = get_vmail_domains();
modules/email/save.php 198)     foreach ($domains as $dom) {
modules/email/save.php 199)         if ($dom['id'] == $account['domain']) {
modules/email/save.php 200)             $domain = $dom['domainname'];
modules/email/save.php 201)             break;
modules/email/save.php 202)         }
bernd Löschen geht jetzt auch

bernd authored 16 years ago

modules/vmail/save.php 203)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 204)     $account_string = $account['local'] . "@" . $domain;
modules/email/save.php 205)     $sure = user_is_sure();
modules/email/save.php 206)     if ($sure === null) {
modules/email/save.php 207)         are_you_sure("action=delete&id={$account['id']}", "Möchten Sie die E-Mail-Adresse »{$account_string}« wirklich löschen?");
modules/email/save.php 208)     } elseif ($sure === true) {
modules/email/save.php 209)         delete_account($account['id']);
modules/email/save.php 210)         if (! $debugmode) {
modules/email/save.php 211)             header("Location: vmail");
modules/email/save.php 212)         }
modules/email/save.php 213)     } elseif ($sure === false) {
modules/email/save.php 214)         if (! $debugmode) {
modules/email/save.php 215)             header("Location: vmail");
modules/email/save.php 216)         }
Bernd Wurst SMTP-seitige Autoresponder...

Bernd Wurst authored 10 years ago

modules/email/save.php 217)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 218) } elseif ($_GET['action'] == 'suspend') {
modules/email/save.php 219)     $title = "E-mail-Adresse stilllegen";
modules/email/save.php 220)     $section = 'vmail_vmail';
modules/email/save.php 221) 
modules/email/save.php 222)     $account = get_account_details((int) $_GET['id']);
modules/email/save.php 223) 
modules/email/save.php 224)     $domain = null;
modules/email/save.php 225)     $domains = get_vmail_domains();
modules/email/save.php 226)     foreach ($domains as $dom) {
modules/email/save.php 227)         if ($dom['id'] == $account['domain']) {
modules/email/save.php 228)             $domain = $dom['domainname'];
modules/email/save.php 229)             break;
modules/email/save.php 230)         }
modules/email/save.php 231)     }
modules/email/save.php 232)     $account_string = $account['local'] . "@" . $domain;
Hanno remove whitespace in empty...

Hanno authored 6 years ago

modules/email/save.php 233) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 234)     if (!isset($_POST['smtpreply']) || !$_POST['smtpreply']) {
modules/email/save.php 235)         system_failure('Zur Stilllegung einer Adresse müssen Sie einen Text eingeben den der Absender als Fehlermeldung erhält.');
modules/email/save.php 236)     }
modules/email/save.php 237)     $account['smtpreply'] = $_POST['smtpreply'];
modules/email/save.php 238) 
modules/email/save.php 239)     save_vmail_account($account);
modules/email/save.php 240)     if (! $debugmode) {
modules/email/save.php 241)         header("Location: vmail");
Bernd Wurst SMTP-seitige Autoresponder...

Bernd Wurst authored 10 years ago

modules/email/save.php 242)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 243) } elseif ($_GET['action'] == 'unsuspend') {
modules/email/save.php 244)     $title = "E-mail-Adresse wieder aktivieren";
modules/email/save.php 245)     $section = 'vmail_vmail';
modules/email/save.php 246) 
modules/email/save.php 247)     $account = get_account_details((int) $_GET['id']);
modules/email/save.php 248) 
modules/email/save.php 249)     $domain = null;
modules/email/save.php 250)     $domains = get_vmail_domains();
modules/email/save.php 251)     foreach ($domains as $dom) {
modules/email/save.php 252)         if ($dom['id'] == $account['domain']) {
modules/email/save.php 253)             $domain = $dom['domainname'];
modules/email/save.php 254)             break;
modules/email/save.php 255)         }
modules/email/save.php 256)     }
modules/email/save.php 257)     $account_string = $account['local'] . "@" . $domain;
Hanno remove whitespace in empty...

Hanno authored 6 years ago

modules/email/save.php 258) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 259)     $account['smtpreply'] = null;
Bernd Wurst SMTP-seitige Autoresponder...

Bernd Wurst authored 10 years ago

modules/email/save.php 260) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/email/save.php 261)     save_vmail_account($account);
modules/email/save.php 262)     if (! $debugmode) {
modules/email/save.php 263)         header("Location: vmail");
modules/email/save.php 264)     }
modules/email/save.php 265) } else {
modules/email/save.php 266)     system_failure("Unimplemented action");
Bernd Wurst SMTP-seitige Autoresponder...

Bernd Wurst authored 10 years ago

modules/email/save.php 267) }