- new Comment class
- improved performances (much less duplicated mysql queries) - less code and better error handling - informs the whole thread when posting new comment - fix various bugs
This commit is contained in:
@@ -10,6 +10,7 @@ include("path.php");
|
|||||||
require(BASE."include/incl.php");
|
require(BASE."include/incl.php");
|
||||||
require(BASE."include/application.php");
|
require(BASE."include/application.php");
|
||||||
require(BASE."include/mail.php");
|
require(BASE."include/mail.php");
|
||||||
|
require(BASE."include/comment.php");
|
||||||
|
|
||||||
// you must be logged in to submit comments
|
// you must be logged in to submit comments
|
||||||
if(!$_SESSION['current']->isLoggedIn())
|
if(!$_SESSION['current']->isLoggedIn())
|
||||||
@@ -19,17 +20,12 @@ if(!$_SESSION['current']->isLoggedIn())
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_numeric($_REQUEST['appId']))
|
if(!is_numeric($_REQUEST['versionId']))
|
||||||
{
|
{
|
||||||
errorpage('Internal Database Access Error');
|
errorpage('Internal Database Access Error');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_numeric($_REQUEST['versionId']))
|
|
||||||
{
|
|
||||||
$_REQUEST['versionId'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!is_numeric($_REQUEST['thread']))
|
if(!is_numeric($_REQUEST['thread']))
|
||||||
{
|
{
|
||||||
$_REQUEST['thread'] = 0;
|
$_REQUEST['thread'] = 0;
|
||||||
@@ -40,47 +36,9 @@ if(!is_numeric($_REQUEST['thread']))
|
|||||||
############################
|
############################
|
||||||
if(isset($_REQUEST['body']))
|
if(isset($_REQUEST['body']))
|
||||||
{
|
{
|
||||||
$hostname = get_remote();
|
$oComment = new Comment();
|
||||||
|
$oComment->create($_REQUEST['subject'], $_REQUEST['body'], $_REQUEST['thread'], $_REQUEST['versionId']);
|
||||||
// get current userid
|
redirect(apidb_fullurl("appview.php?versionId=".$oComment->iVersionId));
|
||||||
$userId = $_SESSION['current']->userid;
|
|
||||||
|
|
||||||
$aInsert = compile_insert_string(array( 'parentId' => $_REQUEST['thread'],
|
|
||||||
'appId' => $_REQUEST['appId'],
|
|
||||||
'versionId' => $_REQUEST['versionId'],
|
|
||||||
'userId' => $userId,
|
|
||||||
'hostname' => $hostname,
|
|
||||||
'subject' => $_REQUEST['subject'],
|
|
||||||
'body' => $_REQUEST['body']));
|
|
||||||
|
|
||||||
$result = query_appdb("INSERT INTO appComments (`time`, {$aInsert['FIELDS']}) VALUES (NOW(), {$aInsert['VALUES']})");
|
|
||||||
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$sEmail = $oOriginator->sEmail;
|
|
||||||
$sFullAppName = "Comment added to ".lookupAppName($_REQUEST['appId'])." ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
|
|
||||||
$sMsg = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId'].".\n";
|
|
||||||
$sMsg .= "\n";
|
|
||||||
$sMsg .= $_SESSION['current']->sRealname." added comment to ".$sFullAppName."\n";
|
|
||||||
$sMsg .= "\n";
|
|
||||||
$sMsg .= "Subject: ".$_REQUEST['subject']."\n";
|
|
||||||
$sMsg .= $_REQUEST['body']."\n";
|
|
||||||
|
|
||||||
$oOriginator = new User($_REQUEST['originator']);
|
|
||||||
if ($oOriginator->wantsEmail())
|
|
||||||
{
|
|
||||||
mail_appdb($sEmail, $sFullAppName ,$sMsg);
|
|
||||||
addmsg("Comment message sent to original poster", "green");
|
|
||||||
}
|
|
||||||
|
|
||||||
$sEmail = get_notify_email_address_list($_REQUEST['appId'], $_REQUEST['versionId']);
|
|
||||||
if($sEmail)
|
|
||||||
{
|
|
||||||
mail_appdb($sEmail, $sFullAppName ,$sMsg);
|
|
||||||
}
|
|
||||||
addmsg("New comment posted.", "green");
|
|
||||||
}
|
|
||||||
redirect(apidb_fullurl("appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
################################
|
################################
|
||||||
@@ -133,10 +91,6 @@ else
|
|||||||
}
|
}
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
<p> </p>
|
|
||||||
|
|
||||||
<?
|
|
||||||
apidb_footer();
|
apidb_footer();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/************************************************************/
|
/************************************************************/
|
||||||
|
|
||||||
include("path.php");
|
include("path.php");
|
||||||
include(BASE."include/"."incl.php");
|
include(BASE."include/incl.php");
|
||||||
require(BASE."include/"."comments.php");
|
require(BASE."include/comment.php");
|
||||||
|
|
||||||
apidb_header("Comments");
|
apidb_header("Comments");
|
||||||
|
|
||||||
|
|||||||
118
appview.php
118
appview.php
@@ -9,7 +9,7 @@
|
|||||||
include("path.php");
|
include("path.php");
|
||||||
require(BASE."include/incl.php");
|
require(BASE."include/incl.php");
|
||||||
require(BASE."include/application.php");
|
require(BASE."include/application.php");
|
||||||
require(BASE."include/comments.php");
|
require(BASE."include/comment.php");
|
||||||
require(BASE."include/appdb.php");
|
require(BASE."include/appdb.php");
|
||||||
require(BASE."include/vote.php");
|
require(BASE."include/vote.php");
|
||||||
require(BASE."include/category.php");
|
require(BASE."include/category.php");
|
||||||
@@ -142,8 +142,8 @@ function display_versions($appId, $versions)
|
|||||||
//set row color
|
//set row color
|
||||||
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
|
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
|
||||||
|
|
||||||
//format desc
|
// Description
|
||||||
$desc = substr(stripslashes($ver->description),0,75);
|
$desc = trim_description($ver->description);
|
||||||
if(strlen($desc) == 75)
|
if(strlen($desc) == 75)
|
||||||
$desc .= " ...";
|
$desc .= " ...";
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ function display_versions($appId, $versions)
|
|||||||
|
|
||||||
//display row
|
//display row
|
||||||
echo "<tr class=$bgcolor>\n";
|
echo "<tr class=$bgcolor>\n";
|
||||||
echo " <td><a href='appview.php?appId=$appId&versionId=$ver->versionId'>".$ver->versionName."</a></td>\n";
|
echo " <td><a href='appview.php?versionId=$ver->versionId'>".$ver->versionName."</a></td>\n";
|
||||||
echo " <td>$desc </td>\n";
|
echo " <td>$desc </td>\n";
|
||||||
echo " <td align=center>$ver->maintainer_rating</td>\n";
|
echo " <td align=center>$ver->maintainer_rating</td>\n";
|
||||||
echo " <td align=center>$ver->maintainer_release</td>\n";
|
echo " <td align=center>$ver->maintainer_release</td>\n";
|
||||||
@@ -172,25 +172,16 @@ function display_versions($appId, $versions)
|
|||||||
/**
|
/**
|
||||||
* We want to see an application family (=no version)
|
* We want to see an application family (=no version)
|
||||||
*/
|
*/
|
||||||
if(!is_numeric($_REQUEST['appId']))
|
if(!is_numeric($_REQUEST['appId']) && !is_numeric($_REQUEST['versionId']))
|
||||||
{
|
{
|
||||||
errorpage("Something went wrong with the application ID");
|
errorpage("Something went wrong with the application or version id");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$appId = $_REQUEST['appId'];
|
|
||||||
|
|
||||||
if(!empty($_REQUEST['versionId']) AND !is_numeric($_REQUEST['versionId']))
|
if($_REQUEST['appId'])
|
||||||
{
|
{
|
||||||
errorpage("Something went wrong with the version ID");
|
$app = new Application($_REQUEST['appId']);
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$versionId = $_REQUEST['versionId'];
|
|
||||||
|
|
||||||
if($appId && !$versionId)
|
|
||||||
{
|
|
||||||
$app = new Application($appId);
|
|
||||||
$data = $app->data;
|
$data = $app->data;
|
||||||
if(!$data)
|
if(!$data)
|
||||||
{
|
{
|
||||||
@@ -207,7 +198,7 @@ if($appId && !$versionId)
|
|||||||
apidb_header("Viewing App - ".$data->appName);
|
apidb_header("Viewing App - ".$data->appName);
|
||||||
|
|
||||||
// cat display
|
// cat display
|
||||||
display_catpath($app->data->catId, $appId);
|
display_catpath($app->data->catId, $_REQUEST['appId']);
|
||||||
|
|
||||||
// set Vendor
|
// set Vendor
|
||||||
$vendor = $app->getVendor();
|
$vendor = $app->getVendor();
|
||||||
@@ -217,7 +208,7 @@ if($appId && !$versionId)
|
|||||||
|
|
||||||
// start display application
|
// start display application
|
||||||
echo html_frame_start("","98%","",0);
|
echo html_frame_start("","98%","",0);
|
||||||
|
echo "<link rel=\"stylesheet\" href=\"./application.css\" type=\"text/css\">";
|
||||||
echo "<tr><td class=color4 valign=top>\n";
|
echo "<tr><td class=color4 valign=top>\n";
|
||||||
echo " <table>\n";
|
echo " <table>\n";
|
||||||
echo " <tr><td>\n";
|
echo " <tr><td>\n";
|
||||||
@@ -237,7 +228,7 @@ if($appId && !$versionId)
|
|||||||
echo " <tr class=\"color1\"><td><b>URL</b></td><td>".$appLinkURL."</td></tr>\n";
|
echo " <tr class=\"color1\"><td><b>URL</b></td><td>".$appLinkURL."</td></tr>\n";
|
||||||
|
|
||||||
// optional links
|
// optional links
|
||||||
$result = query_appdb("SELECT * FROM appData WHERE appId = $appId AND versionID = 0 AND type = 'url'");
|
$result = query_appdb("SELECT * FROM appData WHERE appId = ".$_REQUEST['appId']." AND versionID = 0 AND type = 'url'");
|
||||||
if($result && mysql_num_rows($result) > 0)
|
if($result && mysql_num_rows($result) > 0)
|
||||||
{
|
{
|
||||||
echo " <tr class=\"color1\"><td> <b>Links</b></td><td>\n";
|
echo " <tr class=\"color1\"><td> <b>Links</b></td><td>\n";
|
||||||
@@ -249,7 +240,7 @@ if($appId && !$versionId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// image
|
// image
|
||||||
$img = get_screenshot_img($appId);
|
$img = get_screenshot_img($_REQUEST['appId']);
|
||||||
echo "<tr><td align=center colspan=2>$img</td></tr>\n";
|
echo "<tr><td align=center colspan=2>$img</td></tr>\n";
|
||||||
|
|
||||||
echo " </table>\n"; /* close of name/vendor/bugs/url table */
|
echo " </table>\n"; /* close of name/vendor/bugs/url table */
|
||||||
@@ -260,7 +251,7 @@ if($appId && !$versionId)
|
|||||||
// Display all supermaintainers maintainers of this application
|
// Display all supermaintainers maintainers of this application
|
||||||
echo " <table class=color4 width=250 border=1>\n";
|
echo " <table class=color4 width=250 border=1>\n";
|
||||||
echo " <tr><td align=left><b>Super maintainers:</b></td></tr>\n";
|
echo " <tr><td align=left><b>Super maintainers:</b></td></tr>\n";
|
||||||
$other_maintainers = getSuperMaintainersUserIdsFromAppId($appId);
|
$other_maintainers = getSuperMaintainersUserIdsFromAppId($_REQUEST['appId']);
|
||||||
if($other_maintainers)
|
if($other_maintainers)
|
||||||
{
|
{
|
||||||
while(list($index, list($userIdValue)) = each($other_maintainers))
|
while(list($index, list($userIdValue)) = each($other_maintainers))
|
||||||
@@ -279,7 +270,7 @@ if($appId && !$versionId)
|
|||||||
if($_SESSION['current']->isLoggedIn())
|
if($_SESSION['current']->isLoggedIn())
|
||||||
{
|
{
|
||||||
/* are we already a maintainer? */
|
/* are we already a maintainer? */
|
||||||
if($_SESSION['current']->isSuperMaintainer($appId)) /* yep */
|
if($_SESSION['current']->isSuperMaintainer($_REQUEST['appId'])) /* yep */
|
||||||
{
|
{
|
||||||
echo ' <form method=post name=message action="maintainerdelete.php"><input type=submit value="Remove yourself as a super maintainer" class=button>';
|
echo ' <form method=post name=message action="maintainerdelete.php"><input type=submit value="Remove yourself as a super maintainer" class=button>';
|
||||||
} else /* nope */
|
} else /* nope */
|
||||||
@@ -287,14 +278,13 @@ if($appId && !$versionId)
|
|||||||
echo ' <form method=post name=message action="maintainersubmit.php"><input type=submit value="Be a super maintainer of this app" class=button>';
|
echo ' <form method=post name=message action="maintainersubmit.php"><input type=submit value="Be a super maintainer of this app" class=button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo " <input type=hidden name='appId' value=$appId>";
|
echo " <input type=\"hidden\" name=\"appId\" value=\"".$_REQUEST['appId']."\">";
|
||||||
echo " <input type=hidden name='versionId' value=$versionId>";
|
echo " <input type=\"hidden\" name=\"superMaintainer\" value=\"1\">"; /* set superMaintainer to 1 because we are at the appFamily level */
|
||||||
echo " <input type=hidden name='superMaintainer' value=1>"; /* set superMaintainer to 1 because we are at the appFamily level */
|
|
||||||
echo " </form>";
|
echo " </form>";
|
||||||
|
|
||||||
if($_SESSION['current']->isSuperMaintainer($appId) || $_SESSION['current']->hasPriv("admin"))
|
if($_SESSION['current']->isSuperMaintainer($_REQUEST['appId']) || $_SESSION['current']->hasPriv("admin"))
|
||||||
{
|
{
|
||||||
echo ' <form method="post" name="edit" action="admin/editAppFamily.php"><input type="hidden" name="appId" value="'.$appId.'"><input type="submit" value="Edit App" class="button"></form>';
|
echo ' <form method="post" name="edit" action="admin/editAppFamily.php"><input type="hidden" name="appId" value="'.$_REQUEST['appId'].'"><input type="submit" value="Edit App" class="button"></form>';
|
||||||
echo '<form method="post" name="message" action="appsubmit.php?appId='.$_REQUEST['appId'].'&apptype=2">';
|
echo '<form method="post" name="message" action="appsubmit.php?appId='.$_REQUEST['appId'].'&apptype=2">';
|
||||||
echo '<input type=submit value="Add Version" class="button">';
|
echo '<input type=submit value="Add Version" class="button">';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
@@ -303,7 +293,7 @@ if($appId && !$versionId)
|
|||||||
{
|
{
|
||||||
$url = BASE."admin/deleteAny.php?what=appFamily&appId=".$_REQUEST['appId']."&confirmed=yes";
|
$url = BASE."admin/deleteAny.php?what=appFamily&appId=".$_REQUEST['appId']."&confirmed=yes";
|
||||||
echo " <form method=\"post\" name=\"edit\" action=\"javascript:deleteURL(\"Are you sure?\", \"".$url."\")\"><input type=\"submit\" value=\"Delete App\" class=\"button\"></form>";
|
echo " <form method=\"post\" name=\"edit\" action=\"javascript:deleteURL(\"Are you sure?\", \"".$url."\")\"><input type=\"submit\" value=\"Delete App\" class=\"button\"></form>";
|
||||||
echo ' <form method="post" name="edit" action="admin/editBundle.php"><input type="hidden" name="bundleId" value="'.$appId.'"><input type="submit" value="Edit Bundle" class="button"></form>';
|
echo ' <form method="post" name="edit" action="admin/editBundle.php"><input type="hidden" name="bundleId" value="'.$_REQUEST['appId'].'"><input type="submit" value="Edit Bundle" class="button"></form>';
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
@@ -320,29 +310,33 @@ if($appId && !$versionId)
|
|||||||
|
|
||||||
// description
|
// description
|
||||||
echo " <td class=color2 valign=top width='100%'>\n";
|
echo " <td class=color2 valign=top width='100%'>\n";
|
||||||
echo " <table width='100%' border=0><tr><td width='100%' valign=top><b>Description</b><br />\n";
|
echo " <table width='100%' border=0><tr><td width='100%' valign=top><span class=\"title\">Description</span>\n";
|
||||||
echo add_br(stripslashes($data->description));
|
echo $data->description;
|
||||||
|
|
||||||
echo " </td></tr></table>\n";
|
echo " </td></tr></table>\n";
|
||||||
|
|
||||||
echo html_frame_end("For more details and user comments, view the versions of this application.");
|
echo html_frame_end("For more details and user comments, view the versions of this application.");
|
||||||
|
|
||||||
// display versions
|
// display versions
|
||||||
display_versions($appId,$app->getAppVersionList());
|
display_versions($_REQUEST['appId'],$app->getAppVersionList());
|
||||||
|
|
||||||
// display bundle
|
// display bundle
|
||||||
display_bundle($appId);
|
display_bundle($_REQUEST['appId']);
|
||||||
|
|
||||||
// disabled for now
|
// disabled for now
|
||||||
//log_application_visit($appId);
|
//log_application_visit($_REQUEST['appId']);
|
||||||
}
|
}
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# We want to see a particular version #
|
# We want to see a particular version #
|
||||||
#######################################
|
#######################################
|
||||||
else if($appId && $versionId)
|
else if($_REQUEST['versionId'])
|
||||||
{
|
{
|
||||||
$app = new Application($appId);
|
//FIXME: get rid of appId references everywhere, as version is enough.
|
||||||
|
$sQuery = "SELECT appId FROM appVersion WHERE versionId = '".$_REQUEST['versionId']."'";
|
||||||
|
$hResult = query_appdb($sQuery);
|
||||||
|
$oRow = mysql_fetch_object($hResult);
|
||||||
|
$appId = $oRow->appId;
|
||||||
|
|
||||||
|
$app = new Application($oRow->appId);
|
||||||
$data = $app->data;
|
$data = $app->data;
|
||||||
if(!$data)
|
if(!$data)
|
||||||
{
|
{
|
||||||
@@ -351,7 +345,7 @@ else if($appId && $versionId)
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ver = $app->getAppVersion($versionId);
|
$ver = $app->getAppVersion($_REQUEST['versionId']);
|
||||||
if(!$ver)
|
if(!$ver)
|
||||||
{
|
{
|
||||||
// Oops! Version not found or other error. do something
|
// Oops! Version not found or other error. do something
|
||||||
@@ -360,24 +354,24 @@ else if($appId && $versionId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// header
|
// header
|
||||||
apidb_header("Viewing App Version - ".$data->appName);
|
apidb_header("Viewing App Version - ".$data->appName);
|
||||||
|
|
||||||
// cat
|
// cat
|
||||||
display_catpath($app->data->catId, $appId, $versionId);
|
display_catpath($app->data->catId, $appId, $_REQUEST['versionId']);
|
||||||
|
|
||||||
// set URL
|
// set URL
|
||||||
$appLinkURL = ($ver->webPage) ? "<a href='$ver->webPage'>".substr(stripslashes($ver->webPage),0,30)."</a>": " ";
|
$appLinkURL = ($ver->webPage) ? "<a href='$ver->webPage'>".substr(stripslashes($ver->webPage),0,30)."</a>": " ";
|
||||||
|
|
||||||
// start version display
|
// start version display
|
||||||
echo html_frame_start("","98%","",0);
|
echo html_frame_start("","98%","",0);
|
||||||
|
echo "<link rel=\"stylesheet\" href=\"./application.css\" type=\"text/css\">";
|
||||||
echo '<tr><td class=color4 valign=top>',"\n";
|
echo '<tr><td class=color4 valign=top>',"\n";
|
||||||
echo '<table width="250" border=0 cellpadding=3 cellspacing=1">',"\n";
|
echo '<table width="250" border=0 cellpadding=3 cellspacing=1">',"\n";
|
||||||
echo "<tr class=color0 valign=top><td width=100> <b>Name</b></td><td width='100%'>".stripslashes($data->appName)."</td>\n";
|
echo "<tr class=color0 valign=top><td width=100> <b>Name</b></td><td width='100%'>".stripslashes($data->appName)."</td>\n";
|
||||||
echo "<tr class=color1 valign=top><td> <b>Version</b></td><td>".stripslashes($ver->versionName)."</td></tr>\n";
|
echo "<tr class=color1 valign=top><td> <b>Version</b></td><td>".stripslashes($ver->versionName)."</td></tr>\n";
|
||||||
|
|
||||||
// links
|
// links
|
||||||
$result = query_appdb("SELECT * FROM appData WHERE appId = $appId AND versionID = $versionId AND type = 'url'");
|
$result = query_appdb("SELECT * FROM appData WHERE appId = $appId AND versionID = ".$_REQUEST['versionId']." AND type = 'url'");
|
||||||
if($result && mysql_num_rows($result) > 0)
|
if($result && mysql_num_rows($result) > 0)
|
||||||
{
|
{
|
||||||
echo " <tr class=\"color1\"><td><b>Links</b></td><td>\n";
|
echo " <tr class=\"color1\"><td><b>Links</b></td><td>\n";
|
||||||
@@ -393,13 +387,13 @@ else if($appId && $versionId)
|
|||||||
echo "<tr class=\"color0\" valign=\"top\"><td> <b>Maintainers Version</b></td><td>".stripslashes($ver->maintainer_release)."</td></tr>\n";
|
echo "<tr class=\"color0\" valign=\"top\"><td> <b>Maintainers Version</b></td><td>".stripslashes($ver->maintainer_release)."</td></tr>\n";
|
||||||
|
|
||||||
// image
|
// image
|
||||||
$img = get_screenshot_img($appId, $versionId);
|
$img = get_screenshot_img($appId, $_REQUEST['versionId']);
|
||||||
echo "<tr><td align=center colspan=2>$img</td></tr>\n";
|
echo "<tr><td align=center colspan=2>$img</td></tr>\n";
|
||||||
|
|
||||||
// display all maintainers of this application
|
// display all maintainers of this application
|
||||||
echo "<tr class=color0><td align=left colspan=2><b>Maintainers of this application:</b>\n";
|
echo "<tr class=color0><td align=left colspan=2><b>Maintainers of this application:</b>\n";
|
||||||
echo "<table width=250 border=0>";
|
echo "<table width=250 border=0>";
|
||||||
$other_maintainers = getMaintainersUserIdsFromAppIdVersionId($appId, $versionId);
|
$other_maintainers = getMaintainersUserIdsFromAppIdVersionId($appId, $_REQUEST['versionId']);
|
||||||
if($other_maintainers)
|
if($other_maintainers)
|
||||||
{
|
{
|
||||||
while(list($index, list($userIdValue)) = each($other_maintainers))
|
while(list($index, list($userIdValue)) = each($other_maintainers))
|
||||||
@@ -428,7 +422,7 @@ else if($appId && $versionId)
|
|||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
/* are we already a maintainer? */
|
/* are we already a maintainer? */
|
||||||
if($_SESSION['current']->isMaintainer($appId, $versionId)) /* yep */
|
if($_SESSION['current']->isMaintainer($appId, $_REQUEST['versionId'])) /* yep */
|
||||||
{
|
{
|
||||||
echo '<form method=post name=message action="maintainerdelete.php"><input type=submit value="Remove yourself as a maintainer" class=button>';
|
echo '<form method=post name=message action="maintainerdelete.php"><input type=submit value="Remove yourself as a maintainer" class=button>';
|
||||||
echo "<input type=hidden name='superMaintainer' value=0>";
|
echo "<input type=hidden name='superMaintainer' value=0>";
|
||||||
@@ -438,8 +432,8 @@ else if($appId && $versionId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<input type=hidden name='appId' value=$appId>";
|
echo "<input type=hidden name=\"appId\" value=\"".$appId."\">";
|
||||||
echo "<input type=hidden name='versionId' value=$versionId>";
|
echo "<input type=hidden name=\"versionId\" value=\"".$_REQUEST['versionId']."\">";
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
@@ -450,26 +444,26 @@ else if($appId && $versionId)
|
|||||||
|
|
||||||
echo "</center></td></tr>";
|
echo "</center></td></tr>";
|
||||||
|
|
||||||
if ($_SESSION['current']->isLoggedIn() && ($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintainer($appId, $versionId)))
|
if ($_SESSION['current']->isLoggedIn() && ($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintainer($appId, $_REQUEST['versionId'])))
|
||||||
{
|
{
|
||||||
echo "<tr><td colspan = 2><center>";
|
echo "<tr><td colspan = 2><center>";
|
||||||
echo '<form method=post name=message action=admin/editAppVersion.php?appId='.$appId.'&versionId='.$versionId.'>';
|
echo '<form method=post name=message action=admin/editAppVersion.php?appId='.$appId.'&versionId='.$_REQUEST['versionId'].'>';
|
||||||
echo '<input type=submit value="Edit Version Info" class=button>';
|
echo '<input type=submit value="Edit Version Info" class=button>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
$url = BASE."admin/deleteAny.php?what=appVersion&appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."&confirmed=yes";
|
$url = BASE."admin/deleteAny.php?what=appVersion&appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."&confirmed=yes";
|
||||||
echo "<form method=\"post\" name=\"delete\" action=\"javascript:deleteURL('Are you sure?', '".$url."')\">";
|
echo "<form method=\"post\" name=\"delete\" action=\"javascript:deleteURL('Are you sure?', '".$url."')\">";
|
||||||
echo '<input type=submit value="Delete Version" class="button">';
|
echo '<input type=submit value="Delete Version" class="button">';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
echo '<form method=post name=message action=admin/addAppNote.php?appId='.$appId.'&versionId='.$versionId.'>';
|
echo '<form method=post name=message action=admin/addAppNote.php?versionId='.$_REQUEST['versionId'].'>';
|
||||||
echo '<input type=submit value="Add Note" class=button>';
|
echo '<input type=submit value="Add Note" class=button>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
echo '<form method=post name=message action=admin/addAppNote.php?appId='.$appId.'&versionId='.$versionId.'>';
|
echo '<form method=post name=message action=admin/addAppNote.php?versionId='.$_REQUEST['versionId'].'>';
|
||||||
echo '<input type=hidden name="noteTitle" value="HOWTO">';
|
echo '<input type=hidden name="noteTitle" value="HOWTO">';
|
||||||
echo '<input type=submit value="Add How To" class=button>';
|
echo '<input type=submit value="Add How To" class=button>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
echo '<form method=post name=message action=admin/addAppNote.php?appId='.$appId.'&versionId='.$versionId.'>';
|
echo '<form method=post name=message action=admin/addAppNote.php?versionId='.$versionId.'>';
|
||||||
echo '<input type=hidden name="noteTitle" value="WARNING">';
|
echo '<input type=hidden name="noteTitle" value="WARNING">';
|
||||||
echo '<input type=submit value="Add Warning" class=button>';
|
echo '<input type=submit value="Add Warning" class=button>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
@@ -478,9 +472,9 @@ else if($appId && $versionId)
|
|||||||
|
|
||||||
echo "</table><td class=color2 valign=top width='100%'>\n";
|
echo "</table><td class=color2 valign=top width='100%'>\n";
|
||||||
|
|
||||||
//Desc Image
|
// description
|
||||||
echo "<table width='100%' border=0><tr><td width='100%' valign=top> <b>Description</b><br />\n";
|
echo "<table width='100%' border=0><tr><td width='100%' valign=top> <b>Description</b><br />\n";
|
||||||
echo add_br(stripslashes($ver->description));
|
echo $ver->description;
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
|
|
||||||
/* close the table */
|
/* close the table */
|
||||||
@@ -488,21 +482,15 @@ else if($appId && $versionId)
|
|||||||
|
|
||||||
echo html_frame_end();
|
echo html_frame_end();
|
||||||
|
|
||||||
$rNotes = query_appdb("SELECT * FROM appNotes WHERE appId = $appId and versionId = $versionId");
|
$rNotes = query_appdb("SELECT * FROM appNotes WHERE versionId = ".$_REQUEST['versionId']);
|
||||||
|
|
||||||
while( $oNote = mysql_fetch_object($rNotes) )
|
while( $oNote = mysql_fetch_object($rNotes) )
|
||||||
{
|
{
|
||||||
echo show_note($oNote->noteTitle,$oNote);
|
echo show_note($oNote->noteTitle,$oNote);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: code to view/add user experience record
|
|
||||||
// if(!$versionId)
|
|
||||||
// {
|
|
||||||
// $versionId = 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Comments Section
|
// Comments Section
|
||||||
view_app_comments($appId, $versionId);
|
view_app_comments($_REQUEST['versionId']);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
@@ -510,10 +498,6 @@ else if($appId && $versionId)
|
|||||||
errorpage('Page Called with No Params!');
|
errorpage('Page Called with No Params!');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
<p> </p>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
apidb_footer();
|
apidb_footer();
|
||||||
?>
|
?>
|
||||||
|
|||||||
2
bugs.php
2
bugs.php
@@ -9,7 +9,7 @@
|
|||||||
include("path.php");
|
include("path.php");
|
||||||
require(BASE."include/incl.php");
|
require(BASE."include/incl.php");
|
||||||
require(BASE."include/application.php");
|
require(BASE."include/application.php");
|
||||||
require(BASE."include/comments.php");
|
require(BASE."include/comment.php");
|
||||||
require(BASE."include/appdb.php");
|
require(BASE."include/appdb.php");
|
||||||
require(BASE."include/screenshot.php");
|
require(BASE."include/screenshot.php");
|
||||||
require(BASE."include/category.php");
|
require(BASE."include/category.php");
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
* application environment
|
* application environment
|
||||||
*/
|
*/
|
||||||
include("path.php");
|
include("path.php");
|
||||||
include(BASE."include/"."incl.php");
|
include(BASE."include/incl.php");
|
||||||
require(BASE."include/"."comments.php");
|
require(BASE."include/comment.php");
|
||||||
|
|
||||||
apidb_header("Comments");
|
apidb_header("Comments");
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ include("path.php");
|
|||||||
require(BASE."include/incl.php");
|
require(BASE."include/incl.php");
|
||||||
require(BASE."include/application.php");
|
require(BASE."include/application.php");
|
||||||
require(BASE."include/mail.php");
|
require(BASE."include/mail.php");
|
||||||
|
require(BASE."include/comment.php");
|
||||||
|
|
||||||
|
|
||||||
$_REQUEST['appId'] = strip_tags($_REQUEST['appId']);
|
$_REQUEST['appId'] = strip_tags($_REQUEST['appId']);
|
||||||
@@ -26,42 +27,24 @@ if(!$_SESSION['current']->isLoggedIn())
|
|||||||
/* if we aren't an admin or the maintainer of this app we shouldn't be */
|
/* if we aren't an admin or the maintainer of this app we shouldn't be */
|
||||||
/* allowed to delete any comments */
|
/* allowed to delete any comments */
|
||||||
if(!$_SESSION['current']->hasPriv("admin") &&
|
if(!$_SESSION['current']->hasPriv("admin") &&
|
||||||
!$_SESSION['current']->isMaintainer($_REQUEST['appId'],
|
!$_SESSION['current']->isMaintainer($_REQUEST['appId'], $_REQUEST['versionId']))
|
||||||
$_REQUEST['versionId']))
|
|
||||||
{
|
{
|
||||||
errorpage('You don\'t have admin privileges');
|
errorpage('You don\'t have sufficient privileges to delete this comment.');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* retrieve the parentID of the comment we are deleting */
|
$oComment = new Comment($_REQUEST['commentId']);
|
||||||
/* so we can fix up the parentIds of this comments children */
|
|
||||||
$result = query_appdb("SELECT parentId FROM appComments WHERE commentId = '".$_REQUEST['commentId']."'");
|
|
||||||
if (!$result)
|
|
||||||
{
|
|
||||||
errorpage('Internal error retrieving parent of commentId');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ob = mysql_fetch_object($result);
|
|
||||||
$deletedParentId = $ob->parentId;
|
|
||||||
|
|
||||||
/* get the subject and body from the comment */
|
if($_SESSION['current']->getPref("confirm_comment_deletion") != "no" && !isset($_REQUEST['int_delete_it']))
|
||||||
$result = query_appdb("select * FROM appComments WHERE commentId = '".$_REQUEST['commentId']."'");
|
|
||||||
if (!$result) redirect(apidb_fullurl("appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
|
||||||
$ob = mysql_fetch_object($result);
|
|
||||||
$body = $ob->body;
|
|
||||||
$subject = $ob->subject;
|
|
||||||
|
|
||||||
if($_SESSION['current']->getpref("confirm_comment_deletion") != "no" &&
|
|
||||||
!isset($_REQUEST['int_delete_it']))
|
|
||||||
{
|
{
|
||||||
apidb_header("Delete Comment");
|
apidb_header("Delete Comment");
|
||||||
$mesTitle = "<b>Please state why you are deleting the following comment</b>";
|
$mesTitle = "<b>Please state why you are deleting the following comment</b>";
|
||||||
echo "<form method=\"POST\" action=\"".$_SERVER['PHP_SELF']."\">\n";
|
echo "<form method=\"POST\" action=\"".$_SERVER['PHP_SELF']."\">\n";
|
||||||
echo html_frame_start($mesTitle,500,"",0);
|
echo html_frame_start($mesTitle,500,"",0);
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo html_frame_start($ob->subject,500);
|
echo html_frame_start($oComment->sSubject,500);
|
||||||
echo htmlify_urls($ob->body), "<br /><br />\n";
|
echo htmlify_urls($oComment->sBody), "<br /><br />\n";
|
||||||
echo html_frame_end();
|
echo html_frame_end();
|
||||||
echo '<table width="100%" border=0 cellpadding=0 cellspacing=1>',"\n";
|
echo '<table width="100%" border=0 cellpadding=0 cellspacing=1>',"\n";
|
||||||
echo "<tr class=color1><td colspan=2><textarea name=\"str_why\" cols=\"70\" rows=\"15\" wrap=\"virtual\"></textarea></td></tr>\n";
|
echo "<tr class=color1><td colspan=2><textarea name=\"str_why\" cols=\"70\" rows=\"15\" wrap=\"virtual\"></textarea></td></tr>\n";
|
||||||
@@ -84,46 +67,7 @@ if($_SESSION['current']->getpref("confirm_comment_deletion") != "no" &&
|
|||||||
apidb_footer();
|
apidb_footer();
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
/* delete the comment from the database */
|
$oComment->delete($_REQUEST['str_why']);
|
||||||
$result = query_appdb("DELETE FROM appComments WHERE commentId = '".$_REQUEST['commentId']."'");
|
redirect(apidb_fullurl("appview.php?versionId=".$_REQUEST['versionId']));
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
/* fixup the child comments so the parentId points to a valid parent comment */
|
|
||||||
$result = query_appdb("UPDATE appComments set parentId = '$deletedParentId' WHERE parentId = '".$_REQUEST['commentId']."'");
|
|
||||||
if(!$result)
|
|
||||||
{
|
|
||||||
errorpage('Internal database error fixing up the parentId of child comments');
|
|
||||||
exit;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
$sEmail = get_notify_email_address_list($_REQUEST['appId'], $_REQUEST['versionId']);
|
|
||||||
$oUser = new User($ob->userId);
|
|
||||||
$notify_user_email=$oUser->sEmail;
|
|
||||||
$notify_user_realname=$oUser->sRealname;
|
|
||||||
$sEmail .= $notify_user_email;
|
|
||||||
if($sEmail)
|
|
||||||
{
|
|
||||||
$sFullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
|
|
||||||
$sMsg = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\r\n";
|
|
||||||
$sMsg .= "\r\n";
|
|
||||||
$sMsg .= $_SESSION['current']->realname." deleted comment from ".$sFullAppName."\r\n";
|
|
||||||
$sMsg .= "\n";
|
|
||||||
$sMsg .= "This comment was made on ".substr($ob->time,0,10)." by $notify_user_realname \r\n";
|
|
||||||
$sMsg .= "\r\n";
|
|
||||||
$sMsg .= "Subject: ".$subject."\r\n";
|
|
||||||
$sMsg .= "\r\n";
|
|
||||||
$sMsg .= $body."\r\n";
|
|
||||||
$sMsg .= "\r\n";
|
|
||||||
$sMsg .= "Because:\r\n";
|
|
||||||
if($_REQUEST['str_why'])
|
|
||||||
$sMsg .= stripslashes($_REQUEST['str_why'])."\r\n";
|
|
||||||
else
|
|
||||||
$sMsg .= "No reason given.\r\n";
|
|
||||||
mail_appdb($sEmail, $sFullAppName ,$sMsg);
|
|
||||||
}
|
|
||||||
addmsg("Comment deleted", "green");
|
|
||||||
redirect(apidb_fullurl("appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
436
include/comment.php
Normal file
436
include/comment.php
Normal file
@@ -0,0 +1,436 @@
|
|||||||
|
<?php
|
||||||
|
/***************************************/
|
||||||
|
/* comment class and related functions */
|
||||||
|
/***************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comment class for handling comments
|
||||||
|
*/
|
||||||
|
class Comment {
|
||||||
|
var $iCommentId;
|
||||||
|
var $iParentId;
|
||||||
|
var $iAppId;
|
||||||
|
var $iVersionId;
|
||||||
|
var $sSubject;
|
||||||
|
var $sBody;
|
||||||
|
var $sDateCreated;
|
||||||
|
var $sHostname;
|
||||||
|
var $oOwner;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
* If $iCommentId is provided, fetches comment.
|
||||||
|
*/
|
||||||
|
function Comment($iCommentId="")
|
||||||
|
{
|
||||||
|
if($iCommentId)
|
||||||
|
{
|
||||||
|
|
||||||
|
$sQuery = "SELECT appComments.*, appVersion.appId AS appId
|
||||||
|
FROM appComments, appVersion
|
||||||
|
WHERE appComments.versionId = appVersion.versionId
|
||||||
|
AND commentId = '".$iCommentId."'";
|
||||||
|
$hResult = query_appdb($sQuery);
|
||||||
|
$oRow = mysql_fetch_object($hResult);
|
||||||
|
$this->iCommentId = $oRow->commentId;
|
||||||
|
$this->iParentId = $oRow->parentId;
|
||||||
|
$this->iAppId = $oRow->appId;
|
||||||
|
$this->iVersionId = $oRow->versionId;
|
||||||
|
$this->sSubject = $oRow->subject;
|
||||||
|
$this->sBody = $oRow->body;
|
||||||
|
$this->sDateCreated = $oRow->time;
|
||||||
|
$this->sHostname = $oRow->hostname;
|
||||||
|
$this->oOwner = new User($oRow->userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a new comment.
|
||||||
|
* Informs interested people about the creation.
|
||||||
|
* Returns true on success, false on failure
|
||||||
|
*/
|
||||||
|
function create($sSubject, $sBody, $iParentId=null, $iVersionId)
|
||||||
|
{
|
||||||
|
$aInsert = compile_insert_string(array( 'parentId' => $iParentId,
|
||||||
|
'versionId' => $iVersionId,
|
||||||
|
'subject' => $sSubject,
|
||||||
|
'body' => $sBody ));
|
||||||
|
|
||||||
|
$sFields = "({$aInsert['FIELDS']}, `userId`, `time`, `hostname`)";
|
||||||
|
$sValues = "({$aInsert['VALUES']}, ".$_SESSION['current']->iUserId.", NOW(), '".get_remote()."')";
|
||||||
|
|
||||||
|
if(query_appdb("INSERT INTO appComments $sFields VALUES $sValues", "Error while creating a new comment."))
|
||||||
|
{
|
||||||
|
$this->comment(mysql_insert_id());
|
||||||
|
$sEmail = get_notify_email_address_list($this->iAppId, $this->iVersionId);
|
||||||
|
$sEmail .= $this->oOwner->sEmail." ";
|
||||||
|
// fetches e-mails from parent comments
|
||||||
|
while($iParentId)
|
||||||
|
{
|
||||||
|
$oParent = new Comment($iParentId);
|
||||||
|
$sEmail .= $oParent->oOwner->sEmail." ";
|
||||||
|
$iParentId = $oParent->iParentId;
|
||||||
|
}
|
||||||
|
if($sEmail)
|
||||||
|
{
|
||||||
|
$sSubject = "Comment for ".lookupAppName($this->iAppId)." ".lookupVersionName($this->iVersionId)." added by ".$_SESSION['current']->sRealname;
|
||||||
|
$sMsg = APPDB_ROOT."appview.php?appId=".$this->iAppId."&versionId=".$this->iVersionId."\n";
|
||||||
|
$sMsg .= "\n";
|
||||||
|
$sMsg .= "Subject: ".$this->sSubject."\r\n";
|
||||||
|
$sMsg .= "\n";
|
||||||
|
$sMsg .= $this->sBody."\r\n";
|
||||||
|
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||||
|
}
|
||||||
|
addmsg("Comment created.", "green");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update comment.
|
||||||
|
* FIXME: Informs interested people about the modification.
|
||||||
|
* Returns true on success and false on failure.
|
||||||
|
*/
|
||||||
|
function update($sSubject=null, $sBody=null, $iParentId=null, $iVersionId=null)
|
||||||
|
{
|
||||||
|
if ($iParentId)
|
||||||
|
{
|
||||||
|
if (!query_appdb("UPDATE appComments SET parentId = '".$iParentId."' WHERE commentId = ".$this->iCommentId))
|
||||||
|
return false;
|
||||||
|
$this->iParentId = $iParentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($iVersionId)
|
||||||
|
{
|
||||||
|
if (!query_appdb("UPDATE appComments SET versionId = '".$iVersionId."' WHERE commentId = ".$this->iCommentId))
|
||||||
|
return false;
|
||||||
|
$this->iVersionId = $iVersionId;
|
||||||
|
// FIXME: we need to refetch $this->iAppId.
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sSubject)
|
||||||
|
{
|
||||||
|
if (!query_appdb("UPDATE appComments SET subject = '".$sSubject."' WHERE commentId = ".$this->iCommentId))
|
||||||
|
return false;
|
||||||
|
$this->sSubject = $sSubject;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sBody)
|
||||||
|
{
|
||||||
|
if (!query_appdb("UPDATE appComments SET body = '".$sBody."' WHERE commentId = ".$this->iCommentId))
|
||||||
|
return false;
|
||||||
|
$this->sBody = $sBody;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the current comment from the database.
|
||||||
|
* Informs interested people about the deletion.
|
||||||
|
* Returns true on success and false on failure.
|
||||||
|
*/
|
||||||
|
function delete($sReason=null)
|
||||||
|
{
|
||||||
|
$hResult = query_appdb("DELETE FROM appComments WHERE commentId = '".$this->iCommentId."'");
|
||||||
|
if ($hResult)
|
||||||
|
{
|
||||||
|
/* fixup the child comments so the parentId points to a valid parent comment */
|
||||||
|
$hResult = query_appdb("UPDATE appComments set parentId = '".$this->iParentId."' WHERE parentId = '".$this->iCommentId."'");
|
||||||
|
$sEmail = get_notify_email_address_list($this->iAppId, $this->iVersionId);
|
||||||
|
$sEmail .= $this->oOwner->sEmail;
|
||||||
|
if($sEmail)
|
||||||
|
{
|
||||||
|
$sSubject = "Comment for ".lookupAppName($this->iAppId)." ".lookupVersionName($this->iVersionId)." deleted by ".$_SESSION['current']->sRealname;
|
||||||
|
$sMsg = APPDB_ROOT."appview.php?appId=".$this->iAppId."&versionId=".$this->iVersionId."\n";
|
||||||
|
$sMsg .= "\n";
|
||||||
|
$sMsg .= "This comment was made on ".substr($this->sDateCreated,0,10)." by ".$this->oOwner->sRealname."\n";
|
||||||
|
$sMsg .= "\n";
|
||||||
|
$sMsg .= "Subject: ".$this->sSubject."\r\n";
|
||||||
|
$sMsg .= "\n";
|
||||||
|
$sMsg .= $this->sBody."\r\n";
|
||||||
|
$sMsg .= "\n";
|
||||||
|
$sMsg .= "Because:\n";
|
||||||
|
if($sReason)
|
||||||
|
$sMsg .= $sReason."\n";
|
||||||
|
else
|
||||||
|
$sMsg .= "No reason given.\n";
|
||||||
|
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||||
|
}
|
||||||
|
addmsg("Comment deleted.", "green");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Comment functions that are not part of the class
|
||||||
|
*/
|
||||||
|
|
||||||
|
function forum_lookup_user($iUserId)
|
||||||
|
{
|
||||||
|
if ($iUserId > 0)
|
||||||
|
{
|
||||||
|
$oUser = new User($iUserId);
|
||||||
|
$sMailto = '<a href="mailto:' . $oUser->sEmail . '">' . $oUser->sRealname . '</a>';
|
||||||
|
}
|
||||||
|
if (!$iUserId || !$oUser->isLoggedIn())
|
||||||
|
{
|
||||||
|
$sMailto = '<font color="#999999">Anonymous</font>';
|
||||||
|
}
|
||||||
|
return $sMailto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* display a single comment (in $ob)
|
||||||
|
*/
|
||||||
|
function view_app_comment($ob)
|
||||||
|
{
|
||||||
|
|
||||||
|
echo html_frame_start('','98%');
|
||||||
|
echo '<table width="100%" border=0 cellpadding=2 cellspacing=1">',"\n";
|
||||||
|
|
||||||
|
$ob->subject = stripslashes($ob->subject);
|
||||||
|
$ob->body = stripslashes($ob->body);
|
||||||
|
|
||||||
|
// message header
|
||||||
|
echo "<tr bgcolor=#E0E0E0><td>\n";
|
||||||
|
echo " <b>".$ob->subject."</b><br>\n";
|
||||||
|
echo " by ".forum_lookup_user($ob->userId)." on ".$ob->time."<br>\n";
|
||||||
|
echo "</td></tr><tr><td>\n";
|
||||||
|
|
||||||
|
// body
|
||||||
|
echo htmlify_urls($ob->body), "<br><br>\n";
|
||||||
|
|
||||||
|
// only add RE: once
|
||||||
|
if(eregi("RE:", $ob->subject))
|
||||||
|
$subject = $ob->subject;
|
||||||
|
else
|
||||||
|
$subject = "RE: ".$ob->subject;
|
||||||
|
|
||||||
|
// reply post buttons
|
||||||
|
echo " [<a href='addcomment.php?appId=$ob->appId&versionId=$ob->versionId'><small>post new</small></a>] \n";
|
||||||
|
echo " [<a href='addcomment.php?appId=$ob->appId&versionId=$ob->versionId&subject=".
|
||||||
|
urlencode("$subject")."&thread=$ob->commentId'><small>reply to this</small></a>] \n";
|
||||||
|
|
||||||
|
echo "</td></tr>\n";
|
||||||
|
|
||||||
|
// delete message button, for admins
|
||||||
|
if ($_SESSION['current']->isLoggedIn() && ($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintainer($ob->appId,$ob->versionId) ))
|
||||||
|
{
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td><form method=\"post\" name=\"message\" action=\"".BASE."deletecomment.php\"><input type=submit value='Delete' class=button>\n";
|
||||||
|
echo "<input type=\"hidden\" name=\"commentId\" value=\"$ob->commentId\" />";
|
||||||
|
echo "<input type=\"hidden\" name=\"appId\" value=\"$ob->appId\" />";
|
||||||
|
echo "<input type=\"hidden\" name=\"versionId\" value=\"$ob->versionId\" /></form></td>","\n";
|
||||||
|
echo "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</table>\n";
|
||||||
|
|
||||||
|
echo html_frame_end();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* grab comments for appId / versionId
|
||||||
|
* if parentId is not -1 only comments for that thread are returned
|
||||||
|
*/
|
||||||
|
function grab_comments($versionId, $parentId = -1)
|
||||||
|
{
|
||||||
|
$extra = "";
|
||||||
|
if($parentId != -1)
|
||||||
|
$extra = "AND parentId = $parentId ";
|
||||||
|
|
||||||
|
$qstring = "SELECT from_unixtime(unix_timestamp(appComments.time), \"%W %M %D %Y, %k:%i\") as time, ".
|
||||||
|
"appComments.commentId, appComments.parentId, appComments.versionId, appComments.userId, appComments.subject, appComments.body, appVersion.appId ".
|
||||||
|
"FROM appComments, appVersion WHERE appComments.versionId = appVersion.versionId AND appComments.versionId = '$versionId' ".
|
||||||
|
$extra.
|
||||||
|
"ORDER BY appComments.time ASC";
|
||||||
|
$result = query_appdb($qstring);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* grab comments for appId / versionId
|
||||||
|
* if parentId is not -1 only comments for that thread are returned
|
||||||
|
*/
|
||||||
|
function count_comments($versionId)
|
||||||
|
{
|
||||||
|
$qstring = "SELECT count(commentId) as hits FROM appComments WHERE versionId = $versionId";
|
||||||
|
$result = query_appdb($qstring);
|
||||||
|
$ob = mysql_fetch_object($result);
|
||||||
|
return $ob->hits;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* display nested comments
|
||||||
|
* handle is a db result set
|
||||||
|
*/
|
||||||
|
function do_display_comments_nested($handle)
|
||||||
|
{
|
||||||
|
while($ob = mysql_fetch_object($handle))
|
||||||
|
{
|
||||||
|
view_app_comment($ob);
|
||||||
|
$result = grab_comments($ob->versionId, $ob->commentId);
|
||||||
|
if($result && mysql_num_rows($result))
|
||||||
|
{
|
||||||
|
echo "<blockquote>\n";
|
||||||
|
do_display_comments_nested($result);
|
||||||
|
echo "</blockquote>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function display_comments_nested($versionId, $threadId)
|
||||||
|
{
|
||||||
|
$result = grab_comments($versionId, $threadId);
|
||||||
|
|
||||||
|
do_display_comments_nested($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* display threaded comments
|
||||||
|
* handle is a db result set
|
||||||
|
*/
|
||||||
|
function do_display_comments_threaded($handle, $is_main)
|
||||||
|
{
|
||||||
|
if (!$is_main)
|
||||||
|
echo "<ul>\n";
|
||||||
|
|
||||||
|
while ($ob = mysql_fetch_object($handle))
|
||||||
|
{
|
||||||
|
if ($is_main)
|
||||||
|
{
|
||||||
|
view_app_comment($ob);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
echo '<li><a href="commentview.php?appId='.$ob->appId.'&versionId='.$ob->versionId.'&threadId='.$ob->parentId.'"> '.
|
||||||
|
$ob->subject.' </a> by '.forum_lookup_user($ob->userId).' on '.$ob->time.' </li>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = grab_comments($ob->versionId, $ob->commentId);
|
||||||
|
if ($result && mysql_num_rows($result))
|
||||||
|
{
|
||||||
|
echo "<blockquote>\n";
|
||||||
|
do_display_comments_threaded($result, 0);
|
||||||
|
echo "</blockquote>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$is_main)
|
||||||
|
echo "</ul>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function display_comments_threaded($versionId, $threadId = 0)
|
||||||
|
{
|
||||||
|
$result = grab_comments($versionId, $threadId);
|
||||||
|
|
||||||
|
do_display_comments_threaded($result, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* display flat comments
|
||||||
|
*/
|
||||||
|
function display_comments_flat($versionId)
|
||||||
|
{
|
||||||
|
$result = grab_comments($versionId);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
while($ob = mysql_fetch_object($result))
|
||||||
|
{
|
||||||
|
view_app_comment($ob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function view_app_comments($versionId, $threadId = 0)
|
||||||
|
{
|
||||||
|
// count posts
|
||||||
|
$result = query_appdb("SELECT commentId FROM appComments WHERE versionId = $versionId");
|
||||||
|
$messageCount = mysql_num_rows($result);
|
||||||
|
|
||||||
|
//start comment format table
|
||||||
|
echo html_frame_start("","98%",'',0);
|
||||||
|
echo '<table width="100%" border=0 cellpadding=1 cellspacing=0">',"\n";
|
||||||
|
|
||||||
|
echo '<tr><td bgcolor=#C0C0C0 align=center><table border=0 cellpadding=0 cellspacing=0><tr bgcolor=#C0C0C0>',"\n";
|
||||||
|
|
||||||
|
// message display mode changer
|
||||||
|
if ($_SESSION['current']->isLoggedIn())
|
||||||
|
{
|
||||||
|
// FIXME we need to change this so not logged in users can change current view as well
|
||||||
|
if (isset($_REQUEST['cmode']))
|
||||||
|
$_SESSION['current']->setpref("comments:mode", $_REQUEST['cmode']);
|
||||||
|
|
||||||
|
$sel[$_SESSION['current']->getpref("comments:mode")] = 'selected';
|
||||||
|
echo '<td><form method=get name=smode action="appview.php">',"\n";
|
||||||
|
echo "<b>Application Comments</b> $messageCount total comments ";
|
||||||
|
echo '<b>Mode</b> <select name="cmode" onchange="document.smode.submit();">',"\n";
|
||||||
|
echo ' <option value="flat" '.$sel['flat'].'>Flat</option>',"\n";
|
||||||
|
echo ' <option value="threaded" '.$sel['threaded'].'>Threaded</option>',"\n";
|
||||||
|
echo ' <option value="nested" '.$sel['nested'].'>Nested</option>',"\n";
|
||||||
|
echo ' <option value="off" '.$sel['off'].'>No Comments</option>',"\n";
|
||||||
|
echo '</select>',"\n";
|
||||||
|
echo '<input type=hidden name="versionId" value="'.$versionId.'"></form></td>',"\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// blank space
|
||||||
|
echo '<td> </td>',"\n";
|
||||||
|
|
||||||
|
// post new message button
|
||||||
|
echo '<td><form method="get" name=message action="addcomment.php"><input type=submit value=" post new comment " class=button> ',"\n";
|
||||||
|
echo '<input type=hidden name="versionId" value="'.$versionId.'"></form></td>',"\n";
|
||||||
|
|
||||||
|
//end comment format table
|
||||||
|
echo '</tr></table></td></tr>',"\n";
|
||||||
|
echo '</table>',"\n";
|
||||||
|
echo html_frame_end();
|
||||||
|
|
||||||
|
if( $messageCount > 0 )
|
||||||
|
{
|
||||||
|
echo '<p align="center">The following comments are owned by whoever posted them. WineHQ is not responsible for what they say.</p>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
//start comments
|
||||||
|
echo '<table width="100%" border=0 cellpadding=2 cellspacing=1"><tr><td>',"\n";
|
||||||
|
|
||||||
|
//hide or display depending on pref
|
||||||
|
if ($_SESSION['current']->isLoggedIn())
|
||||||
|
$mode = $_SESSION['current']->getPref("comments:mode");
|
||||||
|
else
|
||||||
|
$mode = "flat";
|
||||||
|
|
||||||
|
switch ($mode)
|
||||||
|
{
|
||||||
|
case "flat":
|
||||||
|
display_comments_flat($versionId);
|
||||||
|
break;
|
||||||
|
case "nested":
|
||||||
|
display_comments_nested($versionId, $threadId);
|
||||||
|
break;
|
||||||
|
case "threaded":
|
||||||
|
display_comments_threaded($versionId, $threadId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</td></tr></table>',"\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -1,263 +0,0 @@
|
|||||||
<?php
|
|
||||||
/***************************/
|
|
||||||
/* get user info for posts */
|
|
||||||
/***************************/
|
|
||||||
|
|
||||||
function forum_lookup_user($iUserId)
|
|
||||||
{
|
|
||||||
if ($iUserId > 0)
|
|
||||||
{
|
|
||||||
$oUser = new User($iUserId);
|
|
||||||
$sMailto = '<a href="mailto:' . $oUser->sEmail . '">' . $oUser->sRealname . '</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$sMailto = '<font color="#999999">Anonymous</font>';
|
|
||||||
}
|
|
||||||
return $sMailto;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* display a single comment (in $ob)
|
|
||||||
*/
|
|
||||||
function view_app_comment($ob)
|
|
||||||
{
|
|
||||||
|
|
||||||
echo html_frame_start('','98%');
|
|
||||||
echo '<table width="100%" border=0 cellpadding=2 cellspacing=1">',"\n";
|
|
||||||
|
|
||||||
$ob->subject = stripslashes($ob->subject);
|
|
||||||
$ob->body = stripslashes($ob->body);
|
|
||||||
|
|
||||||
// message header
|
|
||||||
echo "<tr bgcolor=#E0E0E0><td>\n";
|
|
||||||
echo " <b>".$ob->subject."</b><br>\n";
|
|
||||||
echo " by ".forum_lookup_user($ob->userId)." on ".$ob->time."<br>\n";
|
|
||||||
echo "</td></tr><tr><td>\n";
|
|
||||||
|
|
||||||
// body
|
|
||||||
echo htmlify_urls($ob->body), "<br><br>\n";
|
|
||||||
|
|
||||||
// only add RE: once
|
|
||||||
if(eregi("RE:", $ob->subject))
|
|
||||||
$subject = $ob->subject;
|
|
||||||
else
|
|
||||||
$subject = "RE: ".$ob->subject;
|
|
||||||
|
|
||||||
// reply post buttons
|
|
||||||
echo " [<a href='addcomment.php?appId=$ob->appId&versionId=$ob->versionId'><small>post new</small></a>] \n";
|
|
||||||
echo " [<a href='addcomment.php?appId=$ob->appId&versionId=$ob->versionId&subject=".
|
|
||||||
urlencode("$subject")."&thread=$ob->commentId'><small>reply to this</small></a>] \n";
|
|
||||||
|
|
||||||
echo "</td></tr>\n";
|
|
||||||
|
|
||||||
// delete message button, for admins
|
|
||||||
if ($_SESSION['current']->isLoggedIn() && ($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintainer($ob->appId,$ob->versionId) ))
|
|
||||||
{
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<td><form method=\"post\" name=\"message\" action=\"".BASE."deletecomment.php\"><input type=submit value='Delete' class=button>\n";
|
|
||||||
echo "<input type=\"hidden\" name=\"commentId\" value=\"$ob->commentId\" />";
|
|
||||||
echo "<input type=\"hidden\" name=\"appId\" value=\"$ob->appId\" />";
|
|
||||||
echo "<input type=\"hidden\" name=\"versionId\" value=\"$ob->versionId\" /></form></td>","\n";
|
|
||||||
echo "</td></tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "</table>\n";
|
|
||||||
|
|
||||||
echo html_frame_end();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* grab comments for appId / versionId
|
|
||||||
* if parentId is not -1 only comments for that thread are returned
|
|
||||||
*/
|
|
||||||
function grab_comments($appId, $versionId, $parentId = -1)
|
|
||||||
{
|
|
||||||
$extra = "";
|
|
||||||
if($parentId != -1)
|
|
||||||
$extra = "AND parentId = $parentId ";
|
|
||||||
|
|
||||||
$qstring = "SELECT from_unixtime(unix_timestamp(time), \"%W %M %D %Y, %k:%i\") as time, ".
|
|
||||||
"commentId, parentId, appId, versionId, userId, subject, body ".
|
|
||||||
"FROM appComments WHERE appId = '$appId' AND versionId = '$versionId' ".
|
|
||||||
$extra.
|
|
||||||
"ORDER BY appComments.time ASC";
|
|
||||||
|
|
||||||
$result = query_appdb($qstring);
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* grab comments for appId / versionId
|
|
||||||
* if parentId is not -1 only comments for that thread are returned
|
|
||||||
*/
|
|
||||||
function count_comments($appId, $versionId)
|
|
||||||
{
|
|
||||||
$qstring = "SELECT count(commentId) as hits FROM appComments WHERE appId = $appId AND versionId = $versionId";
|
|
||||||
$result = query_appdb($qstring);
|
|
||||||
$ob = mysql_fetch_object($result);
|
|
||||||
return $ob->hits;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* display nested comments
|
|
||||||
* handle is a db result set
|
|
||||||
*/
|
|
||||||
function do_display_comments_nested($handle)
|
|
||||||
{
|
|
||||||
while($ob = mysql_fetch_object($handle))
|
|
||||||
{
|
|
||||||
view_app_comment($ob);
|
|
||||||
$result = grab_comments($ob->appId, $ob->versionId, $ob->commentId);
|
|
||||||
if($result && mysql_num_rows($result))
|
|
||||||
{
|
|
||||||
echo "<blockquote>\n";
|
|
||||||
do_display_comments_nested($result);
|
|
||||||
echo "</blockquote>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function display_comments_nested($appId, $versionId, $threadId)
|
|
||||||
{
|
|
||||||
$result = grab_comments($appId, $versionId, $threadId);
|
|
||||||
|
|
||||||
do_display_comments_nested($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* display threaded comments
|
|
||||||
* handle is a db result set
|
|
||||||
*/
|
|
||||||
function do_display_comments_threaded($handle, $is_main)
|
|
||||||
{
|
|
||||||
if (!$is_main)
|
|
||||||
echo "<ul>\n";
|
|
||||||
|
|
||||||
while ($ob = mysql_fetch_object($handle))
|
|
||||||
{
|
|
||||||
if ($is_main)
|
|
||||||
{
|
|
||||||
view_app_comment($ob);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
echo '<li><a href="commentview.php?appId='.$ob->appId.'&versionId='.$ob->versionId.'&threadId='.$ob->parentId.'"> '.
|
|
||||||
$ob->subject.' </a> by '.forum_lookup_user($ob->userId).' on '.$ob->time.' </li>'."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = grab_comments($ob->appId, $ob->versionId, $ob->commentId);
|
|
||||||
if ($result && mysql_num_rows($result))
|
|
||||||
{
|
|
||||||
echo "<blockquote>\n";
|
|
||||||
do_display_comments_threaded($result, 0);
|
|
||||||
echo "</blockquote>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$is_main)
|
|
||||||
echo "</ul>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function display_comments_threaded($appId, $versionId, $threadId = 0)
|
|
||||||
{
|
|
||||||
$result = grab_comments($appId, $versionId, $threadId);
|
|
||||||
|
|
||||||
do_display_comments_threaded($result, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* display flat comments
|
|
||||||
*/
|
|
||||||
function display_comments_flat($appId, $versionId)
|
|
||||||
{
|
|
||||||
$result = grab_comments($appId, $versionId);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
while($ob = mysql_fetch_object($result))
|
|
||||||
{
|
|
||||||
view_app_comment($ob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function view_app_comments($appId, $versionId, $threadId = 0)
|
|
||||||
{
|
|
||||||
// count posts
|
|
||||||
$result = query_appdb("SELECT commentId FROM appComments WHERE appId = $appId AND versionId = $versionId");
|
|
||||||
$messageCount = mysql_num_rows($result);
|
|
||||||
|
|
||||||
//start comment format table
|
|
||||||
echo html_frame_start("","98%",'',0);
|
|
||||||
echo '<table width="100%" border=0 cellpadding=1 cellspacing=0">',"\n";
|
|
||||||
|
|
||||||
echo '<tr><td bgcolor=#C0C0C0 align=center><table border=0 cellpadding=0 cellspacing=0><tr bgcolor=#C0C0C0>',"\n";
|
|
||||||
|
|
||||||
// message display mode changer
|
|
||||||
if ($_SESSION['current']->isLoggedIn())
|
|
||||||
{
|
|
||||||
// FIXME we need to change this so not logged in users can change current view as well
|
|
||||||
if (isset($_REQUEST['cmode']))
|
|
||||||
$_SESSION['current']->setpref("comments:mode", $_REQUEST['cmode']);
|
|
||||||
|
|
||||||
$sel[$_SESSION['current']->getpref("comments:mode")] = 'selected';
|
|
||||||
echo '<td><form method=get name=smode action="appview.php">',"\n";
|
|
||||||
echo "<b>Application Comments</b> $messageCount total comments ";
|
|
||||||
echo '<b>Mode</b> <select name="cmode" onchange="document.smode.submit();">',"\n";
|
|
||||||
echo ' <option value=flat '.$sel['flat'].'>Flat</option>',"\n";
|
|
||||||
echo ' <option value=threaded '.$sel['threaded'].'>Threaded</option>',"\n";
|
|
||||||
echo ' <option value=nested '.$sel['nested'].'>Nested</option>',"\n";
|
|
||||||
echo ' <option value=off '.$sel['off'].'>No Comments</option>',"\n";
|
|
||||||
echo '</select><input type=hidden name="appId" value="'.$appId.'">',"\n";
|
|
||||||
echo '<input type=hidden name="versionId" value="'.$versionId.'"></form></td>',"\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// blank space
|
|
||||||
echo '<td> </td>',"\n";
|
|
||||||
|
|
||||||
// post new message button
|
|
||||||
echo '<td><form method=get name=message action="addcomment.php"><input type=submit value=" post new comment " class=button> ',"\n";
|
|
||||||
echo '<input type=hidden name="appId" value="'.$appId.'"><input type=hidden name="versionId" value="'.$versionId.'"></form></td>',"\n";
|
|
||||||
|
|
||||||
//end comment format table
|
|
||||||
echo '</tr></table></td></tr>',"\n";
|
|
||||||
echo '</table>',"\n";
|
|
||||||
echo html_frame_end();
|
|
||||||
|
|
||||||
if( $messageCount > 0 )
|
|
||||||
{
|
|
||||||
echo '<p align="center">The following comments are owned by whoever posted them. WineHQ is not responsible for what they say.</p>'."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
//start comments
|
|
||||||
echo '<table width="100%" border=0 cellpadding=2 cellspacing=1"><tr><td>',"\n";
|
|
||||||
|
|
||||||
//hide or display depending on pref
|
|
||||||
if ($_SESSION['current']->isLoggedIn())
|
|
||||||
$mode = $_SESSION['current']->getpref("comments:mode");
|
|
||||||
else
|
|
||||||
$mode = "flat";
|
|
||||||
|
|
||||||
switch ($mode)
|
|
||||||
{
|
|
||||||
case "flat":
|
|
||||||
display_comments_flat($appId, $versionId);
|
|
||||||
break;
|
|
||||||
case "nested":
|
|
||||||
display_comments_nested($appId, $versionId, $threadId);
|
|
||||||
break;
|
|
||||||
case "threaded":
|
|
||||||
display_comments_threaded($appId, $versionId, $threadId);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</td></tr></table>',"\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -137,13 +137,11 @@ create table appComments (
|
|||||||
time datetime,
|
time datetime,
|
||||||
commentId int not null auto_increment,
|
commentId int not null auto_increment,
|
||||||
parentId int default 0,
|
parentId int default 0,
|
||||||
appId int not null,
|
versionId int not null,
|
||||||
versionId int default 0,
|
|
||||||
userId int,
|
userId int,
|
||||||
hostname varchar(80),
|
hostname varchar(80),
|
||||||
subject varchar(128),
|
subject varchar(128),
|
||||||
body text,
|
body text,
|
||||||
score int,
|
|
||||||
key(commentId),
|
key(commentId),
|
||||||
index(appId),
|
index(appId),
|
||||||
index(versionId)
|
index(versionId)
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
* application environment
|
* application environment
|
||||||
*/
|
*/
|
||||||
include("path.php");
|
include("path.php");
|
||||||
require(BASE."include/"."incl.php");
|
require(BASE."include/incl.php");
|
||||||
require(BASE."include/"."application.php");
|
require(BASE."include/application.php");
|
||||||
require(BASE."include/"."comments.php");
|
require(BASE."include/comment.php");
|
||||||
|
|
||||||
$vendorId = $_REQUEST['vendorId'];
|
$vendorId = $_REQUEST['vendorId'];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user