X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=ImportMailMessage.php;h=ce4ea30d905b74816b063e3e43e3bb0b7a2ab56b;hp=e3cdad6d6717c293116268b71e29a836e94796b3;hb=refs%2Fheads%2Fwip_alan_T5884_add_photo_to_report;hpb=85b4aa4360d9be7641573ce2f6bf7c53f937aa24 diff --git a/ImportMailMessage.php b/ImportMailMessage.php index e3cdad6d..ce4ea30d 100644 --- a/ImportMailMessage.php +++ b/ImportMailMessage.php @@ -1,8 +1,10 @@ post(); return $this->jerr("not allowed"); } - function post() - { + function post($v) + { if(isset($_REQUEST['_convertToPlain'])) { require_once 'System.php'; @@ -54,20 +56,17 @@ class Pman_Crm_ImportHtml extends Pman_Core_ConvertStyle } require_once 'File/Convert.php'; $fc = new File_Convert($path, 'text/html'); + $plain = $fc->convert('text/plain'); $this->jok(file_get_contents($plain)); } + // Import from URL if(isset($_REQUEST['importUrl'])) { - // $host = parse_url($_REQUEST['importUrl']); -// if($host['host'] != 'localhost' && $host['host'] != 'roojs-edward.com' && $host['host'] != $_SERVER['HTTP_HOST']) -// { -// $this->jerr('Invalid URL!'); -// } $this->checkHeader($_REQUEST['importUrl']); $data = $this->convertStyle($_REQUEST['importUrl'], '', true); - // print_r($data);exit; + $this->jok($data); } @@ -79,7 +78,7 @@ class Pman_Crm_ImportHtml extends Pman_Core_ConvertStyle 'ontable' =>'crm_mailing_list_message' )); $htmlFile->onUpload(false); - // print_r($htmlFile); + if($htmlFile->mimetype != 'text/html') { $this->jerr('accept html file only!'); @@ -92,6 +91,7 @@ class Pman_Crm_ImportHtml extends Pman_Core_ConvertStyle $data = $this->convertStyle('', $htmlFile->getStoreName(), false); $htmlFile->delete(); + unlink($htmlFile->getStoreName()) or die('Unable to delete the file'); $this->jok($data);