Example #1
0
require_once "../lib/Form.php";
if (isset($_GET["confirm"]) && $_GET["confirm"] == "yes") {
    Form::compareToken('./index.php');
}
echo HTML::section(1, $title);
/**
 * Testing connection and current version
 */
$setQ = new Query_Setting();
echo Msg::info(_("Database connection is good."));
/**
 * Show warning message if database exists
 */
$setQ->captureError(true);
$setQ->select();
if ($setQ->isError()) {
    echo HTML::para(_("Building OpenClinic tables..."));
} else {
    $set = $setQ->fetch();
    if (!$set) {
        $setQ->close();
        Error::fetch($setQ);
    }
    if (!isset($_GET["confirm"]) || $_GET["confirm"] != "yes") {
        echo HTML::para(sprintf(_("OpenClinic (version %s) is already installed."), $set->getVersion()));
        $setQ->close();
        echo Msg::warning(_("Are you sure you want to delete all clinic data and create new OpenClinic tables?"));
        echo Msg::warning(_("If you continue all data will be lost."));
        // @todo use fieldset
        echo HTML::start('form', array('method' => 'post', 'action' => $_SERVER['PHP_SELF'] . '?confirm=yes'));
        echo HTML::para(Form::button("continue", _("Continue")) . Form::generateToken());