log("mail","_createpop",$mail."@".$dom); // $m=substr($mail,0,1); // $gecos=$mail; // if (!$mail) { // // Cas du CATCH-ALL // $gecos="Catch-All"; // $m="_"; // } // $db->query("INSERT INTO mail_users (uid,alias,path,password) VALUES ('$cuid','".$mail."_".$dom."','/var/alternc/mail/".$m."/".$mail."_".$dom."','"._md5cr($pass)."');"); // $db->query("INSERT INTO mail_users (uid,alias,path,password) VALUES ('$cuid','".$mail."@".$dom."','/var/alternc/mail/".$m."/".$mail."_".$dom."','"._md5cr($pass)."');"); // $db->query("INSERT INTO mail_alias (mail,alias) VALUES ('".$mail."_".$dom."','/var/alternc/mail/".$m."/".$mail."_".$dom."/Maildir/');"); // // $f=fopen("/var/lib/squirrelmail/data/".$mail."_".$dom.".pref","wb"); // $g=0; $g=@fopen("/etc/squirrelmail/default_pref","rb"); // fputs($f,"email_address=$mail@$dom\nchosen_theme=default_theme.php\n"); // if ($g) { // while ($s=fgets($g,1024)) { // if (substr($s,0,14)!="email_address=" && substr($s,0,13)!="chosen_theme=") { // fputs($f,$s); // } // } // fclose($g); // } // fclose($f); // @copy("/var/lib/squirrelmail/data/".$mail."_".$dom.".pref","/var/lib/squirrelmail/data/".$mail."@".$dom.".pref"); // exec("/usr/lib/alternc/mail_add ".$mail."_".$dom." ".$cuid); // return true; // } function _createpop($mail,$dom,$pass) { if ($this->_add_egw_account($mail,$dom,$pass) ) if (parent::_createpop($mail,$dom,$pass)) return true; else return false; else return false; } function _add_egw_account($mail,$dom,$pass) { $res = true; $domain = explode('.',$dom); $size = count($domain); if ( $size >= 3 && $domain[$size-3] == "cta" && $domain[$size-2] == "org" && $domain[$size-1] == "ar" ) { $admincli= "/var/alternc/html/i/intranet/intranet.redcta.org.ar/wwws/stable/admin/admin-cli.php"; $command= "--edit-user"; // Command to be performed $adminuser = $GLOBALS["L_adminuser_egw"]; $adminclave = $GLOBALS["L_adminclave_egw"]; // $account - we use the email address which is extracted from the DB // $firstname - we use the left side of the email adress, which will be extracted from the database $lastname= "-"; // we have a generic lastname // $passwd will be generated with some magic // $email you know that, from the db $expires= "never"; $canchangepw= "yes"; $anonuser= "no"; $primarygroup = $domain[$size-3]; $secundarygroup = join(',', array_slice($domain,0,-3)); $lastname = "-"; $firstname = $mail; $email = $account = $mail ."@" .$dom; $go= $admincli ." " .$command ." " .$adminuser ."," .$adminclave .",\"" .$account ."\"," .$firstname ."," .$lastname ."," .$pass .",\"" .$email ."\"," .$expires ."," .$canchangepw ."," .$anonuser ."," .$primarygroup ; if (isset($secondarygroup)) { $go= $go ."," .$secondarygroup; } echo ($go); exit(); $cod = exec($go); if ($cod) { die ($cod); $res = false; } } return $res; } } ?>