summaryrefslogtreecommitdiff
path: root/lookup_article_inc.php
blob: e20ccc57887c25d120291f5bfe7d2d45756f381e (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
<?php
	global $gContent;
	require_once( ARTICLES_PKG_PATH.'BitArticle.php');
	require_once( LIBERTY_PKG_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 (!empty($_REQUEST['article_id']) && is_numeric($_REQUEST['article_id'])) {
			$gContent = new BitArticle( $_REQUEST['article_id'] );
		} elseif (!empty($_REQUEST['content_id']) && is_numeric($_REQUEST['content_id'])) {
			$gContent = new BitArticle( NULL, $_REQUEST['content_id'] );
		} else {
			$gContent = new BitArticle();
			$gContent->mInfo['expire_date'] = strtotime("+1 day");
		}

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