From c0ba4f656e7b06c0921a384b323a78762e007f0f Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Wed, 6 Oct 2010 20:19:56 +0000
Subject: [PATCH] Pushing last rev up to testing.

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/testing@233 20a16fea-79d4-4915-8869-1ea9d5ebf173
---
 sites/all/modules/unl/cron.php | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/sites/all/modules/unl/cron.php b/sites/all/modules/unl/cron.php
index d8d43c6b..78094dbf 100644
--- a/sites/all/modules/unl/cron.php
+++ b/sites/all/modules/unl/cron.php
@@ -54,10 +54,7 @@ function unl_add_site($site_path, $uri, $clean_url, $db_prefix) {
     $site_path = substr($site_path, 0, -1);
   }
   
-  $path_parts = parse_url($uri);
-  $sites_subdir = $path_parts['host'] . $path_parts['path'];
-  $sites_subdir = strtr($sites_subdir, array('/' => '.')); 
-  
+  $sites_subdir = _unl_get_sites_subdir($uri);
   
   $database = $GLOBALS['databases']['default']['default'];
   $db_url = $database['driver']
@@ -109,10 +106,7 @@ function unl_remove_site($site_path, $uri, $db_prefix) {
   $db_prefix .= '_' . $database['prefix'];
   
   
-  $path_parts = parse_url($uri);
-  $sites_subdir = $path_parts['host'] . $path_parts['path'];
-  $sites_subdir = strtr($sites_subdir, array('/' => '.'));
-
+  $sites_subdir = _unl_get_sites_subdir($uri);
   $sites_subdir = DRUPAL_ROOT . '/sites/' . $sites_subdir;
   $sites_subdir = realpath($sites_subdir);
   
@@ -147,6 +141,16 @@ function unl_remove_site($site_path, $uri, $db_prefix) {
   return TRUE;
 }
 
+function _unl_get_sites_subdir($uri) {
+  $path_parts = parse_url($uri);
+  if (substr($path_parts['host'], -7) == 'unl.edu') {
+    $path_parts['host'] = 'unl.edu';
+  }
+  $sites_subdir = $path_parts['host'] . $path_parts['path'];
+  $sites_subdir = strtr($sites_subdir, array('/' => '.')); 
+  
+  return $sites_subdir;
+}
 
 
 
-- 
GitLab