bernd commited on 2009-09-14 13:31:08
Zeige 17 geänderte Dateien mit 69 Einfügungen und 67 Löschungen.
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1466 87cf0b9e-d624-0410-a070-f6ee81989793
| ... | ... |
@@ -9,7 +9,7 @@ function config($key) |
| 9 | 9 |
if (array_key_exists($key, $config)) |
| 10 | 10 |
return $config[$key]; |
| 11 | 11 |
else |
| 12 |
- logger("inc/base", "config", "Request to read nonexistant config option »{$key}«.");
|
|
| 12 |
+ logger(LOG_ERR, "inc/base", "config", "Request to read nonexistant config option »{$key}«.");
|
|
| 13 | 13 |
return NULL; |
| 14 | 14 |
} |
| 15 | 15 |
|
| ... | ... |
@@ -21,7 +21,7 @@ function db_query($query) |
| 21 | 21 |
if (mysql_error()) |
| 22 | 22 |
{
|
| 23 | 23 |
$error = mysql_error(); |
| 24 |
- logger("inc/base", "dberror", "mysql error: {$error}");
|
|
| 24 |
+ logger(LOG_ERR, "inc/base", "dberror", "mysql error: {$error}");
|
|
| 25 | 25 |
system_failure('Interner Datenbankfehler: »'.iconv('ISO-8859-1', 'UTF-8', $error).'«.');
|
| 26 | 26 |
} |
| 27 | 27 |
$count = @mysql_num_rows($result); |
| ... | ... |
@@ -44,11 +44,13 @@ function maybe_null($value) |
| 44 | 44 |
return 'NULL'; |
| 45 | 45 |
} |
| 46 | 46 |
|
| 47 |
+#define('LOG_ERR', 3);
|
|
| 48 |
+#define('LOG_WARNING', 4);
|
|
| 49 |
+#define('LOG_INFO', 6);
|
|
| 47 | 50 |
|
| 48 |
- |
|
| 49 |
-function logger($scriptname, $scope, $message) |
|
| 51 |
+function logger($severity, $scriptname, $scope, $message) |
|
| 50 | 52 |
{
|
| 51 |
- if (config('logging') == false)
|
|
| 53 |
+ if (config('logging') <= $severity)
|
|
| 52 | 54 |
return; |
| 53 | 55 |
|
| 54 | 56 |
$user = 'NULL'; |
| ... | ... |
@@ -12,7 +12,7 @@ function strong_password($password) |
| 12 | 12 |
DEBUG("Öffne Wörterbuch: ".config('cracklib_dict'));
|
| 13 | 13 |
if (! ($dict = crack_opendict(config('cracklib_dict'))))
|
| 14 | 14 |
{
|
| 15 |
- logger("inc/security", "cracklib", "could not open cracklib-dictionary »".config('cracklib_dict')."«");
|
|
| 15 |
+ logger(LOG_ERR, "inc/security", "cracklib", "could not open cracklib-dictionary »".config('cracklib_dict')."«");
|
|
| 16 | 16 |
system_failure("Kann Crack-Lib-Wörterbuch nicht öffnen: ".config('cracklib_dict'));
|
| 17 | 17 |
} |
| 18 | 18 |
// Führe eine Überprüfung des Passworts durch |
| ... | ... |
@@ -44,7 +44,7 @@ function verify_input_general( $input ) |
| 44 | 44 |
{
|
| 45 | 45 |
if (filter_input_general($input) != $input) {
|
| 46 | 46 |
system_failure("Ihre Daten enthielten ungültige Zeichen!");
|
| 47 |
- logger('inc/security', 'verify_input_general', 'Ungültige Daten: '.$input);
|
|
| 47 |
+ logger(LOG_WARNING, 'inc/security', 'verify_input_general', 'Ungültige Daten: '.$input); |
|
| 48 | 48 |
} |
| 49 | 49 |
} |
| 50 | 50 |
|
| ... | ... |
@@ -57,7 +57,7 @@ function filter_input_username( $input ) |
| 57 | 57 |
function verify_input_username( $input ) |
| 58 | 58 |
{
|
| 59 | 59 |
if (filter_input_username( $input ) != $input) {
|
| 60 |
- logger('inc/security', 'verify_input_username', 'Ungültige Daten: '.$input);
|
|
| 60 |
+ logger(LOG_WARNING, 'inc/security', 'verify_input_username', 'Ungültige Daten: '.$input); |
|
| 61 | 61 |
system_failure("Ihre Daten enthielten ungültige Zeichen!");
|
| 62 | 62 |
} |
| 63 | 63 |
} |
| ... | ... |
@@ -83,7 +83,7 @@ function filter_input_hostname( $input, $wildcard=false ) |
| 83 | 83 |
function verify_input_hostname( $input, $wildcard=false ) |
| 84 | 84 |
{
|
| 85 | 85 |
if (filter_input_hostname( $input, $wildcard ) != $input) {
|
| 86 |
- logger('inc/security', 'verify_input_hostname', 'Ungültige Daten: '.$input);
|
|
| 86 |
+ logger(LOG_WARNING, 'inc/security', 'verify_input_hostname', 'Ungültige Daten: '.$input); |
|
| 87 | 87 |
system_failure("Ihre Daten enthielten ungültige Zeichen!");
|
| 88 | 88 |
} |
| 89 | 89 |
} |
| ... | ... |
@@ -129,7 +129,7 @@ function check_path( $input ) |
| 129 | 129 |
DEBUG("checking {$input} for valid path name");
|
| 130 | 130 |
if ($input != filter_input_general($input)) |
| 131 | 131 |
{
|
| 132 |
- logger('inc/security', 'check_path', 'HTML-Krams im Pfad: '.$input);
|
|
| 132 |
+ logger(LOG_WARNING, 'inc/security', 'check_path', 'HTML-Krams im Pfad: '.$input); |
|
| 133 | 133 |
DEBUG("HTML-Krams im Pfad");
|
| 134 | 134 |
return False; |
| 135 | 135 |
} |
| ... | ... |
@@ -138,7 +138,7 @@ function check_path( $input ) |
| 138 | 138 |
{
|
| 139 | 139 |
if ($item == '..') |
| 140 | 140 |
{
|
| 141 |
- logger('inc/security', 'check_path', '»..« im Pfad: '.$input);
|
|
| 141 |
+ logger(LOG_WARNING, 'inc/security', 'check_path', '»..« im Pfad: '.$input); |
|
| 142 | 142 |
DEBUG("»..« im Pfad");
|
| 143 | 143 |
return False; |
| 144 | 144 |
} |
| ... | ... |
@@ -27,7 +27,7 @@ function get_dyndns_account($id) |
| 27 | 27 |
$uid = (int) $_SESSION['userinfo']['uid']; |
| 28 | 28 |
$result = db_query("SELECT * FROM dns.dyndns WHERE id={$id} AND uid={$uid}");
|
| 29 | 29 |
if (mysql_num_rows($result) != 1) {
|
| 30 |
- logger("modules/dns/include/dnsinclude", "dyndns", "account »{$id}« invalid for uid »{$uid}«.");
|
|
| 30 |
+ logger(LOG_WARNING, "modules/dns/include/dnsinclude", "dyndns", "account »{$id}« invalid for uid »{$uid}«.");
|
|
| 31 | 31 |
system_failure("Account ungültig");
|
| 32 | 32 |
} |
| 33 | 33 |
$item = mysql_fetch_assoc($result); |
| ... | ... |
@@ -47,7 +47,7 @@ function create_dyndns_account($handle, $password_http, $sshkey) |
| 47 | 47 |
$pwhash = "'{SHA}".base64_encode(sha1($password_http, true))."'";
|
| 48 | 48 |
|
| 49 | 49 |
db_query("INSERT INTO dns.dyndns (uid, handle, password, sshkey) VALUES ({$uid}, {$handle}, {$pwhash}, {$sshkey})");
|
| 50 |
- logger("modules/dns/include/dnsinclude", "dyndns", "inserted account");
|
|
| 50 |
+ logger(LOG_INFO, "modules/dns/include/dnsinclude", "dyndns", "inserted account"); |
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
|
| ... | ... |
@@ -67,7 +67,7 @@ function edit_dyndns_account($id, $handle, $password_http, $sshkey) |
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 | 69 |
db_query("UPDATE dns.dyndns SET handle={$handle}, password={$pwhash}, sshkey={$sshkey} WHERE id={$id} LIMIT 1");
|
| 70 |
- logger("modules/dns/include/dnsinclude", "dyndns", "edited account »{$id}«");
|
|
| 70 |
+ logger(LOG_INFO, "modules/dns/include/dnsinclude", "dyndns", "edited account »{$id}«");
|
|
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 | 73 |
|
| ... | ... |
@@ -76,7 +76,7 @@ function delete_dyndns_account($id) |
| 76 | 76 |
$id = (int) $id; |
| 77 | 77 |
|
| 78 | 78 |
db_query("DELETE FROM dns.dyndns WHERE id={$id} LIMIT 1");
|
| 79 |
- logger("modules/dns/include/dnsinclude", "dyndns", "deleted account »{$id}«");
|
|
| 79 |
+ logger(LOG_INFO, "modules/dns/include/dnsinclude", "dyndns", "deleted account »{$id}«");
|
|
| 80 | 80 |
} |
| 81 | 81 |
|
| 82 | 82 |
|
| ... | ... |
@@ -76,7 +76,7 @@ function change_mailaccount($id, $arr) |
| 76 | 76 |
|
| 77 | 77 |
|
| 78 | 78 |
db_query("UPDATE mail.mailaccounts SET ".implode(",", $conditions)." WHERE id='$id' LIMIT 1");
|
| 79 |
- logger("modules/imap/include/mailaccounts", "imap", "updated account »{$arr['account']}«");
|
|
| 79 |
+ logger(LOG_INFO, "modules/imap/include/mailaccounts", "imap", "updated account »{$arr['account']}«");
|
|
| 80 | 80 |
|
| 81 | 81 |
} |
| 82 | 82 |
|
| ... | ... |
@@ -124,7 +124,7 @@ function create_mailaccount($arr) |
| 124 | 124 |
|
| 125 | 125 |
|
| 126 | 126 |
db_query("INSERT INTO mail.mailaccounts (".implode(',', array_keys($values)).") VALUES (".implode(",", array_values($values)).")");
|
| 127 |
- logger("modules/imap/include/mailaccounts", "imap", "created account »{$arr['account']}«");
|
|
| 127 |
+ logger(LOG_INFO, "modules/imap/include/mailaccounts", "imap", "created account »{$arr['account']}«");
|
|
| 128 | 128 |
|
| 129 | 129 |
} |
| 130 | 130 |
|
| ... | ... |
@@ -148,7 +148,7 @@ function delete_mailaccount($id) |
| 148 | 148 |
{
|
| 149 | 149 |
$id = (int) $id; |
| 150 | 150 |
db_query("DELETE FROM mail.mailaccounts WHERE id=".$id." LIMIT 1");
|
| 151 |
- logger("modules/imap/include/mailaccounts", "imap", "deleted account »{$id}«");
|
|
| 151 |
+ logger(LOG_INFO, "modules/imap/include/mailaccounts", "imap", "deleted account »{$id}«");
|
|
| 152 | 152 |
} |
| 153 | 153 |
|
| 154 | 154 |
|
| ... | ... |
@@ -27,7 +27,7 @@ if (isset($_REQUEST['uid']) and isset($_REQUEST['token'])) |
| 27 | 27 |
{
|
| 28 | 28 |
require_once('session/checkuser.php');
|
| 29 | 29 |
require_once('inc/base.php');
|
| 30 |
- logger("modules/index/initialize_useraccount", "initialize", "uid »{$uid}« set a new password");
|
|
| 30 |
+ logger(LOG_INFO, "modules/index/initialize_useraccount", "initialize", "uid »{$uid}« set a new password");
|
|
| 31 | 31 |
set_systemuser_password($uid, $_POST['password']); |
| 32 | 32 |
success_msg('Das Passwort wurde gesetzt!');
|
| 33 | 33 |
invalidate_systemuser_token($uid); |
| ... | ... |
@@ -6,12 +6,12 @@ require_once('inc/error.php');
|
| 6 | 6 |
|
| 7 | 7 |
if (!session_destroy()) |
| 8 | 8 |
{
|
| 9 |
- logger("modules/index/logout", "logout", "session timed out.");
|
|
| 9 |
+ logger(LOG_INFO, "modules/index/logout", "logout", "session timed out."); |
|
| 10 | 10 |
system_failure('Die Sitzung konnte nicht geschlossen werden, eventuell ist die Wartezeit abgelaufen und die Sitzung wurde daher schon beendet.');
|
| 11 | 11 |
} |
| 12 | 12 |
unset($_SESSION['role']); |
| 13 | 13 |
|
| 14 |
-logger("modules/index/logout", "logout", "logged out");
|
|
| 14 |
+logger(LOG_INFO, "modules/index/logout", "logout", "logged out"); |
|
| 15 | 15 |
|
| 16 | 16 |
output('
|
| 17 | 17 |
|
| ... | ... |
@@ -14,7 +14,7 @@ if (isset($_POST['customerno'])) |
| 14 | 14 |
require_once('mail.php');
|
| 15 | 15 |
require_once('inc/base.php');
|
| 16 | 16 |
send_customer_token($_POST['customerno']); |
| 17 |
- logger("modules/index/new_password", "pwrecovery", "token sent for customer »{$_POST['customerno']}«");
|
|
| 17 |
+ logger(LOG_INFO, "modules/index/new_password", "pwrecovery", "token sent for customer »{$_POST['customerno']}«");
|
|
| 18 | 18 |
success_msg('Die angegebenen Daten waren korrekt, Sie sollten umgehend eine E-Mail erhalten.');
|
| 19 | 19 |
} |
| 20 | 20 |
} |
| ... | ... |
@@ -25,7 +25,7 @@ if (isset($_REQUEST['customerno']) and isset($_REQUEST['token'])) |
| 25 | 25 |
{
|
| 26 | 26 |
require_once('session/checkuser.php');
|
| 27 | 27 |
require_once('inc/base.php');
|
| 28 |
- logger("modules/index/validate_token", "pwrecovery", "customer »{$customerno}« set a new password");
|
|
| 28 |
+ logger(LOG_INFO, "modules/index/validate_token", "pwrecovery", "customer »{$customerno}« set a new password");
|
|
| 29 | 29 |
set_customer_password($customerno, $_POST['password']); |
| 30 | 30 |
success_msg('Das Passwort wurde gesetzt!');
|
| 31 | 31 |
set_customer_verified($customerno); |
| ... | ... |
@@ -72,7 +72,7 @@ function create_jabber_account($local, $domain, $password) |
| 72 | 72 |
$result = db_query("SELECT id FROM kundendaten.domains WHERE kunde={$customerno} AND jabber=1 AND id={$domain};");
|
| 73 | 73 |
if (mysql_num_rows($result) == 0) |
| 74 | 74 |
{
|
| 75 |
- logger("modules/jabber/include/jabberaccounts", "jabber", "attempt to create account for invalid domain »{$domain}«");
|
|
| 75 |
+ logger(LOG_WARNING, "modules/jabber/include/jabberaccounts", "jabber", "attempt to create account for invalid domain »{$domain}«");
|
|
| 76 | 76 |
system_failure("Invalid domain!");
|
| 77 | 77 |
} |
| 78 | 78 |
} |
| ... | ... |
@@ -86,12 +86,12 @@ function create_jabber_account($local, $domain, $password) |
| 86 | 86 |
$result = db_query("SELECT id FROM jabber.accounts WHERE local='{$local}' AND {$domainquery}");
|
| 87 | 87 |
if (mysql_num_rows($result) > 0) |
| 88 | 88 |
{
|
| 89 |
- logger("modules/jabber/include/jabberaccounts", "jabber", "attempt to create already existing account »{$local}@{$domain}«");
|
|
| 89 |
+ logger(LOG_WARNING, "modules/jabber/include/jabberaccounts", "jabber", "attempt to create already existing account »{$local}@{$domain}«");
|
|
| 90 | 90 |
system_failure("Diesen Account gibt es bereits!");
|
| 91 | 91 |
} |
| 92 | 92 |
|
| 93 | 93 |
db_query("INSERT INTO jabber.accounts (customerno,local,domain,password) VALUES ({$customerno}, '{$local}', {$domain}, '{$password}');");
|
| 94 |
- logger("modules/jabber/include/jabberaccounts", "jabber", "created account »{$local}@{$domain}«");
|
|
| 94 |
+ logger(LOG_INFO, "modules/jabber/include/jabberaccounts", "jabber", "created account »{$local}@{$domain}«");
|
|
| 95 | 95 |
} |
| 96 | 96 |
|
| 97 | 97 |
|
| ... | ... |
@@ -109,7 +109,7 @@ function change_jabber_password($id, $password) |
| 109 | 109 |
$password = mysql_real_escape_string( $password ); |
| 110 | 110 |
|
| 111 | 111 |
db_query("UPDATE jabber.accounts SET password='{$password}' WHERE customerno={$customerno} AND id={$id} LIMIT 1");
|
| 112 |
- logger("modules/jabber/include/jabberaccounts", "jabber", "changed password for account »{$id}«");
|
|
| 112 |
+ logger(LOG_INFO, "modules/jabber/include/jabberaccounts", "jabber", "changed password for account »{$id}«");
|
|
| 113 | 113 |
} |
| 114 | 114 |
|
| 115 | 115 |
|
| ... | ... |
@@ -122,7 +122,7 @@ function delete_jabber_account($id) |
| 122 | 122 |
$id = (int) $id; |
| 123 | 123 |
|
| 124 | 124 |
db_query("UPDATE jabber.accounts SET `delete`=1 WHERE customerno={$customerno} AND id={$id} LIMIT 1");
|
| 125 |
- logger("modules/jabber/include/jabberaccounts", "jabber", "deleted account »{$id}«");
|
|
| 125 |
+ logger(LOG_INFO, "modules/jabber/include/jabberaccounts", "jabber", "deleted account »{$id}«");
|
|
| 126 | 126 |
} |
| 127 | 127 |
|
| 128 | 128 |
?> |
| ... | ... |
@@ -57,14 +57,14 @@ function set_mysql_access($db, $account, $status) |
| 57 | 57 |
if (get_mysql_access($db, $account)) |
| 58 | 58 |
return NULL; |
| 59 | 59 |
$query = "INSERT INTO misc.mysql_access (`database`,user) VALUES ((SELECT id FROM misc.mysql_database WHERE name='{$db}' AND useraccount={$uid} LIMIT 1), (SELECT id FROM misc.mysql_accounts WHERE username='{$account}' AND useraccount={$uid}));";
|
| 60 |
- logger("modules/mysql/include/mysql", "mysql", "granting access on »{$db}« to »{$account}«");
|
|
| 60 |
+ logger(LOG_INFO, "modules/mysql/include/mysql", "mysql", "granting access on »{$db}« to »{$account}«");
|
|
| 61 | 61 |
} |
| 62 | 62 |
else |
| 63 | 63 |
{
|
| 64 | 64 |
if (! get_mysql_access($db, $account)) |
| 65 | 65 |
return NULL; |
| 66 | 66 |
$query = "DELETE FROM misc.mysql_access WHERE `database`=(SELECT id FROM misc.mysql_database WHERE name='{$db}' AND useraccount={$uid} LIMIT 1) AND user=(SELECT id FROM misc.mysql_accounts WHERE username='{$account}' AND useraccount={$uid});";
|
| 67 |
- logger("modules/mysql/include/mysql", "mysql", "revoking access on »{$db}« from »{$account}«");
|
|
| 67 |
+ logger(LOG_INFO, "modules/mysql/include/mysql", "mysql", "revoking access on »{$db}« from »{$account}«");
|
|
| 68 | 68 |
} |
| 69 | 69 |
db_query($query); |
| 70 | 70 |
} |
| ... | ... |
@@ -74,14 +74,14 @@ function create_mysql_account($username, $description = '') |
| 74 | 74 |
{
|
| 75 | 75 |
if (! validate_mysql_username($username)) |
| 76 | 76 |
{
|
| 77 |
- logger("modules/mysql/include/mysql", "mysql", "illegal username »{$username}«");
|
|
| 77 |
+ logger(LOG_WARNING, "modules/mysql/include/mysql", "mysql", "illegal username »{$username}«");
|
|
| 78 | 78 |
input_error("Der eingegebene Benutzername entspricht leider nicht der Konvention. Bitte tragen Sie einen passenden Namen ein.");
|
| 79 | 79 |
return NULL; |
| 80 | 80 |
} |
| 81 | 81 |
$uid = $_SESSION['userinfo']['uid']; |
| 82 | 82 |
$username = mysql_real_escape_string($username); |
| 83 | 83 |
$description = maybe_null($description); |
| 84 |
- logger("modules/mysql/include/mysql", "mysql", "creating user »{$username}«");
|
|
| 84 |
+ logger(LOG_INFO, "modules/mysql/include/mysql", "mysql", "creating user »{$username}«");
|
|
| 85 | 85 |
db_query("INSERT INTO misc.mysql_accounts (username, password, useraccount, description) VALUES ('$username', '!', $uid, $description);");
|
| 86 | 86 |
} |
| 87 | 87 |
|
| ... | ... |
@@ -90,7 +90,7 @@ function delete_mysql_account($username) |
| 90 | 90 |
{
|
| 91 | 91 |
$username = mysql_real_escape_string($username); |
| 92 | 92 |
$uid = $_SESSION['userinfo']['uid']; |
| 93 |
- logger("modules/mysql/include/mysql", "mysql", "deleting user »{$username}«");
|
|
| 93 |
+ logger(LOG_INFO, "modules/mysql/include/mysql", "mysql", "deleting user »{$username}«");
|
|
| 94 | 94 |
db_query("DELETE FROM misc.mysql_accounts WHERE username='{$username}' AND useraccount='{$uid}' LIMIT 1;");
|
| 95 | 95 |
} |
| 96 | 96 |
|
| ... | ... |
@@ -99,14 +99,14 @@ function create_mysql_database($dbname, $description = '') |
| 99 | 99 |
{
|
| 100 | 100 |
if (! validate_mysql_dbname($dbname)) |
| 101 | 101 |
{
|
| 102 |
- logger("modules/mysql/include/mysql", "mysql", "illegal db-name »{$dbname}«");
|
|
| 102 |
+ logger(LOG_WARNING, "modules/mysql/include/mysql", "mysql", "illegal db-name »{$dbname}«");
|
|
| 103 | 103 |
input_error("Der eingegebene Datenbankname entspricht leider nicht der Konvention. Bitte tragen Sie einen passenden Namen ein.");
|
| 104 | 104 |
return NULL; |
| 105 | 105 |
} |
| 106 | 106 |
$dbname = mysql_real_escape_string($dbname); |
| 107 | 107 |
$uid = $_SESSION['userinfo']['uid']; |
| 108 | 108 |
$description = maybe_null($description); |
| 109 |
- logger("modules/mysql/include/mysql", "mysql", "creating database »{$dbname}«");
|
|
| 109 |
+ logger(LOG_INFO, "modules/mysql/include/mysql", "mysql", "creating database »{$dbname}«");
|
|
| 110 | 110 |
db_query("INSERT INTO misc.mysql_database (name, useraccount, description) VALUES ('$dbname', $uid, $description);");
|
| 111 | 111 |
} |
| 112 | 112 |
|
| ... | ... |
@@ -115,7 +115,7 @@ function delete_mysql_database($dbname) |
| 115 | 115 |
{
|
| 116 | 116 |
$dbname = mysql_real_escape_string($dbname); |
| 117 | 117 |
$uid = $_SESSION['userinfo']['uid']; |
| 118 |
- logger("modules/mysql/include/mysql", "mysql", "removing database »{$dbname}«");
|
|
| 118 |
+ logger(LOG_INFO, "modules/mysql/include/mysql", "mysql", "removing database »{$dbname}«");
|
|
| 119 | 119 |
db_query("DELETE FROM misc.mysql_database WHERE name='{$dbname}' AND useraccount='{$uid}' LIMIT 1;");
|
| 120 | 120 |
} |
| 121 | 121 |
|
| ... | ... |
@@ -139,7 +139,7 @@ function set_mysql_password($username, $password) |
| 139 | 139 |
$username = mysql_real_escape_string($username); |
| 140 | 140 |
$password = mysql_real_escape_string($password); |
| 141 | 141 |
$uid = $_SESSION['userinfo']['uid']; |
| 142 |
- logger("modules/mysql/include/mysql", "mysql", "updating password for »{$username}«");
|
|
| 142 |
+ logger(LOG_INFO, "modules/mysql/include/mysql", "mysql", "updating password for »{$username}«");
|
|
| 143 | 143 |
db_query("UPDATE misc.mysql_accounts SET password=PASSWORD('$password') WHERE username='$username' AND useraccount=$uid;");
|
| 144 | 144 |
} |
| 145 | 145 |
|
| ... | ... |
@@ -20,7 +20,7 @@ function create_customer($data) |
| 20 | 20 |
|
| 21 | 21 |
if (customer_with_email($data['email']) !== NULL) |
| 22 | 22 |
{
|
| 23 |
- logger('modules/register/include/register', 'register', "Attempt to create customer with duplicate email »{$data['email']}«");
|
|
| 23 |
+ logger(LOG_WARNING, 'modules/register/include/register', 'register', "Attempt to create customer with duplicate email »{$data['email']}«");
|
|
| 24 | 24 |
return NULL; |
| 25 | 25 |
} |
| 26 | 26 |
|
| ... | ... |
@@ -30,7 +30,7 @@ function create_customer($data) |
| 30 | 30 |
$nachname = mysql_escape_string($data['nachname']); |
| 31 | 31 |
$email = mysql_escape_string($data['email']); |
| 32 | 32 |
|
| 33 |
- logger('modules/register/include/register', 'register', "Creating new account: {$anrede} / {$firma} / {$vorname} / {$nachname} / {$email}");
|
|
| 33 |
+ logger(LOG_INFO, 'modules/register/include/register', 'register', "Creating new account: {$anrede} / {$firma} / {$vorname} / {$nachname} / {$email}");
|
|
| 34 | 34 |
|
| 35 | 35 |
$realname = maybe_null(chop($vorname.' '.$nachname)); |
| 36 | 36 |
|
| ... | ... |
@@ -46,7 +46,7 @@ if (count($_POST) > 0) |
| 46 | 46 |
require_once('inc/base.php');
|
| 47 | 47 |
send_initial_customer_token($customerno); |
| 48 | 48 |
notify_admins_about_new_customer($customerno); |
| 49 |
- logger("modules/register/index", "register", "token sent for customer »{$customerno}«");
|
|
| 49 |
+ logger(LOG_INFO, "modules/register/index", "register", "token sent for customer »{$customerno}«");
|
|
| 50 | 50 |
$success = true; |
| 51 | 51 |
#success_msg('Die angegebenen Daten wurden gespeichert, Sie sollten umgehend eine E-Mail erhalten.');
|
| 52 | 52 |
} |
| ... | ... |
@@ -67,7 +67,7 @@ function set_systemuser_details($uid, $fullname, $quota) |
| 67 | 67 |
$quota = (int) $quota; |
| 68 | 68 |
|
| 69 | 69 |
db_query("UPDATE system.useraccounts SET name={$fullname} WHERE kunde={$customerno} AND uid={$uid} LIMIT 1");
|
| 70 |
- logger("modules/systemuser/include/useraccounts", "systemuser", "updated real name for uid {$uid}");
|
|
| 70 |
+ logger(LOG_INFO, "modules/systemuser/include/useraccounts", "systemuser", "updated real name for uid {$uid}");
|
|
| 71 | 71 |
|
| 72 | 72 |
} |
| 73 | 73 |
|
| ... | ... |
@@ -139,7 +139,7 @@ function delete_vhost($id) |
| 139 | 139 |
if ($id == 0) |
| 140 | 140 |
system_failure("id == 0");
|
| 141 | 141 |
$vhost = get_vhost_details($id); |
| 142 |
- logger('modules/vhosts/include/vhosts', 'vhosts', 'Removing vhost #'.$id.' ('.$vhost['hostname'].'.'.$vhost['domain'].')');
|
|
| 142 |
+ logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Removing vhost #'.$id.' ('.$vhost['hostname'].'.'.$vhost['domain'].')');
|
|
| 143 | 143 |
db_query("DELETE FROM vhosts.vhost WHERE id={$vhost['id']} LIMIT 1");
|
| 144 | 144 |
} |
| 145 | 145 |
|
| ... | ... |
@@ -150,7 +150,7 @@ function make_svn_vhost($id) |
| 150 | 150 |
$id = (int) $id; |
| 151 | 151 |
if ($id == 0) |
| 152 | 152 |
system_failure("id == 0");
|
| 153 |
- logger('modules/vhosts/include/vhosts', 'vhosts', 'Converting vhost #'.$id.' to SVN');
|
|
| 153 |
+ logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Converting vhost #'.$id.' to SVN'); |
|
| 154 | 154 |
db_query("REPLACE INTO vhosts.dav (vhost, type) VALUES ({$id}, 'svn')");
|
| 155 | 155 |
db_query("DELETE FROM vhosts.webapps WHERE vhost={$id}");
|
| 156 | 156 |
} |
| ... | ... |
@@ -160,7 +160,7 @@ function make_dav_vhost($id) |
| 160 | 160 |
$id = (int) $id; |
| 161 | 161 |
if ($id == 0) |
| 162 | 162 |
system_failure("id == 0");
|
| 163 |
- logger('modules/vhosts/include/vhosts', 'vhosts', 'Converting vhost #'.$id.' to WebDAV');
|
|
| 163 |
+ logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Converting vhost #'.$id.' to WebDAV'); |
|
| 164 | 164 |
db_query("REPLACE INTO vhosts.dav (vhost, type, options) VALUES ({$id}, 'dav', 'nouserfile')");
|
| 165 | 165 |
db_query("DELETE FROM vhosts.webapps WHERE vhost={$id}");
|
| 166 | 166 |
} |
| ... | ... |
@@ -170,7 +170,7 @@ function make_regular_vhost($id) |
| 170 | 170 |
$id = (int) $id; |
| 171 | 171 |
if ($id == 0) |
| 172 | 172 |
system_failure("id == 0");
|
| 173 |
- logger('modules/vhosts/include/vhosts', 'vhosts', 'Converting vhost #'.$id.' to regular');
|
|
| 173 |
+ logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Converting vhost #'.$id.' to regular'); |
|
| 174 | 174 |
db_query("DELETE FROM vhosts.dav WHERE vhost={$id}");
|
| 175 | 175 |
db_query("DELETE FROM vhosts.webapps WHERE vhost={$id}");
|
| 176 | 176 |
} |
| ... | ... |
@@ -186,7 +186,7 @@ function make_webapp_vhost($id, $webapp) |
| 186 | 186 |
if (mysql_num_rows($result) == 0) |
| 187 | 187 |
system_failure("webapp-id invalid");
|
| 188 | 188 |
$webapp_name = mysql_fetch_object($result)->displayname; |
| 189 |
- logger('modules/vhosts/include/vhosts', 'vhosts', 'Setting up webapp '.$webapp_name.' on vhost #'.$id);
|
|
| 189 |
+ logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Setting up webapp '.$webapp_name.' on vhost #'.$id); |
|
| 190 | 190 |
db_query("REPLACE INTO vhosts.webapps (vhost, webapp) VALUES ({$id}, {$webapp})");
|
| 191 | 191 |
mail('webapps-setup@schokokeks.org', 'setup', 'setup');
|
| 192 | 192 |
} |
| ... | ... |
@@ -230,11 +230,11 @@ function save_vhost($vhost) |
| 230 | 230 |
} |
| 231 | 231 |
|
| 232 | 232 |
if ($id != 0) {
|
| 233 |
- logger('modules/vhosts/include/vhosts', 'vhosts', 'Updating vhost #'.$id.' ('.$vhost['hostname'].'.'.$vhost['domain'].')');
|
|
| 233 |
+ logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Updating vhost #'.$id.' ('.$vhost['hostname'].'.'.$vhost['domain'].')');
|
|
| 234 | 234 |
db_query("UPDATE vhosts.vhost SET hostname={$hostname}, domain={$domain}, docroot={$docroot}, php={$php}, `ssl`={$ssl}, logtype={$logtype}, errorlog={$errorlog}, certid={$cert}, ipv4={$ipv4}, options='{$options}' WHERE id={$id} LIMIT 1");
|
| 235 | 235 |
} |
| 236 | 236 |
else {
|
| 237 |
- logger('modules/vhosts/include/vhosts', 'vhosts', 'Creating vhost '.$vhost['hostname'].'.'.$vhost['domain'].'');
|
|
| 237 |
+ logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Creating vhost '.$vhost['hostname'].'.'.$vhost['domain'].''); |
|
| 238 | 238 |
$result = db_query("INSERT INTO vhosts.vhost (user, hostname, domain, docroot, php, `ssl`, logtype, errorlog, certid, ipv4, options) VALUES ({$_SESSION['userinfo']['uid']}, {$hostname}, {$domain}, {$docroot}, {$php}, {$ssl}, {$logtype}, {$errorlog}, {$cert}, {$ipv4}, '{$options}')");
|
| 239 | 239 |
$id = mysql_insert_id(); |
| 240 | 240 |
} |
| ... | ... |
@@ -281,7 +281,7 @@ function delete_alias($id) |
| 281 | 281 |
$id = (int) $id; |
| 282 | 282 |
$alias = get_alias_details($id); |
| 283 | 283 |
|
| 284 |
- logger('modules/vhosts/include/vhosts', 'aliases', 'Removing alias #'.$id.' ('.$alias['hostname'].'.'.$alias['domain'].')');
|
|
| 284 |
+ logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'aliases', 'Removing alias #'.$id.' ('.$alias['hostname'].'.'.$alias['domain'].')');
|
|
| 285 | 285 |
db_query("DELETE FROM vhosts.alias WHERE id={$id}");
|
| 286 | 286 |
} |
| 287 | 287 |
|
| ... | ... |
@@ -299,11 +299,11 @@ function save_alias($alias) |
| 299 | 299 |
$vhost = get_vhost_details( (int) $alias['vhost']); |
| 300 | 300 |
$options = mysql_real_escape_string( $alias['options'] ); |
| 301 | 301 |
if ($id == 0) {
|
| 302 |
- logger('modules/vhosts/include/vhosts', 'aliases', 'Creating alias '.$alias['hostname'].'.'.$alias['domain'].' for VHost '.$vhost['id']);
|
|
| 302 |
+ logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'aliases', 'Creating alias '.$alias['hostname'].'.'.$alias['domain'].' for VHost '.$vhost['id']); |
|
| 303 | 303 |
db_query("INSERT INTO vhosts.alias (hostname, domain, vhost, options) VALUES ({$hostname}, {$domain}, {$vhost['id']}, '{$options}')");
|
| 304 | 304 |
} |
| 305 | 305 |
else {
|
| 306 |
- logger('modules/vhosts/include/vhosts', 'aliases', 'Updating alias #'.$id.' ('.$alias['hostname'].'.'.$alias['domain'].')');
|
|
| 306 |
+ logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'aliases', 'Updating alias #'.$id.' ('.$alias['hostname'].'.'.$alias['domain'].')');
|
|
| 307 | 307 |
db_query("UPDATE vhosts.alias SET hostname={$hostname}, domain={$domain}, options='{$options}' WHERE id={$id} LIMIT 1");
|
| 308 | 308 |
} |
| 309 | 309 |
} |
| ... | ... |
@@ -37,12 +37,12 @@ function find_role($login, $password, $i_am_admin = False) |
| 37 | 37 |
$role = $role | ROLE_CUSTOMER; |
| 38 | 38 |
if ($entry->admin) |
| 39 | 39 |
$role = $role | ROLE_SYSADMIN; |
| 40 |
- logger("session/checkuser", "login", "logged in systemuser »{$login}«.");
|
|
| 40 |
+ logger(LOG_INFO, "session/checkuser", "login", "logged in systemuser »{$login}«.");
|
|
| 41 | 41 |
return $role; |
| 42 | 42 |
} |
| 43 |
- logger("session/checkuser", "login", "wrong password for existing useraccount »{$login}«.");
|
|
| 43 |
+ logger(LOG_WARNING, "session/checkuser", "login", "wrong password for existing useraccount »{$login}«.");
|
|
| 44 | 44 |
} else {
|
| 45 |
- logger("session/checkuser", "login", "did not find useraccount »{$login}«. trying other roles...");
|
|
| 45 |
+ logger(LOG_WARNING, "session/checkuser", "login", "did not find useraccount »{$login}«. trying other roles...");
|
|
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 | 48 |
// Customer? |
| ... | ... |
@@ -69,10 +69,10 @@ function find_role($login, $password, $i_am_admin = False) |
| 69 | 69 |
$hash = crypt($password, $db_password); |
| 70 | 70 |
if ($hash == $db_password || $i_am_admin) |
| 71 | 71 |
{
|
| 72 |
- logger("session/checkuser", "login", "logged in e-mail-account »{$account}«.");
|
|
| 72 |
+ logger(LOG_INFO, "session/checkuser", "login", "logged in e-mail-account »{$account}«.");
|
|
| 73 | 73 |
return ROLE_MAILACCOUNT; |
| 74 | 74 |
} |
| 75 |
- logger("session/checkuser", "login", "wrong password for existing e-mail-account »{$account}«.");
|
|
| 75 |
+ logger(LOG_WARNING, "session/checkuser", "login", "wrong password for existing e-mail-account »{$account}«.");
|
|
| 76 | 76 |
} |
| 77 | 77 |
|
| 78 | 78 |
// virtueller Mail-Account |
| ... | ... |
@@ -85,10 +85,10 @@ function find_role($login, $password, $i_am_admin = False) |
| 85 | 85 |
$hash = crypt($password, $db_password); |
| 86 | 86 |
if ($hash == $db_password || $i_am_admin) |
| 87 | 87 |
{
|
| 88 |
- logger("session/checkuser", "login", "logged in virtual e-mail-account »{$account}«.");
|
|
| 88 |
+ logger(LOG_INFO, "session/checkuser", "login", "logged in virtual e-mail-account »{$account}«.");
|
|
| 89 | 89 |
return ROLE_VMAIL_ACCOUNT; |
| 90 | 90 |
} |
| 91 |
- logger("session/checkuser", "login", "wrong password for existing virtual e-mail-account »{$account}«.");
|
|
| 91 |
+ logger(LOG_WARNING, "session/checkuser", "login", "wrong password for existing virtual e-mail-account »{$account}«.");
|
|
| 92 | 92 |
} |
| 93 | 93 |
|
| 94 | 94 |
|
| ... | ... |
@@ -146,7 +146,7 @@ function get_user_info($username) |
| 146 | 146 |
FROM system.v_useraccounts WHERE username='{$username}' OR uid='{$username}' LIMIT 1");
|
| 147 | 147 |
if (mysql_num_rows($result) < 1) |
| 148 | 148 |
{
|
| 149 |
- logger("session/checkuser", "login", "error reading user's data: »{$username}«");
|
|
| 149 |
+ logger(LOG_ERR, "session/checkuser", "login", "error reading user's data: »{$username}«");
|
|
| 150 | 150 |
system_failure('Das Auslesen Ihrer Benutzerdaten ist fehlgeschlagen. Bitte melden Sie dies einem Administrator');
|
| 151 | 151 |
} |
| 152 | 152 |
$val = @mysql_fetch_object($result); |
| ... | ... |
@@ -163,7 +163,7 @@ function set_customer_verified($customerno) |
| 163 | 163 |
{
|
| 164 | 164 |
$customerno = (int) $customerno; |
| 165 | 165 |
db_query("UPDATE kundendaten.kunden SET status=0 WHERE id={$customerno};");
|
| 166 |
- logger("session/checkuser", "register", "set customer's status to 0.");
|
|
| 166 |
+ logger(LOG_INFO, "session/checkuser", "register", "set customer's status to 0."); |
|
| 167 | 167 |
} |
| 168 | 168 |
|
| 169 | 169 |
function set_customer_lastlogin($customerno) |
| ... | ... |
@@ -177,7 +177,7 @@ function set_customer_password($customerno, $newpass) |
| 177 | 177 |
$customerno = (int) $customerno; |
| 178 | 178 |
$newpass = sha1($newpass); |
| 179 | 179 |
db_query("UPDATE kundendaten.kunden SET passwort='$newpass' WHERE id='".$customerno."' LIMIT 1");
|
| 180 |
- logger("session/checkuser", "pwchange", "changed customer's password.");
|
|
| 180 |
+ logger(LOG_INFO, "session/checkuser", "pwchange", "changed customer's password."); |
|
| 181 | 181 |
} |
| 182 | 182 |
|
| 183 | 183 |
|
| ... | ... |
@@ -188,7 +188,7 @@ function set_systemuser_password($uid, $newpass) |
| 188 | 188 |
$salt = random_string(8); |
| 189 | 189 |
$newpass = crypt($newpass, "\$1\${$salt}\$");
|
| 190 | 190 |
db_query("UPDATE system.passwoerter SET passwort='$newpass' WHERE uid='".$uid."' LIMIT 1");
|
| 191 |
- logger("session/checkuser", "pwchange", "changed user's password.");
|
|
| 191 |
+ logger(LOG_INFO, "session/checkuser", "pwchange", "changed user's password."); |
|
| 192 | 192 |
} |
| 193 | 193 |
|
| 194 | 194 |
|
| ... | ... |
@@ -201,7 +201,7 @@ function setup_session($role, $useridentity) |
| 201 | 201 |
DEBUG("We are system user");
|
| 202 | 202 |
$info = get_user_info($useridentity); |
| 203 | 203 |
$_SESSION['userinfo'] = $info; |
| 204 |
- logger("session/start", "login", "logged in user »{$info['username']}«");
|
|
| 204 |
+ logger(LOG_INFO, "session/start", "login", "logged in user »{$info['username']}«");
|
|
| 205 | 205 |
$useridentity = $info['customerno']; |
| 206 | 206 |
} |
| 207 | 207 |
if ($role & ROLE_CUSTOMER) |
| ... | ... |
@@ -209,7 +209,7 @@ function setup_session($role, $useridentity) |
| 209 | 209 |
$info = get_customer_info($useridentity); |
| 210 | 210 |
$_SESSION['customerinfo'] = $info; |
| 211 | 211 |
set_customer_lastlogin($info['customerno']); |
| 212 |
- logger("session/start", "login", "logged in customer no »{$info['customerno']}«");
|
|
| 212 |
+ logger(LOG_INFO, "session/start", "login", "logged in customer no »{$info['customerno']}«");
|
|
| 213 | 213 |
} |
| 214 | 214 |
if ($role & ROLE_MAILACCOUNT) |
| 215 | 215 |
{
|
| ... | ... |
@@ -17,7 +17,7 @@ if ($_SERVER['HTTPS']) session_set_cookie_params( 0, '/', '', true, true ); |
| 17 | 17 |
|
| 18 | 18 |
if (!session_start()) |
| 19 | 19 |
{
|
| 20 |
- logger("session/start", "session", "Die session konnte nicht gestartet werden!");
|
|
| 20 |
+ logger(LOG_ERR, "session/start", "session", "Die session konnte nicht gestartet werden!"); |
|
| 21 | 21 |
system_failure('Die Sitzung konnte nicht gestartet werden, bitte benachrichtigen Sie den Administrator!');
|
| 22 | 22 |
} |
| 23 | 23 |
|
| ... | ... |
@@ -29,7 +29,7 @@ if (isset($_POST['username']) && isset($_POST['password'])) |
| 29 | 29 |
if ($role === NULL) |
| 30 | 30 |
{
|
| 31 | 31 |
$_SESSION['role'] = ROLE_ANONYMOUS; |
| 32 |
- logger("session/start", "login", "wrong user data (username: »{$_POST['username']}«)");
|
|
| 32 |
+ logger(LOG_WARNING, "session/start", "login", "wrong user data (username: »{$_POST['username']}«)");
|
|
| 33 | 33 |
login_screen('Ihre Anmeldung konnte nicht durchgeführt werden. Vermutlich haben Sie falsche Zugangsdaten eingegeben.');
|
| 34 | 34 |
} |
| 35 | 35 |
else |
| 36 | 36 |