Module: appdb Branch: master Commit: b48221cdd4d1238e5974f50039fc266da7fbedca URL: http://source.winehq.org/git/appdb.git/?a=commit;h=b48221cdd4d1238e5974f5003...
Author: Alexander Nicolaysen Sørnes alex@thehandofagony.com Date: Mon Oct 22 17:07:31 2007 +0200
comment: Require versionId and message body to be defined
---
include/comment.php | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/include/comment.php b/include/comment.php index d26f088..e6646d7 100644 --- a/include/comment.php +++ b/include/comment.php @@ -242,8 +242,8 @@ class Comment { $oM = new objectManager("comment", "Post new ocmment"); $oM->setReturnTo($oVersion->objectMakeUrl()); // reply post buttons - echo " [<a href="".$oM->makeUrl("add")."&iAppId=$this->iAppId&iVersionId=$this->iVersionId"><small>post new</small></a>] \n"; - echo " [<a href="".$oM->makeUrl("add")."&iAppId=$this->iAppId&iVersionId=$this->iVersionId&sSubject=". + echo " [<a href="".$oM->makeUrl("add")."&iVersionId=$this->iVersionId"><small>post new</small></a>] \n"; + echo " [<a href="".$oM->makeUrl("add")."&iVersionId=$this->iVersionId&sSubject=". urlencode("$sSubject")."&iThread=$this->iCommentId"><small>reply to this</small></a>] \n";
echo "</td></tr>\n"; @@ -570,13 +570,26 @@ class Comment { switch($sAction) { case "add": - return array("iThread", "iAppId", "iVersionId"); + return array("iThread", "iVersionId");
default: return null; } }
+ function checkOutputEditorInput($aClean) + { + $sErrors = ""; + + if(!$aClean['iVersionId']) + $sErrors .= "<li>No version id defined; something may have gone wrong with the URL</li>\n"; + + if(!$aClean['sBody']) + $sErrors .= "<li>You need to enter a message!</li>\n"; + + return $sErrors; + } + function outputEditor($aClean) { $sMesTitle = "<b>Post New Comment</b>"; @@ -612,7 +625,6 @@ class Comment { echo html_frame_end();
echo "<input type="hidden" name="iThread" value="".$aClean['iThread']."" />\n"; - echo "<input type="hidden" name="iAppId" value="".$aClean['iAppId']."" />\n"; echo "<input type="hidden" name="iVersionId" value="".$aClean['iVersionId']."" />\n"; }