blob: edbd84f74fda3d34319a88dafbb17a46b925e8f1 (
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
|
<?php
/**
* @package stock
* @subpackage functions
*/
namespace Bitweaver\Stock;
use Bitweaver\Liberty\LibertyContent;
require_once '../kernel/includes/setup_inc.php';
global $gBitSystem, $gBitSmarty, $gBitUser, $gContent;
$gBitSystem->verifyPackage( 'stock' );
$gBitSystem->verifyPermission( 'p_stock_update' );
if( empty( $_REQUEST['content_id'] ) || !is_numeric( $_REQUEST['content_id'] ) ) {
$gBitSystem->fatalError( 'No content ID specified.' );
}
$gContent = LibertyContent::getLibertyObject( (int)$_REQUEST['content_id'] );
if( !$gContent || !$gContent->isValid() ) {
$gBitSystem->fatalError( 'Content not found.' );
}
if( !empty( $_REQUEST['xref_id'] ) ) {
$gContent->loadXref( $_REQUEST['xref_id'] );
}
$gContent->verifyUpdatePermission();
if( !empty( $_REQUEST['fCancel'] ) ) {
header( 'Location: '.$gContent->getDisplayUrl() );
die;
}
if( !empty( $_REQUEST['fSaveXref'] ) ) {
if( $gContent->storeXref( $_REQUEST ) ) {
header( 'Location: '.$gContent->getDisplayUrl() );
die;
}
$xrefInfo = $_REQUEST;
$xrefInfo['data'] = $_REQUEST['edit'] ?? '';
} else {
$xrefInfo = $gContent->mInfo['xref_store']['data'] ?? [];
}
$gBitSmarty->assign( 'gContent', $gContent );
$gBitSmarty->assign( 'xrefInfo', $xrefInfo );
$gBitSmarty->assign( 'errors', $gContent->mErrors );
$gBitSystem->display( 'bitpackage:stock/edit_xref.tpl', 'Edit Detail', [ 'display_mode' => 'edit' ] );
|