Example #1
0
 /**
  * void query(Query $query, bool $goOut = true)
  *
  * Displays the query error page
  *
  * @param Query $query Query object containing query error parameters.
  * @param bool $goOut if true, execute an exit()
  * @return void
  * @access public
  */
 public static function query($query, $goOut = true)
 {
     self::message($query->getError() . " " . $query->getDbErrno() . " - " . $query->getDbError() . "." . $query->getSQL());
     if (defined("OPEN_DEBUG") && OPEN_DEBUG) {
         echo PHP_EOL . "<!-- _dbErrno = " . $query->getDbErrno() . "-->" . PHP_EOL;
         echo "<!-- _dbError = " . $query->getDbError() . "-->" . PHP_EOL;
         if ($query->getSQL() != "") {
             echo "<!-- _SQL = " . $query->getSQL() . "-->" . PHP_EOL;
         }
     }
     if ($query->getDbErrno() == 1049) {
         echo '<p><a href="../install.html">' . "Install instructions" . '</a></p>' . PHP_EOL;
     }
     if ($goOut) {
         exit($query->getError());
     }
 }
Example #2
0
    $body = array();
    $body[] = Form::textArea("sql_query", $sqlQuery, array('rows' => 15, 'cols' => 75, 'readonly' => true));
    $foot = array(Form::button("install_file", _("Install file")) . Form::generateToken());
    echo Form::fieldset(_("Install file"), $body, $foot);
    echo HTML::end('form');
    echo HTML::para(HTML::link(_("Cancel"), './index.php'));
    include_once "../layout/footer.php";
    exit;
}
// end if
require_once "../model/Query.php";
$installQ = new Query();
$installQ->captureError(true);
if ($installQ->isError()) {
    echo HTML::para(_("The connection to the database failed with the following error:"));
    echo Msg::error($installQ->getDbError());
    echo HTML::rule();
    echo HTML::para(_("Please make sure the following has been done before running this install script."));
    $array = array(sprintf(_("Create OpenClinic database (%s of the install instructions)"), HTML::link(sprintf(_("step %d"), 4), '../install.html#step4')), sprintf(_("Create OpenClinic database user (%s of the install instructions)"), HTML::link(sprintf(_("step %d"), 5), '../install.html#step5')), sprintf(_("Update %s with your new database username and password (%s of the install instructions)"), HTML::tag('strong', 'openclinic/config/database_constants.php'), HTML::link(sprintf(_("step %d"), 8), '../install.html#step8')));
    echo HTML::itemList($array, null, true);
    echo HTML::para(sprintf(_("See %s for more details."), HTML::link(_("Install Instructions"), '../install.html')));
    include_once "../layout/footer.php";
    exit;
}
// end if
$installQ->close();
echo Msg::info(_("Database connection is good."));
echo HTML::start('form', array('method' => 'post', 'action' => $_SERVER['PHP_SELF'], 'enctype' => 'multipart/form-data'));
$body = array();
$body[] = Form::file("sql_file", null, array('size' => 50));
$foot = array(Form::button("view_file", _("View file")));