From 7e55c0724a50e233f581dba6760c242f8ad4902a Mon Sep 17 00:00:00 2001 From: Patrick Cool Date: Fri, 24 Nov 2006 00:28:38 +0100 Subject: [PATCH] [svn r10189] various cleanup --- main/inc/global.inc.php | 4 +- main/inc/lib/auth.lib.inc.php | 178 ------------------------ main/inc/lib/course.lib.php | 84 ------------ main/inc/lib/database.lib.php | 31 +---- main/inc/lib/events.lib.inc.php | 88 ------------ main/inc/lib/export.lib.inc.php | 204 +++++++++++----------------- main/inc/lib/statsUtils.lib.inc.php | 34 ----- main/install/configuration.dist.php | 9 +- 8 files changed, 83 insertions(+), 549 deletions(-) delete mode 100644 main/inc/lib/auth.lib.inc.php diff --git a/main/inc/global.inc.php b/main/inc/global.inc.php index 6a54e1ab03..ce945ec6ce 100644 --- a/main/inc/global.inc.php +++ b/main/inc/global.inc.php @@ -325,9 +325,9 @@ else $user_language = $_GET["language"]; if ($_POST["language_list"]) - { +{ $user_language = str_replace("index.php?language=","",$_POST["language_list"]); - } +} // Checking if we have a valid language. If not we set it to the platform language. $valid_languages=api_get_languages(); diff --git a/main/inc/lib/auth.lib.inc.php b/main/inc/lib/auth.lib.inc.php deleted file mode 100644 index a0a20961d5..0000000000 --- a/main/inc/lib/auth.lib.inc.php +++ /dev/null @@ -1,178 +0,0 @@ - - * @version 1.0 - * @param integer $nbcar default 5 define here length of password - * @param boolean $lettresseules default false fix if pass can content digit - * @return string password - * @desc return a string to be use as password - * @see rand() - * @deprecated use api_generate_password located in main_api.lib.php - */ - -function generePass($nbcar=5,$lettresseules = false) -{ - return api_generate_password($nbcar); -} -/** - * ifsnow's email valid check function SnowCheckMail Ver 0.1 - * funtion SnowCheckMail ($Email,$debug=false) - * $Email : E-Mail address to check. - * $debug : Variable for debugging. - * Can use everybody if use without changing the name of function. - * Reference : O'REILLY - Internet Email Programming - * HOMEPAGE : http://www.hellophp.com - * ifsnow is korean phper. Is sorry to be unskillful to English. *^^*;; - * @deprecated Function not in use - */ - -function SnowCheckMail($Email,$debug=false) -{ - global $_SERVER; - $return = array(); - // Variable for return. - // $return[0] : [true|false] - // $return[1] : Processing result save. - - if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $Email)) - { - $return[0]=false; - $return[1]="${Email} is E-Mail form that is not right."; - if ($debug) echo "Error : {$Email} is E-Mail form that is not right.
"; - return $return; - } - elseif ($debug) - { - echo "Confirmation : {$Email} is E-Mail form that is not right.
"; - } - - // E-Mail @ by 2 by standard divide. if it is $Email this "lsm@ebeecomm.com".. - // $Username : lsm - // $Domain : ebeecomm.com - // list function reference : http://www.php.net/manual/en/function.list.php - // split function reference : http://www.php.net/manual/en/function.split.php - list ( $Username, $Domain ) = split ("@",$Email); - - // That MX(mail exchanger) record exists in domain check . - // checkdnsrr function reference : http://www.php.net/manual/en/function.checkdnsrr.php - if ( checkdnsrr ( $Domain, "MX" ) ) - { - if($debug) echo "Confirmation : MX record about {$Domain} exists.
"; - // If MX record exists, save MX record address. - // getmxrr function reference : http://www.php.net/manual/en/function.getmxrr.php - $MXHost = array(); - if ( getmxrr ($Domain, $MXHost)) - { - if($debug) - { - echo "Confirmation : Is confirming address by MX LOOKUP.
"; - for ( $i = 0,$j = 1; $i < count($MXHost); $i++,$j++ ) - { - echo "        Result($j) - $MXHost[$i]
"; - } - } - } - // Getmxrr function does to store MX record address about $Domain in arrangement form to $MXHost. - // $ConnectAddress socket connection address. - $ConnectAddress = $MXHost[0]; - } - else - { - // If there is no MX record simply @ to next time address socket connection do . - $ConnectAddress = $Domain; - if ($debug) echo "Confirmation : MX record about {$Domain} does not exist.
"; - } - - // fsockopen function reference : http://www.php.net/manual/en/function.fsockopen.php - $Connect = fsockopen ( $ConnectAddress, 25 ); - - // Success in socket connection - if ($Connect) - { - if ($debug) echo "Connection succeeded to {$ConnectAddress} SMTP.
"; - // Judgment is that service is preparing though begin by 220 getting string after connection . - // fgets function reference : http://www.php.net/manual/en/function.fgets.php - if ( ereg ( "^220", $Out = fgets ( $Connect, 1024 ) ) ) - { - // Inform client's reaching to server who connect. - fputs ( $Connect, "HELO ".$_SERVER['HTTP_HOST']."\r\n" ); - if ($debug) echo "Run : HELO ".$_SERVER['HTTP_HOST']."
"; - $Out = fgets ( $Connect, 1024 ); // Receive server's answering cord. - - // Inform sender's address to server. - fputs ( $Connect, "MAIL FROM: <{$Email}>\r\n" ); - if ($debug) echo "Run : MAIL FROM: <{$Email}>
"; - $From = fgets ( $Connect, 1024 ); // Receive server's answering cord. - - // Inform listener's address to server. - fputs ( $Connect, "RCPT TO: <{$Email}>\r\n" ); - if ($debug) echo "Run : RCPT TO: <{$Email}>
"; - $To = fgets ( $Connect, 1024 ); // Receive server's answering cord. - - // Finish connection. - fputs ( $Connect, "QUIT\r\n"); - if ($debug) echo "Run : QUIT
"; - - fclose($Connect); - - // Server's answering cord about MAIL and TO command checks. - // Server about listener's address reacts to 550 codes if there does not exist - // checking that mailbox is in own E-Mail account. - if ( !ereg ( "^250", $From ) || !ereg ( "^250", $To )) - { - $return[0]=false; - $return[1]="${Email} is address done not admit in E-Mail server."; - if ($debug) echo "{$Email} is address done not admit in E-Mail server.
"; - return $return; - } - } - } - // Failure in socket connection - else - { - $return[0]=false; - $return[1]="Can not connect E-Mail server ({$ConnectAddress})."; - if ($debug) echo "Can not connect E-Mail server ({$ConnectAddress}).
"; - return $return; - } - $return[0]=true; - $return[1]="{$Email} is E-Mail address that there is no any problem."; - return $return; -} - -?> \ No newline at end of file diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index b822e43195..78896ec3fd 100644 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -66,7 +66,6 @@ CourseManager::get_target_of_linked_course($virtual_course_code) TITLE AND CODE FUNCTIONS - DEPRECATED CourseManager::determine_course_title($user_id, $_cid, $_course) CourseManager::determine_course_title_from_course_info($user_id, $course_info) CourseManager::create_combined_name($user_is_registered_in_real_course, $real_course_name, $virtual_course_list) CourseManager::create_combined_code($user_is_registered_in_real_course, $real_course_code, $virtual_course_list) @@ -227,18 +226,6 @@ class CourseManager return $result["status"]; } - /** - * Change the status of a user in a course, status can be COURSEMANAGER or STUDENT. - * @deprecated Function not in use - */ - function set_user_in_course_status($user_id, $course_code, $status) - { - $course_user_table = Database :: get_main_table(MAIN_COURSE_USER_TABLE); - $sql_query = "UPDATE $course_user_table SET status = '$status' WHERE `course_code` = '$course_code' AND `user_id` = '$user_id'"; - $sql_result = api_sql_query($sql_query, __FILE__, __LINE__); - $result = mysql_fetch_array($sql_result); - return $result["status"]; - } /** * Unsubscribe one or more users from a course @@ -604,77 +591,6 @@ class CourseManager return $result_array; } - /** - * @deprecated use determine_course_title_from_course_info($user_id, - * $course_info) instead Declares global $_course - */ - function determine_course_title($user_id, $_cid, $_course) - { - global $_course; - $real_course_code = $_course['sysCode']; - $real_course_info = Database :: get_course_info($real_course_code); - $real_course_name = $real_course_info["title"]; - $real_course_visual_code = $real_course_info["visual_code"]; - - //is the user registered in the real course? - $table = Database :: get_main_table(MAIN_COURSE_USER_TABLE); - $sql_query = "SELECT * FROM $table WHERE `user_id` = '$user_id' AND `course_code` = '$real_course_code'"; - $sql_result = api_sql_query($sql_query, __FILE__, __LINE__); - $result = mysql_fetch_array($sql_result); - - if (!isset ($result) || empty ($result)) - { - $user_is_registered_in_real_course = false; - } - else - { - $user_is_registered_in_real_course = true; - } - //get a list of virtual courses linked to the current real course - //and to which the current user is subscribed - - $user_subscribed_virtual_course_list = CourseManager :: get_list_of_virtual_courses_for_specific_user_and_real_course($user_id, $real_course_code); - - if (count($user_subscribed_virtual_course_list) > 0) - { - $virtual_courses_exist = true; - } - else - { - $virtual_courses_exist = false; - } - - //now determine course code and name - - if ($user_is_registered_in_real_course && $virtual_courses_exist) - { - $_course["name"] = CourseManager :: create_combined_name($user_is_registered_in_real_course, $real_course_name, $user_subscribed_virtual_course_list); - $_course['official_code'] = CourseManager :: create_combined_code($user_is_registered_in_real_course, $real_course_visual_code, $user_subscribed_virtual_course_list); - } - else - if ($user_is_registered_in_real_course) - { - //course name remains real course name - $_course["name"] = $real_course_name; - $_course['official_code'] = $real_course_visual_code; - } - else - if ($virtual_courses_exist) - { - $_course["name"] = CourseManager :: create_combined_name($user_is_registered_in_real_course, $real_course_name, $user_subscribed_virtual_course_list); - $_course['official_code'] = CourseManager :: create_combined_code($user_is_registered_in_real_course, $real_course_visual_code, $user_subscribed_virtual_course_list); - } - else - { - //course name remains real course name - $_course["name"] = $real_course_name; - $_course['official_code'] = $real_course_visual_code; - } - - $result_title = $_course["name"]; - return $result_title; - } - /** * Find out for which courses the user is registered and determine a visual course code and course title from that. * Takes virtual courses into account diff --git a/main/inc/lib/database.lib.php b/main/inc/lib/database.lib.php index a7b8563ded..f3dd3bc0ba 100644 --- a/main/inc/lib/database.lib.php +++ b/main/inc/lib/database.lib.php @@ -339,14 +339,7 @@ class Database $result = $result['isocode']; return $result; } - /** - * Returns the name of the login table of the stats database. - * @deprecated use Database::get_statistic_table(STATISTIC_TRACK_E_LOGIN_TABLE); - */ - function get_statistic_track_e_login_table() - { - return Database::get_statistic_table(STATISTIC_TRACK_E_LOGIN_TABLE); - } + /** * Returns the name of the main table of the SCORM database. * @deprecated use Database::get_scorm_table(SCORM_MAIN_TABLE); @@ -382,18 +375,6 @@ class Database $result = api_store_result($sql_result); return $result; } - /** - * @return a list (array) of all users. - * @deprecated This function isn't used anywhere in the code. - */ - function get_user_list() - { - $table = Database::get_main_table(MAIN_USER_TABLE); - $sql_query = "SELECT * FROM $table"; - $sql_result = api_sql_query($sql_query, __FILE__, __LINE__); - $result = api_store_result($sql_result); - return $result; - } /** * Returns an array with all database fields for the specified course. @@ -497,16 +478,6 @@ class Database } - /** - * Changes the title of a course. - * @deprecated Function not in use - */ - function update_course_title($course_code, $new_title) - { - $table = Database::get_main_table(MAIN_COURSE_TABLE); - $sql_query = "UPDATE $table SET `title` = '$new_title' WHERE `code` = '$course_code' LIMIT 1"; - api_sql_query($sql_query, __FILE__, __LINE__); - } /* ----------------------------------------------------------------------------- Private Functions diff --git a/main/inc/lib/events.lib.inc.php b/main/inc/lib/events.lib.inc.php index a370c208cf..676bdcb574 100644 --- a/main/inc/lib/events.lib.inc.php +++ b/main/inc/lib/events.lib.inc.php @@ -494,94 +494,6 @@ function event_exercice($exo_id, $score, $weighting) //return 0; } -/** - * @param cours_code (cours.code in maindb)) - * @param action ( enum of strings : "sub" or "unsub" ) - * @author Sebastien Piraux - * @desc Record information for subscription and unsubscription to courses - * @deprecated Function not in use -*/ -function event_subscription($cours_id, $action) -{ - global $_configuration; - global $_user; - global $TABLETRACK_SUBSCRIPTIONS; - - // if tracking is disabled record nothing - if (!$_configuration['tracking_enabled']) - { - return 0; - } - - $sql = "INSERT INTO `$TABLETRACK_SUBSCRIPTIONS` - (`sub_user_id`, - `sub_cours_id`, - `sub_action`) - VALUES - ('".$_user['user_id']."', - '".$cours_id."', - '".$action."')"; - $res = api_sql_query($sql,__FILE__,__LINE__); - //$mysql_query($sql); - return 1; -} - -/** - * @param type_event type of event to record - * @param values indexed array of values (keys are the type of values, values are the event_values) - * @author Sebastien Piraux - * @desc Standard function for all users who wants to add an event recording in their pages - * e.g. : event_default("Exercice Result",array ("ex_id"=>"1", "result"=> "5", "weighting" => "20")); - * @deprecated Function not in use -*/ -function event_default($type_event, $values) -{ - global $_configuration; - global $_user; - global $_cid; - global $TABLETRACK_DEFAULT; - - // if tracking is disabled record nothing - if (!$_configuration['tracking_enabled']) - { - return 0; - } - - $reallyNow = time(); - if ($_user['user_id']) - { - $user_id = "'".$_user['user_id']."'"; - } - else // anonymous - { - $user_id = "NULL"; - } - if ($_user['user_id']) - { - $cours_id = "'".$_cid."'"; - } - else // anonymous - { - $cours_id = "NULL"; - } - $sqlValues = ""; - foreach ($values as $type_value => $event_value) - { - if ($sqlValues == "") - { - $sqlValues .= "('','$user_id','$cours_id','$reallyNow','$type_event','$type_value','$event_value')"; - } - else - { - $sqlValues .= ",('','$user_id','$cours_id','$reallyNow','$type_event','$type_value','$event_value')"; - } - } - $sql = "INSERT INTO `".$TABLETRACK_DEFAULT."` - VALUES ".$sqlValues; - $res = api_sql_query($sql,__FILE__,__LINE__); - return 1; -} - function exercise_attempt($score,$answer,$quesId,$exeId,$j) { global $_configuration; diff --git a/main/inc/lib/export.lib.inc.php b/main/inc/lib/export.lib.inc.php index 8507841b8d..717fa91fc3 100644 --- a/main/inc/lib/export.lib.inc.php +++ b/main/inc/lib/export.lib.inc.php @@ -275,7 +275,7 @@ function copydir($origine, $destination, $verbose = false) * Export a course to a zip file * * @param integer $currentCourseID needed sysId Of course to be exported - * @param boolean $verboseBackup def FALSE echo step of work + * @param boolean $verbose_backup def FALSE echo step of work * @param string $ignore def NONE // future param for selected bloc to export. * @param string $formats def ALL ALL,SQL,PHP,XML,CSV,XLS,HTML * @@ -305,97 +305,60 @@ function copydir($origine, $destination, $verbose = false) */ -function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = "", $formats = "ALL") +function makeTheBackup($exportedCourseId, $verbose_backup = FALSE, $ignore = "", $formats = "ALL") { - GLOBAL $error_msg, $error_no, $db, $archiveRepositorySys, $archiveRepositoryWeb, // from configs files - $appendCourse, $appendMainDb, // - $archiveName, $_configuration, $clarolineRepositorySys, $_course, $TABLEUSER, $TABLECOURSUSER, $TABLECOURS, $TABLEANNOUNCEMENT, $langArchiveName, $langArchiveLocation, $langSizeOf, $langDisk_free_space, $langCreateMissingDirectories, $langBUCourseDataOfMainBase, $langBUUsersInMainBase, $langBUAnnounceInMainBase, $langCopyDirectoryCourse, $langFileCopied, $langBackupOfDataBase, $langBuildTheCompressedFile; - //////////////////////////////////////////////////// - // ****** 1° Check if all data needed are aivailable - // ****** 1° 1. $lang vars - if ($verboseBackup) - { - if ($langArchiveName == "") - $langArchiveName = "Archive name"; - if ($langArchiveLocation == "") - $langArchiveLocation = "Archive location"; - if ($langSizeOf == "") - $langSizeOf = "Size of"; - if ($langDisk_free_space == "") - $langDisk_free_space = "Disk free"; - if ($langCreateMissingDirectories == "") - $langCreateMissingDirectories = "Directory missing "; - if ($langBUCourseDataOfMainBase == "") - $langBUCourseDataOfMainBase = "Backup Course data"; - if ($langBUUsersInMainBase == "") - $langBUUsersInMainBase = "Backup Users"; - if ($langBUAnnounceInMainBase == "") - $langBUAnnounceInMainBase = "Backups announcement"; - if ($langCopyDirectoryCourse == "") - $langCopyDirectoryCourse = "Copy files"; - if ($langFileCopied == "") - $langFileCopied = "File copied"; - if ($langBackupOfDataBase == "") - $langBackupOfDataBase = "Backup of database"; - if ($langBuildTheCompressedFile == "") - $langBuildTheCompressedFile = "zip file"; - } + global $error_msg, $error_no, $db, $archiveRepositorySys, $archiveRepositoryWeb, + $appendCourse, $appendMainDb, $archiveName, $_configuration, $clarolineRepositorySys, $_course, $TABLEUSER, $TABLECOURSUSER, $TABLECOURS, $TABLEANNOUNCEMENT; + // ****** 1° 2. params. $errorCode = 0; $stop = FALSE; + // ****** 1° 2. 1 params.needed if (!isset ($exportedCourseId)) { - GLOBAL $error_msg, $error_no; $error_msg["backup"][] = "[".basename(__FILE__)."][".__LINE__."] Course Id Missing"; $error_no["backup"][] = "1"; $stop = TRUE; } if (!isset ($_configuration['main_database'])) { - GLOBAL $error_msg, $error_no; $error_msg["backup"][] = "[".basename(__FILE__)."][".__LINE__."] Main Db name is Missing"; $error_no["backup"][] = "2"; $stop = TRUE; } if (!isset ($archiveRepositorySys)) { - GLOBAL $error_msg, $error_no; $error_msg["backup"][] = "[".basename(__FILE__)."][".__LINE__."] archive Path not found"; $error_no["backup"][] = "3"; $stop = TRUE; } if (!isset ($appendMainDb)) { - GLOBAL $error_msg, $error_no; $error_msg["backup"][] = "[".basename(__FILE__)."][".__LINE__."] where place course datas from main db in archive"; $error_no["backup"][] = "4"; $stop = TRUE; } if (!isset ($appendCourse)) { - GLOBAL $error_msg, $error_no; $error_msg["backup"][] = "[".basename(__FILE__)."][".__LINE__."] where place course datas in archive"; $error_no["backup"][] = "5"; $stop = TRUE; } if (!isset ($TABLECOURS)) { - GLOBAL $error_msg, $error_no; $error_msg["backup"][] = "[".basename(__FILE__)."][".__LINE__."] name of table of course not defined"; $error_no["backup"][] = "6"; $stop = TRUE; } if (!isset ($TABLEUSER)) { - GLOBAL $error_msg, $error_no; $error_msg["backup"][] = "[".basename(__FILE__)."][".__LINE__."] name of table of users not defined"; $error_no["backup"][] = "7"; $stop = TRUE; } if (!isset ($TABLECOURSUSER)) { - GLOBAL $error_msg, $error_no; $error_msg["backup"][] = "[".basename(__FILE__)."][".__LINE__."] name of table of subscription of users in courses not defined"; $error_no["backup"][] = "8"; $stop = TRUE; @@ -404,11 +367,13 @@ function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = "" { return false; } + // ****** 1° 2. 2 params.optional - if (!isset ($verboseBackup)) + if (!isset ($verbose_backup)) { - $verboseBackup = false; + $verbose_backup = false; } + // ****** 1° 3. check if course exist // not done ////////////////////////////////////////////// @@ -430,32 +395,32 @@ function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = "" $systemFileNameOfReadMe = "readme.txt"; $systemFileNameOfarchiveLog = "readme.txt"; ################### - if ($verboseBackup) + if ($verbose_backup) { - echo "
", $langArchiveName, " : ", "", basename($systemFileNameOfArchive), "
", $langArchiveLocation, " : ", "", realpath($systemFileNameOfArchive), "
", $langSizeOf, " ", realpath("../../".$exportedCourseId."/"), " : ", "", DirSize("../../".$exportedCourseId."/"), " bytes
"; + echo "
", get_lang('ArchiveName'), " : ", "", basename($systemFileNameOfArchive), "
", get_lang('ArchiveLocation'), " : ", "", realpath($systemFileNameOfArchive), "
", get_lang('SizeOf'), " ", realpath("../../".$exportedCourseId."/"), " : ", "", DirSize("../../".$exportedCourseId."/"), " bytes
"; if (function_exists(diskfreespace)) - echo "".$langDisk_free_space." : ".diskfreespace("/")." bytes"; - echo "
"; + echo "".get_lang('DiskFreeSpace')." : ".diskfreespace("/")." bytes"; + echo "
"; } - mkpath($archiveDirOriginalDocs.$appendMainDb, $verboseBackup); - mkpath($archiveDirHtml.$appendMainDb, $verboseBackup); - mkpath($archiveDirCsv.$appendMainDb, $verboseBackup); - mkpath($archiveDirXml.$appendMainDb, $verboseBackup); - mkpath($archiveDirPhp.$appendMainDb, $verboseBackup); - mkpath($archiveDirLog.$appendMainDb, $verboseBackup); - mkpath($archiveDirSql.$appendMainDb, $verboseBackup); - mkpath($archiveDirOriginalDocs.$appendCourse, $verboseBackup); - mkpath($archiveDirHtml.$appendCourse, $verboseBackup); - mkpath($archiveDirCsv.$appendCourse, $verboseBackup); - mkpath($archiveDirXml.$appendCourse, $verboseBackup); - mkpath($archiveDirPhp.$appendCourse, $verboseBackup); - mkpath($archiveDirLog.$appendCourse, $verboseBackup); - mkpath($archiveDirSql.$appendCourse, $verboseBackup); + mkpath($archiveDirOriginalDocs.$appendMainDb, $verbose_backup); + mkpath($archiveDirHtml.$appendMainDb, $verbose_backup); + mkpath($archiveDirCsv.$appendMainDb, $verbose_backup); + mkpath($archiveDirXml.$appendMainDb, $verbose_backup); + mkpath($archiveDirPhp.$appendMainDb, $verbose_backup); + mkpath($archiveDirLog.$appendMainDb, $verbose_backup); + mkpath($archiveDirSql.$appendMainDb, $verbose_backup); + mkpath($archiveDirOriginalDocs.$appendCourse, $verbose_backup); + mkpath($archiveDirHtml.$appendCourse, $verbose_backup); + mkpath($archiveDirCsv.$appendCourse, $verbose_backup); + mkpath($archiveDirXml.$appendCourse, $verbose_backup); + mkpath($archiveDirPhp.$appendCourse, $verbose_backup); + mkpath($archiveDirLog.$appendCourse, $verbose_backup); + mkpath($archiveDirSql.$appendCourse, $verbose_backup); $dirCourBase = $archiveDirSqlCourse; $dirMainBase = $archiveDirSqlMainDb; ///////////////////////////////////////////////////////////////////////// // ****** 3° Build exported element and Fill the archive repository tree - if ($verboseBackup) + if ($verbose_backup) echo " build config file
"; @@ -491,10 +456,10 @@ function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = "" // ******************************************************************** // info about cours // ******************************************************************** - if ($verboseBackup) + if ($verbose_backup) echo "
  • - ".$langBUCourseDataOfMainBase." ".$exportedCourseId." + ".get_lang('BUCourseDataOfMainBase')." ".$exportedCourseId."
    ";
     	$sqlInsertCourse = "
    @@ -530,8 +495,10 @@ function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = ""
     		#	".$sqlInsertCourse."
     		#------------------------
     			";
    -	if ($verboseBackup)
    +	if ($verbose_backup)
    +	{
     		echo "
    "; + } $fcoursql = fopen($archiveDirSql.$appendMainDb."course.sql", "w"); fwrite($fcoursql, $sqlInsertCourse); fclose($fcoursql); @@ -547,10 +514,10 @@ function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = "" // ******************************************************************** // if ($backupUser ) { - if ($verboseBackup) + if ($verbose_backup) echo "
  • - ".$langBUUsersInMainBase." ".$exportedCourseId." + ".get_lang('BUUsersInMainBase')." ".$exportedCourseId."
    ";
     		// recup users
    @@ -622,11 +589,15 @@ function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = ""
     		}
     		else
     		{
    -			if ($verboseBackup)
    +			if ($verbose_backup)
    +			{
     				echo "
    NO user in this course !!!!

    "; + } } - if ($verboseBackup) + if ($verbose_backup) + { echo "
    "; + } } /* End of backup user */ if ($saveAnnouncement) @@ -634,12 +605,14 @@ function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = "" // ******************************************************************** // info about announcment // ******************************************************************** - if ($verboseBackup) + if ($verbose_backup) + { echo "
  • - ".$langBUAnnounceInMainBase." ".$exportedCourseId." + ".get_lang('BUAnnounceInMainBase')." ".$exportedCourseId."
    ";
    +		}
     		// recup annonce
     		$sqlAnnounceOfTheCourse = "
     				SELECT
    @@ -686,8 +659,10 @@ function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = ""
     			$sqlInsertAnn .= ";";
     			$htmlInsertAnn .= "\t\n";
     		}
    -		if ($verboseBackup)
    +		if ($verbose_backup)
    +		{
     			echo "
    "; + } $htmlInsertAnn .= "\n"; $stringConfig .= " #INSERT ANNOUNCE @@ -707,17 +682,17 @@ function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = "" /* End of backup Annonces */ } // we can copy file of course - if ($verboseBackup) - echo " -
  • - ".$langCopyDirectoryCourse; - $nbFiles = copydir(api_get_path(SYS_COURSE_PATH).$_course['path'], $archiveDirOriginalDocs.$appendCourse, $verboseBackup); - if ($verboseBackup) + if ($verbose_backup) + { + echo '
  • '.get_lang('CopyDirectoryCourse'); + } + $nbFiles = copydir(api_get_path(SYS_COURSE_PATH).$_course['path'], $archiveDirOriginalDocs.$appendCourse, $verbose_backup); + if ($verbose_backup) echo " ".$nbFiles." - ".$langFileCopied." + ".get_lang('FileCopied')."
  • "; $stringConfig .= " @@ -726,44 +701,44 @@ function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = "" // Copy of DB course // with mysqldump // ******************************************************************** - if ($verboseBackup) + if ($verbose_backup) echo "
  • - ".$langBackupOfDataBase." ".$exportedCourseId." (SQL) + ".get_lang('BackupOfDataBase')." ".$exportedCourseId." (SQL)
    "; - backupDatabase($db, $exportedCourseId, true, true, 'SQL', $archiveDirSql.$appendCourse, true, $verboseBackup); - if ($verboseBackup) + backupDatabase($db, $exportedCourseId, true, true, 'SQL', $archiveDirSql.$appendCourse, true, $verbose_backup); + if ($verbose_backup) echo "
  • - ".$langBackupOfDataBase." ".$exportedCourseId." (PHP) + ".get_lang('BackupOfDataBase')." ".$exportedCourseId." (PHP)
    "; - backupDatabase($db, $exportedCourseId, true, true, 'PHP', $archiveDirPhp.$appendCourse, true, $verboseBackup); - if ($verboseBackup) + backupDatabase($db, $exportedCourseId, true, true, 'PHP', $archiveDirPhp.$appendCourse, true, $verbose_backup); + if ($verbose_backup) echo "
  • - ".$langBackupOfDataBase." ".$exportedCourseId." (CSV) + ".get_lang('BackupOfDataBase')." ".$exportedCourseId." (CSV)
    "; - backupDatabase($db, $exportedCourseId, true, true, 'CSV', $archiveDirCsv.$appendCourse, true, $verboseBackup); - if ($verboseBackup) + backupDatabase($db, $exportedCourseId, true, true, 'CSV', $archiveDirCsv.$appendCourse, true, $verbose_backup); + if ($verbose_backup) echo "
  • - ".$langBackupOfDataBase." ".$exportedCourseId." (HTML) + ".get_lang('BackupOfDataBase')." ".$exportedCourseId." (HTML)
    "; - backupDatabase($db, $exportedCourseId, true, true, 'HTML', $archiveDirHtml.$appendCourse, true, $verboseBackup); - if ($verboseBackup) + backupDatabase($db, $exportedCourseId, true, true, 'HTML', $archiveDirHtml.$appendCourse, true, $verbose_backup); + if ($verbose_backup) echo "
  • - ".$langBackupOfDataBase." ".$exportedCourseId." (XML) + ".get_lang('BackupOfDataBase')." ".$exportedCourseId." (XML)
    "; - backupDatabase($db, $exportedCourseId, true, true, 'XML', $archiveDirXml.$appendCourse, true, $verboseBackup); - if ($verboseBackup) + backupDatabase($db, $exportedCourseId, true, true, 'XML', $archiveDirXml.$appendCourse, true, $verbose_backup); + if ($verbose_backup) echo "
  • - ".$langBackupOfDataBase." ".$exportedCourseId." (LOG) + ".get_lang('BackupOfDataBase')." ".$exportedCourseId." (LOG)
    "; - backupDatabase($db, $exportedCourseId, true, true, 'LOG', $archiveDirLog.$appendCourse, true, $verboseBackup); + backupDatabase($db, $exportedCourseId, true, true, 'LOG', $archiveDirLog.$appendCourse, true, $verbose_backup); // ******************************************************************** // Copy of DB course // with mysqldump @@ -771,7 +746,7 @@ function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = "" $fdesc = fopen($archiveDir.$systemFileNameOfArchive, "w"); fwrite($fdesc, $stringConfig); fclose($fdesc); - if ($verboseBackup) + if ($verbose_backup) echo "
  • @@ -800,33 +775,12 @@ function makeTheBackup($exportedCourseId, $verboseBackup = "FALSE", $ignore = "" echo "
    "; } $pathToArchive = $archiveRepositoryWeb.$archiveFileName; - if ($verboseBackup) - echo "
    ".$langBuildTheCompressedFile; + if ($verbose_backup) + { + echo '
    '.get_lang('BuildTheCompressedFile'); + } // removeDir($archivePath); } -?> - - \ No newline at end of file diff --git a/main/inc/lib/statsUtils.lib.inc.php b/main/inc/lib/statsUtils.lib.inc.php index 848f036018..9a7ecb3c67 100644 --- a/main/inc/lib/statsUtils.lib.inc.php +++ b/main/inc/lib/statsUtils.lib.inc.php @@ -497,38 +497,4 @@ function buildTabDefcon($array_of_results) } echo "\n"; } - -/** - * @deprecated use format_locale_date in text.lib.php - 19-dec-2005 - */ -function dateLocalizer($formatOfDate, $timestamp = -1) //PMAInspiration :) -{ - return format_locale_date($formatOfDate, $timestamp = -1); -} - -/** - * changeResultOfVisibility($array_of_results) - * @author Christophe Gesché - * @param array_of_results - * @desc complete the content of visibility column a with the literal meaning - */ -function changeResultOfVisibility($array_of_results) -{ - $visibility_label = array( - 0 => 'closed - hide', - 1 => 'open - hide', - 2 => 'open - visible', - 3 => 'closed - visible', - ); - - if (is_array($array_of_results)) - { - for($j = 0 ; $j < count($array_of_results) ; $j++) - { - $array_of_results[$j][0] = $array_of_results[$j][0].' ('.$visibility_label[$array_of_results[$j][0]].')'; - } - } - - return $array_of_results; -} ?> \ No newline at end of file diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php index c0cc528ef6..e64324d6d4 100644 --- a/main/install/configuration.dist.php +++ b/main/install/configuration.dist.php @@ -130,18 +130,11 @@ $phpMyAdminPath = ''; // $extAuthSource["ldap"]["login"]=$clarolineRepositorySys."auth/ldap/login.php"; // $extAuthSource["ldap"]["newUser"]=$clarolineRepositorySys."auth/ldap/newUser.php"; -//============================================================================ -// Language settings -//============================================================================ -// Available Languages : look at the "lang" directory -$platformLanguage = '{PLATFORM_LANGUAGE}'; -$language = $platformLanguage; - //============================================================================ // Misc. settings //============================================================================ // Verbose backup -$verboseBackup = false; +$_configuration['verbose_backup'] = false; // security word for password recovery $_configuration['security_key'] = '{SECURITY_KEY}'; // Settings for new and future features