-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit.php
95 lines (78 loc) · 2.78 KB
/
edit.php
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/**
* $Header$
*
* Copyright (c) 2006 bitweaver.org
* All Rights Reserved. See below for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
*
* @package citizen
* @subpackage functions
*/
/**
* required setup
*/
require_once( '../kernel/setup_inc.php' );
$gBitSystem->verifyPackage( 'citizen' );
$gBitSystem->verifyPermission( 'p_citizen_update' );
include_once( CITIZEN_PKG_PATH.'Citizen.php' );
$gContent = new Citizen();
if( !empty( $_REQUEST['content_id'] ) ) {
$gContent->load($_REQUEST['content_id']);
}
// Get plugins with descriptions
global $gLibertySystem;
if( !empty( $gContent->mInfo ) ) {
$formInfo = $gContent->mInfo;
$formInfo['edit'] = !empty( $gContent->mInfo['data'] ) ? $gContent->mInfo['data'] : '';
}
$cat_type = BITPAGE_CONTENT_TYPE_GUID;
if(isset($_REQUEST["preview"])) {
// get files from all packages that process this data further
foreach( $gBitSystem->getPackageIntegrationFiles( 'form_processor_inc.php', TRUE ) as $package => $file ) {
if( $gBitSystem->isPackageActive( $package ) ) {
include_once( $file );
}
}
$gBitSmarty->assign('preview',1);
$gBitSmarty->assign('title',$_REQUEST["title"]);
$parsed = $gContent->parseData($formInfo['edit'], (!empty( $_REQUEST['format_guid'] ) ? $_REQUEST['format_guid'] :
( isset($gContent->mInfo['format_guid']) ? $gContent->mInfo['format_guid'] : 'tikiwiki' ) ) );
$gBitSmarty->assign_by_ref('parsed', $parsed);
$gContent->invokeServices( 'content_preview_function' );
} else {
$gContent->invokeServices( 'content_edit_function' );
}
// Pro
if (isset($_REQUEST["fCancel"])) {
if( !empty( $gContent->mContentId ) ) {
header("Location: ".$gContent->getDisplayUrl() );
} else {
header("Location: ".CITIZEN_PKG_URL );
}
die;
} elseif (isset($_REQUEST["fSaveCitizen"])) {
if( $gContent->store( $_REQUEST ) ) {
header("Location: ".$gContent->getDisplayUrl() );
} else {
$formInfo = $_REQUEST;
$formInfo['data'] = &$_REQUEST['edit'];
}
}
// Configure quicktags list
if ($gBitSystem->isPackageActive( 'quicktags' ) ) {
include_once( QUICKTAGS_PKG_PATH.'quicktags_inc.php' );
}
// WYSIWYG and Quicktag variable
$gBitSmarty->assign( 'textarea_id', 'editwiki' );
// formInfo might be set due to a error on submit
if( empty( $formInfo ) ) {
$formInfo = &$gContent->mInfo;
}
// $formInfo['citizen_type_list'] = $gContent->getCitizensTypeList();
$gBitSmarty->assign_by_ref( 'citizenInfo', $formInfo );
$gBitSmarty->assign_by_ref( 'errors', $gContent->mErrors );
$gBitSmarty->assign( (!empty( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : 'body').'TabSelect', 'tdefault' );
$gBitSmarty->assign('show_page_bar', 'y');
$gBitSystem->display( 'bitpackage:citizen/edit.tpl', 'Edit: ' , array( 'display_mode' => 'edit' ));
?>