Browse Source

Merge remote-tracking branch 'upstream/1.9.x' into 1.9.x

Francis Gonzales 11 years ago
parent
commit
2f7f5a63f8

+ 11 - 6
main/coursecopy/classes/CourseRestorer.class.php

@@ -92,10 +92,10 @@ class CourseRestorer
 	 */
     public function __construct($course)
     {
-		$this->course							= $course;
-		$course_info 							= api_get_course_info($this->course->code);
+        $this->course = $course;
+        $course_info = api_get_course_info($this->course->code);
         if (!empty($course_info)) {
-		    $this->course_origin_id 				= $course_info['real_id'];
+            $this->course_origin_id = $course_info['real_id'];
         } else {
             $this->course_origin_id = null;
         }
@@ -112,10 +112,12 @@ class CourseRestorer
     {
 		$this->file_option = $option;
 	}
+
     function set_add_text_in_items($status)
     {
         $this->add_text_in_items = $status;
     }
+
     function set_tool_copy_settings($array)
     {
         $this->tool_copy_settings = $array;
@@ -1318,8 +1320,7 @@ class CourseRestorer
         if ($this->course->has_resources(RESOURCE_TEST_CATEGORY))
         {
             $resources = $this->course->resources;
-            foreach ($resources[RESOURCE_TEST_CATEGORY] as $id => $CourseCopyTestcategory )
-            {
+            foreach ($resources[RESOURCE_TEST_CATEGORY] as $id => $CourseCopyTestcategory ) {
                 $tab_test_category_id_old_new[$CourseCopyTestcategory->source_id] = $id;
                 // check if this test_category already exist in the destination BDD
                 // do not Database::escape_string $title and $description, it will be done later
@@ -1591,6 +1592,8 @@ class CourseRestorer
 	 */
 	function restore_learnpaths($session_id = 0, $respect_base_content = false)
     {
+        $session_id = intval($session_id);
+
 		if ($this->course->has_resources(RESOURCE_LEARNPATH)) {
 			$table_main 	= Database::get_course_table(TABLE_LP_MAIN);
 			$table_item 	= Database::get_course_table(TABLE_LP_ITEM);
@@ -1679,7 +1682,9 @@ class CourseRestorer
 					            image = 'scormbuilder.gif',
 					            visibility = '1',
 					            admin = '0',
-					            address = 'squaregrey.gif'";
+					            address = 'squaregrey.gif',
+					            session_id = $session_id
+                            ";
 					Database::query($sql);
 				}
 

+ 6 - 6
main/inc/ajax/model.ajax.php

@@ -179,11 +179,11 @@ switch ($action) {
         break;
     case 'get_work_teacher':
         require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
-        $count = getWorkListTeacher($start, $limit, $sidx, $sord, $where_condition, true);
+        $count = getWorkListTeacher(0, $limit, $sidx, $sord, $where_condition, true);
         break;
     case 'get_work_student':
         require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
-        $count = getWorkListStudent($start, $limit, $sidx, $sord, $where_condition, true);
+        $count = getWorkListStudent(0, $limit, $sidx, $sord, $where_condition, true);
 
         break;
     case 'get_work_user_list_all':
@@ -205,10 +205,10 @@ switch ($action) {
 
         if (empty($documents)) {
             $where_condition .= " AND u.user_id = ".api_get_user_id();
-            $count = get_work_user_list($start, $limit, $sidx, $sord, $work_id, $where_condition, null, true);
+            $count = get_work_user_list(0, $limit, $sidx, $sord, $work_id, $where_condition, null, true);
         } else {
             $count = get_work_user_list_from_documents(
-                $start,
+                0,
                 $limit,
                 $sidx,
                 $sord,
@@ -1060,13 +1060,13 @@ if (in_array($action, $allowed_actions)) {
         switch ($export_format) {
             case 'xls':
                 //TODO add date if exists
-                $file_name = (!empty($action)) ? $action : 'company_report'; 
+                $file_name = (!empty($action)) ? $action : 'company_report';
                 Export::export_table_xls($array, $file_name);
                 break;
             case 'csv':
             default:
                 //TODO add date if exists
-                $file_name = (!empty($action)) ? $action : 'company_report'; 
+                $file_name = (!empty($action)) ? $action : 'company_report';
                 Export::export_table_csv($array, $file_name);
                 break;
         }

+ 5 - 3
main/inc/global.inc.php

@@ -137,7 +137,7 @@ if (!$_configuration['db_host']) {
 if (!empty($_configuration['multiple_access_urls'])) {
     $_configuration['access_url'] = 1;
     $access_urls = api_get_access_urls();
-    
+
     $root_rel = api_get_self();
     $root_rel = substr($root_rel,1);
     $pos = strpos($root_rel,'/');
@@ -317,6 +317,7 @@ if (file_exists($mail_conf)) {
 // ===== "who is logged in?" module section =====
 
 
+
 // check and modify the date of user in the track.e.online table
 if (!$x = strpos($_SERVER['PHP_SELF'], 'whoisonline.php')) {
     LoginCheck(isset($_user['user_id']) ? $_user['user_id'] : '');
@@ -325,8 +326,9 @@ if (!$x = strpos($_SERVER['PHP_SELF'], 'whoisonline.php')) {
 // ===== end "who is logged in?" module section =====
 
 if (api_get_setting('server_type') == 'test') {
-    error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
-    //error_reporting(-1);
+    //error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
+    ini_set('display_errors', '1');
+    error_reporting(-1);
 } else {
     /*
     Server type is not test

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

@@ -1158,7 +1158,8 @@ class Database {
      * @example array('where'=> array('name = "Julio" AND lastname = "montoya"))
     */
 
-    public static function select($columns, $table_name, $conditions = array(), $type_result = 'all', $option = 'ASSOC') {
+    public static function select($columns, $table_name, $conditions = array(), $type_result = 'all', $option = 'ASSOC')
+    {
         $conditions = self::parse_conditions($conditions);
 
         //@todo we could do a describe here to check the columns ...

+ 4 - 2
main/inc/lib/display.lib.php

@@ -58,13 +58,15 @@ class Display {
     /**
      * Displays the reduced page header (without banner)
      */
-    public static function display_reduced_header() {
+    public static function display_reduced_header()
+    {
         global $show_learnpath, $tool_name;
         self::$global_template = new Template($tool_name, false, false, $show_learnpath);
         echo self::$global_template ->show_header_template();
     }
 
-    public static function display_no_header() {
+    public static function display_no_header()
+    {
         global $tool_name;
         $disable_js_and_css_files = true;
         self::$global_template = new Template($tool_name, false, false, $show_learnpath);

+ 2 - 3
main/inc/lib/document.lib.php

@@ -2877,7 +2877,6 @@ class DocumentManager
         $path = Database::escape_string(str_replace('_', '\_', $path));
         $added_slash = ($path == '/') ? '' : '/';
 
-
         //$condition_session = " AND (id_session = '$session_id' OR (id_session = '0' AND insert_date <= (SELECT creation_date FROM $tbl_course WHERE code = '".$course_info['code']."' )))";
         $condition_session = " AND (id_session = '$session_id' OR  id_session = '0' )";
 
@@ -2913,7 +2912,7 @@ class DocumentManager
         if ($lp_id) {
             $return .= '<div class="lp_resource_element">';
             $return .= Display::return_icon('new_doc.gif', '', array(), ICON_SIZE_SMALL);
-            $return .= Display::url(get_lang('NewDocument'), api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_DOCUMENT . '&lp_id=' . $_SESSION['oLP']->lp_id);
+            $return .= Display::url(get_lang('NewDocument'), api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_DOCUMENT.'&lp_id='.$_SESSION['oLP']->lp_id);
             $return .= '</div>';
         } else {
             $return .= Display::div(Display::url(Display::return_icon('close.png', get_lang('Close'), array(), ICON_SIZE_SMALL), ' javascript:void(0);', array('id' => 'close_div_' . $course_info['real_id'] . '_' . $session_id, 'class' => 'close_div')), array('style' => 'position:absolute;right:10px'));
@@ -3129,7 +3128,7 @@ class DocumentManager
                         // Show the "image name" not the filename of the image.
                         if ($lp_id) {
                             //LP URL
-                            $url = api_get_self() . '?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;action=add_item&amp;type=' . TOOL_DOCUMENT . '&amp;file=' . $key . '&amp;lp_id=' . $lp_id;
+                            $url = api_get_self() . '?'.api_get_cidreq().'&amp;action=add_item&amp;type=' . TOOL_DOCUMENT . '&amp;file=' . $key . '&amp;lp_id=' . $lp_id;
                             if (!empty($overwrite_url)) {
                                 $url = $overwrite_url . '&document_id=' . $key;
                             }

+ 84 - 84
main/inc/lib/internationalization_database/name_order_conventions.php

@@ -7,7 +7,7 @@
  * The following table contains two types of conventions concerning person names:
  *
  * "format" - determines how a full person name to be formatted, i.e. in what order the title, the first_name and the last_name to be placed.
- * You maight need to correct the value for your language. The possible values are:
+ * You might need to correct the value for your language. The possible values are:
  * title first_name last_name  - Western order;
  * title last_name first_name  - Eastern order;
  * title last_name, first_name - Western libraries order.
@@ -19,90 +19,90 @@
  * last_name                   - sorting names with priority for the last name.
  */
 return array(
-	'afrikaans' =>        array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'albanian' =>         array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'alemannic' =>        array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'amharic' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'armenian' =>         array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'arabic' =>           array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'asturian' =>         array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'bosnian' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'brazilian' =>        array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'breton' =>           array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'bulgarian' =>        array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'catalan' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'croatian' =>         array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'czech' =>            array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'danish' =>           array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'dari' =>             array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'dutch' =>            array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'english' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'esperanto' =>        array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'estonian' =>         array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'basque'  =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'finnish' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'french' =>           array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'frisian' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'friulian' =>         array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'galician' =>         array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'georgian' =>         array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'german' =>           array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'greek' =>            array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'hawaiian' =>         array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'hebrew' =>           array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'hindi' =>            array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'hungarian' =>        array(  'format' => 'title last_name first_name',  'sort_by' => 'last_name'   ), // Eastern order
-	'icelandic' =>        array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'indonesian' =>       array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'irish' =>            array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'italian' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'japanese' =>         array(  'format' => 'title last_name first_name',  'sort_by' => 'last_name'   ), // Eastern order
-	'korean' =>           array(  'format' => 'title last_name first_name',  'sort_by' => 'last_name'   ), // Eastern order
-	'latin' =>            array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'latvian' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'lithuanian' =>       array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'macedonian' =>       array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'malay' =>            array(  'format' => 'title last_name first_name',  'sort_by' => 'last_name'   ), // Eastern order
-	'manx' =>             array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'marathi' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'middle_frisian' =>   array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'mingo' =>            array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'nepali' =>           array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'norwegian' =>        array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'occitan' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'pashto' =>           array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'persian' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'polish' =>           array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'portuguese' =>       array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'quechua_cusco' =>    array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'romanian' =>         array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'rumantsch' =>        array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'russian' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'sanskrit' =>         array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'serbian' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'serbian_cyrillic' => array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'simpl_chinese' =>    array(  'format' => 'title last_name first_name',  'sort_by' => 'last_name'   ), // Eastern order
-	'slovak' =>           array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'slovenian' =>        array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
+	'afrikaans' =>        array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'albanian' =>         array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'alemannic' =>        array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'amharic' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'armenian' =>         array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'arabic' =>           array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'asturian' =>         array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'bosnian' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'brazilian' =>        array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'breton' =>           array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'bulgarian' =>        array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'catalan' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'croatian' =>         array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'czech' =>            array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'danish' =>           array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'dari' =>             array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'dutch' =>            array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'english' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'esperanto' =>        array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'estonian' =>         array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'basque'  =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'finnish' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'french' =>           array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'frisian' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'friulian' =>         array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+    'galician' =>         array('format' => 'title last_name, first_name',  'sort_by' => 'last_name'),
+	'georgian' =>         array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'german' =>           array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'greek' =>            array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'hawaiian' =>         array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'hebrew' =>           array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'hindi' =>            array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'hungarian' =>        array('format' => 'title last_name first_name',  'sort_by' => 'last_name'), // Eastern order
+	'icelandic' =>        array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'indonesian' =>       array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'irish' =>            array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'italian' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'japanese' =>         array('format' => 'title last_name first_name',  'sort_by' => 'last_name'), // Eastern order
+	'korean' =>           array('format' => 'title last_name first_name',  'sort_by' => 'last_name'), // Eastern order
+	'latin' =>            array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'latvian' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'lithuanian' =>       array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'macedonian' =>       array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'malay' =>            array('format' => 'title last_name first_name',  'sort_by' => 'last_name'), // Eastern order
+	'manx' =>             array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'marathi' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'middle_frisian' =>   array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'mingo' =>            array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'nepali' =>           array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'norwegian' =>        array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'occitan' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'pashto' =>           array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'persian' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'polish' =>           array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'portuguese' =>       array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'quechua_cusco' =>    array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'romanian' =>         array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'rumantsch' =>        array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'russian' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'sanskrit' =>         array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'serbian' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'serbian_cyrillic' => array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'simpl_chinese' =>    array('format' => 'title last_name first_name',  'sort_by' => 'last_name' ), // Eastern order
+	'slovak' =>           array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'slovenian' =>        array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
 
-	//'spanish' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'last_name'  ),
-	//'spanish' =>          array(  'format' => 'title last_name first_name',  'sort_by' => 'last_name'  ),
+	//'spanish' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'last_name'),
+	//'spanish' =>          array(  'format' => 'title last_name first_name',  'sort_by' => 'last_name'),
 	// Some experimental settings for Spanish language:
-	//'spanish' =>          array(  'format' => 'title first_name LAST_NAME',  'sort_by' => 'first_name'  ), // Western order, last name is uppercase when a full name is assembled
-	//'spanish' =>          array(  'format' => 'title first_name LAST_NAME',  'sort_by' => 'last_name'   ), // Western order, last name is uppercase when a full name is assembled
-	'spanish' =>          array(  'format' => 'title last_name, first_name',  'sort_by' => 'last_name'  ), // Library order
-	//'spanish' =>          array(  'format' => 'title LAST_NAME, first_name',  'sort_by' => 'last_name'  ), // Library order, last name is uppercase when a full name is assembled
+	//'spanish' =>          array(  'format' => 'title first_name LAST_NAME',  'sort_by' => 'first_name'), // Western order, last name is uppercase when a full name is assembled
+	//'spanish' =>          array(  'format' => 'title first_name LAST_NAME',  'sort_by' => 'last_name'), // Western order, last name is uppercase when a full name is assembled
+	'spanish' =>          array('format' => 'title last_name, first_name',  'sort_by' => 'last_name'), // Library order
+	//'spanish' =>          array(  'format' => 'title LAST_NAME, first_name',  'sort_by' => 'last_name'), // Library order, last name is uppercase when a full name is assembled
 
-	'swahili' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'swedish' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'tagalog' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'tamil' =>            array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'thai' =>             array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'trad_chinese' =>     array(  'format' => 'title last_name first_name',  'sort_by' => 'last_name'   ), // Eastern order
-	'turkish' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'ukrainian' =>        array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'vietnamese' =>       array(  'format' => 'title last_name first_name',  'sort_by' => 'last_name'   ), // Eastern order
-	'welsh' =>            array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'yiddish' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
-	'yoruba' =>           array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  )
+	'swahili' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'swedish' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'tagalog' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'tamil' =>            array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'thai' =>             array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'trad_chinese' =>     array('format' => 'title last_name first_name',  'sort_by' => 'last_name'), // Eastern order
+	'turkish' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'ukrainian' =>        array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'vietnamese' =>       array('format' => 'title last_name first_name',  'sort_by' => 'last_name'), // Eastern order
+	'welsh' =>            array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'yiddish' =>          array('format' => 'title first_name last_name',  'sort_by' => 'first_name'),
+	'yoruba' =>           array('format' => 'title first_name last_name',  'sort_by' => 'first_name')
 );

+ 81 - 81
main/inc/lib/internationalization_database/non_utf8_encodings.php

@@ -10,85 +10,85 @@
  * Put the probably most used for your language encoding at the first place.
  */
 return array(
-	'afrikaans' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'albanian' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'alemannic' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'amharic' => array(),
-	'armenian' => array('ARMSCII-8'),
-	'arabic' => array('WINDOWS-1256', 'ISO-8859-6'),
-	'asturian' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'belarusian' => array('WINDOWS-1251', 'ISO-8859-5'),
-	'bosnian' => array('WINDOWS-1250', 'ISO-8859-2'),
-	'brazilian' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'breton' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'bulgarian' => array('WINDOWS-1251', 'ISO-8859-5', 'KOI8-R'),
-	'catalan' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'croatian' => array('WINDOWS-1250', 'ISO-8859-2'),
-	'czech' => array('WINDOWS-1250', 'ISO-8859-2'),
-	'danish' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'dari' => array(),
-	'dutch' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'english' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'esperanto' => array('ISO-8859-3'),
-	'estonian' => array('WINDOWS-1257', 'ISO-8859-13', 'ISO-8859-15'),
-	'basque' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'finnish' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'french' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'frisian' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'friulian' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'galician' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'georgian' => array('GEORGIAN-ACADEMY', 'GEORGIAN-PS'),
-	'german' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'greek' => array('WINDOWS-1253', 'ISO-8859-7'),
-	'hawaiian' => array(),
-	'hebrew' => array('ISO-8859-8', 'WINDOWS-1255'),
-	'hindi' => array(),
-	'hungarian' => array('WINDOWS-1250', 'ISO-8859-2'),
-	'icelandic' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'indonesian' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'irish' =>  array('ISO-8859-15', 'WINDOWS-1252'),
-	'italian' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'japanese' => array('EUC-JP', 'ISO-2022-JP', 'SHIFT-JIS'),
-	'korean' => array('EUC-KR', 'ISO-2022-KR', 'CP949'),
-	'latin' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'latvian' => array('WINDOWS-1257', 'ISO-8859-13'),
-	'lithuanian' => array('WINDOWS-1257', 'ISO-8859-13'),
-	'macedonian' => array('WINDOWS-1251'),
-	'malay' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'manx' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'marathi' => array(),
-	'middle_frisian' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'mingo' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'nepali' => array(),
-	'norwegian' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'occitan' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'pashto' => array(),
-	'persian' => array(),
-	'polish' => array('WINDOWS-1250', 'ISO-8859-2'),
-	'portuguese' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'quechua_cusco' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'romanian' => array('WINDOWS-1250', 'ISO-8859-2'),
-	'rumantsch' => array(),
-	'russian' => array('KOI8-R', 'WINDOWS-1251'),
-	'sanskrit' => array(),
-	'scots' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'scots_gaelic' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'serbian' => array('WINDOWS-1250', 'ISO-8859-2'),
-	'serbian_cyrillic' => array('WINDOWS-1251'),
-	'simpl_chinese' => array('GB2312', 'WINDOWS-936'),
-	'slovak' => array('WINDOWS-1250', 'ISO-8859-2'),
-	'slovenian' => array('WINDOWS-1250', 'ISO-8859-2'),
-	'spanish' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'swahili' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'swedish' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'tagalog' => array(),
-	'tamil' => array(),
-	'thai' => array('WINDOWS-874', 'ISO-8859-11'),
-	'trad_chinese' => array('BIG-5', 'EUC-TW'),
-	'turkish' => array('WINDOWS-1254', 'ISO-8859-9'),
-	'ukrainian' => array('KOI8-U'),
-	'vietnamese' => array('WINDOWS-1258'),
-	'welsh' => array('ISO-8859-15', 'WINDOWS-1252'),
-	'yiddish' => array(),
-	'yoruba' => array('ISO-8859-15', 'WINDOWS-1252')
+    'afrikaans' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'albanian' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'alemannic' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'amharic' => array(),
+    'armenian' => array('ARMSCII-8'),
+    'arabic' => array('WINDOWS-1256', 'ISO-8859-6'),
+    'asturian' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'belarusian' => array('WINDOWS-1251', 'ISO-8859-5'),
+    'bosnian' => array('WINDOWS-1250', 'ISO-8859-2'),
+    'brazilian' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'breton' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'bulgarian' => array('WINDOWS-1251', 'ISO-8859-5', 'KOI8-R'),
+    'catalan' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'croatian' => array('WINDOWS-1250', 'ISO-8859-2'),
+    'czech' => array('WINDOWS-1250', 'ISO-8859-2'),
+    'danish' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'dari' => array(),
+    'dutch' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'english' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'esperanto' => array('ISO-8859-3'),
+    'estonian' => array('WINDOWS-1257', 'ISO-8859-13', 'ISO-8859-15'),
+    'basque' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'finnish' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'french' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'frisian' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'friulian' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'galician' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'georgian' => array('GEORGIAN-ACADEMY', 'GEORGIAN-PS'),
+    'german' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'greek' => array('WINDOWS-1253', 'ISO-8859-7'),
+    'hawaiian' => array(),
+    'hebrew' => array('ISO-8859-8', 'WINDOWS-1255'),
+    'hindi' => array(),
+    'hungarian' => array('WINDOWS-1250', 'ISO-8859-2'),
+    'icelandic' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'indonesian' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'irish' =>  array('ISO-8859-15', 'WINDOWS-1252'),
+    'italian' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'japanese' => array('EUC-JP', 'ISO-2022-JP', 'SHIFT-JIS'),
+    'korean' => array('EUC-KR', 'ISO-2022-KR', 'CP949'),
+    'latin' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'latvian' => array('WINDOWS-1257', 'ISO-8859-13'),
+    'lithuanian' => array('WINDOWS-1257', 'ISO-8859-13'),
+    'macedonian' => array('WINDOWS-1251'),
+    'malay' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'manx' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'marathi' => array(),
+    'middle_frisian' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'mingo' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'nepali' => array(),
+    'norwegian' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'occitan' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'pashto' => array(),
+    'persian' => array(),
+    'polish' => array('WINDOWS-1250', 'ISO-8859-2'),
+    'portuguese' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'quechua_cusco' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'romanian' => array('WINDOWS-1250', 'ISO-8859-2'),
+    'rumantsch' => array(),
+    'russian' => array('KOI8-R', 'WINDOWS-1251'),
+    'sanskrit' => array(),
+    'scots' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'scots_gaelic' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'serbian' => array('WINDOWS-1250', 'ISO-8859-2'),
+    'serbian_cyrillic' => array('WINDOWS-1251'),
+    'simpl_chinese' => array('GB2312', 'WINDOWS-936'),
+    'slovak' => array('WINDOWS-1250', 'ISO-8859-2'),
+    'slovenian' => array('WINDOWS-1250', 'ISO-8859-2'),
+    'spanish' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'swahili' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'swedish' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'tagalog' => array(),
+    'tamil' => array(),
+    'thai' => array('WINDOWS-874', 'ISO-8859-11'),
+    'trad_chinese' => array('BIG-5', 'EUC-TW'),
+    'turkish' => array('WINDOWS-1254', 'ISO-8859-9'),
+    'ukrainian' => array('KOI8-U'),
+    'vietnamese' => array('WINDOWS-1258'),
+    'welsh' => array('ISO-8859-15', 'WINDOWS-1252'),
+    'yiddish' => array(),
+    'yoruba' => array('ISO-8859-15', 'WINDOWS-1252')
 );

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

@@ -6568,6 +6568,7 @@ function api_set_memory_limit($mem){
     }
     return false;
 }
+
 /**
  * Gets memory limit in bytes
  * @param string The memory size (128M, 1G, 1000K, etc)

+ 2 - 3
main/inc/lib/template.lib.php

@@ -98,7 +98,6 @@ class Template
         $this->twig->addFilter('get_setting', new Twig_Filter_Function('api_get_setting'));
         $this->twig->addFilter('var_dump', new Twig_Filter_Function('var_dump'));
         $this->twig->addFilter('return_message', new Twig_Filter_Function('Display::return_message_and_translate'));
-
         $this->twig->addFilter('display_page_header', new Twig_Filter_Function('Display::page_header_and_translate'));
         $this->twig->addFilter(
             'display_page_subheader',
@@ -767,12 +766,12 @@ class Template
         }
         $this->assign('header_extra_content', $extra_header);
 
-        if ($this->show_header == 1) {
+        //if ($this->show_header == 1) {
             header('Content-Type: text/html; charset='.api_get_system_encoding());
             header(
                 'X-Powered-By: '.$_configuration['software_name'].' '.substr($_configuration['system_version'], 0, 1)
             );
-        }
+        //}
     }
 
     /**

+ 3 - 1
main/inc/lib/usergroup.lib.php

@@ -25,12 +25,14 @@ class UserGroup extends Model
     public function __construct()
     {
         $this->table = Database::get_main_table(TABLE_USERGROUP);
+
         $this->usergroup_rel_user_table = Database::get_main_table(TABLE_USERGROUP_REL_USER);
         $this->usergroup_rel_course_table = Database::get_main_table(TABLE_USERGROUP_REL_COURSE);
         $this->usergroup_rel_session_table = Database::get_main_table(TABLE_USERGROUP_REL_SESSION);
         $this->access_url_rel_usergroup = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP);
-
         $this->table_course = Database::get_main_table(TABLE_MAIN_COURSE);
+        $this->table_user = Database::get_main_table(TABLE_MAIN_USER);
+
         global $_configuration;
         if (isset($_configuration['enable_multiple_url_support_for_classes'])) {
             $this->useMultipleUrl = $_configuration['enable_multiple_url_support_for_classes'];

+ 3 - 3
main/lang/french/tracking.inc.php

@@ -172,7 +172,7 @@ $Attempts = "Tentatives";
 $Correction = "Correction";
 $NoExercise = "Pas d'exercices";
 $LimitDate = "Date limite";
-$SentDate = "D'ate d'envoi";
+$SentDate = "Date d'envoi";
 $Annotate = "Annoter";
 $DayOfDelay = "Jours de délai";
 $NoProduction = "Pas de production";
@@ -250,7 +250,7 @@ $DashboardBlocks = "Blocs du panneau de contrôle";
 $DashboardList = "Liste du panneau de contrôle";
 $YouHaveNotEnabledBlocks = "Vous n'avez activé aucun bloc";
 $BlocksHaveBeenUpdatedSuccessfully = "Les blocs ont été mis à jour";
-$AttendanceSheetDescription = "Les répertoires de présences vous permettent de réunir les feuilles de présences par groupe. Par exemple, vous pourriez vouloir prendre les présence pour les cours théoriques séparément des cours pratiques.
+$AttendanceSheetDescription = "Les répertoires de présences vous permettent de réunir les feuilles de présences par groupe. Par exemple, vous pourriez vouloir prendre les présence pour les cours théoriques séparément des cours pratiques.
 Chaque élément montrera tous les apprenants comme présents par défaut. C'est à vous de noter leur absence en décochant les cases correspondantes.";
 $AttendanceSheetReport = "Rapport de présences";
 $YouDoNotHaveDoneAttendances = "Vous n'avez aucune feuille de présences";
@@ -332,4 +332,4 @@ $FollowedSessions = "Sessions suivies";
 $FollowedCourses = "Cours suivis";
 $FollowedUsers = "Utilisateurs suivis";
 $Timeline = "Ligne du temps";
-?>
+?>

+ 32 - 13
main/newscorm/learnpath.class.php

@@ -2818,7 +2818,8 @@ class learnpath
      * Uses the table generated by get_toc() and returns an HTML-formatted string ready to display
      * @return	string	HTML TOC ready to display
      */
-    public function get_html_toc($toc_list = null) {
+    public function get_html_toc($toc_list = null)
+    {
         global $_configuration;
         $is_allowed_to_edit = api_is_allowed_to_edit(null, true, false, false);
 
@@ -3747,10 +3748,12 @@ class learnpath
      * Publishes a learnpath. This basically means show or hide the learnpath
      * on the course homepage
      * Can be used as abstract
-     * @param	integer	Learnpath id
-     * @param	string	New visibility (v/s - visible/invisible)
+     * @param	integer	$lp_id Learnpath id
+     * @param	string	$set_visibility New visibility (v/s - visible/invisible)
+     * @return bool
      */
-    public static function toggle_publish($lp_id, $set_visibility = 'v') {
+    public static function toggle_publish($lp_id, $set_visibility = 'v')
+    {
         //if ($this->debug > 0) { error_log('New LP - In learnpath::toggle_publish()', 0); }
         $course_id = api_get_course_int_id();
         $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
@@ -3778,8 +3781,15 @@ class learnpath
         $session_condition = api_get_session_condition($session_id);
 
         $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
-        $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id;
-        $sql = "SELECT * FROM $tbl_tool WHERE c_id = ".$course_id." AND link='$link' and image='scormbuilder.gif' and link LIKE '$link%' $session_condition";
+        $link = 'newscorm/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id;
+        $sql = "SELECT * FROM $tbl_tool
+                WHERE
+                    c_id = ".$course_id." AND
+                    link='$link' and
+                    image='scormbuilder.gif' and
+                    link LIKE '$link%'
+                    $session_condition
+                ";
         $result = Database::query($sql);
         $num = Database :: num_rows($result);
         //if ($this->debug > 2) { error_log('New LP - '.$sql.' - '.$num, 0); }
@@ -3787,15 +3797,24 @@ class learnpath
             $sql = "DELETE FROM $tbl_tool WHERE c_id = ".$course_id." AND (link='$link' and image='scormbuilder.gif' $session_condition)";
         } elseif (($set_visibility == 'v') && ($num == 0)) {
             $sql = "INSERT INTO $tbl_tool (c_id, name, link, image, visibility, admin, address, added_tool, session_id) VALUES
-            	    ($course_id, '$name','$link','scormbuilder.gif','$v','0','pastillegris.gif',0, $session_id)";
+            	    ($course_id, '$name', '$link', 'scormbuilder.gif', '$v', '0','pastillegris.gif', 0, $session_id)";
         } elseif (($set_visibility == 'v') && ($num > 0)) {
-            $sql = "UPDATE $tbl_tool SET c_id = $course_id, name = '$name', link = '$link', image = 'scormbuilder.gif', visibility = '$v', admin = '0', address = 'pastillegris.gif', added_tool = 0, session_id = $session_id
+            $sql = "UPDATE $tbl_tool SET
+                        c_id = $course_id,
+                        name = '$name',
+                        link = '$link',
+                        image = 'scormbuilder.gif',
+                        visibility = '$v',
+                        admin = '0',
+                        address = 'pastillegris.gif',
+                        added_tool = 0,
+                        session_id = $session_id
             	    WHERE c_id = ".$course_id." AND (link='$link' and image='scormbuilder.gif' $session_condition)";
         } else {
             // Parameter and database incompatible, do nothing, exit.
             return false;
         }
-        $result = Database::query($sql);
+        Database::query($sql);
         //if ($this->debug > 2) { error_log('New LP - Leaving learnpath::toggle_visibility: '.$sql, 0); }
     }
 
@@ -5102,21 +5121,21 @@ class learnpath
                 // No edit for this item types
                 if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset'))) {
                     if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) {
-                        $edit_icon .= '<a href="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;action=edit_item&amp;view=build&amp;id=' . $arrLP[$i]['id'] . '&amp;lp_id=' . $this->lp_id . '&amp;path_item=' . $arrLP[$i]['path'] . '">';
+                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=edit_item&amp;view=build&amp;id=' . $arrLP[$i]['id'] . '&amp;lp_id=' . $this->lp_id . '&amp;path_item=' . $arrLP[$i]['path'] . '">';
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
                         $edit_icon .= '</a>';
                     } else {
-                        $edit_icon .= '<a href="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;action=edit_item&amp;id=' . $arrLP[$i]['id'] . '&amp;lp_id=' . $this->lp_id . '&amp;path_item=' . $arrLP[$i]['path'] . '">';
+                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=edit_item&amp;id=' . $arrLP[$i]['id'] . '&amp;lp_id=' . $this->lp_id . '&amp;path_item=' . $arrLP[$i]['path'] . '">';
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
                         $edit_icon .= '</a>';
                     }
                 }
 
-                $delete_icon .= ' <a href="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;action=delete_item&amp;id=' . $arrLP[$i]['id'] . '&amp;lp_id=' . $this->lp_id . '" onClick="return confirmation(\'' . addslashes($title) . '\');">';
+                $delete_icon .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=delete_item&amp;id=' . $arrLP[$i]['id'] . '&amp;lp_id=' . $this->lp_id . '" onClick="return confirmation(\'' . addslashes($title) . '\');">';
                 $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY);
                 $delete_icon .= '</a>';
 
-                $url = api_get_self() . '?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id;
+                $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id;
 
                 if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) {
                     $prerequisities_icon = Display::url(Display::return_icon('accept.png', get_lang('LearnpathPrerequisites'), array(), ICON_SIZE_TINY), $url.'&action=edit_item_prereq');

+ 2 - 1
main/newscorm/lp_ajax_initialize.php

@@ -36,6 +36,7 @@ require_once 'aiccItem.class.php';
  * @param   integer New item ID
  */
 function initialize_item($lp_id, $user_id, $view_id, $next_item) {
+    global $debug;
     $return = '';
     if ($debug > 0) { error_log('In initialize_item('.$lp_id.','.$user_id.','.$view_id.','.$next_item.')', 0); }
     /*$item_id may be one of:
@@ -199,4 +200,4 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item) {
     if ($debug > 1) { error_log("return = $return "); }
     return $return;
 }
-echo initialize_item($_POST['lid'], $_POST['uid'], $_POST['vid'], $_POST['iid']);
+echo initialize_item($_POST['lid'], $_POST['uid'], $_POST['vid'], $_POST['iid']);

+ 1 - 0
main/newscorm/lp_ajax_save_item.php

@@ -46,6 +46,7 @@ require_once 'aiccItem.class.php';
  */
 function save_item($lp_id, $user_id, $view_id, $item_id, $score = -1, $max = -1, $min = -1, $status = '', $time = 0, $suspend = '', $location = '', $interactions = array(), $core_exit = 'none')
 {
+    global $debug;
     $return = null;
 
     if ($debug > 0) {

+ 0 - 2
main/newscorm/lp_controller.php

@@ -7,9 +7,7 @@
  * @package chamilo.learnpath
  * @author Yannick Warnier <ywarnier@beeznest.org>
  */
-
 use \ChamiloSession as Session;
-
 $debug = 0;
 if ($debug > 0) error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
 

+ 3 - 1
main/template/default/work/view.tpl

@@ -16,7 +16,9 @@
     {% for comment in comments %}
         <li>
             <div class="page-header">
-                <a href="{{ _p.web_code }}"><img height="24" src="{{ comment.picture }}"/> {{ comment.username }} </a>- {{ comment.sent_at | api_get_local_time }}
+                <a href="{{ _p.web_code }}">
+                    <img height="24" src="{{ comment.picture }}"/> {{ comment.username }}
+                </a>- {{ comment.sent_at | api_get_local_time }}
             </div>
 
         <p>

+ 5 - 5
main/work/work.lib.php

@@ -27,7 +27,7 @@ if (isset($_configuration['add_document_to_work'])) {
     define('ADD_DOCUMENT_TO_WORK', false);
 }
 
-$_configuration['work_user_comments'] = true;
+//$_configuration['work_user_comments'] = false;
 if (isset($_configuration['work_user_comments'])) {
     define('ALLOW_USER_COMMENTS', $_configuration['work_user_comments']);
 } else {
@@ -2040,7 +2040,7 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
                 }
 
                 // Type.
-                $work['type'] = build_document_icon_tag('file', $work['file']);
+                $work['type'] = build_document_icon_tag('file', $work['url']);
 
                 // File name.
                 $link_to_download = null;
@@ -2075,9 +2075,9 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
                     } else {
                         if ($qualification_exists) {
                             $action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Edit').'"  >'.
-                            Display::return_icon('rate_work.png', get_lang('CorrectAndRate'),array(), ICON_SIZE_SMALL).'</a>';
+                            Display::return_icon('rate_work.png', get_lang('CorrectAndRate'), array(), ICON_SIZE_SMALL).'</a>';
                         } else {
-                            $action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'&gradebook='.Security::remove_XSS($_GET['gradebook']).'" title="'.get_lang('Modify').'">'.
+                            $action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Modify').'">'.
                             Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
                         }
                     }
@@ -2106,7 +2106,7 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
 
                     if (api_get_course_setting('student_delete_own_publication') == 1) {
                         if (api_is_allowed_to_session_edit(false, true)) {
-                            $action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'&gradebook='.Security::remove_XSS($_GET['gradebook']).'" title="'.get_lang('Modify').'">'.
+                            $action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Modify').'">'.
                                 Display::return_icon('edit.png', get_lang('Comment'),array(), ICON_SIZE_SMALL).'</a>';
                         }
                         $action .= ' <a href="'.$url.'work.php?'.api_get_cidreq().'&action=delete&amp;item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'"  >'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';

+ 1 - 1
main/work/work.php

@@ -8,7 +8,7 @@
 
 use ChamiloSession as Session;
 
-$language_file = array('exercice', 'work', 'document', 'admin', 'gradebook');
+$language_file = array('exercice', 'work', 'document', 'admin', 'gradebook', 'tracking');
 
 require_once '../inc/global.inc.php';
 $current_course_tool  = TOOL_STUDENTPUBLICATION;

+ 5 - 0
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php

@@ -18,4 +18,9 @@ class ArrayCacheTest extends CacheTest
 
         $this->assertNull($stats);
     }
+
+    protected function isSharedStorage()
+    {
+        return false;
+    }
 }

+ 174 - 36
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php

@@ -3,69 +3,194 @@
 namespace Doctrine\Tests\Common\Cache;
 
 use Doctrine\Common\Cache\Cache;
+use ArrayObject;
 
 abstract class CacheTest extends \Doctrine\Tests\DoctrineTestCase
 {
-    public function testBasics()
+    /**
+     * @dataProvider provideCrudValues
+     */
+    public function testBasicCrudOperations($value)
     {
         $cache = $this->_getCacheDriver();
 
-        // Test save
-        $cache->save('test_key', 'testing this out');
-
-        // Test contains to test that save() worked
-        $this->assertTrue($cache->contains('test_key'));
+        // Test saving a value, checking if it exists, and fetching it back
+        $this->assertTrue($cache->save('key', 'value'));
+        $this->assertTrue($cache->contains('key'));
+        $this->assertEquals('value', $cache->fetch('key'));
 
-        // Test fetch
-        $this->assertEquals('testing this out', $cache->fetch('test_key'));
+        // Test updating the value of a cache entry
+        $this->assertTrue($cache->save('key', 'value-changed'));
+        $this->assertTrue($cache->contains('key'));
+        $this->assertEquals('value-changed', $cache->fetch('key'));
 
-        // Test delete
-        $cache->save('test_key2', 'test2');
-        $cache->delete('test_key2');
-        $this->assertFalse($cache->contains('test_key2'));
+        // Test deleting a value
+        $this->assertTrue($cache->delete('key'));
+        $this->assertFalse($cache->contains('key'));
     }
 
-    public function testObjects()
+    public function provideCrudValues()
     {
-        $cache = $this->_getCacheDriver();
-
-        // Fetch/save test with objects (Is cache driver serializes/unserializes objects correctly ?)
-        $cache->save('test_object_key', new \ArrayObject());
-        $this->assertTrue($cache->fetch('test_object_key') instanceof \ArrayObject);
+        return array(
+            'array' => array(array('one', 2, 3.0)),
+            'string' => array('value'),
+            'integer' => array(1),
+            'float' => array(1.5),
+            'object' => array(new ArrayObject()),
+        );
     }
 
     public function testDeleteAll()
     {
         $cache = $this->_getCacheDriver();
-        $cache->save('test_key1', '1');
-        $cache->save('test_key2', '2');
-        $cache->deleteAll();
 
-        $this->assertFalse($cache->contains('test_key1'));
-        $this->assertFalse($cache->contains('test_key2'));
+        $this->assertTrue($cache->save('key1', 1));
+        $this->assertTrue($cache->save('key2', 2));
+        $this->assertTrue($cache->deleteAll());
+        $this->assertFalse($cache->contains('key1'));
+        $this->assertFalse($cache->contains('key2'));
+    }
+
+    public function testDeleteAllAndNamespaceVersioningBetweenCaches()
+    {
+        if ( ! $this->isSharedStorage()) {
+            $this->markTestSkipped('The ' . __CLASS__ .' does not use shared storage');
+        }
+
+        $cache1 = $this->_getCacheDriver();
+        $cache2 = $this->_getCacheDriver();
+
+        $this->assertTrue($cache1->save('key1', 1));
+        $this->assertTrue($cache2->save('key2', 2));
+
+        /* Both providers are initialized with the same namespace version, so
+         * they can see entries set by each other.
+         */
+        $this->assertTrue($cache1->contains('key1'));
+        $this->assertTrue($cache1->contains('key2'));
+        $this->assertTrue($cache2->contains('key1'));
+        $this->assertTrue($cache2->contains('key2'));
+
+        /* Deleting all entries through one provider will only increment the
+         * namespace version on that object (and in the cache itself, which new
+         * instances will use to initialize). The second provider will retain
+         * its original version and still see stale data.
+         */
+        $this->assertTrue($cache1->deleteAll());
+        $this->assertFalse($cache1->contains('key1'));
+        $this->assertFalse($cache1->contains('key2'));
+        $this->assertTrue($cache2->contains('key1'));
+        $this->assertTrue($cache2->contains('key2'));
+
+        /* A new cache provider should not see the deleted entries, since its
+         * namespace version will be initialized.
+         */
+        $cache3 = $this->_getCacheDriver();
+        $this->assertFalse($cache3->contains('key1'));
+        $this->assertFalse($cache3->contains('key2'));
     }
 
     public function testFlushAll()
     {
         $cache = $this->_getCacheDriver();
-        $cache->save('test_key1', '1');
-        $cache->save('test_key2', '2');
-        $cache->flushAll();
 
-        $this->assertFalse($cache->contains('test_key1'));
-        $this->assertFalse($cache->contains('test_key2'));
+        $this->assertTrue($cache->save('key1', 1));
+        $this->assertTrue($cache->save('key2', 2));
+        $this->assertTrue($cache->flushAll());
+        $this->assertFalse($cache->contains('key1'));
+        $this->assertFalse($cache->contains('key2'));
+    }
+
+    public function testFlushAllAndNamespaceVersioningBetweenCaches()
+    {
+        if ( ! $this->isSharedStorage()) {
+            $this->markTestSkipped('The ' . __CLASS__ .' does not use shared storage');
+        }
+
+        $cache1 = $this->_getCacheDriver();
+        $cache2 = $this->_getCacheDriver();
+
+        /* Deleting all elements from the first provider should increment its
+         * namespace version before saving the first entry.
+         */
+        $cache1->deleteAll();
+        $this->assertTrue($cache1->save('key1', 1));
+
+        /* The second provider will be initialized with the same namespace
+         * version upon its first save operation.
+         */
+        $this->assertTrue($cache2->save('key2', 2));
+
+        /* Both providers have the same namespace version and can see entires
+         * set by each other.
+         */
+        $this->assertTrue($cache1->contains('key1'));
+        $this->assertTrue($cache1->contains('key2'));
+        $this->assertTrue($cache2->contains('key1'));
+        $this->assertTrue($cache2->contains('key2'));
+
+        /* Flushing all entries through one cache will remove all entries from
+         * the cache but leave their namespace version as-is.
+         */
+        $this->assertTrue($cache1->flushAll());
+        $this->assertFalse($cache1->contains('key1'));
+        $this->assertFalse($cache1->contains('key2'));
+        $this->assertFalse($cache2->contains('key1'));
+        $this->assertFalse($cache2->contains('key2'));
+
+        /* Inserting a new entry will use the same, incremented namespace
+         * version, and it will be visible to both providers.
+         */
+        $this->assertTrue($cache1->save('key1', 1));
+        $this->assertTrue($cache1->contains('key1'));
+        $this->assertTrue($cache2->contains('key1'));
+
+        /* A new cache provider will be initialized with the original namespace
+         * version and not share any visibility with the first two providers.
+         */
+        $cache3 = $this->_getCacheDriver();
+        $this->assertFalse($cache3->contains('key1'));
+        $this->assertFalse($cache3->contains('key2'));
+        $this->assertTrue($cache3->save('key3', 3));
+        $this->assertTrue($cache3->contains('key3'));
     }
 
     public function testNamespace()
     {
         $cache = $this->_getCacheDriver();
-        $cache->setNamespace('test_');
+
+        $cache->setNamespace('ns1_');
+
+        $this->assertTrue($cache->save('key1', 1));
+        $this->assertTrue($cache->contains('key1'));
+
+        $cache->setNamespace('ns2_');
+
+        $this->assertFalse($cache->contains('key1'));
+    }
+
+    public function testDeleteAllNamespace()
+    {
+        $cache = $this->_getCacheDriver();
+
+        $cache->setNamespace('ns1');
+        $this->assertFalse($cache->contains('key1'));
         $cache->save('key1', 'test');
+        $this->assertTrue($cache->contains('key1'));
 
+        $cache->setNamespace('ns2');
+        $this->assertFalse($cache->contains('key1'));
+        $cache->save('key1', 'test');
         $this->assertTrue($cache->contains('key1'));
 
-        $cache->setNamespace('test2_');
+        $cache->setNamespace('ns1');
+        $this->assertTrue($cache->contains('key1'));
+        $cache->deleteAll();
+        $this->assertFalse($cache->contains('key1'));
 
+        $cache->setNamespace('ns2');
+        $this->assertTrue($cache->contains('key1'));
+        $cache->deleteAll();
         $this->assertFalse($cache->contains('key1'));
     }
 
@@ -77,25 +202,38 @@ abstract class CacheTest extends \Doctrine\Tests\DoctrineTestCase
         $cache = $this->_getCacheDriver();
         $stats = $cache->getStats();
 
-        $this->assertArrayHasKey(Cache::STATS_HITS,   $stats);
+        $this->assertArrayHasKey(Cache::STATS_HITS, $stats);
         $this->assertArrayHasKey(Cache::STATS_MISSES, $stats);
         $this->assertArrayHasKey(Cache::STATS_UPTIME, $stats);
         $this->assertArrayHasKey(Cache::STATS_MEMORY_USAGE, $stats);
         $this->assertArrayHasKey(Cache::STATS_MEMORY_AVAILABLE, $stats);
     }
 
-    /**
-     * Make sure that all supported caches return "false" instead of "null" to be compatible
-     * with ORM integration.
-     */
-    public function testFalseOnFailedFetch()
+    public function testFetchMissShouldReturnFalse()
     {
         $cache = $this->_getCacheDriver();
+
+        /* Ensure that caches return boolean false instead of null on a fetch
+         * miss to be compatible with ORM integration.
+         */
         $result = $cache->fetch('nonexistent_key');
+
         $this->assertFalse($result);
         $this->assertNotNull($result);
     }
 
+    /**
+     * Return whether multiple cache providers share the same storage.
+     *
+     * This is used for skipping certain tests for shared storage behavior.
+     *
+     * @return boolean
+     */
+    protected function isSharedStorage()
+    {
+        return true;
+    }
+
     /**
      * @return \Doctrine\Common\Cache\CacheProvider
      */

+ 3 - 30
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php

@@ -8,24 +8,8 @@ use Doctrine\Common\Cache\FilesystemCache;
 /**
  * @group DCOM-101
  */
-class FilesystemCacheTest extends CacheTest
+class FilesystemCacheTest extends BaseFileCacheTest
 {
-    /**
-     * @var \Doctrine\Common\Cache\FilesystemCache
-     */
-    private $driver;
-
-    protected function _getCacheDriver()
-    {
-        $dir = sys_get_temp_dir() . "/doctrine_cache_". uniqid();
-        $this->assertFalse(is_dir($dir));
-
-        $this->driver = new FilesystemCache($dir);
-        $this->assertTrue(is_dir($dir));
-
-        return $this->driver;
-    }
-
     public function testLifetime()
     {
         $cache = $this->_getCacheDriver();
@@ -84,19 +68,8 @@ class FilesystemCacheTest extends CacheTest
         $this->assertGreaterThan(0, $stats[Cache::STATS_MEMORY_AVAILABLE]);
     }
 
-    public function tearDown()
+    protected function _getCacheDriver()
     {
-        $dir        = $this->driver->getDirectory();
-        $ext        = $this->driver->getExtension();
-        $iterator   = new \RecursiveDirectoryIterator($dir);
-
-        foreach (new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST) as $file) {
-            if ($file->isFile()) {
-                @unlink($file->getRealPath());
-            } else {
-                @rmdir($file->getRealPath());
-            }
-        }
+        return new FilesystemCache($this->directory);
     }
-
 }

+ 20 - 11
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php

@@ -3,25 +3,35 @@
 namespace Doctrine\Tests\Common\Cache;
 
 use Doctrine\Common\Cache\MemcacheCache;
+use Memcache;
 
 class MemcacheCacheTest extends CacheTest
 {
-    private $_memcache;
+    private $memcache;
 
     public function setUp()
     {
-        if (extension_loaded('memcache')) {
-            $this->_memcache = new \Memcache;
-            $ok = @$this->_memcache->connect('localhost', 11211);
-            if (!$ok) {
-                $this->markTestSkipped('The ' . __CLASS__ .' requires the use of memcache');
-            }
-        } else {
+        if ( ! extension_loaded('memcache')) {
             $this->markTestSkipped('The ' . __CLASS__ .' requires the use of memcache');
         }
+
+        $this->memcache = new Memcache();
+
+        if (@$this->memcache->connect('localhost', 11211) === false) {
+            unset($this->memcache);
+            $this->markTestSkipped('The ' . __CLASS__ .' cannot connect to memcache');
+        }
     }
 
-    public function testNoExpire() {
+    public function tearDown()
+    {
+        if ($this->memcache instanceof Memcache) {
+            $this->memcache->flush();
+        }
+    }
+
+    public function testNoExpire()
+    {
         $cache = $this->_getCacheDriver();
         $cache->save('noexpire', 'value', 0);
         sleep(1);
@@ -38,8 +48,7 @@ class MemcacheCacheTest extends CacheTest
     protected function _getCacheDriver()
     {
         $driver = new MemcacheCache();
-        $driver->setMemcache($this->_memcache);
+        $driver->setMemcache($this->memcache);
         return $driver;
     }
-
 }

+ 22 - 14
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php

@@ -3,6 +3,7 @@
 namespace Doctrine\Tests\Common\Cache;
 
 use Doctrine\Common\Cache\MemcachedCache;
+use Memcached;
 
 class MemcachedCacheTest extends CacheTest
 {
@@ -10,21 +11,29 @@ class MemcachedCacheTest extends CacheTest
 
     public function setUp()
     {
-        if (extension_loaded('memcached')) {
-            $this->memcached = new \Memcached();
-            $this->memcached->setOption(\Memcached::OPT_COMPRESSION, false);
-            $this->memcached->addServer('127.0.0.1', 11211);
-
-            $fh = @fsockopen('127.0.0.1', 11211);
-            if (!$fh) {
-                $this->markTestSkipped('The ' . __CLASS__ .' requires the use of memcache');
-            }
-        } else {
-            $this->markTestSkipped('The ' . __CLASS__ .' requires the use of memcache');
+        if ( ! extension_loaded('memcached')) {
+            $this->markTestSkipped('The ' . __CLASS__ .' requires the use of memcached');
+        }
+
+        $this->memcached = new Memcached();
+        $this->memcached->setOption(Memcached::OPT_COMPRESSION, false);
+        $this->memcached->addServer('127.0.0.1', 11211);
+
+        if (@fsockopen('127.0.0.1', 11211) === false) {
+            unset($this->memcached);
+            $this->markTestSkipped('The ' . __CLASS__ .' cannot connect to memcache');
         }
     }
 
-    public function testNoExpire() {
+    public function tearDown()
+    {
+        if ($this->memcached instanceof Memcached) {
+            $this->memcached->flush();
+        }
+    }
+
+    public function testNoExpire()
+    {
         $cache = $this->_getCacheDriver();
         $cache->save('noexpire', 'value', 0);
         sleep(1);
@@ -35,8 +44,7 @@ class MemcachedCacheTest extends CacheTest
     {
         $cache = $this->_getCacheDriver();
         $cache->save('key', 'value', 30 * 24 * 3600 + 1);
-
-        $this->assertTrue($cache->contains('key'), 'Memcached provider should support TTL > 30 days');
+        $this->assertTrue($cache->contains('key'), 'Memcache provider should support TTL > 30 days');
     }
 
     protected function _getCacheDriver()

+ 3 - 39
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php

@@ -8,29 +8,8 @@ use Doctrine\Common\Cache\PhpFileCache;
 /**
  * @group DCOM-101
  */
-class PhpFileCacheTest extends CacheTest
+class PhpFileCacheTest extends BaseFileCacheTest
 {
-    /**
-     * @var \Doctrine\Common\Cache\PhpFileCache
-     */
-    private $driver;
-
-    protected function _getCacheDriver()
-    {
-        $dir = sys_get_temp_dir() . "/doctrine_cache_". uniqid();
-        $this->assertFalse(is_dir($dir));
-
-        $this->driver = new PhpFileCache($dir);
-        $this->assertTrue(is_dir($dir));
-
-        return $this->driver;
-    }
-
-    public function testObjects()
-    {
-        $this->markTestSkipped('PhpFileCache does not support saving objects that dont implement __set_state()');
-    }
-
     public function testLifetime()
     {
         $cache = $this->_getCacheDriver();
@@ -106,25 +85,10 @@ class PhpFileCacheTest extends CacheTest
         $this->assertGreaterThan(0, $stats[Cache::STATS_MEMORY_AVAILABLE]);
     }
 
-    public function tearDown()
+    protected function _getCacheDriver()
     {
-        if (!$this->driver) {
-            return;
-        }
-
-        $dir        = $this->driver->getDirectory();
-        $ext        = $this->driver->getExtension();
-        $iterator   = new \RecursiveDirectoryIterator($dir);
-
-        foreach (new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST) as $file) {
-            if ($file->isFile()) {
-                @unlink($file->getRealPath());
-            } else {
-                @rmdir($file->getRealPath());
-            }
-        }
+        return new PhpFileCache($this->directory);
     }
-
 }
 
 class NotSetStateClass

+ 12 - 14
vendor/doctrine/cache/tests/Doctrine/Tests/TestInit.php

@@ -6,18 +6,16 @@ namespace Doctrine\Tests;
 
 error_reporting(E_ALL | E_STRICT);
 
-// register silently failing autoloader
-spl_autoload_register(function($class)
-{
-    if (0 === strpos($class, 'Doctrine\Tests\\')) {
-        $path = __DIR__.'/../../'.strtr($class, '\\', '/').'.php';
-        if (is_file($path) && is_readable($path)) {
-            require_once $path;
-
-            return true;
-        }
-    }
-});
-
-require_once __DIR__ . "/../../../vendor/autoload.php";
+if (file_exists(__DIR__ . '/../../../vendor/autoload.php')) {
+    // dependencies were installed via composer - this is the main project
+    $classLoader = require __DIR__ . '/../../../vendor/autoload.php';
+} elseif (file_exists(__DIR__ . '/../../../../../autoload.php')) {
+    // installed as a dependency in `vendor`
+    $classLoader = require __DIR__ . '/../../../../../autoload.php';
+} else {
+    throw new \Exception('Can\'t find autoload.php. Did you install dependencies via composer?');
+}
 
+/* @var $classLoader \Composer\Autoload\ClassLoader */
+$classLoader->add('Doctrine\\Tests\\', __DIR__ . '/../../');
+unset($classLoader);