diff options
| -rw-r--r-- | LibertyComment.php | 27 | ||||
| -rw-r--r-- | admin/comments.php | 27 | ||||
| -rw-r--r-- | comments_inc.php | 36 | ||||
| -rw-r--r-- | comments_moderation_inc.php | 60 | ||||
| -rw-r--r-- | templates/admin_comments.tpl | 16 | ||||
| -rw-r--r-- | templates/edit_content_comments_inc.tpl | 14 | ||||
| -rw-r--r-- | templates/service_content_body_inc.tpl | 10 | ||||
| -rw-r--r-- | templates/service_content_edit_mini_inc.tpl | 1 |
8 files changed, 5 insertions, 186 deletions
diff --git a/LibertyComment.php b/LibertyComment.php index 357a122..bbf6abe 100644 --- a/LibertyComment.php +++ b/LibertyComment.php @@ -3,7 +3,7 @@ * Management of Liberty Content * * @package liberty - * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyComment.php,v 1.58 2008/04/17 13:26:29 wjames5 Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyComment.php,v 1.59 2008/04/17 18:16:07 wjames5 Exp $ * @author spider <spider@steelsun.com> */ @@ -15,11 +15,6 @@ require_once( LIBERTY_PKG_PATH.'LibertyContent.php' ); define( 'BITCOMMENT_CONTENT_TYPE_GUID', 'bitcomment' ); /** - * Load up our moderation handlers - */ -require_once( LIBERTY_PKG_PATH.'comments_moderation_inc.php' ); - -/** * Virtual base class (as much as one can have such things in PHP) for all * derived tikiwiki classes that require database access. * @@ -521,26 +516,6 @@ class LibertyComment extends LibertyContent { $join1 = ''; } - // if comment moderation is enabled join onto the moderation table to get references - global $gBitSystem, $gBitUser; - if ( $gBitSystem->isFeatureActive('liberty_display_status') && - $gBitSystem->isPackageActive('moderation') - /* would like to enforce access to the moderations along these terms - * the problem is we can't do a real check because we don't have a reference to the parent content object - && ( - ( $gBitSystem->isFeatureActive( 'comments_allow_owner_moderation' ) && $gContent->hasEditPermission() ) || - ( - ( $gBitSystem->isFeatureActive( 'comments_moderate_all' ) || $gBitSystem->isFeatureActive( 'comments_allow_moderation' ) ) && - ( $gBitUser->isAdmin() || $gContent->hasUserPermission('p_liberty_edit_comments') ) - ) - ) - */ - ){ - // where we have a status_id of -1 join to moderation table - $select1 .= ", m.`moderation_id`"; - $join1 .= " LEFT OUTER JOIN `".BIT_DB_PREFIX."moderation` m ON (m.`content_id` = lc.`content_id`) "; - } - $joinSql = $selectSql = $whereSql = ''; $pListHash = array( 'content_id' => $contentId, 'max_records' => $pMaxComments, 'offset'=>$pOffset, 'sort_mode'=> $pSortOrder, 'display_mode' => $pDisplayMode, 'include_comments' => 'y' ); $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars, $this, $pListHash ); diff --git a/admin/comments.php b/admin/comments.php index 263f82b..1addc6d 100644 --- a/admin/comments.php +++ b/admin/comments.php @@ -34,33 +34,8 @@ $commentSettings = array( ); $gBitSmarty->assign( 'commentSettings', $commentSettings ); -$commentModerationSettings = array(); - -if ( $gBitSystem->isPackageActive('moderation') ){ - $commentModerationSettings = array( - "comments_allow_moderation" => array( - 'label' => 'Allow admins to moderate comments', - 'note' => 'Checking this allows users with the permission to edit comments the ability to force moderation on comment posts. When comments are moderated they are automatically hidden until approved by a moderator. This is opt in, meaning you can limit the moderation requirement on a content by content basis.', - 'page' => '', - ), - "comments_allow_owner_moderation" => array( - 'label' => 'Allow content creators to moderate comments on their content', - 'note' => 'This is similar to allowing admins to moderate comments, but this lets the creator of a content item to require and moderate the comments on the things they create. Administrators will also be able to admin those comments.', - 'page' => '', - ), - "comments_moderate_all" => array( - 'label' => 'Require moderation of all comments', - 'note' => 'This forces all comments to be held for moderation before being published. We recommend this only if you are have extensive problems with spam or malicious comments; on high traffic sites this features requires a lot of hands on work to read all comments', - 'page' => '', - ), - ); - - $gBitSmarty->assign( 'commentModerationSettings', $commentModerationSettings ); -} - if( !empty( $_REQUEST['change_prefs'] ) ) { - $commentOptions = array_merge( $commentSettings, $commentModerationSettings ); - foreach( array_keys( $commentOptions ) as $item ) { + foreach( array_keys( $commentSettings ) as $item ) { simple_set_toggle( $item, LIBERTY_PKG_NAME ); } diff --git a/comments_inc.php b/comments_inc.php index c21f364..e2535ea 100644 --- a/comments_inc.php +++ b/comments_inc.php @@ -3,12 +3,12 @@ * comment_inc * * @author spider <spider@steelsun.com> - * @version $Revision: 1.47 $ + * @version $Revision: 1.48 $ * @package liberty * @subpackage functions */ -// $Header: /cvsroot/bitweaver/_bit_liberty/comments_inc.php,v 1.47 2008/04/17 13:26:29 wjames5 Exp $ +// $Header: /cvsroot/bitweaver/_bit_liberty/comments_inc.php,v 1.48 2008/04/17 18:16:07 wjames5 Exp $ // Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. // All Rights Reserved. See copyright.txt for details and a complete list of authors. @@ -117,38 +117,6 @@ if (!empty($_REQUEST['post_comment_submit']) && $gBitUser->hasPermission( 'p_lib } if(!($gBitSystem->isPackageActive('bitboards') && BitBoardTopic::isLockedMsg($storeRow['parent_id']))) { if( $storeComment->storeComment($storeRow) ) { - // hold comments for moderation - requires moderation package is installed - if( $gBitSystem->isPackageActive('moderation') && - empty( $_REQUEST['post_comment_id'] ) && - !( $gContent->isOwner() || $gBitUser->isAdmin() ) && - ( $gBitSystem->isFeatureActive( 'comments_moderate_all' ) || - (( $gBitSystem->isFeatureActive( 'comments_allow_moderation' ) || $gBitSystem->isFeatureActive('comments_allow_owner_moderation')) && - $gContent->getPreference( 'moderate_comments' )) - )){ - // if we are enforcing moderation on the comment then change the status_id - $storeComment->storeStatus( -1 ); - // prep info what we'll store in the moderation ticket - $modMsg = tra( "A comment has been submitted to " ).$gContent->mType['content_description']." ".$gContent->getTitle(); - $modDataHash = array( 'display_url' => $storeComment->getDisplayUrl() ); - if ( $gBitSystem->isFeatureActive('comments_allow_owner_moderation') ){ - $modUserId = $gContent->mInfo['user_id']; - }else{ - $modUserId = 2; //assign it to admin rather than the owner so as to prevent content owner from accessing if they should not be able to - } - // register it for moderation - $pendingModeration = $gModerationSystem->requestModeration( 'liberty', - 'comment_post', - $modUserId, - NULL, - 'p_liberty_edit_comments', - $storeComment->mContentId, - $modMsg, - MODERATION_PENDING, - $modDataHash - ); - } - // end moderation - if($gBitSystem->isPackageActive('bitboards') && $gBitSystem->isFeatureActive('bitboards_thread_track')) { $topic_id = substr($storeComment->mInfo['thread_forward_sequence'],0,10); $data = BitBoardTopic::getNotificationData($topic_id); diff --git a/comments_moderation_inc.php b/comments_moderation_inc.php deleted file mode 100644 index f0a5d33..0000000 --- a/comments_moderation_inc.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php -// $Header: /cvsroot/bitweaver/_bit_liberty/Attic/comments_moderation_inc.php,v 1.1 2008/04/17 13:26:29 wjames5 Exp $ -// Copyright (c) 2004-2008 bitweaver Group -// All Rights Reserved. -// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. - - -/** - * load up moderation - * we need to include its bit_setup_inc incase comments gets loaded first - */ -if ( is_file( BIT_ROOT_PATH.'moderation/bit_setup_inc.php' ) ){ - require_once( BIT_ROOT_PATH.'moderation/bit_setup_inc.php' ); -} - -if( $gBitSystem->isPackageActive('moderation') && - !defined('comments_moderation_callback') ) { - global $gModerationSystem; - - require_once(MODERATION_PKG_PATH.'ModerationSystem.php'); - - // What are our transitions - $commentTransitions = array( "comment_post" => - array (MODERATION_PENDING => - array(MODERATION_APPROVED, - MODERATION_REJECTED), - MODERATION_REJECTED => MODERATION_DELETE, - MODERATION_APPROVED => MODERATION_DELETE, - ), - ); - - function comments_moderation_callback(&$pModeration) { - global $gBitUser, $gBitSystem; - - if ($pModeration['type'] == 'comment_post') { - $comment = new LibertyComment( NULL, $pModeration['content_id'] ); - $comment->load(); - if ($pModeration['status'] == MODERATION_APPROVED) { - // change its status - $comment->storeStatus( 50 ); - // delete the ticket - $pModeration['status'] = MODERATION_DELETE; - }else if($pModeration['status'] == MODERATION_REJECTED) { - // change its status to soft delete - $comment->storeStatus( -999 ); - // delete the ticket - $pModeration['status'] = MODERATION_DELETE; - } - } - - return TRUE; - } - - // Register our moderation transitions - $gModerationSystem->registerModerationListener('liberty', - 'comments_moderation_callback', - $commentTransitions); -} - -?> diff --git a/templates/admin_comments.tpl b/templates/admin_comments.tpl index d6bcb02..9a3d125 100644 --- a/templates/admin_comments.tpl +++ b/templates/admin_comments.tpl @@ -72,22 +72,6 @@ </div> {/legend} {/jstab} - {if $gBitSystem->isPackageActive( 'moderation' ) } - {jstab title="Comment Moderation"} - <p>This feature is new and still in development, you may find it buggy.</p> - {legend legend="Moderation Settings"} - {foreach from=$commentModerationSettings key=item item=output} - <div class="row"> - {formlabel label=`$output.label` for=$item} - {forminput} - {html_checkboxes name="$item" values="y" checked=$gBitSystem->getConfig($item) labels=false id=$item} - {formhelp note=`$output.note` page=`$output.page`} - {/forminput} - </div> - {/foreach} - {/legend} - {/jstab} - {/if} {/jstabs} <div class="row submit"> diff --git a/templates/edit_content_comments_inc.tpl b/templates/edit_content_comments_inc.tpl deleted file mode 100644 index c30935d..0000000 --- a/templates/edit_content_comments_inc.tpl +++ /dev/null @@ -1,14 +0,0 @@ -{if $gBitSystem->isPackageActive('moderation') && - ( - ( $gBitSystem->isFeatureActive( 'comments_allow_owner_moderation' ) && $gContent->hasEditPermission() ) || - ( $gBitSystem->isFeatureActive( 'comments_allow_moderation' ) && ( $gBitUser->isAdmin() || $gContent->hasUserPermission('p_liberty_edit_comments') ) ) - )} - {* comments_moderate_all we handle in comments_inc, no input value is required and its not an option *} - <div class="row"> - {formlabel label="Moderate Comments" for="moderate_comments"} - {forminput} - <input type="checkbox" name="preferences_store[moderate_comments]" id="moderate_comments" value="y" {if $gContent->getPreference( 'moderate_comments' )}checked="checked"{/if} /> - {formhelp note="Comments will be hidden until you approve them."} - {/forminput} - </div> -{/if} diff --git a/templates/service_content_body_inc.tpl b/templates/service_content_body_inc.tpl index ca169f7..88ea22e 100644 --- a/templates/service_content_body_inc.tpl +++ b/templates/service_content_body_inc.tpl @@ -1,11 +1,3 @@ {if $gBitSystem->isFeatureActive( 'liberty_display_status' ) && ($gBitUser->hasPermission('p_liberty_edit_content_status') || $gBitUser->hasPermission('p_liberty_edit_all_status')) && !is_null($serviceHash.content_status_id) && $serviceHash.content_status_id != 50} - <p class="liberty_status">{biticon iname=dialog-warning iexplain="Warning"} {tr}The status of this content is <strong>{$gContent->getContentStatusName($serviceHash.content_status_id)}</strong>{/tr}. - {if $serviceHash.content_status_id == -1 && $gBitSystem->isPackageActive('moderation') && - ( - ( $gBitSystem->isFeatureActive( 'comments_allow_owner_moderation' ) && $gContent->hasEditPermission() ) || - ( $gBitSystem->isFeatureActive( 'comments_allow_moderation' ) && ( $gBitUser->isAdmin() || $gContent->hasUserPermission('p_liberty_edit_comments') ) ) - )} - <a href="{$smarty.const.MODERATION_PKG_URL}index.php?moderation_id={$serviceHash.moderation_id}">Approve/Reject</a> - {/if} - </p> + <p class="liberty_status">{biticon iname=dialog-warning iexplain="Warning"} {tr}The status of this content is <strong>{$gContent->getContentStatusName($serviceHash.content_status_id)}</strong>{/tr}.</p> {/if}{$gContent->mInfo.content_status_name} diff --git a/templates/service_content_edit_mini_inc.tpl b/templates/service_content_edit_mini_inc.tpl index 27040fe..f1a70ed 100644 --- a/templates/service_content_edit_mini_inc.tpl +++ b/templates/service_content_edit_mini_inc.tpl @@ -1,3 +1,2 @@ {include file="bitpackage:liberty/edit_content_status_inc.tpl"} {include file="bitpackage:liberty/edit_content_owner_inc.tpl"} -{include file="bitpackage:liberty/edit_content_comments_inc.tpl"} |
