Other events can explicitly set the _submitted variable to
false to indicate a form submit but not for actual posting of
data (eg. onChange events to update the display of fields).
public isSubmitted ( ) : boolean | ||
return | boolean | True or false indicating if the form has been submitted. |
} else { $notification->push(_("Your data were successfully updated."), 'horde.success'); if (empty($data['user_picture'])) { $folks_driver->logActivity(_("Updated his/her profile details.")); } else { $folks_driver->logActivity(_("Updated his/her profile picture.")); } Horde::url('edit/edit.php')->redirect(); } break; case _("Delete picture"): $result = $folks_driver->deleteImage($GLOBALS['registry']->getAuth()); if ($result instanceof PEAR_Error) { $notification->push($result); } else { $notification->push(_("Your image was deleted successfully."), 'horde.success'); } break; } } elseif (!$form->isSubmitted()) { foreach ($profile as $key => $value) { if ($key != 'user_picture' && !empty($value)) { $vars->set($key, $value); } } } $page_output->header(array('title' => $title)); require FOLKS_TEMPLATES . '/menu.inc'; echo $tabs->render('edit'); $form->renderActive(null, null, null, 'post'); $page_output->footer();
try { $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($vars->get('gallery')); } catch (Ansel_Exception $e) { $notification->push($gallery->getMessage()); Horde::url('view.php?view=List', true)->redirect(); exit; } $url = $vars->get('url'); $form = new Horde_Form($vars, _("Content Disclaimer"), 'disclamer'); $form->addVariable($gallery->get('name'), 'name', 'description', false); $form->addVariable($gallery->get('desc'), 'desc', 'description', false); $form->addHidden('', 'url', 'text', true); $form->addHidden('', 'gallery', 'int', true); $msg = sprintf(_("Photo content may be offensive. You must be over %d to continue."), $gallery->get('age')); $form->addVariable($msg, 'warning', 'description', false); $form->setButtons(array(sprintf(_("Continue - I'm over %d"), $gallery->get('age')), _("Cancel"))); if ($form->isSubmitted()) { if (Horde_Util::getFormData('submitbutton') == _("Cancel")) { $notification->push("You are not authorised to view this photo.", 'horde.warning'); Horde::url('view.php?view=List', true)->redirect(); exit; } else { $session->set('ansel', 'user_age', (int) $gallery->get('age')); $url->redirect(); exit; } } $page_output->header(); $notification->notify(array('listeners' => 'status')); $form->renderActive(null, null, null, 'post'); $page_output->footer();
$question = $u_prefs->getValue('security_question'); } else { $answer = $prefs->getValue('security_answer'); $question = $prefs->getValue('security_question'); } /* Set up the fields for the username and alternate email. */ $form->addHidden('', 'url', 'text', false); $form->addVariable(_("Username"), 'username', 'text', true); if (!empty($answer)) { if (!empty($question)) { $form->addVariable(_("Please respond to your security question: ") . $question, 'security_question', 'description', true); } $form->addVariable(_("Security answer"), 'security_answer', 'text', true); } else { $desc = _("The picture above is for antispam checking. Please retype the characters from the picture. They are case sensitive."); $form->addVariable(_("Human check"), 'captcha', 'captcha', true, false, $desc, array(Folks::getCAPTCHA(!$form->isSubmitted()), HORDE_BASE . '/config/couri.ttf')); } /* Validate the form. */ if ($form->validate()) { $form->getInfo(null, $info); /* Get user email. */ $email = Folks::getUserEmail($info['username']); if ($email instanceof PEAR_Error) { $notification->push($email); throw new Horde_Exception_AuthenticationFailure(); } /* Check the given values with the prefs stored ones. */ if (!empty($answer) && Horde_String::lower($answer) == Horde_String::lower($info['security_answer']) || empty($answer)) { /* Info matches, so reset the password. */ $password = $auth->resetPassword($info['username']); if ($password instanceof PEAR_Error) {