Skip to content

Commit

Permalink
Fixed #13740: Support auto-redirection from MantisBT to MantisTouch f…
Browse files Browse the repository at this point in the history
…or 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
  • Loading branch information
vboctor committed Mar 26, 2012
1 parent 5cafc57 commit 72dde3f
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
17 changes: 17 additions & 0 deletions config_defaults_inc.php
Expand Up @@ -4129,3 +4129,20 @@
'ldap_simulation_file_path', 'plugin_path', 'bottom_include_page', 'top_include_page',
'default_home_page', 'logout_redirect_page', 'manual_url', 'logo_url', 'wiki_engine_url',
);

/***************
* MantisTouch *
***************/

/**
* The MantisTouch URL to direct to. The %s will be replaced by the contents of $g_path.
* A blank value will disable redirection. The %s is not required when redirecting to
* MantisTouch instances that point to a single MantisBT instance and hence have a hard-coded URL.
*
* Following are three examples:
* - 'http://mantisbt.mobi?url=%s'
* - 'http://MyOwnMantisTouch.com/'
* - ''
*/
$g_mantistouch_url = '';

20 changes: 20 additions & 0 deletions core.php
Expand Up @@ -155,6 +155,26 @@ function __autoload( $className ) {
# Register the autoload function to make it effective immediately
spl_autoload_register( '__autoload' );

require_once( 'mobile_api.php' );

if ( strlen( $GLOBALS['g_mantistouch_url'] ) > 0 && mobile_is_mobile_browser() ) {
$t_url = sprintf( $GLOBALS['g_mantistouch_url'], $GLOBALS['g_path'] );

if ( OFF == $g_use_iis ) {
header( 'Status: 302' );
}

header( 'Content-Type: text/html' );

if ( ON == $g_use_iis ) {
header( "Refresh: 0;$t_url" );
} else {
header( "Location: $t_url" );
}

exit; # additional output can cause problems so let's just stop output here
}

# Load UTF8-capable string functions
define( 'UTF8', $g_library_path . 'utf8' );
require_lib( 'utf8/utf8.php' );
Expand Down
20 changes: 20 additions & 0 deletions docbook/Admin_Guide/en-US/Configuration.xml
Expand Up @@ -3387,4 +3387,24 @@
</variablelist>
</section>

<section id="admin.config.mantistouch">
<title>MantisTouch</title>
<para>
These options are used to integrate with MantisTouch (http://www.mantistouch.org) to provide experience targeted to mobile devices.
</para>

<variablelist>
<varlistentry>
<term>$g_mantistouch_url</term>
<listitem>
<para>
The MantisTouch URL to direct to. The %s will be replaced by the contents of $g_path configuration option.
A blank value will disable redirection. The %s is not required when redirecting to
MantisTouch instances that point to a single MantisBT instance and hence have a hard-coded URL.
Examples include: '' (default), 'http://mantisbt.mobi?url=%s', and 'http://MyOwnMantisTouch.com/'.
</para>
</listitem>
</varlistentry>
</variablelist>
</section>
</chapter>

0 comments on commit 72dde3f

Please sign in to comment.