[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] felamimail/inc hook_home.inc.php [Version-0_9_16-bran
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] felamimail/inc hook_home.inc.php [Version-0_9_16-branch] |
Date: |
Sat, 22 Sep 2007 13:40:21 +0000 |
CVSROOT: /sources/phpgroupware
Module name: felamimail
Branch: Version-0_9_16-branch
Changes by: Dave Hall <skwashd> 07/09/22 13:40:21
Modified files:
inc : hook_home.inc.php
Log message:
make hook home work, removes dependency on 'email' app and makes it
acutally work as intended
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/felamimail/inc/hook_home.inc.php?cvsroot=phpgroupware&only_with_tag=Version-0_9_16-branch&r1=1.1.1.1.2.6&r2=1.1.1.1.2.6.2.1
Patches:
Index: hook_home.inc.php
===================================================================
RCS file: /sources/phpgroupware/felamimail/inc/hook_home.inc.php,v
retrieving revision 1.1.1.1.2.6
retrieving revision 1.1.1.1.2.6.2.1
diff -u -b -r1.1.1.1.2.6 -r1.1.1.1.2.6.2.1
--- hook_home.inc.php 11 Mar 2003 00:20:32 -0000 1.1.1.1.2.6
+++ hook_home.inc.php 22 Sep 2007 13:40:21 -0000 1.1.1.1.2.6.2.1
@@ -9,47 +9,17 @@
* option) any later version. *
\**************************************************************************/
- /* $Id: hook_home.inc.php,v 1.1.1.1.2.6 2003/03/11 00:20:32 lkneschke
Exp $ */
-
- $d1 = strtolower(substr(PHPGW_APP_INC,0,3));
- if($d1 == 'htt' || $d1 == 'ftp' )
- {
- echo 'Failed attempt to break in via an old Security
Hole!<br>'."\n";
- $GLOBALS['phpgw']->common->phpgw_exit();
- }
- unset($d1);
+ /* $Id: hook_home.inc.php,v 1.1.1.1.2.6.2.1 2007/09/22 13:40:21 skwashd
Exp $ */
$tmp_app_inc = $GLOBALS['phpgw']->common->get_inc_dir('felamimail');
-# if
($GLOBALS['phpgw_info']['user']['preferences']['felamimail']['mainscreen_showmail']
== True)
-# {
-# // ---- Create the base email Msg Class -----
- $GLOBALS['phpgw']->translation->add_app('felamimail');
- $GLOBALS['phpgw']->msg = CreateObject("email.mail_msg");
-# $args_array = Array();
-# $args_array['folder'] = 'INBOX';
-# $args_array['do_login'] = True;
-# $GLOBALS['phpgw']->msg->begin_request($args_array);
-
-# if (!$GLOBALS['phpgw']->msg->mailsvr_stream)
-# {
-# $error_msg = '<b>Mail error:</b> Can not open
connection to mail server';
-# echo "\r\n"
-# .'<tr>'."\r\n"
-# .'<td align="left">'."\r\n"
-# .'<!-- start Mailbox info -->'."\r\n"
-# .$error_msg."\r\n"
-# .'<!-- ends Mailox info -->'."\r\n"
-# .'</td>'."\r\n"
-# .'</tr>'."\r\n";
-# //$GLOBALS['phpgw']->common->phpgw_exit(True);
-# }
-# else
-# {
+ if
($GLOBALS['phpgw_info']['user']['preferences']['felamimail']['mainscreen_showmail']
== True)
+ {
$title = '<font
color="#FFFFFF">'.lang('felamimail').'</font>';
$portalbox = CreateObject('phpgwapi.listbox',
- Array(
+ array
+ (
'title' => $title,
'primary' =>
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
'secondary' =>
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
@@ -60,103 +30,71 @@
)
);
- $app_id =
$GLOBALS['phpgw']->applications->name2id('calendar');
+ $GLOBALS['phpgw']->translation->add_app('felamimail');
+ $app_id =
$GLOBALS['phpgw']->applications->name2id('felamimail');
$GLOBALS['portal_order'][] = $app_id;
- $var = Array(
- 'up' => Array('url' => '/set_box.php',
'app' => $app_id),
- 'down' => Array('url' => '/set_box.php',
'app' => $app_id),
- 'close' => Array('url' => '/set_box.php',
'app' => $app_id),
- 'question' => Array('url' =>
'/set_box.php', 'app' => $app_id),
- 'edit' => Array('url' => '/set_box.php',
'app' => $app_id)
+ $button = array
+ (
+ 'up' => array('url' => '/set_box.php',
'app' => $app_id),
+ 'down' => array('url' => '/set_box.php',
'app' => $app_id),
+ 'close' => array('url' => '/set_box.php',
'app' => $app_id),
+ 'question' => array('url' => '/set_box.php',
'app' => $app_id),
+ 'edit' => array('url' => '/set_box.php',
'app' => $app_id)
);
- while(list($key,$value) = each($var))
+ foreach ( $button as $key => $value)
+ {
+ $portalbox->set_controls($key, $value);
+ }
+
+ $bofelamimail = createObject('felamimail.bofelamimail');
+ $connected = $bofelamimail->openConnection();
+ if ( $connected )
+ {
+ $headers = $bofelamimail->getHeaders(1,
$GLOBALS['phpgw_info']["user"]["preferences"]["common"]["maxmatchs"], 0);
+ $bofelamimail->closeConnection();
+ }
+ else
{
- $portalbox->set_controls($key,$value);
+ $err = lang('ERROR');
+ $str = lang('Can not open connection to mail server');
+ $extra_data = "<p><strong>$err</strong>$str</p>";
+ echo "\r\n<!-- start felamimail error -->\r\n"
+ . $portalbox->draw($extra_data)
+ . "<!-- ends felamimail error -->\r\n";
+ return;
}
- $portalbox->data = Array();
+ if ( !is_array($headers['header']) ||
!count($headers['header']) )
+ {
+ $str = lang('You have no messages in your INBOX');
+ $extra_data = "<p>$str</p>";
+ echo "\r\n<!-- start felamimail error -->\r\n"
+ . $portalbox->draw($extra_data)
+ . "<!-- ends felamimail error -->\r\n";
+ return;
+ }
+ $portalbox->data = array();
+ foreach($headers['header'] as $msg)
+ {
+ if (strlen($msg['subject']) > 65)
+ {
+ $msg['subject'] = substr($msg['subject'], 0,
65).' ...';
+ }
+ $link_data = array
+ (
+ 'menuaction' =>
'felamimail.uidisplay.display',
+ 'uid' => (int) $msg['uid']
+ );
+ $portalbox->data[] = array
+ (
+ 'text' => htmlspecialchars($msg['subject']),
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', $link_data)
+ );
+ }
-# /* // this is the structure you will get
-# $inbox_data['is_imap'] boolean - pop3 server do not
know what is "new" or not
-# $inbox_data['folder_checked'] string - the folder
checked, as processed by the msg class
-# $inbox_data['alert_string'] string - what to show the
user about this inbox check
-# $inbox_data['number_new'] integer - for IMAP is
number "unseen"; for pop3 is number messages
-# $inbox_data['number_all'] integer - for IMAP and pop3
is total number messages in that inbox
-# */
-# $inbox_data = Array();
-# $inbox_data =
$GLOBALS['phpgw']->msg->new_message_check();
-#
-# if($inbox_data['number_all'] >= 5)
-# {
-# $check_msgs = 5;
-# }
-# else
-# {
-# $check_msgs = $inbox_data['number_all'];
-# }
-
-# if ($inbox_data['number_all'] > 0)
-# {
-# $msg_array = array();
-# $msg_array =
$GLOBALS['phpgw']->msg->get_message_list();
-# }
-# for($i=0; $i<$check_msgs; $i++)
-# {
-# $msg =
$GLOBALS['phpgw']->dcom->header($GLOBALS['phpgw']->msg->mailsvr_stream,$msg_array[$i]);
-# $subject =
$GLOBALS['phpgw']->msg->get_subject($msg,'');
-# if (strlen($subject) > 65)
-# {
-# $subject = substr($subject,0,65).' ...';
-# }
-# $linkData = array
-# (
-# 'mailbox' =>
$GLOBALS['phpgw']->msg->prep_folder_out(''),
-# 'passed_id' => $msg_array[$i],
-# 'startMessage' => 1,
-# 'show_more' => 0
-## );
-# $data[] = array(
-# 'data' => $subject,
-# 'link' =>
$GLOBALS['phpgw']->link('/felamimail/read_body.php',$linkData)
-# );
-# }
-# // ADD FOLDER LISTBOX TO HOME PAGE (Needs to be
TEMPLATED)
-# // Does This Mailbox Support Folders (i.e. more than
just INBOX)?
-# if
($GLOBALS['phpgw']->msg->get_mailsvr_supports_folders() == False)
-# {
-# $extra_data = '';
-# }
-# else
-# {
-# // FUTURE: this will pick up the user option to
show num unseen msgs in dropdown list
-# //$listbox_show_unseen = True;
-# $listbox_show_unseen = False;
-# $switchbox_listbox = '<select name="mailbox"
onChange="document.switchbox.submit()">'
-# . '<option>' . lang('switch
current folder to') . ':'
-# .
$GLOBALS['phpgw']->msg->all_folders_listbox('','','',$listbox_show_unseen)
-# . '</select>';
-# // make it another TR we can insert
-# $switchbox_action =
$GLOBALS['phpgw']->link('/felamimail/index.php');
-# $extra_data = '<form name="switchbox"
action="'.$switchbox_action.'" method="post">'."\r\n"
-# .'<td align="left">'."\r\n"
-# .' <strong>'.lang('E-Mail
Folders').':</strong> '.$switchbox_listbox
-# .'<input type="hidden"
name="startMessage" value="1">'
-# .'</td>'."\r\n"
-# .'</form>'."\r\n";
-# }
-# $GLOBALS['phpgw']->msg->end_request();
-#
- if($data)
- {
- $portalbox->data = $data;
- }
-
- // output the portalbox and below it (1) the folders
listbox (if applicable) and (2) Compose New mail link
- echo "\r\n".'<!-- start Mailbox info -->'."\r\n"
- .$portalbox->draw($extra_data)
- .'<!-- ends Mailox info -->'."\r\n";
-# }
-# }
-?>
+ echo "\r\n<!-- start felamimail -->\r\n"
+ . $portalbox->draw('')
+ . "<!-- end felamimail -->\r\n";
+ }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] felamimail/inc hook_home.inc.php [Version-0_9_16-branch],
Dave Hall <=