summaryrefslogtreecommitdiff
path: root/view_assembly.php
blob: 57fa792c4baf08183d9e7abe15a49e82013fcdd3 (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
<?php
/**
 * @version $Header$
 * @package stock
 * @subpackage functions
 */

use Bitweaver\KernelTools;
use Bitweaver\HttpStatusCodes;

/**
 * required setup
 */
require_once '../kernel/includes/setup_inc.php';

$gBitSystem->verifyPackage( 'stock' );

global $gBitSystem, $stockErrors, $stockWarnings, $stockSuccess;

include_once STOCK_PKG_INCLUDE_PATH.'assembly_lookup_inc.php';

if( $gContent && $gContent->isValid() ) {
	$gBitSystem->setCanonicalLink( $gContent->getDisplayUrl() );
}

global $gHideModules;
$gHideModules = $gBitSystem->isFeatureActive( 'stock_gallery_hide_modules' );

if ( !$gContent->isValid() ) {
	if ( !empty( $_REQUEST['content_id'] ) ) {
		$gBitSystem->fatalError( KernelTools::tra('No assembly exists with the given ID'), null, null, HttpStatusCodes::HTTP_NOT_FOUND );
	}
	KernelTools::bit_redirect( STOCK_PKG_URL."list_assemblies.php", HttpStatusCodes::HTTP_FOUND );
	die;
}

if( $gContent->isCommentable() ) {
	$commentsParentId = $gContent->mContentId;
	$comments_vars = [ 'stockassembly' ];
	$comments_prefix_var='stockassembly:';
	$comments_object_var='stockassembly';
	$comments_return_url = $_SERVER['SCRIPT_NAME']."?content_id=".$gContent->mContentId;
	include_once LIBERTY_PKG_INCLUDE_PATH.'comments_inc.php';
}

require_once STOCK_PKG_INCLUDE_PATH.'display_stock_assembly_inc.php';