cvs: pearweb /public_html/pepr pepr-comments-show.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Fri, 21 Mar 2008 21:40:27 +0000 |
| Subject: | cvs: pearweb /public_html/pepr pepr-comments-show.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-7357@lists.php.net to get a copy of this message | ||
dufuz Fri Mar 21 21:40:27 2008 UTC
Modified files:
/pearweb/public_html/pepr pepr-comments-show.php
Log:
A bit hackish way to fix Request #11289 Commenting on proposals
Note the c->setValue (hint, that is the fix)
A sprinkle of improvements to hopefully make the code a tad more readable.
http://cvs.php.net/viewvc.cgi/pearweb/public_html/pepr/pepr-comments-show.php?r1=1.22&r2=1.23&diff_format=u
Index: pearweb/public_html/pepr/pepr-comments-show.php
diff -u pearweb/public_html/pepr/pepr-comments-show.php:1.22
pearweb/public_html/pepr/pepr-comments-show.php:1.23
--- pearweb/public_html/pepr/pepr-comments-show.php:1.22 Sun Jan 13 17:18:45 2008
+++ pearweb/public_html/pepr/pepr-comments-show.php Fri Mar 21 21:40:27 2008
@@ -17,7 +17,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright Copyright (c) 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License
- * @version $Id: pepr-comments-show.php,v 1.22 2008/01/13 17:18:45 dufuz Exp $
+ * @version $Id: pepr-comments-show.php,v 1.23 2008/03/21 21:40:27 dufuz Exp $
*/
/**
@@ -25,7 +25,7 @@
*/
require_once 'pepr/pepr.php';
-if (!$proposal =& proposal::get($dbh, @$_GET['id'])) {
+if (!$proposal =& proposal::get($dbh, (int)@$_GET['id'])) {
response_header('PEPr :: Comments :: Invalid Request');
echo "<h1>Comments for</h1>\n";
report_error('The requested proposal does not exist.');
@@ -33,18 +33,16 @@
exit;
}
+$id = $proposal->id;
response_header('PEPr :: Comments :: ' . htmlspecialchars($proposal->pkg_name));
echo '<h1>Comments for "' . htmlspecialchars($proposal->pkg_name) .
""</h1>\n";
+display_pepr_nav($proposal);
-if ($auth_user &&
- $proposal->getStatus() == 'proposal')
-{
+if ($auth_user && $proposal->getStatus() == 'proposal') {
include_once 'HTML/QuickForm.php';
+ $form =& new HTML_QuickForm('comment', 'post',
'pepr-comments-show.php?id=' . $id);
- $form =& new HTML_QuickForm('comment', 'post',
- 'pepr-comments-show.php?id=' . $proposal->id);
-
- $form->addElement('textarea', 'comment', null,
+ $c = $form->addElement('textarea', 'comment', null,
array('cols' => 70,
'rows' => 20,
'id' => 'comment_field'));
@@ -60,26 +58,22 @@
$form->addElement('submit', 'submit', 'Add New Comment');
$form->applyFilter('comment', 'trim');
- $form->addRule('comment', 'A comment is required', 'required',
null,
- 'client');
+ $form->addRule('comment', 'A comment is required', 'required',
null, 'client');
if (isset($_POST['submit'])) {
if ($form->validate()) {
- $values = $form->exportValues();
+ $comment = $form->exportValue('comment');
$proposal->sendActionEmail('proposal_comment', 'user',
$auth_user->handle,
- $values['comment']);
- $proposal->addComment($values['comment'],
- 'package_proposal_comments');
+ $comment);
+ $proposal->addComment($comment, 'package_proposal_comments');
report_success('Your comment was successfully processed');
+ $c->setValue('');
} else {
report_error($form->getElementError('comment'));
}
}
}
-
-display_pepr_nav($proposal);
-
?>
<table border="0" cellspacing="0" cellpadding="2"
style="width: 100%">
@@ -92,7 +86,11 @@
<?php
-if ($proposal->getStatus() == 'proposal') {
+if ($proposal->getStatus() != 'proposal') {
+ echo 'Comments are only accepted during the "Proposal" phase. ';
+ echo 'This proposal is currently in the "';
+ echo $proposal->getStatus(true) . '" phase.';
+} else {
if ($auth_user) {
$formArray = $form->toArray();
@@ -132,12 +130,7 @@
echo ' PEAR developer, you can comment by sending an email to ';
echo '<a href="mailto:' . PEAR_DEV_EMAIL .
'">' . PEAR_DEV_EMAIL . '</a>.';
}
-} else {
- echo 'Comments are only accepted during the "Proposal" phase. ';
- echo 'This proposal is currently in the "';
- echo $proposal->getStatus(true) . '" phase.';
}
-
?>
</td>
@@ -150,7 +143,7 @@
<?php
-$comments = ppComment::getAll($proposal->id, 'package_proposal_comments');
+$comments = ppComment::getAll($id, 'package_proposal_comments');
$userInfos = array();
if (is_array($comments) && (count($comments) > 0)) {
@@ -171,7 +164,6 @@
echo ' <td class="textcell" valign="top">';
echo 'There are no comments.';
}
-
?>
</td>
@@ -179,7 +171,4 @@
</table>
<?php
-
-response_footer();
-
-?>
+response_footer();
\ No newline at end of file