integrating admin email into "getEmailsOfEmail"
This commit is contained in:
parent
afe04765ae
commit
742c251fd6
|
@ -93,6 +93,7 @@ switch($action)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'list':
|
case 'list':
|
||||||
|
/*
|
||||||
$settings = loadSettings();
|
$settings = loadSettings();
|
||||||
if($settings['ADMIN'] && $settings['ADMIN']==$admincheck)
|
if($settings['ADMIN'] && $settings['ADMIN']==$admincheck)
|
||||||
{
|
{
|
||||||
|
@ -117,7 +118,7 @@ switch($action)
|
||||||
|
|
||||||
$o['emails']=$data;
|
$o['emails']=$data;
|
||||||
}
|
}
|
||||||
else if(!is_dir($dir))
|
else */if(!is_dir($dir))
|
||||||
$o = array('status'=>'ok','emails'=>[]);
|
$o = array('status'=>'ok','emails'=>[]);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,6 +41,15 @@ function emailIDExists($email,$id)
|
||||||
function getEmailsOfEmail($email)
|
function getEmailsOfEmail($email)
|
||||||
{
|
{
|
||||||
$o = [];
|
$o = [];
|
||||||
|
$settings = loadSettings();
|
||||||
|
|
||||||
|
if($settings['ADMIN'] && $settings['ADMIN']==$email)
|
||||||
|
{
|
||||||
|
$emails = listEmailAdresses();
|
||||||
|
if(count($emails)>0)
|
||||||
|
{
|
||||||
|
foreach($emails as $email)
|
||||||
|
{
|
||||||
if ($handle = opendir(getDirForEmail($email))) {
|
if ($handle = opendir(getDirForEmail($email))) {
|
||||||
while (false !== ($entry = readdir($handle))) {
|
while (false !== ($entry = readdir($handle))) {
|
||||||
if (endsWith($entry,'.json')) {
|
if (endsWith($entry,'.json')) {
|
||||||
|
@ -51,6 +60,22 @@ function getEmailsOfEmail($email)
|
||||||
}
|
}
|
||||||
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))
|
if(is_array($o))
|
||||||
ksort($o);
|
ksort($o);
|
||||||
|
|
Loading…
Reference in a new issue