newmsg.php

来自「通达OA2007SE源代码 非常好的」· PHP 代码 · 共 598 行 · 第 1/2 页

PHP
598
字号
<?
  require './inc/inc.php';
  echo $nocache;
  if (($tipo == 'send'))
  {
    require './inc/class.smtp.php';
    $ARTo = $UM->get_names (stripslashes ($to));
    $ARCc = $UM->get_names (stripslashes ($cc));
    $ARBcc = $UM->get_names (stripslashes ($bcc));
    if ((0 < ((count ($ARTo) + count ($ARCc)) + count ($ARBcc))))
    {
      $mail = new phpmailer ();
      if ($use_password_for_smtp)
      {
        $mail->UseAuthLogin ($sess['user'], $sess['pass']);
      }
      if (($is_html == 'true'))
      {
        $mail->IsHTML (1);
        if (($footer != ''))
        {
          $footer = ereg_replace ('
', '', $footer);
          $footer = ereg_replace ('
', '<br>
', $footer);
          ($body .= $footer);
        }
      }
      else
      {
        if (($footer != ''))
        {
          ($body .= $footer);
        }
      }
      $mail->CharSet = $default_char_set;
      $mail->IPAddress = getenv ('REMOTE_ADDR');
      $mail->timezone = $server_time_zone;
      $mail->From = $sess['email'];
      $mail->FromName = $UM->mime_encode_headers ($prefs['real-name']);
      $mail->AddReplyTo ($prefs['reply-to'], $UM->mime_encode_headers ($prefs['real-name']));
      $mail->Host = $smtp_server;
      $mail->WordWrap = 76;
      $mail->Priority = $priority;
      if ((count ($ARTo) != 0))
      {
        for ($i = 0; ($i < count ($ARTo)); ++$i)
        {
          $name = $ARTo[$i]['name'];
          $email = $ARTo[$i]['mail'];
          if (($name != $email))
          {
            $mail->AddAddress ($email, $UM->mime_encode_headers ($name));
            continue;
          }
          else
          {
            $mail->AddAddress ($email);
            continue;
          }
        }
      }
      if ((count ($ARCc) != 0))
      {
        for ($i = 0; ($i < count ($ARCc)); ++$i)
        {
          $name = $ARCc[$i]['name'];
          $email = $ARCc[$i]['mail'];
          if (($name != $email))
          {
            $mail->AddCC ($email, $UM->mime_encode_headers ($name));
            continue;
          }
          else
          {
            $mail->AddCC ($email);
            continue;
          }
        }
      }
      if ((count ($ARBcc) != 0))
      {
        for ($i = 0; ($i < count ($ARBcc)); ++$i)
        {
          $name = $ARBcc[$i]['name'];
          $email = $ARBcc[$i]['mail'];
          if (($name != $email))
          {
            $mail->AddBCC ($email, $UM->mime_encode_headers ($name));
            continue;
          }
          else
          {
            $mail->AddBCC ($email);
            continue;
          }
        }
      }
      if (is_array ($attachs = $sess['attachments']))
      {
        for ($i = 0; ($i < count ($attachs)); ++$i)
        {
          if (file_exists ($attachs[$i]['localname']))
          {
            $mail->AddAttachment ($attachs[$i]['localname'], $attachs[$i]['name'], $attachs[$i]['type']);
            continue;
          }
        }
      }
      $mail->Subject = $UM->mime_encode_headers (stripslashes ($subject));
      $mail->Body = stripslashes ($body);
      if (($resultmail = $mail->Send () === false))
      {
        $err = $mail->ErrorAlerts[(count ($mail->ErrorAlerts) - 1)];
        $smarty->assign ('umMailSent', false);
        $smarty->assign ('umErrorMessage', $err);
      }
      else
      {
        $smarty->assign ('umMailSent', true);
        if (is_array ($attachs = $sess['attachments']))
        {
          for ($i = 0; ($i < count ($attachs)); ++$i)
          {
            if (file_exists ($attachs[$i]['localname']))
            {
              unlink ($attachs[$i]['localname']);
              continue;
            }
          }
          unset ($$sess);
          reset ($sess);
          $SS->Save ($sess);
        }
        if ($prefs['save-to-sent'])
        {
          if (!$UM->mail_connect ())
          {
            header ((((((((''.'Location: error.php?err=1&sid=').$sid).'&tid=').$tid).'&lid=').$lid).'
'));
            exit ();
          }
          if (!$UM->mail_auth (false))
          {
            header ((((((((''.'Location: badlogin.php?sid=').$sid).'&tid=').$tid).'&lid=').$lid).'
'));
            exit ();
          }
          $UM->mail_save_message ('sent', $resultmail, '\\SEEN');
          unset ($$sess['headers']);
          $UM->mail_disconnect ();
          $SS->Save ($sess);
        }
      }
    }
    else
    {
      exit ((((((((''.'<script language="javascript">location = \'error.php?err=3&sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\';</script>'));
    }
    $jssource = (((((((((((((''.'
	<script language="javascript">
	function newmsg() { location = \'newmsg.php?pag=').$pag).'&folder=').urlencode ($folder)).(((((((''.'&sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\'; }
	function folderlist() { location = \'folders.php?folder=')).urlencode ($folder)).(((((((''.'&sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\'}
	function refreshlist() { location = \'msglist.php?refr=true&folder=')).urlencode ($folder)).(((((((((((((((((((((''.'&pag=').$pag).'&sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\' }
	function goend() { location = \'logout.php?sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\'; }
	function goinbox() { location = \'msglist.php?folder=inbox&sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\'; }
	function emptytrash() {	location = \'folders.php?empty=trash&folder=')).urlencode ($folder)).(((((((''.'&goback=true&sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\';}
	function search() {	location = \'search.php?folder=')).urlencode ($folder)).(((((((((((((((((((''.'&sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\';}
	function addresses() { location = \'addressbook.php?sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\'; }
	function prefs() { location = \'preferences.php?sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\'; }
	</script>
	'));
    $smarty->assign ('umSid', $sid);
    $smarty->assign ('umLid', $lid);
    $smarty->assign ('umTid', $tid);
    $smarty->assign ('umJS', $jssource);
    $smarty->display ('neotech.net/newmsg-result.htm');
  }
  else
  {
    $priority_level = (!$priority ? 3 : $priority);
    $uagent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
    $isMac = ereg ('Mac', $uagent);
    $isOpera = ereg ('Opera', $uagent);
    $uagent = explode ('; ', $uagent);
    $uagent = explode (' ', $uagent[1]);
    $bname = strtoupper ($uagent[0]);
    $bvers = $uagent[1];
    $show_advanced = ((((((($bname == 'MSIE') AND (5 <= intval ($bvers))) AND !$textmode) AND !$isMac) AND !$isOpera) AND ($prefs['editor-mode'] != 'text')) ? 1 : 0);
    $js_advanced = ($show_advanced ? 'true' : 'false');
    $signature = $prefs['signature'];
    if ($show_advanced)
    {
      $signature = nl2br ($signature);
    }
    $add_sig = $prefs['add-sig'];
    $umAddSig = ($add_sig ? 1 : 0);
    $forms = (((((((((((''.'<input type=hidden name=tipo value=edit>
	<input type=hidden name=is_html value="').$js_advanced).'">
	<input type=hidden name=sid value="').$sid).'">
	<input type=hidden name=lid value="').$lid).'">
	<input type=hidden name=folder value="').$folder).'">
	<input type=hidden name=sig value="').htmlspecialchars ($signature)).(((''.'">
	<input type=hidden name=textmode value="').$textmode).'">
	'));
    $jssource = (((((((((((((((((((((((((((((''.'
	<script language="javascript">
	bIs_html = ').$js_advanced).';
	bsig_added = false;
	function addsig() {
		with(document.composeForm) {
			if(bsig_added || sig.value == \'\') return false;
			if(cksig.checked) {
				if(bIs_html) {
					cur = GetHtml()
					SetHtml(cur+\'<br><br>--<br>\'+sig.value);
				} else
					body.value += \'\\r\\n\\r\\n--\\r\\n\'+sig.value;
			}
			cksig.disabled = true;
			bsig_added = true;
		}
		return true;
	}
	function upwin(rem) {
		mywin = \'upload.php\';
		if (rem != null) mywin += \'?rem=\'+rem+\'&sid=').$sid).'\';
		else mywin += \'?sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\';
		window.open(mywin,\'Upload\',\'width=300,height=50,left=200,top=200,scrollbars=0,menubar=0,status=0\');
	}
	function doupload() {
		if(bIs_html) document.composeForm.body.value = GetHtml();
		document.composeForm.tipo.value = \'edit\';
		document.composeForm.submit();
	}
	function textmode() {
		with(document.composeForm) {
			if(bIs_html) body.value = GetText();
			textmode.value = 1;
			tipo.value = \'edit\';
			submit();
		}
	}
	function enviar() {
		error_msg = new Array();
		frm = document.composeForm;
		check_mail(frm.to.value);
		check_mail(frm.cc.value);
		check_mail(frm.bcc.value);
		errors = error_msg.length;
		if(frm.to.value == \'\' && frm.cc.value == \'\' && frm.bcc.value == \'\')
			alert(\'').ereg_replace ('\'', '\\\'', $error_no_recipients)).'\');
		else if (errors > 0) {
			if (errors == 1) errmsg = \'').ereg_replace ('\'', '\\\'', $error_compose_invalid_mail1_s)).'\\r\\r\';
			else  errmsg = \'').ereg_replace ('\'', '\\\'', $error_compose_invalid_mail1_p)).'\\r\\r\';
			for(i=0;i<errors;i++)
				errmsg += error_msg[i]+\'\\r\';
			if (errors == 1) errmsg += \'\\r').ereg_replace ('\'', '\\\'', $error_compose_invalid_mail2_s)).'s\';
			else  errmsg += \'\\r').ereg_replace ('\'', '\\\'', $error_compose_invalid_mail2_p)).(((''.'\';
			alert(errmsg)
		} else {
			if(bIs_html) frm.body.value = GetHtml();
			frm.tipo.value = \'send\';
			frm.submit();
		}
	}
	function newmsg() { location = \'newmsg.php?pag=').$pag).'&folder=')).urlencode ($folder)).(((((((''.'&sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\'; }
	function folderlist() { location = \'folders.php?folder=')).urlencode ($folder)).(((((((((((((((((((''.'&sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\'}
	function goend() { location = \'logout.php?sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\'; }
	function goinbox() { location = \'msglist.php?folder=inbox&sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\'; }
	function emptytrash() {	location = \'folders.php?empty=trash&folder=')).urlencode ($folder)).(((((((''.'&goback=true&sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\';}
	function search() {	location = \'search.php?folder=')).urlencode ($folder)).(((((((((((((((((((((((((((((((((((((''.'&sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\';}
	function addrpopup() {	mywin = window.open(\'quick_address.php?sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\',\'AddressBook\',\'width=480,height=220,top=200,left=200\'); }
	function addrpopup_oa() {	mywin = window.open(\'quick_address_oa.php?sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\',\'AddressBook\',\'width=480,height=220,top=200,left=200\'); }
	function addrpopup_oa_add() {	mywin = window.open(\'quick_address_oa_add.php?sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\',\'AddressBook\',\'width=480,height=220,top=200,left=200\'); }
	function addresses() { location = \'addressbook.php?sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\'; }
	function prefs() { location = \'preferences.php?sid=').$sid).'&tid=').$tid).'&lid=').$lid).'\'; }
	function AddAddress(strType,strAddress) {
		obj = eval(\'document.composeForm.\'+strType);
		if(obj.value == \'\') obj.value = strAddress
		else  obj.value = obj.value + \', \' + strAddress
	}
	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) {

⌨️ 快捷键说明

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