Browse Source

Removing require_once of libs already added in the autoload script

Julio Montoya 12 năm trước cách đây
mục cha
commit
4b6afee605
45 tập tin đã thay đổi với 427 bổ sung466 xóa
  1. 9 9
      custompages/first_login.php
  2. 1 2
      main/admin/settings.lib.php
  3. 0 1
      main/admin/system_status.php
  4. 4 5
      main/blog/blog_admin.php
  5. 20 22
      main/course_progress/thematic_controller.php
  6. 0 4
      main/create_course/add_course.php
  7. 9 11
      main/dashboard/index.php
  8. 0 1
      main/gradebook/gradebook_flatview.php
  9. 3 4
      main/gradebook/gradebook_showlog_eval.php
  10. 0 1
      main/gradebook/gradebook_showlog_link.php
  11. 64 66
      main/gradebook/index.php
  12. 0 3
      main/gradebook/lib/be/category.class.php
  13. 32 34
      main/gradebook/lib/fe/exportgradebook.php
  14. 36 39
      main/gradebook/lib/fe/flatviewtable.class.php
  15. 0 1
      main/gradebook/lib/fe/userform.class.php
  16. 0 1
      main/gradebook/user_stats.php
  17. 1 2
      main/help/allowed_html_tags.php
  18. 15 15
      main/inc/ajax/course.ajax.php
  19. 1 1
      main/inc/ajax/course_home.ajax.php
  20. 1 1
      main/inc/ajax/exercise.ajax.php
  21. 6 4
      main/inc/ajax/extra_field.ajax.php
  22. 46 47
      main/inc/ajax/install.ajax.php
  23. 13 13
      main/inc/ajax/link.ajax.php
  24. 3 1
      main/inc/ajax/notebook.ajax.php
  25. 3 1
      main/inc/ajax/online.ajax.php
  26. 69 72
      main/inc/ajax/skill.ajax.php
  27. 1 2
      main/inc/ajax/social.ajax.php
  28. 60 62
      main/inc/ajax/thematic.ajax.php
  29. 6 4
      main/inc/ajax/timeline.ajax.php
  30. 1 1
      main/inc/ajax/user_manager.ajax.php
  31. 2 6
      main/inc/ajax/work.ajax.php
  32. 2 1
      main/inc/lib/link.lib.php
  33. 5 0
      main/inc/lib/main_api.lib.php
  34. 0 1
      main/inc/lib/nanogong.lib.php
  35. 5 4
      main/inc/lib/notebook.lib.php
  36. 1 1
      main/inc/lib/search/xapian/XapianIndexer.class.php
  37. 1 1
      main/inc/lib/search/xapian/XapianQuery.php
  38. 3 7
      main/inc/lib/skill.lib.php
  39. 1 3
      main/notebook/index.php
  40. 1 3
      main/reservation/rsys.php
  41. 0 1
      main/social/home.php
  42. 0 2
      main/social/skills_tree.php
  43. 2 4
      main/timeline/view.php
  44. 0 1
      main/tracking/lp_results_by_user.php
  45. 0 1
      main/tracking/question_course_report.php

+ 9 - 9
custompages/first_login.php

@@ -7,9 +7,9 @@
 /**
  * Initialization
  */
-require_once('language.php');
-require_once(dirname(__FILE__).'/../main/inc/global.inc.php');
-require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
+require_once 'language.php';
+require_once dirname(__FILE__).'/../main/inc/global.inc.php';
+
 /**
  * Security checks
  */
@@ -17,8 +17,8 @@ if (! isset($_SESSION['conditional_login']['uid']))
   die("Not Authorised");
 
 if (isset($_POST['password'])){
-  $u = UserManager::get_user_info_by_id($_SESSION['conditional_login']['uid']);
-  if ($_POST['password'] != $_POST['password2']) { 
+  $u = UserManager::get_user_info_by_id($_SESdiagnoser.lib.phpSION['conditional_login']['uid']);
+  if ($_POST['password'] != $_POST['password2']) {
     header('Location: '. api_get_self().'?invalid=2');
     exit();
   }
@@ -59,11 +59,11 @@ if ($_GET['invalid'] == 2) {
 	<script type="text/javascript" src="/main/inc/lib/javascript/jquery.min.js"></script>
 	<script type="text/javascript">
 		$(document).ready(function() {
-			if (top.location != location) 
+			if (top.location != location)
 				top.location.href = document.location.href ;
 
 			// Handler pour la touche retour
-			$('input').keyup(function(e) { 
+			$('input').keyup(function(e) {
 				if (e.keyCode == 13) {
 					$('#changepassword-form').submit();
 				}
@@ -80,12 +80,12 @@ if ($_GET['invalid'] == 2) {
 			<img src="/custompages/images/header.png" alt="Logo" />
 		</div> <!-- #header -->
     <h2> <?php echo custompages_get_lang('FirstLogin');?> </h2>
-        
+
 		<div id="changepassword-form-box" class="form-box">
       <div class="info"> <?php echo custompages_get_lang('FirstLoginChangePassword');?> </div>
 		<?php if (isset($error_message)) {
 			echo '<div id="changepassword-form-error" class="form-error">'.$error_message.'</div>';
-		}?> 
+		}?>
 			<form id="changepassword-form" class="form" method="post">
 				<div>
           <label for="password">*<?php echo custompages_get_lang('langPass');?></label>

+ 1 - 2
main/admin/settings.lib.php

@@ -604,8 +604,7 @@ function handle_search() {
     echo '</div>';
 
     if ($search_enabled == 'true') {
-        require_once api_get_path(LIBRARY_PATH).'sortable_table.class.php';
-        $xapian_path = api_get_path(SYS_PATH).'searchdb';
+        $xapian_path = api_get_path(SYS_DATA_PATH).'searchdb';
 
         /*
         @todo Test the Xapian connection

+ 0 - 1
main/admin/system_status.php

@@ -10,7 +10,6 @@ $language_file = array('admin', 'registration');
 $cidReset = true;
 
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'diagnoser.lib.php';
 
 $this_section = SECTION_PLATFORM_ADMIN;
 // User permissions

+ 4 - 5
main/blog/blog_admin.php

@@ -27,8 +27,7 @@ if((!$is_allowed_in_course || !$is_courseMember) && !api_is_allowed_to_edit()) {
 	api_not_allowed(true);//print headers/footers
 }
 
-if (api_is_allowed_to_edit()) { 
-	require_once api_get_path(LIBRARY_PATH) . "blog.lib.php";
+if (api_is_allowed_to_edit()) {
 	$nameTools = get_lang("blog_management");
 
 	// showing the header if we are not in the learning path, if we are in
@@ -49,8 +48,8 @@ if (api_is_allowed_to_edit()) {
 		'name' => $current_section
 		);
 		Display::display_header('');
-	} else {		
-	}	
+	} else {
+	}
 	echo '<div class="actions">';
 	echo "<a href='".api_get_self()."?".api_get_cidreq()."&action=add'>",Display::return_icon('new_blog.png',get_lang('AddBlog'),'',ICON_SIZE_MEDIUM)."</a>";
 	echo '</div>';
@@ -83,7 +82,7 @@ if (api_is_allowed_to_edit()) {
 		Display::display_confirmation_message(get_lang('BlogDeleted'));
 	}
 
-	/*	
+	/*
 		DISPLAY
 	*/
 	//api_display_tool_title($nameTools);

+ 20 - 22
main/course_progress/thematic_controller.php

@@ -4,9 +4,9 @@
 
 /**
  * This file contains class used like controller for thematic, it should be included inside a dispatcher file (e.g: index.php)
- * 
+ *
  * !!! WARNING !!! : ALL DATES IN THIS MODULE ARE STORED IN UTC ! DO NOT CONVERT DURING THE TRANSITION FROM CHAMILO 1.8.x TO 2.0
- * 
+ *
  * @author Christian Fasanando <christian1827@gmail.com>
  * @author Julio Montoya <gugli100@gmail.com> token support improving UI
  * @package chamilo.course_progress
@@ -15,7 +15,7 @@
 /**
  * Thematic Controller script. Prepares the common background variables to give to the scripts corresponding to
  * the requested action
- * @package chamilo.course_progress 
+ * @package chamilo.course_progress
  */
 class ThematicController {
 
@@ -30,7 +30,7 @@ class ThematicController {
     /**
      * This method is used for thematic control (update, insert or listing)
      * @param 	string	Action
-     * render to thematic.php 
+     * render to thematic.php
      */
     public function thematic($action) {
         $thematic = new Thematic();
@@ -44,7 +44,7 @@ class ThematicController {
             switch ($action) {
                 case 'thematic_add':
                 case 'thematic_edit':
-                    // insert or update a thematic		
+                    // insert or update a thematic
                     if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
                         if (trim($_POST['title']) !== '') {
                             if (api_is_allowed_to_edit(null, true)) {
@@ -178,7 +178,7 @@ class ThematicController {
                         $data = $thematic->get_thematic_advance_by_thematic_id($theme['id']);
                         $advance_html = null;
                         if (!empty($data)) {
-                            foreach ($data as $advance) {                                
+                            foreach ($data as $advance) {
                                 $advance_html .= api_convert_and_format_date($advance['start_date'], DATE_FORMAT_LONG) . ' ('.$advance['duration'].' '.get_lang('HourShort').')<br />'.$advance['content'].'<br />';
                             }
                         }
@@ -190,7 +190,7 @@ class ThematicController {
                         'add_signatures' => true,
                         'format' => 'A4-L',
                         'orientation' => 'L'
-                    );                    
+                    );
                     Export::export_table_pdf($table, $params);
                     break;
                 case 'moveup':
@@ -214,7 +214,7 @@ class ThematicController {
             $data['thematic_id'] = $thematic_id;
         }
 
-        if ($action == 'thematic_details') {    
+        if ($action == 'thematic_details') {
             if (isset($thematic_id)) {
                 $thematic_data_result = $thematic->get_thematic_list($thematic_id);
                 if (!empty($thematic_data_result)) {
@@ -230,7 +230,7 @@ class ThematicController {
 
             //Second column
             $thematic_plan_data = $thematic->get_thematic_plan_data();
-            
+
             //Third column
             $thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true);
 
@@ -256,7 +256,7 @@ class ThematicController {
     /**
      * This method is used for thematic plan control (update, insert or listing)
      * @param 	string	Action
-     * render to thematic_plan.php 
+     * render to thematic_plan.php
      */
     public function thematic_plan($action) {
         $thematic = new Thematic();
@@ -272,19 +272,19 @@ class ThematicController {
 
                             $title_list         = $_REQUEST['title'];
                             $description_list   = $_REQUEST['description'];
-                            $description_type   = $_REQUEST['description_type'];               
+                            $description_type   = $_REQUEST['description_type'];
                             $delete_list        = $_REQUEST['delete'];
-                            
+
                             foreach ($title_list as $id => $title) {
                                 $thematic_plan_id = $id;
                                 if (!$thematic->get_thematic_data_by_id($id)) {
                                     $thematic_plan_id = null;
                                 }
-                                $thematic->set_thematic_plan_attributes($_REQUEST['thematic_id'], $title, $description_list[$id], $description_type[$id], $thematic_plan_id);                                
-                                if (isset($delete_list[$id]) && !empty($delete_list[$id])) {                                    
+                                $thematic->set_thematic_plan_attributes($_REQUEST['thematic_id'], $title, $description_list[$id], $description_type[$id], $thematic_plan_id);
+                                if (isset($delete_list[$id]) && !empty($delete_list[$id])) {
                                      $thematic->thematic_plan_delete();
                                 } else {
-                                    $affected_rows = $thematic->thematic_plan_save();    
+                                    $affected_rows = $thematic->thematic_plan_save();
                                 }
                             }
                             unset($_SESSION['thematic_plan_token']);
@@ -315,11 +315,11 @@ class ThematicController {
         }
 
         $thematic_id = intval($_GET['thematic_id']);
-        
+
         if ($action == 'thematic_plan_list') {
             $data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
         }
-        
+
         $description_type = intval($_GET['description_type']);
 
         if (!empty($thematic_id) && !empty($description_type)) {
@@ -341,7 +341,7 @@ class ThematicController {
 
         $data['thematic_id'] = $thematic_id;
         $data['action'] = $action;
-        
+
         $data['default_thematic_plan_title'] = $thematic->get_default_thematic_plan_title();
         $data['default_thematic_plan_icon'] = $thematic->get_default_thematic_plan_icon();
         $data['next_description_type'] = $thematic->get_next_description_type($thematic_id);
@@ -359,16 +359,14 @@ class ThematicController {
     /**
      * This method is used for thematic advance control (update, insert or listing)
      * @param 	string	Action
-     * render to thematic_advance.php 
+     * render to thematic_advance.php
      */
     public function thematic_advance($action) {
-        require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
-
         $thematic = new Thematic();
         $attendance = new Attendance();
         $data = array();
 
-        // get data for attendance input select		
+        // get data for attendance input select
         $attendance_list = $attendance->get_attendances_list();
         $attendance_select = array();
         $attendance_select[0] = get_lang('SelectAnAttendance');

+ 0 - 4
main/create_course/add_course.php

@@ -32,10 +32,6 @@ $this_section = SECTION_COURSES;
 // false - the new course is created immedialely, after filling this form.
 $course_validation_feature = api_get_setting('course_validation') == 'true';
 
-if ($course_validation_feature) {
-    require_once api_get_path(LIBRARY_PATH).'course_request.lib.php';
-}
-
 $htmlHeadXtra[] = '<script>
     function setFocus(){
         $("#title").focus();

+ 9 - 11
main/dashboard/index.php

@@ -1,7 +1,7 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
-* Template (front controller in MVC pattern) used for distpaching to the controllers depend on the current action  
+* Template (front controller in MVC pattern) used for distpaching to the controllers depend on the current action
 * @author Christian Fasanando <christian1827@gmail.com>
 * @package chamilo.dashboard
 */
@@ -12,10 +12,8 @@
 $language_file = array ('index', 'tracking', 'userInfo', 'admin', 'gradebook');
 $cidReset = true;
 
-// including files 
+// including files
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'dashboard.lib.php';
-require_once api_get_path(LIBRARY_PATH).'app_view.php';
 require_once 'dashboard_controller.php';
 require_once 'block.class.php';
 
@@ -51,16 +49,16 @@ if (isset($_GET['path'])) {
 }
 
 // distpacher actions to controller
-switch ($action) {	
-	case 'listing':	
+switch ($action) {
+	case 'listing':
 		$dashboard_controller->display();
 		break;
-	case 'store_user_block':	
+	case 'store_user_block':
 		$dashboard_controller->store_user_block();
-		break;	
-	case 'disable_block':	
+		break;
+	case 'disable_block':
 		$dashboard_controller->close_user_block($path);
-		break;					
-	default :	
+		break;
+	default :
 		$dashboard_controller->display();
 }

+ 0 - 1
main/gradebook/gradebook_flatview.php

@@ -23,7 +23,6 @@ require_once 'lib/fe/displaygradebook.php';
 require_once 'lib/fe/exportgradebook.php';
 require_once 'lib/scoredisplay.class.php';
 require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php';
-require_once api_get_path(LIBRARY_PATH).'pdf.lib.php';
 
 api_block_anonymous_users();
 block_students();

+ 3 - 4
main/gradebook/gradebook_showlog_eval.php

@@ -10,7 +10,6 @@
 $language_file = 'gradebook';
 //$cidReset = true;
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'sortable_table.class.php';
 require_once 'lib/be.inc.php';
 require_once 'lib/gradebook_functions.inc.php';
 require_once 'lib/fe/evalform.class.php';
@@ -39,15 +38,15 @@ $t_user=	 Database :: get_main_table(TABLE_MAIN_USER);
 $visible_log=Security::remove_XSS($_GET['visiblelog']);
 
 $evaledit = Evaluation :: load($visible_log);
-$sql="SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username FROM ".$t_linkeval_log." le INNER JOIN ".$t_user." us 
+$sql="SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username FROM ".$t_linkeval_log." le INNER JOIN ".$t_user." us
       ON le.user_id_log=us.user_id where id_linkeval_log=".$evaledit[0]->get_id()." and type='evaluation';";
 $result=Database::query($sql);
 $list_info=array();
 while ($row=Database::fetch_row($result)) {
-	$list_info[]=$row; 
+	$list_info[]=$row;
 }
 
-foreach($list_info as $key => $info_log) {	
+foreach($list_info as $key => $info_log) {
 	$list_info[$key][5]=($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A';
 	$list_info[$key][3]=($info_log[3]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
 }

+ 0 - 1
main/gradebook/gradebook_showlog_link.php

@@ -10,7 +10,6 @@
 $language_file = 'gradebook';
 //$cidReset = true;
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'sortable_table.class.php';
 require_once 'lib/be.inc.php';
 require_once 'lib/gradebook_functions.inc.php';
 require_once 'lib/fe/evalform.class.php';

+ 64 - 66
main/gradebook/index.php

@@ -36,8 +36,6 @@ require_once 'lib/gradebook_data_generator.class.php';
 require_once 'lib/fe/gradebooktable.class.php';
 require_once 'lib/fe/displaygradebook.php';
 require_once 'lib/fe/userform.class.php';
-require_once api_get_path(LIBRARY_PATH).'ezpdf/class.ezpdf.php';
-require_once api_get_path(LIBRARY_PATH).'gradebook.lib.php';
 
 /*
 $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/jqplot/jquery.jqplot.min.css');
@@ -45,7 +43,7 @@ $htmlHeadXtra[] = api_get_js('jqplot/jquery.jqplot.min.js');
 $htmlHeadXtra[] = api_get_js('jqplot/plugins/jqplot.donutRenderer.min.js');*/
 
 $htmlHeadXtra[] = '<script>
-    
+
 var show_icon = "../img/view_more_stats.gif";
 var hide_icon = "../img/view_less_stats.gif";
 
@@ -53,28 +51,28 @@ $(document).ready(function() {
 
     $(".view_children").live("click", function() {
         var id = $(this).attr("data-cat-id");
-        $(".hidden_"+id).removeClass("hidden");    
-        $(this).removeClass("view_children");        
-        $(this).find("img").attr("src", hide_icon);        
+        $(".hidden_"+id).removeClass("hidden");
+        $(this).removeClass("view_children");
+        $(this).find("img").attr("src", hide_icon);
         $(this).attr("class", "hide_children");
     });
 
-    $(".hide_children").live("click", function(event) {    
-        var id = $(this).attr("data-cat-id");        
-        $(".hidden_"+id).addClass("hidden");    
+    $(".hide_children").live("click", function(event) {
+        var id = $(this).attr("data-cat-id");
+        $(".hidden_"+id).addClass("hidden");
         $(this).removeClass("hide_children");
         $(this).addClass("view_children");
         $(this).find("img").attr("src", show_icon);
     });
- 
-    
-    
+
+
+
 
 /*
   var s1 = [["a",25]];
   var s2 = [["a", 0], ["a", 10], ["a", 10], ["a", 5]];
-     
-  var plot3 = $.jqplot("chart3", [s1, s2], {        
+
+  var plot3 = $.jqplot("chart3", [s1, s2], {
   colors: ["#000", "#fff"],
     seriesDefaults: {
       // make this a donut chart.
@@ -88,7 +86,7 @@ $(document).ready(function() {
         // By default, data labels show the percentage of the donut/pie.
         // You can show the data "value" or data "label" instead.
         dataLabels: "value"
-        
+
       }
     }
   });*/
@@ -120,7 +118,7 @@ $filter_warning_msg = true;
 
 ///direct access to one evaluation
 $cats = Category :: load(null, null, $course_code, null, null, $session_id, false); //already init
-$first_time = null; 
+$first_time = null;
 if (empty($cats)) {
 	$cats = Category :: load(0, null, $course_code, null, null, $session_id, false);//first time
 	$first_time=1;
@@ -139,8 +137,8 @@ if ( (isset($_GET['selectcat']) && $_GET['selectcat']>0) && (isset($_SESSION['st
 	//Introduction tool: student view
 	Display::display_introduction_section(TOOL_GRADEBOOK, array('ToolbarSet' => 'AssessmentsIntroduction'));
 
-	$category= $_GET['selectcat'];		
-	
+	$category= $_GET['selectcat'];
+
 	$cats = Category :: load ($category, null, null, null, null, null, false);
 	$allcat= $cats[0]->get_subcategories($stud_id, $course_code, $session_id);
 	$alleval= $cats[0]->get_evaluations($stud_id);
@@ -312,7 +310,7 @@ if (isset($_GET['deletecat'])) {
 		}
 	}
 	$confirmation_message = get_lang('CategoryDeleted');
-	$filter_confirm_msg = false;   
+	$filter_confirm_msg = false;
 }
 //parameters for evaluations
 if (isset ($_GET['visibleeval'])) {
@@ -349,8 +347,8 @@ if (isset($_GET['lockedeval'])) {
 	if ($eval[0] != null) {
 		$eval[0]->lock($type_locked);
 	}
-	
-	$filter_confirm_msg = false;	
+
+	$filter_confirm_msg = false;
 
 }
 if (isset ($_GET['deleteeval'])) {
@@ -395,11 +393,11 @@ if (isset ($_GET['deletelink'])) {
 		$link= LinkFactory :: load($get_delete_link);
 		if ($link[0] != null) {
 			// clean forum qualify
-			$sql = 'UPDATE '.$tbl_forum_thread.' SET thread_qualify_max=0,thread_weight=0,thread_title_qualify="" 
+			$sql = 'UPDATE '.$tbl_forum_thread.' SET thread_qualify_max=0,thread_weight=0,thread_title_qualify=""
 					WHERE c_id = '.$course_id.' AND thread_id = (SELECT ref_id FROM '.$tbl_grade_links.' WHERE id='.$get_delete_link.' AND type = '.LINK_FORUM_THREAD.');';
 			Database::query($sql);
 			// clean attendance
-			$sql = 'UPDATE '.$tbl_attendance.' SET attendance_qualify_max=0, attendance_weight = 0, attendance_qualify_title="" 
+			$sql = 'UPDATE '.$tbl_attendance.' SET attendance_qualify_max=0, attendance_weight = 0, attendance_qualify_title=""
 				 	WHERE c_id = '.$course_id.' AND id = (SELECT ref_id FROM '.$tbl_grade_links.' WHERE id='.$get_delete_link.' AND type = '.LINK_ATTENDANCE.');';
 			Database::query($sql);
 			$link[0]->delete();
@@ -441,7 +439,7 @@ switch ($action) {
             $category_to_lock[0]->lock_all_items(0);
             $confirmation_message = get_lang('EvaluationHasBeenUnLocked');
         }
-        break;    
+        break;
 }
 
 //actions on the sortabletable
@@ -454,7 +452,7 @@ if (isset ($_POST['action'])) {
 		$filter_warning_msg = false;
 	} else {
 		switch ($_POST['action']) {
- 
+
 			case 'deleted' :
 				$number_of_deleted_categories= 0;
 				$number_of_deleted_evaluations= 0;
@@ -620,8 +618,8 @@ if (empty ($_GET['selectcat'])) {
 }
 $simple_search_form='';
 
-if (isset($_GET['studentoverview'])) {    
-    //@todo this code also seems to be deprecated ...    
+if (isset($_GET['studentoverview'])) {
+    //@todo this code also seems to be deprecated ...
 	$cats= Category :: load($category);
 	$stud_id= (api_is_allowed_to_edit() ? null : $stud_id);
 	$allcat= array ();
@@ -635,7 +633,7 @@ if (isset($_GET['studentoverview'])) {
 		foreach ($data_array as $data) {
 			$newarray[] = array_slice($data, 1);
 		}
-		$pdf= new Cezpdf(); 
+		$pdf= new Cezpdf();
 		$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
 		$pdf->ezSetMargins(30, 30, 50, 30);
 		$pdf->ezSetY(810);
@@ -649,15 +647,15 @@ if (isset($_GET['studentoverview'])) {
     }
 } else {
     //Student view
-    
+
     //in any other case (no search, no pdf), print the available gradebooks
     // Important note: loading a category will actually load the *contents* of
     // this category. This means that, to show the categories of a course,
     // we have to show the root category and show its subcategories that
     // are inside this course. This is done at the time of calling
     // $cats[0]->get_subcategories(), not at the time of doing Category::load()
-    // $category comes from GET['selectcat']    
-    
+    // $category comes from GET['selectcat']
+
     //if $category = 0 (which happens when GET['selectcat'] is undefined)
     // then Category::load() will create a new 'root' category with empty
     // course and session fields in memory (Category::create_root_category())
@@ -676,8 +674,8 @@ if (isset($_GET['studentoverview'])) {
 	    $cats = Category :: load(null, null, $course_code, null, null, $session_id, false);
         if (empty($cats)) {
             // There is no category for this course+session, so create one
-            $cat= new Category();     
-            if (!empty($session_id)) {            	
+            $cat= new Category();
+            if (!empty($session_id)) {
                 $s_name = api_get_session_name($session_id);
             	$cat->set_name($course_code.' - '.get_lang('Session').' '.$s_name);
                 $cat->set_session_id($session_id);
@@ -707,7 +705,7 @@ if (isset($_GET['studentoverview'])) {
     } else {
     	$stud_id = $stud_id;
     }
-    
+
 	$allcat  = $cats[0]->get_subcategories($stud_id, $course_code, $session_id);
 	$alleval = $cats[0]->get_evaluations($stud_id);
 	$alllink = $cats[0]->get_links($stud_id);
@@ -735,14 +733,14 @@ if ($category != '0') {
 	$category_id   = intval($_GET['selectcat']);
 	$course_id     = Database::get_course_by_category($category_id);
 	$show_message  = $cat->show_message_resource_delete($course_id);
-    
+
 	if ($show_message == '') {
 		//student
 		if (!api_is_allowed_to_edit()) {
             $certificate_html = Category::register_user_certificate($category_id, $stud_id);
             if ($certificate_html) {
                 echo $certificate_html;
-            }            
+            }
 		} //end hack
 	}
 }
@@ -751,45 +749,45 @@ if (api_is_allowed_to_edit(null, true)) {
 	// Tool introduction
 	Display::display_introduction_section(TOOL_GRADEBOOK, array('ToolbarSet' => 'AssessmentsIntroduction'));
 
-	if ( (isset ($_GET['selectcat']) && $_GET['selectcat']<>0) ) {	    
+	if ( (isset ($_GET['selectcat']) && $_GET['selectcat']<>0) ) {
 	//
-	} else {	    
+	} else {
         if (((isset ($_GET['selectcat']) && $_GET['selectcat']==0) || ((isset($_GET['cidReq']) && $_GET['cidReq']!==''))) || isset($_GET['isStudentView']) && $_GET['isStudentView']=='false') {
-            $cats = Category :: load(null, null, $course_code, null, null, $session_id, false);		
+            $cats = Category :: load(null, null, $course_code, null, null, $session_id, false);
 		}
 	}
 }
 
 if (isset($first_time) && $first_time==1 && api_is_allowed_to_edit(null,true)) {
 	echo '<meta http-equiv="refresh" content="0;url='.api_get_self().'?cidReq='.$course_code.'" />';
-} else {    
+} else {
     $cats = Category :: load(null, null, $course_code, null, null, $session_id, false); //already init
-    
+
 	if (!empty($cats)) {
-        
-        if ( (api_get_setting('gradebook_enable_grade_model') == 'true') && 
+
+        if ( (api_get_setting('gradebook_enable_grade_model') == 'true') &&
              (api_is_platform_admin() || (api_is_allowed_to_edit(null, true) && api_get_setting('teachers_can_change_grade_model_settings') == 'true'))) {
-            
+
             //Getting grade models
             $obj = new GradeModel();
             $grade_models = $obj->get_all();
             $grade_model_id = $cats[0]->get_grade_model_id();
-                                    
+
             //No children
             if ( (count($cats) == 1 && empty($grade_model_id)) || (count($cats) == 1 && $grade_model_id != -1) ) {
-                if (!empty($grade_models)) {                   
-                    $form_grade = new FormValidator('grade_model_settings');                    
+                if (!empty($grade_models)) {
+                    $form_grade = new FormValidator('grade_model_settings');
                     $obj->fill_grade_model_select_in_form($form_grade, 'grade_model_id', $grade_model_id);
                     $form_grade->addElement('style_submit_button', 'submit', get_lang('Save'), 'class="save"');
-                    
+
                     if ($form_grade->validate()) {
                         $value = $form_grade->exportValue('grade_model_id');
-                        
+
                         $gradebook = new Gradebook();
-                        $gradebook->update(array('id'=> $cats[0]->get_id(), 'grade_model_id' => $value), true);                 
+                        $gradebook->update(array('id'=> $cats[0]->get_id(), 'grade_model_id' => $value), true);
 
-                        //do something                        
-                        $obj = new GradeModel();                             
+                        //do something
+                        $obj = new GradeModel();
                         $components = $obj->get_components($value);
 
                         foreach ($components as $component) {
@@ -810,34 +808,34 @@ if (isset($first_time) && $first_time==1 && api_is_allowed_to_edit(null,true)) {
                         //Reloading cats
                         $cats = Category :: load(null, null, $course_code, null, null, $session_id, false);
                     } else {
-                        $form_grade->display();   
+                        $form_grade->display();
                     }
                 }
             }
         }
-        
+
 		$i = 0;
-        
-		foreach ($cats as $cat) {			
-			$allcat  = $cat->get_subcategories($stud_id, $course_code, $session_id);            
+
+		foreach ($cats as $cat) {
+			$allcat  = $cat->get_subcategories($stud_id, $course_code, $session_id);
 			$alleval = $cat->get_evaluations($stud_id);
 			$alllink = $cat->get_links($stud_id);
-			
+
 			if ($cat->get_parent_id() != 0 ) {
 				$i++;
 			} else {
-				//This is the father				
+				//This is the father
 				//Create gradebook/add gradebook links
-                DisplayGradebook::display_header_gradebook($cat, 0, $cat->get_id(), $is_course_admin, $is_platform_admin, $simple_search_form, false, true);				
-				
+                DisplayGradebook::display_header_gradebook($cat, 0, $cat->get_id(), $is_course_admin, $is_platform_admin, $simple_search_form, false, true);
+
 				if (api_is_allowed_to_edit(null,true) && api_get_setting('gradebook_enable_grade_model') == 'true') {
 					//Showing the grading system
-					if (!empty($grade_models[$grade_model_id])) {             
+					if (!empty($grade_models[$grade_model_id])) {
                         Display::display_normal_message(get_lang('GradeModel').': '.$grade_models[$grade_model_id]['name']);
-                    }					
-				}                                
-				$gradebooktable = new GradebookTable($cat, $allcat, $alleval, $alllink, $addparams);                
-				$gradebooktable->display();				
+                    }
+				}
+				$gradebooktable = new GradebookTable($cat, $allcat, $alleval, $alllink, $addparams);
+				$gradebooktable->display();
 			}
 		}
 	}

+ 0 - 3
main/gradebook/lib/be/category.class.php

@@ -7,9 +7,6 @@
 /**
  * Init
  */
-require_once api_get_path(LIBRARY_PATH).'skill.lib.php';
-require_once api_get_path(LIBRARY_PATH).'gradebook.lib.php';
-require_once api_get_path(LIBRARY_PATH).'grade_model.lib.php';
 /**
  * Class
  * @package chamilo.gradebook

+ 32 - 34
main/gradebook/lib/fe/exportgradebook.php

@@ -94,7 +94,6 @@ a:active {text-decoration: none; font-weight : bold;  color : black;}
  * @return void
  */
 function export_pdf_attendance($headers_table, $data_table, $headers_pdf, $footers_pdf, $title_pdf) {
-    require_once api_get_path(LIBRARY_PATH).'mpdf/mpdf.php';
 
     $mpdf = new mPDF('UTF-8', 'A4-L', '', '', 15, 10, 35, 20, 4, 2, 'L');
     $mpdf->useOnlyCoreFonts = true;
@@ -219,46 +218,45 @@ function export_pdf_attendance($headers_table, $data_table, $headers_pdf, $foote
  * @param	array	pdf footers
  * @return void
  */
-function export_pdf_with_html($headers_table, $data_table, $headers_pdf, $footers_pdf, $title_pdf) {
-	
-	require_once api_get_path(LIBRARY_PATH).'pdf.lib.php';
+function export_pdf_with_html($headers_table, $data_table, $headers_pdf, $footers_pdf, $title_pdf)
+{
 	$headers_in_pdf = '<img src="'.api_get_path(WEB_CSS_PATH).api_get_setting('stylesheets').'/images/header-logo.png">';
-    
+
 	if (is_array($headers_pdf)) {
 		// preparing headers pdf
-		$header = '<br/><br/><table width="100%" cellspacing="1" cellpadding="5" border="0" class="strong">							
-					        <tr><td width="100%" style="text-align: center;" class="title" colspan="4"><h1>'.$title_pdf.'</h1></td></tr>';		
-		foreach($headers_pdf as $header_pdf) {			
+		$header = '<br/><br/><table width="100%" cellspacing="1" cellpadding="5" border="0" class="strong">
+					        <tr><td width="100%" style="text-align: center;" class="title" colspan="4"><h1>'.$title_pdf.'</h1></td></tr>';
+		foreach($headers_pdf as $header_pdf) {
 			if (!empty($header_pdf[0]) && !empty($header_pdf[1])) {
 				$header.= '<tr><td><strong>'.$header_pdf[0].'</strong> </td><td>'.$header_pdf[1].'</td></tr>';
 			}
-		}		
+		}
 		$header.='</table><br />';
 	}
-		
+
 	// preparing footer pdf
 	$footer = '<table width="100%" cellspacing="2" cellpadding="10" border="0">';
 	if (is_array($footers_pdf)) {
-		$footer .= '<tr>';	
+		$footer .= '<tr>';
 		foreach ($footers_pdf as $foot_pdf) {
 			$footer .= '<td width="33%" style="text-align: center;">'.$foot_pdf.'</td>';
 		}
-		$footer .= '</tr>';	
+		$footer .= '</tr>';
 	}
-	$footer .= '</table>';	
+	$footer .= '</table>';
 	$footer .= '<div align="right" style="font-weight: bold;">{PAGENO}/{nb}</div>';
-	
-	// preparing content pdf		
+
+	// preparing content pdf
 	$css_file = api_get_path(TO_SYS, WEB_CSS_PATH).api_get_setting('stylesheets').'/print.css';
 	if (file_exists($css_file)) {
 		$css = @file_get_contents($css_file);
 	} else {
 		$css = '';
-	}	
+	}
 	$items_per_page = 30;
-	$count_pages = ceil(count($data_table) / $items_per_page);  
+	$count_pages = ceil(count($data_table) / $items_per_page);
 	for ($x = 0; $x<$count_pages; $x++) {
-		$content_table .= '<table width="100%" border="1" style="border-collapse:collapse">';	
+		$content_table .= '<table width="100%" border="1" style="border-collapse:collapse">';
 		// header table
 		$content_table .= '<tr>';
 		$i = 0;
@@ -267,38 +265,38 @@ function export_pdf_with_html($headers_table, $data_table, $headers_pdf, $footer
 				if (!empty($head_table[0])) {
 					$width = (!empty($head_table[1])?$head_table[1].'%':'');
 					$content_table .= '<th width="'.$width.'">'.$head_table[0].'</th>';
-					$i++;	
-				}			
-			}		
-		}	
-		$content_table .= '</tr>';			
+					$i++;
+				}
+			}
+		}
+		$content_table .= '</tr>';
 		// body table
-		
+
 		if (is_array($data_table) && count($data_table) > 0) {
-			$offset = $x*$items_per_page;				
+			$offset = $x*$items_per_page;
 			$data_table = array_slice ($data_table, $offset, count($data_table));
 			$i = 1;
 			$item = $offset+1;
-			foreach ($data_table as $data) {			
+			foreach ($data_table as $data) {
 				$content_table .= '<tr>';
 				$content_table .= '<td>'.($item<10?'0'.$item:$item).'</td>';
-				foreach ($data as  $key => $content) {							
+				foreach ($data as  $key => $content) {
 					if (isset($content)) {
 						$key == 1 ? $align='align="left"':$align='align="center"';
-						$content_table .= '<td '.$align.' style="padding:4px;" >'.$content.'</td>';	
-					}					
+						$content_table .= '<td '.$align.' style="padding:4px;" >'.$content.'</td>';
+					}
 				}
 				$content_table .= '</tr>';
 				$i++;
 				$item++;
 				if ($i > $items_per_page) { break; }
-			}			
+			}
 		} else {
 			$content_table .= '<tr colspan="'.$i.'"><td>'.get_lang('Empty').'</td></tr>';
-		}	
-		$content_table .= '</table>';				
-		if ($x < ($count_pages - 1)) { $content_table .= '<pagebreak />'; }		
-	}	
+		}
+		$content_table .= '</table>';
+		if ($x < ($count_pages - 1)) { $content_table .= '<pagebreak />'; }
+	}
 	$pdf = new PDF();
     $pdf->set_custom_footer($footer);
     $pdf->set_custom_header($headers_in_pdf);

+ 36 - 39
main/gradebook/lib/fe/flatviewtable.class.php

@@ -32,13 +32,13 @@ class FlatViewTable extends SortableTable
 		parent :: __construct ('flatviewlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 1 : 0);
         $this->selectcat = $selectcat;
         $this->datagen = new FlatViewDataGenerator($users, $evals, $links, array('only_subcat'=>$this->selectcat->get_id()));
-        		
+
 		$this->limit_enabled = $limit_enabled;
 		$this->offset = $offset;
 		if (isset ($addparams)) {
 			$this->set_additional_parameters($addparams);
 		}
-		
+
 		// step 2: generate rows: students
 		$this->datagen->category = $this->selectcat;
 	}
@@ -53,20 +53,20 @@ class FlatViewTable extends SortableTable
 
 		$header_name = $this->datagen->get_header_names();
 		$total_users = $this->datagen->get_total_users_count();
-		
+
 		$img_file = '';
-		
+
 		if ($this->datagen->get_total_items_count()>0 && $total_users > 0 ) {
 		    //Removing user names and total
 			array_shift($header_name);
 			array_shift($header_name);
 			array_pop($header_name);
-			
+
 			$user_results = $this->datagen->get_data_to_graph();
-						
+
 			$pre_result = $new_result = array();
 			$DataSet = new pData();
-			
+
 			//$pre_result total score of students
 			//filling the Dataset
 			foreach($user_results as $result) {
@@ -76,15 +76,15 @@ class FlatViewTable extends SortableTable
 			}
 			$i = 1;
 			$show_draw = false;
-			if ($total_users >0 ) {			    
+			if ($total_users >0 ) {
 				foreach($pre_result as $res) {
-					$total =  $res / ($total_users);										
+					$total =  $res / ($total_users);
 					if ($total != 0) {
 						$show_draw  = true;
 					}
 					$DataSet->AddPoint($total, "Serie".$i);
 					$DataSet->SetSerieName(strip_tags($header_name[$i-1]),"Serie".$i);
-					
+
 					// Dataset definition
 					$DataSet->AddAllSeries();
 					$DataSet->SetAbsciseLabelSerie();
@@ -98,7 +98,7 @@ class FlatViewTable extends SortableTable
 			$gradebook_id = intval($_GET['selectcat']);
 			$graph_id = api_get_user_id().'AverageResultsVsResource'.$gradebook_id.api_get_course_id();
 			$data = $DataSet->GetData();
-			
+
 			if ($show_draw) {
 				if ($Cache->IsInCache($graph_id, $DataSet->GetData())) {
 				//if (0) {
@@ -130,7 +130,7 @@ class FlatViewTable extends SortableTable
 					//background color area & stripe or not
 					$Test->drawGraphArea(255,255,255,TRUE);
 					$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0 ,150,150,150,TRUE,0,1, FALSE);
-					
+
 					//background grid
 					$Test->drawGrid(4,TRUE,230,230,230,50);
 
@@ -163,9 +163,6 @@ class FlatViewTable extends SortableTable
 	}
 
 	function display_graph_by_resource() {
-		require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php';
-		require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php';
-		require_once api_get_path(LIBRARY_PATH).'pchart/pCache.class.php';
 
 		$header_name = $this->datagen->get_header_names();
 		$total_users = $this->datagen->get_total_users_count();
@@ -176,13 +173,13 @@ class FlatViewTable extends SortableTable
 			array_shift($header_name);
 			//Removing last name
 			array_shift($header_name);
-            
+
 			$displayscore = ScoreDisplay :: instance();
-			$customdisplays = $displayscore->get_custom_score_display_settings();		
-			
+			$customdisplays = $displayscore->get_custom_score_display_settings();
+
 			if (is_array($customdisplays) && count(($customdisplays))) {
-			    
-				$user_results = $this->datagen->get_data_to_graph2();				
+
+				$user_results = $this->datagen->get_data_to_graph2();
 				$pre_result = $new_result = array();
 				$DataSet = new pData();
 				//filling the Dataset
@@ -192,7 +189,7 @@ class FlatViewTable extends SortableTable
 						$pre_result[$i+3][]= $result[$i+1];
 					}
 				}
-	
+
 				$i=0;
 				$show_draw = false;
 				$resource_list = array();
@@ -202,11 +199,11 @@ class FlatViewTable extends SortableTable
 					rsort($res_array);
 					$pre_result2[] = $res_array;
 				}
-				
+
 				//@todo when a display custom does not exist the order of the color does not match
 				//filling all the answer that are not responded with 0
 				rsort($customdisplays);
-				
+
 				if ($total_users > 0) {
 					foreach($pre_result2 as $key=>$res_array) {
 						$key_list = array();
@@ -214,22 +211,22 @@ class FlatViewTable extends SortableTable
 							$resource_list[$key][$user_result[1]] += 1;
 							$key_list[] = $user_result[1];
 						}
-				
+
 						foreach ($customdisplays as $display) {
 							if (!in_array($display['display'], $key_list))
 								$resource_list[$key][$display['display']] = 0;
 						}
 						$i++;
 					}
-				}				
-				
-				//fixing $resource_list		
-				$max = 0;		
+				}
+
+				//fixing $resource_list
+				$max = 0;
 				$new_list = array();
 				foreach($resource_list as $key=>$value) {
 				    $new_value = array();
-				    
-				    foreach($customdisplays as $item) {				        
+
+				    foreach($customdisplays as $item) {
 				        if ($value[$item['display']] > $max) {
 				            $max = $value[$item['display']];
 				        }
@@ -237,8 +234,8 @@ class FlatViewTable extends SortableTable
 				    }
 				    $new_list[] = $new_value;
 				}
-				$resource_list = $new_list;				
-				
+				$resource_list = $new_list;
+
 				$i = 1;
 				$j = 0;
 
@@ -290,12 +287,12 @@ class FlatViewTable extends SortableTable
 
 							//background color area & stripe or not
 							$Test->drawGraphArea(255,255,255,TRUE);
-							
+
 							//Setting max height by default see #3296
 						    if (!empty($max)) {
-                                $Test->setFixedScale(0, $max);    
+                                $Test->setFixedScale(0, $max);
 						    }
-							
+
 							$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(), SCALE_ADDALLSTART0, 150,150,150, TRUE, 0, 0, FALSE);
 
 							//background grid
@@ -433,7 +430,7 @@ class FlatViewTable extends SortableTable
 	      							.'?selectcat='.Security::remove_XSS($_GET['selectcat'])
 	      							.'&offset='.(($this->offset)-LIMIT)
 									.(isset($_GET['search'])?'&search='.Security::remove_XSS($_GET['search']):'').'">'
-	      					.Display::return_icon('action_prev.png', get_lang('PreviousPage'), array(), 32)	      					
+	      					.Display::return_icon('action_prev.png', get_lang('PreviousPage'), array(), 32)
 	      					.'</a>';
 	      	} else {
 	      		$header .= Display::return_icon('action_prev_na.png', get_lang('PreviousPage'), array(), 32);
@@ -442,7 +439,7 @@ class FlatViewTable extends SortableTable
 			// next X
 	      	$calcnext = (($this->offset+(2*LIMIT)) > $totalitems) ?
 	      					($totalitems-(LIMIT+$this->offset)) : LIMIT;
-      		
+
       		if ($calcnext > 0) {
 	      		$header .= '<a href="'.api_get_self()
 	      							.'?selectcat='.Security::remove_XSS($_GET['selectcat'])
@@ -474,14 +471,14 @@ class FlatViewTable extends SortableTable
 		$header_names = $this->datagen->get_header_names($this->offset, $selectlimit);
 
 		$column = 0;
-        
+
 		if ($is_western_name_order) {
 			$this->set_header($column++, $header_names[1]);
 			$this->set_header($column++, $header_names[0]);
 		} else {
 			$this->set_header($column++, $header_names[0]);
 			$this->set_header($column++, $header_names[1]);
-		}        
+		}
 
 		while ($column < count($header_names)) {
 			$this->set_header($column, $header_names[$column], false);

+ 0 - 1
main/gradebook/lib/fe/userform.class.php

@@ -10,7 +10,6 @@
 require_once dirname(__FILE__).'/../../../inc/global.inc.php';
 require_once dirname(__FILE__).'/../be.inc.php';
 require_once dirname(__FILE__).'/../gradebook_functions.inc.php';
-require_once api_get_path(LIBRARY_PATH) . 'formvalidator/FormValidator.class.php';
 /**
  * Extends formvalidator with import and export forms
  * @author Stijn Konings

+ 0 - 1
main/gradebook/user_stats.php

@@ -84,7 +84,6 @@ if (isset ($_GET['exportpdf'])) {
     }
     $html .= $table->toHtml();
 
-    require_once api_get_path(LIBRARY_PATH).'pdf.lib.php';
     $pdf = new PDF();
     $pdf->content_to_pdf($html);
 	exit;

+ 1 - 2
main/help/allowed_html_tags.php

@@ -14,8 +14,7 @@
 // Language file that needs to be included
 $language_file = 'help';
 
-require '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
+require_once '../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'formvalidator/Rule/HTML.php';
 
 header('Content-Type: text/html; charset='.api_get_system_encoding());

+ 15 - 15
main/inc/ajax/course.ajax.php

@@ -11,36 +11,36 @@ $action = $_REQUEST['a'];
 
 $user_id = api_get_user_id();
 
-switch ($action) {    
+switch ($action) {
     case 'add_course_vote':
-		
+
 		$course_id = intval($_REQUEST['course_id']);
         $star      = intval($_REQUEST['star']);
-		
-        if (!api_is_anonymous()) {     	    
-            CourseManager::add_course_vote($user_id, $star, $course_id, 0);                
-        }		
-		$point_info = CourseManager::get_course_ranking($course_id, 0); 		
-		$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';		
+
+        if (!api_is_anonymous()) {
+            CourseManager::add_course_vote($user_id, $star, $course_id, 0);
+        }
+		$point_info = CourseManager::get_course_ranking($course_id, 0);
+		$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
 	    $rating = Display::return_rating_system('star_'.$course_id, $ajax_url.'&amp;course_id='.$course_id, $point_info, false);
 		echo $rating;
-		
+
         break;
     case  'get_user_courses':
         if (api_is_platform_admin()) {
-            $user_id = intval($_POST['user_id']);            
+            $user_id = intval($_POST['user_id']);
             $list_course_all_info = CourseManager::get_courses_list_by_user_id($user_id, false);
             if (!empty($list_course_all_info)) {
-                foreach($list_course_all_info as $course_item) {                
-                    $course_info = api_get_course_info($course_item['code']);                    
+                foreach($list_course_all_info as $course_item) {
+                    $course_info = api_get_course_info($course_item['code']);
                     echo $course_info['title'].'<br />';
                 }
-            } else {            
+            } else {
                 echo get_lang('UserHasNoCourse');
-            } 
+            }
         }
         break;
     default:
         echo '';
 }
-exit;
+exit;

+ 1 - 1
main/inc/ajax/course_home.ajax.php

@@ -468,4 +468,4 @@ switch ($action) {
 	default:
 		echo '';
 }
-exit;
+exit;

+ 1 - 1
main/inc/ajax/exercise.ajax.php

@@ -408,4 +408,4 @@ switch ($action) {
     default:
         echo '';
 }
-exit;
+exit;

+ 6 - 4
main/inc/ajax/extra_field.ajax.php

@@ -1,21 +1,23 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 $language_file = array('admin', 'registration', 'userInfo');
 require_once '../global.inc.php';
 $action = $_GET['a'];
 
-switch ($action) {	
+switch ($action) {
     case 'get_second_select_options':
         $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
         $field_id = isset($_REQUEST['field_id']) ? $_REQUEST['field_id'] : null;
         $option_value_id = isset($_REQUEST['option_value_id']) ? $_REQUEST['option_value_id'] : null;
-        
+
         if (!empty($type) && !empty($field_id) && !empty($option_value_id)) {
             $field_options = new ExtraFieldOption($type);
-            echo $field_options->get_second_select_field_options_by_field($field_id, $option_value_id, true);           
+            echo $field_options->get_second_select_field_options_by_field($field_id, $option_value_id, true);
         }
         break;
     default:
         exit;
         break;
-}
+}
+exit;

+ 46 - 47
main/inc/ajax/install.ajax.php

@@ -10,59 +10,58 @@ $action = $_GET['a'];
 
 switch ($action) {
 	case 'send_contact_information':
-			if (!empty($_POST)) {          
-                            // get params from contact form
-                            $person_name = $_POST['person_name'];
-                            $person_email = $_POST['person_email'];
-                            $person_role = $_POST['person_role'];
-                            $financial_decision = $_POST['financial_decision'];
-                            $contact_language = $_POST['language'];
-                            $company_name = $_POST['company_name'];
-                            $company_activity = $_POST['company_activity'];
-                            $company_country = $_POST['company_country'];
-                            $company_city = $_POST['company_city']; 
+        if (!empty($_POST)) {
+            // get params from contact form
+            $person_name = $_POST['person_name'];
+            $person_email = $_POST['person_email'];
+            $person_role = $_POST['person_role'];
+            $financial_decision = $_POST['financial_decision'];
+            $contact_language = $_POST['language'];
+            $company_name = $_POST['company_name'];
+            $company_activity = $_POST['company_activity'];
+            $company_country = $_POST['company_country'];
+            $company_city = $_POST['company_city'];
 
-                            // validating required fields
-                            $a_required_fields = array($person_name, $person_role, $company_name, $company_activity, $company_country);
-                            $required_field_error = false;
-                            foreach($a_required_fields as $required_file) {
-                                if (trim($required_file) === '') {
-                                    $required_field_error = true;
-                                    break;
-                                }
-                            }
+            // validating required fields
+            $a_required_fields = array($person_name, $person_role, $company_name, $company_activity, $company_country);
+            $required_field_error = false;
+            foreach($a_required_fields as $required_file) {
+                if (trim($required_file) === '') {
+                    $required_field_error = true;
+                    break;
+                }
+            }
 
-                            if ($required_field_error) {
-                                echo 'required_field_error';
-                            } else {
+            if ($required_field_error) {
+                echo 'required_field_error';
+            } else {
 
-                                // save contact information with web service                                
-                                require_once '../lib/nusoap/nusoap.php';
+                // save contact information with web service
+                require_once '../lib/nusoap/nusoap.php';
 
-                                // create a client
-                                $client = new nusoap_client('http://version.chamilo.org/contact.php?wsdl', true);
+                // create a client
+                $client = new nusoap_client('http://version.chamilo.org/contact.php?wsdl', true);
 
-                                // call method ws_add_contact_information
-                                $contact_params = array(
-                                                        'person_name' => $person_name,
-                                                        'person_email' => $person_email,
-                                                        'person_role' => $person_role,
-                                                        'financial_decision' => $financial_decision,
-                                                        'contact_language' => $contact_language,
-                                                        'company_name' => $company_name,
-                                                        'company_activity' => $company_activity,
-                                                        'company_country' => $company_country,
-                                                        'company_city' => $company_city
-                                                    );
+                // call method ws_add_contact_information
+                $contact_params = array(
+                    'person_name' => $person_name,
+                    'person_email' => $person_email,
+                    'person_role' => $person_role,
+                    'financial_decision' => $financial_decision,
+                    'contact_language' => $contact_language,
+                    'company_name' => $company_name,
+                    'company_activity' => $company_activity,
+                    'company_country' => $company_country,
+                    'company_city' => $company_city
+                );
 
-                                $result = $client->call('ws_add_contact_information', array('contact_params' => $contact_params));
-								
-								echo $result;
-							}
+                $result = $client->call('ws_add_contact_information', array('contact_params' => $contact_params));
 
-				}
-			break;	
-	default:
-		echo '';
+                echo $result;
+            }
+        }
+    break;
+default:
+    echo '';
 }
 exit;

+ 13 - 13
main/inc/ajax/link.ajax.php

@@ -10,36 +10,36 @@ api_protect_course_script(true);
 
 $action = $_REQUEST['a'];
 
-switch ($action) {    
+switch ($action) {
     case 'check_url':
         if (api_is_allowed_to_edit(null, true)) {
             $url = $_REQUEST['url'];
-                        
-            //Check if curl is available            
+
+            //Check if curl is available
             if  (!in_array('curl', get_loaded_extensions())) {
                 echo '';
                 exit;
             }
-            
-            // set URL and other appropriate options            
+
+            // set URL and other appropriate options
             $defaults = array(
                 CURLOPT_URL => $url,
-                CURLOPT_FOLLOWLOCATION => true,         // follow redirects accept youtube.com                
+                CURLOPT_FOLLOWLOCATION => true,         // follow redirects accept youtube.com
                 CURLOPT_HEADER => 0,
                 CURLOPT_RETURNTRANSFER => true,
                 CURLOPT_TIMEOUT => 4
             );
             //create a new cURL resource
-            
+
             $ch = curl_init();
-            curl_setopt_array($ch, $defaults);        
-            
+            curl_setopt_array($ch, $defaults);
+
             // grab URL and pass it to the browser
-            $result = curl_exec($ch);    
-            
+            $result = curl_exec($ch);
+
             // close cURL resource, and free up system resources
             curl_close($ch);
-            
+
             if ($result) {
                 echo Display::return_icon('accept.png', get_lang('Ok'));
             } else {
@@ -50,4 +50,4 @@ switch ($action) {
     default:
         echo '';
 }
-exit;
+exit;

+ 3 - 1
main/inc/ajax/notebook.ajax.php

@@ -1,7 +1,9 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace Notebook;
 
 require_once '../global.inc.php';
 
-AjaxController::instance()->run();
+AjaxController::instance()->run();
+exit;

+ 3 - 1
main/inc/ajax/online.ajax.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 /*
  * To change this template, choose Tools | Templates
@@ -36,4 +37,5 @@ switch($action) {
         break;
     default:
         break;
-}
+}
+exit;

+ 69 - 72
main/inc/ajax/skill.ajax.php

@@ -6,9 +6,6 @@
 
 require_once '../global.inc.php';
 
-require_once api_get_path(LIBRARY_PATH).'skill.lib.php';
-require_once api_get_path(LIBRARY_PATH).'gradebook.lib.php';
-
 $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null;
 
 if (api_get_setting('allow_skills_tool') != 'true') {
@@ -24,10 +21,10 @@ $skill_gradebook = new SkillRelGradebook();
 switch ($action) {
     case 'add':
         if (api_is_platform_admin() || api_is_drh()) {
-            if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {            
-                $skill_id = $skill->edit($_REQUEST);    
+            if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {
+                $skill_id = $skill->edit($_REQUEST);
             } else {
-                $skill_id = $skill->add($_REQUEST);    
+                $skill_id = $skill->add($_REQUEST);
             }
         }
         echo $skill_id;
@@ -35,19 +32,19 @@ switch ($action) {
         if (api_is_platform_admin() || api_is_drh()) {
             echo $skill->delete($_REQUEST['skill_id']);
         }
-        break;      
-    case 'find_skills':        
+        break;
+    case 'find_skills':
         $skills = $skill->find('all', array('where' => array('name LIKE %?% '=>$_REQUEST['tag'])));
-        $return_skills = array();    
+        $return_skills = array();
         foreach ($skills as $skill) {
             $skill['caption'] = $skill['name'];
             $skill['value'] =  $skill['id'];
             $return_skills[] = $skill;
-        }            
+        }
         echo json_encode($return_skills);
-        break;    
-    case 'get_gradebooks':        
-        $gradebooks = $gradebook_list = $gradebook->get_all();        
+        break;
+    case 'get_gradebooks':
+        $gradebooks = $gradebook_list = $gradebook->get_all();
         $gradebook_list = array();
         //Only course gradebook with certificate
         if (!empty($gradebooks)) {
@@ -59,31 +56,31 @@ switch ($action) {
                 } else {
                   //  $gradebook['name'] = $gradebook_list[$gradebook['parent_id']]['name'].' > '.$gradebook['name'];
                     //$gradebook_list[]  = $gradebook;
-                }               
+                }
             }
         }
         echo json_encode($gradebook_list);
         break;
-    case 'find_gradebooks':        
-        $gradebooks = $gradebook->find('all', array('where' => array('name LIKE %?% ' => $_REQUEST['tag'])));        
-        $return = array();    
+    case 'find_gradebooks':
+        $gradebooks = $gradebook->find('all', array('where' => array('name LIKE %?% ' => $_REQUEST['tag'])));
+        $return = array();
         foreach ($gradebooks as $item) {
             $item['caption'] = $item['name'];
             $item['value'] =  $item['id'];
             $return[] = $item;
-        }        
-        echo json_encode($return);        
+        }
+        echo json_encode($return);
         break;
-    case 'get_course_info_popup':        
+    case 'get_course_info_popup':
         $course_info = api_get_course_info($_REQUEST['code']);
         $course_info['course_code'] = $course_info['code'];
         $courses = CourseManager::process_hot_course_item(array($course_info));
-        Display::display_no_header();        
+        Display::display_no_header();
         Display::$global_template->assign('hot_courses', $courses);
         echo Display::$global_template->fetch('default/layout/hot_course_item_popup.tpl');
         break;
     case 'gradebook_exists':
-        $data = $gradebook->get($_REQUEST['gradebook_id']);        
+        $data = $gradebook->get($_REQUEST['gradebook_id']);
         if (!empty($data)) {
             echo 1;
         } else {
@@ -91,22 +88,22 @@ switch ($action) {
         }
         break;
     case 'get_skills_by_profile':
-        $skill_rel_profile   = new SkillRelProfile();       
+        $skill_rel_profile   = new SkillRelProfile();
         $profile_id = isset($_REQUEST['profile_id']) ? $_REQUEST['profile_id'] : null;
         $skills = $skill_rel_profile->get_skills_by_profile($profile_id);
         echo json_encode($skills);
         break;
     case 'get_saved_profiles':
         $skill_profile   = new SkillProfile();
-        $profiles = $skill_profile->get_all();        
-        Display::display_no_header();        
+        $profiles = $skill_profile->get_all();
+        Display::display_no_header();
         Display::$global_template->assign('profiles', $profiles);
         echo Display::$global_template->fetch('default/skill/profile_item.tpl');
-        break;    
+        break;
     case 'get_skills':
-        $load_user_data = isset($_REQUEST['load_user_data']) ? $_REQUEST['load_user_data'] : null;        
+        $load_user_data = isset($_REQUEST['load_user_data']) ? $_REQUEST['load_user_data'] : null;
         $id = intval($_REQUEST['id']);
-        $skills = $skill->get_all($load_user_data, false, $id);                    
+        $skills = $skill->get_all($load_user_data, false, $id);
         echo json_encode($skills);
         break;
     case 'get_skill_info':
@@ -116,8 +113,8 @@ switch ($action) {
         break;
     case 'get_skill_course_info':
         $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
-        $skill_info = $skill->get_skill_info($id);        
-        $courses = $skill->get_courses_by_skill($id);        
+        $skill_info = $skill->get_skill_info($id);
+        $courses = $skill->get_courses_by_skill($id);
         $html = '';
         if (!empty($courses)) {
             $html = sprintf(get_lang('ToGetToLearnXYouWillNeedToTakeOneOfTheFollowingCourses'), '<i>'.$skill_info['name'].'</i>').'<br />';
@@ -127,37 +124,37 @@ switch ($action) {
                 $html .= Display::url(sprintf(get_lang('SkillXWithCourseX'), $skill_info['name'], $course['title']), $url, $attributes).'<br />';
             }
         }
-        echo $html;    
+        echo $html;
         break;
-    case 'get_skills_tree_json':        
+    case 'get_skills_tree_json':
         $user_id    = isset($_REQUEST['load_user']) && $_REQUEST['load_user'] == 1 ? api_get_user_id() : 0;
         $skill_id   = isset($_REQUEST['skill_id']) ? $_REQUEST['skill_id'] : 0;
-        $depth      = isset($_REQUEST['main_depth']) ? $_REQUEST['main_depth'] : 2;        
+        $depth      = isset($_REQUEST['main_depth']) ? $_REQUEST['main_depth'] : 2;
         $all = $skill->get_skills_tree_json($user_id, $skill_id, false, $depth);
         echo $all;
         break;
     case 'get_user_skills':
-        $skills = $skill->get_user_skills($user_id, true);        
-        Display::display_no_header();        
+        $skills = $skill->get_user_skills($user_id, true);
+        Display::display_no_header();
         Display::$global_template->assign('skills', $skills);
         echo Display::$global_template->fetch('default/skill/user_skills.tpl');
         break;
     case 'get_gradebook_info':
         $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
-        $info = $gradebook->get($id);                    
+        $info = $gradebook->get($id);
         echo json_encode($info);
-        break;  
+        break;
     case 'load_children':
         $id             = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
         $load_user_data = isset($_REQUEST['load_user_data']) ? $_REQUEST['load_user_data'] : null;
         $skills = $skill->get_children($id, $load_user_data);
-        
+
         $return = array();
         foreach ($skills as $skill) {
             if (isset($skill['data']) && !empty($skill['data'])) {
                 $return[$skill['data']['id']] = array(
                                                     'id'    => $skill['data']['id'],
-                                                    'name'  => $skill['data']['name'], 
+                                                    'name'  => $skill['data']['name'],
                                                     'passed'=> $skill['data']['passed']);
             }
         }
@@ -165,7 +162,7 @@ switch ($action) {
         if (empty($return)) {
             $success = false;
         }
-        
+
         $result = array (
             'success' => $success,
             'data' => $return
@@ -174,7 +171,7 @@ switch ($action) {
         break;
     case 'load_direct_parents':
         $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
-        $skills = $skill->get_direct_parents($id);        
+        $skills = $skill->get_direct_parents($id);
         $return = array();
         foreach($skills as $skill) {
             $return [$skill['data']['id']] = array (
@@ -183,26 +180,26 @@ switch ($action) {
                                                 'name'      => $skill['data']['name']
                                                 );
         }
-        echo json_encode($return);        
+        echo json_encode($return);
         break;
-    case 'profile_matches':        
+    case 'profile_matches':
         $skill_rel_user  = new SkillRelUser();
         $skills = $_REQUEST['skill_id'];
-        
+
         $total_skills_to_search = $skills;
-                
+
         $users  = $skill_rel_user->get_user_by_skills($skills);
-        
+
         $user_list = array();
-        
+
         $count_skills = count($skills);
-        
+
         if (!empty($users)) {
-            foreach ($users as $user) {            
+            foreach ($users as $user) {
                 $user_info = api_get_user_info($user['user_id']);
                 $user_list[$user['user_id']]['user'] = $user_info;
                 $my_user_skills = $skill_rel_user->get_user_skills($user['user_id']);
-                
+
                 $user_skill_list = array();
                 foreach ($my_user_skills as $skill_item) {
                     $user_skill_list[] = $skill_item['skill_id'];
@@ -210,26 +207,26 @@ switch ($action) {
 
                 $user_skills = array();
                 $found_counts = 0;
-                
+
                 foreach ($skills as $skill_id) {
                     $found = false;
                     if (in_array($skill_id, $user_skill_list)) {
                         $found = true;
                         $found_counts++;
-                        $user_skills[$skill_id] = array('skill_id' => $skill_id, 'found' => $found);                        
+                        $user_skills[$skill_id] = array('skill_id' => $skill_id, 'found' => $found);
                     }
                 }
-                
-                foreach ($my_user_skills as $my_skill) {                    
+
+                foreach ($my_user_skills as $my_skill) {
                     if (!isset($user_skills[$my_skill['skill_id']])) {
                         $user_skills[$my_skill['skill_id']] = array('skill_id' => $my_skill['skill_id'], 'found' => false);
                     }
-                    $total_skills_to_search[$my_skill['skill_id']] = $my_skill['skill_id']; 
+                    $total_skills_to_search[$my_skill['skill_id']] = $my_skill['skill_id'];
                 }
                 $user_list[$user['user_id']]['skills'] = $user_skills;
                 $user_list[$user['user_id']]['total_found_skills'] = $found_counts;
             }
-            
+
             $ordered_user_list = array();
             foreach ($user_list as $user_id => $user_data) {
                 $ordered_user_list[$user_data['total_found_skills']][] = $user_data;
@@ -239,62 +236,62 @@ switch ($action) {
                 arsort($ordered_user_list);
             }
         }
-        
-        Display::display_no_header();        
+
+        Display::display_no_header();
         Display::$global_template->assign('order_user_list', $ordered_user_list);
         Display::$global_template->assign('total_search_skills', $count_skills);
-        
+
         $skill_list = array();
 
         if (!empty($total_skills_to_search)) {
             $total_skills_to_search = $skill->get_skills_info($total_skills_to_search);
 
-            foreach ($total_skills_to_search as $skill_info) {                        
-                $skill_list[$skill_info['id']] = $skill_info;        
+            foreach ($total_skills_to_search as $skill_info) {
+                $skill_list[$skill_info['id']] = $skill_info;
             }
         }
 
         Display::$global_template->assign('skill_list', $skill_list);
-        echo Display::$global_template->fetch('default/skill/profile.tpl');        
-        break;                
+        echo Display::$global_template->fetch('default/skill/profile.tpl');
+        break;
     case 'delete_gradebook_from_skill':
     case 'remove_skill':
         if (api_is_platform_admin() || api_is_drh()) {
-            if (!empty($_REQUEST['skill_id']) && !empty($_REQUEST['gradebook_id'])) {            
-                $skill_item = $skill_gradebook->get_skill_info($_REQUEST['skill_id'], $_REQUEST['gradebook_id']);            
+            if (!empty($_REQUEST['skill_id']) && !empty($_REQUEST['gradebook_id'])) {
+                $skill_item = $skill_gradebook->get_skill_info($_REQUEST['skill_id'], $_REQUEST['gradebook_id']);
                 if (!empty($skill_item)) {
                     $skill_gradebook->delete($skill_item['id']);
                     echo 1;
                 } else {
-                    echo 0;    
+                    echo 0;
                 }
             } else {
                 echo 0;
             }
         }
-        break;             
+        break;
     case 'save_profile':
         if (api_is_platform_admin() || api_is_drh()) {
             $skill_profile = new SkillProfile();
             $params = $_REQUEST;
-            //$params['skills'] = isset($_SESSION['skills']) ? $_SESSION['skills'] : null; 
+            //$params['skills'] = isset($_SESSION['skills']) ? $_SESSION['skills'] : null;
             $params['skills'] = $params['skill_id'];
-            $skill_data = $skill_profile->save($params);        
+            $skill_data = $skill_profile->save($params);
             if (!empty($skill_data)) {
                 echo 1;
             } else {
                 echo 0;
             }
         }
-        break;        
+        break;
     case 'skill_exists':
-        $skill_data = $skill->get($_REQUEST['skill_id']);        
+        $skill_data = $skill->get($_REQUEST['skill_id']);
         if (!empty($skill_data)) {
             echo 1;
         } else {
             echo 0;
         }
-        break;   
+        break;
     default:
         echo '';
 }

+ 1 - 2
main/inc/ajax/social.ajax.php

@@ -1,5 +1,5 @@
 <?php
-/* For licensing terms, see /chamilo_license.txt */
+/* For licensing terms, see /license.txt */
 /**
  * Responses to AJAX calls
  */
@@ -123,7 +123,6 @@ switch ($action) {
 			echo '';
 			break;
 		}
-		require_once api_get_path(LIBRARY_PATH).'blog.lib.php';
 		require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
 
 		$user_id = intval($_SESSION['social_user_id']);

+ 60 - 62
main/inc/ajax/thematic.ajax.php

@@ -1,19 +1,17 @@
 <?php
-/* For licensing terms, see /chamilo_license.txt */
+/* For licensing terms, see /license.txt */
 /**
- * Responses to AJAX calls for thematic 
+ * Responses to AJAX calls for thematic
  */
- 
+
 require_once '../global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
-require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
 
 api_protect_course_script(true);
 
 $action = $_GET['a'];
 $thematic = new Thematic();
 
-switch ($action) {		
+switch ($action) {
 	case 'save_thematic_plan':
 		/*$title_list         = $_REQUEST['title'];
 		$description_list   = $_REQUEST['desc'];
@@ -24,51 +22,51 @@ switch ($action) {
 				$thematic->set_thematic_plan_attributes($_REQUEST['thematic_id'], $title_list[$i], $description_list[$i], $description_type[$i]);
 				$affected_rows = $thematic->thematic_plan_save();
 			}
-		}	
+		}
 		$thematic_plan_data = $thematic->get_thematic_plan_data();
 		$return = $thematic->get_thematic_plan_div($thematic_plan_data);
 		echo $return[$_REQUEST['thematic_id']];*/
-		break;        
-	case 'save_thematic_advance':		
+		break;
+	case 'save_thematic_advance':
 		if (!api_is_allowed_to_edit(null, true)) {
 			echo '';
 			exit;
         }
         /*
-		if (($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) || (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) ) {	    			
+		if (($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) || (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) ) {
 			if ($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) {
         		$start_date_error = true;
-    			$data['start_date_error'] = $start_date_error;	
-			} 
-        			
+    			$data['start_date_error'] = $start_date_error;
+			}
+
         	if (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) {
         		$duration_error = true;
-    			$data['duration_error'] = $duration_error;	
+    			$data['duration_error'] = $duration_error;
         	}
-    
-    		$data['action'] = $_REQUEST['action'];	
-    		$data['thematic_id'] = $_REQUEST['thematic_id'];				
-    		$data['attendance_select'] = $attendance_select;					
+
+    		$data['action'] = $_REQUEST['action'];
+    		$data['thematic_id'] = $_REQUEST['thematic_id'];
+    		$data['attendance_select'] = $attendance_select;
     		if (isset($_REQUEST['thematic_advance_id'])) {
     			$data['thematic_advance_id'] = $_REQUEST['thematic_advance_id'];
     			$thematic_advance_data = $thematic->get_thematic_advance_list($_REQUEST['thematic_advance_id']);
-    			$data['thematic_advance_data'] = $thematic_advance_data;		
-    		}	    			
-		} else {   				
-			if ($_REQUEST['thematic_advance_token'] == $_SESSION['thematic_advance_token'] && api_is_allowed_to_edit(null, true)) {    	    			
+    			$data['thematic_advance_data'] = $thematic_advance_data;
+    		}
+		} else {
+			if ($_REQUEST['thematic_advance_token'] == $_SESSION['thematic_advance_token'] && api_is_allowed_to_edit(null, true)) {
     	    	$thematic_advance_id 	= $_REQUEST['thematic_advance_id'];
-    	    	$thematic_id 			= $_REQUEST['thematic_id'];	    			
+    	    	$thematic_id 			= $_REQUEST['thematic_id'];
     	    	$content 				= $_REQUEST['real_content'];
     	    	$duration				= $_REQUEST['duration_in_hours'];
     	    	if (isset($_REQUEST['start_date_type']) && $_REQUEST['start_date_type'] == 2) {
     	    		$start_date 	= $thematic->build_datetime_from_array($_REQUEST['custom_start_date']);
-    	    		$attendance_id 	= 0;	
+    	    		$attendance_id 	= 0;
     	    	} else {
     	    		$start_date 	= $_REQUEST['start_date_by_attendance'];
     	    		$attendance_id 	= $_REQUEST['attendance_select'];
-    	    	}		    			
-    	    	$thematic->set_thematic_advance_attributes($thematic_advance_id, $thematic_id,  $attendance_id, $content, $start_date, $duration);	    				    								
-				$affected_rows = $thematic->thematic_advance_save();			        	
+    	    	}
+    	    	$thematic->set_thematic_advance_attributes($thematic_advance_id, $thematic_id,  $attendance_id, $content, $start_date, $duration);
+				$affected_rows = $thematic->thematic_advance_save();
     		    if ($affected_rows) {
     		    	// get last done thematic advance before move thematic list
     				$last_done_thematic_advance = $thematic->get_last_done_thematic_advance();
@@ -79,53 +77,53 @@ switch ($action) {
 				}
 			}
 		}
-		$thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true);        
-		$return = $thematic->get_thematic_advance_div($thematic_advance_data);		
+		$thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true);
+		$return = $thematic->get_thematic_advance_div($thematic_advance_data);
 		echo $return[$_REQUEST['thematic_id']][$_REQUEST['thematic_advance_id']];*/
-        break;		
-	case 'get_datetime_by_attendance':							
-		$attendance_id       = intval($_REQUEST['attendance_id']);        
+        break;
+	case 'get_datetime_by_attendance':
+		$attendance_id       = intval($_REQUEST['attendance_id']);
 		$thematic_advance_id = intval($_REQUEST['thematic_advance_id']);
-		
+
 		$label = '';
-		$input_select = '';			
+		$input_select = '';
 		if (!empty($attendance_id)) {
-			$attendance = new Attendance();										
-			$thematic   = new Thematic();                
+			$attendance = new Attendance();
+			$thematic   = new Thematic();
             $thematic_list = $thematic->get_thematic_list();
-            
+
             $my_list = $thematic_list_temp = array();
-            foreach ($thematic_list as $item) {                    	
-                $my_list = $thematic->get_thematic_advance_by_thematic_id($item['id']);                    
+            foreach ($thematic_list as $item) {
+                $my_list = $thematic->get_thematic_advance_by_thematic_id($item['id']);
                 $thematic_list_temp = array_merge($my_list, $thematic_list_temp);
-            }     
+            }
 			$new_thematic_list = array();
-		
+
 			foreach($thematic_list_temp as $item) {
 				if (!empty($item['attendance_id']) ) {
 					$new_thematic_list[$item['id']] = array('attendance_id' =>$item['attendance_id'], 'start_date'=>$item['start_date']);
 				}
-			}            
-			          
-			$attendance_calendar = $attendance->get_attendance_calendar($attendance_id);	
-            
+			}
+
+			$attendance_calendar = $attendance->get_attendance_calendar($attendance_id);
+
 			$label = get_lang('StartDate');
 			if (!empty($attendance_calendar)) {
-				$input_select .= '<select id="start_date_select_calendar" name="start_date_by_attendance" UNIQUE size="5">';				
+				$input_select .= '<select id="start_date_select_calendar" name="start_date_by_attendance" UNIQUE size="5">';
 				foreach ($attendance_calendar as $calendar) {
                     $selected = null;
 					$insert = true;
-					//checking if was already taken						
+					//checking if was already taken
 					foreach ($new_thematic_list as $key => $thematic_item) {
 						//if ($calendar['db_date_time'] == $thematic_item['start_date'] && $calendar['attendance_id'] == $thematic_item['attendance_id'] ) {
                         if ($calendar['db_date_time'] == $thematic_item['start_date'] ) {
-							$insert = false;                            
+							$insert = false;
                             if ($thematic_advance_id == $key) {
-                                $insert = true; 
+                                $insert = true;
                                 $selected = 'selected';
                             }
-							break;	
-						}						
+							break;
+						}
 					}
 					if ($insert == true) {
 						$input_select .= '<option '.$selected.' value="'.$calendar['date_time'].'">'.$calendar['date_time'].'</option>';
@@ -135,23 +133,23 @@ switch ($action) {
 			} else {
 				$input_select .= '<em>'.get_lang('ThereAreNoRegisteredDatetimeYet').'</em>';
 			}
-		} 
-		?>			
+		}
+		?>
 		<div class="control-group">
 			<label class="control-label"><?php echo $label ?></label>
 			<div class="controls"><?php echo $input_select ?></div>
-		</div>			
-		<?php				
-	    break;	    
-	case 'update_done_thematic_advance':	
+		</div>
+		<?php
+	    break;
+	case 'update_done_thematic_advance':
 		$thematic_advance_id = intval($_GET['thematic_advance_id']);
-		$total_average = 0;			
-		if (!empty($thematic_advance_id)) {				
-			$thematic = new Thematic();				
-			$affected_rows  = $thematic->update_done_thematic_advances($thematic_advance_id);			
+		$total_average = 0;
+		if (!empty($thematic_advance_id)) {
+			$thematic = new Thematic();
+			$affected_rows  = $thematic->update_done_thematic_advances($thematic_advance_id);
 			//if ($affected_rows) {
 			$total_average  = $thematic->get_total_average_of_thematic_advances(api_get_course_id(), api_get_session_id());
-			//}			
+			//}
 		}
 		echo $total_average;
 		break;

+ 6 - 4
main/inc/ajax/timeline.ajax.php

@@ -1,18 +1,20 @@
 <?php
+/* For licensing terms, see /license.txt */
+
 require_once '../global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'timeline.lib.php';
 
 $timeline = new Timeline();
 
 $action = $_GET['a'];
 
-switch ($action) {		
+switch ($action) {
 	case 'get_timeline_content':
         $items = $timeline->get_timeline_content($_GET['id']);
-        echo json_encode($items);      
+        echo json_encode($items);
         /*echo '<pre>';
         echo json_encode($items);
         echo '</pre>';
         var_dump($items);*/
     break;
-}
+}
+exit;

+ 1 - 1
main/inc/ajax/user_manager.ajax.php

@@ -1,5 +1,5 @@
 <?php
-/* For licensing terms, see /chamilo_license.txt */
+/* For licensing terms, see /license.txt */
 /**
  * Responses to AJAX calls
  */

+ 2 - 6
main/inc/ajax/work.ajax.php

@@ -5,17 +5,13 @@
  */
 
 require_once '../global.inc.php';
-
 require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
 
-
 $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null;
 
 switch ($action) {
-	case 'get_work_user_list':        
-       
-
-		break;	
+	case 'get_work_user_list':
+		break;
     default:
         echo '';
 }

+ 2 - 1
main/inc/lib/link.lib.php

@@ -20,7 +20,8 @@
 
 /* FUNCTIONS */
 
-class Link extends Model {
+class Link extends Model
+{
     var $table;
     var $is_course_model = true;
     var $columns = array('id', 'c_id','url','title','description','category_id', 'display_order', 'on_homepage', 'target', 'session_id');

+ 5 - 0
main/inc/lib/main_api.lib.php

@@ -392,6 +392,11 @@ define('SOCIAL_CENTER_PLUGIN',      2);
 define('SOCIAL_RIGHT_PLUGIN',       3);
 define('CUT_GROUP_NAME', 50);
 
+//Skills
+define ('SKILL_TYPE_REQUIREMENT',   'required');
+define ('SKILL_TYPE_ACQUIRED',      'acquired');
+define ('SKILL_TYPE_BOTH',          'both');
+
 
 /* PATHS & FILES - ROUTINES */
 

+ 0 - 1
main/inc/lib/nanogong.lib.php

@@ -278,7 +278,6 @@ class Nanogong
      */
     public function upload_file($is_nano = false)
     {
-        require_once api_get_path(LIBRARY_PATH).'document.lib.php';
         if (!empty($_FILES)) {
             $upload_ok = FileManager::process_uploaded_file($_FILES['file'], false);
 

+ 5 - 4
main/inc/lib/notebook.lib.php

@@ -10,8 +10,9 @@
  */
 class NotebookManager {
 
-    private function __construct() {
-        
+    public function __construct()
+    {
+
     }
 
     /**
@@ -165,7 +166,7 @@ class NotebookManager {
             $sort_direction = 'DESC';
             $link_sort_direction = 'ASC';
         }
-        
+
         // action links
         echo '<div class="actions">';
         if (!api_is_anonymous()) {
@@ -223,6 +224,6 @@ class NotebookManager {
             echo '<a href="' . api_get_self() . '?action=editnote&amp;notebook_id=' . $row['notebook_id'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>';
             echo '<a href="' . api_get_self() . '?action=deletenote&amp;notebook_id=' . $row['notebook_id'] . '" onclick="return confirmation(\'' . $row['title'] . '\');">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
             echo '</div>';
-        }        
+        }
     }
 }

+ 1 - 1
main/inc/lib/search/xapian/XapianIndexer.class.php

@@ -72,7 +72,7 @@ abstract class XapianIndexer
         }
 
         if ($path == null) {
-            $path = api_get_path(SYS_PATH_DATA).'searchdb/';
+            $path = api_get_path(SYS_DATA_PATH).'searchdb/';
         }
         try {
             $this->db = new XapianWritableDatabase($path, $dbMode);

+ 1 - 1
main/inc/lib/search/xapian/XapianQuery.php

@@ -12,7 +12,7 @@ require_once dirname(__FILE__) . '/../IndexableChunk.class.php';
 //TODO: think another way without including specific fields here
 require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
 
-define('XAPIAN_DB', api_get_path(SYS_PATH_DATA) . 'data/searchdb/');
+define('XAPIAN_DB', api_get_path(SYS_DATA_PATH) . 'searchdb/');
 
 /**
  * Queries the database.

+ 3 - 7
main/inc/lib/skill.lib.php

@@ -8,14 +8,10 @@
 /**
  * Code
  */
-define ('SKILL_TYPE_REQUIREMENT',   'required');
-define ('SKILL_TYPE_ACQUIRED',      'acquired');
-define ('SKILL_TYPE_BOTH',          'both');
 
-require_once api_get_path(LIBRARY_PATH).'model.lib.php';
-
-class SkillProfile extends Model {
-    var $columns = array('id', 'name', 'description');
+class SkillProfile extends Model
+{
+    public $columns = array('id', 'name', 'description');
     public function __construct() {
         $this->table = Database::get_main_table(TABLE_MAIN_SKILL_PROFILE);
         $this->table_rel_profile = Database::get_main_table(TABLE_MAIN_SKILL_REL_PROFILE);

+ 1 - 3
main/notebook/index.php

@@ -16,8 +16,6 @@ require_once '../inc/global.inc.php';
 
 $current_course_tool  = TOOL_NOTEBOOK;
 
-require_once api_get_path(LIBRARY_PATH).'notebook.lib.php';
-
 // The section (tabs)
 $this_section = SECTION_COURSES;
 
@@ -26,7 +24,7 @@ api_protect_course_script(true);
 
 // Additional javascript
 $htmlHeadXtra[] = NotebookManager::javascript_notebook();
-$htmlHeadXtra[] = '<script type="text/javascript">
+$htmlHeadXtra[] = '<script>
 function setFocus(){
 $("#note_title").focus();
 }

+ 1 - 3
main/reservation/rsys.php

@@ -1741,7 +1741,5 @@ class Rsys {
 $language_file = 'reservation';
 $cidReset = true;
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'sortable_table.class.php';
 Rsys :: init();
-require_once 'rcalendar.php';
-require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
+require_once 'rcalendar.php';

+ 0 - 1
main/social/home.php

@@ -11,7 +11,6 @@ $language_file = array('userInfo');
 $cidReset = true;
 
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'skill.lib.php';
 
 $user_id = api_get_user_id();
 $show_full_profile = true;

+ 0 - 2
main/social/skills_tree.php

@@ -10,8 +10,6 @@ $language_file = array('admin');
 
 $cidReset = true;
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'skill.lib.php';
-require_once api_get_path(LIBRARY_PATH).'skill.visualizer.lib.php';
 
 $this_section = SECTION_MYPROFILE;
 

+ 2 - 4
main/timeline/view.php

@@ -1,6 +1,6 @@
 <?php
 /* For licensing terms, see /license.txt */
-/**	
+/**
 	@author Julio Montoya <gugli100@gmail.com> BeezNest 2011
 *	@package chamilo.timeline
 */
@@ -9,8 +9,6 @@
 $language_file = array ('registration','admin');
 require_once '../inc/global.inc.php';
 
-require_once api_get_path(LIBRARY_PATH).'timeline.lib.php';  
-
 $interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('Timeline'));
 $interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('Listing'));
 
@@ -28,7 +26,7 @@ $htmlHeadXtra[] = '
 <script>
 	$(document).ready(function() {
 		var timeline = new VMM.Timeline();
-		timeline.init("'.$url.'");			
+		timeline.init("'.$url.'");
 	});
 </script>';
 $content = '<div class="timeline-example"><div id="timeline"></div></div>';

+ 0 - 1
main/tracking/lp_results_by_user.php

@@ -14,7 +14,6 @@
 $language_file = array ('registration', 'index', 'tracking', 'exercice','survey');
 
 require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
 require_once api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php';
 
 $this_section = SECTION_TRACKING;

+ 0 - 1
main/tracking/question_course_report.php

@@ -12,7 +12,6 @@ require_once '../inc/global.inc.php';
 
 require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php';
 require_once api_get_path(SYS_CODE_PATH).'exercice/question.class.php';
-require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
 require_once api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php';
 
 require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php';