From: Vincent Zanotti Date: Sun, 12 Oct 2008 03:50:08 +0000 (+0200) Subject: Migrates to hruid a few pages (axletter admin, ipwatch, search). X-Git-Tag: xorg/0.10.0~86^2~5 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=90c614cd296ec8ead5b30e28ab7d44e9d49fcc4a;p=platal.git Migrates to hruid a few pages (axletter admin, ipwatch, search). Adds a few TODO for forlife uses that are to be fixed later. Signed-off-by: Vincent Zanotti --- diff --git a/htdocs/javascript/ajax.js b/htdocs/javascript/ajax.js index 71797f0..30a2f6e 100644 --- a/htdocs/javascript/ajax.js +++ b/htdocs/javascript/ajax.js @@ -142,12 +142,12 @@ function previewWiki(idFrom, idTo, withTitle, idShow) } } -function sendTestEmail(token, forlife) +function sendTestEmail(token, hruid) { - Ajax.update_html(null, 'emails/test' + (forlife == null ? '' : '/' + forlife) + '?token=' + token, + Ajax.update_html(null, 'emails/test' + (hruid == null ? '' : '/' + hruid) + '?token=' + token, function() { showTempMessage('mail_sent', "Un email a été envoyé avec succès" - + (forlife == null ? " sur ton adresse." : " sur l'adresse de " + forlife), + + (hruid == null ? " sur ton adresse." : " sur l'adresse de " + hruid), true); }); return false; } diff --git a/include/googleapps.inc.php b/include/googleapps.inc.php index fb9d52c..bc1549c 100644 --- a/include/googleapps.inc.php +++ b/include/googleapps.inc.php @@ -101,7 +101,7 @@ function post_queue_u_update($job) { // TODO(vincent.zanotti): add the url of gappsd, when available. class GoogleAppsAccount { - // User identification: user id, and forlife. + // User identification: user id, and hruid. private $user; public $g_account_name; diff --git a/include/vcard.inc.php b/include/vcard.inc.php index d16dae6..844d45f 100644 --- a/include/vcard.inc.php +++ b/include/vcard.inc.php @@ -83,6 +83,7 @@ class VCard extends PlVCard } // Emails + // TODO: this logic is not hruid-compatible; replace it. $entry->addMail(null, $user['bestalias'] . '@' . $globals->mail->domain, true); $entry->addMail(null, $user['bestalias'] . '@' . $globals->mail->domain2); if ($user['bestalias'] != $user['forlife']) { diff --git a/modules/admin.php b/modules/admin.php index e2043e5..a9eddc6 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -880,9 +880,8 @@ class AdminModule extends PLModule $page->setTitle('Administration - Décédés'); $res = XDB::iterator( - "SELECT u.promo, u.nom, u.prenom, u.deces, u.matricule_ax, a.alias, DATE(MAX(s.start)) AS last + "SELECT u.promo, u.nom, u.prenom, u.deces, u.matricule_ax, u.hruid, DATE(MAX(s.start)) AS last FROM auth_user_md5 AS u - LEFT JOIN aliases AS a ON (a.id = u.user_id AND a.type = 'a_vie') LEFT JOIN logger.sessions AS s ON (s.uid = u.user_id AND suid = 0) WHERE perms IN ('admin', 'user') AND deces <> 0 GROUP BY u.user_id @@ -1051,7 +1050,7 @@ class AdminModule extends PLModule { if (S::v('core_rss_hash')) { $page->setRssLink('Changement Récents', - '/Site/AllRecentChanges?action=rss&user=' . S::v('forlife') . '&hash=' . S::v('core_rss_hash')); + '/Site/AllRecentChanges?action=rss&user=' . S::v('hruid') . '&hash=' . S::v('core_rss_hash')); } // update wiki perms @@ -1160,18 +1159,18 @@ class AdminModule extends PLModule $sql = "SELECT w.ip, IF(s.ip IS NULL, IF(w.ip = s2.ip, s2.host, s2.forward_host), IF(w.ip = s.ip, s.host, s.forward_host)), - w.mask, w.detection, w.state, a.alias AS forlife + w.mask, w.detection, w.state, u.hruid FROM ip_watch AS w LEFT JOIN logger.sessions AS s ON (s.ip = w.ip) LEFT JOIN logger.sessions AS s2 ON (s2.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"; + LEFT JOIN auth_user_md5 AS u ON (u.user_id = s.uid) + GROUP BY w.ip, u.hruid + ORDER BY w.state, w.ip, u.hruid"; $it = Xdb::iterRow($sql); $table = array(); $props = array(); - while (list($ip, $host, $mask, $date, $state, $forlife) = $it->next()) { + while (list($ip, $host, $mask, $date, $state, $hruid) = $it->next()) { $ip = uint_to_ip($ip); $mask = uint_to_ip($mask); if (count($props) == 0 || $props['ip'] != $ip) { @@ -1183,9 +1182,9 @@ class AdminModule extends PLModule 'host' => $host, 'detection' => $date, 'state' => $state, - 'users' => array($forlife)); + 'users' => array($hruid)); } else { - $props['users'][] = $forlife; + $props['users'][] = $hruid; } } if (count($props) > 0) { @@ -1194,18 +1193,18 @@ class AdminModule extends PLModule $page->assign('table', $table); } elseif ($action == 'edit') { $sql = "SELECT w.detection, w.state, w.last, w.description, w.mask, - a1.alias AS edit, a2.alias AS forlife, s.host + u1.hruid AS edit, u2.hruid AS hruid, s.host FROM ip_watch AS w - LEFT JOIN aliases AS a1 ON (a1.id = w.uid AND a1.type = 'a_vie') + LEFT JOIN auth_user_md5 AS u1 ON (u1.user_id = w.uid) LEFT JOIN logger.sessions AS s ON (w.ip = s.ip) - LEFT JOIN aliases AS a2 ON (a2.id = s.uid AND a2.type = 'a_vie') + LEFT JOIN auth_user_md5 AS u2 ON (u2.user_id = s.uid) WHERE w.ip = {?} - GROUP BY a2.alias - ORDER BY a2.alias"; + GROUP BY u2.hruid + ORDER BY u2.hruid"; $it = Xdb::iterRow($sql, ip_to_uint($ip)); $props = array(); - while (list($detection, $state, $last, $description, $mask, $edit, $forlife, $host) = $it->next()) { + while (list($detection, $state, $last, $description, $mask, $edit, $hruid, $host) = $it->next()) { if (count($props) == 0) { $props = array('ip' => $ip, 'mask' => uint_to_ip($mask), @@ -1215,9 +1214,9 @@ class AdminModule extends PLModule 'last' => $last, 'description' => $description, 'edit' => $edit, - 'users' => array($forlife)); + 'users' => array($hruid)); } else { - $props['users'][] = $forlife; + $props['users'][] = $hruid; } } $page->assign('ip', $props); diff --git a/modules/axletter.php b/modules/axletter.php index 8bd7b2d..9414f8d 100644 --- a/modules/axletter.php +++ b/modules/axletter.php @@ -309,10 +309,9 @@ class AXLetterModule extends PLModule $page->changeTpl('axletter/admin.tpl'); $res = XDB::iterator("SELECT IF(u.nom_usage != '', u.nom_usage, u.nom) AS nom, - u.prenom, u.promo, a.alias AS forlife + u.prenom, u.promo, u.hruid FROM axletter_rights AS ar - INNER JOIN auth_user_md5 AS u USING(user_id) - INNER JOIN aliases AS a ON (u.user_id = a.id AND a.type = 'a_vie')"); + INNER JOIN auth_user_md5 AS u USING(user_id)"); $page->assign('admins', $res); $importer = new CSVImporter('axletter_ins'); diff --git a/modules/search.php b/modules/search.php index 2ab0e37..2428b34 100644 --- a/modules/search.php +++ b/modules/search.php @@ -107,8 +107,8 @@ class SearchModule extends PLModule if ($user) { pl_redirect($base . $user->login()); } - $_REQUEST['quick'] = $forlife; - $_GET['quick'] = $forlife; + $_REQUEST['quick'] = $login; + $_GET['quick'] = $login; } elseif (strpos($quick, 'doc:') === 0) { $url = 'Docs/Recherche?'; $url .= 'action=search&q=' . urlencode(substr($quick, 4)); diff --git a/templates/admin/dead_but_active.tpl b/templates/admin/dead_but_active.tpl index b7ecb11..623929a 100644 --- a/templates/admin/dead_but_active.tpl +++ b/templates/admin/dead_but_active.tpl @@ -38,10 +38,10 @@ {$d.promo} - {icon name=user_suit title='Afficher la fiche'} + {icon name=user_suit title='Afficher la fiche'} {* *}{icon name=user_gray title="fiche AX"} - {icon name=wrench title='Administrer user'} + {icon name=wrench title='Administrer user'} {$d.prenom} {$d.nom} {$d.deces} diff --git a/templates/axletter/admin.tpl b/templates/axletter/admin.tpl index f4c3bac..16bab10 100644 --- a/templates/axletter/admin.tpl +++ b/templates/axletter/admin.tpl @@ -37,8 +37,8 @@ {iterate item=a from=$admins} - {$a.prenom} {$a.nom} (X{$a.promo}){icon name=user_suit} - {icon name=cross title="Retirer"} + {$a.prenom} {$a.nom} (X{$a.promo}){icon name=user_suit} + {icon name=cross title="Retirer"} {/iterate}