summaryrefslogtreecommitdiff
path: root/index.php
blob: 9e7a6d12def689dc5f517ee9969171cff365cac0 (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
44
45
<?php
/**
 * @version $Header$
 * @package bitweaver
 */
require_once( 'kernel/setup_inc.php' );

if( !$gBitSystem->isDatabaseValid() ) {
	install_error();
} elseif( !$gBitSystem->getActivePackage() ) {
	$bit_index = $gBitSystem->getConfig( 'bit_index' );
	if( in_array( $bit_index, array_keys( $gBitSystem->mPackages )) && defined( strtoupper( $bit_index ).'_PKG_PATH' )) {
		$gBitSystem->setActivePackage( $bit_index );
	} else {
		unset( $bit_index );
	}
}

if( !empty( $_REQUEST['content_id'] )) {
	if( $obj = LibertyBase::getLibertyObject( $_REQUEST['content_id'] )) {
		$url = $obj->getDisplayUrl();
		if( !empty($_REQUEST['highlight'] )) {
			if( preg_match( '/\?/', $url )) {
				$url .= '&';
			} else {
				$url .= '?';
			}
			$url .= 'highlight='.$_REQUEST['highlight'];
		}
		bit_redirect( $url );
	}
} elseif( !empty( $_REQUEST['structure_id'] )) {
	include( LIBERTY_PKG_PATH.'display_structure_inc.php' );
	die;
}

$gBitThemes->loadLayout();
// Redirectless home for packages
if( !empty( $bit_index )) {
	chdir( $gBitSystem->mPackages[$bit_index]['path'] );
	include_once( './index.php' );
die;
}

bit_redirect( $gBitSystem->getDefaultPage() );