Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         JsAdmin
6
 * @author          WebsiteBaker Project, modified by Swen Uth for Website Baker 2.7
7
 * @copyright       WebsiteBaker 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: tool.php 2 2017-07-02 15:14:29Z Manuela $
13
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/branches/main/modules/jsadmin/tool.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

    
23
// check if module language file exists for the language set by the user (e.g. DE, EN)
24
$sAddonName = basename(__DIR__);
25
require(WB_PATH .'/modules/'.$sAddonName.'/languages/EN.php');
26
if(file_exists(WB_PATH .'/modules/'.$sAddonName.'/languages/'.LANGUAGE .'.php')) {
27
    require(WB_PATH .'/modules/'.$sAddonName.'/languages/'.LANGUAGE .'.php');
28
}
29
$sModulName = basename(__DIR__);
30
$js_back = ADMIN_URL.'/admintools/tool.php';
31
$ToolUrl = ADMIN_URL.'/admintools/tool.php?tool=jsadmin';
32
if( !$admin->get_permission($sModulName,'module' ) ) {
33
    $admin->print_error($MESSAGE['ADMIN_INSUFFICIENT_PRIVELLIGES'], $js_back);
34
}
35
if( !function_exists( 'get_setting' ) )  {  require(WB_PATH.'/modules/'.basename(__DIR__).'/jsadmin.php');  }
36

    
37
// Check if user selected what add-ons to reload
38
if(isset($_POST['save_settings']))  {
39
    if (!$admin->checkFTAN())
40
    {
41
        if(!$admin_header) { $admin->print_header(); }
42
        $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$_SERVER['REQUEST_URI']);
43
    }
44
    $aSql = array();
45

    
46
    $aSql[] = save_setting('mod_jsadmin_persist_order', intval(isset($_POST['persist_order'])) );
47
    $aSql[] = save_setting('mod_jsadmin_ajax_order_pages', intval(isset($_POST['ajax_order_pages'])) );
48
    $aSql[] = save_setting('mod_jsadmin_ajax_order_sections', intval(isset($_POST['ajax_order_sections'])) );
49

    
50
    // check if there is a database error, otherwise say successful implode('<br />',$aSql ). 
51
    if(!$admin_header) { $admin->print_header(); }
52
    if($database->is_error()) {
53
        $admin->print_error($database->get_error(), $js_back);
54
    } else {
55
        $admin->print_success( $MESSAGE['PAGES_SAVED'], $ToolUrl);
56
    }
57

    
58
} else {
59
    // $admin->print_header();
60
}
61

    
62
// Display form
63
    $persist_order = get_setting('mod_jsadmin_persist_order' ) ? 'checked="checked"' : '';
64
    $ajax_order_pages = get_setting('mod_jsadmin_ajax_order_pages'  ) ? 'checked="checked"' : '';
65
    $ajax_order_sections = get_setting('mod_jsadmin_ajax_order_sections' ) ? 'checked="checked"' : '';
66

    
67
// THIS ROUTINE CHECKS THE EXISTING OFF ALL NEEDED YUI FILES
68
  $YUI_ERROR=false; // ist there an Error
69
  $YUI_PUT ='';   // String with javascipt includes
70
  $YUI_PUT_MISSING_Files=''; // String with missing files
71
  reset($js_yui_scripts);
72
  foreach($js_yui_scripts as $script) {
73
     if(!file_exists($WB_MAIN_RELATIVE_PATH.$script)){
74
        $YUI_ERROR=true;
75
        $YUI_PUT_MISSING_Files =$YUI_PUT_MISSING_Files."- ".WB_URL.$script."<br />";   // catch all missing files
76
    }
77
    }
78
    if($YUI_ERROR)
79
    {
80
?>
81
    <div id="jsadmin_install" style="border: solid 2px #c99; background: #ffd; padding: 0.5em; margin-top: 1em">
82

    
83
     <?php echo $MOD_JSADMIN['TXT_ERROR_INSTALLINFO_B'].$YUI_PUT_MISSING_Files; ?>
84
      </div>
85
<?php
86
  }
87
  else
88
  {
89
  ?>
90
   <form id="jsadmin_form" name="store_settings" style="margin-top: 1em; display: true;" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
91
    <?php echo $admin->getFTAN(); ?>
92
   <table >
93
   <tr>
94
         <td colspan="2"><?php echo $MOD_JSADMIN['TXT_HEADING_B']; ?>:</td>
95
   </tr>
96
   <tr>
97
         <td width="20"><input type="checkbox" name="persist_order" id="persist_order" value="true" <?php echo $persist_order; ?>/></td>
98
         <td><label for="persist_order"><?php echo $MOD_JSADMIN['TXT_PERSIST_ORDER_B']; ?></label></td>
99
   </tr>
100
   <tr>
101
         <td width="20"><input type="checkbox" name="ajax_order_pages" id="ajax_order_pages" value="true" <?php echo $ajax_order_pages; ?>/></td>
102
         <td><label for="ajax_order_pages"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_PAGES_B']; ?></label></td>
103
   </tr>
104
   <tr>
105
         <td width="20"><input type="checkbox" name="ajax_order_sections" id="ajax_order_sections" value="true" <?php echo $ajax_order_sections; ?>/></td>
106
         <td><label for="ajax_order_sections"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_SECTIONS_B']; ?></label></td>
107
   </tr>
108
   <tr>
109
         <td>&nbsp;</td>
110
         <td>
111
           <input type="submit" name="save_settings" value="<?php echo $TEXT['SAVE']; ?>" />
112
        </td>
113
   </tr>
114
   </table>
115
   </form>
116
 <?php
117
 }
(12-12/14)