X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fadmin.php;h=e9fbae1c8a24fff9c3ad4bd6bd50adb88caac49f;hb=4cd83ff8c82b3f6b8bfff1d629fdc026306c0824;hp=c39e2ba1155baefeb22d898935ca2947284dfec5;hpb=92c4ac0156e22243a4be7590904b1eee9b657e57;p=platal.git diff --git a/modules/admin.php b/modules/admin.php index c39e2ba..e9fbae1 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -413,7 +413,10 @@ class AdminModule extends PLModule if (Post::has('account_deletion_confirmation')) { $uid = $user->id(); $name = $user->fullName(); - $user->profile()->clear(); + $profile = $user->profile(); + if ($profile) { + $user->profile()->clear(); + } $user->clear(true); $page->trigSuccess("L'utilisateur $name ($uid) a bien été supprimé."); } @@ -1012,7 +1015,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 +1063,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 +1154,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 +1168,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 +1401,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) {