Пример #1
0
function management_view($db)
{
    // Table for management
    $table = <<<EOD
\t<table id='keysTable' class="fancy" style="font-size:83%;" border=1>
\t\t<tr>
\t\t\t<th>
\t\t\t\t<a href="">Name</a>
\t\t\t</th>
\t\t\t<th>
\t\t\t\t<a href="">Type</a>
\t\t\t</th>
\t\t\t<th>
\t\t\t\t<a href="">Characters</a>
\t\t\t</th>
\t\t\t<th>
\t\t\t\t<a href="">Notes</a>
\t\t\t</th>
\t\t</tr>
EOD;
    $apiResults = retrieve_api_keys($db);
    if ($apiResults) {
        $alt_b = false;
        foreach ($apiResults as $row) {
            $alt_b = !$alt_b;
            $rand = rand();
            $name = $row['keyName'];
            $type = $row['type'];
            $Characters = $row['characters'];
            $key = $row['apiKey'];
            $notes = $row['notes'];
            if (!$notes) {
                $trunNotes = "no notes";
            } elseif (strlen($notes) > 140) {
                $trunNotes = substr($notes, 0, 130) . " . . . ";
            } else {
                $trunNotes = $notes;
            }
            $id = $row['id'];
            $class = $alt_b ? "main" : "alt";
            $table .= <<<EOD
\t\t\t\t\t<tr keyID={$id} class="{$class}">
\t\t\t\t\t<td style="color: #FFA500"><a href="index.php?key={$key}" class="keyName">{$name}</a></td>
\t\t\t\t\t<td>{$type}</td>
\t\t\t\t\t<td>{$Characters}</td>
\t\t\t\t\t<td class="keyNotes">{$trunNotes}</td>
\t\t\t\t\t<td><a keyID={$id} class="editKey" href="manage.php?editNotes&id={$id}">Edit Key</a></td>
\t\t\t\t\t<td><a keyID={$id} class="removeKey" href="manage.php?removeKey&id={$id}">Remove Key</a></td>
\t\t\t\t\t</tr>
EOD;
        }
        $table .= '<div class="fadeDiv">&nbsp;</div><div id="keyInfoBox" class="floating_login_div" style="display: none;">';
        $table .= '<div class="exitbutton"><a href="#">[X]</a></div>';
        $table .= edit_key_form();
        $table .= '</div>';
    } else {
        $table .= "<tr><td colspan=4> No Keys Found </td></tr>";
    }
    $table .= "</table>";
    $table .= "\n\t</body></html>\n\t";
    return $table;
}
Пример #2
0
function get_form_divs()
{
    global $Db;
    $infobar = "";
    if (!loggedIn()) {
        $infobar .= makeDiv("register", show_registration($Db));
        $infobar .= makediv("login", get_login_form());
        $infobar .= makediv("reset", resetPasswordForm());
    } else {
        if (!(isset($_GET['key']) && !isset($_GET['chid'])) && defined("API_KEY")) {
            $infobar .= makediv("api", edit_key_form());
        }
    }
    return $infobar;
}