From 398b5316333ea77259ca6811b4c9c9407322229d Mon Sep 17 00:00:00 2001
From: Pol Dell'Aiera <Pol@47194.no-reply.drupal.org>
Date: Tue, 20 Sep 2011 11:22:27 +0200
Subject: [PATCH 152/152] Fix #374222: Template files do not work when using admin theme

---
 simplenews.module |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/simplenews.module b/simplenews.module
index 53db457..741c4be 100644
--- a/simplenews.module
+++ b/simplenews.module
@@ -93,6 +93,19 @@ function simplenews_init() {
       '@settings' => url('admin/settings/simplenews/general')
     )), 'error');
   }
+
+  $disallow_paths = array('*run-cron', '*cron.php');
+  $disallow_path  = FALSE;
+
+  $disallow_path = drupal_match_path($_GET['q'], implode("\r\n", $disallow_paths));
+  $alias = drupal_get_path_alias($_GET['q']);
+  if ($alias != $_GET['q']) {
+    $disallow_path = FALSE || drupal_match_path($alias, implode("\r\n", $disallow_paths));
+  }
+
+  if ($disallow_path == TRUE) {
+    $GLOBALS['custom_theme'] = variable_get('theme_default', 'garland');
+  }
 }
 
 /**
-- 
1.7.4

