[Trivialibre] r396 - trivialibre/trunk
trivialibre at enix.org
trivialibre at enix.org
Dim 27 Aou 19:48:03 CEST 2006
Author: thomas
Date: Sun Aug 27 19:48:01 2006
New Revision: 396
Modified:
trivialibre/trunk/html.php
trivialibre/trunk/index.php
Log:
* html.php, index.php:
- Liste des questions par auteur.
Modified: trivialibre/trunk/html.php
==============================================================================
--- trivialibre/trunk/html.php (original)
+++ trivialibre/trunk/html.php Sun Aug 27 19:48:01 2006
@@ -27,12 +27,26 @@
require('bd.inc.php');
header_show();
-function html_display_category ($category, $status)
+function html_display_category ($category, $status, $author)
{
- echo "<h1>Questions <i>" . category_get($category) . "</i>" . (($status == 0) ? " en attente de modération" : "") . "</h1>\n";
-
$db = new db();
- $req = $db->query ("select question, answer from tvl_questions where status=" . $status . " and category=" . $category);
+
+ echo "<h1>Questions <i>" . category_get($category) . "</i>";
+ if ($author != "")
+ {
+ $req = $db->query("select author_name from tvl_questions where author_email='" . $author . "' limit 1");
+ $item = mysql_fetch_object($req);
+ echo " de " . $item->author_name;
+ }
+ if ($status == 0)
+ echo " en attente de modération";
+ echo "</h1>\n";
+
+ $sql = "select question, answer from tvl_questions where status=" . $status . " and category=" . $category;
+ if ($author != "")
+ $sql .= " and author_email='" . $author . "'";
+
+ $req = $db->query ($sql);
$count = 0;
echo "<table width=\"100%\">";
@@ -55,16 +69,26 @@
$status = 1;
}
+if (ereg("^([A-Za-z0-9_\.\-]*)@([A-Za-z0-9_\-]*)\.([A-Za-z0-9_\.\-]*)$", $_GET['author']))
+{
+ $author = $_GET['author'];
+}
+else
+{
+ $author = "";
+}
+
+
if (isset($_GET['category']) && $_GET['category'] >= 0 && $_GET['category'] < 6)
{
- html_display_category ($_GET['category'], $status);
+ html_display_category ($_GET['category'], $status, $author);
}
else
{
/* Display the questions category by category */
for ($i = 0; $i < 6; $i++)
{
- html_display_category ($i, $status);
+ html_display_category ($i, $status, $author);
}
}
Modified: trivialibre/trunk/index.php
==============================================================================
--- trivialibre/trunk/index.php (original)
+++ trivialibre/trunk/index.php Sun Aug 27 19:48:01 2006
@@ -167,14 +167,14 @@
<table width="50%" align="center">
<?php
$db = new db();
- $req = $db->query ("select author_name, count(*) as nb from tvl_questions where status=1 group by author_name order by nb desc");
+ $req = $db->query ("select author_name, author_email, count(*) as nb from tvl_questions where status=1 group by author_name order by nb desc");
$i = 0;
while ($item = mysql_fetch_array($req))
{
?>
<tr class="<?php echo ($i++ % 2 == 0) ? "odd" : "even"; ?>">
<td><?php echo utf8_encode($item[0]); ?></td>
- <td><?php echo $item[1]; ?></td>
+ <td><a href="html.php?author=<?php echo $item[1]; ?>"><?php echo $item[2]; ?></a></td>
</tr>
<?php
}
Plus d'informations sur la liste de diffusion Trivialibre