Juan Carlos Raña 14 years ago
parent
commit
74e46857e2

+ 2 - 61
main/admin/index.php

@@ -330,7 +330,7 @@ function version_check() {
 		{
 		*/
 		$return = 'site registered. ';
-		$return .= check_system_version2();
+		$return .= check_system_version();
 		//}
 	}
 	return $return;
@@ -372,7 +372,7 @@ function register_site()
 * @copyright (C) 2001 The phpBB Group
 * @return language string with some layout (color)
 */
-function check_system_version2()
+function check_system_version()
 {
 	global $_configuration;
 	$system_version = trim($_configuration['system_version']); // the chamilo version of your installation
@@ -406,65 +406,6 @@ function check_system_version2()
 	}
 	return $output;
 }
-
-/**
-* Check if the current installation is up to date
-* The code is borrowed from phpBB and slighlty modified
-* @author The phpBB Group <support@phpbb.com> (the code)
-* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University (the modifications)
-* @copyright (C) 2001 The phpBB Group
-* @return language string with some layout (color)
-* @deprecated 	For some reason this code adds a 9 in front and a 0 at the end of what normally gets displayed by
-				the http://www.dokeos.com/version.php page (instead of version.txt) . That's why I chose to use fopen which requires however
-				that allow_url_open is set to true
-*/
-function check_system_version()
-{
-	global $_configuration; // the chamilo version of your installation
-	$system_version = $_configuration['system_version'];
-
-	if ($fsock = @fsockopen('www.chamilo.org', 80, $errno, $errstr))
-	{
-		@fputs($fsock, "GET /version.php HTTP/1.1\r\n");
-		@fputs($fsock, "HOST: www.chamilo.org\r\n");
-		@fputs($fsock, "Connection: close\r\n\r\n");
-
-		$get_info = false;
-		while (!@feof($fsock))
-		{
-			if ($get_info)
-			{
-				$version_info .= @fread($fsock, 1024);
-			}
-			else
-			{
-				if (@fgets($fsock, 1024) == "\r\n")
-				{
-					$get_info = true;
-				}
-			}
-		}
-		@fclose($fsock);
-
-		if (trim($system_version) <> trim($version_info)) {
-			$output='<span style="color:red">' . get_lang('YourVersionNotUpToDate') . '. '.get_lang('LatestVersionIs').' <b>Chamilo '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Dokeos '.$system_version. '</b>. '.str_replace('http://www.chamilo.org','<a href="http://www.chamilo.org">http://www.chamilo.org</a>',get_lang('PleaseVisitDokeos')).'</span>';
-		} else {
-			$output = '<span style="color:green">'.get_lang('VersionUpToDate').': Chamilo '.$version_info.'</span>';
-		}
-	}
-	else
-	{
-		if ($errstr)
-		{
-			$output = '<span style="color:red">' . get_lang('ConnectSocketError') . ': '. $errstr . '</span>';
-		}
-		else
-		{
-			$output = '<span>' . get_lang('SocketFunctionsDisabled') . '</span>';
-		}
-	}
-	return $output;
-}
 /*
 		FOOTER
 */

+ 26 - 2
main/admin/statistics/statistics.lib.php

@@ -263,26 +263,50 @@ class Statistics {
 		if ($_configuration['multiple_access_urls']) {
 			$table_url = ", $access_url_rel_user_table";
 			$where_url = " WHERE login_user_id=user_id AND access_url_id='".$current_url_id."'";
+			$where_url_last = ' AND login_date > DATE_SUB(NOW(),INTERVAL 1 %s)';
 		} else {
 			$table_url = '';
-			$where_url='';
+			$where_url = '';
+			$where_url_last = ' WHERE login_date > DATE_SUB(NOW(),INTERVAL 1 %s)';
 		}
 		switch ($type) {
 			case 'month':
 				$months = api_get_months_long();
 				$period = get_lang('PeriodMonth');
 				$sql = "SELECT DATE_FORMAT( login_date, '%Y-%m' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY login_date ";
+				$sql_last_x = "SELECT DATE_FORMAT( login_date, '%Y-%m' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'YEAR')." GROUP BY stat_date ORDER BY login_date ";
 				break;
 			case 'hour':
 				$period = get_lang('PeriodHour');
 				$sql = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY stat_date ";
+				$sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'DAY')." GROUP BY stat_date ORDER BY stat_date ";
 				break;
 			case 'day':
 				$week_days = api_get_week_days_long();
 				$period = get_lang('PeriodDay');
 				$sql = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
+				$sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'WEEK')." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
 				break;
 		}
+		$res_last_x = Database::query($sql_last_x);
+		$result_last_x = array();
+		while ($obj = Database::fetch_object($res_last_x)) {
+			$stat_date = $obj->stat_date;
+			switch ($type) {
+				case 'month':
+					$stat_date = explode('-', $stat_date);
+					$stat_date[1] = $months[$stat_date[1] - 1];
+					$stat_date = implode(' ', $stat_date);
+					break;
+				case 'day':
+					$stat_date = $week_days[$stat_date];
+					break;
+			}
+			$result_last_x[$stat_date] = $obj->number_of_logins;
+		}
+		Statistics::print_stats(get_lang('LastLogins').' ('.$period.')', $result_last_x, true);
+		flush(); //flush web request at this point to see something already while the full data set is loading
+		echo '<br />';
 		$res = Database::query($sql);
 		$result = array();
 		while ($obj = Database::fetch_object($res)) {
@@ -299,7 +323,7 @@ class Statistics {
 			}
 			$result[$stat_date] = $obj->number_of_logins;
 		}
-		Statistics::print_stats(get_lang('Logins').' ('.$period.')', $result, true);
+		Statistics::print_stats(get_lang('AllLogins').' ('.$period.')', $result, true);
 	}
 	/**
 	 * Print the number of recent logins

+ 4 - 3
main/admin/user_list.php

@@ -946,8 +946,9 @@ if ($_GET['action'] == "login_as" && isset ($login_as_user_id))
             $form->addElement('html', '<div id="extra_data_text" style="display:none;">');
             $form->add_textfield('keyword_extra_data_text', '', false, array('style'=>'margin-left:17px', 'id'=>'input_extra_text'));
             $form->addElement('html', '</div>');
-        }
-
+        } else {
+            $form->addElement('html', '<div id="extra_data_text" style="display:none;">');
+	}
 
         $form->addElement('html', '</td></tr>');
 
@@ -1000,4 +1001,4 @@ if ($_GET['action'] == "login_as" && isset ($login_as_user_id))
 ==============================================================================
 */
 Display :: display_footer();
-?>
+?>

+ 4 - 1
main/exercice/answer_admin.inc.php

@@ -281,8 +281,10 @@ if($submitAnswers || $buttonBack)
                 $reponse=str_replace('::','',$reponse);
 
                 // we save the answer because it will be modified
-                $temp=$reponse;
+                //$temp=$reponse;
+                $temp = text_filter($reponse);
 
+                /* // Deprecated code.
                 // 1. find everything between the [tex] and [/tex] tags
                 $startlocations=api_strpos($temp,'[tex]');
                 $endlocations=api_strpos($temp,'[/tex]');
@@ -294,6 +296,7 @@ if($submitAnswers || $buttonBack)
                     // 2. replace this by {texcode}
                     $temp=str_replace($texstring,"{texcode}",$temp);
                 }
+                */
 
                 // blanks will be put into an array
                 $blanks=Array();

+ 9 - 9
main/exercice/exercice.php

@@ -869,7 +869,7 @@ if ($show == 'test') {
 					echo '<td width="15" valign="left">'.($i+($page*$limitExPage)).'.'.'</td>';
 
 					//Showing exercise title
-					$row['title']=api_parse_tex($row['title']);
+					$row['title']=text_filter($row['title']);
 
 					echo '<td>';
 					$class_invisible = '';
@@ -928,7 +928,7 @@ if ($show == 'test') {
 					?>
 					<tr>
 					  <td><?php echo ($i+($page*$limitExPage)).'.'; ?></td>
-					  <?php $row['title']=api_parse_tex($row['title']);?>
+					  <?php $row['title']=text_filter($row['title']);?>
 					  <td>
 
 					<?php
@@ -1131,7 +1131,7 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
 							"te.exe_weighting as exweight, te.exe_date as exdate, te.exe_id as exid, email as exemail, " .
 							"te.start_date as exstart, steps_counter as exstep, cuser.user_id as excruid, te.exe_duration as exduration, ce.results_disabled as exdisabled
 							FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te, $TBL_USER AS user,$tbl_course_rel_user AS cuser
-					WHERE  user.user_id=cuser.user_id AND te.exe_exo_id = ce.id AND te.status != 'incomplete' AND cuser.user_id=te.exe_user_id 
+					WHERE  user.user_id=cuser.user_id AND te.exe_exo_id = ce.id AND te.status != 'incomplete' AND cuser.user_id=te.exe_user_id
                     AND te.exe_cours_id='" . Database :: escape_string($_cid) . "'
 					AND cuser.relation_type<>".COURSE_RELATION_TYPE_RRHH." $user_id_and $session_id_and AND ce.active <>-1 AND" .
 					" orig_lp_id = 0 AND orig_lp_item_id = 0 AND cuser.course_code=te.exe_cours_id ORDER BY userpart2, te.exe_cours_id ASC, ce.title ASC," .
@@ -1166,7 +1166,7 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
 			$from_gradebook = true;
 		}
 		$sizeof = sizeof($results);
-		
+
 		$user_list_id = array ();
 		$user_last_name = '';
 		$user_first_name = '';
@@ -1225,13 +1225,13 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
 					//echo ceil((($results[$i][4] - $results[$i][7]) / 60)) . ' ' . get_lang('MinMinutes');
 					$exe_date_timestamp = api_strtotime($results[$i]['exdate'], date_default_timezone_get());
 					$start_date_timestamp = api_strtotime($results[$i]['exstart'], date_default_timezone_get());
-					
+
 					$my_duration = ceil((($exe_date_timestamp - $start_date_timestamp) / 60));
-					if ($my_duration == 1 ) {						
-						$duration_list = $my_duration . ' ' . get_lang('MinMinute');	
+					if ($my_duration == 1 ) {
+						$duration_list = $my_duration . ' ' . get_lang('MinMinute');
 					} else {
-						$duration_list =  $my_duration. ' ' . get_lang('MinMinutes');						
-					}					
+						$duration_list =  $my_duration. ' ' . get_lang('MinMinutes');
+					}
 					if ($results[$i]['exstep'] > 1) {
 						//echo ' ( ' . $results[$i][8] . ' ' . get_lang('Steps') . ' )';
 						$duration_list = ' ( ' . $results[$i]['exstep'] . ' ' . get_lang('Steps') . ' )';

+ 8 - 3
main/exercice/exercice_submit.php

@@ -519,8 +519,10 @@ if ($formSent) {
                                     $answerWeighting = explode(',', $is_set_switchable[0]);
 
                                     // we save the answer because it will be modified
-                                    $temp = $answer;
+                                    //$temp = $answer;
+                                    $temp = text_filter($answer);
 
+                                    /* // Deprecated code
                                     // TeX parsing
                                     // 1. find everything between the [tex] and [/tex] tags
                                     $startlocations = api_strpos($temp, '[tex]');
@@ -531,6 +533,7 @@ if ($formSent) {
                                         // 2. replace this by {texcode}
                                         $temp = str_replace($texstring, '{texcode}', $temp);
                                     }
+                                    */
 
                                     $answer = '';
                                     $j = 0;
@@ -545,9 +548,11 @@ if ($formSent) {
                                         if (($pos = api_strpos($temp, '[')) === false) {
                                             // adds the end of the text
                                             $answer = $temp;
+                                            /* // Deprecated code
                                             // TeX parsing - replacement of texcode tags
                                             $texstring = api_parse_tex($texstring);
                                             $answer = str_replace("{texcode}", $texstring, $answer);
+                                            */
                                             $real_text[] = $answer;
                                             break; //no more "blanks", quit the loop
                                         }
@@ -780,7 +785,7 @@ if ($formSent) {
                     $current_time = time();
 
 					//The $exercise_row['expired_time'][$exerciseId] is never set. It means nothing.
-                    //if (isset($_SESSION['expired_time'][$current_expired_time_key]) && $exercise_row['expired_time'][$exerciseId] != 0) {                    
+                    //if (isset($_SESSION['expired_time'][$current_expired_time_key]) && $exercise_row['expired_time'][$exerciseId] != 0) {
                     if (isset($_SESSION['expired_time'][$current_expired_time_key])) {
                         $expired_date = $_SESSION['expired_time'][$current_expired_time_key];
                         $expired_time = strtotime($expired_date);
@@ -1086,7 +1091,7 @@ if (api_is_course_admin() && $origin != 'learnpath') {
     echo '</div>';
 }
 
-$exerciseTitle = api_parse_tex($exerciseTitle);
+$exerciseTitle = text_filter($exerciseTitle);
 echo "<h3>" . $exerciseTitle . "</h3>";
 $show_clock = true;
 

+ 12 - 7
main/exercice/exercise.lib.php

@@ -47,7 +47,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 			$questionName=$objQuestionTmp->selectTitle();
 			$questionDescription=$objQuestionTmp->selectDescription();
 
-			$questionName=api_parse_tex($questionName);
+			$questionName=text_filter($questionName);
 
 			$s="<div id=\"question_title\" class=\"sectiontitle\">
 				".get_lang('Question').' ';
@@ -63,7 +63,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 			$s='';
 			$s.="<table class='exercise_questions' style='margin:4px;padding:2px;'>
 				<tr><td valign='top' colspan='2'>";
-			$questionDescription=api_parse_tex($questionDescription);
+			$questionDescription=text_filter($questionDescription);
 			$s.=$questionDescription;
 			$s.="</td></tr></table>";
 
@@ -150,6 +150,8 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 				list($answer) = explode('::',$answer);
 
 				// because [] is parsed here we follow this procedure:
+				$answer = text_filter($answer);
+				/* // Deprecated code
 				// 1. find everything between the [tex] and [/tex] tags
 				$startlocations = api_strpos($answer,'[tex]');
 				$endlocations = api_strpos($answer,'[/tex]');
@@ -159,6 +161,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 					// 2. replace this by {texcode}
 					$answer = str_replace($texstring,'{texcode}',$answer);
 				}
+				*/
 
 				// 3. do the normal matching parsing
 				// replaces [blank] by an input field
@@ -207,9 +210,11 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 
 				*/
 
+				/* // Deprecated code
 				// 5. replace the {texcode by the api_pare_tex parsed code}
 				$texstring = api_parse_tex($texstring);
 				$answer=str_replace("{texcode}",$texstring,$answer);
+				*/
 
 			}
 
@@ -224,7 +229,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 						$selected = 'checked="checked"';
 					}
 				}
-				$answer = api_parse_tex($answer);
+				$answer = text_filter($answer);
 				$answer = Security::remove_XSS($answer, STUDENT);
 				$s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'.
 					'<tr><td colspan="3"><div class="u-m-answer"><p style="float: '.($is_ltr_text_direction ? 'left' : 'right').'; padding-'.($is_ltr_text_direction ? 'right' : 'left').': 4px;">'.
@@ -244,7 +249,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 						$selected = 'checked="checked"';
 					}
 				}
-				$answer = api_parse_tex($answer);
+				$answer = text_filter($answer);
 				$answer = Security::remove_XSS($answer, STUDENT);
 				$s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'.
 					'<tr><td colspan="3"><div class="u-m-answer"><p style="float: '.($is_ltr_text_direction ? 'left' : 'right').'; padding-'.($is_ltr_text_direction ? 'right' : 'left').': 4px;">'.
@@ -264,7 +269,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 						$selected = 'checked="checked"';
 					}
 				}
-				$answer = api_parse_tex($answer);
+				$answer = text_filter($answer);
 				$answer = Security::remove_XSS($answer, STUDENT);
 				$s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'.
 					'<tr><td colspan="3"><div class="u-m-answer"><p style="float: '.($is_ltr_text_direction ? 'left' : 'right').'; padding-'.($is_ltr_text_direction ? 'right' : 'left').': 4px;">'.
@@ -284,7 +289,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 					// only show elements to be answered (not the contents of
 					// the select boxes, who are corrrect = 0)
 					$s .= '<tr><td width="45%" valign="top" >';
-					$parsed_answer = api_parse_tex($answer);
+					$parsed_answer = text_filter($answer);
 					//left part questions
 					$s .= ' <span style="float:left; width:8%;"><b>'.$lines_count.'</b>.&nbsp;</span>
 						 	<span style="float:left; width:92%;">'.$parsed_answer.'</span></td>';
@@ -390,7 +395,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 			echo '<table class="exercise_questions" >
 				  <tr>
 			  		<td valign="top" colspan="2">';
-			echo $questionDescription=api_parse_tex($questionDescription);
+			echo $questionDescription=text_filter($questionDescription);
 			echo '</td></tr>';
 		}
 

+ 10 - 5
main/exercice/exercise_result.php

@@ -314,14 +314,14 @@ function display_unique_or_multiple_answer($answerType, $studentChoice, $answer,
 	</td>
 	<td width="45%" style="border-bottom: 1px solid #4171B5;">
 		<?php
-		$answer=api_parse_tex($answer);
+		$answer=text_filter($answer);
 		echo $answer;
 		?>
 	</td>
 	<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
 	<td width="45%" style="border-bottom: 1px solid #4171B5;">
 		<?php
-		$answerComment=api_parse_tex($answerComment);
+		$answerComment=text_filter($answerComment);
 		if($studentChoice)
 		{
 			if(!$answerCorrect)
@@ -440,7 +440,7 @@ if (api_is_course_admin() && $origin != 'learnpath') {
 	echo '</div>';
 }
 
-$exerciseTitle=api_parse_tex($exerciseTitle);
+$exerciseTitle=text_filter($exerciseTitle);
 
 //show exercise title
 ?>
@@ -685,8 +685,10 @@ foreach ($questionList as $questionId) {
 					$answerWeighting = explode(',',$is_set_switchable[0]);
 
 					// we save the answer because it will be modified
-					$temp=$answer;
+					//$temp=$answer;
+					$temp = text_filter($answer);
 
+					/* // Deprecated code.
 					// TeX parsing
 					// 1. find everything between the [tex] and [/tex] tags
 					$startlocations=api_strpos($temp,'[tex]');
@@ -698,6 +700,7 @@ foreach ($questionList as $questionId) {
 						// 2. replace this by {texcode}
 						$temp=str_replace($texstring,'{texcode}',$temp);
 					}
+					*/
 
 					$answer='';
 					$j=0;
@@ -714,9 +717,11 @@ foreach ($questionList as $questionId) {
 						{
 							// adds the end of the textsolution
 							$answer=$temp;
+							/* // Deprecated code.
 							// TeX parsing - replacement of texcode tags
 							$texstring = api_parse_tex($texstring);
 							$answer=str_replace("{texcode}",$texstring,$answer);
+							*/
                             $real_text[] = $answer;
 							break; //no more "blanks", quit the loop
 						}
@@ -890,7 +895,7 @@ foreach ($questionList as $questionId) {
 			{
 				if ($origin != 'learnpath') {
 					echo '<tr>';
-					echo '<td>'.api_parse_tex($answer_matching[$answerId]).'</td><td>'.api_parse_tex($user_answer).' / <b><span style="color: #008000;">'.api_parse_tex($answer_matching[$answerCorrect]).'</span></b></td>';
+					echo '<td>'.text_filter($answer_matching[$answerId]).'</td><td>'.text_filter($user_answer).' / <b><span style="color: #008000;">'.text_filter($answer_matching[$answerCorrect]).'</span></b></td>';
 					echo '</tr>';
 				}
 			}

+ 10 - 2
main/exercice/exercise_show.php

@@ -269,7 +269,7 @@ $show_results = true;
 // Avoiding the "Score 0/0" message  when the exe_id is not set
 if (Database::num_rows($result)>0 && isset($id)) {
 	$test=Database::result($result,0,0);
-	$exerciseTitle=api_parse_tex($test);
+	$exerciseTitle=text_filter($test);
 	$exerciseDescription=Database::result($result,0,1);
 
 	// if the results_disabled of the Quiz is 1 when block the script
@@ -634,8 +634,10 @@ if ($show_results) {
 
 				//$answerWeighting=explode(',',$answerWeighting);
 				// we save the answer because it will be modified
-			    $temp=$answer;
+			    //$temp=$answer;
+			    $temp = text_filter($answer);
 
+			    /* // Deprecated code
 				// TeX parsing
 				// 1. find everything between the [tex] and [/tex] tags
 				$startlocations=api_strpos($temp,'[tex]');
@@ -645,6 +647,8 @@ if ($show_results) {
 					// 2. replace this by {texcode}
 					$temp=str_replace($texstring,'{texcode}',$temp);
 				}
+				*/
+
 				$j=0;
 				// the loop will stop at the end of the text
 				$i=0;
@@ -655,8 +659,10 @@ if ($show_results) {
 						if (($pos = api_strpos($temp,'[')) === false) {
 							// adds the end of the text
 							$answer.=$temp;
+							/* // Deprecated code
 							// TeX parsing
 							$texstring = api_parse_tex($texstring);
+							*/
 							break;
 						}
 					    $temp=api_substr($temp,$pos+1);
@@ -703,9 +709,11 @@ if ($show_results) {
 						if (($pos = api_strpos($temp,'[')) === false) {
 							// adds the end of the text
 							$answer.=$temp;
+							/* // Deprecated code
 							// TeX parsing
 							$texstring = api_parse_tex($texstring);
 							//$answer=str_replace("{texcode}",$texstring,$answer);
+							*/
 							break;
 						}
 						// adds the piece of text that is before the blank and ended by [

+ 7 - 7
main/exercice/export/scorm/scorm_classes.php

@@ -129,12 +129,12 @@ class ScormQuestion extends Question
 		$cols = 2;
 		$s='<tr>' .
 			'<td colspan="'.$cols.'" id="question_'.$this->id.'_title" valign="middle" style="background-color:#d6d6d6;">' . "\n" .
-		   	api_parse_tex($title).
+		   	text_filter($title).
 		   	'</td>' . "\n" .
 		   	'</tr>' . "\n" .
 		   	'<tr>' . "\n" .
 		   	'<td valign="top" colspan="'.$cols.'">' . "\n" .
-		   	'<i>'.api_parse_tex($description).'</i>' . "\n" .
+		   	'<i>'.text_filter($description).'</i>' . "\n" .
 		   	'</td>' . "\n" .
 		   	'</tr>' . "\n";
 		return $s;
@@ -174,7 +174,7 @@ class ScormAnswerMultipleChoice extends Answer
 		$type = $this->getQuestionType();
 		$jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n";
 		$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n";
-		
+
 		//not sure if we are going to export also the MULTIPLE_ANSWER_COMBINATION to SCORM
         //if ($type == MCMA  || $type == MULTIPLE_ANSWER_COMBINATION ) {
 		if ($type == MCMA ) {
@@ -208,7 +208,7 @@ class ScormAnswerMultipleChoice extends Answer
 	    		$js .= 'questions_types['.$this->questionJSId.'] = \'mcma\';'."\n";
 	    	} else {
 	    		$js .= 'questions_types['.$this->questionJSId.'] = \'exact\';'."\n";
-	    	}	    	
+	    	}
 	    	$js .= $jstmpw;
         } elseif ($type == MULTIPLE_ANSWER_COMBINATION) {
         		//To this items we show the ThisItemIsNotExportable
@@ -443,7 +443,7 @@ class ScormAnswerMatching extends Answer
 				// options (A, B, C, ...) that will be put into the list-box
 				$Select[$answerId]['Lettre']=$cpt1;
 				// answers that will be shown at the right side
-				$answer = api_parse_tex($answer);
+				$answer = text_filter($answer);
 				$Select[$answerId]['Reponse']=$answer;
 				$cpt1++;
 			}
@@ -722,14 +722,14 @@ class ScormAnswerHotspot extends Answer
 		{
 			$s="<tr>
 			  <td valign='top' colspan='2'>&nbsp;";
-			$questionName=api_parse_tex($questionName);
+			$questionName=text_filter($questionName);
 			$s.=$questionName;
 			$s.="</td>
 			</tr>
 			<tr>
 			  <td valign='top' colspan='2'>
 				<i>";
-			$questionDescription=api_parse_tex($questionDescription);
+			$questionDescription=text_filter($questionDescription);
 			$s.=$questionDescription;
 			$s.="</i>
 			  </td>

+ 19 - 19
main/exercice/question.class.php

@@ -42,7 +42,7 @@ abstract class Question
 	public $picture;
 	public $exerciseList;  // array with the list of exercises which this question is in
 	private $isContent;
-	
+
 	static $typePicture = 'new_question.png';
 	static $explanationLangVar = '';
 	static $questionTypes = array(
@@ -70,7 +70,7 @@ abstract class Question
 		$this->level = 1;
 		$this->exerciseList=array();
 	}
-	
+
 	public function getIsContent() {
 		$isContent = intval($_REQUEST['isContent']);
 		return $this->isContent = $isContent;
@@ -142,7 +142,7 @@ abstract class Question
 	 */
 	function selectTitle()
 	{
-		$this->question=api_parse_tex($this->question);
+		$this->question=text_filter($this->question);
 		return $this->question;
 	}
 
@@ -154,7 +154,7 @@ abstract class Question
 	 */
 	function selectDescription()
 	{
-		$this->description=api_parse_tex($this->description);
+		$this->description=text_filter($this->description);
 		return $this->description;
 	}
 
@@ -516,15 +516,15 @@ abstract class Question
 		// saves the picture into a temporary file
 		@move_uploaded_file($Picture,$picturePath.'/tmp.'.$Extension);
 	}
-	
+
 	/**
-		Sets the title 
+		Sets the title
 	*/
 	public function setTitle($title)
 	{
-		$this->question = $title; 	
+		$this->question = $title;
 	}
-	
+
 
 	/**
 	 * Moves the temporary question "tmp" to "quiz-$questionId"
@@ -1002,10 +1002,10 @@ abstract class Question
 		$renderer->setElementTemplate('<div class="row"><div class="label">{label}</div><div class="formw" >{element}</div></div>','questionName');
 		$renderer->setElementTemplate('<div class="row"><div class="label">{label}</div><div class="formw">{element}</div></div>','questionLevel');
 		$form->addRule('questionName', get_lang('GiveQuestion'), 'required');
-		
+
 		// default content
 		$isContent = intval($_REQUEST['isContent']);
-		
+
 		// question type
 		$answerType= intval($_REQUEST['answerType']);
 		$form->addElement('hidden','answerType',$_REQUEST['answerType']);
@@ -1101,26 +1101,26 @@ abstract class Question
 			//2. but if it is a feedback DIRECT we only show the UNIQUE_ANSWER type that is currently available
 			$question_type_custom_list = array ( UNIQUE_ANSWER => self::$questionTypes[UNIQUE_ANSWER]);
 		}
-		
+
 		//blocking edition
-		
+
 		$show_quiz_edition = true;
 		if (isset($exerciseId) && !empty($exerciseId)) {
 			$TBL_LP_ITEM	= Database::get_course_table(TABLE_LP_ITEM);
 			$sql="SELECT max_score FROM $TBL_LP_ITEM
 				  WHERE item_type = '".TOOL_QUIZ."' AND path ='".Database::escape_string($exerciseId)."'";
 			$result = Database::query($sql);
-			if (Database::num_rows($result) > 0) {				
+			if (Database::num_rows($result) > 0) {
 				$show_quiz_edition = false;
 			}
 		}
-		
+
 		echo '<ul class="question_menu">';
 
 		foreach ($question_type_custom_list as $i=>$a_type) {
 			// include the class of the type
-			require_once($a_type[0]);			
- 		    // get the picture of the type and the langvar which describes it			 
+			require_once($a_type[0]);
+ 		    // get the picture of the type and the langvar which describes it
 			eval('$img = '.$a_type[1].'::$typePicture;');
 			eval('$explanation = get_lang('.$a_type[1].'::$explanationLangVar);');
 			echo '<li>';
@@ -1139,7 +1139,7 @@ abstract class Question
 			echo '</div>';
 			echo '</li>';
 		}
-		
+
 		echo '<li>';
 		echo '<div class="icon_image_content">';
 		if ($show_quiz_edition) {
@@ -1164,11 +1164,11 @@ abstract class Question
 	{
 		return self::$questionTypes;
 	}
-	
+
 	static function updateId()
 	{
 		return self::$questionTypes;
-	}	
+	}
 }
 endif;
 ?>

+ 0 - 1
main/forum/forumfunction.inc.php

@@ -3725,7 +3725,6 @@ function send_notifications($forum_id=0, $thread_id=0, $post_id=0) {
 				$email_body .= get_lang('NewForumPost')."\n";
 				$email_body .= get_lang('YouWantedToStayInformed')."<br /><br />\n";
 				$email_body .= get_lang('ThreadCanBeFoundHere')." : <a href=\"".$thread_link."\">".$thread_link."</a>\n";
-				var_dump($email_body);
 				@api_mail_html(api_get_person_name($value['firstname'], $value['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $value['email'], $email_subject, $email_body, api_get_person_name($_SESSION['_user']['firstName'], $_SESSION['_user']['lastName'], null, PERSON_NAME_EMAIL_ADDRESS), $_SESSION['_user']['mail']);
 			}
 		}

+ 2 - 2
main/gradebook/lib/flatview_data_generator.class.php

@@ -314,10 +314,10 @@ class FlatViewDataGenerator
 	// Sort functions - used internally
 
 	function sort_by_last_name($item1, $item2) {
-		return api_strcmp($item1[1], $item2[1]);
+		return api_strcmp($item1[2], $item2[2]);
 	}
 
 	function sort_by_first_name($item1, $item2) {
-		return api_strcmp($item1[2], $item2[2]);
+		return api_strcmp($item1[3], $item2[3]);
 	}
 }

+ 3 - 3
main/inc/lib/exercise_show_functions.lib.php

@@ -124,7 +124,7 @@ class ExerciseShowFunctions {
 			<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
 			<td valign="top" align="left" >
 				<?php
-				$answerComment=api_parse_tex($answerComment);
+				$answerComment=text_filter($answerComment);
 				if($studentChoice) {
 					echo '<span style="font-weight: bold; color: #008000;">'.nl2br(make_clickable($answerComment)).'</span>';
 				} else {
@@ -169,7 +169,7 @@ class ExerciseShowFunctions {
 		</td>
 		<td width="40%" style="border-bottom: 1px solid #4171B5;">
 			<?php
-			$answer=api_parse_tex($answer);
+			$answer=text_filter($answer);
 			echo $answer;
 			?>
 		</td>
@@ -177,7 +177,7 @@ class ExerciseShowFunctions {
 		<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
 		<td width="20%" style="border-bottom: 1px solid #4171B5;">
 			<?php
-			$answerComment=api_parse_tex($answerComment);
+			$answerComment=text_filter($answerComment);
 			if($studentChoice)
 			{
 				if(!$answerCorrect)

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

@@ -141,7 +141,7 @@ define('LOG_CONFIGURATION_SETTINGS_CATEGORY', 'settings_category');
 define('LOG_CONFIGURATION_SETTINGS_VARIABLE', 'settings_variable');
 
 // Specification for usernames:
-// 1. ASCII-letters, digits, "." (dot), "_" (underscore) are acceptable, 20 characters maximal length.
+// 1. ASCII-letters, digits, "." (dot), "_" (underscore) are acceptable, 40 characters maximum length.
 // 2. Empty username is formally valid, but it is reserved for the anonymous user.
 define('USERNAME_MAX_LENGTH', 40);
 define('USERNAME_PURIFIER', '/[^0-9A-Za-z_\.]/');

+ 5 - 5
main/newscorm/learnpath_functions.inc.php

@@ -1473,7 +1473,7 @@ function export_exercise($item_id)
 		}
 	}
 
-	$exerciseTitle = api_parse_tex($exerciseTitle);
+	$exerciseTitle = text_filter($exerciseTitle);
 
 	$test .= "<h3>".$exerciseTitle."</h3>";
 
@@ -1482,7 +1482,7 @@ function export_exercise($item_id)
 		$test .= "<a href=\"../document/download.php?doc_url=%2Faudio%2F".$exerciseSound."\"&SQMSESSID=36812c2dea7d8d6e708d5e6a2f09b0b9 target=\"_blank\"><img src=\"../img/sound.gif\" border=\"0\" align=\"absmiddle\" alt=".get_lang("Sound")."\" /></a>";
 	}
 
-	$exerciseDescription = api_parse_tex($exerciseDescription);
+	$exerciseDescription = text_filter($exerciseDescription);
 
 	// --------- writing the .js file with to check the correct answers begin -----------------------
 	$scriptfilename = "Exercice".$item_id.".js";
@@ -1716,7 +1716,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
 				$content = $myrow["content"];
 				//3.2.7 Make clickable???
 				$content = make_clickable($content);
-				$content = api_parse_tex($content);
+				$content = text_filter($content);
 				//3.2.8 Write the prepared content to the export string
 				$expcontent .= "<tr><td class=\"text\" colspan='2'>";
 				$expcontent .= $content;
@@ -1755,7 +1755,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
 				//$content = nl2br($content);
 				//3.2 Prepare the data for export
 				$content = make_clickable($content);
-				$content = api_parse_tex($content);
+				$content = text_filter($content);
 
 				//3.3 Get a UNIX(?<-mktime) Timestamp of the end_date for this announcement
 				$last_post_datetime = $myrow['end_date']; // post time format  datetime de mysql
@@ -1801,7 +1801,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
 					$expcontent .= "<h4>".$row['title']."</h4>";
 					//2.a.1.2 Prepare content
 					$content = make_clickable(nl2br($row['content']));
-					$content = api_parse_tex($content);
+					$content = text_filter($content);
 					//2.a.1.3 Write content to the export string
 					$expcontent .= $content;
 				}