summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--edit.php92
-rw-r--r--lookup_article_inc.php2
-rw-r--r--read.php22
-rw-r--r--templates/articles_mini_search.tpl40
-rw-r--r--templates/edit_article.tpl8
5 files changed, 51 insertions, 113 deletions
diff --git a/edit.php b/edit.php
index 3329724..2dc9f6e 100644
--- a/edit.php
+++ b/edit.php
@@ -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" ) );
?>
diff --git a/lookup_article_inc.php b/lookup_article_inc.php
index e20ccc5..bec8c1d 100644
--- a/lookup_article_inc.php
+++ b/lookup_article_inc.php
@@ -11,7 +11,7 @@
$gContent = new BitArticle( NULL, $_REQUEST['content_id'] );
} else {
$gContent = new BitArticle();
- $gContent->mInfo['expire_date'] = strtotime("+1 day");
+ $gContent->mInfo['expire_date'] = strtotime("+1 year");
}
if( empty( $gContent->mArticleId ) && empty( $gContent->mContentId ) ) {
diff --git a/read.php b/read.php
index 788ca7d..6d08046 100644
--- a/read.php
+++ b/read.php
@@ -1,5 +1,5 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_articles/read.php,v 1.2 2005/08/13 22:03:39 squareing Exp $
+// $Header: /cvsroot/bitweaver/_bit_articles/read.php,v 1.3 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.
@@ -24,19 +24,25 @@ include_once( ARTICLES_PKG_PATH.'lookup_article_inc.php' );
$gContent->addHit();
$smarty->assign_by_ref('article', $gContent->mInfo);
+// get all the services that want to display something on this page
+$displayHash = array( 'perm_name' => 'bit_p_view' );
+$gContent->invokeServices( 'content_display_function', $displayHash );
+
$topics = BitArticleTopic::listTopics();
$smarty->assign_by_ref( 'topics', $topics );
$section = 'cms';
-if ( $gBitSystem->isFeatureActive('feature_article_comments') ) {
- $maxComments = $gBitSystem->getPreference( 'article_comments_per_page' );
- $comments_return_url = $_SERVER['PHP_SELF']."?article_id=".$gContent->mArticleId;
- $commentsParentId = $gContent->mInfo['content_id'];
- include_once ( LIBERTY_PKG_PATH . 'comments_inc.php' );
+// Comments engine!
+if( $gContent->mInfo['allow_comments'] == 'y' ) {
+ $comments_vars = Array( 'article' );
+ $comments_prefix_var='article:';
+ $comments_object_var='article';
+ $commentsParentId = $gContent->mContentId;
+ $comments_return_url = ARTICLES_PKG_URL.'read.php?article_id='.$gContent->mArticleId;
+ include_once( LIBERTY_PKG_PATH.'comments_inc.php' );
}
-
if ( $feature_theme_control == 'y' ) {
$cat_type = 'article';
$cat_objid = $_REQUEST["article_id"];
@@ -48,8 +54,6 @@ if ( isset( $_REQUEST['mode'] ) && $_REQUEST['mode'] == 'mobile' ) {
HAWBIT_read_article( $article_data, $pages );
}
-
// Display the Index Template
$gBitSystem->display( 'bitpackage:articles/read_article.tpl' );
-
?>
diff --git a/templates/articles_mini_search.tpl b/templates/articles_mini_search.tpl
index 982d51f..1dd944a 100644
--- a/templates/articles_mini_search.tpl
+++ b/templates/articles_mini_search.tpl
@@ -1,23 +1,17 @@
-<table class="find">
-<tr><td>{tr}Find{/tr}</td>
- <td>
- <form method="get" action="{$smarty.const.ARTICLES_PKG_URL}list.php">
- <input type="text" name="find" value="{$find|escape}" />
- <input type="submit" value="{tr}find{/tr}" name="search" />
- <input type="hidden" name="sort_mode" value="{$sort_mode|escape}" />
- <select name="type">
- <option value="" {if $find_type eq ''}selected="selected"{/if}>{tr}all{/tr}</option>
- {section name=t loop=$types}
- <option value="{$types[t].type|escape}" {if $type eq $types[t].type}selected="selected"{/if}>{$types[t].type}</option>
- {/section}
- </select>
- <select name="topic">
- <option value="" {if $find_topic eq ''}selected="selected"{/if}>{tr}all{/tr}</option>
- {section name=ix loop=$topics}
- <option value="{$topics[ix].topic_id|escape}" {if $find_topic eq $topics[ix].topic_id}selected="selected"{/if}>{tr}{$topics[ix].name}{/tr}</option>
- {/section}
- </select>
- </form>
- </td>
-</tr>
-</table>
+{form method="get" ipackage="articles" ifile="list.php"}
+ <input type="text" name="find" value="{$find|escape}" />
+ <input type="submit" value="{tr}find{/tr}" name="search" />
+ <input type="hidden" name="sort_mode" value="{$sort_mode|escape}" />
+ <select name="type">
+ <option value="" {if $find_type eq ''}selected="selected"{/if}>{tr}all{/tr}</option>
+ {section name=t loop=$types}
+ <option value="{$types[t].type|escape}" {if $type eq $types[t].type}selected="selected"{/if}>{$types[t].type}</option>
+ {/section}
+ </select>
+ <select name="topic">
+ <option value="" {if $find_topic eq ''}selected="selected"{/if}>{tr}all{/tr}</option>
+ {section name=ix loop=$topics}
+ <option value="{$topics[ix].topic_id|escape}" {if $find_topic eq $topics[ix].topic_id}selected="selected"{/if}>{tr}{$topics[ix].name}{/tr}</option>
+ {/section}
+ </select>
+{/form}
diff --git a/templates/edit_article.tpl b/templates/edit_article.tpl
index cf591b7..7c82cc1 100644
--- a/templates/edit_article.tpl
+++ b/templates/edit_article.tpl
@@ -161,8 +161,8 @@
{formlabel label="Publish Date" for=""}
{forminput}
{html_select_date prefix="publish_" time=$gContent->mInfo.publish_date start_year="-5" end_year="+10"} {tr}at{/tr}&nbsp;
- <span dir="ltr">{html_select_time prefix="publish_" time=$publish_dateSite display_seconds=false}&nbsp;{$siteTimeZone}</span>
- {formhelp note=""}
+ <span dir="ltr">{html_select_time prefix="publish_" time=$gContent->mInfo.publish_date display_seconds=false}&nbsp;{$siteTimeZone}</span>
+ {formhelp note="If the article type allows it, this article will not be displayed <strong>before</strong> this date."}
{/forminput}
</div>
@@ -171,8 +171,8 @@
{formlabel label="Expiration Date" for=""}
{forminput}
{html_select_date prefix="expire_" time=$gContent->mInfo.expire_date start_year="-5" end_year="+10"} {tr}at{/tr}&nbsp;
- <span dir="ltr">{html_select_time prefix="expire_" time=$expire_dateSite display_seconds=false}&nbsp;{$siteTimeZone}</span>
- {formhelp note=""}
+ <span dir="ltr">{html_select_time prefix="expire_" time=$gContent->mInfo.expire_date display_seconds=false}&nbsp;{$siteTimeZone}</span>
+ {formhelp note="If the article type allows it, this article will not be displayed <strong>after</strong> this date."}
{/forminput}
</div>
{/legend}