function handler_postfix_delayed(&$page)
{
$page->changeTpl('admin/postfix_delayed.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Postfix : Retardés');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Postfix : Retardés');
if (Env::has('del')) {
$crc = Env::v('crc');
XDB::execute("UPDATE postfix_mailseen SET release = 'del' WHERE crc = {?}", $crc);
- $page->trig($crc." verra tous ses mails supprimés !");
+ $page->trig($crc." verra tous ses mails supprimés !");
} elseif (Env::has('ok')) {
$crc = Env::v('crc');
XDB::execute("UPDATE postfix_mailseen SET release = 'ok' WHERE crc = {?}", $crc);
}
$page->assign_by_ref('sessions', $sessions);
} else {
- $page->assign('msg_nofilters', "Sélectionner une annuée et/ou un utilisateur");
+ $page->assign('msg_nofilters', "Sélectionner une annuée et/ou un utilisateur");
}
}
require_once("user.func.inc.php");
if (S::has('suid')) {
- $page->kill("déjà en SUID !!!");
+ $page->kill("déjà en SUID !!!");
}
if (Env::has('user_id')) {
if ($login) {
if (is_numeric($login)) {
- $r = XDB::query("SELECT *, a.alias AS forlife, u.flags AS sexe,
+ $r = XDB::query("SELECT *, a.alias AS forlife,
+ FIND_IN_SET('watch', u.flags) AS watch, FIND_IN_SET('femme', u.flags) AS sexe,
(year(naissance) > promo - 15 or year(naissance) < promo - 25) AS naiss_err
FROM auth_user_md5 AS u
LEFT JOIN aliases AS a ON (a.id = u.user_id AND type= 'a_vie')
WHERE u.user_id = {?}", $login);
} else {
- $r = XDB::query("SELECT *, a.alias AS forlife, u.flags AS sexe,
+ $r = XDB::query("SELECT *, a.alias AS forlife,
+ FIND_IN_SET('watch', u.flags) AS watch, FIND_IN_SET('femme', u.flags) AS sexe,
(year(naissance) > promo - 15 or year(naissance) < promo - 25) AS naiss_err
FROM auth_user_md5 AS u
INNER JOIN aliases AS a ON ( a.id = u.user_id AND a.alias={?} AND type!='homonyme' )", $login);
$page->trig("invalid email $email");
} else {
$redirect->add_email($email);
- $page->trig("Ajout de $email effectué");
+ $page->trig("Ajout de $email effectué");
}
break;
WHERE uid = {?} AND rewrite LIKE CONCAT({?}, '@%')",
$mr['user_id'], $val);
fix_bestalias($mr['user_id']);
- $page->trig($val." a été supprimé");
+ $page->trig($val." a été supprimé");
}
break;
case "activate_fwd":
$nom = Env::v('nomN');
$promo = Env::i('promoN');
$sexe = Env::v('sexeN');
- $comm = Env::v('commentN');
+ $comm = trim(Env::v('commentN'));
+ $watch = Env::v('watchN');
+ $flags = '';
+ if ($sexe) {
+ $flags = 'femme';
+ }
+ if ($watch) {
+ if ($flags) {
+ $flags .= ',';
+ }
+ $flags .= 'watch';
+ }
+
+ if ($watch && !$comm) {
+ $page->trig("Il est nécessaire de mettre un commentaire pour surveiller un compte");
+ break;
+ }
$query = "UPDATE auth_user_md5 SET
naissance = '$naiss',
perms = '$perms',
prenom = '".addslashes($prenm)."',
nom = '".addslashes($nom)."',
- flags = '$sexe',
+ flags = '$flags',
promo = $promo,
comment = '".addslashes($comm)."'
WHERE user_id = '{$mr['user_id']}'";
if (XDB::execute($query)) {
user_reindex($mr['user_id']);
- $mailer = new PlMailer();
- $mailer->setFrom("webmaster@polytechnique.org");
- $mailer->addTo("web@polytechnique.org");
- $mailer->setSubject("INTERVENTION de ".S::v('forlife'));
- $mailer->setTxtBody(preg_replace("/[ \t]+/", ' ', $query));
+ $mailer = new PlMailer("admin/mail_intervention.tpl");
+ $mailer->assign("user", S::v('forlife'));
+ $mailer->assign("query", $query);
$mailer->send();
- $page->trig("updaté correctement.");
+ $page->trig("updaté correctement.");
}
if (Env::v('nomusageN') != $mr['nom_usage']) {
+ require_once "xorg.misc.inc.php";
set_new_usage($mr['user_id'], Env::v('nomusageN'), make_username(Env::v('prenomN'), Env::v('nomusageN')));
}
if (Env::v('decesN') != $mr['deces']) {
user_clear_all_subs($mr['user_id'], false);
}
- $r = XDB::query("SELECT *, a.alias AS forlife, u.flags AS sexe
+ $r = XDB::query("SELECT *, a.alias AS forlife,
+ FIND_IN_SET('watch', u.flags) AS watch, FIND_IN_SET('femme', u.flags) AS sexe
FROM auth_user_md5 AS u
LEFT JOIN aliases AS a ON (a.id = u.user_id AND type= 'a_vie')
WHERE u.user_id = {?}", $mr['user_id']);
// DELETE FROM auth_user_md5
case "u_kill":
user_clear_all_subs($mr['user_id']);
- $page->trig("'{$mr['user_id']}' a été désinscrit !");
- $mailer = new PlMailer();
- $mailer->setFrom("webmaster@polytechnique.org");
- $mailer->addTo("web@polytechnique.org");
- $mailer->setSubject("INTERVENTION de ".S::v('forlife'));
- $mailer->setTxtBody("\nUtilisateur $login désinscrit");
+ $page->trig("'{$mr['user_id']}' a été désinscrit !");
+ $mailer = new PlMailer("admin/mail_intervention.tpl");
+ $mailer->assign("user", S::v('forlife'));
+ $mailer->assign("query", "\nUtilisateur $login désinscrit");
$mailer->send();
break;
}
$page->changeTpl('admin/ax-xorg.tpl');
$page->assign('xorg_title','Polytechnique.org - Administration - AX/X.org');
- // liste des différences
+ // liste des différences
$res = XDB::query(
'SELECT u.promo,u.nom AS nom,u.prenom AS prenom,ia.nom AS nomax,ia.prenom AS prenomax,u.matricule AS mat,ia.matricule_ax AS matax
FROM auth_user_md5 AS u
ORDER BY u.promo,u.nom,u.prenom');
$page->assign('diffs', $res->fetchAllAssoc());
- // gens à l'ax mais pas chez nous
+ // gens à l'ax mais pas chez nous
$res = XDB::query(
'SELECT ia.promo,ia.nom,ia.nom_patro,ia.prenom
FROM identification_ax as ia
WHERE u.nom IS NULL');
$page->assign('mank', $res->fetchAllAssoc());
- // gens chez nous et pas à l'ax
+ // gens chez nous et pas à l'ax
$res = XDB::query('SELECT promo,nom,prenom FROM auth_user_md5 WHERE matricule_ax IS NULL');
$page->assign('plus', $res->fetchAllAssoc());
}
}
}
- function handler_validate(&$page, $action = 'list', $id = null) {
+ function handler_validate(&$page, $action = 'list', $id = null)
+ {
$page->changeTpl('admin/valider.tpl');
$page->assign('xorg_title','Polytechnique.org - Administration - Valider une demande');
+ $page->addCssLink('nl.css');
require_once("validations.inc.php");
+
if ($action == 'edit' and !is_null($id)) {
$page->assign('preview_id', $id);
}
$page->assign('vit', new ValidateIterator());
}
+
function handler_validate_answers(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Réponses automatiques de validation');
- $page->assign('title', 'Gestion des réponses automatiques');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Réponses automatiques de validation');
+ $page->assign('title', 'Gestion des réponses automatiques');
$table_editor = new PLTableEditor('admin/validate/answers','requests_answers','id');
- $table_editor->describe('category','catégorie',true);
+ $table_editor->describe('category','catégorie',true);
$table_editor->describe('title','titre',true);
$table_editor->describe('answer','texte',false);
$table_editor->apply($page, $action, $id);
$table_editor->apply($page, $action, $id);
}
function handler_mx_broken(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title', 'Polytechnique.org - Administration - MX Défaillants');
- $page->assign('title', 'MX Défaillant');
+ $page->assign('xorg_title', 'Polytechnique.org - Administration - MX Défaillants');
+ $page->assign('title', 'MX Défaillant');
$table_editor = new PLTableEditor('admin/mx/broken', 'mx_watch', 'host', true);
$table_editor->describe('host', 'Masque', true);
$table_editor->describe('state', 'Niveau', true);
- $table_editor->describe('text', 'Description du problème', false);
+ $table_editor->describe('text', 'Description du problème', false);
$table_editor->apply($page, $action, $id);
}
function handler_logger_actions(&$page, $action = 'list', $id = null) {
$page->assign('xorg_title','Polytechnique.org - Administration - Actions');
$page->assign('title', 'Gestion des actions de logger');
$table_editor = new PLTableEditor('admin/logger/actions','logger.actions','id');
- $table_editor->describe('text','intitulé',true);
+ $table_editor->describe('text','intitulé',true);
$table_editor->describe('description','description',true);
$table_editor->apply($page, $action, $id);
}
$page->assign('title', 'Gestion des coupures');
$table_editor = new PLTableEditor('admin/downtime','coupures','id');
$table_editor->describe('debut','date',true);
- $table_editor->describe('duree','durée',false);
- $table_editor->describe('resume','résumé',true);
- $table_editor->describe('services','services affectés',true);
+ $table_editor->describe('duree','durée',false);
+ $table_editor->describe('resume','résumé',true);
+ $table_editor->describe('services','services affectés',true);
$table_editor->describe('description','description',false);
$table_editor->apply($page, $action, $id);
}
$page->changeTpl('admin/wiki.tpl');
+ $page->addJsLink('jquery.js');
$page->assign('wiki_pages', $wiki_tree);
$page->assign('perms_opts', $perms);
}
$page->changeTpl('admin/ipwatcher.tpl');
$states = array('safe' => 'Ne pas surveiller',
- 'unsafe' => 'Surveiller les inscription',
- 'dangerous' => 'Surveiller tous les accès',
+ 'unsafe' => 'Surveiller les inscriptions',
+ 'dangerous' => 'Surveiller tous les accès',
'ban' => 'Bannir cette adresse');
$page->assign('states', $states);
$page->assign('action', $action);
if ($action == 'list') {
- $sql = "SELECT w.ip, s.host, w.detection, w.state, a.alias AS forlife
+ $sql = "SELECT w.ip, IF(w.ip = s.ip, s.host, s.forward_host), w.detection, w.state, a.alias AS forlife
FROM ip_watch AS w
- LEFT JOIN logger.sessions AS s USING(ip)
+ LEFT JOIN logger.sessions AS s ON (s.ip = w.ip OR s.forward_ip = w.ip)
LEFT JOIN aliases AS a ON (a.id = s.uid AND a.type = 'a_vie')
GROUP BY w.ip, a.alias
ORDER BY w.state, w.ip, a.alias";
}
}
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>