Feature #272 - The Dropbox tool fully uses the conventional language sub-system, the function dropbox_leng() has been eliminated.

skala
Ivan Tcholakov 15 years ago
parent 759303b7ff
commit edb3658f54
  1. 30
      main/dropbox/dropbox_class.inc.php
  2. 4
      main/dropbox/dropbox_download.php
  3. 37
      main/dropbox/dropbox_functions.inc.php
  4. 12
      main/dropbox/dropbox_init.inc.php
  5. 84
      main/dropbox/dropbox_submit.php
  6. 123
      tests/main/dropbox/dropbox_functions.inc.test.php

@ -93,7 +93,7 @@ class Dropbox_Work {
function _createNewWork ($uploader_id, $title, $description, $author, $filename, $filesize) {
global $_user,$dropbox_cnf;
// Do some sanity checks
settype($uploader_id, 'integer') or die(dropbox_lang("generalError")." (code 201)"); //set $uploader_id to correct type
settype($uploader_id, 'integer') or die(get_lang('GeneralError').' (code 201)'); //set $uploader_id to correct type
//if (! isCourseMember($uploader_id)) die(); //uploader must be coursemember to be able to upload
//-->this check is done when submitting data so it isn't checked here
@ -165,11 +165,11 @@ class Dropbox_Work {
*/
function _createExistingWork ($id) {
global $_user,$dropbox_cnf; // RH: Feedback
// Do some sanity checks
settype($id, 'integer') or die(dropbox_lang("generalError")." (code 205)"); //set $id to correct type
settype($id, 'integer') or die(get_lang('GeneralError').' (code 205)'); //set $id to correct type
$id = intval($id);
// get the data from DB
$sql="SELECT uploader_id, filename, filesize, title, description, author, upload_date, last_upload_date, cat_id
FROM ".$dropbox_cnf["tbl_file"]."
@ -183,7 +183,7 @@ class Dropbox_Work {
if ($uploaderName == FALSE) {
//deleted user
$this->uploader_id = -1;
$this->uploaderName = dropbox_lang("anonymous", "noDLTT");
$this->uploaderName = get_lang('Unknown', '');
} else {
$this->uploader_id = $uploader_id;
$this->uploaderName = $uploaderName;
@ -268,7 +268,7 @@ class Dropbox_SentWork extends Dropbox_Work
// Do sanity checks on recipient_ids array & property fillin
// The sanity check for ex-coursemembers is already done in base constructor
settype($uploader_id, 'integer') or die(dropbox_lang("generalError")." (code 208)"); //set $uploader_id to correct type
settype($uploader_id, 'integer') or die(get_lang('GeneralError').' (code 208)'); //set $uploader_id to correct type
$justSubmit = FALSE; // RH: mailing zip-file or just upload
if ( is_int($recipient_ids)) {
@ -277,10 +277,10 @@ class Dropbox_SentWork extends Dropbox_Work
$justSubmit = TRUE; $recipient_ids = array($uploader_id);
}
if (! is_array($recipient_ids) || count($recipient_ids) == 0) {
die(dropbox_lang("generalError")." (code 209)");
die(get_lang('GeneralError').' (code 209)');
}
foreach ($recipient_ids as $rec) {
if (empty($rec)) die(dropbox_lang("generalError")." (code 210)");
if (empty($rec)) die(get_lang('GeneralError').' (code 210)');
//if (!isCourseMember($rec)) die(); //cannot sent document to someone outside of course
//this check is done when validating submitted data
$this->recipients[] = array("id"=>$rec, "name"=>getUserNameFromId($rec));
@ -328,7 +328,7 @@ class Dropbox_SentWork extends Dropbox_Work
$this->Dropbox_Work($id);
// Do sanity check. The sanity check for ex-coursemembers is already done in base constructor
settype($id, 'integer') or die(dropbox_lang("generalError")." (code 211)"); //set $id to correct type
settype($id, 'integer') or die(get_lang('GeneralError').' (code 211)'); //set $id to correct type
//Fill in recipients array/
$this->recipients = array(); // RH: Feedback: added to SELECT
@ -342,7 +342,7 @@ class Dropbox_SentWork extends Dropbox_Work
$recipientName = getUserNameFromId($dest_user_id);
//$this->category=$res['cat_id'];
if ($recipientName == FALSE) {
$this->recipients[] = array("id"=>-1, "name"=> dropbox_lang("anonymous", "noDLTT"));
$this->recipients[] = array("id"=>-1, "name"=> get_lang('Unknown', ''));
} else {
$this->recipients[] = array("id"=>$dest_user_id, "name"=>$recipientName, "user_id"=>$dest_user_id,
"feedback_date"=>$res["feedback_date"], "feedback"=>$res["feedback"]); // RH: Feedback
@ -531,7 +531,7 @@ class Dropbox_Person
function deleteReceivedWorkFolder($id) {
global $dropbox_cnf;
$id = intval($id);
$sql = "DELETE FROM ".$dropbox_cnf["tbl_file"]." where cat_id = '".$id."' ";
if(!Database::query($sql)) return false;
$sql = "DELETE FROM ".$dropbox_cnf["tbl_category"]." where cat_id = '".$id."' ";
@ -558,7 +558,7 @@ class Dropbox_Person
}
if (! $found) {
if(!$this->deleteReceivedWorkFolder($id)) {
die(dropbox_lang("generalError")." (code 216)");
die(get_lang('GeneralError').' (code 216)');
}
}
//delete entries in person table concerning received works
@ -586,7 +586,7 @@ class Dropbox_Person
*/
function deleteSentWork ($id) {
$id = intval($id);
global $dropbox_cnf;
//index check
$found = false;
@ -598,7 +598,7 @@ class Dropbox_Person
}
if (!$found) {
if(!$this->deleteReceivedWorkFolder($id)) {
die(dropbox_lang("generalError")." (code 219)");
die(get_lang('GeneralError').' (code 219)');
}
}
//$file_id = $this->sentWork[$index]->id; // RH: Mailing
@ -628,7 +628,7 @@ class Dropbox_Person
} // foreach (... as $wi -> $w) gives error 221! (no idea why...)
}
if (! $found) {
die(dropbox_lang("generalError")." (code 221)");
die(get_lang('GeneralError').' (code 221)');
}
$feedback_date = date("Y-m-d H:i:s",time());

@ -317,7 +317,7 @@ if ($_GET['mailing']) // RH: Mailing detail window call
SANITY CHECKS OF GET DATA & FILE
==============================================================================
*/
if ( ! isset( $_GET['id']) || ! is_numeric( $_GET['id'])) die(dropbox_lang("generalError")." (code 501)");
if ( ! isset( $_GET['id']) || ! is_numeric( $_GET['id'])) die(get_lang('GeneralError').' (code 501)');
$work = new Dropbox_work($_GET['id']);
@ -328,7 +328,7 @@ $file = $work->title;
//if ( !is_file( $path) || ! eregi( '^[A-Z0-9_\-][A-Z0-9._\-]*$', $file))
if ( !is_file( $path))
{
die(dropbox_lang("generalError")." (code 504)");
die(get_lang('GeneralError').' (code 504)');
}
/*

@ -536,7 +536,7 @@ function display_add_form()
<div class="row">
<div class="label">
<span class="form_required">*</span><?php echo dropbox_lang("uploadFile")?>:
<span class="form_required">*</span><?php echo get_lang('UploadFile'); ?>:
</div>
<div class="formw">
<input type="hidden" name="MAX_FILE_SIZE" value='<?php echo dropbox_cnf("maxFilesize")?>' />
@ -561,7 +561,7 @@ function display_add_form()
</div>
<div class="formw">
<input type="checkbox" name="cb_overwrite" id="cb_overwrite" value="true" /><?php echo dropbox_lang("overwriteFile")?>
<input type="checkbox" name="cb_overwrite" id="cb_overwrite" value="true" /><?php echo get_lang('OverwriteFile'); ?>
</div>
</div>
<?php
@ -570,7 +570,7 @@ function display_add_form()
<div class="row">
<div class="label">
<?php echo dropbox_lang("sendTo")?>
<?php echo get_lang('SendTo'); ?>
</div>
<div class="formw">
<?php
@ -665,13 +665,13 @@ function display_add_form()
if ( ($dropbox_person -> isCourseTutor || $dropbox_person -> isCourseAdmin) && dropbox_cnf("allowMailing")) // RH: Mailing starting point
{
// echo '<option value="mailing">'.dropbox_lang("mailingInSelect").'</option>';
// echo '<option value="mailing">'.get_lang('MailingInSelect').'</option>';
}
if ( dropbox_cnf("allowJustUpload")) // RH
{
//echo '<option value="upload">'.dropbox_lang("justUploadInSelect").'</option>';
echo '<option value="user_'.$_user['user_id'].'">'.dropbox_lang("justUploadInSelect").'</option>';
//echo '<option value="upload">'.get_lang('JustUploadInSelect').'</option>';
echo '<option value="user_'.$_user['user_id'].'">'.get_lang('JustUploadInSelect').'</option>';
}
echo '</select>
@ -683,7 +683,7 @@ function display_add_form()
<div class="label">
</div>
<div class="formw">
<button type="Submit" class="upload" name="submitWork">'.dropbox_lang("upload", "noDLTT").'</button>
<button type="Submit" class="upload" name="submitWork">'.get_lang('Upload', '').'</button>
</div>
</div>
';
@ -702,7 +702,7 @@ function getUserNameFromId ($id) // RH: Mailing: return 'Mailing ' + id
$mailingId = $id - dropbox_cnf("mailingIdBase");
if ( $mailingId > 0)
{
return dropbox_lang("mailingAsUsername", "noDLTT") . $mailingId;
return get_lang('MailingAsUsername', '') . $mailingId;
}
$id = intval($id);
$sql = "SELECT ".(api_is_western_name_order() ? "CONCAT(firstname,' ', lastname)" : "CONCAT(lastname,' ', firstname)")." AS name
@ -793,14 +793,15 @@ function getUserOwningThisMailing($mailingPseudoId, $owner = 0, $or_die = '')
$result = Database::query($sql);
if (!($res = Database::fetch_array($result)))
die(dropbox_lang("generalError")." (code 901)");
die(get_lang('GeneralError').' (code 901)');
if ($owner == 0) return $res['uploader_id'];
if ($res['uploader_id'] == $owner) return TRUE;
die(dropbox_lang("generalError")." (code ".$or_die.")");
die(get_lang('GeneralError').' (code '.$or_die.')');
}
/**
* @author René Haentjens, Ghent University
* @todo check if this function is still necessary.
@ -834,20 +835,6 @@ function removeMoreIfMailing($file_id)
}
}
/**
* The dropbox has a deviant naming scheme for language files so it needs an additional language function
*
* @todo check if this function is still necessary.
*
* @author René Haentjens, Ghent University
*/
function dropbox_lang($variable, $notrans = 'DLTT')
{
global $charset;
return (api_get_setting('server_type') == 'test' ?
get_lang('dropbox_lang["'.$variable.'"]', $notrans) :
api_html_entity_decode(api_to_system_encoding(str_replace("\\'", "'", $GLOBALS['dropbox_lang'][$variable]), null, true), ENT_QUOTES, $charset));
}
/**
* Function that finds a given config setting
*
@ -1259,7 +1246,7 @@ function zip_download ($array)
$overview_file=$temp_zip_dir.'/overview.html';
$handle=fopen($overview_file,'w');
fwrite($handle,$overview_file_content);
// send the zip file
DocumentManager::file_send_for_download($temp_zip_file,true,$name);
exit;

@ -117,7 +117,7 @@ if ($_GET['action']=='add')
$javascript = "<script type=\"text/javascript\">
function confirmsend ()
{
if (confirm(\"".dropbox_lang("mailingConfirmSend", "noDLTT")."\")){
if (confirm(\"".get_lang('MailingConfirmSend', '')."\")){
return true;
} else {
return false;
@ -127,7 +127,7 @@ $javascript = "<script type=\"text/javascript\">
function confirmation (name)
{
if (confirm(\"".dropbox_lang("confirmDelete", "noDLTT")." : \"+ name )){
if (confirm(\"".get_lang('ConfirmDelete', '')." : \"+ name )){
return true;
} else {
return false;
@ -138,10 +138,10 @@ $javascript = "<script type=\"text/javascript\">
function checkForm (frm)
{
if (frm.elements['recipients[]'].selectedIndex < 0){
alert(\"".dropbox_lang("noUserSelected", "noDLTT")."\");
alert(\"".get_lang('NoUserSelected', '')."\");
return false;
} else if (frm.file.value == '') {
alert(\"".dropbox_lang("noFileSpecified", "noDLTT")."\");
alert(\"".get_lang('NoFileSpecified', '')."\");
return false;
} else {
return true;
@ -285,7 +285,7 @@ if((!$is_allowed_in_course || !$is_course_member) && !api_is_allowed_to_edit(nul
*/
if ($_GET['view']=='received')
{
$interbreadcrumb[] = array ("url" => "../dropbox/index.php", "name" => dropbox_lang("dropbox", "noDLTT"));
$interbreadcrumb[] = array ("url" => "../dropbox/index.php", "name" => get_lang('Dropbox', ''));
$nameTools = get_lang('ReceivedFiles');
if ($_GET['action'] == 'addreceivedcategory')
@ -296,7 +296,7 @@ if ($_GET['view']=='received')
}
if ($_GET['view']=='sent' OR empty($_GET['view']))
{
$interbreadcrumb[] = array ("url" => "../dropbox/index.php", "name" => dropbox_lang("dropbox", "noDLTT"));
$interbreadcrumb[] = array ("url" => "../dropbox/index.php", "name" => get_lang('Dropbox', ''));
$nameTools = get_lang('SentFiles');
if ($_GET['action'] == 'addsentcategory')

@ -18,7 +18,7 @@ if (isset($_POST["dropbox_unid"])) {
{
$dropbox_unid = $_GET["dropbox_unid"];
} else {
die(dropbox_lang("badFormData")." (code 400)");
die(get_lang('BadFormData').' (code 400)');
}
if (isset($_SESSION["dropbox_uniqueid"]) && isset($_GET["dropbox_unid"]) && $dropbox_unid == $_SESSION["dropbox_uniqueid"]) {
@ -75,13 +75,13 @@ if ( isset( $_POST["submitWork"]))
{
$error = TRUE;
$errormsg = dropbox_lang("badFormData");
$errormsg = get_lang('BadFormData');
}
elseif ( !isset( $_POST['recipients']) || count( $_POST['recipients']) <= 0)
{
$error = TRUE;
$errormsg = dropbox_lang("noUserSelected");
$errormsg = get_lang('NoUserSelected');
}
else
{
@ -101,12 +101,12 @@ if ( isset( $_POST["submitWork"]))
elseif (strpos($rec, 'user_') === 0 && !isCourseMember(substr($rec, strlen('user_') ) ))
{
echo '401';
die( dropbox_lang("badFormData")." (code 401)");
die(get_lang('BadFormData').' (code 401)');
}
elseif (strpos($rec, 'group_') !== 0 && strpos($rec, 'user_') !== 0)
{
echo '402';
die( dropbox_lang("badFormData")." (code 402)");
die(get_lang('BadFormData').' (code 402)');
}
}
@ -115,7 +115,7 @@ if ( isset( $_POST["submitWork"]))
{
$error = TRUE;
$errormsg = dropbox_lang("mailingSelectNoOther");
$errormsg = get_lang('MailingSelectNoOther');
}
// we are doing a just upload but an additional recipient is selected.
elseif ( $thisIsJustUpload && ( count($_POST['recipients']) != 1))
@ -128,7 +128,7 @@ if ( isset( $_POST["submitWork"]))
{
$error = TRUE;
$errormsg = dropbox_lang("noFileSpecified");
$errormsg = get_lang('NoFileSpecified');
}
}
@ -156,12 +156,12 @@ if ( isset( $_POST["submitWork"]))
if ( $dropbox_filesize <= 0 || $dropbox_filesize > dropbox_cnf("maxFilesize"))
{
$errormsg = dropbox_lang("tooBig");
$errormsg = get_lang('TooBig');
$error = TRUE;
}elseif ( !is_uploaded_file( $dropbox_filetmpname)) // check user fraud : no clean error msg.
{
die ( dropbox_lang("badFormData")." (code 403)");
die(get_lang('BadFormData').' (code 403)');
}
if ( !$error)
@ -199,7 +199,7 @@ if ( isset( $_POST["submitWork"]))
if ( ($w->recipients[0]['id'] > dropbox_cnf("mailingIdBase")) xor $thisIsAMailing)
{
$error = TRUE;
$errormsg = dropbox_lang("mailingNonMailingError");
$errormsg = get_lang('MailingNonMailingError');
}
if ( ($w->recipients[0]['id'] == $_user['user_id']) xor $thisIsJustUpload)
{
@ -219,15 +219,15 @@ if ( isset( $_POST["submitWork"]))
if ( ( ! is_dir( dropbox_cnf("sysPath"))))
{
//The dropbox subdir doesn't exist yet so make it and create the .htaccess file
mkdir( dropbox_cnf("sysPath"), api_get_permissions_for_new_directories()) or die ( dropbox_lang("errorCreatingDir")." (code 404)");
$fp = fopen( dropbox_cnf("sysPath")."/.htaccess", "w") or die (dropbox_lang("errorCreatingDir")." (code 405)");
mkdir( dropbox_cnf("sysPath"), api_get_permissions_for_new_directories()) or die(get_lang('ErrorCreatingDir').' (code 404)');
$fp = fopen( dropbox_cnf("sysPath")."/.htaccess", "w") or die(get_lang('ErrorCreatingDir').' (code 405)');
fwrite($fp, "AuthName AllowLocalAccess
AuthType Basic
order deny,allow
deny from all
php_flag zlib.output_compression off") or die (dropbox_lang("errorCreatingDir")." (code 406)");
php_flag zlib.output_compression off") or die(get_lang('ErrorCreatingDir').' (code 406)');
}
if ( $error) {}
@ -240,7 +240,7 @@ if ( isset( $_POST["submitWork"]))
else
{
$error = TRUE;
$errormsg = $dropbox_title . ": " . dropbox_lang("mailingWrongZipfile");
$errormsg = $dropbox_title . ': ' . get_lang('MailingWrongZipfile');
}
}
elseif ( $thisIsJustUpload) // RH: $newWorkRecipients is empty array
@ -274,7 +274,7 @@ if ( isset( $_POST["submitWork"]))
if ( !$error)
{
@move_uploaded_file( $dropbox_filetmpname, dropbox_cnf("sysPath") . '/' . $dropbox_filename)
or die( dropbox_lang("uploadError")." (code 407)");
or die(get_lang('UploadError').' (code 407)');
new Dropbox_SentWork( $_user['user_id'], $dropbox_title, $_POST['description'], strip_tags($_POST['authors']), $dropbox_filename, $dropbox_filesize, $newWorkRecipients);
}
}
@ -347,11 +347,11 @@ if ( isset( $_GET['mailingIndex'])) // examine or send
}
elseif (count($students) > 1)
{
return ' <'.dropbox_lang("mailingFileRecipDup", "noDLTT").$var."= $thisRecip>";
return ' <'.get_lang('MailingFileRecipDup', '').$var."= $thisRecip>";
}
else
{
return ' <'.dropbox_lang("mailingFileRecipNotFound", "noDLTT").$var."= $thisRecip>";
return ' <'.get_lang('MailingFileRecipNotFound', '').$var."= $thisRecip>";
}
}
@ -373,21 +373,21 @@ if ( isset( $_GET['mailingIndex'])) // examine or send
{
$thisRecip = api_substr($thisName, $preLen, api_strlen($thisName) - $preLen - $postLen);
if ( $thisRecip) return getUser($thisRecip);
return ' <'.dropbox_lang("mailingFileNoRecip", "noDLTT").'>';
return ' <'.get_lang('MailingFileNoRecip', '').'>';
}
else
{
return ' <'.dropbox_lang("mailingFileNoPostfix", "noDLTT").$postFix.'>';
return ' <'.get_lang('MailingFileNoPostfix', '').$postFix.'>';
}
}
else
{
return ' <'.dropbox_lang("mailingFileNoPrefix", "noDLTT").$preFix.'>';
return ' <'.get_lang('MailingFileNoPrefix', '').$preFix.'>';
}
}
else
{
return ' <'.dropbox_lang("mailingFileFunny", "noDLTT").'>';
return ' <'.get_lang('MailingFileFunny', '').'>';
}
}
@ -411,14 +411,14 @@ if ( isset( $_GET['mailingIndex'])) // examine or send
$thisFileUcase = strtoupper($thisFile);
if ( preg_match("~.(php.*|phtml)$~i", $thisFile) )
{
$error = TRUE; $errormsg .= $thisFile . ': ' . dropbox_lang("mailingZipPhp");
$error = TRUE; $errormsg .= $thisFile . ': ' . get_lang('MailingZipPhp');
break;
}
elseif ( !$thisContent['folder'])
{
if ( $ucaseFiles[$thisFileUcase])
{
$error = TRUE; $errormsg .= $thisFile . ': ' . dropbox_lang("mailingZipDups");
$error = TRUE; $errormsg .= $thisFile . ': ' . get_lang('MailingZipDups');
break;
}
else
@ -432,7 +432,7 @@ if ( isset( $_GET['mailingIndex'])) // examine or send
}
else
{
$error = TRUE; $errormsg .= dropbox_lang("mailingZipEmptyOrCorrupt");
$error = TRUE; $errormsg .= get_lang('MailingZipEmptyOrCorrupt');
}
if ( !$error)
@ -451,17 +451,17 @@ if ( isset( $_GET['mailingIndex'])) // examine or send
{
if ( isset( $_GET['mailingSend']))
{
$errormsg .= dropbox_lang("mailingFileSentTo");
$errormsg .= get_lang('MailingFileSentTo');
}
else
{
$errormsg .= dropbox_lang("mailingFileIsFor");
$errormsg .= get_lang('MailingFileIsFor');
}
$errormsg .= htmlspecialchars(api_get_person_name($thisRecip[2], $thisRecip[1]), ENT_QUOTES, $charset);
if ( is_null($thisRecip[3]))
{
$errormsg .= dropbox_lang("mailingFileNotRegistered");
$errormsg .= get_lang('MailingFileNotRegistered');
}
else
{
@ -490,7 +490,7 @@ if ( isset( $_GET['mailingIndex'])) // examine or send
{
$remainingUsers .= ', ' . htmlspecialchars(api_get_person_name($res[1], $res[0]), ENT_QUOTES, $charset);
}
$errormsg .= '<br />' . dropbox_lang("mailingNothingFor") . api_substr($remainingUsers, 1) . '.<br />';
$errormsg .= '<br />' . get_lang('MailingNothingFor') . api_substr($remainingUsers, 1) . '.<br />';
}
if ( isset( $_GET['mailingSend']))
@ -524,13 +524,13 @@ if ( isset( $_GET['mailingIndex'])) // examine or send
}
elseif ($mailing_item->filesize != 0)
{
$errormsg .= '<br />' . dropbox_lang("mailingNotYetSent") . '<br />';
$errormsg .= '<br />' . get_lang('MailingNotYetSent') . '<br />';
}
}
}
else
{
$error = TRUE; $errormsg .= dropbox_lang("mailingWrongZipfile");
$error = TRUE; $errormsg .= get_lang('MailingWrongZipfile');
}
@ -543,7 +543,7 @@ if ( isset( $_GET['mailingIndex'])) // examine or send
{
?>
<b><font color="#FF0000"><?php echo $errormsg?></font></b><br><br>
<a href="index.php<?php echo "?origin=$origin"; ?>"><?php echo dropbox_lang("backList")?></a><br>
<a href="index.php<?php echo "?origin=$origin"; ?>"><?php echo get_lang('BackList'); ?></a><br>
<?php
}
@ -551,7 +551,7 @@ if ( isset( $_GET['mailingIndex'])) // examine or send
{
?>
<?php echo $errormsg?><br><br>
<a href="index.php<?php echo "?origin=$origin"; ?>"><?php echo dropbox_lang("backList")?></a><br>
<a href="index.php<?php echo "?origin=$origin"; ?>"><?php echo get_lang('BackList'); ?></a><br>
<?php
}
@ -595,10 +595,10 @@ if ( isset( $_GET['deleteReceived']) || isset( $_GET['deleteSent'])
}
/*if (! $dropbox_person->isCourseAdmin || ! $dropbox_person->isCourseTutor) {
die(dropbox_lang("generalError")." (code 408)");
die(get_lang('GeneralError').' (code 408)');
}*/
$tellUser = dropbox_lang("fileDeleted"); // RH: Feedback
$tellUser = get_lang('FileDeleted'); // RH: Feedback
if ( isset( $_GET['deleteReceived']))
{
@ -611,7 +611,7 @@ if ( isset( $_GET['deleteReceived']) || isset( $_GET['deleteSent'])
}
else
{
die(dropbox_lang("generalError")." (code 409)");
die(get_lang('GeneralError').' (code 409)');
}
}
elseif ( isset( $_GET['deleteSent'])) // RH: Feedback
@ -625,7 +625,7 @@ if ( isset( $_GET['deleteReceived']) || isset( $_GET['deleteSent'])
}
else
{
die(dropbox_lang("generalError")." (code 410)");
die(get_lang('GeneralError').' (code 410)');
}
}
elseif ( isset( $_GET['showFeedback'])) // RH: Feedback
@ -638,7 +638,7 @@ if ( isset( $_GET['deleteReceived']) || isset( $_GET['deleteSent'])
foreach( $w -> recipients as $r) if (($fb = $r["feedback"]))
{
$fbarray [$r["feedback_date"].$r["name"]]=
$r["name"] . ' ' . dropbox_lang("sentOn", "noDLTT") .
$r["name"] . ' ' . get_lang('SentOn', '') .
' ' . $r["feedback_date"] . ":\n" . $fb;
}
@ -653,7 +653,7 @@ if ( isset( $_GET['deleteReceived']) || isset( $_GET['deleteSent'])
echo '<textarea class="dropbox_feedbacks">&nbsp;</textarea>', "\n";
}
$tellUser = dropbox_lang("showFeedback");
$tellUser = get_lang('ShowFeedback');
}
else // if ( isset( $_GET['editFeedback'])) // RH: Feedback
{
@ -663,16 +663,16 @@ if ( isset( $_GET['deleteReceived']) || isset( $_GET['deleteSent'])
$found = true; break;
}
}
if (! $found) die(dropbox_lang("generalError")." (code 415)");
if (! $found) die(get_lang('GeneralError').' (code 415)');
echo '<form method="post" action="index.php">', "\n",
'<input type="hidden" name="feedbackid" value="',
$id, '"/>', "\n",
'<textarea name="feedbacktext" class="dropbox_feedbacks">',
htmlspecialchars($w->feedback,ENT_QUOTES,$charset), '</textarea>', "<br>\n",
'<input type="submit" name="feedbacksubmit" value="', dropbox_lang("ok", "noDLTT"), '"/>', "\n",
'<input type="submit" name="feedbacksubmit" value="', get_lang('Ok', ''), '"/>', "\n",
'</form>', "\n";
$tellUser = dropbox_lang("giveFeedback");
$tellUser = get_lang('GiveFeedback');
}
/**
@ -680,6 +680,6 @@ if ( isset( $_GET['deleteReceived']) || isset( $_GET['deleteSent'])
* RESULTMESSAGE FOR DELETE FILE OR EDIT FEEDBACK // RH: Feedback
* ==============================================
*/
$return_message=dropbox_lang("backList");
$return_message = get_lang('BackList');
}
?>

@ -2,12 +2,12 @@
//include_once(api_get_path(LIBRARY_PATH)."/pclzip/pclzip.lib.php");
require_once(api_get_path(LIBRARY_PATH).'document.lib.php');
class TestDropboxFunctions extends UnitTestCase {
/**
* This function is a wrapper function for the multiple actions feature.
* @return Mixed If there is a problem, return a string message, otherwise nothing
*/
function testhandle_multiple_actions() {
global $_user, $is_courseAdmin, $is_courseTutor;
$res= handle_multiple_actions();
@ -16,13 +16,13 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* Displays the form to move one individual file to a category
* @return html code of the form that appears in a dokeos message box.
*/
function testdisplay_move_form() {
ob_start();
$id= 1;
@ -34,13 +34,13 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* This functions displays all teh possible actions that can be performed on multiple files. This is the dropdown list that
* appears below the sortable table of the sent / or received files.
* @return html value for the dropdown list
*/
function testdisplay_action_options() {
ob_start();
$categories= 1;
@ -51,8 +51,8 @@ class TestDropboxFunctions extends UnitTestCase {
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
}
/**
* this function returns the html code that displays the checkboxes next to the files so that
* multiple actions on one file are possible.
@ -60,7 +60,7 @@ class TestDropboxFunctions extends UnitTestCase {
* @param $part are we dealing with a sent or with a received file?
* @return html code
*/
function testdisplay_file_checkbox() {
$id= 1;
$part = 'test';
@ -70,7 +70,7 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* This function displays the form to add a new category.
*
@ -80,7 +80,7 @@ class TestDropboxFunctions extends UnitTestCase {
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
function testdisplay_addcategory_form() {
global $dropbox_cnf;
ob_start();
@ -99,7 +99,7 @@ class TestDropboxFunctions extends UnitTestCase {
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
function testDisplay_add_form() {
global $_user, $is_courseAdmin, $is_courseTutor, $course_info, $origin, $dropbox_unid;
ob_start();
@ -110,13 +110,13 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* This function displays the firstname and lastname of the user as a link to the user tool.
* @see this is the same function as in the new forum, so this probably has to move to a user library.
* @todo move this function to the user library
*/
function testdisplayuserlink() {
global $_otherusers;
$user_id = 1;
@ -126,12 +126,12 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* returns username or false if user isn't registered anymore
* @todo check if this function is still necessary. There might be a library function for this.
*/
function testGetUserNameFromId() {
global $dropbox_cnf;
$id = 1;
@ -141,12 +141,12 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* returns loginname or false if user isn't registered anymore
* @todo check if this function is still necessary. There might be a library function for this.
*/
function testGetLoginFromId() {
$id = 1;
$res= getLoginFromId($id);
@ -155,13 +155,13 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* @desc This function retrieves the number of feedback messages on every document. This function might become obsolete when
* the feedback becomes user individual.
*/
function testget_total_number_feedback() {
global $dropbox_cnf;
$res= get_total_number_feedback($file_id='');
@ -170,7 +170,7 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* This function retrieves all the dropbox categories and returns them as an array
* @param $filter default '', when we need only the categories of the sent or the received part.
@ -184,7 +184,7 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* RH: Mailing (2 new functions)
* Mailing zip-file is posted to (dest_user_id = ) mailing pseudo_id
@ -203,7 +203,7 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* Get the last access to a given tool of a given user
* @param $tool string the tool constant
@ -212,7 +212,7 @@ class TestDropboxFunctions extends UnitTestCase {
* @return string last tool access date
* @todo consider moving this function to a more appropriate place.
*/
function testget_last_tool_access() {
global $_course, $_user;
$tool = '1';
@ -222,7 +222,7 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* This functions stores a new dropboxcategory
* @var it might not seem very elegant if you create a category in sent and in received with the same name that you get two entries in the
@ -233,7 +233,7 @@ class TestDropboxFunctions extends UnitTestCase {
* more elegant would be
* test | 1 | 1 | 237
*/
function teststoreaddcategory() {
global $_user,$dropbox_cnf;
$res= store_addcategory();
@ -242,7 +242,7 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* This function moves a file to a different category
* @param $id the id of the file we are moving
@ -250,7 +250,7 @@ class TestDropboxFunctions extends UnitTestCase {
* @param $part are we moving a received file or a sent file?
* @return language string
*/
function testStoremove() {
$id= 1;
$part = 'test';
@ -261,11 +261,11 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
*@return selected string
*@return selected string
*/
function teststoreadddropbox() {
global $dropbox_cnf;
global $_user;
@ -276,13 +276,13 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* @return boolean indicating if user with user_id=$user_id is a course member
* @todo eliminate global
* @todo check if this function is still necessary. There might be a library function for this.
*/
function testIsCourseMember() {
$user_id = 1;
$res= isCourseMember($user_id);
@ -291,12 +291,12 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* this function transforms the array containing all the feedback into something visually attractive.
* @param an array containing all the feedback about the given message.
*/
function testfeedback() {
$array = array();
$res= feedback($array);
@ -305,7 +305,7 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* This function returns the html code to display the feedback messages on a given dropbox file
* @param $feedback_array an array that contains all the feedback messages about the given document.
@ -341,7 +341,7 @@ class TestDropboxFunctions extends UnitTestCase {
/**
* @return a language string (depending on the success or failure.
*/
function teststore_feedback() {
global $dropbox_cnf;
global $_user;
@ -351,12 +351,12 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* @desc This function checks if the real filename of the dropbox files doesn't already exist in the temp folder. If this is the case then
* it will generate a different filename;
*/
function testcheck_file_name() {
global $_course;
$file_name_2_check = 'test';
@ -366,11 +366,11 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* @desc this function checks if the key exists. If this is the case it returns the value, if not it returns 0
*/
function testcheck_number_feedback() {
$key = 'test';
$array = array();
@ -380,12 +380,12 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* @desc generates the contents of a html file that gives an overview of all the files in the zip file.
* This is to know the information of the files that are inside the zip file (who send it, the comment, ...)
*/
function testgenerate_html_overview() {
$files = array();
$res= generate_html_overview($files, $dont_show_columns=array(), $make_link=array());
@ -394,7 +394,7 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* This function downloads all the files of the inputarray into one zip
* @param $array an array containing all the ids of the files that have to be downloaded.
@ -439,26 +439,11 @@ class TestDropboxFunctions extends UnitTestCase {
}
*/
/**
* The dropbox has a deviant naming scheme for language files so it needs an additional language function
* @todo check if this function is still necessary.
*/
function testdropbox_lang() {
global $charset;
$variable = 'test';
$res= dropbox_lang($variable, $notrans = 'DLTT');
if(!is_null($res)){
$this->assertTrue(is_string($res));
}
//var_dump($res);
}
/**
* Function that finds a given config setting
*/
function testdropbox_cnf() {
$variable = 'test';
$res= dropbox_cnf($variable);
@ -483,13 +468,13 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* @desc Cleans the temp zip files that were created when users download several files or a whole folder at once.
* T
* @return true
*/
function testcleanup_temp_dropbox() {
global $_course;
$res= cleanup_temp_dropbox();
@ -498,7 +483,7 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* This function deletes a dropbox category
* @todo give the user the possibility what needs to be done with the files in this category: move them to the root, download them as a zip, delete them
@ -514,13 +499,13 @@ class TestDropboxFunctions extends UnitTestCase {
}
//var_dump($res);
}
/**
* Checks if there are files in the dropbox_file table that aren't used anymore in dropbox_person table.
* If there are, all entries concerning the file are deleted from the db + the file is deleted from the server
*/
function testremoveUnusedFiles() {
$res= removeUnusedFiles();
if(!is_null($res)){
@ -532,7 +517,7 @@ class TestDropboxFunctions extends UnitTestCase {
/**
* @todo check if this function is still necessary.
*/
function testremoveMoreIfMailing() {
$file_id = 1;
$res= removeMoreIfMailing($file_id);

Loading…
Cancel
Save