Use DIRECTORY_SEPARATOR everywhere.
authorIain Patterson <me@iain.cx>
Mon, 7 Jul 2014 08:24:48 +0000 (04:24 -0400)
committerIain Patterson <me@iain.cx>
Mon, 7 Jul 2014 08:24:48 +0000 (04:24 -0400)
We were using DIRECTORY_SEPARATOR in some cases and explicitly joining
paths with slashes in others.

lib/functions.php
www/index.php

index ec0b35a..6a39ddd 100644 (file)
     echo call_user_func_array("get_small_link", func_get_args());
   }
 
-  include_once("$lib_root/admin.php");
-  include_once("$lib_root/forms.php");
+  include_once(join(DIRECTORY_SEPARATOR, array($lib_root, "admin.php")));
+  include_once(join(DIRECTORY_SEPARATOR, array($lib_root, "forms.php")));
 
 ?>
index ae8b5a1..64b403d 100644 (file)
@@ -8,10 +8,10 @@
   $root = join(DIRECTORY_SEPARATOR, array($_SERVER['DOCUMENT_ROOT'], ".."));
   $propel_root = join(DIRECTORY_SEPARATOR, array($root, "propel"));
   $lib_root = join(DIRECTORY_SEPARATOR, array($root, "lib"));
-  require_once "propel/Propel.php";
+  require_once(join(DIRECTORY_SEPARATOR, array("propel", "Propel.php")));
 
   Propel::init("$propel_root/build/conf/$propel_project-conf.php");
-  set_include_path(join(PATH_SEPARATOR, array("$propel_root/build/classes", get_include_path())));
+  set_include_path(join(PATH_SEPARATOR, array(join(DIRECTORY_SEPARATOR, array($propel_root, "build", "classes")), get_include_path())));
 
   $request = preg_replace('!^/branches/[^/]+/!', "", $_SERVER['REQUEST_URI']);
   $request = preg_replace('!^/+!', "", $request);
 
   $http = (isset($_SERVER['HTTPS'])) ? "https" : "http";
   $username = $_SERVER['REMOTE_USER'];
-  include_once("$lib_root/constants.php");
-  include_once("$lib_root/functions.php");
-  include_once("$lib_root/session.php");
-  include_once("$lib_root/header.php");
+  include_once(join(DIRECTORY_SEPARATOR, array($lib_root, "constants.php")));
+  include_once(join(DIRECTORY_SEPARATOR, array($lib_root, "functions.php")));
+  include_once(join(DIRECTORY_SEPARATOR, array($lib_root, "session.php")));
+  include_once(join(DIRECTORY_SEPARATOR, array($lib_root, "header.php")));
   $q = new UserQuery;
   $user = $q->findOneByUsername($username);
   if (! $q->count()) {
     $admin_level = $user->getAdmin();
     if ($module) {
       echo "<h3 class=\"printonly\">$charity $module</h3>\n";
-      include_once("$lib_root/$module.php");
+      include_once(join(DIRECTORY_SEPARATOR, array($lib_root, "$module.php")));
     }
 
-    #else include_once("$lib_root/menu.php");
+    #else include_once(join(DIRECTORY_SEPARATOR, array($lib_root, "menu.php")));
    }
-  include_once("$lib_root/footer.php");
+  include_once(join(DIRECTORY_SEPARATOR, array($lib_root, "footer.php")));
 ?>