1 |
1947
|
darkviper
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
5 |
|
|
*
|
6 |
|
|
* This program is free software: you can redistribute it and/or modify
|
7 |
|
|
* it under the terms of the GNU General Public License as published by
|
8 |
|
|
* the Free Software Foundation, either version 3 of the License, or
|
9 |
|
|
* (at your option) any later version.
|
10 |
|
|
*
|
11 |
|
|
* This program is distributed in the hope that it will be useful,
|
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
|
|
* GNU General Public License for more details.
|
15 |
|
|
*
|
16 |
|
|
* You should have received a copy of the GNU General Public License
|
17 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18 |
|
|
*/
|
19 |
|
|
|
20 |
|
|
/**
|
21 |
|
|
* AccessFile.php
|
22 |
|
|
*
|
23 |
|
|
* @category Core
|
24 |
|
|
* @package Core_Routing
|
25 |
2045
|
Luisehahne
|
* @subpackage Accessfiles
|
26 |
|
|
* @copyright Manuela v.d.Decken <manuela@isteam.de>
|
27 |
|
|
* @author Manuela v.d.Decken <manuela@isteam.de>
|
28 |
1947
|
darkviper
|
* @license http://www.gnu.org/licenses/gpl.html GPL License
|
29 |
|
|
* @version 0.0.1
|
30 |
2070
|
darkviper
|
* @revision $Revision$
|
31 |
|
|
* @lastmodified $Date$
|
32 |
1947
|
darkviper
|
* @since File available since 17.01.2013
|
33 |
2045
|
Luisehahne
|
* @description Single standard accessfile with additional var-entries
|
34 |
1947
|
darkviper
|
*/
|
35 |
|
|
class AccessFile {
|
36 |
|
|
|
37 |
|
|
/** int first private property */
|
38 |
2045
|
Luisehahne
|
protected $oReg = null;
|
39 |
|
|
protected $sAccessFilesRoot = ''; // basedir of the current AccessFile structure
|
40 |
|
|
protected $sFileName = ''; // filename and path from AccessFilesRoot (without extension)
|
41 |
|
|
protected $sFullFileName = ''; // full path and filename (without extension)
|
42 |
|
|
protected $sFileExtension = '.php'; // extension for all accessfiles (default: '.php')
|
43 |
|
|
protected $aVars = array(); // variables in accessfile
|
44 |
|
|
protected $aConsts = array(); // constants in accessfile
|
45 |
|
|
protected $iErrorNo = 0;
|
46 |
1947
|
darkviper
|
|
47 |
|
|
const VAR_STRING = 'string';
|
48 |
|
|
const VAR_BOOL = 'bool';
|
49 |
|
|
const VAR_BOOLEAN = 'bool';
|
50 |
|
|
const VAR_INT = 'int';
|
51 |
|
|
const VAR_INTEGER = 'int';
|
52 |
|
|
const VAR_FLOAT = 'float';
|
53 |
|
|
|
54 |
|
|
const FORCE_DELETE = true;
|
55 |
|
|
|
56 |
|
|
/**
|
57 |
|
|
* Constructor
|
58 |
2045
|
Luisehahne
|
* @param string $sAccessFilesRoot full path to the base directory of accessfiles-tree
|
59 |
|
|
* @param string $sFileName subdirectory and filename of the new access file from AccessFilesRoot<br />
|
60 |
|
|
* (indirect addressing (./ | ../) is not allowed here!!)
|
61 |
|
|
* @param integer $iPageId (default: 0) Id of the page or 0 for dummy files
|
62 |
|
|
* @throws AccessFileInvalidFilePathException
|
63 |
1947
|
darkviper
|
*/
|
64 |
2045
|
Luisehahne
|
public function __construct($sAccessFilesRoot, $sFileName, $iPageId = 0)
|
65 |
1947
|
darkviper
|
{
|
66 |
2045
|
Luisehahne
|
$this->oReg = WbAdaptor::getInstance();
|
67 |
|
|
$this->sFileExtension = $this->oReg->PageExtension;
|
68 |
|
|
// sanitize AccessFilesRoot
|
69 |
|
|
if (($sX = realpath($sAccessFilesRoot)) == false) {
|
70 |
|
|
throw new AccessFileInvalidFilePathException('invalid path for AccessFilesRoot given [ '.$sAccessFilesRoot.' ]');
|
71 |
1947
|
darkviper
|
}
|
72 |
2045
|
Luisehahne
|
$sAccessFilesRoot = rtrim(str_replace('\\', '/', $sX), '/').'/';
|
73 |
|
|
// check location of AccessFilesRoot
|
74 |
|
|
if (!preg_match('/^' . preg_quote($this->oReg->AppPath, '/') . '/siU', $sAccessFilesRoot)) {
|
75 |
|
|
throw new AccessFileInvalidFilePathException('tried to place AccessFilesRoot out of application path [ '.$sAccessFilesRoot.' ]');
|
76 |
|
|
}
|
77 |
|
|
$this->sAccessFilesRoot = $sAccessFilesRoot;
|
78 |
|
|
// sanitize Filename
|
79 |
|
|
$sFileName = preg_replace('/'.preg_quote($this->sFileExtension, '/').'$/', '', $sFileName);
|
80 |
|
|
$this->sFileName = ltrim(rtrim(trim(str_replace('\\', '/', $sFileName)), '/'), './');
|
81 |
|
|
if (preg_match('/\.\.+\//', $this->sFileName)) {
|
82 |
|
|
throw new AccessFileInvalidFilePathException('relative path (./ or ../) is not allowed in Filename!! [ '.$this->sFileName.' ]');
|
83 |
|
|
}
|
84 |
|
|
$this->sFullFileName = $this->sAccessFilesRoot . $this->sFileName;
|
85 |
|
|
$this->aVars['iPageId'] = intval($iPageId);
|
86 |
|
|
|
87 |
1947
|
darkviper
|
}
|
88 |
|
|
/**
|
89 |
|
|
* Set Id of current page
|
90 |
|
|
* @param integer PageId
|
91 |
|
|
*/
|
92 |
|
|
public function setPageId($iPageId)
|
93 |
|
|
{
|
94 |
|
|
$this->addVar('iPageId', $iPageId, $sType = self::VAR_INTEGER);
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
/**
|
98 |
|
|
* Add new variable into the vars list
|
99 |
|
|
* @param string name of the variable without leading '$'
|
100 |
|
|
* @param mixed Value of the variable (Only scalar data (boolean, integer, float and string) are allowed)
|
101 |
|
|
* @param string Type of the variable (use class constants to define)
|
102 |
|
|
*/
|
103 |
|
|
public function addVar($sName, $mValue, $sType = self::VAR_STRING)
|
104 |
|
|
{
|
105 |
2045
|
Luisehahne
|
$mValue = $this->sanitizeValue($mValue, $sType);
|
106 |
|
|
$this->aVars[$sName] = $mValue;
|
107 |
1947
|
darkviper
|
}
|
108 |
|
|
|
109 |
|
|
/**
|
110 |
|
|
* Add new constant into the constants list
|
111 |
|
|
* @param string name of the constant (upper case chars only)
|
112 |
|
|
* @param mixed Value of the variable (Only scalar data (boolean, integer, float and string) are allowed)
|
113 |
|
|
* @param string Type of the variable (use class constants to define)
|
114 |
2045
|
Luisehahne
|
* @throws AccessFileConstForbiddenException
|
115 |
1947
|
darkviper
|
* @deprecated constants are not allowed from WB-version 2.9 and up
|
116 |
|
|
*/
|
117 |
|
|
public function addConst($sName, $mValue, $sType = self::VAR_STRING)
|
118 |
|
|
{
|
119 |
2045
|
Luisehahne
|
if (version_compare($this->oReg->AppVersion, '2.9', '<'))
|
120 |
1947
|
darkviper
|
{
|
121 |
2045
|
Luisehahne
|
$mValue = $this->sanitizeValue($mValue, $sType);
|
122 |
|
|
$this->aConsts[strtoupper($sName)] = $mValue;
|
123 |
1947
|
darkviper
|
} else {
|
124 |
|
|
throw new AccessFileConstForbiddenException('define constants is not allowed from WB-version 2.9 and up');
|
125 |
|
|
}
|
126 |
|
|
}
|
127 |
|
|
|
128 |
1982
|
darkviper
|
/**
|
129 |
|
|
* Write the accessfile
|
130 |
2045
|
Luisehahne
|
* @throws AccessFileWriteableException
|
131 |
1982
|
darkviper
|
*/
|
132 |
1947
|
darkviper
|
public function write()
|
133 |
|
|
{
|
134 |
2045
|
Luisehahne
|
// full path and filename
|
135 |
|
|
$sFileName = $this->sFullFileName.$this->sFileExtension;
|
136 |
|
|
// remove AppPath from File for use in error messages
|
137 |
|
|
$sDisplayFilename = str_replace($this->oReg->AppPath, '', $sFileName);
|
138 |
|
|
// do not allow writing if PageId is missing!
|
139 |
|
|
if (!$this->aVars['iPageId']) {
|
140 |
|
|
throw new AccessFileWriteableException('Missing PageId for file [' . $sDisplayFilename . ']');
|
141 |
1947
|
darkviper
|
}
|
142 |
2045
|
Luisehahne
|
// build the content for the access file
|
143 |
|
|
$sContent = $this->buildFileContent($this->buildPathToIndexFile($sFileName));
|
144 |
|
|
// create path if file does not already exists
|
145 |
|
|
if (!file_exists($sFileName)) {
|
146 |
|
|
$this->createPath($sFileName);
|
147 |
1947
|
darkviper
|
}
|
148 |
2045
|
Luisehahne
|
// create new file or overwrite existing one
|
149 |
|
|
if (!file_put_contents($sFileName, $sContent)) {
|
150 |
|
|
throw new AccessFileWriteableException('Unable to write file [' . $sDisplayFilename . ']');
|
151 |
1947
|
darkviper
|
}
|
152 |
2045
|
Luisehahne
|
// do chmod if os is not windows
|
153 |
|
|
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
154 |
|
|
chmod($sFileName, $this->oReg->OctalFileMode);
|
155 |
1947
|
darkviper
|
}
|
156 |
|
|
}
|
157 |
|
|
|
158 |
2045
|
Luisehahne
|
/**
|
159 |
|
|
* searchParentPageId
|
160 |
|
|
* @param string $sAccessFilesRoot
|
161 |
|
|
* @param string $sFullFilePath
|
162 |
|
|
* @return int found page-id
|
163 |
|
|
* @description find first valid accessfile backwards in the parent line<br />
|
164 |
|
|
* or the start page if no parent is found.
|
165 |
|
|
*/
|
166 |
|
|
protected function searchParentPageId($sAccessFilesRoot, $sFullFilePath)
|
167 |
|
|
{
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
return $iPageId;
|
171 |
|
|
}
|
172 |
1947
|
darkviper
|
/**
|
173 |
|
|
* Rename an existing Accessfile
|
174 |
1949
|
darkviper
|
* @param string $sNewName the new filename without path and without extension
|
175 |
1947
|
darkviper
|
* @return boolean
|
176 |
2046
|
darkviper
|
* @throws AccessFileRenameException
|
177 |
1947
|
darkviper
|
*/
|
178 |
|
|
public function rename($sNewName)
|
179 |
|
|
{
|
180 |
2045
|
Luisehahne
|
// validate and sanitize new filename
|
181 |
|
|
$sPattern = '/(^'.preg_quote($this->sAccessFilesRoot, '/').'|^'.preg_quote($this->oReg->AppPath, '/')
|
182 |
|
|
. ')?([^\/]*?)(?:'.preg_quote($this->sFileExtension, '/').')?$/s';
|
183 |
|
|
if (!preg_match($sPattern, $sNewName, $aMatches)) {
|
184 |
|
|
// sorry, but the given filename is not valid!
|
185 |
|
|
throw new AccessFileRenameException('invalid filename [' . str_replace($this->oReg->AppPath, '', $sNewName) . ']');
|
186 |
1947
|
darkviper
|
}
|
187 |
2045
|
Luisehahne
|
$sOldFileName = $this->sFullFileName;
|
188 |
|
|
// $aMatches[sizeof($aMatches)-1] contains the new filename without extension only
|
189 |
|
|
$sNewFileName = preg_replace('/(^.*?)[^\/]*$/', '\1'.$aMatches[sizeof($aMatches)-1], $sOldFileName);
|
190 |
|
|
$sDisplayOldFileName = str_replace($this->oReg->AppPath, '', $sOldFileName);
|
191 |
|
|
$sDisplayNewFileName = str_replace($this->oReg->AppPath, '', $sNewFileName);
|
192 |
|
|
|
193 |
|
|
if (file_exists($sNewFileName.$this->sFileExtension) || file_exists($sNewFileName.'/')) {
|
194 |
|
|
// if new filename or directory already exists
|
195 |
|
|
throw new AccessFileRenameException('new file or new dirname already exists ['.$sDisplayNewFileName.'{'.$this->sFileExtension.'}]');
|
196 |
1947
|
darkviper
|
}
|
197 |
2045
|
Luisehahne
|
if (!is_writeable($sOldFileName.$this->sFileExtension)) {
|
198 |
|
|
// old file is not writable an can not be renamed
|
199 |
|
|
throw new AccessFileRenameException('file not exists or file is readonly ['.$sDisplayOldFileName.$this->sFileExtension.']');
|
200 |
1949
|
darkviper
|
}
|
201 |
|
|
$bSubdirRenamed = false; // set default value
|
202 |
2045
|
Luisehahne
|
if (file_exists($sOldFileName.'/')) { //
|
203 |
|
|
if (is_writeable($sOldFileName.'/')) {
|
204 |
|
|
if (!( $bSubdirRenamed = rename($sOldFileName.'/', $sOldFileName.'/'))) {
|
205 |
|
|
throw new AccessFileRenameException('unable to rename directory ['.$sDisplayOldFileName.'/] to ['.$sDisplayNewFileName.'/]');
|
206 |
1947
|
darkviper
|
}
|
207 |
1949
|
darkviper
|
} else {
|
208 |
2045
|
Luisehahne
|
throw new AccessFileRenameException('directory is not writeable ['.$sDisplayOldFileName.'/]');
|
209 |
1947
|
darkviper
|
}
|
210 |
|
|
}
|
211 |
1949
|
darkviper
|
// try to rename accessfile
|
212 |
2045
|
Luisehahne
|
if (!rename($sOldFileName.$this->sFileExtension, $sNewFileName.$this->sFileExtension)) {
|
213 |
|
|
if ($bSubdirRenamed) { rename($sNewFileName.'/', $sOldFileName.'/'); }
|
214 |
|
|
$sMsg = 'unable to rename file ['.$sDisplayOldFileName.$this->sFileExtension
|
215 |
|
|
. '] to ['.$sDisplayOldFileName.$this->sFileExtension.']';
|
216 |
|
|
throw new AccessFileRenameException($sMsg);
|
217 |
1947
|
darkviper
|
}
|
218 |
1949
|
darkviper
|
return true;
|
219 |
1947
|
darkviper
|
}
|
220 |
|
|
|
221 |
|
|
/**
|
222 |
|
|
* Delete the actual Accessfile
|
223 |
|
|
* @return boolean true if successfull
|
224 |
|
|
* @throws AccessFileIsNoAccessfileException
|
225 |
2045
|
Luisehahne
|
* @throws AccessFileWriteableException
|
226 |
1947
|
darkviper
|
*/
|
227 |
|
|
public function delete($bForceDelete = true)
|
228 |
|
|
{
|
229 |
2045
|
Luisehahne
|
$sFileName = $this->sFullFileName.$this->sFileExtension;
|
230 |
|
|
|
231 |
1947
|
darkviper
|
if (!AccessFileHelper::isAccessFile($sFileName)) {
|
232 |
|
|
throw new AccessFileIsNoAccessfileException('requested file is NOT an accessfile');
|
233 |
|
|
}
|
234 |
|
|
if (file_exists($sFileName) && is_writeable($sFileName))
|
235 |
|
|
{
|
236 |
2045
|
Luisehahne
|
if (is_writeable($this->sFullFileName)) {
|
237 |
|
|
AccessFileHelper::delTree($this->sFullFileName, AccessFileHelper::DEL_ROOT_DELETE);
|
238 |
1947
|
darkviper
|
}
|
239 |
|
|
unlink($sFileName);
|
240 |
|
|
$sFileName = '';
|
241 |
|
|
} else {
|
242 |
2045
|
Luisehahne
|
throw new AccessFileWriteableException('requested file not exists or permissions missing');
|
243 |
1947
|
darkviper
|
}
|
244 |
|
|
}
|
245 |
|
|
|
246 |
|
|
/**
|
247 |
|
|
* getFilename
|
248 |
|
|
* @return string path+name of the current accessfile
|
249 |
|
|
*/
|
250 |
|
|
public function getFileName()
|
251 |
|
|
{
|
252 |
2045
|
Luisehahne
|
return $this->sFullFileName.$this->sFileExtension;
|
253 |
1947
|
darkviper
|
}
|
254 |
|
|
|
255 |
|
|
/**
|
256 |
|
|
* getPageId
|
257 |
|
|
* @return integer
|
258 |
|
|
*/
|
259 |
|
|
public function getPageId()
|
260 |
|
|
{
|
261 |
2045
|
Luisehahne
|
return (isset($this->aVars['iPageId']) ? $this->aVars['iPageId'] : 0);
|
262 |
1947
|
darkviper
|
}
|
263 |
|
|
/**
|
264 |
|
|
* get number of the last occured error
|
265 |
|
|
* @return int
|
266 |
|
|
*/
|
267 |
|
|
public function getError()
|
268 |
|
|
{
|
269 |
2045
|
Luisehahne
|
return $this->iErrorNo;
|
270 |
1947
|
darkviper
|
}
|
271 |
|
|
/**
|
272 |
|
|
* set number of error
|
273 |
|
|
* @param type $iErrNo
|
274 |
|
|
*/
|
275 |
2045
|
Luisehahne
|
protected function setError($iErrNo = self::ERR_NONE)
|
276 |
1947
|
darkviper
|
{
|
277 |
2045
|
Luisehahne
|
$this->iErrorNo = $iErrNo;
|
278 |
1947
|
darkviper
|
}
|
279 |
|
|
/**
|
280 |
|
|
* Create Path to Accessfile
|
281 |
|
|
* @param string full path/name to new access file
|
282 |
2045
|
Luisehahne
|
* @throws AccessFileWriteableException
|
283 |
1947
|
darkviper
|
* @throws AccessFileInvalidStructureException
|
284 |
|
|
*/
|
285 |
2045
|
Luisehahne
|
protected function createPath($sFilename)
|
286 |
1947
|
darkviper
|
{
|
287 |
2045
|
Luisehahne
|
$sFilename = str_replace($this->sAccessFilesRoot, '', $sFilename);
|
288 |
|
|
$sPagesDir = $this->sAccessFilesRoot;
|
289 |
|
|
if (($iSlashPosition = mb_strrpos($sFilename, '/')) !== false) {
|
290 |
1947
|
darkviper
|
// if subdirs exists, then procceed extended check
|
291 |
|
|
$sExtension = preg_replace('/.*?(\.[a-z][a-z0-9]+)$/siU', '\1', $sFilename);
|
292 |
|
|
$sParentDir = mb_substr($sFilename, 0, $iSlashPosition);
|
293 |
2045
|
Luisehahne
|
if (file_exists($sPagesDir . $sParentDir)) {
|
294 |
1947
|
darkviper
|
if (!is_writable($sPagesDir . $sParentDir)) {
|
295 |
2045
|
Luisehahne
|
throw new AccessFileWriteableException('No write permissions for ' . $sPagesDir . $sParentDir);
|
296 |
1947
|
darkviper
|
}
|
297 |
2045
|
Luisehahne
|
} else {
|
298 |
1947
|
darkviper
|
// if parentdir not exists
|
299 |
2045
|
Luisehahne
|
if (file_exists($sPagesDir . $sParentDir . $sExtension)) {
|
300 |
1947
|
darkviper
|
// but parentaccessfile exists, create parentdir and ok
|
301 |
|
|
$iOldUmask = umask(0);
|
302 |
2045
|
Luisehahne
|
$bRetval = mkdir($sPagesDir . $sParentDir, $this->oReg->OctalDirMode);
|
303 |
1947
|
darkviper
|
umask($iOldUmask);
|
304 |
|
|
} else {
|
305 |
2045
|
Luisehahne
|
throw new AccessFileInvalidStructureException('invalid structure - missing file: ' . $sFilename);
|
306 |
1947
|
darkviper
|
}
|
307 |
|
|
if (!$bRetval) {
|
308 |
2045
|
Luisehahne
|
throw new AccessFileWriteableException('Unable to create ' . $sPagesDir . $sParentDir);
|
309 |
1947
|
darkviper
|
}
|
310 |
|
|
}
|
311 |
|
|
}
|
312 |
|
|
}
|
313 |
|
|
/**
|
314 |
|
|
* Sanitize value
|
315 |
|
|
* @param mixed Value to sanitize
|
316 |
|
|
* @param string Type of the variable (use class constants to define)
|
317 |
|
|
* @return string printable value
|
318 |
|
|
* @throws InvalidArgumentException
|
319 |
|
|
*/
|
320 |
2045
|
Luisehahne
|
protected function sanitizeValue($mValue, $sType)
|
321 |
1947
|
darkviper
|
{
|
322 |
|
|
$mRetval = '';
|
323 |
|
|
switch ($sType)
|
324 |
|
|
{
|
325 |
|
|
case self::VAR_BOOLEAN:
|
326 |
|
|
case self::VAR_BOOL:
|
327 |
|
|
$mRetval = (filter_var(strtolower($mValue), FILTER_VALIDATE_BOOLEAN) ? '1' : '0');
|
328 |
|
|
break;
|
329 |
|
|
case self::VAR_INTEGER:
|
330 |
|
|
case self::VAR_INT:
|
331 |
|
|
if (filter_var($mValue, FILTER_VALIDATE_INT) === false) {
|
332 |
|
|
throw new InvalidArgumentException('value is not an integer');
|
333 |
|
|
}
|
334 |
|
|
$mRetval = (string) $mValue;
|
335 |
|
|
break;
|
336 |
|
|
case self::VAR_FLOAT:
|
337 |
|
|
if (filter_var($mValue, FILTER_VALIDATE_FLOAT) === false) {
|
338 |
|
|
throw new InvalidArgumentException('value is not a float');
|
339 |
|
|
}
|
340 |
|
|
$mRetval = (string) $mValue;
|
341 |
|
|
break;
|
342 |
|
|
default: // VAR_STRING
|
343 |
|
|
$mRetval = '\'' . (string) $mValue . '\'';
|
344 |
|
|
break;
|
345 |
|
|
}
|
346 |
|
|
return $mRetval;
|
347 |
|
|
}
|
348 |
|
|
|
349 |
|
|
/**
|
350 |
|
|
* Calculate backsteps in directory
|
351 |
|
|
* @param string accessfile
|
352 |
|
|
*/
|
353 |
2045
|
Luisehahne
|
protected function buildPathToIndexFile($sFileName)
|
354 |
1947
|
darkviper
|
{
|
355 |
2045
|
Luisehahne
|
$iBackSteps = substr_count(str_replace($this->oReg->AppPath, '', $sFileName), '/');
|
356 |
1947
|
darkviper
|
return str_repeat('../', $iBackSteps) . 'index.php';
|
357 |
|
|
}
|
358 |
|
|
|
359 |
|
|
/**
|
360 |
|
|
* Build the content of the new accessfile
|
361 |
|
|
* @param string $sIndexFile name and path to the wb/index.php file
|
362 |
|
|
* @return string
|
363 |
|
|
*/
|
364 |
2045
|
Luisehahne
|
protected function buildFileContent($sIndexFile)
|
365 |
1947
|
darkviper
|
{
|
366 |
|
|
$sFileContent
|
367 |
|
|
= '<?php' . "\n"
|
368 |
1949
|
darkviper
|
. '// *** This file was created automatically by ' ."\n"
|
369 |
2045
|
Luisehahne
|
. '// *** ' . $this->oReg->AppName . ' Ver.' . $this->oReg->AppVersion
|
370 |
|
|
. ($this->oReg->AppServicePack != '' ? ' '.$this->oReg->AppServicePack : '')
|
371 |
|
|
. ' Rev.' . $this->oReg->AppRevision . "\n"
|
372 |
1949
|
darkviper
|
. '// *** on ' . date('c') . "\n"
|
373 |
|
|
. '//' . "\n"
|
374 |
|
|
. '// *** Warning *************************************' . "\n"
|
375 |
|
|
. '// *** Please do not manually change this file!' . "\n"
|
376 |
|
|
. '// *** It will be recreated from time to time and' . "\n"
|
377 |
|
|
. '// *** then all manual changes will get lost!!' . "\n"
|
378 |
|
|
. '// *************************************************' . "\n"
|
379 |
|
|
. '//' . "\n";
|
380 |
2045
|
Luisehahne
|
foreach ($this->aVars as $sKey => $sVar) {
|
381 |
1947
|
darkviper
|
$sFileContent .= "\t" . '$' . $sKey . ' = ' . $sVar . ';' . "\n";
|
382 |
|
|
}
|
383 |
2045
|
Luisehahne
|
foreach ($this->aConsts as $sKey => $sVar) {
|
384 |
1949
|
darkviper
|
$sFileContent .= "\t" . 'define(\'' . $sKey . '\', ' . $sVar . '); // ** deprecated command **' . "\n";
|
385 |
1947
|
darkviper
|
}
|
386 |
|
|
$sFileContent
|
387 |
1949
|
darkviper
|
.="\t" . 'require(\'' . $sIndexFile . '\');' . "\n"
|
388 |
2045
|
Luisehahne
|
. "\t" . 'exit();' . "\n"
|
389 |
1947
|
darkviper
|
. '// *************************************************' . "\n"
|
390 |
|
|
. '// end of file' . "\n";
|
391 |
|
|
return $sFileContent;
|
392 |
|
|
}
|
393 |
|
|
|
394 |
|
|
}
|
395 |
|
|
|
396 |
|
|
// end of class AccessFile
|
397 |
|
|
// //////////////////////////////////////////////////////////////////////////////////// //
|
398 |
|
|
/**
|
399 |
|
|
* AccessFileException
|
400 |
|
|
*
|
401 |
|
|
* @category WBCore
|
402 |
|
|
* @package WBCore_Accessfiles
|
403 |
|
|
* @author M.v.d.Decken <manuela@isteam.de>
|
404 |
|
|
* @copyright M.v.d.Decken <manuela@isteam.de>
|
405 |
|
|
* @license http://www.gnu.org/licenses/gpl.html GPL License
|
406 |
|
|
* @version 2.9.0
|
407 |
2070
|
darkviper
|
* @revision $Revision$
|
408 |
|
|
* @lastmodified $Date$
|
409 |
1947
|
darkviper
|
* @description Exceptionhandler for the Accessfiles and depending classes
|
410 |
|
|
*/
|
411 |
|
|
|
412 |
2045
|
Luisehahne
|
class AccessFileException extends AppException { }
|
413 |
|
|
class AccessFileInvalidStructureException extends AccessFileException { }
|
414 |
|
|
class AccessFileIsNoAccessfileException extends AccessFileException { }
|
415 |
1947
|
darkviper
|
class AccessFileConstForbiddenException extends AccessFileException { }
|
416 |
|
|
class AccessFileInvalidFilePathException extends AccessFileException { }
|
417 |
1949
|
darkviper
|
class AccessFileRenameException extends AccessFileException { }
|
418 |
2045
|
Luisehahne
|
class AccessFileWriteableException extends AccessFileException { }
|