Merging with svn version

skala
Noël Dieschburg 17 years ago
commit 8d060238a5
  1. 10
      main/exercice/adminhp.php
  2. 4
      main/exercice/exercice.php
  3. 2
      main/exercice/exercise_result.class.php
  4. 20
      main/exercice/hotpotatoes.lib.php
  5. 2
      main/exercice/showinframes.php
  6. 2
      main/exercice/testheaderpage.php
  7. 2
      main/gradebook/gradebook_result.class.php
  8. 2
      main/tracking/userLog.php
  9. 2
      main/tracking/userlogCSV.php

@ -134,18 +134,12 @@ $lstrComment = GetComment($hotpotatoesName);
if($lstrComment=="") if($lstrComment=="")
$lstrComment = GetQuizName($hotpotatoesName,$documentPath); $lstrComment = GetQuizName($hotpotatoesName,$documentPath);
if($lstrComment=="") if($lstrComment=="")
$lstrComment = GetFileName($hotpotatoesName,$documentPath); $lstrComment = basename($hotpotatoesName,$documentPath);
echo $lstrComment; echo $lstrComment;
echo "\" size=40> "; echo "\" size=40> ";
echo "<button type=\"submit\" class=\"save\" name=\"submit\" value=\"".get_lang('Ok')."\">".get_lang('Ok')."</button>"; echo "<button type=\"submit\" class=\"save\" name=\"submit\" value=\"".get_lang('Ok')."\">".get_lang('Ok')."</button>";
echo "<button type=\"button\" class=\"cancel\" name=\"cancel\" value=\"".get_lang('Cancel')."\" onclick=\"javascript:document.form1.newName.value='';\">".get_lang('Cancel')."</button>"; echo "<button type=\"button\" class=\"cancel\" name=\"cancel\" value=\"".get_lang('Cancel')."\" onclick=\"javascript:document.form1.newName.value='';\">".get_lang('Cancel')."</button>";
echo "</form>"; echo "</form>";
?> Display::display_footer();
<?php
Display::display_footer();
?>

@ -1066,7 +1066,7 @@ if ($show == 'test') {
$title = GetQuizName($path, $documentPath); $title = GetQuizName($path, $documentPath);
if ($title == '') { if ($title == '') {
$title = GetFileName($path); $title = basename($path);
} }
// prof only // prof only
if ($is_allowedToEdit) { if ($is_allowedToEdit) {
@ -1345,7 +1345,7 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
for ($i = 0; $i < sizeof($hpresults); $i++) { for ($i = 0; $i < sizeof($hpresults); $i++) {
$title = GetQuizName($hpresults[$i][1], $documentPath); $title = GetQuizName($hpresults[$i][1], $documentPath);
if ($title == '') { if ($title == '') {
$title = GetFileName($hpresults[$i][1]); $title = basename($hpresults[$i][1]);
} }
echo '<tr>'; echo '<tr>';
if ($is_allowedToEdit) { if ($is_allowedToEdit) {

@ -196,7 +196,7 @@ class ExerciseResult
$title = GetQuizName($hpresults[$i][1],$document_path); $title = GetQuizName($hpresults[$i][1],$document_path);
if ($title =='') if ($title =='')
{ {
$title = GetFileName($hpresults[$i][1]); $title = basename($hpresults[$i][1]);
} }
if(empty($user_id)) if(empty($user_id))
{ {

@ -54,7 +54,7 @@ function GetQuizName($fname,$fpath) {
if (file_exists($fpath.$fname)) { if (file_exists($fpath.$fname)) {
if (!($fp = fopen($fpath.$fname, "r"))) { if (!($fp = fopen($fpath.$fname, "r"))) {
//die("could not open Quiz input"); //die("could not open Quiz input");
return GetFileName($fname); return basename($fname);
} }
$contents = fread($fp, filesize($fpath.$fname)); $contents = fread($fp, filesize($fpath.$fname));
@ -107,19 +107,6 @@ function SetComment($path,$comment) {
return "$result"; return "$result";
} }
/**
* Get the name of the file from a path (without the extension)
*
* This assumes the path is made of elements split by '/', not '\' or '\\'
* @param string Path
* @return string File name
*/
function GetFileName($fname) {
$name = explode('/',$fname);
$name = $name[sizeof($name)-1];
return $name;
}
/** /**
* Reads the file contents into a string * Reads the file contents into a string
* @param string Urlencoded path * @param string Urlencoded path
@ -165,7 +152,6 @@ function WriteFileCont($full_file_path,$content) {
* Gets the name of an img whose path is given (without directories or extensions) * Gets the name of an img whose path is given (without directories or extensions)
* @param string An image tag (<img src="...." ...>) * @param string An image tag (<img src="...." ...>)
* @return string The image file name or an empty string * @return string The image file name or an empty string
* @uses GetFileName No comment
*/ */
function GetImgName($imgtag) { function GetImgName($imgtag) {
// select src tag from img tag // select src tag from img tag
@ -180,7 +166,7 @@ function GetImgName($imgtag) {
if ($src=="") { if ($src=="") {
return ""; return "";
} else { } else {
$tmp_src = GetFileName($src) ; $tmp_src = basename($src) ;
if ($tmp_src == "") { if ($tmp_src == "") {
return $src; return $src;
} else { } else {
@ -304,7 +290,7 @@ function ReplaceImgTag($content) {
else { else {
$prehref = $imgname; $prehref = $imgname;
$posthref = GetFileName($imgname); $posthref = basename($imgname);
$newcontent = str_replace($prehref,$posthref,$newcontent); $newcontent = str_replace($prehref,$posthref,$newcontent);
} }
} }

@ -84,7 +84,7 @@ WriteFileCont($full_file_path.$_user['user_id'].".t.html",$newcontent);
$newcontent = str_replace($prehref,$posthref,$newcontent); $newcontent = str_replace($prehref,$posthref,$newcontent);
*/ */
$doc_url = GetFolderPath($doc_url).urlencode(GetFileName($doc_url)); $doc_url = GetFolderPath($doc_url).urlencode(basename($doc_url));
// echo $documentWebPath.$doc_url.$_user['user_id'].".t.html"; // echo $documentWebPath.$doc_url.$_user['user_id'].".t.html";
// exit; // exit;
?> ?>

@ -18,7 +18,7 @@ $my_file=str_replace(array('../','\\..','\\0','..\\'),array('','','',''),urldeco
$title = GetQuizName($my_file,$documentPath); $title = GetQuizName($my_file,$documentPath);
if ($title =='') { if ($title =='') {
$title = GetFileName($my_file); $title = basename($my_file);
} }
$nameTools = $title; $nameTools = $title;
$noPHP_SELF=true; $noPHP_SELF=true;

@ -177,7 +177,7 @@ class GradeBookResult
$return[$j+$i] = array(); $return[$j+$i] = array();
$title = GetQuizName($hpresults[$i][1],$document_path); $title = GetQuizName($hpresults[$i][1],$document_path);
if ($title =='') { if ($title =='') {
$title = GetFileName($hpresults[$i][1]); $title = basename($hpresults[$i][1]);
} }
if (empty($user_id)) { if (empty($user_id)) {
$return[$j+$i]['user'] = $hpresults[$i][0]; $return[$j+$i]['user'] = $hpresults[$i][0];

@ -333,7 +333,7 @@ function display_exercise_tracking_info($view, $user_id, $course_id)
for($i = 0; $i < sizeof($hpresults); $i++) { for($i = 0; $i < sizeof($hpresults); $i++) {
$title = GetQuizName($hpresults[$i][0],''); $title = GetQuizName($hpresults[$i][0],'');
if ($title == '') if ($title == '')
$title = GetFileName($hpresults[$i][0]); $title = basename($hpresults[$i][0]);
$display_date = format_locale_date(get_lang('dateTimeFormatLong'), $hpresults[$i][3]); $display_date = format_locale_date(get_lang('dateTimeFormatLong'), $hpresults[$i][3]);
?> ?>
<tr> <tr>

@ -284,7 +284,7 @@ function display_exercise_tracking_info($view, $user_id, $course_id)
$title = GetQuizName($hpresults[$i][0],''); $title = GetQuizName($hpresults[$i][0],'');
if ($title == '') if ($title == '')
$title = GetFileName($hpresults[$i][0]); $title = basename($hpresults[$i][0]);
$display_date = format_locale_date(get_lang('dateTimeFormatLong'), $hpresults[$i][3]); $display_date = format_locale_date(get_lang('dateTimeFormatLong'), $hpresults[$i][3]);
$line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n";

Loading…
Cancel
Save