diff options
| author | Lester Caine <lsces@lsces.co.uk> | 2010-11-28 08:45:34 +0000 |
|---|---|---|
| committer | Lester Caine <lsces@lsces.co.uk> | 2010-11-28 08:45:34 +0000 |
| commit | 25106c070fb9bdaa982693778e7cd9c65fa08670 (patch) | |
| tree | 024ef175e441848eefc3724533c84f39d6e0b05c /edit_notes.php | |
| parent | cdc58284379867bc47e3b3d789a06289a6182567 (diff) | |
| download | contact-25106c070fb9bdaa982693778e7cd9c65fa08670.tar.gz contact-25106c070fb9bdaa982693778e7cd9c65fa08670.tar.bz2 contact-25106c070fb9bdaa982693778e7cd9c65fa08670.zip | |
Initial pass at working with emails imported into comments structure
Diffstat (limited to 'edit_notes.php')
| -rw-r--r-- | edit_notes.php | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/edit_notes.php b/edit_notes.php new file mode 100644 index 0000000..66df0b9 --- /dev/null +++ b/edit_notes.php @@ -0,0 +1,79 @@ +<?php +/** + * $Header: /cvsroot/bitweaver/_bit_contact/edit.php,v 1.6 2010/02/08 21:27:22 wjames5 Exp $ + * + * Copyright (c) 2006 bitweaver.org + * All Rights Reserved. See below for details and a complete list of authors. + * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details + * + * @package contact + * @subpackage functions + */ + +/** + * required setup + */ +require_once( '../kernel/setup_inc.php' ); + +$gBitSystem->verifyPackage( 'contact' ); +$gBitSystem->verifyPermission( 'p_contact_update' ); + +include_once( CONTACT_PKG_PATH.'lookup_contact_inc.php' ); + +if( !empty( $gContent->mInfo ) ) { + $formInfo = $gContent->mInfo; + $formInfo['edit'] = !empty( $gContent->mInfo['data'] ) ? $gContent->mInfo['data'] : ''; +} + +require_once 'import/Mbox.php'; +require_once 'import/mimeDecode.php'; + +//reads a mbox file +$file = '/srv/website/bitweaver/contact/data/Stockport'; +echo 'Using file ' . $file . "<br>"; + +$mbox = new Mail_Mbox($file); +$mbox->open(); + +for ($n = 0; $n < $mbox->size(); $n++) { + $message = $mbox->get($n); + + preg_match('/Subject: (.*)$/m', $message, $matches); + $subject = $matches[1]; + echo 'Mail #' . $n . ': ' . $subject . "<br>"; + $Decoder = new Mail_mimeDecode( $message ); + $params = array( + 'include_bodies' => TRUE, + 'decode_bodies' => TRUE, + 'decode_headers' => TRUE + ); + $Decoded = $Decoder->decode($params); + if ( $Decoded->ctype_primary == "multipart" ) { + vd($Decoded->parts[0]->ctype_primary); + vd($Decoded->parts[0]->ctype_secondary); + print($Decoded->parts[0]->body); + } else { + vd($Decoded->ctype_primary); + vd($Decoded->ctype_secondary); + print($Decoded->body); + } + vd($Decoded->headers); + print( $message ); +} + +$mbox->close(); + +// formInfo might be set due to a error on submit +if( empty( $formInfo ) ) { + $formInfo = &$gContent->mInfo; +} + +$formInfo['contact_type_list'] = $gContent->getContactSourceList(); +$gBitSmarty->assign_by_ref( 'pageInfo', $formInfo ); + +$gBitSmarty->assign_by_ref( 'errors', $gContent->mErrors ); +$gBitSmarty->assign( (!empty( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : 'body').'TabSelect', 'tdefault' ); +$gBitSmarty->assign('show_page_bar', 'y'); + +$gBitSystem->display( 'bitpackage:contact/edit.tpl', 'Edit: ' , array( 'display_mode' => 'edit' )); +?> |
