⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newmsg.php

📁 极限网络智能办公系统 Office Automation V3.0官方100%源代码.
💻 PHP
📖 第 1 页 / 共 2 页
字号:

	function check_mail(strmail) {
		if(strmail == '') return;
		chartosplit = ',;';
		protectchar = '\"';
		temp = '';
		armail = new Array();
		inthechar = false;
		lt = '<';
		gt = '>';
		isclosed = true;

		for(i=0;i<strmail.length;i++) {
			thischar = strmail.charAt(i);
			if(thischar == lt && isclosed) isclosed = false;
			if(thischar == gt && !isclosed) isclosed = true;
			if(thischar == protectchar) inthechar = (inthechar)?0:1;
			if(chartosplit.indexOf(thischar) != -1 && !inthechar && isclosed) {
				armail[armail.length] = temp; temp = '';
			} else temp += thischar;
		}

		armail[armail.length] = temp;

		for(i=0;i<armail.length;i++) {
			thismail = armail[i]; strPat = /(.*)<(.*)>/;
			matchArray = thismail.match(strPat);
			if (matchArray != null) strEmail = matchArray[2];
			else {
				strPat = /([-a-zA-Z0-9_$+.]+@[-a-zA-Z0-9_.]+[-a-zA-Z0-9_]+)((.*))/; matchArray = thismail.match(strPat);
				if (matchArray != null) strEmail = matchArray[1];
				else strEmail = thismail;
			}
			if(strEmail.charAt(0) == '\"' && strEmail.charAt(strEmail.length-1) == '\"') strEmail = strEmail.substring(1,strEmail.length-1)
			if(strEmail.charAt(0) == '<' && strEmail.charAt(strEmail.length-1) == '>') strEmail = strEmail.substring(1,strEmail.length-1)

			strPat = /([-a-zA-Z0-9_$+.]+@[-a-zA-Z0-9_.]+[-a-zA-Z0-9_]+)((.*))/;
			matchArray = strEmail.match(strPat);
			if(matchArray == null)
				error_msg[error_msg.length] = strEmail;
		}
	}


	</script>
	";

	$smarty->assign("umPriority",$priority_level);
	$smarty->assign("umAddSignature",$umAddSig);
	$smarty->assign("umForms",$forms);
	$smarty->assign("umJS",$jssource);

	$body = stripslashes($body);


	if(isset($rtype)) {
		$mail_info = $sess["headers"][base64_encode(strtolower($folder))][$ix];

		if(!eregi("\\ANSWERED",$mail_info["flags"])) {

			if(!$UM->mail_connect()) { die("<script>location = 'error.php?err=1&sid=$sid&tid=$tid&lid=$lid'</script>"); }
			if(!$UM->mail_auth()) { die("<script>location = 'badlogin.php?sid=$sid&tid=$tid&lid=$lid'</script>"); }
			if($UM->mail_set_flag($mail_info,"\\ANSWERED","+")) {
				$sess["headers"][base64_encode(strtolower($folder))][$ix] = $mail_info;
				$SS->Save($sess);
			}
			$UM->mail_disconnect();

		}


		$filename = $mail_info["localname"];

		if(!file_exists($filename)) die("<script>location = 'msglist.php?err=2&folder=".urlencode($folder)."&pag=$pag&sid=$sid&tid=$tid&lid=$lid&refr=true';</script>");
		$result = $UM->_read_file($filename);

		$email = $UM->Decode($result);
		$result = $UM->fetch_structure($result);

		$tmpbody = $email["body"];
		$subject = $mail_info["subject"];

		$ARFrom = $email["from"];
		$useremail = $sess["email"];

		// from
		$name = $ARFrom[0]["name"];
		$thismail = $ARFrom[0]["mail"];
		$fromreply = "\"$name\" <$thismail>";

		// To
		$ARTo = $email["to"];

		for($i=0;$i<count($ARTo);$i++) {
			$name = $ARTo[$i]["name"]; $thismail = $ARTo[$i]["mail"];
			if(isset($toreply)) $toreply .= ", \"$name\" <$thismail>";
			else $toreply = "\"$name\" <$thismail>";
		}

		// CC
		$ARCC = $email["cc"];
		for($i=0;$i<count($ARCC);$i++) {
			$name = $ARCC[$i]["name"]; $thismail = $ARCC[$i]["mail"];
			if(isset($ccreply)) $ccreply .= ", \"$name\" <$thismail>";
			else $ccreply = "\"$name\" <$thismail>";
		}

		function clear_names($strMail) {
			global $UM;
			$strMail = $UM->get_names($strMail);
			for($i=0;$i<count($strMail);$i++) {
				$thismail = $strMail[$i];
				$thisline = ($thismail["mail"] != $thismail["name"])?"\"".$thismail["name"]."\""." <".$thismail["mail"].">":$thismail["mail"];
				if($thismail["mail"] != "" && strpos($result,$thismail["mail"]) === false) {
					if($result != "") $result .= ", ".$thisline;
					else $result = $thisline;
				}
			}
			return $result;
		}


		$allreply = clear_names($fromreply.", ".$toreply);
		$ccreply = clear_names($ccreply);
		$fromreply = clear_names($fromreply);

		$msgsubject = $email["subject"];

		$fromreply_quote 	= $fromreply;
		$toreply_quote		= $toreply;
		$ccreply_quote		= $ccreply;
		$msgsubject_quote	= $msgsubject;

		if($show_advanced) {
			$fromreply_quote 	= htmlspecialchars($fromreply_quote);
			$toreply_quote		= htmlspecialchars($toreply_quote);
			$ccreply_quote		= htmlspecialchars($ccreply_quote);
			$msgsubject_quote	= htmlspecialchars($msgsubject_quote);
			$linebreak			= "<br>";

		} else {
			$tmpbody			= strip_tags($tmpbody);
			$quote_string = "> ";
			$tmpbody = $quote_string.ereg_replace("\n","\n$quote_string",$tmpbody);
		}

$body = "
$reply_delimiter$linebreak
$reply_from_hea ".ereg_replace("(\")","",$fromreply_quote)."$linebreak
$reply_to_hea ".ereg_replace("(\")","",$toreply_quote);

if(!empty($ccreply)) {
	$body .= "$linebreak
$reply_cc_hea ".ereg_replace("(\")","",$ccreply_quote);
}


$body .= "$linebreak
$reply_subject_hea ".$msgsubject_quote."$linebreak
$reply_date_hea ".@strftime($date_format,$email["date"])."$linebreak
$linebreak
$tmpbody";


		if($show_advanced) {
			$body = "
<br>
<BLOCKQUOTE dir=ltr style=\"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px\">
  <DIV style=\"FONT: 10pt arial\">
  $body
  </DIV>
</BLOCKQUOTE>
";
		}

		switch($rtype) {
		case "reply":
			if(!eregi("^$reply_prefix",trim($subject))) $subject = "$reply_prefix $subject";
			$to = $fromreply;
			break;
		case "replyall":
			if(!eregi("^$reply_prefix",trim($subject))) $subject = "$reply_prefix $subject";
			$to = $allreply;
			$cc = $ccreply;
			break;
		case "forward":
			if(!eregi("^$forward_prefix",trim($subject))) $subject = "$forward_prefix $subject";

			if(count($email["attachments"]) > 0) {
				$bound = $email["attachments"][0]["boundary"];
				if($bound != "") {
					$parts = $UM->split_parts($bound,$result["body"]);
				} else {
					$parts[0] = $result["body"];
				}

				for($i = 0; $i < count($email["attachments"]); $i++) {

					$current = $email["attachments"][$i];

					$currentstruc = $UM->fetch_structure($parts[$current["part"]]);

					$tmpfilename 	= $userfolder."_attachments/".uniqid("").".tmp";
					$contenttype 	= ($current["content-type"] != "")?$current["content-type"]:"application/octet-stream";
					$filename		= ($current["name"] != "")?$current["name"]:basename($tmpfilename);

					$UM->save_attach($currentstruc["header"],$currentstruc["body"],$tmpfilename);

					$ind = count($sess["attachments"]);
					$sess["attachments"][$ind]["localname"] = $tmpfilename;
					$sess["attachments"][$ind]["name"] = $filename;
					$sess["attachments"][$ind]["type"] = $contenttype;
					$sess["attachments"][$ind]["size"] = filesize($tmpfilename);
				}

				$SS->Save($sess);
			}
			break;
		}


		if($add_sig && !empty($signature))
			if($show_advanced) $body = "<br><br>--<br>$signature<br><br>$body";
			else $body = "\r\n\r\n--\r\n$signature\r\n\r\n$body";
	} else

		if($add_sig && !empty($signature) && empty($body))
			if($show_advanced) $body = "<br><br>--<br>$signature<br><br>$body";
			else $body = "\r\n\r\n--\r\n$signature\r\n\r\n$body";

	$haveSig = empty($signature)?0:1;
	$smarty->assign("umHaveSignature",$haveSig);

	$strto = (isset($nameto) && eregi("([-a-z0-9_$+.]+@[-a-z0-9_.]+[-a-z0-9_])",$mailto))?
	"<input class=textbox style=\"width : 400px;\" type=text size=50 name=to value=\"&quot;".htmlspecialchars(stripslashes($nameto))."&quot; <".htmlspecialchars(stripslashes($mailto)).">\">
	":"<input class=textbox style=\"width : 400px;\" type=text size=50 name=to value=\"".htmlspecialchars(stripslashes($to))."\">";

	$strcc = "<input class=textbox style=\"width : 400px;\" type=text size=50 name=cc value=\"".htmlspecialchars(stripslashes($cc))."\">";
	$strbcc = "<input class=textbox style=\"width : 400px;\" type=text size=50 name=bcc value=\"".htmlspecialchars(stripslashes($bcc))."\">";
	$strsubject = "<input class=textbox style=\"width : 400px;\" type=text size=50 name=subject value=\"".htmlspecialchars(stripslashes($subject))."\">";

	$haveAttachs = (is_array($attachs = $sess["attachments"]) && count($sess["attachments"]) != 0)?1:0;
	$smarty->assign("umHaveAttachs",$haveAttachs);

	if(is_array($attachs = $sess["attachments"]) && count($sess["attachments"]) != 0) {

		$attachlist = Array();
		for($i=0;$i<count($attachs);$i++) {
			$index = count($attachlist);

			$attachlist[$index]["name"] = $attachs[$i]["name"];
			$attachlist[$index]["size"] = ceil($attachs[$i]["size"]/1024);
			$attachlist[$index]["type"] = $attachs[$i]["type"];
			$attachlist[$index]["link"] = "javascript:upwin($i)";
		}
		$smarty->assign("umAttachList",$attachlist);
	}

	if(!$show_advanced) $body = stripslashes($body);

	$umAdvEdit = ($show_advanced)?1:0;

	$smarty->assign("umBody",$body);
	$smarty->assign("umTo",$strto);
	$smarty->assign("umCc",$strcc);
	$smarty->assign("umBcc",$strbcc);
	$smarty->assign("umSubject",$strsubject);
	$smarty->assign("umTextEditor",$txtarea);
	$smarty->assign("umAdvancedEditor",$umAdvEdit);

	$smarty->display("neotech.net/newmsg.htm");

}

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -