summaryrefslogtreecommitdiff
path: root/edit_key_break.php
blob: 31d5c10b4224400c890af80fcb1f30730202c332 (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
<?php

use Bitweaver\KernelTools;
/**
 * $Header: /cvsroot/bitweaver/_bit_contact/edit.php,v 1.6 2010/02/08 21:27:22 wjames5 Exp $
 *
 * 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 contact
 * @subpackage functions
 */

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

$gBitSystem->verifyPackage( 'contact' );
$gBitSystem->verifyPermission( 'p_contact_update' );

include_once CONTACT_PKG_INCLUDE_PATH . 'lookup_contact_inc.php';
if( empty( $gContent ) || !is_object( $gContent ) ) {
	$gContent = new Contact();
}

if( !empty( $_REQUEST['xref_id'] ) ) {
	$gContent->loadXref( $_REQUEST['xref_id'] );
}
$gContent->stepXref( $_REQUEST );

if(isset($_REQUEST["fSaveXref"])) {
	KernelTools::bit_redirect( $gContent->getDisplayUrl() );
}

// formInfo might be set due to a error on submit
if( empty( $xrefInfo ) ) {
	$xrefInfo = &$gContent->mInfo['xref_store']['data'];
}
if( empty( $xrefInfo['content_id'] ) ) {
	$xrefInfo = $_REQUEST;
	if ( isset($xrefInfo['edit']) ) {
		$xrefInfo['data'] = $xrefInfo['edit'];
	}
}

// Ensure simple text edit boxes for xref entries
$gContent->mInfo['format_guid'] = 'text';
$gBitSmarty->assign( 'xrefInfo', $xrefInfo );
$gBitSmarty->assign( 'title', $gContent->mInfo['title'] );
$gBitSmarty->assign( 'xref_title', $gContent->mInfo['xref_title'] );

$gBitSmarty->assign( 'errors', $gContent->mErrors );
$gBitSystem->display( 'bitpackage:contact/edit_key_break.tpl', 'Edit: ' , [ 'display_mode' => 'edit' ]);