[aur-dev] [PATCH 3/5] pkg_comment_form.php: Make printing of header conditional

Marcel Korpel marcel.korpel at gmail.com
Mon Jul 20 22:08:46 UTC 2015


For use in the new RPC interface to edit comments, the form shouldn't
always print a header. Make this conditional.

Signed-off-by: Marcel Korpel <marcel.korpel at gmail.com>
---
 web/template/pkg_comment_form.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/web/template/pkg_comment_form.php b/web/template/pkg_comment_form.php
index 16a92b1..2eeb6f9 100644
--- a/web/template/pkg_comment_form.php
+++ b/web/template/pkg_comment_form.php
@@ -1,8 +1,10 @@
+<?php /* $pkgbase_name will not be set when called from aurjson.class.php */
+if (isset($pkgbase_name)): ?>
 <div id="generic-form" class="box">
 	<h2><?= (isset($comment_id)) ? __('Edit comment for: %s', htmlspecialchars($pkgbase_name)) : __("Add Comment"); ?></h2>
 	<form action="<?= get_pkgbase_uri($pkgbase_name) ?>" method="post">
 		<fieldset>
-<?php
+<?php endif;
 if (isset($_REQUEST['comment']) && check_token()) {
 	echo '<p>' . __('Comment has been added.') . '</p>';
 }
@@ -21,7 +23,10 @@ if (isset($_REQUEST['comment']) && check_token()) {
 			<p>
 				<input type="submit" value="<?= (isset($comment_id)) ? __("Save") : __("Add Comment") ?>" />
 			</p>
+<?php
+if (isset($pkgbase_name)): ?>
 		</fieldset>
 	</form>
 </div>
+<?php endif;
 
-- 
2.4.6


More information about the aur-dev mailing list