1 |
<?php |
---|
2 |
/** |
---|
3 |
* SessionExpired Widget class |
---|
4 |
* |
---|
5 |
* @project CWC2 |
---|
6 |
* @revision $Id: |
---|
7 |
* @purpose SessionExpired Widget class |
---|
8 |
* @author DM Solutions Group (sfournier@dmsolutions.ca) |
---|
9 |
* @copyright |
---|
10 |
* <b>Copyright (c) 2002, DM Solutions Group Inc.</b> |
---|
11 |
* Permission is hereby granted, free of charge, to any person obtaining a |
---|
12 |
* copy of this software and associated documentation files (the "Software"), |
---|
13 |
* to deal in the Software without restriction, including without limitation |
---|
14 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
---|
15 |
* and/or sell copies of the Software, and to permit persons to whom the |
---|
16 |
* Software is furnished to do so, subject to the following conditions: |
---|
17 |
* |
---|
18 |
* The above copyright notice and this permission notice shall be included |
---|
19 |
* in all copies or substantial portions of the Software. |
---|
20 |
* |
---|
21 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
22 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
23 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
---|
24 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
25 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
---|
26 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
27 |
* DEALINGS IN THE SOFTWARE. |
---|
28 |
*/ |
---|
29 |
|
---|
30 |
|
---|
31 |
include_once(dirname(__FILE__)."/../Widget.php"); |
---|
32 |
|
---|
33 |
/** |
---|
34 |
* SessionExpiredWidget |
---|
35 |
* |
---|
36 |
* @desc Widget That redirect to a template or a URL or display a text |
---|
37 |
* if session expire. |
---|
38 |
*/ |
---|
39 |
class SessionExpired extends CWCWidget |
---|
40 |
{ |
---|
41 |
var $mszErrorMsg = ""; |
---|
42 |
|
---|
43 |
/** |
---|
44 |
* SessionExpiredWidget |
---|
45 |
* |
---|
46 |
* Constructor method for the SessionExpired widget. |
---|
47 |
*/ |
---|
48 |
function SessionExpired() |
---|
49 |
{ |
---|
50 |
// invoke constructor of parent |
---|
51 |
parent::CWCWidget(); |
---|
52 |
|
---|
53 |
// set the description for this widget |
---|
54 |
$this->szWidgetDescription = <<<EOT |
---|
55 |
SessionExpiredWidget is a simple widget that simply redirect to a template or a URL or display a text if session expire. |
---|
56 |
EOT; |
---|
57 |
$this->maAttributes["URL"] = |
---|
58 |
new StringAttribute( "URL", false ); |
---|
59 |
|
---|
60 |
$this->maAttributes["TEMPLATE"] = |
---|
61 |
new StringAttribute( "TEMPLATE", false ); |
---|
62 |
|
---|
63 |
$this->maAttributes["TEXT"] = |
---|
64 |
new StringAttribute( "TEXT", false ); |
---|
65 |
$this->mnMaturityLevel = MATURITY_BETA; |
---|
66 |
} |
---|
67 |
|
---|
68 |
function ParseURL() |
---|
69 |
{ |
---|
70 |
parent::ParseURL(); |
---|
71 |
|
---|
72 |
if (!$this->moApp->mbSessionOK) |
---|
73 |
{ |
---|
74 |
if (isset($this->maParams['URL'])) |
---|
75 |
{ |
---|
76 |
header("Location: ".$this->maParams['URL']); |
---|
77 |
} |
---|
78 |
else |
---|
79 |
if (isset($this->maParams['TEMPLATE'])) |
---|
80 |
{ |
---|
81 |
// Make sure tu use a valid session |
---|
82 |
$this->setVar( 'sid', session_id()); |
---|
83 |
$this->moApp->mbSessionOK = true; |
---|
84 |
|
---|
85 |
$this->moApp->CWCSetTemplate($this->maParams['TEMPLATE']); |
---|
86 |
|
---|
87 |
return false; |
---|
88 |
} |
---|
89 |
else |
---|
90 |
if (isset($this->maParams['TEXT'])) |
---|
91 |
{ |
---|
92 |
$this->mszErrorMsg = $this->maParams['TEXT']; |
---|
93 |
|
---|
94 |
return false; |
---|
95 |
} |
---|
96 |
} |
---|
97 |
|
---|
98 |
return true; |
---|
99 |
} |
---|
100 |
|
---|
101 |
/** |
---|
102 |
* DrawPublish |
---|
103 |
* |
---|
104 |
* Return the HTML code using the name in the map file and the |
---|
105 |
* parameters of the CWC tag. |
---|
106 |
*/ |
---|
107 |
function DrawPublish() |
---|
108 |
{ |
---|
109 |
return $this->mszErrorMsg; |
---|
110 |
} |
---|
111 |
} |
---|
112 |
?> |
---|