<?php require_once 'init.php'; $mid = $_GET['mid']; $login_uid = $_COOKIE['uid']; $mailObj = new MailClass($login_uid); $json_str = $mailObj->get_mail_info($mid); $mail_obj = json_decode($json_str); $mail_info_array = array(); $mail_info_array['isdraft'] = $mail_obj[0]->isdraft; $mail_info_array['mid'] = $mail_obj[0]->mid; $mail_info_array['title'] = $mail_obj[0]->title; $mail_info_array['date'] = $mail_obj[0]->date; $mail_info_array['fromuid'] = $mail_obj[0]->fromuid; $mail_info_array['fromuser'] = $mail_obj[0]->fromuser; $mail_info_array['touser'] = $mail_obj[0]->touser; $mail_info_array['content'] = $mail_obj[0]->content; $btn_del_caption = "删除信息"; $btn_edit_caption = "回复信息"; if ($mail_obj[0]->isdraft == 'true') { $btn_del_caption = "删除草稿"; $btn_edit_caption = "编辑草稿"; } else { //if ( $mail_obj[0]->fromuid != $login_uid ) { $mailObj->set_mail_readed($mid, $login_uid); //} } $smarty->assign('mail_info', $mail_info_array); $smarty->assign('btn_del_caption', $btn_del_caption); $smarty->assign('btn_edit_caption', $btn_edit_caption); $smarty->display('mail_view.tpl');
<?php require_once 'init.php'; $mailObj = new MailClass($_COOKIE['uid']); $json_str = $mailObj->get_mail_list(2); $mail_info_array = json_decode($json_str); $mail_info_list = array(); if (!isset($mail_info_array->result)) { foreach ($mail_info_array as $mail_obj) { $item = array('mid' => $mail_obj->mid, 'title' => $mail_obj->title, 'date' => $mail_obj->date, 'fromuser' => $mail_obj->fromuser, 'status' => $mail_obj->status); array_push($mail_info_list, $item); } } /* $last_page = basename($_SERVER['SCRIPT_FILENAME']); setcookie('last_page',$last_page, time()+3600); setcookie('mail_type','read', time()+3600); */ $smarty->assign('mail_info_list', $mail_info_list); $smarty->display('mail_list.tpl');
<?php require_once 'init.php'; if (isset($_GET['mid'])) { $mid = $_GET['mid']; $mailObj = new MailClass($_COOKIE['uid']); $json_str = $mailObj->get_mail_info($mid); $mail_info = json_decode($json_str); if ($mail_info[0]->isdraft == 'true') { $smarty->assign('mail_title', $mail_info[0]->title); $smarty->assign('mail_touser', $mail_info[0]->touser); $smarty->assign('mail_content', $mail_info[0]->content); } } else { if (isset($_GET['touid'])) { $touid = $_GET['touid']; $userObj = new UserClass(); $json_str = $userObj->get_userinfo($touid); $user_obj = json_decode($json_str); $smarty->assign('mail_touser', $user_obj[0]->name); } } $smarty->display('mail_edit.tpl');
require_once dirname(__FILE__) . '/includes/plugin.class.php'; setcookie('uid', $_SESSION['uid'], time() + 3600); $login_uid = $_SESSION['uid']; $_COOKIE['uid'] = $login_uid; //获取登录用户信息 $CUser = new UserClass(); //获取登录用户名 $json_str = $CUser->get_userinfo($login_uid); $user_obj = json_decode($json_str); $username = $user_obj[0]->name; //获取登录用户头像 $user_avatar = $CUser->get_avatar($login_uid); //获取登录用户权限 $user_privilege = $CUser->get_privilege($_SESSION['uid']); //获取站内信信息 $CMail = new MailClass($login_uid); //获取未读站内信数量 $json_str = $CMail->get_mail_count(); $result_array = json_decode($json_str); $unread_mail_count = $result_array->unread; //获取站内信数组 $json_str = $CMail->get_mail_list(1); $unread_mail_array = json_decode($json_str); $unread_mail_list = array(); if (!isset($unread_mail_array->result)) { foreach ($unread_mail_array as $mail_obj) { $fromuser_avatar = $CUser->get_avatar($mail_obj->fromuid); $item = array('mid' => $mail_obj->mid, 'title' => $mail_obj->title, 'date' => $mail_obj->date, 'fromuser_avatar' => $fromuser_avatar); array_push($unread_mail_list, $item); } }
<?php session_start(); require_once dirname(dirname(__FILE__)) . '/config.php'; require_once BASE_PATH . '/includes/mail.class.php'; $json_error = json_encode(array("result" => "false")); if (!isset($_POST['action'])) { echo $json_error; exit; } if (!isset($_COOKIE['uid'])) { echo $json_error; exit; } $mailObj = new MailClass($_COOKIE['uid']); $action = $_POST['action']; switch ($action) { case "del_mail": if (isset($_POST['mid'])) { echo $mailObj->del_mail($_POST['mid']); exit; } break; case "send_mail": //发送邮件 当包含mid时只做更新不做插入 $title = $_POST['title']; $touser = $_POST['touser']; $content = $_POST['content']; if (isset($_POST['mid'])) { echo $mailObj->del_mail($title, $touser, $content, $_POST['mid']); } else {