Skip to content

Commit 72dde3f

Browse files
committedMar 26, 2012
Fixed #13740: Support auto-redirection from MantisBT to MantisTouch for mobi
1. Auto-detect mobile browser. 2. Redirect to a configured instance of MantisTouch, passing in the URL of t This functionality will be controlled via a configuration option that enable
1 parent 5cafc57 commit 72dde3f

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed
 

‎config_defaults_inc.php

+17
Original file line numberDiff line numberDiff line change
@@ -4129,3 +4129,20 @@
41294129
'ldap_simulation_file_path', 'plugin_path', 'bottom_include_page', 'top_include_page',
41304130
'default_home_page', 'logout_redirect_page', 'manual_url', 'logo_url', 'wiki_engine_url',
41314131
);
4132+
4133+
/***************
4134+
* MantisTouch *
4135+
***************/
4136+
4137+
/**
4138+
* The MantisTouch URL to direct to. The %s will be replaced by the contents of $g_path.
4139+
* A blank value will disable redirection. The %s is not required when redirecting to
4140+
* MantisTouch instances that point to a single MantisBT instance and hence have a hard-coded URL.
4141+
*
4142+
* Following are three examples:
4143+
* - 'http://mantisbt.mobi?url=%s'
4144+
* - 'http://MyOwnMantisTouch.com/'
4145+
* - ''
4146+
*/
4147+
$g_mantistouch_url = '';
4148+

‎core.php

+20
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,26 @@ function __autoload( $className ) {
155155
# Register the autoload function to make it effective immediately
156156
spl_autoload_register( '__autoload' );
157157

158+
require_once( 'mobile_api.php' );
159+
160+
if ( strlen( $GLOBALS['g_mantistouch_url'] ) > 0 && mobile_is_mobile_browser() ) {
161+
$t_url = sprintf( $GLOBALS['g_mantistouch_url'], $GLOBALS['g_path'] );
162+
163+
if ( OFF == $g_use_iis ) {
164+
header( 'Status: 302' );
165+
}
166+
167+
header( 'Content-Type: text/html' );
168+
169+
if ( ON == $g_use_iis ) {
170+
header( "Refresh: 0;$t_url" );
171+
} else {
172+
header( "Location: $t_url" );
173+
}
174+
175+
exit; # additional output can cause problems so let's just stop output here
176+
}
177+
158178
# Load UTF8-capable string functions
159179
define( 'UTF8', $g_library_path . 'utf8' );
160180
require_lib( 'utf8/utf8.php' );

‎docbook/Admin_Guide/en-US/Configuration.xml

+20
Original file line numberDiff line numberDiff line change
@@ -3387,4 +3387,24 @@
33873387
</variablelist>
33883388
</section>
33893389

3390+
<section id="admin.config.mantistouch">
3391+
<title>MantisTouch</title>
3392+
<para>
3393+
These options are used to integrate with MantisTouch (http://www.mantistouch.org) to provide experience targeted to mobile devices.
3394+
</para>
3395+
3396+
<variablelist>
3397+
<varlistentry>
3398+
<term>$g_mantistouch_url</term>
3399+
<listitem>
3400+
<para>
3401+
The MantisTouch URL to direct to. The %s will be replaced by the contents of $g_path configuration option.
3402+
A blank value will disable redirection. The %s is not required when redirecting to
3403+
MantisTouch instances that point to a single MantisBT instance and hence have a hard-coded URL.
3404+
Examples include: '' (default), 'http://mantisbt.mobi?url=%s', and 'http://MyOwnMantisTouch.com/'.
3405+
</para>
3406+
</listitem>
3407+
</varlistentry>
3408+
</variablelist>
3409+
</section>
33903410
</chapter>

0 commit comments

Comments
 (0)