From 06fd479ba5fbea921c81747fe18ee118a67e6d48 Mon Sep 17 00:00:00 2001
From: Pol Dell'Aiera <Pol@47194.no-reply.drupal.org>
Date: Fri, 2 Sep 2011 09:46:02 +0200
Subject: [PATCH] Fix issue #374222: template files do not work when using admin theme.

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

diff --git a/simplenews.module b/simplenews.module
index ad3d4e3..d2d11e9 100644
--- a/simplenews.module
+++ b/simplenews.module
@@ -822,6 +822,22 @@ function simplenews_form_alter(&$form, $form_state, $form_id) {
  * Implementation of hook_cron().
  */
 function simplenews_cron() {
+  $disallow_paths = array('*run-cron', '*cron.php');
+  $disallow_paths_string = implode("\n", $disallow_paths);
+  $disallow_path = FALSE;
+
+  if (trim($disallow_paths_string) != '') {
+    $disallow_path = drupal_match_path($_GET['q'], $disallow_paths_string);
+    $alias = drupal_get_path_alias($_GET['q']);
+    if ($alias != $_GET['q']) {
+      $disallow_path = FALSE || drupal_match_path($alias, $disallow_paths_string);
+    }
+  }
+
+  if ($disallow_path == TRUE) {
+    $GLOBALS['custom_theme'] = variable_get('theme_default', 'garland');
+  }
+
   module_load_include('inc', 'simplenews', 'includes/simplenews.mail');
   simplenews_mail_spool();
   simplenews_clear_spool();
-- 
1.7.4

