function showpdadomains()
{
global $domain;
$list = explode(";", $domain);
for ($i = 0; $i < count($list); $i++)
{
$xitem = trim($list[$i]);
if ($xitem) $ret.= "";
}
return $ret;
}
function checkpdasession($id)
{
global $notactive;
$session = getusersession($id, $user, $config);
if (!$session)
{
if($id) logoutuser($id);
header("Location: index.html?message=".urlencode($notactive["MESSAGE"]));
exit;
}
}
function printlist($count,$no="",$listno,$path="")
{
if($count<=$listno) return;
global $id,$folder,$search,$xsearch,$xfolder,$dodo,$Ccase,$global;
$end=ceil($count/$listno);
if($no>round(SHOWLISTS/2))
{
if($end-SHOWLISTS>0 && $no>$end-round(SHOWLISTS/2))
$i= $end-SHOWLISTS+1;
else
{
$i= $no-round(SHOWLISTS/2)+1;
$end=$end>SHOWLISTS?SHOWLISTS+$i-1:$end;
}
}
else
{
$i= 1;
$end=$end>SHOWLISTS?SHOWLISTS:$end;
}
if($path=="get.html")
$pathtype='&folder='.rawurlencode($folder);
elseif($path=="address.html")
$pathtype='&global='.rawurlencode($global);
if($no>1)
$ret.='<< <';
else
$ret.='<< <';
for($i;$i<=$end;$i++) $ret.= ($i==$no?' '.$i:' '.$i.'');
if($no> >>';
else
$ret.=' > >>';
return $ret;
}
function deletemessage($id,$user,$folder,$messageid)
{
global $otherconfig,$otheraccounts;
$fileitem = getfolderpath($user, $folder, $messageid);
if (getmessageflag($id, $folder, $messageid) == unreadflag) $unr=-1; else $unr=0;
if (($fileitem = getrealfile($fileitem))){
$Fsize = filesize($fileitem);
if (@unlink($fileitem)) {
changeindex(dirname($fileitem),$unr,-1,-$Fsize);
if(!($otherconfig["FULLMERAK"] && directmerak && !is_array($otheraccounts))) deleteuid($id, $fileitem);
}
}
}
// store mail for jump between writemail and addressbook
function storemail($in)
{
global $user;
$path = usersdir . $user . "/" . writetmpfile;
if(!is_Array($in) || !count($in))
{
@unlink($path);
return false;
}
$nodata= true;
foreach ($in as $k => $value)
{
if($k>0) $data.= "\r\n";
if(trim($value)!=='')
{
$data .= base64_encode(trim($value));
$nodata = false;
}
}
if($nodata)
{
@unlink($path);
return true;
}
$handle = fopen ($path, "wb");
fputs($handle,$data,strlen($data));
fclose($handle);
}
// retrieve mail for jump between "somewhere" and writemail
function retrievemail($delete=0)
{
global $user;
$path = usersdir . $user . "/" . writetmpfile;
if(!file_exists($path)) return;
if($delete){@unlink($path); return;}
$out = file($path);
foreach($out as $k => $v) $out[$k]= trim($v);
return $out;
}
?>