diff options
| author | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-10-28 22:53:40 +0000 |
|---|---|---|
| committer | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-10-28 22:53:40 +0000 |
| commit | 5328c11135888671be7b952ab76069f8d34dbb78 (patch) | |
| tree | f489a4aaf2c9b2691086cf663e0e7c16ccdf1a06 | |
| parent | d6c77ae7a1b31462b57d2b06d79167970040ab52 (diff) | |
Add fallback to default skin if the selected one is not available in plugin directory
git-svn-id: https://svn.roundcube.net/trunk@3076 208e9e7b-5314-0410-a742-e7e81cd9613c
| -rw-r--r-- | roundcubemail/plugins/archive/archive.php | 4 | ||||
| -rw-r--r-- | roundcubemail/plugins/markasjunk/markasjunk.php | 2 | ||||
| -rw-r--r-- | roundcubemail/program/include/rcube_plugin.php | 14 |
3 files changed, 17 insertions, 3 deletions
diff --git a/roundcubemail/plugins/archive/archive.php b/roundcubemail/plugins/archive/archive.php index 8c855fea7..27887cef3 100644 --- a/roundcubemail/plugins/archive/archive.php +++ b/roundcubemail/plugins/archive/archive.php @@ -24,8 +24,8 @@ class archive extends rcube_plugin if ($rcmail->task == 'mail' && ($rcmail->action == '' || $rcmail->action == 'show') && ($archive_folder = $rcmail->config->get('archive_mbox'))) { - $skin_path = 'skins/'.$rcmail->output->config['skin']; - + $skin_path = $this->local_skin_path(); + $this->include_script('archive.js'); $this->add_texts('localization', true); $this->add_button( diff --git a/roundcubemail/plugins/markasjunk/markasjunk.php b/roundcubemail/plugins/markasjunk/markasjunk.php index f3e652d89..4f41a7eed 100644 --- a/roundcubemail/plugins/markasjunk/markasjunk.php +++ b/roundcubemail/plugins/markasjunk/markasjunk.php @@ -19,7 +19,7 @@ class markasjunk extends rcube_plugin $rcmail = rcmail::get_instance(); if ($rcmail->action == '' || $rcmail->action == 'show') { - $skin_path = 'skins/'.$rcmail->output->config['skin']; + $skin_path = $this->local_skin_path();; $this->include_script('markasjunk.js'); $this->add_texts('localization', true); $this->add_button(array( diff --git a/roundcubemail/program/include/rcube_plugin.php b/roundcubemail/program/include/rcube_plugin.php index 5e37764c4..ed30e8f17 100644 --- a/roundcubemail/program/include/rcube_plugin.php +++ b/roundcubemail/program/include/rcube_plugin.php @@ -231,6 +231,20 @@ abstract class rcube_plugin else return $fn; } + + /** + * Provide path to the currently selected skin folder within the plugin directory + * with a fallback to the default skin folder. + * + * @return string Skin path relative to plugins directory + */ + protected function local_skin_path() + { + $skin_path = 'skins/'.$this->api->output->config['skin']; + if (!is_dir(realpath(slashify($this->home) . $skin_path))) + $skin_path = 'skins/default'; + return $skin_path; + } /** * Callback function for array_map |
