示例#1
0
function list_transactions()
{
    global $xtpl;
    global $db;
    if ($_SESSION["is_admin"]) {
        $sql = 'SELECT * FROM transactions
		LEFT JOIN members
		ON transactions.t_m_id = members.m_id
		LEFT JOIN servers
		ON transactions.t_server = servers.server_id
		ORDER BY transactions.t_id DESC LIMIT 10';
    } else {
        $sql = 'SELECT * FROM transactions
		LEFT JOIN members
		ON transactions.t_m_id = members.m_id
		LEFT JOIN servers
		ON transactions.t_server = servers.server_id
		WHERE members.m_id = "' . $db->check($_SESSION["member"]["m_id"]) . '"
		ORDER BY transactions.t_id DESC LIMIT 10';
    }
    if ($result = $db->query($sql)) {
        while ($t = $db->fetch_array($result)) {
            if ($t['t_done'] == 0) {
                $status = 'pending';
            }
            if ($t['t_done'] == 1 && $t['t_success'] == 0) {
                $status = 'error';
            }
            if ($t['t_done'] == 1 && $t['t_success'] == 1) {
                $status = 'ok';
            }
            $xtpl->transaction($t['t_id'], $t["server_name"] == "" ? "---" : $t["server_name"], $t["t_vps"] == 0 ? "---" : $t["t_vps"], transaction_label($t['t_type']), $status);
        }
    }
    $xtpl->transactions_out();
}
示例#2
0
    $xtpl->table_add_category(strtoupper(_("done")));
    $xtpl->table_add_category(strtoupper(_("ok?")));
    $sql = 'SELECT * FROM transactions
	    LEFT JOIN members
	    ON transactions.t_m_id = members.m_id
	    LEFT JOIN servers
	    ON transactions.t_server = servers.server_id
	    ORDER BY transactions.t_id DESC LIMIT ' . $_GET["page_number"] * $cfg_transactions["per_page"] * 1 . ',' . $cfg_transactions["per_page"] . ';';
    if ($result = $db->query($sql)) {
        while ($t = $db->fetch_array($result)) {
            $xtpl->table_td($t["t_id"]);
            $xtpl->table_td(strftime("%Y-%m-%d %H:%M", $t["t_time"]));
            $xtpl->table_td($t["m_nick"]);
            $xtpl->table_td($t["server_name"] == "" ? _("--Every--") : $t["server_name"]);
            $xtpl->table_td($t["t_vps"] == 0 ? _("--Every--") : $t["t_vps"]);
            $xtpl->table_td(transaction_label($t["t_type"]));
            $xtpl->table_td($t["t_done"]);
            $xtpl->table_td($t["t_success"]);
            if ($t["t_done"] == 1 && $t["t_success"] == 1) {
                $xtpl->table_tr(false, 'ok');
            } elseif ($t["t_done"] == 1 && $t["t_success"] == 0) {
                $xtpl->table_tr(false, 'error');
            } elseif ($t["t_done"] == 0 && $t["t_success"] == 0) {
                $xtpl->table_tr(false, 'pending');
            } else {
                $xtpl->table_tr();
            }
        }
    }
    $xtpl->table_end(gen_pages_listing($_GET["page_number"], $pages, $cfg_transactions["max_offset_listing"]));
    $xtpl->table_out();
示例#3
0
 $s = $db->findByColumnOnce("servers", "server_id", $t["t_server"]);
 if ($_SESSION["is_admin"]) {
     $xtpl->table_td('<a href="?page=transactions&filter=yes&details=1&id=' . $t["t_id"] . '">' . $t["t_id"] . '</a>');
 } else {
     $xtpl->table_td($t["t_id"]);
 }
 $xtpl->table_td(strftime("%Y-%m-%d %H:%M", $t["t_time"]));
 $xtpl->table_td(format_duration($t["t_end"] ? $t["t_end"] - $t["t_time"] : 0), false, true);
 $xtpl->table_td(format_duration($t["t_end"] - $t["t_real_start"]), false, true);
 $xtpl->table_td("{$m["m_id"]} {$m["m_nick"]}");
 $xtpl->table_td($s ? "{$s["server_id"]} {$s["server_name"]}" : '---');
 $xtpl->table_td($t["t_vps"] == 0 ? _("--Every--") : "<a href='?page=adminvps&action=info&veid={$t["t_vps"]}'>{$t["t_vps"]}</a>");
 if ($_SESSION["is_admin"]) {
     $xtpl->table_td('<a href="?page=transactions&filter=yes&details=1&type=' . $t["t_type"] . '">' . $t["t_type"] . '</a>' . ' ' . transaction_label($t["t_type"]));
 } else {
     $xtpl->table_td("{$t["t_type"]}" . ' ' . transaction_label($t["t_type"]));
 }
 $xtpl->table_td('<a href="?page=transactions&filter=yes&details=1&id=' . $t["t_depends_on"] . '">' . $t["t_depends_on"] . '</a>');
 $xtpl->table_td($t["t_done"]);
 $xtpl->table_td($t["t_success"]);
 if ($_SESSION["is_admin"] && !$t["t_success"]) {
     $xtpl->table_td('<a href="?page=transactions&action=redo&id=' . $t["t_id"] . '"><img src="template/icons/vps_restart.png"  title="' . _("Redo transaction") . '"/></a>');
 }
 if ($t["t_done"] == 1 && $t["t_success"] == 1) {
     $xtpl->table_tr(false, 'ok');
 } else {
     if ($t["t_done"] == 1 && $t["t_success"] == 0) {
         $xtpl->table_tr(false, 'error');
     } else {
         if ($t["t_done"] == 1 && $t["t_success"] == 2) {
             $xtpl->table_tr(false, 'warning');