Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         JsAdmin
6
 * @author          Ryan Djurovich (2004-2009), WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id: tool.php 2070 2014-01-03 01:21:42Z darkviper $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/jsadmin/tool.php $
14
 * @lastmodified    $Date: 2014-01-03 02:21:42 +0100 (Fri, 03 Jan 2014) $
15
 *
16
*/
17

    
18
/* -------------------------------------------------------- */
19
// Must include code to stop this file being accessed directly
20
if(!defined('WB_URL')) {
21
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
22
	throw new IllegalFileException();
23
}
24
/* -------------------------------------------------------- */
25

    
26
// check if module language file exists for the language set by the user (e.g. DE, EN)
27
if(!file_exists(WB_PATH .'/modules/jsadmin/languages/'.LANGUAGE .'.php')) {
28
	// no module language file exists for the language set by the user, include default module language file EN.php
29
	require_once(WB_PATH .'/modules/jsadmin/languages/EN.php');
30
} else {
31
	// a module language file exists for the language defined by the user, load it
32
	require_once(WB_PATH .'/modules/jsadmin/languages/'.LANGUAGE .'.php');
33
}
34
/*
35
// check if backend.css file needs to be included into the <body></body>
36
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH .'/modules/jsadmin/backend.css')) {
37
	echo '<style type="text/css">';
38
	include(WB_PATH .'/modules/jsadmin/backend.css');
39
	echo "\n</style>\n";
40
}
41
*/
42
require_once(WB_PATH.'/modules/jsadmin/jsadmin.php');
43

    
44
// Check if user selected what add-ons to reload
45
if(isset($_POST['save_settings']))  {
46

    
47
	if (!$admin->checkFTAN())
48
	{
49
		if(!$admin_header) { $admin->print_header(); }
50
		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$_SERVER['REQUEST_URI']);
51
	}
52

    
53
	// Include functions file
54
	require_once(WB_PATH.'/framework/functions.php');
55
	save_setting('mod_jsadmin_persist_order', isset($_POST['persist_order']));
56
	save_setting('mod_jsadmin_ajax_order_pages', isset($_POST['ajax_order_pages']));
57
	save_setting('mod_jsadmin_ajax_order_sections', isset($_POST['ajax_order_sections']));
58
   // 	echo '<div style="border: solid 2px #9c9; background: #ffd; padding: 0.5em; margin-top: 1em">'.$MESSAGE['SETTINGS']['SAVED'].'</div>';
59
	// check if there is a database error, otherwise say successful
60
	if(!$admin_header) { $admin->print_header(); }
61
	if($database->is_error()) {
62
		$admin->print_error($database->get_error(), $js_back);
63
	} else {
64

    
65
		$admin->print_success($MESSAGE['PAGES_SAVED'], ADMIN_URL.'/admintools/tool.php?tool=jsadmin');
66
	}
67

    
68
} else {
69
	// $admin->print_header();
70
}
71

    
72
// Display form
73
	$persist_order = get_setting('mod_jsadmin_persist_order', true) ? 'checked="checked"' : '';
74
	$ajax_order_pages = get_setting('mod_jsadmin_ajax_order_pages', true) ? 'checked="checked"' : '';
75
	$ajax_order_sections = get_setting('mod_jsadmin_ajax_order_sections', true) ? 'checked="checked"' : '';
76

    
77
// THIS ROUTINE CHECKS THE EXISTING OFF ALL NEEDED YUI FILES
78
  $YUI_ERROR=false; // ist there an Error
79
  $YUI_PUT ='';   // String with javascipt includes
80
  $YUI_PUT_MISSING_Files=''; // String with missing files
81
  reset($js_yui_scripts);
82
  foreach($js_yui_scripts as $script) {
83
     if(!file_exists($WB_MAIN_RELATIVE_PATH.$script)){
84
        $YUI_ERROR=true;
85
        $YUI_PUT_MISSING_Files =$YUI_PUT_MISSING_Files."- ".WB_URL.$script."<br />";   // catch all missing files
86
    }
87
	}
88
	if($YUI_ERROR)
89
	{
90
?>
91
	<div id="jsadmin_install" style="border: solid 2px #c99; background: #ffd; padding: 0.5em; margin-top: 1em">
92

    
93
     <?php echo $MOD_JSADMIN['TXT_ERROR_INSTALLINFO_B'].$YUI_PUT_MISSING_Files; ?>
94
      </div>
95
<?php
96
  }
97
  else
98
  {
99
  ?>
100
<div  id="jsadmin_form"></div>
101
   <form name="store_settings" style="margin-top: 1em; display: true;" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
102
	<?php echo $admin->getFTAN(); ?>
103
   <table class="jsadmin_drag_area">
104
<tbody>
105
   <tr>
106
	     <td colspan="2"><?php echo $MOD_JSADMIN['TXT_HEADING_B']; ?>:</td>
107
   </tr>
108
   <tr>
109
	     <td style="width: 20px;"><input type="checkbox" name="persist_order" id="persist_order" value="true" <?php echo $persist_order; ?>/></td>
110
	     <td><label for="persist_order"><?php echo $MOD_JSADMIN['TXT_PERSIST_ORDER_B']; ?></label></td>
111
   </tr>
112
   <tr>
113
	     <td  style="width: 20px;"><input type="checkbox" name="ajax_order_pages" id="ajax_order_pages" value="true" <?php echo $ajax_order_pages; ?>/></td>
114
	     <td><label for="ajax_order_pages"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_PAGES_B']; ?></label></td>
115
   </tr>
116
   <tr>
117
	     <td style="width: 20px;"><input type="checkbox" name="ajax_order_sections" id="ajax_order_sections" value="true" <?php echo $ajax_order_sections; ?>/></td>
118
	     <td><label for="ajax_order_sections"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_SECTIONS_B']; ?></label></td>
119
   </tr>
120
   <tr>
121
	     <td style="width: 20px;">&nbsp;</td>
122
	     <td>
123
		   <input type="submit" name="save_settings" value="<?php echo $TEXT['SAVE']; ?>" />
124
	    </td>
125
   </tr>
126
</tbody>
127
   </table>
128
   </form>
129
 <?php
130
 }
(10-10/13)