18 require_once SQ_CORE_PACKAGE_PATH.
'/designs/design_area/design_area.inc';
44 parent::__construct($assetid);
60 public function printVar($var, Array $args, $value_prefix=
'', $value_suffix=
'')
67 case 'submit_button' :
68 case 'password_change_message' :
69 case 'password_old_box' :
70 case 'password_new_box' :
71 case 'password_confirm_box' :
72 if ($this->_tmp[
'painting_section'] !=
'password_change') {
73 trigger_localised_error(
'CORE0179', E_USER_WARNING, $var, $this->
attr(
'id_name'));
81 case 'password_change_heading' :
82 echo
'<',
'?php if (!empty($GLOBALS[\'SQ_PASSWORD_CHANGE_FORM\'])) { echo ', $this->
_escapeVar(
'$GLOBALS[\'SQ_PASSWORD_CHANGE_FORM\'][\'heading\']', $args),
'; } ?',
'>';
85 case 'password_change_message' :
86 echo
'<',
'?php if (!empty($GLOBALS[\'SQ_PASSWORD_CHANGE_FORM\'])) { echo ', $this->
_escapeVar(
'$GLOBALS[\'SQ_PASSWORD_CHANGE_FORM\'][\'msg\']', $args),
'; } ?',
'>';
92 if ($this->
attr(
'forward_www_vars')) {
93 $qry_str_extra =
'&<'.
'?php echo htmlentities(preg_replace(\'/SQ_ACTION=[^\&]+\&?/\', \'\', $_SERVER[\'QUERY_STRING\'])); ?'.
'>';
97 if ($this->_tmp[
'painting_section'] ==
'password_change') {
98 echo
'<form action="<',
'?php echo $_SERVER[\'PHP_SELF\']; ?',
'>?SQ_ACTION=password_change'.$qry_str_extra.
'" id="'.$this->
attr(
'id_name').
'_password_change_prompt" method="post" onsubmit="return checkEntry();">';
101 echo
'<form action="<',
'?php echo $_SERVER[\'PHP_SELF\']; ?',
'>?SQ_ACTION=logout'.$qry_str_extra.
'" id="'.$this->
attr(
'id_name').
'_password_change_prompt" method="post">';
104 if ($this->
attr(
'forward_www_vars')) {
106 // Take all the post vars and whack em in the form - important ones are removed
107 require_once SQ_LIB_PATH.\'/html_form/html_form.inc\';
108 $'.$this->attr(
'id_name').
'_post_vars = $_POST;
109 unset($'.$this->
attr(
'id_name').
'_post_vars[\'SQ_PASSWORD_CHANGE_OLD\']);
110 unset($'.$this->
attr(
'id_name').
'_post_vars[\'SQ_PASSWORD_CHANGE_NEW\']);
111 unset($'.$this->
attr(
'id_name').
'_post_vars[\'SQ_PASSWORD_CHANGE_CONFIRM\']);
112 unset($'.$this->
attr(
'id_name').
'_post_vars[\'SQ_ACTION\']);
113 var_to_hidden_field($'.$this->
attr(
'id_name').
'_post_vars);
121 <script type="text/javascript"><!--
123 var passwordChangeForm = document.forms[\''.$this->attr(
'id_name').
'_password_change_prompt\'];
124 function checkEntry() {
125 return (passwordChangeForm.SQ_PASSWORD_CHANGE_OLD.value.length > 0 && passwordChangeForm.SQ_PASSWORD_CHANGE_NEW.value.length > 0 && passwordChangeForm.SQ_PASSWORD_CHANGE_CONFIRM.value.length > 0);
132 case 'system_messages' :
133 echo
'<',
'?php echo implode(\'<br/>\', $GLOBALS[\'SQ_SYSTEM\']->messages()); ?',
'>';
136 case 'password_old_box' :
137 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
138 $extras =
'onfocus="this.select();"';
139 foreach ($args As $k => $v) {
140 if ($k =
'size')
continue;
141 $extras .=
' '.$k.
'="'.htmlspecialchars($v).
'"';
143 password_box(
'SQ_PASSWORD_CHANGE_OLD',
'', empty($args[
'size']) ? 10 : $args[
'size'], 0, $extras);
144 if ($this->
attr(
'give_password_old_focus')) {
145 echo
'<script type="text/javascript"><!--
147 function set_'.$this->attr(
'id_name').
'_password_old_box_focus() {
148 document.getElementById("'.$this->
attr(
'id_name').
'_password_change_prompt").elements["SQ_PASSWORD_CHANGE_OLD"].focus();
150 window.onload = set_'.$this->
attr(
'id_name').
'_password_old_box_focus;
157 case 'password_new_box' :
158 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
159 $extras =
'onfocus="this.select();"';
160 foreach ($args As $k => $v) {
161 if ($k =
'size')
continue;
162 $extras .=
' '.$k.
'="'.htmlspecialchars($v).
'"';
164 password_box(
'SQ_PASSWORD_CHANGE_NEW',
'', empty($args[
'size']) ? 10 : $args[
'size'], 0, $extras);
167 case 'password_confirm_box' :
168 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
169 $extras =
'onfocus="this.select();"';
170 foreach ($args As $k => $v) {
171 if ($k =
'size')
continue;
172 $extras .=
' '.$k.
'="'.htmlspecialchars($v).
'"';
174 password_box(
'SQ_PASSWORD_CHANGE_CONFIRM',
'', empty($args[
'size']) ? 10 : $args[
'size'], 0, $extras);
177 case 'submit_button' :
178 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
180 foreach ($args As $k => $v) {
181 if ($k ==
'value')
continue;
182 $extras .=
' '.$k.
'="'.htmlspecialchars($v).
'"';
184 submit_button(
'change_password_logout_button', empty($args[
'value']) ? ucfirst($this->_tmp[
'painting_section']) : $args[
'value'],
'', $extras);
187 case 'password_rules_note':
189 echo $GLOBALS["SQ_SYSTEM"]->user->getPasswordRulesDescription();
194 parent::printVar($var, $args);
210 switch (array_get_index($element,
'operation')) {
211 case 'password_change_section':
212 $this->_tmp[
'painting_section'] =
'password_change';
213 foreach ($this->
attr(
'password_change_contents') as $item) {
214 parent::_printContentItemCode($item);
216 $this->_tmp[
'painting_section'] =
'';
220 return parent::_printContentItemCode($element);
238 $res = parent::getProtectedAttrs();
239 $res[] =
'password_change_contents';