Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         code
6
 * @author          WebsiteBaker Project
7
 * @copyright       Website Baker Org. e.V.
8
 * @link            http://websitebaker.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.3
11
 * @requirements    PHP 5.3.6 and higher
12
 * @version         $Id: modify.php 2 2017-07-02 15:14:29Z Manuela $
13
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/branches/main/modules/code/modify.php $
14
 * @lastmodified    $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
15
 *
16
 */
17

    
18
/* -------------------------------------------------------- */
19
// Must include code to stop this file being accessed directly
20
if(defined('WB_PATH') == false) { die('Illegale file access /'.basename(__DIR__).'/'.basename(__FILE__).''); }
21
/* -------------------------------------------------------- */
22
// check if module language file exists for the language set by the user (e.g. DE, EN)
23
$sAddonName = basename(__DIR__);
24
require(WB_PATH .'/modules/'.$sAddonName.'/languages/EN.php');
25
if(file_exists(WB_PATH .'/modules/'.$sAddonName.'/languages/'.LANGUAGE .'.php')) {
26
    require(WB_PATH .'/modules/'.$sAddonName.'/languages/'.LANGUAGE .'.php');
27
}
28
$sModulName = basename(__DIR__);
29
if( !$admin->get_permission($sModulName,'module' ) ) {
30
      die($MESSAGE['ADMIN_INSUFFICIENT_PRIVELLIGES']);
31
}
32
require(WB_PATH . '/include/editarea/wb_wrapper_edit_area.php');
33

    
34
// Setup template object
35
$template = new Template(WB_PATH.'/modules/'.$sAddonName);
36
$template->set_file('page', 'htt/modify.htt');
37
$template->set_block('page', 'main_block', 'main');
38

    
39
// Get page content
40

    
41
$query = "SELECT content FROM `".TABLE_PREFIX."mod_code` WHERE `section_id` = '$section_id'";
42
$get_content = $database->query($query);
43
$content = $get_content->fetchRow(MYSQLI_ASSOC);
44
$content = htmlspecialchars($content['content']);
45

    
46
// Insert vars
47
$template->set_var(
48
    array(
49
        'ADDON_NAME'            => $sAddonName,
50
        'PAGE_ID'               => $page_id,
51
        'SECTION_ID'            => $section_id,
52
        'REGISTER_EDIT_AREA'    => (function_exists('registerEditArea') ? registerEditArea('content'.$section_id, 'php', false) : ''),
53
        'WB_URL'                => WB_URL,
54
        'CONTENT'               => $content,
55
        'TEXT_SAVE'             => $TEXT['SAVE'],
56
        'TEXT_BACK'             => $TEXT['BACK'],
57
        'TEXT_CANCEL'           => $TEXT['CANCEL'],
58
        'SECTION'               => $section_id,
59
        'FTAN'                  => $admin->getFTAN()
60
    )
61
);
62

    
63
// Parse template object
64
$template->set_unknowns('keep');
65
$template->parse('main', 'main_block', false);
66
$template->pparse('output', 'page', false);
(8-8/12)