Exemplo n.º 1
0
 function output()
 {
     global $db, $php_start, $main, $vars;
     if ($this->hide) {
         return;
     }
     $this->tpl['php_time'] = getmicrotime() - $php_start;
     $this->tpl['mysql_time'] = $db->total_time;
     if (isset($main->userdata->privileges['admin']) && $main->userdata->privileges['admin'] === TRUE && $vars['debug']['enabled'] == TRUE) {
         $this->tpl['debug_mysql'] = ROOT_PATH . "debug/mysql.php?" . get_qs();
     }
     return template($this->tpl, __FILE__);
 }
Exemplo n.º 2
0
 function table($table, $template = 'constructors/table.tpl')
 {
     global $smarty;
     if (substr(strrchr($template, "."), 1) != "tpl") {
         $path_parts = pathinfo($template);
         $tpl_file = 'includes' . substr($path_parts['dirname'], strpos($path_parts['dirname'], 'includes') + 8) . "/" . basename($path_parts['basename'], '.' . $path_parts['extension']) . '_' . $table->info['TABLE_NAME'] . '.tpl';
         if (file_exists($smarty->template_dir . $tpl_file)) {
             $template = $tpl_file;
         } else {
             $template = 'constructors/table.tpl';
         }
     }
     return template(array("data" => $table->data, "extra_data" => $table->info, "hidden_qs" => get_qs()), $template);
 }
Exemplo n.º 3
0
 function output()
 {
     global $main, $db, $geocalc, $srtm;
     $main->header->hide = TRUE;
     $main->menu->hide = TRUE;
     $main->footer->hide = TRUE;
     $this->tpl['a_node'] = isset($_POST['a_node']) ? $_POST['a_node'] : get('a_node');
     if ($this->tpl['a_node'] != '') {
         $a_node_data = $db->get('id, name, latitude, longitude, elevation', 'nodes', "id = '" . $this->tpl['a_node'] . "'");
         $a_node_data = $a_node_data[0];
         $this->tpl['a_node_output'] = $a_node_data['name'] . ' (#' . $a_node_data['id'] . ')';
     }
     $this->tpl['b_node'] = isset($_POST['b_node']) ? $_POST['b_node'] : get('b_node');
     if ($this->tpl['b_node'] != '') {
         $b_node_data = $db->get('id, name, latitude, longitude, elevation', 'nodes', "id = '" . $this->tpl['b_node'] . "'");
         $b_node_data = $b_node_data[0];
         $this->tpl['b_node_output'] = $b_node_data['name'] . ' (#' . $b_node_data['id'] . ')';
     }
     if ($this->tpl['a_node'] != '' && $this->tpl['b_node'] != '') {
         $this->tpl['a_node_azimuth'] = $geocalc->GCAzimuth($a_node_data['latitude'], $a_node_data['longitude'], $b_node_data['latitude'], $b_node_data['longitude']);
         $this->tpl['b_node_azimuth'] = $geocalc->GCAzimuth($b_node_data['latitude'], $b_node_data['longitude'], $a_node_data['latitude'], $a_node_data['longitude']);
         $this->tpl['a_node_geo_elevation'] = $srtm->get_elevation($a_node_data['latitude'], $a_node_data['longitude']);
         $this->tpl['b_node_geo_elevation'] = $srtm->get_elevation($b_node_data['latitude'], $b_node_data['longitude']);
         $this->tpl['a_node_elevation'] = $a_node_data['elevation'];
         $this->tpl['b_node_elevation'] = $b_node_data['elevation'];
         $a_node_total_elevation = $this->tpl['a_node_geo_elevation'] + $this->tpl['a_node_elevation'];
         $b_node_total_elevation = $this->tpl['b_node_geo_elevation'] + $this->tpl['b_node_elevation'];
         $this->tpl['distance'] = $geocalc->GCDistance($a_node_data['latitude'], $a_node_data['longitude'], $b_node_data['latitude'], $b_node_data['longitude']);
         $this->tpl['a_node_tilt'] = rad2deg(atan(($b_node_total_elevation - $a_node_total_elevation) / ($this->tpl['distance'] * 1000)));
         $this->tpl['b_node_tilt'] = rad2deg(atan(($a_node_total_elevation - $b_node_total_elevation) / ($this->tpl['distance'] * 1000)));
         $this->tpl['distance'] = sqrt(pow($this->tpl['distance'] * 1000, 2) + pow(abs($a_node_total_elevation - $b_node_total_elevation), 2)) / 1000;
         $this->tpl['gearth'] = makelink(array("page" => "gearth", "subpage" => "download", "node" => get('a_node'), "node2" => get('b_node'), "show_p2p" => "1", "show_aps" => "1", "show_clients" => "1", "show_unlinked" => "1", "show_links_p2p" => "1", "show_links_client" => "1"));
         $this->tpl['frequency'] = isset($_POST['frequency']) ? (int) $_POST['frequency'] : null;
         if ($this->tpl['frequency'] <= 0) {
             $this->tpl['frequency'] = 2450;
         }
         $frequency = $this->tpl['frequency'] * 1000000;
         $c = 299792.458;
         // light speed in km
         $this->tpl['fsl'] = 20 * log10(4 * pi() * $this->tpl['distance'] * ($frequency / $c));
         $this->tpl['plot_image'] = makelink(array("page" => "nodes", "subpage" => "plot", "a_node" => $this->tpl['a_node'], "b_node" => $this->tpl['b_node'], "frequency" => isset($_POST['frequency']) ? $_POST['frequency'] : null));
     }
     $this->tpl['hidden_qs'] = get_qs();
     return template($this->tpl, __FILE__);
 }
Exemplo n.º 4
0
function makelink($extra = "", $cur_qs = FALSE, $cur_gs_vars = TRUE, $htmlspecialchars = TRUE)
{
    global $qs_vars;
    $o = array();
    if (get('show_map') == "no") {
        $o = array_merge_check($o, array("show_map" => "no"));
    }
    if ($cur_qs == TRUE) {
        parse_str(get_qs(), $qs);
        $o = array_merge_check(isset($o) ? $o : null, isset($qs) ? $qs : null);
    }
    if ($cur_gs_vars == TRUE) {
        $o = array_merge_check(isset($o) ? $o : null, isset($qs_vars) ? $qs_vars : null);
    }
    $o = array_merge_check(isset($o) ? $o : null, isset($extra) ? $extra : null);
    return $htmlspecialchars ? htmlspecialchars('?' . query_str($o)) : '?' . query_str($o);
}
Exemplo n.º 5
0
    }
    return $qs;
}
foreach ($_POST as $key => $value) {
    ${$key} = $value;
}
$TBK_MONTO = $TBK_MONTO / 100;
$authorization_code = "";
$success = false;
$url = getenv("ORDER_URL") . $TBK_ORDEN_COMPRA;
$headers = array("Content-Type" => "application/json");
$response = Requests::get($url);
if ($response->success) {
    $order = json_decode($response->body, true);
    $status = 0;
    $qs = get_qs();
    $payment_type = null;
    $number_quotas = null;
    $TBK_CODIGO_AUTORIZACION = isset($TBK_CODIGO_AUTORIZACION) ? $TBK_CODIGO_AUTORIZACION : "";
    if ($TBK_RESPUESTA == "0") {
        if (valid_mac($qs, $TBK_ORDEN_COMPRA) && $order["status"] == 0 && !in_array($TBK_CODIGO_AUTORIZACION, array("000000", ""))) {
            $authorization_code = isset($order["authorization_code"]) ? $order["authorization_code"] : "";
            if ($order["amount"] == $TBK_MONTO && $authorization_code == "") {
                $authorization_code = $TBK_CODIGO_AUTORIZACION;
                $status = 1;
                $payment_type = $TBK_TIPO_PAGO;
                $number_quotas = (int) $TBK_NUMERO_CUOTAS;
                $success = true;
            } else {
                $status = 4;
            }