1 | <?php
|
---|
2 |
|
---|
3 | include_once('class.functions.inc.php');
|
---|
4 |
|
---|
5 | class imap_functions
|
---|
6 | {
|
---|
7 | var $functions;
|
---|
8 | var $imap;
|
---|
9 | var $imapDelimiter;
|
---|
10 | var $imap_admin;
|
---|
11 | var $imap_passwd;
|
---|
12 | var $imap_server;
|
---|
13 | var $imap_port;
|
---|
14 |
|
---|
15 | function imap_functions(){
|
---|
16 | $this->functions = new functions;
|
---|
17 | $this->imap_admin = $_SESSION['phpgw_info']['expresso']['email_server']['imapAdminUsername'];
|
---|
18 | $this->imap_passwd = $_SESSION['phpgw_info']['expresso']['email_server']['imapAdminPW'];
|
---|
19 | $this->imap_server = $_SESSION['phpgw_info']['expresso']['email_server']['imapServer'];
|
---|
20 | $this->imap_port = $_SESSION['phpgw_info']['expresso']['email_server']['imapPort'];
|
---|
21 | $this->imapDelimiter= $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter'];
|
---|
22 | $this->imap = imap_open('{'.$this->imap_server.':'.$this->imap_port.'/novalidate-cert}', $this->imap_admin, $this->imap_passwd, OP_HALFOPEN);
|
---|
23 | }
|
---|
24 |
|
---|
25 | function get_user_info($uid)
|
---|
26 | {
|
---|
27 | $get_quota = @imap_get_quotaroot($this->imap,"user" . $this->imapDelimiter . $uid);
|
---|
28 |
|
---|
29 | if (count($get_quota) == 0)
|
---|
30 | {
|
---|
31 | $quota['mailquota'] = '-1';
|
---|
32 | $quota['mailquota_used'] = '-1';
|
---|
33 | }
|
---|
34 | else
|
---|
35 | {
|
---|
36 | $quota['mailquota'] = round (($get_quota['limit'] / 1024), 2);
|
---|
37 | $quota['mailquota_used'] = round (($get_quota['usage'] / 1024), 2);
|
---|
38 | }
|
---|
39 | return $quota;
|
---|
40 | }
|
---|
41 |
|
---|
42 | function getMembersShareAccount($uid)
|
---|
43 | {
|
---|
44 | $owner_user_share = imap_getacl($this->imap, "user" . $this->imapDelimiter . $uid);
|
---|
45 |
|
---|
46 | //Organiza participantes da conta compartilha em um array, retira apenas os members,
|
---|
47 | $i =0;
|
---|
48 | foreach($owner_user_share as $key => $value)
|
---|
49 | {
|
---|
50 | if ($i != 0)
|
---|
51 | {
|
---|
52 | $return[$i] = $key;
|
---|
53 | }
|
---|
54 | ++$i;
|
---|
55 | }
|
---|
56 |
|
---|
57 | //Ordena os participantes da conta compartilhada
|
---|
58 | sort($return);
|
---|
59 |
|
---|
60 | return $return;
|
---|
61 | }
|
---|
62 |
|
---|
63 | }
|
---|