Source for file RSDEngineDBApplicationLogoutFile.php

Documentation is available at RSDEngineDBApplicationLogoutFile.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 RSDEngineDBApplicationLogoutFile.
20 *
21 * @package RSDEngine
22 * @author Lukas Feiler <lukas.feiler@chello.at>
23 * @copyright Lukas Feiler 2003
24 * @filesource
25 */
26
27 /**RSDEngineDBApplicationLogoutFile extends RSDEngineFile.
28 */
29 require_once('RSDEngine/RSDEngineFile.php');
30
31
32 /**Generates a file called logout.php to be put in the code directory.
33 *
34 * Requesting logout.php with a browser destroys your session and logs you out.
35 * It should only be generated for database backended applications.
36 *
37 * @author Lukas Feiler <lukas.feiler@chello.at>
38 * @version 0.1.9
39 * @copyright Lukas Feiler 2003
40 * @package RSDEngine
41 */
42 class RSDEngineDBApplicationLogoutFile extends RSDEngineFile{
43
44 /**Returns the filename of this logout file.
45 * @return String The string "logout.php" will be returned.
46 */
47 function getFilename()
48 {
49 return "logout.php";
50 }
51
52 /**Returns the code for the file logut.php.
53 *
54 * This file performs the logout of a user by calling the method logout() in the application class.
55 * Note that this method requires $this->config to be correctly
56 * filled with all configuration options of the RSDEngine.
57 * @see config
58 *
59 * @return String The code for logout.php.
60 */
61 function getCode()
62 {
63 extract($this->config);
64 $authors = RSArrayUtil::toString(split("\n",$authors),"\n",'* @author %val');
65 $appInstanceName = $this->relatedClasses['dbApplicationClass']->getInstanceName();
66
67 $write = $this->config['writeLogoutFile'];
68 $this->setWrite($write);
69
70 $data = '';
71 $data .="<?php\n" .
72 '/' . "**This file performs the logout of a user by calling \$${appInstanceName}->logout().\n" .
73 '*' . "\n" .
74 $authors . "\n" .
75 '* @copyright ' . $copyright . "\n" .
76 '* @package ' . $projectName . "\n" .
77 '* @filesource' . "\n" .
78 '*/' . "\n" .
79 "\n" .
80 '/' . '**Only a logged in user can log out.' . "\n" .
81 "*/\n";
82 if ($webApplication) {
83 $data .= "require_once('model/" . $this->relatedFiles['dbApplicationPrivateInitFile']->getFilename() . "');\n";
84 } else {
85 $data .= "require_once('" . $this->relatedFiles['dbApplicationPrivateInitFile']->getFilename() . "');\n";
86 }
87 $data .="\n" .
88 "\$${appInstanceName}->logout();\n" .
89 "?>\n" .
90 "PRIVATE";
91 return $data;
92 }
93 }
94 ?>

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