result[$i]</td></tr>";
}
print "</table><hr><br><br>";
}
}
return $result;
}
/*
#
# READING from Server via Telnet-Connection!
#
*/
function getline() {
$this->line = fgets($this->fp, 256);
return $this->line;
}
/*
#
# QUOTA Functions
#
*/
// GETTING QUOTA
function getquota($mb_name) {
$output=$this->command(". getquota \"$mb_name\"");
if (strstr($output[0],". NO"))
{
$ret["used"] = "NOT-SET";
$ret["qmax"] = "NOT-SET";
}
else
{
$realoutput = str_replace(")", "", $output[0]);
$tok_list = split(" ",$realoutput);
$si_used=sizeof($tok_list)-2;
$si_max=sizeof($tok_list)-1;
$ret["used"] = str_replace(")","",$tok_list[$si_used]);
$ret["qmax"] = $tok_list[$si_max];
}
return $ret;
}
// SETTING QUOTA
function setmbquota($mb_name, $quota) {
$this->command(". setquota \"$mb_name\" (STORAGE $quota)");
}
/*
#
# MAILBOX Functions
#
*/
function createmb($mb_name, $mb_partition="") {
$this->command(". create \"$mb_name\" $mb_partition");
}
function deletemb($mb_name) {
$this->command(". setacl \"$mb_name\" $this->admin d");
$this->command(". delete \"$mb_name\"");
}
function renamemb($mb_name, $newmbname) {
$all="lrswipcda";
$this->setacl($mb_name, $this->admin,$all);
$this->command(". rename \"$mb_name\" \"$newmbname\"");
$this->deleteacl($newmbname, $this->admin);
}
function renameuser($from_mb_name, $to_mb_name) {
$all="lrswipcda"; $find_out=array(); $split_res=array(); $owner=""; $oldowner="";
/* Anlegen und Kopieren der INBOX */
$this->createmb($to_mb_name);
$this->setacl($to_mb_name, $this->admin,$all);
$this->copymailsfromfolder($from_mb_name, $to_mb_name);
/* Quotas uebernehmen */
$quota=$this->getquota($from_mb_name);
$oldquota=trim($quota["qmax"]);
if (strcmp($oldquota,"NOT-SET")!=0) {
$this->setmbquota($to_mb_name, $oldquota);
}
/* Den Rest Umbenennen */
$username=str_replace(".","/",$from_mb_name);
$split_res=explode(".", $to_mb_name);
if (strcmp($split_res[0],"user")==0) {
$owner=$split_res;
}
$split_res=explode(".", $from_mb_name);
if (strcmp($split_res[0],"user")==0) {
$oldowner=$split_res;
}
$find_out=$this->GetFolders($username);
for ($i=0; $i < count($find_out); $i++) {
if (strcmp($find_out[$i],$username)!=0) {
$split_res=split("$username",$find_out[$i]);
$split_res=str_replace("/",".",$split_res);
$this->renamemb((str_replace("/",".",$find_out[$i])), ("$to_mb_name"."$split_res"));
if ($owner) {
$this->setacl(("$to_mb_name"."$split_res"),$owner,$all);
}
if ($oldow