diff --git a/main/admin/index.php b/main/admin/index.php index 3cea4897a9..365b735ae0 100755 --- a/main/admin/index.php +++ b/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 (the code) -* @author Patrick Cool , 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='' . get_lang('YourVersionNotUpToDate') . '. '.get_lang('LatestVersionIs').' Chamilo '.$version_info.'. '.get_lang('YourVersionIs').' Dokeos '.$system_version. '. '.str_replace('http://www.chamilo.org','http://www.chamilo.org',get_lang('PleaseVisitDokeos')).''; - } else { - $output = ''.get_lang('VersionUpToDate').': Chamilo '.$version_info.''; - } - } - else - { - if ($errstr) - { - $output = '' . get_lang('ConnectSocketError') . ': '. $errstr . ''; - } - else - { - $output = '' . get_lang('SocketFunctionsDisabled') . ''; - } - } - return $output; -} /* FOOTER */ diff --git a/main/admin/statistics/statistics.lib.php b/main/admin/statistics/statistics.lib.php index 6377734ead..a6d3858221 100755 --- a/main/admin/statistics/statistics.lib.php +++ b/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 '
'; $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 diff --git a/main/admin/user_list.php b/main/admin/user_list.php index a3f2478b2e..318397c3b5 100755 --- a/main/admin/user_list.php +++ b/main/admin/user_list.php @@ -946,8 +946,9 @@ if ($_GET['action'] == "login_as" && isset ($login_as_user_id)) $form->addElement('html', ''); - } - + } else { + $form->addElement('html', ''; } -$exerciseTitle = api_parse_tex($exerciseTitle); +$exerciseTitle = text_filter($exerciseTitle); echo "

" . $exerciseTitle . "

"; $show_clock = true; diff --git a/main/exercice/exercise.lib.php b/main/exercice/exercise.lib.php index 37fa1bd161..8148b59c98 100755 --- a/main/exercice/exercise.lib.php +++ b/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="
".get_lang('Question').' '; @@ -63,7 +63,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre $s=''; $s.="
"; - $questionDescription=api_parse_tex($questionDescription); + $questionDescription=text_filter($questionDescription); $s.=$questionDescription; $s.="
"; @@ -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 .= ''. '

'. @@ -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 .= ''. '

'. @@ -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 .= ''. '

'. @@ -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 .= ''; - $parsed_answer = api_parse_tex($answer); + $parsed_answer = text_filter($answer); //left part questions $s .= ' '.$lines_count.' '.$parsed_answer.''; @@ -390,7 +395,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre echo ''; } diff --git a/main/exercice/exercise_result.php b/main/exercice/exercise_result.php index 2f8d5a3d04..418fa85d41 100755 --- a/main/exercice/exercise_result.php +++ b/main/exercice/exercise_result.php @@ -314,14 +314,14 @@ function display_unique_or_multiple_answer($answerType, $studentChoice, $answer, '; - echo ''; + echo ''; echo ''; } } diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php index 1ac46877a6..2a5551dc86 100755 --- a/main/exercice/exercise_show.php +++ b/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 [ diff --git a/main/exercice/export/scorm/scorm_classes.php b/main/exercice/export/scorm/scorm_classes.php old mode 100644 new mode 100755 index 358fb5b035..748cf26664 --- a/main/exercice/export/scorm/scorm_classes.php +++ b/main/exercice/export/scorm/scorm_classes.php @@ -129,12 +129,12 @@ class ScormQuestion extends Question $cols = 2; $s='' . '' . "\n" . '' . "\n" . '' . "\n" . '' . "\n" . '' . "\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=" diff --git a/main/exercice/question.class.php b/main/exercice/question.class.php index c50fb82482..241db19e13 100755 --- a/main/exercice/question.class.php +++ b/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('
{label}
{element}
','questionName'); $renderer->setElementTemplate('
{label}
{element}
','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 '
    '; 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 '
  • '; @@ -1139,7 +1139,7 @@ abstract class Question echo ''; echo '
  • '; } - + echo '
  • '; echo '
    '; if ($show_quiz_edition) { @@ -1164,11 +1164,11 @@ abstract class Question { return self::$questionTypes; } - + static function updateId() { return self::$questionTypes; - } + } } endif; ?> \ No newline at end of file diff --git a/main/forum/forumfunction.inc.php b/main/forum/forumfunction.inc.php index 2c2c58d41e..a628af789b 100755 --- a/main/forum/forumfunction.inc.php +++ b/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')."

    \n"; $email_body .= get_lang('ThreadCanBeFoundHere')." : ".$thread_link."\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']); } } diff --git a/main/gradebook/lib/flatview_data_generator.class.php b/main/gradebook/lib/flatview_data_generator.class.php index 40ae9686d2..2e1553cee3 100755 --- a/main/gradebook/lib/flatview_data_generator.class.php +++ b/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]); } } diff --git a/main/inc/lib/exercise_show_functions.lib.php b/main/inc/lib/exercise_show_functions.lib.php index 8145e23e64..8d9215c421 100755 --- a/main/inc/lib/exercise_show_functions.lib.php +++ b/main/inc/lib/exercise_show_functions.lib.php @@ -124,7 +124,7 @@ class ExerciseShowFunctions {
@@ -177,7 +177,7 @@ class ExerciseShowFunctions {
'; - echo $questionDescription=api_parse_tex($questionDescription); + echo $questionDescription=text_filter($questionDescription); echo '
'; } -$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 '
'.api_parse_tex($answer_matching[$answerId]).''.api_parse_tex($user_answer).' / '.api_parse_tex($answer_matching[$answerCorrect]).''.text_filter($answer_matching[$answerId]).''.text_filter($user_answer).' / '.text_filter($answer_matching[$answerCorrect]).'
' . "\n" . - api_parse_tex($title). + text_filter($title). '
' . "\n" . - ''.api_parse_tex($description).'' . "\n" . + ''.text_filter($description).'' . "\n" . '
 "; - $questionName=api_parse_tex($questionName); + $questionName=text_filter($questionName); $s.=$questionName; $s.="
"; - $questionDescription=api_parse_tex($questionDescription); + $questionDescription=text_filter($questionDescription); $s.=$questionDescription; $s.=" '.nl2br(make_clickable($answerComment)).''; } else { @@ -169,7 +169,7 @@ class ExerciseShowFunctions { ".$exerciseTitle.""; @@ -1482,7 +1482,7 @@ function export_exercise($item_id) $test .= ".get_lang("; } - $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 .= "
"; $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 .= "

".$row['title']."

"; //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; }