Browse Source

[svn r20450] FS#306 - The Dropbox tool: Improvements for better encoding management.

Ivan Tcholakov 16 years ago
parent
commit
54bce1d0e2

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

@@ -433,7 +433,7 @@ class Dropbox_Person
 		if ($sort == 'filesize') {	//filesize is not a string, so we use other comparison technique
 			return $aval<$bval ? -1 : 1;
 		} else {
-		    return strcasecmp($aval, $bval);
+		    return api_strcasecmp($aval, $bval);
 		}
 	}
 	
@@ -654,4 +654,4 @@ class Dropbox_Person
 		}
 		$this->receivedWork = $new_received_work;
 	}
-}
+}

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

@@ -1261,7 +1261,7 @@ function zip_download_alternative($files)
 	// Step 2: we copy all the original dropbox files to the temp folder and change their name into the original name
 	foreach ($files as $key=>$value)
 	{
-		$value['title']=check_file_name(strtolower($value['title']));
+		$value['title']=check_file_name(api_strtolower($value['title']));
 		$files[$value['filename']]['title']=$value['title'];
 		copy(api_get_path(SYS_COURSE_PATH).$_course['path']."/dropbox/".$value['filename'], api_get_path(SYS_COURSE_PATH).$_course['path']."/temp/".$value['title']);
 	}
@@ -1507,4 +1507,4 @@ function get_last_tool_access($tool, $course_code='', $user_id='')
 	$row=mysql_fetch_array($result);
 	return $row['access_date'];
 }
-?>
+?>

+ 7 - 7
main/dropbox/dropbox_submit.php

@@ -317,11 +317,11 @@ if ( isset( $_GET['mailingIndex']))  // examine or send
     $mailing_file = dropbox_cnf("sysPath") . '/' . $mailing_item->filename;
     $errormsg = '<b>' . $mailing_item->recipients[0]['name'] . ' ('
     	. "<a href='dropbox_download.php?origin=$origin&id=".urlencode($mailing_item->id)."'>"
-		. htmlspecialchars($mailing_title,ENT_QUOTES,$charset) . '</a>):</b><br><br>';
+		. htmlspecialchars($mailing_title,ENT_QUOTES,$charset) . '</a>):</b><br /><br />';
 
     if ( preg_match( dropbox_cnf("mailingZipRegexp"), $mailing_title, $nameParts))
 	{
-		$var = strtoupper($nameParts[2]);  // the variable part of the name
+		$var = api_strtoupper($nameParts[2]);  // the variable part of the name
 		$course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
 		$sel = "SELECT u.user_id, u.lastname, u.firstname, cu.status
 				FROM `".$_configuration['main_database']."`.`user` u
@@ -357,7 +357,7 @@ if ( isset( $_GET['mailingIndex']))  // examine or send
         }
 
 		$preFix = $nameParts[1]; $postFix = $nameParts[3];
-		$preLen = strlen($preFix); $postLen = strlen($postFix);
+		$preLen = api_strlen($preFix); $postLen = api_strlen($postFix);
 
 		function findRecipient($thisFile)
 		{
@@ -368,11 +368,11 @@ if ( isset( $_GET['mailingIndex']))  // examine or send
             if ( preg_match(dropbox_cnf("mailingFileRegexp"), $thisFile, $matches))
             {
 	            $thisName = $matches[1];
-	            if ( substr($thisName, 0, $preLen) == $preFix)
+	            if ( api_substr($thisName, 0, $preLen) == $preFix)
 	            {
-		            if ( $postLen == 0 || substr($thisName, -$postLen) == $postFix)
+		            if ( $postLen == 0 || api_substr($thisName, -$postLen) == $postFix)
 		            {
-			            $thisRecip = substr($thisName, $preLen, strlen($thisName) - $preLen - $postLen);
+			            $thisRecip = api_substr($thisName, $preLen, api_strlen($thisName) - $preLen - $postLen);
 			            if ( $thisRecip) return getUser($thisRecip);
 			            return ' <'.dropbox_lang("mailingFileNoRecip", "noDLTT").'>';
 		            }
@@ -491,7 +491,7 @@ if ( isset( $_GET['mailingIndex']))  // examine or send
 		        {
 					$remainingUsers .= ', ' . htmlspecialchars($res[0].' '.$res[1],ENT_QUOTES,$charset);
 		        }
-		        $errormsg .= '<br>' . dropbox_lang("mailingNothingFor") . substr($remainingUsers, 1) . '.<br>';
+		        $errormsg .= '<br />' . dropbox_lang("mailingNothingFor") . api_substr($remainingUsers, 1) . '.<br />';
 	        }
 
 			if ( isset( $_GET['mailingSend']))