Skip to content
Snippets Groups Projects
Select Git revision
  • d5d84ebf53d896c78ad8425b4ddafd7731c71cca
  • master default protected
2 results

lib_base.php

Blame
  • lib_base.php 9.77 KiB
    <?php
    
    /**
    * ownCloud
    *
    * @author Frank Karlitschek 
    * @copyright 2010 Frank Karlitschek karlitschek@kde.org 
    * 
    * This library is free software; you can redistribute it and/or
    * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
    * License as published by the Free Software Foundation; either 
    * version 3 of the License, or any later version.
    * 
    * This library is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
    *  
    * You should have received a copy of the GNU Lesser General Public 
    * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
    * 
    */
    
    
    // set some stuff
    ob_start();
    error_reporting(E_ALL | E_STRICT);
    date_default_timezone_set('Europe/Berlin');
    ini_set('arg_separator.output','&amp;');
    ini_set('session.cookie_httponly','1;');
    session_start();
    
    // calculate the documentroot
    $DOCUMENTROOT=substr(__FILE__,0,-17);
    $SERVERROOT=$_SERVER['DOCUMENT_ROOT'];
    $count=strlen($SERVERROOT);
    $WEBROOT=substr($DOCUMENTROOT,$count);
    //echo($WEBROOT);
    
    // set the right include path
    set_include_path(get_include_path().PATH_SEPARATOR.$DOCUMENTROOT.PATH_SEPARATOR.$DOCUMENTROOT.'/inc'.PATH_SEPARATOR.$DOCUMENTROOT.'/config');
    
    // define default config values
    $CONFIG_ADMINLOGIN='';
    $CONFIG_ADMINPASSWORD='';
    $CONFIG_DATADIRECTORY=$SERVERROOT.$WEBROOT.'/data';
    $CONFIG_HTTPFORCESSL=false;
    $CONFIG_DATEFORMAT='j M Y G:i';
    $CONFIG_DBHOST='localhost';
    $CONFIG_DBNAME='owncloud';
    $CONFIG_DBUSER='';
    $CONFIG_DBPASSWORD='';
    
    // include the generated configfile
    @include_once('config.php');
    
    // redirect to https site if configured
    if(isset($CONFIG_HTTPFORCESSL) and $CONFIG_HTTPFORCESSL){
      if(!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] != 'on') { 
        $url = "https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; 
        header("Location: $url"); 
        exit; 
      } 
    }
    
    // load core libs
    require_once('lib_files.php');
    require_once('lib_log.php');
    require_once('lib_config.php');