| 1 | 
        
            2
         | 
        
            Manuela
         | 
        <?php
  | 
      
      
        | 2 | 
        
         | 
        
         | 
        /**
  | 
      
      
        | 3 | 
        
         | 
        
         | 
         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  | 
      
      
        | 4 | 
        
         | 
        
         | 
         *
  | 
      
      
        | 5 | 
        
         | 
        
         | 
         * This program is free software: you can redistribute it and/or modify
  | 
      
      
        | 6 | 
        
         | 
        
         | 
         * it under the terms of the GNU General Public License as published by
  | 
      
      
        | 7 | 
        
         | 
        
         | 
         * the Free Software Foundation, either version 3 of the License, or
  | 
      
      
        | 8 | 
        
         | 
        
         | 
         * (at your option) any later version.
  | 
      
      
        | 9 | 
        
         | 
        
         | 
         *
  | 
      
      
        | 10 | 
        
         | 
        
         | 
         * This program is distributed in the hope that it will be useful,
  | 
      
      
        | 11 | 
        
         | 
        
         | 
         * but WITHOUT ANY WARRANTY; without even the implied warranty of
  | 
      
      
        | 12 | 
        
         | 
        
         | 
         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  | 
      
      
        | 13 | 
        
         | 
        
         | 
         * GNU General Public License for more details.
  | 
      
      
        | 14 | 
        
         | 
        
         | 
         *
  | 
      
      
        | 15 | 
        
         | 
        
         | 
         * You should have received a copy of the GNU General Public License
  | 
      
      
        | 16 | 
        
         | 
        
         | 
         * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  | 
      
      
        | 17 | 
        
         | 
        
         | 
         *
  | 
      
      
        | 18 | 
        
         | 
        
         | 
         * @category        include
  | 
      
      
        | 19 | 
        
         | 
        
         | 
         * @package         jscalendar
  | 
      
      
        | 20 | 
        
         | 
        
         | 
         * @subpackage      jscalendar-functions
  | 
      
      
        | 21 | 
        
         | 
        
         | 
         * @author          Dietmar Wöllbrink
  | 
      
      
        | 22 | 
        
         | 
        
         | 
         * @copyright       WebsiteBaker Org. e.V.
  | 
      
      
        | 23 | 
        
         | 
        
         | 
         * @link            http://websitebaker.org/
  | 
      
      
        | 24 | 
        
         | 
        
         | 
         * @license         http://www.gnu.org/licenses/gpl.html
  | 
      
      
        | 25 | 
        
         | 
        
         | 
         * @platform        WebsiteBaker 2.8.3
  | 
      
      
        | 26 | 
        
         | 
        
         | 
         * @requirements    PHP 5.3.6 and higher
  | 
      
      
        | 27 | 
        
         | 
        
         | 
         * @version         $Id$
  | 
      
      
        | 28 | 
        
         | 
        
         | 
         * @filesource      $HeadURL$
  | 
      
      
        | 29 | 
        
         | 
        
         | 
         * @lastmodified    $Date$
  | 
      
      
        | 30 | 
        
         | 
        
         | 
         *
  | 
      
      
        | 31 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 32 | 
        
         | 
        
         | 
        /* -------------------------------------------------------- */
  | 
      
      
        | 33 | 
        
         | 
        
         | 
        // $Id$
  | 
      
      
        | 34 | 
        
         | 
        
         | 
        // Must include code to stop this file being accessed directly
  | 
      
      
        | 35 | 
        
         | 
        
         | 
        if(!defined('WB_PATH')) {
 | 
      
      
        | 36 | 
        
         | 
        
         | 
            require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
  | 
      
      
        | 37 | 
        
         | 
        
         | 
            throw new IllegalFileException();
  | 
      
      
        | 38 | 
        
         | 
        
         | 
        } else {
 | 
      
      
        | 39 | 
        
         | 
        
         | 
            // convert string from jscalendar to timestamp.
  | 
      
      
        | 40 | 
        
         | 
        
         | 
            // converts dd.mm.yyyy and mm/dd/yyyy, with or without time.
  | 
      
      
        | 41 | 
        
         | 
        
         | 
            // strtotime() may fails with e.g. "dd.mm.yyyy" and PHP4
  | 
      
      
        | 42 | 
        
         | 
        
         | 
            function jscalendar_to_timestamp($str, $offset='') {
 | 
      
      
        | 43 | 
        
         | 
        
         | 
                $str = trim($str);
  | 
      
      
        | 44 | 
        
         | 
        
         | 
                if ($str == '0' || $str == ''){return('0');}
 | 
      
      
        | 45 | 
        
         | 
        
         | 
                if ($offset == '0'){$offset = '';}
 | 
      
      
        | 46 | 
        
         | 
        
         | 
                // convert to yyyy-mm-dd
  | 
      
      
        | 47 | 
        
         | 
        
         | 
                // "dd.mm.yyyy"?
  | 
      
      
        | 48 | 
        
         | 
        
         | 
                if(preg_match('/^\d{1,2}\.\d{1,2}\.\d{2}(\d{2})?/', $str)) {
 | 
      
      
        | 49 | 
        
         | 
        
         | 
                    $str = preg_replace('/^(\d{1,2})\.(\d{1,2})\.(\d{2}(\d{2})?)/', '$3-$2-$1', $str);
 | 
      
      
        | 50 | 
        
         | 
        
         | 
                }
  | 
      
      
        | 51 | 
        
         | 
        
         | 
                // "mm/dd/yyyy"?
  | 
      
      
        | 52 | 
        
         | 
        
         | 
                if(preg_match('#^\d{1,2}/\d{1,2}/(\d{2}(\d{2})?)#', $str)) {
 | 
      
      
        | 53 | 
        
         | 
        
         | 
                    $str = preg_replace('#^(\d{1,2})/(\d{1,2})/(\d{2}(\d{2})?)#', '$3-$1-$2', $str);
 | 
      
      
        | 54 | 
        
         | 
        
         | 
                }
  | 
      
      
        | 55 | 
        
         | 
        
         | 
                // use strtotime()
  | 
      
      
        | 56 | 
        
         | 
        
         | 
              if($offset!=''){
 | 
      
      
        | 57 | 
        
         | 
        
         | 
                  return(strtotime($str, $offset)-TIMEZONE);
  | 
      
      
        | 58 | 
        
         | 
        
         | 
              } else{
 | 
      
      
        | 59 | 
        
         | 
        
         | 
                  return(strtotime($str)-TIMEZONE);
  | 
      
      
        | 60 | 
        
         | 
        
         | 
              }
  | 
      
      
        | 61 | 
        
         | 
        
         | 
            }
  | 
      
      
        | 62 | 
        
         | 
        
         | 
        }
  |