use com\indigloo\exception\DBException; use com\indigloo\sc\mysql; use com\indigloo\sc\auth\Login; use com\indigloo\Url; use com\indigloo\Util; use com\indigloo\Logger; if (isset($_POST['save']) && $_POST['save'] == 'Save') { $gWeb = \com\indigloo\core\Web::getInstance(); $fvalues = array(); $fUrl = \com\indigloo\Url::tryFormUrl("fUrl"); try { $fhandler = new Form\Handler("edit-form", $_POST); $fhandler->addRule("name", "Name", array('required' => 1)); $fvalues = $fhandler->getValues(); $name = $fvalues["name"]; if (!Util::isAlphaNumeric($name)) { $fhandler->addError("Bad name : only letters and numbers are allowed!"); } if ($fhandler->hasErrors()) { throw new UIException($fhandler->getErrors()); } $loginId = Login::getLoginIdInSession(); $listDao = new \com\indigloo\sc\dao\Lists(); $listDao->createNew($loginId, $name, $fvalues["description"]); $message = sprintf("success! new list created"); $gWeb->store(Constants::FORM_MESSAGES, array($message)); header("Location: " . $fUrl); } catch (UIException $ex) { $gWeb->store(Constants::STICKY_MAP, $fvalues); $gWeb->store(Constants::FORM_ERRORS, $ex->getMessages()); header("Location: " . $fUrl);