diff options
| author | Lester Caine <lester@lsces.co.uk> | 2009-02-21 19:45:53 +0000 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2009-02-21 19:45:53 +0000 |
| commit | 5feb32051334fb0a73dfdc85987854399c5755fe (patch) | |
| tree | e471281899fb2a7f77dca67215763b8261f934af | |
| parent | 38242268f4953db663a94bff95c1eb19cf7cfaee (diff) | |
| download | liberty-5feb32051334fb0a73dfdc85987854399c5755fe.tar.gz liberty-5feb32051334fb0a73dfdc85987854399c5755fe.tar.bz2 liberty-5feb32051334fb0a73dfdc85987854399c5755fe.zip | |
If no external database connection string supplied fall back to local database.
| -rw-r--r-- | plugins/data.dbreport.php | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/plugins/data.dbreport.php b/plugins/data.dbreport.php index 152654a..58db483 100644 --- a/plugins/data.dbreport.php +++ b/plugins/data.dbreport.php @@ -1,6 +1,6 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_liberty/plugins/Attic/data.dbreport.php,v 1.2 2009/02/21 19:19:12 lsces Exp $ + * $Header: /cvsroot/bitweaver/_bit_liberty/plugins/Attic/data.dbreport.php,v 1.3 2009/02/21 19:45:53 lsces Exp $ * @package liberty * @subpackage plugins_data * @@ -1480,7 +1480,7 @@ function wikiplugin_dbreport($data, $params) { } // we need a dsn or db parameter if (!isset($dsn) && !isset($db)) { - return tra('Missing db or dsn parameter'); + $db = 'local'; } // parse the report definition // $parse_fix = ($_REQUEST['preview']); @@ -1504,13 +1504,19 @@ function wikiplugin_dbreport($data, $params) { } } // translate db name into dsn - if (isset($db)) { - if ( !$gBitSystem->isFeatureActive( 'dbreport_manage' ) ) { - return ( tra('You do not have permission to use this DSN') ); - } + if ( isset($db) ) { + if ( $db == 'local' ) { + global $gBitDbType, $gBitDbUser, $gBitDbPassword, $gBitDbHost, $gBitDbName; + $dsn = "$gBitDbType://$gBitDbUser:$gBitDbPassword@$gBitDbHost/$gBitDbName"; + } else { + if ( !$gBitSystem->isFeatureActive( 'dbreport_manage' ) ) { + return ( tra('You do not have permission to use this DSN') ); + } else { //TODO - convert to bw managed library - // retrieve the dsn string - $dsn = $tikilib->get_dsn_by_name($db); + // retrieve the dsn string + $dsn = $tikilib->get_dsn_by_name($db); + } + } } else { if ( !$gBitSystem->isFeatureActive( 'dbreport_direct' ) ) { return ( tra('Direct DSN access for reports is disabled') ); |
