integrating admin email into "getEmailsOfEmail"
This commit is contained in:
parent
afe04765ae
commit
742c251fd6
|
@ -93,6 +93,7 @@ switch($action)
|
|||
break;
|
||||
|
||||
case 'list':
|
||||
/*
|
||||
$settings = loadSettings();
|
||||
if($settings['ADMIN'] && $settings['ADMIN']==$admincheck)
|
||||
{
|
||||
|
@ -117,7 +118,7 @@ switch($action)
|
|||
|
||||
$o['emails']=$data;
|
||||
}
|
||||
else if(!is_dir($dir))
|
||||
else */if(!is_dir($dir))
|
||||
$o = array('status'=>'ok','emails'=>[]);
|
||||
else
|
||||
{
|
||||
|
|
|
@ -41,15 +41,40 @@ function emailIDExists($email,$id)
|
|||
function getEmailsOfEmail($email)
|
||||
{
|
||||
$o = [];
|
||||
if ($handle = opendir(getDirForEmail($email))) {
|
||||
while (false !== ($entry = readdir($handle))) {
|
||||
if (endsWith($entry,'.json')) {
|
||||
$time = substr($entry,0,-5);
|
||||
$json = json_decode(file_get_contents(getDirForEmail($email).DS.$entry),true);
|
||||
$o[$time] = array('email'=>$email,'id'=>$time,'from'=>$json['parsed']['from'],'subject'=>$json['parsed']['subject'],'md5'=>md5($time.$json['raw']),'maillen'=>strlen($json['raw']));
|
||||
$settings = loadSettings();
|
||||
|
||||
if($settings['ADMIN'] && $settings['ADMIN']==$email)
|
||||
{
|
||||
$emails = listEmailAdresses();
|
||||
if(count($emails)>0)
|
||||
{
|
||||
foreach($emails as $email)
|
||||
{
|
||||
if ($handle = opendir(getDirForEmail($email))) {
|
||||
while (false !== ($entry = readdir($handle))) {
|
||||
if (endsWith($entry,'.json')) {
|
||||
$time = substr($entry,0,-5);
|
||||
$json = json_decode(file_get_contents(getDirForEmail($email).DS.$entry),true);
|
||||
$o[$time] = array('email'=>$email,'id'=>$time,'from'=>$json['parsed']['from'],'subject'=>$json['parsed']['subject'],'md5'=>md5($time.$json['raw']),'maillen'=>strlen($json['raw']));
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($handle = opendir(getDirForEmail($email))) {
|
||||
while (false !== ($entry = readdir($handle))) {
|
||||
if (endsWith($entry,'.json')) {
|
||||
$time = substr($entry,0,-5);
|
||||
$json = json_decode(file_get_contents(getDirForEmail($email).DS.$entry),true);
|
||||
$o[$time] = array('email'=>$email,'id'=>$time,'from'=>$json['parsed']['from'],'subject'=>$json['parsed']['subject'],'md5'=>md5($time.$json['raw']),'maillen'=>strlen($json['raw']));
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
|
||||
if(is_array($o))
|
||||
|
|
Loading…
Reference in a new issue