function snipForm() { require_once 'form/form.class.php'; $formFile = $this->Ctrl->getConf('root.dir') . '/conf/form.user.login.conf'; $form = new NyaaForm(); $form->loadFile($formFile); $form->addHidden('__FORM__', 'user.login.apply'); $form->addHidden('__APPLY_FROM__', 'user.login.form'); $bind = array('form' => $form, 'email' => $form->getInput('email'), 'password' => $form->getInput('password'), 'saveLogin' => $form->getInput('saveLogin'), 'toRegist' => $form->getInput('toRegist'), 'signin' => $form->getInput('signin')); $result = $this->Ctrl->getResult('user.login.form'); if (!empty($result)) { $bind['errors'] = $result->getOr('errors', array()); $form->setValues($result->getOr('request', array())); } return $bind; }
function snipForm() { $conf = 'form.user.register.conf'; $formName = 'user.register.form'; $applyName = 'user.register.apply'; require_once 'form/form.class.php'; $formFile = $this->Ctrl->getConf('root.dir') . '/conf/' . $conf; $form = new NyaaForm(); $form->setEnctype('multipart/form-data'); $form->loadFile($formFile); $form->addHidden('__FORM__', $applyName); $form->addHidden('__APPLY_FROM__', $formName); $bind = array('form' => $form); $email = $this->Request->isEmpty('email') ? '' : $this->Request->get('email'); $result = $this->Ctrl->getResult($formName); if (!empty($email)) { $form->getInput('email')->setValue($email); } if (!empty($result)) { $bind['errors'] = $result->getOr('errors', array()); $form->setValues($result->getOr('request', array())); } return $bind; }