diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2013-07-12 10:17:32 +0200 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2013-07-12 10:17:32 +0200 |
commit | deb2b8d0804d1d25a3f28266747ce9041495b372 (patch) | |
tree | eb32b73e965a3c7b6297f1adc2427689f48b7bd8 /program/include | |
parent | f6777712dc8c8ed2316e2926e98bb081e3785e40 (diff) |
Allow to load config files for different environments (#1487311); keep (non-default) filename in URLs throughout the webmail app
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/rcmail.php | 12 | ||||
-rw-r--r-- | program/include/rcmail_output_html.php | 6 |
2 files changed, 13 insertions, 5 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php index d430cd350..800eddac6 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -51,6 +51,7 @@ class rcmail extends rcube */ public $action = ''; public $comm_path = './'; + public $filename = ''; private $address_books = array(); private $action_map = array(); @@ -65,12 +66,13 @@ class rcmail extends rcube /** * This implements the 'singleton' design pattern * + * @param string Environment name to run (e.g. live, dev, test) * @return rcmail The one and only instance */ - static function get_instance() + static function get_instance($env = '') { if (!self::$instance || !is_a(self::$instance, 'rcmail')) { - self::$instance = new rcmail(); + self::$instance = new rcmail($env); self::$instance->startup(); // init AFTER object was linked with self::$instance } @@ -86,6 +88,10 @@ class rcmail extends rcube { $this->init(self::INIT_WITH_DB | self::INIT_WITH_PLUGINS); + // set filename if not index.php + if (($basename = basename($_SERVER['SCRIPT_FILENAME'])) && $basename != 'index.php') + $this->filename = $basename; + // start session $this->session_init(); @@ -724,7 +730,7 @@ class rcmail extends rcube $p['_task'] = $task; unset($p['task']); - $url = './'; + $url = './' . $this->filename; $delm = '?'; foreach (array_reverse($p) as $key => $val) { if ($val !== '' && $val !== null) { diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index c96a40ab9..998779509 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -1004,7 +1004,9 @@ class rcmail_output_html extends rcmail_output } return html::quote($value); - break; + + case 'form': + return $this->form_tag($attrib); } return ''; } @@ -1432,7 +1434,7 @@ class rcmail_output_html extends rcmail_output $attrib['noclose'] = true; return html::tag('form', - $attrib + array('action' => "./", 'method' => "get"), + $attrib + array('action' => $this->app->comm_path, 'method' => "get"), $hidden . $content, array('id','class','style','name','method','action','enctype','onsubmit')); } |