|
From: mdw c. <myd...@li...> - 2002-02-20 15:48:20
|
MyDynaWeb CVS committal
Author : sukria
Project : mydynaweb
Module : htdocs
Dir : mydynaweb/htdocs
Modified Files:
comment.php save_coment.php
Log Message:
Comments / Forum updates (improvements)
DONE:
- when sending comments to users, parsing the email end removing any "nospam" tags
- fixing the limit of indentation to 5
- adding the availability of displaying only the title of messages under a threshold
TODO:
- A navigation bar which would provide an easy way of look at the comments
===================================================================
RCS file: /cvsroot/mydynaweb/mydynaweb/htdocs/comment.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- comment.php 19 Feb 2002 18:37:31 -0000 1.18
+++ comment.php 20 Feb 2002 15:48:18 -0000 1.19
@@ -56,7 +56,11 @@
$PAGE .= get_piece_of_news($row[1], '<P>' . $row['texte'] . '<br><br>' .
$row['long_text'], $row[4], translate($row[5],$DBH), "news.php?q=$row[6]", $row[nbhit], $row[0], $row2[0], strlen($row['long_text']) * 8, sizeof($get_parents), $DBH);
-
+///////////////
+// Threshold
+if (!isset($threshold)) {
+ $threshold = -1;
+}
// The react button
$PAGE .= "<center><b><form action='add_comment.php'>
@@ -76,7 +80,7 @@
// Step 2 : print out the threads
if ($num_comments) {
foreach ($get_parents as $thread) {
- $PAGE .= print_message($thread, 0, $get_message, $get_children);
+ $PAGE .= print_message($thread, 0, $threshold, $get_message, $get_children);
}
}
@@ -101,26 +105,40 @@
can draw messages and their children...
*/
-function print_message ($num_cmt, $level, $get_message, $get_children)
+function print_message ($num_cmt, $level, $threshold, $get_message, $get_children)
{
$HTML = "";
$get_message[$num_cmt]['REACT'] = REACT;
$get_message[$num_cmt]['SIZE'] = 100;
+
+ // the limit of the identation : 5
+ if ($level > 5) $level = 5;
+
for ($i=0; $i<$level; $i++) {
$get_message[$num_cmt]['SIZE'] -= 5;
}
-
- if ($level == 0) { // a new thread
+
+ // a new thread
+ if ($level == 0) {
$HTML .= "<tr><td>" . get_template(THEMES_PATH."/thread.html", $get_message[$num_cmt]) . "</td></tr>";
}
- else {
+
+ // a comment fully displayed (under threshold)
+ else if (($threshold == -1) or ($threshold >= $level)) {
+ $get_message[$num_cmt]['desc'] = ("Reply to ".$get_message[$get_message[$num_cmt]['pere']]['title']);
$HTML .= "<tr><td>" . get_template(THEMES_PATH."/comment.html", $get_message[$num_cmt]) . "</td></tr>";
}
+ // a comment under the threshold : only the title
+ else {
+ $get_message[$num_cmt]['threshold'] = $level;
+ $HTML .= "<tr><td>". get_template(THEMES_PATH."/comment_title.html", $get_message[$num_cmt])."</td></tr>";
+ }
+
if (sizeof($get_children[$num_cmt])) {
foreach ($get_children[$num_cmt] as $child) {
- $HTML .= print_message($child, $level+1, $get_message, $get_children);
+ $HTML .= print_message($child, $level+1, $threshold, $get_message, $get_children);
}
}
===================================================================
RCS file: /cvsroot/mydynaweb/mydynaweb/htdocs/save_coment.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- save_coment.php 19 Feb 2002 00:33:16 -0000 1.11
+++ save_coment.php 20 Feb 2002 15:48:18 -0000 1.12
@@ -74,7 +74,10 @@
}
foreach ($trolls as $email=>$name) {
-
+ $email = str_replace('nospam.', '', $email);
+ $email = str_replace('nospam', '', $email);
+ $email = str_replace('.nospam', '', $email);
+
$sujet = (translate("NEW_COMMENT_ON", $DBH) . SITE_TITLE);
$headers .= "From: <".WEBMASTER_EMAIL.">\n";
$headers .= "X-Sender: <".WEBMASTER_EMAIL.">\n";
|