summaryrefslogtreecommitdiff
path: root/edit_personal_page.php
blob: a9a045a8cf5941d0c25aeadceadee2c8b2f05c71 (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
68
<?php
/**
 * personal dashboard
 *
 * @copyright (c) 2004-15 bitweaver.org
 *
 * @package users
 * @subpackage functions
 */

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

$gBitUser->verifyRegistered();

// Check if the page has changed
if (isset($_REQUEST["fSavePage"])) {
	$gBitUser->store( $_REQUEST );
	header( "Location:".USERS_PKG_URL."index.php?home=".$gBitUser->mUsername );
	die;
}elseif( isset($_REQUEST["fCancel"]) ){
	header( "Location:".USERS_PKG_URL."index.php?home=".$gBitUser->mUsername );
	die;
}

// see if we should show the attachments tab at all
foreach( $gLibertySystem->mPlugins as $plugin ) {
	if( ( $plugin['plugin_type'] == 'storage' ) && ( $plugin['is_active'] == 'y' ) ) {
		$gBitSmarty->assign( 'show_attachments','y' );
	}
}

$gBitSmarty->assign('preview',0);
// If we are in preview mode then preview it!
if(isset($_REQUEST["preview"])) {
	$gBitSmarty->assign('preview',1);
	$gBitUser->mInfo['title'] = $_REQUEST["title"];
	if(isset($_REQUEST["description"])) {
		$gBitUser->mInfo['description'] = $_REQUEST["description"];
	}
	$gBitUser->mInfo['data'] = $_REQUEST["edit"];

	$parseHash = [
		'data' => $_REQUEST["edit"],
		'format' => BitBase::getParameter( $_REQUEST, 'format_guid', $gBitUser->getField( 'format_guid', 'tikiwiki' ) ),
	];

	$parsed = LibertyContent::parseDataHash( $parseHash );
	$gBitUser->mInfo['parsed_data'] = $parsed;
	/* SPELLCHECKING INITIAL ATTEMPT */
	//This nice function does all the job!
	$gBitSmarty->assign( 'pageInfo', $gBitUser->mInfo );
	$gBitUser->invokeServices( 'content_preview_function' );
}
else {
	$gBitUser->invokeServices( 'content_edit_function' );
}

$gBitSmarty->assign( 'pageInfo', $gBitUser->mInfo );
$gBitSmarty->assign( 'gContent', $gBitUser );

$gBitSmarty->assign( 'show_page_bar', 'y' );
$gBitSystem->setConfig( 'wiki_description', 'n' );

$gBitSystem->display( 'bitpackage:users/edit_personal_page.tpl', null, [ 'display_mode' => 'edit' ] );
?>