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

📄 messages.php

📁 groupoffice
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/*   Copyright Intermesh 2003   Author: Merijn Schering <mschering@intermesh.nl>   Version: 1.0 Release date: 08 July 2003   This program is free software; you can redistribute it and/or modify it   under the terms of the GNU General Public License as published by the   Free Software Foundation; either version 2 of the License, or (at your   option) any later version. */ require('../../Group-Office.php');$GO_SECURITY->authenticate();$GO_MODULES->authenticate('email');require_once ($GO_CONFIG->class_path."mail/imap.class.inc");require_once ($GO_MODULES->class_path."email.class.inc");require_once ($GO_LANGUAGE->get_language_file('email'));$mail = new imap();$email = new email();$overlib  = new overlib();$account_id = isset ($_REQUEST['account_id']) ? $_REQUEST['account_id'] : 0;$task = isset ($_REQUEST['task']) ? $_REQUEST['task'] : '';$uid = isset ($_REQUEST['uid']) ? $_REQUEST['uid'] : 0;$mailbox = isset ($_REQUEST['mailbox']) ? smart_stripslashes($_REQUEST['mailbox']) : 'INBOX';$link_back = $GO_MODULES->url.'messages.php?account_id='.$account_id.'&mailbox='.urlencode($mailbox);$refresh_treeview = false;$first_uid = false;$em_settings = $email->get_settings($GO_SECURITY->user_id);//search query parameters$from = isset ($_REQUEST['from']) ? smart_stripslashes(trim($_REQUEST['from'])) : '';$to = isset ($_REQUEST['to']) ? smart_stripslashes(trim($_REQUEST['to'])) : '';$subject = isset ($_REQUEST['subject']) ? smart_stripslashes(trim($_REQUEST['subject'])) : '';$cc = isset ($_REQUEST['cc']) ? smart_stripslashes(trim($_REQUEST['cc'])) : '';$body = isset ($_REQUEST['body']) ? smart_stripslashes(trim($_REQUEST['body'])) : '';$before = isset ($_REQUEST['before']) ? smart_stripslashes(trim($_REQUEST['before'])) : '';$since = isset ($_REQUEST['since']) ? smart_stripslashes(trim($_REQUEST['since'])) : '';$before = isset ($_REQUEST['before']) ? $_REQUEST['before'] : '';$since = isset ($_REQUEST['since']) ? $_REQUEST['since'] : '';$flagged = isset ($_REQUEST['flagged']) ? $_REQUEST['flagged'] : '';$answered = isset ($_REQUEST['answered']) ? $_REQUEST['answered'] : '';$seen = isset($_REQUEST['seen']) ? $_REQUEST['seen'] : '';		$datatable = new datatable('messages_table');if ($task == 'set_search_query' || !isset ($_SESSION['email_search_query'])) {	$_SESSION['email_search_query'] = $mail->build_search_query($subject, $from, $to, $cc, $body, $before, $since, $before, $since, $flagged, $answered, $seen);	$datatable->start=0;}if (!$account = $email->get_account($account_id)) {	$account = $email->get_account(0);}if ($account) {	if (!$mail->open($account['host'], $account['type'], $account['port'], $account['username'], $account['password'], $mailbox, 0, $account['use_ssl'], $account['novalidate_cert'])) {		$GO_HEADER['body_arguments'] = 'onload="parent.treeview.location.href=\'treeview.php\';"';		require($GO_THEME->theme_path.'header.inc');		echo '<p class="Error">'.$ml_connect_failed.' \''.$account['host'].'\' '.$ml_at_port.': '.$account['port'].'</p>';		echo '<p class="Error">'.imap_last_error().'</p>';		require_once ($GO_THEME->theme_path.'footer.inc');		exit ();	}} //check for the addressbook moduleif (isset($GO_MODULES->modules['addressbook']) && $GO_MODULES->modules['addressbook']['read_permission']){	require_once($GO_MODULES->modules['addressbook']['class_path'].'addressbook.class.inc');	$ab = new addressbook();}if(isset($_POST['form_action']) && $_POST['form_action'] == 'empty_folder'){	$mail->sort();	$mail->delete($mail->sort);	$refresh_treeview = true;}/*   show from address in normal mail folders and show to in sent items folders */$show = "from";$get_to_addresses = ($mailbox=='INBOX');if ($mail->is_imap() && $account['sent'] != ''){	if (strpos($mailbox, $account['sent']) === 0)	{		$show = "to";	}}if(isset($_GET['mailbox'])){	$datatable->start=0;}$th = new table_heading();$datatable->add_column($th);if ($show == "from"){	$datatable->add_column(new table_heading($ml_from, SORTFROM));}else{	$datatable->add_column(new table_heading($ml_to, SORTTO));}$th = new table_heading();$datatable->add_column($th);$datatable->add_column(new table_heading($ml_subject, SORTSUBJECT));//$datatable->add_column(new table_heading($ml_size, SORTSIZE));$datatable->add_column(new table_heading($strDate, SORTARRIVAL));//when this is post request delete selected messagesif ($_SERVER['REQUEST_METHOD'] == "POST" && count($datatable->selected)){	switch ($_POST['form_action'])	{			case 'delete':			if ($mailbox == $account['trash'] || $account['type'] == 'pop3' || $account['trash'] == '')			{							$mail->delete($datatable->selected);								}else			{				$mail->set_message_flag($mailbox, $datatable->selected, "\\Seen");				$mail->move($account['trash'], $datatable->selected);								if($em_folder = $email->get_folder($account['id'], addslashes($account['trash'])))				{					$status = $mail->status($em_folder['name'], SA_ALL);					$em_folder['unseen'] = $status->unseen;					$em_folder['msgcount'] = $status->messages;					$email->__update_folder($em_folder);					$refresh_treeview = true;				}			}			if($account['type'] == 'pop3')	$mail->reopen($mailbox);			break;		case 'move':			$mail->move(smart_stripslashes($_POST['folder']), $datatable->selected);			if($account['type'] == 'pop3')	$mail->reopen($mailbox);						if($em_folder = $email->get_folder($account['id'], smart_addslashes($_POST['folder'])))			{				$status = $mail->status($em_folder['name'], SA_ALL);				$em_folder['unseen'] = $status->unseen;				$em_folder['msgcount'] = $status->messages;				$email->__update_folder($em_folder);				$refresh_treeview = true;			}			break;		case 'set_flag':			switch($_POST['flag'])			{				case 'read':					$mail->set_message_flag($mailbox, $datatable->selected, "\\Seen");					$refresh_treeview = true;					break;				case 'unread':					$mail->set_message_flag($mailbox, $datatable->selected, "\\Seen", "reset");					$refresh_treeview = true;					break;				case 'flag':					$mail->set_message_flag($mailbox, $datatable->selected, "\\Flagged");					break;				case 'clear_flag':					$mail->set_message_flag($mailbox, $datatable->selected, "\\Flagged", "reset");					break;			}			break;	}	}if($mailbox == $account['sent']){	$email_search_query = str_replace('FROM', 'TO', $_SESSION['email_search_query']);}else{	$email_search_query = $_SESSION['email_search_query'];}$sort_field = ($datatable->sort_index == SORTARRIVAL && !$mail->is_imap()) ? SORTDATE : $datatable->sort_index;$sort_order = $datatable->sort_ascending ? 0 : 1;$msg_count = $mail->sort($sort_field , $sort_order, $email_search_query);if ($msg_count > 0){	if (strtolower($mailbox) == "inbox")	{		$email_filter = array();		$subject_filter = array();				$filters = array();				if(!empty($account['spamtag']) && !empty($account['spam']))		{			$filter['field'] = 'subject';			$filter['folder'] = $account['spam'];			$filter['keyword'] = $account['spamtag'];			$filter['mark_as_read'] = false;			$filters[] = $filter;		}		//if there are new messages get the filters		$email->get_filters($account['id']);		while ($email->next_record())		{			$filter["field"] = $email->f("field");			$filter["folder"] = $email->f("folder");			$filter["keyword"] = $email->f("keyword");			$filter['mark_as_read'] = ($email->f('mark_as_read') == '1');			$filters[] = $filter;		}	}	$mail->get_messages($datatable->start, $datatable->offset);	$row_count = 0;	while($mail->next_message($get_to_addresses))	{				$row = new table_row($mail->f('uid'));			if($em_settings['show_preview'] == '1')		{			$row->set_attribute('onclick', 'javascript:open_message(event, '.$mail->f('uid').', this);table_select(event, \''.					$datatable->form_name.'\',\''.					$datatable->attributes['id'].'\',\''.					addslashes($row->attributes['id']).'\','.					($datatable->multiselect ? 'true' : 'false').','.					$_SESSION['GO_SESSION']['use_checkbox_select'].');');		}				if($account['drafts'] != '' && $mailbox == $account['drafts'])		{			$row->set_attribute('ondblclick', "javascript:popup('send.php?mail_from=".				$account['id']."&uid=".$mail->f('uid')."&mailbox=".urlencode($mailbox).				"&action=open','".$GO_CONFIG->composer_width."','".				$GO_CONFIG->composer_height."');"); 				}else		{			if($em_settings['show_preview'] == '0')			{				$row->set_attribute('ondblclick', 'javascript:table_clear_old_class('.$mail->f('uid').');open_message(event, '.$mail->f('uid').', this);table_select(event, \''.					$datatable->form_name.'\',\''.					$datatable->attributes['id'].'\',\''.					addslashes($row->attributes['id']).'\','.					($datatable->multiselect ? 'true' : 'false').','.					$_SESSION['GO_SESSION']['use_checkbox_select'].');parent.toggle_navigation(false);');			}else			{				$row->set_attribute('ondblclick', 'javascript:parent.toggle_navigation(false);');			}		}						$row_count++;		$continue = false;		//check if message is new and apply users filters to new messages only in the inbox folder.		if ($mail->f('new') == 1)		{			if (strtolower($mailbox) == "inbox")			{					for ($i=0;$i<sizeof($filters);$i++)				{					if ($filters[$i]["folder"])					{						$field = $mail->f($filters[$i]["field"]);						if (!is_array($field))						{							if (stristr($field, $filters[$i]["keyword"]) !== false)							{																$messages[] = $mail->f("uid");								if($filter['mark_as_read'])								{									$mail->set_message_flag($mailbox, $messages, "\\Seen");								}								if ($mail->move($filters[$i]["folder"], $messages))								{									$continue = true;									$refresh = true;									break;								}							}						}else						{							for ($x=0;$x<sizeof($field);$x++)							{								if (stristr($field[$x], $filters[$i]["keyword"]))								{									$messages[] = $mail->f("uid");									if($filter['mark_as_read'])									{										$mail->set_message_flag($mailbox, $messages, "\\Seen");									}									if ($mail->move($filters[$i]["folder"], $messages))									{										$continue = true;										$refresh = true;										break;									}								}							}						}					}				}			}			if ($continue)			{				continue;			}			$row->set_attribute('class','NewMail');				$img = new image('mail');		}else	if ($mail->f('answered'))		{			$img = new image('mail_repl');		}else		{			$img = new image('mail');		}		$img->set_attribute('style', 'border:0px;width:16px;height:16px;margin-right:3px;');		$img->set_attribute('valign', 'middle');		//display message		$subject = $mail->f('subject') ? $mail->f('subject') : $ml_no_subject;		$short_subject = cut_string($subject, 45);		if ($show == "from")

⌨️ 快捷键说明

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