Commit 769ebb66 authored by Dries's avatar Dries

- Check input given to table rendering functions to avoid warning.
parent f281f0a7
...@@ -183,7 +183,7 @@ function variable_del($name) { ...@@ -183,7 +183,7 @@ function variable_del($name) {
} }
function table_cell($cell, $header = 0) { function table_cell($cell, $header = 0) {
if (is_array($cell)) { if (is_array($cell)) {
$data = $cell["data"]; $data = $cell["data"];
foreach ($cell as $key => $value) { foreach ($cell as $key => $value) {
if ($key != "data") { if ($key != "data") {
...@@ -213,28 +213,32 @@ function table($header, $rows) { ...@@ -213,28 +213,32 @@ function table($header, $rows) {
** Emit the table header: ** Emit the table header:
*/ */
$output .= " <tr>"; if (is_array($header)) {
foreach ($header as $cell) { $output .= " <tr>";
$output .= table_cell($cell, 1); foreach ($header as $cell) {
$output .= table_cell($cell, 1);
}
$output .= " </tr>";
} }
$output .= " </tr>";
/* /*
** Emit the table rows: ** Emit the table rows:
*/ */
foreach ($rows as $number => $row) { if (is_array($rows)) {
if ($number % 2 == 1) { foreach ($rows as $number => $row) {
$output .= " <tr class=\"light\">"; if ($number % 2 == 1) {
} $output .= " <tr class=\"light\">";
else { }
$output .= " <tr class=\"dark\">"; else {
} $output .= " <tr class=\"dark\">";
}
foreach ($row as $cell) { foreach ($row as $cell) {
$output .= table_cell($cell, 0); $output .= table_cell($cell, 0);
}
$output .= " </tr>";
} }
$output .= " </tr>";
} }
$output .= "</table>"; $output .= "</table>";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment