<?php
// QuickTalk 2.5.1 build:20100810
// --------
// HTML start
// --------
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" xml:lang="en" lang="en">
<head>
<title>QuickTalk installation checker</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<link rel="stylesheet" href="admin/qtg.css">
<style type="text/css">
p.check {margin:5px 0 0 0; padding:0}
p.endcheck {margin:5px 0; padding:5px; border:solid 1px #aaaaaa}
span.ok {color:#00aa00; background-color:inherit}
span.nok {color:#ff0000; background-color:inherit}
div.footer_copy {width:100%; text-align:right}
a.footer_copy {color:blue; background-color:inherit; font-size:8pt}
</style>
</head>';
echo '<body>
<!-- PAGE CONTROL -->
<div class="qtg_page">
<table class="qtg_page" width="550" cellspacing="0" style="margin:5px">
<tr class="qtg_page">
<td class="qtg_page">
<!-- PAGE CONTROL -->
<!-- HEADER BANNER -->
<div style="background:url(admin/bg_btop_c.gif) repeat-x;">
<img src="admin/qtg_logo.gif" width="175" height="50" style="border-width:0" alt="QuickTalk" title="QuickTalk"/>
</div>
<!-- END HEADER BANNER -->
<!-- BODY MAIN -->
<table width="100%" cellspacing="0" style="border:1px solid #156AC2;">
<tr>
<td style="padding:5px 10px 5px 10px;">
<!-- BODY MAIN -->
';
// --------
// 1 CONFIG
// --------
echo '<h1>Checking your configuration</h1>';
$error = '';
// 1 file exist
echo '<p class="check">Checking installed files... ';
if ( !file_exists('bin/config.php') ) $error .= 'File <b>config.php</b> is not in the <b>bin</b> directory. Communication with database is impossible.<br/>';
if ( !file_exists('bin/qt_lib_db.php') ) $error .= 'File <b>qt_lib_db.php</b> is not in the <b>bin</b> directory. Application cannot start.<br/>';
if ( !file_exists('bin/qt_lib_txt.php') ) $error .= 'File <b>qt_lib_txt.php</b> is not in the <b>bin</b> directory. Application cannot start.<br/>';
if ( !file_exists('bin/qtg_init.php') ) $error .= 'File <b>qtg_init.php</b> is not in the <b>bin</b> directory. Application cannot start.<br/>';
if ( !empty($error) ) die($error);
if ( empty($error) )
{
echo '<span class="ok">Main files found.</span></p>';
}
else
{
die('<span class="nok">'.$error.'</span></p>');
}
// 2 config is correct
echo '<p class="check">Checking config.php... ';
include('bin/config.php');
if ( !isset($qtg_dbsystem) ) $error .= 'Variable <b>$qtg_dbsystem</b> is not defined in the file <b>bin/config.php</b>. Communication with database is impossible.<br/>';
if ( !isset($qtg_host) ) $error .= 'Variable <b>$qtg_host</b> is not defined in the file <b>bin/config.php</b>. Communication with database is impossible.<br/>';
if ( !isset($qtg_database) ) $error .= 'Variable <b>$qtg_database</b> is not defined in the file <b>bin/config.php</b>. Communication with database is impossible.<br/>';
if ( !isset($qtg_prefix) ) $error .= 'Variable <b>$qtg_prefix</b> is not defined in the file <b>bin/config.php</b>. Communication with database is impossible.<br/>';
if ( !isset($qtg_user) ) $error .= 'Variable <b>$qtg_user</b> is not defined in the file <b>bin/config.php</b>. Communication with database is impossible.<br/>';
if ( !isset($qtg_pwd) ) $error .= 'Variable <b>$qtg_pwd</b> is not defined in the file <b>bin/config.php</b>. Communication with database is impossible.<br/>';
if ( !isset($qtg_port) ) $error .= 'Variable <b>$qtg_port</b> is not defined in the file <b>bin/config.php</b>. Communication with database is impossible.<br/>';
if ( !isset($qtg_dsn) ) $error .= 'Variable <b>$qtg_dsn</b> is not defined in the file <b>bin/config.php</b>. Communication with database is impossible.<br/>';
if ( !empty($error) ) die($error);
// check db type
if ( !in_array($qtg_dbsystem,array('file','mysql4','mysql','mssql','pg','ibase','sqlite','db2','oci')) ) die('Unknown db type '.$qtg_dbsystem);
// check other values
if ( $qtg_dbsystem!=file && empty($qtg_database) ) $error .= 'Variable <b>$qtg_database</b> is not defined in the file <b>bin/config.php</b>. Communication with database is impossible.<br/>';
if ( !empty($error) ) die($error);
echo '<span class="ok">Done.</span><br/>';
// 3 test db connection
if ( $qtg_dbsystem=='file' )
{
include('bin/qt_lib_txt.php');
echo '<p class="check">Accessing the repository ['.$qtg_host.'data] ...';
if ( empty($error) ) { if ( !file_exists($qtg_host.'data') ) die ('<p style="color:red">Missing directory [data]. You must first create this directory and make it writable.</p>'); }
if ( empty($error) ) { if ( !is_dir($qtg_host.'data') ) die ('<p style="color:red">Missing directory [data]. You must first create this directory and make it writable.</p>'); }
if ( empty($error) ) { if ( !is_writable($qtg_host.'data') ) die ('<p style="color:red">The directory [data] is locked. You must first make it writable.</p>'); }
echo '<span class="ok">Done.</span></p>';
}
else
{
echo '<p class="check">Connecting to database... ';
include('bin/qt_lib_db.php');
include('bin/qt_lib_txt.php');
$oDB = new cDB($qtg_dbsystem,$qtg_host,$qtg_database,$qtg_user,$qtg_pwd,$qtg_port,$qtg_dsn);
if ( !empty($oDB->error) ) die ('<p style="color:red">Connection with database failed.<br/>Check that server is up and running.<br/>Check that the settings in the file <b>bin/config.php</b> are correct for your database.</p>');
echo '<span class="ok">Done.</span></p>';
}
if ( !empty($error) )
{
die('<span class="nok">'.$error.'</span></p>');
}
echo '<p class="endcheck">Configuration tests completed successfully.</p>';
// --------
// 2 DATABASE
// --------
$error = '';
if ( $qtg_dbsystem!='file' )
{
echo '<h1>Checking your database</h1>';
// 1 message table
echo '<p class="check">Checking message table... ';
$oDB->Query('SELECT count(id) as countid FROM '.$qtg_prefix.'qtgmessage WHERE id>=0');
if ( !empty($oDB->error) ) die("<br/><font color=red>Problem with table ".$qtg_prefix."qtgmessage</font>");
$row = $oDB->Getrow();
$intCount = $row['countid'];
echo '<span class="ok">Table [',$qtg_prefix,'qtgmessage] exists.</span> ',$intCount,' messages found. ';
// search version
$strVersion='unknown';
$oDB->Query( 'SELECT name FROM '.$qtg_prefix.'qtgmessage WHERE id=-1');
$row = $oDB->Getrow();
if ( isset($row['name']) ) { if ( $row['name']=='2.0' ) $strVersion='2.0'; }
echo 'Database version: ',$strVersion,'.</span></p>';
echo '<p class="endcheck">Database tests completed successfully.</p>';
}
// --------
// 3 LANGUAGE AND SKIN
// --------
$error = '';
echo '<h1>Checking language and skin options</h1>';
echo '<p class="check">Files... ';
include('bin/config_display.php');
if ( empty($qtg_language) ) $error .= 'Setting <b>language</b> is not defined in the setting table. Application can only work with english.<br/>';
if ( !file_exists("language/$qtg_language/qtg_main.php") ) $error .= "File <b>qtg_main.php</b> is not in the <b>language/$qtg_language</b> directory.<br/>";
if ( !file_exists("language/$qtg_language/qtg_adm.php") ) $error .= "File <b>qtg_adm.php</b> is not in the <b>language/$qtg_language</b> directory.<br/>";
if ( !file_exists("language/$qtg_language/qtg_cntry.php") ) $error .= "File <b>qtg_cntry.php</b> is not in the <b>language/$qtg_language</b> directory.<br/>";
if ( !file_exists("language/english/qtg_main.php") ) $error .= "File <b>qtg_main.php</b> is not in the <b>language/english</b> directory. English language is mandatory.<br/>";
if ( !file_exists("language/english/qtg_adm.php") ) $error .= "File <b>qtg_adm.php</b> is not in the <b>language/english</b> directory. English language is mandatory.<br/>";
if ( !file_exists("language/english/qtg_cntry.php") ) $error .= "File <b>qtg_cntry.php</b> is not in the <b>language/english</b> directory. English language is mandatory.<br/>";
if ( empty($qtg_skin) ) $error .= 'Setting <b>skin</b> is not defined in the setting table. Application will not display correctly.<br/>';
if ( !file_exists("skin/$qtg_skin/qtg.css") ) $error .= "File <b>qtg.css</b> is not in the <b>skin/xxxx</b> directory.<br/>";
if ( !file_exists("skin/default/qtg.css") ) $error .= "File <b>qtg.css</b> is not in the <b>skin/default</b> directory. Default skin is mandatory.<br/>";
if ( empty($error) )
{
echo '<span class="ok">Ok.</span>';
}
else
{
echo '<span class="nok">',$error,'</span>';
}
echo '</p>';
// end LANGUAGE AND SKIN tests
echo '<p class="endcheck">Language and skin files tested.</p>';
// --------
// 4 ADMINISTRATION TIPS
// --------
$error = '';
echo '<h1>Administration tips</h1>';
echo '<p class="check">Email setting... ';
if ( empty($qtg_email) )
{
$error .= 'Administrator e-mail is not yet defined. It\'s mandatory to define it!';
}
else
{
if ( !QTismail($qtg_email) ) $error .= 'Administrator e-mail format seams incorrect. Please check it';
}
if ( empty($error) )
{
echo '<span class="ok">Done.</span></p>';
}
else
{
echo '<span class="nok">',$error,'</span></p>';
}
$error = '';
echo '<p class="check">Security check... ';
if ( !QTislogin($qtg_user,2) ) $error .= 'The admin login ['.$qtg_user.'] is not valid. You will have problem to enter the Administration section from the guestbook.<br/>';
if ( !QTislogin($qtg_pwd,2) ) $error .= 'The password of user ['.$qtg_user.'] is not valid. You will have problem to enter the Administration section from the guestbook.<br/>';
if ( !empty($qtg_user_2) )
{
if ( !QTislogin($qtg_user_2,2) ) $error .= 'The admin login ['.$qtg_user_2.'] is not valid. He will have problem to enter the Administration section from the guestbook.<br/>';
if ( !QTislogin($qtg_pwd_2,2) ) $error .= 'The password of user ['.$qtg_user_2.'] is not valid. He will have problem to enter the Administration section from the guestbook.<br/>';
}
if ( !file_exists("language/$qtg_language/qtg_privacy.php") ) $error .= "File <b>qtg_privacy.php</b> is not in the <b>language/$qtg_language</b> directory. It's recommended to define your privacy rules.<br/>";
if ( !file_exists("language/english/qtg_privacy.php") ) $error .= "File <b>qtg_privacy.php</b> is not in the <b>language/english</b> directory. It's recommended to define your privacy rules.<br/>";
if ( empty($error) )
{
echo '<span class="ok">Done.</span></p>';
}
else
{
echo '<span class="nok">',$error,'</span></p>';
}
$error = '';
echo '<p class="endcheck">Administration tips completed.</p>';
// --------
// 5 END
// --------
echo '<h1>Result</h1>';
echo 'The checker did not found blocking issues in your configuration.<br/>';
include('bin/config_stop.php');
if ( !$qtg_actif ) echo 'Your board seams well installed, but is currently off-line.<br/>Log as Administrator and go to the Administration panel to turn your board on-line.<br/>';
echo '<br/><br/><a href="qtg_index.php">Go to the guestbook</a>';
// --------
// HTML END
// --------
echo '<!-- END BODY MAIN -->
</td>
</tr>
</table>
<!-- END BODY MAIN -->
<!-- footer line -->
<p style="margin:2px;text-align:right;font-size:8pt">powered by <a href="http://www.qt-cute.org">QT-cute</a></p>
<!-- END PAGE CONTROL -->
</td>
</tr>
</table>
</div>
<!-- END PAGE CONTROL -->
</body>
</html>';
?>