27
27
$mail_fetch_allow_unsubscribed = false;
30
* Validate a requested POP3 port number
32
* Allowable port numbers are configured in config.php
33
* (see config_example.php for an example and more
34
* rules about how the list of allowable port numbers
37
* @param int $requested_port The port number given by the user
39
* @return string An error string is returned if the port
40
* number is not allowable, otherwise an
41
* empty string is returned.
44
function validate_mail_fetch_port_number($requested_port) {
45
global $mail_fetch_allowable_ports;
46
@include_once(SM_PATH . 'plugins/mail_fetch/config.php');
47
if (empty($mail_fetch_allowable_ports))
48
$mail_fetch_allowable_ports = array(110, 995);
50
if (in_array('ALL', $mail_fetch_allowable_ports))
53
if (!in_array($requested_port, $mail_fetch_allowable_ports)) {
54
sq_change_text_domain('mail_fetch');
55
$error = _("Sorry, that port number is not allowed");
56
sq_change_text_domain('squirrelmail');
64
* Validate a requested POP3 server address
66
* Blocked server addresses are configured in config.php
67
* (see config_example.php for more details)
69
* @param int $requested_address The server address given by the user
71
* @return string An error string is returned if the server
72
* address is not allowable, otherwise an
73
* empty string is returned.
76
function validate_mail_fetch_server_address($requested_address) {
77
global $mail_fetch_block_server_pattern;
78
@include_once(SM_PATH . 'plugins/mail_fetch/config.php');
79
if (empty($mail_fetch_block_server_pattern))
80
$mail_fetch_block_server_pattern = '/(^10\.)|(^192\.)|(^127\.)|(^localhost)/';
82
if ($mail_fetch_block_server_pattern == 'UNRESTRICTED')
85
if (preg_match($mail_fetch_block_server_pattern, $requested_address)) {
86
sq_change_text_domain('mail_fetch');
87
$error = _("Sorry, that server address is not allowed");
88
sq_change_text_domain('squirrelmail');
29
95
function hex2bin( $data ) {
30
96
/* Original code by josh@superfork.com */