forked from fisharebest/webtrees
-
Notifications
You must be signed in to change notification settings - Fork 0
/
block_edit.php
60 lines (53 loc) · 2.15 KB
/
block_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
<?php
// Change the preferences for a block on the index pages.
//
// webtrees: Web based Family History software
// Copyright (C) 2013 webtrees development team.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
define('WT_SCRIPT_NAME', 'block_edit.php');
require './includes/session.php';
$block_id = WT_Filter::getInteger('block_id');
$block = WT_DB::prepare(
"SELECT SQL_CACHE * FROM `##block` WHERE block_id=?"
)->execute(array($block_id))->fetchOneRow();
// Check access. (1) the block must exist, (2) gedcom blocks require
// managers, (3) user blocks require the user or an admin
if (!$block || $block->gedcom_id && !userGedcomAdmin(WT_USER_ID, $block->gedcom_id) || $block->user_id && $block->user_id!=WT_USER_ID && !WT_USER_IS_ADMIN) {
exit;
}
$class_name=$block->module_name.'_WT_Module';
$block=new $class_name;
$controller=new WT_Controller_Ajax();
$controller->pageHeader();
if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
ckeditor_WT_Module::enableEditor($controller);
}
?>
<form name="block" method="post" action="block_edit.php?block_id=<?php echo $block_id; ?>" onsubmit="return modalDialogSubmitAjax(this);" >
<input type="hidden" name="save" value="1">
<?php echo WT_Filter::getCsrf(); ?>
<p>
<?php echo $block->getDescription(); ?>
</p>
<table class="facts_table">
<?php echo $block->configureBlock($block_id); ?>
<tr>
<td colspan="2" class="topbottombar">
<input type="submit" value="<?php echo WT_I18N::translate('save'); ?>">
</td>
</tr>
</table>
</form>