diff options
author | Christian Weber | 2007-09-03 15:05:11 +0000 |
---|---|---|
committer | Christian Weber | 2007-09-03 15:05:11 +0000 |
commit | 87dc34cf6e0757730ce9411c332440ca3314fa06 (patch) | |
tree | c5e19055a068f02bfcb11e602d270660006c5ca1 /it_fax.class | |
parent | 294a62e26f0f19d81f4548af5f48f6036e611bbd (diff) | |
download | itools-87dc34cf6e0757730ce9411c332440ca3314fa06.tar.gz itools-87dc34cf6e0757730ce9411c332440ca3314fa06.tar.bz2 itools-87dc34cf6e0757730ce9411c332440ca3314fa06.zip |
Obsolete
Diffstat (limited to 'it_fax.class')
-rw-r--r-- | it_fax.class | 127 |
1 files changed, 0 insertions, 127 deletions
diff --git a/it_fax.class b/it_fax.class deleted file mode 100644 index a9d8132..0000000 --- a/it_fax.class +++ /dev/null @@ -1,127 +0,0 @@ -<?php - -/* -** $Id$ -** -** ITools - the Internet Tools Library -** -** Copyright (C) 1995-2003 by the ITools Authors. -** This program is free software; you can redistribute it and/or -** modify it under the terms of either the GNU General Public License -** or the GNU Lesser General Public License, as published by the Free -** Software Foundation. See http://www.gnu.org/licenses/ for details. -*/ - -define('IT_FAX_PRIORITY_LOW', 207); -define('IT_FAX_PRIORITY_NORMAL', 127); -define('IT_FAX_PRIORITY_HIGH', 63); - - -/** - * Construct a fax message with body (plaintext and/or HTML) and - * send it. Also provides utility function to check phone number address - * validity.<br> - * <em>Example:</em><br> - * <code><nobr> - * if (!it_fax::check_number($faxnumber))<br> - * die("Invalid fax number '$faxnumber'\n");<br> - * <br> - * $fax = new it_fax("faxtest-$USER", $faxnumber,, $faxid,, 'Kommentar',, IT_FAX_PRIORITY_HIGH);<br> - * $fax->add_body("<html><body><h1>Ultrafax Test</h1>Dies ist ein Ultrafaxtest abgeschickt von $USER@gna.ch</body></html>", IT_MAIL_HTML);<br> - * $fax->send();<br> - * </nobr></code> - */ -class it_fax extends it_mail -{ - -/** - * Construct a new fax message. Body can be added later. - * @param $application Application name sending the fax - * @param $faxnumber Phone number to send fax to - * @param $faxid Optional unique identifier of this message application can set if it wants to track status later - * @param $comment Optional comment to be logged with fax message - * @param $priority Priority, one of IT_FAX_PRIORITY_LOW, IT_FAX_PRIORITY_NORMAL or IT_FAX_PRIORITY_HIGH - */ -function it_fax($application, $faxnumber, $faxid = '-', $comment = '', $priority = 0, $mailto = 'ultrafax@zhcs.rim.ch', $mailfrom = 'ultrafaxmaster@zhcs.rim.ch', $faxstatusto = '') -{ - $faxnumber = ereg_replace('[^0-9]', '', $faxnumber); - - if (!$priority) - $priority = IT_FAX_PRIORITY_NORMAL; - - $signature = $this->_create_signature($application, $faxnumber, $faxid); - - $this->it_mail(array('From' => $mailfrom, 'To' => $mailto, 'Subject' => "Fax Message from $application", 'X-Faxsender' => $application, 'X-Faxid' => $faxid, 'X-Faxnumber' => $faxnumber, 'X-Faxsignature' => $signature, 'X-Faxpriority' => $priority, 'X-Faxcomment' => ereg_replace("[\r\n\t ()]+", ' ', $comment), 'X-Faxstatus-To' => $faxstatusto)); -} - -/** - * Add body part to this fax message. Can be called repeatedly. - * @param $text Text to be added to fax message - * @param $type Type of text, one of IT_MAIL_HTML (default) or IT_MAIL_PLAIN - */ -function add_body($text, $type = IT_MAIL_HTML) -{ - if ($type != IT_MAIL_HTML) - $text = "<pre>$text</pre>"; - - it_mail::add_body($text, IT_MAIL_HTML); -} - -/** - * Check if given phone number is valid (very simplistic, currently allows - * 0 followed by any number of digits, e.g. 012345) - * @param $phonenumber phonenumber to be checked - * @return True if phone number seems to be valid - */ -function check_number($phonenumber) -{ - return ereg('^0[0-9 ]+$', trim($phonenumber)); -} - -/** - * INTERNAL FUNCTION: Get signature session - * @return Session object to create/check signatures - */ -function _get_session() -{ - $session = new it_session; - $session->set_secret('be55b53ac39445943d16aba1bfd8e515'); - $session->set_cookiename('it_fax_cookie_never_exists'); - $session->set_lifetime(30 * 86400); /* Almost forever: 30 days */ - $session->init(); - - return $session; -} - -/** - * INTERNAL FUNCTION: Get signature for this fax message parameters - * @param $application Application name sending the fax - * @param $faxnumber Phone number to send fax to - * @param $faxid Optional unique identifier of this message application can set if it wants to track status later - * @return Signature for this fax - */ -function _create_signature($application, $faxnumber, $faxid) -{ - $session = it_fax::_get_session(); - - return $session->create_signature("$application|$faxnumber|$faxid"); -} - -/** - * INTERNAL FUNCTION: Check signature for this fax message parameters - * @param $signature Signature to check - * @param $application Application name sending the fax - * @param $faxnumber Phone number to send fax to - * @param $faxid Optional unique identifier of this message application can set if it wants to track status later - * @return True if signature ok, false otherwise - */ -function _check_signature($signature, $application, $faxnumber, $faxid) -{ - $session = it_fax::_get_session(); - - return $session->check_signature("$application|$faxnumber|$faxid", $signature); -} - -} /* End class it_fax */ - -?> |