初始化

This commit is contained in:
2026-08-08 18:28:49 +08:00
parent 9bef4420e0
commit f082037a6e
854 changed files with 217171 additions and 11 deletions
+74
View File
@@ -0,0 +1,74 @@
<?php
$activeMenu = 'database';
include APP_PATH . 'app/views/layouts/admin_header.php';
?>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="box box-warning">
<div class="box-header with-border">
<h3 class="box-title">
<i class="fa fa-edit"></i> 编辑记录 — 表:<code><?php echo htmlspecialchars($table); ?></code> — ID<?php echo $row['id']; ?>
</h3>
<div class="box-tools">
<a href="<?php echo BASE_URL; ?>/Admin/databaseView/<?php echo $idx; ?>" class="btn btn-default btn-sm">
<i class="fa fa-arrow-left"></i> 返回
</a>
</div>
</div>
<form method="post" action="">
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($csrfToken); ?>">
<div class="box-body">
<?php foreach ($columns as $col): ?>
<?php $field = $col['Field']; ?>
<?php $isSensitive = in_array($field, $sensitiveFields ?? [], true); ?>
<div class="form-group">
<label>
<strong><?php echo htmlspecialchars($field); ?></strong>
<small class="text-muted">(<?php echo htmlspecialchars($col['Type']); ?><?php echo $col['Key'] === 'PRI' ? ', 主键' : ''; ?><?php echo $isSensitive ? ', 已脱敏不可编辑' : ''; ?>)</small>
</label>
<?php if ($field === 'id'): ?>
<input type="text" class="form-control" value="<?php echo htmlspecialchars($row[$field] ?? ''); ?>" disabled>
<?php elseif ($isSensitive): ?>
<input type="text" class="form-control" value="<?php echo htmlspecialchars($row[$field] ?? ''); ?>" disabled>
<p class="text-warning" style="margin-top:4px;"><i class="fa fa-lock"></i> 敏感字段已脱敏,无法在此查看或修改</p>
<?php elseif (stripos($col['Type'], 'text') !== false): ?>
<textarea name="<?php echo htmlspecialchars($field); ?>" class="form-control" rows="4"><?php echo htmlspecialchars($row[$field] ?? ''); ?></textarea>
<?php elseif (stripos($col['Type'], 'enum') !== false): ?>
<?php
// 解析 ENUM 值
preg_match("/^enum\((.*)\)$/i", $col['Type'], $m);
$enumVals = [];
if (!empty($m[1])) {
foreach (explode(',', $m[1]) as $ev) {
$enumVals[] = trim($ev, "'\"");
}
}
?>
<?php if (!empty($enumVals)): ?>
<select name="<?php echo htmlspecialchars($field); ?>" class="form-control">
<?php foreach ($enumVals as $ev): ?>
<option value="<?php echo htmlspecialchars($ev); ?>" <?php echo ($row[$field] ?? '') === $ev ? 'selected' : ''; ?>>
<?php echo htmlspecialchars($ev); ?>
</option>
<?php endforeach; ?>
</select>
<?php else: ?>
<input type="text" name="<?php echo htmlspecialchars($field); ?>" class="form-control" value="<?php echo htmlspecialchars($row[$field] ?? ''); ?>">
<?php endif; ?>
<?php else: ?>
<input type="text" name="<?php echo htmlspecialchars($field); ?>" class="form-control" value="<?php echo htmlspecialchars($row[$field] ?? ''); ?>">
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<div class="box-footer">
<button type="submit" class="btn btn-warning"><i class="fa fa-save"></i> 保存修改</button>
<a href="<?php echo BASE_URL; ?>/Admin/databaseView/<?php echo $idx; ?>" class="btn btn-default">取消</a>
</div>
</form>
</div>
</div>
</div>
<?php include APP_PATH . 'app/views/layouts/admin_footer.php'; ?>