summaryrefslogtreecommitdiff
path: root/includes/lookup_content_inc.php
blob: 29e8728d8b5e3b944532115be06d2a8d611c5a33 (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
34
35
36
37
38
39
40
41
42
43
<?php
/**
 * lookup_content_inc
 *
 * @author   spider <spider@steelsun.com>
 * @version  $Revision$
 * @package  liberty
 * @subpackage functions
 */

/**
 * required setup
 */
namespace Bitweaver\Liberty;

use Bitweaver\BitBase;

global $gContent;

if( !empty($_REQUEST['structure_id']) && BitBase::verifyId( $_REQUEST['structure_id'] ) ) {
	$_REQUEST['structure_id'] = preg_replace( '/[\D]/', '', $_REQUEST['structure_id'] );
	$gStructure = new LibertyStructure( $_REQUEST['structure_id'] );
	if( $gStructure->load() ) {
		$gStructure->loadNavigation();
		$gStructure->loadPath();
		$gBitSmarty->assign( 'structureInfo', $gStructure->mInfo );
//		$_REQUEST['page_id'] = $gStructure->mInfo['page_id'];
		if( $viewContent = LibertyBase::getLibertyObject( $gStructure->mInfo['content_id'], $gStructure->mInfo['content_type']['content_type_guid'] ) ) {
			$viewContent->setStructure( $_REQUEST['structure_id'] );
			$gBitSmarty->assign( 'pageInfo', $viewContent->mInfo );
			$gContent = &$viewContent;
			$gBitSmarty->assign( 'gContent', $gContent );
		}
	}
} elseif( !empty($_REQUEST['content_id']) && BitBase::verifyId( $_REQUEST['content_id'] ) ) {
	$_REQUEST['content_id'] = preg_replace( '/[\D]/', '', $_REQUEST['content_id'] );

	if( $gContent = LibertyBase::getLibertyObject( $_REQUEST['content_id'] ) ) {
		$gBitSmarty->assign( 'gContent', $gContent );
		$gBitSmarty->assign( 'pageInfo', $gContent->mInfo );
	}
}