diff options
author | Christian Schneider | 2006-12-12 13:38:57 +0000 |
---|---|---|
committer | Christian Schneider | 2006-12-12 13:38:57 +0000 |
commit | fd9171e0df775da9c4a3ea22e8f95ec75d3b3897 (patch) | |
tree | 53e93e18851d1c780f73e5464b89b1aad87f598c /sms/sms.class | |
parent | ee2fcb5bbc9b9db282a4668c50d87447b2114886 (diff) | |
download | itools-fd9171e0df775da9c4a3ea22e8f95ec75d3b3897.tar.gz itools-fd9171e0df775da9c4a3ea22e8f95ec75d3b3897.tar.bz2 itools-fd9171e0df775da9c4a3ea22e8f95ec75d3b3897.zip |
Merged revisions 13944-15067 via svnmerge from
svn+ssh://rdc.rim.ch/rdc/svn/itools/devel-redesign
........
r13945 | weber | 2006-10-26 16:13:44 +0200 (Thu, 26 Oct 2006) | 2 lines
omit null attributes, true means add name only. select() supports optgroups
........
r13946 | weber | 2006-10-26 16:22:42 +0200 (Thu, 26 Oct 2006) | 2 lines
Removed cruft
........
r13989 | cschneid | 2006-10-27 18:32:11 +0200 (Fri, 27 Oct 2006) | 1 line
Removed more cruft
........
r13991 | cschneid | 2006-10-28 19:36:35 +0200 (Sat, 28 Oct 2006) | 1 line
Make adserver output xhtml compliant tags
........
r14093 | weber | 2006-11-06 17:13:23 +0100 (Mon, 06 Nov 2006) | 2 lines
title tag can be omitted completely
........
r14096 | weber | 2006-11-06 18:00:43 +0100 (Mon, 06 Nov 2006) | 2 lines
Q() doesn't encode newlines, tag() encodes newlines within attributes
........
r14135 | weber | 2006-11-09 02:30:03 +0100 (Thu, 09 Nov 2006) | 2 lines
Migrate DB to texts.php on the fly (this functionality will be removed later), use only statictext, not DB
........
r14164 | mueller | 2006-11-09 19:23:40 +0100 (Thu, 09 Nov 2006) | 1 line
disable empty options in select
........
r14194 | mueller | 2006-11-13 14:34:25 +0100 (Mon, 13 Nov 2006) | 1 line
imply choose() in show()
........
r14212 | weber | 2006-11-13 18:14:33 +0100 (Mon, 13 Nov 2006) | 2 lines
Debug output is left-aligned
........
r14231 | cschneid | 2006-11-14 17:09:32 +0100 (Tue, 14 Nov 2006) | 1 line
Load js files before dom is ready and prevent loops on static=
........
r14288 | cschneid | 2006-11-15 13:16:54 +0100 (Wed, 15 Nov 2006) | 1 line
More compact serialization of arrays
........
r14388 | weber | 2006-11-22 18:19:34 +0100 (Wed, 22 Nov 2006) | 2 lines
Add optional IE PNG fix to it_html::img()
........
r14442 | mueller | 2006-11-27 23:22:23 +0100 (Mon, 27 Nov 2006) | 1 line
correctly handle <option value="">
........
r14444 | cschneid | 2006-11-28 12:35:43 +0100 (Tue, 28 Nov 2006) | 1 line
Handle null separately to preserve 0 == '0'
........
r14450 | cschneid | 2006-11-28 15:36:45 +0100 (Tue, 28 Nov 2006) | 1 line
Style commit (mainly done to test commit-email)
........
r14451 | cschneid | 2006-11-28 15:44:49 +0100 (Tue, 28 Nov 2006) | 1 line
Test commit for commit-email
........
r14638 | cschneid | 2006-12-01 14:20:45 +0100 (Fri, 01 Dec 2006) | 1 line
Suppress warning in case src file was removed by race
........
r14970 | weber | 2006-12-09 03:07:22 +0100 (Sat, 09 Dec 2006) | 2 lines
Added the highly useful timerlog() method from searchlib to justify the supporting code in auto_append.php ;)
........
r14971 | weber | 2006-12-09 03:08:49 +0100 (Sat, 09 Dec 2006) | 2 lines
Added set(), made dump_php's return value more convincing
........
r14993 | cschneid | 2006-12-11 14:05:29 +0100 (Mon, 11 Dec 2006) | 1 line
Added itjs::send_headers() to send HTTP headers suitable for JSON data
........
r14997 | cschneid | 2006-12-11 14:28:52 +0100 (Mon, 11 Dec 2006) | 1 line
Set JSON expiration date for IE
........
r15057 | weber | 2006-12-12 14:02:43 +0100 (Tue, 12 Dec 2006) | 2 lines
documentation update
........
Diffstat (limited to 'sms/sms.class')
-rw-r--r-- | sms/sms.class | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/sms/sms.class b/sms/sms.class deleted file mode 100644 index 6483035..0000000 --- a/sms/sms.class +++ /dev/null @@ -1,122 +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. -** -** sms.class - SMS gateway interface (both ways) using the Minick SMS gateway -*/ - -class it_sms -{ - /* Public readonly */ - var $service; /* Service name ("soltime", "superweb", etc.) */ - var $keyword; /* Short number service keyword ("SOLTIME", "SW", etc.) */ - - var $direction; /* "IN": Handy -> it_sms; "OUT": it_sms -> Handy */ - var $date; /* Date of message sent / received */ - - var $number; /* FQPhone number of other party z. B. 0041763901391 */ - var $message; /* Message text */ - - var $result; /* Result of transaction or empty */ - - /* Private */ - var $logfile; /* Log file name or empty for no log */ - - - /* Constructor */ - function it_sms($service, $keyword, $logfile="XX") - { - $this->service = $service; - $this->keyword = $keyword; - $this->logfile = $logfile; - - if ($logfile == "XX") - $this->logfile = $_SERVER['DOCUMENT_ROOT']."/../log/sms.log"; - } - - - /* Write a log file entry */ - function log() - { - if ($this->logfile == "") - return; - - $log = date("Y-m-d H:i:s") . " DIR=$this->direction NUMBER=$this->number RESULT=$this->result TEXT=\"$this->message\""; - if ($_COOKIE['UID']) - $log .= " UID=\"" . $_COOKIE['UID'] . "\""; - - if ($file = fopen($this->logfile, "a")) - { - fwrite($file, $log . "\n"); - fclose($file); - } - } - - - /* Send an SMS. Returns 1 on success, 0 otherwise. */ - function send($number, $message) - { - $this->direction = "OUT"; - $this->date = date("Y-m-d H:i:s"); - - /* Remove all non-digits */ - $number = ereg_replace('[^+0-9]', '', $number); - - /* Change 076 to 004176 etc. */ - $this->number = ereg_replace('^0([1-9])', '0041\\1', $number); - - $this->message = $message; - - $url = "http://panther.minick.ch/cgi-bin/$this->service/send?number=$this->number&message=" . urlencode($this->keyword." ".$this->message); - - /* debug("Sending SMS: $url<br>\n"); */ - - $result = file($url); - $this->result = trim($result[5]); /* "OKAY" or "NOTOK" w/o newline */ - $this->log(); - - if ($this->result == "OKAY") - return 1; /* Success */ - - return 0; /* Failure */ - } - - - /* - ** Receive an SMS from HTTP GET request - ** Format: number=Absendertelefonnummer, message=SMS-Text, id=xxxxx - ** Returns: 1=got a valid message, 0=got invalid garbage, ignore. - */ - function receive($secret="") - { - $this->direction = "IN"; - $this->date = date("Y-m-d H:i:s"); - - $this->number = $_GET['number']; - $this->message = $_GET['message']; - - if ($_GET['id'] == $secret) - { - $this->result = "OKAY"; - $this->log(); - return 1; - } - else - { - $this->result = "NOTOK: Bad authentication \"".$_GET['id']."\""; - $this->log(); - $this->number = $this->message = ""; - return 0; - } - } - -} /* End class it_sms */ -?> |