ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilPasswordInputGUI Class Reference

This class represents a password property in a property form. More...

+ Inheritance diagram for ilPasswordInputGUI:
+ Collaboration diagram for ilPasswordInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setRetype ($a_val)
 Set retype on/off. More...
 
 getRetype ()
 Get retype on/off. More...
 
 setRetypeValue ($a_retypevalue)
 Set Retype Value. More...
 
 getRetypeValue ()
 Get Retype Value. More...
 
 setMaxLength ($a_maxlength)
 Set Max Length. More...
 
 getMaxLength ()
 Get Max Length. More...
 
 setSize ($a_size)
 Set Size. More...
 
 setPreSelection ($a_val)
 Set preselection. More...
 
 getPreSelection ()
 Get preselection. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 getSize ()
 Get Size. More...
 
 setValidateAuthPost ($a_validateauthpost)
 Set Validate required status against authentication POST var. More...
 
 getValidateAuthPost ()
 Get Validate required status against authentication POST var. More...
 
 setRequiredOnAuth ($a_requiredonauth)
 Set input required, if authentication mode allows password setting. More...
 
 getRequiredOnAuth ()
 Get input required, if authentication mode allows password setting. More...
 
 setSkipSyntaxCheck ($a_val)
 Set skip syntax check. More...
 
 getSkipSyntaxCheck ()
 Get skip syntax check. More...
 
 setDisableHtmlAutoComplete ($a_value)
 Set autocomplete. More...
 
 isHtmlAutoCompleteDisabled ()
 Get autocomplete. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 render ()
 Render item. More...
 
 insert (&$a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 

Protected Attributes

 $value
 
 $size = 20
 
 $validateauthpost = ""
 
 $requiredonauth = false
 
 $preselection = false
 
 $maxlength = false
 
 $autocomplete_disabled = true
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Detailed Description

This class represents a password property in a property form.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 11 of file class.ilPasswordInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPasswordInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

Definition at line 31 of file class.ilPasswordInputGUI.php.

32 {
33 parent::__construct($a_title, $a_postvar);
34 $this->setRetype(true);
35 $this->setSkipSyntaxCheck(false);
36 }
setRetype($a_val)
Set retype on/off.
setSkipSyntaxCheck($a_val)
Set skip syntax check.

References setRetype(), and setSkipSyntaxCheck().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilPasswordInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilFormPropertyGUI.

Definition at line 254 of file class.ilPasswordInputGUI.php.

255 {
256 global $lng;
257
259 $_POST[$this->getPostVar()."_retype"] = ilUtil::stripSlashes($_POST[$this->getPostVar()."_retype"]);
260 if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
261 {
262 $this->setAlert($lng->txt("msg_input_is_required"));
263
264 return false;
265 }
266 if ($this->getValidateAuthPost() != "")
267 {
269
270 // check, if password is required dependent on auth mode
272 && trim($_POST[$this->getPostVar()]) == "")
273 {
274 $this->setAlert($lng->txt("form_password_required_for_auth"));
275
276 return false;
277 }
278
279 // check, if password is allowed to be set for given auth mode
280 if (trim($_POST[$this->getPostVar()]) != "" &&
282 {
283 $this->setAlert($lng->txt("form_password_not_allowed_for_auth"));
284
285 return false;
286 }
287 }
288 if ($this->getRetype() && !$this->getPreSelection() &&
289 ($_POST[$this->getPostVar()] != $_POST[$this->getPostVar()."_retype"]))
290 {
291 $this->setAlert($lng->txt("passwd_not_match"));
292
293 return false;
294 }
295 if (!$this->getSkipSyntaxCheck() &&
296 !ilUtil::isPassword($_POST[$this->getPostVar()],$custom_error) &&
297 $_POST[$this->getPostVar()] != "")
298 {
299 if($custom_error != '') $this->setAlert($custom_error);
300 else $this->setAlert($lng->txt("passwd_invalid"));
301
302 return false;
303 }
304
305 return $this->checkSubItemsInput();
306 }
static _allowPasswordModificationByAuthMode($a_auth_mode)
Allow password modification.
_getAuthMode($a_auth_mode, $a_db_handler='')
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
getRetype()
Get retype on/off.
getValidateAuthPost()
Get Validate required status against authentication POST var.
getRequiredOnAuth()
Get input required, if authentication mode allows password setting.
getSkipSyntaxCheck()
Get skip syntax check.
getPreSelection()
Get preselection.
static isPassword($a_passwd, &$customError=null)
validates a password @access public
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST['username']
Definition: cron.php:12
global $lng
Definition: privfeed.php:40

References $_POST, $auth, $lng, ilAuthUtils\_allowPasswordModificationByAuthMode(), ilAuthUtils\_getAuthMode(), ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), getPreSelection(), ilFormPropertyGUI\getRequired(), getRequiredOnAuth(), getRetype(), getSkipSyntaxCheck(), getValidateAuthPost(), ilUtil\isPassword(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ getMaxLength()

ilPasswordInputGUI::getMaxLength ( )

Get Max Length.

Returns
int Max Length

Definition at line 113 of file class.ilPasswordInputGUI.php.

References $maxlength.

Referenced by render().

+ Here is the caller graph for this function:

◆ getPreSelection()

ilPasswordInputGUI::getPreSelection ( )

Get preselection.

Returns
boolean preselection of five passwords true/false

Definition at line 143 of file class.ilPasswordInputGUI.php.

References $preselection.

Referenced by checkInput(), and render().

+ Here is the caller graph for this function:

◆ getRequiredOnAuth()

ilPasswordInputGUI::getRequiredOnAuth ( )

Get input required, if authentication mode allows password setting.

Returns
boolean require input

Definition at line 204 of file class.ilPasswordInputGUI.php.

References $requiredonauth.

Referenced by checkInput().

+ Here is the caller graph for this function:

◆ getRetype()

ilPasswordInputGUI::getRetype ( )

Get retype on/off.

Returns
boolean retype

Definition at line 73 of file class.ilPasswordInputGUI.php.

74 {
75 return $this->retype;
76 }

Referenced by checkInput(), and render().

+ Here is the caller graph for this function:

◆ getRetypeValue()

ilPasswordInputGUI::getRetypeValue ( )

Get Retype Value.

Returns
string Retype Value

Definition at line 93 of file class.ilPasswordInputGUI.php.

94 {
95 return $this->retypevalue;
96 }

Referenced by render().

+ Here is the caller graph for this function:

◆ getSize()

ilPasswordInputGUI::getSize ( )

Get Size.

Returns
int Size

Definition at line 164 of file class.ilPasswordInputGUI.php.

165 {
166 return $this->size;
167 }

References $size.

Referenced by render().

+ Here is the caller graph for this function:

◆ getSkipSyntaxCheck()

ilPasswordInputGUI::getSkipSyntaxCheck ( )

Get skip syntax check.

Returns
boolean skip syntax check

Definition at line 224 of file class.ilPasswordInputGUI.php.

225 {
226 return $this->skip_syntax_check;
227 }

Referenced by checkInput().

+ Here is the caller graph for this function:

◆ getValidateAuthPost()

ilPasswordInputGUI::getValidateAuthPost ( )

Get Validate required status against authentication POST var.

Returns
string POST var

Definition at line 184 of file class.ilPasswordInputGUI.php.

References $validateauthpost.

Referenced by checkInput().

+ Here is the caller graph for this function:

◆ getValue()

ilPasswordInputGUI::getValue ( )

Get Value.

Returns
string Value

Definition at line 53 of file class.ilPasswordInputGUI.php.

References $value.

Referenced by render().

+ Here is the caller graph for this function:

◆ insert()

ilPasswordInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Definition at line 391 of file class.ilPasswordInputGUI.php.

392 {
393 $html = $this->render();
394
395 $a_tpl->setCurrentBlock("prop_generic");
396 $a_tpl->setVariable("PROP_GENERIC", $html);
397 $a_tpl->parseCurrentBlock();
398 }
$html
Definition: example_001.php:87

References $html, and render().

+ Here is the call graph for this function:

◆ isHtmlAutoCompleteDisabled()

ilPasswordInputGUI::isHtmlAutoCompleteDisabled ( )

Get autocomplete.

Returns
bool Value

Definition at line 244 of file class.ilPasswordInputGUI.php.

References $autocomplete_disabled.

Referenced by render().

+ Here is the caller graph for this function:

◆ render()

ilPasswordInputGUI::render ( )

Render item.

Definition at line 311 of file class.ilPasswordInputGUI.php.

312 {
313 global $lng;
314
315 $ptpl = new ilTemplate("tpl.prop_password.html", true, true, "Services/Form");
316
317 if (!$this->getPreSelection())
318 {
319 if ($this->getRetype())
320 {
321 $ptpl->setCurrentBlock("retype");
322 $ptpl->setVariable("RSIZE", $this->getSize());
323 $ptpl->setVariable("RID", $this->getFieldId());
324 $ptpl->setVariable("RMAXLENGTH", $this->getMaxLength());
325 $ptpl->setVariable("RPOST_VAR", $this->getPostVar());
326
327 if($this->isHtmlAutoCompleteDisabled())
328 {
329 $ptpl->setVariable("RAUTOCOMPLETE", "autocomplete=\"off\"");
330 }
331
332 // this is creating an "auto entry" in the setup, if the retype is missing
333 /*$retype_value = ($this->getRetypeValue() != "")
334 ? $this->getRetypeValue()
335 : $this->getValue();*/
336 $retype_value = $this->getRetypeValue();
337 $ptpl->setVariable("PROPERTY_RETYPE_VALUE", ilUtil::prepareFormOutput($retype_value));
338 if ($this->getDisabled())
339 {
340 $ptpl->setVariable("RDISABLED",
341 " disabled=\"disabled\"");
342 }
343 $ptpl->setVariable("TXT_RETYPE", $lng->txt("form_retype_password"));
344 $ptpl->parseCurrentBlock();
345 }
346
347 if (strlen($this->getValue()))
348 {
349 $ptpl->setCurrentBlock("prop_password_propval");
350 $ptpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
351 $ptpl->parseCurrentBlock();
352 }
353 $ptpl->setVariable("POST_VAR", $this->getPostVar());
354 $ptpl->setVariable("ID", $this->getFieldId());
355 $ptpl->setVariable("SIZE", $this->getSize());
356 $ptpl->setVariable("MAXLENGTH", $this->getMaxLength());
357 if ($this->getDisabled())
358 {
359 $ptpl->setVariable("DISABLED",
360 " disabled=\"disabled\"");
361 }
362 if($this->isHtmlAutoCompleteDisabled())
363 {
364 $ptpl->setVariable("AUTOCOMPLETE", "autocomplete=\"off\"");
365 }
366 }
367 else
368 {
369 // preselection
370 $passwd_list = ilUtil::generatePasswords(5);
371 foreach ($passwd_list as $passwd)
372 {
373 $i++;
374 $ptpl->setCurrentBlock("select_input");
375 $ptpl->setVariable("POST_VAR", $this->getPostVar());
376 $ptpl->setVariable("OP_ID", $this->getPostVar()."_".$i);
377 $ptpl->setVariable("VAL_RADIO_OPTION", $passwd);
378 $ptpl->setVariable("TXT_RADIO_OPTION", $passwd);
379 $ptpl->parseCurrentBlock();
380 }
381
382 }
383 return $ptpl->get();
384 }
getFieldId()
Get Post Variable.
getRetypeValue()
Get Retype Value.
isHtmlAutoCompleteDisabled()
Get autocomplete.
special template class to simplify handling of ITX/PEAR
static generatePasswords($a_number)
Generate a number of passwords.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References $lng, ilUtil\generatePasswords(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), getMaxLength(), ilFormPropertyGUI\getPostVar(), getPreSelection(), getRetype(), getRetypeValue(), getSize(), getValue(), isHtmlAutoCompleteDisabled(), and ilUtil\prepareFormOutput().

Referenced by insert().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDisableHtmlAutoComplete()

ilPasswordInputGUI::setDisableHtmlAutoComplete (   $a_value)

Set autocomplete.

Parameters
bool$a_valueValue

Definition at line 234 of file class.ilPasswordInputGUI.php.

235 {
236 $this->autocomplete_disabled = (bool)$a_value;
237 }

◆ setMaxLength()

ilPasswordInputGUI::setMaxLength (   $a_maxlength)

Set Max Length.

Parameters
int$a_maxlengthMax Length

Definition at line 103 of file class.ilPasswordInputGUI.php.

104 {
105 $this->maxlength = $a_maxlength;
106 }

◆ setPreSelection()

ilPasswordInputGUI::setPreSelection (   $a_val)

Set preselection.

Parameters
booleanpreselection of five passwords true/false

Definition at line 133 of file class.ilPasswordInputGUI.php.

134 {
135 $this->preselection = $a_val;
136 }

◆ setRequiredOnAuth()

ilPasswordInputGUI::setRequiredOnAuth (   $a_requiredonauth)

Set input required, if authentication mode allows password setting.

Parameters
boolean$a_requiredonauthrequire input

Definition at line 194 of file class.ilPasswordInputGUI.php.

195 {
196 $this->requiredonauth = $a_requiredonauth;
197 }

◆ setRetype()

ilPasswordInputGUI::setRetype (   $a_val)

Set retype on/off.

Parameters
booleanretype

Definition at line 63 of file class.ilPasswordInputGUI.php.

64 {
65 $this->retype = $a_val;
66 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setRetypeValue()

ilPasswordInputGUI::setRetypeValue (   $a_retypevalue)

Set Retype Value.

Parameters
string$a_retypevalueRetype Value

Definition at line 83 of file class.ilPasswordInputGUI.php.

84 {
85 $this->retypevalue = $a_retypevalue;
86 }

Referenced by setValueByArray().

+ Here is the caller graph for this function:

◆ setSize()

ilPasswordInputGUI::setSize (   $a_size)

Set Size.

Parameters
int$a_sizeSize

Definition at line 123 of file class.ilPasswordInputGUI.php.

124 {
125 $this->size = $a_size;
126 }

◆ setSkipSyntaxCheck()

ilPasswordInputGUI::setSkipSyntaxCheck (   $a_val)

Set skip syntax check.

Parameters
booleanskip syntax check

Definition at line 214 of file class.ilPasswordInputGUI.php.

215 {
216 $this->skip_syntax_check = $a_val;
217 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setValidateAuthPost()

ilPasswordInputGUI::setValidateAuthPost (   $a_validateauthpost)

Set Validate required status against authentication POST var.

Parameters
string$a_validateauthpostPOST var

Definition at line 174 of file class.ilPasswordInputGUI.php.

175 {
176 $this->validateauthpost = $a_validateauthpost;
177 }

◆ setValue()

ilPasswordInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Definition at line 43 of file class.ilPasswordInputGUI.php.

44 {
45 $this->value = $a_value;
46 }

Referenced by setValueByArray().

+ Here is the caller graph for this function:

◆ setValueByArray()

ilPasswordInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 153 of file class.ilPasswordInputGUI.php.

154 {
155 $this->setValue($a_values[$this->getPostVar()]);
156 $this->setRetypeValue($a_values[$this->getPostVar()."_retype"]);
157 }
setRetypeValue($a_retypevalue)
Set Retype Value.
setValue($a_value)
Set Value.

References ilFormPropertyGUI\getPostVar(), setRetypeValue(), and setValue().

+ Here is the call graph for this function:

Field Documentation

◆ $autocomplete_disabled

ilPasswordInputGUI::$autocomplete_disabled = true
protected

Definition at line 23 of file class.ilPasswordInputGUI.php.

Referenced by isHtmlAutoCompleteDisabled().

◆ $maxlength

ilPasswordInputGUI::$maxlength = false
protected

Definition at line 18 of file class.ilPasswordInputGUI.php.

Referenced by getMaxLength().

◆ $preselection

ilPasswordInputGUI::$preselection = false
protected

Definition at line 17 of file class.ilPasswordInputGUI.php.

Referenced by getPreSelection().

◆ $requiredonauth

ilPasswordInputGUI::$requiredonauth = false
protected

Definition at line 16 of file class.ilPasswordInputGUI.php.

Referenced by getRequiredOnAuth().

◆ $size

ilPasswordInputGUI::$size = 20
protected

Definition at line 14 of file class.ilPasswordInputGUI.php.

Referenced by getSize().

◆ $validateauthpost

ilPasswordInputGUI::$validateauthpost = ""
protected

Definition at line 15 of file class.ilPasswordInputGUI.php.

Referenced by getValidateAuthPost().

◆ $value

ilPasswordInputGUI::$value
protected

Definition at line 13 of file class.ilPasswordInputGUI.php.

Referenced by getValue().


The documentation for this class was generated from the following file: