summaryrefslogtreecommitdiff
path: root/fax.class
diff options
context:
space:
mode:
authorUrban Müller2007-07-26 13:02:24 +0000
committerUrban Müller2007-07-26 13:02:24 +0000
commit806a5297e7e99d455b97a4f0acaba2f40f470584 (patch)
treeb9fc43ef227da87d873cf3676c08c49fa0dc1240 /fax.class
parentc3cba034c8009b65c25dd4ef5f54b18d9c8ee7d4 (diff)
downloaditools-806a5297e7e99d455b97a4f0acaba2f40f470584.tar.gz
itools-806a5297e7e99d455b97a4f0acaba2f40f470584.tar.bz2
itools-806a5297e7e99d455b97a4f0acaba2f40f470584.zip
renamed files for autoloader
Diffstat (limited to 'fax.class')
-rw-r--r--fax.class127
1 files changed, 0 insertions, 127 deletions
diff --git a/fax.class b/fax.class
deleted file mode 100644
index a9d8132..0000000
--- a/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>
- * &nbsp;&nbsp;&nbsp;&nbsp;die("Invalid fax number '$faxnumber'\n");<br>
- * <br>
- * $fax = new it_fax("faxtest-$USER"&#44; $faxnumber&#44;, $faxid&#44;, 'Kommentar'&#44;, IT_FAX_PRIORITY_HIGH);<br>
- * $fax->add_body("&lt;html&gt;&lt;body&gt;&lt;h1&gt;Ultrafax Test&lt;/h1&gt;Dies ist ein Ultrafaxtest abgeschickt von $USER@gna.ch&lt;/body&gt;&lt;/html&gt;", 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 */
-
-?>