newmsg.php
来自「通达OA2007SE源代码 非常好的」· PHP 代码 · 共 598 行 · 第 1/2 页
PHP
598 行
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 ())
{
exit ((((((((''.'<script>location = \'error.php?err=1&sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\'</script>'));
}
if (!$UM->mail_auth ())
{
exit ((((((((''.'<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))
{
exit ((('<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'];
$name = $ARFrom[0]['name'];
$thismail = $ARFrom[0]['mail'];
$fromreply = (((((''.'"').$name).'" <').$thismail).'>');
$ARTo = $email['to'];
for ($i = 0; ($i < count ($ARTo)); ++$i)
{
$name = $ARTo[$i]['name'];
$thismail = $ARTo[$i]['mail'];
if (isset ($toreply))
{
($toreply .= (((((''.', "').$name).'" <').$thismail).'>'));
continue;
}
else
{
$toreply = (((((''.'"').$name).'" <').$thismail).'>');
continue;
}
}
$ARCC = $email['cc'];
for ($i = 0; ($i < count ($ARCC)); ++$i)
{
$name = $ARCC[$i]['name'];
$thismail = $ARCC[$i]['mail'];
if (isset ($ccreply))
{
($ccreply .= (((((''.', "').$name).'" <').$thismail).'>'));
continue;
}
else
{
$ccreply = (((((''.'"').$name).'" <').$thismail).'>');
continue;
}
}
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'] != '') AND (strpos ($result, $thismail['mail']) === false)))
{
if (($result != ''))
{
($result .= (', '.$thisline));
continue;
}
else
{
$result = $thisline;
continue;
}
continue;
}
}
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 ('
', ((''.'
').$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 ((0 < count ($email['attachments'])))
{
$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;
}
break;
}
}
if (($add_sig AND !empty ($signature)))
{
if ($show_advanced)
{
$body = ((((''.'<br><br>--<br>').$signature).'<br><br>').$body);
}
else
{
$body = ((((''.'
--
').$signature).'
').$body);
}
}
}
else
{
if ((($add_sig AND !empty ($signature)) AND empty ($body)))
{
if ($show_advanced)
{
$body = ((((''.'<br><br>--<br>').$signature).'<br><br>').$body);
}
else
{
$body = ((((''.'
--
').$signature).'
').$body);
}
}
}
$haveSig = (empty ($signature) ? 0 : 1);
$smarty->assign ('umHaveSignature', $haveSig);
$strto = ((isset ($nameto) AND eregi ((''.'([-a-z0-9_$+.]+@[-a-z0-9_.]+[-a-z0-9_])'), $mailto)) ? (((('<input class=textbox style="width : 400px;" type=text size=50 name=to value=""'.htmlspecialchars (stripslashes ($nameto))).'" <').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']) AND (count ($sess['attachments']) != 0)) ? 1 : 0);
$smarty->assign ('umHaveAttachs', $haveAttachs);
if ((is_array ($attachs = $sess['attachments']) AND (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');
}
echo '
';
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?