public function view_categoryList() { /* ----- 获取全部的分类列表 -----*/ $msgcat_obj = new messagecategoryModel(); $lp_ojb = new LocalPowerModel(); $powerlist = $lp_ojb->getEbayPowerlist($_SESSION['userId']); if (empty($powerlist['field'])) { $filsql = '0'; } else { $filsql = implode(', ', $powerlist['field']); } $arrlist = $msgcat_obj->getAllCategoryInfoList(' and id in (' . $filsql . ') order by category_name'); $msg_obj = new messageModel(); if (in_array('-1', $powerlist['field'])) { $arrlist[] = array('id' => -1, 'category_name' => '迷途文件夹', 'ebay_account' => ''); } foreach ($arrlist as &$listval) { /* ---- 计算某个分类下已经回复的数量 ---- */ $replyed_num = $msg_obj->getNumber($listval['id'], array(2, 3)); $listval['replyed'] = $replyed_num; /* ---- 计算某个分类下未回复的数量 ---- */ $noreply_num = $msg_obj->getNumber($listval['id'], array(0)); $listval['noreply'] = $noreply_num; } $this->smarty->assign('sec_menue', 1); $this->smarty->assign('toplevel', 1); $this->smarty->assign('categorylist', $arrlist); $this->smarty->assign('toptitle', 'message类别列表'); $this->smarty->display('msgcategorylist.htm'); }
public function view_reReplyMessage() { $ids = isset($_GET['ids']) ? trim($_GET['ids']) : FALSE; $returndata = array('errCode' => 0, 'errMsg' => ''); if (empty($ids)) { $returndata['errCode'] = 100; $returndata['errMsg'] = '缺少参数!'; echo json_encode($returndata); exit; } $ids = clearData($ids); $msg_ojb = new messageModel(); if (empty($ids)) { $returndata['errCode'] = 101; $returndata['errMsg'] = '缺少参数!'; echo json_encode($returndata); exit; } // print_r($ids);exit; $result = $msg_ojb->reReplyMessage_ebay($ids); $returndata['errCode'] = 102; $returndata['errMsg'] = ''; $returndata['data'] = $result; echo json_encode($returndata); }
<!-- <li><a href="cloud.html">cloud</a></li> --> <li><a href="shell/shell.html">shell</a></li> <li><a href="about.html">about</a></li> <li><a href="sign.html">sign</a></li> <li><a href="countdown/countdown.html">countdown</a></li> </ul> <?php ob_start(); require_once 'public.func.php'; include_once 'messageModel.class.php'; $_SESSION['isFlash'] = 1; $_SESSION['flashTime'] = time(); if (isOnline()) { $userName = $_SESSION['userName']; $msgModel = new messageModel(); $msg = $msgModel->getUnReadMsgNum(); echo <<<EOF <div class="navbar-about-me"> <button class="navbar-messages btn btn-info" type="button" onclick="readMes()"> <span class="fa fa-bell"> </span> <span class="badge">{$msg}</span> </button> <img class="navbar-head-img img-circle" alt="40x40" src="img/headPic.jpg" style="cursor:pointer"> </div> EOF; ob_end_flush(); } ?> <!-- <div class="navbar-about-me">
public function delete($id) { $message = new messageModel(); $message->delete($id); header("location:" . $this->_link(array('messages')) . ""); }
public function markAsRead($messageid, $type = 'Read', $flag = '') { //return TRUE; $msg_obj = new messageModel(); $msginof = $msg_obj->getMessageInfo(array($messageid)); $verb = 'ReviseMyMessages'; global $devID, $appID, $certID, $serverUrl, $siteID, $compatabilityLevel, $mctime, $userToken; $xmlRequest = '<?xml version="1.0" encoding="utf-8"?> <ReviseMyMessagesRequest xmlns="urn:ebay:apis:eBLBaseComponents"> <WarningLevel>High</WarningLevel> <MessageIDs> <MessageID>' . $msginof[0]['message_id'] . '</MessageID> </MessageIDs> '; $xmlRequest .= '<Read>true</Read>'; $xmlRequest .= ' <RequesterCredentials> <eBayAuthToken>' . $userToken . '</eBayAuthToken> </RequesterCredentials> <WarningLevel>High</WarningLevel> </ReviseMyMessagesRequest> '; $session = new eBaySession($userToken, $devID, $appID, $certID, $serverUrl, $compatabilityLevel, $siteID, $verb); $responseXml = $session->sendHttpRequest($xmlRequest); //echo $responseXml;exit; if (stristr($responseXml, 'HTTP 404') || $responseXml == '' || $responseXml === FALSE) { self::$errCode = 9001; self::$sender = $msginof[0]['replyuser_id']; self::$errMsg = __METHOD__ . '发送请求失败! in line ' . __LINE__; self::$sendMsg = __METHOD__ . '发送请求失败! in line ' . __LINE__; return FALSE; } $data = XML_unserialize($responseXml); //print_r($data); $ack = $data['ReviseMyMessagesResponse']; $ack = $ack['Ack']; if ($ack == 'Success') { return TRUE; } else { self::$sender = $msginof[0]['replyuser_id']; self::$errMsg = $xmlRequest . '-----' . $responseXml . __LINE__ . "\n"; $obj_return = simplexml_load_string($responseXml); if ($obj_return && isset($obj_return->Errors->LongMessage)) { self::$sendMsg = 'MSGID:' . $msginof[0]['message_id'] . '发送人:' . $msginof[0]['sendid'] . ' ++++ 原因 :' . $obj_return->Errors->LongMessage; } else { self::$sendMsg = 'MSGID:' . $msginof[0]['message_id'] . '发送人:' . $msginof[0]['sendid'] . ' ++++ ' . '原因未知'; } return FALSE; } }
public function view() { session_start(); $itemName = ''; $itemOwner = ''; $itemBorrower = ''; $isValidBid = false; // Check that URL has required fields if (empty($_GET['item']) || empty($_GET['owner']) || empty($_GET['borrower'])) { header("Location:index.php"); return; } $itemName = $_GET['item']; $itemOwner = $_GET['owner']; $itemBorrower = $_GET['borrower']; $currentUser = $_SESSION['username']; // Getting the item include 'models/itemModel.php'; $itemModel = new itemModel(); $queryResult = $itemModel->getByKey($itemOwner, $itemName); // Ensures that message session is for item that exist if ($queryResult == false) { $this->goToPreviousPage(); return; } $item = pg_fetch_array($queryResult); $itemImage = $item['image_url']; $itemPrice = $item['price']; // Getting the members include 'models/memberModel.php'; $memberModel = new memberModel(); // Ensures that message session is for members that exist if (!$memberModel->memberExist($itemOwner) || !$memberModel->memberExist($itemBorrower)) { $this->goToPreviousPage(); return; } // Ensures that current logged in user belongs to message session if ($currentUser != $itemOwner && $currentUser != $itemBorrower) { $this->goToPreviousPage(); return; } // Ensures that user is not sending message to self if ($itemOwner == $itemBorrower) { $this->goToPreviousPage(); return; } // Getting the loan request include 'models/loanRequestModel.php'; $loanRequestModel = new loanRequestModel(); $bidMade = $loanRequestModel->getLoanRequestByOwnerItemBorrower($itemOwner, $itemName, $itemBorrower); if ($bidMade != false) { $bid = pg_fetch_array($bidMade); $date_start = $bid['date_start']; $bidStatus = $bid['status']; $bidPrice = $bid['price_offer']; $isValidBid = $bid['is_valid']; } // Checks if is an accept or reject if (isset($_POST['accept'])) { $loanRequestModel->acceptLoanRequest($itemName, $itemOwner, $itemBorrower, $date_start); $bidStatus = 'accepted'; } if (isset($_POST['reject'])) { $loanRequestModel->rejectLoanRequest($itemName, $itemOwner, $itemBorrower, $date_start); $bidStatus = 'declined'; } // get all past messages include 'models/messageModel.php'; $messageModel = new messageModel(); // Check for new message sent if (isset($_POST['msg-content'])) { $content = $_POST['msg-content']; $sender = $itemBorrower; $receiver = $itemOwner; if ($currentUser == $itemOwner) { $sender = $itemOwner; $receiver = $itemBorrower; } $messageModel->addMessage($itemName, $itemOwner, $sender, $receiver, $content); } $chatHistory = $messageModel->getChatHistoryInOrder($itemName, $itemOwner, $itemBorrower); // get user profile images $ownerProfile = $memberModel->getUserByUsername($itemOwner); $ownerIcon = pg_fetch_row($ownerProfile)[5]; $borrowerProfile = $memberModel->getUserByUsername($itemBorrower); $borrowerIcon = pg_fetch_row($borrowerProfile)[5]; // put all messages into an array $messageArray = array(); while ($row = pg_fetch_row($chatHistory)) { $msgSender = $row[2]; if ($msgSender == $itemOwner) { $msgSenderIcon = $ownerIcon; } else { $msgSenderIcon = $borrowerIcon; } $msgContent = $row[4]; $msgTimestamp = $row[5]; $message = array($msgSender, $msgSenderIcon, $msgContent, $msgTimestamp); array_push($messageArray, $message); } include 'views/message.php'; }
function messageActionAction() { $request = $this->getRequest(); if ('POST' == $request->getMethod()) { $action = $this->post()->get("action"); $id = $this->post()->get("id"); } $action = 1; $id = 1; $messageModel = new messageModel(); $result = $messageModel->frontMessageAction($action, $id); if ($result) { $this->displayJsonUdo(Common_Error::ERROR_SUCCESS); } else { $this->displayJsonUdo(Common_Error::ERROR_FAIL); } }
<?php include 'models/tableModel.php'; include 'models/memberModel.php'; include 'models/loanRequestModel.php'; include 'models/itemModel.php'; include 'models/reviewModel.php'; include 'models/messageModel.php'; $loanRequestModel = new loanRequestModel(); $tableModel = new tableModel(); $memberModel = new memberModel(); $itemModel = new itemModel(); $reviewModel = new reviewModel(); $messageModel = new messageModel(); ?> <div class="wrapper"> <div class="col-md-10"> <h1>Statistics</h1> <div class="panel panel-info"> <div class="panel-body"> <!-- Nav tabs --> <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"><a href="#user" aria-controls="home" role="tab" data-toggle="tab">User</a></li> <li role="presentation"><a href="#items" aria-controls="profile" role="tab" data-toggle="tab">Items</a></li> <li role="presentation"><a href="#loans" aria-controls="home" role="tab" data-toggle="tab">Loans</a></li> <li role="presentation"><a href="#messages" aria-controls="home" role="tab" data-toggle="tab">Messages</a></li> <li role="presentation"><a href="#others" aria-controls="home" role="tab" data-toggle="tab">Others</a></li> </ul> <!-- Tab panes --> <div class="tab-content">
private function loadExpiredSystemMessages() { $user = new userModel(); $uid = $user->getId(); $date = new DateTime(); $date->setTime(23, 59, 59); $timestamp = $date->format('U'); $sql = "SELECT id FROM messages WHERE expireDate < '{$timestamp}' ORDER BY postDate ASC"; $query = $this->db->query($sql); $data = array(); while ($result = $query->fetch_assoc()) { $message = new messageModel(); $data[] = $message->load($result['id']); } return $data; }
commitQuery(); //提交事务 echo formatetime() . "---sleeping... 3 mins at code line--" . __LINE__ . "\n"; //提示正在睡眠中 sleep(10); //睡眠3分钟 continue; //跳出当前循环 } else { $retype = 1; } } //print_r($row);exit; $remsg_obj = new replyMessageQueueModel(); //队列处理对象 $msg_obj = new messageModel(); //message处理对象 $rm_obj = new ReplyMessageModel(); //处理发送的model $infor = unserialize($row['parameter']); // 反序列化其他扩展信息 /*----- 根据账号来加载账号信息 -----*/ $ebayaccount = $row['account']; //所属账号 $token_file = WEB_PATH . "lib/ebaylibrary/keys/keys_" . $ebayaccount . ".php"; if (!file_exists($token_file)) { echo formatetime() . '---' . $token_file . " does not exists!!! at code line--" . __LINE__ . "\n"; // 密码文件不存在 $remsgque_obj->delAQueueRecords($row['id']); //数据不对直接删除 $msg_obj->updateMessageStatus(array($row['messageid']), 0);
// $msg->setFrom(array('*****@*****.**'=>'Meet Better Me')); // //将邮件发给谁 // $msg->setTo($email); // //设置邮件主题 // $msg->setSubject('网站有人留言啦!'); // $str = $message; // $msg->setBody("留言内容为——{$str}",'text/html','utf-8'); // try{ // $mailer->send($msg); // }catch(Swift_ConnectionException $e){ // echo $e.getMessage(); // } $result = true; } } echo json_encode($result); break; case 'readMes': $messageModel = new messageModel(); $res = $messageModel->getUnReadMsg(); $len = count($res); for ($i = 0; $i < $len; $i++) { $res[$i]['time'] = date("Y-m-d H:i:s", $res[$i]['time']); } $result = $messageModel->setMsgStatus(); echo json_encode($res); break; default: # code... break; }
public function view_markLocalStatus_alisite() { $ids = isset($_GET['msgids']) ? trim($_GET['msgids']) : ''; $status = isset($_GET['status']) ? intval($_GET['status']) : 0; if (empty($ids)) { //没有传入id值 $msgdata = array('errCode' => 10020, 'errMsg' => '请指定message!'); echo json_encode($msgdata); exit; } if ($status == 0) { $msgdata = array('errCode' => 10021, 'errMsg' => '请指定状态!'); echo json_encode($msgdata); exit; } if ($status == 1) { //标记为已经回复 $status = 2; } else { if ($status == 2) { //标记为未回复 $status = 0; } else { $msgdata = array('errCode' => 10024, 'errMsg' => '请指定正确的状态!'); echo json_encode($msgdata); exit; } } $ids = clearData($ids); $msg_obj = new messageModel(); $result = $msg_obj->updateMessageStatus_alisite($ids, $status, $_SESSION['globaluserid'], time()); //$result = $msg_obj->updateMessageStatus($ids, $status);//debug if ($result) { $msgdata = array('errCode' => 10023, 'errMsg' => '操作成功! '); echo json_encode($msgdata); exit; } else { $msgdata = array('errCode' => 10022, 'errMsg' => '操作失败!'); echo json_encode($msgdata); exit; } }