[2] | 1 | <?php |
---|
[139] | 2 | |
---|
[2] | 3 | $current_app = 'expressoMail1_2'; |
---|
| 4 | $current_name = 'ExpressoMail 1.2'; |
---|
| 5 | $homedisplay = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['mainscreen_showmail']; |
---|
[139] | 6 | $homedisplay = 'True'; |
---|
[2] | 7 | if($homedisplay=='True') |
---|
| 8 | { |
---|
| 9 | $homedisplay = 1; |
---|
| 10 | } |
---|
| 11 | $homedisplay = intval($homedisplay); |
---|
| 12 | |
---|
| 13 | $prev_currentapp = $GLOBALS['phpgw_info']['flags']['currentapp']; |
---|
| 14 | $GLOBALS['phpgw_info']['flags']['currentapp'] = $current_app; |
---|
| 15 | |
---|
| 16 | if(intval($homedisplay)) |
---|
| 17 | { |
---|
| 18 | $boemailadmin = CreateObject('emailadmin.bo'); |
---|
| 19 | $emailadmin_profile = $boemailadmin->getProfileList(); |
---|
| 20 | $_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']); |
---|
| 21 | $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user']; |
---|
| 22 | $_SESSION['phpgw_info']['expressomail']['server'] = $GLOBALS['phpgw_info']['server']; |
---|
| 23 | $expressoMail = CreateObject($current_app.'.imap_functions'); |
---|
| 24 | $mbox_stream = $expressoMail-> open_mbox(); |
---|
[139] | 25 | $messages = imap_sort($mbox_stream, SORTARRIVAL, true, SE_UID); |
---|
[2] | 26 | $num_new_messages = 0; |
---|
| 27 | $subjects = array(); |
---|
[139] | 28 | |
---|
[2] | 29 | for ($i = 0; $i < count($messages);$i++) |
---|
| 30 | { |
---|
| 31 | $msg_number = $messages[$i]; |
---|
| 32 | $header = @imap_headerinfo($mbox_stream, imap_msgno($mbox_stream, $msg_number), 80, 255); |
---|
| 33 | if (!is_object($header)) |
---|
| 34 | return false; |
---|
| 35 | |
---|
| 36 | if($header->Recent != 'N' && $header->Unseen != 'U') |
---|
| 37 | continue; |
---|
| 38 | $new_m++; |
---|
| 39 | if($new_m <= 10) { |
---|
[139] | 40 | $date_msg = date("d/m/Y",$header->udate); |
---|
| 41 | if (date("d/m/Y") == $date_msg) |
---|
| 42 | $date = date("H:i",$header->udate); |
---|
| 43 | else |
---|
| 44 | $date = $date_msg; |
---|
| 45 | $subject = $expressoMail->decode_string($header->fetchsubject); |
---|
| 46 | $text = "<div style='overflow:hidden;white-space:nowrap'>".$date." .: ".$subject."</div>"; |
---|
| 47 | if(strlen($text) > 105) |
---|
| 48 | $text = substr($text,0,105).' ...'; |
---|
[2] | 49 | |
---|
| 50 | $link_msg = $GLOBALS['phpgw']->link( |
---|
| 51 | '/'.$current_app.'/index.php', |
---|
| 52 | 'msgball[msgnum]='.$msg_number.'&msgball[folder]=INBOX'); |
---|
[139] | 53 | $data[] = array('text' => $text, 'link' => $link_msg); |
---|
| 54 | } |
---|
[2] | 55 | } |
---|
[139] | 56 | |
---|
[2] | 57 | imap_close($mbox_stream); |
---|
[139] | 58 | |
---|
| 59 | $title = $current_name." - ".($new_m > 1 ? lang("You have %1 new messages!","<font color=red>".$new_m."</font>") : ($new_m == 1 ? str_replace("1","<font color=red>1</font>",lang("you have 1 new message!")) : lang("you have no new messages"))); |
---|
[2] | 60 | $GLOBALS['phpgw']->translation->add_app($current_app); |
---|
| 61 | |
---|
| 62 | if ((isset($prev_currentapp)) && ($prev_currentapp) && ($GLOBALS['phpgw_info']['flags']['currentapp'] != $prev_currentapp)) |
---|
| 63 | $GLOBALS['phpgw_info']['flags']['currentapp'] = $prev_currentapp; |
---|
| 64 | |
---|
| 65 | $portalbox = CreateObject('phpgwapi.listbox', |
---|
| 66 | Array( |
---|
| 67 | 'title' => $title, |
---|
| 68 | 'primary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], |
---|
| 69 | 'secondary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], |
---|
| 70 | 'tertiary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], |
---|
| 71 | 'width' => '100%', |
---|
| 72 | 'outerborderwidth' => '0', |
---|
| 73 | 'header_background_image' => $GLOBALS['phpgw']->common->image('phpgwapi/templates/phpgw_website','bg_filler') |
---|
| 74 | ) |
---|
| 75 | ); |
---|
| 76 | |
---|
| 77 | $app_id = $GLOBALS['phpgw']->applications->name2id('expressoMail'); |
---|
| 78 | $GLOBALS['portal_order'][] = $app_id; |
---|
| 79 | |
---|
| 80 | $var = Array( |
---|
| 81 | 'up' => Array('url' => '/set_box.php', 'app' => $app_id), |
---|
| 82 | 'down' => Array('url' => '/set_box.php', 'app' => $app_id), |
---|
| 83 | 'close' => Array('url' => '/set_box.php', 'app' => $app_id), |
---|
| 84 | 'question' => Array('url' => '/set_box.php', 'app' => $app_id), |
---|
| 85 | 'edit' => Array('url' => '/set_box.php', 'app' => $app_id) |
---|
| 86 | ); |
---|
| 87 | |
---|
| 88 | while(list($key,$value) = each($var)) |
---|
| 89 | $portalbox->set_controls($key,$value); |
---|
| 90 | |
---|
[139] | 91 | $portalbox->data = $data; |
---|
| 92 | |
---|
[2] | 93 | echo "\n".'<!-- BEGIN Mailbox info -->'."\n".$portalbox->draw($extra_data).'<!-- END Mailbox info -->'."\n"; |
---|
| 94 | } |
---|