X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fadmin.php;h=e1e2ceb246acc1ae8ca4cc3a5744ab05ad2f3778;hb=7b094a73666cee7650946254c82800e25965db41;hp=ed7195945b9aaf8f447438a8ca8d59cd43248eed;hpb=9f52839d4a55c6b59ab80af35026a064e007ac72;p=platal.git diff --git a/modules/admin.php b/modules/admin.php index ed71959..e1e2ceb 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -1012,7 +1012,6 @@ class AdminModule extends PLModule $page->setTitle('Administration - Valider une demande'); $page->addCssLink('nl.css'); $page->addJsLink('ajax.js'); - require_once 'validations.inc.php'; if ($action == 'edit' && !is_null($id)) { $page->assign('preview_id', $id); @@ -1061,7 +1060,7 @@ class AdminModule extends PLModule // where several copies of the site use the same DB, but not the same "dynamic configuration" global $globals; $globals->updateNbValid(); - $page->assign('vit', new ValidateIterator()); + $page->assign('vit', Validate::iterate()); } function handler_validate_answers(&$page, $action = 'list', $id = null) @@ -1152,9 +1151,10 @@ class AdminModule extends PLModule S::assert_xsrf_token(); $firstname = Post::t('firstname'); $lastname = strtoupper(Post::t('lastname')); - $sex = Post::b('sex') ? User::GENDER_FEMALE : User::GENDER_FEMALE; + $sex = Post::b('sex') ? User::GENDER_FEMALE : User::GENDER_MALE; $email = Post::t('email'); - $login = PlUser::makeHrid($firstname, $lastname, 'ax'); + $type = Post::s('type'); + $login = PlUser::makeHrid($firstname, $lastname, $type); if (!isvalid_email($email)) { $page->trigError("Invalid email address: $email"); } else if (strlen(Post::s('pwhash')) != 40) { @@ -1165,14 +1165,14 @@ class AdminModule extends PLModule XDB::execute("INSERT INTO accounts (hruid, type, state, password, registration_date, email, full_name, display_name, sex, directory_name) - VALUES ({?}, 'ax', 'active', {?}, NOW(), {?}, {?}, {?}, {?}, {?})", - $login, Post::s('pwhash'), $email, $full_name, $full_name, $sex, + VALUES ({?}, {?}, 'active', {?}, NOW(), {?}, {?}, {?}, {?}, {?})", + $login, $type, Post::s('pwhash'), $email, $full_name, $full_name, $sex, $directory_name); } } - $uf = new UserFilter(new UFC_AccountType('ax')); - $page->assign('users', $uf->iterUsers(new PlLimit(10))); + $uf = new UserFilter(new UFC_AccountType('ax', 'school', 'fx')); + $page->assign('users', $uf->iterUsers()); } @@ -1398,9 +1398,9 @@ class AdminModule extends PLModule $page->changeTpl('admin/jobs.tpl'); if (Env::has('search')) { - $res = XDB::query("SELECT e.id, e.name, e.acronym - FROM profile_job_enum AS e - WHERE e.name LIKE CONCAT('% ', {?}, '%') OR e.acronym LIKE CONCAT('% ', {?}, '%')", + $res = XDB::query("SELECT id, name, acronym + FROM profile_job_enum + WHERE name LIKE CONCAT('%', {?}, '%') OR acronym LIKE CONCAT('%', {?}, '%')", Env::t('job'), Env::t('job')); if ($res->numRows() <= 20) { @@ -1418,7 +1418,7 @@ class AdminModule extends PLModule $selectedJob = Env::has('selectedJob'); Phone::deletePhones(0, Phone::LINK_COMPANY, $id); - Address::delete(null, Address::lLINK_COMPANY, $id); + Address::delete(null, Address::LINK_COMPANY, $id); if (Env::has('change')) { XDB::execute('UPDATE profile_job SET jobid = {?}