function section_fetchmail_daemon_save()
{
    $fetch = new fetchmail();
    $fetch->FetchmailDaemonPostmaster = $_GET["FetchmailDaemonPostmaster"];
    $fetch->FetchmailPoolingTime = $_GET["FetchmailPoolingTime"];
    echo $fetch->Save();
}
Example #2
0
function section_fetchmail_daemon_save()
{
    $sock = new sockets();
    $fetch = new fetchmail();
    $fetch->FetchmailDaemonPostmaster = $_GET["FetchmailDaemonPostmaster"];
    $fetch->FetchmailPoolingTime = $_GET["FetchmailPoolingTime"];
    $sock->SET_INFO("FetchMailGLobalDropDelivered", $_GET["FetchMailGLobalDropDelivered"]);
    echo $fetch->Save();
}
function section_config()
{
    $fetch = new fetchmail();
    if (isset($_GET["build"])) {
        $fetch->Save();
        $fetch = new fetchmail();
    }
    $fetchmailrc = $fetch->fetchmailrc;
    $FetchGetLive = $fetch->FetchGetLive;
    $save = Paragraphe('disk-save-64.png', '{generate_config}', '{generate_config_text}', "javascript:LoadAjax(\"fetchmail_daemon_rules\",\"fetchmail.daemon.rules.php?Showlist=yes&tab=1&build=yes\")");
    $fetchmailrc = htmlentities($fetchmailrc);
    $fetchmailrc = nl2br($fetchmailrc);
    $FetchGetLive = htmlentities($FetchGetLive);
    $FetchGetLive = nl2br($FetchGetLive);
    $tpl = new templates();
    $html = section_tabs() . "<br><H5>{see_config}</H5><br>\n\t<table style='width:100%'>\n\t<tr>\n\t<td width=75% valign='top'>" . RoundedLightGreen("<code>{$fetchmailrc}</code>") . "<br>" . RoundedLightGreen("<code>{$FetchGetLive}</code>") . "</td>\n\t<td valign='top'>{$save}<br>" . applysettings("fetch") . "</td>\n\t</tr>\n\t</table>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #4
0
function main_fetchmail_build(){
	include_once('ressources/class.user.inc');
	include_once('ressources/class.main_cf.inc');
	include_once('ressources/class.fetchmail.inc');
	
	
$failed=false;	
	
$isp_address_mail=$_GET["isp_address_mail"];
$isp_pop3_server=$_GET["isp_pop3_server"];
$isp_smtp_server=$_GET["isp_smtp_server"];
	
$isp_account=$_GET["isp_account"];
$isp_password=$_GET["isp_password"];
$local_email=$_GET["local_email"];
$local_password=$_GET["local_password"];
	
$isp_smtp_account=$_GET["isp_smtp_account"];
$isp_smtp_password=$_GET["isp_smtp_password"];
	
$relay_server=$_GET["relay_server"];


if($local_email==null){
	echo main_fetchmail_build_results(true,'local mail (False)');
	exit;
}

$ldap=new clladp();
writelogs("i try to found if user exists",__FUNCTION__,__FILE__);
$uid=$ldap->uid_from_email($local_email);
if($uid<>null){
	$user=new user($local_email);
	$ou=$user->ou;
}else{
	writelogs("no user found, create it",__FUNCTION__,__FILE__);
	$tb=explode("@",$local_email);
	$local_domain=$tb[1];  
	$user=new user($tb[0]);
	$ou=$ldap->ou_by_smtp_domain($local_domain);
	if($ou==null){
		$ou=$local_domain;
		writelogs("Adding new organization $ou",__FUNCTION__,__FILE__);
		$ldap->AddOrganization($ou);
	}	
	
}


	
	writelogs("Creating user",__FUNCTION__,__FILE__);
	$user=new user($local_email);
	$user->mail=$local_email;
	$user->password=$local_password;
	$user->ou=$ou;
	$user->SenderCanonical=$isp_address_mail;
	if(!$user->add_user()){
		echo main_fetchmail_build_results(true,$user->ldap_error);
		exit;
	}
	
	
	if($isp_smtp_account<>null){
		writelogs("Creating SMTP authentification for $isp_smtp_server width $isp_smtp_account",__FUNCTION__,__FILE__);
		$sasl=new smtp_sasl_password_maps();
		$sasl->add($isp_address_mail,$isp_smtp_account,$isp_password);
		$main=new main_cf();
		writelogs("Enable sasl engine in postfix",__FUNCTION__,__FILE__);
		$main->smtp_sasl_password_maps_enable_2();		
		
	}
	writelogs("Creating sender_dependent_relayhost_maps -> $isp_smtp_server",__FUNCTION__,__FILE__);
	$sender=new sender_dependent_relayhost_maps();
	if(!$sender->Add($isp_address_mail,$isp_smtp_server)){
		echo main_fetchmail_build_results(true,"sender_dependent_relayhost_maps:$sender->ldap_error");
		exit;
	}
	

	$fetchmail=new Fetchmail_settings();
	$array["poll"]=$isp_pop3_server;
	$array["proto"]="auto";
	$array["keep"]="yes";
	$array["user"]=$isp_account;
	$array["pass"]=$isp_password;
	$array["is"]=$local_email;
	$array["fetchall"]="yes";
	$line=$fetchmail->compile($array);
	if(!$user->fetchmail_add_rule($line)){
		echo main_fetchmail_build_results(true,"fetchmail rule:$user->ldap_error");
		exit;
	}
	
	$relay=new Routing($ou);
	if($relay_server<>null){
		if(!$relay->create_relay_server($local_domain,$relay_server,$ou)){
				echo main_fetchmail_build_results(true,"relay:$relay->ldap_error");
			}
		}else{
			if(!$relay->create_localdomain($ou,$local_domain)){
				echo main_fetchmail_build_results(true,"local domain:$relay->ldap_error");
			}
		}

	
	$fetchmail=new fetchmail();
	$fetchmail->Save();
	$main=new main_cf();
	$main->save_conf();
	$main->save_conf_to_server();
	
	
	
	$info="<table style='width:100%'>
	<tr>
		<td width=1%><img src='img/fw_bold.gif'></td>
		<td nowrap align='right'><strong>{organization}</strong>:</td>
		<td nowrap><strong>$ou</strong></td>
	</tr>
	<tr>
		<td width=1%><img src='img/fw_bold.gif'></td>
		<td nowrap align='right'><strong>{local_mail}</strong>:</td>
		<td nowrap><strong>$local_email</strong></td>
	</tr>
	<tr>
		<td width=1%><img src='img/fw_bold.gif'></td>
		<td nowrap align='right'><strong>{isp_address_mail}</strong>:</td>
		<td nowrap><strong>$isp_address_mail</strong></td>
	</tr>			
	</table>	
	";
	
	echo main_fetchmail_build_results(false,$info);
	
	
}
Example #5
0
function SavePools()
{
    $user = $_GET["is"];
    writelogs("local user is :\"{$_GET["is"]}\"", __FUNCTION__, __FILE__);
    $tpl = new templates();
    $ldap = new clladp();
    $dn = $ldap->dn_from_email($user);
    if ($dn == null) {
        echo $tpl->_ENGINE_parse_body("\"{$user}\"\n{doesntexists}");
        exit;
    }
    $fr = new Fetchmail_settings();
    if ($fr->EditRule($_GET, $_GET["rule_number"])) {
        $fetchmail = new fetchmail();
        $fetchmail->Save();
        echo $tpl->javascript_parse_text('{success}');
    } else {
        echo $tpl->javascript_parse_text('{failed}');
    }
}
Example #6
0
function ApplyConfigFetchMail()
{
    $prod = "fetchmail_main_settings";
    $tpl = new templates();
    $user = new usersMenus();
    if ($user->fetchmail_installed == false) {
        echo $tpl->_ENGINE_parse_body(NotInstalled($prod));
        exit;
    }
    include_once 'ressources/class.fetchmail.inc';
    $fetch = new fetchmail();
    $fetch->Save();
    $sock = new sockets();
    $sock->getfile('Savefetchmailrc');
    echo $tpl->_ENGINE_parse_body(Success($prod));
}
Example #7
0
function TreeFetchMailApplyConfig()
{
    $usr = new usersMenus();
    $tpl = new templates();
    if ($usr->AsMailBoxAdministrator == false) {
        echo $tpl->_ENGINE_parse_body('{no_privileges}');
        exit;
    }
    include_once 'ressources/class.fetchmail.inc';
    $fecth = new fetchmail();
    echo $fecth->Save();
}
Example #8
0
function fetch_enable_save()
{
    $sock = new sockets();
    $sock->SET_INFO('EnableFetchmail', $_GET["enable_fetchmail"]);
    $fetch = new fetchmail();
    $fetch->Save();
}
function page_save(){
	
	$ldap=new clladp();
	$user=new user($_GET["uid"]);
	$fetchmail=new Fetchmail_settings();
	if($_GET["fetchmail_rule_id"]>-1){
		$fetchmail->EditRule($_GET,$_GET["fetchmail_rule_id"]);
		
	}else{
		
		if(!$fetchmail->AddRule($_GET)){
			echo "->AddRule Class, Mysql error !\n";
			return;
			
		}
	}
	
	$fetchmail=new fetchmail();
	$fetchmail->Save();
	
}
function page_save(){
	$_POST["pass"]=url_decode_special_tool($_POST["pass"]);
	$ldap=new clladp();
	$user=new user($_POST["uid"]);
	$fetchmail=new Fetchmail_settings();
	if($_POST["fetchmail_rule_id"]>-1){
		$fetchmail->EditRule($_POST,$_POST["fetchmail_rule_id"]);
		
	}else{
		
		if(!$fetchmail->AddRule($_POST)){
			echo "->AddRule Class, Mysql error !\n";
			return;
			
		}
	}
	
	$fetchmail=new fetchmail();
	$fetchmail->Save();
	
}
function EnableFetchmail()
{
    $sock = new sockets();
    $sock->SET_INFO('EnableFetchmail', $_POST["EnableFetchmail"]);
    $fetch = new fetchmail();
    $fetch->Save();
}
Example #12
0
function fetch_enable_save()
{
    $artica = new artica_general();
    $artica->EnableFetchmail = $_GET["enable_fetchmail"];
    $artica->Save();
    $fetch = new fetchmail();
    $fetch->Save();
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body("{enable_fetchmail}: {success}\n");
}