ILIAS
release_4-3 Revision
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
class.ilRegExpInputGUI.php
Go to the documentation of this file.
1
<?php
2
/*
3
+-----------------------------------------------------------------------------+
4
| ILIAS open source |
5
+-----------------------------------------------------------------------------+
6
| Copyright (c) 1998-2007 ILIAS open source, University of Cologne |
7
| |
8
| This program is free software; you can redistribute it and/or |
9
| modify it under the terms of the GNU General Public License |
10
| as published by the Free Software Foundation; either version 2 |
11
| of the License, or (at your option) any later version. |
12
| |
13
| This program is distributed in the hope that it will be useful, |
14
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
| GNU General Public License for more details. |
17
| |
18
| You should have received a copy of the GNU General Public License |
19
| along with this program; if not, write to the Free Software |
20
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21
+-----------------------------------------------------------------------------+
22
*/
23
31
class
ilRegExpInputGUI
extends
ilTextInputGUI
32
{
33
private
$pattern
;
34
41
function
__construct
($a_title =
""
, $a_postvar =
""
)
42
{
43
parent::__construct
($a_title, $a_postvar);
44
$this->
setType
(
"feedurl"
);
45
}
46
52
function
setNoMatchMessage
($a_nomatchmessage)
53
{
54
$this->nomatchmessage = $a_nomatchmessage;
55
}
56
62
function
getNoMatchMessage
()
63
{
64
return
$this->nomatchmessage;
65
}
66
72
function
setPattern
(
$pattern
)
73
{
74
$this->pattern =
$pattern
;
75
}
76
82
function
getPattern
()
83
{
84
return
$this->pattern
;
85
}
86
92
function
checkInput
()
93
{
94
global
$lng
;
95
96
// this line is necessary, otherwise it is a security issue (Alex)
97
$_POST
[$this->
getPostVar
()] =
ilUtil::stripSlashes
(
$_POST
[$this->
getPostVar
()]);
98
99
$value
=
$_POST
[$this->
getPostVar
()];
100
101
if
(!$this->
getRequired
() && strcasecmp(
$value
,
""
) == 0)
102
{
103
return
true
;
104
}
105
106
if
($this->
getRequired
() && trim(
$value
) ==
""
)
107
{
108
$this->
setAlert
($lng->txt(
"msg_input_is_required"
));
109
110
return
false
;
111
}
112
113
$result
= preg_match ($this->pattern,
$value
);
114
if
(!
$result
)
115
{
116
if
($this->
getNoMatchMessage
() ==
""
)
117
{
118
$this->
setAlert
($lng->txt(
"msg_input_does_not_match_regexp"
));
119
}
120
else
121
{
122
$this->
setAlert
($this->
getNoMatchMessage
());
123
}
124
}
125
return
$result
;
126
127
}
128
129
}
Services
Form
classes
class.ilRegExpInputGUI.php
Generated on Sat Apr 30 2016 19:00:59 for ILIAS by
1.8.1.2 (using
Doxyfile
)