summaryrefslogtreecommitdiff
path: root/includes/lookup_article_inc.php
blob: 45461ac76ad8caadfc0bbec4ce261f69aa2509cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
 * @version $Header$
 * @package articles
 * @subpackage functions
 */

/**
 * Initialization
 */
use Bitweaver\Articles\BitArticle;
use Bitweaver\BitBase;
require_once( LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php' );

// if we already have a gContent, we assume someone else created it for us, and has properly loaded everything up.
if( empty( $gContent ) || !is_object( $gContent ) ) {
	if (@BitBase::verifyId( $_REQUEST['article_id'] ?? 0 ) ) {
		$gContent = new BitArticle( $_REQUEST['article_id'] );
	} elseif( @BitBase::verifyId( $_REQUEST['content_id'] ?? 0 ) ) {
		$gContent = new BitArticle( NULL, $_REQUEST['content_id'] );
	} else {
		$gContent = new BitArticle();
		$gContent->mInfo['expire_date'] = strtotime( "+1 year" );
	}

	if( empty( $gContent->mArticleId ) && empty( $gContent->mContentId )  ) {
		//handle legacy forms that use plain 'article' form variable name
	} else {
		$gContent->load();
	}
	$gBitSmarty->clearAssign( 'gContent' );
	$gBitSmarty->assign( 'gContent', $gContent );
}