示例#1
0
    }
    if ($m < 1) {
        $m = 1;
    }
    if ($y < 0) {
        $y = 0;
    }
    if ($d > 31) {
        $d = 31;
    }
    if ($m > 12) {
        $m = 12;
    }
    $time = sprintf('%04d-%02d-%02d', $y, $m, $d);
}
$voc = getVoc(false, $time, true);
$table = '';
if ($voc === false) {
    setError('Fehler beim Abrufen der Vokabeln');
} else {
    if (count($voc) == 0) {
        setError('Keine Vokabeln vorhanden');
    } else {
        $top = '<tr><th>Englisch</th><th>Deutsch</th></tr>';
        $rows = '';
        foreach ($voc as $v) {
            $id = htmlspecialchars($v->id);
            $german = htmlspecialchars($v->german, 0, 'UTF-8');
            $english = htmlspecialchars($v->english, 0, 'UTF-8');
            $rows .= "<tr><td>{$english}</td><td>{$german}</td></tr>\n";
        }
示例#2
0
<?php

require_once 'lib/settings.php';
require_once 'lib/db.php';
require_once 'lib/users.php';
require_once 'lib/session.php';
require_once 'lib/login.php';
require_once 'lib/voc.php';
if (!connect_mysql()) {
    exit;
}
include 'lib/loginfilter.php';
include 'lib/navbar.php';
$isAdmin = isUserInRole('admin');
$isUser = isUserInRole('user');
$voc = getVoc($isAdmin);
$table = '';
if ($voc === false) {
    setError('Fehler beim Abrufen der Vokabeln');
} else {
    if (count($voc) == 0) {
        setError('Keine Vokabeln vorhanden');
    } else {
        $xhdr = $isAdmin ? '<th>Ersteller</th>' : '';
        $xhdr = $isUser ? "<th></th>{$xhdr}<th class=\"time\">Datum</th>" : '';
        $top = "<tr><th>Englisch</th><th>Deutsch</th>{$xhdr}</tr>";
        $rows = '';
        foreach ($voc as $v) {
            $id = htmlspecialchars($v->id);
            $german = htmlspecialchars($v->german, 0, 'UTF-8');
            $english = htmlspecialchars($v->english, 0, 'UTF-8');