diff options
Diffstat (limited to 'edit.php')
| -rw-r--r-- | edit.php | 92 |
1 files changed, 16 insertions, 76 deletions
@@ -1,5 +1,5 @@ <?php -// $Header: /cvsroot/bitweaver/_bit_articles/edit.php,v 1.6 2005/08/22 20:48:49 squareing Exp $ +// $Header: /cvsroot/bitweaver/_bit_articles/edit.php,v 1.7 2005/08/26 09:17:14 squareing 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. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. @@ -14,54 +14,34 @@ include_once( LIBERTY_PKG_PATH.'edit_help_inc.php' ); // Is package installed and enabled $gBitSystem->verifyPackage( 'articles' ); -// Now check permissions to access this page -//$gBitSystem->verifyPermission( 'bit_p_edit_article' ); - - include_once('lookup_article_inc.php'); -if ($gBitUser->hasPermission('bit_p_admin_articles') || $gBitUser->hasPermission('bit_p_edit_article') ) { +if( $gBitUser->hasPermission('bit_p_admin_articles' ) || $gBitUser->hasPermission( 'bit_p_edit_article' ) ) { $viewerCanEdit = TRUE; -} elseif (!empty($gContent->mInfo['user_id']) && $gContent->mInfo['user_id'] == $gBitUser->mUserId) { +} elseif( !empty($gContent->mInfo['user_id'] ) && $gContent->mInfo['user_id'] == $gBitUser->mUserId ) { $viewerCanEdit = TRUE; -} elseif (!$gContent->mArticleId && $gBitUser->hasPermission('bit_p_submit_article')) { +} elseif( !$gContent->mArticleId && $gBitUser->hasPermission( 'bit_p_submit_article' ) ) { $viewerCanEdit = TRUE; } - // Now check permissions to access this page -if ( !$viewerCanEdit ) { //!$gBitSystem->verifyPermission( 'bit_p_edit_article' ) && ( $article_data["author_name"] != $gBitUser->mUserId || $article_data["creator_edit"] != 'y' ) ) { +if ( !$viewerCanEdit ) { $smarty->assign( 'msg', tra( "Permission denied you cannot edit this article" ) ); $gBitSystem->display( "error.tpl" ); die; } -if ($gBitSystem->isPackageActive( 'categories' )) { - $cat_type = BITARTICLE_CONTENT_TYPE_GUID; - $cat_objid = $gContent->mContentId; - include_once( CATEGORIES_PKG_PATH . 'categorize_list_inc.php' ); -} - -if ($gBitSystem->isPackageActive( 'quicktags' )) { - include_once( QUICKTAGS_PKG_PATH . 'quicktags_inc.php' ); -} - - // If we are in preview mode then preview it! if (isset($_REQUEST["preview"])) { $article = $gContent->preparePreview($_REQUEST); $smarty->assign('preview', 'y'); - $smarty->assign_by_ref('article', $article); $gContent->invokeServices( 'content_preview_function' ); + $smarty->assign_by_ref('article', $article); } else { $gContent->invokeServices( 'content_edit_function' ); $smarty->assign_by_ref('article', $gContent->mInfo); } -if ( !$gBitUser->hasPermission( 'bit_p_use_HTML' )) { - $_REQUEST["allowhtml"] = 'off'; -} - if ( isset( $_REQUEST["template_id"] ) && $_REQUEST["template_id"] > 0 ) { $template_data = $tikilib->get_template( $_REQUEST["template_id"] ); @@ -69,58 +49,15 @@ if ( isset( $_REQUEST["template_id"] ) && $_REQUEST["template_id"] > 0 ) { $_REQUEST["body"] = $template_data["content"].$_REQUEST["data"]; } -$publish_date = date( "U" ); -$cur_time = getdate(); -$expire_date = mktime ( $cur_time["hours"], $cur_time["minutes"], 0, $cur_time["mon"], $cur_time["mday"] + 365, $cur_time["year"] ); - -$smarty->assign('author_name', $gBitUser->getDisplayName()); - -if ( isset( $_REQUEST["allowhtml"] ) ) { - if ( $_REQUEST["allowhtml"] == "on" ) { - $smarty->assign( 'allowhtml', 'y' ); - } -} +$smarty->assign( 'author_name', $gBitUser->getDisplayName() ); if ( isset( $_REQUEST["save"] ) ) { - - - if ( isset( $_REQUEST["use_image"] ) && $_REQUEST["use_image"] == 'on' ) { - $use_image = 'y'; - } else { - $use_image = 'n'; - } - - if ( isset( $_REQUEST["isfloat"] ) && $_REQUEST["isfloat"] == 'on' ) { - $isfloat = 'y'; - } else { - $isfloat = 'n'; - } + if( empty( $_REQUEST["rating"] ) ) $_REQUEST['rating'] = 0; + if( empty( $_REQUEST['topic_id'] ) ) $_REQUEST['topic_id'] = 0; - if ( !isset( $_REQUEST["rating"] ) ) - $_REQUEST['rating'] = 0; - if ( !isset( $_REQUEST['topic_id'] ) || $_REQUEST['topic_id'] == '' ) $_REQUEST['topic_id'] = 0; - - - if ($gContent->store($_REQUEST)) { - if ( $gBitSystem->isPackageActive('categories') ) { - $cat_desc = $gLibertySystem->mContentTypes[BITARTICLE_CONTENT_TYPE_GUID]['content_description'].' by '.$gBitUser->getDisplayName( FALSE, array( 'real_name' => $gContent->mInfo['creator_real_name'], 'user' => $gContent->mInfo['creator_user'], 'user_id'=>$gContent->mInfo['user_id'] ) ); - $cat_name = $gContent->getTitle(); - $cat_href = $gContent->getDisplayUrl(); - $cat_objid = $gContent->mContentId; - $cat_content_id = $gContent->mContentId; - $cat_obj_type = BITARTICLE_CONTENT_TYPE_GUID; - include_once( CATEGORIES_PKG_PATH.'categorize_inc.php' ); - } + if( $gContent->store( $_REQUEST ) ) { header ( "location: " . ARTICLES_PKG_URL. "index.php" ); } - - /*$cat_type = 'article'; - $cat_objid = $artid; - $cat_desc = substr( $_REQUEST["heading"], 0, 200 ); - $cat_name = $_REQUEST["title"]; - $cat_href = ARTICLES_PKG_URL . "read_article.php?article_id=" . $cat_objid;*/ - - } // Get a topic list @@ -133,14 +70,17 @@ $smarty->assign_by_ref( 'types', $types ); /*if ( $feature_cms_templates == 'y' && $bit_p_use_content_templates == 'y' ) { $templates = $tikilib->list_templates( 'cms', 0, -1, 'name_asc', '' ); }*/ +$smarty->assign_by_ref( 'templates', $templates["data"] ); + // WYSIWYG and Quicktag variable $smarty->assign( 'textarea_id', 'editarticle' ); -$smarty->assign_by_ref( 'templates', $templates["data"] ); +if ($gBitSystem->isPackageActive( 'quicktags' )) { + include_once( QUICKTAGS_PKG_PATH . 'quicktags_inc.php' ); +} // Display the Index Template $smarty->assign( 'show_page_bar', 'n' ); -$gBitSystem->display( 'bitpackage:articles/edit_article.tpl', tra("articles") ); - +$gBitSystem->display( 'bitpackage:articles/edit_article.tpl', tra( "Articles" ) ); ?> |
