More localisable, and now able to detect the PDO pgsql drivers.

Also don't require a person to be logged in if their setup is so
screwed they can't even connect to a database...
This commit is contained in:
Andrew McMillan 2010-02-20 13:44:40 +13:00
parent 39aec8c91c
commit 2e6dca26f2

View File

@ -2,32 +2,41 @@
include("../inc/always.php");
include("DAViCalSession.php");
$session->LoginRequired();
include("interactive-page.php");
include("page-header.php");
ob_start( );
phpinfo();
$phpinfo = ob_get_contents( );
ob_end_clean( );
include("AwlQuery.php");
$phpinfo = preg_replace( '{^.*?<body>}s', '', $phpinfo);
$phpinfo = preg_replace( '{</body>.*?$}s', '', $phpinfo);
$loaded_extensions = array_flip(get_loaded_extensions());
/** @TODO: work out something more than true/false returns for dependency checks */
function check_pgsql() {
return function_exists('pg_connect');
}
if ( check_pgsql() ) {
$session->LoginRequired();
}
function check_pdo() {
return class_exists('PDO');
}
function check_pdo_pgsql() {
global $_awl_dbconn;
global $phpinfo, $loaded_extensions;
if ( !class_exists('PDO') ) return false;
if ( !isset($_awl_dbconn) || $_awl_dbconn === false ) _awl_connect_configured_database();
if ( $_awl_dbconn === false ) return false;
/* $version = $_awl_dbconn->GetVersion();
if ( !isset($version) ) return false;*/
return true;
return isset($loaded_extensions['pdo_pgsql']);
}
function check_pgsql() {
return function_exists('pg_connect');
}
include("interactive-page.php");
include("page-header.php");
include("AwlQuery.php");
function check_schema_version() {
global $c;
@ -51,11 +60,11 @@ function check_davical_version() {
$dependencies = array(
'Current DAViCal version '. $c->version_string => 'check_davical_version',
'DAViCal DB Schema version '. implode('.',$c->want_dbversion) => 'check_schema_version',
'PHP PDO module available' => 'check_pdo',
'PDO PostgreSQL divers' => 'check_pdo_pgsql',
'PHP PostgreSQL available' => 'check_pgsql' /*,
translate('Current DAViCal version '). $c->version_string => 'check_davical_version',
translate('DAViCal DB Schema version '). implode('.',$c->want_dbversion) => 'check_schema_version',
translate('PHP PDO module available') => 'check_pdo',
translate('PDO PostgreSQL divers') => 'check_pdo_pgsql',
translate('PHP PostgreSQL available') => 'check_pgsql' /*,
'YAML' => 'php5-syck' */
);
@ -72,6 +81,20 @@ foreach( $dependencies AS $k => $v ) {
$want_dbversion = implode('.',$c->want_dbversion);
$heading_setup = translate('Setup');
$paragraph_setup = translate('Currently this page does very little. Suggestions or patches to make it do more useful stuff will be gratefully received.');
$heading_versions = translate('Current Versions');
$paragraph_versions = translate('You are currently running DAViCal version %s. The database schema should be at version %s and it is at version %s.');
$paragraph_versions = sprintf( $paragraph_versions, $c->version_string, $want_dbversion, $c->schema_major.$c->schema_minor.$c->schema_patch);
$heading_dependencies = translate('Dependencies');
$th_dependency = translate('Dependency');
$th_status = translate('Status');
$heading_config_clients = translate('Configuring Calendar Clients for DAViCal');
$heading_config_davical = translate('Configuring DAViCal');
echo <<<EOBODY
<style>
tr.dep_ok {
@ -95,34 +118,56 @@ p {
}
</style>
<h1>Setup</h1>
<p>Currently this page does very little. Suggestions or patches to make it do something
useful will be gratefully received.
<h1>$heading_setup</h1>
<p>$paragraph_setup
<h2>Current Versions</h2>
<p>You are currently running DAViCal version $c->version_string.
The database schema should be at version $want_dbversion and it is at version $c->schema_major.$c->schema_minor.$c->schema_patch.
<h2>$heading_versions</h2>
<p>$paragraph_versions
<br>&nbsp;
</p>
<h2>Dependencies</h2>
<h2>$heading_dependencies</h2>
<p>
<table class="dependencies">
<tr>
<th>Dependency</th>
<th>Status</th>
<th>$th_dependency</th>
<th>$th_status</th>
</tr>
$dependencies_table
</table>
<br>&nbsp;
</p>
<h2>Configuring Calendar Clients for DAViCal</h2>
<script language="javascript">
function toggle_visible() {
var argv = toggle_visible.arguments;
var argc = argv.length;
var fld_checkbox = document.getElementById(argv[0]);
if ( argc < 2 ) {
return;
}
for (var i = 1; i < argc; i++) {
var block_id = argv[i].substr(1);
var block_logical = argv[i].substr(0,1);
var b = document.getElementById(block_id);
if ( block_logical == '!' )
b.style.display = (fld_checkbox.checked ? 'none' : '');
else
b.style.display = (!fld_checkbox.checked ? 'none' : '');
}
}
</script><p><label>Show phpinfo() output:<input type="checkbox" value="1" id="fld_show_phpinfo" onclick="toggle_visible('fld_show_phpinfo','=phpinfo')"></label></p>
<div style="display:none" id="phpinfo">$phpinfo</div>
<h2>$heading_config_clients</h2>
<p>The <a href="http://rscds.sourceforge.net/clients.php">DAViCal client setup page on sourceforge</a> have information on how
to configure Evolution, Sunbird, Lightning and Mulberry to use remotely hosted calendars.</p>
<p>The administrative interface has no facility for viewing or modifying calendar data.</p>
<h2>Configuring DAViCal</h2>
<h2>$heading_config_davical</h2>
<p>If you can read this then things must be mostly working already.</p>
<p>The <a href="http://rscds.sourceforge.net/installation.php">DAViCal installation page</a> on sourceforge has
some further information on how to install and configure this application.</p>