Project

General

Profile

1 601 doc
<?php
2 1377 FrankH
/**
3
 *
4
 * @category        modules
5
 * @package         JsAdmin
6
 * @author          WebsiteBaker Project, modified by Swen Uth for Website Baker 2.7
7
 * @copyright       2009-2011, Website Baker 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$
13 1477 Luisehahne
 * @filesource		$HeadURL$
14
 * @lastmodified    $Date$
15 1377 FrankH
 *
16 601 doc
*/
17
18 1537 Luisehahne
// prevent this file from being accessed directly
19
/* -------------------------------------------------------- */
20
if(defined('WB_PATH') == false)
21
{
22
	// Stop this file being access directly
23
	die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
24
}
25
/* -------------------------------------------------------- */
26 601 doc
27
// check if module language file exists for the language set by the user (e.g. DE, EN)
28
if(!file_exists(WB_PATH .'/modules/jsadmin/languages/'.LANGUAGE .'.php')) {
29
	// no module language file exists for the language set by the user, include default module language file EN.php
30
	require_once(WB_PATH .'/modules/jsadmin/languages/EN.php');
31
} else {
32
	// a module language file exists for the language defined by the user, load it
33
	require_once(WB_PATH .'/modules/jsadmin/languages/'.LANGUAGE .'.php');
34
}
35 1457 Luisehahne
/*
36 601 doc
// check if backend.css file needs to be included into the <body></body>
37
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH .'/modules/jsadmin/backend.css')) {
38
	echo '<style type="text/css">';
39
	include(WB_PATH .'/modules/jsadmin/backend.css');
40
	echo "\n</style>\n";
41
}
42 1457 Luisehahne
*/
43 601 doc
require_once(WB_PATH.'/modules/jsadmin/jsadmin.php');
44
45
// Check if user selected what add-ons to reload
46 1457 Luisehahne
if(isset($_POST['save_settings']))  {
47 1460 Luisehahne
48 1377 FrankH
	if (!$admin->checkFTAN())
49
	{
50 1460 Luisehahne
		if(!$admin_header) { $admin->print_header(); }
51 1425 Luisehahne
		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$_SERVER['REQUEST_URI']);
52 1377 FrankH
	}
53
54 601 doc
	// Include functions file
55
	require_once(WB_PATH.'/framework/functions.php');
56
	save_setting('mod_jsadmin_persist_order', isset($_POST['persist_order']));
57
	save_setting('mod_jsadmin_ajax_order_pages', isset($_POST['ajax_order_pages']));
58
	save_setting('mod_jsadmin_ajax_order_sections', isset($_POST['ajax_order_sections']));
59 1457 Luisehahne
   // 	echo '<div style="border: solid 2px #9c9; background: #ffd; padding: 0.5em; margin-top: 1em">'.$MESSAGE['SETTINGS']['SAVED'].'</div>';
60
	// check if there is a database error, otherwise say successful
61 1460 Luisehahne
	if(!$admin_header) { $admin->print_header(); }
62 1457 Luisehahne
	if($database->is_error()) {
63
		$admin->print_error($database->get_error(), $js_back);
64
	} else {
65
66
		$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/admintools/tool.php?tool=jsadmin');
67
	}
68
69
} else {
70
	// $admin->print_header();
71 601 doc
}
72
73
// Display form
74 1457 Luisehahne
	$persist_order = get_setting('mod_jsadmin_persist_order', true) ? 'checked="checked"' : '';
75
	$ajax_order_pages = get_setting('mod_jsadmin_ajax_order_pages', true) ? 'checked="checked"' : '';
76
	$ajax_order_sections = get_setting('mod_jsadmin_ajax_order_sections', true) ? 'checked="checked"' : '';
77 601 doc
78
// THIS ROUTINE CHECKS THE EXISTING OFF ALL NEEDED YUI FILES
79
  $YUI_ERROR=false; // ist there an Error
80
  $YUI_PUT ='';   // String with javascipt includes
81
  $YUI_PUT_MISSING_Files=''; // String with missing files
82
  reset($js_yui_scripts);
83
  foreach($js_yui_scripts as $script) {
84 626 doc
     if(!file_exists($WB_MAIN_RELATIVE_PATH.$script)){
85 601 doc
        $YUI_ERROR=true;
86 626 doc
        $YUI_PUT_MISSING_Files =$YUI_PUT_MISSING_Files."- ".WB_URL.$script."<br />";   // catch all missing files
87 601 doc
    }
88
	}
89
	if($YUI_ERROR)
90
	{
91 1457 Luisehahne
?>
92
	<div id="jsadmin_install" style="border: solid 2px #c99; background: #ffd; padding: 0.5em; margin-top: 1em">
93 601 doc
94
     <?php echo $MOD_JSADMIN['TXT_ERROR_INSTALLINFO_B'].$YUI_PUT_MISSING_Files; ?>
95
      </div>
96 1457 Luisehahne
<?php
97 601 doc
  }
98
  else
99
  {
100
  ?>
101 1457 Luisehahne
   <form id="jsadmin_form" name="store_settings" style="margin-top: 1em; display: true;" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
102 1377 FrankH
	<?php echo $admin->getFTAN(); ?>
103 601 doc
   <table cellpadding="4" cellspacing="0" border="0">
104
   <tr>
105
	     <td colspan="2"><?php echo $MOD_JSADMIN['TXT_HEADING_B']; ?>:</td>
106
   </tr>
107
   <tr>
108
	     <td width="20"><input type="checkbox" name="persist_order" id="persist_order" value="true" <?php echo $persist_order; ?>/></td>
109
	     <td><label for="persist_order"><?php echo $MOD_JSADMIN['TXT_PERSIST_ORDER_B']; ?></label></td>
110
   </tr>
111
   <tr>
112
	     <td width="20"><input type="checkbox" name="ajax_order_pages" id="ajax_order_pages" value="true" <?php echo $ajax_order_pages; ?>/></td>
113
	     <td><label for="ajax_order_pages"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_PAGES_B']; ?></label></td>
114
   </tr>
115
   <tr>
116
	     <td width="20"><input type="checkbox" name="ajax_order_sections" id="ajax_order_sections" value="true" <?php echo $ajax_order_sections; ?>/></td>
117
	     <td><label for="ajax_order_sections"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_SECTIONS_B']; ?></label></td>
118
   </tr>
119
   <tr>
120
	     <td>&nbsp;</td>
121
	     <td>
122 1457 Luisehahne
		   <input type="submit" name="save_settings" value="<?php echo $TEXT['SAVE']; ?>" />
123 601 doc
	    </td>
124
   </tr>
125
   </table>
126
   </form>
127
 <?php
128
 }