[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: felamimail/inc class.bofelamimail.inc.php,1.2.2.
From: |
Lars Kneschke <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: felamimail/inc class.bofelamimail.inc.php,1.2.2.6,1.2.2.7 class.uifelamimail.inc.php,1.2.2.6,1.2.2.7 mime.php,1.1.1.1.2.1,1.1.1.1.2.2 |
Date: |
Thu, 08 Aug 2002 01:52:20 -0400 |
Update of /cvsroot/phpgroupware/felamimail/inc
In directory subversions:/tmp/cvs-serv2383/inc
Modified Files:
Tag: Version-0_9_14-branch
class.bofelamimail.inc.php class.uifelamimail.inc.php mime.php
Log Message:
fixed some little bugs
Index: class.bofelamimail.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.bofelamimail.inc.php,v
retrieving revision 1.2.2.6
retrieving revision 1.2.2.7
diff -C2 -r1.2.2.6 -r1.2.2.7
*** class.bofelamimail.inc.php 20 Jun 2002 12:46:27 -0000 1.2.2.6
--- class.bofelamimail.inc.php 8 Aug 2002 05:52:16 -0000 1.2.2.7
***************
*** 205,208 ****
--- 205,246 ----
// this function is based on a on "Building A PHP-Based Mail
Client"
// http://www.devshed.com
+ // fetch a specific attachment from a message
+ function getAttachment($_messageUID, $_partID)
+ {
+ // parse message structure
+ $structure = imap_fetchstructure($this->mbox,
$_messageUID, FT_UID);
+ $sections = $this->parse($structure);
+
+ // look for specified part
+ for($x=0; $x<sizeof($sections); $x++)
+ {
+ if($sections[$x]["pid"] == $_partID)
+ {
+ $type = $sections[$x]["type"];
+ $encoding = $sections[$x]["encoding"];
+ $filename = $sections[$x]["name"];
+ }
+ }
+
+ $attachment = imap_fetchbody($this->mbox, $_messageUID,
$_partID, FT_UID);
+
+ switch($encoding)
+ {
+ case "":
+ $attachment = imap_base64($attachment);
+
+ break;
+ }
+
+ return array(
+ 'type' => $type,
+ 'encoding' => $encoding,
+ 'filename' => $filename,
+ 'attachment' => $attachment
+ );
+ }
+
+ // this function is based on a on "Building A PHP-Based Mail
Client"
+ // http://www.devshed.com
// iterate through object returned by parse()
// create a new array holding information only on message
attachments
Index: class.uifelamimail.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.uifelamimail.inc.php,v
retrieving revision 1.2.2.6
retrieving revision 1.2.2.7
diff -C2 -r1.2.2.6 -r1.2.2.7
*** class.uifelamimail.inc.php 20 Jun 2002 12:46:27 -0000 1.2.2.6
--- class.uifelamimail.inc.php 8 Aug 2002 05:52:16 -0000 1.2.2.7
***************
*** 18,25 ****
var $public_functions = array
(
! 'viewMainScreen' => True,
! 'handleButtons' => True,
'deleteMessage' => True,
'toggleFilter' => True,
'compressFolder' => True
);
--- 18,26 ----
var $public_functions = array
(
! 'addVcard' => True,
'deleteMessage' => True,
+ 'handleButtons' => True,
'toggleFilter' => True,
+ 'viewMainScreen' => True,
'compressFolder' => True
);
***************
*** 140,144 ****
#$this->cats =
CreateObject('phpgwapi.categories');
#$this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
! #$this->account
= $phpgw_info['user']['account_id'];
$this->t =
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
#$this->grants =
$phpgw->acl->get_grants('notes');
--- 141,145 ----
#$this->cats =
CreateObject('phpgwapi.categories');
#$this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
! #$this->account =
$phpgw_info['user']['account_id'];
$this->t =
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
#$this->grants =
$phpgw->acl->get_grants('notes');
***************
*** 152,155 ****
--- 153,188 ----
$this->dataRowColor[1] = $phpgw_info["theme"]["bg02"];
+ }
+
+ function addVcard()
+ {
+ $messageID =
$GLOBALS['HTTP_GET_VARS']['messageID'];
+ $partID = $GLOBALS['HTTP_GET_VARS']['partID'];
+ $attachment =
$this->bofelamimail->getAttachment($messageID,$partID);
+
+ $tmpfname = tempnam
($GLOBALS['phpgw_info']['server']['temp_dir'], "phpgw_");
+ $fp = fopen($tmpfname, "w");
+ fwrite($fp, $attachment['attachment']);
+ fclose($fp);
+
+ $vcard = CreateObject('phpgwapi.vcard');
+ $entry = $vcard->in_file($tmpfname);
+ $entry['owner'] =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $entry['access'] = 'private';
+ $entry['tid'] = 'n';
+
+ _debug_array($entry);
+ print "<br><br>";
+
+ print quoted_printable_decode($entry['fn'])."<br>";
+
+ #$boaddressbook =
CreateObject('addressbook.boaddressbook');
+ #$soaddressbook =
CreateObject('addressbook.soaddressbook');
+ #$soaddressbook->add_entry($entry);
+ #$ab_id = $boaddressbook->get_lastid();
+
+ unlink($tmpfname);
+
+ $GLOBALS['phpgw']->common->phpgw_exit();
}
Index: mime.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/mime.php,v
retrieving revision 1.1.1.1.2.1
retrieving revision 1.1.1.1.2.2
diff -C2 -r1.1.1.1.2.1 -r1.1.1.1.2.2
*** mime.php 25 Feb 2002 23:58:37 -0000 1.1.1.1.2.1
--- mime.php 8 Aug 2002 05:52:16 -0000 1.1.1.1.2.2
***************
*** 586,591 ****
$ent = urlencode($message->header->entity_id);
- $DefaultLink = $phpgw->link(
-
"/felamimail/download.php","startMessage=$startMessage&passed_id=$id&mailbox=$urlMailbox&passed_ent_id=$ent");
if ($where && $what)
$DefaultLink .= '&where=' . urlencode($where) . '&what=' .
urlencode($what);
--- 586,589 ----
***************
*** 595,607 ****
$ImageURL = '';
- $HookResults = do_hook("attachment $type0/$type1", $Links,
- $startMessage, $id, $urlMailbox, $ent, $DefaultLink,
- $display_filename, $where, $what);
-
- $Links = $HookResults[1];
- $DefaultLink = $HookResults[6];
-
$body .= '<TR><TD> </TD><TD>';
! $body .= "<A
HREF=\"$DefaultLink\">$display_filename</A> </TD>";
$body .= '<TD><SMALL><b>' .
show_readable_size($message->header->size) .
'</b> </small></TD>';
--- 593,647 ----
$ImageURL = '';
$body .= '<TR><TD> </TD><TD>';
! switch("$type0/$type1")
! {
! case "text/x-vcard":
! $bofelamimail =
CreateObject('felamimail.bofelamimail',$mailbox);
! $vcard =
CreateObject('phpgwapi.vcard');
!
! $attachment =
$bofelamimail->getAttachment($GLOBALS['HTTP_GET_VARS']['uid'],$ent);
! $tmpfname = tempnam
($GLOBALS['phpgw_info']['server']['temp_dir'], "phpgw_");
! $fp = fopen($tmpfname, "w");
! fwrite($fp, $attachment['attachment']);
! fclose($fp);
!
! $entry = $vcard->in_file($tmpfname);
! $entry['owner'] =
$GLOBALS['phpgw_info']['user']['account_id'];
! $entry['access'] = 'private';
! $entry['tid'] = 'n';
!
! unlink($tmpfname);
!
! #_debug_array($entry);
! #print "<br><br>";
!
! if(isset($entry['fn']))
! $display_filename =
htmlentities(quoted_printable_decode($entry['fn']))."<br>";
! if(isset($entry['org_name']))
! $display_filename .=
htmlentities(quoted_printable_decode($entry['org_name']))."<br>";
! if(isset($entry['adr_one_postalcode']))
! $display_filename .=
htmlentities(quoted_printable_decode($entry['adr_one_postalcode']))." ";
! if(isset($entry['adr_one_locality']))
! $display_filename .=
htmlentities(quoted_printable_decode($entry['adr_one_locality']));
! $linkData = array
! (
! 'menuaction' =>
'felamimail.uifelamimail.addVcard',
! 'startMessage' => $startMessage,
! 'mailbox' => $urlMailbox,
! 'messageID' =>
$GLOBALS['HTTP_GET_VARS']['uid'],
! 'partID' => $ent
! );
! $DefaultLink =
$GLOBALS['phpgw']->link('/index.php',$linkData);
! $body .= "<A HREF=\"$DefaultLink\"
target=\"_blank\">$display_filename</A> </TD>";
!
! break;
!
! default:
! $DefaultLink = $phpgw->link(
!
"/felamimail/download.php","startMessage=$startMessage&passed_id=$id&mailbox=$urlMailbox&passed_ent_id=$ent");
! $body .= "<A HREF=\"$DefaultLink\"
target=\"_blank\">$display_filename</A> </TD>";
!
! break;
! }
$body .= '<TD><SMALL><b>' .
show_readable_size($message->header->size) .
'</b> </small></TD>';
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: felamimail/inc class.bofelamimail.inc.php,1.2.2.6,1.2.2.7 class.uifelamimail.inc.php,1.2.2.6,1.2.2.7 mime.php,1.1.1.1.2.1,1.1.1.1.2.2,
Lars Kneschke <address@hidden> <=