X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/098a79f0819ebb89b7d48df4a6b154af4560f68e..a7ba11adfecf6cb906749efe5abce688363aef07:/user_add.php diff --git a/user_add.php b/user_add.php index cf2fe76b..9834fec4 100644 --- a/user_add.php +++ b/user_add.php @@ -47,7 +47,7 @@ if (in_array('cl', explode(',', $user->plugins))) $clients = ttTeamHelper::getActiveClients($user->team_id); $assigned_projects = array(); -if ($request->getMethod() == 'POST') { +if ($request->isPost()) { $cl_name = trim($request->getParameter('name')); $cl_login = trim($request->getParameter('login')); if (!$auth->isPasswordExternal()) { @@ -131,20 +131,20 @@ $form->addInputElement($table); $form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->getKey('button.submit'))); -if ($request->getMethod() == 'POST') { +if ($request->isPost()) { // Validate user input. if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.person_name')); if (!ttValidString($cl_login)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.login')); if (!$auth->isPasswordExternal()) { - if (!ttValidString($cl_password1)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password')); - if (!ttValidString($cl_password2)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password')); + if (!ttValidString($cl_password1)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password')); + if (!ttValidString($cl_password2)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password')); if ($cl_password1 !== $cl_password2) $errors->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password')); - } + } if (!ttValidEmail($cl_email, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.email')); if (!ttValidFloat($cl_rate, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.users.default_rate')); - if ($errors->isEmpty()) { + if ($errors->no()) { if (!ttUserHelper::getUserByLogin($cl_login)) { $fields = array( 'name' => $cl_name, @@ -164,7 +164,7 @@ if ($request->getMethod() == 'POST') { } else $errors->add($i18n->getKey('error.user_exists')); } -} // post +} // POST $smarty->assign('auth_external', $auth->isPasswordExternal()); $smarty->assign('forms', array($form->getName()=>$form->toArray())); @@ -172,4 +172,3 @@ $smarty->assign('onload', 'onLoad="document.userForm.name.focus();handleClientCo $smarty->assign('title', $i18n->getKey('title.add_user')); $smarty->assign('content_page_name', 'user_add.tpl'); $smarty->display('index.tpl'); -?> \ No newline at end of file