1 |
2
|
Manuela
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
4 |
|
|
*
|
5 |
|
|
* This program is free software: you can redistribute it and/or modify
|
6 |
|
|
* it under the terms of the GNU General Public License as published by
|
7 |
|
|
* the Free Software Foundation, either version 3 of the License, or
|
8 |
|
|
* (at your option) any later version.
|
9 |
|
|
*
|
10 |
|
|
* This program is distributed in the hope that it will be useful,
|
11 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
|
|
* GNU General Public License for more details.
|
14 |
|
|
*
|
15 |
|
|
* You should have received a copy of the GNU General Public License
|
16 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
|
|
*/
|
18 |
|
|
|
19 |
|
|
/**
|
20 |
|
|
* cmdModify.php
|
21 |
|
|
*
|
22 |
|
|
* @category Addons
|
23 |
|
|
* @package Addons_wrapper
|
24 |
|
|
* @copyright Manuela v.d.Decken <manuela@isteam.de>
|
25 |
|
|
* @author Manuela v.d.Decken <manuela@isteam.de>
|
26 |
|
|
* @license http://www.gnu.org/licenses/gpl.html GPL License
|
27 |
|
|
* @version 3.0.1
|
28 |
|
|
* @lastmodified $Date$
|
29 |
|
|
* @since File available since 17.12.2015
|
30 |
|
|
* @description xyz
|
31 |
|
|
*/
|
32 |
|
|
/* -------------------------------------------------------- */
|
33 |
|
|
// Must include code to stop this file being accessed directly
|
34 |
|
|
if (!defined('WB_PATH')) { throw new Exception('Cannot access the addon \"'.basename(__DIR__).'\" directly'); }
|
35 |
|
|
/* -------------------------------------------------------- */
|
36 |
|
|
|
37 |
|
|
// set default values for a new one or if no matching record found
|
38 |
|
|
$aInstance = array(
|
39 |
|
|
'section_id' => $section_id,
|
40 |
|
|
'page_id' => $page_id,
|
41 |
|
|
'url' => '',
|
42 |
|
|
'height' => 400
|
43 |
|
|
);
|
44 |
|
|
// Get page content
|
45 |
|
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'mod_'.$sAddonName.'` '
|
46 |
|
|
. 'WHERE `section_id` = '.$section_id;
|
47 |
|
|
if (($oInstances = $database->query($sql))) {
|
48 |
|
|
// try to load an existing record
|
49 |
|
|
if (($aRecord = $oInstances->fetchRow(MYSQLI_ASSOC))) {
|
50 |
|
|
$aRecord['url'] = str_replace(
|
51 |
|
|
'{SYSVAR:AppUrl}',
|
52 |
|
|
str_replace('\\', '/', WB_URL).'/',
|
53 |
|
|
$aRecord['url']
|
54 |
|
|
);
|
55 |
|
|
$aInstance = $aRecord;
|
56 |
|
|
}
|
57 |
|
|
}
|
58 |
|
|
$aInstance = array_change_key_case($aInstance, CASE_UPPER);
|
59 |
|
|
// complete array with replacements
|
60 |
|
|
$aInstance['WB_URL'] = WB_URL;
|
61 |
|
|
$aInstance['THEME_URL'] = $sAddonThemeUrl;
|
62 |
|
|
// $aInstance['CANCEL_URL'] = ADMIN_URL.'/pages/modify.php?page_id='.$page_id.'#wb_'.$section_id;
|
63 |
|
|
$aInstance['SAVE_URL'] = ADMIN_URL.'/pages/save.php';
|
64 |
|
|
$aInstance['CANCEL_URL'] = ADMIN_URL.'/pages/index.php';
|
65 |
|
|
$aInstance['TEXT_URL'] = $TEXT['URL'];
|
66 |
|
|
$aInstance['TEXT_HEIGHT'] = $TEXT['HEIGHT'];
|
67 |
|
|
$aInstance['TEXT_SAVE'] = $TEXT['SAVE'];
|
68 |
|
|
$aInstance['TEXT_BACK'] = $TEXT['BACK'];
|
69 |
|
|
$aInstance['TEXT_CANCEL'] = $TEXT['CANCEL'];
|
70 |
|
|
$aInstance['FTAN'] = $admin->getFTAN();
|
71 |
|
|
// create template object
|
72 |
|
|
$oTpl = new Template($sAddonThemePath);
|
73 |
|
|
$oTpl->set_file('page', 'modify.htt');
|
74 |
|
|
$oTpl->set_block('page', 'main_block', 'main');
|
75 |
|
|
// add array of replacements
|
76 |
|
|
$oTpl->set_var($aInstance);
|
77 |
|
|
// Parse template object
|
78 |
|
|
$oTpl->parse('main', 'main_block', false);
|
79 |
|
|
$oTpl->pparse('output', 'page');
|
80 |
|
|
|
81 |
|
|
// end of file
|