[svn r10085] cleanup $_configuration

skala
Patrick Cool 19 years ago
parent d436cc87a8
commit 48285abda4
  1. 1
      index.php
  2. 4
      main/document/edit_document.php
  3. 2
      main/exercice/hotpotatoes.php
  4. 28
      main/inc/lib/add_course.lib.inc.php
  5. 2
      main/inc/lib/document.lib.php
  6. 4
      main/inc/lib/export.lib.inc.php
  7. 8
      main/inc/lib/groupmanager.lib.php
  8. 54
      main/inc/lib/main_api.lib.php
  9. 33
      main/install/configuration.dist.php
  10. 4
      whoisonline.php

@ -428,7 +428,6 @@ function display_lost_password_info()
function display_anonymous_course_list()
{
//init
global $coursesRepositoryWeb;
$web_course_path = api_get_path(WEB_COURSE_PATH);
$category = $_GET["category"];
$main_course_table = Database :: get_main_table(MAIN_COURSE_TABLE);

@ -1,4 +1,4 @@
<?php // $Id: edit_document.php 9985 2006-11-15 00:43:47Z pcool $
<?php // $Id: edit_document.php 10085 2006-11-21 20:42:52Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -87,7 +87,7 @@ $file_name = $doc;
//echo('file_name: '.$file_name.'<br>');
$baseServDir = api_get_path(SYS_COURSE_PATH);
$baseServUrl = $urlAppend."/";
$baseServUrl = $_configuration['url_append']."/";
$courseDir = $_course['path']."/document";
$baseWorkDir = $baseServDir.$courseDir;
$group_document = false;

@ -46,7 +46,7 @@ $is_allowedToEdit=(!empty($is_courseAdmin)?$is_courseAdmin:false);
//$dbTable = '`'.$_course['dbNameGlu']."document`";
$dbTable = Database::get_course_table(DOCUMENT_TABLE);
$baseServDir = $_configuration['root_sys'];
$baseServUrl = $urlAppend."/";
$baseServUrl = $_configuration['url_append']."/";
$document_sys_path = api_get_path(SYS_COURSE_PATH).$_course['path']."/document";
$uploadPath = "/HotPotatoes_files";

@ -83,7 +83,7 @@ function create_course($wanted_code, $title, $tutor_name, $category_code, $cours
*/
function define_course_keys($wantedCode, $prefix4all = "", $prefix4baseName = "", $prefix4path = "", $addUniquePrefix = false, $useCodeInDepedentKeys = true)
{
global $coursesRepositoryAppend, $prefixAntiNumber, $_configuration;
global $prefixAntiNumber, $_configuration;
$course_table = Database :: get_main_table(MAIN_COURSE_TABLE);
@ -174,7 +174,8 @@ function define_course_keys($wantedCode, $prefix4all = "", $prefix4baseName = ""
$finalSuffix['CourseDb'] = substr('_'.md5(uniqid(rand())), 0, 4);
}
if(file_exists($_configuration['root_sys'].$coursesRepositoryAppend.$keysCourseRepository))
// @todo: use and api_get_path here instead of constructing it by yourself
if(file_exists($_configuration['root_sys'].$_configuration['course_folder'].$keysCourseRepository))
{
$keysAreUnique = false;
@ -209,19 +210,18 @@ function define_course_keys($wantedCode, $prefix4all = "", $prefix4baseName = ""
*/
function prepare_course_repository($courseRepository, $courseId)
{
GLOBAL $coursesRepositorySys;
umask(0);
mkdir($coursesRepositorySys.$courseRepository, 0777);
mkdir($coursesRepositorySys.$courseRepository . "/document", 0777);
mkdir($coursesRepositorySys.$courseRepository . "/dropbox", 0777);
mkdir($coursesRepositorySys.$courseRepository . "/group", 0777);
mkdir($coursesRepositorySys.$courseRepository . "/page", 0777);
mkdir($coursesRepositorySys.$courseRepository . "/scorm", 0777);
mkdir($coursesRepositorySys.$courseRepository . "/temp", 0777);
mkdir($coursesRepositorySys.$courseRepository . "/work", 0777);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository, 0777);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/document", 0777);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/dropbox", 0777);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/group", 0777);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/page", 0777);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/scorm", 0777);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/temp", 0777);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/work", 0777);
//create .htaccess in dropbox
$fp = fopen($coursesRepositorySys.$courseRepository . "/dropbox/.htaccess", "w");
$fp = fopen(api_get_path(SYS_COURSE_PATH).$courseRepository . "/dropbox/.htaccess", "w");
fwrite($fp, "AuthName AllowLocalAccess
AuthType Basic
@ -232,7 +232,7 @@ function prepare_course_repository($courseRepository, $courseId)
fclose($fp);
// build index.php of course
$fd = fopen($coursesRepositorySys.$courseRepository . "/index.php", "w");
$fd = fopen(api_get_path(SYS_COURSE_PATH).$courseRepository . "/index.php", "w");
// str_replace() removes \r that cause squares to appear at the end of each line
$string = str_replace("\r", "", "<?" . "php
@ -242,7 +242,7 @@ function prepare_course_repository($courseRepository, $courseId)
include(\"../../main/course_home/course_home.php\");
?>");
fwrite($fd, "$string");
$fd = fopen($coursesRepositorySys.$courseRepository . "/group/index.php", "w");
$fd = fopen(api_get_path(SYS_COURSE_PATH).$courseRepository . "/group/index.php", "w");
$string = "<html></html>";
fwrite($fd, "$string");
return 0;

@ -58,7 +58,7 @@ define("DEFAULT_DOCUMENT_QUOTA", get_setting('default_document_quotum'));
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$baseServDir = api_get_path(SYS_PATH);
$baseServUrl = $urlAppend."/"; //WARNING do not use $urlAppend
$baseServUrl = $_configuration['url_append']."/";
$baseWorkDir = $sys_course_path.$courseDir;
/*

@ -309,7 +309,7 @@ function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = ""
{
GLOBAL $error_msg, $error_no, $db, $archiveRepositorySys, $archiveRepositoryWeb, // from configs files
$appendCourse, $appendMainDb, //
$archiveName, $_configuration, $clarolineRepositorySys, $_course, $coursesRepositorySys, $TABLEUSER, $TABLECOURSUSER, $TABLECOURS, $TABLEANNOUNCEMENT, $langArchiveName, $langArchiveLocation, $langSizeOf, $langDisk_free_space, $langCreateMissingDirectories, $langBUCourseDataOfMainBase, $langBUUsersInMainBase, $langBUAnnounceInMainBase, $langCopyDirectoryCourse, $langFileCopied, $langBackupOfDataBase, $langBuildTheCompressedFile;
$archiveName, $_configuration, $clarolineRepositorySys, $_course, $TABLEUSER, $TABLECOURSUSER, $TABLECOURS, $TABLEANNOUNCEMENT, $langArchiveName, $langArchiveLocation, $langSizeOf, $langDisk_free_space, $langCreateMissingDirectories, $langBUCourseDataOfMainBase, $langBUUsersInMainBase, $langBUAnnounceInMainBase, $langCopyDirectoryCourse, $langFileCopied, $langBackupOfDataBase, $langBuildTheCompressedFile;
////////////////////////////////////////////////////
// ****** 1° Check if all data needed are aivailable
// ****** 1° 1. $lang vars
@ -711,7 +711,7 @@ function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = ""
echo "
<LI>
".$langCopyDirectoryCourse;
$nbFiles = copydir($coursesRepositorySys.$_course['path'], $archiveDirOriginalDocs.$appendCourse, $verboseBackup);
$nbFiles = copydir(api_get_path(SYS_COURSE_PATH).$_course['path'], $archiveDirOriginalDocs.$appendCourse, $verboseBackup);
if ($verboseBackup)
echo "
<strong>

@ -145,8 +145,8 @@ class GroupManager
function create_group($name, $category_id, $tutor, $places)
{
global $_course,$_user;
$currentCourseRepository = $_course['path'];
$coursesRepositorySys = api_get_path(SYS_COURSE_PATH);
$table_group = Database :: get_course_table(GROUP_TABLE);
$table_forum = Database :: get_course_table(FORUM_TABLE);
$category = GroupManager :: get_category($category_id);
@ -158,14 +158,14 @@ class GroupManager
api_sql_query($sql,__FILE__,__LINE__);
$lastId = mysql_insert_id();
/*$secret_directory = uniqid("")."_team_".$lastId;
while (is_dir($coursesRepositorySys.$currentCourseRepository."/group/$secret_directory"))
while (is_dir(api_get_path(SYS_COURSE_PATH).$currentCourseRepository."/group/$secret_directory"))
{
$secret_directory = uniqid("")."_team_".$lastId;
}
FileManager :: mkdirs($coursesRepositorySys.$currentCourseRepository."/group/".$secret_directory, 0777);
FileManager :: mkdirs(api_get_path(SYS_COURSE_PATH).$currentCourseRepository."/group/".$secret_directory, 0777);
*/
$desired_dir_name= '/'.replace_dangerous_char($name,'strict').'_groupdocs';
$dir_name = create_unexisting_directory($_course,$_user['user_id'],$lastId,NULL,$coursesRepositorySys.$currentCourseRepository.'/document',$desired_dir_name);
$dir_name = create_unexisting_directory($_course,$_user['user_id'],$lastId,NULL,api_get_path(SYS_COURSE_PATH).$currentCourseRepository.'/document',$desired_dir_name);
/* Stores the directory path into the group table */
$sql = "UPDATE ".$table_group." SET name = '".mysql_real_escape_string($name)."', secret_directory = '".$dir_name."' WHERE id ='".$lastId."'";
api_sql_query($sql,__FILE__,__LINE__);

@ -242,7 +242,7 @@ function api_is_self_registration_allowed()
* Returns a full path to a certain Dokeos area, which you specify
* through a parameter.
*
* See $coursesRepositoryAppend in the configuration.php
* See $_configuration['course_folder'] in the configuration.php
* to alter the WEB_COURSE_PATH and SYS_COURSE_PATH parameters.
*
* @param one of the following constants:
@ -250,26 +250,66 @@ function api_is_self_registration_allowed()
* REL_COURSE_PATH, REL_CLARO_PATH, WEB_CODE_PATH, SYS_CODE_PATH,
* SYS_LANG_PATH, WEB_IMG_PATH, GARBAGE_PATH, PLUGIN_PATH, SYS_ARCHIVE_PATH,
* INCLUDE_PATH, LIBRARY_PATH, CONFIGURATION_PATH
*
* @example assume that your server root is /var/www/ dokeos is installed in a subfolder dokeos/ and the URL of your campus is http://www.mydokeos.com
* The other configuration paramaters have not been changed.
* The different api_get_paths will give
* WEB_PATH http://www.mydokeos.com
* SYS_PATH /var/www/
* REL_PATH dokeos/
* WEB_COURSE_PATH http://www.mydokeos.com/courses/
* SYS_COURSE_PATH /var/www/dokeos/courses/
* REL_COURSE_PATH
* REL_CLARO_PATH
* WEB_CODE_PATH
* SYS_CODE_PATH
* SYS_LANG_PATH
* WEB_IMG_PATH
* GARBAGE_PATH
* PLUGIN_PATH
* SYS_ARCHIVE_PATH
* INCLUDE_PATH
* LIBRARY_PATH
* CONFIGURATION_PATH
*/
function api_get_path($path_type)
{
global $_configuration;
switch ($path_type)
{
case WEB_PATH :
return $GLOBALS['rootWeb'];
// example: http://www.mydokeos.com
return $_configuration['root_web'];
break;
case SYS_PATH :
return $GLOBALS['rootSys'];
// example: /var/www/
return $_configuration['root_sys'];
break;
case REL_PATH :
return (substr($GLOBALS['urlAppend'], -1) === '/' ? $GLOBALS['urlAppend'] : $GLOBALS['urlAppend'].'/');
// example: dokeos/
if (substr($GLOBALS['urlAppend'], -1) === '/')
{
return $_configuration['url_append'];
}
else
{
return $_configuration['url_append'].'/';
}
break;
case WEB_COURSE_PATH :
return $GLOBALS['coursesRepositoryWeb'];
// example: http://www.mydokeos.com/courses/
return $_configuration['root_web'].$_configuration['course_folder'];
break;
case SYS_COURSE_PATH :
return $GLOBALS['coursesRepositorySys'];
// example: /var/www/dokeos/courses/
return $_configuration['root_sys'].$_configuration['course_folder'];
break;
case REL_COURSE_PATH :
return api_get_path(REL_PATH).$GLOBALS['coursesRepositoryAppend'];
break;
@ -1498,7 +1538,7 @@ function api_get_languages()
*/
function api_disp_html_area($name, $content = '', $height = '', $width = '100%', $optAttrib = '')
{
global $urlAppend, $_course, $fck_attribute;
global $_configuration, $_course, $fck_attribute;
require_once(dirname(__FILE__).'/formvalidator/Element/html_editor.php');
$editor = new HTML_QuickForm_html_editor($name);
$editor->setValue($content);

@ -85,24 +85,33 @@ $_configuration['user_personal_database'] ='{DATABASE_PERSONAL}';
//============================================================================
// Directory settings
//============================================================================
// URL to the root of your Dokeos installation
// URL to the root of your Dokeos installation, example: http://www.mydokeos.com
$_configuration['root_web'] = '{ROOT_WEB}';
// Path to the root of your Dokeos installation
// Path to the webroot of system, example: /var/www
$_configuration['root_sys'] = '{ROOT_SYS}';
// Path from your WWW-root to the root of your Dokeos installation
$urlAppend = '{URL_APPEND_PATH}';
// Directory of the Dokeos code
$clarolineRepositoryAppend = "main/";
// Directory to store all course-related files
$coursesRepositoryAppend = "courses/";
// Path from your WWW-root to the root of your Dokeos installation, example: dokeos (this means dokeos is installed in /var/www/dokeos/
$_configuration['url_append'] = '{URL_APPEND_PATH}';
// Directory of the Dokeos code. You could change this but it is not advised since this has not been tested yet.
$_configuration['code_append'] = "main/";
// Directory to store all course-related files. You could change this but it is not advised since this has not been tested yet.
$_configuration['course_folder'] = "courses/";
// @todo this shouldn't be here.
// Directory of the admin-area
$rootAdminAppend = "admin/";
// Do not change the following values
// @todo should be moved to api_get_path
$clarolineRepositorySys = $_configuration['root_sys'].$clarolineRepositoryAppend;
$clarolineRepositoryWeb = $_configuration['root_web'].$clarolineRepositoryAppend;
$coursesRepositorySys = $_configuration['root_sys'].$coursesRepositoryAppend;
$coursesRepositoryWeb = $_configuration['root_web'].$coursesRepositoryAppend;
$clarolineRepositorySys = $_configuration['root_sys'].$_configuration['code_append'];
$clarolineRepositoryWeb = $_configuration['root_web'].$_configuration['code_append'];
$rootAdminSys = $clarolineRepositorySys.$rootAdminAppend;
$rootAdminWeb = $clarolineRepositoryWeb.$rootAdminAppend;
// directory to store archived courses

@ -1,4 +1,4 @@
<?php // $Id: whoisonline.php 10082 2006-11-21 19:08:15Z pcool $
<?php // $Id: whoisonline.php 10085 2006-11-21 20:42:52Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -60,7 +60,7 @@ if ($_GET['chatid'] != '')
$result=api_sql_query($sql,__FILE__,__LINE__);
//redirect caller to chat
header("Location: ".$clarolineRepositoryAppend."chat/chat.php?cidReq=".$_cid."&origin=whoisonline&target=$chatid");
header("Location: ".$_configuration['code_append']."chat/chat.php?cidReq=".$_cid."&origin=whoisonline&target=$chatid");
exit();
}

Loading…
Cancel
Save