Example #1
0
function get_active_theme()
{
    $theme_name = "";
    // Get a name of the active theme.
    $sql = "SELECT t.theme_name FROM theme t JOIN settings s WHERE t.themeid = s.themeid";
    $q = new Query();
    $q->connect();
    $rows = $q->exec($sql);
    if (count($rows) > 0) {
        $theme_name = $rows[0]["theme_name"];
    }
    $q->close();
    // Check theme directory existence.
    $theme = "../themes/" . $theme_name;
    if (file_exists($theme . "/style.css")) {
        return $theme_name;
    } else {
        return "";
    }
}
$mbrClassifyDm = $dmQ->getAssoc('mbr_classify_dm');
$mbrStatusDm = array("y" => $loc->getText("mbrActive"), "n" => $loc->getText("mbrInactive"));
$customFields = $dmQ->getAssoc('member_fields_dm');
$dmQ->close();
// Get & show the latest BarcodeNumber.
require_once "../shared/common.php";
require_once "../classes/Query.php";
$barcode = "0";
$sql = "SELECT MAX(barcode_nmbr) AS bn FROM member";
$q = new Query();
$q->connect();
$rows = $q->exec($sql);
if (count($rows) > 0) {
    $barcode = $rows[0]["bn"];
}
$q->close();
$barcode_help = $loc->getText("mbrLatestBarcode") . ": " . $barcode . " <br />";
$barcode_help .= '<input type="checkbox" id="chk_auto_barcode" name="chk_auto_barcode" value="1" /> ' . $loc->getText("mbrAutoBarcode");
$fields = array("mbrFldsClassify" => inputField('select', "classification", $mbr->getClassification(), NULL, $mbrClassifyDm), "mbrFldsStatus" => inputField('select', "status", $mbr->getStatus(), NULL, $mbrStatusDm), "mbrFldsCardNmbr" => inputField('text', "barcodeNmbr", $mbr->getBarcodeNmbr(), NULL, NULL, $barcode_help), "mbrFldsLastName" => inputField('text', "lastName", $mbr->getLastName()), "mbrFldsFirstName" => inputField('text', "firstName", $mbr->getFirstName()), "mbrFldsHomePhone" => inputField('text', "homePhone", $mbr->getHomePhone()), "mbrFldsWorkPhone" => inputField('text', "workPhone", $mbr->getWorkPhone()), "mbrFldsCel" => inputField('text', "cel", $mbr->getCel()), "mbrFldsEmail" => inputField('text', "email", $mbr->getEmail()), "mbrFldsFoto" => inputField('text', "foto", $mbr->getFoto()), "MailingAddress:" => inputField('textarea', "address", $mbr->getAddress()), "mbrFldsPassUser" => inputField('text', "passUser", $mbr->getPassUser()), "mbrFldsBornDt" => inputField('text', "bornDt", $mbr->getBornDt()), "mbrFldsOther" => inputField('textarea', "other", $mbr->getOther()));
foreach ($customFields as $name => $title) {
    $fields[$title . ':'] = inputField('text', 'custom_' . $name, $mbr->getCustom($name));
}
?>

<table class="primary">
  <tr>
    <th colspan="2" valign="top" nowrap="yes" align="left">
      <?php 
echo H($headerWording);
?>
 <?php 
Example #3
0
    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")));
echo Form::fieldset(_("Install a SQL file"), $body, $foot);
echo HTML::end('form');
require_once "../layout/footer.php";
Example #4
0
/**
 * bool parseSql(string $text)
 *
 * Parses a SQL text
 *
 * @param string $text sentences to parse
 * @return bool false if an error occurs
 * @access public
 * @since 0.8
 */
function parseSql($text)
{
    $controlledErrors = array(1060, 1091);
    $installQ = new Query();
    $installQ->captureError(true);
    /**
     * reading through SQL text executing SQL only when ";" is encountered and if is out of brackets
     */
    $count = strlen($text);
    $sqlSentence = "";
    $outBracket = true;
    for ($i = 0; $i < $count; $i++) {
        $char = $text[$i];
        if ($char == "(") {
            $outBracket = false;
        }
        if ($char == ")") {
            $outBracket = true;
        }
        if ($char == ";" && $outBracket) {
            $result = $installQ->exec($sqlSentence);
            if ($installQ->isError() && !in_array($installQ->getDbErrno(), $controlledErrors)) {
                echo HTML::para(sprintf(_("Process sql [%s]"), $sqlSentence));
                $installQ->close();
                Error::query($installQ, false);
                echo Msg::error(sprintf(_("Error: %s"), $installQ->getDbError()));
                return false;
            }
            $sqlSentence = "";
        } else {
            $sqlSentence .= $char;
        }
    }
    $installQ->close();
    return true;
}