Source for file RSDEngineDBApplicationPublicInitFile.php

Documentation is available at RSDEngineDBApplicationPublicInitFile.php


1 <?php
2 // RSDEngine: The Rapid and Secure Development Engine
3 // Copyright (C) 2003 Lukas Feiler
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 /**Contains just the class RSDEngineDBApplicationPublicInitFile.
20 *
21 * @package RSDEngine
22 * @author Lukas Feiler <lukas.feiler@chello.at>
23 * @copyright Lukas Feiler 2003
24 * @filesource
25 */
26
27 /**RSDEngineDBApplicationPublicInitFile extends RSDEngineFile.
28 */
29 require_once('RSDEngine/RSDEngineFile.php');
30
31
32 /**Generates the public init file.
33 *
34 * The public init file includes the init file generated by the class RSDEngineDBApplicationInitFile.
35 * It does not forces authentication (that's why it's public!). It should only be generated for
36 * applications that use authentication.
37 *
38 * @author Lukas Feiler <lukas.feiler@chello.at>
39 * @version 0.1.9
40 * @copyright Lukas Feiler 2003
41 * @package RSDEngine
42 */
43 class RSDEngineDBApplicationPublicInitFile extends RSDEngineFile{
44
45 /**Whether to overwrite an existing file. The default for this class is not to do so!
46 * @var boolean
47 */
48 var $overwriteExisting = false;
49
50
51 /**Returns the name of the public initialization file.
52 *
53 * In fact strtolower($this->config['projectName']) . "Init_public.php" is returned.
54 * @see config
55 *
56 * @return String The public initialization file name.
57 */
58 function getFilename()
59 {
60 return strtolower($this->config['projectName']) . "Init_public.php";
61 }
62
63 /**Returns the code of the public initialization file.
64 *
65 * Note that this method requires $this->config to be correctly
66 * filled with all configuration options of the RSDEngine.
67 * @see config
68 *
69 * @return String The code of the public initialization file.
70 */
71 function getCode()
72 {
73 extract($this->config);
74 $authors = RSArrayUtil::toString(split("\n",$authors),"\n",'* @author %val');
75 $projectNameUC = strtoupper($projectName);
76 $projectNameLC = strtolower($projectName);
77
78 $write = $this->config['writePublicInitFile'];
79 $this->setWrite($write);
80
81 $data = '';
82 $data .='/' . '**Every page that includes this file will NOT require authentication to access it.' . "\n" .
83 '*' . "\n" .
84 $authors . "\n" .
85 '* @copyright ' . $copyright . "\n" .
86 '* @package ' . $projectName . "\n" .
87 '* @filesource' . "\n" .
88 '*/' . "\n" .
89 "\n" .
90 '/' . "**Forcing authentication.\n" .
91 "*/\n" .
92 "define('${projectNameUC}_LIVEUSER_FORCE_AUTHENTICATION', false);\n" .
93 "\n" .
94 '/' . '**Initializing the project.' . "\n" .
95 "*/\n" .
96 "require_once('" . $this->relatedFiles['dbApplicationInitFile']->getFilename() . "');";
97 return "<?php\n$data\n?>";
98 }
99 }
100 ?>

Documentation generated on Mon, 8 Dec 2003 13:11:06 +0100 by phpDocumentor 1.2.3