X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fadmin.php;h=bc6f097520ad8d460882d33f77e30adb79359a58;hb=b3cd1320f091b2df9c8ed5f7b995a3d88c26ecad;hp=6ce598eac65cb1ed89736997638213de6faf5ac4;hpb=6d8ec13c63e3efbe91396273a3bf8449843e10d5;p=platal.git diff --git a/modules/admin.php b/modules/admin.php index 6ce598e..bc6f097 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -132,7 +132,8 @@ class AdminModule extends PLModule function _getDays($year, $month) { // give a 'no filter' option - $months[0] = "----"; + $days = array(); + $days[0] = "----"; if ($year && $month) { $day_max = Array(-1, 31, checkdate(2, 29, $year) ? 29 : 28 , 31, @@ -174,6 +175,7 @@ class AdminModule extends PLModule function _getMonths($year) { // give a 'no filter' option + $months = array(); $months[0] = "----"; if ($year) { @@ -206,6 +208,7 @@ class AdminModule extends PLModule function _getYears() { // give a 'no filter' option + $years = array(); $years[0] = "----"; // retrieve available years @@ -236,7 +239,7 @@ class AdminModule extends PLModule $where = array(); if ($uid) - array_push($where, "uid='$uid'"); + array_push($where, "s.uid='$uid'"); // we were given at least a year if ($year) { @@ -374,8 +377,10 @@ class AdminModule extends PLModule } // Loads the user identity using the environment. - $user = User::get($login); - if (!$user) { + if ($login) { + $user = User::get($login); + } + if (empty($user)) { return; } @@ -391,11 +396,11 @@ class AdminModule extends PLModule } // Handles specific requests (AX sync, su, ...). - if(Post::has('logs_account')) { + if(Post::has('log_account')) { pl_redirect("admin/logger?loguser=$login&year=".date('Y')."&month=".date('m')); } - if(Post::has('su_button') && $registered) { + if(Post::has('su_account') && $registered) { if (!Platal::session()->startSUID($user)) { $page->trigError('Impossible d\'effectuer un SUID sur ' . $user->login()); } else { @@ -433,8 +438,8 @@ class AdminModule extends PLModule if (Post::i('token_access', 0) != ($user->token_access ? 1 : 0)) { $to_update['token'] = Post::i('token_access') ? rand_url_id(16) : null; } - if (Post::i('skin', 0) != $user->skin) { - $to_update['skin'] = Post::i('skin', 0); + if (Post::i('skin') != $user->skin) { + $to_update['skin'] = Post::i('skin'); if ($to_update['skin'] == 0) { $to_update['skin'] = null; } @@ -598,8 +603,8 @@ class AdminModule extends PLModule // }}} - $page->addJsLink('ui.core.js'); - $page->addJsLink('ui.tabs.js'); + $page->addJsLink('jquery.ui.core.js'); + $page->addJsLink('jquery.ui.tabs.js'); // Displays last login and last host information. $res = XDB::query("SELECT start, host @@ -697,7 +702,6 @@ class AdminModule extends PLModule $page->changeTpl('admin/add_accounts.tpl'); if (Env::has('add_type') && Env::has('people')) { - require_once 'directory.enums.inc.php'; $lines = explode("\n", Env::t('people')); $separator = Env::t('separator'); $promotion = Env::i('promotion'); @@ -854,12 +858,11 @@ class AdminModule extends PLModule if ($op == 'list') { $res = XDB::iterator( "SELECT a.alias AS homonyme, s.alias AS forlife, - IF(h.homonyme_id = s.id, a.expire, NULL) AS expire, - IF(h.homonyme_id = s.id, a.type, NULL) AS type, - ac.uid AS user_id + IF(h.homonyme_id = s.uid, a.expire, NULL) AS expire, + IF(h.homonyme_id = s.uid, a.type, NULL) AS type, ac.uid FROM aliases AS a - LEFT JOIN homonyms AS h ON (h.homonyme_id = a.uid) - INNER JOIN aliases AS s ON (s.uid = h.uid AND s.type='a_vie') + LEFT JOIN homonyms AS h ON (h.homonyme_id = a.uid) + INNER JOIN aliases AS s ON (s.uid = h.uid AND s.type = 'a_vie') INNER JOIN accounts AS ac ON (ac.uid = a.uid) WHERE a.type = 'homonyme' OR a.expire != '' ORDER BY a.alias, forlife"); @@ -867,7 +870,7 @@ class AdminModule extends PLModule while ($tab = $res->next()) { $hnymes[$tab['homonyme']][] = $tab; } - $page->assign_by_ref('hnymes',$hnymes); + $page->assign_by_ref('hnymes', $hnymes); } } @@ -902,9 +905,9 @@ class AdminModule extends PLModule WHERE hrpid = {?}', $val, $pid); $page->trigSuccess('Ajout du décès de ' . $name . ' le ' . $val . '.'); if($death == '0000-00-00' || empty($death)) { - // TODO: FIX THIS DEPRECATED CALL - require_once('user.func.inc.php'); - user_clear_all_subs($uid, false); // by default, dead ppl do not loose their email + $profile = Profile::get($pid); + $profile->clear(); + $profile->owner()->clear(false); } } } @@ -937,7 +940,7 @@ class AdminModule extends PLModule function handler_validate(&$page, $action = 'list', $id = null) { - $page->changeTpl('admin/valider.tpl'); + $page->changeTpl('admin/validation.tpl'); $page->setTitle('Administration - Valider une demande'); $page->addCssLink('nl.css'); $page->addJsLink('ajax.js');