Permalink
Browse files

NOJIRA: A few code polish-ups: parsing ini file in vitals.inc.php; 2.…

… setting the default timezone to system calculated default.
  • Loading branch information...
1 parent 4329199 commit 7698777db952d78d49d343c8317804d29deb592b Cindy Li committed May 27, 2011
Showing with 45 additions and 40 deletions.
  1. +34 −34 image-gallery.php
  2. +7 −1 include/vitals.inc.php
  3. +4 −5 uploader-server.php
View
68 image-gallery.php 100644 → 100755
@@ -1,6 +1,6 @@
<?php
- $settings = parse_ini_file("image-gallery-settings.ini");
- $INFUSION = $settings["infusion"];
+define('FLUID_IG_INCLUDE_PATH', 'include/');
+include(FLUID_IG_INCLUDE_PATH . "vitals.inc.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -9,43 +9,43 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Uploader</title>
- <link rel="stylesheet" type="text/css" href="<?php echo $INFUSION;?>/src/webapp/framework/fss/css/fss-reset.css" />
- <link rel="stylesheet" type="text/css" href="<?php echo $INFUSION;?>/src/webapp/framework/fss/css/fss-layout.css" />
- <link rel="stylesheet" type="text/css" href="<?php echo $INFUSION;?>/src/webapp/components/uploader/css/Uploader.css" />
+ <link rel="stylesheet" type="text/css" href="<?php echo FLUID_IG_INFUSION;?>/src/webapp/framework/fss/css/fss-reset.css" />
+ <link rel="stylesheet" type="text/css" href="<?php echo FLUID_IG_INFUSION;?>/src/webapp/framework/fss/css/fss-layout.css" />
+ <link rel="stylesheet" type="text/css" href="<?php echo FLUID_IG_INFUSION;?>/src/webapp/components/uploader/css/Uploader.css" />
<link rel="stylesheet" type="text/css" href="css/image-gallery.css" />
<!-- Fluid and jQuery Dependencies -->
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/lib/jquery/core/js/jquery.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/lib/jquery/ui/js/jquery.ui.core.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/framework/core/js/jquery.keyboard-a11y.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/lib/jquery/plugins/scrollTo/js/jquery.scrollTo.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/lib/swfobject/js/swfobject.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/lib/swfupload/js/swfupload.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/lib/json/js/json2.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/lib/jquery/core/js/jquery.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/lib/jquery/ui/js/jquery.ui.core.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/framework/core/js/jquery.keyboard-a11y.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/lib/jquery/plugins/scrollTo/js/jquery.scrollTo.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/lib/swfobject/js/swfobject.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/lib/swfupload/js/swfupload.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/lib/json/js/json2.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/framework/core/js/Fluid.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/framework/core/js/DataBinding.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/framework/core/js/FluidIoC.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/framework/core/js/FluidDocument.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/framework/core/js/FluidView.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/framework/core/js/FluidRequests.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/framework/core/js/FluidDOMUtilities.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/lib/fastXmlPull/js/fastXmlPull.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/framework/renderer/js/fluidRenderer.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/framework/renderer/js/fluidParser.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/framework/renderer/js/RendererUtilities.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/framework/enhancement/js/ProgressiveEnhancement.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/framework/core/js/Fluid.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/framework/core/js/DataBinding.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/framework/core/js/FluidIoC.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/framework/core/js/FluidDocument.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/framework/core/js/FluidView.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/framework/core/js/FluidRequests.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/framework/core/js/FluidDOMUtilities.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/lib/fastXmlPull/js/fastXmlPull.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/framework/renderer/js/fluidRenderer.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/framework/renderer/js/fluidParser.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/framework/renderer/js/RendererUtilities.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/framework/enhancement/js/ProgressiveEnhancement.js"></script>
<!-- Uploader dependencies -->
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/components/uploader/js/Uploader.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/components/uploader/js/FileQueue.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/components/progress/js/Progress.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/components/uploader/js/FileQueueView.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/components/uploader/js/MimeTypeExtensions.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/components/uploader/js/FlashUploaderSupport.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/components/uploader/js/Flash9UploaderSupport.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/components/uploader/js/HTML5UploaderSupport.js"></script>
- <script type="text/javascript" src="<?php echo $INFUSION;?>/src/webapp/components/uploader/js/DemoUploadManager.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/components/uploader/js/Uploader.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/components/uploader/js/FileQueue.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/components/progress/js/Progress.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/components/uploader/js/FileQueueView.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/components/uploader/js/MimeTypeExtensions.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/components/uploader/js/FlashUploaderSupport.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/components/uploader/js/Flash9UploaderSupport.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/components/uploader/js/HTML5UploaderSupport.js"></script>
+ <script type="text/javascript" src="<?php echo FLUID_IG_INFUSION;?>/src/webapp/components/uploader/js/DemoUploadManager.js"></script>
<!-- The Uploader demo -->
<script type="text/javascript" src="js/image-gallery.js"></script>
@@ -115,7 +115,7 @@
pathResolver: {
options: {
prefixes: {
- infusion: "<?php echo $INFUSION;?>"
+ infusion: "<?php echo FLUID_IG_INFUSION;?>"
}
}
}
@@ -4,7 +4,13 @@
define('FLUID_IG_DEVEL', 1);
// set the default timezone to avoid the warning of "cannot rely on system timezone"
-date_default_timezone_set('America/New_York');
+@date_default_timezone_set(@date_default_timezone_get());
+
+// parse ini file to retrieve the user settings
+$ini_file = FLUID_IG_INCLUDE_PATH . "../image-gallery-settings.ini";
+$_settings = parse_ini_file($ini_file);
+
+define('FLUID_IG_INFUSION', $_settings["infusion"]);
// get the protocol
if (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) {
View
@@ -13,13 +13,12 @@
define('FLUID_IG_INCLUDE_PATH', 'include/');
-include("include/vitals.inc.php");
-$settings = parse_ini_file("image-gallery-settings.ini");
+include(FLUID_IG_INCLUDE_PATH . "vitals.inc.php");
// The constants
-$allowed_file_extensions = $settings["allowed_file_extensions"]; // The array of allowed file extensions: gif, png, jpg, tif
-$secs_to_timeout = $settings["secs_to_timeout"]; // The seconds to keep the uploaded images
-$temp_dir = $settings["temp_dir"];
+$allowed_file_extensions = $_settings["allowed_file_extensions"]; // The array of allowed file extensions: gif, png, jpg, tif
+$secs_to_timeout = $_settings["secs_to_timeout"]; // The seconds to keep the uploaded images
+$temp_dir = $_settings["temp_dir"];
// Remove all the folders that are older than 3600 seconds
clean_history($temp_dir, $secs_to_timeout);

0 comments on commit 7698777

Please sign in to comment.