diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-12-30 08:33:02 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-12-30 08:33:02 +0000 |
commit | 769ebb666c9a2340e22ca92ae4685369eec083cc (patch) | |
tree | 9f77fb64d483eb9af5c33e4f62182120084e4f64 | |
parent | f281f0a7e32c0fcfd51fc07a76203427e1c6c25b (diff) | |
download | brdo-769ebb666c9a2340e22ca92ae4685369eec083cc.tar.gz brdo-769ebb666c9a2340e22ca92ae4685369eec083cc.tar.bz2 |
- Check input given to table rendering functions to avoid warning.
-rw-r--r-- | includes/common.inc | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/includes/common.inc b/includes/common.inc index d3a909adf..6a979f9de 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -183,7 +183,7 @@ function variable_del($name) { } function table_cell($cell, $header = 0) { - if (is_array($cell)) { + if (is_array($cell)) { $data = $cell["data"]; foreach ($cell as $key => $value) { if ($key != "data") { @@ -213,28 +213,32 @@ function table($header, $rows) { ** Emit the table header: */ - $output .= " <tr>"; - foreach ($header as $cell) { - $output .= table_cell($cell, 1); + if (is_array($header)) { + $output .= " <tr>"; + foreach ($header as $cell) { + $output .= table_cell($cell, 1); + } + $output .= " </tr>"; } - $output .= " </tr>"; /* ** Emit the table rows: */ - foreach ($rows as $number => $row) { - if ($number % 2 == 1) { - $output .= " <tr class=\"light\">"; - } - else { - $output .= " <tr class=\"dark\">"; - } + if (is_array($rows)) { + foreach ($rows as $number => $row) { + if ($number % 2 == 1) { + $output .= " <tr class=\"light\">"; + } + else { + $output .= " <tr class=\"dark\">"; + } - foreach ($row as $cell) { - $output .= table_cell($cell, 0); + foreach ($row as $cell) { + $output .= table_cell($cell, 0); + } + $output .= " </tr>"; } - $output .= " </tr>"; } $output .= "</table>"; |