| 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       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: tool.php 1537 2011-12-10 11:04:33Z Luisehahne $
 | 
  
    | 13 |  * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/jsadmin/tool.php $
 | 
  
    | 14 |  * @lastmodified    $Date: 2011-12-10 12:04:33 +0100 (Sat, 10 Dec 2011) $
 | 
  
    | 15 |  *
 | 
  
    | 16 | */
 | 
  
    | 17 | 
 | 
  
    | 18 | // 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 | 
 | 
  
    | 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 | /*
 | 
  
    | 36 | // 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 | */
 | 
  
    | 43 | require_once(WB_PATH.'/modules/jsadmin/jsadmin.php');
 | 
  
    | 44 | 
 | 
  
    | 45 | // Check if user selected what add-ons to reload
 | 
  
    | 46 | if(isset($_POST['save_settings']))  {
 | 
  
    | 47 | 
 | 
  
    | 48 | 	if (!$admin->checkFTAN())
 | 
  
    | 49 | 	{
 | 
  
    | 50 | 		if(!$admin_header) { $admin->print_header(); }
 | 
  
    | 51 | 		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$_SERVER['REQUEST_URI']);
 | 
  
    | 52 | 	}
 | 
  
    | 53 | 
 | 
  
    | 54 | 	// 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 |    // 	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 | 	if(!$admin_header) { $admin->print_header(); }
 | 
  
    | 62 | 	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 | }
 | 
  
    | 72 | 
 | 
  
    | 73 | // Display form
 | 
  
    | 74 | 	$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 | 
 | 
  
    | 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 |      if(!file_exists($WB_MAIN_RELATIVE_PATH.$script)){
 | 
  
    | 85 |         $YUI_ERROR=true;
 | 
  
    | 86 |         $YUI_PUT_MISSING_Files =$YUI_PUT_MISSING_Files."- ".WB_URL.$script."<br />";   // catch all missing files
 | 
  
    | 87 |     }
 | 
  
    | 88 | 	}
 | 
  
    | 89 | 	if($YUI_ERROR)
 | 
  
    | 90 | 	{
 | 
  
    | 91 | ?>
 | 
  
    | 92 | 	<div id="jsadmin_install" style="border: solid 2px #c99; background: #ffd; padding: 0.5em; margin-top: 1em">
 | 
  
    | 93 | 
 | 
  
    | 94 |      <?php echo $MOD_JSADMIN['TXT_ERROR_INSTALLINFO_B'].$YUI_PUT_MISSING_Files; ?>
 | 
  
    | 95 |       </div>
 | 
  
    | 96 | <?php
 | 
  
    | 97 |   }
 | 
  
    | 98 |   else
 | 
  
    | 99 |   {
 | 
  
    | 100 |   ?>
 | 
  
    | 101 |    <form id="jsadmin_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 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> </td>
 | 
  
    | 121 | 	     <td>
 | 
  
    | 122 | 		   <input type="submit" name="save_settings" value="<?php echo $TEXT['SAVE']; ?>" />
 | 
  
    | 123 | 	    </td>
 | 
  
    | 124 |    </tr>
 | 
  
    | 125 |    </table>
 | 
  
    | 126 |    </form>
 | 
  
    | 127 |  <?php
 | 
  
    | 128 |  }
 |