diff options
| -rw-r--r-- | .diffnotice | 6 | ||||
| -rw-r--r-- | .gitattributes | 2 | ||||
| -rw-r--r-- | .gitignore | 11 | ||||
| -rw-r--r-- | .notice | 0 | ||||
| -rw-r--r-- | Makefile | 68 | ||||
| -rw-r--r-- | banner.lib | 3 | ||||
| -rw-r--r-- | banner/.cvsignore | 2 | ||||
| -rw-r--r-- | banner/Makefile | 48 | ||||
| -rw-r--r-- | banner/banner.class | 289 | ||||
| -rw-r--r-- | browser.class | 126 | ||||
| -rw-r--r-- | config.class | 36 | ||||
| -rw-r--r-- | darwin/.cvsignore | 2 | ||||
| -rw-r--r-- | darwin/Makefile | 47 | ||||
| -rw-r--r-- | darwin/query.class | 95 | ||||
| -rw-r--r-- | db.class | 250 | ||||
| -rw-r--r-- | db_record.class | 520 | ||||
| -rw-r--r-- | db_table.class | 425 | ||||
| -rw-r--r-- | dbi.class | 450 | ||||
| -rw-r--r-- | debug.class | 180 | ||||
| -rw-r--r-- | fax.class | 127 | ||||
| -rw-r--r-- | html.class | 516 | ||||
| -rw-r--r-- | html_form.class | 166 | ||||
| -rw-r--r-- | html_page.class | 214 | ||||
| -rw-r--r-- | it.class | 133 | ||||
| -rw-r--r-- | itjs.class | 131 | ||||
| -rw-r--r-- | itjs.php | 57 | ||||
| -rw-r--r-- | itjs/boot.js | 136 | ||||
| -rw-r--r-- | itjs/error.gif | bin | 0 -> 43 bytes | |||
| -rw-r--r-- | itjs/it.js | 165 | ||||
| -rw-r--r-- | itjs/loader.js | 207 | ||||
| -rw-r--r-- | itjs/state.html | 29 | ||||
| -rw-r--r-- | itjs/state.js | 114 | ||||
| -rw-r--r-- | itjs/timer.js | 64 | ||||
| -rw-r--r-- | itools.lib | 22 | ||||
| -rw-r--r-- | license/.cvsignore | 1 | ||||
| -rw-r--r-- | license/Makefile | 47 | ||||
| -rw-r--r-- | license/license.class | 142 | ||||
| -rw-r--r-- | mail.class | 480 | ||||
| -rw-r--r-- | session.class | 231 | ||||
| -rw-r--r-- | sms.lib | 3 | ||||
| -rw-r--r-- | sms/Makefile | 47 | ||||
| -rw-r--r-- | sms/sms.class | 122 | ||||
| -rw-r--r-- | support.pinc | 226 | ||||
| -rw-r--r-- | text.class | 422 | ||||
| -rw-r--r-- | time.pinc | 139 | ||||
| -rw-r--r-- | url.class | 484 | ||||
| -rw-r--r-- | urlcache/.cvsignore | 2 | ||||
| -rw-r--r-- | urlcache/Makefile | 48 | ||||
| -rw-r--r-- | urlcache/urlcache.class | 225 | ||||
| -rw-r--r-- | urlcache/urlcache.php | 28 | ||||
| -rw-r--r-- | urlcache/urlcache.sql | 14 | ||||
| -rw-r--r-- | user.class | 511 | ||||
| -rw-r--r-- | xml.class | 269 | 
53 files changed, 8082 insertions, 0 deletions
| diff --git a/.diffnotice b/.diffnotice new file mode 100644 index 0000000..41bcacd --- /dev/null +++ b/.diffnotice @@ -0,0 +1,6 @@ +schneider@search.ch +weber@search.ch +demesmaeker@search.ch +koni@search.ch +seefeld@search.ch +mueller@search.ch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9c7115f --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* text=auto !eol +itjs/error.gif -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..25c5961 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +/*.lib +/*.slib +banner/*.lib +banner/*.slib +darwin/*.lib +darwin/*.slib +license/license.slib +sms/*.lib +sms/*.slib +urlcache/*.lib +urlcache/*.slib diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1bdb140 --- /dev/null +++ b/Makefile @@ -0,0 +1,68 @@ +## +##	$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.lib b/banner.lib new file mode 100644 index 0000000..4de6252 --- /dev/null +++ b/banner.lib @@ -0,0 +1,3 @@ +<?php +require_once('banner/banner.class'); +?> diff --git a/banner/.cvsignore b/banner/.cvsignore new file mode 100644 index 0000000..b8e8856 --- /dev/null +++ b/banner/.cvsignore @@ -0,0 +1,2 @@ +*.slib +*.lib diff --git a/banner/Makefile b/banner/Makefile new file mode 100644 index 0000000..8e607aa --- /dev/null +++ b/banner/Makefile @@ -0,0 +1,48 @@ +## +##	$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 new file mode 100644 index 0000000..214fcb7 --- /dev/null +++ b/banner/banner.class @@ -0,0 +1,289 @@ +<?php + +/* + * $Id$ + * + */ + +class it_banner +{ + +function it_banner($p = array()) +{ +	$this->p = (array)$p + array( +		'server' => "http://localhost/", +		'serverbase' => "http://localhost/getbanner.html", +		'host' => $_SERVER['HTTP_HOST'], +		'uri' => str_replace('/doc_static', '', $_SERVER['PHP_SELF']), +		'place' => "", +		'language' => "", +		'keyword' => "", +		'category' => "", +		'region' => "", +		'vars' => array(), +		'ip' => $_SERVER['REMOTE_ADDR'], +		'uid' => $_COOKIE['UID'], +		'bgcolor' => "", +		'width' => "", +		'height' => "", +		'mx1' => "", +		'mx2' => "", +		'my1' => "", +		'my2' => "", +		'z' => "", +		'target' => "_top", +		'timeout' => 5, +		'uidcookie' => 'crustulum', +		'enablephpbanners' => false, +		'addextraline' => "", +		'bannerid' => $_REQUEST["bannerid"], +		'exclude' => $_REQUEST["exclude"], +	); + +	$this->p += array('loc' => $this->p['region']);	# Historical name +} + +function choose() +{ +	if ($GLOBALS['debug_noads']) +		return; + +	$host = 'localhost'; +	$port = 80; +	$url = '/'; + +	if (eregi('^[a-z]+://([^:/]+):([0-9]+)(.*)', $this->p['serverbase'], $regs)) +	{ +		$host = $regs[1]; +		$port = $regs[2]; +		$url = $regs[3]; +	} +	else if (eregi('^[a-z]+://([^:/]+)(.*)', $this->p['serverbase'], $regs)) +	{ +		$host = $regs[1]; +		$port = 80; +		$url = $regs[2]; +	} + +	if ($url == '') +		$url = '/'; + +	$params = array(); + +	foreach (array('host', 'uri', 'place', 'language', 'keyword', 'category', 'loc', 'mx1', 'mx2', 'my1', 'my2', 'z', 'ip', 'uid', 'bgcolor', 'bannerid', 'exclude') as $key) +		$params[$key] = $this->p[$key]; + +	$request .= it_html::U($url, $params); +	if ($GLOBALS['debug_adreq']) # can't use EDC since itools sometimes not included +		ED("http://$host$request"); + +	if ($fp = @fsockopen($host, $port, $errno, $errstr, $this->p['timeout'])) +	{ +		if ($this->p['uid']) +			$cookie = "Cookie: " . $this->p['uidcookie'] . "=" . urlencode($this->p['uid']) . "\r\n"; +		else +			$cookie = ''; + +		fputs($fp, "GET $request HTTP/1.0\r\nHost: $host\r\n$cookie\r\n"); + +		$b = array(); + +		while (!feof($fp)) +		{ +			$line = fgets($fp, 10240); + +			if (!trim($line)) +				$emptylines++; + +			if ($emptylines == 0) +				; +			else if (ereg("^data (.*)$", $line, $r)) +			{ +				$len = (int)$r[1]; +				$b['data'] = ''; + +				while (!feof($fp) && (strlen($b['data']) < $len)) +					$b['data'] .= fread($fp, $len - strlen($b['data'])); + +				if (strlen($b['data']) < $len) +					$b['data'] = ''; # Skip banners which got corrupted during transmission, very rare +			} +			else if (ereg("^([^ ]*) (.*)\n$", $line, $r)) +			{ +				$b[$r[1]] = $r[2]; +			} +			else if (ereg("^</banner>", $line)) +			{ +				# Doubleclick artificially delays banners for Mozilla/Linux so we do not show them to linux users +				if (!(eregi('linux', $_SERVER['HTTP_USER_AGENT']) && eregi('\.doubleclick\.net', $b['data']))) +				{ +					$this->bannersbyposition[$b['position'] ? $b['position'] : 'banner'] = $b; +					$this->banners[] = $b; +				} + +				$b = array(); +			} +		} + +		if ($GLOBALS['debug_adreq']) # can't use EDC since itools sometimes not included +			ED($this->banners); +	} + +        srand((double)microtime()*1000000); +	$this->rand = rand(); +} + +/** + * Show one or all banners for this banner position + * @param $nocount Switch off impression counting of true for multiple display + * @param $noecho Switch off automatic display of HTML snipplet with echo + * @return HTML snipplet to insert banner(s) if $noecho is set, undefined otherwise + */ +function show($nocount = 0, $noecho = false) +{ +	if (!is_array($this->banners)) +		return; // none found or choose() not called yet + +	$count = count($this->banners); +	$number = 0; + +	if ($noecho) +		ob_start(); + +	foreach ($this->banners as $banner) +	{ +		$result .= $this->render($banner, $count, $number); +		$number++; +	} + +	if ($noecho) +	{ +		$result = ob_get_contents(); +		ob_end_clean(); +	} + +	return $result; +} + +/** + * Returns html code for a banner from a multi banner request + * @param $position Which position to return, e.g. 'feature' + * @param $nocount Suppress counting of this banner + */ +function showcombined($position = "banner", $nocount = false) +{ +	ob_start(); +	if ($this->bannersbyposition[$position]) +		$this->render($this->bannersbyposition[$position], 1, 0); +	$result = ob_get_contents(); +	ob_end_clean(); + +	return $result; +} + +/** + * Renders a banner, to be overloaded e.g. to render sponsor banners in a table + * @param $banner Opaque structure representing the banner + * @param $count Total number of banners, also number of times this method gets called + * @param $position Current banner number, from 0 to $count - 1 + */ +function render($banner, $count, $number) +{ +	if ($number > 0) +		echo "<br><br>"; + +	$this->render_banner($banner); +} + +/** + * Render one banner + * @param $banner Opaque banner structure to be rendered + */ +function render_banner($banner) +{ +	if ($banner['width'] <= 0) +		$banner['width'] = 468; +	if ($banner['height'] <= 0) +		$banner['height'] = 60; +	if ($this->p['width']) +		$banner['width'] = $this->p['width']; +	if ($this->p['height']) +		$banner['height'] = $this->p['height']; +	$l = $banner['locationid']; +	if (strlen($banner['matchingkeyword']) + strlen($banner['matchingcategory']) + strlen($banner['matchingregion']) + strlen($banner['language']) > 0) +		$l .= "|" . $banner['matchingkeyword']; +	if (strlen($banner['matchingcategory']) + strlen($banner['matchingregion']) + strlen($banner['language']) > 0) +		$l .= "|" . $banner['matchingcategory']; +	if (strlen($banner['matchingregion']) + strlen($banner['language']) > 0) +		$l .= "|" . $banner['matchingregion']; +	if (strlen($banner['language']) > 0) +		$l .= "|" . $banner['language']; +	$l = str_replace("/", "_", $l); + +	$rand = $this->rand; + +	$pathinfo = "/c=" . $banner['campaignid'] . ":" . urlencode($banner['campaignname']) . "/b=" . $banner['bannerid'] . ":" . urlencode($banner['bannername']) . "/l=" . urlencode($l); +	$nocountinfo = $nocount ? "/nocount=1" : ""; +	$viewpre = $this->p['server'] . "view.html$pathinfo$nocountinfo/img="; +	$clickpre = $this->p['server'] . "click.html$pathinfo/url="; +	$clickpreenc = urlencode($clickpre); +	$auditurl = $viewpre . "empty.gif"; + +	$keyword = $this->p['keyword']; +	$keyword = preg_replace('/<country_[^>]*>/', '', $keyword); +	$keyword = ereg_replace('\]\[', ' ', $keyword); +	$keyword = ereg_replace('^\[ +', '', $keyword); +	$keyword = ereg_replace(' +\]$', '', $keyword); +	$keywordhtml = htmlentities(substr($keyword, 0, 30)); +	$keywordurl = urlencode($keyword); + +	extract($this->p['vars'], EXTR_SKIP); + +	while (eregi("__([a-z]*)__", $banner['alttext'], $r)) +		$banner['alttext'] = str_replace($r[0], ${strtolower($r[1])}, $banner['alttext']); +	while (eregi("__([a-z]*)__", $banner['extraline'], $r)) +		$banner['extraline'] = str_replace($r[0], ${strtolower($r[1])}, $banner['extraline']); +	while (eregi("__([a-z]*)__", $banner['path'], $r)) +		$banner['path'] = str_replace($r[0], ${strtolower($r[1])}, $banner['path']); +	while (eregi("__([a-z]*)__", $banner['url'], $r)) +		$banner['url'] = str_replace($r[0], ${strtolower($r[1])}, $banner['url']); +	$viewurl = $viewpre . $banner['path']; +	$clickurl = $clickpre . $banner['url']; +	while (eregi("__([a-z]*)__", $banner['data'], $r)) +		$banner['data'] = str_replace($r[0], ${strtolower($r[1])}, $banner['data']); + +	switch ($banner['type']) +	{ +		case 0: +			if (eregi('&', $viewurl) && !eregi('&[a-z]+;', $viewurl)) +				$viewurl = htmlspecialchars($viewurl); + +			if (eregi('&', $clickurl) && !eregi('&[a-z]+;', $clickurl)) +				$clickurl = htmlspecialchars($clickurl); + +			if($banner['url'] != 'http://') +			{ +				$linkstart = "<a href=\"$clickurl\" target=\"" . urlencode($this->p['target']) . "\">"; +				$linkend   = "</a>"; +			} + +			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; + +			if (strlen($banner['extraline']) == 0 && $this->p['addextraline']) +				echo "<br> "; +		break; +		case 1: +			echo $banner['data']; +			break; +		case 2: +			if ($this->p['enablephpbanners']) +				eval("?>" . $banner['data']); +			break; +	} +} + +} +?> diff --git a/browser.class b/browser.class new file mode 100644 index 0000000..2018247 --- /dev/null +++ b/browser.class @@ -0,0 +1,126 @@ +<?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_Browser: Browser capability class +**	For a good list see http://www.msb.edu/dept/msbtc/waehner/browser/ +** +**	Inspired by browser.pinc,v 1.1.1.1 1999/03/23 14:51:39 bobak Exp +*/ + +/** + * Browser capabilities class + * var $Type		string: Browser type, "Netscape", "MSIE", "Konqueror" etc. + * var $Version		float:  Browser-Version x.y for all brands + * var $Platform	string: "Win95", "Macintosh", "Linux" ... may be wrong + * var $Language	string: Browser's language, "de", "en", ... or unset + * var $HTMLVersion	float:  Suported HTML version x.y + * var $JavaScript	bool:   Browser supports Javascript + * var $CSS		bool:   Browser supports Style sheets + * var $TextOnly	bool:   Browser supports only text, no graphics + */ +class it_browser +{ +	/* Generic attributes */ +	var $UserAgent;		/* string: Unparsed HTTP_USER_AGENT */ +	var $Type = '';		/* string: Browser type, "Netscape", "MSIE", etc. */ +	var $Version;		/* float:  Browser-Version x.y for all brands */ +	var $Platform;		/* string: "Win95", "Macintosh", "Linux" ... may be wrong */ +	var $Language;		/* string: Browser's language, "de", "en", ... or unset */ +	var $HTMLVersion=0;	/* float:  Suported HTML version x.y */ +	var $JavaScript=0;	/* bool:   Browser supports Javascript */ +	var $CSS=1;		/* int:    Style sheet level (0..3) */ +	var $TextOnly=0;	/* bool:   Browser supports only text, no graphics */ + +	/* Browser specific stuff (DEPRECATED, use generic attributes above) */ +	var $MSIE;		/* float:  Microsoft Internet Explorer Version or 0 */ +	var $NS;		/* float:  Netscape Navigator Version or 0 */ + +/** + * Constructor: Initializes public fields with browser capabilities + */ +function it_browser() +{ +	$this->UserAgent = $_SERVER['HTTP_USER_AGENT']; +	/* $this->UserAgent = "Mozilla/4.0 [de] (compatible; MSIE 5.0; Bill Gates 1.0; Windows 95)"; */ + +	/* Find "Mozilla/4.0" */ +	if (ereg("([^/]*)/([^ ]*)", $this->UserAgent, $regs)) +	{ +		$this->Type = $regs[1]; +		$this->Version = (double)$regs[2]; +	} + +	/* Find optional "(compatible; MSIE 3.0; Win95)" */ +	if (ereg("\((.*)\)", $this->UserAgent, $regs)) +	{ +		$optattr = split("; ", $regs[1]); +		if ($optattr[0] == "compatible") +		{ +			if (ereg("([^/]*)[/ ]([^/]*)", $optattr[1], $regs)) +			{ +				$this->Type = $regs[1]; +				$this->Version = (double)$regs[2]; +			} +			else $this->Type = $optattr[1]; +			$this->Platform = $optattr[count($optattr)-1]; +		} +		else +			$this->Platform = $optattr[0]; +	} + +	if ($this->Type == "Mozilla") +		$this->Type = "Netscape"; + +	/* Find optional "[de]" */ +	if (ereg("\[(.*)\]", $this->UserAgent, $regs)) +		$this->Language = $regs[1]; + +	/* And now for the browser capabilities ... */ +	if ($this->Type == "MSIE") +	{ +		$this->MSIE = $this->Version; +		$this->HTMLVersion = 4.0; +		$this->JavaScript  = 1; + +		if ($this->Version >= 4.0) +			$this->CSS = 2; +	} +	else if ($this->Type == "Opera") +	{ +		$this->Opera = $this->Version; +		if ($this->Version >= 3.5) +			$this->HTMLVersion = 4.0; +		else +			$this->HTMLVersion = 3.2; +		$this->JavaScript = 1; +	} +	else if ($this->Type == "Konqueror") +	{ +		$this->HTMLVersion = 4.0; +		$this->CSS = 2; +		$this->JavaScript = 1; +	} +	else if ($this->Type == "Netscape") +	{ +		$this->NS = $this->Version; +		$this->HTMLVersion = 4.0; +		$this->JavaScript = 1; + +		if ($this->Version >= 5.0) +			$this->CSS = 2; +	} +	else if ($this->Type == "Lynx") +		$this->TextOnly = 1; +} + +} /* End Class it_Browser */ +?> diff --git a/config.class b/config.class new file mode 100644 index 0000000..0998c28 --- /dev/null +++ b/config.class @@ -0,0 +1,36 @@ +<?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 new file mode 100644 index 0000000..b8e8856 --- /dev/null +++ b/darwin/.cvsignore @@ -0,0 +1,2 @@ +*.slib +*.lib diff --git a/darwin/Makefile b/darwin/Makefile new file mode 100644 index 0000000..d6c4aa1 --- /dev/null +++ b/darwin/Makefile @@ -0,0 +1,47 @@ +## +##	$Id$ +## +##	Makefile for itools/darwin.lib +## +##	$Log$ +##	Revision 1.1  2000/01/12 02:26:20  weber +##	Added darwin query class +## + +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 new file mode 100644 index 0000000..f0a5b7e --- /dev/null +++ b/darwin/query.class @@ -0,0 +1,95 @@ +<?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 = $resul |