예제 #1
0
 /**
  * Get the HTML markup of the comment form.
  *
  * @param array $http_data Query parameters.
  *
  * @return string The JSON formatted response data.
  */
 private function get_comment_form($http_data)
 {
     if (!isset($http_data['base_id']) || !isset($http_data['pkgbase_name'])) {
         $output = array('success' => 0, 'error' => __('Package base ID or package base name missing.'));
         return json_encode($output);
     }
     $comment_id = intval($http_data['arg']);
     $base_id = intval($http_data['base_id']);
     $pkgbase_name = $http_data['pkgbase_name'];
     list($user_id, $comment) = comment_by_id($comment_id);
     if (!has_credential(CRED_COMMENT_EDIT, array($user_id))) {
         $output = array('success' => 0, 'error' => __('You are not allowed to edit this comment.'));
         return json_encode($output);
     } elseif (is_null($comment)) {
         $output = array('success' => 0, 'error' => __('Comment does not exist.'));
         return json_encode($output);
     }
     ob_start();
     include 'pkg_comment_form.php';
     $html = ob_get_clean();
     $output = array('success' => 1, 'form' => $html);
     return json_encode($output);
 }
예제 #2
0
<?php

set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once "aur.inc.php";
include_once "pkgbasefuncs.inc.php";
set_lang();
check_sid();
$comment_id = intval($_REQUEST['comment_id']);
list($user_id, $comment) = comment_by_id($comment_id);
if (!isset($base_id) || !has_credential(CRED_COMMENT_EDIT, array($user_id)) || is_null($comment)) {
    header('Location: /');
    exit;
}
html_header(__("Edit comment"));
include 'pkg_comment_box.php';
html_footer(AURWEB_VERSION);