summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Fowler <spider@viovio.com>2008-10-20 21:40:08 +0000
committerChristian Fowler <spider@viovio.com>2008-10-20 21:40:08 +0000
commit9de6d0ae14e9104fe0616de84a5810d251911bae (patch)
tree1b97e730304cc567274573ea1d52038c348eaf5c
parentc0f6195ecc9afe97048757cf681a8e091a795052 (diff)
downloadarticles-9de6d0ae14e9104fe0616de84a5810d251911bae.tar.gz
articles-9de6d0ae14e9104fe0616de84a5810d251911bae.tar.bz2
articles-9de6d0ae14e9104fe0616de84a5810d251911bae.zip
BIG CHANGE: migrate p_*_edit permissions to p_*_update permission naming convention, hasEditPermission is now hasUpdatePermission, many explicit perm checks have been cleaned up to hasUpdatePermission
-rw-r--r--BitArticle.php8
-rw-r--r--admin/schema_inc.php4
-rw-r--r--article_history.php2
-rw-r--r--edit.php23
-rw-r--r--list.php32
-rw-r--r--read.php6
-rw-r--r--templates/article_display.tpl6
-rw-r--r--templates/articles_nav.tpl2
-rw-r--r--templates/list_articles.tpl4
-rw-r--r--templates/menu_articles.tpl4
-rw-r--r--templates/print_article.tpl4
11 files changed, 24 insertions, 71 deletions
diff --git a/BitArticle.php b/BitArticle.php
index 92910ae..14ace33 100644
--- a/BitArticle.php
+++ b/BitArticle.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_articles/BitArticle.php,v 1.150 2008/10/03 17:20:15 wjames5 Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_articles/BitArticle.php,v 1.151 2008/10/20 21:40:08 spiderr Exp $
* @package articles
*
* Copyright( c )2004 bitweaver.org
@@ -9,14 +9,14 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: BitArticle.php,v 1.150 2008/10/03 17:20:15 wjames5 Exp $
+ * $Id: BitArticle.php,v 1.151 2008/10/20 21:40:08 spiderr Exp $
*
* Article class is used when accessing BitArticles. It is based on TikiSample
* and builds on core bitweaver functionality, such as the Liberty CMS engine.
*
* created 2004/8/15
* @author wolffy <wolff_borg@yahoo.com.au>
- * @version $Revision: 1.150 $ $Date: 2008/10/03 17:20:15 $ $Author: wjames5 $
+ * @version $Revision: 1.151 $ $Date: 2008/10/20 21:40:08 $ $Author: spiderr $
*/
/**
@@ -67,7 +67,7 @@ class BitArticle extends LibertyMime {
// Permission setup
$this->mViewContentPerm = 'p_articles_read';
$this->mCreateContentPerm = 'p_articles_submit';
- $this->mEditContentPerm = 'p_articles_edit';
+ $this->mUpdateContentPerm = 'p_articles_update';
$this->mAdminContentPerm = 'p_articles_admin';
}
diff --git a/admin/schema_inc.php b/admin/schema_inc.php
index 9a16372..02aca2e 100644
--- a/admin/schema_inc.php
+++ b/admin/schema_inc.php
@@ -94,12 +94,12 @@ $gBitInstaller->registerSchemaDefault( ARTICLES_PKG_NAME, array(
// ### Default UserPermissions
$gBitInstaller->registerUserPermissions( ARTICLES_PKG_NAME, array(
- array('p_articles_edit', 'Can edit articles', 'editors', ARTICLES_PKG_NAME),
+ array('p_articles_update', 'Can update articles', 'editors', ARTICLES_PKG_NAME),
array('p_articles_remove', 'Can remove articles', 'editors', ARTICLES_PKG_NAME),
array('p_articles_read', 'Can read articles', 'basic', ARTICLES_PKG_NAME),
array('p_articles_read_history', 'Can read article history', 'registered', ARTICLES_PKG_NAME),
array('p_articles_submit', 'Can submit articles', 'basic', ARTICLES_PKG_NAME),
- array('p_articles_edit_submission', 'Can edit submissions', 'editors', ARTICLES_PKG_NAME),
+ array('p_articles_update_submission', 'Can update submissions', 'editors', ARTICLES_PKG_NAME),
array('p_articles_remove_submission', 'Can remove submissions', 'editors', ARTICLES_PKG_NAME),
array('p_articles_approve_submission', 'Can approve submissions', 'editors', ARTICLES_PKG_NAME),
array('p_articles_send', 'Can send articles to other sites', 'editors', ARTICLES_PKG_NAME),
diff --git a/article_history.php b/article_history.php
index 33bf7a3..e0d7441 100644
--- a/article_history.php
+++ b/article_history.php
@@ -35,7 +35,7 @@ if( !$gContent->isValid() || empty( $gContent->mInfo ) ) {
}
// additionally we need to check if this article is a submission and see if user has perms to view it.
-if( $gContent->getField( 'status_id' ) != ARTICLE_STATUS_APPROVED && !( $gContent->hasUserPermission( 'p_articles_edit_submission' ) || $gContent->hasUserPermission( 'p_articles_edit_submission' ) || $gContent->hasUserPermission( 'p_articles_edit_submission' ) || $gBitUser->isAdmin() ) ) {
+if( $gContent->getField( 'status_id' ) != ARTICLE_STATUS_APPROVED && !( $gContent->hasUserPermission( 'p_articles_update_submission' ) || $gBitUser->isAdmin() ) ) {
$gBitSmarty->assign( 'msg', tra( "Permission denied you cannot view this article" ) );
$gBitSystem->display( "error.tpl" , NULL, array( 'display_mode' => 'display' ));
die;
diff --git a/edit.php b/edit.php
index fadc4d1..d87ac62 100644
--- a/edit.php
+++ b/edit.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_articles/edit.php,v 1.46 2008/10/03 17:20:15 wjames5 Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_articles/edit.php,v 1.47 2008/10/20 21:40:08 spiderr Exp $
* @package articles
* @subpackage functions
*/
@@ -20,27 +20,8 @@ $gBitSystem->verifyPackage( 'articles' );
include_once('lookup_article_inc.php');
-/**
- * This mess is deprecated - leave it here during perm upgrade incase we goofed the clean up below
-$isOwner = FALSE;
-if( $gContent->hasAdminPermission() || $gContent->hasUserPermission( 'p_articles_edit' ) || $gContent->isOwner() ) {
- $isOwner = TRUE;
-} elseif( !$gContent->mArticleId && $gContent->hasUserPermission( 'p_articles_submit' ) ) {
- $isOwner = TRUE;
-}
-
-// Now check permissions to access this page
-if( !$isOwner ) {
- if ( empty( $gContent->mArticleId )) {
- $gBitSystem->fatalPermission( 'p_articles_submit' );
- } else {
- $gBitSystem->fatalPermission( 'p_articles_edit' );
- }
-}
-*/
-
if( $gContent->isValid() ){
- $gContent->verifyEditPermission();
+ $gContent->verifyUpdatePermission();
}else{
$gContent->verifyCreatePermission();
}
diff --git a/list.php b/list.php
index ab3a912..f33bdff 100644
--- a/list.php
+++ b/list.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_articles/list.php,v 1.23 2008/09/19 01:34:36 laetzer Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_articles/list.php,v 1.24 2008/10/20 21:40:08 spiderr Exp $
* @package articles
* @subpackage functions
*/
@@ -57,34 +57,6 @@ if( !empty( $_REQUEST['action'] ) ) {
}
}
-/* this is a messed up version of a multiple articles removal section
-if( isset( $_REQUEST["multi_article"] ) && isset( $_REQUEST["checked"] ) && $_REQUEST["multi_article"] == "remove_articles" ) {
- // Now check permissions to remove the selected articles
- $gBitSystem->verifyPermission( 'p_articles_remove' );
-
- if( !empty( $_REQUEST['cancel'] ) ) {
- // user cancelled - just continue on, doing nothing
- } elseif( empty( $_REQUEST['confirm'] ) ) {
- $formHash['delete'] = TRUE;
- $formHash['submit_mult'] = 'remove_articles';
- foreach( $_REQUEST["checked"] as $del ) {
- $formHash['input'][] = '<input type="hidden" name="checked[]" value="'.$del.'"/>';
- }
- $gBitSystem->confirmDialog( $formHash, array( 'warning' => 'Are you sure you want to delete '.count($_REQUEST["checked"] ).' articles?', 'error' => 'This cannot be undone!' ));
- } else {
- foreach( $_REQUEST["checked"] as $deleteId ) {
- $tmpPage = new BitArticle( $deleteId );
- if( !$tmpPage->load()|| !$tmpPage->expunge() ) {
- array_merge( $errors, array_values( $tmpPage->mErrors ) );
- }
- }
- if( !empty( $errors ) ) {
- $gBitSmarty->assign( 'errors', $errors );
- }
- }
-}
-*/
-
$article = new BitArticle();
// change the status of an article first
if( !empty( $_REQUEST['action'] ) ) {
@@ -93,7 +65,7 @@ if( !empty( $_REQUEST['action'] ) ) {
}
}
-if( empty( $_REQUEST['status_id'] ) || (!(($gBitSystem->isFeatureActive('articles_auto_approve') && $gBitUser->isRegistered()) || $gBitUser->hasPermission( 'p_articles_edit_submission' ) || $gBitUser->hasPermission( 'p_articles_admin' ) ) ) ) {
+if( empty( $_REQUEST['status_id'] ) || (!(($gBitSystem->isFeatureActive('articles_auto_approve') && $gBitUser->isRegistered()) || $gBitUser->hasPermission( 'p_articles_update_submission' ) || $gBitUser->hasPermission( 'p_articles_admin' ) ) ) ) {
$_REQUEST['status_id'] = ARTICLE_STATUS_APPROVED;
}
$listArticles = $article->getList( $_REQUEST );
diff --git a/read.php b/read.php
index d328faf..225fc84 100644
--- a/read.php
+++ b/read.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_articles/read.php,v 1.26 2008/10/03 17:20:15 wjames5 Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_articles/read.php,v 1.27 2008/10/20 21:40:08 spiderr Exp $
* @package articles
* @subpackage functions
*/
@@ -29,14 +29,14 @@ $gContent->verifyViewPermission();
// additionally we need to check if this article is a submission and see if user has perms to view it.
if( $gContent->getField( 'status_id' ) != ARTICLE_STATUS_APPROVED ) {
- if( !( $gContent->hasUserPermission( 'p_articles_edit_submission' ) || $gContent->hasUserPermission( 'p_articles_approve_submission' ))) {
+ if( !( $gContent->hasUserPermission( 'p_articles_update_submission' ) || $gContent->hasUserPermission( 'p_articles_approve_submission' ))) {
$gBitSystem->fatalError( tra( "Permission denied you cannot view this article" ));
}
}
// we also need to check and see if the article is future dated - we will display it if the user can edit it otherwise we pretend it does not exist.
$timestamp = $gBitSystem->getUTCTime();
-if ( ($gContent->mInfo['publish_date'] > $timestamp) && !$gContent->hasEditPermission() ){
+if ( ($gContent->mInfo['publish_date'] > $timestamp) && !$gContent->hasUpdatePermission() ){
$gBitSystem->fatalError( tra( 'Article cannot be found' ));
}
diff --git a/templates/article_display.tpl b/templates/article_display.tpl
index a17046e..85293de 100644
--- a/templates/article_display.tpl
+++ b/templates/article_display.tpl
@@ -1,4 +1,4 @@
-{* $Header: /cvsroot/bitweaver/_bit_articles/templates/article_display.tpl,v 1.53 2008/10/03 17:20:15 wjames5 Exp $ *}
+{* $Header: /cvsroot/bitweaver/_bit_articles/templates/article_display.tpl,v 1.54 2008/10/20 21:40:08 spiderr Exp $ *}
{strip}
{if !$showDescriptionsOnly}
{include file="bitpackage:liberty/services_inc.tpl" serviceLocation='nav' serviceHash=$article}
@@ -10,7 +10,7 @@
{if $gContent->hasUserPermission( 'p_articles_read_history' ) && !$version && $article.version > 1}
{smartlink ititle="View History" ipackage=articles ifile="article_history.php" ibiticon="icons/appointment-new" article_id=$article.article_id}
{/if}
- {if $gContent->hasEditPermission()}
+ {if $gContent->hasUpdatePermission()}
<a href="{$smarty.const.ARTICLES_PKG_URL}edit.php?article_id={$article.article_id}">{biticon ipackage="icons" iname="accessories-text-editor" iexplain=edit}</a>
{/if}
{*<a style="display:none;" href="{$smarty.const.ARTICLES_PKG_URL}print.php?article_id={$article.article_id}">{biticon ipackage="icons" iname="document-print" iexplain=print}</a>*}
@@ -35,7 +35,7 @@
{/if}
</div>
- <div class="body"{if $gBitUser->getPreference( 'users_double_click' ) and $gContent->hasEditPermission()} ondblclick="location.href='{$smarty.const.ARTICLES_PKG_URL}edit.php?article_id={$article.article_id}';"{/if}>
+ <div class="body"{if $gBitUser->getPreference( 'users_double_click' ) and $gContent->hasUpdatePermission()} ondblclick="location.href='{$smarty.const.ARTICLES_PKG_URL}edit.php?article_id={$article.article_id}';"{/if}>
<div class="content">
{include file="bitpackage:liberty/services_inc.tpl" serviceLocation='body' serviceHash=$article}
{* deal with the article image if there is one *}
diff --git a/templates/articles_nav.tpl b/templates/articles_nav.tpl
index 9da6630..9a28abe 100644
--- a/templates/articles_nav.tpl
+++ b/templates/articles_nav.tpl
@@ -3,7 +3,7 @@
<li><a href="{$smarty.const.ARTICLES_PKG_URL}index.php">{tr}View articles{/tr}</a></li>
<li><a href="{$smarty.const.ARTICLES_PKG_URL}list.php">{tr}List articles{/tr}</a></li>
<li><a href="{$smarty.const.ARTICLES_PKG_URL}list_submissions.php">{tr}List submissions{/tr}</a></li>
- {if $gBitSystem->isFeatureActive( 'p_articles_edit' )}
+ {if $gBitSystem->isFeatureActive( 'p_articles_create' )}
<li><a href="{$smarty.const.ARTICLES_PKG_URL}edit.php">{tr}New article{/tr}</a></li>
{/if}
</ul>
diff --git a/templates/list_articles.tpl b/templates/list_articles.tpl
index afea897..e3caf5b 100644
--- a/templates/list_articles.tpl
+++ b/templates/list_articles.tpl
@@ -1,4 +1,4 @@
-{* $Header: /cvsroot/bitweaver/_bit_articles/templates/list_articles.tpl,v 1.21 2007/08/23 08:10:21 squareing Exp $ *}
+{* $Header: /cvsroot/bitweaver/_bit_articles/templates/list_articles.tpl,v 1.22 2008/10/20 21:40:08 spiderr Exp $ *}
<div class="floaticon">{bithelp}</div>
{strip}
@@ -142,7 +142,7 @@
{smartlink ititle="Approve Article" ibiticon="icons/dialog-ok" sort_mode=$sort_mode status_id=$smarty.request.status_id article_id=$article.article_id content_id=$article.content_id set_status_id=$smarty.const.ARTICLE_STATUS_APPROVED action=approve}
{/if}
- {if $gBitUser->hasPermission( 'p_articles_edit' ) or ( $article.author eq $user and $article.creator_edit eq 'y' )}
+ {if $gBitUser->hasPermission( 'p_articles_update' ) or ( $article.author eq $user and $article.creator_edit eq 'y' )}
{smartlink ititle="Edit" ifile="edit.php" ibiticon="icons/accessories-text-editor" article_id=$article.article_id}
{/if}
diff --git a/templates/menu_articles.tpl b/templates/menu_articles.tpl
index 106c78e..f875e5b 100644
--- a/templates/menu_articles.tpl
+++ b/templates/menu_articles.tpl
@@ -2,8 +2,8 @@
<ul>
{if $gBitUser->hasPermission( 'p_articles_read' )}
<li><a class="item" href="{$smarty.const.ARTICLES_PKG_URL}index.php">{biticon ipackage="icons" iname="go-home" iexplain="Articles Home" ilocation=menu}</a></li>
- {if $gBitUser->hasPermission( 'p_articles_edit') || $gBitUser->hasPermission('p_articles_submit') }
- {if $gBitUser->hasPermission('p_articles_edit')}
+ {if $gBitUser->hasPermission( 'p_articles_create') || $gBitUser->hasPermission('p_articles_submit') }
+ {if $gBitUser->hasPermission('p_articles_create')}
{assign var=iexplain value="Write Article"}
{else}
{assign var=iexplain value="Submit Article"}
diff --git a/templates/print_article.tpl b/templates/print_article.tpl
index ccafce8..66c8a50 100644
--- a/templates/print_article.tpl
+++ b/templates/print_article.tpl
@@ -1,4 +1,4 @@
-{* $Header: /cvsroot/bitweaver/_bit_articles/templates/print_article.tpl,v 1.6 2008/10/03 17:20:15 wjames5 Exp $ *}
+{* $Header: /cvsroot/bitweaver/_bit_articles/templates/print_article.tpl,v 1.7 2008/10/20 21:40:08 spiderr Exp $ *}
{* Index we display a wiki page here *}
{include file="bitpackage:kernel/header.tpl"}
@@ -28,7 +28,7 @@
</div> {* end articleheading *}
<div class="articletrailer">
({$size} bytes
- {if $gContent->hasEditPermission()}
+ {if $gContent->hasUpdatePermission()}
[<a href="{$smarty.const.ARTICLES_PKG_URL}edit.php?article_id={$article_id}">{tr}Edit{/tr}</a>]
{/if}
{if $gContent->hasUserPermission( 'p_articles_remove' )}