skala
Julio Montoya 16 years ago
commit 71436b6bd3
  1. 34
      index.php
  2. 32
      main/admin/access_url_add_courses_to_url.php
  3. 28
      main/admin/access_url_add_sessions_to_url.php
  4. 35
      main/admin/access_url_add_users_to_url.php
  5. 2
      main/admin/access_url_edit.php
  6. 28
      main/admin/access_url_edit_courses_to_url.php
  7. 28
      main/admin/access_url_edit_sessions_to_url.php
  8. 30
      main/admin/access_url_edit_users_to_url.php
  9. 10
      main/admin/access_urls.php
  10. 33
      main/create_course/add_course.php
  11. 95
      main/inc/global.inc.php
  12. 139
      main/inc/lib/main_api.lib.php
  13. 7
      main/inc/lib/usermanager.lib.php
  14. 3
      main/install/db_main.sql

@ -20,19 +20,17 @@ $language_file = array('courses', 'index');
// Maybe we should change this into an api function? an example: Coursemanager::unset();
$cidReset = true;
/*
Included libraries
*/
/* Included libraries */
/** @todo make all the library files consistent, use filename.lib.php and not filename.lib.inc.php */
require_once 'main/inc/global.inc.php';
include_once api_get_path(LIBRARY_PATH).'course.lib.php';
include_once api_get_path(LIBRARY_PATH).'debug.lib.inc.php';
include_once api_get_path(LIBRARY_PATH).'events.lib.inc.php';
include_once api_get_path(LIBRARY_PATH).'system_announcements.lib.php';
include_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
include_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(LIBRARY_PATH).'debug.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'events.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'system_announcements.lib.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once 'main/chat/chat_functions.lib.php';
$loginFailed = isset($_GET['loginFailed']) ? true : isset($loginFailed);
@ -41,9 +39,7 @@ $setting_show_also_closed_courses = api_get_setting('show_closed_courses') == 't
// the section (for the tabs)
$this_section = SECTION_CAMPUS;
/*
Action Handling
*/
/* Action Handling */
/** @todo Wouldn't it make more sense if this would be done in local.inc.php so that local.inc.php become the only place where authentication is done?
* by doing this you could logout from any page instead of only from index.php. From the moment there is a logout=true in the url you will be logged out
@ -56,16 +52,12 @@ if (!empty($_GET['logout'])) {
logout();
}
/*
Table definitions
*/
/* Table definitions */
$main_course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
$main_category_table = Database :: get_main_table(TABLE_MAIN_CATEGORY);
$track_login_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
/*
Constants and CONFIGURATION parameters
*/
/* Constants and CONFIGURATION parameters */
/** @todo these configuration settings should move to the dokeos config settings */
/** defines wether or not anonymous visitors can see a list of the courses on the Dokeos homepage that are open to the world */
$_setting['display_courses_to_anonymous_users'] = 'true';
@ -75,9 +67,7 @@ if (isset($_user['user_id'])) {
$nameTools = api_get_setting('siteName');
}
/*
LOGIN
*/
/* LOGIN */
/**
* @todo This piece of code should probably move to local.inc.php where the actual login / logout procedure is handled.

@ -1,44 +1,24 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2009 Dokeos SPRL
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /license.txt */
/**
==============================================================================
* This script allows platform admins to add users to urls.
* It displays a list of users and a list of courses;
* you can select multiple users and courses and then click on
* @package dokeos.admin
==============================================================================
* @package chamilo.admin
*/
// name of the language file that needs to be included
$language_file = 'admin';
$cidReset = true;
require ('../inc/global.inc.php');
require_once '../inc/global.inc.php';
$this_section=SECTION_PLATFORM_ADMIN;
require_once (api_get_path(LIBRARY_PATH).'urlmanager.lib.php');
api_protect_admin_script();
if (!$_configuration['multiple_access_urls'])
if (!$_configuration['multiple_access_urls']) {
header('Location: index.php');
exit;
}
/*
-----------------------------------------------------------

@ -1,38 +1,16 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2009 Dokeos SPRL
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /license.txt */
/**
==============================================================================
* This script allows platform admins to add users to urls.
* It displays a list of users and a list of courses;
* you can select multiple users and courses and then click on
* @package dokeos.admin
==============================================================================
* @package chamilo.admin
*/
// name of the language file that needs to be included
$language_file = 'admin';
$cidReset = true;
require ('../inc/global.inc.php');
require_once '../inc/global.inc.php';
$this_section=SECTION_PLATFORM_ADMIN;
require_once (api_get_path(LIBRARY_PATH).'urlmanager.lib.php');

@ -1,43 +1,24 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2009 Dokeos SPRL
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/**
==============================================================================
* This script allows platform admins to add users to urls.
/* For licensing terms, see /license.txt */
/**
* This script allows platform admins to add users to urls.
* It displays a list of users and a list of courses;
* you can select multiple users and courses and then click on
* @package dokeos.admin
==============================================================================
* @package chamilo.admin
*/
// name of the language file that needs to be included
$language_file = 'admin';
$cidReset = true;
require ('../inc/global.inc.php');
require_once '../inc/global.inc.php';
$this_section=SECTION_PLATFORM_ADMIN;
require_once (api_get_path(LIBRARY_PATH).'urlmanager.lib.php');
api_protect_admin_script();
if (!$_configuration['multiple_access_urls'])
if (!$_configuration['multiple_access_urls']) {
header('Location: index.php');
exit;
}
/*
-----------------------------------------------------------

@ -120,5 +120,5 @@ if (isset ($_GET['action'])) {
}
// Submit button
$form->addElement('submit', 'submit', $submit_name);
$form->addElement('style_submit_button', 'submit', $submit_name, 'class="add"');
$form->display();

@ -1,30 +1,10 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2009 Dokeos SPRL
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /license.txt */
/**
==============================================================================
* @package dokeos.admin
==============================================================================
* @package chamilo.admin
*/
// name of the language file that needs to be included
$language_file='admin';
@ -32,7 +12,7 @@ $language_file='admin';
$cidReset=true;
// including some necessary dokeos files
require('../inc/global.inc.php');
require_once '../inc/global.inc.php';
require_once (api_get_path(LIBRARY_PATH).'urlmanager.lib.php');
require_once (api_get_path(LIBRARY_PATH).'access_url_edit_courses_to_url_functions.lib.php');

@ -1,30 +1,10 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2009 Dokeos SPRL
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /license.txt */
/**
==============================================================================
* @package dokeos.admin
==============================================================================
* @package chamilo.admin
*/
// name of the language file that needs to be included
$language_file='admin';
@ -32,7 +12,7 @@ $language_file='admin';
$cidReset=true;
// including some necessary dokeos files
require('../inc/global.inc.php');
require_once '../inc/global.inc.php';
require_once (api_get_path(LIBRARY_PATH).'urlmanager.lib.php');
require_once (api_get_path(LIBRARY_PATH).'access_url_edit_sessions_to_url_functions.lib.php');

@ -1,30 +1,10 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2009 Dokeos SPRL
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /license.txt */
/**
==============================================================================
* @package dokeos.admin
==============================================================================
* @package chamilo.admin
*/
// name of the language file that needs to be included
$language_file='admin';
@ -32,7 +12,7 @@ $language_file='admin';
$cidReset=true;
// including some necessary dokeos files
require('../inc/global.inc.php');
require_once '../inc/global.inc.php';
require_once (api_get_path(LIBRARY_PATH).'urlmanager.lib.php');
require_once ('../inc/lib/xajax/xajax.inc.php');
@ -157,7 +137,7 @@ if($ajax_search) {
}
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
$sql="SELECT u.user_id, lastname, firstname, username
FROM $tbl_user u".
FROM $tbl_user u WHERE status <> ".ANONYMOUS." ".
$order_clause;
$result=Database::query($sql);
$Users=Database::store_result($result);

@ -1,15 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
/**
==============================================================================
* @package chamilo.admin
==============================================================================
*/
// name of the language file that needs to be included
$language_file = 'admin';
$cidReset = true;
require '../inc/global.inc.php';
require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
@ -63,7 +61,7 @@ if (isset ($_GET['action'])) {
foreach($url_list as $my_url) {
if (!in_array($my_url['id'],$my_user_url_list)){
UrlManager::add_user_to_url(api_get_user_id(),$my_url['id']);
$url_str.=$my_url['url'].' ';
$url_str.=$my_url['url'].' <br />';
}
}
Display :: display_normal_message(get_lang('AdminUserRegisteredToThisURL').': '.$url_str.'<br />',false);
@ -84,11 +82,11 @@ $url_string='';
$my_user_url_list = api_get_access_url_from_user(api_get_user_id());
foreach($url_list as $my_url) {
if (!in_array($my_url['id'],$my_user_url_list)){
$url_string.=$my_url['url'].' ';
$url_string.=$my_url['url'].' <br />';
}
}
if(!empty($url_string)) {
Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').':<br />'.$url_string,false);
Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string,false);
}
// checking the current installation

@ -1,13 +1,10 @@
<?php
// $Id: add_course.php 20588 2009-05-13 12:34:18Z pcool $
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /license.txt */
/**
==============================================================================
* This script allows professors and administrative staff to create course sites.
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @author Roan Embrechts, refactoring
* @package dokeos.create_course
==============================================================================
*/
// name of the language file that needs to be included
@ -17,21 +14,21 @@ $language_file = "create_course";
$cidReset = true; // Flag forcing the 'current course' reset
// including the global file
include ('../inc/global.inc.php');
require_once '../inc/global.inc.php';
// section for the tabs
$this_section=SECTION_COURSES;
$this_section = SECTION_COURSES;
// include configuration file
include (api_get_path(CONFIGURATION_PATH).'add_course.conf.php');
require_once api_get_path(CONFIGURATION_PATH).'add_course.conf.php';
// include additional libraries
include_once (api_get_path(LIBRARY_PATH).'add_course.lib.inc.php');
include_once (api_get_path(LIBRARY_PATH).'course.lib.php');
include_once (api_get_path(LIBRARY_PATH).'debug.lib.inc.php');
include_once (api_get_path(LIBRARY_PATH).'fileManage.lib.php');
include_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
include_once (api_get_path(CONFIGURATION_PATH).'course_info.conf.php');
// require_once additional libraries
require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(LIBRARY_PATH).'debug.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(CONFIGURATION_PATH).'course_info.conf.php';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
$htmlHeadXtra[] = '<script type="text/javascript">
@ -156,9 +153,5 @@ if ($form->validate()) {
$form->display();
Display::display_normal_message(get_lang('Explanation'));
}
/*
==============================================================================
FOOTER
==============================================================================
*/
Display :: display_footer();
/* FOOTER */
Display :: display_footer();

@ -1,7 +1,6 @@
<?php
/**
==============================================================================
* It is recommended that ALL dokeos scripts include this important file.
* It is recommended that ALL Chamilo scripts include this important file.
* This script manages
* - http get, post, post_files, session, server-vars extraction into global namespace;
* (which doesn't occur anymore when servertype config setting is set to test,
@ -18,7 +17,6 @@
* but use a redirect immediately. By doing so the $already_installed variable can be removed.
* @todo make it possible to enable / disable the tracking through the Dokeos config page.
*
==============================================================================
*/
// Showing/hiding error codes in global error messages.
@ -74,16 +72,6 @@ require_once $includePath.'/lib/main_api.lib.php';
// Do not over-use this variable. It is only for this script's local use.
$lib_path = api_get_path(LIBRARY_PATH);
// Start session.
api_session_start($already_installed);
if (!$already_installed) {
$global_error_code = 2;
// The system has not been installed yet.
require $includePath.'/global_error_message.inc.php';
die();
}
// Fix bug in IIS that doesn't fill the $_SERVER['REQUEST_URI'].
api_request_uri();
@ -100,6 +88,9 @@ require_once $lib_path.'text.lib.php';
require_once $lib_path.'security.lib.php';
require_once $lib_path.'events.lib.inc.php';
/* DATABASE CONNECTION */
// @todo: this shouldn't be done here. It should be stored correctly during installation.
if (empty($_configuration['statistics_database']) && $already_installed) {
$_configuration['statistics_database'] = $_configuration['main_database'];
@ -125,6 +116,37 @@ if (!$_configuration['db_host']) {
die();
}
/* RETRIEVING ALL THE CHAMILO CONFIG SETTINGS FOR MULTIPLE URLs FEATURE*/
if (!empty($_configuration['multiple_access_urls'])) {
$_configuration['access_url'] = 1;
$access_urls = api_get_access_urls();
$protocol = ((!empty($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) != 'OFF') ? 'https' : 'http').'://';
$request_url1 = $protocol.$_SERVER['SERVER_NAME'].'/';
$request_url2 = $protocol.$_SERVER['HTTP_HOST'].'/';
foreach ($access_urls as & $details) {
if ($request_url1 == $details['url'] or $request_url2 == $details['url']) {
$_configuration['access_url'] = $details['id'];
}
}
} else {
$_configuration['access_url'] = 1;
}
// This function is moved here after the database connections was made since api_session_start will call the api_get_path() function and this function will call a Database function
// Start session.
api_session_start($already_installed);
if (!$already_installed) {
$global_error_code = 2;
// The system has not been installed yet.
require $includePath.'/global_error_message.inc.php';
die();
}
// The system has not been designed to use special SQL modes that were introduced since MySQL 5.
Database::query("set session sql_mode='';");
@ -135,11 +157,7 @@ if (!Database::select_db($_configuration['main_database'], $dokeos_database_conn
die();
}
/*
--------------------------------------------
Initialization of the default encodings
--------------------------------------------
*/
/* Initialization of the default encodings */
// The platform's character set must be retrieved at this early moment.
$sql = "SELECT selected_value FROM settings_current WHERE variable = 'platform_charset';";
$result = Database::query($sql);
@ -162,27 +180,6 @@ Database::query("SET SESSION character_set_server='utf8';");
Database::query("SET SESSION collation_server='utf8_general_ci';");
Database::query("SET CHARACTER SET '" . Database::to_db_encoding($charset) . "';");
/*
--------------------------------------------
RETRIEVING ALL THE DOKEOS CONFIG SETTINGS
--------------------------------------------
*/
if (!empty($_configuration['multiple_access_urls'])) {
$_configuration['access_url'] = 1;
$access_urls = api_get_access_urls();
$protocol = ((!empty($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) != 'OFF') ? 'https' : 'http').'://';
$request_url1 = $protocol.$_SERVER['SERVER_NAME'].'/';
$request_url2 = $protocol.$_SERVER['HTTP_HOST'].'/';
foreach ($access_urls as & $details) {
if ($request_url1 == $details['url'] or $request_url2 == $details['url']) {
$_configuration['access_url'] = $details['id'];
}
}
} else {
$_configuration['access_url'] = 1;
}
// access_url == 1 is the default dokeos location
if ($_configuration['access_url'] != 1) {
$url_info = api_get_access_url($_configuration['access_url']);
@ -273,11 +270,9 @@ if (!$x = strpos($_SERVER['PHP_SELF'], 'whoisonline.php')) {
if (api_get_setting('server_type') == 'test') {
/*
--------------------------------------------
Server type is test
Server type is test
- high error reporting level
- only do addslashes on $_GET and $_POST
--------------------------------------------
*/
if (IS_PHP_53) {
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
@ -305,11 +300,9 @@ if (api_get_setting('server_type') == 'test') {
}
} else {
/*
--------------------------------------------
Server type is not test
- normal error reporting level
- full fake register globals block
--------------------------------------------
*/
error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR);
@ -343,11 +336,7 @@ if (api_get_setting('server_type') == 'test') {
}
}
/*
-----------------------------------------------------------
LOAD LANGUAGE FILES SECTION
-----------------------------------------------------------
*/
/* LOAD LANGUAGE FILES SECTION */
// if we use the javascript version (without go button) we receive a get
// if we use the non-javascript version (with the go button) we receive a post
@ -383,7 +372,7 @@ if (api_get_self() == api_get_path(REL_PATH).'main/admin/sub_language.php' || ap
$lang_list_result = array_diff($lang_list_post, $lang_list_pre);
unset($lang_list_pre);
// ------ english language array
// english language array
$english_language_array[$language_file_item] = compact($lang_list_result);
//cleaning the variables
@ -395,7 +384,7 @@ if (api_get_self() == api_get_path(REL_PATH).'main/admin/sub_language.php' || ap
include_once $parent_file;
}
// ------ parent language array
// parent language array
$parent_language_array[$language_file_item] = compact($lang_list_result);
//cleaning the variables
@ -407,7 +396,7 @@ if (api_get_self() == api_get_path(REL_PATH).'main/admin/sub_language.php' || ap
include $sub_file;
}
// ------ sub language array
// sub language array
$sub_language_array[$language_file_item] = compact($lang_list_result);
//cleaning the variables
@ -532,4 +521,4 @@ if ($_configuration['tracking_enabled'] && !isset($_SESSION['login_as']) && isse
$s_sql_update_logout_date = "UPDATE $tbl_track_login SET logout_date=NOW() WHERE login_id='$i_id_last_connection'";
Database::query($s_sql_update_logout_date);
}
}
}

@ -335,8 +335,7 @@ function api_get_path($path_type, $path = null) {
);
static $is_this_function_initialized;
static $include_path_sys;
//static $include_path_sys; //deprecated
static $server_base_web; // No trailing slash.
static $server_base_sys; // No trailing slash.
static $root_web;
@ -344,40 +343,39 @@ function api_get_path($path_type, $path = null) {
static $root_rel;
static $code_folder;
static $course_folder;
//always load root_web modifications for multiple url features
global $_configuration;
//default $_configuration['root_web'] configuration
$root_web = $_configuration['root_web'];
// Configuration data for already installed system.
$root_sys = $_configuration['root_sys'];
$load_new_config = false;
// To avoid that the api_get_access_url() function fails since global.inc.php also calls the main_api.lib.php
if ($path_type == WEB_PATH) {
if (isset($_configuration['access_url']) && $_configuration['access_url'] != 1) {
//we look into the DB the function api_get_access_url
$url_info = api_get_access_url($_configuration['access_url']);
$root_web = $url_info['active'] == 1 ? $url_info['url'] : $_configuration['root_web'];
$load_new_config = true;
}
}
if (!$is_this_function_initialized) {
global $_configuration;
$include_path_sys = str_replace('\\', '/', realpath(dirname(__FILE__).'/../')).'/';
//
// Configuration data for already installed system.
//
$root_sys = $_configuration['root_sys'];
if (!isset($_configuration['access_url']) || $_configuration['access_url'] == 1 || $_configuration['access_url'] == '') {
//by default we call the $_configuration['root_web'] we don't query to the DB
//$url_info= api_get_access_url(1);
//$root_web = $url_info['url'];
if (isset($_configuration['root_web'])) {
$root_web = $_configuration['root_web'];
}
// Ivan: Just a formal note, here $root_web stays unset, reason about this is unknown.
} else {
//we look into the DB the function api_get_access_url
//this funcion have a problem because we can't called to the Database:: functions
$url_info = api_get_access_url($_configuration['access_url']);
$root_web = $url_info['active'] == 1 ? $url_info['url'] : $_configuration['root_web'];
}
$root_rel = $_configuration['url_append'];
$code_folder = $_configuration['code_append'];
$course_folder = $_configuration['course_folder'];
$root_rel = $_configuration['url_append'];
$code_folder = $_configuration['code_append'];
$course_folder = $_configuration['course_folder'];
//
// Support for the installation process.
// Developers might use the function api_get_path() directly or indirectly (this is difficult to be traced), at the moment when
// configuration has not been created yet. This is why this function should be upgraded to return correct results in this case.
//
if (defined('SYSTEM_INSTALLATION') && SYSTEM_INSTALLATION) {
if (($pos = strpos(($requested_page_rel = api_get_self()), 'main/install')) !== false) {
$root_rel = substr($requested_page_rel, 0, $pos);
@ -403,60 +401,72 @@ function api_get_path($path_type, $path = null) {
}
// Dealing with trailing slashes.
$root_web = api_add_trailing_slash($root_web);
$root_sys = api_add_trailing_slash($root_sys);
$root_rel = api_add_trailing_slash($root_rel);
$code_folder = api_add_trailing_slash($code_folder);
$course_folder = api_add_trailing_slash($course_folder);
$root_web = api_add_trailing_slash($root_web);
$root_sys = api_add_trailing_slash($root_sys);
$root_rel = api_add_trailing_slash($root_rel);
$code_folder = api_add_trailing_slash($code_folder);
$course_folder = api_add_trailing_slash($course_folder);
// Web server base and system server base.
$server_base_web = preg_replace('@'.$root_rel.'$@', '', $root_web); // No trailing slash.
$server_base_sys = preg_replace('@'.$root_rel.'$@', '', $root_sys); // No trailing slash.
//
// Initialization of a table taht contains common-purpose paths.
$paths[WEB_PATH] = $root_web;
$paths[SYS_PATH] = $root_sys;
$paths[REL_PATH] = $root_rel;
$paths[WEB_SERVER_ROOT_PATH] = $server_base_web.'/';
$paths[SYS_SERVER_ROOT_PATH] = $server_base_sys.'/';
$paths[WEB_COURSE_PATH] = $root_web.$course_folder;
$paths[SYS_COURSE_PATH] = $root_sys.$course_folder;
$paths[REL_COURSE_PATH] = $root_rel.$course_folder;
$paths[REL_CODE_PATH] = $root_rel.$code_folder;
$paths[WEB_CODE_PATH] = $root_web.$code_folder;
$paths[WEB_PATH] = $root_web;
$paths[SYS_PATH] = $root_sys;
$paths[REL_PATH] = $root_rel;
$paths[WEB_SERVER_ROOT_PATH] = $server_base_web.'/';
$paths[SYS_SERVER_ROOT_PATH] = $server_base_sys.'/';
$paths[WEB_COURSE_PATH] = $root_web.$course_folder;
$paths[SYS_COURSE_PATH] = $root_sys.$course_folder;
$paths[REL_COURSE_PATH] = $root_rel.$course_folder;
$paths[REL_CODE_PATH] = $root_rel.$code_folder;
$paths[WEB_CODE_PATH] = $root_web.$code_folder;
// Elimination of an obsolete configuration setting.
//$paths[SYS_CODE_PATH] = $GLOBALS['clarolineRepositorySys'];
$paths[SYS_CODE_PATH] = $root_sys.$code_folder;
//$paths[SYS_CODE_PATH] = $GLOBALS['clarolineRepositorySys'];
$paths[SYS_CODE_PATH] = $root_sys.$code_folder;
//
// Now we can switch into api_get_path() "terminology".
$paths[SYS_LANG_PATH] = $paths[SYS_CODE_PATH].$paths[SYS_LANG_PATH];
$paths[WEB_IMG_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_IMG_PATH];
$paths[SYS_LANG_PATH] = $paths[SYS_CODE_PATH].$paths[SYS_LANG_PATH];
$paths[WEB_IMG_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_IMG_PATH];
// TODO: This path may depend on the configuration option? To be researched.
// Maybe a new constant like WEB_USER_CSS_PATH has to be defined?
$paths[WEB_CSS_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_CSS_PATH];
$paths[WEB_CSS_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_CSS_PATH];
//
$paths[GARBAGE_PATH] = $paths[SYS_PATH].$paths[GARBAGE_PATH]; // Deprecated?
$paths[SYS_PLUGIN_PATH] = $paths[SYS_PATH].$paths[SYS_PLUGIN_PATH];
$paths[WEB_PLUGIN_PATH] = $paths[WEB_PATH].$paths[WEB_PLUGIN_PATH];
$paths[SYS_ARCHIVE_PATH] = $paths[SYS_PATH].$paths[SYS_ARCHIVE_PATH];
$paths[WEB_ARCHIVE_PATH] = $paths[WEB_PATH].$paths[WEB_ARCHIVE_PATH];
$paths[SYS_TEST_PATH] = $paths[SYS_PATH].$paths[SYS_TEST_PATH];
$paths[GARBAGE_PATH] = $paths[SYS_PATH].$paths[GARBAGE_PATH]; // Deprecated?
$paths[SYS_PLUGIN_PATH] = $paths[SYS_PATH].$paths[SYS_PLUGIN_PATH];
$paths[WEB_PLUGIN_PATH] = $paths[WEB_PATH].$paths[WEB_PLUGIN_PATH];
$paths[SYS_ARCHIVE_PATH] = $paths[SYS_PATH].$paths[SYS_ARCHIVE_PATH];
$paths[WEB_ARCHIVE_PATH] = $paths[WEB_PATH].$paths[WEB_ARCHIVE_PATH];
$paths[SYS_TEST_PATH] = $paths[SYS_PATH].$paths[SYS_TEST_PATH];
// A change as of Chamilo 1.8.6.2
// Calculation in the previous way does not rely on configuration settings and in some cases gives unexpected results.
//$paths[INCLUDE_PATH] = $include_path_sys; // Old behaviour, Dokeos 1.8.6.1.
$paths[INCLUDE_PATH] = $paths[SYS_CODE_PATH].$paths[INCLUDE_PATH]; // New behaviour, coherrent with the model, Chamilo 1.8.6.2.
//
$paths[LIBRARY_PATH] = $paths[SYS_CODE_PATH].$paths[LIBRARY_PATH];
$paths[CONFIGURATION_PATH] = $paths[SYS_CODE_PATH].$paths[CONFIGURATION_PATH];
$paths[WEB_LIBRARY_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_LIBRARY_PATH];
$paths[WEB_AJAX_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_AJAX_PATH];
//$paths[INCLUDE_PATH] = $include_path_sys; // Old behaviour, Dokeos 1.8.6.1.
$paths[INCLUDE_PATH] = $paths[SYS_CODE_PATH].$paths[INCLUDE_PATH]; // New behaviour, coherrent with the model, Chamilo 1.8.6.2.
$paths[LIBRARY_PATH] = $paths[SYS_CODE_PATH].$paths[LIBRARY_PATH];
$paths[CONFIGURATION_PATH] = $paths[SYS_CODE_PATH].$paths[CONFIGURATION_PATH];
$paths[WEB_LIBRARY_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_LIBRARY_PATH];
$paths[WEB_AJAX_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_AJAX_PATH];
$is_this_function_initialized = true;
} else {
if ($load_new_config) {
$root_web = api_add_trailing_slash($root_web);
// Web server base and system server base.
$server_base_web = preg_replace('@'.$root_rel.'$@', '', $root_web); // No trailing slash.
//redefine root webs
$paths[WEB_PATH] = $root_web;
$paths[WEB_SERVER_ROOT_PATH]= $server_base_web.'/';
$paths[WEB_SERVER_ROOT_PATH]= $server_base_web.'/';
$paths[WEB_COURSE_PATH] = $root_web.$course_folder;
$paths[WEB_CODE_PATH] = $root_web.$code_folder;
}
}
// Shallow purification and validation of input parameters.
$path_type = trim($path_type);
$path = trim($path);
@ -465,7 +475,6 @@ function api_get_path($path_type, $path = null) {
}
// Retrieving a common-purpose path.
if (isset($paths[$path_type])) {
return $paths[$path_type];
}
@ -3396,7 +3405,7 @@ function api_get_access_urls($from = 0, $to = 1000000, $order = 'url', $directio
$order = Database::escape_string($order);
$direction = Database::escape_string($direction);
$sql = "SELECT id, url, description, active, created_by, tms FROM $t_au ORDER BY $order $direction LIMIT $to OFFSET $from";
$res = Database::query($sql);
$res = Database::query($sql);
return Database::store_result($res);
}

@ -1881,8 +1881,8 @@ class UserManager
$access_url_id = api_get_current_access_url_id();
if($access_url_id!=-1) {
$tbl_url_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$join_access_url= "LEFT JOIN $tbl_url_course url_rel_course ON url_rel_course.course_code= course.code";
$where_access_url=" AND access_url_id = $access_url_id ";
$join_access_url= " , $tbl_url_course url_rel_course ";
$where_access_url=" AND access_url_id = $access_url_id AND url_rel_course.course_code = scu.course_code";
}
}
@ -1922,8 +1922,7 @@ class UserManager
ORDER BY code";
$course_list_sql_result = Database::query($personal_course_list_sql);
$course_list_sql_result = Database::query($personal_course_list_sql);
if (Database::num_rows($course_list_sql_result)>0) {
while ($result_row = Database::fetch_array($course_list_sql_result)) {

@ -1246,6 +1246,9 @@ CREATE TABLE access_url_rel_user (
PRIMARY KEY (access_url_id, user_id)
);
//Adding admin user in the first access_url
INSERT INTO access_url_rel_user SET user_id=1, access_url_id=1;
ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_user (user_id);
ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_access_url(access_url_id);
ALTER TABLE access_url_rel_user ADD INDEX idx_access_url_rel_user_access_url_user (user_id,access_url_id);

Loading…
Cancel
Save