summaryrefslogtreecommitdiff
path: root/structure_add_content.php
blob: b58175af1d94995861cae78e7924757b15cae5a0 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
 * @version $Header$
 *
 * @author   spider <spider@steelsun.com>
 * @version  $Revision$
 * @package  liberty
 * @subpackage functions
 */

/**
 * required setup
 */
use Bitweaver\KernelTools;
$gLiteweightScan = true;
require_once '../kernel/includes/setup_inc.php';

if( !empty( $_REQUEST['modal'] ) ) {
	$gBitSystem->mConfig['site_top_bar'] = false;
	$gBitSystem->mConfig['site_left_column'] = false;
	$gBitSystem->mConfig['site_right_column'] = false;
	$gBitSmarty->assign( 'popupPage', '1' );
}

require_once( LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php' );
require_once( LIBERTY_PKG_INCLUDE_PATH.'structure_edit_inc.php' );

if( !empty( $_SERVER['HTTP_REFERER'] ) ) {
	$urlHash = parse_url( $_SERVER['HTTP_REFERER'] );
	if( $urlHash['path'] != $_SERVER['SCRIPT_NAME'] ) {
		$_SESSION['structure_referer'] = $_SERVER['HTTP_REFERER'];
	}
}

if( $gBitThemes->isAjaxRequest() ) {
	header( 'Content-Type: text/html; charset=utf-8' );
	print $gBitSmarty->fetch( "bitpackage:liberty/structure_add_feedback_inc.tpl" );
	exit;
}

	$_REQUEST['thumbnail_size'] = 'icon';
	include_once( LIBERTY_PKG_INCLUDE_PATH.'get_content_list_inc.php' );
	foreach( $contentList as $cItem ) {
		$cList[$contentTypes[$cItem['content_type_guid']]][$cItem['content_id']] = $cItem['title'].' [id: '.$cItem['content_id'].']';
	}
	$gBitSmarty->assign( 'contentListHash', $contentList );
	$gBitSmarty->assign( 'contentList', $cList );
	$gBitSmarty->assign( 'contentSelect', $contentSelect );
	$gBitSmarty->assign( 'contentTypes', $contentTypes );

	$subpages = $gStructure->getStructureNodes($_REQUEST["structure_id"]);
	$max = count($subpages);
	$gBitSmarty->assign('subpages', $subpages);
	if ($max != 0) {
		$last_child = $subpages[$max - 1];
		$gBitSmarty->assign('insert_after', $last_child["structure_id"]);
	}

	if( !empty( $_REQUEST['done'] ) ) {
		if( !empty( $_SESSION['structure_referer'] ) ) {
			KernelTools::bit_redirect( $_SESSION['structure_referer'] );
		} else {
			KernelTools::bit_redirect( $gContent->getDisplayUri() );
		}
	}
	$gBitSystem->display( 'bitpackage:liberty/structure_add_content.tpl', "Add Content" , [ 'display_mode' => 'display' ]);