From 1448848d5d6c078d1839d965a30912c8f44bd2f6 Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Mon, 20 Feb 2012 20:11:07 +0000
Subject: [PATCH] [gh-287] Merging from testing into staging -c 1440

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/staging@1455 20a16fea-79d4-4915-8869-1ea9d5ebf173
---
 profiles/unl_profile/unl_profile.install | 1 +
 sites/all/modules/unl/unl.module         | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/profiles/unl_profile/unl_profile.install b/profiles/unl_profile/unl_profile.install
index da07a1e5..3c7131a6 100644
--- a/profiles/unl_profile/unl_profile.install
+++ b/profiles/unl_profile/unl_profile.install
@@ -318,6 +318,7 @@ EOF;
 
   $files_dir = $settings_dir . '/files';
   chmod($files_dir, 0777);
+  chmod($files_dir . '/styles', 0777);
 
   
   // IMCE setup (currently cannot be shared between sites)
diff --git a/sites/all/modules/unl/unl.module b/sites/all/modules/unl/unl.module
index 52a69ab8..df5dcf4e 100644
--- a/sites/all/modules/unl/unl.module
+++ b/sites/all/modules/unl/unl.module
@@ -460,6 +460,15 @@ function unl_menu_alter(&$items) {
     $items['node/%node/moderation']['theme callback'] = '_unl_get_admin_theme';
     $items['node/%node/moderation/%/unpublish']['theme callback'] = '_unl_get_admin_theme';
   }
+  
+  // Add a menu hook for the image module to use clean file URLs.
+  if (variable_get('unl_clean_file_url') && module_exists('image')) {
+    $directory_path = file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath();
+    $items['styles/%image_style'] = $items[$directory_path . '/styles/%image_style'];
+    // This parameter is how "deep" to look into request_path() for the image's path.
+    // Since clean URLs have no "prefix", we can just set it to 1.
+    $items['styles/%image_style']['page arguments'] = array(1);
+  }
 }
 
 /**
-- 
GitLab