summaryrefslogtreecommitdiff
path: root/ajax_comments.php
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2007-06-11 20:15:48 +0000
committerMax Kremmel <xing@synapse.plus.com>2007-06-11 20:15:48 +0000
commit60d7a7c6d59729bf43944b697954c6a4d079f687 (patch)
tree8b2a5a97f77bf96d22a5707bd79f7df9048e4f07 /ajax_comments.php
parentadbea18572f04f19c45a9cb99badf9c966353b0b (diff)
downloadliberty-60d7a7c6d59729bf43944b697954c6a4d079f687.tar.gz
liberty-60d7a7c6d59729bf43944b697954c6a4d079f687.tar.bz2
liberty-60d7a7c6d59729bf43944b697954c6a4d079f687.zip
do a permission check and return correct error depnding on what happened
Diffstat (limited to 'ajax_comments.php')
-rw-r--r--ajax_comments.php19
1 files changed, 9 insertions, 10 deletions
diff --git a/ajax_comments.php b/ajax_comments.php
index a7b24d6..290e1b9 100644
--- a/ajax_comments.php
+++ b/ajax_comments.php
@@ -1,22 +1,21 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_liberty/ajax_comments.php,v 1.1 2007/06/10 15:14:40 wjames5 Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_liberty/ajax_comments.php,v 1.2 2007/06/11 20:15:48 squareing Exp $
* @package liberty
* @subpackage functions
*/
require_once( '../bit_setup_inc.php' );
-global $gContent, $gBitSmarty;
-require_once (LIBERTY_PKG_PATH.'LibertyContent.php');
-
$staticContent = new LibertyContent();
-$gContent = $staticContent->getLibertyObject( $_REQUEST['parent_id'], $_REQUEST['parent_guid']);
+$gContent = $staticContent->getLibertyObject( $_REQUEST['parent_id'], $_REQUEST['parent_guid'] );
-if( $gContent->isCommentable() ) {
+if( !$gBitUser->hasPermission( 'p_liberty_post_comments' )) {
+ echo tra( "You do not have the required permissions to post new comments" );
+} elseif( $gContent->isCommentable() ) {
$commentsParentId = $_REQUEST['parent_id'];
$comments_return_url = $_REQUEST['comments_return_url'];
include_once( LIBERTY_PKG_PATH.'comments_inc.php' );
- if (isset($_REQUEST['post_comment_submit'])){
+ if( isset( $_REQUEST['post_comment_submit'] )) {
$storeComment->loadComment();
$postComment = $storeComment->mInfo;
$postComment['parsed_data'] = $storeComment->parseData( $postComment );
@@ -24,7 +23,7 @@ if( $gContent->isCommentable() ) {
$gBitSmarty->assign('comment', $postComment);
$gBitSmarty->assign('commentsParentId', $commentsParentId);
echo $gBitSmarty->fetch( 'bitpackage:liberty/display_comment.tpl' );
-}else{
- echo "Sorry, you do not have permission to post comments to this content.";
+} else {
+ echo tra( "Sorry, you can not post a comment here." );
}
-?> \ No newline at end of file
+?>