示例#1
0
 public function view_ajaxDelCategory()
 {
     $cid = isset($_GET['cid']) ? $_GET['cid'] : 0;
     if (!is_numeric($cid)) {
         //传入数据非数字
         $msgar = array('code' => 6001, 'msg' => 'id不合法');
         echo json_encode($msgar);
         exit;
     }
     if ($cid === 0) {
         //没有传入分类id
         $msgar = array('code' => 6004, 'msg' => '未指定分类id');
         echo json_encode($msgar);
         exit;
     }
     $msg_obj = new amazonmessageModel();
     $num = $msg_obj->getNumber($cid);
     if ($num) {
         $msgar = array('code' => 6005, 'msg' => '该分类下邮件不为空,不能删除!');
         echo json_encode($msgar);
         exit;
     }
     $msgcat_obj = new amazonmessagecategoryModel();
     $result = $msgcat_obj->delCategoryById($cid);
     if ($result) {
         //删除成功
         $msgar = array('code' => 6002, 'msg' => '删除成功!');
         echo json_encode($msgar);
         exit;
     } else {
         $msgar = array('code' => 6003, 'msg' => '删除失败!');
         echo json_encode($msgar);
         exit;
     }
 }
示例#2
0
 public function view_downLoadAttach()
 {
     $mid = isset($_GET['mid']) ? $_GET['mid'] : 0;
     $msg_obj = new amazonmessageModel();
     $msginfo = $msg_obj->getMessageInfo(array($mid))[0];
     $attachname = $msginfo['attachname'];
     $attachpath = WEB_PATH . 'crontab/' . $msginfo['attachpath'];
     if (!file_exists($attachpath)) {
         die('附件不存在');
     }
     $fp = fopen($attachpath, 'r');
     $fsize = filesize($attachpath);
     header("Content-type:text/html;charset=utf-8");
     Header("Content-type: application/octet-stream");
     Header("Accept-Ranges: bytes");
     Header("Accept-Length:" . $fsize);
     Header("Content-Disposition: attachment; filename=" . $attachname);
     $buffer = 1024;
     while (!feof($fp)) {
         $file_con = fread($fp, $buffer);
         echo $file_con;
     }
     fclose($fp);
 }
示例#3
0
<?php

/*
 * Amazon邮件抓取脚本
 */
error_reporting(E_ALL);
include_once __DIR__ . '/../framework.php';
// 加载框架
Core::getInstance();
// 初始化框架对象
include_once WEB_PATH . 'lib/Get_Email.class.php';
include_once WEB_PATH . 'lib/opensys_functions.php';
$mail = new Get_Email();
$account_obj = new AmazonAccountModel();
$msg_obj = new amazonmessageModel();
$msgcat_obj = new amazonmessagecategoryModel();
$fam_obj = new FetchAmazonMessageModel();
$accounts = $account_obj->getAmazonAccountsGmail();
$path = '';
$connect = array();
$n = 0;
foreach ($accounts as $ac) {
    if ($ac['amazon_account'] != "{$argv['1']}") {
        continue;
    }
    $path = WEB_PATH . 'crontab/gmaillib/' . $ac['amazon_account'] . '/' . preg_split('/@/', $ac['gmail'])[0] . '/' . date('Y-m-d') . '/';
    $connect = $mail->mailConnect('imap.gmail.com', '993', $ac['gmail'], base64_decode($ac['password']), 'INBOX', 'ssl');
    if (!$connect) {
        die('连接失败');
    } else {
        echo "连接成功\r\n";
示例#4
0
    case '3':
        echo "<script>";
        echo "top.alertify.error('附件只有部分被上传',2000)";
        echo "</script>";
        exit;
    case '4':
        echo "<script>";
        echo "top.alertify.error('没有附件被上传',2000)";
        echo "</script>";
        exit;
    case '5':
        echo "<script>";
        echo "top.alertify.error('上传附件大小为0',2000)";
        echo "</script>";
        exit;
}
$attach = WEB_PATH . 'html/upload/' . $id . $_FILES['attach']["name"];
$msg_obj = new amazonmessageModel();
$res = $msg_obj->insertAttachPath($id, $attach);
echo $res;
if (move_uploaded_file($_FILES['attach']['tmp_name'], $attach) && $res) {
    echo "<script>";
    echo "top.alertify.success('附件上传成功',2000);";
    echo "top.\$('#attachname').html('{$atname_tmp}');";
    echo "</script>";
} else {
    echo "<script>";
    echo "top.alertify.error('附件上传失败',2000);";
    echo "</script>";
    exit;
}
 public function view_markAmazonMessage()
 {
     $status = isset($_GET['status']) ? $_GET['status'] : FALSE;
     $msgid = isset($_GET['msgid']) ? $_GET['msgid'] : FALSE;
     if ($status === FALSE) {
         $msgdata = array('errCode' => 10030, 'errMsg' => '操作失败!');
         echo json_encode($msgdata);
         exit;
     }
     if ($msgid === FALSE || !is_numeric($msgid)) {
         $msgdata = array('errCode' => 10031, 'errMsg' => '操作失败!');
         echo json_encode($msgdata);
         exit;
     }
     $status = $status == 0 ? 1 : 0;
     $msg_obj = new amazonmessageModel();
     $result = $msg_obj->updateMessageMark($msgid, $status);
     if ($result) {
         $msgdata = array('errCode' => 10032, 'errMsg' => '操作成功!');
         echo json_encode($msgdata);
         exit;
     } else {
         $msgdata = array('errCode' => 10033, 'errMsg' => '操作失败!');
         echo json_encode($msgdata);
         exit;
     }
 }