Exemplo n.º 1
0
require_once 'common.php';
if (!($user_info = $poker->isLoggedin())) {
    no_auth_handler(_get_string('name'), $_SERVER['REQUEST_URI']);
}
if (_post_string('submit')) {
    try {
        $amount = _post_string('amount');
        if (!is_numeric($amount)) {
            throw new Exception("amount must be numeric");
        }
        if ($amount == '' or $amount < 0) {
            throw new Exception("amount must be greater than zero");
        }
        $amount *= 100;
        $currency_one_public = ereg("^http", _cst_currency_one_public) ? _cst_currency_one_public : dirname(_me()) . "/" . _cst_currency_one_public;
        $currency_one_private = ereg("^http", _cst_currency_one_private) ? _cst_currency_one_private : dirname(_me()) . "/" . _cst_currency_one_private;
        if (isset($_POST['currency']) && $_POST['currency'] != '') {
            $currency = $_POST['currency'];
        }
        $packet = $poker->cashOut($currency_one_private, $amount, $currency);
        $poker->cashOutCommit($packet['name']);
        $url = $currency_one_public . "?command=put_note&serial=" . $packet['bserial'] . "&name=" . $packet['name'] . "&value=" . $packet['value'];
        if (isset($currency)) {
            $url .= "&id=" . $currency;
        }
        $handle = fopen($url, "r");
        if (!$handle) {
            throw new Exception($currency_one_public . " request failed, check the server logs");
        }
        $lines = array();
        while ($line = fgets($handle)) {
Exemplo n.º 2
0
    public static function start()
    {
        global $USER, $LINK, $OUTPUT;
        ?>
<div class="modal fade" id="settings">
  <div class="modal-dialog">
    <div class="modal-content">
      <?php 
        if ($USER->instructor) {
            ?>
      <form id="settings_form" method="POST">
      <?php 
        }
        ?>
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title"><?php 
        _me('Configure');
        ?>
        <?php 
        echo htmlent_utf8($LINK->title);
        ?>
        </h4>
      </div><!-- / .modal-header -->
      <div class="modal-body">
        <img id="settings_spinner" src="<?php 
        echo $OUTPUT->getSpinnerUrl();
        ?>
" style="display: none">
        <span id="save_fail" style="display:none; color:red"><?php 
        _me('Unable to save settings');
        ?>
</span>
        </p>
            <?php 
        if ($USER->instructor) {
            ?>
            <input type="hidden" name="settings_internal_post" value="1"/>
            <?php 
        }
    }