small code style improvements

main
msquare 8 years ago
parent 42144ed21c
commit 676f5e1627

@ -5,7 +5,8 @@ function admin_news() {
if (! isset($_GET["action"])) {
redirect(page_link_to("news"));
} else {
}
$html = '<div class="col-md-12"><h1>' . _("Edit news entry") . '</h1>' . msg();
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) {
$news_id = $_REQUEST['id'];
@ -14,7 +15,9 @@ function admin_news() {
}
$news = sql_select("SELECT * FROM `News` WHERE `ID`='" . sql_escape($news_id) . "' LIMIT 1");
if (count($news) > 0) {
if (empty($news)) {
return error("No News found.", true);
}
switch ($_REQUEST["action"]) {
default:
redirect(page_link_to('news'));
@ -59,10 +62,6 @@ function admin_news() {
redirect(page_link_to("news"));
break;
}
} else {
return error("No News found.", true);
}
}
return $html . '</div>';
}
?>

@ -374,11 +374,11 @@ function render_table($columns, $rows, $data = true) {
foreach ($rows as $row) {
$html .= '<tr>';
foreach ($columns as $key => $column) {
$value = "&nbsp;";
if (isset($row[$key])) {
$html .= '<td class="column_' . $key . '">' . $row[$key] . '</td>';
} else {
$html .= '<td class="column_' . $key . '">&nbsp;</td>';
$value = $row[$key];
}
$html .= '<td class="column_' . $key . '">' . $value . '</td>';
}
$html .= '</tr>';
}

Loading…
Cancel
Save