Location: PHPKode > projects > V-webmail > includes/email.list.buildsearchresults.php
<?php
	/**
    * Get full details for the messages
    */
	for ($i=0; $i<count($_msg_ids); $i++) {
		if (!in_array($_msg_ids[$i]['mailbox'], $_folders)) {
			$_mboxname = preg_replace('/^' . preg_quote($SESSION['email']['fold'], '/') . '/', '', $_msg_ids[$i]['mailbox']);
			$mail_list[++$j] = array('spacer'        => '<tr><td colspan="8">&nbsp;</td></tr>',
			                         'mailbox'       => $_msg_ids[$i]['mailbox'],
			                         'mailbox_title' => htmlspecialchars($_mboxname),
									 'from_header'   => $_msg_ids[$i]['mailbox'] == $USERPREFS['settings']['sent_items_folder'] ? lang('To') : lang('From'));
			$mailaccess->reconnect($_msg_ids[$i]['mailbox']);
			$_folders[] = $_msg_ids[$i]['mailbox'];
			$row = 0;
		}

		// Default for older versions
		$unread_mail = isset($USERPREFS['settings']['unread_mail']) ? $USERPREFS['settings']['unread_mail'] : 'bold';

		$mail_list[$j]['msgs'][$row]              = $mailaccess->getMsgSummary($_msg_ids[$i]['msg_id']);
		$mail_list[$j]['msgs'][$row]['bold']      = ($mail_list[$j]['msgs'][$row]['unread'] AND strpos($unread_mail, 'bold')   !== FALSE) ? 'bold' : 'normal';
		$mail_list[$j]['msgs'][$row]['style']     = ($mail_list[$j]['msgs'][$row]['unread'] AND strpos($unread_mail, 'italic') !== FALSE) ? 'italic' : 'normal';
		$mail_list[$j]['msgs'][$row]['js_msg_id'] = substr(base64_encode($_msg_ids[$i]['msg_id'] . $_msg_ids[$i]['mailbox']), 0, -2);
		$mail_list[$j]['msgs'][$row]['mbox']      = $_msg_ids[$i]['mailbox'];
		$mail_list[$j]['msgs'][$row]['mbox_url']  = urlencode($_msg_ids[$i]['mailbox']);

		// Build the link for the listing page
		if (!empty($mail_list[$j]['msgs'][$row]['draft'])) {
			$mail_list[$j]['msgs'][$row]['link'] = sprintf('email.reply.redirect.php?%s&action=opendraft&msg_id=%s&mbox=%s',
				                             VWEBMAILSESSION,
			                                 $mail_list[$j]['msgs'][$row]['msg_id'],
											 $mail_list[$j]['msgs'][$row]['mbox_url']);
		} else {
			$mail_list[$j]['msgs'][$row]['link'] = sprintf('email.view.message.php?%s&msg_id=%s&mbox=%s',
				                             VWEBMAILSESSION,
											 $mail_list[$j]['msgs'][$row]['msg_id'],
											 $mail_list[$j]['msgs'][$row]['mbox_url']);
		}

		/**
        * If we're in the sent items folder,
		* replace the email/name entries with
		* to_email and to_name.
        */
		if ('inbox' != strtolower($SESSION['email']['mbox']) AND $mail_list[$j]['mailbox'] == $USERPREFS['settings']['sent_items_folder']) {
			$mail_list[$j]['msgs'][$row]['email']         = $mail_list[$j]['msgs'][$row]['to_email'];
			$mail_list[$j]['msgs'][$row]['name']          = $mail_list[$j]['msgs'][$row]['to_name'];
			$mail_list[$j]['msgs'][$row]['email_urlsafe'] = $mail_list[$j]['msgs'][$row]['to_urlsafe'];
		}

		$row++;
	}


	/**
    * If no results, make mail_list the correct
	* format.
    */
	if (empty($mail_list)) {
		$message     = lang('No messages!');
		$from_header = 'inbox' != strtolower($SESSION['email']['mbox']) && $SESSION['email']['mbox'] == $USERPREFS['settings']['sent_items_folder'] ? lang('To') : lang('From');
		$mboxname    = preg_replace('/^' . preg_quote($SESSION['email']['fold'], '/') . '/', '', $SESSION['email']['mbox']);
		$mail_list   = array(array('select_all_gif' => true, 'mailbox_title' => htmlspecialchars($mboxname), 'spacer' => '', 'from_header' => $from_header, 'msgs' => array()));
	}

	/**
    * Remove the last spacer and set the
	* first select_all_gif entry
    */
	$mail_list[count($mail_list) - 1]['spacer'] = '';
	$mail_list[0]['select_all_gif'] = true;

	/**
    * mmf
    */
	$SESSION['email']['num_msgs'] = $num_msgs;
?>
Return current item: V-webmail