-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgetinbox.php
More file actions
executable file
·82 lines (72 loc) · 3.82 KB
/
getinbox.php
File metadata and controls
executable file
·82 lines (72 loc) · 3.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
include('constants.php');
foreach($_POST as $item => $val) {
${$item} = $val;
}
$stringona = '';
// Checking if personalized connection
if($src_server == 'other') {
$strFlags = '';
foreach($src_server_security_protocol as $flag) {
$strFlags .= '/'.$flag;
}
$strConnection = '{'.$src_server_name.":$src_server_port$strFlags}";
}
else {
require('./mailref.php');
if(!key_exists($src_server,$mailRef)) {
die("Unknown server, probably data was inserted in a bad way");
}
$strFlags = '';
foreach($mailRef[$src_server]['flags'] as $flag) {
$strFlags .= '/'.$flag;
}
$strConnection = '{'.$mailRef[$src_server]['address'].':'.$mailRef[$src_server]['port'].$strFlags.'}';
}
$src_mbox = imap_open($strConnection,"$src_server_username","$src_server_password")
or die("can't connect: ".imap_last_error()."\n");
$list = imap_list($src_mbox, $strConnection, "*");
if (is_array($list)) {
foreach ($list as &$val) {
$_status = imap_status($src_mbox,$val,SA_MESSAGES);
$_totalMessages = $_status->messages;
$_exploded = explode('}',$val);
$val = $_exploded[1];
//$val = "<option value=\"$val\">$val</option>";
$val = '<div class="limit-wrapper">
<input type="hidden" name="'.$val.'-num-msgs" value="'.$_totalMessages.'" />
<input type="checkbox" class="checkbox-limit" name="inboxes[]" value="'.$val.'" />'.$val.' ('.$_totalMessages.' mensagens nesta caixa)<br />
<div class="limit-box limit-box-num-wrapper">
<input type="checkbox" class="checkbox-limit-sub" name="'.$val.'-limit-num-check" />Limitar o número de mensagens a ser importados<br />
<div class="limit-box-num limit-box">
Limite :<input type="text" name="'.$val.'-limit-num" />
<select name="'.$val.'-limit-num-dir">
<option value='.RECENT.'>Mais Recentes</option>
<option value='.OLD.'>Mais Antigas</option>
</select>
</div>
</div>
<div class="limit-box limit-box-date-wrapper">
<input type="checkbox" class="checkbox-limit-sub" name="'.$val.'-limit-date-check" />Limitar o período de mensagens a ser importados<br />
<div class="limit-box limit-box-date">
A partir de: <input type="text" name="'.$val.'-limit-date-init" /><br />
Até: <input type="text" name="'.$val.'-limit-date-end" /><br />
</div>
</div>
';/*<div class="limit-box limit-box-multi-wrapper">
<input type="checkbox" class="checkbox-limit-sub" name="'.$val.'-limit-multi-check" />Utilizar multiprocessamento<br />
<div class="limit-box limit-box-multi">
A partir de: <input type="text" name="'.$val.'-limit-multi-num" /><br />
</div>
</div>
</div>
';*/
$stringona .= $val;
//print imap_utf7_decode($val) . "<br />\n";
}
} else {
echo "imap_list failed: " . imap_last_error() . "\n";
}
print_r($stringona);
//return(json_encode($list));
?>