From e681588953e1bf427323abd3634241ffd8453be2 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 10 Mar 2010 15:42:51 -0500 Subject: [PATCH 1/2] Removing GARBAGE_PATH --- main/inc/lib/main_api.lib.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php index 3aa1a63927..9692763581 100755 --- a/main/inc/lib/main_api.lib.php +++ b/main/inc/lib/main_api.lib.php @@ -175,9 +175,8 @@ define('SYS_CODE_PATH', 'SYS_CODE_PATH'); define('SYS_LANG_PATH', 'SYS_LANG_PATH'); define('WEB_IMG_PATH', 'WEB_IMG_PATH'); define('WEB_CSS_PATH', 'WEB_CSS_PATH'); -define('GARBAGE_PATH', 'GARBAGE_PATH'); // Deprecated? define('SYS_PLUGIN_PATH', 'SYS_PLUGIN_PATH'); -define('PLUGIN_PATH', 'SYS_PLUGIN_PATH'); // deprecated +define('PLUGIN_PATH', 'SYS_PLUGIN_PATH'); // deprecated ? define('WEB_PLUGIN_PATH', 'WEB_PLUGIN_PATH'); define('SYS_ARCHIVE_PATH', 'SYS_ARCHIVE_PATH'); define('WEB_ARCHIVE_PATH', 'WEB_ARCHIVE_PATH'); @@ -228,11 +227,14 @@ require_once dirname(__FILE__).'/internationalization.lib.php'; * The defined constants used by this function contain the abbreviations WEB, REL, SYS with the following meaning for types: * WEB - an absolute URL (we often call it web-path), * example: http://www.mychamilo.org/chamilo/courses/COURSE01/document/lesson01.html; + * * REL - represents a semi-absolute URL - a web-path, which is relative to the root web-path of the server, without server's base, * example: /chamilo/courses/COURSE01/document/lesson01.html; + * * SYS - represents an absolute path inside the scope of server's file system, * /var/www/chamilo/courses/COURSE01/document/lesson01.html or * C:/Inetpub/wwwroot/chamilo/courses/COURSE01/document/lesson01.html. + * * In some abstract sense we can consider these three path types as absolute. * * Notes about the current behaviour model: @@ -271,7 +273,6 @@ require_once dirname(__FILE__).'/internationalization.lib.php'; * api_get_path(WEB_CSS_PATH) http://www.mychamilo.org/chamilo/main/css/ * api_get_path(WEB_LIBRARY_PATH) http://www.mychamilo.org/chamilo/main/inc/lib/ * - * api_get_path(GARBAGE_PATH) Deprecated? * * * api_get_path(SYS_ARCHIVE_PATH) /var/www/chamilo/archive/ * api_get_path(INCLUDE_PATH) /var/www/chamilo/main/inc/ @@ -312,7 +313,6 @@ function api_get_path($path_type, $path = null) { SYS_LANG_PATH => 'lang/', WEB_IMG_PATH => 'img/', WEB_CSS_PATH => 'css/', - GARBAGE_PATH => 'archive/', // Deprecated? SYS_PLUGIN_PATH => 'plugin/', WEB_PLUGIN_PATH => 'plugin/', SYS_ARCHIVE_PATH => 'archive/', @@ -427,8 +427,6 @@ function api_get_path($path_type, $path = null) { $paths[SYS_ARCHIVE_PATH] = $paths[SYS_PATH].$paths[SYS_ARCHIVE_PATH]; $paths[SYS_TEST_PATH] = $paths[SYS_PATH].$paths[SYS_TEST_PATH]; - $paths[GARBAGE_PATH] = $paths[SYS_PATH].$paths[GARBAGE_PATH]; // Deprecated? - // TODO: This path may depend on the configuration option? To be researched. // Maybe a new constant like WEB_USER_CSS_PATH has to be defined? $paths[WEB_CSS_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_CSS_PATH]; From a74609097fc47e13dd6d552f90e72f2ebd52e93a Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 10 Mar 2010 17:26:20 -0500 Subject: [PATCH 2/2] Setting the temp dir for the Spreadsheet_Excel_Writer class problems found in some servers due the tempnam PHP function. tmp file set to api_get_path(SYS_ARCHIVE_PATH) see BT#836 Thanks to Noa for reporting it. --- main/exercice/exercise_result.class.php | 2 ++ main/gradebook/gradebook_result.class.php | 2 ++ main/inc/lib/debug.lib.inc.php | 1 - main/survey/survey.lib.php | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/main/exercice/exercise_result.class.php b/main/exercice/exercise_result.class.php index 0b5ec3fd94..dedde3d5c1 100755 --- a/main/exercice/exercise_result.class.php +++ b/main/exercice/exercise_result.class.php @@ -343,6 +343,8 @@ class ExerciseResult } //build the results require_once(api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php'); $workbook = new Spreadsheet_Excel_Writer(); + $workbook ->setTempDir(api_get_path(SYS_ARCHIVE_PATH)); + $workbook->send($filename); $worksheet =& $workbook->addWorksheet('Report '.date('YmdGis')); $line = 0; diff --git a/main/gradebook/gradebook_result.class.php b/main/gradebook/gradebook_result.class.php index 8fee7ea7de..a8fc79ed60 100755 --- a/main/gradebook/gradebook_result.class.php +++ b/main/gradebook/gradebook_result.class.php @@ -255,6 +255,8 @@ class GradeBookResult //build the results require_once(api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php'); $workbook = new Spreadsheet_Excel_Writer(); + $workbook ->setTempDir(api_get_path(SYS_ARCHIVE_PATH)); + $workbook->send($filename); $worksheet =& $workbook->addWorksheet('Report '.date('YmdGis')); $line = 0; diff --git a/main/inc/lib/debug.lib.inc.php b/main/inc/lib/debug.lib.inc.php index f04bf7f909..ee00857bfd 100755 --- a/main/inc/lib/debug.lib.inc.php +++ b/main/inc/lib/debug.lib.inc.php @@ -66,7 +66,6 @@ function debug_paths() echo 'SYS_CODE_PATH :'.api_get_path(SYS_CODE_PATH).'
'; echo 'SYS_LANG_PATH :'.api_get_path(SYS_LANG_PATH).'
'; echo 'WEB_IMG_PATH :'.api_get_path(WEB_IMG_PATH).'
'; - echo 'GARBAGE_PATH :'.api_get_path(GARBAGE_PATH).'
'; echo 'PLUGIN_PATH :'.api_get_path(PLUGIN_PATH).'
'; echo 'SYS_ARCHIVE_PATH :'.api_get_path(SYS_ARCHIVE_PATH).'
'; echo 'INCLUDE_PATH :'.api_get_path(INCLUDE_PATH).'
'; diff --git a/main/survey/survey.lib.php b/main/survey/survey.lib.php index d1db46b367..957f5460a6 100755 --- a/main/survey/survey.lib.php +++ b/main/survey/survey.lib.php @@ -3528,6 +3528,7 @@ class SurveyUtil { require_once(api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php'); $workbook = new Spreadsheet_Excel_Writer(); + $workbook ->setTempDir(api_get_path(SYS_ARCHIVE_PATH)); $workbook->send($filename); $worksheet =& $workbook->addWorksheet('Report 1'); $line = 0;