<?php // $Id: path.lib.php 9707 2007-12-12 13:46:31Z mlaurent $
if ( count( get_included_files() ) == 1 ) die( '---' );
/**
 * CLAROLINE
 *
 * built url and system paths
 *
 * @version 1.8 $Revision: 9707 $
 *
 * @copyright (c) 2001-2007 Universite catholique de Louvain (UCL)
 *
 * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 *
 * @author see 'credits' file
 *
 * @since claroline 1.8.3
 *
 * @package KERNEL
 *
 */


/**
Http://www.domain.tld/whereisMyCampus/claroline/blah

$rootWeb    = Http://www.domain.tld/whereisMyCampus/claroline/blah
$hostWeb    = Http://www.domain.tld
$urlAppend  = /whereisMyCampus/claroline/blah
$clarolineRepositorySys = Http://www.domain.tld/whereisMyCampus/claroline

*/
/**
 * Return a common path of claroline
 *
 * @param string $pathKey key name of the path ( varname in previous version of claroline)
 * @author Christophe Gesché <moosh@claroline.net>
 * @return path
 */
function get_path($pathKey)
{
    static $pathList = array() ;

    if ( count($pathList) == 0 )
    {
        $rootPath = dirname(dirname(dirname(dirname(__FILE__))));

        // root path
        $pathList['rootSys'] =  $rootPath . '/' ;
        $pathList['includePath'] =  $rootPath . '/claroline/inc' ;
        $pathList['incRepositorySys'] =  $rootPath . '/claroline/inc' ;

        // root url
        $pathList['url'] =  get_conf('urlAppend');
        $pathList['rootWeb'] =  get_conf('rootWeb') ;

        // append path
        $pathList['imgRepositoryAppend'] =  'claroline/img/'; // <-this line would be editable in claroline 1.7
        $pathList['coursesRepositoryAppend'] =  get_conf('coursesRepositoryAppend','courses/');

        // root path + append path
        $pathList['clarolineRepositorySys'] =  $rootPath . '/claroline/' ;
        $pathList['coursesRepositorySys'] =  $rootPath . '/' . $pathList['coursesRepositoryAppend'] ;
        $pathList['rootAdminSys'] =  $rootPath . '/claroline/admin/' ;
        $pathList['imgRepositorySys'] =  $rootPath . '/' . $pathList['imgRepositoryAppend'];

        // root url + append path
        $pathList['coursesRepositoryWeb'] =  $pathList['url'] . '/' . $pathList['coursesRepositoryAppend'];
        $pathList['imgRepositoryWeb'] = $pathList['url']  . '/' . $pathList['imgRepositoryAppend'];
        $pathList['clarolineRepositoryWeb'] =  $pathList['url'] . '/claroline/';
        $pathList['rootAdminWeb'] =  $pathList['url'] . '/claroline/admin/';

        // path special case
        $pathList['garbageRepositorySys'] =  get_conf('garbageRepositorySys');
        $pathList['mysqlRepositorySys'] =  get_conf('mysqlRepositorySys');
    }

    if ( array_key_exists( $pathKey, $pathList ) )
    {
        return $pathList[$pathKey];
    }
    else
    {
        trigger_error('Claroline : Unknown path name "' . $pathKey . '" passed to get_path function' , E_USER_NOTICE);
        return false;
    }

}

?>
