Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
3 lars 1
<?php
2
/* $Id: Weban_Shop.class.php 8 2007-04-24 14:17:50Z markus $ */
3
 
4
/**
5
 * Shop module class. This builds the Base class for
6
 * the shop module and is created for further updates.
7
 *
8
 * This class handles the traffic between a client and the
9
 * server. My clou is to put any used Function in a Method
10
 * formate and replace them with the original.
11
 *
12
 * PHP versions 4 and 5
13
 *
14
 * LICENSE: This source file is subject to version 3.0 of the PHP license
15
 * that is available through the world-wide-web at the following URI:
16
 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
17
 * the PHP License and are unable to obtain it through the web, please
18
 * send a note to license@php.net so we can mail you a copy immediately.
19
 *
20
 * @category   Shop
21
 * @package    Error
22
 * @author     Markus Niewerth <markus@weban.de>
23
 * @copyright  1997-2005 The PHP Group
24
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
25
 * @since      File available since Release 1.0.1
26
 */
27
 
28
 
29
// {{{ constants
30
 
31
 
32
// }}}
33
// {{{ GLOBALS
34
 
35
 // -------------------
36
 // IF any put in here!
37
 // -------------------
38
 
39
// }}}
40
// {{{ Error
41
 
42
/**
43
 * Dies bildet die Basis Klasse f�r das Shop Modul.
44
 *
45
 * Diese Klasse bildet die Schnittstelle zwischen dem Client
46
 * und dem Server und wird die Funktionssyntax abl�sen.
47
 * Neue Funktionen werden nur noch in Form von Methoden
48
 * implementiert. Alle �lteren Funktionen sollten wenn m�glich
49
 * hier als Methoden implementiert werden.
50
 *
51
 * Funktionen k�nnen aber auch in einer Sammlung gekapselt
52
 * werden. So, dass sie zum Beispiel eine eigene Klasse bilden
53
 * (sinnvoll bei Datenbank Funktionen)
54
 *
55
 * @category   CMS
56
 * @package    Error
57
 * @author     Markus Niewerth 	<markus@weban.de>
58
 * @author     Lars Tiefland 	<tiefland@weban.de>
59
 * @copyright  1997-2007 Webagentur Niewerth
60
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
61
 * @link       http://server2/intranet/3_0.txt
62
 * @see        Functions
63
 * @since      Class available since Release 1.1
64
 */
65
 
66
class Error {
67
 
68
	// {{{ properties
69
 
70
	/**
71
	 * The Shops ID number.
72
	 *
73
	 * Its a very important ID, cause the
74
	 * ID is saved in any userdefined data-
75
	 * base entry like articles a.s.o.
76
	 *
77
	 * @var int
78
     */
79
	var $shopsId;
80
 
81
	/**
82
	 * The Shop language.
83
	 *
84
	 * The Base language is DE. Note that this
85
	 * value could be mixed! But stadard is DE
86
	 *
87
	 * @var 	array
88
     */
89
	var $language;
90
 
91
	var $errortype;
92
 
93
	// }}}
94
	// {{{ Error()
95
 
96
	/**
97
	 * Base Constructor
98
	 *
99
	 * @param 	object
100
	 * @param 	object
101
	 * @return	Weban_Shop
102
     */
103
	function Error ($shopsId, $language, $_ereporting=0)
104
	{
105
		//error_reporting($_ereporting);
106
 
107
		$this->shopsId 	= $shopsId;
108
		$this->language = $language;
109
 
110
	}
111
	// }}}
112
 
113
	function errorHandler
114
	(
115
		$errno		= E_USER_ERROR,
116
		$errmsg		= 'Userdefined Error Message',
117
		$filename	= __FILE__,
118
		$linenum	= __LINE__,
119
		$vars		= NULL,
120
		$adminmail	= 'markus@weban.de',
121
		$logfile	= "weban_shop_error%s.log",
122
		$logdir		= "/logs/php/"
123
	)
124
	{
125
		$identifier	= date("j-m-y");
126
		$logdir 	= $_SESSION['INI']['DOCUMENT_ROOT'].$logdir.$identifier."/";
127
 
128
		if (!@is_dir($logdir)) {
129
			@mkdir($logdir,0777);
130
		}
131
 
132
		$logfile = sprintf($logdir.$logfile,$identifier);
133
 
134
		$vars 	 = ($vars==NULL) ? $GLOBALS : $vars;
135
		$_error  = &new Error_Object($errno, $errmsg, $filename, $linenum, $vars, $adminmail, $logfile);
136
		return $_error;
137
	}
138
 
139
	function isError($_obj)
140
	{
141
		if ( get_class ($_obj) === 'error_object' )
142
			return true;
143
 
144
		return false;
145
	}
146
 
147
	function printErrors()
148
	{
149
		$_walk=1;
150
		$_ret=NULL;
151
		if (!isset($GLOBALS['ErrorMessages']))
152
		{
153
			return;
154
		} else {
155
			if (sizeof($GLOBALS['ErrorMessages'])>0)
156
			{
157
				foreach ($GLOBALS['ErrorMessages'] AS $_tmpMsg)
158
				{
159
					$_ret .= $_walk++. ". " .$_tmpMsg. "<br>";
160
				}
161
			}
162
		}
163
		return $_ret;
164
	}
165
}
166
// }}}
167
 
168
/*
169
 * Local variables:
170
 * tab-width: 4
171
 * c-basic-offset: 4
172
 * c-hanging-comment-ender-p: nil
173
 * End:
174
 */
175
?>