diff --git a/main/exercice/hotpotatoes.lib.php b/main/exercice/hotpotatoes.lib.php
index 03bce6cb64..5da6d8240c 100644
--- a/main/exercice/hotpotatoes.lib.php
+++ b/main/exercice/hotpotatoes.lib.php
@@ -1,34 +1,11 @@
-)",$contents,$matches);
$imgcount = 0;
- while (list($int,$match)=each($matches))
- {
+ while (list($int,$match)=each($matches)) {
//each match consists of a key and a value
- while(list($key,$imgtag)=each($match))
- {
+ while (list($key,$imgtag)=each($match)) {
$imgname = GetImgName($imgtag);
- if ($imgname!="" && !in_array($imgname,$imgparams)){
+ if ($imgname!="" && !in_array($imgname,$imgparams)) {
array_push($imgparams,$imgname); // name (+ type) of the images in the html test
$imgcount = $imgcount + 1; // number of images in the html test
}
@@ -278,12 +244,10 @@ function GetImgParams($fname,$fpath,&$imgparams,&$imgcount)
* @param array List of image parameters
* @return string String containing the hidden parameters built from the list given
*/
-function GenerateHiddenList($imgparams)
-{
+function GenerateHiddenList($imgparams) {
$list = "";
- if(is_array($imgparams)){
- while (list($int,$string)=each($imgparams))
- {
+ if (is_array($imgparams)) {
+ while (list($int,$string)=each($imgparams)) {
$list .= "\n";
}
}
@@ -296,18 +260,15 @@ function GenerateHiddenList($imgparams)
* @param string Node we are looking for in the array
* @return mixed Node name or false if not found
*/
-function myarraysearch(&$array,$node)
-{
+function myarraysearch(&$array,$node) {
$match = FALSE;
$tmp_array = array();
- for($i=0;$i)",$content,$matches);
$imgcount = 0;
- while (list($int,$match)=each($matches))
- {
- while(list($key,$imgtag)=each($match))
- {
+ while (list($int,$match)=each($matches)) {
+ while (list($key,$imgtag)=each($match)) {
$imgname = GetSrcName($imgtag);
if ($imgname=="") {} // valid or invalid image name
else {
@@ -360,11 +318,9 @@ function ReplaceImgTag($content)
* @param integer Length to reach
* @return string Modified folder name
*/
-function FillFolderName($name,$nsize)
-{
+function FillFolderName($name,$nsize) {
$str = "";
- for($i=0;$i < $nsize-strlen($name);$i++)
- {
+ for($i=0;$i < $nsize-strlen($name);$i++) {
$str .= "0";
}
$str .= $name;
@@ -376,17 +332,14 @@ function FillFolderName($name,$nsize)
* @param string Folder path
* @return string Folder name (modified)
*/
-function GenerateHpFolder($folder)
-{
+function GenerateHpFolder($folder) {
$filelist = array();
if ($dir = @opendir($folder)) {
while (($file = readdir($dir)) !== false) {
if ( $file != ".") {
- if ($file != "..")
- {
+ if ($file != "..") {
$full_name = $folder."/".$file;
- if (is_dir($full_name))
- {
+ if (is_dir($full_name)) {
$filelist[] = $file;
}
}
@@ -410,8 +363,7 @@ function GenerateHpFolder($folder)
* @param string Path
* @return string Folder name stripped down
*/
-function GetFolderName($fname)
-{
+function GetFolderName($fname) {
$name = explode('/',$fname);
$name = $name[sizeof($name)-2];
return $name;
@@ -422,12 +374,12 @@ function GetFolderName($fname)
* @param string Path
* @return string Path stripped down
*/
-function GetFolderPath($fname)
-{
+function GetFolderPath($fname) {
$str = "";
$name = explode('/',$fname);
- for($i=0;$i < sizeof($name)-1; $i++)
- { $str = $str.$name[$i]."/"; }
+ for ($i=0;$i < sizeof($name)-1; $i++) {
+ $str = $str.$name[$i]."/";
+ }
return $str;
}
@@ -436,8 +388,7 @@ function GetFolderPath($fname)
* @param string Path
* @return integer 1 if a subfolder was found, 0 otherwise
*/
-function CheckSubFolder($path)
-{
+function CheckSubFolder($path) {
$folder = GetFolderPath($path);
$dflag = 0;
if ($dir = @opendir($folder)) {
@@ -462,21 +413,17 @@ function CheckSubFolder($path)
* @param integer User id
* @return void No return value, but echoes results
*/
-function HotPotGCt($folder,$flag,$userID)
-{ // Garbage Collector
+function HotPotGCt($folder,$flag,$userID) {
+ // Garbage Collector
$filelist = array();
if ($dir = @opendir($folder)) {
while (($file = readdir($dir)) !== false) {
if ( $file != ".") {
- if ($file != "..")
- {
+ if ($file != "..") {
$full_name = $folder."/".$file;
- if (is_dir($full_name))
- {
+ if (is_dir($full_name)) {
HotPotGCt($folder."/".$file,$flag,$userID);
- }
- else
- {
+ } else {
$filelist[] = $file;
}
}
@@ -484,19 +431,13 @@ function HotPotGCt($folder,$flag,$userID)
}
closedir($dir);
}
- while (list ($key, $val) = each ($filelist))
- {
- if (stristr($val,$userID.".t.html"))
- {
- if ($flag == 1)
- {
+ while (list ($key, $val) = each ($filelist)) {
+ if (stristr($val,$userID.".t.html")) {
+ if ($flag == 1) {
my_delete($folder."/".$val);
- }
- else
- {
+ } else {
echo $folder."/".$val."
";
}
}
}
-}
-?>
+}
\ No newline at end of file