From fc7b5b8283173ebb5209da124e5b283e5b86dfa7 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 03 Feb 2012 06:12:35 -0500
Subject: [PATCH] Get rid of global $__skin_path variable (#1488336)

---
 program/include/main.inc           |    2 +-
 program/steps/mail/compose.inc     |    4 +++-
 program/include/rcube_template.php |    8 ++++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/program/include/main.inc b/program/include/main.inc
index 8b935c1..35c2df4 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1379,8 +1379,8 @@
   $RCMAIL->output->add_script(sprintf("rcmail_editor_init(%s)",
     json_encode(array(
         'mode'       => $mode,
-        'skin_path'  => '$__skin_path',
         'lang'       => $lang,
+        'skin_path'  => $RCMAIL->output->get_skin_path(),
         'spellcheck' => intval($RCMAIL->config->get('enable_spellcheck')),
         'spelldict'  => intval($RCMAIL->config->get('spellcheck_dictionary')),
     ))), 'foot');
diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php
index 0fbd9df..94fa676 100644
--- a/program/include/rcube_template.php
+++ b/program/include/rcube_template.php
@@ -167,6 +167,14 @@
     }
 
     /**
+     * Getter for the current skin path property
+     */
+    public function get_skin_path()
+    {
+        return $this->config['skin_path'];
+    }
+
+    /**
      * Check if a specific template exists
      *
      * @param string Template name
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 6b2fa7b..cbef368 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -775,7 +775,7 @@
 
     $OUTPUT->include_script('googiespell.js');
     $OUTPUT->add_script(sprintf(
-      "var googie = new GoogieSpell('\$__skin_path/images/googiespell/','?_task=utils&_action=spell&lang=', %s);\n".
+      "var googie = new GoogieSpell('%s/images/googiespell/','%s&lang=', %s);\n".
       "googie.lang_chck_spell = \"%s\";\n".
       "googie.lang_rsm_edt = \"%s\";\n".
       "googie.lang_close = \"%s\";\n".
@@ -787,6 +787,8 @@
       "googie.setSpellContainer('spellcheck-control');\n".
       "googie.decorateTextarea('%s');\n".
       "%s.set_env('spellcheck', googie);",
+      $RCMAIL->output->get_skin_path(),
+      $RCMAIL->url(array('_task' => 'utils', '_action' => 'spell')),
       !empty($dictionary) ? 'true' : 'false',
       JQ(Q(rcube_label('checkspelling'))),
       JQ(Q(rcube_label('resumeediting'))),

--
Gitblit v1.9.1