| 1 | 2 | Manuela | <?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$
 | 
      
        | 13 |  |  |  * @filesource      $HeadURL$
 | 
      
        | 14 |  |  |  * @lastmodified    $Date$
 | 
      
        | 15 |  |  |  *
 | 
      
        | 16 |  |  | */
 | 
      
        | 17 |  |  | 
 | 
      
        | 18 |  |  | /* -------------------------------------------------------- */
 | 
      
        | 19 |  |  | // Must include code to stop this file being accessed directly
 | 
      
        | 20 |  |  | if(defined('WB_PATH') == false) { die('Cannot access '.basename(__DIR__).'/'.basename(__FILE__).' directly'); }
 | 
      
        | 21 |  |  | /* -------------------------------------------------------- */
 | 
      
        | 22 |  |  | function get_setting($name, $default = '') {
 | 
      
        | 23 |  |  |     global $database;
 | 
      
        | 24 |  |  |     $retVal = $default;
 | 
      
        | 25 |  |  |     $sql  = 'SELECT `value` FROM `'.TABLE_PREFIX.'mod_jsadmin` '
 | 
      
        | 26 |  |  |           . 'WHERE `name` = \''.$database->escapeString($name).'\'';
 | 
      
        | 27 |  |  |     if ($retVal = $database->get_one($sql) ) { }
 | 
      
        | 28 |  |  |     return $retVal;
 | 
      
        | 29 |  |  | }
 | 
      
        | 30 |  |  | 
 | 
      
        | 31 |  |  | function save_setting($name, $value) {
 | 
      
        | 32 |  |  |     global $database;
 | 
      
        | 33 |  |  |     $prev_value = get_setting ( $name, '' );
 | 
      
        | 34 |  |  |     if($prev_value === false) {
 | 
      
        | 35 |  |  |         $sql   = 'INSERT INTO `'.TABLE_PREFIX.'mod_jsadmin` SET ';
 | 
      
        | 36 |  |  |     } else {
 | 
      
        | 37 |  |  |         $sql   = 'UPDATE `'.TABLE_PREFIX.'mod_jsadmin` SET ';
 | 
      
        | 38 |  |  |     }
 | 
      
        | 39 |  |  |         $sql  .= '`name`  = \''.$database->escapeString($name).'\', '
 | 
      
        | 40 |  |  |               . '`value`  = '.(int)$value.' '
 | 
      
        | 41 |  |  |               . 'WHERE `name` = \''.$database->escapeString($name).'\'';
 | 
      
        | 42 |  |  |         $database->query($sql);
 | 
      
        | 43 |  |  |         return $sql;
 | 
      
        | 44 |  |  | }
 | 
      
        | 45 |  |  | 
 | 
      
        | 46 |  |  | // the follwing variables to use and check existing the YUI
 | 
      
        | 47 |  |  | $WB_MAIN_RELATIVE_PATH="../..";
 | 
      
        | 48 |  |  | $YUI_PATH = '/include/yui';
 | 
      
        | 49 |  |  | $js_yui_min = "-min";  // option for smaller code so faster
 | 
      
        | 50 |  |  | $js_yui_scripts = Array();
 | 
      
        | 51 |  |  | $js_yui_scripts[] = $YUI_PATH.'/yahoo/yahoo'.$js_yui_min.'.js';
 | 
      
        | 52 |  |  | $js_yui_scripts[] = $YUI_PATH.'/event/event'.$js_yui_min.'.js';
 | 
      
        | 53 |  |  | $js_yui_scripts[] = $YUI_PATH.'/dom/dom'.$js_yui_min.'.js';
 | 
      
        | 54 |  |  | $js_yui_scripts[] = $YUI_PATH.'/connection/connection'.$js_yui_min.'.js';
 | 
      
        | 55 |  |  | $js_yui_scripts[] = $YUI_PATH.'/dragdrop/dragdrop'.$js_yui_min.'.js';
 |