From 4d740d6a13f89a063d8fc73a064b8ed06f819a15 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 8 Mar 2010 10:51:52 -0500 Subject: [PATCH 1/8] Minor - cosmetic changes (cleaning header, changing require to require_once) --- main/admin/access_url_edit.php | 2 +- main/admin/access_urls.php | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/main/admin/access_url_edit.php b/main/admin/access_url_edit.php index e678de8d84..664b2ef6aa 100755 --- a/main/admin/access_url_edit.php +++ b/main/admin/access_url_edit.php @@ -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(); diff --git a/main/admin/access_urls.php b/main/admin/access_urls.php index 4923c0d428..205187667f 100755 --- a/main/admin/access_urls.php +++ b/main/admin/access_urls.php @@ -1,15 +1,13 @@ '; } } Display :: display_normal_message(get_lang('AdminUserRegisteredToThisURL').': '.$url_str.'
',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'].'
'; } } if(!empty($url_string)) { - Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').':
'.$url_string,false); + Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').'
'.$url_string,false); } // checking the current installation From a6f6cc9a8615a91686e00613ba1bea6429c8ea41 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 8 Mar 2010 10:52:25 -0500 Subject: [PATCH 2/8] Minor - Replacing require to require_once, updating license headers --- main/admin/access_url_add_courses_to_url.php | 32 ++++------------- main/admin/access_url_add_sessions_to_url.php | 28 ++------------- main/admin/access_url_add_users_to_url.php | 35 +++++-------------- main/admin/access_url_edit_courses_to_url.php | 28 +++------------ .../admin/access_url_edit_sessions_to_url.php | 28 +++------------ main/admin/access_url_edit_users_to_url.php | 28 +++------------ 6 files changed, 29 insertions(+), 150 deletions(-) diff --git a/main/admin/access_url_add_courses_to_url.php b/main/admin/access_url_add_courses_to_url.php index 118ef42681..800fe1a8e2 100755 --- a/main/admin/access_url_add_courses_to_url.php +++ b/main/admin/access_url_add_courses_to_url.php @@ -1,44 +1,24 @@ - - 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; +} /* ----------------------------------------------------------- diff --git a/main/admin/access_url_add_sessions_to_url.php b/main/admin/access_url_add_sessions_to_url.php index 2b65c670b4..95411d0aee 100755 --- a/main/admin/access_url_add_sessions_to_url.php +++ b/main/admin/access_url_add_sessions_to_url.php @@ -1,38 +1,16 @@ - - 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'); diff --git a/main/admin/access_url_add_users_to_url.php b/main/admin/access_url_add_users_to_url.php index f4bd5f1e87..2a786eec5e 100755 --- a/main/admin/access_url_add_users_to_url.php +++ b/main/admin/access_url_add_users_to_url.php @@ -1,43 +1,24 @@ - - 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; +} /* ----------------------------------------------------------- diff --git a/main/admin/access_url_edit_courses_to_url.php b/main/admin/access_url_edit_courses_to_url.php index 353c7dfbd2..c3c40018f1 100755 --- a/main/admin/access_url_edit_courses_to_url.php +++ b/main/admin/access_url_edit_courses_to_url.php @@ -1,30 +1,10 @@ - - 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'); diff --git a/main/admin/access_url_edit_sessions_to_url.php b/main/admin/access_url_edit_sessions_to_url.php index 69a505d53b..cc6a99ef1f 100755 --- a/main/admin/access_url_edit_sessions_to_url.php +++ b/main/admin/access_url_edit_sessions_to_url.php @@ -1,30 +1,10 @@ - - 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'); diff --git a/main/admin/access_url_edit_users_to_url.php b/main/admin/access_url_edit_users_to_url.php index a7d47dd1e5..7151681566 100755 --- a/main/admin/access_url_edit_users_to_url.php +++ b/main/admin/access_url_edit_users_to_url.php @@ -1,30 +1,10 @@ - - 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'); From 13c5d3a523f413b9b37bbd2a6e07062e565c3d5f Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 8 Mar 2010 12:42:31 -0500 Subject: [PATCH 3/8] Fixing get_courses_list_by_session() function when using multiples urls feature --- main/inc/lib/usermanager.lib.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index 8df8924868..bd85077fc6 100644 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -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)) { From 6525e07b3ddbd4c40503c1481b4ee22ae7f292c7 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 8 Mar 2010 12:50:28 -0500 Subject: [PATCH 4/8] Adding admin user to the \"access_url_rel_user\" table in order to avoid blocking the admin user when installing the multiples url feature --- main/install/db_main.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main/install/db_main.sql b/main/install/db_main.sql index 4b3da1fc2a..8c4c55c477 100644 --- a/main/install/db_main.sql +++ b/main/install/db_main.sql @@ -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); From 76eb32823bb5f16c938617d327cbe4d94b955a0d Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 8 Mar 2010 13:02:15 -0500 Subject: [PATCH 5/8] require/include functions changed to require_once --- main/create_course/add_course.php | 33 ++++++++++++------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/main/create_course/add_course.php b/main/create_course/add_course.php index 7d5c307eb3..ff41816b27 100755 --- a/main/create_course/add_course.php +++ b/main/create_course/add_course.php @@ -1,13 +1,10 @@ , 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[] = ''; //jQuery $htmlHeadXtra[] = '