Checking whether to add a comment is something that really does not
belong to a function named display_package_details().

Signed-off-by: Lukas Fleischer <[email protected]>
---
 web/html/packages.php    | 6 ++++++
 web/lib/pkgfuncs.inc.php | 4 ----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/web/html/packages.php b/web/html/packages.php
index e03a099..a9f6263 100644
--- a/web/html/packages.php
+++ b/web/html/packages.php
@@ -99,6 +99,12 @@ if (check_token()) {
                list($ret, $output) = pkg_change_category($pkgid, $atype);
        }
 
+       if (isset($_REQUEST['comment'])) {
+               $uid = uid_from_sid($_COOKIE["AURSID"]);
+               add_package_comment($pkgid, $uid, $_REQUEST['comment']);
+               $ret = true;
+       }
+
        if ($ret) {
                /* Redirect back to package page on success. */
                header('Location: ' . get_pkg_uri($pkgname));
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index 1350bf5..a4deee6 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -449,10 +449,6 @@ function display_package_details($id=0, $row, $SID="") {
                # Actions Bar
                if ($SID) {
                        include('actions_form.php');
-                       if (isset($_REQUEST['comment']) && check_token()) {
-                               $uid = uid_from_sid($SID);
-                               add_package_comment($id, $uid, 
$_REQUEST['comment']);
-                       }
                        include('pkg_comment_form.php');
                }
 
-- 
1.8.4.rc3.500.gc3113b0

Reply via email to