trombi done.
I'm quite happy with the results
try :
http://dev.m4x.org/listes/trombi.php?liste=test
JM: I love your fiche.php work. it still needs some css tweaks, but the general impress is wonderful
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: getphoto.php,v 1.5 2004-08-31 10:03:28 x2000habouzit Exp $
+ $Id: getphoto.php,v 1.6 2004-09-10 23:13:03 x2000habouzit Exp $
***************************************************************************/
Header("Content-type: image/".$myphoto->mimetype);
echo $myphoto->data;
} else {
- $result = $globals->db->query("SELECT attachmime, attach FROM photo WHERE uid = '{$_REQUEST['x']}'");
+ if(preg_match('/^\d*$/',$_REQUEST['x'])) {
+ $result = $globals->db->query("SELECT attachmime, attach FROM photo WHERE uid = '{$_REQUEST['x']}'");
+ } else {
+ $sql = "SELECT attachmime, attach
+ FROM photo AS p
+ INNER JOIN aliases AS a ON p.uid=a.id
+ WHERE alias='{$_REQUEST['x']}'";
+ $result = $globals->db->query($sql);
+ }
if( list($type,$data) = @mysql_fetch_row($result) ) {
Header( "Content-type: image/$type");
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2004 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************
+ $Id: trombi.php,v 1.1 2004-09-10 23:13:04 x2000habouzit Exp $
+ ***************************************************************************/
+
+if(empty($_REQUEST['liste'])) header('Location: index.php');
+$liste = $_REQUEST['liste'];
+
+require("auto.prepend.inc.php");
+new_skinned_page('listes/trombi.tpl', AUTH_COOKIE, true);
+include('xml-rpc-client.inc.php');
+
+$res = $globals->db->query("SELECT password FROM auth_user_md5 WHERE user_id={$_SESSION['uid']}");
+list($pass) = mysql_fetch_row($res);
+mysql_free_result($res);
+
+$client = new xmlrpc_client("http://{$_SESSION['uid']}:$pass@localhost:4949");
+$members = $client->get_members($liste);
+
+if(is_array($members)) {
+ $membres = Array();
+ foreach($members[1] as $member) {
+ if(preg_match('/^([^.]*.[^.]*.(\d\d\d\d))@polytechnique.org$/', $member[1], $matches)) {
+ $membres[$matches[2]][] = Array('n' => $member[0], 'l' => $matches[1]);
+ } else {
+ $membres[0][] = Array('l' => $member[1]);
+ }
+ }
+ ksort($membres);
+
+ $moderos = Array();
+ foreach($members[2] as $owner) {
+ list($m) = split('@',$owner);
+ $res = $globals->db->query("SELECT CONCAT(prenom, ' ', nom), promo
+ FROM auth_user_md5 AS u
+ INNER JOIN aliases AS a ON u.user_id = a.id
+ WHERE a.alias = '$m'");
+ if(list($nom, $promo) = mysql_fetch_row($res)) {
+ $moderos[$promo][] = Array('n' => $nom, 'l' => $m);
+ } else {
+ $moderos[0][] = Array('l' => $owner);
+ }
+ mysql_free_result($res);
+ }
+ ksort($moderos);
+
+ $page->assign_by_ref('details', $members[0]);
+ $page->assign_by_ref('members', $membres);
+ $page->assign_by_ref('owners', $moderos);
+
+} else
+ $page->assign('no_list',true);
+
+$page->run();
+?>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: liste.tpl,v 1.4 2004-09-10 22:47:19 x2000habouzit Exp $
+ $Id: liste.tpl,v 1.5 2004-09-10 23:13:04 x2000habouzit Exp $
***************************************************************************}
{dynamic}
</tr>
<tr>
<td colspan='2' class='center'>
- <a href='trombiliste.php?liste={$smarty.request.liste}'>trombino de la liste</a>
+ <a href='trombi.php?liste={$smarty.request.liste}'>trombino de la liste</a> (page longue à charger)
</td>
</tr>
</table>
--- /dev/null
+{***************************************************************************
+ * Copyright (C) 2003-2004 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************
+ $Id: trombi.tpl,v 1.1 2004-09-10 23:13:04 x2000habouzit Exp $
+ ***************************************************************************}
+
+{dynamic}
+
+{if $no_list}
+
+<p class='erreur'>La liste n'existe pas ou tu n'as pas le droit d'en voir les détails</p>
+
+{else}
+
+<div class="rubrique">
+ Liste {$smarty.request.liste}
+</div>
+
+<table class='tinybicol' cellpadding='0' cellspacing='0'>
+ <tr>
+ <td class='titre'> Adresse </td>
+ <td>{mailto address=$details.addr}</td>
+ </tr>
+ <tr>
+ <td class='titre'> Sujet </td>
+ <td>{$details.desc}</td>
+ </tr>
+ <tr>
+ <td class='titre'> Visibilité </td>
+ <td>{if $details.priv eq 0}publique{elseif $details.priv eq 1}privée{else}admin{/if}</td>
+ </tr>
+ <tr>
+ <td class='titre'> Diffusion </td>
+ <td>{if $details.diff}modérée{else}libre{/if}</td>
+ </tr>
+ <tr>
+ <td class='titre'> Inscription </td>
+ <td>{if $details.ins}modérée{else}libre{/if}</td>
+ </tr>
+ <tr>
+ <td colspan='2' class='center'>
+ <a href='liste.php?liste={$smarty.request.liste}'>Page de la liste</a>
+ </td>
+ </tr>
+</table>
+
+<div class='rubrique'>
+ modérateurs de la liste
+</div>
+
+<table cellpadding="8" cellspacing="2" style="width:100%;">
+ {foreach from=$owners item=xs key=promo}
+ {foreach from=$xs item=x}
+ {if $promo}
+ {cycle values="1,2,3" assign="loop"}
+ {if $loop eq "1"}<tr>{/if}
+ <td class='center'>
+ <img src="{"getphoto.php"|url}?x={$x.l}" width="110" alt=" [ PHOTO ] " />
+ <br />
+ <a href="javascript:x()" onclick="popWin('{"fiche.php"|url}?user={$x.l}')">
+ {$x.n} ({$promo})
+ </a>
+ </td>
+ {if $loop eq "3"}</tr>{/if}
+ {/if}
+ {/foreach}
+ {/foreach}
+ {if $loop eq "1"}
+ {cycle values="1,2,3" assign="loop"}
+ {cycle values="1,2,3" assign="loop"}
+ <td></td><td></td></tr>
+ {elseif $loop eq "2"}
+ {cycle values="1,2,3" assign="loop"}
+ <td></td></tr>
+ {/if}
+</table>
+
+<div class='rubrique'>
+ membres de la liste
+</div>
+
+<table cellpadding="8" cellspacing="2" style="width:100%;">
+ {foreach from=$members item=xs key=promo}
+ {foreach from=$xs item=x}
+ {if $promo}
+ {cycle values="1,2,3" assign="loop"}
+ {if $loop eq "1"}<tr>{/if}
+ <td class='center'>
+ <img src="{"getphoto.php"|url}?x={$x.l}" width="110" alt=" [ PHOTO ] " />
+ <br />
+ <a href="javascript:x()" onclick="popWin('{"fiche.php"|url}?user={$x.l}')">
+ {$x.n} ({$promo})
+ </a>
+ </td>
+ {if $loop eq "3"}</tr>{/if}
+ {/if}
+ {/foreach}
+ {/foreach}
+ {if $loop eq "1"}<td></td><td></td></tr>{elseif $loop eq "2"}<td></td></tr>{/if}
+</table>
+
+{/if}
+
+{/dynamic}
+
+{* vim:set et sw=2 sts=2 sws=2: *}