<?php $page->layout = 'admin'; if (!User::require_admin()) { header('Location: /admin'); exit; } $page->title = i18n_get('Table Info') . ': ' . $_GET['table']; $columns = DBMan::table_info($_GET['table']); echo $tpl->render('dbman/info', array('table' => $_GET['table'], 'columns' => $columns));
<?php if (!User::require_admin()) { header('Location: /admin'); exit; } if (!isset($_GET['table'])) { header('Location: /dbman/index'); exit; } $page->layout = 'admin'; $page->title = i18n_get('Editing Item') . ': ' . $_GET['table'] . '/' . $_GET['key']; // get the field details of the table so we can dynamically generate the form $fields = DBMan::table_info($_GET['table']); $f = new Form('post'); $f->verify_csrf = false; // generate rules for required fields foreach ($fields as $field) { $f->rules[$field->name] = DBMan::get_rules($field); } if ($f->submit()) { // update item $pkey = DBMan::primary_key($_GET['table']); $sql = 'update `' . $_GET['table'] . '` set '; $params = array(); $sep = ''; foreach ($_POST as $k => $v) { if ($k == $pkey) { continue; } $sql .= $sep . $k . ' = ?';