summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--.notice0
-rw-r--r--Makefile68
-rw-r--r--banner/.cvsignore2
-rw-r--r--banner/Makefile48
-rw-r--r--banner/banner.class14
-rw-r--r--config.class36
-rw-r--r--darwin/.cvsignore2
-rw-r--r--darwin/Makefile43
-rw-r--r--darwin/query.class95
-rw-r--r--debug.class2
-rw-r--r--html.class72
-rw-r--r--it.class17
-rw-r--r--itjs.class15
-rw-r--r--itjs/boot.js29
-rw-r--r--license/.cvsignore1
-rw-r--r--license/Makefile47
-rw-r--r--license/license.class8
-rw-r--r--sms.lib3
-rw-r--r--sms/Makefile47
-rw-r--r--sms/sms.class122
-rw-r--r--text.class226
-rw-r--r--url.class2
-rw-r--r--urlcache/.cvsignore2
-rw-r--r--urlcache/Makefile43
-rw-r--r--urlcache/urlcache.class217
-rw-r--r--urlcache/urlcache.php28
-rw-r--r--urlcache/urlcache.sql14
-rw-r--r--user.class1
29 files changed, 241 insertions, 969 deletions
diff --git a/.gitignore b/.gitignore
index 25c5961..2b52b61 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,10 +2,4 @@
/*.slib
banner/*.lib
banner/*.slib
-darwin/*.lib
-darwin/*.slib
license/license.slib
-sms/*.lib
-sms/*.slib
-urlcache/*.lib
-urlcache/*.slib
diff --git a/.notice b/.notice
deleted file mode 100644
index e69de29..0000000
--- a/.notice
+++ /dev/null
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 1bdb140..0000000
--- a/Makefile
+++ /dev/null
@@ -1,68 +0,0 @@
-##
-## $Id$
-##
-## Makefile for itools.lib
-##
-## 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.
-##
-
-CPP= cpp -traditional
-QUIETMAKE= $(MAKE) -s
-PHPCOMPILE= /usr/local/bin/phpcompile
-
-MODULE= itools
-SUBDIRS= banner darwin license sms urlcache
-CLASSES= support.pinc it.class browser.class db.class db_record.class db_table.class dbi.class debug.class html.class html_form.class html_page.class itjs.class mail.class fax.class session.class text.class url.class user.class xml.class
-
-#
-# Library creation rules, do not change stuff below...
-#
-SLIB= $(MODULE).slib
-LIB= $(MODULE)-compiled.lib
-DEVEL= $(MODULE)-devel.lib
-
-all:
- @echo Nothing to do. You may want to make $(MODULE)-compiled.lib
-
-all2: $(LIB) $(DEVEL) $(SUBDIRS)
-
-$(LIB): $(SLIB) Makefile
- @if [ -x $(PHPCOMPILE) ]; then (echo Compiling $(SLIB) to $(LIB) ...) 1>&2; cat $(SLIB) license/license.slib | $(PHPCOMPILE) >$(LIB); else (echo $(PHPCOMPILE) not found, copying $(SLIB) to $(LIB) ...) 1>&2; cp $(SLIB) $(LIB); fi
-
-$(SLIB): $(CLASSES) DUMMY
- @(echo Creating $(SLIB) from $(SUBDIRS) $(CLASSES) ...) 1>&2
- @echo -e "<?php\nrequire_once('itools/config.class');" >$(SLIB)
- @(for class in DUMMY $(CLASSES); do test -f $$class && cat $$class; done) | $(CPP) -P -undef | perl -ne 's/^\s+//g; print unless /^\s*$$/' | grep -v "^<?php" | grep -v "^?>" >>$(SLIB)
- @echo "?>" >>$(SLIB)
-
-$(DEVEL): $(CLASSES) Makefile
- @echo "<?php" >$(DEVEL)
- @(for class in $(CLASSES); do test -f $$class && echo "require_once('itools/$$class');"; done) >>$(DEVEL)
- @echo "?>" >>$(DEVEL)
-
-## Rule to merge all of SLIB and SUBDIRS/SLIBS into one big SLIB
-#$(SLIB): $(CLASSES) DUMMY
-# @(echo Creating $(SLIB) from $(SUBDIRS) $(CLASSES) ...) 1>&2
-# @echo "<?php" >$(SLIB)
-# @(for dir in DUMMY $(SUBDIRS); do (test -d $$dir && cd $$dir && $(QUIETMAKE) cat); done; for class in DUMMY $(CLASSES); do test -f $$class && cat $$class; done) | $(CPP) -P -undef | perl -ne 's/^\s+//g; print unless /^\s*$$/' | grep -v "^<?php" | grep -v "^?>" >>$(SLIB)
-# @echo "?>" >>$(SLIB)
-
-$(SUBDIRS)::
- @(cd $@; $(QUIETMAKE))
-
-DUMMY:
-
-cat: $(SLIB)
- @cat $(SLIB)
-
-clean:
- @(echo Cleaning $(SLIB) $(LIB) ...) 1>&2
- @rm -f $(SLIB) $(LIB) $(DEVEL)
- @for dir in DUMMY $(SUBDIRS); do (test -d $$dir && cd $$dir && $(QUIETMAKE) $@) || :; done
-
-delsource:
- @rm -rf *.slib license.lib $(DEVEL) $(CLASSES) $(SUBDIRS)
diff --git a/banner/.cvsignore b/banner/.cvsignore
deleted file mode 100644
index b8e8856..0000000
--- a/banner/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.slib
-*.lib
diff --git a/banner/Makefile b/banner/Makefile
deleted file mode 100644
index 8e607aa..0000000
--- a/banner/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-##
-## $Id$
-##
-## Makefile for itools/banner.lib
-##
-## $Log$
-## Revision 1.1 2000/02/25 18:49:46 weber
-## Hello, world!
-##
-##
-
-CPP= cpp
-QUIETMAKE= $(MAKE) -s
-PHPCOMPILE= /usr/local/bin/phpcompile
-
-MODULE= banner
-SUBDIRS=
-CLASSES= banner.class
-
-#
-# Library creation rules, do not change stuff below...
-#
-SLIB= $(MODULE).slib
-LIB= ../$(MODULE).lib
-
-all: $(LIB)
-
-$(LIB): $(SLIB)
- @if [ -x $(PHPCOMPILE) ]; then (echo Compiling $(SLIB) to $(LIB) ...) 1>&2; $(PHPCOMPILE) <$(SLIB) >$(LIB); else (echo $(PHPCOMPILE) not found, copying $(SLIB) to $(LIB) ...) 1>&2; cp $(SLIB) $(LIB); fi
-
-$(SLIB): $(CLASSES) DUMMY
- @(echo Creating $(SLIB) from $(SUBDIRS) $(CLASSES) ...) 1>&2
- @echo "<?php" >$(SLIB)
- @(for dir in DUMMY $(SUBDIRS); do (test -d $$dir && cd $$dir && $(QUIETMAKE) cat); done; for class in DUMMY $(CLASSES); do test -f $$class && cat $$class; done) | $(CPP) -P -undef | perl -ne 's/^\s+//g; print unless /^\s*$$/' | grep -v "^<?php" | grep -v "^?>" >>$(SLIB)
- @echo "?>" >>$(SLIB)
-
-$(SUBDIRS)::
- @(cd $@; $(QUIETMAKE))
-
-DUMMY:
-
-cat: $(SLIB)
- @cat $(SLIB)
-
-clean:
- @(echo Cleaning $(SLIB) $(LIB) ...) 1>&2
- @rm -f $(SLIB) $(LIB)
- @for dir in DUMMY $(SUBDIRS); do (test -d $$dir && cd $$dir && $(QUIETMAKE) $@) || :; done
diff --git a/banner/banner.class b/banner/banner.class
index 7c6d32a..37ae213 100644
--- a/banner/banner.class
+++ b/banner/banner.class
@@ -129,8 +129,9 @@ function choose()
ED($this->banners);
}
- srand((double)microtime()*1000000);
+ srand((double)microtime()*1000000);
$this->rand = rand();
+ $this->chosen = true;
}
/**
@@ -141,6 +142,9 @@ function choose()
*/
function show($nocount = false, $noecho = false)
{
+ if (!$this->chosen)
+ $this->choose();
+
if (!is_array($this->banners))
return; // none found or choose() not called yet
@@ -190,7 +194,7 @@ function showcombined($position = "banner", $nocount = false)
function render($banner, $count, $number, $nocount = false)
{
if ($number > 0)
- echo "<br><br>";
+ echo "<br /><br />";
$this->render_banner($banner, $nocount);
}
@@ -267,13 +271,13 @@ function render_banner($banner, $nocount = false)
$linkend = "</a>";
}
- echo "$linkstart<img src=\"$viewurl\" alt=\"" . $banner['alttext'] . "\" width=" . $banner['width'] . " height=" . $banner['height'] . " border=0>$linkend";
+ echo "$linkstart<img src=\"$viewurl\" alt=\"" . $banner['alttext'] . "\" width=\"" . $banner['width'] . "\" height=\"" . $banner['height'] . "\" border=\"0\" />$linkend";
if (strlen($banner['extraline']) > 0)
- echo "<br>$linkstart" . $banner['extraline'] . $linkend;
+ echo "<br />$linkstart" . $banner['extraline'] . $linkend;
if (strlen($banner['extraline']) == 0 && $this->p['addextraline'])
- echo "<br>&nbsp;";
+ echo "<br />&nbsp;";
break;
case 1:
echo $banner['data'];
diff --git a/config.class b/config.class
deleted file mode 100644
index 0998c28..0000000
--- a/config.class
+++ /dev/null
@@ -1,36 +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.
-**
-** Class it_config: Server-wide ITools Configuration
-** Can be overloaded as needed by applications
-*/
-
-/**
- * Class it_config: Server-wide ITools Configuration
- * Can be overloaded as needed by applications
- */
-class it_config
-{
- /* Generic Paraphernalia (readable) */
- var $project_root; /* string: usually /www/gna.ch */
-
-/**
- * Constructor: Initializes public fields
- */
-function it_config()
-{
- $this->project_root = dirname($_SERVER['DOCUMENT_ROOT']);
-}
-
-} /* End Class it_config */
-
-?>
diff --git a/darwin/.cvsignore b/darwin/.cvsignore
deleted file mode 100644
index b8e8856..0000000
--- a/darwin/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.slib
-*.lib
diff --git a/darwin/Makefile b/darwin/Makefile
deleted file mode 100644
index bd59596..0000000
--- a/darwin/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-##
-## $Id$
-##
-## Makefile for itools/darwin.lib
-##
-
-CPP= cpp
-QUIETMAKE= $(MAKE) -s
-PHPCOMPILE= /usr/local/bin/phpcompile
-
-MODULE= darwin
-SUBDIRS=
-CLASSES= query.class
-
-#
-# Library creation rules, do not change stuff below...
-#
-SLIB= $(MODULE).slib
-LIB= ../$(MODULE).lib
-
-all: $(LIB)
-
-$(LIB): $(SLIB)
- @if [ -x $(PHPCOMPILE) ]; then (echo Compiling $(SLIB) to $(LIB) ...) 1>&2; $(PHPCOMPILE) <$(SLIB) >$(LIB); else (echo $(PHPCOMPILE) not found, copying $(SLIB) to $(LIB) ...) 1>&2; cp $(SLIB) $(LIB); fi
-
-$(SLIB): $(CLASSES) DUMMY
- @(echo Creating $(SLIB) from $(SUBDIRS) $(CLASSES) ...) 1>&2
- @echo "<?php" >$(SLIB)
- @(for dir in DUMMY $(SUBDIRS); do (test -d $$dir && cd $$dir && $(QUIETMAKE) cat); done; for class in DUMMY $(CLASSES); do test -f $$class && cat $$class; done) | $(CPP) -P -undef | perl -ne 's/^\s+//g; print unless /^\s*$$/' | grep -v "^<?php" | grep -v "^?>" >>$(SLIB)
- @echo "?>" >>$(SLIB)
-
-$(SUBDIRS)::
- @(cd $@; $(QUIETMAKE))
-
-DUMMY:
-
-cat: $(SLIB)
- @cat $(SLIB)
-
-clean:
- @(echo Cleaning $(SLIB) $(LIB) ...) 1>&2
- @rm -f $(SLIB) $(LIB)
- @for dir in DUMMY $(SUBDIRS); do (test -d $$dir && cd $$dir && $(QUIETMAKE) $@) || :; done
diff --git a/darwin/query.class b/darwin/query.class
deleted file mode 100644
index f0a5b7e..0000000
--- a/darwin/query.class
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php
-/*
-** $Id$
-**
-** itools/darwin/query.class - Query the UltraDarwin 3000 Search Engine
-**
-** Requires: global $it_text object to determine result language
-**
-** $Log$
-** Revision 1.4 2000/05/08 16:01:21 cschneid
-** Removed need to global $it_text object
-**
-** Revision 1.3 2000/05/08 15:44:18 cschneid
-** Allow absolute http:// url to search binary
-**
-** Revision 1.2 2000/01/16 22:46:02 weber
-** Renamed query to result to avoid confusion
-**
-** Revision 1.1 2000/01/12 02:26:21 weber
-** Added darwin query class
-**
-**
-*/
-
-class it_darwin_query
-{
- /* Public Result information (read only) */
- var $totalresults; /* Total number of results found */
- var $firstresult; /* first fetched result */
- var $lastresult; /* last fetched result */
-
- /* Parameters (read only) */
- var $service; /* Service identifier for query URL */
- var $resultsperpage; /* Number of results to show per page */
-
- /* Private */
- var $result; /* Raw query result array */
- var $resptr; /* Result array pointer */
-
- /* Constructor */
- function it_darwin_query($service, $resultsperpage=10)
- {
- if (!ereg('^http://', $service))
- $service = "http://ultrasearch.relog.ch/$service/Search";
-
- $this->service = $service;
- $this->resultsperpage = $resultsperpage;
- $this->totalresults = $this->firstresult = $this->lastresult = 0;
- }
-
-
- /*
- ** Perform a query for $q starting at $rank. Return true on success,
- ** false on error (no results is not an error)
- */
- function query($q, $rank=0)
- {
- global $it_text;
-
- if (is_object($it_text))
- $lang = "&lang=" . $it_text->get_language();
-
- $url = $this->service . "?q=" . urlencode($q) . "$lang&rank=$rank&n=" . $this->resultsperpage;
-
- /* debug("it_darwin::query(\"$url\",$rank)"); */
-
- if ($this->result = file($url))
- {
- $this->totalresults = trim($this->result[2]);
- $this->firstresult = trim($this->result[3]);
- $this->lastresult = trim($this->result[4]);
- $this->resptr = $this->firstresult;
- return 1;
- }
- return 0;
- }
-
- /* Fetch a result as an array "url", "title", "description", "size", "date" */
- function fetch_array($number="XX")
- {
- /* debug("fetch_array($number), resptr==$this->resptr"); */
- if ($number != "XX")
- $this->resptr = $number;
-
- if (($this->resptr >= $this->firstresult) && ($this->resptr <= $this->lastresult))
- {
- $n = 5+($this->resptr-$this->firstresult)*5; /* start of result record */
- $this->resptr+=1; /* Spinn ich?? ++ geht nicht !! */
- return array("url" => trim($this->result[$n]), "title" => trim($this->result[$n+1]), "description" => trim($this->result[$n+2]), "size" => trim($this->result[$n+3])*1024, "date" => trim($this->result[$n+4]));
- }
- else return 0; /* Out of bounds */
-
- }
-} /* End class it_darwin_query */
-?>
diff --git a/debug.class b/debug.class
index b4cb764..e33a339 100644
--- a/debug.class
+++ b/debug.class
@@ -164,7 +164,7 @@ function dump()
$r = str_repeat(" ", count(debug_backtrace())-3) . $r;
if (isset($_SERVER['REMOTE_ADDR']) && !$plain)
- return "<pre style='color:#c00; background-color:white; margin:0px'>$r</pre>\n";
+ return "<pre style='color:#c00; text-align:left; background-color:white; margin:0'>$r</pre>\n";
else
return "$r\n";
}
diff --git a/html.class b/html.class
index f23274b..a4657f2 100644
--- a/html.class
+++ b/html.class
@@ -24,11 +24,12 @@ class it_html
'name' => 'it_html', # Name of global variable to use
'oldhtml' => false,
'prettyprint' => false,
- 'tags' => 'a,br,form,h1,h2,h3,h4,img,input,li,meta,table,td,th,tr,ul',
+ 'tags' => 'a,br,form,h1,h2,h3,h4,input,li,meta,table,td,th,tr,ul',
'moretags' => '',
'nonewlinetags' => 'a,img,span',
'preprocess_attr' => array(),
'charset' => "iso-8859-1",
+ 'ie_png_fix' => false, # To enable, supply URL of a transparent gif (like /images/0.gif)
'show_content_type' => true,
'show_favicon' => true,
'show_boot_dom' => true,
@@ -137,17 +138,15 @@ function tag(/* $name, ... */)
$result = "<$name";
- # add attributes. If $value === null, use key only (<td nowrap> instead of <td nowrap=""> for old html, <td nowrap="nowrap"> for xhtml style)
+ # add attributes. If $value === true, use key only (<td nowrap> instead of <td nowrap=""> for old html, <td nowrap="nowrap"> for xhtml style)
foreach($attr as $key => $value)
{
- if ($value === false) # omit whole tag
+ if (($value === null) || ($value === false)) # null or false: omit whole tag
;
- else if (isset($value) && $value !== true)
- $result .= " $key=\"" . it_html::Q($value) . '"';
- else if ($this->_oldhtml)
- $result .= " $key";
- else
- $result .= " $key=\"$key\"";
+ else if (isset($value) && $value !== true) # normal case: value
+ $result .= " $key=\"" . str_replace("\n", "&#10;", it_html::Q($value)) . '"';
+ else # true: tag without value
+ $result .= $this->_oldhtml ? " $key" : " $key=\"$key\"";
}
# Apply a kind of magic... this needs further investigation
@@ -190,6 +189,30 @@ function div(/* $class, ... */)
/**
+ * Special img() function patches png transparency for IE 5.5-6 if ie_png_fix is set
+ * @param ... any number optional data or array of key => value arguments
+ * @return <img ... />
+ */
+function img(/* ... */)
+{
+ $args = func_get_args();
+
+ if ($this->_ie_png_fix && preg_match('/MSIE [56]/', $_SERVER['HTTP_USER_AGENT']))
+ {
+ foreach($args as $id => $arg)
+ if (preg_match('/\.png(\?.*)?$/', $arg['src']))
+ {
+ $args[$id]['style'] = "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{$arg['src']}',sizingMethod='scale');" . $arg['style'];
+ $args[$id]['src'] = $this->_ie_png_fix;
+ }
+ }
+
+ array_unshift($args, 'img');
+ return call_user_func_array(array(&$this, 'tag'), $args);
+}
+
+
+/**
* Shortcut: return a span of a specific class
* @param $class class name or null for no class= tag
* @param ... any number optional data or array of key => value arguments
@@ -217,7 +240,7 @@ function Q($string)
if ($GLOBALS['it_html']->_charset == "iso-8859-1")
$string = preg_replace('/[\x80-\x9f]/', ' ', strtr($string, array("\x80"=>"EUR", "\x82"=>"'", "\x84"=>"\"", "\x85"=>"...", "\x8a"=>"S", "\x8c"=>"OE", "\x8e"=>"Z", "\x91"=>"'", "\x92"=>"'", "\x93"=>"\"", "\x94"=>"\"", "\x96"=>"-", "\x97"=>"-", "\x9a"=>"s", "\x9e"=>"z")));
- return str_replace("\n", "&#10;", htmlspecialchars($string));
+ return htmlspecialchars($string);
}
@@ -274,13 +297,14 @@ function U(/* ... */)
/**
- * Create a dropdown menu object
+ * Create a dropdown menu object. Warning: encodes html code within options!
* @param $tags key => value pairs of <select> tag
* @param $options array (value => text) of available options or
* string key:val{,key:val} where key will be rawurldecoded so it may contain %2C as comma
+ * supports optgroups as array (value => optgroup => array(value => text))
* @param $selected optional currently selected value
*/
-function select($tags, $options, $selected = '')
+function select($tags, $options, $selected = null)
{
# Transmogrify key:val{,key:val} to array(key => val)
if (!is_array($options))
@@ -295,9 +319,19 @@ function select($tags, $options, $selected = '')
}
}
- $html = '';
- foreach($options as $value => $text)
- $html .= '<option value="'.it_html::Q($value).'"'.(($value == $selected) ? ($this->_oldhtml ? ' selected' : ' selected="selected"') : '').'>'.(trim($text) === "" ? "&nbsp;" : it_html::Q($text))."</option>\n";
+ $html = "";
+ foreach($options as $value => $option)
+ {
+ if (is_array($option))
+ {
+ $grouphtml = "";
+ foreach($option as $optval => $opt)
+ $grouphtml .= $this->tag('option', 'value' => $optval, 'selected' => isset($selected) ? $optval == $selected : false, it_html::Q($opt));
+ $html .= $this->tag('optgroup', 'label' => $value, $grouphtml);
+ }
+ else
+ $html .= $this->tag('option', 'value' => $value, 'selected' => isset($selected) ? $value == $selected : false, 'disabled' => $option === "", (trim($option) === "") ? "&nbsp;" : it_html::Q($option));
+ }
return $this->tag('select', $tags, $html);
}
@@ -386,7 +420,7 @@ function itjs(/* ... */)
* Return HTML header with correct doctype.
*
* @param any number of text args or array of key => value:
- * 'title' HTML title tag
+ * 'title' optional HTML title tag
* 'content-type' optional content type (default: "text/html; charset=iso-8859-1")
* 'description' optional data for <meta name="description"> tag
* 'doctype' optional <!DOCTYPE HTML PUBLIC...> tag
@@ -434,7 +468,9 @@ function head(/* ... */)
);
$header = $p['show_content_type'] ? meta(array('http-equiv' => "Content-Type", 'content' => $p['content-type'])) : "";
- $header .= tag('title', it_html::Q($p['title']));
+
+ if (isset($p['title']))
+ $header .= tag('title', it_html::Q($p['title']));
foreach(array('description', 'keywords') as $name)
if (!empty($p[$name]))
@@ -466,7 +502,7 @@ function head(/* ... */)
if ($p['js'])
{
$js .= $this->itjs("boot.js", array('mode' => "inline"));
- $js .= "function it_boot_init(){ window.clearTimeout(window.it_panictimer); " . trim($p['jsboot']) . " }\n";
+ $js .= "function it_boot_start(){ " . trim($p['jsboot']) . " }\n";
$js .= "it_boot('/itjs/" . $p['js'] . "');\n";
}
diff --git a/it.class b/it.class
index 2dad792..4f561c6 100644
--- a/it.class
+++ b/it.class
@@ -4,7 +4,7 @@
**
** ITools - the Internet Tools Library
**
-** Copyright (C) 1995-2004 by the ITools Authors.
+** Copyright (C) 1995-2006 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
@@ -45,6 +45,21 @@ function log($name /* ... */)
/**
+ * Store timings for appending to log/timer_log-* in auto_append.php
+ */
+function timerlog($label = '')
+{
+ if ($GLOBALS['debug_timerlog'])
+ {
+ $s = $GLOBALS['ULTRATIME'];
+ $e = gettimeofday();
+ $msec= ($e['sec'] - $s['sec']) * 1000 + ($e['usec'] - $s['usec']) / 1000;
+ $GLOBALS['ULTRATIMERLOG'] .= sprintf(" %s:%d", $label, $msec);
+ }
+}
+
+
+/**
* Send error report either to browser (on devel/twin machines) or by email to .diffnotice guys
* @parma $title (optional) error title, one line
* @param $body (optional) error body, multiline
diff --git a/itjs.class b/itjs.class
index ac56032..e5c0b25 100644
--- a/itjs.class
+++ b/itjs.class
@@ -17,6 +17,17 @@ class itjs
{
/**
+ * Send HTTP headers (content-type) to transmit javascript code
+ */
+function send_headers()
+{
+ if (!preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT'])) # text/plain breaks Opera 8.51/Linux
+ header('Content-Type: text/plain; charset=iso-8859-1'); # Berni reported some Firewalls to require this
+
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time()+10) . ' GMT'); # prevent broken data on IE reloads
+}
+
+/**
* Serialize the result into a javascript script
* @param $values Array with values to be serialized
* @param $callback Javascript function to call with data (iframe solution)
@@ -38,7 +49,7 @@ function serialize($values)
*/
function encode($values)
{
- $texts = ($values === array_values($values)) ? "[]0" : "{}1"; # Numerical or associative array
+ $texts = ($values === array_values($values)) ? "[]0 " : "{}1\n"; # Numerical or associative array
$result = $texts{0};
@@ -62,7 +73,7 @@ function encode($values)
else
$result .= itjs::encode($value);
- $separator = ",\n";
+ $separator = "," . $texts{3};
}
$result .= $texts{1};
diff --git a/itjs/boot.js b/itjs/boot.js
index 78d1fd1..a0ec24f 100644
--- a/itjs/boot.js
+++ b/itjs/boot.js
@@ -1,6 +1,6 @@
// $Id$
-var it_boot_status = "";
+var it_boot_status = "boot";
var it_panictimer = window.setTimeout("it_panic(it_boot_status)", 31337);
var it_catcherrstart = new Date().getTime();
@@ -34,7 +34,9 @@ function it_boot_addparam(url, param)
function it_panic(msg)
{
- window.setTimeout("document.location.href = it_boot_addparam(document.location.href, 'static=" + msg + "')", 500);
+ if (!document.location.href.match(/[?&]static=/)) // Avoid loop
+ window.setTimeout("document.location.href = it_boot_addparam(document.location.href, 'static=" + msg + "')", 500);
+
return it_catcherr('panic ' + msg, '-', -1);
}
@@ -47,7 +49,12 @@ function it_boot_report(msg, file, line, error)
new Image().src = "/itjs/error.gif/" + escape(msg) + "|" + escape(file) + "|" + line + "|" + (new Date().getTime() - it_catcherrstart) + "|" + escape(error);
}
-function it_boot(file, isretry)
+function it_boot_checkcss(style, key, value)
+{
+ return navigator.userAgent.match(/konqueror/i) || (style && style.getPropertyValue && (style.getPropertyValue(key) == value));
+}
+
+function it_boot_init()
{
window.it_domtimer = null;
var konqueror = navigator.userAgent.match(/konqueror/i);
@@ -55,12 +62,12 @@ function it_boot(file, isretry)
var dom = doc && (dom = document.getElementById('it_boot_dom')); // HTML has been rendered
var view = dom && doc.defaultView; // We can check if stylesheet is active
var style = view && view.getComputedStyle && view.getComputedStyle(dom, '');
- var css = style && style.getPropertyValue && ((style.getPropertyValue("visibility") == "hidden") || konqueror); // CSS active (inline style on tag)
- var stylesheet = style && style.getPropertyValue && ((style.getPropertyValue("display") == "none") || konqueror); // External stylesheet loaded
+ var css = window.it_boot_checkcss(style, "visibility", "hidden"); // CSS active (inline style on tag)
+ var stylesheet = window.it_boot_checkcss(style, "display", "none"); // External stylesheet loaded
- if (!(doc || !(it_boot_status = "doc")) || !(dom || !(it_boot_status = "dom")) || (style && (style.length > 0) && !(stylesheet || !(it_boot_status = "stylesheet"))))
+ if (!(doc || !(it_boot_status = "doc")) || !(dom || !(it_boot_status = "dom")) || (style && !(stylesheet || !(it_boot_status = "stylesheet"))))
{
- window.it_domtimer = window.setTimeout("it_boot('" + file + "')" , 42);
+ window.it_domtimer = window.setTimeout("it_boot_init()" , 42);
if (style && !css)
it_panic("css");
@@ -68,6 +75,12 @@ function it_boot(file, isretry)
return;
}
+ window.clearTimeout(window.it_panictimer);
+ window.it_boot_start();
+}
+
+function it_boot(file, isretry)
+{
try
{
var loader = new XMLHttpRequest();
@@ -97,7 +110,7 @@ function it_boot(file, isretry)
if (data.code.length == data.len)
{
- var code = "try {" + data.code + ";window.it_boot_init()} catch (e) { it_boot_report('Load error', '-', -1, e); }"; // Wrapped in try/catch as Konqueror does not support window.onerror
+ var code = "try {" + data.code + "} catch (e) { it_boot_report('Load error', '-', -1, e); };window.it_boot_init()"; // Wrapped in try/catch as Konqueror does not support window.onerror
isretry = true; // No further retry after this point
if (window.execScript)
diff --git a/license/.cvsignore b/license/.cvsignore
deleted file mode 100644
index a5abf2f..0000000
--- a/license/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-license.slib
diff --git a/license/Makefile b/license/Makefile
deleted file mode 100644
index 0aa63bd..0000000
--- a/license/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-##
-## $Id$
-##
-## Makefile for itools/license.lib
-##
-## $Log$
-## Revision 1.1 2000/07/13 19:10:19 weber
-## Added licensing suite
-##
-
-CPP= cpp
-QUIETMAKE= $(MAKE) -s
-PHPCOMPILE= /usr/local/bin/phpcompile
-
-MODULE= license
-SUBDIRS=
-CLASSES= license.class
-
-#
-# Library creation rules, do not change stuff below...
-#
-SLIB= $(MODULE).slib
-LIB= ../$(MODULE).lib
-
-all: $(LIB)
-
-$(LIB): $(SLIB)
- @if [ -x $(PHPCOMPILE) ]; then (echo Compiling $(SLIB) to $(LIB) ...) 1>&2; $(PHPCOMPILE) <$(SLIB) >$(LIB); else (echo $(PHPCOMPILE) not found, copying $(SLIB) to $(LIB) ...) 1>&2; cp $(SLIB) $(LIB); fi
-
-$(SLIB): $(CLASSES) DUMMY
- @(echo Creating $(SLIB) from $(SUBDIRS) $(CLASSES) ...) 1>&2
- @echo "<?php" >$(SLIB)
- @(for dir in DUMMY $(SUBDIRS); do (test -d $$dir && cd $$dir && $(QUIETMAKE) cat); done; for class in DUMMY $(CLASSES); do test -f $$class && cat $$class; done) | $(CPP) -P -undef | perl -ne 's/^\s+//g; print unless /^\s*$$/' | grep -v "^<?php" | grep -v "^?>" >>$(SLIB)
- @echo "?>" >>$(SLIB)
-
-$(SUBDIRS)::
- @(cd $@; $(QUIETMAKE))
-
-DUMMY:
-
-cat: $(SLIB)
- @cat $(SLIB)
-
-clean:
- @(echo Cleaning $(SLIB) $(LIB) ...) 1>&2
- @rm -f $(SLIB) $(LIB)
- @for dir in DUMMY $(SUBDIRS); do (test -d $$dir && cd $$dir && $(QUIETMAKE) $@) || :; done
diff --git a/license/license.class b/license/license.class
index 83a71a5..c915c3a 100644
--- a/license/license.class
+++ b/license/license.class
@@ -5,14 +5,6 @@
** Relog Internet Tools 3 Library ("ITOOLS3")
**
** it_license.class - Handle software licensing
-**
-** $Log$
-** Revision 1.2 2000/07/13 19:16:29 daenzer
-** cosmetic changes
-**
-** Revision 1.1 2000/07/13 19:10:19 weber
-** Added licensing suite
-**
*/
/**
diff --git a/sms.lib b/sms.lib
deleted file mode 100644
index 98e2b62..0000000
--- a/sms.lib
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-require('sms/sms.class');
-?>
diff --git a/sms/Makefile b/sms/Makefile
deleted file mode 100644
index 33cd428..0000000
--- a/sms/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-##
-## $Id$
-##
-## Makefile for itools/sms.lib
-##
-## $Log$
-## Revision 1.1 2000/01/10 23:04:09 weber
-## SMS functions added
-##
-
-CPP= cpp
-QUIETMAKE= $(MAKE) -s
-PHPCOMPILE= /usr/local/bin/phpcompile
-
-MODULE= sms
-SUBDIRS=
-CLASSES= sms.class
-
-#
-# Library creation rules, do not change stuff below...
-#
-SLIB= $(MODULE).slib
-LIB= ../$(MODULE).lib
-
-all: $(LIB)
-
-$(LIB): $(SLIB)
- @if [ -x $(PHPCOMPILE) ]; then (echo Compiling $(SLIB) to $(LIB) ...) 1>&2; $(PHPCOMPILE) <$(SLIB) >$(LIB); else (echo $(PHPCOMPILE) not found, copying $(SLIB) to $(LIB) ...) 1>&2; cp $(SLIB) $(LIB); fi
-
-$(SLIB): $(CLASSES) DUMMY
- @(echo Creating $(SLIB) from $(SUBDIRS) $(CLASSES) ...) 1>&2
- @echo "<?php" >$(SLIB)
- @(for dir in DUMMY $(SUBDIRS); do (test -d $$dir && cd $$dir && $(QUIETMAKE) cat); done; for class in DUMMY $(CLASSES); do test -f $$class && cat $$class; done) | $(CPP) -P -undef | perl -ne 's/^\s+//g; print unless /^\s*$$/' | grep -v "^<?php" | grep -v "^?>" >>$(SLIB)
- @echo "?>" >>$(SLIB)
-
-$(SUBDIRS)::
- @(cd $@; $(QUIETMAKE))
-
-DUMMY:
-
-cat: $(SLIB)
- @cat $(SLIB)
-
-clean:
- @(echo Cleaning $(SLIB) $(LIB) ...) 1>&2
- @rm -f $(SLIB) $(LIB)
- @for dir in DUMMY $(SUBDIRS); do (test -d $$dir && cd $$dir && $(QUIETMAKE) $@) || :; done
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