Project

General

Profile

1
<?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
 * cmdInstall.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: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
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
    // get content
38
    $sql = 'SELECT `url`, `height` FROM `'.TABLE_PREFIX.'mod_wrapper` '
39
         . 'WHERE `section_id` = '.intval($section_id);
40
    if (($oInstances = $database->query($sql))) {
41
        if (($aInstance = $oInstances->fetchRow(MYSQLI_ASSOC))) {
42
            $aInstance['url'] = str_replace('{SYSVAR:AppUrl}', WB_URL.'/', $aInstance['url']);
43
            $aTplData = array_change_key_case($aInstance, CASE_UPPER);
44
            $aTplData['NOTICE'] = $MOD_WRAPPER['NOTICE'];
45
            if (class_exists('Twig_Environment') && is_readable($sAddonTemplatePath.'/view.twig')) {
46
                // create twig template object
47
                $oTwig = new Twig_Environment(new Twig_Loader_Filesystem($sAddonTemplatePath));
48
                echo $oTwig->render('view.twig', $aTplData);
49
            } else {
50
                // create phplib template object
51
                $oTpl = new Template($sAddonTemplatePath);
52
                $oTpl->set_file('page', 'view.htt');
53
                $oTpl->set_block('page', 'main_block', 'main');
54
                $oTpl->set_var($aTplData);
55
                // Parse template object
56
                $oTpl->parse('main', 'main_block', false);
57
                $oTpl->pparse('output', 'page');
58
            }
59
        }
60
    }
61
// end of file
62

    
(7-7/7)