webinterface => /webinterface
bernd authored 17 years ago
|
1) <?php
2)
3) require_once('inc/debug.php');
4) require_once('inc/db_connect.php');
5)
6) function mailaccounts($uid)
7) {
8) $uid = (int) $uid;
9) $query = "SELECT m.id,concat_ws('@',`m`.`local`,if(isnull(`m`.`domain`),_utf8'schokokeks.org',`d`.`domainname`)) AS `account`, `m`.`password` AS `cryptpass`,`m`.`maildir` AS `maildir`,aktiv from (`mail`.`mailaccounts` `m` left join `mail`.`v_domains` `d` on((`d`.`id` = `m`.`domain`))) WHERE m.uid=$uid";
10) DEBUG("SQL-Query: {$query}");
11) $result = @mysql_query($query);
12) if (mysql_error())
13) system_failure(mysql_error());
14) DEBUG("Found ".@mysql_num_rows($result)." rows!");
15) $accounts = array();
16) if (@mysql_num_rows($result) > 0)
17) while ($acc = @mysql_fetch_object($result))
18) array_push($accounts, array('id'=> $acc->id, 'account' => $acc->account, 'mailbox' => $acc->maildir, 'cryptpass' => $acc->cryptpass, 'enabled' => ($acc->aktiv == 1)));
19) return $accounts;
20) }
21)
22) function get_mailaccount($id)
23) {
24) $uid = (int) $uid;
25) $query = "SELECT concat_ws('@',`m`.`local`,if(isnull(`m`.`domain`),_utf8'schokokeks.org',`d`.`domainname`)) AS `account`, `m`.`password` AS `cryptpass`,`m`.`maildir` AS `maildir`,aktiv from (`mail`.`mailaccounts` `m` left join `mail`.`v_domains` `d` on((`d`.`id` = `m`.`domain`))) WHERE m.id=$id";
26) $result = mysql_query($query);
27) DEBUG("Found ".mysql_num_rows($result)." rows!");
28) $acc = mysql_fetch_object($result);
29) $ret = array('account' => $acc->account, 'mailbox' => $acc->maildir, 'enabled' => ($acc->aktiv == 1));
30) DEBUG(print_r($ret, true));
31) return $ret;
32) }
33)
34) function encrypt_mail_password($pw)
35) {
36) DEBUG("unencrypted PW: ".$pw);
|