function my_show_message($msg)
{
    my_header();
    printf('<p class="msg">%s</p>', $msg);
    my_footer();
    exit;
}
示例#2
0
function form($head, $message, $help = "")
{
    global $gm, $gd, $gy, $hm, $hd, $hy, $hmstr_to_hebcal;
    if ($message && isset($_GET["cfg"])) {
        header("HTTP/1.1 400 Bad Request");
        if ($_GET["cfg"] == "json") {
            header("Content-Type: application/json; charset=UTF-8");
            $arr = array("error" => $message);
            echo json_encode($arr, 0);
            exit;
        } elseif ($_GET["cfg"] == "xml") {
            header("Content-Type: text/xml; charset=UTF-8");
            echo "<?xml version=\"1.0\" ?>\n<error message=\"{$message}\" />\n";
            exit;
        }
    }
    if ($head) {
        my_header($message);
    }
    if ($message) {
        ?>
<div class="alert alert-danger alert-dismissible" role="alert">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  <?php 
        echo $message;
        echo $help;
        ?>
</div><!-- .alert -->
<?php 
    }
    $action = $_SERVER["PHP_SELF"];
    $pos = strpos($action, "index.php");
    if ($pos !== false) {
        $action = substr($action, 0, $pos);
    }
    ?>
<div id="converter-form" class="hidden-print">
<div class="row">
<div class="col-sm-6">
<h5>Convert from Gregorian to Hebrew date</h5>
<form class="form-inline" action="<?php 
    echo $action;
    ?>
">
<div class="form-group">
<input type="text" class="form-control" style="width:48px" name="gd" placeholder="day" value="<?php 
    echo $gd;
    ?>
" size="2" maxlength="2" id="gd" pattern="\d*">
<?php 
    global $MoY_long;
    echo html_form_select("gm", $MoY_long, $gm, 0, "", false, 'class="form-control" style="width:120px"');
    ?>
<input type="text" class="form-control" style="width:66px" name="gy" placeholder="year" value="<?php 
    echo $gy;
    ?>
" size="4" maxlength="4" id="gy" pattern="\d*">
</div><!-- .form-group -->
<div class="clearfix">
<div class="checkbox">
<label class="checkbox" for="gs"><input type="checkbox" name="gs" value="on" id="gs">
After sunset</label>
</div><!-- .checkbox -->
</div><!-- .clearfix -->
<div class="form-group">
<button name="g2h" type="submit" value="1" class="btn btn-primary"><i class="glyphicon glyphicon-refresh"></i> Convert to Hebrew</button>
</div><!-- .form-group -->
</form>
</div><!-- .col-sm-6 -->

<div class="col-sm-6">
<h5>Convert from Hebrew to Gregorian date</h5>
<form class="form-inline" action="<?php 
    echo $action;
    ?>
">
<div class="form-group">
<input type="text" class="form-control" style="width:48px" name="hd" placeholder="day" value="<?php 
    echo $hd;
    ?>
" size="2" maxlength="2" id="hd" pattern="\d*">
<?php 
    echo html_form_select("hm", $hmstr_to_hebcal, $hm, 0, "", false, 'class="form-control" style="width:120px"');
    ?>
<input type="text" class="form-control" style="width:66px" name="hy" placeholder="year" value="<?php 
    echo $hy;
    ?>
" size="4" maxlength="4" id="hy" pattern="\d*">
</div><!-- .form-group -->
<div class="clearfix">
<div class="form-group">
<button name="h2g" type="submit" value="1" class="btn btn-primary"><i class="glyphicon glyphicon-refresh"></i> Convert to Gregorian</button>
</div><!-- .form-group -->
</div><!-- .clearfix -->
</form>
</div><!-- .col-sm-6 -->
</div><!-- .row -->
</div><!-- #converter-form -->
<?php 
    my_footer();
    exit;
}