示例#1
0
                if ($from_staff) {
                    inbox::convert_email_to_new_task($email_receive, true);
                } else {
                    $email_receive->mark_seen();
                    // mark it seen so we don't poll for it again
                    alloc_error("Could not create a task from this email. Email was not sent by a staff member. Email resides in INBOX.");
                }
                // Else if we have a key, append to comment
            } else {
                // Skip over emails that are from alloc. These emails are kept only for
                // posterity and should not be parsed and downloaded and re-emailed etc.
                if (same_email_address($email_receive->mail_headers["from"], ALLOC_DEFAULT_FROM_ADDRESS)) {
                    $email_receive->mark_seen();
                    $email_receive->archive();
                } else {
                    inbox::process_one_email($email_receive);
                }
            }
        } catch (Exception $e) {
            // There may have been a database error, so let the database know it can run this next bit
            db_alloc::$stop_doing_queries = false;
            // Try forwarding the errant email
            try {
                $email_receive->forward(config::get_config_item("allocEmailAdmin"), "Email command failed", "\n" . $e->getMessage() . "\n\n" . $e->getTraceAsString());
                // If that fails, try last-ditch email send
            } catch (Exception $e) {
                mail(config::get_config_item("allocEmailAdmin"), "Email command failed(2)", "\n" . $e->getMessage() . "\n\n" . $e->getTraceAsString());
            }
        }
    }
}
示例#2
0
文件: inbox.php 项目: cjbayliss/alloc
singleton("errors_thrown", true);
if (!have_entity_perm("inbox", PERM_READ, $current_user)) {
    alloc_error("Permission denied.", true);
}
$info = inbox::get_mail_info();
if (!$info["host"]) {
    alloc_error("Email mailbox host not defined, assuming email function is inactive.", true);
}
if ($_REQUEST["id"] && $_REQUEST["hash"] && !inbox::verify_hash($_REQUEST["id"], $_REQUEST["hash"])) {
    alloc_error("The IMAP ID for that email is no longer valid. Refresh the list and try again.");
} else {
    if ($_REQUEST["id"] && $_REQUEST["hash"]) {
        $_REQUEST["archive"] && inbox::archive_email($_REQUEST);
        // archive the email by moving it to another folder
        $_REQUEST["download"] && inbox::download_email($_REQUEST);
        // download it to a mbox file
        $_REQUEST["process"] && inbox::process_email($_REQUEST);
        // attach it to a task etc
        $_REQUEST["readmail"] && inbox::read_email($_REQUEST);
        // mark the email as read
        $_REQUEST["unreadmail"] && inbox::unread_email($_REQUEST);
        // mark the email as unread
        $_REQUEST["newtask"] && inbox::process_email_to_task($_REQUEST);
        // use this email to create a new task
        $_REQUEST["taskID"] && inbox::attach_email_to_existing_task($_REQUEST);
        // attach email as new comment thread onto existing task
        alloc_redirect($TPL["url_alloc_inbox"]);
    }
}
$TPL["rows"] = inbox::get_list();
include_template("templates/inboxM.tpl");
示例#3
0
<?php

session_start();
include_once 'config/db_conn.php';
include_once 'db_config/db_user.php';
include_once 'db_config/db_gigs.php';
include_once 'db_config/db_sentmail.php';
include_once 'db_config/db_inbox.php';
$sentmail = new sentmail();
$inboxmail = new inbox();
$to = trim($_REQUEST['to'], ' ');
$gig_id = $_REQUEST['gig_id'];
$user = new user();
$rs_user = $user->uniq_user_list('user_id', $_SESSION['user_id']);
$data_user = mysql_fetch_array($rs_user);
$rs_user_tomail = $user->uniq_user_list('user_name', $to);
$data_user_tomail = mysql_fetch_array($rs_user_tomail);
$gigs_obj = new gigs();
$rs_gigs = $gigs_obj->uniq_gigs_list('id', $gig_id);
$data_gigs = mysql_fetch_array($rs_gigs);
if ($_REQUEST['submit']) {
    $data_senmail = array();
    $data_senmail['gigs_id'] = $gig_id;
    $data_senmail['to_id'] = $data_user_tomail['user_id'];
    $data_senmail['from_id'] = $_SESSION['user_id'];
    $data_senmail['sub'] = $_REQUEST['subject'];
    $data_senmail['body'] = $_REQUEST['body'];
    $data_senmail['attachment'] = $_FILES['attachment']['name'];
    $data_senmail['date_time'] = date('y-m-d h:i:s');
    $sentmail->dataInsert('ninerr_sentmail', $data_senmail);
    $data_inbox['gigs_id'] = $gig_id;
示例#4
0
 function find_email($debug = false, $get_blobs = false, $ignore_date = false)
 {
     $info = inbox::get_mail_info();
     $mailbox = $this->get_value("commentMaster") . $this->get_value("commentMasterID");
     $mail = new email_receive($info);
     $mail->open_mailbox(config::get_config_item("allocEmailFolder") . "/" . $mailbox, OP_HALFOPEN + OP_READONLY);
     $mail->check_mail();
     $msg_nums = $mail->get_all_email_msg_uids();
     $debug and print "<hr><br><b>find_email(): " . date("Y-m-d H:i:s") . " found " . count($msg_nums) . " emails for mailbox: " . $mailbox . "</b>";
     // fetch and parse email
     foreach ((array) $msg_nums as $num) {
         $debug and print "<hr><br>Examining message number: " . $num;
         unset($mimebits);
         // this will stream output
         $mail->set_msg($num);
         $mail->get_msg_header();
         $text = $mail->fetch_mail_text();
         list($from1, $e1n) = parse_email_address($mail->mail_headers["from"]);
         list($from2, $e2n) = parse_email_address($this->get_value("commentCreatedUserText"));
         if (!$from2 && $this->get_value("commentCreatedUser")) {
             $p = new person();
             $p->set_id($this->get_value("commentCreatedUser"));
             $p->select();
             $from2 = $p->get_value("emailAddress");
         }
         if (!$from2 && $this->get_value("commentCreatedUserClientContactID")) {
             $p = new clientContact();
             $p->set_id($this->get_value("commentCreatedUserClientContactID"));
             $p->select();
             $from2 = $p->get_value("clientContactEmail");
         }
         $text1 = str_replace(array("\\s", "\n", "\r"), "", trim($text));
         $text2 = str_replace(array("\\s", "\n", "\r"), "", trim($this->get_value("comment")));
         $date = format_date("U", $this->get_value("commentCreatedTime"));
         $date1 = strtotime($mail->mail_headers["date"]) - 300;
         $date3 = strtotime($mail->mail_headers["date"]) + 300;
         similar_text($text1, $text2, $percent);
         if ($percent >= 99 && ($from1 == $from2 || !$from2 || same_email_address($from1, config::get_config_item("AllocFromEmailAddress"))) && ($date > $date1 && $date < $date3 || $ignore_date)) {
             $debug and print "<br><b style='color:green'>Found you! Msg no: " . $num . " in mailbox: " . $mailbox . " for commentID: " . $this->get_id() . "</b>";
             foreach ((array) $mail->mail_parts as $v) {
                 $s = $v["part_object"];
                 // structure
                 $raw_data = imap_fetchbody($mail->connection, $mail->msg_uid, $v["part_number"], FT_UID | FT_PEEK);
                 $thing = $mail->decode_part($s->encoding, $raw_data);
                 $filename = $mail->get_parameter_attribute_value($s->parameters, "name");
                 $filename or $filename = $mail->get_parameter_attribute_value($s->parameters, "filename");
                 $filename or $filename = $mail->get_parameter_attribute_value($s->dparameters, "name");
                 $filename or $filename = $mail->get_parameter_attribute_value($s->dparameters, "filename");
                 $bits = array();
                 $bits["part"] = $v["part_number"];
                 $bits["name"] = $filename;
                 $bits["size"] = strlen($thing);
                 $get_blobs and $bits["blob"] = $thing;
                 $filename and $mimebits[] = $bits;
             }
             $mail->close();
             return array($mail, $text, $mimebits);
         } else {
             similar_text($text1, $text2, $percent);
             $debug and print "<br>TEXT: " . sprintf("%d", $text1 == $text2) . " (" . sprintf("%d", $percent) . "%)";
             #$debug and print "<br>Text1:<br>".$text1."<br>* * *<br>";
             #$debug and print "Text2:<br>".$text2."<br>+ + +</br>";
             $debug and print "<br>FROM: " . sprintf("%d", $from1 == $from2 || !$from2 || same_email_address($from1, config::get_config_item("AllocFromEmailAddress")));
             $debug and print " From1: " . page::htmlentities($from1);
             $debug and print " From2: " . page::htmlentities($from2);
             $debug and print "<br>DATE: " . sprintf("%d", $date > $date1 && $date < $date3) . " (" . date("Y-m-d H:i:s", $date) . " | " . date("Y-m-d H:i:s", $date1) . " | " . date("Y-m-d H:i:s", $date3) . ")";
             $debug and print "<br>";
         }
     }
     $mail->close();
     return array(false, false, false);
 }
示例#5
0
<?php

session_start();
include_once 'config/db_conn.php';
include_once 'db_config/db_user.php';
include_once 'db_config/db_gigs.php';
include_once 'db_config/db_sentmail.php';
include_once 'db_config/db_inbox.php';
$sentmail = new sentmail();
$inboxmail = new inbox();
$to = $_REQUEST['to'];
$gig_id = $_REQUEST['gig_id'];
$user = new user();
$rs_user = $user->uniq_user_list('user_id', $_SESSION['user_id']);
$data_user = mysql_fetch_array($rs_user);
$rs_user_tomail = $user->uniq_user_list('user_name', 'sandip');
$data_user_tomail = mysql_fetch_array($rs_user_tomail);
//echo $data_user_tomail['user_primary_email'];
$gigs_obj = new gigs();
$rs_gigs = $gigs_obj->uniq_gigs_list('id', $gig_id);
$data_gigs = mysql_fetch_array($rs_gigs);
$rs_sentmail = $sentmail->uniq_sentmail_list('from_id', $_SESSION['user_id']);
$rs_inbox = $inboxmail->uniq_inbox_list('from_id', $_SESSION['user_id']);
if ($_REQUEST['submit']) {
    $data_senmail = array();
    $data_senmail['gigs_id'] = $gig_id;
    $data_senmail['to'] = $data_user_tomail['user_primary_email'];
    $data_senmail['from'] = $data_user['user_primary_email'];
    $data_senmail['sub'] = $_REQUEST['subject'];
    $data_senmail['body'] = $_REQUEST['body'];
    $data_senmail['attachment'] = $_FILES['attachment']['name'];
示例#6
0
<?php 
if ($_GET['action'] == 'denySuccus') {
    $action = $_GET['action'];
    $reserve_id = $_GET['id'];
    $item_id = $_GET['item_id'];
    $msg_id = $_GET['msg_id'];
    //$user_id=$_GET['user_id'];
    //$owner_id=$_GET['owner_id'];
    $rentitemdetail = user::mainDetailOfItem($item_id);
    $featurimage = itemClass::select_featured_image($item_id);
    $renter = $user_id;
    $msg_detail = inbox::select_msg_by_id($msg_id);
    $msg_detail = mysql_fetch_assoc($msg_detail);
    $renter_detail = user::user_profile($msg_detail['sender_id']);
    // renter profile
    $message_detail = inbox::select_notification($msg_id);
    ?>

		<div id="container">			  
			  <!--container search-->
			  <div class="containersearch">
				<div id="" class="pT10 pB10">
					<?php 
    if (isset($_SESSION['msg'])) {
        echo $_SESSION['msg'] = "18";
    }
    ?>
				</div>
			    <!--Listing Confirm-->
				 <div class="listingconfirmtop">
				   <h2 class="font22 black"> OWner can't be Accept Your Request Due to   </h2>
示例#7
0
<?php

ob_start();
session_start();
include '../include/alertHeader.php';
if (!isset($_SESSION['user'])) {
    header("location:" . $URL_SITE . "front/login.php");
}
if (isset($_GET['item_id'])) {
    $item_id = $_GET['item_id'];
    $reservationid = $_GET['id'];
    $msg_id = $_GET['msg_id'];
}
$update = user::update_message($msg_id);
$check = itemClass::checkDetail($_GET['id']);
$msg_detail_res = inbox::select_msg_by_id($_GET['msg_id']);
$msg_detail = mysql_fetch_assoc($msg_detail_res);
$renter_detail = user::user_profile($msg_detail['sender_id']);
// renter profile
//echo "<pre>";print_r($msg_detail);echo "</pre>";
$rentitemdetail = user::mainDetailOfItem($item_id);
// Details of item
$featurimage = itemClass::select_featured_image($item_id);
// select image of item
$dates = itemClass::renter_praposal_date($item_id, $renter_detail['id']);
// to check date by renter
if ($dates['newissuedate'] != '0000-00-00') {
    $start = strtotime($dates['newissuedate']);
    // if  dates were changed by owner
    $end = strtotime($dates['newienddate']);
} else {
示例#8
0
文件: home.php 项目: raju99/sparkswap
<div class="DashboarddivR">
<div class="dashwhitebg mB10">
	<div class="dasbmessages">
		<h3>Messages (<?php 
echo $nmber_of_unread;
?>
 New)</h3>
			<?php 
if ($nmber_of_msg > 0) {
    $i = 0;
    while ($mesg = mysql_fetch_assoc($res_inbox)) {
        //echo "<pre>";print_r($mesg);echo "</pre>";
        if ($i > 5) {
            break;
        }
        $on_which_reply_did_res = inbox::select_msg_by_id($mesg['replied_on_id']);
        $on_which_reply_did = mysql_fetch_assoc($on_which_reply_did_res);
        $frnd_user = user::user_profile($mesg['sender_id']);
        $checkacepteddeniedPost_res = user::checkRentStatus($mesg['reservation_id']);
        $checkRentStatusOfUSer = mysql_fetch_assoc($checkacepteddeniedPost_res);
        //echo "<pre>";print_r($checkRentStatusOfUSer);echo "</pre>";
        ?>
					<div class="dasbmessagesbdr">
						<div class="dasbmessagespicdiv">
							<?php 
        if (!empty($frnd_user['user_picture'])) {
            ?>
								<img src="<?php 
            echo $URL_SITE;
            ?>
classes/show_image.php?filename=../images/profile/<?php 
示例#9
0
 public static function get_list()
 {
     // Get list of emails
     $info = inbox::get_mail_info();
     $email_receive = new email_receive($info);
     $email_receive->open_mailbox($info["folder"], OP_HALFOPEN | OP_READONLY);
     $email_receive->check_mail();
     $new_nums = $email_receive->get_new_email_msg_uids();
     $msg_nums = $email_receive->get_all_email_msg_uids();
     if ($msg_nums) {
         foreach ($msg_nums as $num) {
             $row = array();
             $email_receive->set_msg($num);
             $email_receive->get_msg_header();
             $row["from"] = $email_receive->get_printable_from_address();
             in_array($num, (array) $new_nums) and $row["new"] = true;
             $row["id"] = $num;
             $row["date"] = $email_receive->mail_headers["date"];
             $row["subject"] = $email_receive->mail_headers["subject"];
             $rows[] = $row;
         }
     }
     $email_receive->close();
     return $rows;
 }