Last Comments/Ratings Fixes. Disable MetaRatings, Reimplement rating average stars, linkify commenters names for null-rating posts from devcp. Bug 247144.

This commit is contained in:
psychoticwolf%carolina.rr.com 2004-12-20 13:38:30 +00:00
Родитель 98f5b200ad
Коммит 0f407e9c2f
6 изменённых файлов: 117 добавлений и 16 удалений

Просмотреть файл

@ -36,6 +36,10 @@
//
// ***** END LICENSE BLOCK *****
//XXX -- Meta-Ratings not yet production ready. Disabled for Update 1.0. Bug 247144.
exit("Meta-Ratings Disabled");
//Submit Review/Rating Feedback to Table
require"../core/config.php";

Просмотреть файл

@ -28,7 +28,7 @@ if ($_POST["submit"]=="Flag Selected" or $_POST["submit"]=="Delete Selected") {
<h1>Updating comments list, please wait...</h1>
<?php
//Process Post Data, Make Changes to User Table.
//Process Post Data, Make Changes to Feedback Table.
//Begin General Updating
for ($i=1; $i<=$_POST[maxid]; $i++) {
if (!$_POST["selected_$i"]) {
@ -75,9 +75,10 @@ $startpoint = ($pageid-1)*$items_per_page;
$id = escape_string($_GET["id"]);
$sql = "SELECT `Name` FROM `main` WHERE `ID`='$id' LIMIT 1";
$sql = "SELECT `Type`,`Name` FROM `main` WHERE `ID`='$id' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$row = mysql_fetch_array($sql_result);
$type = $row["Type"];
$name = $row["Name"];
$sql = "SELECT CommentID FROM `feedback` WHERE ID = '$id'";
@ -250,6 +251,14 @@ echo"<h2>Submitting Comment, please wait...</h2>\n";
$title = escape_string($_POST["title"]);
$comments = escape_string($_POST["notes"]);
if ($_POST["type"]=="E") {
$type="extensions";
} else if ($_POST["type"]=="T") {
$type="themes";
}
$name = "<a href=\"/$type/authorprofiles?id=$_SESSION[uid]\">$_SESSION[name]</a>";
$sql = "INSERT INTO `feedback` (`ID`, `CommentName`, `CommentVote`, `CommentTitle`, `CommentNote`, `CommentDate`, `commentip`) VALUES ('$id', '$name', NULL, '$title', '$comments', NOW(NULL), '$_SERVER[REMOTE_ADDR]');";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
if ($sql_result) {
@ -270,6 +279,7 @@ Need to make a reply comment or answer a question somebody left who didn't provi
<form name="addcoment" method="post" action="?id=<?php echo"$id"; ?>&action=addcomment#addcomment">
<?writeFormKey();?>
<input name="id" type="hidden" value="<?php echo"$id"; ?>">
<input name="type" type="hidden" value="<?php echo"$type"; ?>">
<input name="name" type="hidden" value="<?php echo"$_SESSION[name]"; ?>">
<strong>Title:</strong> <input name="title" type="text" size="30" maxlength="150" value=""><br>
<strong>Comment:</strong><br>

Просмотреть файл

@ -272,7 +272,26 @@ $sql = "SELECT TM.ID, TM.Name, TM.DateAdded, TM.DateUpdated, TM.Homepage, TM.Des
?>
<div id="mainContent">
<div class="rating">Rating: <img src="/images/stars-3-8.gif" width="90" height="20" title="3.8 Stars out of 5" alt="3.8 Stars"></div>
<?php
if ($rating != NULL) {
?>
<div class="rating" title="<?php echo"$rating"; ?> Stars out of 5">Rating: <?php
for ($i = 1; $i <= floor($rating); $i++) {
echo"<IMG SRC=\"/images/stars/star_icon.png\" width=\"17\" height=\"20\" ALT=\""; if ($i==1) {echo"$rating stars out of 5 ";} echo"\">";
}
if ($rating>floor($rating)) {
$val = ($rating-floor($rating))*10;
echo"<IMG SRC=\"/images/stars/star_0$val.png\" width=\"17\" height=\"20\" ALT=\"\">";
$i++;
}
for ($i = $i; $i <= 5; $i++) {
echo"<IMG SRC=\"/images/stars/graystar_icon.png\" width=\"17\" height=\"20\" ALT=\""; if ($i==1) {echo"$rating stars out of 5 ";} echo"\">";
}
?>
</div>
<?php } ?>
<h2 class="first"><strong><?php echo"$name"; ?></strong> - <?php echo ucwords("$application")." Extension"; ?></h2>
<p class="first"><?php echo"$name $version"; ?>, by <?php echo"$authors"; ?>, released on <?php echo"$releasedate"; ?></p>
@ -402,6 +421,7 @@ $sql = "SELECT TM.ID, TM.Name, TM.DateAdded, TM.DateUpdated, TM.Homepage, TM.Des
echo"<h4>$commenttitle by $commentname</h4>\n";
echo"<p class=\"opinions-date\"><a href=\"#permalink\">$commentdate</a></p>\n";
echo"<p class=\"opinions-text\">$commentnotes</P>\n";
if ($rating != NULL) {
echo"<p class=\"opinions-rating\" title=\"$rating of 5 stars\">";
for ($i = 1; $i <= $rating; $i++) {
echo"<IMG SRC=\"/images/stars/star_icon.png\" WIDTH=17 HEIGHT=20 ALT=\"*\">";
@ -410,6 +430,7 @@ $sql = "SELECT TM.ID, TM.Name, TM.DateAdded, TM.DateUpdated, TM.Homepage, TM.Des
echo"<IMG SRC=\"/images/stars/graystar_icon.png\" WIDTH=17 HEIGHT=20 ALT=\"\">";
}
echo"</p>\n";
}
echo"</li>\n";
}
@ -572,6 +593,7 @@ $sql = "SELECT TM.ID, TM.Name, TM.DateAdded, TM.DateUpdated, TM.Homepage, TM.Des
echo"<h4>$title by $name</h4>\n";
echo"<p class=\"opinions-date\"><a href=\"#$commentid\">$date</a></p>\n";
echo"<p class=\"opinions-text\">$notes</P>\n";
if ($rating != NULL) {
echo"<p class=\"opinions-rating\" title=\"$rating of 5 stars\">";
for ($i = 1; $i <= $rating; $i++) {
echo"<IMG SRC=\"/images/stars/star_icon.png\" WIDTH=17 HEIGHT=20 ALT=\"*\">";
@ -579,16 +601,19 @@ $sql = "SELECT TM.ID, TM.Name, TM.DateAdded, TM.DateUpdated, TM.Homepage, TM.Des
for ($i = $i; $i <= 5; $i++) {
echo"<IMG SRC=\"/images/stars/graystar_icon.png\" WIDTH=17 HEIGHT=20 ALT=\"\">";
}
if ($helpful_yes>0 or $helpful_no>0) {
$helpful_total=$helpful_yes+$helpful_no;
echo"<br>$helpful_yes of $helpful_total people found this comment helpful.<br>\n";
}
echo"Was this comment helpful to you? <a href=\"../core/commenthelpful.php?".uriparams()."&amp;id=$id&amp;type=$type&amp;commentid=$commentid&amp;pageid=$pageid&amp;action=yes\">Yes</a>&nbsp;&nbsp;&nbsp;<a href=\"../core/commenthelpful.php?".uriparams()."&amp;id=$id&amp;type=$type&amp;commentid=$commentid&amp;pageid=$pageid&amp;action=no\">No</a>";
//XXX Meta-Ratings not Production Ready, disabled. Bug 247144.
// if ($helpful_yes>0 or $helpful_no>0) {
// $helpful_total=$helpful_yes+$helpful_no;
// echo"<br>$helpful_yes of $helpful_total people found this comment helpful.<br>\n";
// }
//echo"Was this comment helpful to you? <a href=\"../core/commenthelpful.php?".uriparams()."&amp;id=$id&amp;type=$type&amp;commentid=$commentid&amp;pageid=$pageid&amp;action=yes\">Yes</a>&nbsp;&nbsp;&nbsp;<a href=\"../core/commenthelpful.php?".uriparams()."&amp;id=$id&amp;type=$type&amp;commentid=$commentid&amp;pageid=$pageid&amp;action=no\">No</a>";
echo" <span style=\"font-size: xx-small\"><a href=\"../core/reportcomment.php?".uriparams()."&amp;id=$id&amp;type=$type&amp;commentid=$commentid&amp;pageid=$pageid&amp;action=report\" ONCLICK=\"return confirm('Report this comment as inappropriate on the site?');\">(Report Comment)</a></span>";
echo"<BR>";
echo"</p>\n";
}
echo"</li>\n";
}

Просмотреть файл

@ -365,8 +365,26 @@ $datestring = "$datetitle $date";
echo"<DIV class=\"item\">\n";
echo"<div class=\"rating\">Rating: <img src=\"/images/stars-3-8.gif\" width=\"90\" height=\"20\" title=\"3.8 Stars out of 5\" alt=\"3.8 Stars\"></div>\n";
if ($rating != NULL) {
echo"<div class=\"rating\" title=\"$rating Stars out of 5\">Rating: ";
for ($i = 1; $i <= floor($rating); $i++) {
echo"<IMG SRC=\"/images/stars/star_icon.png\" width=\"17\" height=\"20\" ALT=\""; if ($i==1) {echo"$rating stars out of 5 ";} echo"\">";
}
if ($rating>floor($rating)) {
$val = ($rating-floor($rating))*10;
echo"<IMG SRC=\"/images/stars/star_0$val.png\" width=\"17\" height=\"20\" ALT=\"\">";
$i++;
}
for ($i = $i; $i <= 5; $i++) {
echo"<IMG SRC=\"/images/stars/graystar_icon.png\" width=\"17\" height=\"20\" ALT=\""; if ($i==1) {echo"$rating stars out of 5 ";} echo"\">";
}
echo"</div>\n";
}
echo"<h2 class=\"first\"><A HREF=\"moreinfo.php?".uriparams()."&amp;id=$id\">$name $version</A></h2>";

Просмотреть файл

@ -272,7 +272,26 @@ $sql = "SELECT TM.ID, TM.Name, TM.DateAdded, TM.DateUpdated, TM.Homepage, TM.Des
?>
<div id="mainContent">
<div class="rating">Rating: <img src="/images/stars-3-8.gif" width="90" height="20" title="3.8 Stars out of 5" alt="3.8 Stars"></div>
<?php
if ($rating != NULL) {
?>
<div class="rating" title="<?php echo"$rating"; ?> Stars out of 5">Rating: <?php
for ($i = 1; $i <= floor($rating); $i++) {
echo"<IMG SRC=\"/images/stars/star_icon.png\" width=\"17\" height=\"20\" ALT=\""; if ($i==1) {echo"$rating stars out of 5 ";} echo"\">";
}
if ($rating>floor($rating)) {
$val = ($rating-floor($rating))*10;
echo"<IMG SRC=\"/images/stars/star_0$val.png\" width=\"17\" height=\"20\" ALT=\"\">";
$i++;
}
for ($i = $i; $i <= 5; $i++) {
echo"<IMG SRC=\"/images/stars/graystar_icon.png\" width=\"17\" height=\"20\" ALT=\""; if ($i==1) {echo"$rating stars out of 5 ";} echo"\">";
}
?>
</div>
<?php } ?>
<h2 class="first"><strong><?php echo"$name"; ?></strong> - <?php echo ucwords("$application")." Theme"; ?></h2>
<p class="first"><?php echo"$name $version"; ?>, by <?php echo"$authors"; ?>, released on <?php echo"$releasedate"; ?></p>
@ -402,6 +421,7 @@ $sql = "SELECT TM.ID, TM.Name, TM.DateAdded, TM.DateUpdated, TM.Homepage, TM.Des
echo"<h4>$commenttitle by $commentname</h4>\n";
echo"<p class=\"opinions-date\"><a href=\"#permalink\">$commentdate</a></p>\n";
echo"<p class=\"opinions-text\">$commentnotes</P>\n";
if ($rating != NULL) {
echo"<p class=\"opinions-rating\" title=\"$rating of 5 stars\">";
for ($i = 1; $i <= $rating; $i++) {
echo"<IMG SRC=\"/images/stars/star_icon.png\" WIDTH=17 HEIGHT=20 ALT=\"*\">";
@ -410,6 +430,7 @@ $sql = "SELECT TM.ID, TM.Name, TM.DateAdded, TM.DateUpdated, TM.Homepage, TM.Des
echo"<IMG SRC=\"/images/stars/graystar_icon.png\" WIDTH=17 HEIGHT=20 ALT=\"\">";
}
echo"</p>\n";
}
echo"</li>\n";
}
@ -572,6 +593,7 @@ $sql = "SELECT TM.ID, TM.Name, TM.DateAdded, TM.DateUpdated, TM.Homepage, TM.Des
echo"<h4>$title by $name</h4>\n";
echo"<p class=\"opinions-date\"><a href=\"#$commentid\">$date</a></p>\n";
echo"<p class=\"opinions-text\">$notes</P>\n";
if ($rating != NULL) {
echo"<p class=\"opinions-rating\" title=\"$rating of 5 stars\">";
for ($i = 1; $i <= $rating; $i++) {
echo"<IMG SRC=\"/images/stars/star_icon.png\" WIDTH=17 HEIGHT=20 ALT=\"*\">";
@ -579,16 +601,19 @@ $sql = "SELECT TM.ID, TM.Name, TM.DateAdded, TM.DateUpdated, TM.Homepage, TM.Des
for ($i = $i; $i <= 5; $i++) {
echo"<IMG SRC=\"/images/stars/graystar_icon.png\" WIDTH=17 HEIGHT=20 ALT=\"\">";
}
if ($helpful_yes>0 or $helpful_no>0) {
$helpful_total=$helpful_yes+$helpful_no;
echo"<br>$helpful_yes of $helpful_total people found this comment helpful.<br>\n";
}
echo"Was this comment helpful to you? <a href=\"../core/commenthelpful.php?".uriparams()."&amp;id=$id&amp;type=$type&amp;commentid=$commentid&amp;pageid=$pageid&amp;action=yes\">Yes</a>&nbsp;&nbsp;&nbsp;<a href=\"../core/commenthelpful.php?".uriparams()."&amp;id=$id&amp;type=$type&amp;commentid=$commentid&amp;pageid=$pageid&amp;action=no\">No</a>";
//XXX Meta-Ratings not Production Ready, disabled. Bug 247144.
// if ($helpful_yes>0 or $helpful_no>0) {
// $helpful_total=$helpful_yes+$helpful_no;
// echo"<br>$helpful_yes of $helpful_total people found this comment helpful.<br>\n";
// }
// echo"Was this comment helpful to you? <a href=\"../core/commenthelpful.php?".uriparams()."&amp;id=$id&amp;type=$type&amp;commentid=$commentid&amp;pageid=$pageid&amp;action=yes\">Yes</a>&nbsp;&nbsp;&nbsp;<a href=\"../core/commenthelpful.php?".uriparams()."&amp;id=$id&amp;type=$type&amp;commentid=$commentid&amp;pageid=$pageid&amp;action=no\">No</a>";
echo" <span style=\"font-size: xx-small\"><a href=\"../core/reportcomment.php?".uriparams()."&amp;id=$id&amp;type=$type&amp;commentid=$commentid&amp;pageid=$pageid&amp;action=report\" ONCLICK=\"return confirm('Report this comment as inappropriate on the site?');\">(Report Comment)</a></span>";
echo"<BR>";
echo"</p>\n";
}
echo"</li>\n";
}

Просмотреть файл

@ -366,7 +366,26 @@ $datestring = "$datetitle $date";
echo"<DIV class=\"item\">\n";
echo"<div class=\"rating\">Rating: <img src=\"/images/stars-3-8.gif\" width=\"90\" height=\"20\" title=\"3.8 Stars out of 5\" alt=\"3.8 Stars\"></div>\n";
if ($rating != NULL) {
echo"<div class=\"rating\" title=\"$rating Stars out of 5\">Rating: ";
for ($i = 1; $i <= floor($rating); $i++) {
echo"<IMG SRC=\"/images/stars/star_icon.png\" width=\"17\" height=\"20\" ALT=\""; if ($i==1) {echo"$rating stars out of 5 ";} echo"\">";
}
if ($rating>floor($rating)) {
$val = ($rating-floor($rating))*10;
echo"<IMG SRC=\"/images/stars/star_0$val.png\" width=\"17\" height=\"20\" ALT=\"\">";
$i++;
}
for ($i = $i; $i <= 5; $i++) {
echo"<IMG SRC=\"/images/stars/graystar_icon.png\" width=\"17\" height=\"20\" ALT=\""; if ($i==1) {echo"$rating stars out of 5 ";} echo"\">";
}
echo"</div>\n";
}
echo"<h2 class=\"first\"><A HREF=\"moreinfo.php?".uriparams()."&amp;id=$id\">$name $version</A></h2>";