Ver Fonte

Feature #306 - Trimming totally trailing whitespace in php-source files, part 1, 220 files.

Ivan Tcholakov há 15 anos atrás
pai
commit
7aef9165bf
100 ficheiros alterados com 2151 adições e 2151 exclusões
  1. 6 6
      main/admin/calendar_view.php
  2. 75 75
      main/announcements/announcements.inc.php
  3. 145 145
      main/announcements/announcements.php
  4. 6 6
      main/app_share/appshare.php
  5. 6 6
      main/app_share/index.php
  6. 1 1
      main/app_share/plugin.php
  7. 34 34
      main/auth/courses.php
  8. 49 49
      main/auth/inscription.php
  9. 18 18
      main/auth/ldap/authldap.php
  10. 10 10
      main/auth/ldap/login.php
  11. 9 9
      main/auth/ldap/newUser.php
  12. 1 1
      main/auth/lostPassword.php
  13. 15 15
      main/auth/lost_password.lib.php
  14. 45 45
      main/auth/my_progress.php
  15. 6 6
      main/auth/openid/login.php
  16. 2 2
      main/auth/openid/whatis.php
  17. 18 18
      main/blog/blog.php
  18. 20 20
      main/blog/blog_admin.php
  19. 5 5
      main/blog/calendar.php
  20. 4 4
      main/blog/download.php
  21. 183 183
      main/calendar/agenda.inc.php
  22. 43 43
      main/calendar/agenda.php
  23. 3 3
      main/calendar/calendar.php
  24. 6 6
      main/calendar/download.php
  25. 6 6
      main/calendar/ical_export.php
  26. 39 39
      main/calendar/myagenda.inc.php
  27. 6 6
      main/calendar/myagenda.php
  28. 22 22
      main/chat/chat.php
  29. 31 31
      main/chat/chat_chat.php
  30. 14 14
      main/chat/chat_footer.php
  31. 5 5
      main/chat/chat_functions.lib.php
  32. 1 1
      main/chat/chat_hidden.php
  33. 69 69
      main/chat/chat_message.php
  34. 23 23
      main/chat/chat_whoisonline.php
  35. 18 18
      main/chat/header_frame.inc.php
  36. 16 16
      main/conference/api.php
  37. 3 3
      main/conference/audiopost.php
  38. 6 6
      main/conference/checksession.php
  39. 4 4
      main/conference/get_translation.lib.php
  40. 3 3
      main/conference/testpost.php
  41. 1 1
      main/conference/videoconference.php
  42. 30 30
      main/course_description/index.php
  43. 8 8
      main/course_home/2column.php
  44. 5 5
      main/course_home/3column.php
  45. 25 25
      main/course_home/activity.php
  46. 22 22
      main/course_home/btf_functions.php
  47. 9 9
      main/course_home/course_home.php
  48. 3 3
      main/course_info/delete_course.php
  49. 7 7
      main/course_info/infocours.php
  50. 2 2
      main/course_info/maintenance.php
  51. 15 15
      main/course_info/postpone.php
  52. 10 10
      main/coursecopy/backup.php
  53. 8 8
      main/coursecopy/classes/Announcement.class.php
  54. 11 11
      main/coursecopy/classes/Course.class.php
  55. 6 6
      main/coursecopy/classes/CourseArchiver.class.php
  56. 10 10
      main/coursecopy/classes/CourseBuilder.class.php
  57. 8 8
      main/coursecopy/classes/CourseDescription.class.php
  58. 98 98
      main/coursecopy/classes/CourseRestorer.class.php
  59. 64 64
      main/coursecopy/classes/CourseSelectForm.class.php
  60. 7 7
      main/coursecopy/classes/Document.class.php
  61. 15 15
      main/coursecopy/classes/DummyCourseCreator.class.php
  62. 8 8
      main/coursecopy/classes/Event.class.php
  63. 8 8
      main/coursecopy/classes/Forum.class.php
  64. 8 8
      main/coursecopy/classes/ForumCategory.class.php
  65. 8 8
      main/coursecopy/classes/ForumPost.class.php
  66. 9 9
      main/coursecopy/classes/ForumTopic.class.php
  67. 10 10
      main/coursecopy/classes/Glossary.class.php
  68. 1 1
      main/coursecopy/classes/Learnpath.class.php
  69. 9 9
      main/coursecopy/classes/Link.class.php
  70. 8 8
      main/coursecopy/classes/LinkCategory.class.php
  71. 8 8
      main/coursecopy/classes/Quiz.class.php
  72. 8 8
      main/coursecopy/classes/QuizQuestion.class.php
  73. 7 7
      main/coursecopy/classes/Survey.class.php
  74. 8 8
      main/coursecopy/classes/SurveyInvitation.class.php
  75. 9 9
      main/coursecopy/classes/SurveyQuestion.class.php
  76. 17 17
      main/coursecopy/copy_course.php
  77. 16 16
      main/coursecopy/create_backup.php
  78. 39 39
      main/coursecopy/import_backup.php
  79. 15 15
      main/coursecopy/recycle_course.php
  80. 7 7
      main/create_course/add_course.php
  81. 1 1
      main/cron/user_import/client.php
  82. 42 42
      main/document/create_document.php
  83. 62 62
      main/document/document.inc.php
  84. 100 100
      main/document/document.php
  85. 15 15
      main/document/document_slideshow.inc.php
  86. 5 5
      main/document/download.php
  87. 78 78
      main/document/edit_document.php
  88. 2 2
      main/document/headerpage.php
  89. 20 20
      main/document/quota.php
  90. 25 25
      main/document/showinframes.php
  91. 13 13
      main/document/slideshow.inc.php
  92. 38 38
      main/document/slideshow.php
  93. 41 41
      main/document/slideshowoptions.php
  94. 2 2
      main/document/upload.php
  95. 91 91
      main/dropbox/dropbox_class.inc.php
  96. 30 30
      main/dropbox/dropbox_functions.inc.php
  97. 23 23
      main/dropbox/dropbox_init.inc.php
  98. 16 16
      main/dropbox/dropbox_submit.php
  99. 2 2
      main/dropbox/index.php
  100. 2 2
      main/exercice/addlimits.php

+ 6 - 6
main/admin/calendar_view.php

@@ -22,12 +22,12 @@
 ==============================================================================
 *	@package dokeos.admin
 *	@author Carlos Vargas
-*	This file is the calendar/calendar.php 
+*	This file is the calendar/calendar.php
 ==============================================================================
 */
 // name of the language file that needs to be included
 $language_file = 'agenda';
-// including the claroline global 
+// including the claroline global
 include('../inc/global.inc.php');
 
 //session
@@ -36,7 +36,7 @@ if(isset($_GET['id_session']))
 
 // the variables for the days and the months
 // Defining the shorts for the days
-$DaysShort = api_get_week_days_short(); 
+$DaysShort = api_get_week_days_short();
 // Defining the days of the week to allow translation of the days
 $DaysLong = api_get_week_days_long();
 // Defining the months of the year to allow translation of the months
@@ -60,7 +60,7 @@ $MonthsLong = api_get_months_long();
 }
 table.calendar
 {
-	width: 100%;	
+	width: 100%;
 	font-size: 11px;
 	font-family: verdana, arial, helvetica, sans-serif;
 }
@@ -79,12 +79,12 @@ table.calendar td
 {
 	width: 25px;
 	height: 25px;
-	background-color: #f5f5f5;	
+	background-color: #f5f5f5;
 	text-align: center;
 }
 table.calendar td.selected
 {
-	border: 1px solid #ff0000; 
+	border: 1px solid #ff0000;
 	background-color: #FFCECE;
 }
 table.calendar td a

+ 75 - 75
main/announcements/announcements.inc.php

@@ -40,13 +40,13 @@
 */
 function display_announcement($announcement_id)
 {
-	global $_user, $dateFormatLong;	
-	
+	global $_user, $dateFormatLong;
+
 	if ($announcement_id != strval(intval($announcement_id))) { return false; } // potencial sql injection
-	
+
 	$tbl_announcement 	= Database::get_course_table(TABLE_ANNOUNCEMENT);
 	$tbl_item_property	= Database::get_course_table(TABLE_ITEM_PROPERTY);
-	
+
 	if ($_user['user_id'])
 	{
 		$sql_query = "	SELECT announcement.*, toolitemproperties.*
@@ -71,7 +71,7 @@ function display_announcement($announcement_id)
 	}
 	$sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
 	$result = Database::fetch_array($sql_result);
-	
+
 	if ($result !== false) // A sanity check.
 	{
 		$title		 = $result['title'];
@@ -81,7 +81,7 @@ function display_announcement($announcement_id)
 		$last_post_datetime = $result['insert_date'];// post time format  datetime de mysql
 		list($last_post_date, $last_post_time) = split(" ", $last_post_datetime);
 	}
-	
+
 	echo "<table height=\"100\" width=\"100%\" border=\"1\" cellpadding=\"5\" cellspacing=\"0\" id=\"agenda_list\">\n";
 	echo "<tr class=\"data\"><td>" . $title . "</td></tr>\n";
 	echo "<tr><td class=\"announcements_datum\">" . get_lang('AnnouncementPublishedOn') . " : " . api_ucfirst(format_locale_date($dateFormatLong,strtotime($last_post_date) ) ) . "</td></tr>\n";
@@ -105,13 +105,13 @@ function show_to_form($to_already_selected)
 
 	echo "\n<table id=\"recipient_list\" style=\"display: none;\">\n";
 	echo "\t<tr>\n";
-	
+
 	// the form containing all the groups and all the users of the course
 	echo "\t\t<td>\n";
 	echo "<strong>".get_lang('Users')."</strong><br />";
 	construct_not_selected_select_form($group_list,$user_list,$to_already_selected);
 	echo "\t\t</td>\n";
-	
+
 	// the buttons for adding or removing groups/users
 	echo "\n\t\t<td valign=\"middle\">\n";
 	echo "\t\t<input	type=\"button\"	",
@@ -125,7 +125,7 @@ function show_to_form($to_already_selected)
 				"value=\"   <<   \">";
 	echo "\t\t</td>\n";
 	echo "\n\t\t<td>\n";
-	
+
 	// the form containing the selected groups and users
 	echo "<strong>".get_lang('DestinationUsers')."</strong><br />";
 	construct_selected_select_form($group_list,$user_list,$to_already_selected);
@@ -172,9 +172,9 @@ function construct_not_selected_select_form($group_list=null, $user_list=null,$t
 				echo	"\t\t<option value=\"USER:",$this_user["user_id"],"\">",
 					"", api_get_person_name($this_user['firstName'], $this_user['lastName']),
 					"</option>\n";
-			}	
+			}
 		}
-		
+
 	}
 	echo "\t\t</select>\n";
 }
@@ -224,7 +224,7 @@ function construct_selected_select_form($group_list=null, $user_list=null,$to_al
 			}
 		}
 	} else {
-		if ($to_already_selected=='everyone') {						
+		if ($to_already_selected=='everyone') {
 			// adding the groups to the select form
 			if (is_array($ref_array_groups))
 			{
@@ -237,11 +237,11 @@ function construct_selected_select_form($group_list=null, $user_list=null,$to_al
 							"G: ",$this_group['name']," &ndash; " . $this_group['userNb'] . " " . get_lang('Users') .
 							"</option>\n";
 					}
-				}					
+				}
 			}
 			// adding the individual users to the select form
 			foreach($ref_array_users as $this_user)
-			{					
+			{
 				if (!is_array($to_already_selected) || !in_array("USER:".$this_user['user_id'],$to_already_selected)) // $to_already_selected is the array containing the users (and groups) that are already selected
 				{
 					echo	"\t\t<option value=\"USER:",$this_user['user_id'],"\">",
@@ -265,16 +265,16 @@ function show_to_form_group($group_id)
 	echo "\t<tr>\n";
 
 	echo "\t\t<td>\n";
-	
+
 	echo "\t\t<select name=\"not_selected_form[]\" size=5 style=\"width:200px\" multiple>\n";
 	$group_users = GroupManager::get_subscribed_users($group_id);
 	foreach ($group_users as $user){
 		echo '<option value="'.$user['user_id'].'">'.api_get_person_name($user['firstname'], $user['lastname']).'</option>';
 	}
 	echo '</select>';
-	
+
 	echo "\t\t</td>\n";
-	
+
 	// the buttons for adding or removing groups/users
 	echo "\n\t\t<td valign=\"middle\">\n";
 	echo "\t\t<input	type=\"button\"	",
@@ -288,10 +288,10 @@ function show_to_form_group($group_id)
 				"value=\"   <<   \">";
 	echo "\t\t</td>\n";
 	echo "\n\t\t<td>\n";
-	
+
 	echo "\t\t<select name=\"selectedform[]\" size=5 style=\"width:200px\" multiple>\n";
 	echo '</select>';
-	
+
 	echo "\t\t</td>\n";
 	echo "\t</tr>\n";
 	echo "</table>";
@@ -312,7 +312,7 @@ function get_course_users()
 {
 	//this would return only the users from real courses:
 	//$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id());
-	
+
 	$user_list = CourseManager::get_real_and_linked_user_list(api_get_course_id(), true, $_SESSION['id_session']);
 	return $user_list;
 }
@@ -338,10 +338,10 @@ function load_edit_users($tool, $id)
 {
 	global $_course;
 	global $tbl_item_property;
-	
+
 	$tool = Database::escape_string($tool);
 	$id = Database::escape_string($id);
-	
+
 	$sql="SELECT * FROM $tbl_item_property WHERE tool='$tool' AND ref='$id'";
 	$result=api_sql_query($sql,__FILE__,__LINE__) or die (mysql_error());
 	while ($row=Database::fetch_array($result))
@@ -437,41 +437,41 @@ function to_javascript()
 
 		arrFbox.sort();
 		arrTbox.sort();
-				
+
 		var arrFboxGroup = new Array();
 		var arrFboxUser = new Array();
-		var prefix_x;											
-				
+		var prefix_x;
+
 		for (x = 0; x < arrFbox.length; x++) {
-			prefix_x = arrFbox[x].substring(0,2);		
+			prefix_x = arrFbox[x].substring(0,2);
 			if (prefix_x == 'G:') {
-				arrFboxGroup.push(arrFbox[x]);					
+				arrFboxGroup.push(arrFbox[x]);
 			} else {
-				arrFboxUser.push(arrFbox[x]);					
-			}		  
-		}		
-		
+				arrFboxUser.push(arrFbox[x]);
+			}
+		}
+
 		arrFboxGroup.sort();
 		arrFboxUser.sort();
-		arrFbox = arrFboxGroup.concat(arrFboxUser);				
-										
+		arrFbox = arrFboxGroup.concat(arrFboxUser);
+
 		var arrTboxGroup = new Array();
-		var arrTboxUser = new Array();	
-		var prefix_y;						
-					
+		var arrTboxUser = new Array();
+		var prefix_y;
+
 		for (y = 0; y < arrTbox.length; y++) {
-			prefix_y = arrTbox[y].substring(0,2);				
+			prefix_y = arrTbox[y].substring(0,2);
 			if (prefix_y == 'G:') {
 				arrTboxGroup.push(arrTbox[y]);
 			} else {
 				arrTboxUser.push(arrTbox[y]);
-			}			
-		}													
-					
+			}
+		}
+
 		arrTboxGroup.sort();
 		arrTboxUser.sort();
-		arrTbox = arrTboxGroup.concat(arrTboxUser);		
-				
+		arrTbox = arrTboxGroup.concat(arrTboxUser);
+
 		fbox.length	= 0;
 		tbox.length	= 0;
 
@@ -501,23 +501,23 @@ function to_javascript()
 
 
 	function selectAll(cbList,bSelect,showwarning)
-	{	
-			
+	{
+
 		if (document.getElementById('emailTitle').value==''){
 			document.getElementById('msg_error').innerHTML='".get_lang('FieldRequired')."';
 			document.getElementById('msg_error').style.display='block';
-			document.getElementById('emailTitle').focus();		
+			document.getElementById('emailTitle').focus();
 		}else {
 			if (cbList.length <	1) {
 				if (!confirm(\"".get_lang('Send2All')."\")) {
-					return false;		
-				} 			
-			} 	
+					return false;
+				}
+			}
 			for	(var i=0; i<cbList.length; i++)
-			cbList[i].selected = cbList[i].checked = bSelect;					
-			document.f1.submit();	
-		}				
-															
+			cbList[i].selected = cbList[i].checked = bSelect;
+			document.f1.submit();
+		}
+
 	}
 
 	function reverseAll(cbList)
@@ -584,7 +584,7 @@ function sent_to_form($sent_to_array)
 				$output.="\t<option value=\"\">G: ".$group_names[$group_id]['name']."</option>\n";
 			}
 		}
-		
+
 		if (isset($sent_to_array['users']))
 		{
 			if (is_array($sent_to_array['users']))
@@ -596,7 +596,7 @@ function sent_to_form($sent_to_array)
 				}
 			}
 		}
-		
+
 		// ending the form
 		$output.="</select>\n";
 	}
@@ -664,17 +664,17 @@ function sent_to($tool, $id)
 {
 	global $_course;
 	global $tbl_item_property;
-	
+
 	$tool = Database::escape_string($tool);
 	$id = Database::escape_string($id);
-	
+
 	$sent_to_group = array();
-	$sent_to = array();	
-	
+	$sent_to = array();
+
 	$sql="SELECT * FROM $tbl_item_property WHERE tool='$tool' AND ref='".$id."'";
 	$result = api_sql_query($sql,__FILE__,__LINE__);
 
-	
+
 	while ($row=Database::fetch_array($result)) {
 		// if to_group_id is null then it is sent to a specific user
 		// if to_group_id = 0 then it is sent to everybody
@@ -711,11 +711,11 @@ function sent_to($tool, $id)
 function change_visibility_announcement($tool,$id)
 {
 	global $_course;
-	global $tbl_item_property;	
-	
+	global $tbl_item_property;
+
 	$tool = Database::escape_string($tool);
 	$id = Database::escape_string($id);
-	
+
 	$sql="SELECT * FROM $tbl_item_property WHERE tool='$tool' AND ref='$id'";
 
 	$result=api_sql_query($sql,__FILE__,__LINE__) or die (mysql_error());
@@ -765,7 +765,7 @@ function store_advalvas_item($emailTitle,$newContent, $order, $to)
 		{
 			foreach ($send_to['groups'] as $group)
 			{
-				api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", $_user['user_id'], $group); 
+				api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", $_user['user_id'], $group);
 			}
 		}
 
@@ -801,7 +801,7 @@ function store_advalvas_group_item($emailTitle,$newContent, $order, $to, $to_use
 	$emailTitle = Database::escape_string(Security::remove_XSS($emailTitle));
 	$newContent = Database::escape_string(Security::remove_XSS($newContent,COURSEMANAGERLOWSECURITY));
 	$order = intval($order);
-	// store in the table announcement	
+	// store in the table announcement
 	$sql = "INSERT INTO $tbl_announcement SET content = '$newContent', title = '$emailTitle', end_date = NOW(), display_order ='$order', session_id=".intval($_SESSION['id_session']);
 	$result = api_sql_query($sql,__FILE__,__LINE__) or die (mysql_error());
 	$last_id= Database::get_last_insert_id();
@@ -815,7 +815,7 @@ function store_advalvas_group_item($emailTitle,$newContent, $order, $to, $to_use
 		{
 			foreach ($send_to['groups'] as $group)
 			{
-				api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", $_user['user_id'], $group); 
+				api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", $_user['user_id'], $group);
 			}
 		}
 	}
@@ -845,18 +845,18 @@ function store_advalvas_group_item($emailTitle,$newContent, $order, $to, $to_use
 */
 function edit_advalvas_item($id,$emailTitle,$newContent,$to)
 {
-	
+
 	global $_course;
 	global $nameTools;
 	global $_user;
 
 	global $tbl_announcement;
 	global $tbl_item_property;
-	
+
 	$newContent=stripslashes($newContent);
 	$emailTitle = Database::escape_string(Security::remove_XSS($emailTitle));
 	$newContent = Database::escape_string(Security::remove_XSS($newContent,COURSEMANAGERLOWSECURITY));
-	
+
 	// store the modifications in the table announcement
 	$sql = "UPDATE $tbl_announcement SET content='$newContent', title = '$emailTitle' WHERE id='$id'";
 
@@ -908,7 +908,7 @@ function send_announcement_email($user_list, $course_code, $_course, $mail_title
 {
 	global $charset;
 	global $_user;
-			
+
 	foreach ($user_list as $this_user) {
 		/*  Header : Bericht van uw lesgever - GES ($course_code) - Morgen geen les! ($mail_title)
 			Body :  John Doe (prenom + nom) <john_doe@hotmail.com> (email)
@@ -922,12 +922,12 @@ function send_announcement_email($user_list, $course_code, $_course, $mail_title
 		$mail_body .= api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS).' ';
 		$mail_body .= '<'.$_user['mail'].">\n";
 		$mail_body .= $_course['official_code'].' '.$_course['name'];
-		
+
 		//set the charset and use it for the encoding of the email - small fix, not really clean (should check the content encoding origin first)
 		//here we use the encoding used for the webpage where the text is encoded (ISO-8859-1 in this case)
 		if(empty($charset)){$charset='ISO-8859-1';}
 		$encoding = 'Content-Type: text/plain; charset='. $charset;
-		
+
 		$newmail = api_mail(api_get_person_name($this_user['firstname'], $this_user['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $this_user['email'], $mail_subject, $mail_body, api_get_person_name($_SESSION['_user']['firstName'], $_SESSION['_user']['lastName'], null, PERSON_NAME_EMAIL_ADDRESS), $_SESSION['_user']['mail'], $encoding);
 	}
 }
@@ -936,7 +936,7 @@ function update_mail_sent($insert_id)
 {
 	global $_course;
 	global $tbl_announcement;
-	if ($insert_id != strval(intval($insert_id))) { return false; } 
+	if ($insert_id != strval(intval($insert_id))) { return false; }
 	$insert_id = Database::escape_string($insert_id);
 	// store the modifications in the table tbl_annoucement
 	$sql = "UPDATE $tbl_announcement SET email_sent='1' WHERE id='$insert_id'";
@@ -944,13 +944,13 @@ function update_mail_sent($insert_id)
 }
 
 /**
- * Gets all announcements from a user by course 
+ * Gets all announcements from a user by course
  * @param	string course db
- * @param	int user id 
+ * @param	int user id
  * @return	string an html with the content
  */
 function get_all_annoucement_by_user_course($course_db, $user_id)
-{	
+{
 	$tbl_announcement		= Database::get_course_table(TABLE_ANNOUNCEMENT, $course_db);
 	$tbl_item_property  	= Database::get_course_table(TABLE_ITEM_PROPERTY, $course_db);
 	if (!empty($user_id) && is_numeric($user_id)) {

+ 145 - 145
main/announcements/announcements.php

@@ -288,17 +288,17 @@ if (!empty($_SESSION['toolgroup'])){
 	$_clean['toolgroup']=(int)$_SESSION['toolgroup'];
 	$group_properties  = GroupManager :: get_group_properties($_clean['toolgroup']);
 	$interbreadcrumb[] = array ("url" => "../group/group.php", "name" => get_lang('Groups'));
-	$interbreadcrumb[] = array ("url"=>"../group/group_space.php?gidReq=".$_SESSION['toolgroup'], "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')');	
+	$interbreadcrumb[] = array ("url"=>"../group/group_space.php?gidReq=".$_SESSION['toolgroup'], "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')');
 } else {
 	if($surveyid) {
-	
+
 			$interbreadcrumb[] = array ("url" => "../survey/survey_list.php?cidReq=$cidReq", "name" => get_lang('Survey'));
 			$nameTools = get_lang('PublishSurvey');
 	}else {
 		$nameTools = get_lang('Announcement');
 		$nameTools12 = get_lang('PublishSurvey');
 	}
-} 
+}
 
 
 
@@ -367,19 +367,19 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 	if (!empty($_GET['action']) AND $_GET['action']=='delete' AND isset($_GET['id'])) {
 		//api_sql_query("DELETE FROM  $tbl_announcement WHERE id='$delete'",__FILE__,__LINE__);
 		$id=intval(addslashes($_GET['id']));
-		
+
 		if (!api_is_course_coach() || api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $id)) {
 
 			// tooledit : visibility = 2 : only visibile for platform administrator
 			if ($ctok == $_GET['sec_token']) {
 				api_sql_query("UPDATE $tbl_item_property SET visibility='2' WHERE tool='".TOOL_ANNOUNCEMENT."' and ref='".$id."'",__FILE__,__LINE__);
-		
+
 				delete_added_resource("Ad_Valvas", $delete);
-		
+
 				$id = null;
 				$emailTitle = null;
 				$newContent = null;
-		
+
 				$message = get_lang("AnnouncementDeleted");
 			}
 		}
@@ -395,13 +395,13 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 		//api_sql_query("DELETE FROM $tbl_announcement",__FILE__,__LINE__);
 		if(api_is_allowed_to_edit()) {
 			api_sql_query("UPDATE $tbl_item_property SET visibility='2' WHERE tool='".TOOL_ANNOUNCEMENT."'",__FILE__,__LINE__);
-	
+
 			delete_all_resources_type("Ad_Valvas");
-	
+
 			$id = null;
 			$emailTitle = null;
 			$newContent = null;
-	
+
 			$message = get_lang("AnnouncementDeletedAll");
 		}
 	}
@@ -411,32 +411,32 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 		Modify announcement
 	-----------------------------------------------------------
 	*/
-	if (!empty($_GET['action']) and $_GET['action']=='modify' AND isset($_GET['id'])) {		
+	if (!empty($_GET['action']) and $_GET['action']=='modify' AND isset($_GET['id'])) {
 		$display_form = true;
 
 		// RETRIEVE THE CONTENT OF THE ANNOUNCEMENT TO MODIFY
 		$id = intval(addslashes($_GET['id']));
-		
+
 		if (!api_is_course_coach() || api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $id)) {
 			$sql="SELECT * FROM  $tbl_announcement WHERE id='$id'";
 			$result = api_sql_query($sql,__FILE__,__LINE__);
 			$myrow = Database::fetch_array($result);
-	
+
 			if ($myrow) {
 				$announcement_to_modify 	= $myrow['id'];
 				$content_to_modify 		= $myrow['content'];
-	
+
 				$title_to_modify 			= $myrow['title'];
-	
+
 				if ($originalresource!=="no")  {
 					//unset_session_resources();
 					edit_added_resources("Ad_Valvas", $announcement_to_modify);
 					$to=load_edit_users("announcement", $announcement_to_modify);
 				}
-	
+
 				$display_announcement_list = false;
 			}
-	
+
 			if ($to=="everyone" OR !empty($_SESSION['toolgroup']))
 			{
 				$_SESSION['select_groupusers']="hide";
@@ -459,7 +459,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 			$thisAnnouncementId = intval($_GET['down']);
 			$sortDirection = "DESC";
 		}
-	
+
 		if (!empty($_GET['up'])) {
 			$thisAnnouncementId = intval($_GET['up']);
 			$sortDirection = "ASC";
@@ -513,7 +513,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 	-----------------------------------------------------------
 	*/
 	//if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
-	
+
 	$emailTitle=(!empty($_POST['emailTitle'])?$safe_emailTitle:'');
 	$newContent=(!empty($_POST['newContent'])?$safe_newContent:'');
 	$submitAnnouncement=isset($_POST['submitAnnouncement'])?$_POST['submitAnnouncement']:0;
@@ -522,22 +522,22 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 	if (!empty($_POST['id'])) {
 		$id=intval($_POST['id']);
 	}
-	
+
 	if ($submitAnnouncement && empty($emailTitle)) {
 		$error_message = get_lang('TitleIsRequired');
 		$content_to_modify = $newContent;
-	} else if ($submitAnnouncement) {			
-		
-		if (isset($id)&&$id) {			
+	} else if ($submitAnnouncement) {
+
+		if (isset($id)&&$id) {
 			// there is an Id => the announcement already exists => update mode
-			if ($ctok == $_POST['sec_token']) {				
+			if ($ctok == $_POST['sec_token']) {
 				$edit_id = edit_advalvas_item($id,$emailTitle,$newContent,$_POST['selectedform']);
 				if (!$delete) {
 				    update_added_resources("Ad_Valvas", $id);
 				}
 				$message = get_lang('AnnouncementModified');
 			}
-		} else {			
+		} else {
 			//insert mode
 			if ($ctok == $_POST['sec_token']) {
 				if (!$surveyid) {
@@ -553,20 +553,20 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 				    $_SESSION['select_groupusers']="hide";
 				    $message = get_lang('AnnouncementAdded');
 				}
-	
+
 				/*============================================================
 				MAIL WHEN USER COMES FROM SURVEY
 				======================================================= */
-	
+
 				if ($_POST['emailsAdd']) {
-				    
+
 					$to_email_address =$_POST['emailsAdd'];
 					$to_email_to = explode(',', $to_email_address);
 					$to_email = array_unique($to_email_to);
 					$db_name = $_REQUEST['db_name'];
-					
+
 					for ($i=0;$i<count($to_email);$i++) {
-				
+
 						$to= trim($to_email[$i]);
 						$db_name = $_REQUEST['db_name'];
 						$newContentone=str_replace("#page#","choose_language.php",$newContent);
@@ -575,11 +575,11 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 						$newContentfour=str_replace("#mail#",$to,$newContentthree);
 					    $newContentfive=str_replace("#db_name#",$db_name,$newContentfour);
 						$newContentsix=str_replace("#uid#","",$newContentfive);
-					
+
 						if (eregi('^[0-9a-z_\.-]+@(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-z][0-9a-z-]*[0-9a-z]\.)+[a-z]{2,3})$', $to )) {
 							$subject=stripslashes($emailTitle);
 							$message=stripslashes($newContentsix);
-						
+
 						    $sender_name = api_get_person_name($_SESSION['_user']['lastName'], $_SESSION['_user']['firstName'], null, PERSON_NAME_EMAIL_ADDRESS);
 						    $email = $_SESSION['_user']['mail'];
 							$headers="From:$sender_name\r\nReply-to: $email\r\nContent-type: text/html; charset=iso-8859-15";
@@ -613,40 +613,40 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 						}
 					}
 				}
-	
+
 				/*===================================================================
 				    							MAIL FUNCTION
 				===================================================================*/
-	
+
 				if ($_POST['email_ann'] && empty($_POST['onlyThoseMails'])) {
-					
-				  	$sent_to=sent_to("announcement", $insert_id);					
+
+				  	$sent_to=sent_to("announcement", $insert_id);
 				    $userlist   = $sent_to['users'];
 				    $grouplist  = $sent_to['groups'];
-	
+
 			        // groepen omzetten in users
 			        if ($grouplist) {
-	
+
 						$grouplist = "'".implode("', '",$grouplist)."'";	//protect individual elements with surrounding quotes
 						$sql = "SELECT user_id
 								FROM $tbl_groupUser gu
 								WHERE gu.group_id IN (".$grouplist.")";
-	
-	
+
+
 						$groupMemberResult = api_sql_query($sql,__FILE__,__LINE__);
-	
-	
+
+
 						if ($groupMemberResult) {
 							while ($u = Database::fetch_array($groupMemberResult)) {
 								$userlist [] = $u ['user_id']; // complete the user id list ...
 							}
 						}
 					}
-	
-	
+
+
 				    if (is_array($userlist)) {
 				    	$userlist = "'".implode("', '", array_unique($userlist) )."'";
-	
+
 				    	// send to the created 'userlist'
 					    $sqlmail = "SELECT user_id, lastname, firstname, email
 						       					 FROM $tbl_user
@@ -665,31 +665,31 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 										 	ON $tbl_user.user_id = $tbl_session_course_user.id_user
 											AND $tbl_session_course_user.course_code = '".$_course['id']."'
 											AND $tbl_session_course_user.id_session = ".intval($_SESSION['id_session']);
-			    			
+
 			    		}
 			    	}
-	
+
 					if ($sqlmail!='') {
 						$result = api_sql_query($sqlmail,__FILE__,__LINE__);
-	
+
 				    	/*=================================================================================
 							    				send email one by one to avoid antispam
 					    =================================================================================*/
-	
-	
+
+
 						$db_name = Database::get_course_table(TABLE_MAIN_SURVEY);
 						while ($myrow = Database::fetch_array($result)) {
 							/*    Header : Bericht van uw lesgever - GES ($_cid)
-	
+
 								  Body :   John Doe (prenom + nom) <john_doe@hotmail.com> (email)
-	
+
 								  		   Morgen geen les!! (emailTitle)
-	
+
 								  		   Morgen is er geen les, de les wordt geschrapt wegens vergadering (newContent)
 						    */
-	
+
 							$emailSubject = "[" . $_course['official_code'] . "] " . $emailTitle;
-	
+
 	                        if ($surveyid) {
 	                        	$newContentone=str_replace("#page#","choose_language.php",$newContent);
 								$newContenttwo=str_replace("#temp#",$template,$newContentone);
@@ -698,11 +698,11 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 	                            $newContentfive=str_replace("#db_name#",$db_name,$newContentfour);
 								$newContentsix=str_replace("#uid#",$myrow["user_id"],$newContentfive);
 	                			$message=stripslashes($newContentsix);
-	
+
 							    $sender_name = api_get_person_name($_SESSION['_user']['lastName'], $_SESSION['_user']['firstName'], null, PERSON_NAME_EMAIL_ADDRESS);
 							    $email = $_SESSION['_user']['mail'];
-	
-	
+
+
 								$headers="From:$sender_name\r\nReply-to: $email\r\nContent-type: text/html; charset=iso-8859-15";
 								//@mail($myrow["email"],stripslashes($emailTitle),$message,$headers);
 								api_mail('',$myrow["email"],stripslashes($emailTitle),$message,$sender_name,$email);
@@ -718,10 +718,10 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 	                            $mail_body .= api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS)." \n";
 	                            $mail_body .= "<br /> \n<a href=\"".api_get_path(WEB_COURSE_PATH).$_course['id']."\">";
 	                            $mail_body .= $_course['official_code'].' '.$_course['name'] . "</a>";
-	
+
 								//set the charset and use it for the encoding of the email - small fix, not really clean (should check the content encoding origin first)
 								//here we use the encoding used for the webpage where the text is encoded (ISO-8859-1 in this case)
-	
+
 								//$to_email_address =$_POST['emailsAdd'];
 								//$mail_body;
 								$headers = array();
@@ -729,16 +729,16 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 								$headers['Content-Type'] = 'text/html';
 								$headers['charset'] = $charset;
 		                        $mailid=$myrow["email"];
-	 
+
 								$newmail = api_mail_html(api_get_person_name($myrow["lastname"], $myrow["firstname"], null, PERSON_NAME_EMAIL_ADDRESS), $myrow["email"], stripslashes($emailSubject), $mail_body, api_get_person_name($_SESSION['_user']['lastName'], $_SESSION['_user']['firstName'], null, PERSON_NAME_EMAIL_ADDRESS), $_SESSION['_user']['mail'],$headers);
 	                        }
-	                        
+
 							$sql_date="SELECT * FROM $db_name WHERE survey_id='$surveyid'";
 							$res_date=api_sql_query($sql_date, __FILE__, __LINE__);
 							$obj_date=Database::fetch_object($res_date);
 							$end_date=$obj_date->avail_till;
 							$table_reminder = Database :: get_main_table(TABLE_MAIN_SURVEY_REMINDER); // TODO: To be checked. TABLE_MAIN_SURVEY_REMINDER has not been defined.
-							
+
 							if ($_REQUEST['reminder']=="1") {
 								$time=getdate();
 								$time = $time['yday'];
@@ -751,7 +751,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 								$time = $time+14;
 								$sql="INSERT INTO $table_reminder(sid,db_name,email,subject,content,reminder_choice,reminder_time,avail_till) values('$surveyid','$db_name','$mailid','".addslashes($emailSubject)."','".addslashes($mail_body)."','1','$time','$end_date')";
 								api_sql_query($sql, __FILE__, __LINE__);
-	
+
 							} else if ($_REQUEST['reminder']=="3") {
 								$time=getdate();
 								$time = $time['yday'];
@@ -763,7 +763,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 						update_mail_sent($insert_id);
 						$message = $added_and_sent;
 					}
-	
+
 				} // $email_ann*/
 			} // end condition token
 		}	// isset
@@ -784,7 +784,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 
 
 		if($_REQUEST['publish_survey']) {
-		
+
 		 $surveyid=$_REQUEST['surveyid'];
 		 $cidReq = $_REQUEST['cidReq'];
 		 ?>
@@ -792,8 +792,8 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 			window.location.href="../survey/survey_list.php?<?php echo  api_get_cidreq(); ?>&published=published&surveyid=<?php echo Security::remove_XSS($_REQUEST['publish_survey']); ?>";
 		</script>
 		<?php
-		}		
-	}	// if $submit Announcement	
+		}
+	}	// if $submit Announcement
 }
 
 
@@ -814,7 +814,7 @@ if (empty($_GET['origin']) || $_GET['origin'] !== 'learnpath') {
 */
 
 /* DISPLAY LEFT COLUMN */
-  
+
 if(api_is_allowed_to_edit(false,true))  {
  	// check teacher status
   	if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') {
@@ -833,10 +833,10 @@ if(api_is_allowed_to_edit(false,true))  {
 } else {
 	// students only get to see the visible announcements
 
-				
+
 		if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') {
 			$group_memberships=GroupManager::get_group_ids($_course['dbName'], $_user['user_id']);
-			
+
 			if ((api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
 				$cond_user_id = " AND (toolitemproperties.lastedit_user_id = '".api_get_user_id()."' OR ( toolitemproperties.to_user_id='".$_user['user_id']."'" .
 						"OR toolitemproperties.to_group_id IN (0, ".implode(", ", $group_memberships)."))) ";
@@ -844,7 +844,7 @@ if(api_is_allowed_to_edit(false,true))  {
 				$cond_user_id = " AND ( toolitemproperties.to_user_id='".$_user['user_id']."'" .
 						"OR toolitemproperties.to_group_id IN (0, ".implode(", ", $group_memberships).")) ";
 			}
-			
+
 			// the user is member of several groups => display personal announcements AND his group announcements AND the general announcements
 			if (is_array($group_memberships) && count($group_memberships)>0) {
 				$sql="SELECT
@@ -862,14 +862,14 @@ if(api_is_allowed_to_edit(false,true))  {
 				// the user is not member of any group
 				// this is an identified user => show the general announcements AND his personal announcements
 				if ($_user['user_id']) {
-					
+
 					if ((api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
 						$cond_user_id = " AND (toolitemproperties.lastedit_user_id = '".api_get_user_id()."' OR ( toolitemproperties.to_user_id='".$_user['user_id']."' OR toolitemproperties.to_group_id='0')) ";
 					} else {
 						$cond_user_id = " AND ( toolitemproperties.to_user_id='".$_user['user_id']."' OR toolitemproperties.to_group_id='0') ";
 					}
-					
-					
+
+
 					$sql="SELECT
 						announcement.*, toolitemproperties.*
 						FROM $tbl_announcement announcement, $tbl_item_property toolitemproperties
@@ -882,13 +882,13 @@ if(api_is_allowed_to_edit(false,true))  {
 						ORDER BY display_order DESC
 						LIMIT 0,$maximum";
 				} else {
-					
+
 					if (api_get_course_setting('allow_user_edit_announcement')) {
 						$cond_user_id = " AND (toolitemproperties.lastedit_user_id = '".api_get_user_id()."' OR toolitemproperties.to_group_id='0') ";
 					} else {
 						$cond_user_id = " AND toolitemproperties.to_group_id='0' ";
 					}
-					
+
 					// the user is not identiefied => show only the general announcements
 					$sql="SELECT
 						announcement.*, toolitemproperties.*
@@ -904,8 +904,8 @@ if(api_is_allowed_to_edit(false,true))  {
 				}
 			}
 		}
-	
-	
+
+
 }
 
 $result = api_sql_query($sql,__FILE__,__LINE__);
@@ -916,19 +916,19 @@ $announcement_number = Database::num_rows($result);
 ----------------------------------------------------*/
 
 if (!$surveyid) {
-	$show_actions = false;	
+	$show_actions = false;
 	if ((api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) and (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath')) {
 		echo '<div class="actions">';
 		echo "<a href='".api_get_self()."?".api_get_cidreq()."&action=add&origin=".(empty($_GET['origin'])?'':$_GET['origin'])."'>".Display::return_icon('announce_add.gif',get_lang('AddAnnouncement')).get_lang('AddAnnouncement')."</a>";
-		$show_actions = true;				
+		$show_actions = true;
 	}
-		
+
 	if (api_is_allowed_to_edit() && $announcement_number > 1) {
 		if (!$show_actions)
-			echo '<div class="actions">';			
+			echo '<div class="actions">';
 		echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=delete_all\" onclick=\"javascript:if(!confirm('".get_lang("ConfirmYourChoice")."')) return false;\">".Display::return_icon('valvesdelete.gif',get_lang('AnnouncementDeleteAll')).get_lang('AnnouncementDeleteAll')."</a>\n";	}	// if announcementNumber > 1
 	if ($show_actions)
-		echo '</div>';		
+		echo '</div>';
 }
 
 if (empty($_GET['origin']) OR $_GET['origin'] !== 'learnpath') {
@@ -944,13 +944,13 @@ if (!$surveyid) {
 	if ($display_title_list == true) {
 		echo "\t\t\t<table>\n";
 		while ($myrow = Database::fetch_array($result)) {
-			$title = $myrow['title'];	
+			$title = $myrow['title'];
 			$title = Security::remove_XSS($title);
 			echo "\t\t\t\t<tr>\n";
 			echo "\t\t\t\t\t<td width=\"15%\">\n";
-			if ($myrow['visibility']==0) { 
+			if ($myrow['visibility']==0) {
 				$class="class=\"invisible\"";
-			} else { 
+			} else {
 				$class="";
 			}
 			echo "\t\t\t\t\t\t<a style=\"text-decoration:none\" href=\"announcements.php?".api_get_cidreq()."#".$myrow['id']."\" ".$class.">" . api_trunc_str($title,$length) . "</a>\n";
@@ -987,12 +987,12 @@ if (!empty($error_message)) {
 ==================================================================================*/
 
 if ($display_form == true) {
-	
+
 	$content_to_modify=stripslashes($content_to_modify);
 	$title_to_modify=stripslashes($title_to_modify);
-	
+
 	// DISPLAY ADD ANNOUNCEMENT COMMAND
-	echo '<form method="post" name="f1" action="'.api_get_self().'?publish_survey='.Security::remove_XSS($surveyid).'&id='.Security::remove_XSS($_GET['id']).'&db_name='.$db_name.'&cidReq='.Security::remove_XSS($_GET['cidReq']).'" style="margin:0px;">'."\n";		
+	echo '<form method="post" name="f1" action="'.api_get_self().'?publish_survey='.Security::remove_XSS($surveyid).'&id='.Security::remove_XSS($_GET['id']).'&db_name='.$db_name.'&cidReq='.Security::remove_XSS($_GET['cidReq']).'" style="margin:0px;">'."\n";
 	if (empty($_GET['id'])) {
 		$form_name = get_lang('AddAnnouncement');
 	} else {
@@ -1023,15 +1023,15 @@ if ($display_form == true) {
 			$_SESSION['select_groupusers']="show";
 			$email_ann = '1';
 			$content_to_modify = sprintf(get_lang('RemindInactiveLearnersMailContent'),api_get_setting('siteName'),$since);
-			$title_to_modify = sprintf(get_lang('RemindInactiveLearnersMailSubject'),api_get_setting('siteName'));						
+			$title_to_modify = sprintf(get_lang('RemindInactiveLearnersMailSubject'),api_get_setting('siteName'));
 		} else {
 			echo get_lang("Everybody");
 		}
-		
+
 		show_to_form($to);
 		echo '		</div>
 					</div>';
-								
+
 		if (!isset($announcement_to_modify) ) $announcement_to_modify ='';
 		if ($announcement_to_modify=='') {
 			($email_ann=='1')?$checked='checked':$checked='';
@@ -1041,14 +1041,14 @@ if ($display_form == true) {
 						</div>
 						<div class="formw">'.get_lang('EmailOption').'
 						</div>
-					</div>';			
-			
+					</div>';
+
 		}
 	} else {
-		
+
 		if (!isset($announcement_to_modify) ) {
 			$announcement_to_modify ="";
-		} 
+		}
 		if ($announcement_to_modify=='') {
 			($email_ann=='1' || !empty($surveyid))?$checked='checked':$checked='';
 			echo '<div class="row">
@@ -1058,11 +1058,11 @@ if ($display_form == true) {
 				  <div class="formw">'.
 					get_lang('EmailOption').': '.get_lang('MyGroup').'&nbsp;&nbsp;<a href="#" onclick="if(document.getElementById(\'recipient_list\').style.display==\'none\') document.getElementById(\'recipient_list\').style.display=\'block\'; else document.getElementById(\'recipient_list\').style.display=\'none\';">'.get_lang('ModifyRecipientList').'</a>';
 			show_to_form_group($_SESSION['toolgroup']);
-			echo '</div></div>';	
+			echo '</div></div>';
 		}
-		
+
 	}
-	
+
 	if ($surveyid) {
 		echo '	<div class="row">
 					<div class="label">
@@ -1081,65 +1081,65 @@ if ($display_form == true) {
 					</div>
 				</div>';
 	}
-		
-	// the announcement title						
-	echo '	<div class="row">			
+
+	// the announcement title
+	echo '	<div class="row">
 				<div id="msg_error" style="display:none;color:red;margin-left:20%"></div>
 				<div class="label">
 					<span class="form_required">*</span> '.get_lang('EmailTitle').'
 				</div>
-				<div class="formw">	
-												
+				<div class="formw">
+
 					<input type="text" id="emailTitle" name="emailTitle" value="'.Security::remove_XSS($title_to_modify).'" size="60">
 				</div>
 			</div>';
-		
+
 	unset($title_to_modify);
 	$title_to_modify = null;
 
 	if (!isset($announcement_to_modify) ) $announcement_to_modify ="";
 	if (!isset($content_to_modify) ) 		$content_to_modify ="";
 	if (!isset($title_to_modify)) 		$title_to_modify = "";
-	
+
 	echo '<input type="hidden" name="id" value="'.$announcement_to_modify.'" />';
-	
+
 	if ($surveyid) {
 	$content_to_modify='<br /><a href="'.api_get_path(WEB_CODE_PATH).'/survey/#page#?temp=#temp#&surveyid=#sid#&uid=#uid#&mail=#mail#&db_name=#db_name">'.get_lang('ClickHereToOpenSurvey').'</a><br />
 									'.get_lang('OrCopyPasteUrl').' <br />
 									'.api_get_path(WEB_CODE_PATH).'/survey/#page#?temp=#temp#&surveyid=#sid#&uid=#uid#&mail=#mail#&db_name=#db_name&nbsp;';
 	}
-	
-    $oFCKeditor = new FCKeditor('newContent') ;		
-		
+
+    $oFCKeditor = new FCKeditor('newContent') ;
+
 	$oFCKeditor->Width		= '100%';
 	$oFCKeditor->Height		= '300';
-	
+
 	if(!api_is_allowed_to_edit()) {
 		$oFCKeditor->ToolbarSet = "AnnouncementsStudent";
 	} else {
 		$oFCKeditor->ToolbarSet = "Announcements";
-	}		
-	
+	}
+
 	$oFCKeditor->Value		= $content_to_modify;
-	
-	echo $oFCKeditor->CreateHtml();        
-        
+
+	echo $oFCKeditor->CreateHtml();
+
 	echo'<br />';
 	if (empty($_SESSION['toolgroup'])) {
 		echo '<input type="hidden" name="submitAnnouncement" value="OK">';
 		echo '<input type="hidden" name="sec_token" value="'.$stok.'" />';
-		echo '<button class="save" type="button"  value="'.'  '.get_lang('Send').'  '.'" onclick="selectAll(this.form.elements[3],true)" >'.get_lang('ButtonPublishAnnouncement').'</button><br /><br />';        
+		echo '<button class="save" type="button"  value="'.'  '.get_lang('Send').'  '.'" onclick="selectAll(this.form.elements[3],true)" >'.get_lang('ButtonPublishAnnouncement').'</button><br /><br />';
 	} else {
 		echo '<input type="hidden" name="submitAnnouncement" value="OK">';
 		echo '<input type="hidden" name="sec_token" value="'.$stok.'" />';
-		echo '<button class="save" type="button"  value="'.'  '.get_lang('Send').'  '.'" onclick="selectAll(this.form.elements[4],true)" >'.get_lang('ButtonPublishAnnouncement').'</button><br /><br />';		
+		echo '<button class="save" type="button"  value="'.'  '.get_lang('Send').'  '.'" onclick="selectAll(this.form.elements[4],true)" >'.get_lang('ButtonPublishAnnouncement').'</button><br /><br />';
 	}
 	echo '</form><br />';
 
 	if ((isset($_GET['action']) && isset($_GET['id']) && is_array($to))||isset($_GET['remindallinactives'])||isset($_GET['remind_inactive'])) {
 		echo '<script>document.getElementById(\'recipient_list\').style.display=\'block\';</script>';
 	}
-	
+
 } // displayform
 
 
@@ -1191,7 +1191,7 @@ if ($display_announcement_list && !$surveyid) {
 		} elseif (isset($_SESSION['group'])) {
 			// A.2. you are a course admin with a GROUP filter
 			// => see only the messages of this specific group
-			
+
 			$sql="SELECT
 				announcement.*, toolitemproperties.*
 				FROM $tbl_announcement announcement, $tbl_item_property toolitemproperties
@@ -1205,7 +1205,7 @@ if ($display_announcement_list && !$surveyid) {
 			// A.3 you are a course admin without any group or user filter
 			// A.3.a you are a course admin without user or group filter but WITH studentview
 			// => see all the messages of all the users and groups without editing possibilities
-	
+
 			if (isset($isStudentView) and $isStudentView=="true") {
 
 				$sql="SELECT
@@ -1219,7 +1219,7 @@ if ($display_announcement_list && !$surveyid) {
 					ORDER BY display_order DESC";
 			} else {
 				// A.3.a you are a course admin without user or group filter and WTIHOUT studentview (= the normal course admin view)
-				// => see all the messages of all the users and groups with editing possibilities	
+				// => see all the messages of all the users and groups with editing possibilities
 				$sql="SELECT
 					announcement.*, toolitemproperties.*
 					FROM $tbl_announcement announcement, $tbl_item_property toolitemproperties
@@ -1229,19 +1229,19 @@ if ($display_announcement_list && !$surveyid) {
 					AND announcement.session_id IN(0,".intval($_SESSION['id_session']).")
 					GROUP BY toolitemproperties.ref
 					ORDER BY display_order DESC";
-	
+
 			}
 		}
-	} else {  
-	//STUDENT			
+	} else {
+	//STUDENT
 			if (is_array($group_memberships) && count($group_memberships)>0) {
-				
+
 				if ((api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
 					$cond_user_id = " AND (toolitemproperties.lastedit_user_id = '".api_get_user_id()."' OR (toolitemproperties.to_user_id=$user_id OR toolitemproperties.to_group_id IN (0, ".implode(", ", $group_memberships).") )) ";
 				} else {
 					$cond_user_id = " AND (toolitemproperties.to_user_id=$user_id OR toolitemproperties.to_group_id IN (0, ".implode(", ", $group_memberships).")) ";
 				}
-				
+
 				$sql="SELECT
 					announcement.*, toolitemproperties.*
 					FROM $tbl_announcement announcement, $tbl_item_property toolitemproperties
@@ -1251,16 +1251,16 @@ if ($display_announcement_list && !$surveyid) {
 					AND toolitemproperties.visibility='1'
 					ORDER BY display_order DESC";
 			} else {
-				
+
 				if ($_user['user_id']) {
-					
+
 					if ((api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
 						$cond_user_id = " AND (toolitemproperties.lastedit_user_id = '".api_get_user_id()."' OR (toolitemproperties.to_user_id='".$_user['user_id']."' OR toolitemproperties.to_group_id='0')) ";
 					} else {
 						$cond_user_id = " AND (toolitemproperties.to_user_id='".$_user['user_id']."' OR toolitemproperties.to_group_id='0') ";
 					}
-					
-					$sql="SELECT 
+
+					$sql="SELECT
 						announcement.*, toolitemproperties.*
 						FROM $tbl_announcement announcement, $tbl_item_property toolitemproperties
 						WHERE announcement.id = toolitemproperties.ref
@@ -1270,13 +1270,13 @@ if ($display_announcement_list && !$surveyid) {
 						AND announcement.session_id IN(0,".intval($_SESSION['id_session']).")
 						ORDER BY display_order DESC";
 				} else {
-					
+
 					if ((api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
 						$cond_user_id = " AND (toolitemproperties.lastedit_user_id = '".api_get_user_id()."' OR toolitemproperties.to_group_id='0' ) ";
 					} else {
 						$cond_user_id = " AND toolitemproperties.to_group_id='0' ";
 					}
-					
+
 					$sql="SELECT
 						announcement.*, toolitemproperties.*
 						FROM $tbl_announcement announcement, $tbl_item_property toolitemproperties
@@ -1287,7 +1287,7 @@ if ($display_announcement_list && !$surveyid) {
 						AND announcement.session_id IN(0,".intval($_SESSION['id_session']).")";
 				}
 			}
-		
+
 	}
 
 	$result = api_sql_query($sql,__FILE__,__LINE__);
@@ -1300,7 +1300,7 @@ if ($display_announcement_list && !$surveyid) {
 	if ($num_rows == 0) {
 		echo get_lang('NoAnnouncements');;
 	}
-	
+
 	$iterator = 1;
 	$bottomAnnouncement = $announcement_number;
 
@@ -1309,7 +1309,7 @@ if ($display_announcement_list && !$surveyid) {
 	$displayed=array();
 
 	while ($myrow = Database::fetch_array($result)) {
-		
+
 		if (!in_array($myrow['id'], $displayed)) {
 			$title		 = $myrow['title'];
 			$content	 = $myrow['content'];
@@ -1336,7 +1336,7 @@ if ($display_announcement_list && !$surveyid) {
 			echo	"\t\t\t\t<tr class=\"".$style."\">";
 
 			/* THE ICONS */
-			
+
 			echo "\t\t\t\t\t<th>\n";
 			// anchoring
 			echo "<a name=\"".(int)($myrow["id"])."\"></a>\n";
@@ -1349,18 +1349,18 @@ if ($display_announcement_list && !$surveyid) {
 				echo "\t\t\t\t\t\t".Display::return_icon('email.gif', get_lang('AnnounceSentByEmail'))."\n";
 			}
 			echo "\t\t\t\t\t</th>\n";
-			
+
 			/* TITLE */
 
 			echo "\t\t\t\t\t<th>".Security::remove_XSS($title)."</th>\n";
 			echo "\t\t\t\t\t<th>" . get_lang("SentTo") . " : &nbsp; ";
-			
+
 			$sent_to=sent_to("announcement", $myrow['id']);
 			$sent_to_form=sent_to_form($sent_to);
 			$user_info=api_get_user_info($myrow['insert_user_id']);
-			
+
 				echo '&nbsp;&nbsp;&nbsp;'.get_lang('By').' : &nbsp;'.str_replace(' ', '&nbsp;', api_get_person_name($user_info['firstName'], $user_info['lastName']));
-			echo "\t\t\t\t\t</th>\n","\t\t\t\t</tr>\n";			
+			echo "\t\t\t\t\t</th>\n","\t\t\t\t</tr>\n";
 			echo "\t\t\t\t<tr class='row_odd'>\n\t\t\t\t\t<td class=\"announcements_datum\" colspan=\"3\">";
 			echo get_lang('AnnouncementPublishedOn')," : ",api_ucfirst(format_locale_date($dateFormatLong,strtotime($last_post_date)));
 			echo "</td>\n\t\t\t\t</tr>\n";
@@ -1381,7 +1381,7 @@ if ($display_announcement_list && !$surveyid) {
 
 			// we can edit if : we are the teacher OR the element belongs to the session we are coaching OR the option to allow users to edit is on
 			if (api_is_allowed_to_edit() OR (api_is_course_coach() && api_is_element_in_the_session(TOOL_ANNOUNCEMENT,$myrow['id'])) OR (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
-				
+
 				/* SHOW MOD/DEL/VIS FUNCTIONS */
 				echo	"<a href=\"".api_get_self()."?".api_get_cidreq()."&action=modify&id=".$myrow['id']."\">",
 						Display::return_icon('edit.gif', get_lang('Edit')),
@@ -1409,7 +1409,7 @@ if ($display_announcement_list && !$surveyid) {
 					echo	"<a href=\"".api_get_self()."?".api_get_cidreq()."&up=".$myrow["id"]."&sec_token=".$stok."\">",
 							Display::return_icon('up.gif', get_lang('Up'))."</a>";
 				}
-				
+
 				if ($iterator < $bottomAnnouncement) {
 					echo	"<a href=\"".api_get_self()."?".api_get_cidreq()."&down=".$myrow["id"]."&sec_token=".$stok."\">".
 							Display::return_icon('down.gif', get_lang('Down'))."</a>";
@@ -1421,7 +1421,7 @@ if ($display_announcement_list && !$surveyid) {
 			} // is_allowed_to_edit
 
 			echo "<tr><td width=\"100%\" colspan=\"3\"><a href=\"#top\">".Display::return_icon('top.gif', get_lang('Top'))."</a></td></tr>";
-			
+
 		}
 		$displayed[]=$myrow['id'];
 	}	// end while ($myrow = Database::fetch_array($result))

+ 6 - 6
main/app_share/appshare.php

@@ -15,22 +15,22 @@ $nameTools = get_lang("ModifInfo");
 $course_code = $_course["sysCode"];
 
 $app_share_tmp_dir_base = api_get_path(SYS_ARCHIVE_PATH).'app_share/';
-mkdir ($app_share_tmp_dir_base, 0700); 
+mkdir ($app_share_tmp_dir_base, 0700);
 $app_share_tmp_dir = $app_share_tmp_dir_base.$course_code;
 $app_base_file = api_get_path(SYS_CODE_PATH).'app_share/DokeosAppShare.exe';
 $app_share_app_file = $app_share_tmp_dir.'/DokeosAppShare.exe';
 
 $specialCode='';
 if (file_exists($app_share_app_file) == FALSE) {
-	
+
 	mkdir ($app_share_tmp_dir, 0700);
-	
+
 	if (file_exists($app_base_file) == FALSE) {
 		echo('FATAL ERROR: file <b>'.$app_base_file.'</b> not found.<br />');
 	} else {
 		$source = fopen($app_base_file, "r");
 		$target = fopen($app_share_app_file, "a" );
-		
+
 		$specialCode = rand(100000,999999).time().rand(100000,999999);
 		$contents = fread ($source, filesize ($app_base_file));
 		fwrite ($target, $contents, filesize ($app_base_file));
@@ -38,7 +38,7 @@ if (file_exists($app_share_app_file) == FALSE) {
 		fclose($source);
 		fclose($target);
 	}
-	
+
 } else {
 	$source = fopen($app_share_app_file, "r" );
 	fread ($source, filesize ($app_base_file)); // skip binary content
@@ -67,7 +67,7 @@ if ($_GET["client"] == 'true') {
     <PARAM NAME = ENCODING VALUE=Tight>
     <PARAM NAME = 'Open New Window' VALUE='Yes'>
     <COMMENT>
-	<EMBED 
+	<EMBED
             type = 'application/x-java-applet;version=1.4' \
             CODE = VncViewer.class \
             ARCHIVE = VncViewer.jar \

+ 6 - 6
main/app_share/index.php

@@ -15,22 +15,22 @@ $nameTools = get_lang("ModifInfo");
 $course_code = $_course["sysCode"];
 
 $app_share_tmp_dir_base = api_get_path(SYS_ARCHIVE_PATH).'app_share/';
-mkdir ($app_share_tmp_dir_base, 0700); 
+mkdir ($app_share_tmp_dir_base, 0700);
 $app_share_tmp_dir = $app_share_tmp_dir_base.$course_code;
 $app_base_file = api_get_path(SYS_CODE_PATH).'app_share/DokeosAppShare.exe';
 $app_share_app_file = $app_share_tmp_dir.'/DokeosAppShare.exe';
 
 $specialCode='';
 if (file_exists($app_share_app_file) == FALSE) {
-	
+
 	mkdir ($app_share_tmp_dir, 0700);
-	
+
 	if (file_exists($app_base_file) == FALSE) {
 		echo('FATAL ERROR: file <b>'.$app_base_file.'</b> not found.<br />');
 	} else {
 		$source = fopen($app_base_file, "r");
 		$target = fopen($app_share_app_file, "a" );
-		
+
 		$specialCode = rand(100000,999999).time().rand(100000,999999);
 		$contents = fread ($source, filesize ($app_base_file));
 		fwrite ($target, $contents, filesize ($app_base_file));
@@ -38,7 +38,7 @@ if (file_exists($app_share_app_file) == FALSE) {
 		fclose($source);
 		fclose($target);
 	}
-	
+
 } else {
 	$source = fopen($app_share_app_file, "r" );
 	fread ($source, filesize ($app_base_file)); // skip binary content
@@ -74,7 +74,7 @@ if ($_GET["client"] == 'true') {
     <PARAM NAME = ENCODING VALUE=Tight>
     <PARAM NAME = 'Open New Window' VALUE='Yes'>
     <COMMENT>
-	<EMBED 
+	<EMBED
             type = 'application/x-java-applet;version=1.4' \
             CODE = VncViewer.class \
             ARCHIVE = VncViewer.jar \

+ 1 - 1
main/app_share/plugin.php

@@ -1,6 +1,6 @@
 <?php
 /**
- * Plugin details (must be present) 
+ * Plugin details (must be present)
  */
 //the plugin title
 $plugin_info['title']='AppShare';

+ 34 - 34
main/auth/courses.php

@@ -1,4 +1,4 @@
-<?php 
+<?php
 /* For licensing terms, see /dokeos_license.txt */
 /**
 ==============================================================================
@@ -16,7 +16,7 @@
 // name of the language file that needs to be included
 $language_file = array ('courses','registration');
 
-//delete the globals["_cid"] we don't need it here 
+//delete the globals["_cid"] we don't need it here
 $cidReset = true; // Flag forcing the 'current course' reset
 
 // including the global file
@@ -29,9 +29,9 @@ $this_section=SECTION_COURSES;
 api_block_anonymous_users();
 
 if (!(api_is_platform_admin() || api_is_course_admin() || api_is_allowed_to_create_course())) {
-	if (api_get_setting('allow_students_to_browse_courses')=='false') {	
-		api_not_allowed();		
-	}			
+	if (api_get_setting('allow_students_to_browse_courses')=='false') {
+		api_not_allowed();
+	}
 }
 // include additional libraries
 include_once(api_get_path(LIBRARY_PATH) . 'debug.lib.inc.php');
@@ -103,7 +103,7 @@ if (isset($_GET['move']))
 		if($ctok == $_GET['sec_token'])
 		{
 			$message=move_category($_GET['move'], $_GET['category']);
-		}			
+		}
 	}
 }
 
@@ -240,7 +240,7 @@ function subscribe_user($course_code)
 
 	if ($all_course_information['registration_code']=='' OR $_POST['course_registration_code']==$all_course_information['registration_code'])
 	{
-		
+
 		if (api_is_platform_admin()) {
 			$status_user_in_new_course=COURSEMANAGER;
 		} else {
@@ -255,7 +255,7 @@ function subscribe_user($course_code)
 				CourseManager::email_to_tutor($_user['user_id'],$course_code,$send_to_tutor_also=true);
 			}
 			return get_lang('EnrollToCourseSuccessful');
-			
+
 		}
 		else
 		{
@@ -337,20 +337,20 @@ function browse_courses()
 */
 function count_courses_in_category($category)
 {
-	$tbl_course         = Database::get_main_table(TABLE_MAIN_COURSE);	
-	$sql="SELECT * FROM $tbl_course WHERE category_code".(empty($category)?" IS NULL":"='".$category."'");	
-	
+	$tbl_course         = Database::get_main_table(TABLE_MAIN_COURSE);
+	$sql="SELECT * FROM $tbl_course WHERE category_code".(empty($category)?" IS NULL":"='".$category."'");
+
 	//showing only the courses of the current Dokeos access_url_id
 	global $_configuration;
 	if ($_configuration['multiple_access_urls']==true) {
 		$url_access_id = api_get_current_access_url_id();
 		if ($url_access_id !=-1) {
-			$tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);		
-			$sql="SELECT * FROM $tbl_course as course INNER JOIN $tbl_url_rel_course as url_rel_course 
+			$tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
+			$sql="SELECT * FROM $tbl_course as course INNER JOIN $tbl_url_rel_course as url_rel_course
 					ON (url_rel_course.course_code=course.code)
 					WHERE access_url_id = $url_access_id AND category_code".(empty($category)?" IS NULL":"='".$category."'");
-		}		
-	}	
+		}
+	}
 	$result=api_sql_query($sql,__FILE__,__LINE__);
 	return Database::num_rows($result);
 }
@@ -367,11 +367,11 @@ function browse_course_categories()
 	$tbl_courses_nodes   = Database::get_main_table(TABLE_MAIN_CATEGORY);
 	$category = Database::escape_string($_GET['category']);
 	$safe_url_categ = Security::remove_XSS($_GET['category']);
-	
+
 	echo "<p><b>".get_lang('CourseCategories')."</b>";
 
 	$sql= "SELECT * FROM $tbl_courses_nodes WHERE parent_id ".(empty($category)?"IS NULL":"='".$category."'")." GROUP BY code, parent_id  ORDER BY tree_pos ASC";
-	
+
 	$result=api_sql_query($sql,__FILE__,__LINE__);
 	echo "<ul>";
 	while ($row=Database::fetch_array($result))	{
@@ -405,21 +405,21 @@ function browse_courses_in_category()
 
 	echo "<p><b>".get_lang('CoursesInCategory')."</b>";
 	$my_category = (empty($category)?" IS NULL":"='".$category."'");
-	
+
 	$sql="SELECT * FROM $tbl_course WHERE category_code".$my_category.' ORDER BY title, visual_code';
 
-	//showing only the courses of the current Dokeos access_url_id 
+	//showing only the courses of the current Dokeos access_url_id
 	global $_configuration;
 	if ($_configuration['multiple_access_urls']==true) {
 		$url_access_id = api_get_current_access_url_id();
 		if ($url_access_id !=-1) {
-			$tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);		
-			$sql="SELECT * FROM $tbl_course as course INNER JOIN $tbl_url_rel_course as url_rel_course 
+			$tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
+			$sql="SELECT * FROM $tbl_course as course INNER JOIN $tbl_url_rel_course as url_rel_course
 					ON (url_rel_course.course_code=course.code)
 					WHERE access_url_id = $url_access_id AND category_code".$my_category.' ORDER BY title, visual_code';
-		}		
+		}
 	}
-	
+
 	$result=api_sql_query($sql,__FILE__,__LINE__);
 	while ($row=Database::fetch_array($result)) {
 		if ($row['registration_code']=='') {
@@ -428,7 +428,7 @@ function browse_courses_in_category()
 			$registration_code=true;
 		}
 		$courses[]=array("code" => $row['code'], "directory" => $row['directory'], "db"=> $row['db_name'], "visual_code" => $row['visual_code'], "title" => $row['title'], "tutor" => $row['tutor_name'], "subscribe" => $row['subscribe'], "unsubscribe" => $row['unsubscribe'], 'registration_code'=> $registration_code);
-	}	
+	}
 	display_subscribe_to_courses($courses);
 }
 
@@ -524,17 +524,17 @@ function search_courses($search_term)
 	$TABLECOURS = Database::get_main_table(TABLE_MAIN_COURSE);
 	$search_term_safe=Database::escape_string($search_term);
 	$sql_find="SELECT * FROM $TABLECOURS WHERE code LIKE '%".$search_term_safe."%' OR title LIKE '%".$search_term_safe."%' OR tutor_name LIKE '%".$search_term_safe."%' ORDER BY title, visual_code ASC";
-	
+
 	global $_configuration;
 	if ($_configuration['multiple_access_urls']==true) {
 		$url_access_id = api_get_current_access_url_id();
 		if ($url_access_id !=-1) {
 			$tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
-			$sql_find="SELECT * FROM $TABLECOURS as course INNER JOIN $tbl_url_rel_course as url_rel_course 
+			$sql_find="SELECT * FROM $TABLECOURS as course INNER JOIN $tbl_url_rel_course as url_rel_course
 					ON (url_rel_course.course_code=course.code)
-					WHERE access_url_id = $url_access_id AND  (code LIKE '%".$search_term_safe."%' OR title LIKE '%".$search_term_safe."%' OR tutor_name LIKE '%".$search_term_safe."%' ) ORDER BY title, visual_code ASC "; 
-		}		
-	}	
+					WHERE access_url_id = $url_access_id AND  (code LIKE '%".$search_term_safe."%' OR title LIKE '%".$search_term_safe."%' OR tutor_name LIKE '%".$search_term_safe."%' ) ORDER BY title, visual_code ASC ";
+		}
+	}
 	$result_find=api_sql_query($sql_find,__FILE__,__LINE__);
 	while ($row=Database::fetch_array($result_find)) {
 		$courses[]=array("code" => $row['code'], "directory" => $row['directory'], "db"=> $row['db_name'], "visual_code" => $row['visual_code'], "title" => $row['title'], "tutor" => $row['tutor_name'], "subscribe" => $row['subscribe'], "unsubscribe" => $row['unsubscribe']);
@@ -818,7 +818,7 @@ function display_courses_in_category($user_category_id, $showicons)
 	$TABLECOURS=Database::get_main_table(TABLE_MAIN_COURSE);
 	$TABLECOURSUSER=Database::get_main_table(TABLE_MAIN_COURSE_USER);
 	$TABLE_USER_COURSE_CATEGORY = Database::get_user_personal_table(TABLE_USER_COURSE_CATEGORY);
-	
+
 
 
 	$sql_select_courses="SELECT course.code, course.visual_code, course.subscribe subscr, course.unsubscribe unsubscr,
@@ -904,7 +904,7 @@ function display_subscribe_icon($current_course, $user_coursecodes)
 {
 	global $stok;
 	// we display the icon to subscribe or the text already subscribed
-	if (in_array($current_course['code'],$user_coursecodes)) {		
+	if (in_array($current_course['code'],$user_coursecodes)) {
 		Display::display_icon('enroll_na.gif', get_lang('AlreadySubscribed'));
 	} else {
 		if ($current_course['subscribe'] == SUBSCRIBE_ALLOWED)
@@ -920,7 +920,7 @@ function display_subscribe_icon($current_course, $user_coursecodes)
 		} else {
 		//	echo get_lang("SubscribingNotAllowed");
 			Display::display_icon('enroll_na.gif', get_lang('SubscribingNotAllowed'));
-			
+
 		}
 	}
 }
@@ -962,7 +962,7 @@ function display_course_icons($key, $number_of_courses, $course)
 	}
 	echo "<td rowspan=\"2\" valign=\"top\" class=\"invisible\">";
 	if ($course['status'] != 1) {
-		if ($course['unsubscr'] == 1) {	
+		if ($course['unsubscr'] == 1) {
 				// changed link to submit to avoid action by the search tool indexer
 				echo	"<form action=\"".api_get_self()."\" method=\"post\" onsubmit=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang("ConfirmUnsubscribeFromCourse"),ENT_QUOTES,$charset))."')) return false;\">";
 				echo    '<input type="hidden" name="sec_token" value="'.$stok.'">';
@@ -1178,7 +1178,7 @@ function display_info_text($text)
 {
 	//echo "<font color=\"#808080\">" . $text . "</font>\n";
 	echo $text;
-} 
+}
 
 /**
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University

+ 49 - 49
main/auth/inscription.php

@@ -22,20 +22,20 @@ require_once(api_get_path(INCLUDE_PATH).'lib/legal.lib.php');
 //require_once (api_get_path(LIBRARY_PATH).'image.lib.php');
 
 // Load terms & conditions from the current lang
-if (api_get_setting('allow_terms_conditions')=='true') {	
+if (api_get_setting('allow_terms_conditions')=='true') {
 	$get = array_keys($_GET);
 	if (isset($get)) {
-		if ($get[0]=='legal'){				
+		if ($get[0]=='legal'){
 			//$language = api_get_setting('platformLanguage');
 			$language = api_get_interface_language();
 			$language = api_get_language_id($language);
 			$term_preview= LegalManager::get_last_condition($language);
 			if ($term_preview==false) {
 				//look for the default language
-				$language = api_get_setting('platformLanguage');				
+				$language = api_get_setting('platformLanguage');
 				$language = api_get_language_id($language);
 				$term_preview= LegalManager::get_last_condition($language);
-			}					
+			}
 			$tool_name = get_lang('TermsAndConditions');
 			Display :: display_header('');
 			echo '<div class="actions-title">';
@@ -43,7 +43,7 @@ if (api_get_setting('allow_terms_conditions')=='true') {
 			echo '</div>';
 			if (!empty($term_preview['content']))
 				echo $term_preview['content'];
-			else 
+			else
 				echo get_lang('ComingSoon');
 			Display :: display_footer();
 			exit;
@@ -67,7 +67,7 @@ if (api_get_setting('allow_registration')=='approval') {
 }
 //if openid was not found
 if (!empty($_GET['openid_msg']) && $_GET['openid_msg'] == 'idnotfound') {
-	Display::display_warning_message(get_lang('OpenIDCouldNotBeFoundPleaseRegister'));	
+	Display::display_warning_message(get_lang('OpenIDCouldNotBeFoundPleaseRegister'));
 }
 
 $form = new FormValidator('registration');
@@ -100,7 +100,7 @@ if ($display_all_form===true) {
 		$form->addRule('email', get_lang('ThisFieldIsRequired'), 'required');
 	$form->addRule('email', get_lang('EmailWrong'), 'email');
 	if (api_get_setting('openid_authentication')=='true') {
-		$form->addElement('text', 'openid', get_lang('OpenIDURL'), array('size' => 40));	
+		$form->addElement('text', 'openid', get_lang('OpenIDURL'), array('size' => 40));
 	}
 	/*
 	//	OFFICIAL CODE
@@ -130,7 +130,7 @@ if ($display_all_form===true) {
 	$form->addElement('text', 'phone', get_lang('Phone'), array('size' => 40));
 	if (api_get_setting('registration', 'phone') == 'true')
 		$form->addRule('phone', get_lang('ThisFieldIsRequired'), 'required');
-	
+
 	// PICTURE
 	/*if (api_get_setting('profile', 'picture') == 'true') {
 		$form->addElement('file', 'picture', get_lang('AddPicture'));
@@ -212,15 +212,15 @@ if ($display_all_form===true) {
 					$group[] =& HTML_QuickForm::createElement('radio', 'extra_'.$field_details[1], $option_details[1],$option_details[2].'<br />',$option_details[1]);
 				}
 				$form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], '');
-				if ($field_details[7] == 0)	$form->freeze('extra_'.$field_details[1]);	
+				if ($field_details[7] == 0)	$form->freeze('extra_'.$field_details[1]);
 				break;
 			case USER_FIELD_TYPE_SELECT:
 				$options = array();
 				foreach($field_details[9] as $option_id => $option_details) {
 					$options[$option_details[1]] = $option_details[2];
 				}
-				$form->addElement('select','extra_'.$field_details[1],$field_details[3],$options,'');	
-				if ($field_details[7] == 0)	$form->freeze('extra_'.$field_details[1]);			
+				$form->addElement('select','extra_'.$field_details[1],$field_details[3],$options,'');
+				if ($field_details[7] == 0)	$form->freeze('extra_'.$field_details[1]);
 				break;
 			case USER_FIELD_TYPE_SELECT_MULTIPLE:
 				$options = array();
@@ -228,7 +228,7 @@ if ($display_all_form===true) {
 					$options[$option_details[1]] = $option_details[2];
 				}
 				$form->addElement('select','extra_'.$field_details[1],$field_details[3],$options,array('multiple' => 'multiple'));
-				if ($field_details[7] == 0)	$form->freeze('extra_'.$field_details[1]);	
+				if ($field_details[7] == 0)	$form->freeze('extra_'.$field_details[1]);
 				break;
 			case USER_FIELD_TYPE_DATE:
 				$form->addElement('datepickerdate', 'extra_'.$field_details[1], $field_details[3],array('form_name'=>'registration'));
@@ -285,13 +285,13 @@ if ($display_all_form===true) {
 
 }
 //------------ Terms and conditions
-if (api_get_setting('allow_terms_conditions')=='true') {	
+if (api_get_setting('allow_terms_conditions')=='true') {
 	//$language = api_get_setting('platformLanguage');
 	$language = api_get_interface_language();
 	$language = api_get_language_id($language);
-	$term_preview= LegalManager::get_last_condition($language);	
-	
-	if ($term_preview==false) { 
+	$term_preview= LegalManager::get_last_condition($language);
+
+	if ($term_preview==false) {
 		//we load from the platform
 		$language = api_get_setting('platformLanguage');
 		$language = api_get_language_id($language);
@@ -299,31 +299,31 @@ if (api_get_setting('allow_terms_conditions')=='true') {
 		//if is false we load from english
 		if ($term_preview==false){
 			$language = api_get_language_id('english'); //this must work
-			$term_preview= LegalManager::get_last_condition($language);	
-		}					
-	}	
+			$term_preview= LegalManager::get_last_condition($language);
+		}
+	}
 	// Version and language //password
 	$form->addElement('hidden', 'legal_accept_type',$term_preview['version'].':'.$term_preview['language_id']);
-	$form->addElement('hidden', 'legal_info',$term_preview['legal_id'].':'.$term_preview['language_id']);	
+	$form->addElement('hidden', 'legal_info',$term_preview['legal_id'].':'.$term_preview['language_id']);
 	if (isset($_SESSION['info_current_user'][1]) && isset($_SESSION['info_current_user'][2])) {
 		$form->addElement('hidden', 'login',$_SESSION['info_current_user'][1]);
-		$form->addElement('hidden', 'password',$_SESSION['info_current_user'][2]);	
+		$form->addElement('hidden', 'password',$_SESSION['info_current_user'][2]);
 	}
 	if($term_preview['type'] == 1) {
-		$form->addElement('checkbox', 'legal_accept', null, get_lang('IHaveReadAndAgree').'&nbsp;<a href="inscription.php?legal" target="_blank">'.get_lang('TermsAndConditions').'</a>');		
+		$form->addElement('checkbox', 'legal_accept', null, get_lang('IHaveReadAndAgree').'&nbsp;<a href="inscription.php?legal" target="_blank">'.get_lang('TermsAndConditions').'</a>');
 		$form->addRule('extra_legal_accept',  get_lang('ThisFieldIsRequired'), 'required');
 	} else {
-		if (!empty($term_preview['content'])) {			
+		if (!empty($term_preview['content'])) {
 			$preview = LegalManager::show_last_condition($term_preview);
 			$term_preview  = '<div class="row">
 					<div class="label">'.get_lang('TermsAndConditions').'</div>
 					<div class="formw">
 					'.$preview.'
-					<br />				
+					<br />
 					</div>
-					</div>';		
+					</div>';
 			$form->addElement('html', $term_preview);
-		}		
+		}
 	}
 }
 
@@ -351,7 +351,7 @@ if(!empty($_GET['phone']))
 
 if (api_get_setting('openid_authentication')=='true' && !empty($_GET['openid']))
 {
-	$defaults['openid'] = Security::remove_XSS($_GET['openid']);	
+	$defaults['openid'] = Security::remove_XSS($_GET['openid']);
 }
 $defaults['status'] = STUDENT;
 $form->setDefaults($defaults);
@@ -361,18 +361,18 @@ if ($form->validate()) {
 	  STORE THE NEW USER DATA INSIDE THE MAIN DOKEOS DATABASE
 	  -----------------------------------------------------*/
 	$values = $form->exportValues();
-	
+
 	$values['username'] = api_substr($values['username'],0,20); //make *sure* the login isn't too long
 
 	if (api_get_setting('allow_registration_as_teacher') == 'false') {
 		$values['status'] = STUDENT;
 	}
-	
+
 	// creating a new user
-	$user_id = UserManager::create_user($values['firstname'],$values['lastname'],$values['status'],$values['email'],$values['username'],$values['pass1'],$values['official_code'], $values['language'],$values['phone'],$picture_uri);	
+	$user_id = UserManager::create_user($values['firstname'],$values['lastname'],$values['status'],$values['email'],$values['username'],$values['pass1'],$values['official_code'], $values['language'],$values['phone'],$picture_uri);
 
 		// Terms & Conditions
-	if (api_get_setting('allow_terms_conditions')=='true') {	
+	if (api_get_setting('allow_terms_conditions')=='true') {
 		// update the terms & conditions
 		if (isset($values['legal_accept_type'])) {
 			$cond_array = explode(':',$values['legal_accept_type']);
@@ -380,7 +380,7 @@ if ($form->validate()) {
 				$time = time();
 				$condition_to_save = intval($cond_array[0]).':'.intval($cond_array[1]).':'.$time;
 				UserManager::update_extra_field_value($user_id,'legal_accept',$condition_to_save);
-			}	
+			}
 		}
 	}
 
@@ -449,12 +449,12 @@ if ($form->validate()) {
 			$sql = "UPDATE ".$TABLE_USER."	SET active='0' WHERE user_id='".$user_id."'";
 			api_sql_query($sql,__FILE__,__LINE__);
 
-			
+
 			$sql_get_id_admin="SELECT * FROM ".Database::get_main_table(TABLE_MAIN_ADMIN);
 			$result=api_sql_query($sql_get_id_admin,__FILE__,__LINE__);
 			while ($row = Database::fetch_array($result)) {
-					
-				$sql_admin_list="SELECT * FROM ".$TABLE_USER." WHERE user_id='".$row['user_id']."'";			
+
+				$sql_admin_list="SELECT * FROM ".$TABLE_USER." WHERE user_id='".$row['user_id']."'";
 				$result_list=api_sql_query($sql_admin_list,__FILE__,__LINE__);
 				$admin_list=Database::fetch_array($result_list);
 				$emailto		= $admin_list['email'];
@@ -470,18 +470,18 @@ if ($form->validate()) {
 				$emailbody		.=get_lang('FirstName').': '.$values['firstname']."\n";
 				$emailbody		.=get_lang('Email').': '.$values['email']."\n";
 				$emailbody		.=get_lang('Status').': '.$values['status']."\n\n";
-				$emailbody		.=get_lang('ManageUser').': '.api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$user_id;	
-				
+				$emailbody		.=get_lang('ManageUser').': '.api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$user_id;
+
 				$sender_name = api_get_setting('administratorName').' '.api_get_setting('administratorSurname');
-			    $email_admin = api_get_setting('emailAdministrator');				
+			    $email_admin = api_get_setting('emailAdministrator');
 				@api_mail('', $emailto, $emailsubject, $emailbody, $sender_name,$email_admin);
-				
+
 			}
 				// 3. exit the page
 				unset($user_id);
 				Display :: display_footer();
 				exit;
-			
+
 		}
 
 
@@ -497,7 +497,7 @@ if ($form->validate()) {
 		api_session_register('_user');
 		api_session_register('is_allowedCreateCourse');
 
-		//stats		
+		//stats
 		event_login();
 		// last user login date is now
 		$user_last_login_datetime = 0; // used as a unix timestamp it will correspond to : 1 1 1970
@@ -510,7 +510,7 @@ if ($form->validate()) {
 
 		if (strstr($values['email'], '@')) {
 			// Lets predefine some variables. Be sure to change the from address!
-			$recipient_name = $values['firstname'].' '.$values['lastname'];	
+			$recipient_name = $values['firstname'].' '.$values['lastname'];
 			$email = $values['email'];
 			$emailfromaddr = api_get_setting('emailAdministrator');
 			$emailfromname = api_get_setting('siteName');
@@ -519,20 +519,20 @@ if ($form->validate()) {
 			// The body can be as long as you wish, and any combination of text and variables
 			$portal_url = $_configuration['root_web'];
 			if ($_configuration['multiple_access_urls']==true) {
-				$access_url_id = api_get_current_access_url_id();				
+				$access_url_id = api_get_current_access_url_id();
 				if ($access_url_id != -1 ){
 					$url = api_get_access_url($access_url_id);
 					$portal_url = $url['url'];
 				}
-			} 
-	
+			}
+
 			$emailbody = get_lang('Dear')." ".stripslashes(Security::remove_XSS($recipient_name)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName')." ".get_lang('Settings')." ".$values['username']."\n".get_lang('Pass')." : ".stripslashes($values['pass1'])."\n\n".get_lang('Address')." ".api_get_setting('siteName')." ".get_lang('Is')." : ".$portal_url."\n\n".get_lang('Problem')."\n\n".get_lang('Formula').",\n\n".api_get_setting('administratorName')." ".api_get_setting('administratorSurname')."\n".get_lang('Manager')." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email')." : ".api_get_setting('emailAdministrator');
-			
+
 			// Here we are forming one large header line
-			// Every header must be followed by a \n except the last			
+			// Every header must be followed by a \n except the last
 			$sender_name = api_get_setting('administratorName').' '.api_get_setting('administratorSurname');
-		    $email_admin = api_get_setting('emailAdministrator');						
-			@api_mail($recipient_name, $email, $emailsubject, $emailbody, $sender_name,$email_admin);	
+		    $email_admin = api_get_setting('emailAdministrator');
+			@api_mail($recipient_name, $email, $emailsubject, $emailbody, $sender_name,$email_admin);
 		}
 	}
 

+ 18 - 18
main/auth/ldap/authldap.php

@@ -48,7 +48,7 @@
 	version history
 	---------------
 	3.2 - updated to allow for specific term search for teachers identification
-	3.1 - updated code to use database settings, to respect coding conventions as much as possible (camel-case removed) and to allow for non-anonymous login 
+	3.1 - updated code to use database settings, to respect coding conventions as much as possible (camel-case removed) and to allow for non-anonymous login
 	3.0	- updated to use ldap_var.inc.php instead of ldap_var.inc (deprecated)
 		(November 2003)
 	2.9	- further changes for new login procedure
@@ -321,7 +321,7 @@ function ldap_authentication_check ($uname, $passwd)
 	// Etablissement de la connexion anonyme avec le serveur LDAP
 	$ds=ldap_connect($ldap_host,$ldap_port);
 	ldap_set_version($ds);
-	
+
 	$test_bind = false;
 	$test_bind_res = ldap_handle_bind($ds,$test_bind);
    	//en cas de probleme on utlise le replica
@@ -379,7 +379,7 @@ function ldap_authentication_check ($uname, $passwd)
 /**
  * Set the protocol version with version from config file (enables LDAP version 3)
  * @param	resource	The LDAP connexion resource, passed by reference.
- * @return	void	
+ * @return	void
  */
 function ldap_set_version(&$resource)
 {
@@ -401,7 +401,7 @@ function ldap_set_version(&$resource)
  * Handle bind (whether authenticated or not)
  * @param	resource	The LDAP handler to which we are connecting (by reference)
  * @param	resource	The LDAP bind handler we will be modifying
- * @return	boolean		Status of the bind assignment. True for success, false for failure. 
+ * @return	boolean		Status of the bind assignment. True for success, false for failure.
  */
 function ldap_handle_bind(&$ldap_handler,&$ldap_bind)
 {
@@ -442,14 +442,14 @@ function ldap_get_users()
 {
 
 	global $ldap_basedn, $ldap_host, $ldap_port, $ldap_rdn, $ldap_pass;
-	
+
 	$keyword_firstname = trim(Database::escape_string($_GET['keyword_firstname']));
 	$keyword_lastname = trim(Database::escape_string($_GET['keyword_lastname']));
 	$keyword_username = trim(Database::escape_string($_GET['keyword_username']));
 	$keyword_type = Database::escape_string($_GET['keyword_type']);
-	
+
 	$ldap_query=array();
-	
+
 	if ($keyword_username != "") {
 		$ldap_query[]="(uid=".$keyword_username."*)";
 	} else if ($keyword_lastname!=""){
@@ -461,13 +461,13 @@ function ldap_get_users()
 	if ($keyword_type !="" && $keyword_type !="all") {
 		$ldap_query[]="(employeeType=".$keyword_type.")";
 	}
-	
+
 	if (count($ldap_query)>1){
 		$str_query.="(& ";
 		foreach ($ldap_query as $query){
 			$str_query.=" $query";
 		}
-		$str_query.=" )"; 
+		$str_query.=" )";
 	} else {
 		$str_query=$ldap_query[0];
 	}
@@ -499,11 +499,11 @@ function ldap_get_users()
  */
 function ldap_get_number_of_users()
 {
-		
+
 	$info = ldap_get_users();
 	if (count($info)>0)
 		return $info['count'];
-	else 
+	else
 		return 0;
 
 }
@@ -547,12 +547,12 @@ function ldap_get_user_data($from, $number_of_items, $column, $direction)
 				$outab[] = $info[$key]['eduPersonPrimaryAffiliation'][0]; // Ici "student"
 				$users[] = $user;
 			}
-			
-		} 
+
+		}
 		else
 		{
 			Display :: display_error_message(get_lang('NoUser'));
-		}	
+		}
 	}
 	return $users;
 }
@@ -567,7 +567,7 @@ function ldap_get_user_data($from, $number_of_items, $column, $direction)
 function modify_filter($user_id,$url_params, $row)
 {
 	$url_params_id="id[]=".$row[0];
-	//$url_params_id="id=".$row[0];	
+	//$url_params_id="id=".$row[0];
 	$result .= '<a href="ldap_users_list.php?action=add_user&amp;user_id='.$user_id.'&amp;id_session='.Security::remove_XSS($_GET['id_session']).'&amp;'.$url_params_id.'&amp;sec_token='.$_SESSION['sec_token'].'"  onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, api_get_system_encoding()))."'".')) return false;">'.Display::return_icon('add_user.gif', get_lang('AddUsers')).'</a>';
 	return $result;
 }
@@ -580,7 +580,7 @@ function modify_filter($user_id,$url_params, $row)
 function ldap_add_user($login)
 {
 	global $ldap_basedn, $ldap_host, $ldap_port, $ldap_rdn, $ldap_pass;
-	
+
 	$ds = ldap_connect($ldap_host, $ldap_port);
 	ldap_set_version($ds);
 	if ($ds)
@@ -634,8 +634,8 @@ function ldap_add_user($login)
 			}
 		}
 
-	} 
-	else 
+	}
+	else
 	{
 		Display :: display_error_message(get_lang('LDAPConnectionError'));
 	}

+ 10 - 10
main/auth/ldap/login.php

@@ -2,29 +2,29 @@
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos SPRL
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Roan Embrechts
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
 ==============================================================================
 */
 /**
 ==============================================================================
-*	Users trying to login, who already exist in the Dokeos database 
+*	Users trying to login, who already exist in the Dokeos database
 *	and have ldap as authentication type, get verified here.
 *
 *	@author Roan Embrechts
@@ -45,14 +45,14 @@
 	===============================================
 		LDAP authentification module
 		this calls the loginWithLdap function
-		from the LDAP library, and sets a few 
+		from the LDAP library, and sets a few
 		variables based on the result.
 	===============================================
 	*/
 //require_once('../../inc/global.inc.php'); - this script should be loaded by the /index.php script anyway, so global is already loaded
 require_once('authldap.php');
 
-$loginLdapSucces = ldap_login($login, $password);	
+$loginLdapSucces = ldap_login($login, $password);
 
 if ($loginLdapSucces)
 {
@@ -60,8 +60,8 @@ if ($loginLdapSucces)
 	$uidReset = true;
 	$_user['user_id'] = $uData['user_id'];
 	api_session_register('_uid');
-    // Jand: copied from event_login in events.lib.php to enable login statistics:    
-    event_login(); 
+    // Jand: copied from event_login in events.lib.php to enable login statistics:
+    event_login();
 }
 else
 {

+ 9 - 9
main/auth/ldap/newUser.php

@@ -2,29 +2,29 @@
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos SPRL
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Roan Embrechts
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
 ==============================================================================
 */
 /**
 ==============================================================================
-*	Users trying to login, who do not yet exist in the Dokeos database, 
+*	Users trying to login, who do not yet exist in the Dokeos database,
 *	can be added by this script which tries to retrieve ldap information about
 *   them.
 *
@@ -32,10 +32,10 @@
 *	@package dokeos.auth.ldap
 ==============================================================================
 */
-	
+
 /*
 ==================================================
-	when a user does not exist yet in dokeos, 
+	when a user does not exist yet in dokeos,
 	but he or she does exist in the LDAP,
 	we add him to the dokeos database
 ==================================================
@@ -45,7 +45,7 @@ require_once('authldap.php');
 
 //error_log('Trying to register new user '.$login.' with pass '.$password,0);
 
-$ldap_login_success = ldap_login($login, $password);	
+$ldap_login_success = ldap_login($login, $password);
 
 if ($ldap_login_success)
 {

+ 1 - 1
main/auth/lostPassword.php

@@ -35,7 +35,7 @@ echo $tool_name;
 echo '</div>';
 $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
 if (isset ($_GET["reset"]) && isset ($_GET["id"])) {
-	$msg = reset_password($_GET["reset"], $_GET["id"]);	
+	$msg = reset_password($_GET["reset"], $_GET["id"]);
 	$msg1= '<a href="'.api_get_path(WEB_PATH).'main/auth/lostPassword.php" class="fake_button_back" >'.get_lang('Back').'</a>';
 	echo '<br/><br/><div class="actions" >'.$msg1.'</div>';
 } else {

+ 15 - 15
main/auth/lost_password.lib.php

@@ -13,7 +13,7 @@ function get_email_headers()
 	$emailHeaders = "From: \"".addslashes(api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS))."\" <".api_get_setting('emailAdministrator').">\n";
 	$emailHeaders .= "Reply-To: ".api_get_setting('emailAdministrator')."\n";
 	$emailHeaders .= "Return-Path: ".api_get_setting('emailAdministrator')."\n";
-	$emailHeaders .= "X-Sender: ".api_get_setting('emailAdministrator')."\n";	
+	$emailHeaders .= "X-Sender: ".api_get_setting('emailAdministrator')."\n";
 	$emailHeaders .= "X-Mailer: PHP / ".phpversion()."\n";
 	$emailHeaders .= "Content-Type: text/plain;\n\tcharset=\"".$charset."\"\n";
 	$emailHeaders .= "Mime-Version: 1.0";
@@ -32,18 +32,18 @@ function get_user_account_list($user, $reset = false)
 	global $_configuration;
 	$portal_url = $_configuration['root_web'];
 	if ($_configuration['multiple_access_urls']==true) {
-		$access_url_id = api_get_current_access_url_id();				
+		$access_url_id = api_get_current_access_url_id();
 		if ($access_url_id != -1 ){
 			$url = api_get_access_url($access_url_id);
 			$portal_url = $url['url'];
 		}
 	}
-		
-	if ($reset==true) {		 	
+
+	if ($reset==true) {
 		foreach ($user as $thisUser) {
 			$secretword = get_secret_word($thisUser["email"]);
-			if ($reset)	{								
-				$reset_link = $portal_url."main/auth/lostPassword.php?reset=".$secretword."&id=".$thisUser['uid'];			
+			if ($reset)	{
+				$reset_link = $portal_url."main/auth/lostPassword.php?reset=".$secretword."&id=".$thisUser['uid'];
 			} else {
 				$reset_link = get_lang('Pass')." : $thisUser[password]";
 			}
@@ -53,10 +53,10 @@ function get_user_account_list($user, $reset = false)
 		{
 			$userAccountList = implode("\n------------------------\n", $userAccountList);
 		}
-	} else {		 
+	} else {
 	    $user = $user[0];
 	    $reset_link = get_lang('Pass')." : $user[password]";
-       	$userAccountList = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$user['loginName']."\n".$reset_link.'';	
+       	$userAccountList = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$user['loginName']."\n".$reset_link.'';
 	}
 	return $userAccountList;
 }
@@ -75,19 +75,19 @@ function send_password_to_user($user)
 	$userAccountList = get_user_account_list($user); // BODY
 	$portal_url = $_configuration['root_web'];
 	if ($_configuration['multiple_access_urls']==true) {
-		$access_url_id = api_get_current_access_url_id();				
+		$access_url_id = api_get_current_access_url_id();
 		if ($access_url_id != -1 ){
 			$url = api_get_access_url($access_url_id);
 			$portal_url = $url['url'];
 		}
 	}
-						
+
 	$emailBody = get_lang('YourAccountParam')." ".$portal_url."\n\n$userAccountList";
 	// SEND MESSAGE
-	$emailTo = $user[0]["email"];			
+	$emailTo = $user[0]["email"];
 	$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
-    $email_admin = api_get_setting('emailAdministrator');			
-				
+    $email_admin = api_get_setting('emailAdministrator');
+
 	if (@api_mail('', $emailTo, $emailSubject, $emailBody, $sender_name,$email_admin)==1) {
 		Display::display_confirmation_message(get_lang('YourPasswordHasBeenEmailed'));
 	} else {
@@ -111,14 +111,14 @@ function handle_encrypted_password($user)
 	$emailSubject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT
 	$userAccountList = get_user_account_list($user, true); // BODY
 	$emailTo = $user[0]["email"];
-	$secretword = get_secret_word($emailTo);	
+	$secretword = get_secret_word($emailTo);
 	$emailBody = get_lang('DearUser')." :\n".get_lang("password_request")."\n\n";
 	$emailBody .= "-----------------------------------------------\n".$userAccountList."\n-----------------------------------------------\n\n";
 	$emailBody .=get_lang('PasswordEncryptedForSecurity');
 	$emailBody .="\n\n".get_lang('Formula').",\n".get_lang('PlataformAdmin');
 	$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
     $email_admin = api_get_setting('emailAdministrator');
-			
+
 	if (@api_mail('', $emailTo, $emailSubject, $emailBody, $sender_name,$email_admin)==1)
 	{
 		Display::display_confirmation_message(get_lang('YourPasswordHasBeenEmailed'));

+ 45 - 45
main/auth/my_progress.php

@@ -65,9 +65,9 @@ $now=date('Y-m-d');
   <th><?php echo get_lang('Course'); ?></th>
   <th><?php echo get_lang('Time'); ?></th>
   <th><?php echo get_lang('Progress'); ?></th>
-  <th><?php 
+  <th><?php
   echo get_lang('Score');
-  Display :: display_icon('info3.gif',get_lang('ScormAndLPTestTotalAverage') , array ('align' => 'absmiddle', 'hspace' => '3px')); 
+  Display :: display_icon('info3.gif',get_lang('ScormAndLPTestTotalAverage') , array ('align' => 'absmiddle', 'hspace' => '3px'));
   ?></th>
   <th><?php echo get_lang('LastConnexion'); ?></th>
   <th><?php echo get_lang('Details'); ?></th>
@@ -100,9 +100,9 @@ foreach($Courses as $enreg) {
   		<?php echo $progress.'%'; ?>
   	</td>
   	<td align='center'>
-		<?php 
+		<?php
 		if (!is_null($pourcentageScore)) {
-			echo $pourcentageScore.'%'; 
+			echo $pourcentageScore.'%';
 		} else {
 			echo '0%';
 		}
@@ -132,42 +132,42 @@ foreach($Courses as $enreg) {
 	if(isset($_GET['course'])) {
 		$course = Database::escape_string($_GET['course']);
 		$a_infosCours = CourseManager::get_course_information($course);
-		
+
 		//get coach and session_name if there is one and if session_mode is activated
 		if(api_get_setting('use_session_mode')=='true') {
 			$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
 			$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
 			$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
 			$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
-			
-			$sql = 'SELECT id_session 
+
+			$sql = 'SELECT id_session
 					FROM '.$tbl_session_course_user.' session_course_user
 					WHERE session_course_user.id_user = '.intval($_user['user_id']).'
 					AND session_course_user.course_code = "'.Database::escape_string($course).'"
 					ORDER BY id_session DESC';
 			$rs = api_sql_query($sql,__FILE__,__LINE__);
-			
-			$row=Database::fetch_array($rs);			
+
+			$row=Database::fetch_array($rs);
 			if (!empty ($row[0]))
 			{
-				$session_id =intval($row[0]);	
+				$session_id =intval($row[0]);
 			}
-			//$session_id =intval(Database::result($rs,0,0));			
-			
+			//$session_id =intval(Database::result($rs,0,0));
+
 			if($session_id>0)
 			{
 				// get session name and coach of the session
-				$sql = 'SELECT name, id_coach FROM '.$tbl_session.' 
+				$sql = 'SELECT name, id_coach FROM '.$tbl_session.'
 						WHERE id='.$session_id;
-				$rs = api_sql_query($sql,__FILE__,__LINE__);						
+				$rs = api_sql_query($sql,__FILE__,__LINE__);
 				$session_name = Database::result($rs,0,'name');
 				$session_coach_id = intval(Database::result($rs,0,'id_coach'));
-				
+
 				// get coach of the course in the session
-				$sql = 'SELECT id_coach FROM '.$tbl_session_course.' 
+				$sql = 'SELECT id_coach FROM '.$tbl_session_course.'
 						WHERE id_session='.$session_id.'
 						AND course_code = "'.Database::escape_string($_GET['course']).'"';
-				$rs = api_sql_query($sql,__FILE__,__LINE__);						
+				$rs = api_sql_query($sql,__FILE__,__LINE__);
 				$session_course_coach_id = intval(Database::result($rs,0,0));
 
 				if($session_course_coach_id!=0)
@@ -182,9 +182,9 @@ foreach($Courses as $enreg) {
 				}
 			}
 		} // end if(api_get_setting('use_session_mode')=='true')
-		
+
 		$tableTitle = $a_infosCours['title'].' | Coach : '.$a_infosCours['tutor_name'].((!empty($session_name)) ? ' | '.get_lang('Session').' : '.$session_name : '');
-		
+
 
 		?>
 		<table class="data_table" width="100%">
@@ -275,18 +275,18 @@ foreach($Courses as $enreg) {
 			</tr>
 
 			<?php
-				
+
 				$sql='SELECT visibility FROM '.$a_infosCours['db_name'].'.'.TABLE_TOOL_LIST.' WHERE name="quiz"';
 				$resultVisibilityTests = api_sql_query($sql);
-								
-				if (Database::result($resultVisibilityTests,0,'visibility')==1) {				
+
+				if (Database::result($resultVisibilityTests,0,'visibility')==1) {
 					$sqlExercices = "	SELECT quiz.title,id, results_disabled
 									FROM ".$a_infosCours['db_name'].".".$tbl_course_quiz." AS quiz
-									WHERE active='1'";	
-	
+									WHERE active='1'";
+
 					$resuktExercices = api_sql_query($sqlExercices);
-					if (Database::num_rows($resuktExercices)>0) {						
-						while ($a_exercices = Database::fetch_array($resuktExercices)) {								
+					if (Database::num_rows($resuktExercices)>0) {
+						while ($a_exercices = Database::fetch_array($resuktExercices)) {
 							$sqlEssais = "	SELECT COUNT(ex.exe_id) as essais
 											FROM $tbl_stats_exercices AS ex
 											WHERE ex.exe_user_id='".$_user['user_id']."' AND ex.exe_cours_id = '".$a_infosCours['code']."'
@@ -296,46 +296,46 @@ foreach($Courses as $enreg) {
 										 ;
 							$resultEssais = api_sql_query($sqlEssais);
 							$a_essais = Database::fetch_array($resultEssais);
-		
+
 							$sqlScore = "SELECT exe_id , exe_result,exe_weighting
 										 FROM $tbl_stats_exercices
 										 WHERE exe_user_id = ".$_user['user_id']."
 											 AND exe_cours_id = '".$a_infosCours['code']."'
 											 AND exe_exo_id = ".$a_exercices['id']."
 											 AND orig_lp_id = 0
-											 AND orig_lp_item_id = 0			
+											 AND orig_lp_item_id = 0
 										ORDER BY exe_date DESC LIMIT 1";
-		
+
 							$resultScore = api_sql_query($sqlScore);
 							$score = 0;
 							while($a_score = Database::fetch_array($resultScore)) {
 								$score = $score + $a_score['exe_result'];
 								$weighting = $weighting + $a_score['exe_weighting'];
 								$exe_id = $a_score['exe_id'];
-							}					
-							
+							}
+
 							if  ($weighting>0) {
-								// i.e 10.50%							
+								// i.e 10.50%
 								$pourcentageScore = round(($score*100)/$weighting,2);
 							} else {
-								$pourcentageScore=0;			
+								$pourcentageScore=0;
 							}
-		
+
 							$weighting = 0;
-		
+
 							echo '<tr>
 									<td>';
 							echo $a_exercices['title'];
-							echo '</td>';								 
-																						
-							if ($a_exercices['results_disabled']==0) {								
-								echo '<td align="center">';	
+							echo '</td>';
+
+							if ($a_exercices['results_disabled']==0) {
+								echo '<td align="center">';
 								if ($a_essais['essais']>0) {
 									echo $pourcentageScore.'%';
 								} else {
 									echo '/';
-								}						 
-								echo '</td>';								
+								}
+								echo '</td>';
 								echo '<td align="center">';
 								echo  $a_essais['essais'];
 								echo '</td>
@@ -344,17 +344,17 @@ foreach($Courses as $enreg) {
 									echo '<a href="../exercice/exercise_show.php?origin=myprogress&id='.$exe_id.'&cidReq='.$a_infosCours['code'].'&id_session='.Security::remove_XSS($_GET['id_session']).'"> '.Display::return_icon('quiz.gif', get_lang('Quiz')).' </a>';
 								echo '</td>';
 							} else {
-								// we show or not the results if the teacher wants to									
-								echo '<td align="center">';							 
+								// we show or not the results if the teacher wants to
+								echo '<td align="center">';
 								echo get_lang('CantShowResults');
-								echo '</td>';								
+								echo '</td>';
 								echo '<td align="center">';
 								echo ' -- ';
 								echo '</td>
 										<td align="center" width="25">';
 								echo ' -- ';
 								echo '</td>';
-								
+
 							}
 							echo '</tr>';
 						}

+ 6 - 6
main/auth/openid/login.php

@@ -1,7 +1,7 @@
 <?php
 /**
  * OpenID login method
- * 
+ *
  * The OpenID login method relies on authentication servers providing a public
  * URL that can confirm the identity of a person, thus avoiding the spread
  * use of password transmissions over non-secure lines (for Dokeos, it is a
@@ -14,7 +14,7 @@ require_once 'openid.conf.php';
 require_once 'openid.lib.php';
 require_once 'xrds.lib.php';
 
-function openid_form() 
+function openid_form()
 {
 	return '<div class="menusection"><span class="menusectioncaption">'.get_lang('OpenIdAuthentication').'</span><form name="openid_login" method="post"><label for="openid_url">'.get_lang('OpenIDURL').' <a href="main/auth/openid/whatis.php" title="'.get_lang('OpenIDWhatIs').'">'.Display::return_icon('info3.gif',get_lang('Info')).'</a></label><input type="text" id="openid_url" name="openid_url" style="background: url(main/img/openid_small_logo.png) no-repeat; background-color: #fff; background-position: 0 50%; padding-left:18px;" value="http://"></input><input type="submit" name="openid_login" value="'.get_lang('Enter').'" /><br /><br /></form></div>';
 }
@@ -29,7 +29,7 @@ function openid_form()
  * @param $claimed_id The OpenID to authenticate
  * @param $return_to The endpoint to return to from the OpenID Provider
  */
-function openid_begin($claimed_id, $return_to = '', $form_values = array()) 
+function openid_begin($claimed_id, $return_to = '', $form_values = array())
 {
 
   $claimed_id = _openid_normalize($claimed_id);
@@ -80,7 +80,7 @@ function openid_begin($claimed_id, $return_to = '', $form_values = array())
  * @return $response Response values for further processing with
  *   $response['status'] set to one of 'success', 'failed' or 'cancel'.
  */
-function openid_complete($response) 
+function openid_complete($response)
 {
   // Default to failed response
   $response['status'] = 'failed';
@@ -251,7 +251,7 @@ function openid_association_request($public) {
 }
 
 /**
- * 
+ *
  */
 function openid_authentication_request($claimed_id, $identity, $return_to = '', $assoc_handle = '', $version = 2) {
 
@@ -275,7 +275,7 @@ function openid_authentication_request($claimed_id, $identity, $return_to = '',
   }
 
   // Simple Registration - we don't ask lastname and firstname because the only
-  // available similar data is "fullname" and we would have to guess where to split 
+  // available similar data is "fullname" and we would have to guess where to split
   $request['openid.sreg.required'] = 'nickname,email';
   $request['openid.ns.sreg'] = "http://openid.net/extensions/sreg/1.1";
 

+ 2 - 2
main/auth/openid/whatis.php

@@ -10,8 +10,8 @@ Display::display_header('OpenID', NULL);
 <p>
 <a href="<?php
  if (strpos($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST'])) {
- 	 echo Security::remove_XSS($_SERVER['HTTP_REFERER']); 
- } 
+ 	 echo Security::remove_XSS($_SERVER['HTTP_REFERER']);
+ }
  ?>">Return to the previous page</a>
 </p>
 <?php

+ 18 - 18
main/blog/blog.php

@@ -18,7 +18,7 @@
 
 	See the GNU General Public License for more details.
 
-	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium 
+	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
 	info@dokeos.com
 
 ==============================================================================
@@ -80,12 +80,12 @@ $safe_post_title = Security::remove_XSS($_POST['post_title']);
 $safe_post_file_comment = Security::remove_XSS($_POST['post_file_comment']);
 $safe_post_full_text = Security::remove_XSS(stripslashes(api_html_entity_decode($_POST['post_full_text'])), COURSEMANAGERLOWSECURITY);
 $safe_comment_text = Security::remove_XSS(stripslashes(api_html_entity_decode($_POST['comment_text'])), COURSEMANAGERLOWSECURITY);
-$safe_comment_title = Security::remove_XSS($_POST['comment_title']);  
+$safe_comment_title = Security::remove_XSS($_POST['comment_title']);
 $safe_task_name = Security::remove_XSS($_POST['task_name']);
 $safe_task_description = Security::remove_XSS($_POST['task_description']);
 
 if (!empty($_POST['new_post_submit']) AND !empty($_POST['post_title']))
-{	
+{
 	Blog :: create_post($safe_post_title, $safe_post_full_text, $safe_post_file_comment,$blog_id);
 	$return_message = array('type' => 'confirmation', 'message' => get_lang('BlogAdded'));
 }
@@ -129,7 +129,7 @@ if (!empty($_POST['new_task_execution_submit']))
 	$return_message = array('type' => 'confirmation', 'message' => get_lang('CommentCreated'));
 }
 if (!empty($_POST['register']))
-{	
+{
 	if (is_array($_POST['user'])) {
 		foreach ($_POST['user'] as $index => $user_id)
 		{
@@ -138,7 +138,7 @@ if (!empty($_POST['register']))
 	}
 }
 if (!empty($_POST['unregister']))
-{	
+{
 	if (is_array($_POST['user'])) {
 		foreach ($_POST['user'] as $index => $user_id)
 		{
@@ -170,7 +170,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks')
 		Blog :: delete_assigned_task($blog_id, Database::escape_string((int)$_GET['task_id']), Database::escape_string((int)$_GET['user_id']));
 		$return_message = array('type' => 'confirmation', 'message' => get_lang('TaskAssignmentDeleted'));
 	}
-		
+
 }
 
 if (isset($_GET['action']) && $_GET['action'] == 'view_post')
@@ -180,8 +180,8 @@ if (isset($_GET['action']) && $_GET['action'] == 'view_post')
 	if (isset($_GET['do']) && $_GET['do'] == 'delete_comment')
 	{
 		if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id))
-		{		
-			Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']); 
+		{
+			Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']);
 			$return_message = array('type' => 'confirmation', 'message' => get_lang('CommentDeleted'));
 		}
 		else
@@ -280,7 +280,7 @@ if (!empty($return_message))
 	if ($return_message['type'] == 'error')
 	{
 		Display::display_error_message($return_message['message']);
-	}	
+	}
 }
 
 
@@ -291,9 +291,9 @@ echo '<div class=actions>';
 	<?php if(api_is_allowed('BLOG_'.$blog_id, 'article_add')) { ?><a href="<?php echo api_get_self(); ?>?action=new_post&amp;blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('NewPost') ?>"><?php echo Display::return_icon('blog_article.gif', get_lang('NewPost')).get_lang('NewPost') ?></a><?php } ?>
 	<?php if(api_is_allowed('BLOG_'.$blog_id, 'task_management')) { ?><a href="<?php echo api_get_self(); ?>?action=manage_tasks&amp;blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageTasks') ?>"><?php echo Display::return_icon('blog_tasks.gif', get_lang('TaskManager')).get_lang('TaskManager') ?></a><?php } ?>
 	<?php if(api_is_allowed('BLOG_'.$blog_id, 'member_management')) { ?><a href="<?php echo api_get_self(); ?>?action=manage_members&amp;blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageMembers') ?>"><?php echo Display::return_icon('blog_user.gif', get_lang('MemberManager')).get_lang('MemberManager') ?></a><?php } ?>
-<?php	
-echo '</div>';	
-		
+<?php
+echo '</div>';
+
 // Tool introduction
 Display::display_introduction_section(TOOL_BLOG);
 
@@ -415,7 +415,7 @@ switch ($current_page)
 	case 'new_post' :
 		if (api_is_allowed('BLOG_'.$blog_id, 'article_add', $user_task ? $task_id : 0))
 		{
-			// we show the form if 
+			// we show the form if
 			// 1. no post data
 			// 2. there is post data and the required field is empty
 			if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title'])))
@@ -424,7 +424,7 @@ switch ($current_page)
 				if ($_POST)
 				{
 					Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
-				}			
+				}
 			Blog :: display_form_new_post($blog_id);
 		}
 		else
@@ -452,7 +452,7 @@ switch ($current_page)
 
 		if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id))
 		{
-			// we show the form if 
+			// we show the form if
 			// 1. no post data
 			// 2. there is post data and the required field is empty
 			if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title'])))
@@ -461,10 +461,10 @@ switch ($current_page)
 				if ($_POST)
 				{
 					Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
-				}				
+				}
 			Blog :: display_form_edit_post($blog_id, Database::escape_string((int)$_GET['post_id']));
 			}
-			else 
+			else
 			{
 				if (isset ($_GET['filter']) && !empty ($_GET['filter']))
 				{
@@ -474,7 +474,7 @@ switch ($current_page)
 				{
 					Blog :: display_blog_posts($blog_id);
 				}
-			}				
+			}
 		}
 		else
 		{

+ 20 - 20
main/blog/blog_admin.php

@@ -52,10 +52,10 @@ if((!$is_allowed_in_course || !$is_courseMember) && !api_is_allowed_to_edit())
 
 if (api_is_allowed_to_edit())
 {
-	
-	require_once(api_get_path(LIBRARY_PATH) . "blog.lib.php");	
-	$nameTools = get_lang("blog_management");	
-	
+
+	require_once(api_get_path(LIBRARY_PATH) . "blog.lib.php");
+	$nameTools = get_lang("blog_management");
+
 	// showing the header if we are not in the learning path, if we are in
 	// the learning path, we do not include the banner so we have to explicitly
 	// include the stylesheet, which is normally done in the header
@@ -71,11 +71,11 @@ if (api_is_allowed_to_edit())
 		} elseif (isset($_GET['action']) && $_GET['action']=='edit') {
 			$current_section=get_lang('EditBlog');
 			$my_url='action=edit&amp;blog_id='.Security::remove_XSS($_GET['blog_id']);
-		}	
+		}
 		$interbreadcrumb[]= array (
 		'url' => 'blog_admin.php?'.$my_url,
 		'name' => $current_section
-		);		
+		);
 		Display::display_header('');
 	} else {
 		echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"".$clarolineRepositoryWeb."css/default.css\"/>";
@@ -88,7 +88,7 @@ if (api_is_allowed_to_edit())
 	$get_blog_name	   = Security::remove_XSS($_POST['blog_name']);
 	$get_blog_subtitle = Security::remove_XSS($_POST['blog_subtitle']);
 	$get_blog_id       = Security::remove_XSS($_POST['blog_id']);
-	
+
 	if (!empty($_POST['new_blog_submit']) AND !empty($_POST['blog_name'])) {
 		if (strlen(trim($_POST['blog_name']))>0)  {
 			Blog::create_blog($get_blog_name,$get_blog_subtitle);
@@ -110,7 +110,7 @@ if (api_is_allowed_to_edit())
 		Blog::delete_blog(Database::escape_string((int)$_GET['blog_id']));
 		Display::display_confirmation_message(get_lang('BlogDeleted'));
 	}
-	
+
 	/*
 	==============================================================================
 		DISPLAY
@@ -118,10 +118,10 @@ if (api_is_allowed_to_edit())
 	*/
 	//api_display_tool_title($nameTools);
 	//api_introductionsection(TOOL_BLOG);
-	
-	
+
+
 		if (isset($_GET['action']) && $_GET['action'] == 'add') {
-			// we show the form if 
+			// we show the form if
 			// 1. no post data
 			// 2. there is post data and one of the required form elements is empty
 			if (!$_POST OR (!empty($_POST) AND (empty($_POST['new_blog_submit']) OR empty($_POST['blog_name'])))) {
@@ -133,15 +133,15 @@ if (api_is_allowed_to_edit())
 				if (count($_POST)>0) {
 					Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
 				}
-	
-			
-			} 
+
+
+			}
 			Blog::display_new_blog_form();
 		}
 		}
-			
+
 		if (isset($_GET['action']) && $_GET['action'] == 'edit') {
-			// we show the form if 
+			// we show the form if
 			// 1. no post data
 			// 2. there is post data and one of the three form elements is empty
 			if (!$_POST OR (!empty($_POST) AND (empty($_POST['edit_blog_submit']) OR empty($_POST['blog_name']) )))
@@ -153,7 +153,7 @@ if (api_is_allowed_to_edit())
 			Blog::display_edit_blog_form(Database::escape_string((int)$_GET['blog_id']));
 			}
 		}
-	
+
 		echo '<div class="actions">';
 		echo "<a href='".api_get_self()."?".api_get_cidreq()."&action=add'>",Display::return_icon('blog_new.gif',get_lang('AddBlog')),get_lang('AddBlog')."</a>";
 		echo '</div>';
@@ -165,10 +165,10 @@ if (api_is_allowed_to_edit())
 				"</tr>\n";
 
 		echo "</table>";*/
-		Blog::display_blog_list();	
-		 			
+		Blog::display_blog_list();
+
 	} else {
-		api_not_allowed(true);		
+		api_not_allowed(true);
 	}
 
 // Display the footer

+ 5 - 5
main/blog/calendar.php

@@ -1,8 +1,8 @@
 <?php
 // name of the language file that needs to be included
-$language_file = 'agenda'; 
+$language_file = 'agenda';
 
-// including the global 
+// including the global
 include('../inc/global.inc.php');
 
 // the variables for the days and the months
@@ -21,7 +21,7 @@ $MonthsLong = api_get_months_long();
 <style type="text/css">
 table.calendar
 {
-	width: 100%;	
+	width: 100%;
 	font-size: 11px;
 	font-family: verdana, arial, helvetica, sans-serif;
 }
@@ -40,12 +40,12 @@ table.calendar td
 {
 	width: 25px;
 	height: 25px;
-	background-color: #f5f5f5;	
+	background-color: #f5f5f5;
 	text-align: center;
 }
 table.calendar td.selected
 {
-	border: 1px solid #ff0000; 
+	border: 1px solid #ff0000;
 	background-color: #FFCECE;
 }
 table.calendar td a

+ 4 - 4
main/blog/download.php

@@ -3,7 +3,7 @@
 ==============================================================================
 	Dokeos - elearning and course management software
 
-	Copyright (c) 2008 Dokeos SPRL	
+	Copyright (c) 2008 Dokeos SPRL
 
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
@@ -60,14 +60,14 @@ $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url;
 
 if (! isset($_course))
 {
-	api_not_allowed(true);	
+	api_not_allowed(true);
 }
 $full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/blog/'.$doc_url;
 
 //if the rewrite rule asks for a directory, we redirect to the course view
-if (is_dir($full_file_name)) 
+if (is_dir($full_file_name))
 {
-	//remove last slash if present	
+	//remove last slash if present
 	while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
 	//create the path
 	$document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path

+ 183 - 183
main/calendar/agenda.inc.php

@@ -66,8 +66,8 @@ function get_calendar_items($month, $year)
     $repeats = array();
 
 	$session_condition = intval($_SESSION['id_session'])==0 ? '' : ' AND agenda.session_id IN (0,'.intval($_SESSION['id_session']).') ';
-	
-	
+
+
 	/*--------------------------------------------------
 			CONSTRUCT THE SQL STATEMENT
 	  --------------------------------------------------*/
@@ -98,7 +98,7 @@ function get_calendar_items($month, $year)
         $start = time();
         $stop = mktime(0,0,0,1,1,2038);//by default, set year to maximum for mktime()
 	}
-	
+
 	// by default we use the id of the current user. The course administrator can see the agenda of other users by using the user / group filter
 	$user_id=$_user['user_id'];
 	if ($_SESSION['user']!==null)
@@ -250,7 +250,7 @@ function get_calendar_items($month, $year)
 
 	//echo "<pre>".$sql."</pre>";
 	$result=api_sql_query($sql,__FILE__,__LINE__) or die(Database::error());
-	
+
 	/////////////////
 	$data=array();
 	while ($row=Database::fetch_array($result))
@@ -322,21 +322,21 @@ function display_minimonthcalendar($agendaitems, $month, $year, $monthName)
 				{
 					$month_curday = array();
 					$items_curday = $agendaitems[$curday][$curday];
-					
+
 					foreach ($items_curday as $item_curday) {
 						$start_date_item = $item_curday['start_date'];
 						$month_item = (int)substr($start_date_item,5,2);
 						if($month == $month_item) {
 							$month_curday[] = $item_curday['start_date'];
 						}
-					}										
-														
-					if (!empty($month_curday)) {										
+					}
+
+					if (!empty($month_curday)) {
 						echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&amp;action=view&amp;view=day&amp;day=".$curday."&amp;month=".$month."&amp;year=".$year."#".$curday."\">".$dayheader."</a>";
 					} else {
 						echo $dayheader;
 					}
-				}				
+				}
 				else
 				{
 					echo $dayheader;
@@ -406,7 +406,7 @@ function display_monthcalendar($month, $year)
 	$today = getdate();
 	while ($curday <=$numberofdays[$month])
   	{
-		echo "<tr>\n";	
+		echo "<tr>\n";
     	for ($ii=0; $ii<7; $ii++)
 	  	{
 	  		if (($curday == -1)&&($ii==$startdayofweek))
@@ -418,7 +418,7 @@ function display_monthcalendar($month, $year)
 				$bgcolor = $ii<5 ? "class=\"row_odd\"" : "class=\"row_even\"";
 
 				$dayheader = "$curday";
-				
+
 				if (key_exists($curday,$data)) {
 					$dayheader="<a href='".api_get_self()."?".api_get_cidreq()."&amp;view=list&amp;origin=$origin&amp;month=$month&amp;year=$year&amp;day=$curday#$curday'>".$curday."</a>";
 					foreach ($data[$curday] as $key=>$agenda_item)
@@ -437,7 +437,7 @@ function display_monthcalendar($month, $year)
 								//echo $agendaitems['title'];
 						}
 
-					}				
+					}
 				}
 
 				if (($curday==$today['mday'])&&($year ==$today['year'])&&($month == $today['mon']))
@@ -509,47 +509,47 @@ function move(fbox,	tbox)
 			fLength++;
 		}
 	}
-	
+
 	//arrFbox.sort();
-	//arrTbox.sort()		
+	//arrTbox.sort()
 
 	var arrFboxGroup = new Array();
 	var arrFboxUser = new Array();
-	var prefix_x;											
-			
+	var prefix_x;
+
 	for (x = 0; x < arrFbox.length; x++) {
-		prefix_x = arrFbox[x].substring(0,2);		
+		prefix_x = arrFbox[x].substring(0,2);
 		if (prefix_x == 'G:') {
-			arrFboxGroup.push(arrFbox[x]);					
+			arrFboxGroup.push(arrFbox[x]);
 		} else {
-			arrFboxUser.push(arrFbox[x]);					
-		}		  
-	}		
-	
+			arrFboxUser.push(arrFbox[x]);
+		}
+	}
+
 	arrFboxGroup.sort();
 	arrFboxUser.sort();
-	arrFbox = arrFboxGroup.concat(arrFboxUser);				
-									
+	arrFbox = arrFboxGroup.concat(arrFboxUser);
+
 	var arrTboxGroup = new Array();
-	var arrTboxUser = new Array();	
-	var prefix_y;						
-				
+	var arrTboxUser = new Array();
+	var prefix_y;
+
 	for (y = 0; y < arrTbox.length; y++) {
-		prefix_y = arrTbox[y].substring(0,2);				
+		prefix_y = arrTbox[y].substring(0,2);
 		if (prefix_y == 'G:') {
 			arrTboxGroup.push(arrTbox[y]);
 		} else {
 			arrTboxUser.push(arrTbox[y]);
-		}			
-	}													
-				
+		}
+	}
+
 	arrTboxGroup.sort();
 	arrTboxUser.sort();
 	arrTbox = arrTboxGroup.concat(arrTboxUser);
 
 	fbox.length	= 0;
 	tbox.length	= 0;
-		
+
 	var	c;
 	for(c =	0; c < arrFbox.length; c++)
 	{
@@ -569,7 +569,7 @@ function move(fbox,	tbox)
 
 function checkDate(month, day, year)
 {
-  var monthLength = 
+  var monthLength =
     new Array(31,28,31,30,31,30,31,31,30,31,30,31);
 
   if (!day || !month || !year)
@@ -584,14 +584,14 @@ function checkDate(month, day, year)
 
   if (day > monthLength[month-1])
     return false;
-  
+
   return true;
-}		
+}
 
-function mktime() 
-{		    
+function mktime()
+{
     var no, ma = 0, mb = 0, i = 0, d = new Date(), argv = arguments, argc = argv.length;
-    d.setHours(0,0,0); d.setDate(1); d.setMonth(1); d.setYear(1972); 
+    d.setHours(0,0,0); d.setDate(1); d.setMonth(1); d.setYear(1972);
     var dateManip = {
         0: function(tt){ return d.setHours(tt); },
         1: function(tt){ return d.setMinutes(tt); },
@@ -599,7 +599,7 @@ function mktime()
         3: function(tt){ set = d.setMonth(parseInt(tt)-1); ma = d.getFullYear() - 1972; return set; },
         4: function(tt){ return d.setDate(tt+mb); },
         5: function(tt){ return d.setYear(tt+ma); }
-    };    
+    };
     for( i = 0; i < argc; i++ ){
         no = parseInt(argv[i]*1);
         if (isNaN(no)) {
@@ -611,10 +611,10 @@ function mktime()
                 return false;
             }
         }
-    } 
+    }
     return Math.floor(d.getTime()/1000);
-}		
-		
+}
+
 function validate()
 {
 	var	f =	document.new_calendar_item;
@@ -623,52 +623,52 @@ function validate()
 }
 
 function selectAll(cbList,bSelect,showwarning)
-{		
+{
 		var start_day = document.new_calendar_item.fday.value;
 		var start_month = document.new_calendar_item.fmonth.value;
-		var start_year = document.new_calendar_item.fyear.value;		
-		var start_hour = document.new_calendar_item.fhour.value;		
+		var start_year = document.new_calendar_item.fyear.value;
+		var start_hour = document.new_calendar_item.fhour.value;
 		var start_minute = document.new_calendar_item.fminute.value;
 		var start_date = mktime(start_hour,start_minute,0,start_month,start_day,start_year)
-				
+
 		var ends_day = document.new_calendar_item.end_fday.value;
 		var ends_month = document.new_calendar_item.end_fmonth.value;
-		var ends_year = document.new_calendar_item.end_fyear.value;		
-		var ends_hour = document.new_calendar_item.end_fhour.value;		
+		var ends_year = document.new_calendar_item.end_fyear.value;
+		var ends_hour = document.new_calendar_item.end_fhour.value;
 		var ends_minute = document.new_calendar_item.end_fminute.value;
-		var ends_date = mktime(ends_hour,ends_minute,0,ends_month,ends_day,ends_year)		
-		
+		var ends_date = mktime(ends_hour,ends_minute,0,ends_month,ends_day,ends_year)
+
 		msg_err1 = document.getElementById(\"err_date\");
 		msg_err2 = document.getElementById(\"err_start_date\");
 		msg_err3 = document.getElementById(\"err_end_date\");
 		msg_err4 = document.getElementById(\"err_title\");
-											
-		if (start_date > ends_date) {			 
-			msg_err1.style.display =\"block\"; 
+
+		if (start_date > ends_date) {
+			msg_err1.style.display =\"block\";
 			msg_err1.innerHTML=\"".get_lang('EndDateCannotBeBeforeTheStartDate')."\";
-			msg_err2.innerHTML=\"\";msg_err3.innerHTML=\"\";												
+			msg_err2.innerHTML=\"\";msg_err3.innerHTML=\"\";
 		} else if (checkDate(start_month,start_day,start_year) == false) {
 			msg_err2.style.display =\"block\";
 			msg_err2.innerHTML=\"".get_lang('InvalidDate')."\";
-			msg_err1.innerHTML=\"\";msg_err3.innerHTML=\"\";			 					
+			msg_err1.innerHTML=\"\";msg_err3.innerHTML=\"\";
 		} else if (checkDate(ends_month,ends_day,ends_year) == false) {
 			msg_err3.style.display =\"block\";
 			msg_err3.innerHTML=\"".get_lang('InvalidDate')."\";
-			msg_err1.innerHTML=\"\";msg_err2.innerHTML=\"\";			 					
+			msg_err1.innerHTML=\"\";msg_err2.innerHTML=\"\";
 		} else if (document.new_calendar_item.title.value == '') {
 			msg_err4.style.display =\"block\";
 			msg_err4.innerHTML=\"".get_lang('FieldRequired')."\";
-			msg_err1.innerHTML=\"\";msg_err2.innerHTML=\"\";msg_err3.innerHTML=\"\";			 					
+			msg_err1.innerHTML=\"\";msg_err2.innerHTML=\"\";msg_err3.innerHTML=\"\";
 		}  else {
 			if (cbList.length <	1) {
 				if (!confirm(\"".get_lang('Send2All')."\")) {
-					return false;		
-				} 			
-			} 	
+					return false;
+				}
+			}
 			for	(var i=0; i<cbList.length; i++)
-			cbList[i].selected = cbList[i].checked = bSelect;					
+			cbList[i].selected = cbList[i].checked = bSelect;
 			document.new_calendar_item.submit();
-		}			
+		}
 
 }
 
@@ -745,11 +745,11 @@ function get_course_users()
 	global $tbl_user;
 	global $tbl_courseUser, $tbl_session_course_user;
 	global $_cid;
-	
+
 	// not 100% if this is necessary, this however prevents a notice
 	if (!isset($courseadmin_filter))
 		{$courseadmin_filter='';}
-	
+
 	$order_clause = api_sort_by_first_name() ? ' ORDER BY u.firstname, u.lastname' : ' ORDER BY u.lastname, u.firstname';
 	$sql = "SELECT u.user_id uid, u.lastname lastName, u.firstname firstName
 			FROM $tbl_user as u, $tbl_courseUser as cu
@@ -759,7 +759,7 @@ function get_course_users()
 	while($user=Database::fetch_array($result)){
 		$users[$user[0]] = $user;
 	}
-	
+
 	if(!empty($_SESSION['id_session'])){
 		$sql = "SELECT u.user_id uid, u.lastname lastName, u.firstName firstName
 				FROM $tbl_session_course_user AS session_course_user
@@ -767,12 +767,12 @@ function get_course_users()
 					ON u.user_id = session_course_user.id_user
 				WHERE id_session='".intval($_SESSION['id_session'])."'
 				AND course_code='$_cid'";
-	
+
 		$result = api_sql_query($sql,__FILE__,__LINE__);
 		while($user=Database::fetch_array($result)){
 			$users[$user[0]] = $user;
-		}	
-	}	
+		}
+	}
 	return $users;
 
 }
@@ -800,7 +800,7 @@ function show_to_form($to_already_selected)
 {
 	$user_list=get_course_users();
 	$group_list=get_course_groups();
-	
+
 	echo "\n<table id=\"recipient_list\" style=\"display: none;\">\n";
 		echo "\t<tr>\n";
 		// the form containing all the groups and all the users of the course
@@ -813,9 +813,9 @@ function show_to_form($to_already_selected)
 		echo "\t\t<input type=\"button\" ",
 					"onclick=\"move(document.getElementById('not_selected_form'),document.getElementById('selected_form'))\" ",
 					"value=\"   &gt;&gt;   \" />",
-	
+
 					"\n\t\t<p>&nbsp;</p>",
-	
+
 					"\n\t\t<input type=\"button\" ",
 					"onclick=\"move(document.getElementById('selected_form'),document.getElementById('not_selected_form'))\" ",
 					"value=\"   &lt;&lt;   \" />";
@@ -837,7 +837,7 @@ function show_to_form($to_already_selected)
 function construct_not_selected_select_form($group_list=null, $user_list=null,$to_already_selected=array())
 {
 	echo "\t\t<select id=\"not_selected_form\" name=\"not_selected_form[]\" size=\"5\" multiple=\"multiple\" style=\"width:200px\">\n";
-	
+
 	// adding the groups to the select form
 
 	if (isset($to_already_selected) && $to_already_selected==='everyone') {
@@ -856,7 +856,7 @@ function construct_not_selected_select_form($group_list=null, $user_list=null,$t
 				}
 			}
 			// a divider
-			
+
 		}
 		echo	"<option value=\"\">--------------------------------------------</option>";
 		// adding the individual users to the select form
@@ -868,7 +868,7 @@ function construct_not_selected_select_form($group_list=null, $user_list=null,$t
 					"",api_get_person_name($this_user['firstName'], $this_user['lastName']),
 					"</option>\n";
 			}
-		}			
+		}
 	}
 		echo "\t\t</select>\n";
 }
@@ -891,37 +891,37 @@ function construct_selected_select_form($group_list=null, $user_list=null,$to_al
 
 	// we load all the groups and all the users into a reference array that we use to search the name of the group / user
 	$ref_array_groups=get_course_groups();
-	
-	$ref_array_users=get_course_users();		
+
+	$ref_array_users=get_course_users();
 	// we construct the form of the already selected groups / users
 	echo "\t\t<select id=\"selected_form\" name=\"selectedform[]\" size=\"5\" multiple=\"multiple\" style=\"width:200px\">";
 	if(is_array($to_already_selected))
 	{
 		$select_options_group = array();
 		$select_options_user = array();
-		$select_options_groupuser = array();		
+		$select_options_groupuser = array();
 		foreach($to_already_selected as $groupuser)
 		{
 			list($type,$id)=explode(":",$groupuser);
 			if ($type=="GROUP")
 			{
 				$select_options_group[] = "\t\t<option value=\"".$groupuser."\">G: ".$ref_array_groups[$id]['name']."</option>";
-				//echo "\t\t<option value=\"".$groupuser."\">G: ".$ref_array_groups[$id]['name']."</option>";												
-			}			
+				//echo "\t\t<option value=\"".$groupuser."\">G: ".$ref_array_groups[$id]['name']."</option>";
+			}
 			else
-			{								
+			{
 				$select_options_user[] = "\t\t<option value=\"".$groupuser."\">".api_get_person_name($ref_array_users[$id]['firstName'], $ref_array_users[$id]['lastName'])."</option>";
 				//echo "\t\t<option value=\"".$groupuser."\">".api_get_person_name($ref_array_users[$id]['firstName'], $ref_array_users[$id]['lastName'])."</option>";
-			}			
+			}
 		}
 		$select_options_group[] = "<option value=\"\">--------------------------------------------</option>";
 		$select_options_groupuser = array_merge($select_options_group,$select_options_user);
-		
+
 		foreach($select_options_groupuser as $select_options) {
 			echo $select_options;
-		}		
+		}
 	} else {
-			if($to_already_selected=='everyone'){							
+			if($to_already_selected=='everyone'){
 				// adding the groups to the select form
 				if (is_array($group_list))
 				{
@@ -934,7 +934,7 @@ function construct_selected_select_form($group_list=null, $user_list=null,$to_al
 								"G: ",$this_group['name']," &ndash; " . $this_group['userNb'] . " " . get_lang('Users') .
 								"</option>\n";
 						}
-					}					
+					}
 				}
 				echo	"<option value=\"\">--------------------------------------------</option>";
 				// adding the individual users to the select form
@@ -969,13 +969,13 @@ function store_new_agenda_item() {
 	$content=trim($_POST['content']);
 	$start_date=(int)$_POST['fyear']."-".(int)$_POST['fmonth']."-".(int)$_POST['fday']." ".(int)$_POST['fhour'].":".(int)$_POST['fminute'].":00";
 	$end_date=(int)$_POST['end_fyear']."-".(int)$_POST['end_fmonth']."-".(int)$_POST['end_fday']." ".(int)$_POST['end_fhour'].":".(int)$_POST['end_fminute'].":00";
-	
+
 	$content=stripslashes($content);
 	$title=Database::escape_string(Security::remove_XSS($title));
 	$content = Database::escape_string(Security::remove_XSS($content,COURSEMANAGERLOWSECURITY));
 	$start_date=Database::escape_string($start_date);
 	$end_date=Database::escape_string($end_date);
-	
+
 
 	// store in the table calendar_event
 	$sql = "INSERT INTO ".$TABLEAGENDA."
@@ -1004,7 +1004,7 @@ function store_new_agenda_item() {
 			}
 		}
 	}
-	else // the message is sent to everyone, so we set the group to 0 
+	else // the message is sent to everyone, so we set the group to 0
 	{
 		api_item_property_update($_course, TOOL_CALENDAR_EVENT, $last_id,"AgendaAdded", $_user['user_id'], '','',$start_date,$end_date);
 	}
@@ -1042,7 +1042,7 @@ function store_agenda_item_as_announcement($item_id){
 	//check params
 	if(empty($item_id) or $item_id != strval(intval($item_id))){return -1;}
 	//get the agenda item
-	
+
 	$item_id=Database::escape_string($item_id);
 	$sql = "SELECT * FROM $table_agenda WHERE id = '".$item_id."'";
 	$res = api_sql_query($sql,__FILE__,__LINE__);
@@ -1145,10 +1145,10 @@ function sent_to($tool, $id)
 {
 	global $_course;
 	$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
-	
+
 	$tool=Database::escape_string($tool);
 	$id=Database::escape_string($id);
-	
+
 	$sql="SELECT * FROM $TABLE_ITEM_PROPERTY WHERE tool='".$tool."' AND ref='".$id."'";
 	$result=api_sql_query($sql,__FILE__,__LINE__);
 	while ($row=Database::fetch_array($result))
@@ -1272,7 +1272,7 @@ function sent_to_form($sent_to_array)
 function show_group_filter_form()
 {
 	$group_list=get_course_groups();
-	
+
 	echo "<select name=\"select\" onchange=\"javascript: MM_jumpMenu('parent',this,0)\">";
 	echo "<option value=\"agenda.php?group=none\">show all groups</option>";
 	foreach($group_list as $this_group)
@@ -1294,7 +1294,7 @@ function show_group_filter_form()
 function show_user_filter_form()
 {
 	$user_list=get_course_users();
-	
+
 	echo "<select name=\"select\" onchange=\"javascript: MM_jumpMenu('parent',this,0)\">";
 	echo "<option value=\"agenda.php?user=none\">show all users</option>";
 	foreach($user_list as $this_user)
@@ -1316,41 +1316,41 @@ function show_user_filter_form()
 function show_user_group_filter_form()
 {
 	echo "\n<select name=\"select\" onchange=\"javascript: MM_jumpMenu('parent',this,0)\">";
-	
+
 	// Groups
 	$option = "\n\t<optgroup label=\"".get_lang("Groups")."\">";
-	$group_list=get_course_groups();	
+	$group_list=get_course_groups();
 	//echo "\n\t<option value=\"agenda.php?user=none\">".get_lang("ShowAll")."</option>";
-	
+
 	$group_available_to_access =array();
-	
-	if(!empty($group_list)){		
+
+	if(!empty($group_list)){
 		foreach($group_list as $this_group) {
-			// echo "<option value=\"agenda.php?isStudentView=true&amp;group=".$this_group['id']."\">".$this_group['name']."</option>";				
+			// echo "<option value=\"agenda.php?isStudentView=true&amp;group=".$this_group['id']."\">".$this_group['name']."</option>";
 			$has_access = GroupManager::user_has_access(api_get_user_id(),$this_group['id'],GROUP_TOOL_CALENDAR);
 			$result = GroupManager::get_group_properties($this_group['id']);
-				
+
 			if ($result['calendar_state']!='0') {
 				$group_available_to_access[]=$this_group['id'];
-			}	
-					
-			// lastedit 
-			if ($has_access || $result['calendar_state']=='1') {		
+			}
+
+			// lastedit
+			if ($has_access || $result['calendar_state']=='1') {
 				$option.= "\n\t\t<option value=\"agenda.php?group=".$this_group['id']."\" ";
 				$option.= ($this_group['id']==$_SESSION['group'])? " selected":"" ;
-				$option.=  ">".$this_group['name']."</option>";				
-			}			
+				$option.=  ">".$this_group['name']."</option>";
+			}
 		}
 	}
-	
+
 	$all =  "\n\t<option value=\"agenda.php?user=none\">".get_lang("ShowAll")."</option>";
 	$option = $all.$option;
-	
-	$option.= "\n\t</optgroup>";	
-	echo $option;	
-	
+
+	$option.= "\n\t</optgroup>";
+	echo $option;
+
 	global $_course;
-	
+
 	// Users
 	echo "\n\t<optgroup label=\"".get_lang("Users")."\">";
 	$user_list=get_course_users();
@@ -1358,7 +1358,7 @@ function show_user_group_filter_form()
 		echo "\n\t\t<option value=\"agenda.php?user=".$this_user['uid']."\" ";
 		echo ($this_user['uid']==$_SESSION['user'])? " selected":"" ;
 		echo ">".api_get_person_name($this_user['firstName'], $this_user['lastName'])."</option>";
-	}		
+	}
 	echo "\n\t</optgroup>";
 	echo "</select>";
 }
@@ -1375,7 +1375,7 @@ function load_edit_users($tool, $id)
 	$tool=Database::escape_string($tool);
 	$id=Database::escape_string($id);
 	$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
-	
+
 	$sql="SELECT * FROM $TABLE_ITEM_PROPERTY WHERE tool='$tool' AND ref='$id'";
 	$result=api_sql_query($sql,__FILE__,__LINE__) or die (Database::error());
 	while ($row=Database::fetch_array($result))
@@ -1609,7 +1609,7 @@ function store_edited_agenda_item($id_attach,$file_comment)
 	// step 3: update the attachments (=delete all and add those in the session
 	update_added_resources("Agenda", $id);
 
-	// return the message;	
+	// return the message;
 	Display::display_confirmation_message(get_lang("EditSuccess"));
 
 }
@@ -1688,7 +1688,7 @@ function delete_agenda_item($id)
 			//resetting the $id;
 			$id=null;
 
-			// displaying the result message in the yellow box			
+			// displaying the result message in the yellow box
 			Display::display_confirmation_message(get_lang("AgendaDeleteSuccess"));
 		}	  // if (isset($id)&&$id&&isset($action)&&$action=="delete")
 	} // if ($is_allowed_to_edit)
@@ -1712,7 +1712,7 @@ function showhide_agenda_item($id)
 		if (isset($_GET['id'])&&$_GET['id']&&isset($_GET['action'])&&$_GET['action']=="showhide")
 		{
 			$id=(int)addslashes($_GET['id']);
-			change_visibility($nameTools,$id);			
+			change_visibility($nameTools,$id);
 			Display::display_confirmation_message(get_lang("VisibilityChanged"));
 		}
 	}
@@ -1790,7 +1790,7 @@ function display_agenda_items()
 
 	$session_condition = intval($_SESSION['id_session'])==0 ? '' : ' AND agenda.session_id IN (0,'.intval($_SESSION['id_session']).') ';
 
-	
+
 	if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))
 	{
 		// A.1. you are a course admin with a USER filter
@@ -1798,22 +1798,22 @@ function display_agenda_items()
 		if (!empty($_SESSION['user']))
 		{
 			$group_memberships=GroupManager::get_group_ids($_course['dbName'],$_SESSION['user']);
-				
+
 			$show_user =true;
 			$new_group_memberships=array();
 			foreach($group_memberships as $id)
 			{
-				// did i have access to the same  
+				// did i have access to the same
 				$has_access = GroupManager::user_has_access(api_get_user_id(),$id,GROUP_TOOL_CALENDAR);
 				$result = GroupManager::get_group_properties($id);
-								
-				if ($has_access && $result['calendar_state']!='0' ) 
-				{						
-					$new_group_memberships[]=$id;					
-				}					
+
+				if ($has_access && $result['calendar_state']!='0' )
+				{
+					$new_group_memberships[]=$id;
+				}
 			}
 			$group_memberships = $new_group_memberships;
-			
+
 			if (is_array($group_memberships) && count($group_memberships)>0)
 			{
 				$sql="SELECT
@@ -1827,7 +1827,7 @@ function display_agenda_items()
 					ORDER BY start_date ".$_SESSION['sort'];
 			}
 			else
-			{				
+			{
 					$sql="SELECT
 					agenda.*, toolitemproperties.*
 					FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." toolitemproperties
@@ -1843,19 +1843,19 @@ function display_agenda_items()
 		// => see only the messages of this specific group
 		elseif (!empty($_SESSION['group']))
 		{
-			
-			if (!empty($group_id)) {				
-				$result = GroupManager::get_group_properties($group_id);						
+
+			if (!empty($group_id)) {
+				$result = GroupManager::get_group_properties($group_id);
 				$has_access = GroupManager::user_has_access(api_get_user_id(),$group_id,GROUP_TOOL_CALENDAR);
 				//echo '<pre>';print_R($result);
-									
-				// lastedit 
+
+				// lastedit
 				if (!$has_access || $result['calendar_state']=='0' )
-				{				
-					$group_id=0;						
-				}				
-			}		
-								
+				{
+					$group_id=0;
+				}
+			}
+
 			$sql="SELECT
 				agenda.*, toolitemproperties.*
 				FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." toolitemproperties
@@ -1890,7 +1890,7 @@ function display_agenda_items()
 			{
 				// A.3.b.1 you are a course admin without user or group filter and WITHOUT studentview (= the normal course admin view)
 				// 	=> see all the messages of all the users and groups with editing possibilities
-				
+
 				 if (api_is_course_admin())
 				 {
 					 $sql="SELECT
@@ -1908,7 +1908,7 @@ function display_agenda_items()
 				 	// A.3.b.2 you are a student with no group filter possibly showall
 				 	//when showing all the events we do not show the group events
 				 	//todo showing ALL events including the groups events that are available
-				 					 	 
+
 				 	$sql="SELECT
 						agenda.*, toolitemproperties.*
 						FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." toolitemproperties
@@ -1918,17 +1918,17 @@ function display_agenda_items()
 						$session_condition
 						GROUP BY toolitemproperties.ref
 						ORDER BY start_date ".$_SESSION['sort'];
-						
-					
+
+
 					/*
 				 	if (is_array($group_memberships) && count($group_memberships)>0)
-				 	{  
+				 	{
 				 		echo $sql="SELECT
 						agenda.*, toolitemproperties.*
 						FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." toolitemproperties
 						WHERE agenda.id = toolitemproperties.ref  ".$show_all_current."
 						AND toolitemproperties.tool='".TOOL_CALENDAR_EVENT."'
-						AND toolitemproperties.visibility='1' AND toolitemproperties.to_group_id IN (0, ".implode(", ", $group_memberships).") 
+						AND toolitemproperties.visibility='1' AND toolitemproperties.to_group_id IN (0, ".implode(", ", $group_memberships).")
 						$session_condition
 						GROUP BY toolitemproperties.ref
 						ORDER BY start_date ".$_SESSION['sort'];
@@ -1946,7 +1946,7 @@ function display_agenda_items()
 						ORDER BY start_date ".$_SESSION['sort'];
 				 	}
 				 	*/
-				 	
+
 				 }
 			}
 		}
@@ -2196,8 +2196,8 @@ function display_agenda_items()
 				echo ' "> '.$user_filename.' </a>';
 				echo '<span class="forum_attach_comment" >'.$attachment_list['comment'].'</span>';
 				if (api_is_allowed_to_edit()) {
-					echo '&nbsp;&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;origin='.Security::remove_XSS($_GET['origin']).'&amp;action=delete_attach&amp;id_attach='.$attachment_list['id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a><br />';	
-				}				
+					echo '&nbsp;&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;origin='.Security::remove_XSS($_GET['origin']).'&amp;action=delete_attach&amp;id_attach='.$attachment_list['id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a><br />';
+				}
 
 			}
 
@@ -2295,7 +2295,7 @@ function display_one_agenda_item($agenda_id)
 			CONSTRUCT THE SQL STATEMENT
 	  --------------------------------------------------*/
 	$agenda_id = Database::escape_string($agenda_id);
-	
+
 	$sql="SELECT agenda.*, toolitemproperties.*
 					FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." toolitemproperties
 					WHERE agenda.id = toolitemproperties.ref
@@ -2597,7 +2597,7 @@ function show_add_form($id = '')
 	{
 		$form_title = get_lang('ModifyCalendarItem');
 	}
-	else 
+	else
 	{
 		$form_title = get_lang('AddCalendarItem');
 	}
@@ -2694,7 +2694,7 @@ function show_add_form($id = '')
 													echo "\t\t\t\t<option value=\"$value\">$value</option>\n";
 												} ?>
 					</select>
-					<a href="javascript:openCalendar('new_calendar_item', 'f')"><?php Display::display_icon('calendar_select.gif', get_lang('Select'), array ('style' => 'vertical-align: middle;')); ?></a>					
+					<a href="javascript:openCalendar('new_calendar_item', 'f')"><?php Display::display_icon('calendar_select.gif', get_lang('Select'), array ('style' => 'vertical-align: middle;')); ?></a>
 					&nbsp;<?php echo get_lang('StartTime').": \n"; ?>&nbsp;
 						<select name="fhour" onchange="javascript:document.new_calendar_item.end_fhour.value=this.value;">
 							<!-- <option value="--">--</option> -->
@@ -2715,7 +2715,7 @@ function show_add_form($id = '')
 									}
 								} ?>
 						</select>
-						
+
 						<select name="fminute" onchange="javascript:document.new_calendar_item.end_fminute.value=this.value;">
 							<!-- <option value="<?php echo $minutes ?>"><?php echo $minutes; ?></option> -->
 							<!-- <option value="--">--</option> -->
@@ -2727,7 +2727,7 @@ function show_add_form($id = '')
 									echo "\t\t\t\t<option value=\"$value\">$value</option>\n";
 								} ?>
 						</select>
-	<?php 
+	<?php
 	echo 	'	</div>
 			</div>';
 
@@ -2737,7 +2737,7 @@ function show_add_form($id = '')
 					'.get_lang('EndDate').'
 				</div>
 				<div class="formw">
-					<div id="err_end_date" style="display:none;color:red"></div>';	
+					<div id="err_end_date" style="display:none;color:red"></div>';
 	?>
 						<select name="end_fday">
 							<?php
@@ -2768,7 +2768,7 @@ function show_add_form($id = '')
 									else
 										{ echo "\t\t\t\t <option value=\"".$value."\">".$MonthsLong[$i-1]."</option>\n"; }
 									}?>
-						</select>			
+						</select>
 						<select name="end_fyear">
 								<option value="<?php echo ($end_year-1) ?>"><?php echo ($end_year-1) ?></option>
 								<option value="<?php echo $end_year ?>" selected> <?php echo $end_year ?> </option>
@@ -2798,7 +2798,7 @@ function show_add_form($id = '')
 										{ echo "\t\t\t\t<option value=\"".$value."\"> ".$value." </option>\n"; }
 								} ?>
 						</select>
-						
+
 						<select name="end_fminute">
 							<!-- <option value="<?php echo $end_minutes; ?>"><?php echo $end_minutes; ?></option> -->
 							<!-- <option value="--">--</option> -->
@@ -2810,17 +2810,17 @@ function show_add_form($id = '')
 									echo "\t\t\t\t<option value=\"$value\">$value</option>\n";
 								} ?>
 						</select>
-	<?php 
+	<?php
 	echo 	'	</div>
 			</div>';
-						
+
 	// the title of the agenda item
 	echo 	' 	<div class="row">
 					<div class="label">
 						<span class="form_required">*</span>'.get_lang('ItemTitle').'
 					</div>
 					<div class="formw">
-	<div id="err_title" style="display:none;color:red"></div>										
+	<div id="err_title" style="display:none;color:red"></div>
 						<input type="text" size="60" name="title" value="';
 						if (isset($title)) echo $title;
 	echo				'" />
@@ -2857,7 +2857,7 @@ function show_add_form($id = '')
 	echo '		</div>
 			</div>';
 
-	// the added resources 
+	// the added resources
 	/*echo '	<div class="row">
 				<div class="label">
 					'.get_lang('AddedResources').'
@@ -2873,7 +2873,7 @@ function show_add_form($id = '')
 	echo '		</div>
 			</div>';
 			*/
-	
+
 	// File attachment
 	echo '	<div class="row">
 				<div class="label">
@@ -2979,8 +2979,8 @@ function show_add_form($id = '')
 	echo '		</div>
 			</div>';
     }//only show repeat fields if adding, not if editing
-    
-    
+
+
     // the submit button for storing the calendar item
     echo '		<div class="row">
 					<div class="label">
@@ -2991,7 +2991,7 @@ function show_add_form($id = '')
 			$text=get_lang('ModifyEvent');
 		} else {
 		$class='add';
-			$text=get_lang('AgendaAdd'); 
+			$text=get_lang('AgendaAdd');
 		}
 	echo '<button class="'.$class.'" type="button" name="name" onclick="selectAll(document.getElementById(\'selected_form\'),true)">'.$text.'</button>';
 	echo '			</div>
@@ -3008,8 +3008,8 @@ function get_agendaitems($month, $year)
 
 	$items = array ();
 	$month = Database::escape_string($month);
-	$year = Database::escape_string($year);	
-	
+	$year = Database::escape_string($year);
+
 	//databases of the courses
 	$TABLEAGENDA 		= Database :: get_course_table(TABLE_AGENDA);
 	$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY);
@@ -3018,7 +3018,7 @@ function get_agendaitems($month, $year)
 	// if the user is administrator of that course we show all the agenda items
 	if (api_is_allowed_to_edit(false,true)) {
 		//echo "course admin";
-		
+
 		$sqlquery = "SELECT
 						DISTINCT agenda.*, item_property.*
 						FROM ".$TABLEAGENDA." agenda,
@@ -3070,13 +3070,13 @@ function get_agendaitems($month, $year)
     global $_configuration;
    	$root_url = $_configuration['root_web'];
 	if ($_configuration['multiple_access_urls']==true) {
-		$access_url_id = api_get_current_access_url_id();				
+		$access_url_id = api_get_current_access_url_id();
 		if ($access_url_id != -1 ){
-			$url = api_get_access_url($access_url_id); 				
+			$url = api_get_access_url($access_url_id);
 			$root_url = $url['url'];
-		}		
+		}
 	}
-		
+
 	while ($item = Database::fetch_array($result))
 	{
 		$agendaday = date('j',strtotime($item['start_date']));
@@ -3581,7 +3581,7 @@ function get_week_agendaitems($courses_dbs, $month, $year, $week = '')
 			//Display the events in agenda
 			$items[$agendaday][$item['start_date']] .= "<i>$time</i> <a href=\"$URL\" title=\"".$array_course_info["name"]."\">".$agenda_link."</a>";
 			$items[$agendaday][$item['start_date']] .= "<div>".$item['title']."</div><br>";
-			
+
 		}
 	}
 	// sorting by hour for every day
@@ -4317,32 +4317,32 @@ function agenda_add_item($course_info, $title, $content, $db_start_date, $db_end
 {
 	global $_course;
     $user_id    = api_get_user_id();
-    
+
     // database table definitions
     $t_agenda   = Database::get_course_table(TABLE_AGENDA,$course_info['dbName']);
     $agenda_table_attachment = Database::get_course_table(TABLE_AGENDA_ATTACHMENT);
     $item_property 				=	Database::get_course_table(TABLE_ITEM_PROPERTY);
-    
+
     // some filtering of the input data
     $content=stripslashes($content);
 	$title=Database::escape_string(Security::remove_XSS($title));
-	$content = Database::escape_string(Security::remove_XSS($content,COURSEMANAGERLOWSECURITY));   
+	$content = Database::escape_string(Security::remove_XSS($content,COURSEMANAGERLOWSECURITY));
     $start_date = Database::escape_string($db_start_date);
     $end_date   = Database::escape_string($db_end_date);
     isset($_SESSION['id_session'])?$id_session=intval($_SESSION['id_session']):$id_session=null;
     // store in the table calendar_event
 
     // check if exists in calendar_event table and if it is not deleted!
-    $sql = "SELECT * FROM $t_agenda agenda, $item_property item_property 
-    			WHERE agenda.title='$title' 
-    			AND agenda.content = '$content' 
+    $sql = "SELECT * FROM $t_agenda agenda, $item_property item_property
+    			WHERE agenda.title='$title'
+    			AND agenda.content = '$content'
     			AND agenda.start_date = '$start_date'
-    			AND agenda.end_date = '$end_date' ".(!empty($parent_id)? " 
-    			AND agenda.parent_event_id = '$parent_id'":"")." 
+    			AND agenda.end_date = '$end_date' ".(!empty($parent_id)? "
+    			AND agenda.parent_event_id = '$parent_id'":"")."
     			AND agenda.session_id = '$id_session'
     			AND item_property.tool = '".TOOL_CALENDAR_EVENT."'
     			AND item_property.ref = agenda.id
-    			AND item_property.visibility <> 2    			
+    			AND item_property.visibility <> 2
     			";
     $result = api_sql_query($sql,__FILE__,__LINE__);
     $count = Database::num_rows($result);
@@ -4414,7 +4414,7 @@ function delete_attachment_file($id_attach) {
 	$last_id_file=Database::insert_id();
 	// update item_property
 	api_item_property_update($_course, 'calendar_event_attachment', $id_attach ,'AgendaAttachmentDeleted', api_get_user_id());
-	if (!empty($result)) {	
+	if (!empty($result)) {
 	Display::display_confirmation_message(get_lang("AttachmentFileDeleteSuccess"));
 	}
 }
@@ -4686,7 +4686,7 @@ function agenda_import_ical($course_info,$file) {
  * @param	int		Week number
  * @param	string	Type of view (month_view, week_view, day_view)
  * @return 	array	The results of the database query, or null if not found
- */ 
+ */
 function get_global_agenda_items($agendaitems, $day = "", $month = "", $year = "", $week = "", $type)
 {
 	$tbl_global_agenda= Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
@@ -4767,7 +4767,7 @@ function get_global_agenda_items($agendaitems, $day = "", $month = "", $year = "
 			}
 			//$agendaitems[$halfhour] .= "<div><i>$hour:$minute</i> <b>".get_lang('Evento Global'). ":  </b><a href=\"myagenda.php?action=view&amp;view=personal&amp;day=$day&amp;month=$month&amp;year=$year&amp;id=".$item['id']."#".$item['id']."\" class=\"personal_agenda\">".$item['title']."</a></div>";
 			if (!is_array($agendaitems[$halfhour]))
-	        	$content = $agendaitems[$halfhour];                			
+	        	$content = $agendaitems[$halfhour];
 			$agendaitems[$halfhour] = $content."<div><i>$hour:$minute</i> <b>".get_lang('GlobalEvent'). ":  </b>".$item['title']."</div>";
 		}
 	}
@@ -4792,6 +4792,6 @@ function display_ical_import_form()
 				<div class="formw">
 					<button class="save" type="submit" name="ical_submit" value="'.get_lang('Import').'">'.get_lang('Import').'</button>
 				</div>
-			</div>';	
+			</div>';
 	echo '</form>';
 }

+ 43 - 43
main/calendar/agenda.php

@@ -183,7 +183,7 @@ if (isset($_GET['toolgroup']) && $_GET['toolgroup']==strval(intval($_GET['toolgr
 	$interbreadcrumb[] = array ("url" => "../group/group.php", "name" => get_lang('Groups'));
 	$interbreadcrumb[] = array ("url"=>"../group/group_space.php?gidReq=".Security::remove_XSS($_GET['toolgroup']), "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')');
 	Display::display_header($nameTools,'Agenda');
-	
+
 } elseif (empty($_GET['origin']) or $_GET['origin'] != 'learnpath') {
 	Display::display_header($nameTools,'Agenda');
 } else {
@@ -272,20 +272,20 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 {
 	switch ($_GET['action'])
 	{
-		case "importical":			
+		case "importical":
 					            if(isset($_POST['ical_submit']))
 					            {
-					                $course_info = api_get_course_info(); 
+					                $course_info = api_get_course_info();
 					                $ical_name = $_FILES['ical_import']['name'];
 					                $ical_type = $_FILES['ical_import']['type'];
-					                $ext = substr($ical_name,(strrpos($ical_name,".")+1));                              
+					                $ext = substr($ical_name,(strrpos($ical_name,".")+1));
 					                if ($ical_type === 'text/calendar' || $ext === 'ics') {
 					                agenda_import_ical($course_info,$_FILES['ical_import']);
 					                $is_ical = true;
 					                } else {
-					                	$is_ical = false;                	                	
-					                }                
-					            }            
+					                	$is_ical = false;
+					                }
+					            }
 					            break;
 		case 'add':
 								if($_POST['submit_event'])
@@ -295,8 +295,8 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 					                $event_stop     = (int) $_POST['end_fyear'].'-'.(int) $_POST['end_fmonth'].'-'.(int) $_POST['end_fday'].' '.(int) $_POST['end_fhour'].':'.(int) $_POST['end_fminute'].':00';
 					                $safe_title = Security::remove_XSS($_POST['title']);
 					                $safe_file_comment = Security::remove_XSS($_POST['file_comment']);
-					                
-									$id = agenda_add_item($course_info,$safe_title,$_POST['content'],$event_start,$event_stop,$_POST['selectedform'],false,$safe_file_comment);				
+
+									$id = agenda_add_item($course_info,$safe_title,$_POST['content'],$event_start,$event_stop,$_POST['selectedform'],false,$safe_file_comment);
 					                if(!empty($_POST['repeat']))
 					                {
 					                	$end_y = intval($_POST['repeat_end_year']);
@@ -304,47 +304,47 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 					                    $end_d = intval($_POST['repeat_end_day']);
 					                    $end   = mktime(23, 59, 59, $end_m, $end_d, $end_y);
 					                    $res = agenda_add_repeat_item($course_info,$id,Security::remove_XSS($_POST['repeat_type']),$end,Security::remove_XSS($_POST['selectedform']),$safe_file_comment);
-					                }                 
-								}			
+					                }
+								}
 								break;
 		case "edit":
 								if( ! (api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, intval($_REQUEST['id']) ) ) )
 								{ // a coach can only delete an element belonging to his session
 									if ($_POST['submit_event'])
-									{		$my_id_attach = (int)$_REQUEST['id_attach'];										
+									{		$my_id_attach = (int)$_REQUEST['id_attach'];
 											$safe_file_comment = Security::remove_XSS($_REQUEST['file_comment']);
-											store_edited_agenda_item($my_id_attach,$safe_file_comment);						
-									}				
-								}			
+											store_edited_agenda_item($my_id_attach,$safe_file_comment);
+									}
+								}
 								break;
 		case "delete":
 								$id=(int)$_GET['id'];
 								if( ! (api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $id ) ) )
 								{ // a coach can only delete an element belonging to his session
 									delete_agenda_item($id);
-								}				
+								}
 								break;
 		case "showhide":
 								$id=(int)$_GET['id'];
 								if( ! (api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $id ) ) )
 								{ // a coach can only delete an element belonging to his session
 									showhide_agenda_item($id);
-								}			
+								}
 								break;
 		case "announce": 		//copying the agenda item into an announcement
 								$id=(int)$_GET['id'];
 								if( ! (api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $id ) ) )
 								{ // a coach can only delete an element belonging to his session
 									$ann_id = store_agenda_item_as_announcement($id);
-									$tool_group_link = (isset($_SESSION['toolgroup'])?'&toolgroup='.$_SESSION['toolgroup']:'');								
+									$tool_group_link = (isset($_SESSION['toolgroup'])?'&toolgroup='.$_SESSION['toolgroup']:'');
 									Display::display_normal_message(get_lang('CopiedAsAnnouncement').'&nbsp;<a href="../announcements/announcements.php?id='.$ann_id.$tool_group_link.'">'.get_lang('NewAnnouncement').'</a>', false);
-								}			
+								}
 								break;
 		case "delete_attach": 	//delete attachment file
 								$id_attach = (int)$_GET['id_attach'];
 								if (!empty($id_attach)) {
 									delete_attachment_file($id_attach);
-								}			
+								}
 								break;
 	}
 }
@@ -357,7 +357,7 @@ if (empty($_GET['origin']) or $_GET['origin']!='learnpath')
 {
 	echo '<td width="220" height="19" valign="top">';
 	// the small calendar
-	$MonthName = $MonthsLong[$select_month -1];	
+	$MonthName = $MonthsLong[$select_month -1];
 	$agenda_items=get_calendar_items($select_month,$select_year);
 	if (api_get_setting('display_mini_month_calendar') == 'true')
 	{
@@ -377,31 +377,31 @@ echo '<div class="sort" style="float:left">';
 echo '</div>';
 
 if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) {
-		
+
 	switch ($_GET['action']) {
-		case 'importical' :								
-								if (isset($_POST['ical_submit'])) {        
+		case 'importical' :
+								if (isset($_POST['ical_submit'])) {
 							        if (!$is_ical) {
 									Display::display_error_message(get_lang('IsNotiCalFormatFile'));
 	                				display_ical_import_form();
 	                				break;
 									}
-							        display_agenda_items();						        
+							        display_agenda_items();
 							    }
 							    else {
 							    	display_ical_import_form();
 							    }
 							    break;
 		case 'add' :
-								if ($_POST['submit_event']) {		
+								if ($_POST['submit_event']) {
 									display_agenda_items();
-								} else {			
+								} else {
 										show_add_form();
 								}
 								break;
-		case 'edit' :				
+		case 'edit' :
 								if ( !(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, intval($_REQUEST['id'])))) {
-									if ($_POST['submit_event']) {		
+									if ($_POST['submit_event']) {
 										display_agenda_items();
 									}
 									else {
@@ -411,9 +411,9 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 								} else {
 									display_agenda_items();
 								}
-								break;	
+								break;
 		case 'delete':
-								display_agenda_items();				
+								display_agenda_items();
 								break;
 		case 'showhide':
 								if(!empty($_GET['agenda_id']))
@@ -421,15 +421,15 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
 									 display_one_agenda_item((int)$_GET['agenda_id']);
 								}
 								else
-								{            	
-									display_agenda_items();			
-								}		
+								{
+									display_agenda_items();
+								}
 								break;
-		case 'announce': 		display_agenda_items();			
+		case 'announce': 		display_agenda_items();
 								break;
-		case 'delete_attach': 	display_agenda_items();		
-								break;	
-	}	
+		case 'delete_attach': 	display_agenda_items();
+								break;
+	}
 }
 
 // this is for students and whenever the courseaministrator has not chosen any action. It is in fact the default behaviour
@@ -444,17 +444,17 @@ if (!$_GET['action'] || $_GET['action']=="showall"  || $_GET['action']=="showcur
                  display_one_agenda_item((int)$_GET['agenda_id']);
             }
             else
-            {            	
+            {
 			     display_agenda_items();
             }
 		}
-        else 
-        {        	        		
-				display_monthcalendar($select_month, $select_year);	        	
+        else
+        {
+				display_monthcalendar($select_month, $select_year);
 		}
 	}
 	else
-	{		
+	{
 		display_one_agenda_item((int)$_GET['agenda_id']);
 	}
 }

+ 3 - 3
main/calendar/calendar.php

@@ -43,7 +43,7 @@ if (empty ($iso_lang) )
 	$iso_lang = 'en';
 }
 ?>
-<!DOCTYPE html 
+<!DOCTYPE html
      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $iso_lang; ?>" lang="<?php echo $iso_lang; ?>">
@@ -66,12 +66,12 @@ if (empty ($iso_lang) )
 table.calendar td
 {
 
-	background-color: #f5f5f5;	
+	background-color: #f5f5f5;
 	text-align: center;
 }
 .data_table td.selected
 {
-	border: 1px solid #ff0000; 
+	border: 1px solid #ff0000;
 	background-color: #FFCECE;
 }
 .data_table td a

+ 6 - 6
main/calendar/download.php

@@ -3,7 +3,7 @@
 ==============================================================================
 	Dokeos - elearning and course management software
 
-	Copyright (c) 2008 Dokeos SPRL	
+	Copyright (c) 2008 Dokeos SPRL
 
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
@@ -59,15 +59,15 @@ $doc_url = str_replace(' ', '+', $doc_url);
 $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url;
 
 if (!isset($_course)) {
-	api_not_allowed(true);	
+	api_not_allowed(true);
 }
 
 $full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/calendar/'.$doc_url;
 //if the rewrite rule asks for a directory, we redirect to the document explorer
-if (is_dir($full_file_name)) 
+if (is_dir($full_file_name))
 {
 	//remove last slash if present
-	//$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url; 
+	//$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url;
 	//mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (Ren�)
 	while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
 	//create the path
@@ -81,12 +81,12 @@ $tbl_agenda_attachment 	= Database::get_course_table(TABLE_AGENDA_ATTACHMENT);
 // launch event
 event_download($doc_url);
 
-$sql='SELECT filename FROM '.$tbl_agenda_attachment.'   
+$sql='SELECT filename FROM '.$tbl_agenda_attachment.'
   	  WHERE path LIKE BINARY "'.$doc_url.'"';
 
 $result= api_sql_query($sql, __FILE__, __LINE__);
 $row= Database::fetch_array($result);
-$title = str_replace(' ','_', $row['filename']); 
+$title = str_replace(' ','_', $row['filename']);
 DocumentManager::file_send_for_download($full_file_name,TRUE, $title);
 
 exit;

+ 6 - 6
main/calendar/ical_export.php

@@ -48,7 +48,7 @@ if(!empty($_GET['id']) && $_GET['id']==strval(intval($_GET['id'])))
 		switch($_GET['class'])
 		{
 			case 'public':
-				$vevent->setClass('PUBLIC');			
+				$vevent->setClass('PUBLIC');
 				break;
 			case 'private':
 				$vevent->setClass('PRIVATE');
@@ -57,7 +57,7 @@ if(!empty($_GET['id']) && $_GET['id']==strval(intval($_GET['id'])))
 				$vevent->setClass('CONFIDENTIAL');
 				break;
 			default:
-				$vevent->setClass('PRIVATE');				
+				$vevent->setClass('PRIVATE');
 				break;
 		}
 
@@ -71,7 +71,7 @@ if(!empty($_GET['id']) && $_GET['id']==strval(intval($_GET['id'])))
 				list($y,$m,$d,$h,$M,$s) = preg_split('/[\s:-]/',$ai['date']);
 				$vevent->setProperty('dtstart',array('year'=>$y,'month'=>$m,'day'=>$d,'hour'=>$h,'min'=>$M,'sec'=>$s));
 				if(empty($ai['enddate']))
-				{	
+				{
 					$y2=$y;$m2=$m;$d2=$d;$h2=$h;$M2=$M+15;$s2=$s;
 					if($M2>60){$M2=$M2-60;$h2+=1;}
 				}
@@ -101,7 +101,7 @@ if(!empty($_GET['id']) && $_GET['id']==strval(intval($_GET['id'])))
 				list($y,$m,$d,$h,$M,$s) = preg_split('/[\s:-]/',$ai['start_date']);
 				$vevent->setProperty('dtstart',array('year'=>$y,'month'=>$m,'day'=>$d,'hour'=>$h,'min'=>$M,'sec'=>$s));
 				if(empty($ai['end_date']))
-				{	
+				{
 					$y2=$y;$m2=$m;$d2=$d;$h2=$h;$M2=$M+15;$s2=$s;
 					if($M2>60){$M2=$M2-60;$h2+=1;}
 				}
@@ -131,13 +131,13 @@ if(!empty($_GET['id']) && $_GET['id']==strval(intval($_GET['id'])))
 				break;
 			default:
 				header('location:'.Security::remove_XSS($_SERVER['HTTP_REFERER']));
-				die();	
+				die();
 		}
 	}
 }
 else
 {
 	header('location:'.Security::remove_XSS($_SERVER['HTTP_REFERER']));
-	die();	
+	die();
 }
 ?>

+ 39 - 39
main/calendar/myagenda.inc.php

@@ -51,12 +51,12 @@ function get_myagendaitems($courses_dbs, $month, $year)
 	global $_user;
 	global $_configuration;
 	global $setting_agenda_link;
-	
+
 
 	$items = array ();
 	// get agenda-items for every course
 	foreach ($courses_dbs as $key => $array_course_info)
-	{		
+	{
 		//databases of the courses
 		$TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA, $array_course_info["db"]);
 		$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY, $array_course_info["db"]);
@@ -70,7 +70,7 @@ function get_myagendaitems($courses_dbs, $month, $year)
 										DISTINCT agenda.*, item_property.*
 										FROM ".$TABLEAGENDA." agenda,
 											 ".$TABLE_ITEMPROPERTY." item_property
-										WHERE agenda.id = item_property.ref 
+										WHERE agenda.id = item_property.ref
 										AND MONTH(agenda.start_date)='".$month."'
 										AND YEAR(agenda.start_date)='".$year."'
 										AND item_property.tool='".TOOL_CALENDAR_EVENT."'
@@ -116,7 +116,7 @@ function get_myagendaitems($courses_dbs, $month, $year)
 		while ($item = Database::fetch_array($result)) {
 			$agendaday = date("j",strtotime($item['start_date']));
 			if(!isset($items[$agendaday])){$items[$agendaday]=array();}
-			
+
 			$time= date("H:i",strtotime($item['start_date']));
 			$end_time= date("H:i",strtotime($item['end_date']));
 			$URL = api_get_path(WEB_PATH)."main/calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&amp;day=$agendaday&amp;month=$month&amp;year=$year#$agendaday"; // RH  //Patrick Cool: to highlight the relevant agenda item
@@ -131,10 +131,10 @@ function get_myagendaitems($courses_dbs, $month, $year)
 				$items[$agendaday][$item['start_date']] = '';
 			}
 			$items[$agendaday][$item['start_date']] .= "".get_lang('StartTimeWindow')."&nbsp;<i>".$time."</i>"."&nbsp;-&nbsp;".get_lang("EndTimeWindow")."&nbsp;<i>".$end_time."</i>&nbsp;";
-			$items[$agendaday][$item['start_date']] .= '<br />'."<a href=\"$URL\" title=\"".Security::remove_XSS($array_course_info['title'])."\">".$agenda_link."</a>  ".Security::remove_XSS($item['title'])."<br /> ";			
+			$items[$agendaday][$item['start_date']] .= '<br />'."<a href=\"$URL\" title=\"".Security::remove_XSS($array_course_info['title'])."\">".$agenda_link."</a>  ".Security::remove_XSS($item['title'])."<br /> ";
 			$items[$agendaday][$item['start_date']] .= '<br/>';
 		}
-		
+
 	}
 	// sorting by hour for every day
 	$agendaitems = array ();
@@ -301,11 +301,11 @@ function show_new_personal_item_form($id = "")
 	// if an $id is passed to this function this means we are editing an item
 	// we are loading the information here (we do this after everything else
 	// to overwrite the default information)
-	
+
 	if (strlen($id) > 0 && $id != strval(intval($id))) {
 		return false; //potential SQL injection
-	}	
-	
+	}
+
 	if ($id <> "")
 	{
 		$sql = "SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$_user['user_id']."' AND id='".$id."'";
@@ -466,15 +466,15 @@ function store_personal_item($day, $month, $year, $hour, $minute, $title, $conte
 	global $_user;
 	//constructing the date
 	$date = $year."-".$month."-".$day." ".$hour.":".$minute.":00";
-	
+
 	$date = Database::escape_string($date);
 	$title = Database::escape_string($title);
 	$content = Database::escape_string($content);
 	if ($id != strval(intval($id))) {
 		return false; //potential SQL injection
 	}
-	
-	
+
+
 	if ($id <> "")
 	{ // we are updating
 		$sql = "UPDATE ".$tbl_personal_agenda." SET user='".$_user['user_id']."', title='".$title."', text='".$content."', date='".$date."' WHERE id='".$id."'";
@@ -499,13 +499,13 @@ function get_all_courses_of_user()
         $tbl_session_course     = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
         $tbl_session_course_user= Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
         $tbl_session                    = Database :: get_main_table(TABLE_MAIN_SESSION);
-        $sql_select_courses = "SELECT c.code k, c.visual_code  vc, c.title i, c.tutor_name t, 
+        $sql_select_courses = "SELECT c.code k, c.visual_code  vc, c.title i, c.tutor_name t,
                                       c.db_name db, c.directory dir, '5' as status
                                 FROM $TABLECOURS c, $tbl_session_course_user srcu
-                                WHERE srcu.id_user='".$_user['user_id']."' 
+                                WHERE srcu.id_user='".$_user['user_id']."'
                                 AND c.code=srcu.course_code
-                                UNION 
-                               SELECT c.code k, c.visual_code  vc, c.title i, c.tutor_name t, 
+                                UNION
+                               SELECT c.code k, c.visual_code  vc, c.title i, c.tutor_name t,
                                       c.db_name db, c.directory dir, cru.status status
                                 FROM $TABLECOURS c, $TABLECOURSUSER cru
                                 WHERE cru.user_id='".$_user['user_id']."'
@@ -588,17 +588,17 @@ function get_personal_agenda_items($agendaitems, $day = "", $month = "", $year =
 	//echo "week:".$week."/";
 	//echo $type."<p>";
 	//echo "<pre>".$sql."</pre>";
-	
+
 	global $_configuration;
    	$root_url = $_configuration['root_web'];
 	if ($_configuration['multiple_access_urls']==true) {
-		$access_url_id = api_get_current_access_url_id();				
+		$access_url_id = api_get_current_access_url_id();
 		if ($access_url_id != -1 ){
-			$url = api_get_access_url($access_url_id); 				
+			$url = api_get_access_url($access_url_id);
 			$root_url = $url['url'];
-		}		
+		}
 	}
-	
+
 	$result = api_sql_query($sql, __FILE__, __LINE__);
 	while ($item = Database::fetch_array($result))
 	{
@@ -782,7 +782,7 @@ function show_simple_personal_agenda($user_id)
 {
 	$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
 	global $MonthsLong, $charset;
-	
+
 	// The SQL statement that retrieves all the personal agenda items of this user
 	$sql = "SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' ORDER BY date DESC";
 	$result = api_sql_query($sql, __FILE__, __LINE__);
@@ -820,31 +820,31 @@ function show_simple_personal_agenda($user_id)
 			}
 			/*--------------------------------------------------
 			 			display: date and time
-			  --------------------------------------------------*/					
-			// adding an internal anchor			
+			  --------------------------------------------------*/
+			// adding an internal anchor
 			$content.= date("d", strtotime($myrow["date"]))." ".$MonthsLong[date("n", strtotime($myrow["date"])) - 1]." ".date("Y", strtotime($myrow["date"]))."&nbsp;";
 			$content.= api_ucfirst(strftime(get_lang("timeNoSecFormat"), strtotime($myrow["date"])));
-			
+
 			/*--------------------------------------------------
 			 			display: the title
 			  --------------------------------------------------*/
-			$content.= '<br />';						
+			$content.= '<br />';
 			$content.= $myrow['title'];
 			$content.= '<br />';
-			
+
 			/*--------------------------------------------------
 			 			display: the content
 			  --------------------------------------------------*/
 			  /*
 			$content = $myrow['title'];
 			$content = make_clickable($content);
-			$content = text_filter($content);*/		
-			return $content;						
+			$content = text_filter($content);*/
+			return $content;
 		}
 	} else {
 		return $content;
 	}
-	
+
 }
 
 /**
@@ -856,11 +856,11 @@ function delete_personal_agenda($id)
 {
 	global $tbl_personal_agenda;
 	global $_user;
-	
+
 	if ($id != strval(intval($id))) {
 		return false; //potential SQL injection
-	}	
-	
+	}
+
 	if ($id <> '')
 	{
 		$sql = "SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$_user['user_id']."' AND id='".$id."'";
@@ -889,12 +889,12 @@ function get_personal_agenda_items_between_dates($user_id, $date_start='', $date
 	$expr = '/\d{4}-\d{2}-\d{2}\ \d{2}:\d{2}:\d{2}/';
 	if(!preg_match($expr,$date_start)) { return $items; }
 	if(!preg_match($expr,$date_end)) { return $items; }
-	
+
 	// get agenda-items for every course
 	$courses = api_get_user_courses($user_id,false);
     require_once(api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
 	foreach ($courses as $id => $course)
-	{		
+	{
 		$c = api_get_course_info($course['code']);
 		//databases of the courses
 		$t_a = Database :: get_course_table(TABLE_AGENDA, $course['db']);
@@ -908,14 +908,14 @@ function get_personal_agenda_items_between_dates($user_id, $date_start='', $date
 						" DISTINCT agenda.*, item_property.* ".
 						" FROM ".$t_a." agenda, ".
 						$t_ip." item_property ".
-                        " WHERE agenda.id = item_property.ref ". 
+                        " WHERE agenda.id = item_property.ref ".
 						" AND agenda.start_date>='$date_start' ".
 						" AND agenda.end_date<='$date_end' ".
 						" AND item_property.tool='".TOOL_CALENDAR_EVENT."' ".
 						" AND item_property.visibility='1' ".
 						" GROUP BY agenda.id ".
 						" ORDER BY start_date ";
-		} else { 
+		} else {
             // if the user is not an administrator of that course, then...
 			if (is_array($group_memberships) && count($group_memberships)>0)
 			{
@@ -953,7 +953,7 @@ function get_personal_agenda_items_between_dates($user_id, $date_start='', $date
 			$start_date = $year.$month.$day.$hour.$min;
 			list($year,$month,$day,$hour,$min,$sec) = split('[-: ]',$item['end_date']);
 			$end_date = $year.$month.$day.$hour.$min;
-			
+
 			$items[] = array(
 				'datestart'=>$start_date,
 				'dateend'=>$end_date,
@@ -963,6 +963,6 @@ function get_personal_agenda_items_between_dates($user_id, $date_start='', $date
 			);
 		}
 	}
-	return $items;	
+	return $items;
 }
 ?>

+ 6 - 6
main/calendar/myagenda.php

@@ -80,7 +80,7 @@ $nameTools = get_lang('MyAgenda');
 //remove this if cause it was showing in agenda general
 /*if(!empty($_GET['coursePath'])) {
 	$course_path = api_htmlentities(strip_tags($_GET['coursePath']),ENT_QUOTES,$charset);
-	$course_path = str_replace(array('../','..\\'),array('',''),$course_path); 	
+	$course_path = str_replace(array('../','..\\'),array('',''),$course_path);
 }
 */
 if (!empty ($course_path)) {
@@ -128,9 +128,9 @@ if (empty($_SESSION['view']))
 	$_SESSION['view'] = "month";
 }
 // 2. Storing it in the session. If we change the view by clicking on the links left, we change the session
-if (!empty($_GET['view'])) {	
+if (!empty($_GET['view'])) {
 	$_SESSION['view'] = Security::remove_XSS($_GET['view']);
-	
+
 }
 // 3. The views: (month, week, day, personal)
 if ($_SESSION['view'])
@@ -214,7 +214,7 @@ if (isset ($_user['user_id']))
 	// The name of the current Month
 	$monthName = $MonthsLong[$month -1];
 	// Starting the output
-	
+
 	echo "\n<div class=\"actions\">\n";
 	echo "\t<a href=\"".api_get_self()."?action=view&amp;view=month\">".Display::return_icon('calendar_month.gif', get_lang('MonthView'))." ".get_lang('MonthView')."</a> \n";
 	echo "\t<a href=\"".api_get_self()."?action=view&amp;view=week\">".Display::return_icon('calendar_week.gif', get_lang('WeekView'))." ".get_lang('WeekView')."</a> \n";
@@ -224,8 +224,8 @@ if (isset ($_user['user_id']))
 		echo "\t<a href=\"".api_get_self()."?action=add_personal_agenda_item\">".Display::return_icon('calendar_personal_add.gif', get_lang('AddPersonalItem'))." ".get_lang('AddPersonalItem')."</a> \n";
 		echo "\t<a href=\"".api_get_self()."?action=view&amp;view=personal\">".Display::return_icon('calendar_personal.gif', get_lang('ViewPersonalItem'))."  ".get_lang('ViewPersonalItem')."</a> \n";
 	}
-	echo "</div>\n\n";	
-	
+	echo "</div>\n\n";
+
 	echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
 	echo "<tr>";
 	// output: the small calendar item on the left and the view / add links

+ 22 - 22
main/chat/chat.php

@@ -43,7 +43,7 @@ else
 	$_SESSION['origin']=$_GET["origin"];
 	$_SESSION['target']=$_GET["target"];
 }
-/* ============================================================================== 
+/* ==============================================================================
   			TRACKING
 ==============================================================================  */
 event_access_tool(TOOL_CHAT);
@@ -52,12 +52,12 @@ event_access_tool(TOOL_CHAT);
 header('Content-Type: text/html; charset='. $charset);
 
 /*
- * Choose CSS style (platform's, user's, or course's) 
+ * Choose CSS style (platform's, user's, or course's)
  */
 $platform_theme = api_get_setting('stylesheets'); 	// plataform's css
 $my_style=$platform_theme;
-if(api_get_setting('user_selected_theme') == 'true') 
-{		
+if(api_get_setting('user_selected_theme') == 'true')
+{
 	$useri = api_get_user_info();
 	$user_theme = $useri['theme'];
 	if(!empty($user_theme) && $user_theme != $my_style)
@@ -67,19 +67,19 @@ if(api_get_setting('user_selected_theme') == 'true')
 }
 
 $mycourseid = api_get_course_id();
-if (!empty($mycourseid) && $mycourseid != -1) 
-{	
-	if (api_get_setting('allow_course_theme') == 'true') 
-	{	
-		$mycoursetheme=api_get_course_setting('course_theme');			
-		if (!empty($mycoursetheme) && $mycoursetheme!=-1)		 
-		{							
+if (!empty($mycourseid) && $mycourseid != -1)
+{
+	if (api_get_setting('allow_course_theme') == 'true')
+	{
+		$mycoursetheme=api_get_course_setting('course_theme');
+		if (!empty($mycoursetheme) && $mycoursetheme!=-1)
+		{
 			if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
-			{				
+			{
 				$my_style = $mycoursetheme;		// course's css
-			}			
-		}				
-	
+			}
+		}
+
 	}
 	$open_chat_window=api_get_course_setting('allow_open_chat_window');
 }
@@ -87,22 +87,22 @@ if (api_get_setting('show_navigation_menu')!='false') {
 	$footer_size = 20;
 } else {
 	switch($my_style){
-		case 'dokeos_classic' : 
+		case 'dokeos_classic' :
 			$footer_size = 48;
 			break;
-		case 'academica' : 
+		case 'academica' :
 			$footer_size = 140;
 			break;
-		case 'silver_line' : 
+		case 'silver_line' :
 			$footer_size = 60;
 			break;
-		case 'baby_orange' : 
+		case 'baby_orange' :
 			$footer_size = 120;
 			break;
-		case 'public_admin' : 
+		case 'public_admin' :
 			$footer_size =90;
 			break;
-		default : 
+		default :
 			$footer_size = 48;
 			break;
 	}
@@ -122,7 +122,7 @@ if (empty($open_chat_window))
 if (api_get_setting('show_navigation_menu') == 'false' || !empty($open_chat_window)) {
 echo '<frameset cols="165,*,0" border="1" frameborder="1" framespacing="1">';
 } else {
-echo '<frameset cols="165,*,200" border="1" frameborder="1" framespacing="1">';	
+echo '<frameset cols="165,*,200" border="1" frameborder="1" framespacing="1">';
 }
 echo '<frame src="chat_whoisonline.php?cidReq='.$cidreq.'" name="chat_whoisonline" scrolling="auto">';
 echo'<frameset rows="25,15" border="1" frameborder="1" framespacing="1">';

+ 31 - 31
main/chat/chat_chat.php

@@ -40,43 +40,43 @@ include (api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
 
 $course=$_GET['cidReq'];
 
-// if we have the session set up 
+// if we have the session set up
 if (!empty($course))
-{	
+{
 	$reset=$_GET['reset']?true:false;
 	$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
 	$query="SELECT username FROM $tbl_user WHERE user_id='".$_user['user_id']."'";
 	$result=api_sql_query($query,__FILE__,__LINE__);
-	
+
 	list($pseudoUser)=Database::fetch_row($result);
-	
+
 	$isAllowed=(empty($pseudoUser) || !$_cid)?false:true;
 	$isMaster=$is_courseAdmin?true:false;
-	
-	
+
+
 	$dateNow=date('Y-m-d');
-	
+
 	$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
 	$chatPath=$documentPath.'chat_files/';
 	$TABLEITEMPROPERTY= Database::get_course_table(TABLE_ITEM_PROPERTY);
-	
+
 	if(!is_dir($chatPath))
 	{
 		if(is_file($chatPath))
 		{
 			@unlink($chatPath);
 		}
-		
+
 		if (!api_is_anonymous()) {
 			$perm = api_get_setting('permissions_for_new_directories');
 			$perm = octdec(!empty($perm)?$perm:'0770');
 			@mkdir($chatPath,$perm);
-			@chmod($chatPath,$perm);			
+			@chmod($chatPath,$perm);
 			$doc_id=add_document($_course,'/chat_files','folder',0,'chat_files');
 			api_sql_query("INSERT INTO ".$TABLEITEMPROPERTY . " (tool,insert_user_id,insert_te,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility) VALUES ('document',1,NOW(),NOW(),$doc_id,'DocumentAdded',1,0,NULL,0)");
 		}
 	}
-	
+
 	if(!file_exists($chatPath.'messages-'.$dateNow.'.log.html'))
 	{
 		@fclose(fopen($chatPath.'messages-'.$dateNow.'.log.html','w'));
@@ -86,42 +86,42 @@ if (!empty($course))
 			item_property_update_on_folder($_course,'/chat_files', $_user['user_id']);
 		}
 	}
-	
+
 	if($reset && $isMaster)
 	{
 		$i=1;
-	
+
 		while(file_exists($chatPath.'messages-'.$dateNow.'-'.$i.'.log.html'))
 		{
 			$i++;
 		}
-	
+
 		@rename($chatPath.'messages-'.$dateNow.'.log.html',$chatPath.'messages-'.$dateNow.'-'.$i.'.log.html');
-	
+
 		@fclose(fopen($chatPath.'messages-'.$dateNow.'.log.html','w'));
-	
+
 		$doc_id=add_document($_course,'/chat_files/messages-'.$dateNow.'-'.$i.'.log.html','file',filesize($chatPath.'messages-'.$dateNow.'-'.$i.'.log.html'),'messages-'.$dateNow.'-'.$i.'.log.html');
-	
+
 		api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id']);
 		item_property_update_on_folder($_course,'/chat_files', $_user['user_id']);
-	
+
 		$doc_id = DocumentManager::get_document_id($_course,'/chat_files/messages-'.$dateNow.'.log.html');
-	
+
 		update_existing_document($_course, $doc_id,0);
 	}
-	
+
 	$content=file($chatPath.'messages-'.$dateNow.'.log.html');
 	$nbr_lines=sizeof($content);
 	$remove=$nbr_lines-100;
-	
+
 	if($remove < 0)
 	{
 		$remove=0;
 	}
-	
+
 	array_splice($content,0,$remove);
 	include('header_frame.inc.php');
-	
+
 	if ($_GET["origin"]=='whoisonline') {  //the caller
 		$content[0]=get_lang('CallSent').'<br>'.$content[0];
 	}
@@ -130,32 +130,32 @@ if (!empty($course))
 		$sql="update $track_user_table set chatcall_user_id = '', chatcall_date = '', chatcall_text='' where (user_id = ".$_user['user_id'].")";
 		$result=api_sql_query($sql,__FILE__,__LINE__);
 	}
-	
+
 	echo '<div style="margin-left: 5px;">';
 	foreach($content as $thisLine)
 	{
 		echo strip_tags(api_html_entity_decode($thisLine),'<br> <span> <b> <i> <img> <font>');
 	}
 	echo '</div>';
-	
+
 	?>
-	
+
 	<a name="bottom" style="text-decoration:none;">&nbsp;</a>
-	
+
 	<?php
 	if($isMaster || $is_courseCoach)
 	{
-		$rand=mt_rand(1,1000);		
+		$rand=mt_rand(1,1000);
 		echo '<div style="margin-left: 5px;">';
 		echo '<a href="'.api_get_self().'?rand='.$rand.'&reset=1&cidReq='.$_GET['cidReq'].'#bottom" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmReset'),ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('ClearList')).' '.get_lang('ClearList').'</a>';
 		echo '</div>';
 	}
 }
 else
-{	
+{
 	include('header_frame.inc.php');
-	$message=get_lang('CloseOtherSession');	
-	Display :: display_error_message($message);	
+	$message=get_lang('CloseOtherSession');
+	Display :: display_error_message($message);
 }
 include('footer_frame.inc.php');
 ?>

+ 14 - 14
main/chat/chat_footer.php

@@ -6,13 +6,13 @@ define('FRAME','footer');
 echo '<html><head><style>';
 
 /*
- * Choose CSS style (platform's, user's, or course's) 
+ * Choose CSS style (platform's, user's, or course's)
  */
 
 $platform_theme = api_get_setting('stylesheets'); 	// plataform's css
 $my_style=$platform_theme;
-if(api_get_setting('user_selected_theme') == 'true') 
-{		
+if(api_get_setting('user_selected_theme') == 'true')
+{
 	$useri = api_get_user_info();
 	$user_theme = $useri['theme'];
 	if(!empty($user_theme) && $user_theme != $my_style)
@@ -22,19 +22,19 @@ if(api_get_setting('user_selected_theme') == 'true')
 }
 
 $mycourseid = api_get_course_id();
-if (!empty($mycourseid) && $mycourseid != -1) 
-{	
-	if (api_get_setting('allow_course_theme') == 'true') 
-	{	
-		$mycoursetheme=api_get_course_setting('course_theme');			
-		if (!empty($mycoursetheme) && $mycoursetheme!=-1)		 
-		{							
+if (!empty($mycourseid) && $mycourseid != -1)
+{
+	if (api_get_setting('allow_course_theme') == 'true')
+	{
+		$mycoursetheme=api_get_course_setting('course_theme');
+		if (!empty($mycoursetheme) && $mycoursetheme!=-1)
+		{
 			if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
-			{				
+			{
 				$my_style = $mycoursetheme;		// course's css
-			}			
-		}				
-	
+			}
+		}
+
 	}
 }
 

+ 5 - 5
main/chat/chat_functions.lib.php

@@ -25,7 +25,7 @@
 /**
  * @author isaac flores paz
  * @param integer
- * @return void 
+ * @return void
  */
 function exit_of_chat ($user_id) {
 	$list_course=array();
@@ -70,7 +70,7 @@ function disconnect_user_of_chat () {
 	$cdate_m           = date('i',time());
 	$cdate_s           = date('s',time());
 	$cd_count_time_seconds=$cdate_h*3600 + $cdate_m*60 + $cdate_s;
-	
+
 	foreach ($list_info_user_in_chat as $list_info_user) {
 			$date_db_date = date('Y-m-d',strtotime($list_info_user['last_connection']));
 			$date_db_h  = date('H',strtotime($list_info_user['last_connection']));
@@ -84,7 +84,7 @@ function disconnect_user_of_chat () {
 		 			api_sql_query($sql,__FILE__,__LINE__);
 				}
 			}
-		
+
 
 	}
 }
@@ -101,6 +101,6 @@ function users_list_in_chat () {
  	while ($row = Database::fetch_array($result,'ASSOC')) {
  		$list_users_in_chat[]=$row;
  	}
- 	return $list_users_in_chat;	
-}	
+ 	return $list_users_in_chat;
+}
 ?>

+ 1 - 1
main/chat/chat_hidden.php

@@ -116,7 +116,7 @@ if ($_SESSION["origin"] == 'whoisonline') {  //check if our target has denied ou
 	$result=api_sql_query($sql,__FILE__,__LINE__);
 	$row=mysql_fetch_array($result);
 	if ($row['chatcall_text'] == 'DENIED') {
-		echo "<script language=javascript> alert('".get_lang('ChatDenied')."'); </script>";	
+		echo "<script language=javascript> alert('".get_lang('ChatDenied')."'); </script>";
 		$sql="update $track_user_table set chatcall_user_id = '', chatcall_date = '', chatcall_text='' where (user_id = $talk_to)";
 		$result=api_sql_query($sql,__FILE__,__LINE__);
 	}

+ 69 - 69
main/chat/chat_message.php

@@ -49,7 +49,7 @@ $course=api_get_course_id();
 ////
 ?>
 <script language="javascript" type="text/javascript">
-function insert_smile(text) { 
+function insert_smile(text) {
 	if (text.createTextRange) {
     text.smile = document.selection.createRange().duplicate();
    	}
@@ -57,8 +57,8 @@ function insert_smile(text) {
 
 function insert(text) {
 	var chat = document.formMessage.message;
-   	if (chat.createTextRange && chat.smile) {      
-    	var smile = chat.smile;      
+   	if (chat.createTextRange && chat.smile) {
+    	var smile = chat.smile;
     	smile.text = smile.text.charAt(smile.text.length - 1) == ' ' ? text + ' ' : text;
    	}
    	else chat.value += text;
@@ -79,21 +79,21 @@ function close_chat_window() {
 // mode open in a new window: close the window when there isn't an user login
 
 if(empty($_user['user_id']))
-{	
-	echo '<script languaje="javascript"> close_chat_window() </script>';	
+{
+	echo '<script languaje="javascript"> close_chat_window() </script>';
 }
 else
 {
 	api_protect_course_script();
 }
 
-// if we have the session set up 
+// if we have the session set up
 if (!empty($course) && !empty($_user['user_id']))
 {
 	include_once(api_get_path(LIBRARY_PATH).'document.lib.php');
 	include_once(api_get_path(LIBRARY_PATH).'text.lib.php');
 	include_once (api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
-	
+
 	/*
 	-----------------------------------------------------------
 		Constants and variables
@@ -101,7 +101,7 @@ if (!empty($course) && !empty($_user['user_id']))
 	*/
 	$tbl_user	= Database::get_main_table(TABLE_MAIN_USER);
 	$sent = $_REQUEST['sent'];
-	
+
 	/*
 	==============================================================================
 			MAIN CODE
@@ -109,39 +109,39 @@ if (!empty($course) && !empty($_user['user_id']))
 	*/
 	$query="SELECT lastname, firstname, username FROM $tbl_user WHERE user_id='".$_user['user_id']."'";
 	$result=api_sql_query($query,__FILE__,__LINE__);
-	
+
 	list($pseudoUser)=Database::fetch_row($result);
-	
+
 	$isAllowed=(empty($pseudoUser) || !$_cid)?false:true;
 	$isMaster=$is_courseAdmin?true:false;
-	
+
 	$firstname=Database::result($result,0,'firstname');
 	$lastname=Database::result($result,0,'lastname');
-	
+
 	$dateNow=date('Y-m-d');
-	
+
 	$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
 	$chatPath=$documentPath.'chat_files/';
 	$TABLEITEMPROPERTY= Database::get_course_table(TABLE_ITEM_PROPERTY);
-	
+
 	if(!is_dir($chatPath)) {
 		if(is_file($chatPath)) {
 			@unlink($chatPath);
 		}
-		if (!api_is_anonymous()) {			
+		if (!api_is_anonymous()) {
 			$perm = api_get_setting('permissions_for_new_directories');
 			$perm = octdec(!empty($perm)?$perm:'0770');
 			@mkdir($chatPath,$perm);
-			@chmod($chatPath,$perm);	
+			@chmod($chatPath,$perm);
 			$doc_id=add_document($_course,'/chat_files','folder',0,'chat_files');
 			$sql_insert = "INSERT INTO ".$TABLEITEMPROPERTY . " (tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility) VALUES ('document',1,NOW(),NOW(),$doc_id,'DocumentAdded',1,0,NULL,0)";
 			api_sql_query($sql_insert ,__FILE__,__LINE__);
-		}	
+		}
 	}
-		
-	include('header_frame.inc.php');	
+
+	include('header_frame.inc.php');
 	$chat_size=0;
-	
+
 	//define emoticons
 	$emoticon_text1=':-)';
 	$emoticon_img1= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_smile.gif" alt="'.get_lang('Smile').'" title="'.get_lang('Smile').'" />';
@@ -150,7 +150,7 @@ if (!empty($course) && !empty($_user['user_id']))
 	$emoticon_text3=';-)';
 	$emoticon_img3= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_wink.gif" alt="'.get_lang('Wink').'" title="'.get_lang('Wink').'" />';
 	$emoticon_text4=':-P';
-	$emoticon_img4= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_razz.gif" alt="'.get_lang('Avid').'" title="'.get_lang('Avid').'" />';	
+	$emoticon_img4= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_razz.gif" alt="'.get_lang('Avid').'" title="'.get_lang('Avid').'" />';
 	$emoticon_text5='8-)';
 	$emoticon_img5= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_cool.gif" alt="'.get_lang('Cool').'" title="'.get_lang('Cool').'" />';
 	$emoticon_text6=':-o)';
@@ -160,17 +160,17 @@ if (!empty($course) && !empty($_user['user_id']))
 	$emoticon_text8='=8-o';
 	$emoticon_img8= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_eek.gif" alt="'.get_lang('Amazing').'" title="'.get_lang('Amazing').'" />';
 	$emoticon_text9=':-|)';
-	$emoticon_img9= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_neutral.gif" alt="'.get_lang('Neutral').'" title="'.get_lang('Neutral').'" />';	
+	$emoticon_img9= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_neutral.gif" alt="'.get_lang('Neutral').'" title="'.get_lang('Neutral').'" />';
 	$emoticon_text8=':-k';
 	$emoticon_img8= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_think.gif" alt="'.get_lang('Think').'" title="'.get_lang('Think').'" />';
 	$emoticon_text11=':-?';
 	$emoticon_img11= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_confused.gif" alt="'.get_lang('Confused').'" title="'.get_lang('Confused').'" />';
 	$emoticon_text12=':-8';
-	$emoticon_img12= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_redface.gif" alt="'.get_lang('Redface').'" title="'.get_lang('Redface').'" />';	
+	$emoticon_img12= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_redface.gif" alt="'.get_lang('Redface').'" title="'.get_lang('Redface').'" />';
 	$emoticon_text13=':-=';
 	$emoticon_img13= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_shhh.gif" alt="'.get_lang('Silence').'" title="'.get_lang('Silence').'" />';
 	$emoticon_text14=':-#)';
-	$emoticon_img14= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_silenced.gif" alt="'.get_lang('Silenced').'" title="'.get_lang('Silenced').'" />';	
+	$emoticon_img14= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_silenced.gif" alt="'.get_lang('Silenced').'" title="'.get_lang('Silenced').'" />';
 	$emoticon_text15=':-(';
 	$emoticon_img15= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_sad.gif" alt="'.get_lang('Sad').'" title="'.get_lang('Sad').'" />';
 	$emoticon_text16=':-[8';
@@ -178,21 +178,21 @@ if (!empty($course) && !empty($_user['user_id']))
 	$emoticon_text17='--)';
 	$emoticon_img17= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_arrow.gif" alt="'.get_lang('Arrow').'" title="'.get_lang('Arrow').'" />';
 	$emoticon_text18=':!:';
-	$emoticon_img18= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_exclaim.gif" alt="'.get_lang('Exclamation').'" title="'.get_lang('Exclamation').'" />';	
+	$emoticon_img18= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_exclaim.gif" alt="'.get_lang('Exclamation').'" title="'.get_lang('Exclamation').'" />';
 	$emoticon_text19=':?:';
 	$emoticon_img19= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_question.gif" alt="'.get_lang('Question').'" title="'.get_lang('Question').'" />';
 	$emoticon_text20='0-';
-	$emoticon_img20= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_idea.gif" alt="'.get_lang('Idea').'" title="'.get_lang('Idea').'" />';				
+	$emoticon_img20= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_idea.gif" alt="'.get_lang('Idea').'" title="'.get_lang('Idea').'" />';
   //
 	$emoticon_text201='*';
 	$emoticon_img201= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/waiting.gif" alt="'.get_lang('AskPermissionSpeak').'" title="'.get_lang('AskPermissionSpeak').'" />';
 	$emoticon_text202=':speak:';
-	$emoticon_img202= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/flag_green_small.gif" alt="'.get_lang('GiveTheFloorTo').'" title="'.get_lang('GiveTheFloorTo').'" />';		
+	$emoticon_img202= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/flag_green_small.gif" alt="'.get_lang('GiveTheFloorTo').'" title="'.get_lang('GiveTheFloorTo').'" />';
 	$emoticon_text203=':pause:';
-	$emoticon_img203= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/flag_yellow_small.gif" alt="'.get_lang('Pause').'" title="'.get_lang('Pause').'" />';					
+	$emoticon_img203= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/flag_yellow_small.gif" alt="'.get_lang('Pause').'" title="'.get_lang('Pause').'" />';
 	$emoticon_text204=':stop:';
-	$emoticon_img204= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/flag_red_small.gif" alt="'.get_lang('Stop').'" title="'.get_lang('Stop').'" />';	
-	
+	$emoticon_img204= '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/flag_red_small.gif" alt="'.get_lang('Stop').'" title="'.get_lang('Stop').'" />';
+
 	if($sent)
 	{
 		$message=trim(htmlspecialchars(stripslashes($_POST['message']),ENT_QUOTES,$charset));
@@ -222,19 +222,19 @@ if (!empty($course) && !empty($_user['user_id']))
 		$message=str_replace($emoticon_text203, $emoticon_img203, $message);
 		$message=str_replace($emoticon_text204, $emoticon_img204, $message);
 
-		
-		
-		
-		$timeNow=date('d/m/y H:i:s');		
-		if (!api_is_anonymous()) {		
+
+
+
+		$timeNow=date('d/m/y H:i:s');
+		if (!api_is_anonymous()) {
 			if(!empty($message))
 			{
 				$message=make_clickable($message);
-		
+
 				if(!file_exists($chatPath.'messages-'.$dateNow.'.log.html'))
 				{
 					$doc_id=add_document($_course,'/chat_files/messages-'.$dateNow.'.log.html','file',0,'messages-'.$dateNow.'.log.html');
-		
+
 					api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id']);
 					item_property_update_on_folder($_course,'/chat_files', $_user['user_id']);
 				}
@@ -242,25 +242,25 @@ if (!empty($course) && !empty($_user['user_id']))
 				{
 					$doc_id = DocumentManager::get_document_id($_course,'/chat_files/messages-'.$dateNow.'.log.html');
 				}
-		
+
 				$fp=fopen($chatPath.'messages-'.$dateNow.'.log.html','a');
-		
+
 				if($isMaster)
 				{
-					$photo= '<img src="'.api_get_path(WEB_IMG_PATH).'teachers.gif" alt="'.get_lang('Teacher').'"  width="11" height="11" align="top"  title="'.get_lang('Teacher').'"  />';				
-					fputs($fp,'<span style="color:#999; font-size: smaller;">['.$timeNow.']</span>'.$photo.' <span id="chat_login_name"><b>'.api_get_person_name($firstname, $lastname).'</b></span> : <i>'.$message.'</i><br>'."\n");	 		
-					
+					$photo= '<img src="'.api_get_path(WEB_IMG_PATH).'teachers.gif" alt="'.get_lang('Teacher').'"  width="11" height="11" align="top"  title="'.get_lang('Teacher').'"  />';
+					fputs($fp,'<span style="color:#999; font-size: smaller;">['.$timeNow.']</span>'.$photo.' <span id="chat_login_name"><b>'.api_get_person_name($firstname, $lastname).'</b></span> : <i>'.$message.'</i><br>'."\n");
+
 				}
 				else
 				{
 					$photo= '<img src="'.api_get_path(WEB_IMG_PATH).'students.gif" alt="'.get_lang('Student').'"  width="11" height="11" align="top"  title="'.get_lang('Student').'"  />';
 					 fputs($fp,'<span style="color:#999; font-size: smaller;">['.$timeNow.']</span>'.$photo.' <b>'.api_get_person_name($firstname, $lastname).'</b> : <i>'.$message.'</i><br>'."\n");
 				}
-		
+
 				fclose($fp);
-		
+
 				$chat_size=filesize($chatPath.'messages-'.$dateNow.'.log.html');
-		
+
 				update_existing_document($_course, $doc_id,$chat_size);
 				item_property_update_on_folder($_course,'/chat_files', $_user['user_id']);
 			}
@@ -281,40 +281,40 @@ if (!empty($course) && !empty($_user['user_id']))
     <tr>
         <td>
         <?php
-		echo  "<a href=\"javascript:insert('".$emoticon_text1."')\">".$emoticon_img1."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text2."')\">".$emoticon_img2."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text3."')\">".$emoticon_img3."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text4."')\">".$emoticon_img4."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text5."')\">".$emoticon_img5."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text6."')\">".$emoticon_img6."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text7."')\">".$emoticon_img7."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text8."')\">".$emoticon_img8."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text9."')\">".$emoticon_img9."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text10."')\">".$emoticon_img10."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text11."')\">".$emoticon_img11."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text12."')\">".$emoticon_img12."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text13."')\">".$emoticon_img13."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text14."')\">".$emoticon_img14."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text15."')\">".$emoticon_img15."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text16."')\">".$emoticon_img16."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text17."')\">".$emoticon_img17."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text18."')\">".$emoticon_img18."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text19."')\">".$emoticon_img19."</a>"; 
+		echo  "<a href=\"javascript:insert('".$emoticon_text1."')\">".$emoticon_img1."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text2."')\">".$emoticon_img2."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text3."')\">".$emoticon_img3."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text4."')\">".$emoticon_img4."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text5."')\">".$emoticon_img5."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text6."')\">".$emoticon_img6."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text7."')\">".$emoticon_img7."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text8."')\">".$emoticon_img8."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text9."')\">".$emoticon_img9."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text10."')\">".$emoticon_img10."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text11."')\">".$emoticon_img11."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text12."')\">".$emoticon_img12."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text13."')\">".$emoticon_img13."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text14."')\">".$emoticon_img14."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text15."')\">".$emoticon_img15."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text16."')\">".$emoticon_img16."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text17."')\">".$emoticon_img17."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text18."')\">".$emoticon_img18."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text19."')\">".$emoticon_img19."</a>";
 		echo  "<a href=\"javascript:insert('".$emoticon_text20."')\">".$emoticon_img20."</a>";
 		?>
         </td>
         <td>
         <?php
-		echo  "<a href=\"javascript:insert('".$emoticon_text201."')\">".$emoticon_img201."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text202."')\">".$emoticon_img202."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text203."')\">".$emoticon_img203."</a>"; 
-		echo  "<a href=\"javascript:insert('".$emoticon_text204."')\">".$emoticon_img204."</a>"; 
+		echo  "<a href=\"javascript:insert('".$emoticon_text201."')\">".$emoticon_img201."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text202."')\">".$emoticon_img202."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text203."')\">".$emoticon_img203."</a>";
+		echo  "<a href=\"javascript:insert('".$emoticon_text204."')\">".$emoticon_img204."</a>";
 		?>
         </td>
     </tr>
 	</table>
     </form>
-<?php 
+<?php
 
 }
 include('footer_frame.inc.php');

+ 23 - 23
main/chat/chat_whoisonline.php

@@ -47,19 +47,19 @@ if (!empty($course))
 	$tbl_session_course	= Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
 	$tbl_user		= Database::get_main_table(TABLE_MAIN_USER);
 	$tbl_chat_connected	= Database::get_course_table(CHAT_CONNECTED_TABLE,$_course['dbName']);
-	
+
 	$query="SELECT username FROM $tbl_user WHERE user_id='".$_user['user_id']."'";
 	$result=api_sql_query($query,__FILE__,__LINE__);
-	
+
 	list($pseudoUser)=Database::fetch_array($result);
-	
+
 	$isAllowed=(empty($pseudoUser) || !$_cid)?false:true;
 	$isMaster=$is_courseAdmin?true:false;
-		
-	$date_inter=date('Y-m-d H:i:s',time()-120); 
-	
-	$Users = array(); 
-	
+
+	$date_inter=date('Y-m-d H:i:s',time()-120);
+
+	$Users = array();
+
 	if(!isset($_SESSION['id_session']))
 	{
 		$query="SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri,t3.status FROM $tbl_user t1,$tbl_chat_connected t2,$tbl_course_user t3 WHERE t1.user_id=t2.user_id AND t3.user_id=t2.user_id AND t3.course_code = '".$_course['sysCode']."' AND t2.last_connection>'".$date_inter."' ORDER BY username";
@@ -75,30 +75,30 @@ if (!empty($course))
 		{
 			$Users[$learner['user_id']] = $learner;
 		}
-		
+
 		// select session coach
 		$query="SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri FROM $tbl_user t1,$tbl_chat_connected t2,$tbl_session t3 WHERE t1.user_id=t2.user_id AND t3.id_coach=t2.user_id AND t3.id = '".$_SESSION['id_session']."' AND t2.last_connection>'".$date_inter."' ORDER BY username";
 		$result=api_sql_query($query,__FILE__,__LINE__);
 		if($coach = Database::fetch_array($result))
 			$Users[$coach['user_id']] = $coach;
-		
+
 		// select session course coach
 		$query="SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri FROM $tbl_user t1,$tbl_chat_connected t2,$tbl_session_course t3 WHERE t1.user_id=t2.user_id AND t3.id_coach=t2.user_id AND t3.id_session = '".$_SESSION['id_session']."' AND t3.course_code = '".$_course['sysCode']."' AND t2.last_connection>'".$date_inter."' ORDER BY username";
 		$result=api_sql_query($query,__FILE__,__LINE__);
 		if($coach = Database::fetch_array($result))
 			$Users[$coach['user_id']] = $coach;
-		
+
 	}
-	
-	
-	$user_id=$enreg['user_id'];	
+
+
+	$user_id=$enreg['user_id'];
 	include('header_frame.inc.php');
 	?>
 	<table border="0" cellpadding="0" cellspacing="0" width="100%" class="data_table">
 	<tr><th colspan="2"><?php echo get_lang("Connected"); ?></th></tr>
 	<?php
 	foreach($Users as $enreg)
-	{	
+	{
 		if(!isset($_SESSION['id_session']))
 		{
 			$status=$enreg['status'];
@@ -107,17 +107,17 @@ if (!empty($course))
 		{
 			if(CourseManager::is_course_teacher($enreg['user_id'],$_SESSION['_course']['id'])) $status=1; else $status=5;
 		}
-		
+
 	$user_image=UserManager::get_user_picture_path_by_id($enreg['user_id'],'web',false,true);
 	$file_url=$user_image['dir'].$user_image['file'];
-		
-	?>    
-    <tr>    
+
+	?>
+    <tr>
 	  <td width="1%" valign="top"><img src="<?php echo $file_url;?>" border="0" width="22" alt="" /></td>
 	  <td width="99%"><?php if($status == 1) echo Display::return_icon('teachers.gif', get_lang('Teacher'),array('height' => '11')).' '; else echo Display::return_icon('students.gif', get_lang('Student'), array('height' => '11'));?><a <?php if($status == 1) echo 'class="master"';// ?> name="user_<?php echo $enreg['user_id']; ?>" href="<?php echo api_get_self(); ?>?<?php echo api_get_cidreq();?>&showPic=<?php if($showPic == $enreg['user_id']) echo '0'; else echo $enreg['user_id']; ?>#user_<?php echo $enreg['user_id']; ?>"><?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']); ?></a></td>
 	</tr>
 	<?php
-	
+
 	if($showPic == $enreg['user_id']): ?>
 	<tr>
 	  <td colspan="2" align="center"><img src="<?php echo $file_url;?>" border="0" width="100" alt="" /></td>
@@ -126,9 +126,9 @@ if (!empty($course))
 	<?php
 	}
 	unset($Users);
-	?>	
-	</table>	
-	<?php	
+	?>
+	</table>
+	<?php
 	}
 	include('footer_frame.inc.php');
 ?>

+ 18 - 18
main/chat/header_frame.inc.php

@@ -41,7 +41,7 @@ $bodyXtra='';
 if(FRAME == 'hidden')
 {
 	$bodyXtra='onload="javascript:updateChat(); updateConnected(); setTimeout(\'submitHiddenForm();\',5000);"';
-    // change timeout to change refresh time of the chat window 
+    // change timeout to change refresh time of the chat window
 }
 elseif(FRAME == 'message')
 {
@@ -50,13 +50,13 @@ elseif(FRAME == 'message')
 
 
 /*
- * Choose CSS style (platform's, user's, or course's) 
+ * Choose CSS style (platform's, user's, or course's)
  */
 
 $platform_theme = api_get_setting('stylesheets'); 	// plataform's css
 $my_style=$platform_theme;
-if(api_get_setting('user_selected_theme') == 'true') 
-{		
+if(api_get_setting('user_selected_theme') == 'true')
+{
 	$useri = api_get_user_info();
 	$user_theme = $useri['theme'];
 	if(!empty($user_theme) && $user_theme != $my_style)
@@ -67,19 +67,19 @@ if(api_get_setting('user_selected_theme') == 'true')
 
 $mycourseid = api_get_course_id();
 
-if (!empty($mycourseid) && $mycourseid != -1) 
-{	
-	if (api_get_setting('allow_course_theme') == 'true') 
-	{	
-		$mycoursetheme=api_get_course_setting('course_theme');			
-		if (!empty($mycoursetheme) && $mycoursetheme!=-1)		 
-		{							
+if (!empty($mycourseid) && $mycourseid != -1)
+{
+	if (api_get_setting('allow_course_theme') == 'true')
+	{
+		$mycoursetheme=api_get_course_setting('course_theme');
+		if (!empty($mycoursetheme) && $mycoursetheme!=-1)
+		{
 			if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
-			{				
+			{
 				$my_style = $mycoursetheme;		// course's css
-			}			
-		}				
-	
+			}
+		}
+
 	}
 }
 
@@ -101,7 +101,7 @@ if (empty($mycourseid))
 	a{
 		font-size: 12px;
 	}
-	
+
 	.background_submit{
 		background: url(../img/chat_little.gif) 2px 2px no-repeat;
 		padding: 2px 1px 1px 20px;
@@ -117,7 +117,7 @@ function updateChat()
 {
 	if('<?php echo $chat_size_old; ?>' != '<?php echo $chat_size_new; ?>')
 	{
-		parent.chat_chat.location.href='chat_chat.php?size=<?php echo $chat_size_new.'&cidReq='.$_GET['cidReq']; ?>#bottom';				
+		parent.chat_chat.location.href='chat_chat.php?size=<?php echo $chat_size_new.'&cidReq='.$_GET['cidReq']; ?>#bottom';
 	}
 }
 
@@ -150,7 +150,7 @@ function send_message(evenement){
     {
     	if(prop == 'which') touche = evenement.which; else touche = evenement.keyCode;
     }
-    
+
     if (touche == 13)
     {
     	document.formMessage.submit();

+ 16 - 16
main/conference/api.php

@@ -34,7 +34,7 @@ if ($debug>0)
 
 
 /*==== Flash loose the cookie ===*/
-/* needed when using the nice upload window : 
+/* needed when using the nice upload window :
 if ($_SERVER['HTTP_USER_AGENT'] == 'Shockwave Flash') {
 	$sid = $_REQUEST['sid'];
 	if ($debug>0) error_log("reusing: ".$sid);
@@ -64,7 +64,7 @@ $_course['path'] = $_course['directory'];
 // FIXME: add_document needs this to work
 $_course['dbName'] = $_course['db_name'];
 
-// FIXME: check if CourseManager::get_user_in_course_status return != 
+// FIXME: check if CourseManager::get_user_in_course_status return !=
 //	COURSEMANAGER when the code is not valid
 if ($debug>0) error_log($coursePath, 0);
 
@@ -126,19 +126,19 @@ else if ($action == "upload")
 	}
 
 	echo '<html><body><script language="javascript">setTimeout(1000,window.close());</script></body></html>';
-} 
-else if ($action == "service") 
+}
+else if ($action == "service")
 {
 	/*==== List files ====*/
 	if ($debug>0) error_log("sending file list",0);
 	$subaction = $_REQUEST["subaction"];
 	$is_manager = (CourseManager::get_user_in_course_status($user_id, $cidReq) == COURSEMANAGER);
-	if ($subaction == "list") 
+	if ($subaction == "list")
 	{
 		// FIXME: check security around $_REQUEST["cwd"]
 		$cwd = $_REQUEST["cwd"];
 
-		
+
 		// treat /..
 		$nParent = 0; // the number of /.. into the url
 		while (substr($cwd, -3, 3) == "/..")
@@ -150,10 +150,10 @@ else if ($action == "service")
 		}
 		for (;$nParent >0; $nParent--){
 			$cwd = (strrpos($cwd,'/')>-1 ? substr($cwd, 0, strrpos($cwd,'/')) : $cwd);
-		}		
+		}
 
 		if (strlen($cwd) == 0) $cwd="/";
-		
+
 		if (Security::check_abs_path($cwd,api_get_path(SYS_PATH)))
 			die();
 
@@ -164,7 +164,7 @@ else if ($action == "service")
 		/* $canDelete = ($canDelete && $isBellowVideoConfUploadPath);
 		*/
 		$can_delete = ($is_manager && $is_below_videoconf_dir);
-		
+
 		// get files list
 		$files = DocumentManager::get_all_document_data($_course, $cwd, 0, NULL, false);
 		printf("<dokeosobject><fileListMeta></fileListMeta><fileList>");
@@ -175,17 +175,17 @@ else if ($action == "service")
 		{
 			// converting to UTF-8
 			$files[$k]['title'] = api_convert_encoding(
-						api_strlen($files[$k]['title']) > 32 ? 
-							api_substr($files[$k]['title'],0, 32)."..." : 
+						api_strlen($files[$k]['title']) > 32 ?
+							api_substr($files[$k]['title'],0, 32)."..." :
 							$files[$k]['title'],
-						'utf-8',api_get_setting('platform_charset')); 
+						'utf-8',api_get_setting('platform_charset'));
 			// removing '<', '>' and '_'
 			$files[$k]['title'] = str_replace(array('<','>','_'),' ', $files[$k]['title']);
 		}
 
 		if(is_array($files))
 		{
-	
+
 			foreach($files as $i)
 			{
 				if ($i["filetype"] == "folder")
@@ -204,8 +204,8 @@ else if ($action == "service")
 		printf("</files><ppts>");
 		printf("</ppts>");
 		printf("</fileList></dokeosobject>");
-	} 
-	else if ($subaction == "delete") 
+	}
+	else if ($subaction == "delete")
 	{
 		/*==== PERMISSION ====*/
 		$permissions = CourseManager::get_user_in_course_status($user_id, $cidReq);
@@ -222,7 +222,7 @@ else if ($action == "service")
 			die();
 		}
 		DocumentManager::delete_document($_course, $path, $coursePath);
-		echo "<result>OK</result>"; // We have to return something to OpenLaszlo 
+		echo "<result>OK</result>"; // We have to return something to OpenLaszlo
 	}
 }
 else if ($action == "download")

+ 3 - 3
main/conference/audiopost.php

@@ -1,4 +1,4 @@
-<?php 
+<?php
 //file_put_contents("result.txt", print_r($_POST, true));
 //file_put_contents("result3.txt", print_r($_FILES, true));
 //file_put_contents("result2.txt", print_r($_GET, true));
@@ -51,7 +51,7 @@ if($is_our_server)
 					$res = api_item_property_update($course_info,TOOL_DOCUMENT,$id,'DocumentAdded',$_GET['user_id']);
 					if($res === false)
 					{
-						error_log(__FILE__.':'.__LINE__.': Something went wrong with item properties update of '.$target,0);					
+						error_log(__FILE__.':'.__LINE__.': Something went wrong with item properties update of '.$target,0);
 					}
 					else
 					{//make sound invisible?
@@ -60,7 +60,7 @@ if($is_our_server)
 				}
 				else
 				{
-					error_log(__FILE__.':'.__LINE__.': Could not create document record for document '.$target,0);					
+					error_log(__FILE__.':'.__LINE__.': Could not create document record for document '.$target,0);
 				}
 			}
 		}

+ 6 - 6
main/conference/checksession.php

@@ -35,13 +35,13 @@ printf ('<?xml version="1.0" encoding="UTF-8" ?>');
 printf('<dokeosobject>');
 
 printf('<courseobject>');
-foreach ($_SESSION['_course'] as $key => $val)	
+foreach ($_SESSION['_course'] as $key => $val)
 		printf('<%s>%s</%s>',$key,api_utf8_encode($val),$key);
 printf('</courseobject>');
 
 printf('<userobject>');
-foreach ($_SESSION['_user'] as $key => $val) 
-	if ($key != "auth_source") 
+foreach ($_SESSION['_user'] as $key => $val)
+	if ($key != "auth_source")
 	{
 		if (( $key == "lastName" || $key == "firstName" ) && strlen($val) == 0)
 			$val = get_lang('Unknown');
@@ -50,9 +50,9 @@ foreach ($_SESSION['_user'] as $key => $val)
 
 printf('<sid>%s</sid>', session_id());
 $isadmin =((CourseManager::get_user_in_course_status($_SESSION['_user']['user_id'], $_SESSION['_course']['sysCode']) == COURSEMANAGER)||
-		api_is_platform_admin() || 
-		api_is_course_tutor() ||  
-		api_is_course_admin() || 
+		api_is_platform_admin() ||
+		api_is_course_tutor() ||
+		api_is_course_admin() ||
 		api_is_course_coach() ? "true" : "false");
 printf('<key>%s</key>', md5($confkey.$challenge));
 printf('<challenge>%s</challenge>', $challenge);

+ 4 - 4
main/conference/get_translation.lib.php

@@ -2,17 +2,17 @@
 /* See license terms in /dokeos_license.txt */
 /**
  * Library for language translation from Dokeos language files to XML for videoconference
- * @uses main_api.lib.php for api_get_path() 
+ * @uses main_api.lib.php for api_get_path()
  */
 /**
- * This function reads a Dokeos language file and transforms it into XML, 
- * then returns the XML string to the caller. 
+ * This function reads a Dokeos language file and transforms it into XML,
+ * then returns the XML string to the caller.
  */
 function get_language_file_as_xml($language='english')
 {
 	$path = api_get_path(SYS_LANG_PATH).$language.'/';
 	if(!is_dir($path) or !is_readable($path))
-	{ 
+	{
 		if($language != 'english')
 		{
 			return get_language_file_as_xml('english');

+ 3 - 3
main/conference/testpost.php

@@ -1,13 +1,13 @@
-<?php 
+<?php
 //file_put_contents("result.txt", print_r($_POST, true));
 //file_put_contents("result3.txt", print_r($_FILES, true));
 //file_put_contents("result2.txt", print_r($_GET, true));
 require('../inc/global.inc.php');
-if(api_get_setting('service_visio','active')=='true' 
+if(api_get_setting('service_visio','active')=='true'
 	&& $_SERVER['REMOTE_HOST'] == api_get_setting('service_visio','visio_host'))
 {
 	$target = "/tmp/";
 	$target = $target . basename( $_FILES['file']['name']) ;
-	if(move_uploaded_file($_FILES['file']['tmp_name'], $target)); 
+	if(move_uploaded_file($_FILES['file']['tmp_name'], $target));
 }
 ?>

+ 1 - 1
main/conference/videoconference.php

@@ -1,5 +1,5 @@
 <?php require('../inc/global.inc.php'); ?>
-<!DOCTYPE html 
+<!DOCTYPE html
 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>

+ 30 - 30
main/course_description/index.php

@@ -132,7 +132,7 @@ while ($row = Database::fetch_array($result)) {
   $default_description_titles[$row['id']] = $row['title'];
 }
 
-if (api_is_allowed_to_edit() && !is_null($description_id) || $action =='add') {	
+if (api_is_allowed_to_edit() && !is_null($description_id) || $action =='add') {
 	$description_id = intval($description_id);
 	// Delete a description block
 	if ($action == 'delete') {
@@ -148,42 +148,42 @@ if (api_is_allowed_to_edit() && !is_null($description_id) || $action =='add') {
 			if ($description = Database::fetch_array($result)) {
 				$default_description_titles[$description_id] = $description['title'];
 				$description_content = $description['content'];
-	
+
 			} else {
-				$current_title = $default_description_titles[$description_id];				
-			}	
+				$current_title = $default_description_titles[$description_id];
+			}
 
 		} else {
 			$sql = "SELECT MAX(id) as MAX FROM $tbl_course_description ";
 			$result = api_sql_query($sql, __FILE__, __LINE__);
-			$max= Database::fetch_array($result);				
+			$max= Database::fetch_array($result);
 			$description_id = $max['MAX']+1;
 			if ($description_id < ADD_BLOCK) {
 					$description_id=8;
-			} 			
+			}
 		}
-		//Se borro: echo ' <style> .row{} <\style> por que hacia conflicto en apartado personalizado con los estilos propios del formvalidator 		
-		// Build the form		
+		//Se borro: echo ' <style> .row{} <\style> por que hacia conflicto en apartado personalizado con los estilos propios del formvalidator
+		// Build the form
 		$form = new FormValidator('course_description','POST','index.php?'.api_get_cidreq(),'','style="width: 100%;"');
 		$form->addElement('header', '', $default_description_titles[$description_id]);
 		$form->addElement('hidden', 'description_id');
-		
+
 		if ($action == 'edit' || intval($edit) == 1 ) {
 			$form->addElement('hidden', 'edit','1');
-		}		
+		}
 
 		if ($action == 'add' || intval($add) == 1 ) {
-			$form->addElement('hidden', 'add','1');	
-		}		
-			
-		if (($description_id >= ADD_BLOCK) || $default_description_title_editable[$description_id] || $action == 'add' || intval($edit) == 1) {			
+			$form->addElement('hidden', 'add','1');
+		}
+
+		if (($description_id >= ADD_BLOCK) || $default_description_title_editable[$description_id] || $action == 'add' || intval($edit) == 1) {
 			$form->add_textfield('title', get_lang('Title'), true, array('size'=>'width: 350px;'));
 			$form->applyFilter('title','html_filter');
 		}
-		
+
 		if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
 			WCAG_rendering::prepare_admin_form($description_content, $form);
-		} else {			
+		} else {
 			$form->add_html_editor('contentDescription', get_lang('Content'), true, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '200'));
 		}
 		$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
@@ -193,7 +193,7 @@ if (api_is_allowed_to_edit() && !is_null($description_id) || $action =='add') {
 		$default['description_id'] = $description_id;
 		//if ($description_id >= ADD_BLOCK) {
 			//$default['description_id'] = ADD_BLOCK;
-		//} 
+		//}
 		$form->setDefaults($default);
 		// If form validates: save the description block
 		if ($form->validate()) {
@@ -205,13 +205,13 @@ if (api_is_allowed_to_edit() && !is_null($description_id) || $action =='add') {
 			}
 			$title = $description['title'];
 			if ($description['description_id'] >= ADD_BLOCK) {
-				if ($description['add']=='1') { //if this element has been submitted for addition					
+				if ($description['add']=='1') { //if this element has been submitted for addition
 					$result = api_sql_query($sql, __FILE__, __LINE__);
-					$sql = "INSERT IGNORE INTO $tbl_course_description SET id = '".$description_id."', title = '".Database::escape_string(Security::remove_XSS($title,COURSEMANAGERLOWSECURITY))."', content = '".Database::escape_string(Security::remove_XSS($content,COURSEMANAGERLOWSECURITY))."'";				
+					$sql = "INSERT IGNORE INTO $tbl_course_description SET id = '".$description_id."', title = '".Database::escape_string(Security::remove_XSS($title,COURSEMANAGERLOWSECURITY))."', content = '".Database::escape_string(Security::remove_XSS($content,COURSEMANAGERLOWSECURITY))."'";
+					api_sql_query($sql, __FILE__, __LINE__);
+				} else {
+					$sql = "UPDATE $tbl_course_description SET  title = '".Database::escape_string(Security::remove_XSS($title,COURSEMANAGERLOWSECURITY))."', content = '".Database::escape_string(Security::remove_XSS($content,COURSEMANAGERLOWSECURITY))."' WHERE id = '".$description_id."' ";
 					api_sql_query($sql, __FILE__, __LINE__);
-				} else {								
-					$sql = "UPDATE $tbl_course_description SET  title = '".Database::escape_string(Security::remove_XSS($title,COURSEMANAGERLOWSECURITY))."', content = '".Database::escape_string(Security::remove_XSS($content,COURSEMANAGERLOWSECURITY))."' WHERE id = '".$description_id."' ";				
-					api_sql_query($sql, __FILE__, __LINE__);					
 				}
 			} else {
 				//if title is not editable, then use default title
@@ -227,21 +227,21 @@ if (api_is_allowed_to_edit() && !is_null($description_id) || $action =='add') {
 		}
 		// Show the form
 		else {
-			// menu top 
+			// menu top
 			//***********************************
 			if (api_is_allowed_to_edit()) {
 				$categories = array ();
-				
+
 				foreach ($default_description_titles as $id => $title) {
 					$categories[$id] = $title;
 				}
 				$categories[ADD_BLOCK] = get_lang('NewBloc');
-					
+
 				$i=1;
 				echo '<div class="actions">';
 				ksort($categories);
 				foreach ($categories as $id => $title) {
-					if ($i==8) { 
+					if ($i==8) {
 						echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add">'.Display::return_icon($default_description_icon[$id], $title, array('height'=>'22')).' '.$title.'</a>';
 						break;
 					} else {
@@ -283,17 +283,17 @@ if ($show_description_list) {
 	}
 	if (api_is_allowed_to_edit()) {
 		$categories = array ();
-		
+
 		foreach ($default_description_titles as $id => $title) {
 			$categories[$id] = $title;
 		}
 		$categories[ADD_BLOCK] = get_lang('NewBloc');
-		
+
 		$i=1;
 		echo '<div class="actions" style="margin-bottom:30px">';
 		ksort($categories);
 		foreach ($categories as $id => $title) {
-			if ($i==8) { 
+			if ($i==8) {
 				echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add">'.Display::return_icon($default_description_icon[$id], $title, array('height'=>'22')).' '.$title.'</a>';
 				break;
 			} else {
@@ -311,7 +311,7 @@ if ($show_description_list) {
 				echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=delete&amp;description_id='.$description->id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;">';
 				echo Display::return_icon('delete.gif', get_lang('Delete'), array('style' => 'vertical-align:middle;float:right;'));
 				echo '</a> ';
-				
+
 				//edit
 				echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;description_id='.$description->id.'">';
 				echo Display::return_icon('edit.gif', get_lang('Edit'), array('style' => 'vertical-align:middle;float:right; padding-right:4px;'));

+ 8 - 8
main/course_home/2column.php

@@ -130,7 +130,7 @@ function show_tools($course_tool_category)
 			$all_tools_list[]=$properties;
 		}
 	}
-	
+
 	if (isset($all_tools_list))
 	{
 		$lnk = array();
@@ -158,24 +158,24 @@ function show_tools($course_tool_category)
 
 			$toolsRow['link'] = $toolsRow['link'];
 			echo	'<td width="50%" height="30">';
-			
+
 			if(strpos($toolsRow['name'],'visio_')!==false)
 			{
 				echo '<a  '.$class.' href="javascript: void(0);" onclick="window.open(\'' . htmlspecialchars($toolsRow['link']).(($toolsRow['image']=="external.gif" || $toolsRow['image']=="external_na.gif") ? '' : $qm_or_amp.api_get_cidreq()) . '\',\'window_visio'.$_SESSION['_cid'].'\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '">';
 			}
-			
+
 			else if(strpos($toolsRow['name'],'chat')!==false && api_get_course_setting('allow_open_chat_window')==true)
-			{					
+			{
 				/*
 				echo  '<a href="#" onclick="window.open(\'' . htmlspecialchars($toolsRow['link']) .(($toolsRow['image']=="external.gif" || $toolsRow['image']=="external_na.gif") ? '' : $qm_or_amp.api_get_cidreq()). '\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '"'.$class.'>';
 				*/
 				echo  '<a href="javascript: void(0);" onclick="window.open(\'' . htmlspecialchars($toolsRow['link']).$qm_or_amp.api_get_cidreq() . '\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '"'.$class.'>';
-			}			
-			else 
+			}
+			else
 			{
-				echo	'<a href="'. htmlspecialchars($toolsRow['link']).(($toolsRow['image']=="external.gif" || $toolsRow['image']=="external_na.gif") ? '' : $qm_or_amp.api_get_cidreq()).'" target="' , $toolsRow['target'], '" '.$class.'>';				
+				echo	'<a href="'. htmlspecialchars($toolsRow['link']).(($toolsRow['image']=="external.gif" || $toolsRow['image']=="external_na.gif") ? '' : $qm_or_amp.api_get_cidreq()).'" target="' , $toolsRow['target'], '" '.$class.'>';
 			}
-					
+
 			/*
 			echo Display::return_icon($toolsRow['image'], get_lang(ucfirst($toolsRow['name']))),'&nbsp;', ($toolsRow['image']=="external.gif" || $toolsRow['image']=="external_na.gif" || $toolsRow['image']=="scormbuilder.gif" || $toolsRow['image']=="blog.gif") ? htmlspecialchars( $toolsRow['name'],ENT_QUOTES,$charset) : get_lang(ucfirst($toolsRow['name'])),'</a>';
 			*/

+ 5 - 5
main/course_home/3column.php

@@ -26,7 +26,7 @@
 ==============================================================================
 */
 /**
-============================================================================== 
+==============================================================================
 *                  HOME PAGE FOR EACH COURSE (BASIC TOOLS FIXED)
 *
 *	This page, included in every course's index.php is the home
@@ -36,7 +36,7 @@
 *	access to Professor's tools (statistics, edit forums...).
 *
 *	@package dokeos.course_home
-============================================================================== 
+==============================================================================
 */
 $hide = isset($_GET['hide']) && $_GET['hide'] == 'yes' ? 'yes' : null;
 $restore = isset($_GET['restore']) && $_GET['restore'] == 'yes' ? 'yes' : null;
@@ -64,14 +64,14 @@ if (is_allowed_to_edit())
  *     visibility = 2 - admin
  *
  * Who can change visibility ?
- * 
+ *
  *     admin = 0 - prof and admin
  *     admin = 1 - admin
  *
  * Show message to confirm that a tools must be hide from aivailable tools
  *
  *     visibility 0,1->2 - $remove
- * 
+ *
  * Process hiding a tools from aivailable tools.
  *
  *     visibility=2                         are only view  by Dokeos
@@ -96,7 +96,7 @@ if (is_allowed_to_edit())
 			$toolsRow['link']=api_get_path(WEB_CODE_PATH).$toolsRow['link'];
 		}
 		$toolsRow['image']=api_get_path(WEB_CODE_PATH)."img/".$toolsRow['image'];
-	
+
 		echo 	"<br><br><br>\n";
 		echo	"<table class=\"message\" width=\"70%\" align=\"center\">\n",
 				"<tr><td width=\"7%\" align=\"center\">\n",

+ 25 - 25
main/course_home/activity.php

@@ -88,7 +88,7 @@ function show_tools_category($course_tool_category)
 				$result = api_sql_query("SELECT * FROM $course_tool_table WHERE category = 'admin' ORDER BY id",__FILE__,__LINE__);
 				$colLink ="##003399";
 				break;
-		
+
 
 	}
 
@@ -96,7 +96,7 @@ function show_tools_category($course_tool_category)
 	{
 		$all_tools_list[]=$temp_row;
 	}
-	
+
 	/*if(api_is_course_coach())
 	{
 		$result = api_sql_query("SELECT * FROM $course_tool_table WHERE name='tracking'",__FILE__,__LINE__);
@@ -245,9 +245,9 @@ function show_tools_category($course_tool_category)
 				}
 
 			}
-			
+
 			// Both checks are necessary as is_platform_admin doesn't take student view into account
-			if( $is_platform_admin && $is_allowed_to_edit) 
+			if( $is_platform_admin && $is_allowed_to_edit)
 			{
  				if($toolsRow['admin'] !='1')
 				{
@@ -294,11 +294,11 @@ function show_tools_category($course_tool_category)
 				$toolsRow['link'] = $toolsRow['link'].$qm_or_amp.api_get_cidreq();
 			}
 				if(strpos($toolsRow['name'],'visio_')!==false) {
-					
+
 					/*
 					$toollink = "\t" . '<a ' . $class . ' href="#" onclick="window.open(\'' . htmlspecialchars($toolsRow['link']) . '\',\'window_visio\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '">';
 					*/
-	
+
 					$toollink = "\t" . '<a id="tooldesc_'.$toolsRow["id"].'"  ' . $class . ' href="javascript: void(0);" onclick="window.open(\'' . htmlspecialchars($toolsRow['link']) . '\',\'window_visio'.$_SESSION['_cid'].'\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '">';
 					$my_tool_link = "\t" . '<a id="istooldesc_'.$toolsRow["id"].'"  ' . $class . ' href="javascript: void(0);" onclick="window.open(\'' . htmlspecialchars($toolsRow['link']) . '\',\'window_visio'.$_SESSION['_cid'].'\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '">';
 				} else if(strpos($toolsRow['name'],'chat')!==false && api_get_course_setting('allow_open_chat_window')==true) {
@@ -310,16 +310,16 @@ function show_tools_category($course_tool_category)
 
 				} else {
 
-					if (count(explode('type=classroom',$toolsRow['link']))==2 || count(explode('type=conference',$toolsRow['link']))==2) {					
-						//$toollink = "\t" . '<a ' . $class . ' href="' . $toolsRow['link'] . '" target="_blank">';	
-						$toollink = "\t" . '<a id="tooldesc_'.$toolsRow["id"].'" ' . $class . ' href="' . $toolsRow['link'] . '" target="_blank">';													
-						$my_tool_link = "\t" . '<a id="istooldesc_'.$toolsRow["id"].'" ' . $class . ' href="' . $toolsRow['link'] . '" target="_blank">';							
-					
-					} else {					
-						//$toollink = "\t" . '<a ' . $class . ' href="' . htmlspecialchars($toolsRow['link']) . '" target="' . $toolsRow['target'] . '">';	
-						$toollink = "\t" . '<a id="tooldesc_'.$toolsRow["id"].'" ' . $class . ' href="' . htmlspecialchars($toolsRow['link']) . '" target="' . $toolsRow['target'] . '">';							
-						$my_tool_link = "\t" . '<a id="istooldesc_'.$toolsRow["id"].'" ' . $class . ' href="' . htmlspecialchars($toolsRow['link']) . '" target="' . $toolsRow['target'] . '">';	
-					
+					if (count(explode('type=classroom',$toolsRow['link']))==2 || count(explode('type=conference',$toolsRow['link']))==2) {
+						//$toollink = "\t" . '<a ' . $class . ' href="' . $toolsRow['link'] . '" target="_blank">';
+						$toollink = "\t" . '<a id="tooldesc_'.$toolsRow["id"].'" ' . $class . ' href="' . $toolsRow['link'] . '" target="_blank">';
+						$my_tool_link = "\t" . '<a id="istooldesc_'.$toolsRow["id"].'" ' . $class . ' href="' . $toolsRow['link'] . '" target="_blank">';
+
+					} else {
+						//$toollink = "\t" . '<a ' . $class . ' href="' . htmlspecialchars($toolsRow['link']) . '" target="' . $toolsRow['target'] . '">';
+						$toollink = "\t" . '<a id="tooldesc_'.$toolsRow["id"].'" ' . $class . ' href="' . htmlspecialchars($toolsRow['link']) . '" target="' . $toolsRow['target'] . '">';
+						$my_tool_link = "\t" . '<a id="istooldesc_'.$toolsRow["id"].'" ' . $class . ' href="' . htmlspecialchars($toolsRow['link']) . '" target="' . $toolsRow['target'] . '">';
+
 					}
 
 				}
@@ -339,9 +339,9 @@ function show_tools_category($course_tool_category)
 				}
 				Display::display_icon($toolsRow['image'], $tool_name, array('class'=>'tool-icon','id'=>'toolimage_'.$toolsRow["id"]));
 				echo '</a> ';
-					
-				echo $my_tool_link;	
-				/*	
+
+				echo $my_tool_link;
+				/*
 					echo ($toolsRow['image'] == 'file_html_na.gif' || $toolsRow['image'] == 'file_html.gif' || $toolsRow['image'] == 'scormbuilder.gif' || $toolsRow['image'] == 'scormbuilder_na.gif' || $toolsRow['image'] == 'blog.gif' || $toolsRow['image'] == 'blog_na.gif' || $toolsRow['image'] == 'external.gif' || $toolsRow['image'] == 'external_na.gif') ? '  '.stripslashes($toolsRow['name']) : '  '.get_lang(ucfirst($toolsRow['name']));
 				*/
 				echo $tool_name;
@@ -388,7 +388,7 @@ if (isset($_GET['sent_http_request']) && $_GET['sent_http_request']==1) {
 		$requested_image   = ($tool_visibility == 0 ) ? $tool_image : $new_image;
 		$requested_clase   = ($tool_visibility == 0 ) ? 'visible' : 'invisible';
 		$requested_message = ($tool_visibility == 0 ) ? 'is_active' : 'is_inactive';
-    $requested_view    = ($tool_visibility == 0 ) ? 'visible.gif' : 'invisible.gif'; 
+    $requested_view    = ($tool_visibility == 0 ) ? 'visible.gif' : 'invisible.gif';
     $requested_visible = ($tool_visibility == 0 ) ? 1 : 0;
 	 	/*
 		-----------------------------------------------------------
@@ -399,7 +399,7 @@ if (isset($_GET['sent_http_request']) && $_GET['sent_http_request']==1) {
 				$sql="UPDATE $tool_table SET visibility='".Database::escape_string($requested_visible)."' WHERE id='".$_GET["id"]."'";
 				api_sql_query($sql,__FILE__,__LINE__);
 			}
-    
+
 		$response_data = array(
 			'image'   => $requested_image,
 			'tclass'  => $requested_clase,
@@ -410,7 +410,7 @@ if (isset($_GET['sent_http_request']) && $_GET['sent_http_request']==1) {
 		exit;
 	}
 } else {
-	
+
 	if(api_is_allowed_to_edit()) {
 	 	/*
 		-----------------------------------------------------------
@@ -422,7 +422,7 @@ if (isset($_GET['sent_http_request']) && $_GET['sent_http_request']==1) {
 			api_sql_query("UPDATE $tool_table SET visibility=0 WHERE id='".$_GET["id"]."'",__FILE__,__LINE__);
 			Display::display_confirmation_message(get_lang('ToolIsNowHidden'));
 		}
-	
+
 	  /*
 		-----------------------------------------------------------
 			REACTIVATE
@@ -434,7 +434,7 @@ if (isset($_GET['sent_http_request']) && $_GET['sent_http_request']==1) {
 			Display::display_confirmation_message(get_lang('ToolIsNowVisible'));
 		}
 	}
-	
+
 }
 
 // work with data post askable by admin of course
@@ -490,7 +490,7 @@ if(api_is_allowed_to_edit())
 
 ?>
 	<div class="normal-message" id="id_normal_message" style="display:none"><?php echo get_lang("PleaseStandBy")."<br/>".'<img src="'.$server_protocol.$current_host.'/'.$path_work.'main/inc/lib/javascript/indicator.gif"/>'; ?></div>
-	<div class="confirmation-message" id="id_confirmation_message" style="display:none"></div>		
+	<div class="confirmation-message" id="id_confirmation_message" style="display:none"></div>
 	<div class="courseadminview">
 		<span class="viewcaption"><?php echo get_lang("Authoring") ?></span>
 		<table width="100%">

+ 22 - 22
main/course_home/btf_functions.php

@@ -144,7 +144,7 @@ function showtools2($cat)
 		if (api_get_session_id()!=0 && in_array($toolsRow['name'],array('course_maintenance','course_setting'))) {
 				continue;
 		}
-		
+
 		$cell_content = '';
 		// the name of the tool
 		$tool_name = ($toolsRow['name_translated'] != "" ? $toolsRow['name_translated'] : htmlspecialchars($toolsRow['name'],ENT_QUOTES,$charset)); // RH: added htmlspecialchars
@@ -172,25 +172,25 @@ function showtools2($cat)
 
 		// VISIBLE
 		if ($toolsRow['visibility'] or $cat == 'courseAdmin' or $cat == 'platformAdmin')
-		{	
+		{
 			if(strpos($toolsRow['name'],'visio_')!==false)
-			{	
+			{
 				$cell_content .= '<a  href="javascript: void(0);" onclick="window.open(\'' . $toolsRow['link'].$link_annex . '\',\'window_visio'.$_SESSION['_cid'].'\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '"><img src="'.$toolsRow['img'].'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>';
 			}
 			else if(strpos($toolsRow['name'],'chat')!==false && api_get_course_setting('allow_open_chat_window')==true)
-			{					
+			{
 				/*
-				$cell_content .= '<a href="#" onclick="window.open(\'' .$toolsRow['link'].$link_annex. '\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '"><img src="'.$toolsRow['img'].'" alt="'.get_lang(ucfirst($toolsRow['name'])).' " align="absmiddle" border="0">'.$tool_name.'</a>'."\n"; // don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']				
-				*/				
-				$cell_content .= '<a href="javascript: void(0);" onclick="window.open(\'' .$toolsRow['link'].$link_annex. '\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '"><img src="'.$toolsRow['img'].'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>'."\n"; // don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']				
-			}			
-			else 
+				$cell_content .= '<a href="#" onclick="window.open(\'' .$toolsRow['link'].$link_annex. '\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '"><img src="'.$toolsRow['img'].'" alt="'.get_lang(ucfirst($toolsRow['name'])).' " align="absmiddle" border="0">'.$tool_name.'</a>'."\n"; // don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']
+				*/
+				$cell_content .= '<a href="javascript: void(0);" onclick="window.open(\'' .$toolsRow['link'].$link_annex. '\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '"><img src="'.$toolsRow['img'].'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>'."\n"; // don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']
+			}
+			else
 			{
 				/*
 				$cell_content .= '<a href="'.$toolsRow['link'].$link_annex.'" target="'.$toolsRow['target'].'"><img src="'.$toolsRow['img'].'" alt="'.get_lang(ucfirst($toolsRow['name'])).' " align="absmiddle" border="0">'.$tool_name.'</a>'."\n"; // don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']
 				*/
 				$cell_content .= '<a href="'.$toolsRow['link'].$link_annex.'" target="'.$toolsRow['target'].'"><img src="'.$toolsRow['img'].'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>'."\n"; // don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']
-			}			
+			}
 		}
 		// INVISIBLE
 		else
@@ -198,37 +198,37 @@ function showtools2($cat)
 			if (api_is_allowed_to_edit())
 			{
 				if(strpos($toolsRow['name'],'visio_')!==false)
-				{	
-					$cell_content .= '<a  href="javascript: void(0);" onclick="window.open(\'' . $toolsRow['link'].$link_annex . '\',\'window_visio'.$_SESSION['_cid'].'\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '"><img src="'.str_replace(".gif", "_na.gif", $toolsRow['img']).'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>'."\n"; 
+				{
+					$cell_content .= '<a  href="javascript: void(0);" onclick="window.open(\'' . $toolsRow['link'].$link_annex . '\',\'window_visio'.$_SESSION['_cid'].'\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '"><img src="'.str_replace(".gif", "_na.gif", $toolsRow['img']).'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>'."\n";
 				}
 				else if(strpos($toolsRow['name'],'chat')!==false && api_get_course_setting('allow_open_chat_window')==true)
-				{					
+				{
 					/*
 					$cell_content .= '<a href="#" onclick="window.open(\'' .$toolsRow['link'].$link_annex. '\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '" class="invisible"><img src="'.str_replace(".gif", "_na.gif", $toolsRow['img']).'" alt="'.get_lang(ucfirst($toolsRow['name'])).' " align="absmiddle" border="0">'.$tool_name.'</a>'."\n"; // don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']
 					*/
 					$cell_content .= '<a href="javascript: void(0);" onclick="window.open(\'' .$toolsRow['link'].$link_annex. '\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $toolsRow['target'] . '" class="invisible"><img src="'.str_replace(".gif", "_na.gif", $toolsRow['img']).'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>'."\n"; // don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']
-				}			
-				else 
+				}
+				else
 				{
 					/*
-					$cell_content .= '<a href="'.$toolsRow['link'].$link_annex.'" target="'.$toolsRow['target'].'" class="invisible"><img src="'.str_replace(".gif", "_na.gif", $toolsRow['img']).'" alt="'.get_lang(ucfirst($toolsRow['name'])).' " align="absmiddle" border="0">'.$tool_name.'</a>'."\n";// don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']				
+					$cell_content .= '<a href="'.$toolsRow['link'].$link_annex.'" target="'.$toolsRow['target'].'" class="invisible"><img src="'.str_replace(".gif", "_na.gif", $toolsRow['img']).'" alt="'.get_lang(ucfirst($toolsRow['name'])).' " align="absmiddle" border="0">'.$tool_name.'</a>'."\n";// don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']
 					*/
-					$cell_content .= '<a href="'.$toolsRow['link'].$link_annex.'" target="'.$toolsRow['target'].'" class="invisible"><img src="'.str_replace(".gif", "_na.gif", $toolsRow['img']).'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>'."\n";// don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']				
-				}		
+					$cell_content .= '<a href="'.$toolsRow['link'].$link_annex.'" target="'.$toolsRow['target'].'" class="invisible"><img src="'.str_replace(".gif", "_na.gif", $toolsRow['img']).'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>'."\n";// don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']
+				}
 			}
 			else
 			{
 				/*
-				$cell_content .= '<img src="'.str_replace(".gif", "_na.gif", $toolsRow['img']).'" alt="'.get_lang(ucfirst($toolsRow['name'])).' " align="absmiddle" border="0">'; // don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']	
-				*/	
-				$cell_content .= '<img src="'.str_replace(".gif", "_na.gif", $toolsRow['img']).'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'; // don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']	
+				$cell_content .= '<img src="'.str_replace(".gif", "_na.gif", $toolsRow['img']).'" alt="'.get_lang(ucfirst($toolsRow['name'])).' " align="absmiddle" border="0">'; // don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']
+				*/
+				$cell_content .= '<img src="'.str_replace(".gif", "_na.gif", $toolsRow['img']).'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'; // don't replace img with display::return_icon because $toolsRow['img'] = api_get_path(WEB_IMG_PATH).$toolsRow['img']
 				$cell_content .= '<span class="invisible">'.$tool_name.'</span>';
 			}
 		}
 
 		$lnk = array ();
 		if (api_is_allowed_to_edit() and $cat != "courseAdmin" && !strpos($toolsRow['link'], 'learnpath_handler.php?learnpath_id'))
-		{			
+		{
 			if ($toolsRow["visibility"])
 			{
 				$link['name'] = Display::return_icon('remove.gif', get_lang('Deactivate'), array('style' => 'vertical-align:middle;'));

+ 9 - 9
main/course_home/course_home.php

@@ -70,7 +70,7 @@ if ($_SERVER['HTTP_HOST'] == 'localhost') {
     $path_work = substr($info[0],0,strlen($info[0])-1);
 } else {
     $path_work = "";
-} 
+}
 $htmlHeadXtra[] ='<script type="text/javascript">
  $(document).ready(function() {
   $(".make_visible_and_invisible").attr("href","javascript:void(0);");
@@ -117,7 +117,7 @@ $htmlHeadXtra[] ='<script type="text/javascript">
 					$("#"+tool_id).attr("title","'.get_lang('Activate').'");
 				} else {
 					$("#"+tool_id).attr("alt","'.get_lang('Deactivate').'");
-					$("#"+tool_id).attr("title","'.get_lang('Deactivate').'");							
+					$("#"+tool_id).attr("title","'.get_lang('Deactivate').'");
 				}
 				if (info.message=="is_active") {
 					message = "'.get_lang('ToolIsNowVisible').'";
@@ -127,18 +127,18 @@ $htmlHeadXtra[] ='<script type="text/javascript">
 				$(".normal-message").hide();
 				$("#id_confirmation_message").html(message);
 				$("#id_confirmation_message").show();
-		} }); 
-				
-	}); 	
+		} });
+
+	});
 
  });
-</script>';	
+</script>';
 if(!isset($cidReq))
 {
 	$cidReq = api_get_course_id(); // to provide compatibility. with previous system
 
 	global $error_msg,$error_no;
-	$classError = "init";	
+	$classError = "init";
 	$error_no[$classError][] = "2";
 	$error_level[$classError][] = "info";
 	$error_msg[$classError][] = "[".__FILE__."][".__LINE__."] cidReq was Missing $cidReq take $dbname;";
@@ -201,7 +201,7 @@ api_session_unregister('toolgroup');
 	Is the user allowed here?
 -----------------------------------------------------------
 */
-if($is_allowed_in_course == false) 
+if($is_allowed_in_course == false)
 {
 	api_not_allowed(true);
 }
@@ -221,7 +221,7 @@ Display::display_header($course_title, "Home");
 -----------------------------------------------------------
 */
 if(!isset($coursesAlreadyVisited[$_cid]) )
-{	
+{
 	event_access_course();
 	$coursesAlreadyVisited[$_cid] = 1;
 	api_session_register('coursesAlreadyVisited');

+ 3 - 3
main/course_info/delete_course.php

@@ -53,10 +53,10 @@ $tool_name = get_lang('DelCourse');
 if (isset($_GET['delete']) && $_GET['delete'] == 'yes')
 {
 	CourseManager :: delete_course($_course['sysCode']);
-	
+
 	$obj_cat=new Category();
 	$obj_cat->update_category_delete($_course['sysCode']);
-	
+
 	// DELETE CONFIRMATION MESSAGE
 	unset ($_course);
 	unset ($_cid);
@@ -69,7 +69,7 @@ else
 {
 	$message = "&quot;".$currentCourseName."&quot; "."(".$currentCourseCode.") "."<p>".get_lang("ByDel")."</p>"."<p>"."<a href=\"maintenance.php\">".get_lang("N")."</a>"."&nbsp;&nbsp;|&nbsp;&nbsp;"."<a href=\"".api_get_self()."?delete=yes\">".get_lang("Y")."</a>"."</p>";
 	$interbreadcrumb[] = array ("url" => "maintenance.php", "name" => get_lang('Maintenance'));
-} 
+}
 Display :: display_header($tool_name, "Settings");
 api_display_tool_title($tool_name);
 Display::display_warning_message($message,false);

+ 7 - 7
main/course_info/infocours.php

@@ -252,14 +252,14 @@ $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class=
 
 // COURSE THEME PICKER
 if (api_get_setting('allow_course_theme') == 'true')
-{	
+{
 	$form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="theme" id="theme"></a>'.Display::return_icon('theme.gif',get_lang('Theming')).' '.get_lang('Theming').'</div><div style="clear:both;"></div>');
 
-	//Allow Learning path 
+	//Allow Learning path
 	$form->addElement('radio', 'allow_learning_path_theme', get_lang('AllowLearningPathTheme'), get_lang('AllowLearningPathThemeAllow'), 1);
 	$form->addElement('radio', 'allow_learning_path_theme', null, get_lang('AllowLearningPathThemeDisallow'), 0);
 	$form -> addElement('html',$linebreak);
-	
+
 	$form->addElement('select_theme', 'course_theme', get_lang('Theme'));
 	$form->applyFilter('course_theme', 'trim');
 	$form -> addElement('html',$linebreak);
@@ -363,7 +363,7 @@ if ($form->validate() && is_settings_editable()) {
 	if($update_values['allow_user_edit_announcement'] != $values['allow_user_edit_announcement']){
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_edit_announcement']." WHERE variable = 'allow_user_edit_announcement' ";
 		api_sql_query($sql,__FILE__,__LINE__);
-	}	
+	}
 	if($update_values['allow_user_image_forum'] != $values['allow_user_image_forum']){
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_image_forum']." WHERE variable = 'allow_user_image_forum' ";
 		api_sql_query($sql,__FILE__,__LINE__);
@@ -371,16 +371,16 @@ if ($form->validate() && is_settings_editable()) {
 	if($update_values['allow_open_chat_window'] != $values['allow_open_chat_window']){
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_open_chat_window']." WHERE variable = 'allow_open_chat_window' ";
 		api_sql_query($sql,__FILE__,__LINE__);
-	}	
+	}
 	if($update_values['course_theme'] != $values['course_theme']){
 		$sql = "UPDATE $table_course_setting SET value = '".$update_values['course_theme']."' WHERE variable = 'course_theme' ";
-		api_sql_query($sql,__FILE__,__LINE__); 
+		api_sql_query($sql,__FILE__,__LINE__);
 	}
 	if($update_values['allow_learningpath_theme'] != $values['allow_learning_path_theme']){
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_learning_path_theme']." WHERE variable = 'allow_learning_path_theme' ";
 		api_sql_query($sql,__FILE__,__LINE__);
 	}
-	
+
 
 	$cidReset = true;
 	$cidReq = $course_code;

+ 2 - 2
main/course_info/maintenance.php

@@ -30,7 +30,7 @@
 /*
  * Created on 18 October 2006 by Elixir Interactive http://www.elixir-interactive.com
  */
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = array ('admin','create_course', 'course_info', 'coursebackup');
 
 require ('../inc/global.inc.php');
@@ -66,7 +66,7 @@ api_display_tool_title($nameTools);
 <div class="sectioncomment"><?php echo get_lang("DescriptionRecycleCourse");?></div>
 
 <div class="sectiontitle"><?php Display::display_icon('delete.gif',get_lang("DelCourse")); ?>&nbsp;&nbsp;<a href="../course_info/delete_course.php?<?php echo api_get_cidreq();?>"><?php echo get_lang("DelCourse");?></a></div>
-<div class="sectioncomment"><?php echo get_lang("DescriptionDeleteCourse");	?></div>	
+<div class="sectioncomment"><?php echo get_lang("DescriptionDeleteCourse");	?></div>
 
 <?php
 // footer

+ 15 - 15
main/course_info/postpone.php

@@ -2,21 +2,21 @@
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
 ==============================================================================
@@ -40,14 +40,14 @@
 *	@package dokeos.course_info
 ==============================================================================
 */
-	
+
 /*
 ==============================================================================
 		INIT SECTION
 ==============================================================================
-*/ 
+*/
 
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = "postpone";
 //$interbreadcrumb[]= array ("url"=>"index.php", "name"=> get_lang('Admin'));
 $htmlHeadXtra[] = "
@@ -60,16 +60,16 @@ $htmlHeadXtra[] = "
 <STYLE media=\"print\" type=\"text/css\">
 TD {border-bottom: thin dashed Gray;}
 </STYLE>";
-include('../inc/global.inc.php'); 
+include('../inc/global.inc.php');
 $this_section=SECTION_COURSES;
 
-include(api_get_path(LIBRARY_PATH).'debug.lib.inc.php'); 
+include(api_get_path(LIBRARY_PATH).'debug.lib.inc.php');
 Display::display_header($nameTools,"Settings");
 
 //include(api_get_path(CONFIGURATION_PATH)."postpone.conf.php");
 
 $nameTools = get_lang('Postpone');
-$TABLECOURSE	= Database::get_main_table(TABLE_MAIN_COURSE); 
+$TABLECOURSE	= Database::get_main_table(TABLE_MAIN_COURSE);
 $is_allowedToEdit 			= $is_courseAdmin;
 $currentCourseID 			= $_course['sysCode'];
 $currentCourseRepository 	= $_course["path"];
@@ -95,10 +95,10 @@ $currentCourseExpirationDate	= $currentCourseExtentionData["expiration_date"];
 <?php //echo get_lang('SubTitle'); ?>
 
 
-This script  would be  called  by  
-	professor, 
-	or administrator, 
-	or other  script 
+This script  would be  called  by
+	professor,
+	or administrator,
+	or other  script
 to give more time to a course before expiration.
 
 <?php

+ 10 - 10
main/coursecopy/backup.php

@@ -1,38 +1,38 @@
 <?php
 // $Id: backup.php 12219 2007-05-01 18:46:59Z yannoo $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 /**
  * ==============================================================================
  * Create a backup.
- * 
+ *
  * @author Bart Mollet <bart.mollet@hogent.be>
  * @package dokeos.backup
  * ==============================================================================
  */
 
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = array('exercice', 'coursebackup', 'admin');
 
 // including the global file
@@ -60,7 +60,7 @@ api_display_tool_title($nameTools);
 ==============================================================================
 		MAIN CODE
 ==============================================================================
-*/ 
+*/
 ?>
 
   <ul>

+ 8 - 8
main/coursecopy/classes/Announcement.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: Announcement.class.php 11326 2007-03-02 10:34:18Z yannoo $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';
@@ -75,7 +75,7 @@ class Announcement extends Resource
 	function show()
 	{
 		parent::show();
-		echo $this->date.': '.$this->title;	
+		echo $this->date.': '.$this->title;
 	}
 }
 ?>

+ 11 - 11
main/coursecopy/classes/Course.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: Course.class.php 19948 2009-04-21 17:27:59Z juliomontoya $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'LinkCategory.class.php';
@@ -58,12 +58,12 @@ class Course
 			if (is_array($resources)) {
 				foreach($resources as $id => $resource) {
 					if( $resource->links_to($resource_to_check) ) {
-						return true;	
+						return true;
 					}
 					if( $type == RESOURCE_LEARNPATH && get_class($resource)=='Learnpath') {
 						if($resource->has_item($resource_to_check)) {
-							return true;	
-						}	
+							return true;
+						}
 					}
 				}
 			}
@@ -87,7 +87,7 @@ class Course
 	{
 		if( $resource_type != null)
 		{
-			return is_array($this->resources[$resource_type]) && ( count($this->resources[$resource_type]) > 0 );	
+			return is_array($this->resources[$resource_type]) && ( count($this->resources[$resource_type]) > 0 );
 		}
 		return (count($this->resources) > 0);
 	}

+ 6 - 6
main/coursecopy/classes/CourseArchiver.class.php

@@ -76,23 +76,23 @@ class CourseArchiver
 		{
 			//TODO set and handle an error message telling the user to review the permissions on the archive directory
       		error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors')!=false?$php_errormsg:'error not recorded because track_errors is off in your php.ini').' - This error, occuring because your archive directory will not let this script write data into it, will prevent courses backups to be created',0);
-		} 
+		}
 		// Write the course-object to the file
 		$fp = @fopen($course_info_file, 'w');
 		if($fp == false)
 		{
       			error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors')!=false?$php_errormsg:'error not recorded because track_errors is off in your php.ini'),0);
-		} 
+		}
 		$res = @fwrite($fp, base64_encode(serialize($course)));
 		if($res == false)
 		{
       			error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors')!=false?$php_errormsg:'error not recorded because track_errors is off in your php.ini'),0);
-		} 
+		}
 		$res = @fclose($fp);
 		if($res == false)
 		{
       			error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors')!=false?$php_errormsg:'error not recorded because track_errors is off in your php.ini'),0);
-		} 
+		}
 
 		// Copy all documents to the temp-dir
 		if( is_array($course->resources[RESOURCE_DOCUMENT])) {
@@ -101,8 +101,8 @@ class CourseArchiver
 					$doc_dir = $backup_dir.$document->path;
 					@mkdir(dirname($doc_dir), 0755, true);
 					if (file_exists($course->path.$document->path)) {
-						copy($course->path.$document->path, $doc_dir);	
-					}					
+						copy($course->path.$document->path, $doc_dir);
+					}
 				} else {
 					@mkdir($backup_dir.$document->path, 0755, true);
 				}

+ 10 - 10
main/coursecopy/classes/CourseBuilder.class.php

@@ -42,7 +42,7 @@ class CourseBuilder
 		$this->course->type = $type;
 		$this->course->path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/';
 		$this->course->backup_path = api_get_path(SYS_COURSE_PATH).$_course['path'];
-		$this->course->encoding = api_get_system_encoding(); //current platform encoding 
+		$this->course->encoding = api_get_system_encoding(); //current platform encoding
 	}
 	/**
 	 * Get the created course
@@ -106,13 +106,13 @@ class CourseBuilder
 	function build_documents()
 	{
 		$table_doc = Database :: get_course_table(TABLE_DOCUMENT);
-		$table_prop = Database :: get_course_table(TABLE_ITEM_PROPERTY);	
-			
-        if (!empty($this->course->type) && $this->course->type=='partial')        	
+		$table_prop = Database :: get_course_table(TABLE_ITEM_PROPERTY);
+
+        if (!empty($this->course->type) && $this->course->type=='partial')
         	$sql = 'SELECT * FROM '.$table_doc.' d, '.$table_prop.' p WHERE tool = \''.TOOL_DOCUMENT.'\' AND p.ref = d.id AND p.visibility != 2 AND path NOT LIKE \'/images/gallery%\' ORDER BY path';
         else
         	$sql = 'SELECT * FROM '.$table_doc.' d, '.$table_prop.' p WHERE tool = \''.TOOL_DOCUMENT.'\' AND p.ref = d.id AND p.visibility != 2 ORDER BY path';
-		
+
 		$db_result = api_sql_query($sql, __FILE__, __LINE__);
 		while ($obj = Database::fetch_object($db_result))
 		{
@@ -521,23 +521,23 @@ class CourseBuilder
 			closedir($dir);
 		}
 	}
-	
+
 	/**
 	 * Build the glossarys
 	 */
 	function build_glossarys() {
 		$table_glossary = Database :: get_course_table(TABLE_GLOSSARY);
-		
-        if (!empty($this->course->type) && $this->course->type=='partial')        	
+
+        if (!empty($this->course->type) && $this->course->type=='partial')
         	$sql = 'SELECT * FROM '.$table_glossary.' g ';
         else
         	$sql = 'SELECT * FROM '.$table_glossary.' g ';
-		
+
 		$db_result = api_sql_query($sql, __FILE__, __LINE__);
 		while ($obj = Database::fetch_object($db_result))
 		{
 			$doc = new Glossary($obj->glossary_id, $obj->name, $obj->description, $obj->display_order);
 			$this->course->add_resource($doc);
 		}
-	}	
+	}
 }

+ 8 - 8
main/coursecopy/classes/CourseDescription.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: CourseDescription.class.php 4940 2005-05-10 13:46:14Z bmol $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';
@@ -57,7 +57,7 @@ class CourseDescription extends Resource
 	function show()
 	{
 		parent::show();
-		echo $this->title;	
+		echo $this->title;
 	}
 }
 ?>

+ 98 - 98
main/coursecopy/classes/CourseRestorer.class.php

@@ -81,7 +81,7 @@ class CourseRestorer
 	 * which the resources should be stored. Default: Current Dokeos-course.
 	 */
 	function restore($destination_course_code = '')
-	{		
+	{
 		if ($destination_course_code == '') {
 			$course_info = api_get_course_info();
 			$this->course->destination_db = $course_info['dbName'];
@@ -92,8 +92,8 @@ class CourseRestorer
 			$this->course->destination_path = $course_info['directory'];
 		}
 		// platform encoding
-		$course_charset = $this->course->encoding; 
-		
+		$course_charset = $this->course->encoding;
+
 		$this->restore_links();
 		$this->restore_tool_intro();
 		$this->restore_events();
@@ -144,7 +144,7 @@ class CourseRestorer
 		$table = Database :: get_course_table(TABLE_LINKED_RESOURCES, $this->course->destination_db);
 		foreach ($this->course->resources as $type => $resources)
 		{
-			if (is_array($resources)) 
+			if (is_array($resources))
 				foreach ($resources as $id => $resource)
 				{
 					$linked_resources = $resource->get_linked_resources();
@@ -164,8 +164,8 @@ class CourseRestorer
 	 * Restore documents
 	 */
 	function restore_documents()
-	{		
-		if ($this->course->has_resources(RESOURCE_DOCUMENT)) {			
+	{
+		if ($this->course->has_resources(RESOURCE_DOCUMENT)) {
 			$table = Database :: get_course_table(TABLE_DOCUMENT, $this->course->destination_db);
 			$resources = $this->course->resources;
 			$destination_course['dbName']= $this->course->destination_db;
@@ -174,26 +174,26 @@ class CourseRestorer
 				$path = api_get_path(SYS_COURSE_PATH).$this->course->destination_path.'/';
 				$perm = api_get_setting('permissions_for_new_directories');
 			    $perm = octdec(!empty($perm)?$perm:0770);
-			    $dirs = explode('/', dirname($document->path));	
+			    $dirs = explode('/', dirname($document->path));
 			    if (count($dirs)==1) {
 			    	if ($this->file_type==FOLDER) {
 			    		$new = substr($document->path, 8);
 			    		$created_dir = create_unexisting_directory($destination_course,api_get_user_id(),0, 0 ,$path.'document',$new,basename($new));
 			    	}
-			    } else {			    	    								
-					$my_temp = '';		
-					for ($i=1; $i<=count($dirs); $i++) {			
-						$my_temp .= $dirs[$i];					
-						if (!is_dir($path.'document/'.$my_temp)) {											
-							$sql = "SELECT id FROM ".$table." WHERE path='/".Database::escape_string($my_temp)."'"; 
-							//echo '<br>';							
-							$res = api_sql_query($sql, __FILE__, __LINE__);							
-							$num_result = Database::num_rows($res);					
+			    } else {
+					$my_temp = '';
+					for ($i=1; $i<=count($dirs); $i++) {
+						$my_temp .= $dirs[$i];
+						if (!is_dir($path.'document/'.$my_temp)) {
+							$sql = "SELECT id FROM ".$table." WHERE path='/".Database::escape_string($my_temp)."'";
+							//echo '<br>';
+							$res = api_sql_query($sql, __FILE__, __LINE__);
+							$num_result = Database::num_rows($res);
 							if ($num_result==0) {
 								$created_dir = create_unexisting_directory($destination_course,api_get_user_id(),0, 0 ,$path.'document','/'.$my_temp,basename($my_temp));
 							}
 						}
-						$my_temp .= '/';																
+						$my_temp .= '/';
 					}
 			    }
 			    /*
@@ -208,9 +208,9 @@ class CourseRestorer
 				echo '<br>';
 				*/
 				if ($document->file_type == DOCUMENT) {
-					if (file_exists($path.$document->path)) {	
+					if (file_exists($path.$document->path)) {
 						switch ($this->file_option) {
-							case FILE_OVERWRITE :								
+							case FILE_OVERWRITE :
 								$this->course->backup_path.'/'.$document->path;
 								copy($this->course->backup_path.'/'.$document->path, $path.$document->path);
 								$sql = "SELECT id FROM ".$table." WHERE path='/".substr($document->path, 9)."'";
@@ -287,7 +287,7 @@ class CourseRestorer
 							}
 						}
 					} // end file doesn't exist
-				}				
+				}
 				else
 				{
 					/*$sql = "SELECT id FROM ".$table." WHERE path = '/".Database::escape_string(substr($document->path, 9))."'";
@@ -295,7 +295,7 @@ class CourseRestorer
 					if( Database::num_rows($res)> 0)
 					{
 						$obj = Database::fetch_object($res);
-						$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = $obj->id;	
+						$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = $obj->id;
 					}
 					else
 					{
@@ -339,7 +339,7 @@ class CourseRestorer
 						case FILE_SKIP :
 							break;
 						case FILE_RENAME :
-							$i = 1; 
+							$i = 1;
 
 							$ext = explode('.', basename($document->path));
 
@@ -642,7 +642,7 @@ class CourseRestorer
 				} else {
 					$course_destination=$this->course->destination_path;
 				}
-				
+
 				$course_info=api_get_course_info(api_get_course_id());
 				$search='../courses/'.$course_info['path'].'/document';
 				$replace_search_by='../courses/'.$course_destination.'/document';
@@ -777,15 +777,15 @@ class CourseRestorer
 			$table_ans = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION, $this->course->destination_db);
 			$resources = $this->course->resources;
 			foreach ($resources[RESOURCE_SURVEY] as $id => $survey)
-			{	
-				
+			{
+
 				$sql_check =   'SELECT survey_id FROM '.$table_sur.'
 								WHERE code = "'.Database::escape_string($survey->code).'"
 								AND lang="'.Database::escape_string($survey->lang).'"
 								';
-				
+
 				$result_check = api_sql_query($sql_check, __FILE__, __LINE__);
-				
+
 				$doc = '';
 				$sql = "INSERT INTO ".$table_sur." " .
 						"SET code = '".Database::escape_string($survey->code)."', " .
@@ -804,19 +804,19 @@ class CourseRestorer
 						"answered = '0', " .
 						"invite_mail = '".Database::escape_string($survey->invite_mail)."', " .
 						"reminder_mail = '".Database::escape_string($survey->reminder_mail)."'";
-				
+
 				//An existing survey exists with the same code and the same language
 				if(Database::num_rows($result_check) == 1)
 				{
-										
+
 					switch ($this->file_option) {
-						
+
 						case FILE_SKIP:
 							//Do nothing
 							break;
-							
+
 						case FILE_RENAME:
-							
+
 							$survey_code = $survey->code.'_';
 							$i=1;
 							$temp_survey_code = $survey_code.$i;
@@ -825,7 +825,7 @@ class CourseRestorer
 								$temp_survey_code = $survey_code.++$i;
 							}
 							$survey_code = $temp_survey_code;
-							
+
 							$sql = "INSERT INTO ".$table_sur." " .
 									"SET code = '".Database::escape_string($survey_code)."', " .
 									"title = '".Database::escape_string($survey->title)."', " .
@@ -843,10 +843,10 @@ class CourseRestorer
 									"answered = '0', " .
 									"invite_mail = '".Database::escape_string($survey->invite_mail)."', " .
 									"reminder_mail = '".Database::escape_string($survey->reminder_mail)."'";
-							
+
 							//Insert the new source survey
 							api_sql_query($sql, __FILE__, __LINE__);
-							
+
 							$new_id = Database::get_last_insert_id();
 							$this->course->resources[RESOURCE_SURVEY][$id]->destination_id = $new_id;
 							foreach ($survey->question_ids as $index => $question_id)
@@ -861,30 +861,30 @@ class CourseRestorer
 										"question_id = ".$qid."";
 								api_sql_query($sql, __FILE__, __LINE__);
 							}
-							
+
 							break;
-							
+
 						case FILE_OVERWRITE:
-														
+
 							// Delete the existing survey with the same code and language and import the one of the source course
-							
+
 							// getting the information of the survey (used for when the survey is shared)
 							require_once(api_get_path(SYS_CODE_PATH).'survey/survey.lib.php');
-							
+
 							$sql_select_existing_survey = "SELECT * FROM $table_sur WHERE survey_id='".Database::escape_string(Database::result($result_check,0,0))."'";
 							$result = api_sql_query($sql_select_existing_survey, __FILE__, __LINE__);
 							$survey_data = Database::fetch_array($result,'ASSOC');
-							
+
 							// if the survey is shared => also delete the shared content
 							if (is_numeric($survey_data['survey_share']))
 							{
 								survey_manager::delete_survey($survey_data['survey_share'], true,$this->course->destination_db);
 							}
 							$return = survey_manager :: delete_survey($survey_data['survey_id'],false,$this->course->destination_db);
-							
+
 							//Insert the new source survey
 							api_sql_query($sql, __FILE__, __LINE__);
-							
+
 							$new_id = Database::get_last_insert_id();
 							$this->course->resources[RESOURCE_SURVEY][$id]->destination_id = $new_id;
 							foreach ($survey->question_ids as $index => $question_id)
@@ -899,14 +899,14 @@ class CourseRestorer
 										"question_id = ".$qid."";
 								api_sql_query($sql, __FILE__, __LINE__);
 							}
-							
+
 							break;
-							
+
 						default:
 							break;
 					}
-					
-					
+
+
 				}
 				//No existing survey with the same language and the same code, we just copy the survey
 				else
@@ -927,23 +927,23 @@ class CourseRestorer
 						api_sql_query($sql, __FILE__, __LINE__);
 					}
 				}
-				
+
 			}
 		}
 	}
-	
+
 	/**
 	 * Check availability of a survey code
 	 */
 	function is_survey_code_available($survey_code)
-	{		
+	{
 		$table_sur = Database :: get_course_table(TABLE_SURVEY, $this->course->destination_db);
 		$sql = "SELECT * FROM $table_sur WHERE code='".Database::escape_string($survey_code)."'";
 		$result = api_sql_query($sql, __FILE__, __LINE__);
 		if(Database::num_rows($result) > 0) return false; else return true;
-		
+
 	}
-	
+
 	/**
 	 * Restore survey-questions
 	 */
@@ -962,7 +962,7 @@ class CourseRestorer
 			}
 			$table_que = Database :: get_course_table(TABLE_SURVEY_QUESTION, $this->course->destination_db);
 			$table_ans = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION, $this->course->destination_db);
-			
+
 			$sql = "INSERT INTO ".$table_que." " .
 					"SET survey_id = 		'".Database::escape_string($question->survey_id)."', " .
 					"survey_question = 		'".Database::escape_string($question->survey_question)."', " .
@@ -973,7 +973,7 @@ class CourseRestorer
 					"shared_question_id = 	'".Database::escape_string($question->shared_question_id)."', " .
 					"max_value = 			'".Database::escape_string($question->max_value)."' ";
 			api_sql_query($sql, __FILE__, __LINE__);
-			
+
 			$new_id = Database::get_last_insert_id();
 			foreach ($question->answers as $index => $answer) {
 				$sql = "INSERT INTO ".$table_ans." " .
@@ -1033,9 +1033,9 @@ class CourseRestorer
 				$previous_item_ids = array();
 				$next_item_ids = array();
 				$old_prerequisite = array();
-				$old_refs = array();				
+				$old_refs = array();
 				$prerequisite_ids = array();
-				
+
 				foreach ($lp->get_items() as $index => $item) {
 					/*
 					if ($item['id'] != 0)
@@ -1053,17 +1053,17 @@ class CourseRestorer
 					} else {
 						$ref = $item['ref'];
 					}*/
-					
+
 					// we set the ref code here and then we update in a for loop
 					$ref = $item['ref'];
-					
+
 					//Dealing with path the same way as ref as some data has been put into path when it's a
 					//local resource
 					$path = Database::escape_string($item['path']);
 					if(strval(intval($path)) === $path) {
 						$path = $this->get_new_id($item['item_type'],$path);
 					}
-					
+
 					$sql = "INSERT INTO ".$table_item." SET " .
 							"lp_id = '".Database::escape_string($new_lp_id)."', " .
 							"item_type='".Database::escape_string($item['item_type'])."', " .
@@ -1081,7 +1081,7 @@ class CourseRestorer
 							"prerequisite = '".Database::escape_string($item['prerequisite'])."', " .
 							"parameters='".Database::escape_string($item['parameters'])."', " .
 							"launch_data = '".Database::escape_string($item['launch_dataprereq_type'])."'";
-							
+
 					api_sql_query($sql, __FILE__, __LINE__);
 					$new_item_id = Database::get_last_insert_id();
 					//save a link between old and new item IDs
@@ -1092,7 +1092,7 @@ class CourseRestorer
 					$previous_item_ids[$new_item_id] = $item['previous_item_id'];
 					//save a reference of items that need a next_item_id refresh
 					$next_item_ids[$new_item_id] = $item['next_item_id'];
-					
+
 					if (!empty($item['prerequisite'])) {
 						if ($lp->lp_type =='2') {
 							// if is an sco
@@ -1101,7 +1101,7 @@ class CourseRestorer
 							$old_prerequisite[$new_item_id]= $new_item_ids[$item['prerequisite']];
 						}
 					}
-					
+
 					if (!empty($ref)) {
 						if ($lp->lp_type =='2') {
 							// if is an sco
@@ -1110,26 +1110,26 @@ class CourseRestorer
 							$old_refs[$new_item_id]= $new_item_ids[$ref];
 						}
 					}
-					
+
 					$prerequisite_ids[$new_item_id] = $item['prerequisite'];
-				}			
-						
+				}
+
 				// updating prerequisites
 				foreach ($old_prerequisite  as $key=>$my_old_prerequisite) {
-					if($my_old_prerequisite != ''){																	
-						$sql = "UPDATE ".$table_item." SET prerequisite = '".$my_old_prerequisite."' WHERE id = '".$key."'  ";			
-						api_sql_query($sql, __FILE__, __LINE__);					
-					}																		
+					if($my_old_prerequisite != ''){
+						$sql = "UPDATE ".$table_item." SET prerequisite = '".$my_old_prerequisite."' WHERE id = '".$key."'  ";
+						api_sql_query($sql, __FILE__, __LINE__);
+					}
 				}
-				
+
 				//updating refs
-				foreach ($old_refs  as $key=>$my_old_ref) {					
-					if ($my_old_ref != '') {										
-						$sql = "UPDATE ".$table_item." SET ref = '".$my_old_ref."' WHERE id = '".$key."'  ";						
-						api_sql_query($sql, __FILE__, __LINE__);					
-					}																		
+				foreach ($old_refs  as $key=>$my_old_ref) {
+					if ($my_old_ref != '') {
+						$sql = "UPDATE ".$table_item." SET ref = '".$my_old_ref."' WHERE id = '".$key."'  ";
+						api_sql_query($sql, __FILE__, __LINE__);
+					}
 				}
-				
+
 				foreach ($parent_item_ids as $new_item_id => $parent_item_old_id) {
 					$parent_new_id = 0;
 					if($parent_item_old_id != 0){
@@ -1146,7 +1146,7 @@ class CourseRestorer
 					$sql = "UPDATE ".$table_item." SET previous_item_id = '".$previous_new_id."' WHERE id = '".$new_item_id."'";
 					api_sql_query($sql, __FILE__, __LINE__);
 				}
-				
+
 				foreach ($next_item_ids as $new_item_id => $next_item_old_id) {
 					$next_new_id = 0;
 					if($next_item_old_id != 0){
@@ -1154,7 +1154,7 @@ class CourseRestorer
 					}
 					$sql = "UPDATE ".$table_item." SET next_item_id = '".$next_new_id."' WHERE id = '".$new_item_id."'";
 					api_sql_query($sql, __FILE__, __LINE__);
-				}				
+				}
 
 				foreach ($prerequisite_ids as $new_item_id => $prerequisite_old_id)
 				{
@@ -1166,9 +1166,9 @@ class CourseRestorer
 					api_sql_query($sql, __FILE__, __LINE__);
 				}
 
-				$this->course->resources[RESOURCE_LEARNPATH][$id]->destination_id = $new_lp_id;				
+				$this->course->resources[RESOURCE_LEARNPATH][$id]->destination_id = $new_lp_id;
 			}
-				
+
 		}
 	}
 	/**
@@ -1181,20 +1181,20 @@ class CourseRestorer
 
 		$my_tbl_db_spa_origin=Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT,$my_course_info['dbName']);
 		$my_tbl_db_spa_destination = Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT, $this->course->destination_db);
-		
+
 		$my_tbl_db_origin=Database :: get_course_table(TABLE_STUDENT_PUBLICATION,$my_course_info['dbName']);
 		$my_tbl_db_destination = Database :: get_course_table(TABLE_STUDENT_PUBLICATION, $this->course->destination_db);
-		
+
 		$my_tbl_db_item_property_origin=Database :: get_course_table(TABLE_ITEM_PROPERTY, $my_course_info['dbName']);
 		$my_tbl_db_item_property_destination=Database :: get_course_table(TABLE_ITEM_PROPERTY, $this->course->destination_db);
-		
+
 		//query in student publication
-		
+
 		$query_sql_fin_sp='INSERT IGNORE INTO '.$my_tbl_db_destination.'' .
 		'(id,url,title,description,author,active,accepted,post_group_id,sent_date,' .
 		'filetype,has_properties,view_properties,qualification,date_of_qualification,' .
 		'parent_id,qualificator_id,session_id) ';
-		
+
 		$query_sql_ini_sp='SELECT id,url,title,description,author,active,accepted,post_group_id,' .
 		'sent_date,filetype,has_properties,view_properties,qualification,date_of_qualification,' .
 		'parent_id,qualificator_id,session_id FROM '.$my_tbl_db_origin.' WHERE filetype="folder" ';
@@ -1204,35 +1204,35 @@ class CourseRestorer
 		$origin='../../courses/'.$course_info['path'].'/work/';
 
 		self::allow_create_all_directory($origin,$destination,false);
-		
+
 		//query in item property
-		
+
 		$query_sql_fin_ip='INSERT IGNORE INTO '.$my_tbl_db_item_property_destination.'' .
 		'(tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,' .
 		'to_user_id,visibility,start_visible,end_visible) ';
-		
+
 		$query_sql_ini_ip='SELECT tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,' .
 		'lastedit_user_id,to_group_id,to_user_id,visibility,start_visible,
 		end_visible FROM '.$my_tbl_db_item_property_origin.' ip INNER JOIN '.$my_tbl_db_origin.' sp' .
 		' ON ip.ref=sp.id WHERE tool="work" ';
-		
-		
+
+
 		$query_sql_fin_sa='INSERT IGNORE INTO '.$my_tbl_db_spa_destination.'' .
 		'(id,expires_on,ends_on,add_to_calendar,enable_qualification,publication_id) ';
-		
+
 		$query_sql_ini_sa='SELECT sa.id,sa.expires_on,sa.ends_on,sa.add_to_calendar,sa.enable_qualification,sa.publication_id FROM '.$my_tbl_db_spa_origin.' sa INNER JOIN '.$my_tbl_db_origin.' sp
 		ON sa.publication_id=sp.id WHERE filetype="folder" ';
-		
+
 		$query_sql_sp    = $query_sql_fin_sp.$query_sql_ini_sp;
 		$query_sql_ip    = $query_sql_fin_ip.$query_sql_ini_ip;
 		$query_sql_sa    = $query_sql_fin_sa.$query_sql_ini_sa;
-		
+
 		api_sql_query($query_sql_sp,__FILE__,__LINE__);
 		api_sql_query($query_sql_ip,__FILE__,__LINE__);
 		api_sql_query($query_sql_sa,__FILE__,__LINE__);
-		
+
 	}
-	
+
 /**
  * copy all directory and sub directory
  * @param string The path origin
@@ -1240,11 +1240,11 @@ class CourseRestorer
  * @param boolean Option Overwrite
  * @return void()
  */
-	function allow_create_all_directory($source, $dest, $overwrite = false){		
+	function allow_create_all_directory($source, $dest, $overwrite = false){
    		if(!is_dir($dest)) {
     		mkdir($dest);
     	}
-    
+
 	    if ($handle = opendir($source)) {        // if the folder exploration is sucsessful, continue
 	        while (false !== ($file = readdir($handle))) { // as long as storing the next file to $file is successful, continue
 	            if ($file != '.' && $file != '..') {
@@ -1297,6 +1297,6 @@ class CourseRestorer
 
 			}
 		}
-	}	
+	}
 }
 ?>

+ 64 - 64
main/coursecopy/classes/CourseSelectForm.class.php

@@ -1,27 +1,27 @@
 <?php
 // $Id: CourseSelectForm.class.php 22200 2009-07-17 19:47:58Z iflorespaz $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004-2008 Dokeos SPRL
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Course.class.php';
@@ -39,7 +39,7 @@ class CourseSelectForm
 	 * @param boolean the document array will be serialize. This is used in the course_copy.php file
 	 */
 	function display_form($course, $hidden_fields = null, $avoid_serialize=false)
-	{		
+	{
 		$resource_titles[RESOURCE_EVENT] = get_lang('Events');
 		$resource_titles[RESOURCE_ANNOUNCEMENT] = get_lang('Announcements');
 		$resource_titles[RESOURCE_DOCUMENT] = get_lang('Documents');
@@ -88,10 +88,10 @@ class CourseSelectForm
 	 							break;
  							}
  						}
- 					}	
+ 					}
  				}
 			}
-		</script>		
+		</script>
 		<?php
 
 		//get destination course title
@@ -102,16 +102,16 @@ class CourseSelectForm
 				echo get_lang('DestinationCourse').' : '.$course_infos['title'];
 			echo '</h3>';
 		}
-		
+
 		echo '<p>';
 		echo get_lang('SelectResources');
 		echo '</p>';
-		
+
 		echo '<script language="javascript" src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>';
 		echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';
 		echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.api_get_path(WEB_CODE_PATH).'img/progress_bar.gif\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">';
 		echo '<input type="hidden" name="action" value="course_select_form"/>';
-		
+
 		foreach ($course->resources as $type => $resources) {
 			if (count($resources) > 0) {
 				switch ($type) {
@@ -130,7 +130,7 @@ class CourseSelectForm
 						echo '<div id="div_'.$type.'">';
 						echo '<blockquote>';
 						echo "[<a href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a> | <a href=\"javascript: void(0);\" onclick=\"javascript:setCheckbox('$type',false);\" >".get_lang('None')."</a>]";
-						echo '<br />'; 
+						echo '<br />';
 						foreach ($resources as $id => $resource) {
 							echo '<input type="checkbox" name="resource['.$type.']['.$id.']" id="resource['.$type.']['.$id.']"/>';
 							echo ' <label for="resource['.$type.']['.$id.']">';
@@ -145,15 +145,15 @@ class CourseSelectForm
 				}
 			}
 		}
-		
+
 		if ($avoid_serialize) {
 			//Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files)
 			// this is a known issue of serialize
 			$course->resources['document']= null;
-		} 
-		
+		}
+
 		echo '<input type="hidden" name="course" value="'.base64_encode(serialize($course)).'"/>';
-		
+
 		if (is_array($hidden_fields)) {
 			foreach ($hidden_fields as $key => $value) {
 				echo "\n";
@@ -167,10 +167,10 @@ class CourseSelectForm
 		echo '</form>';
 		echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>';
 	}
-	
-	
+
+
 	function display_hidden_quiz_questions($course)
-	{	
+	{
 		foreach ($course->resources as $type => $resources) {
 			if (count($resources) > 0) {
 				switch ($type) {
@@ -184,7 +184,7 @@ class CourseSelectForm
 			}
 		}
 	}
-	
+
 	function display_hidden_scorm_directories($course)
 	{
 		foreach ($course->resources as $type => $resources) {
@@ -198,65 +198,65 @@ class CourseSelectForm
 				}
 			}
 		}
-	}	
-	
+	}
+
 	/**
-	 * Get the posted course 
+	 * Get the posted course
 	 * @param string who calls the function? It can be copy_course, create_backup, import_backup or recycle_course
 	 * @return course The course-object with all resources selected by the user
 	 * in the form given by display_form(...)
 	 */
 	function get_posted_course($from='')
 	{
-		$course = unserialize(base64_decode($_POST['course']));				
-		//Create the resource DOCUMENT objects		
+		$course = unserialize(base64_decode($_POST['course']));
+		//Create the resource DOCUMENT objects
 		//Loading the results from the checkboxes of the javascript
 		$resource = $_POST['resource'][RESOURCE_DOCUMENT];
 		$table_doc = Database :: get_course_table(TABLE_DOCUMENT);
-		$table_prop = Database :: get_course_table(TABLE_ITEM_PROPERTY);				
-					
-		// Searching the documents resource that have been set to null because $avoid_serialize is true in the display_form() function 
-		if ($from=='copy_course') {			
+		$table_prop = Database :: get_course_table(TABLE_ITEM_PROPERTY);
+
+		// Searching the documents resource that have been set to null because $avoid_serialize is true in the display_form() function
+		if ($from=='copy_course') {
 			if (is_array($resource)) {
 				$resource = array_keys($resource);
-				foreach	($resource as $resource_item) {				
+				foreach	($resource as $resource_item) {
 					$sql = 'SELECT * FROM '.$table_doc.' d, '.$table_prop.' p WHERE tool = \''.TOOL_DOCUMENT.'\' AND p.ref = d.id AND p.visibility != 2 AND id = '.$resource_item.' ORDER BY path';
 					$db_result = api_sql_query($sql, __FILE__, __LINE__);
 					while ($obj = Database::fetch_object($db_result)) {
-						$doc = new Document($obj->id, $obj->path, $obj->comment, $obj->title, $obj->filetype, $obj->size);									
-						$course->add_resource($doc);						
-						// adding item property										
-						$sql = "SELECT * FROM $table_prop WHERE TOOL = '".RESOURCE_DOCUMENT."' AND ref='".$resource_item."'";					
+						$doc = new Document($obj->id, $obj->path, $obj->comment, $obj->title, $obj->filetype, $obj->size);
+						$course->add_resource($doc);
+						// adding item property
+						$sql = "SELECT * FROM $table_prop WHERE TOOL = '".RESOURCE_DOCUMENT."' AND ref='".$resource_item."'";
 						$res = api_sql_query($sql,__FILE__,__LINE__);
 						$all_properties = array ();
-						while ($item_property = Database::fetch_array($res,'ASSOC')) {						
+						while ($item_property = Database::fetch_array($res,'ASSOC')) {
 							$all_properties[] = $item_property;
 						}
 						$course->resources[RESOURCE_DOCUMENT][$resource_item]->item_properties = $all_properties;
-					}						
+					}
 				}
 			}
-		}	
-		
-		/*else {			
-			$documents = $_POST['resource'][RESOURCE_DOCUMENT];	
+		}
+
+		/*else {
+			$documents = $_POST['resource'][RESOURCE_DOCUMENT];
 			//print_r($course->resources );
 			foreach	($resource as $resource_item) {
-				echo $resource_item;					
+				echo $resource_item;
 				foreach($documents as $obj) {
 					print_r($obj);
-					
+
 					if ($obj->id==$resource_item) {
 						$doc = new Document($obj->id, $obj->path, $obj->comment, $obj->title, $obj->filetype, $obj->size);
-						print_r($doc);									
-						$course->add_resource($doc);		
+						print_r($doc);
+						$course->add_resource($doc);
 					}
 				}
-			}			
+			}
 		}*/
-		
+
 		if (is_array($course->resources)) {
-			foreach ($course->resources as $type => $resources) {	
+			foreach ($course->resources as $type => $resources) {
 				switch ($type) {
 					case RESOURCE_SURVEYQUESTION:
 						foreach($resources as $id => $obj) {
@@ -274,21 +274,21 @@ class CourseSelectForm
 						// Mark folders to import which are not selected by the user to import,
 						// but in which a document was selected.
 						$documents = $_POST['resource'][RESOURCE_DOCUMENT];
-						if (is_array($resources))						
-							foreach($resources as $id => $obj) {							
-								if( $obj->file_type == 'folder' && ! isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) && is_array($documents)) {								
-									foreach($documents as $id_to_check => $post_value) {									
+						if (is_array($resources))
+							foreach($resources as $id => $obj) {
+								if( $obj->file_type == 'folder' && ! isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) && is_array($documents)) {
+									foreach($documents as $id_to_check => $post_value) {
 										$obj_to_check = $resources[$id_to_check];
 										$shared_path_part = substr($obj_to_check->path,0,strlen($obj->path));
 										if($id_to_check != $id && $obj->path == $shared_path_part) {
-											$_POST['resource'][RESOURCE_DOCUMENT][$id] = 1;	
+											$_POST['resource'][RESOURCE_DOCUMENT][$id] = 1;
 											break;
-										}	
-									}	
-								}						
-							}						
-					default :		
-						if (is_array($resources)) {							 			
+										}
+									}
+								}
+							}
+					default :
+						if (is_array($resources)) {
 							foreach ($resources as $id => $obj) {
 								$resource_is_used_elsewhere = $course->is_linked_resource($obj);
 								// check if document is in a quiz (audio/video)
@@ -298,8 +298,8 @@ class CourseSelectForm
 									{
 										if($quiz->media == $id)
 										{
-											$resource_is_used_elsewhere = true;	
-										}	
+											$resource_is_used_elsewhere = true;
+										}
 									}
 								}
 								if (!isset ($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere)
@@ -307,11 +307,11 @@ class CourseSelectForm
 									unset ($course->resources[$type][$id]);
 								}
 							}
-						}											
+						}
 				}
 			}
 		}
-		return $course;		
+		return $course;
 	}
 }
 ?>

+ 7 - 7
main/coursecopy/classes/Document.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: Document.class.php 4733 2005-05-02 08:54:49Z bmol $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';

+ 15 - 15
main/coursecopy/classes/DummyCourseCreator.class.php

@@ -1,27 +1,27 @@
 <?php
 // $Id: DummyCourseCreator.class.php 15087 2008-04-25 04:37:14Z yannoo $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Course.class.php';
@@ -44,7 +44,7 @@ class DummyCourseCreator
 	 */
 	var $course;
 	/**
-	 * 
+	 *
 	 */
 	var $default_property = array();
 	/**
@@ -122,7 +122,7 @@ class DummyCourseCreator
 		foreach($directories as $path => $flag)
 		{
 			$path = substr($path,0,strlen($path)-1);
-			$document = new Document($doc_id++,'/'.$path, $this->get_dummy_content('description'),$this->get_dummy_content('title'),'folder',0);	
+			$document = new Document($doc_id++,'/'.$path, $this->get_dummy_content('description'),$this->get_dummy_content('title'),'folder',0);
 			$property['lastedit_type'] = 'FolderCreated';
 			$document->item_properties[] = $property;
 			$this->course->add_resource($document);
@@ -192,7 +192,7 @@ class DummyCourseCreator
 		}
 		// create links
 		$number_of_links = rand(5, 50);
-		$on_homepage = rand(0,20) == 0 ? 1 : 0; 
+		$on_homepage = rand(0,20) == 0 ? 1 : 0;
 		$property = $this->default_property;
 		$property['lastedit_type'] = 'LinkAdded';
 		$property['tool'] = TOOL_LINK;
@@ -271,7 +271,7 @@ class DummyCourseCreator
 				$resource = $resources[rand(0,count($resources)-1)];
 				$item = array();
 				$item['type'] = $resource->type;
-				$item['id'] = $resource->source_id;	
+				$item['id'] = $resource->source_id;
 				$item['display_order'] = $item_id;
 				$item['title'] = $this->get_dummy_content('title');
 				$item['description'] = $this->get_dummy_content('description');
@@ -279,14 +279,14 @@ class DummyCourseCreator
 				if( rand(0,5) == 1 && $item_id > 1)
 				{
 					$item['prereq_type'] = 'i';
-					$item['prereq'] = rand($global_item_id - $item_id,$global_item_id-1);	
+					$item['prereq'] = rand($global_item_id - $item_id,$global_item_id-1);
 				}
 				$chapter['items'][] = $item;
 				$global_item_id++;
 			}
-			$chapters[] = $chapter;	
+			$chapters[] = $chapter;
 		}
-		$lp = new Learnpath($i,$this->get_dummy_content('title'),$this->get_dummy_content('description'),1,$chapters);	
+		$lp = new Learnpath($i,$this->get_dummy_content('title'),$this->get_dummy_content('description'),1,$chapters);
 		$this->course->add_resource($lp);
 		}
 	}
@@ -305,7 +305,7 @@ class DummyCourseCreator
 		 case 'description':
 		 	$descriptions = explode(".",$dummy_text);
 		 	return $descriptions[rand(0,count($descriptions)-1)];
-		 	break;	
+		 	break;
 		 case 'title':
 		 	$dummy_text = str_replace(array("\n",'.',',',"\t"),array(' ','','',' '),$dummy_text);
 		 	$titles = explode(" ",$dummy_text);

+ 8 - 8
main/coursecopy/classes/Event.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: Event.class.php 5243 2005-05-31 08:34:12Z bmol $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';
@@ -70,7 +70,7 @@ class Event extends Resource
 	function show()
 	{
 		parent::show();
-		echo $this->title.' ('.$this->start_date.' -> '.$this->end_date.')';	
+		echo $this->title.' ('.$this->start_date.' -> '.$this->end_date.')';
 	}
 }
 ?>

+ 8 - 8
main/coursecopy/classes/Forum.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: Forum.class.php 3305 2005-02-03 12:44:01Z bmol $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';
@@ -134,6 +134,6 @@ class Forum extends Resource
 	function show()
 	{
 		parent::show();
-		echo $this->title;	
+		echo $this->title;
 	}
 }

+ 8 - 8
main/coursecopy/classes/ForumCategory.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: ForumCategory.class.php 3990 2005-03-31 09:55:18Z bmol $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';
@@ -69,6 +69,6 @@ class ForumCategory extends Resource
 	function show()
 	{
 		parent::show();
-		echo $this->title;	
+		echo $this->title;
 	}
 }

+ 8 - 8
main/coursecopy/classes/ForumPost.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: ForumPost.class.php 3305 2005-02-03 12:44:01Z bmol $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';
@@ -94,6 +94,6 @@ class ForumPost extends Resource
 	function show()
 	{
 		parent::show();
-		echo $this->title.' ('.$this->poster_name.', '.$this->post_time.')';	
+		echo $this->title.' ('.$this->poster_name.', '.$this->post_time.')';
 	}
 }

+ 9 - 9
main/coursecopy/classes/ForumTopic.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: ForumTopic.class.php 11365 2007-03-03 10:49:33Z yannoo $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';
@@ -89,7 +89,7 @@ class ForumTopic extends Resource
 	  * Weight
 	  */
 	 var $qualify_max;
-	 
+
 	 /**
 	 * Create a new ForumTopic
 	 */
@@ -117,6 +117,6 @@ class ForumTopic extends Resource
 	function show()
 	{
 		parent::show();
-		echo $this->title.' ('.$this->topic_poster_name.', '.$this->topic_time.')';	
+		echo $this->title.' ('.$this->topic_poster_name.', '.$this->topic_time.')';
 	}
 }

+ 10 - 10
main/coursecopy/classes/Glossary.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: Document.class.php 4733 2005-05-02 08:54:49Z bmol $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';
@@ -51,15 +51,15 @@ class Glossary extends Resource
 		$this->name = $name;
 		$this->description = $description;
 		$this->display_order = $display_order;
-	
-		
+
+
 	}
 	/**
 	 * Show this glossary
 	 */
 	function show() {
 		parent::show();
-		echo $this->name;	
+		echo $this->name;
 	}
 }
 ?>

+ 1 - 1
main/coursecopy/classes/Learnpath.class.php

@@ -122,7 +122,7 @@ class Learnpath extends Resource
 	function Learnpath($id,$type,$name,$path,$ref,$description,$content_local,$default_encoding,$default_view_mode,$prevent_reinit,$force_commit,$content_maker,$display_order,$js_lib,$content_license,$debug,$visibility,$items)
 	{
 		parent::Resource($id,RESOURCE_LEARNPATH);
-		$this->lp_type = $type; 
+		$this->lp_type = $type;
 		$this->name = $name;
 		$this->path = $path;
 		$this->ref = $ref;

+ 9 - 9
main/coursecopy/classes/Link.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: Link.class.php 6738 2005-10-28 07:59:36Z bmol $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';
@@ -63,7 +63,7 @@ class Link extends Resource
 		parent::Resource($id,RESOURCE_LINK);
 		$this->title = $title;
 		$this->url = $url;
-		$this->description = $description;	
+		$this->description = $description;
 		$this->category_id = $category_id;
 		$this->on_homepage = $on_homepage;
 	}
@@ -73,7 +73,7 @@ class Link extends Resource
 	function show()
 	{
 		parent::show();
-		echo $this->title.' ('.$this->url.')';	
+		echo $this->title.' ('.$this->url.')';
 	}
 }
 ?>

+ 8 - 8
main/coursecopy/classes/LinkCategory.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: LinkCategory.class.php 15087 2008-04-25 04:37:14Z yannoo $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';
@@ -55,7 +55,7 @@ class LinkCategory extends Resource
 		$this->title = $title;
 		$this->description = $description;
 		$this->display_order = $display_order;
-	}	
+	}
 	/**
 	 * Show this LinkCategory
 	 */

+ 8 - 8
main/coursecopy/classes/Quiz.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: Quiz.class.php 15802 2008-07-17 04:52:13Z yannoo $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';
@@ -124,6 +124,6 @@ class Quiz extends Resource
 	function show()
 	{
 		parent::show();
-		echo $this->title;	
+		echo $this->title;
 	}
 }

+ 8 - 8
main/coursecopy/classes/QuizQuestion.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: QuizQuestion.class.php 18549 2009-02-17 18:08:58Z cfasanando $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';
@@ -105,6 +105,6 @@ class QuizQuestion extends Resource
 	function show()
 	{
 		parent::show();
-		echo $this->question;	
+		echo $this->question;
 	}
 }

+ 7 - 7
main/coursecopy/classes/Survey.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004-2007 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';

+ 8 - 8
main/coursecopy/classes/SurveyInvitation.class.php

@@ -1,26 +1,26 @@
 <?php // $Id: $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004-2007 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';
@@ -76,7 +76,7 @@ class SurveyInvitation extends Resource
 	function show()
 	{
 		parent::show();
-		echo $this->invitation_code;	
+		echo $this->invitation_code;
 	}
 }
 ?>

+ 9 - 9
main/coursecopy/classes/SurveyQuestion.class.php

@@ -1,26 +1,26 @@
 <?php // $Id:  $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004-2007 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 require_once 'Resource.class.php';
@@ -77,7 +77,7 @@ class SurveyQuestion extends Resource
 	 * @param int	 $shared_question_id
 	 * @param int	 $max_value
 	 */
-	function SurveyQuestion($id,$survey_id,$survey_question,$survey_question_comment, 
+	function SurveyQuestion($id,$survey_id,$survey_question,$survey_question_comment,
 							$type,$display,$sort,$shared_question_id,$max_value)
 	{
 		parent::Resource($id,RESOURCE_SURVEYQUESTION);
@@ -109,7 +109,7 @@ class SurveyQuestion extends Resource
 	function show()
 	{
 		parent::show();
-		echo $this->survey_question;	
+		echo $this->survey_question;
 	}
 }
 ?>

+ 17 - 17
main/coursecopy/copy_course.php

@@ -1,32 +1,32 @@
 <?php
 // $Id: copy_course.php 22204 2009-07-17 20:31:35Z iflorespaz $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 /**
  * ==============================================================================
  * Copy resources from one course to another one.
- * 
+ *
  * @author Bart Mollet <bart.mollet@hogent.be>
  * @package dokeos.backup
  * ==============================================================================
@@ -35,8 +35,8 @@
 ==============================================================================
 		INIT SECTION
 ==============================================================================
-*/ 
-// name of the language file that needs to be included 
+*/
+// name of the language file that needs to be included
 $language_file = array('exercice', 'coursebackup', 'admin');
 require_once '../inc/global.inc.php';
 include_once api_get_path(LIBRARY_PATH) . 'fileManage.lib.php';
@@ -65,11 +65,11 @@ Display::display_header($nameTools);
 ==============================================================================
 		MAIN CODE
 ==============================================================================
-*/ 
+*/
 // If a CourseSelectForm is posted or we should copy all resources, then copy them
 if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (isset ($_POST['copy_option']) && $_POST['copy_option'] == 'full_copy')) {
 	if (isset ($_POST['action']) && $_POST['action'] == 'course_select_form') {
-		$course = CourseSelectForm :: get_posted_course('copy_course');		
+		$course = CourseSelectForm :: get_posted_course('copy_course');
 	} else {
 		$cb = new CourseBuilder();
 		$course = $cb->build();
@@ -81,7 +81,7 @@ if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (i
 } elseif (isset ($_POST['copy_option']) && $_POST['copy_option'] == 'select_items') {
 	// Else, if a CourseSelectForm is requested, show it
 	Display::display_normal_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz'));
-	if (api_get_setting('show_glossary_in_documents') != 'none') { 
+	if (api_get_setting('show_glossary_in_documents') != 'none') {
 		Display::display_normal_message(get_lang('ToExportDocumentsWithGlossaryYouHaveToSelectGlossary'));
 	}
 	$cb = new CourseBuilder();
@@ -91,7 +91,7 @@ if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (i
 	$hidden_fields['same_file_name_option'] = $_POST['same_file_name_option'];
 	$hidden_fields['destination_course'] = $_POST['destination_course'];
 	CourseSelectForm :: display_form($course, $hidden_fields, true);
-} else {	
+} else {
 	$table_c = Database :: get_main_table(TABLE_MAIN_COURSE);
 	$table_cu = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
 	$user_info = api_get_user_info();
@@ -103,7 +103,7 @@ if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (i
 	$sql .= ' AND target_course_code IS NULL AND cu.user_id = '.$user_info['user_id'].' AND c.code != '."'".$course_info['sysCode']."'".' ORDER BY title ASC';
 	$res = api_sql_query($sql,__FILE__,__LINE__);
 	if( Database::num_rows($res) == 0) {
-		Display::display_normal_message(get_lang('NoDestinationCoursesAvailable'));	
+		Display::display_normal_message(get_lang('NoDestinationCoursesAvailable'));
 	} else {
 ?>
 	<form method="post" action="copy_course.php">
@@ -144,8 +144,8 @@ if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (i
 }
 /*
 ==============================================================================
-		FOOTER 
+		FOOTER
 ==============================================================================
-*/ 
+*/
 Display::display_footer();
 ?>

+ 16 - 16
main/coursecopy/create_backup.php

@@ -1,38 +1,38 @@
 <?php
 // $Id: create_backup.php 20084 2009-04-24 20:10:43Z aportugal $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos SPRL
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 /**
  * ==============================================================================
  * Create a backup.
- * 
+ *
  * @author Bart Mollet <bart.mollet@hogent.be>
  * @package dokeos.backup
  * ==============================================================================
  */
 
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = array ('exercice', 'admin', 'coursebackup');
 
 // including the global file
@@ -75,7 +75,7 @@ api_display_tool_title($nameTools);
 ==============================================================================
 		MAIN CODE
 ==============================================================================
-*/ 
+*/
 if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (isset ($_POST['backup_option']) && $_POST['backup_option'] == 'full_backup'))
 {
 	if (isset ($_POST['action']) && $_POST['action'] == 'course_select_form')
@@ -105,7 +105,7 @@ if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (i
 elseif (isset ($_POST['backup_option']) && $_POST['backup_option'] == 'select_items')
 {
 	$cb = new CourseBuilder('partial');
-	$course = $cb->build();	
+	$course = $cb->build();
 	Display::display_normal_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz'));
 	CourseSelectForm :: display_form($course);
 }
@@ -120,7 +120,7 @@ else
 	else
 	{
 		echo get_lang('SelectOptionForBackup');
-		
+
 		include_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
 		$form = new FormValidator('create_backup_form','POST');
 		$renderer = $form->defaultRenderer();
@@ -129,18 +129,18 @@ else
 		$form->addElement('radio', 'backup_option', '',  get_lang('LetMeSelectItems'), 'select_items');
 		$form->addElement('html','<br />');
 		$form->addElement('style_submit_button', null, get_lang('CreateBackup'), 'class="save"');
-		
+
 		$form->add_progress_bar();
-		
+
 		$values['backup_option'] = 'full_backup';
 		$form->setDefaults($values);
-		
+
 		$form->display();
 	}
 }
 /*
 ==============================================================================
-		FOOTER 
+		FOOTER
 ==============================================================================
 */
 Display::display_footer();

+ 39 - 39
main/coursecopy/import_backup.php

@@ -1,31 +1,31 @@
 <?php // $Id: import_backup.php 20448 2009-05-10 10:17:22Z ivantcholakov $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004-2008 Dokeos SPRL
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 /**
  * ==============================================================================
  * Import a backup.
- * 
+ *
  * @author Bart Mollet <bart.mollet@hogent.be>
  * @package dokeos.backup
  * ==============================================================================
@@ -34,8 +34,8 @@
 ==============================================================================
 		INIT SECTION
 ==============================================================================
-*/ 
-// name of the language file that needs to be included 
+*/
+// name of the language file that needs to be included
 $language_file = array('exercice', 'coursebackup', 'admin');
 
 // including the global file
@@ -44,7 +44,7 @@ include ('../inc/global.inc.php');
 // Check access rights (only teachers are allowed here)
 if( ! api_is_allowed_to_edit())
 {
-	api_not_allowed(true);	
+	api_not_allowed(true);
 }
 
 //remove memory and time limits as much as possible as this might be a long process...
@@ -79,17 +79,17 @@ api_display_tool_title($nameTools);
 ==============================================================================
 		MAIN CODE
 ==============================================================================
-*/ 
+*/
 
 if((isset($_POST['action']) && $_POST['action'] == 'course_select_form' ) || (isset($_POST['import_option']) && $_POST['import_option'] == 'full_backup' )) {
-	$error=false;	
+	$error=false;
 	if (isset($_POST['action']) && $_POST['action'] == 'course_select_form') {
 		// partial backup here we recover the documents posted
 		$course = CourseSelectForm::get_posted_course();
-						
+
 	} else {
 		if( $_POST['backup_type'] == 'server') {
-			$filename = $_POST['backup_server'];	
+			$filename = $_POST['backup_server'];
 			$delete_file = false;
 		} else {
 			if($_FILES['backup']['error']==0){
@@ -108,9 +108,9 @@ if((isset($_POST['action']) && $_POST['action'] == 'course_select_form' ) || (is
 		  $course = CourseArchiver::read_course($filename,$delete_file);
         }
 	}
-	
-	if(!$error && $course->has_resources()) {		
-		$cr = new CourseRestorer($course);		
+
+	if(!$error && $course->has_resources()) {
+		$cr = new CourseRestorer($course);
 		$cr->set_file_option($_POST['same_file_name_option']);
 		$cr->restore();
 		Display::display_normal_message(get_lang('ImportFinished').
@@ -129,43 +129,43 @@ if((isset($_POST['action']) && $_POST['action'] == 'course_select_form' ) || (is
 		}
 	}
 	CourseArchiver::clean_backup_dir();
-} elseif (isset($_POST['import_option']) && $_POST['import_option'] == 'select_items') {	
+} elseif (isset($_POST['import_option']) && $_POST['import_option'] == 'select_items') {
 	if( $_POST['backup_type'] == 'server') {
 		$filename = $_POST['backup_server'];
-		$delete_file = false;	
+		$delete_file = false;
 	} else {
 		$filename = CourseArchiver::import_uploaded_file($_FILES['backup']['tmp_name']);
 		$delete_file = true;
 	}
-	$course = CourseArchiver::read_course($filename,$delete_file);	
+	$course = CourseArchiver::read_course($filename,$delete_file);
 	if ($course->has_resources() && ($filename !== false)) {
 		CourseSelectForm::display_form($course,array('same_file_name_option'=>$_POST['same_file_name_option']));
 	} elseif ($filename === false) {
     	Display::display_error_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin').
                 '<a class="bottom-link" href="import_backup.php?'.api_get_cidreq().'">&lt;&lt; '.get_lang('TryAgain').'</a>',false);
     } else {
-		Display::display_warning_message(get_lang('NoResourcesInBackupFile').	
+		Display::display_warning_message(get_lang('NoResourcesInBackupFile').
                 '<a class="bottom-link" href="import_backup.php?'.api_get_cidreq().'">&lt;&lt; '.get_lang('TryAgain').'</a>',false);
 	}
 } else {
 	$user = api_get_user_info();
 	$backups = CourseArchiver::get_available_backups($is_platformAdmin?null:$user['user_id']);
 	$backups_available = (count($backups)>0);
-	
+
 	echo get_lang('SelectBackupFile').'<br /><br />';
-	
+
 	include (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
 	$form = new FormValidator('import_backup_form','POST','import_backup.php', '','multipart/form-data');
-	
+
 	$renderer = $form->defaultRenderer();
 	$renderer->setElementTemplate('<div>{element}</div> ');
-	
+
 	$form->addElement('hidden','action', 'restore_backup');
-	
+
 	$form->addElement('radio', 'backup_type', '', get_lang('LocalFile'), 'local', 'id="bt_local" class="checkbox" onclick="javascript:document.import_backup_form.backup_server.disabled=true;document.import_backup_form.backup.disabled=false;"');
 	$form->addElement('file', 'backup', '', 'style="margin-left: 50px;"');
 	$form->addElement('html', '<br />');
-	
+
 	if( $backups_available ){
 		$form->addElement('radio', 'backup_type', '', get_lang('ServerFile'), 'server', 'id="bt_server" class="checkbox" onclick="javascript:document.import_backup_form.backup_server.disabled=false;document.import_backup_form.backup.disabled=true;"');
 		$options['null'] = '-';
@@ -180,37 +180,37 @@ if((isset($_POST['action']) && $_POST['action'] == 'course_select_form' ) || (is
 	{
 		$form->addElement('radio', '', '', '<i>'.get_lang('NoBackupsAvailable').'</i>', '', 'disabled="true"');
 	}
-	
+
 	$form->addElement('html', '<br /><br />');
-	
+
 	$form->addElement('radio', 'import_option', '', get_lang('ImportFullBackup'), 'full_backup', 'id="import_option_1" class="checkbox"');
 	$form->addElement('radio', 'import_option', '', get_lang('LetMeSelectItems'), 'select_items', 'id="import_option_2" class="checkbox"');
-	
+
 	$form->addElement('html', '<br /><br />');
-	
+
 	$form->addElement('html', get_lang('SameFilename'));
 	$form->addElement('html', '<br /><br />');
 	$form->addElement('radio', 'same_file_name_option', '', get_lang('SameFilenameSkip'), FILE_SKIP, 'id="same_file_name_option_1" class="checkbox"');
 	$form->addElement('radio', 'same_file_name_option', '', get_lang('SameFilenameRename'), FILE_RENAME, 'id="same_file_name_option_2" class="checkbox"');
 	$form->addElement('radio', 'same_file_name_option', '', get_lang('SameFilenameOverwrite'), FILE_OVERWRITE, 'id="same_file_name_option_3" class="checkbox"');
-	
+
 	$form->addElement('html', '<br />');
 	$form->addElement('style_submit_button', null, get_lang('ImportBackup'), 'class="save"');
-	
+
 	$values['backup_type'] = 'local';
 	$values['import_option'] = 'full_backup';
 	$values['same_file_name_option'] = FILE_OVERWRITE;
 	$form->setDefaults($values);
-	
+
 	$form->add_progress_bar();
-	
+
 	$form->display();
-		
+
 }
 /*
 ==============================================================================
-		FOOTER 
+		FOOTER
 ==============================================================================
-*/ 
+*/
 Display::display_footer();
 ?>

+ 15 - 15
main/coursecopy/recycle_course.php

@@ -1,37 +1,37 @@
 <?php // $Id: recycle_course.php 19948 2009-04-21 17:27:59Z juliomontoya $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Bart Mollet (bart.mollet@hogent.be)
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 /**
  * ==============================================================================
  * Delete resources from a course.
- * 
+ *
  * @author Bart Mollet <bart.mollet@hogent.be>
  * @package dokeos.backup
  * ==============================================================================
  */
 
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = array ('exercice', 'admin', 'course_info', 'coursebackup');
 
 // including the global file
@@ -39,7 +39,7 @@ include ('../inc/global.inc.php');
 
 // Check access rights (only teachers are allowed here)
 if( ! api_is_allowed_to_edit()) {
-	api_not_allowed(true);	
+	api_not_allowed(true);
 }
 // section for the tabs
 $this_section=SECTION_COURSES;
@@ -64,26 +64,26 @@ api_display_tool_title($nameTools);
 ==============================================================================
 		MAIN CODE
 ==============================================================================
-*/ 
+*/
 if(  (isset($_POST['action']) && $_POST['action'] == 'course_select_form' ) || (isset($_POST['recycle_option']) && $_POST['recycle_option'] == 'full_backup' ) ) {
 	if(isset($_POST['action']) && $_POST['action'] == 'course_select_form' ) {
 		$course = CourseSelectForm::get_posted_course();
 	} else {
 		$cb = new CourseBuilder();
-		$course = $cb->build();	
+		$course = $cb->build();
 	}
 	$cr = new CourseRecycler($course);
 	$cr->recycle();
 	Display::display_confirmation_message(get_lang('RecycleFinished'));
 } elseif( isset($_POST['recycle_option']) && $_POST['recycle_option'] == 'select_items') {
 	$cb = new CourseBuilder();
-	$course = $cb->build();	
+	$course = $cb->build();
 	CourseSelectForm::display_form($course);
 } else {
 	$cb = new CourseBuilder();
 	$course = $cb->build();
 	if( ! $course->has_resources()) {
-		echo get_lang('NoResourcesToRecycle');	
+		echo get_lang('NoResourcesToRecycle');
 	} else {
 		Display::display_warning_message(get_lang('RecycleWarning'),false);
 	?>
@@ -97,7 +97,7 @@ if(  (isset($_POST['action']) && $_POST['action'] == 'course_select_form' ) || (
 	<br/>
 	<button class="save" type="submit"><?php echo get_lang('RecycleCourse') ?></button>
 	</form>
-	<?php	
+	<?php
 	}
 }
 // Display the footer

+ 7 - 7
main/create_course/add_course.php

@@ -10,10 +10,10 @@
 ==============================================================================
 */
 
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = "create_course";
 
-//delete the globals["_cid"] we don't need it here 
+//delete the globals["_cid"] we don't need it here
 $cidReset = true; // Flag forcing the 'current course' reset
 
 // including the global file
@@ -65,7 +65,7 @@ $form->addElement('header', '', $tool_name);
 //title
 $form->add_textfield('title',get_lang('CourseName'),true,array('size'=>'60'));
 $form->applyFilter('title', 'html_filter');
-	
+
 $form->addElement('static',null,null,get_lang('Ex'));
 $categories_select = $form->addElement('select', 'category_code', get_lang('Fac'), $categories);
 $form->applyFilter('category_code', 'html_filter');
@@ -103,13 +103,13 @@ if ($form->validate()) {
 	$category_code = $course_values['category_code'];
 	$title = $course_values['title'];
 	$course_language = $course_values['course_language'];
-	
+
 	if (trim($wanted_code) == '') {
 		$wanted_code = generate_course_code(api_substr($title,0,$maxlength));
 	}
-	
+
 	$keys = define_course_keys($wanted_code, "", $_configuration['db_prefix']);
-	
+
 	$sql_check = sprintf('SELECT * FROM '.$table_course.' WHERE visual_code = "%s"',Database :: escape_string($wanted_code));
 	$result_check = api_sql_query($sql_check,__FILE__,__LINE__); //I don't know why this api function doesn't work...
 	if ( Database::num_rows($result_check)<1 ) {
@@ -139,7 +139,7 @@ if ($form->validate()) {
 		$form->display();
 		//echo '<p>'.get_lang('CourseCodeAlreadyExistExplained').'</p>';
 	}
-		
+
 } else {
 	// Display the form
 	$form->display();

+ 1 - 1
main/cron/user_import/client.php

@@ -24,7 +24,7 @@ if(php_sapi_name()!='cli')
 
 // include nusoap library
 require_once(api_get_path(LIBRARY_PATH).'nusoap/nusoap.php');
- 
+
 // create client
 $client = new nusoap_client(api_get_path(WEB_CODE_PATH).'cron/user_import/service.php');
 

+ 42 - 42
main/document/create_document.php

@@ -22,7 +22,7 @@
 
 	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-	
+
 ==============================================================================
 */
 /**
@@ -40,14 +40,14 @@
 ==============================================================================
 */
 
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = 'document';
 include ('../inc/global.inc.php');
 $_SESSION['whereami'] = 'document/create';
 $this_section = SECTION_COURSES;
 
 $htmlHeadXtra[]='<script>
-	
+
 function InnerDialogLoaded()
 {
 	/*
@@ -80,9 +80,9 @@ function InnerDialogLoaded()
 		return null ;
 	}
 
-	var B = new EditorFrame.FCKToolbarButton(\'Templates\', EditorFrame.FCKLang.Templates);		
+	var B = new EditorFrame.FCKToolbarButton(\'Templates\', EditorFrame.FCKLang.Templates);
 	return B.ClickFrame();
-};	
+};
 
 	var temp=false;
 	var temp2=false;
@@ -90,9 +90,9 @@ function InnerDialogLoaded()
 	var load_default_template = '. ((isset($_POST['submit']) || empty($_SERVER['QUERY_STRING'])) ? 'false' : 'true' ) .';
 
 	function launch_templates()
-	{		
-		//document.getElementById(\'frmModel\').style.display="block";				
-		//document.getElementById(\'content___Frame\').width=\'70%\'; 		
+	{
+		//document.getElementById(\'frmModel\').style.display="block";
+		//document.getElementById(\'content___Frame\').width=\'70%\';
 		//window.frames[0].FCKToolbarItems.GetItem("Template").Click;
 	}
 
@@ -107,22 +107,22 @@ function InnerDialogLoaded()
 		if(temp==true){
 			// This functions shows that you can interact directly with the editor area
 			// DOM. In this way you have the freedom to do anything you want with it.
-	
+
 			// Get the editor instance that we want to interact with.
 			var oEditor = FCKeditorAPI.GetInstance(\'content\') ;
-	
+
 			// Get the Editor Area DOM (Document object).
 			var oDOM = oEditor.EditorDocument ;
-	
+
 			var iLength ;
 			var contentText ;
 			var contentTextArray;
 			var bestandsnaamNieuw = "";
 			var bestandsnaamOud = "";
-	
+
 			// The are two diffent ways to get the text (without HTML markups).
 			// It is browser specific.
-	
+
 			if( document.all )		// If Internet Explorer.
 			{
 				contentText = oDOM.body.innerText ;
@@ -135,7 +135,7 @@ function InnerDialogLoaded()
 			}
 
 			var index=contentText.indexOf("/*<![CDATA");
-			contentText=contentText.substr(0,index);			
+			contentText=contentText.substr(0,index);
 
 			// Compose title if there is none
 			contentTextArray = contentText.split(\' \') ;
@@ -151,7 +151,7 @@ function InnerDialogLoaded()
 					bestandsnaamNieuw += contentTextArray[x];
 				}
 			}
-			
+
 		// comment see FS#3335
 		//	if(document.getElementById(\'title_edited\').value == "false")
 		//	{
@@ -160,7 +160,7 @@ function InnerDialogLoaded()
 		//			document.getElementById(\'title\').value = bestandsnaamNieuw;
 		//		}
 		//	}
-		
+
 		}
 		temp=true;
 	}
@@ -243,7 +243,7 @@ $relative_url='';
 
 for($i=0;$i<($count_dir);$i++)
 {
-	$relative_url.='../';	
+	$relative_url.='../';
 }
 
 // we do this in order to avoid the condition in html_editor.php ==> if ($this -> fck_editor->Config['CreateDocumentWebDir']=='' || $this -> fck_editor->Config['CreateDocumentDir']== '')
@@ -286,7 +286,7 @@ if (isset ($_SESSION['_gid']) && $_SESSION['_gid'] != '') {
 	$path = explode('/', $dir);
 	if ('/'.$path[1] != $group['directory']) {
 		api_not_allowed(true);
-	}	
+	}
 }
 $interbreadcrumb[] = array ("url" => "./document.php?curdirpath=".urlencode($_GET['dir']).$req_gid, "name" => get_lang('Documents'));
 
@@ -346,20 +346,20 @@ $renderer->setElementTemplate($filename_template, 'filename');
 
 // initialize group array
 $group = array();
-	
+
 // If allowed, add element for document title
-if (api_get_setting('use_document_title') == 'true') {	
+if (api_get_setting('use_document_title') == 'true') {
 	//$group[]= $form->add_textfield('title', get_lang('Title'),true,'class="input_titles" id="title"');
-	// replace the 	add_textfield with this	
+	// replace the 	add_textfield with this
 	$group[]=$form->createElement('text','title',get_lang('Title'),'class="input_titles" id="title"');
-	//$form->applyFilter('title','trim');		
-	//$form->addRule('title', get_lang('ThisFieldIsRequired'), 'required');		
-} else {		
+	//$form->applyFilter('title','trim');
+	//$form->addRule('title', get_lang('ThisFieldIsRequired'), 'required');
+} else {
 	//$form->add_textfield('filename', get_lang('FileName'),true,'class="input_titles" id="filename"  onblur="check_if_still_empty()"');
-	// replace the 	add_textfield with this 
-	$group[]=$form->createElement('text','filename',get_lang('FileName'),'class="input_titles" id="filename"  onblur="check_if_still_empty()"');		
-	//$form->applyFilter('filename','trim');	
-	//$form->addRule('filename', get_lang('ThisFieldIsRequired'), 'required');				
+	// replace the 	add_textfield with this
+	$group[]=$form->createElement('text','filename',get_lang('FileName'),'class="input_titles" id="filename"  onblur="check_if_still_empty()"');
+	//$form->applyFilter('filename','trim');
+	//$form->addRule('filename', get_lang('ThisFieldIsRequired'), 'required');
 	//$form->addRule('filename', get_lang('FileExists'), 'callback', 'document_exists');
 }
 
@@ -372,20 +372,20 @@ if(!empty($_SESSION['_gid'])) {
 $form->addGroup($group, 'filename_group', get_lang('FileName') ,'&nbsp;&nbsp;&nbsp;', false);
 $form->addRule('filename_group', get_lang('ThisFieldIsRequired'), 'required');
 
-if (api_get_setting('use_document_title') == 'true') {			
+if (api_get_setting('use_document_title') == 'true') {
 	$form->addGroupRule('filename_group', array(
 	  'title' => array(
-	    array(get_lang('ThisFieldIsRequired'), 'required'),	   
+	    array(get_lang('ThisFieldIsRequired'), 'required'),
 	    array(get_lang('FileExists'),'callback', 'document_exists')
 	    )
 	));
 } else {
 	$form->addGroupRule('filename_group', array(
-	  'filename' => array(	   	    
+	  'filename' => array(
 		array(get_lang('ThisFieldIsRequired'), 'required'),
 	    array(get_lang('FileExists'),'callback', 'document_exists')
 	    )
-	));		
+	));
 }
 
 //$form->addElement('style_submit_button', 'submit', get_lang('SaveDocument'), 'class="save"');
@@ -408,25 +408,25 @@ $form->addElement('html','<div id="frmModel" style="display:block; height:525px;
 if ($form->validate()) {
 	$values = $form->exportValues();
 	$readonly = isset($values['readonly']) ? 1 : 0;
-	
+
 	$values['title']=addslashes(trim($values['title']));
 
-	$clean_val=$values['filename']; 
+	$clean_val=$values['filename'];
 
 	$clean_val=Security::remove_XSS($clean_val);
 	$clean_val=replace_dangerous_char(($clean_val));
 	$clean_val=disable_dangerous_file($clean_val);
 	$clean_val=replace_accents($clean_val);
 
-	
+
 	$values['filename']=$clean_val;
-	
+
 	if (api_get_setting('use_document_title') != 'true') {
 		$values['title'] = $values['filename'];
 	} else	{
-		$values['filename'] = $values['title'];	
+		$values['filename'] = $values['title'];
 	}
-	
+
 	$filename = replace_accents($values['filename']);
 	$texte = $values['content'];
 	$texte=Security::remove_XSS($texte,COURSEMANAGERLOWSECURITY);
@@ -436,7 +436,7 @@ if ($form->validate()) {
 		$texte = str_replace('</head>', '<link rel="stylesheet" href="./css/frames.css" type="text/css" /></head>', $texte);
 	}
 	if ($fp = @ fopen($filepath.$filename.'.'.$extension, 'w')) {
-		$texte = text_filter($texte);		
+		$texte = text_filter($texte);
 		$content = str_replace(api_get_path('WEB_COURSE_PATH'), $_configuration['url_append'].'/courses/', $texte);
 		// change the path of mp3 to absolute
 		// first regexp deals with ../../../ urls
@@ -444,7 +444,7 @@ if ($form->validate()) {
 		//$content = preg_replace("|(flashvars=\"file=)(\.+/)+|","$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/',$content);
 		//second regexp deals with audio/ urls
 		// Disabled by Ivan Tcholakov.
-		//$content = preg_replace("|(flashvars=\"file=)([^/]+)/|","$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/',$content);		 		 
+		//$content = preg_replace("|(flashvars=\"file=)([^/]+)/|","$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/',$content);
 		fputs($fp, $content);
 		fclose($fp);
 		$files_perm = api_get_setting('permissions_for_new_files');
@@ -461,7 +461,7 @@ if ($form->validate()) {
 		}
 
 		if (!is_file($filepath.'css/frames.css')) {
-			//make a copy of the current css for the new document			
+			//make a copy of the current css for the new document
 			copy(api_get_path(SYS_CODE_PATH).'css/'.api_get_setting('stylesheets').'/frames.css', $filepath.'css/frames.css');
 			$doc_id = add_document($_course, $dir.'css/frames.css', 'file', filesize($filepath.'css/frames.css'), 'frames.css');
 			api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id']);
@@ -493,7 +493,7 @@ if ($form->validate()) {
 		} else {
 			Display :: display_header($nameTools, "Doc");
 			Display :: display_error_message(get_lang('Impossible'));
-			Display :: display_footer();		
+			Display :: display_footer();
 		}
 	} else {
 		Display :: display_header($nameTools, "Doc");

+ 62 - 62
main/document/document.inc.php

@@ -35,7 +35,7 @@
 
 
 /**
- * Builds the form thats enables the user to 
+ * Builds the form thats enables the user to
  * select a directory to browse/upload in
  *
  * @param array 	An array containing the folders we want to be able to select
@@ -60,7 +60,7 @@ function build_directory_selector($folders,$curdirpath,$group_dir='',$changeRend
 			$folder_titles = array();
 			while($obj = Database::fetch_object($res))
 			{
-				$folder_titles[$obj->path] = $obj->title;	
+				$folder_titles[$obj->path] = $obj->title;
 			}
 		}
 	}
@@ -69,21 +69,21 @@ function build_directory_selector($folders,$curdirpath,$group_dir='',$changeRend
 		if (is_array($folders)){
 			foreach($folders as $folder)
 			{
-				$folder_titles[$folder] = basename($folder);	
-			}	
+				$folder_titles[$folder] = basename($folder);
+			}
 		}
 	}
-	
+
 	require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
 	$form = new FormValidator('selector','POST',api_get_self());
-	
+
 	$parent_select = $form->addElement('select', 'curdirpath', get_lang('CurrentDirectory'),'','onchange="javascript:document.selector.submit()"');
-	
+
 	if($changeRenderer==true){
 		$renderer = $form->defaultRenderer();
 		$renderer->setElementTemplate('<span>{label} : {element}</span> ','curdirpath');
 	}
-	
+
 	//group documents cannot be uploaded in the root
 	if(empty($group_dir))
 	{
@@ -94,17 +94,17 @@ function build_directory_selector($folders,$curdirpath,$group_dir='',$changeRend
 			{
 				$selected = ($curdirpath==$folder)?' selected="selected"':'';
 				$path_parts = explode('/',$folder);
-				
+
 				if($folder_titles[$folder]=='shared_folder')
 				{
 					$folder_titles[$folder]=get_lang('SharedFolder');
 				}
 				elseif(strstr($folder_titles[$folder], 'sf_user_'))
-				{			
+				{
 						$userinfo=Database::get_user_info_from_id(substr($folder_titles[$folder],8));
-					$folder_titles[$folder]=api_get_person_name($userinfo['firstname'], $userinfo['lastname']);				
-				}				
-				
+					$folder_titles[$folder]=api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
+				}
+
 				$label = str_repeat('&nbsp;&nbsp;&nbsp;',count($path_parts)-2).' &mdash; '.$folder_titles[$folder];
 				$parent_select -> addOption($label,$folder);
 				if($selected!='') $parent_select->setSelected($folder);
@@ -124,13 +124,13 @@ function build_directory_selector($folders,$curdirpath,$group_dir='',$changeRend
 			else
 			{
 				$path_parts = explode('/',str_replace($group_dir,'',$folder));
-				$label = str_repeat('&nbsp;&nbsp;&nbsp;',count($path_parts)-2).' &mdash; '.$label;			
+				$label = str_repeat('&nbsp;&nbsp;&nbsp;',count($path_parts)-2).' &mdash; '.$label;
 			}
 			$parent_select -> addOption($label,$folder);
 			if($selected!='') $parent_select->setSelected($folder);
 		}
 	}
-	
+
 	$form=$form->toHtml();
 
 	return $form;
@@ -154,7 +154,7 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility
 	{
 		$req_gid = '&amp;gidReq='.$_SESSION['_gid'];
 	}
-	else 
+	else
 	{
 		$req_gid = '';
 	}
@@ -182,7 +182,7 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility
 		{
 			$url = "showinframes.php?".api_get_cidreq()."&amp;file=".$url_path.$req_gid;
 		}
-		else 
+		else
 		{
 			//url-encode for problematic characters (we may not call them dangerous characters...)
 			$path = str_replace('%2F', '/',$url_path).'?'.api_get_cidreq();
@@ -194,7 +194,7 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility
 			$target='_blank';
 		}
 	}
-	else 
+	else
 	{
 		$url=api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$url_path.$req_gid;
 	}
@@ -203,7 +203,7 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility
 	//$tooltip_title = str_replace('?cidReq='.$_GET['cidReq'],'',basename($path));
 	$tooltip_title = explode('?', basename($path));
 	$tooltip_title = $tooltip_title[0];
-	
+
 	if($tooltip_title=='shared_folder')
 	{
 		$tooltip_title_alt=get_lang('SharedFolder');
@@ -260,25 +260,25 @@ function build_document_icon_tag($type, $path)
 		}
 		elseif(strstr($basename, 'sf_user_'))
 		{
-			$userinfo=Database::get_user_info_from_id(substr($basename,8));	
-			$image_path = UserManager::get_user_picture_path_by_id(substr($basename,8),'web',false, true);										
-		
+			$userinfo=Database::get_user_info_from_id(substr($basename,8));
+			$image_path = UserManager::get_user_picture_path_by_id(substr($basename,8),'web',false, true);
+
 			if($image_path['file']=='unknown.jpg')
-			{		
+			{
 				$icon = $image_path['file'];
 			}
 			else
 			{
 				$icon = '../upload/users/'.substr($basename,8).'/'.$image_path['file'];
 			}
-			$basename = api_get_person_name($userinfo['firstname'], $userinfo['lastname']);			
+			$basename = api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
 		}
 		else
-		{	
+		{
 		    if(($basename =='audio' || $basename =='flash' || $basename =='images' || $basename =='video') && api_is_allowed_to_edit()==true)
-			{			  
-					$basename = get_lang('HelpDefaultDirDocuments');				
-			}				
+			{
+					$basename = get_lang('HelpDefaultDirDocuments');
+			}
 			$icon = 'folder_document.gif';
 		}
 	}
@@ -302,7 +302,7 @@ function build_edit_icons($curdirpath,$type,$path,$visibility,$id,$is_template,$
 	{
 		$req_gid = '&amp;gidReq='.$_SESSION['_gid'];
 	}
-	else 
+	else
 	{
 		$req_gid = '';
 	}
@@ -323,17 +323,17 @@ function build_edit_icons($curdirpath,$type,$path,$visibility,$id,$is_template,$
 	if( isset($_GET['direction']))
 	{
 		$sort_params[] = 'direction='.Security::remove_XSS($_GET['direction']);
-	}	
+	}
 	$sort_params = implode('&amp;',$sort_params);
 	$visibility_icon = ($visibility==0)?'invisible':'visible';
 	$visibility_command = ($visibility==0)?'set_visible':'set_invisible';
 	$curdirpath = urlencode($curdirpath);
-	
+
 	$modify_icons = '';
-		
+
 	if ($is_read_only)
 	{
-		$modify_icons = Display::return_icon('edit_na.gif', get_lang('Modify'));		
+		$modify_icons = Display::return_icon('edit_na.gif', get_lang('Modify'));
         $modify_icons .= '&nbsp;'.Display::return_icon('delete.gif', get_lang('Delete'));
         $modify_icons .= '&nbsp;'.Display::return_icon('deplacer_fichier_na.gif', get_lang('Move'));
         $modify_icons .= '&nbsp;'.Display::return_icon($visibility_icon.'_na.gif', get_lang('VisibilityCannotBeChanged'));
@@ -341,15 +341,15 @@ function build_edit_icons($curdirpath,$type,$path,$visibility,$id,$is_template,$
 	else
 	{
 		$modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&amp;file='.urlencode($path).$req_gid.'"><img src="../img/edit.gif" border="0" title="'.get_lang('Modify').'" alt="" /></a>';
-        if (strcmp($path,'/audio')===0 or strcmp($path,'/flash')===0 or strcmp($path,'/images')===0 or strcmp($path,'/shared_folder')===0 or strcmp($path,'/video')===0) { 
+        if (strcmp($path,'/audio')===0 or strcmp($path,'/flash')===0 or strcmp($path,'/images')===0 or strcmp($path,'/shared_folder')===0 or strcmp($path,'/video')===0) {
         	$modify_icons .= '&nbsp;'.Display::return_icon('delete_na.gif',get_lang('ThisFolderCannotBeDeleted'));
         } else {
         	$modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&amp;delete='.urlencode($path).$req_gid.'&amp;'.$sort_params.'" onclick="return confirmation(\''.basename($path).'\');"><img src="../img/delete.gif" border="0" title="'.get_lang('Delete').'" alt="" /></a>';
         }
         $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&amp;move='.urlencode($path).$req_gid.'"><img src="../img/deplacer_fichier.gif" border="0" title="'.get_lang('Move').'" alt="" /></a>';
         $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&amp;'.$visibility_command.'='.$id.$req_gid.'&amp;'.$sort_params.'"><img src="../img/'.$visibility_icon.'.gif" border="0" title="'.get_lang('Visible').'" alt="" /></a>';
-	}	
-	
+	}
+
 	if($type == 'file' && pathinfo($path,PATHINFO_EXTENSION)=='html')
 	{
 		if($is_template==0)
@@ -359,7 +359,7 @@ function build_edit_icons($curdirpath,$type,$path,$visibility,$id,$is_template,$
 		else{
 			$modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&amp;remove_as_template='.$id.$req_gid.'&amp;'.$sort_params.'"><img src="../img/wizard_gray_small.gif" border="0" title="'.get_lang('RemoveAsTemplate').'" alt=""'.get_lang('RemoveAsTemplate').'" /></a>';
 		}
-	}	
+	}
 	return $modify_icons;
 }
 
@@ -368,17 +368,17 @@ function build_move_to_selector($folders,$curdirpath,$move_file,$group_dir='')
 {
 	$form = '<form name="move_to" action="'.api_get_self().'" method="post">'."\n";
 	$form .= '<input type="hidden" name="move_file" value="'.$move_file.'" />'."\n";
-	
+
 	$form .= '<div class="row">';
 	$form .= '	<div class="label">';
 	$form .= 	get_lang('MoveTo');
 	$form .= '	</div>';
 	$form .= '	<div class="formw">';
-	
+
 	$form .= ' <select name="move_to">'."\n";
-	
+
 	//group documents cannot be uploaded in the root
-	if($group_dir=='') 
+	if($group_dir=='')
 	{
 		if($curdirpath!='/')
 		{
@@ -387,7 +387,7 @@ function build_move_to_selector($folders,$curdirpath,$move_file,$group_dir='')
 		if(is_array($folders))
 		{
 			foreach ($folders AS $folder)
-			{	
+			{
 				//you cannot move a file to:
 				//1. current directory
 				//2. inside the folder you want to move
@@ -395,7 +395,7 @@ function build_move_to_selector($folders,$curdirpath,$move_file,$group_dir='')
 				if(($curdirpath!=$folder) && ($folder!=$move_file) && (substr($folder,0,strlen($move_file)+1) != $move_file.'/'))
 				{
 					$path_displayed = $folder;
-					
+
 					// if document title is used, we have to display titles instead of real paths...
 					if(api_get_setting('use_document_title'))
 					{
@@ -409,17 +409,17 @@ function build_move_to_selector($folders,$curdirpath,$move_file,$group_dir='')
 	else
 	{
 		foreach ($folders AS $folder)
-		{	
+		{
 			if(($curdirpath!=$folder) && ($folder!=$move_file) && (substr($folder,0,strlen($move_file)+1) != $move_file.'/'))//cannot copy dir into his own subdir
 			{
 				if(api_get_setting('use_document_title'))
 				{
 					$path_displayed = get_titles_of_path($folder);
 				}
-				
+
 				$display_folder = substr($path_displayed,strlen($group_dir));
 				$display_folder = ($display_folder == '')?'/ ('.get_lang('HomeDirectory').')':$display_folder;
-								
+
 				$form .= '<option value="'.$folder.'">'.$display_folder.'</option>'."\n";
 			}
 		}
@@ -427,17 +427,17 @@ function build_move_to_selector($folders,$curdirpath,$move_file,$group_dir='')
 
 	$form .= '		</select>'."\n";
 	$form .= '	</div>';
-	
+
 	$form .= '<div class="row">';
 	$form .= '	<div class="label"></div>';
-	$form .= '	<div class="formw">';	
+	$form .= '	<div class="formw">';
 	$form .= '		<button type="submit" class="next" name="move_file_submit">'.get_lang('MoveFile').'</button>'."\n";
-	$form .= '	</div>';	
-	$form .= '</div>';	
+	$form .= '	</div>';
+	$form .= '</div>';
 
 	$form .= '</form>';
-	
-	$form .= '<div style="clear: both; margin-bottom: 10px;"></div>';		
+
+	$form .= '<div style="clear: both; margin-bottom: 10px;"></div>';
 
 	return $form;
 }
@@ -458,13 +458,13 @@ function get_titles_of_path($path)
 	$path_displayed = '';
 	for($i=0; $i<$nb_slashes; $i++)
 	{ // foreach folders of the path, retrieve title.
-	
+
 		$current_slash_pos = strpos($path,'/',$current_slash_pos+1);
 		$tmp_path = substr($path,strpos($path,'/',0),$current_slash_pos);
-		
+
 		if(empty($tmp_path)) // if empty, then we are in the final part of the path
 			$tmp_path = $path;
-			
+
 		if(!empty($tmp_folders_titles[$tmp_path])) // if this path has soon been stored here we don't need a new query
 		{
 			$path_displayed .= $tmp_folders_titles[$tmp_path];
@@ -486,14 +486,14 @@ function get_titles_of_path($path)
 /**
 * This function displays the name of the user and makes the link tothe user tool.
 *
-* @param $user_id 
+* @param $user_id
 * @param $name
 * @return a link to the userInfo.php
 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
 * @version february 2006, dokeos 1.8
-*/ 
+*/
 function display_user_link_document($user_id, $name)
-{	
+{
 	if ($user_id<>0)
 	{
 		return '<a href="../user/userInfo.php?uInfo='.$user_id.'">'.$name.'</a>';
@@ -511,7 +511,7 @@ function create_dir_form()
 	$new_folder_text .= '<input type="hidden" name="curdirpath" value="'.Security::remove_XSS($_GET['curdirpath']).'" />';
 	// form title
 	$new_folder_text .= '<div class="row"><div class="form_header">'.get_lang('CreateDir').'</div></div>';
-	
+
 	// folder field
 	$new_folder_text .= '<div class="row">';
 	$new_folder_text .= '<div class="label"><span class="form_required">*</span>'.get_lang('NewDir').'</div>';
@@ -521,10 +521,10 @@ function create_dir_form()
 	$new_folder_text .= '<div class="row">';
 	$new_folder_text .= '<div class="label">&nbsp;</div>';
 	$new_folder_text .= '<div class="formw"><button type="submit" class="add" name="create_dir">'.get_lang('CreateFolder').'</button></div>';
-	$new_folder_text .= '</div>';		
+	$new_folder_text .= '</div>';
 	$new_folder_text .= '</form>';
-	$new_folder_text .= '<div style="clear: both; margin-bottom: 10px;"></div>';	
-	
+	$new_folder_text .= '<div style="clear: both; margin-bottom: 10px;"></div>';
+
 	return $new_folder_text;
 }
 ?>

+ 100 - 100
main/document/document.php

@@ -81,9 +81,9 @@ $(document).ready( function() {
 	for (i=0;i<$(".actions").length;i++) {
 		if ($(".actions:eq("+i+")").html()=="<table border=\"0\"></table>" || $(".actions:eq("+i+")").html()=="" || $(".actions:eq("+i+")").html()==null) {
 			$(".actions:eq("+i+")").hide();
-		}		
+		}
 	}
- } ); 
+ } );
  </script>';
 //session
 if(isset($_GET['id_session']))
@@ -203,7 +203,7 @@ require_once api_get_path(LIBRARY_PATH) . 'document.lib.php';
 require_once api_get_path(LIBRARY_PATH) . 'tablesort.lib.php';
 require_once api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php';
 
- 
+
 //-----------------------------------------------------------
 //check the path
 //if the path is not found (no document id), set the path to /
@@ -258,13 +258,13 @@ if (isset($_GET['action']) && $_GET['action']=="download")
 		$error404 .= '</body></html>';
 		echo($error404);
 		exit;
-	}  
+	}
 	// launch event
 	event_download($my_get_id);
-	
+
     // check visibility of document and paths
     if (!($is_allowed_to_edit || $group_member_with_upload_rights) &&
-        !DocumentManager::is_visible($my_get_id, $_course)){        
+        !DocumentManager::is_visible($my_get_id, $_course)){
         api_not_allowed();
     }
 
@@ -303,25 +303,25 @@ if ($array_len >1)
 {
 	if(empty($_SESSION['_gid']))
 	{
-		$url_dir='document.php?&curdirpath=/'; 
+		$url_dir='document.php?&curdirpath=/';
 		$interbreadcrumb[]= array ('url'=>$url_dir, 'name'=> get_lang('HomeDirectory'));
 	}
-} 
+}
 
 $dir_acum='';
 for ($i=0; $i<$array_len;$i++)
-{ 
+{
 	if($dir_array[$i] =='shared_folder')
 	{
 		$dir_array[$i]=get_lang('SharedFolder');
 	}
 	elseif(strstr($dir_array[$i], 'sf_user_'))
 	{
-		$userinfo=Database::get_user_info_from_id(substr($dir_array[$i], 8));		
+		$userinfo=Database::get_user_info_from_id(substr($dir_array[$i], 8));
 		$dir_array[$i]=api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
 	}
 
-	$url_dir='document.php?&curdirpath='.$dir_acum.$dir_array[$i]; 
+	$url_dir='document.php?&curdirpath='.$dir_acum.$dir_array[$i];
 	$interbreadcrumb[]= array ('url'=>$url_dir, 'name'=> $dir_array[$i]);
 	$dir_acum.=$dir_array[$i].'/';
 }
@@ -368,37 +368,37 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 	/*======================================
 				MOVE FILE OR DIRECTORY
 	  ======================================*/
-	$my_get_move=Security::remove_XSS($_GET['move']); 
+	$my_get_move=Security::remove_XSS($_GET['move']);
 	if (isset($_GET['move']) && $_GET['move']!='')
-	{ 	
+	{
 		if (!$is_allowed_to_edit)
 		{
 			if(DocumentManager::check_readonly($_course,$_user['user_id'],$my_get_move))
 			{
-				api_not_allowed();	 
+				api_not_allowed();
 			}
 		}
-		
+
 		if(DocumentManager::get_document_id($_course,$my_get_move))
 		{
 			$folders = DocumentManager::get_all_document_folders($_course,$to_group_id,$is_allowed_to_edit || $group_member_with_upload_rights);
 			echo '<div class="row"><div class="form_header">'.get_lang('Move').'</div></div>';
 			echo build_move_to_selector($folders,Security::remove_XSS($_GET['curdirpath']),$my_get_move,$group_properties['directory']);
 		}
-		
-		
+
+
 	}
- 	
+
 	if (isset($_POST['move_to']) && isset($_POST['move_file']))
 	{
 		if (!$is_allowed_to_edit)
 		{
 			if(DocumentManager::check_readonly($_course,$_user['user_id'],$my_get_move))
 			{
-				api_not_allowed();	
+				api_not_allowed();
 			}
 		}
-		
+
 		include_once(api_get_path(LIBRARY_PATH) . 'fileManage.lib.php');
 		//this is needed for the update_db_info function
 		//$dbTable = $_course['dbNameGlu']."document";
@@ -424,8 +424,8 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 		{
 			Display::display_error_message(get_lang('Impossible'));
 		}
-		
-		
+
+
 	}
 
 	/*======================================
@@ -433,28 +433,28 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 	  ======================================*/
 
 	if ( isset($_GET['delete']) )
-	{		
+	{
 		if (!$is_allowed_to_edit)
 		{
 			if(DocumentManager::check_readonly($_course,$_user['user_id'],$_GET['delete'],'',true))
 			{
 				api_not_allowed();
 			}
-		} 
-							
+		}
+
 		include_once(api_get_path(LIBRARY_PATH) . 'fileManage.lib.php');
-		 
+
 		if(DocumentManager::delete_document($_course,$_GET['delete'],$base_work_dir))
 		{
 			Display::display_confirmation_message(get_lang('DocDeleted'));
 		}
 		else
-		{	
-			
+		{
+
 			Display::display_error_message(get_lang('DocDeleteError'));
 		}
-		
-		
+
+
 	}
 
 	if( isset($_POST['action']))
@@ -462,7 +462,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 		switch($_POST['action'])
 		{
 			case 'delete':
-			
+
 				foreach($_POST['path'] as $index => $path)
 				{
 					if (!$is_allowed_to_edit)
@@ -474,8 +474,8 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 						}
 					}
 				}
-			
-				foreach($_POST['path'] as $index => $path)				
+
+				foreach($_POST['path'] as $index => $path)
 				{
 					if (strcmp($path,'/audio')===0 or strcmp($path,'/flash')===0 or strcmp($path,'/images')===0 or strcmp($path,'/shared_folder')===0 or strcmp($path,'/video')===0) {
 						continue;
@@ -500,8 +500,8 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 		//needed for directory creation
 		include_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php');
 		$post_dir_name=Security::remove_XSS($_POST['dirname']);
-		
-		if ($post_dir_name=='../' || $post_dir_name=='.' || $post_dir_name=='..') 
+
+		if ($post_dir_name=='../' || $post_dir_name=='.' || $post_dir_name=='..')
 		{
 			Display::display_error_message(get_lang('CannotCreateDir'));
 		}
@@ -513,11 +513,11 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 			$clean_val=replace_accents($dir_name);
 			$dir_name=$clean_val;
 			$dir_check=$base_work_dir.''.$dir_name;
-			
+
 			if(!is_dir($dir_check))
 			{
 				$created_dir = create_unexisting_directory($_course,$_user['user_id'],$to_group_id,$to_user_id,$base_work_dir,$dir_name,$post_dir_name);
-				
+
 				if($created_dir)
 				{
 					Display::display_confirmation_message('<span title="'.$created_dir.'">'.get_lang('DirCr').'</span>',false);
@@ -536,7 +536,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 			}
 		}
 	}
-	
+
 	//show them the form for the directory name
 	if(isset($_GET['createdir']))
 	{
@@ -550,7 +550,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 	  ======================================*/
 
 	if ((isset($_GET['set_invisible']) && !empty($_GET['set_invisible'])) || (isset($_GET['set_visible']) && !empty($_GET['set_visible'])) AND $_GET['set_visible']<>'*' AND $_GET['set_invisible']<>'*')
-	{		
+	{
 		//make visible or invisible?
 		if(isset($_GET['set_visible']))
 		{
@@ -561,16 +561,16 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 		{
 			$update_id = $_GET['set_invisible'];
 			$visibility_command = 'invisible';
-		} 
-		
-		if (!$is_allowed_to_edit)	
-		{	
+		}
+
+		if (!$is_allowed_to_edit)
+		{
 			if(DocumentManager::check_readonly($_course,$_user['user_id'],'',$update_id))
 			{
-				api_not_allowed(); 
-			} 
+				api_not_allowed();
+			}
 		}
-		
+
 		//update item_property to change visibility
 		if(api_item_property_update($_course, TOOL_DOCUMENT, $update_id, $visibility_command, $_user['user_id']))
 		{
@@ -582,16 +582,16 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 		}
 
 	}
-	
-	
+
+
 	/*======================================
 	   	  TEMPLATE ACTION
 	  ======================================*/
-	
+
 	if (isset($_GET['add_as_template']) && !isset($_POST['create_template'])) {
-		
+
 		$document_id_for_template = intval($_GET['add_as_template']);
-		
+
 		//create the form that asks for the directory name
 		$template_text = '<form name="set_document_as_new_template" enctype="multipart/form-data" action="'.api_get_self().'?add_as_template='.$document_id_for_template.'" method="post">';
 		$template_text .= '<input type="hidden" name="curdirpath" value="'.$curdirpath.'" />';
@@ -606,34 +606,34 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 		$template_text .= '<button type="submit" class="add" name="create_template">'.get_lang('CreateTemplate').'</button>';
 		$template_text .= '</form>';
 		//show the form
-		Display::display_normal_message($template_text,false);		
-		
-	} elseif(isset($_GET['add_as_template']) && isset($_POST['create_template'])) {		
-		
-		$document_id_for_template = intval(Database::escape_string($_GET['add_as_template']));    
-			
-		$title=Security::remove_XSS($_POST['template_title']);				
-		//$description = Security::remove_XSS($_POST['template_description']);		
+		Display::display_normal_message($template_text,false);
+
+	} elseif(isset($_GET['add_as_template']) && isset($_POST['create_template'])) {
+
+		$document_id_for_template = intval(Database::escape_string($_GET['add_as_template']));
+
+		$title=Security::remove_XSS($_POST['template_title']);
+		//$description = Security::remove_XSS($_POST['template_description']);
 		$course_code = api_get_course_id();
 		$user_id = api_get_user_id();
-		
+
 		// create the template_thumbnails folder in the upload folder (if needed)
 		if (!is_dir(api_get_path(SYS_CODE_PATH).'upload/template_thumbnails/')) {
 			$perm = api_get_setting('permissions_for_new_directories');
 			$perm = octdec(!empty($perm)?$perm:'0770');
 			$res = @mkdir(api_get_path(SYS_CODE_PATH).'upload/template_thumbnails/',$perm);
 		}
-		
+
 		// upload the file
 		if (!empty($_FILES['template_image']['name'])) {
 			echo 'uploading';
 			include_once (api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
 			$upload_ok = process_uploaded_file($_FILES['template_image']);
-			
+
 			if ($upload_ok) {
 				// Try to add an extension to the file if it hasn't one
-				$new_file_name = $_course['sysCode'].'-'.add_ext_on_mime(stripslashes($_FILES['template_image']['name']), $_FILES['template_image']['type']);	
-				
+				$new_file_name = $_course['sysCode'].'-'.add_ext_on_mime(stripslashes($_FILES['template_image']['name']), $_FILES['template_image']['type']);
+
 				// upload dir
 				$upload_dir = api_get_path(SYS_CODE_PATH).'upload/template_thumbnails/';
 
@@ -644,7 +644,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 
 				$max_width_for_picture = 100;
 
-				if ($picture_infos[0]>$max_width_for_picture) {		
+				if ($picture_infos[0]>$max_width_for_picture) {
 					$thumbwidth = $max_width_for_picture;
 					if (empty($thumbwidth) or $thumbwidth==0) {
 					  $thumbwidth=$max_width_for_picture;
@@ -657,27 +657,27 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
 				$type=$picture_infos[2];
 
 				switch (!empty($type)) {
-					case 2 : $temp->send_image('JPG',$upload_dir.$new_file_name);							 
+					case 2 : $temp->send_image('JPG',$upload_dir.$new_file_name);
 							 break;
-					case 3 : $temp->send_image('PNG',$upload_dir.$new_file_name);							
+					case 3 : $temp->send_image('PNG',$upload_dir.$new_file_name);
 							 break;
-					case 1 : $temp->send_image('GIF',$upload_dir.$new_file_name);							 
+					case 1 : $temp->send_image('GIF',$upload_dir.$new_file_name);
 							 break;
 				}
 			}
-	   }	
-		
-		DocumentManager::set_document_as_template($title, $description, $document_id_for_template, $course_code, $user_id, $new_file_name);		
-		Display::display_confirmation_message(get_lang('DocumentSetAsTemplate'));		
+	   }
+
+		DocumentManager::set_document_as_template($title, $description, $document_id_for_template, $course_code, $user_id, $new_file_name);
+		Display::display_confirmation_message(get_lang('DocumentSetAsTemplate'));
 	}
-		
-	if(isset($_GET['remove_as_template'])) {		
+
+	if(isset($_GET['remove_as_template'])) {
 		$document_id_for_template = intval($_GET['remove_as_template']);
 		$course_code = api_get_course_id();
-		$user_id = api_get_user_id();		
-		DocumentManager::unset_document_as_template($document_id_for_template, $course_code, $user_id);		
-		Display::display_confirmation_message(get_lang('DocumentUnsetAsTemplate'));		
-	}	
+		$user_id = api_get_user_id();
+		DocumentManager::unset_document_as_template($document_id_for_template, $course_code, $user_id);
+		Display::display_confirmation_message(get_lang('DocumentUnsetAsTemplate'));
+	}
 } // END is allowed to edit
 
 /*
@@ -713,7 +713,7 @@ if($folders===false)
 				<?php echo get_lang('Up'); ?></a>&nbsp;
 	<?php
 	}
-	
+
 if(isset($docs_and_folders) && is_array($docs_and_folders))
 {
 	//echo('<pre>');
@@ -725,8 +725,8 @@ if(isset($docs_and_folders) && is_array($docs_and_folders))
 	$use_document_title = api_get_setting('use_document_title');
 	//create a sortable table with our data
 	$sortable_data = array();
-	
-	
+
+
 	while (list ($key, $id) = each($docs_and_folders))
 	{
 		$row = array ();
@@ -734,7 +734,7 @@ if(isset($docs_and_folders) && is_array($docs_and_folders))
 		//if the item is invisible, wrap it in a span with class invisible
 		$invisibility_span_open = ($id['visibility']==0)?'<span class="invisible">':'';
 		$invisibility_span_close = ($id['visibility']==0)?'</span>':'';
-		//size (or total size of a directory)		
+		//size (or total size of a directory)
 		$size = $id['filetype']=='folder' ? get_total_folder_size($id['path'],$is_allowed_to_edit) : $id['size'];
 		//get the title or the basename depending on what we're using
 		if ($use_document_title=='true' AND $id['title']<>'') {
@@ -755,20 +755,20 @@ if(isset($docs_and_folders) && is_array($docs_and_folders))
 		}
 		//data for checkbox
 		if (($is_allowed_to_edit || $group_member_with_upload_rights) AND count($docs_and_folders)>1) {
-			$row[] = $id['path'];			
+			$row[] = $id['path'];
 		}
-		
-		// Show the Owner of the file only in groups				
-		$user_link='';	
-			
+
+		// Show the Owner of the file only in groups
+		$user_link='';
+
 		if(isset($_SESSION['_gid']) && $_SESSION['_gid']!='') {
 			if (!empty($id['insert_user_id'])) {
-				$user_info=UserManager::get_user_info_by_id($id['insert_user_id']);		
+				$user_info=UserManager::get_user_info_by_id($id['insert_user_id']);
 				$user_name=api_get_person_name($user_info['firstname'], $user_info['lastname']);
 				$user_link='<div class="document_owner">'.get_lang('Owner').': '.display_user_link_document($id['insert_user_id'],$user_name).'</div>';
 			}
 		}
-		
+
 		//icons (clickable)
 		//$row[]= build_document_icon_tag($id['filetype'],$id['path']);
 		$row[] = create_document_link($http_www,  $document_name,  $id['path'], $id['filetype'],  $size, $id['visibility'], true);
@@ -782,8 +782,8 @@ if(isset($docs_and_folders) && is_array($docs_and_folders))
 		$row[] = '<span style="display:none;">'.$size.'</span>'.$invisibility_span_open.$display_size.$invisibility_span_close;
 
 		//last edit date
-		$last_edit_date=$id['lastedit_date'];		
-		$display_date = date_to_str_ago($last_edit_date).'<br><span class="dropbox_date">'.$last_edit_date.'</span>';		
+		$last_edit_date=$id['lastedit_date'];
+		$display_date = date_to_str_ago($last_edit_date).'<br><span class="dropbox_date">'.$last_edit_date.'</span>';
 		$row[] = $invisibility_span_open.$display_date.$invisibility_span_close;
 
 		//admins get an edit column
@@ -797,15 +797,15 @@ if(isset($docs_and_folders) && is_array($docs_and_folders))
 			}
 			else
 			{
-				$edit_icons = build_edit_icons($curdirpath,$id['filetype'],$id['path'],$id['visibility'],$key, $is_template,$id['readonly']);			
-			}			
+				$edit_icons = build_edit_icons($curdirpath,$id['filetype'],$id['path'],$id['visibility'],$key, $is_template,$id['readonly']);
+			}
 			$row[] = $edit_icons;
 		}
 		$row[] = $last_edit_date;
 		$row[] = $size;
 		$total_size=$total_size+$size;
 		$sortable_data[] = $row;
-		
+
 	}
 	//*******************************************************************************************
 }
@@ -815,7 +815,7 @@ else
 	$table_footer='<div style="text-align:center;"><strong>'.get_lang('NoDocsInFolder').'</strong></div>';
 }
 
-$column_show=array();	
+$column_show=array();
 
 
 	if ($is_allowed_to_edit || $group_member_with_upload_rights)
@@ -834,7 +834,7 @@ $column_show=array();
 			<a href="quota.php?<?php echo api_get_cidreq();?>"><?php Display::display_icon('statistics.gif', get_lang("ShowCourseQuotaUse")); ?><?php echo get_lang("ShowCourseQuotaUse"); ?></a>
 		<?php
 	}
-	if ($docs_and_folders!=null) {	
+	if ($docs_and_folders!=null) {
 		global $total_size;
 		if ($total_size!=0){ ?>
 	<!-- download zipped folder -->
@@ -842,7 +842,7 @@ $column_show=array();
 			<a href="<?php echo api_get_self(); ?>?<?php echo api_get_cidreq();?>&action=downloadfolder"><?php echo get_lang("Save"); ?> (ZIP)</a>&nbsp;
 <?php
 		}
-	} 
+	}
 	// Slideshow by Patrick Cool, May 2004
 	include("document_slideshow.inc.php");
 	if ($image_present)
@@ -883,13 +883,13 @@ if ( count($row) == 8 )
 	$column_order[]=1;
 	$column_order[]=2;
 	$column_order[]=7;
-	$column_order[]=4;	
+	$column_order[]=4;
 }
 
 $default_column = $is_allowed_to_edit ? 2 : 1;
 $tablename = $is_allowed_to_edit ? 'teacher_table' : 'student_table';
 $table = new SortableTableFromArrayConfig($sortable_data,$default_column,20,$tablename,$column_show,$column_order,'ASC');
- 
+
 $query_vars['curdirpath'] = $curdirpath;
 
 if(isset($_SESSION['_gid']))
@@ -922,7 +922,7 @@ if (count($docs_and_folders)>1)
 {
 	if ($is_allowed_to_edit || $group_member_with_upload_rights)
 	{
-		$form_actions = array();		
+		$form_actions = array();
 		$form_action['delete'] = get_lang('Delete');
 		$table->set_form_actions($form_action,'path');
 	}

+ 15 - 15
main/document/document_slideshow.inc.php

@@ -24,16 +24,16 @@
 *	This is a plugin for the documents tool. It looks for .jpg, .jpeg, .gif, .png
 *	files (since these are the files that can be viewed in a browser) and creates
 *	a slideshow with it by allowing to go to the next/previous image.
-*	You can also have a quick overview (thumbnail view) of all the images in 
+*	You can also have a quick overview (thumbnail view) of all the images in
 *	that particular folder.
 *
 *	Each slideshow is folder based. Only
-*	the images of the chosen folder are shown. 
-*	
+*	the images of the chosen folder are shown.
+*
 *	This file has two large sections.
 *	1. code that belongs in document.php, but to avoid clutter I put the code here
 *	(not present) 2. the function resize_image that handles the image resizing
-*	
+*
 *	@author Patrick Cool, responsible author
 *	@author Roan Embrechts, minor cleanup
 *	@package dokeos.document
@@ -41,21 +41,21 @@
 */
 
 /*
-============================================================================== 
-	general code that belongs in document.php 
-	   
+==============================================================================
+	general code that belongs in document.php
+
 	this code should indeed go in documents.php but since document.php is already a really ugly file with
 	too much things in one file , I decided to put the code for document.php here and to include this
 	file into document.php
-============================================================================== 
-*/ 
+==============================================================================
+*/
 
 $accepted_extensions = array('.jpg','.jpeg','.gif','.png');
 
 // resetting the images of the slideshow = destroying the slideshow
 if (isset($_GET['action']) && $_GET['action'] == 'exit_slideshow') {
 	$_SESSION['image_files_only'] = null;
-	unset($image_files_only); 
+	unset($image_files_only);
 }
 
 // We check if there are images in this folder by searching the extensions for .jpg, .gif, .png
@@ -75,11 +75,11 @@ $image_present = 0;
 
 if (count($all_files) > 0) {
 	foreach ($all_files as $file) {
-		$slideshow_extension = strrchr($file,'.'); 
-		$slideshow_extension = strtolower($slideshow_extension); 
+		$slideshow_extension = strrchr($file,'.');
+		$slideshow_extension = strtolower($slideshow_extension);
 		if (in_array($slideshow_extension,$accepted_extensions)) {
 			$image_present = 1;
-			$image_files_only[] = $file; 
+			$image_files_only[] = $file;
 		}
 	}
 }
@@ -96,7 +96,7 @@ $image_files_only = sort_files($array_to_search);
 $_SESSION['image_files_only'] = $image_files_only;
 
 function sort_files($table) {
-	
+
 	global $tablename_direction, $accepted_extensions;
 	$temp = array();
 
@@ -133,5 +133,5 @@ function rsort_table($a, $b) {
 	global $tablename_column;
 	return strnatcmp($b[$tablename_column], $a[$tablename_column]);
 }
- 
+
 ?>

+ 5 - 5
main/document/download.php

@@ -67,8 +67,8 @@ $doc_url = str_replace(' ', '+', $doc_url);
 $doc_url = str_replace(array('../','\\..','\\0','..\\'),array('','','',''), $doc_url); //echo $doc_url;
 
 
-// dealing with image included into survey: when users receive a link towards a 
-// survey while not being authenticated on the plateform. 
+// dealing with image included into survey: when users receive a link towards a
+// survey while not being authenticated on the plateform.
 // the administrator should probably be able to disable this code through admin
 // inteface
 $refer_script = strrchr($_SERVER["HTTP_REFERER"],'/');
@@ -81,7 +81,7 @@ if (substr($refer_script,0,15) == "/fillsurvey.php") {
 	$_course['path']=$_course['directory'];
 } else {
 	//protection
-	api_protect_course_script();	
+	api_protect_course_script();
 
 	if (! isset($_course))
 	{
@@ -90,10 +90,10 @@ if (substr($refer_script,0,15) == "/fillsurvey.php") {
 
 
 	//if the rewrite rule asks for a directory, we redirect to the document explorer
-	if(is_dir(api_get_path(SYS_COURSE_PATH).$_course['path']."/document".$doc_url)) 
+	if(is_dir(api_get_path(SYS_COURSE_PATH).$_course['path']."/document".$doc_url))
 	{
 		//remove last slash if present
-		//$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url; 
+		//$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url;
 		//mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (Ren�)
 		while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
 		//group folder?

+ 78 - 78
main/document/edit_document.php

@@ -22,7 +22,7 @@
 	See the GNU General Public License for more details.
 
 	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium, info@dokeos.com
-	
+
 ==============================================================================
 */
 /**
@@ -50,7 +50,7 @@
 * not for validation at the moment)
 ==============================================================================
 */
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = 'document';
 /*
 ------------------------------------------------------------------------------
@@ -64,9 +64,9 @@ $htmlHeadXtra[] = '
 <script type="text/javascript">
 
 function InnerDialogLoaded()
-{	
+{
 	/*
-	var B=new window.frames[0].FCKToolbarButton(\'Templates\',window.frames[0].FCKLang.Templates);	
+	var B=new window.frames[0].FCKToolbarButton(\'Templates\',window.frames[0].FCKLang.Templates);
 	return B.ClickFrame();
 	*/
 
@@ -95,15 +95,15 @@ function InnerDialogLoaded()
 		return null ;
 	}
 
-	var B = new EditorFrame.FCKToolbarButton(\'Templates\', EditorFrame.FCKLang.Templates);		
+	var B = new EditorFrame.FCKToolbarButton(\'Templates\', EditorFrame.FCKLang.Templates);
 	return B.ClickFrame();
-};	
-		
+};
+
 function FCKeditor_OnComplete( editorInstance )
 {
-	document.getElementById(\'frmModel\').innerHTML = "<iframe style=\'height: 525px; width: 180px;\' scrolling=\'no\' frameborder=\'0\' src=\''.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/fckdialogframe.html \'>";	
+	document.getElementById(\'frmModel\').innerHTML = "<iframe style=\'height: 525px; width: 180px;\' scrolling=\'no\' frameborder=\'0\' src=\''.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/fckdialogframe.html \'>";
 }
-		
+
 
 </script>';
 
@@ -154,7 +154,7 @@ if (!empty($group_properties['directory']))
 $relative_url='';
 for($i=0;$i<($count_dir);$i++)
 {
-	$relative_url.='../';	
+	$relative_url.='../';
 }
 
 $html_editor_config = array(
@@ -236,8 +236,8 @@ event_access_tool(TOOL_DOCUMENT);
 if (!is_allowed_to_edit())
 {
 	if(DocumentManager::check_readonly($_course,$user_id,$file))
-	{	
-		api_not_allowed();	
+	{
+		api_not_allowed();
 	}
 
 }
@@ -279,7 +279,7 @@ function change_name($baseWorkDir, $sourceFile, $renameTo, $dir, $doc)
 	//api_display_debug_info("call my_rename: params $file_name_for_change, $renameTo");
     	$renameTo = disable_dangerous_file($renameTo); //avoid renaming to .htaccess file
 	$renameTo = my_rename($file_name_for_change, stripslashes($renameTo)); //fileManage API
-    
+
 	if ($renameTo)
 	{
 		if (isset($dir) && $dir != "")
@@ -334,9 +334,9 @@ if (isset($_POST['newComment']))
 	}
 	//Determine the correct query to the DB
 	//new code always keeps document in database
-	$query = "UPDATE $dbTable 
-		SET comment='".$newComment."', title='".$newTitle."' 
-		WHERE path 
+	$query = "UPDATE $dbTable
+		SET comment='".$newComment."', title='".$newTitle."'
+		WHERE path
 		LIKE BINARY '".$commentPath."'";
 	api_sql_query($query,__FILE__,__LINE__);
 	$oldComment = $newComment;
@@ -401,7 +401,7 @@ if($is_allowedToEdit)
 
 			$_POST['filename']=str_replace('.'.$extension,'',$_POST['filename']);
 		}
-		
+
 		$filename=stripslashes($_POST['filename']);
 
 		$texte=trim(str_replace(array("\r","\n"),"",stripslashes($_POST['texte'])));
@@ -422,7 +422,7 @@ if($is_allowedToEdit)
 		//{
 			$extension = $_POST['extension'];
 		//}
-		
+
 		$file=$dir.$filename.'.'.$extension;
 		$read_only_flag=$_POST['readonly'];
 		if (!empty($read_only_flag))
@@ -433,12 +433,12 @@ if($is_allowedToEdit)
 		{
 			$read_only_flag=0;
 		}
-		
+
 		$show_edit=$_SESSION['showedit'];
 		//unset($_SESSION['showedit']);
-		api_session_unregister('showedit');		
-		
-						
+		api_session_unregister('showedit');
+
+
 		if(empty($filename))
 		{
 			$msgError=get_lang('NoFileName');
@@ -448,25 +448,25 @@ if($is_allowedToEdit)
 			if ($read_only_flag==0)
 			{
 				if (!empty($texte))
-				{					
+				{
 					if($fp=@fopen($filepath.$filename.'.'.$extension,'w'))
-					{						 
+					{
 						$texte = text_filter($texte);
 						//if flv player, change absolute paht temporarely to prevent from erasing it in the following lines
 						$texte = str_replace('flv=h','flv=h|',$texte);
 						$texte = str_replace('flv=/','flv=/|',$texte);
-						
+
 						// change the path of mp3 to absolute
 						// first regexp deals with ../../../ urls
 						// Disabled by Ivan Tcholakov.
 						//$texte = preg_replace("|(flashvars=\"file=)(\.+/)+|","$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/',$texte);
 						//second regexp deals with audio/ urls
 						// Disabled by Ivan Tcholakov.
-						//$texte = preg_replace("|(flashvars=\"file=)([^/]+)/|","$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/',$texte);		 
-												
- 						
- 						fputs($fp,$texte);						
-						fclose($fp);			
+						//$texte = preg_replace("|(flashvars=\"file=)([^/]+)/|","$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/',$texte);
+
+
+ 						fputs($fp,$texte);
+						fclose($fp);
 						$perm = api_get_setting('permissions_for_new_directories');
 						$perm = octdec(!empty($perm)?$perm:'0770');
 						if(!is_dir($filepath.'css'))
@@ -476,7 +476,7 @@ if($is_allowedToEdit)
 							api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', $_user['user_id']);
 							api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', $_user['user_id']);
 						}
-						
+
 						if(!is_file($filepath.'css/frames.css'))
 						{
 							$platform_theme= api_get_setting('stylesheets');
@@ -484,14 +484,14 @@ if($is_allowedToEdit)
 								copy(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css',$filepath.'css/frames.css');
 								$doc_id=add_document($_course,$dir.'css/frames.css','file',filesize($filepath.'css/frames.css'),'frames.css');
 								api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id']);
-								api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', $_user['user_id']);								
+								api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', $_user['user_id']);
 							}
 						}
-								
+
 						// "WHAT'S NEW" notification: update table item_property (previously last_tooledit)
 						$document_id = DocumentManager::get_document_id($_course,$file);
 						if($document_id)
-						{	
+						{
 							$file_size = filesize($filepath.$filename.'.'.$extension);
 							update_existing_document($_course, $document_id,$file_size,$read_only_flag);
 							api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentUpdated', $_user['user_id']);
@@ -504,12 +504,12 @@ if($is_allowedToEdit)
 						else
 						{
 						//$msgError=get_lang('Impossible');
-						}							
+						}
 					}
 					else
 					{
 						$msgError=get_lang('Impossible');
-					}						
+					}
 				}
 				else
 				{
@@ -518,37 +518,37 @@ if($is_allowedToEdit)
 						$document_id = DocumentManager::get_document_id($_course,$file);
 						if ($document_id) {
 							update_existing_document($_course, $document_id,$file_size,$read_only_flag);
-						}							
-					}				
-				}				
+						}
+					}
+				}
 			}
 			else
-			{				
-				
+			{
+
 				if (is_file($filepath.$filename.'.'.$extension)) {
 					$file_size = filesize($filepath.$filename.'.'.$extension);
 					$document_id = DocumentManager::get_document_id($_course,$file);
-					
+
 					if ($document_id) {
 						update_existing_document($_course, $document_id,$file_size,$read_only_flag);
-					}					
+					}
 				}
-				
+
 				if (empty($document_id)) //or if is folder
-				{	
+				{
 					$folder=$_POST['file_path'];
 					$document_id = DocumentManager::get_document_id($_course,$folder);
-										
+
 					if (DocumentManager::is_folder($_course, $document_id))
 					{
 						if($document_id)
 						{
 							update_existing_document($_course, $document_id,$file_size,$read_only_flag);
-						}		
-					}					
+						}
+					}
 				}
-				
-				
+
+
 			}
 		}
 	}
@@ -558,16 +558,16 @@ if($is_allowedToEdit)
 //replace relative paths by absolute web paths  (e.g. "./" => "http://www.dokeos.com/courses/ABC/document/")
 if(file_exists($filepath.$doc))
 {
-	$extension=explode('.',$doc);	
+	$extension=explode('.',$doc);
 	$extension=$extension[sizeof($extension)-1];
 	$filename=str_replace('.'.$extension,'',$doc);
 	$extension=strtolower($extension);
-	
+
 	/*if(!in_array($extension,array('html','htm'))) // that was wrong
 	{
-		$extension=$filename=$texte='';		
+		$extension=$filename=$texte='';
 	}*/
-	
+
 	if(in_array($extension,array('html','htm')))
 	{
 		$texte=file($filepath.$doc);
@@ -575,7 +575,7 @@ if(file_exists($filepath.$doc))
 		$path_to_append=api_get_path('WEB_COURSE_PATH').$_course['path'].'/document'.$dir;
 		$texte=str_replace('="./','="'.$path_to_append,$texte);
 		$texte=str_replace('mp3player.swf?son=.%2F','mp3player.swf?son='.urlencode($path_to_append),$texte);
-	}	
+	}
 }
 
 /*
@@ -606,7 +606,7 @@ $sql = 'SELECT id, readonly FROM '.$dbTable.' WHERE path LIKE BINARY "'.$dir.$do
 $rs = api_sql_query($sql, __FILE__, __LINE__);
 $readonly = Database::result($rs,0,'readonly');
 $doc_id = Database::result($rs,0,'id');
- 
+
 // owner
 $sql = 'SELECT insert_user_id FROM '.Database::get_course_table(TABLE_ITEM_PROPERTY).'
 		WHERE tool LIKE "document"
@@ -616,7 +616,7 @@ $owner_id = Database::result($rs,0,'insert_user_id');
 
 
 if ($owner_id == $_user['user_id'] || api_is_platform_admin() || api_is_allowed_to_edit() || GroupManager :: is_user_in_group($_user['user_id'],$_SESSION['_gid'] ))
-{  
+{
 	$get_cur_path=Security::remove_XSS($_GET['curdirpath']);
 	$get_file=Security::remove_XSS($_GET['file']);
 	$action =  api_get_self().'?sourceFile='.urlencode($file_name).'&curdirpath='.urlencode($get_cur_path).'&file='.urlencode($get_file).'&doc='.urlencode($doc);
@@ -624,15 +624,15 @@ if ($owner_id == $_user['user_id'] || api_is_platform_admin() || api_is_allowed_
 
 	// form title
 	$form->addElement('header', '', $nameTools);
-	
+
 	$renderer = $form->defaultRenderer();
 
 	$form->addElement('hidden','filename');
-	$form->addElement('hidden','extension'); 
+	$form->addElement('hidden','extension');
 	$form->addElement('hidden','file_path');
-	$form->addElement('hidden','commentPath');		
-	$form->addElement('hidden','showedit');	
-	
+	$form->addElement('hidden','commentPath');
+	$form->addElement('hidden','showedit');
+
 	if($use_document_title)
 	{
 		$form->add_textfield('newTitle',get_lang('Title'));
@@ -641,62 +641,62 @@ if ($owner_id == $_user['user_id'] || api_is_platform_admin() || api_is_allowed_
 	else
 	{
 		$form->addElement('hidden','renameTo');
-	}		
+	}
 
 	$form->addElement('hidden','formSent');
 	$defaults['formSent'] = 1;
 
-			
+
 	$read_only_flag=$_POST['readonly'];
-			
+
 	$defaults['texte'] = $texte;
-			
+
 	//if($extension == 'htm' || $extension == 'html')
 	// HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved.
 	if(($extension == 'htm' || $extension == 'html') && stripos($dir, '/HotPotatoes_files') === false)
 	{
 		if (empty($readonly) && $readonly==0)
-		{	
+		{
 			$_SESSION['showedit']=1;
 			$renderer->setElementTemplate('<div class="row"><div class="label" id="frmModel" style="overflow: visible;"></div><div class="formw">{element}</div></div>', 'texte');
 			$form->add_html_editor('texte', '', false, true, $html_editor_config);
-		}			
+		}
 	}
-			
+
 	if(!$group_document)
 	{
 		$metadata_link = '<a href="../metadata/index.php?eid='.urlencode('Document.'.$docId).'">'.get_lang('AddMetadata').'</a>';
 		$form->addElement('static',null,get_lang('Metadata'),$metadata_link);
 	}
-			
+
 	$form->addElement('textarea','newComment',get_lang('Comment'),'rows="3" style="width:300px;"');
 	/*
 	$renderer = $form->defaultRenderer();
 	*/
-	if ($owner_id == $_user['user_id'] || api_is_platform_admin())	
+	if ($owner_id == $_user['user_id'] || api_is_platform_admin())
 	{
 		$renderer->setElementTemplate('<div class="row"><div class="label"></div><div class="formw">{element}{label}</div></div>', 'readonly');
-		$checked =&$form->addElement('checkbox','readonly',get_lang('ReadOnly'));			
+		$checked =&$form->addElement('checkbox','readonly',get_lang('ReadOnly'));
 		if ($readonly==1)
-		{ 
+		{
 			$checked->setChecked(true);
 		}
-	}		
+	}
 	$form->addElement('style_submit_button','submit',get_lang('SaveDocument'), 'class="save"');
-			
+
 	$defaults['filename'] = $filename;
 	$defaults['extension'] = $extension;
 	$defaults['file_path'] = Security::remove_XSS($_GET['file']);
 	$defaults['commentPath'] = $file;
 	$defaults['renameTo'] = $file_name;
 	$defaults['newComment'] = $oldComment;
-	
+
 	$form->setDefaults($defaults);
 	// show templates
 	/*
-	$form->addElement('html','<div id="frmModel" style="display:block; height:525px; width:240px; position:absolute; top:115px; left:1px;"></div>');			
+	$form->addElement('html','<div id="frmModel" style="display:block; height:525px; width:240px; position:absolute; top:115px; left:1px;"></div>');
 	*/
-	$form->display();			
+	$form->display();
 
 	//Display::display_error_message(get_lang('ReadOnlyFile')); //main API
 

+ 2 - 2
main/document/headerpage.php

@@ -8,7 +8,7 @@
 $language_file = 'document';
 require_once '../inc/global.inc.php';
 $noPHP_SELF=true;
-$header_file= Security::remove_XSS($_GET['file']);	
+$header_file= Security::remove_XSS($_GET['file']);
 $path_array=explode('/',str_replace('\\','/',$header_file));
 $path_array = array_map('urldecode',$path_array);
 $header_file=implode('/',$path_array);
@@ -26,6 +26,6 @@ $path_info= pathinfo($file_url_sys);
 
 Display::display_header(null,"Doc");
 echo "<div align=\"center\">";
-$file_url_web=api_get_path('WEB_COURSE_PATH').$_course['path'].'/document'.$header_file."?".api_get_cidreq();	
+$file_url_web=api_get_path('WEB_COURSE_PATH').$_course['path'].'/document'.$header_file."?".api_get_cidreq();
 echo "<a href='".$file_url_web."' target='blank'>".get_lang('_cut_paste_link')."</a></div>";
 ?>

+ 20 - 20
main/document/quota.php

@@ -2,20 +2,20 @@
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004 Dokeos S.A.
 	Copyright (c) 2005 Roan Embrechts, Vrije Universiteit Brussel
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
 ==============================================================================
 */
@@ -29,18 +29,18 @@
 *	@package dokeos.document
 ==============================================================================
 */
-	
+
 // name of the language file that needs to be included
 $language_file = 'document';
- 
+
 // including the global dokeos file
-require_once "../inc/global.inc.php"; 
+require_once "../inc/global.inc.php";
 
 // including additional libraries
 require_once api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php';
 require_once api_get_path(LIBRARY_PATH) . 'document.lib.php';
-	
-// some constants and variables 
+
+// some constants and variables
 $courseDir   = $_course['path']."/document";
 $maxFilledSpace = DEFAULT_DOCUMENT_QUOTA;
 
@@ -59,7 +59,7 @@ Display::display_header($nameTools,"Doc");
 ==============================================================================
 		FUNCTIONS
 ==============================================================================
-*/ 
+*/
 
 /**
 *	Here we count 1 kilobyte = 1000 byte, 12 megabyte = 1000 kilobyte.
@@ -69,13 +69,13 @@ function display_quota($course_quota, $already_consumed_space)
 	$course_quota_m = round($course_quota / 1000000);
 	$already_consumed_space_m = round($already_consumed_space / 1000000);
 	$message = get_lang("CourseCurrentlyUses") . " <strong>" . $already_consumed_space_m . " megabyte</strong>.<br/>". get_lang("MaximumAllowedQuota") . " <strong>$course_quota_m megabyte</strong>.<br/>";
-	
+
 	$percentage = $already_consumed_space / $course_quota * 100;
 	$percentage = round($percentage);
 
 	if ($percentage < 100) $other_percentage = 100 - $percentage;
 	else $other_percentage = 0;
-	
+
 	//decide where to place percentage in graph
 	if ($percentage >= 50)
 	{
@@ -87,24 +87,24 @@ function display_quota($course_quota, $already_consumed_space)
 		$text_in_unfilled = "&nbsp;$other_percentage%".
 		$text_in_filled = "";
 	}
-	
+
 	//decide the background colour of the graph
 	if ($percentage < 65) $colour = "#00BB00"; //safe - green
 	else if ($percentage < 90) $colour = "#ffd400"; //filling up - yelloworange
 	else $colour = "#DD0000"; //full - red
-	
+
 	//this is used for the table width: a table of only 100 pixels looks too small
 	$visual_percentage = 4 * $percentage;
 	$visual_other_percentage = 4 * $other_percentage;
-	
-	$message .=  get_lang("PercentageQuotaInUse") . ": <strong>$percentage%</strong>.<br/>" . 
+
+	$message .=  get_lang("PercentageQuotaInUse") . ": <strong>$percentage%</strong>.<br/>" .
 				get_lang("PercentageQuotaFree") . ": <strong>$other_percentage%</strong>.<br>";
-	
+
 	$message .= "<br/><table cellpadding=\"\" cellspacing=\"0\" height=\"40\"><tr>
 				<td bgcolor=\"$colour\" width=\"$visual_percentage\"></td>
 				<td bgcolor=\"Silver\" width=\"$visual_other_percentage\">&nbsp;$other_percentage%</td>
 				</tr></table>";
-				
+
 	echo $message;
 }
 
@@ -113,7 +113,7 @@ echo '<div class="actions">';
 // link back to the documents overview
 echo '<a href="document.php">'.Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview')).get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview').'</a>';
 echo '</div>';
-	
+
 // getting the course quota
 $course_quota = DocumentManager::get_course_quota();
 

+ 25 - 25
main/document/showinframes.php

@@ -1,31 +1,31 @@
-<?php // $Id: showinframes.php 22177 2009-07-16 22:30:39Z iflorespaz $ 
+<?php // $Id: showinframes.php 22177 2009-07-16 22:30:39Z iflorespaz $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004-2008 Dokeos S.A.
 	Copyright (c) 2003 Ghent University (UGent)
 	Copyright (c) 2001 Universite catholique de Louvain (UCL)
 	Copyright (c) Hugues Peeters
 	Copyright (c) Roan Embrechts
-	
+
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
-	
+
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
 	as published by the Free Software Foundation; either version 2
 	of the License, or (at your option) any later version.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 /**
-============================================================================== 
+==============================================================================
 *	This file will show documents in a separate frame.
 *	We don't like frames, but it was the best of two bad things.
 *
@@ -47,38 +47,38 @@
 *	@package dokeos.document
 ==============================================================================
 */
-	
+
 /*
-============================================================================== 
-	   DOKEOS INIT 
-============================================================================== 
-*/ 
+==============================================================================
+	   DOKEOS INIT
+==============================================================================
+*/
 $language_file[] = 'document';
 require_once '../inc/global.inc.php';
 require_once '../glossary/glossary.class.php';
 if (!empty($_GET['nopages'])) {
 	$nopages=Security::remove_XSS($_GET['nopages']);
-	if ($nopages==1) {		
+	if ($nopages==1) {
 		require_once api_get_path(INCLUDE_PATH).'reduced_header.inc.php';
 		Display::display_error_message(get_lang('FileNotFound'));
 	}
-	exit;	
+	exit;
 }
 
 $_SESSION['whereami'] = 'document/view';
-	
+
 $interbreadcrumb[]= array ('url'=>'./document.php', 'name'=> get_lang('Documents'));
 $nameTools = get_lang('Documents');
 $file = Security::remove_XSS(urldecode($_GET['file']));
 /*
-============================================================================== 
+==============================================================================
 		Main section
-============================================================================== 
-*/ 
+==============================================================================
+*/
 header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
 //header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
 header('Last-Modified: Wed, 01 Jan 2100 00:00:00 GMT');
-		
+
 header('Cache-Control: no-cache, must-revalidate');
 header('Pragma: no-cache');
 
@@ -87,7 +87,7 @@ $browser_display_title = "Dokeos Documents - " . Security::remove_XSS($_GET['cid
 //only admins get to see the "no frames" link in pageheader.php, so students get a header that's not so high
 $frameheight = 135;
 if($is_courseAdmin) {
-	$frameheight = 165;	
+	$frameheight = 165;
 }
 
 $file_root=$_course['path'].'/document'.str_replace('%2F', '/',$file);
@@ -104,10 +104,10 @@ $path_info= pathinfo($file_url_sys);
 	<frameset rows="<?php echo $frameheight; ?>,*" border="0" frameborder="no" >
 		<frame name="top" scrolling="no" noresize target="contents" src="headerpage.php?file=<?php echo $file.'&amp;'.api_get_cidreq(); ?>" />
 		<?php
-		if (file_exists($file_url_sys)) {								
-			echo '<frame name="main" id="framemain" src="'.$file_url_web.'?'.api_get_cidreq().'&rand='.mt_rand(1,10000).'" />';		
+		if (file_exists($file_url_sys)) {
+			echo '<frame name="main" id="framemain" src="'.$file_url_web.'?'.api_get_cidreq().'&rand='.mt_rand(1,10000).'" />';
 		} else {
-			echo '<frame name="main" id="framemain" src=showinframes.php?nopages=1 />';				
+			echo '<frame name="main" id="framemain" src=showinframes.php?nopages=1 />';
 		}
 		?>
 	<noframes>

+ 13 - 13
main/document/slideshow.inc.php

@@ -20,11 +20,11 @@
 ==============================================================================
 */
 /**
-============================================================================== 
+==============================================================================
 *	@author Patrick Cool
 *	@package dokeos.document
 *	@todo convert comments to be understandable to phpDocumentor
-============================================================================== 
+==============================================================================
 */
 /*
 ==============================================================================
@@ -34,11 +34,11 @@ Ghent University
 Mai 2004
 http://icto.UGent.be
 
-Please bear in mind that this is only an alpha release. 
-I wrote this quite quick and didn't think too much about it in advance. 
+Please bear in mind that this is only an alpha release.
+I wrote this quite quick and didn't think too much about it in advance.
 It is not perfect at all but it is workable and usefull (I think)
 Do not consider this as a powerpoint replacement, although it has
-the same starting point. 
+the same starting point.
 ==============================================================================
 */
 /*
@@ -47,11 +47,11 @@ Description:
 	This is a plugin for the documents tool. It looks for .jpg, .jpeg, .gif, .png
 	files (since these are the files that can be viewed in a browser) and creates
 	a slideshow with it by allowing to go to the next/previous image.
-	You can also have a quick overview (thumbnail view) of all the images in 
+	You can also have a quick overview (thumbnail view) of all the images in
 	that particular folder.
 	Maybe it is important to notice that each slideshow is folder based. Only
-	the images of the chosen folder are shown. 
-	
+	the images of the chosen folder are shown.
+
 	This file has two large sections.
 	1. code that belongs in document.php, but to avoid clutter I put the code here
 	2. the function resize_image that handles the image resizing
@@ -77,8 +77,8 @@ Description:
 function resize_image($image, $target_width, $target_height, $slideshow=0) {
 /*  // Replaced fragment of code by Ivan Tcholakov, 04-MAY-2009.
 	// 1. grabbing the image height and width of the original image
-		$image_properties=getimagesize($image); 
-		$source_width=$image_properties["0"]; 
+		$image_properties=getimagesize($image);
+		$source_width=$image_properties["0"];
 		$source_height=$image_properties["1"];
 		//print_r($image_properties);
 
@@ -95,12 +95,12 @@ function resize_image($image, $target_width, $target_height, $slideshow=0) {
 		{
 		if ($resize_factor_width<=1 and $resize_factor_height<=1)
 			{
-			if ($resize_factor_width > $resize_factor_height)	
+			if ($resize_factor_width > $resize_factor_height)
 				{
 				$image_width=$target_width;
 				$image_height=ceil($source_height*$resize_factor_width);
 				}
-			if ($resize_factor_width < $resize_factor_height)	
+			if ($resize_factor_width < $resize_factor_height)
 				{
 				$image_width=ceil($source_width*$resize_factor_height);
 				$image_height=$target_height;
@@ -111,7 +111,7 @@ function resize_image($image, $target_width, $target_height, $slideshow=0) {
 				$image_height=ceil($source_height*$resize_factor_height);
 				}
 			//echo "image width=".$image_width."<br>";
-			//echo "image height=".$image_height; 
+			//echo "image height=".$image_height;
 		} //if ($resize_factor_width<=1 and $resize_factor_height<=1)
 	else // no resizing required
 		{

+ 38 - 38
main/document/slideshow.php

@@ -22,11 +22,11 @@
 ==============================================================================
 */
 /**
-============================================================================== 
+==============================================================================
 *	@author Patrick Cool
-*   @author Julio Montoya Lots of improvements, cleaning, adding security 
+*   @author Julio Montoya Lots of improvements, cleaning, adding security
 *	@package dokeos.document
-============================================================================== 
+==============================================================================
 */
 /*
 ==============================================================================
@@ -44,7 +44,7 @@ January 2008
 */
 // including the language file
 
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = array ('slideshow', 'document');
 require_once '../inc/global.inc.php';
 $noPHP_SELF = true;
@@ -66,7 +66,7 @@ $url = "document.php?curdirpath=".$pathurl;
 $originaltoolname = get_lang('Documents');
 $interbreadcrumb[] = array ("url" => Security::remove_XSS($url), "name" => $originaltoolname);
 
-// because $nametools uses $_SERVER['PHP_SELF'] for the breadcrumbs instead of $_SERVER['REQUEST_URI'], I had to 
+// because $nametools uses $_SERVER['PHP_SELF'] for the breadcrumbs instead of $_SERVER['REQUEST_URI'], I had to
 // bypass the $nametools thing and use <b></b> tags in the $interbreadcrump array
 //$url = "slideshow.php?curdirpath=".$pathurl;
 $originaltoolname = get_lang('SlideShow');
@@ -109,7 +109,7 @@ function MM_openBrWindow(theURL,winName,features) { //v2.0
 		echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'"><img src="'.api_get_path(WEB_IMG_PATH).'thumbnails.png" alt="">'.get_lang('_show_thumbnails').'</a>&nbsp;';
 	} else {
 		echo '<img src="'.api_get_path(WEB_IMG_PATH).'thumbnails_na.png" alt="">'.get_lang('_show_thumbnails').'&nbsp;';
-	}	
+	}
 	// slideshow options
 	echo '<a href="slideshowoptions.php?curdirpath='.$pathurl.'"><img src="'.api_get_path(WEB_IMG_PATH).'acces_tool.gif" alt="">'.get_lang('_set_slideshow_options').'</a> &nbsp;';
 ?>
@@ -126,11 +126,11 @@ if (isset ($_POST['Submit'])) {
 	// we come from slideshowoptions.php
 	$_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']);
 	if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') {
-		//echo "resizing"; 
+		//echo "resizing";
 		$_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']);
 		$_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']);
 	} else {
-		//echo "unsetting the session heighte and width"; 
+		//echo "unsetting the session heighte and width";
 		$_SESSION["image_resizing_width"] = null;
 		$_SESSION["image_resizing_height"] = null;
 	}
@@ -149,28 +149,28 @@ if ($_SESSION["image_resizing"] == "resizing") {
 // =======================================================================
 //						THUMBNAIL VIEW
 // =======================================================================
-// this is for viewing all the images in the slideshow as thumbnails. 
+// this is for viewing all the images in the slideshow as thumbnails.
 $image_tag = array ();
 if ($slide_id == "all") {
 	$thumbnail_width = 100;
 	$thumbnail_height = 100;
-	$row_items = 4;	
+	$row_items = 4;
 	if (is_array($image_files_only)) {
-		foreach ($image_files_only as $one_image_file) {	
+		foreach ($image_files_only as $one_image_file) {
 			$image = $sys_course_path.$_course['path']."/document".$folder.$one_image_file;
 			if (file_exists($image)) {
 				$image_height_width = resize_image($image, $thumbnail_width, $thumbnail_height, 1);
-				
+
 				$image_height = $image_height_width[0];
-				$image_width = $image_height_width[1];		
-				
+				$image_width = $image_height_width[1];
+
 				if ($path and $path !== "/") {
 					$doc_url = $path."/".$one_image_file;
 				} else {
 					$doc_url = $path.$one_image_file;
-				}	
-				$image_tag[] = "<img src='download.php?doc_url=".$doc_url."' border='0' width='".$image_width."' height='".$image_height."' title='".$one_image_file."'>";			
-			}		
+				}
+				$image_tag[] = "<img src='download.php?doc_url=".$doc_url."' border='0' width='".$image_width."' height='".$image_height."' title='".$one_image_file."'>";
+			}
 		} // foreach ($image_files_only as $one_image_file)
 	}
 } // if ($slide_id=="all")
@@ -184,12 +184,12 @@ $number_image=6;
 $number_iteration=ceil($count_image/$number_image);
 $p=0;
 for ($k=0;$k<$number_iteration;$k++) {
-	echo '<tr height="'.$thumbnail_height.'">';	
+	echo '<tr height="'.$thumbnail_height.'">';
 	for ($i=0;$i<$number_image;$i++) {
 			if (!is_null($image_tag[$p])) {
 				echo '<td  style="border:1px solid; border-color: #CCCCCC #666666 #666666 #CCCCCC;">';
 				echo '<div align="center"><a href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.' ">'.$image_tag[$p].'</a>';
-				echo '</div></td>';				
+				echo '</div></td>';
 			}
 			$p++;
 		}
@@ -200,38 +200,38 @@ echo '</table>';
 // =======================================================================
 //						ONE AT A TIME VIEW
 // =======================================================================
-// this is for viewing all the images in the slideshow one at a time. 
+// this is for viewing all the images in the slideshow one at a time.
 if ($slide_id !== "all") {
 	$image = $sys_course_path.$_course['path']."/document".$folder.$image_files_only[$slide];
 	if (file_exists($image)) {
 		$image_height_width = resize_image($image, $target_width, $target_height);
-	
+
 		$image_height = $image_height_width[0];
 		$image_width = $image_height_width[1];
-	
+
 		if ($_SESSION["image_resizing"] == "resizing") {
 			$height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"';
-			
+
 			/* // Removed by Ivan Tcholakov, 04-MAY-2009. After some changes this fragment of code is not needed anymore.
-			//adjust proportions. Juan Carlos Raсa Trabado TODO: replace resize_image function ?	
+			//adjust proportions. Juan Carlos Raсa Trabado TODO: replace resize_image function ?
 			$size = @ getimagesize($image);
 			$height_width_tags = (($size[1] > $image_width) ? 'width="'.$image_width.'"' : '');
-			$height_width_tags = (($size[1] > $image_height) ? 'height="'.$image_height.'"' : '');		
+			$height_width_tags = (($size[1] > $image_height) ? 'height="'.$image_height.'"' : '');
 			*/
-		}		
-	
+		}
+
 		// showing the comment of the image, Patrick Cool, 8 april 2005
 		// this is done really quickly and should be cleaned up a little bit using the API functions
 		$tbl_documents = Database::get_course_table(TABLE_DOCUMENT);
 		if ($path=='/') {
 			$pathpart='/';
 		} else {
-			$pathpart=$path.'/'; 
+			$pathpart=$path.'/';
 		}
 		$sql = "SELECT * FROM $tbl_documents WHERE path='".Database::escape_string($pathpart.$image_files_only[$slide])."'";
 		$result = api_sql_query($sql,__FILE__,__LINE__);
 		$row = Database::fetch_array($result);
-	
+
 		// back forward buttons
 		echo '<table align="center" border="0">';
 		echo '<tr>';
@@ -243,11 +243,11 @@ if ($slide_id !== "all") {
 		echo '<img src="'.api_get_path(WEB_IMG_PATH).'silde_back.gif" alt="">';
 		if ($slide > 0) {
 			echo "</a> ";
-		}	
+		}
 		// divider
 		if ($slide_id <> "all") {
 			echo '</td><td valign="middle"> [ '.$next_slide.'/'.$total_slides.' ] </td><td>';
-		}		
+		}
 		// next slide
 		if ($slide < $total_slides -1 and $slide_id <> "all") {
 			echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>";
@@ -259,9 +259,9 @@ if ($slide_id !== "all") {
 		echo '</td>';
 		echo '</tr>';
 		echo '</table>';
-		
+
 		echo '<br/>';
-	
+
 		echo '<table align="center" border="0">';
 		echo '<tr>';
 		echo '<td align="center">';
@@ -272,18 +272,18 @@ if ($slide_id !== "all") {
 		echo '<td align="center">';
 		$aux= explode(".", htmlspecialchars($image_files_only[$slide]));
 	    $ext= $aux[count($aux)-1];
-		echo '<strong>'.basename(htmlspecialchars($image_files_only[$slide]), '.'.$ext).'</strong>';			
-		echo '<br />'.$row['comment'].'<br />';	
+		echo '<strong>'.basename(htmlspecialchars($image_files_only[$slide]), '.'.$ext).'</strong>';
+		echo '<br />'.$row['comment'].'<br />';
 		list($width, $high) = getimagesize($image);
 		echo $width.' x '.$high.' <br />';
-		echo round((filesize($image)/1024),2).' KB';	
-	    echo ' - '.$ext; 	
+		echo round((filesize($image)/1024),2).' KB';
+	    echo ' - '.$ext;
 		echo '</td>';
 		echo '</tr>';
 		echo '</table>';
 	} else {
 		Display::display_warning_message(get_lang('FileNotFound'));
-	}		
+	}
 } // if ($slide_id!=="all")
 
 Display :: display_footer();

+ 41 - 41
main/document/slideshowoptions.php

@@ -1,4 +1,4 @@
-<?php // $Id: slideshowoptions.php 22565 2009-08-02 21:12:59Z yannoo $ 
+<?php // $Id: slideshowoptions.php 22565 2009-08-02 21:12:59Z yannoo $
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
@@ -21,10 +21,10 @@
 ==============================================================================
 */
 /**
-============================================================================== 
+==============================================================================
 *	@author Patrick Cool
 *	@package dokeos.document
-============================================================================== 
+==============================================================================
 */
 
 /*
@@ -35,11 +35,11 @@ Ghent University
 May 2004
 http://icto.UGent.be
 
-Please bear in mind that this is only an beta release. 
-I wrote this quite quick and didn't think too much about it in advance. 
+Please bear in mind that this is only an beta release.
+I wrote this quite quick and didn't think too much about it in advance.
 It is not perfect at all but it is workable and usefull (I think)
 Do not consider this as a powerpoint replacement, although it has
-the same starting point. 
+the same starting point.
 ==============================================================================
 */
 /*
@@ -48,18 +48,18 @@ Description:
 	This is a plugin for the documents tool. It looks for .jpg, .jpeg, .gif, .png
 	files (since these are the files that can be viewed in a browser) and creates
 	a slideshow with it by allowing to go to the next/previous image.
-	You can also have a quick overview (thumbnail view) of all the images in 
+	You can also have a quick overview (thumbnail view) of all the images in
 	that particular folder.
 	Maybe it is important to notice that each slideshow is folder based. Only
-	the images of the chosen folder are shown. 
-	
+	the images of the chosen folder are shown.
+
 	On this page the options of the slideshow can be set: maintain the original file
 	or resize the file to a given width.
 ==============================================================================
 
 */
 // including the language file
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = array ('slideshow', 'document');
 
 require_once '../inc/global.inc.php';
@@ -76,7 +76,7 @@ $url="slideshow.php?curdirpath=".$pathurl;
 $originaltoolname=get_lang('SlideShow');
 $interbreadcrumb[]= array ("url"=>$url, "name"=>$originaltoolname );
 
-// because $nametools uses $_SERVER['PHP_SELF'] for the breadcrumbs instead of $_SERVER['REQUEST_URI'], I had to 
+// because $nametools uses $_SERVER['PHP_SELF'] for the breadcrumbs instead of $_SERVER['REQUEST_URI'], I had to
 // bypass the $nametools thing and use <b></b> tags in the $interbreadcrump array
 $url="slideshowoptions.php?curdirpath=".$pathurl;
 $originaltoolname="<b>".get_lang('_slideshow_options')."</b>";
@@ -84,9 +84,9 @@ $interbreadcrumb[]= array ("url"=>$url, "name"=>$originaltoolname );
 
 Display::display_header($originalToolName,"Doc");
 
-// can't remember why I put this here. This is probably obsolete code 
+// can't remember why I put this here. This is probably obsolete code
 // loading the slides from the session
-//$image_files_only = $_SESSION["image_files_only"]; 
+//$image_files_only = $_SESSION["image_files_only"];
 
 // calculating the current slide, next slide, previous slide and the number of slides
 /*if ($slide_id)
@@ -94,12 +94,12 @@ Display::display_header($originalToolName,"Doc");
 	$slide=$slide_id;
 	}
 else
-	{ 
-	$slide=0;  
+	{
+	$slide=0;
 	}
 $previous_slide=$slide-1;
 $next_slide=$slide+1;
-$total_slides=count($image_files_only); 
+$total_slides=count($image_files_only);
 */
 ?>
 <style type="text/css">
@@ -118,16 +118,16 @@ $total_slides=count($image_files_only);
 
 
 function enableresizing() { //v2.0
-	document.options.width.disabled=false; 
-	document.options.width.className='enabled_input'; 
+	document.options.width.disabled=false;
+	document.options.width.className='enabled_input';
 	document.options.height.disabled=false;
-	document.options.height.className='enabled_input'; 
+	document.options.height.className='enabled_input';
 }
 function disableresizing() { //v2.0
-	document.options.width.disabled=true; 
-	document.options.width.className='disabled_input'; 
+	document.options.width.disabled=true;
+	document.options.width.className='disabled_input';
 	document.options.height.disabled=true;
-	document.options.height.className='disabled_input'; 
+	document.options.height.className='disabled_input';
 }
 
 window.onload = <?php echo $_SESSION['image_resizing'] == 'resizing' ? 'enableresizing' : 'disableresizing'; ?>;
@@ -144,14 +144,14 @@ echo '</div>';
 ?>
 
 <form action="slideshow.php?curdirpath=<?php echo $pathurl; ?>" method="post" name="options" id="options">
-	
+
 	<div class="row"><div class="form_header"><?php echo get_lang('_slideshow_options') ?></div></div>
 
 	<div class="row">
 		<div class="label">
-			<input class="checkbox" name="radio_resizing" type="radio" onClick="disableresizing()" value="noresizing" 
-	  <?php 
-	  $image_resizing=$_SESSION["image_resizing"]; 
+			<input class="checkbox" name="radio_resizing" type="radio" onClick="disableresizing()" value="noresizing"
+	  <?php
+	  $image_resizing=$_SESSION["image_resizing"];
 	  if($image_resizing=="noresizing" or $image_resizing=="")
 	  	{
 		echo " checked";
@@ -161,47 +161,47 @@ echo '</div>';
 		<div class="formw"><?php echo get_lang('_no_resizing');?><br /><?php echo get_lang('_no_resizing_comment');?>
 		</div>
 	</div>
-	
 
-	
+
+
 	<div class="row">
 		<div class="label">
 			<input class="checkbox" name="radio_resizing" type="radio" onClick="enableresizing()" value="resizing"
-	  <?php 
-	  $image_resizing=$_SESSION["image_resizing"]; 
+	  <?php
+	  $image_resizing=$_SESSION["image_resizing"];
 	  if($image_resizing=="resizing")
 	  	{
 		echo " checked";
 		$width=$_SESSION["image_resizing_width"];
 		$height=$_SESSION["image_resizing_height"];
-		} 
+		}
 			?>>
 		</div>
 		<div class="formw">
 			<?php echo get_lang('_resizing');?><br /><?php echo get_lang('_resizing_comment');?><br />
-        <?php echo get_lang('_width');?>: 
-	    &nbsp;<input name="width" type="text" id="width" 
-		<?php 
+        <?php echo get_lang('_width');?>:
+	    &nbsp;<input name="width" type="text" id="width"
+		<?php
 		if ($image_resizing=="resizing") {
 			echo " value='".$width."'";
 			echo " class=\"enabled_input\"";
 	    } else {
-            echo " class=\"disabled_input\""; 
+            echo " class=\"disabled_input\"";
         }
-		?> >        
+		?> >
         <br />
-        <?php echo get_lang('_height');?>: 
+        <?php echo get_lang('_height');?>:
         &nbsp;&nbsp;&nbsp;&nbsp;<input name="height" type="text" id="height"
-		<?php 
+		<?php
 		if ($image_resizing=="resizing") {
 			echo " value='".$height."'";
 			echo " class=\"enabled_input\"";
 		} else {
-            echo " class=\"disabled_input\""; 
+            echo " class=\"disabled_input\"";
         }
 		?> >
 		</div>
-	</div>	
+	</div>
 	<div class="row">
 		<div class="label">
 		</div>
@@ -209,7 +209,7 @@ echo '</div>';
 			<br />
 			<button type="submit" class="save" name="Submit" value="Save" ><?php echo get_lang('Save'); ?></button>
 		</div>
-	</div>	
+	</div>
 </form>
 <?php
 Display::display_footer();

+ 2 - 2
main/document/upload.php

@@ -350,7 +350,7 @@ if(isset($_FILES['user_upload']))
              */
 			if (!empty($_POST['if_exists']) && $_POST['if_exists'] == 'overwrite') {
 				// overwrite the file on search engine
-				// actually, it consists on delete terms from db, insert new ones, create a new search engine document, and remove the old one 
+				// actually, it consists on delete terms from db, insert new ones, create a new search engine document, and remove the old one
 
 				// get search_did
 				$tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
@@ -496,7 +496,7 @@ if(isset($_GET['createdir']))
 	$new_folder_text .= '</form>';
 	//show the form
 	//Display::display_normal_message($new_folder_text, false);
-	
+
 	echo create_dir_form();
 }
 

+ 91 - 91
main/dropbox/dropbox_class.inc.php

@@ -4,7 +4,7 @@
 /**
  * Dropbox module for Dokeos
  * Classes for the dropbox module.
- * 
+ *
  * 3 classes are defined:
  * - Dropbox_Work:
  * 		. id
@@ -23,7 +23,7 @@
  *
  *      . feedback_date  => date of most recent feedback     // RH: Feedback
  *      . feedback      => feedback text (or HTML?)         // RH: Feedback
- * 
+ *
  * - Dropbox_SentWork extends Dropbox_Work
  * 		. recipients	=> array of ["id"]["name"] lists the recipients of the work
  * 											// RH: Mailing: or mailing pseudo_id
@@ -55,7 +55,7 @@ class Dropbox_Work {
 	public $last_upload_date;
 	public $isOldWork;
 	public $feedback_date, $feedback;  // RH: Feedback
-	
+
 	/**
 		* Constructor calls private functions to create a new work or retreive an existing work from DB
 		* depending on the number of parameters
@@ -75,7 +75,7 @@ class Dropbox_Work {
 			$this->_createExistingWork($arg1);
 		}
 	}
-	
+
 	/**
 		* private function creating a new work object
 	 *
@@ -91,14 +91,14 @@ class Dropbox_Work {
 		*/
 	function _createNewWork ($uploader_id, $title, $description, $author, $filename, $filesize) {
 		global $_user;
-		
+
 		// Do some sanity checks
 		settype($uploader_id, 'integer') or die(dropbox_lang("generalError")." (code 201)"); //set $uploader_id to correct type
 		//if (! isCourseMember($uploader_id)) die(); //uploader must be coursemember to be able to upload
 			//-->this check is done when submitting data so it isn't checked here
-			
+
 		// Fill in the properties
-		$this->uploader_id = $uploader_id; 
+		$this->uploader_id = $uploader_id;
 		$this->uploaderName = getUserNameFromId($this->uploader_id);
 		$this->filename = $filename;
 		$this->filesize = $filesize;
@@ -110,8 +110,8 @@ class Dropbox_Work {
 		// Check if object exists already. If it does, the old object is used
 		// with updated information (authors, descriptio, upload_date)
 		$this->isOldWork = FALSE;
-		$sql="SELECT id, upload_date 
-				FROM ".dropbox_cnf("tbl_file")." 
+		$sql="SELECT id, upload_date
+				FROM ".dropbox_cnf("tbl_file")."
 				WHERE filename = '".addslashes($this->filename)."'";
         $result = api_sql_query($sql,__FILE__,__LINE__);
 		$res = mysql_fetch_array($result);
@@ -132,7 +132,7 @@ class Dropbox_Work {
 			$result = api_sql_query($sql,__FILE__,__LINE__);
 		} else {
 			$this->upload_date = $this->last_upload_date;
-			$sql="INSERT INTO ".dropbox_cnf("tbl_file")." 
+			$sql="INSERT INTO ".dropbox_cnf("tbl_file")."
 				(uploader_id, filename, filesize, title, description, author, upload_date, last_upload_date, session_id)
 				VALUES ('".addslashes($this->uploader_id)."'
 						, '".addslashes($this->filename)."'
@@ -145,19 +145,19 @@ class Dropbox_Work {
 						, ".intval($_SESSION['id_session'])."
 						)";
 
-        	$result = api_sql_query($sql,__FILE__,__LINE__);		
+        	$result = api_sql_query($sql,__FILE__,__LINE__);
 			$this->id = mysql_insert_id(); //get automatically inserted id
 		}
-		
+
 		// insert entries into person table
-		$sql="INSERT INTO ".dropbox_cnf("tbl_person")." 
+		$sql="INSERT INTO ".dropbox_cnf("tbl_person")."
 				(file_id, user_id)
 				VALUES ('".addslashes($this->id)."'
 						, '".addslashes($this->uploader_id)."'
 						)";
         $result = api_sql_query($sql);	//if work already exists no error is generated
 	}
-	
+
 	/**
 		* private function creating existing object by retreiving info from db
 	 *
@@ -165,7 +165,7 @@ class Dropbox_Work {
 		*/
 	function _createExistingWork ($id) {
 		global $_user;  // RH: Feedback
-		
+
 		// Do some sanity checks
 		settype($id, 'integer') or die(dropbox_lang("generalError")." (code 205)"); //set $id to correct type
 
@@ -175,19 +175,19 @@ class Dropbox_Work {
 				WHERE id='".addslashes($id)."'";
         $result = api_sql_query($sql,__FILE__,__LINE__);
 		$res = mysql_fetch_array($result,MYSQL_ASSOC);
-		
+
 		// Check if uploader is still in Dokeos system
-		$uploader_id = stripslashes($res["uploader_id"]);    
+		$uploader_id = stripslashes($res["uploader_id"]);
 		$uploaderName = getUserNameFromId($uploader_id);
 		if ($uploaderName == FALSE) {
 			//deleted user
 			$this->uploader_id = -1;
-			$this->uploaderName = dropbox_lang("anonymous", "noDLTT");			
+			$this->uploaderName = dropbox_lang("anonymous", "noDLTT");
 		} else {
-			$this->uploader_id = $uploader_id; 
-			$this->uploaderName = $uploaderName;			
+			$this->uploader_id = $uploader_id;
+			$this->uploaderName = $uploaderName;
 		}
-		
+
 		// Fill in properties
 		$this->id = $id;
 		$this->filename = stripslashes($res["filename"]);
@@ -198,8 +198,8 @@ class Dropbox_Work {
 		$this->upload_date = stripslashes($res["upload_date"]);
 		$this->last_upload_date = stripslashes($res["last_upload_date"]);
 		$this->category = $res['cat_id'];
-		
-		
+
+
 		// Getting the feedback on the work.
 		if ($_GET['action']=='viewfeedback' AND $this->id==$_GET['id']) {
 			$feedback2=array();
@@ -208,13 +208,13 @@ class Dropbox_Work {
 			while ($row_feedback=Database::fetch_array($result)) {
 				$feedback2[]=$row_feedback;
 			}
-			$this->feedback2=$feedback2; 
+			$this->feedback2=$feedback2;
 		}
 		/*
 		// RH: Feedback
 		$result = api_sql_query("SELECT feedback_date, feedback, cat_id FROM ".
 		    dropbox_cnf("tbl_post")." WHERE dest_user_id='".$_user['user_id'].
-		    "' AND file_id='".$id."'",__FILE__,__LINE__);		
+		    "' AND file_id='".$id."'",__FILE__,__LINE__);
 		if ($res = mysql_fetch_array($result))
 		{
     		$this->feedback_date = $res["feedback_date"];
@@ -227,7 +227,7 @@ class Dropbox_Work {
 class Dropbox_SentWork extends Dropbox_Work
 {
 	public $recipients;	//array of ["id"]["name"] arrays
-	
+
 	/**
 		* Constructor calls private functions to create a new work or retreive an existing work from DB
 		* depending on the number of parameters
@@ -267,7 +267,7 @@ class Dropbox_SentWork extends Dropbox_Work
 		// Do sanity checks on recipient_ids array & property fillin
 		// The sanity check for ex-coursemembers is already done in base constructor
 		settype($uploader_id, 'integer') or die(dropbox_lang("generalError")." (code 208)"); //set $uploader_id to correct type
-		
+
 		$justSubmit = FALSE;  // RH: mailing zip-file or just upload
 		if ( is_int($recipient_ids)) {
 			$justSubmit = TRUE; $recipient_ids = array($recipient_ids + $this->id);
@@ -283,16 +283,16 @@ class Dropbox_SentWork extends Dropbox_Work
 				//this check is done when validating submitted data
 			$this->recipients[] = array("id"=>$rec, "name"=>getUserNameFromId($rec));
 		}
-		
+
 		// insert data in dropbox_post and dropbox_person table for each recipient
 		foreach ($this->recipients as $rec) {
-			$sql="INSERT INTO ".dropbox_cnf("tbl_post")." 
+			$sql="INSERT INTO ".dropbox_cnf("tbl_post")."
 				(file_id, dest_user_id, session_id)
 				VALUES ('".addslashes($this->id)."', '".addslashes($rec["id"])."', ".intval($_SESSION['id_session']).")";
 	        $result = api_sql_query($sql);	//if work already exists no error is generated
-						
+
 			//insert entries into person table
-			$sql="INSERT INTO ".dropbox_cnf("tbl_person")." 
+			$sql="INSERT INTO ".dropbox_cnf("tbl_person")."
 				(file_id, user_id)
 				VALUES ('".addslashes($this->id)."'
 						, '".addslashes($rec["id"])."'
@@ -300,11 +300,11 @@ class Dropbox_SentWork extends Dropbox_Work
         	// RH: do not add recipient in person table if mailing zip or just upload
 			if (!$justSubmit) {
 				$result = api_sql_query($sql);	//if work already exists no error is generated
-			} 
+			}
 			//update item_property (previously last_tooledit) table for each recipient
-			
+
 			global $_course, $dropbox_cnf;
-			
+
 			if (($ownerid = $this->uploader_id) > $dropbox_cnf["mailingIdBase"]) {
 			    $ownerid = getUserOwningThisMailing($ownerid);
 			}
@@ -314,7 +314,7 @@ class Dropbox_SentWork extends Dropbox_Work
 			api_item_property_update($_course, TOOL_DROPBOX, $this->id, "DropboxFileAdded", $ownerid, NULL, $recipid) ;
 		}
 	}
-	
+
 	/**
 		* private function creating existing object by retreiving info from db
 	 *
@@ -323,13 +323,13 @@ class Dropbox_SentWork extends Dropbox_Work
 	function _createExistingSentWork  ($id) {
 		// Call constructor of Dropbox_Work object
 		$this->Dropbox_Work($id);
-		
+
 		// Do sanity check. The sanity check for ex-coursemembers is already done in base constructor
 		settype($id, 'integer') or die(dropbox_lang("generalError")." (code 211)"); //set $id to correct type
 
 		//Fill in recipients array/
 		$this->recipients = array();  // RH: Feedback: added to SELECT
-		$sql="SELECT dest_user_id, feedback_date, feedback 
+		$sql="SELECT dest_user_id, feedback_date, feedback
 				FROM ".dropbox_cnf("tbl_post")."
 				WHERE file_id='".addslashes($id)."'";
         $result = api_sql_query($sql,__FILE__,__LINE__);
@@ -341,7 +341,7 @@ class Dropbox_SentWork extends Dropbox_Work
 			if ($recipientName == FALSE) {
 				$this->recipients[] = array("id"=>-1, "name"=> dropbox_lang("anonymous", "noDLTT"));
 			} else {
-				$this->recipients[] = array("id"=>$dest_user_id, "name"=>$recipientName, "user_id"=>$dest_user_id, 
+				$this->recipients[] = array("id"=>$dest_user_id, "name"=>$recipientName, "user_id"=>$dest_user_id,
 				    "feedback_date"=>$res["feedback_date"], "feedback"=>$res["feedback"]);  // RH: Feedback
 			}
 		}
@@ -355,7 +355,7 @@ class Dropbox_Person
 	public $userId = 0;
 	public $isCourseAdmin = FALSE;
 	public $isCourseTutor = FALSE;
-	public $_orderBy = '';	//private property that determines by which field 
+	public $_orderBy = '';	//private property that determines by which field
 						//the receivedWork and the sentWork arrays are sorted
 
 	/**
@@ -370,22 +370,22 @@ class Dropbox_Person
 		// Fill in properties
 		$this->userId = $userId;
 		$this->isCourseAdmin = $isCourseAdmin;
-		$this->isCourseTutor = $isCourseTutor;	
+		$this->isCourseTutor = $isCourseTutor;
 		$this->receivedWork = array();
 		$this->sentWork = array();
 
 		//Note: perhaps include an ex coursemember check to delete old files
-		
+
 		$post_tbl = Database::get_course_table(TABLE_DROPBOX_POST);
 		$person_tbl = Database::get_course_table(TABLE_DROPBOX_PERSON);
 		$file_tbl = Database::get_course_table(TABLE_DROPBOX_FILE);
 		// find all entries where this person is the recipient
 		$sql = "SELECT r.file_id, r.cat_id
 				FROM $post_tbl r, $person_tbl p
-				WHERE r.dest_user_id = '".addslashes($this->userId)."' 
+				WHERE r.dest_user_id = '".addslashes($this->userId)."'
 					AND r.dest_user_id = p.user_id
 					AND r.file_id = p.file_id";
-					
+
 		if (intval($_SESSION['id_session']>0)) {
 			$sql .= " AND r.session_id = ".intval($_SESSION['id_session']);
 		}
@@ -394,15 +394,15 @@ class Dropbox_Person
 			$temp = new Dropbox_Work($res["file_id"]);
 			$temp -> category = $res['cat_id'];
 			$this->receivedWork[] = $temp;
-		}	
+		}
 
 		// find all entries where this person is the sender/uploader
-		$sql = "SELECT f.id 
-				FROM $file_tbl f, $person_tbl p 
+		$sql = "SELECT f.id
+				FROM $file_tbl f, $person_tbl p
 				WHERE f.uploader_id = '".addslashes($this->userId)."'
 				AND f.uploader_id = p.user_id
-				AND f.id = p.file_id";					
-				
+				AND f.id = p.file_id";
+
 		if(intval($_SESSION['id_session']>0)) {
 			$sql .= " AND f.session_id = ".intval($_SESSION['id_session']);
 		}
@@ -411,11 +411,11 @@ class Dropbox_Person
 			$this->sentWork[] = new Dropbox_SentWork($res["id"]);
 		}
 	}
-	
+
 	/**
-		* This private method is used by the usort function in  the 
-		* orderSentWork and orderReceivedWork methods. 
-		* It compares 2 work-objects by 1 of the properties of that object, dictated by the 
+		* This private method is used by the usort function in  the
+		* orderSentWork and orderReceivedWork methods.
+		* It compares 2 work-objects by 1 of the properties of that object, dictated by the
 	 * private property _orderBy
 	 *
 	 * @param unknown_type $a
@@ -438,7 +438,7 @@ class Dropbox_Person
 		    return api_strcasecmp($aval, $bval);
 		}
 	}
-	
+
 	/**
 		* method that sorts the objects in the sentWork array, dependent on the $sort parameter.
 		* $sort can be lastDate, firstDate, title, size, ...
@@ -450,31 +450,31 @@ class Dropbox_Person
 
 		*/
 		switch($sort) {
-			case 'lastDate': 
+			case 'lastDate':
 				$this->_orderBy = 'last_upload_date';
 				break;
-			case 'firstDate': 
+			case 'firstDate':
 				$this->_orderBy = 'upload_date';
 				break;
-			case 'title': 
+			case 'title':
 				$this->_orderBy = 'title';
 				break;
-			case 'size': 
+			case 'size':
 				$this->_orderBy = 'filesize';
 				break;
-			case 'author': 
+			case 'author':
 				$this->_orderBy = 'author';
 				break;
-			case 'recipient': 
+			case 'recipient':
 				$this->_orderBy = 'recipients';
 				break;
 			default:
 				$this->_orderBy = 'last_upload_date';
 		} // switch
-		
-		usort($this->sentWork, array($this,"_cmpWork"));	//this calls the _cmpWork method	
+
+		usort($this->sentWork, array($this,"_cmpWork"));	//this calls the _cmpWork method
 	}
-	
+
 	/**
 		* method that sorts the objects in the receivedWork array, dependent on the $sort parameter.
 		* $sort can be lastDate, firstDate, title, size, ...
@@ -482,31 +482,31 @@ class Dropbox_Person
 		*/
 	function orderReceivedWork($sort) {
 		switch($sort) {
-			case 'lastDate': 
+			case 'lastDate':
 				$this->_orderBy = 'last_upload_date';
 				break;
-			case 'firstDate': 
+			case 'firstDate':
 				$this->_orderBy = 'upload_date';
 				break;
-			case 'title': 
+			case 'title':
 				$this->_orderBy = 'title';
 				break;
-			case 'size': 
+			case 'size':
 				$this->_orderBy = 'filesize';
 				break;
-			case 'author': 
+			case 'author':
 				$this->_orderBy = 'author';
 				break;
-			case 'sender': 
+			case 'sender':
 				$this->_orderBy = 'uploaderName';
 				break;
 			default:
 				$this->_orderBy = 'last_upload_date';
 		} // switch
-		
-		usort($this->receivedWork, array($this,"_cmpWork"));	//this calls the _cmpWork method		
+
+		usort($this->receivedWork, array($this,"_cmpWork"));	//this calls the _cmpWork method
 	}
-	
+
 	/**
 		* Deletes all the received work of this person
 	 *
@@ -514,7 +514,7 @@ class Dropbox_Person
 	function deleteAllReceivedWork () {
 		//delete entries in person table concerning received works
 		foreach ($this->receivedWork as $w) {
-			api_sql_query("DELETE FROM ".dropbox_cnf("tbl_person")." WHERE user_id='".$this->userId."' AND file_id='".$w->id."'",__FILE__,__LINE__);		
+			api_sql_query("DELETE FROM ".dropbox_cnf("tbl_person")." WHERE user_id='".$this->userId."' AND file_id='".$w->id."'",__FILE__,__LINE__);
 		}
 		removeUnusedFiles();	//check for unused files
 
@@ -523,7 +523,7 @@ class Dropbox_Person
    /**
     * Deletes all the received categories and work of this person
 	  */
-	function deleteReceivedWorkFolder($id) {	
+	function deleteReceivedWorkFolder($id) {
 		$sql = "DELETE FROM ".dropbox_cnf("tbl_file")." where cat_id = '".$id."' ";
 		if(!api_sql_query($sql))		return false;
 		$sql = "DELETE FROM ".dropbox_cnf("tbl_category")." where cat_id = '".$id."' ";
@@ -531,7 +531,7 @@ class Dropbox_Person
 		$sql = "DELETE FROM ".dropbox_cnf("tbl_post")." where cat_id = '".$id."' ";
 		if(!api_sql_query($sql))		return false;
 		return true;
-	}	
+	}
 	/**
 	 * Deletes a received dropbox file of this person with id=$id
 	 *
@@ -549,25 +549,25 @@ class Dropbox_Person
 		if (! $found) {
 			if(!$this->deleteReceivedWorkFolder($id)) {
 				die(dropbox_lang("generalError")." (code 216)");
-			}	
+			}
 		}
 		//delete entries in person table concerning received works
-		api_sql_query("DELETE FROM ".dropbox_cnf("tbl_person")." WHERE user_id='".$this->userId."' AND file_id='".$id."'",__FILE__,__LINE__);		
+		api_sql_query("DELETE FROM ".dropbox_cnf("tbl_person")." WHERE user_id='".$this->userId."' AND file_id='".$id."'",__FILE__,__LINE__);
 		removeUnusedFiles();	//check for unused files
 	}
-	
+
 	/**
 	 * Deletes all the sent dropbox files of this person
 		*/
 	function deleteAllSentWork () {
 		//delete entries in person table concerning sent works
 		foreach ($this->sentWork as $w) {
-			api_sql_query("DELETE FROM ".dropbox_cnf("tbl_person")." WHERE user_id='".$this->userId."' AND file_id='".$w->id."'",__FILE__,__LINE__);		
+			api_sql_query("DELETE FROM ".dropbox_cnf("tbl_person")." WHERE user_id='".$this->userId."' AND file_id='".$w->id."'",__FILE__,__LINE__);
 			removeMoreIfMailing($w->id);  // RH: Mailing: see init1
-		}		
+		}
 		removeUnusedFiles();	//check for unused files
 	}
-	
+
 	/**
 	 * Deletes a sent dropbox file of this person with id=$id
 	 *
@@ -589,11 +589,11 @@ class Dropbox_Person
 		}
 		//$file_id = $this->sentWork[$index]->id;  // RH: Mailing
 		//delete entries in person table concerning sent works
-		api_sql_query("DELETE FROM ".dropbox_cnf("tbl_person")." WHERE user_id='".$this->userId."' AND file_id='".$id."'",__FILE__,__LINE__);		
+		api_sql_query("DELETE FROM ".dropbox_cnf("tbl_person")." WHERE user_id='".$this->userId."' AND file_id='".$id."'",__FILE__,__LINE__);
 		removeMoreIfMailing($id);  // RH: Mailing: see init1
 		removeUnusedFiles();	//check for unused files
 	}
-	
+
 	/**
 	 * Updates feedback for received work of this person with id=$id
 	 *
@@ -606,7 +606,7 @@ class Dropbox_Person
 		//id check
 		$found = false; $wi = -1;
 		foreach($this->receivedWork as $w) {
-			$wi++; 
+			$wi++;
 			if ($w->id == $id){
 			   $found = true;
 			   break;
@@ -614,18 +614,18 @@ class Dropbox_Person
 		}
 		if (! $found) {
 			die(dropbox_lang("generalError")." (code 221)");
-		} 
-		
+		}
+
 		$feedback_date = date("Y-m-d H:i:s",time());
 		$this->receivedWork[$wi]->feedback_date = $feedback_date;
 		$this->receivedWork[$wi]->feedback = $text;
-		
+
 		api_sql_query("UPDATE ".dropbox_cnf("tbl_post")." SET feedback_date='".
 		    addslashes($feedback_date)."', feedback='".addslashes($text).
-		    "' WHERE dest_user_id='".$this->userId."' AND file_id='".$id."'",__FILE__,__LINE__);		
+		    "' WHERE dest_user_id='".$this->userId."' AND file_id='".$id."'",__FILE__,__LINE__);
 
 		//update item_property (previously last_tooledit) table
-		
+
 		if (($ownerid = $this->receivedWork[$wi]->uploader_id) > $dropbox_cnf["mailingIdBase"]) {
 		    $ownerid = getUserOwningThisMailing($ownerid);
 		}
@@ -639,19 +639,19 @@ class Dropbox_Person
 	 */
 	function filter_received_work($type,$value) {
 		global $dropbox_cnf;
-		
+
     	$new_received_work = array();
 		foreach ($this->receivedWork as $index => $work) {
 			switch ($type) {
 				case 'uploader_id':
-					if ($work->uploader_id == $value || 
+					if ($work->uploader_id == $value ||
 					    ($work->uploader_id > $dropbox_cnf["mailingIdBase"] &&
 					     getUserOwningThisMailing($work->uploader_id) == $value)) {
 						$new_received_work[] = $work;
 					}
 					break;
 				default:
-					$new_received_work[] = $work;	
+					$new_received_work[] = $work;
 			}
 		}
 		$this->receivedWork = $new_received_work;

+ 30 - 30
main/dropbox/dropbox_functions.inc.php

@@ -1,7 +1,7 @@
 <?php //$id: $
 /* For licensing terms, see /dokeos_license.txt */
 /**
-* This file contains additional dropbox functions. Initially there were some 
+* This file contains additional dropbox functions. Initially there were some
 * functions in the init files also but I have moved them over
 * to one file 		-- Patrick Cool <patrick.cool@UGent.be>, Ghent University
 */
@@ -185,7 +185,7 @@ function display_move_form($part, $id, $target=array())
 	echo  '</select>';
 	echo '	</div>
 			</div>';
-	
+
 	echo '
 		<div class="row">
 			<div class="label">
@@ -193,10 +193,10 @@ function display_move_form($part, $id, $target=array())
 			<div class="formw">
 				<button class="next" type="submit" name="do_move" value="'.get_lang('Ok').'">'.get_lang('MoveFile').'</button>
 			</div>
-		</div>	
+		</div>
 	';
 	echo '</form>';
-	
+
 	echo '<div style="clear: both;"></div>';
 }
 
@@ -450,7 +450,7 @@ function display_addcategory_form($category_name='', $id='',$action)
 	if ($action=='addsentcategory') {
 		$target='sent';
 	}
-	
+
 	if ($action=='editcategory') {
 		$text=get_lang('ModifyCategory');
 		$class='save';
@@ -467,9 +467,9 @@ function display_addcategory_form($category_name='', $id='',$action)
 	}
 	echo '<input name="action" type="hidden" value="'.Security::remove_XSS($action).'">';
 	echo '<input name="target" type="hidden" value="'.$target.'">';
-	
+
 	echo '<div class="row"><div class="form_header">'.$title.'</div></div>';
-	
+
 	echo '	<div class="row">
 				<div class="label">
 					<span class="form_required">*</span> '.get_lang('CategoryName').'
@@ -482,25 +482,25 @@ function display_addcategory_form($category_name='', $id='',$action)
 	if ($_POST AND !empty($_POST['category_name']))
 	{
 		echo '<span class="form_error">'.get_lang('CategoryAlreadyExistsEditIt').'<span><br />';
-	}	
+	}
 	echo '			<input type="text" name="category_name" value="'.Security::remove_XSS($category_name).'" />
 				</div>
 			</div>';
-	
+
 	echo '	<div class="row">
 				<div class="label">
 				</div>
 				<div class="formw">
 					<button class="'.$class.'" type="submit" name="StoreCategory">'.$text.'</button>
 				</div>
-			</div>';	
+			</div>';
 	echo '	<div class="row">
 				<div class="label">
 				</div>
 				<div class="formw">
 					<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>
 				</div>
-			</div>';	
+			</div>';
 	echo '</form>';
 	echo '<div style="clear: both;"></div>';
 }
@@ -519,14 +519,14 @@ function display_add_form()
 	$dropbox_person = new Dropbox_Person( $_user['user_id'], $is_courseAdmin, $is_courseTutor);
 	?>
 	<form method="post" action="index.php?view_received_category=<?php echo Security::remove_XSS($_GET['view_received_category']); ?>&view_sent_category=<?php echo Security::remove_XSS($_GET['view_sent_category']); ?>&view=<?php echo Security::remove_XSS($_GET['view']); ?>&<?php echo "origin=$origin"."&".api_get_cidreq(); ?>" enctype="multipart/form-data" onsubmit="return checkForm(this)">
-	
+
 	<div class="row"><div class="form_header"><?php echo get_lang('UploadNewFile'); ?></div></div>
-	
+
 	<div class="row">
 		<div class="label">
 			<span class="form_required">*</span><?php echo dropbox_lang("uploadFile")?>:
 		</div>
-		<div class="formw">	
+		<div class="formw">
 				<input type="hidden" name="MAX_FILE_SIZE" value='<?php echo dropbox_cnf("maxFilesize")?>' />
 				<input type="file" name="file" size="20" <?php if (dropbox_cnf("allowOverwrite")) echo 'onChange="checkfile(this.value)"'; ?> />
 				<input type="hidden" name="dropbox_unid" value="<?php echo $dropbox_unid ?>" />
@@ -539,19 +539,19 @@ function display_add_form()
 				?>
 		</div>
 	</div>
-		
+
 	<?php
 	if (dropbox_cnf("allowOverwrite"))
 	{
 		?>
 		<div class="row">
 			<div class="label">
-				
+
 			</div>
 			<div class="formw">
 				<input type="checkbox" name="cb_overwrite" id="cb_overwrite" value="true" /><?php echo dropbox_lang("overwriteFile")?>
 			</div>
-		</div>	
+		</div>
 		<?php
 	}
 	?>
@@ -659,7 +659,7 @@ function display_add_form()
 		echo '</select>
 		</div>
 	</div>';
-		
+
 	echo '
 		<div class="row">
 			<div class="label">
@@ -668,8 +668,8 @@ function display_add_form()
 				<button type="Submit" class="upload" name="submitWork">'.dropbox_lang("upload", "noDLTT").'</button>
 			</div>
 		</div>
-	';		
-	
+	';
+
 	echo "</form>";
 }
 
@@ -951,7 +951,7 @@ function store_add_dropbox()
     {
     	return get_lang('UplUnableToSaveFileFilteredExtension');
     }
-	
+
 	// set title
 	$dropbox_title = $dropbox_filename;
 	// set author
@@ -1011,9 +1011,9 @@ function store_add_dropbox()
 	}
 
 	@move_uploaded_file( $dropbox_filetmpname, dropbox_cnf("sysPath") . '/' . $dropbox_filename);
-	
+
 	$b_send_mail = api_get_course_setting('email_alert_on_new_doc_dropbox');
-	
+
 	if($b_send_mail)
 	{
 		foreach($new_work_recipients as $recipient_id)
@@ -1026,7 +1026,7 @@ function store_add_dropbox()
 				//get_lang('NewDropboxFileUploadedContent').' '.api_get_path(WEB_CODE_PATH).'dropbox/index.php?cidReq='.$_course['sysCode']."\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS)."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'), api_get_person_name(api_get_setting('administratorName')." ".api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS), api_get_setting('emailAdministrator'));
 		}
 	}
-	
+
 	new Dropbox_SentWork( $_user['user_id'], $dropbox_title, $_POST['description'], strip_tags($_POST['authors']), $dropbox_filename, $dropbox_filesize, $new_work_recipients);
 
 	Security::clear_token();
@@ -1127,7 +1127,7 @@ function feedback_form()
 	$number_users_who_see_file=Database::num_rows($result);
 	if ($number_users_who_see_file>1)
 	{
-		$return .= '<textarea name="feedback" style="width: 80%; height: 80px;"></textarea><br /><button type="submit" class="add" name="store_feedback" value="'.get_lang('Ok').'" 
+		$return .= '<textarea name="feedback" style="width: 80%; height: 80px;"></textarea><br /><button type="submit" class="add" name="store_feedback" value="'.get_lang('Ok').'"
 			onclick="document.form_tablename.attributes.action.value = document.location;">'.get_lang('AddComment').'</button>';
 	}
 	else
@@ -1182,9 +1182,9 @@ function zip_download ($array)
 	global $dropbox_cnf;
 	global $_user;
 	global $files;
-	
+
 	$sys_course_path = api_get_path(SYS_COURSE_PATH);
-	
+
 	// zip library for creation of the zipfile
 	include(api_get_path(LIBRARY_PATH)."/pclzip/pclzip.lib.php");
 
@@ -1297,14 +1297,14 @@ function zip_download_alternative($files)
 	{
 		$zip_folder->add(api_get_path(SYS_COURSE_PATH).$_course['path']."/temp/".$value['title'],PCLZIP_OPT_REMOVE_PATH, api_get_path(SYS_COURSE_PATH).$_course['path']."/temp");
 	}
-	
+
 	// Step 1: create the overview file and add it to the zip
 	$overview_file_content=generate_html_overview($files, array('filename'), array('title'));
 	$overview_file=$temp_zip_dir.'overview'.replace_dangerous_char(api_is_western_name_order() ? $_user['firstname'].$_user['lastname'] : $_user['lastname'].$_user['firstname'], 'strict').'.html';
 	$handle=fopen($overview_file,'w');
 	fwrite($handle,$overview_file_content);
 	// todo: find a different solution for this because even 2 seconds is no guarantee.
-	sleep(2);	
+	sleep(2);
 
 	// Step 4: we add the overview file
 	$zip_folder->add($overview_file,PCLZIP_OPT_REMOVE_PATH, api_get_path(SYS_COURSE_PATH).$_course['path']."/temp");
@@ -1472,7 +1472,7 @@ function get_total_number_feedback($file_id='')
 function check_number_feedback($key, $array)
 {
 	if (is_array($array))
-	{	
+	{
 		if (key_exists($key,$array))
 		{
 			return $array[$key];

+ 23 - 23
main/dropbox/dropbox_init.inc.php

@@ -30,12 +30,12 @@
 ==============================================================================
 		INIT SECTION
 ==============================================================================
-*/ 
-// name of the language file that needs to be included 
-$language_file = "dropbox";	
+*/
+// name of the language file that needs to be included
+$language_file = "dropbox";
 
 //this var disables the link in the breadcrumbs on top of the page
-//$noPHP_SELF = TRUE;	
+//$noPHP_SELF = TRUE;
 
 // including the basic Dokeos initialisation file
 require("../inc/global.inc.php");
@@ -55,7 +55,7 @@ require(api_get_path(INCLUDE_PATH).'/conf/mail.conf.php');
 include_once(api_get_path(LIBRARY_PATH) . 'mail.lib.inc.php');
 include_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php');
 
-// protecting the script 
+// protecting the script
 api_protect_course_script();
 
 
@@ -63,7 +63,7 @@ api_protect_course_script();
 -----------------------------------------------------------
 	Libraries
 -----------------------------------------------------------
-*/ 
+*/
 require_once(api_get_path(LIBRARY_PATH)."/debug.lib.inc.php");
 require_once(api_get_path(LIBRARY_PATH) . "/course.lib.php");
 require_once(api_get_path(LIBRARY_PATH) . "/groupmanager.lib.php");
@@ -77,7 +77,7 @@ require_once( "dropbox_class.inc.php");
 
 // including some libraries that are also used in the documents tool
 require_once('../document/document.inc.php');  // we use a function build_document_icon_tag
-require_once(api_get_path(LIBRARY_PATH).'/fileDisplay.lib.php'); // the function choose_image is used 
+require_once(api_get_path(LIBRARY_PATH).'/fileDisplay.lib.php'); // the function choose_image is used
 require_once(api_get_path(LIBRARY_PATH).'/document.lib.php');
 
 
@@ -86,7 +86,7 @@ require_once(api_get_path(LIBRARY_PATH).'/document.lib.php');
 -----------------------------------------------------------
 	Virtual course support
 -----------------------------------------------------------
-*/ 
+*/
 $user_id = api_get_user_id();
 $course_code = $_course['sysCode'];
 $course_info = Database::get_course_info($course_code);
@@ -100,9 +100,9 @@ $is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($
 -----------------------------------------------------------
 */
 // we need this here because the javascript to re-upload the file needs an array
-// off all the documents that have already been sent. 
+// off all the documents that have already been sent.
 // @todo consider moving the javascripts in a function that displays the javascripts
-// only when it is needed. 
+// only when it is needed.
 if ($_GET['action']=='add')
 {
 	$dropbox_person = new Dropbox_Person( $_user['user_id'], $is_courseAdmin, $is_courseTutor);
@@ -243,7 +243,7 @@ elseif ($_GET['view']='sent')
 {
 	$part='sent';
 }
-else 
+else
 {
 	header ('location: index.php?view='.$_GET['view'].'&error=Error');
 }
@@ -254,11 +254,11 @@ if (($_POST['action']=='download_received' || $_POST['action']=='download_sent')
 	if (!is_array($checked_file_ids) || count($checked_file_ids)==0)
 	{
 		header ('location: index.php?view='.$_GET['view'].'&error=CheckAtLeastOneFile');
-		exit; 
+		exit;
 	}
-	else 
+	else
 		handle_multiple_actions();
-		exit; 
+		exit;
 	}
 }
 
@@ -283,33 +283,33 @@ if((!$is_allowed_in_course || !$is_courseMember) && !api_is_allowed_to_edit())
 ==============================================================================
 		BREADCRUMBS
 ==============================================================================
-*/ 
+*/
 if ($_GET['view']=='received')
 {
 	$interbreadcrumb[] = array ("url" => "../dropbox/index.php", "name" => dropbox_lang("dropbox", "noDLTT"));
 	$nameTools = get_lang('ReceivedFiles');
-	
+
 	if ($_GET['action'] == 'addreceivedcategory')
 	{
 		$interbreadcrumb[] = array ("url" => "../dropbox/index.php?view=received", "name" => get_lang("ReceivedFiles"));
-		$nameTools = get_lang('AddNewCategory');		
+		$nameTools = get_lang('AddNewCategory');
 	}
 }
 if ($_GET['view']=='sent' OR empty($_GET['view']))
 {
 	$interbreadcrumb[] = array ("url" => "../dropbox/index.php", "name" => dropbox_lang("dropbox", "noDLTT"));
 	$nameTools = get_lang('SentFiles');
-	
+
 	if ($_GET['action'] == 'addsentcategory')
 	{
 		$interbreadcrumb[] = array ("url" => "../dropbox/index.php?view=sent", "name" => get_lang("SentFiles"));
-		$nameTools = get_lang('AddNewCategory');		
+		$nameTools = get_lang('AddNewCategory');
 	}
 	if ($_GET['action'] == 'add')
 	{
 		$interbreadcrumb[] = array ("url" => "../dropbox/index.php?view=sent", "name" => get_lang("SentFiles"));
-		$nameTools = get_lang('UploadNewFile');		
-	}		
+		$nameTools = get_lang('UploadNewFile');
+	}
 }
 
 
@@ -317,13 +317,13 @@ if ($_GET['view']=='sent' OR empty($_GET['view']))
 ==============================================================================
 		HEADER & TITLE
 ==============================================================================
-*/ 
+*/
 
 if ($origin != 'learnpath')
 {
     Display::display_header($nameTools,"Dropbox");
 }
-else // if we come from the learning path we have to include the stylesheet and the required javascripts manually. 
+else // if we come from the learning path we have to include the stylesheet and the required javascripts manually.
 {
 	echo '<link rel="stylesheet" type="text/css" href="',api_get_path(WEB_CODE_PATH), 'css/default.css">';
 	echo $javascript;

+ 16 - 16
main/dropbox/dropbox_submit.php

@@ -53,11 +53,11 @@ api_session_register("dropbox_uniqueid");
  */
 if ( isset( $_POST["submitWork"]))
 {
-    if (file_exists(api_get_path(INCLUDE_PATH) . "/fileUploadLib.inc.php")) 
+    if (file_exists(api_get_path(INCLUDE_PATH) . "/fileUploadLib.inc.php"))
     {
         require_once(api_get_path(INCLUDE_PATH) . "/fileUploadLib.inc.php");
-    } 
-    else 
+    }
+    else
     {
         require_once(api_get_path(LIBRARY_PATH) . "/fileUpload.lib.php");
 	}
@@ -182,17 +182,17 @@ if ( isset( $_POST["submitWork"]))
             {
 	            // set title
 	            $dropbox_title = $dropbox_filename;
-	
+
 	            // set author
 	            if ( $_POST['authors'] == '')
 	            {
 	                $_POST['authors'] = getUserNameFromId( $_user['user_id']);
 	            }
-	
+
 				if ( $dropbox_overwrite)  // RH: Mailing: adapted
 				{
 					$dropbox_person = new Dropbox_Person( $_user['user_id'], $is_courseAdmin, $is_courseTutor);
-	
+
 					foreach($dropbox_person->sentWork as $w)
 					{
 						if ($w->title == $dropbox_filename)
@@ -216,7 +216,7 @@ if ( isset( $_POST["submitWork"]))
 				{
 					$dropbox_filename = getLoginFromId( $_user['user_id']) . "_" . $dropbox_filename . "_".uniqid('');
 				}
-	
+
 				if ( ( ! is_dir( dropbox_cnf("sysPath"))))
 	            {
 					//The dropbox subdir doesn't exist yet so make it and create the .htaccess file
@@ -224,13 +224,13 @@ if ( isset( $_POST["submitWork"]))
 					$fp = fopen( dropbox_cnf("sysPath")."/.htaccess", "w") or die (dropbox_lang("errorCreatingDir")." (code 405)");
 					fwrite($fp, "AuthName AllowLocalAccess
 	                             AuthType Basic
-	
+
 	                             order deny,allow
 	                             deny from all
-	
+
 	                             php_flag zlib.output_compression off") or die (dropbox_lang("errorCreatingDir")." (code 406)");
 	            }
-	
+
 				if ( $error) {}
 	            elseif ( $thisIsAMailing)  // RH: $newWorkRecipients is integer - see class
 				{
@@ -269,9 +269,9 @@ if ( isset( $_POST["submitWork"]))
 		            	}
 		            }
 	        	}
-	
+
 				//After uploading the file, create the db entries
-	
+
 	        	if ( !$error)
 	        	{
 		            @move_uploaded_file( $dropbox_filetmpname, dropbox_cnf("sysPath") . '/' . $dropbox_filename)
@@ -333,7 +333,7 @@ if ( isset( $_GET['mailingIndex']))  // examine or send
         {
 			// string result = error message, array result = [user_id, lastname, firstname]
 
-	    	global $var, $sel; 
+	    	global $var, $sel;
             if (isset($students)) {
                 unset($students);
             }
@@ -392,11 +392,11 @@ if ( isset( $_GET['mailingIndex']))  // examine or send
             }
         }
 
-	    if (file_exists(api_get_path(INCLUDE_PATH) . "/pclzip/pclzip.lib.php")) 
+	    if (file_exists(api_get_path(INCLUDE_PATH) . "/pclzip/pclzip.lib.php"))
 	    {
 	        require(api_get_path(INCLUDE_PATH) . "/pclzip/pclzip.lib.php");
-	    } 
-	    else 
+	    }
+	    else
 	    {
 	        require(api_get_path(LIBRARY_PATH) . "/pclzip/pclzip.lib.php");
 		}

+ 2 - 2
main/dropbox/index.php

@@ -166,8 +166,8 @@ if (isset($_POST['StoreCategory'])) {
 	{
 		Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete').'<br />'.$return_information['message']);
 		display_addcategory_form($_POST['category_name'],$_POST['edit_id'],$_POST['action']);
-	}	
-	
+	}
+
 }
 
 // *** Move a File ***

+ 2 - 2
main/exercice/addlimits.php

@@ -141,7 +141,7 @@ if (isset($_SESSION['gradebook'])){
 	$gradebook=	$_SESSION['gradebook'];
 }
 
-if (!empty($gradebook) && $gradebook=='view') {	
+if (!empty($gradebook) && $gradebook=='view') {
 	$interbreadcrumb[]= array (
 			'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),
 			'name' => get_lang('Gradebook')
@@ -229,7 +229,7 @@ Time :
  * @todo shouldn't this be moved to the part above (around line 111: action handling)
  */
 if (isset($_POST['ok'])) {
-	$exercise_id = Database::escape_string($_POST['exe_id']);	
+	$exercise_id = Database::escape_string($_POST['exe_id']);
 	if ($_POST['limit']==1) {
 		$minutes = Database::escape_string($_POST['minutes']);
 		$query = "UPDATE ".$TBL_EXERCICES." SET ques_time_limit= $minutes where id= $exercise_id";

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff