function HumanRule($ligne) { $fr = new Fetchmail_settings(); $arr = $fr->parse_config($ligne); $arr = $arr[1]; if ($arr["ssl"]) { $ssl = "{using_ssl}"; } if ($arr["port"] != null) { $port = "{with_port} {$arr["port"]}"; } else { $port = null; } $line = "{fetch_address} "<strong>" . $arr["user"] . "</strong>"<br>\n\t{protocol}: <strong>{$arr["proto"]} {$port} {$ssl}</strong><br>\n\t{and_send_to} <strong>"" . $arr["is"] . ""</strong>"; return $line; }
function LoadFetchMailRuleFromUser() { $ldap = new clladp(); $u = $ldap->UserDatas($_GET["LoadFetchMailRuleFromUser"]); $fr = new Fetchmail_settings(); $tpl = new templates(); while (list($num, $ligne) = each($u["FetchMailsRulesSources"])) { $arr = $fr->parse_config($ligne); $arr = $arr[1]; $line = "\n\t\t<table>\n\t\t<tr>\n\t\t<td width=1% valign='top'><img src='img/fw_bold.gif'></td>\n\t\t<td width=1% nowrap valign='top'>{rule} {$num}</td>\n\t\t<td>" . $arr["poll"] . " {from} " . $arr["user"] . " {to} " . $arr["is"] . "</td>\n\t\t</tr>\n\t\t</table>"; $res[] = RoundedLightGrey($tpl->_ENGINE_parse_body($line), "javascript:UserFetchMailRule({$num},'{$_GET["LoadFetchMailRuleFromUser"]}');", 1); } echo $tpl->_ENGINE_parse_body(implode("<br>", $res)); echo $list; }
function import_filename($filename) { if (!is_file($filename)) { echo "{$filename} (no such file)\n"; } $f = new Fetchmail_settings(); $array = $f->parse_config(@file_get_contents($filename)); echo "Importing " . count($array) . " lines/rules form \"{$path}\"\n"; $fetch = new Fetchmail_settings(); while (list($num, $ligne) = each($array)) { if ($fetch->EditRule($ligne, 0, true)) { } } }