| 
      1
     | 
    
      <?php
 
     | 
  
  
    | 
      2
     | 
    
      
 
     | 
  
  
    | 
      3
     | 
    
      // $Id: tool.php 626 2008-01-28 16:28:56Z doc $
 
     | 
  
  
    | 
      4
     | 
    
      
 
     | 
  
  
    | 
      5
     | 
    
      // JsAdmin module for Website Baker
 
     | 
  
  
    | 
      6
     | 
    
      // Copyright (C) 2006, Stepan Riha
 
     | 
  
  
    | 
      7
     | 
    
      // www.nonplus.net
 
     | 
  
  
    | 
      8
     | 
    
      
 
     | 
  
  
    | 
      9
     | 
    
      // modified by Swen Uth for Website Baker 2.7
 
     | 
  
  
    | 
      10
     | 
    
      
 
     | 
  
  
    | 
      11
     | 
    
      /*
 
     | 
  
  
    | 
      12
     | 
    
      
 
     | 
  
  
    | 
      13
     | 
    
       Website Baker Project <http://www.websitebaker.org/>
 
     | 
  
  
    | 
      14
     | 
    
       Copyright (C) 2004-2008, Ryan Djurovich
 
     | 
  
  
    | 
      15
     | 
    
      
 
     | 
  
  
    | 
      16
     | 
    
       Website Baker is free software; you can redistribute it and/or modify
 
     | 
  
  
    | 
      17
     | 
    
       it under the terms of the GNU General Public License as published by
 
     | 
  
  
    | 
      18
     | 
    
       the Free Software Foundation; either version 2 of the License, or
 
     | 
  
  
    | 
      19
     | 
    
       (at your option) any later version.
 
     | 
  
  
    | 
      20
     | 
    
      
 
     | 
  
  
    | 
      21
     | 
    
       Website Baker is distributed in the hope that it will be useful,
 
     | 
  
  
    | 
      22
     | 
    
       but WITHOUT ANY WARRANTY; without even the implied warranty of
 
     | 
  
  
    | 
      23
     | 
    
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
     | 
  
  
    | 
      24
     | 
    
       GNU General Public License for more details.
 
     | 
  
  
    | 
      25
     | 
    
      
 
     | 
  
  
    | 
      26
     | 
    
       You should have received a copy of the GNU General Public License
 
     | 
  
  
    | 
      27
     | 
    
       along with Website Baker; if not, write to the Free Software
 
     | 
  
  
    | 
      28
     | 
    
       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
     | 
  
  
    | 
      29
     | 
    
      
 
     | 
  
  
    | 
      30
     | 
    
      */
 
     | 
  
  
    | 
      31
     | 
    
      
 
     | 
  
  
    | 
      32
     | 
    
      // direct access prevention
 
     | 
  
  
    | 
      33
     | 
    
      defined('WB_PATH') OR die(header('Location: ../index.php'));
     | 
  
  
    | 
      34
     | 
    
      
 
     | 
  
  
    | 
      35
     | 
    
      // check if module language file exists for the language set by the user (e.g. DE, EN)
 
     | 
  
  
    | 
      36
     | 
    
      if(!file_exists(WB_PATH .'/modules/jsadmin/languages/'.LANGUAGE .'.php')) {
     | 
  
  
    | 
      37
     | 
    
      	// no module language file exists for the language set by the user, include default module language file EN.php
 
     | 
  
  
    | 
      38
     | 
    
      	require_once(WB_PATH .'/modules/jsadmin/languages/EN.php');
 
     | 
  
  
    | 
      39
     | 
    
      } else {
     | 
  
  
    | 
      40
     | 
    
      	// a module language file exists for the language defined by the user, load it
 
     | 
  
  
    | 
      41
     | 
    
      	require_once(WB_PATH .'/modules/jsadmin/languages/'.LANGUAGE .'.php');
 
     | 
  
  
    | 
      42
     | 
    
      }
 
     | 
  
  
    | 
      43
     | 
    
      
 
     | 
  
  
    | 
      44
     | 
    
      // check if backend.css file needs to be included into the <body></body>
 
     | 
  
  
    | 
      45
     | 
    
      if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH .'/modules/jsadmin/backend.css')) {
     | 
  
  
    | 
      46
     | 
    
      	echo '<style type="text/css">';
 
     | 
  
  
    | 
      47
     | 
    
      	include(WB_PATH .'/modules/jsadmin/backend.css');
 
     | 
  
  
    | 
      48
     | 
    
      	echo "\n</style>\n";
 
     | 
  
  
    | 
      49
     | 
    
      }
 
     | 
  
  
    | 
      50
     | 
    
      
 
     | 
  
  
    | 
      51
     | 
    
      require_once(WB_PATH.'/modules/jsadmin/jsadmin.php');
 
     | 
  
  
    | 
      52
     | 
    
      
 
     | 
  
  
    | 
      53
     | 
    
      // Check if user selected what add-ons to reload
 
     | 
  
  
    | 
      54
     | 
    
      if(isset($_POST['submit']) AND $_POST['submit'] != '') {
     | 
  
  
    | 
      55
     | 
    
      	// Include functions file
 
     | 
  
  
    | 
      56
     | 
    
      	require_once(WB_PATH.'/framework/functions.php');
 
     | 
  
  
    | 
      57
     | 
    
      	save_setting('mod_jsadmin_persist_order', isset($_POST['persist_order']));
     | 
  
  
    | 
      58
     | 
    
      	save_setting('mod_jsadmin_ajax_order_pages', isset($_POST['ajax_order_pages']));
     | 
  
  
    | 
      59
     | 
    
      	save_setting('mod_jsadmin_ajax_order_sections', isset($_POST['ajax_order_sections']));
     | 
  
  
    | 
      60
     | 
    
      	echo '<div style="border: solid 2px #9c9; background: #ffd; padding: 0.5em; margin-top: 1em">'.$MESSAGE['SETTINGS']['SAVED'].'</div>';
 
     | 
  
  
    | 
      61
     | 
    
      }
 
     | 
  
  
    | 
      62
     | 
    
      
 
     | 
  
  
    | 
      63
     | 
    
      // Display form
 
     | 
  
  
    | 
      64
     | 
    
      $persist_order = get_setting('mod_jsadmin_persist_order', true) ? 'checked="1"' : '';
     | 
  
  
    | 
      65
     | 
    
      $ajax_order_pages = get_setting('mod_jsadmin_ajax_order_pages', true) ? 'checked="1"' : '';
     | 
  
  
    | 
      66
     | 
    
      $ajax_order_sections = get_setting('mod_jsadmin_ajax_order_sections', true) ? 'checked="1"' : '';
     | 
  
  
    | 
      67
     | 
    
      ?>
 
     | 
  
  
    | 
      68
     | 
    
      <?php
 
     | 
  
  
    | 
      69
     | 
    
      
 
     | 
  
  
    | 
      70
     | 
    
      // THIS ROUTINE CHECKS THE EXISTING OFF ALL NEEDED YUI FILES
 
     | 
  
  
    | 
      71
     | 
    
        $YUI_ERROR=false; // ist there an Error
 
     | 
  
  
    | 
      72
     | 
    
        $YUI_PUT ='';   // String with javascipt includes
 
     | 
  
  
    | 
      73
     | 
    
        $YUI_PUT_MISSING_Files=''; // String with missing files
 
     | 
  
  
    | 
      74
     | 
    
        reset($js_yui_scripts);
 
     | 
  
  
    | 
      75
     | 
    
        foreach($js_yui_scripts as $script) {
     | 
  
  
    | 
      76
     | 
    
           if(!file_exists($WB_MAIN_RELATIVE_PATH.$script)){
     | 
  
  
    | 
      77
     | 
    
              $YUI_ERROR=true;
 
     | 
  
  
    | 
      78
     | 
    
              $YUI_PUT_MISSING_Files =$YUI_PUT_MISSING_Files."- ".WB_URL.$script."<br />";   // catch all missing files
 
     | 
  
  
    | 
      79
     | 
    
          }
 
     | 
  
  
    | 
      80
     | 
    
      	}
 
     | 
  
  
    | 
      81
     | 
    
      	if($YUI_ERROR)
 
     | 
  
  
    | 
      82
     | 
    
      	{
     | 
  
  
    | 
      83
     | 
    
          ?><div id="jsadmin_install" style="border: solid 2px #c99; background: #ffd; padding: 0.5em; margin-top: 1em">
 
     | 
  
  
    | 
      84
     | 
    
      
 
     | 
  
  
    | 
      85
     | 
    
           <?php echo $MOD_JSADMIN['TXT_ERROR_INSTALLINFO_B'].$YUI_PUT_MISSING_Files; ?>
 
     | 
  
  
    | 
      86
     | 
    
            </div>
 
     | 
  
  
    | 
      87
     | 
    
            <?php
 
     | 
  
  
    | 
      88
     | 
    
        }
 
     | 
  
  
    | 
      89
     | 
    
        else
 
     | 
  
  
    | 
      90
     | 
    
        {
     | 
  
  
    | 
      91
     | 
    
        ?>
 
     | 
  
  
    | 
      92
     | 
    
         <form id="jsadmin_form" style="margin-top: 1em; display: true;" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
 
     | 
  
  
    | 
      93
     | 
    
         <table cellpadding="4" cellspacing="0" border="0">
 
     | 
  
  
    | 
      94
     | 
    
         <tr>
 
     | 
  
  
    | 
      95
     | 
    
      	     <td colspan="2"><?php echo $MOD_JSADMIN['TXT_HEADING_B']; ?>:</td>
 
     | 
  
  
    | 
      96
     | 
    
         </tr>
 
     | 
  
  
    | 
      97
     | 
    
         <tr>
 
     | 
  
  
    | 
      98
     | 
    
      	     <td width="20"><input type="checkbox" name="persist_order" id="persist_order" value="true" <?php echo $persist_order; ?>/></td>
 
     | 
  
  
    | 
      99
     | 
    
      	     <td><label for="persist_order"><?php echo $MOD_JSADMIN['TXT_PERSIST_ORDER_B']; ?></label></td>
 
     | 
  
  
    | 
      100
     | 
    
         </tr>
 
     | 
  
  
    | 
      101
     | 
    
         <tr>
 
     | 
  
  
    | 
      102
     | 
    
      	     <td width="20"><input type="checkbox" name="ajax_order_pages" id="ajax_order_pages" value="true" <?php echo $ajax_order_pages; ?>/></td>
 
     | 
  
  
    | 
      103
     | 
    
      	     <td><label for="ajax_order_pages"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_PAGES_B']; ?></label></td>
 
     | 
  
  
    | 
      104
     | 
    
         </tr>
 
     | 
  
  
    | 
      105
     | 
    
         <tr>
 
     | 
  
  
    | 
      106
     | 
    
      	     <td width="20"><input type="checkbox" name="ajax_order_sections" id="ajax_order_sections" value="true" <?php echo $ajax_order_sections; ?>/></td>
 
     | 
  
  
    | 
      107
     | 
    
      	     <td><label for="ajax_order_sections"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_SECTIONS_B']; ?></label></td>
 
     | 
  
  
    | 
      108
     | 
    
         </tr>
 
     | 
  
  
    | 
      109
     | 
    
         <tr>
 
     | 
  
  
    | 
      110
     | 
    
      	     <td> </td>
 
     | 
  
  
    | 
      111
     | 
    
      	     <td>
 
     | 
  
  
    | 
      112
     | 
    
      		   <input type="submit" name="submit" value="<?php echo $TEXT['SAVE']; ?>" />
 
     | 
  
  
    | 
      113
     | 
    
      	    </td>
 
     | 
  
  
    | 
      114
     | 
    
         </tr>
 
     | 
  
  
    | 
      115
     | 
    
         </table>
 
     | 
  
  
    | 
      116
     | 
    
         </form>
 
     | 
  
  
    | 
      117
     | 
    
       <?php
 
     | 
  
  
    | 
      118
     | 
    
       }
 
     | 
  
  
    | 
      119
     | 
    
      ?>
 
     |