Exemplo n.º 1
0
 public static function formatEntries(Database $db, $llimit = self::DEFAULT_LINK_LIMIT)
 {
     $s = '<table class="table table-hover form-inline">' . self::ENTRIES_HEAD . '<tbody>';
     foreach ($db->getEntries() as $uuid => $e) {
         $icon = $db->getIconSrc($e[Database::KEY_CUSTOMICON]);
         $s .= '<tr><td>' . ($icon == null ? '' : '<img src="' . KphpUI::makePrintable($icon) . '" />') . '</td>';
         $s .= '<td>' . KphpUI::makePrintable($e[Database::KEY_TITLE]) . '</td>';
         $s .= '<td>' . self::formatLink($e[Database::KEY_URL], $llimit) . '</td>';
         $s .= '<td><input type="text" class="span3 selectOnFocus" value="' . KphpUI::makePrintable($e[Database::KEY_USERNAME]) . '" /></td>';
         $s .= '<td id="pwd_' . $uuid . '"><button type="button" class="btn btn-primary"' . ' onclick="loadPassword(\'' . $uuid . '\');" autocomplete="off"' . ' data-loading-text="...">Load</button></td></tr>';
     }
     return $s . '</tbody></table>';
 }
Exemplo n.º 2
0
//I don't know how to make pretty code :(
//Don't worry - me too :P
//$bash = new Bash("https://raw.githubusercontent.com/Cpt-ManlyPink/glhf-bash/master/bash.json");
$bash = new Bash("bash.json");
$db = new Database();
$entries = $bash->process();
//Checks if there have been new entries in JSON file.
$lastModified = $entries['lastModified'];
if ($db->lastSave() != $lastModified) {
    foreach ($entries['entries'] as $entry) {
        $db->saveEntrie($entry);
    }
    $db->updateLastSave($lastModified, $db->lastSave());
}
//Fetches all entries from DB
$content = $db->getEntries();
?>
<!doctype html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>GLHF.lv Teamspeak Bash</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" type="text/css" href="css/style.css" />
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    </head>
    <body>
        <div class="container">
        <!--[if lt IE 8]>
            <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>