Changing string_2_boolean with api_string_2_boolean

1.9.x
Julio Montoya 11 years ago
parent d005def86c
commit 01313ac8ee
  1. 26
      main/dropbox/dropbox_config.inc.php
  2. 5
      main/inc/lib/main_api.lib.php
  3. 2
      tests/main/inc/lib/main_api.lib.test.php

@ -1,11 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* DEBUGGING VARS
*/
$DEBUG = false; // TODO: Is this needed?
/**
* DATABASE TABLE VARIABLES
*/
@ -23,19 +18,22 @@ $dropbox_cnf['tbl_feedback'] = Database::get_course_table(TABLE_DROPBOX_FEEDBAC
* INITIALISE OTHER VARIABLES & CONSTANTS
*/
$dropbox_cnf['courseId'] = $_cid;
$dropbox_cnf['sysPath'] = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/dropbox'; //path to dropbox subdir in course containing the uploaded files
//path to dropbox subdir in course containing the uploaded files
$dropbox_cnf['sysPath'] = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/dropbox';
$dropbox_cnf['webPath'] = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/dropbox';
$dropbox_cnf['maxFilesize'] = api_get_setting('dropbox_max_filesize'); //file size limit as imposed by the platform admin (see Chamilo Config Settings on the platform administration section)
//$dropbox_cnf['version'] = '1.4';
$dropbox_cnf['allowOverwrite'] = string_2_boolean(api_get_setting('dropbox_allow_overwrite'));
$dropbox_cnf['allowJustUpload'] = string_2_boolean(api_get_setting('dropbox_allow_just_upload'));
$dropbox_cnf['allowStudentToStudent'] = string_2_boolean(api_get_setting('dropbox_allow_student_to_student'));
$dropbox_cnf['allowGroup'] = string_2_boolean(api_get_setting('dropbox_allow_group'));
//file size limit as imposed by the platform admin (see Chamilo Config Settings on the platform administration section)
$dropbox_cnf['maxFilesize'] = api_get_setting('dropbox_max_filesize');
$dropbox_cnf['allowOverwrite'] = api_string_2_boolean(api_get_setting('dropbox_allow_overwrite'));
$dropbox_cnf['allowJustUpload'] = api_string_2_boolean(api_get_setting('dropbox_allow_just_upload'));
$dropbox_cnf['allowStudentToStudent'] = api_string_2_boolean(api_get_setting('dropbox_allow_student_to_student'));
$dropbox_cnf['allowGroup'] = api_string_2_boolean(api_get_setting('dropbox_allow_group'));
/**
* INITIALISE MAILING VARIABLES
* MAILING VARIABLES
*/
$dropbox_cnf['allowMailing'] = string_2_boolean(api_get_setting('dropbox_allow_mailing')); // false = no mailing functionality
// false = no mailing functionality
$dropbox_cnf['allowMailing'] = api_string_2_boolean(api_get_setting('dropbox_allow_mailing'));
$dropbox_cnf['mailingIdBase'] = 10000000; // bigger than any user_id,
// allowing enough space for pseudo_ids as uploader_id, dest_user_id, user_id:
// mailing pseudo_id = dropbox_cnf('mailingIdBase') + mailing id

@ -923,7 +923,7 @@ function api_protect_course_script($print_headers = false, $allow_session_admins
/**
* Function used to protect an admin script.
*
*
* The function blocks access when the user has no platform admin rights with an error message printed on default output
* @param bool Whether to allow session admins as well
* @param bool Whether to allow HR directors as well
@ -3767,7 +3767,7 @@ function api_max_sort_value($user_course_category, $user_id) {
* @return boolean true or false
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
*/
function string_2_boolean($string) {
function api_string_2_boolean($string) {
if ($string == 'true') {
return true;
}
@ -3777,6 +3777,7 @@ function string_2_boolean($string) {
return false;
}
/**
* Determines the number of plugins installed for a given location
*/

@ -531,7 +531,7 @@ class TestMainApi extends UnitTestCase {
function testString2Boolean(){
global $string;
$res=string_2_boolean($string);
$res=api_string_2_boolean($string);
$this->assertFalse($res);
}

Loading…
Cancel
Save