Location: PHPKode > projects > Astmail - Asterisk web voicemail > messageTxt.class.php
<?php
session_start();
include ("mailbox.class.php");
include ("folder.class.php");
/*

 Copyright (c) 2005-2006 Colorado State Univeristy
 All rights reserved.

Please contact Kyle Haefner hide@address.com
for changes, bug notices or feature requests

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/



/*
;
; Message Information file
;
[message]
origmailbox=11012
context=analog
macrocontext=
exten=1
priority=4
callerchan=Zap/26-1
callerid=Unknown
origdate=Thu Aug 11 11:47:33 AM MST 2005
origtime=1123786053
category=
duration=2
*/

class MessageTxt{

var $vmail_dir = $_SESSION[vmail_dir];
var $fileInfo;
var $destbox;
var $origbox;
var $folder = "INBOX";
var $length;
var $msgNum;
var $length;
var $callerid;
var $datesent;
var $timesent;



function MessageTxt($destMbox, $origMbox, $len, $senderName, $date)
{
	$this->destbox=$destMbox;
	$this->origbox-$origMbox;
	$this->length=$len;
	$this->callerid=$senderName;
	$this->datesent=$date;
	$this->fileInfo = ";
; Message Information file
;
[message]
originalbox=$origMbox
context=default
macrocontext=
exten=0
priority=0
callerchan=Zap/1-1
callerid=$senderName
origdate=".$this->getDate()."
origtime=$date
category=
duration=$len";
}

function printInfo()
{
	print $this->fileInfo;
}

function write()
{
	//touch($this->vmail_dir."/".$this->destbox."/".$this->folder."/msg".$this->getMsgNum().".txt");
	$fp = fopen($this->vmail_dir."/".$this->destbox."/".$this->folder."/msg".$this->getMsgNum().".txt",'w');
	fwrite($fp,$this->fileInfo);
	fclose($fp);
}

/*Return the number+1 of the last message in the inbox folder of mailbox*/
function getMsgNum()
{
	$destFolder   = new Folder($this->destbox,$this->folder);
	$newmsg = sprintf("%04d",(($destFolder->last)+1));
	return $newmsg;
}

function getDate()
{
	$myDate = date("D M j g:i A Y", $this->datesent);
	return $myDate;
}

}

?>
Return current item: Astmail - Asterisk web voicemail