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    Database_Check
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
define('__DATABASE_CHECK_SQL_FILES_DIR__', 			'/usr/share/php/module/shop/includes/sqlfiles/');
31
 
32
 
33
// }}}
34
// {{{ GLOBALS
35
 
36
 // -------------------
37
 // IF any put in here!
38
 // -------------------
39
 
40
	/**
41
	 * Table Names
42
	 *
43
	 * Holds all tablenames that are needed
44
	 * for a 'redaktions system'
45
	 *
46
	 * @name tables
47
	 */
48
 
49
	 $GLOBALS['tables'] = array
50
	 (
51
		 'Aktionen' =>
52
 
53
			 array
54
			 (
55
			 	'ID' => 'int(4)'
56
			 ),
57
 
58
		 'Bestellung',
59
		 'Feature_options',
60
		 'Feature_to_Ware',
61
		 'Features',
62
		 'Herstellerkatalog',
63
		 'Logins',
64
		 'Logins_to_Verteiler',
65
		 'Preisagentur',
66
		 'Preisagentur_regEx',
67
		 'Verteiler',
68
		 'WarenTesterLogos',
69
		 'artikel',
70
		 'artikel_2_Aktionen',
71
		 'artikel_to_Bestellung',
72
		 'artikel_to_Preisagentur',
73
		 'artikel_to_WarenTesterLogos',
74
		 'banner',
75
		 'bannerPositionen',
76
		 'banner_to_bannerPositionen',
77
		 'counter',
78
		 'directory',
79
		 'eBay_Auktionen',
80
		 'eBay_AuktionsDaten',
81
		 'eBay_Bestellung',
82
		 'eBay_settings',
83
		 'news',
84
		 'shop_link_table',
85
		 'shop_log',
86
		 'shops',
87
		 'such_quelle',
88
		 'such_quelle_to_such_woerter',
89
		 'such_woerter',
90
		 'templates',
91
		 'templates_to_artikel',
92
		 'templates_to_directory',
93
		 'top_seller',
94
		 'top_seller_settings',
95
		 'top_seller_to_aufrufe',
96
		 'web_settings',
97
	 );
98
 
99
// }}}
100
// {{{ Weban_Shop
101
 
102
/**
103
 * Dies bildet die Basis Klasse f�r das Shop Modul.
104
 *
105
 * Diese Klasse bildet die Schnittstelle zwischen dem Client
106
 * und dem Server und wird die Funktionssyntax abl�sen.
107
 * Neue Funktionen werden nur noch in Form von Methoden
108
 * implementiert. Alle �lteren Funktionen sollten wenn m�glich
109
 * hier als Methoden implementiert werden.
110
 *
111
 * Funktionen k�nnen aber auch in einer Sammlung gekapselt
112
 * werden. So, dass sie zum Beispiel eine eigene Klasse bilden
113
 * (sinnvoll bei Datenbank Funktionen)
114
 *
115
 * @category   CMS
116
 * @package    Database_Check
117
 * @author     Markus Niewerth 	<markus@weban.de>
118
 * @author     Lars Tiefland 	<tiefland@weban.de>
119
 * @copyright  1997-2007 Webagentur Niewerth
120
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
121
 * @link       http://server2/intranet/3_0.txt
122
 * @see        Functions
123
 * @since      Class available since Release 1.1
124
 */
125
 
126
class Database_Check {
127
 
128
	// {{{ properties
129
 
130
	/**
131
	 * The Shops ID number.
132
	 *
133
	 * Its a very important ID, cause the
134
	 * ID is saved in any userdefined data-
135
	 * base entry like articles a.s.o.
136
	 *
137
	 * @var int
138
     */
139
	var $_databaseName;
140
 
141
	/**
142
	 * The Shops ID number.
143
	 *
144
	 * Its a very important ID, cause the
145
	 * ID is saved in any userdefined data-
146
	 * base entry like articles a.s.o.
147
	 *
148
	 * @var int
149
     */
150
	var $_tables;
151
 
152
	// }}}
153
	// {{{ Weban_Shop()
154
 
155
	/**
156
	 * Base Constructor
157
	 *
158
	 * @param 	object
159
	 * @param 	object
160
	 * @return	Weban_Shop
161
     */
162
	function Database_Check ($_databaseName=1, $_tables=array())
163
	{
164
		$this->_databaseName = $_databaseName;
165
		$this->_tables = ($_tables==array()) ? $GLOBALS['tables'] : $_tables;
166
	}
167
	// }}}
168
 
169
	function chksqldir()
170
	{
171
		if (!is_array($this->_tables))
172
			return false;
173
 
174
		foreach($this->_tables AS $_tblName)
175
		{
176
			$_fileName = __DATABASE_CHECK_SQL_FILES_DIR__.$_tblName;
177
			if (!is_dir($_fileName))
178
			{
179
				if (!@mkdir ($_fileName, 0700))
180
				{
181
					print("<hr>Error While Creating Sql Directory: $_fileName<hr>");
182
					$_ret['file_exists'][$_tblName] = 0;
183
					$_ret['sql_string'][$_tblName]  = 0;
184
				}  else {
185
					$_ret['file_exists'][$_tblName] = 1;
186
				}
187
			} else {
188
				$_ret['file_exists'][$_tblName] = 1;
189
			}
190
			$_ret['sql_string'][$_tblName]  = $this->getSqlCmd ($_fileName);
191
		}
192
		return $_ret;
193
	}
194
 
195
	function getSqlCmd ($_fileName)
196
	{
197
		return @file_get_contents($_fileName."/sql.php");
198
	}
199
 
200
}
201
// }}}
202
 
203
/*
204
 * Local variables:
205
 * tab-width: 4
206
 * c-basic-offset: 4
207
 * c-hanging-comment-ender-p: nil
208
 * End:
209
 */
210
?>