forked from isidromlc/PHPost
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevbroken.php
More file actions
364 lines (322 loc) · 13.1 KB
/
Copy pathdevbroken.php
File metadata and controls
364 lines (322 loc) · 13.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
<?php
/**
* devbroken.php
* ---------------------------------------------------------------
* Página de identidad / ficha técnica autocontenida.
* Lee el archivo de texto plano "devbroken" (mismo directorio) y
* lo renderiza como una ficha visual.
*
* AISLAMIENTO INTENCIONAL:
* Este archivo NO hace require/include de nada del proyecto
* (sin bootstrap.php, sin Config, sin Smarty, sin DB). Es HTML+PHP
* plano a propósito, para que pueda existir aunque el resto de la
* app esté rota, en mantenimiento o caída.
* ---------------------------------------------------------------
*/
declare(strict_types=1);
header('Content-Type: text/html; charset=utf-8');
// Evita que buscadores indexen esta ficha interna.
header('X-Robots-Tag: noindex, nofollow');
header('X-Content-Type-Options: nosniff');
header('Referrer-Policy: no-referrer');
/**
* Parsea el formato del archivo "devbroken":
*
* SECCION
* [CLAVE] valor
*
* Una línea sin indentar en mayúsculas = nueva sección.
* Una línea indentada con [CLAVE] valor = par dentro de la sección activa.
*
* @return array<string, array<string,string>>
*/
function parseDevBroken(string $path): array
{
$sections = [];
$current = null;
$lines = file($path, FILE_IGNORE_NEW_LINES);
if ($lines === false) {
return $sections;
}
foreach ($lines as $raw) {
if (trim($raw) === '') {
continue;
}
$isHeader = $raw !== '' && !ctype_space($raw[0])
&& preg_match('/^[A-Z][A-Z0-9 ]*$/', trim($raw)) === 1;
if ($isHeader) {
$current = trim($raw);
$sections[$current] = [];
continue;
}
if ($current !== null && preg_match('/^\s*\[([A-Z0-9_]+)\]\s+(.*)$/', $raw, $m) === 1) {
$sections[$current][$m[1]] = trim($m[2]);
}
}
return $sections;
}
/** Convierte URLs y emails sueltos dentro de un valor en enlaces. */
function linkify(string $value): string
{
$escaped = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
if (preg_match('#^https?://#i', $value)) {
return '<a href="' . $escaped . '" target="_blank" rel="noopener noreferrer">' . $escaped . '</a>';
}
if (filter_var($value, FILTER_VALIDATE_EMAIL)) {
return '<a href="mailto:' . $escaped . '">' . $escaped . '</a>';
}
return $escaped;
}
$dataFile = __DIR__ . '/devbroken';
$sections = is_readable($dataFile) ? parseDevBroken($dataFile) : [];
$brand = $sections['BRAND'] ?? [];
$project = $sections['PROJECT'] ?? [];
$author = $sections['AUTHOR'] ?? [];
$status = $sections['STATUS']['CURRENT'] ?? ($project['STATUS'] ?? 'Desconocido');
// Secciones que ya se muestran en el hero: no repetirlas en la grilla.
$hiddenFromGrid = ['BRAND', 'PROJECT', 'AUTHOR', 'STATUS'];
?>
<!DOCTYPE html>
<html lang="es" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex, nofollow">
<title><?= htmlspecialchars($brand['NAME'] ?? 'DevBroken') ?> · <?= htmlspecialchars($project['NAME'] ?? 'Ficha técnica') ?></title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=Playfair+Display:ital@1&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<style>
:root{
--bg:#0B0A10; --bg-alt:#0E0C15; --panel:#131019; --panel-raised:#181420;
--border:#241F2E; --border-soft:#1B1723;
--text:#EBE7F2; --text-dim:#9691AA; --text-faint:#5C5670;
--accent:#8B7FFF; --accent-soft:rgba(139,127,255,.13); --accent-line:rgba(139,127,255,.4);
--live:#38D9A9; --live-soft:rgba(56,217,169,.14);
--font-display:'Sora','Segoe UI',sans-serif;
--font-serif:'Playfair Display',Georgia,serif;
--font-body:'Inter','Segoe UI',sans-serif;
--font-mono:'JetBrains Mono',Consolas,monospace;
--radius:12px;
}
html[data-theme="light"]{
--bg:#F6F4FB; --bg-alt:#EFEBF7; --panel:#FFFFFF; --panel-raised:#FBFAFF;
--border:#E2DCF0; --border-soft:#EAE5F5;
--text:#221D30; --text-dim:#5C5670; --text-faint:#948FA6;
--accent:#6F5CE6; --accent-soft:rgba(111,92,230,.10); --accent-line:rgba(111,92,230,.35);
--live:#0FA37E; --live-soft:rgba(15,163,126,.10);
}
*{box-sizing:border-box;}
@media (prefers-reduced-motion: reduce){ *{ animation-duration:.001ms !important; transition-duration:.001ms !important; } }
body{
margin:0;
background:var(--bg);
background-image:
radial-gradient(ellipse 800px 460px at 88% -8%, var(--accent-soft), transparent 60%),
radial-gradient(ellipse 620px 420px at 4% 12%, var(--live-soft), transparent 55%);
color:var(--text);
font-family:var(--font-body);
line-height:1.6;
transition:background-color .25s, color .25s;
}
a{ color:var(--accent); text-decoration:none; }
a:hover{ text-decoration:underline; }
:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; border-radius:4px; }
code, .mono{ font-family:var(--font-mono); }
.wrap{ max-width:900px; margin:0 auto; padding:56px 24px 60px; }
/* ---------- top bar ---------- */
.topbar{ display:flex; justify-content:flex-end; margin-bottom:26px; }
.theme-btn{
display:flex; align-items:center; gap:7px;
background:var(--panel); border:1px solid var(--border);
color:var(--text-dim); font-family:var(--font-mono); font-size:12px;
padding:8px 13px; border-radius:20px; cursor:pointer;
}
.theme-btn:hover{ color:var(--text); border-color:var(--accent-line); }
/* ---------- hero / nameplate ---------- */
.plate{
background:var(--panel);
border:1px solid var(--border);
border-radius:16px;
padding:34px 32px;
margin-bottom:34px;
position:relative;
overflow:hidden;
}
.plate::before{
content:'';
position:absolute; inset:0;
background:linear-gradient(120deg, var(--accent-soft), transparent 55%);
pointer-events:none;
}
.brand-row{ display:flex; align-items:center; gap:12px; margin-bottom:22px; position:relative; }
.brand-mark{
width:38px; height:38px; border-radius:10px; flex:none;
background:linear-gradient(135deg, var(--accent), #5b4fd1);
display:flex; align-items:center; justify-content:center;
font-family:var(--font-display); font-weight:700; color:#fff; font-size:15px;
}
.brand-name{ font-family:var(--font-display); font-weight:600; font-size:15.5px; }
.brand-focus{ font-family:var(--font-mono); font-size:11px; color:var(--text-faint); margin-top:1px; }
.status-pill{
display:inline-flex; align-items:center; gap:7px;
background:var(--live-soft); border:1px solid rgba(56,217,169,.35);
color:var(--live); font-family:var(--font-mono); font-size:11px;
padding:5px 11px; border-radius:20px; margin-bottom:16px; position:relative;
}
.status-dot{ width:7px; height:7px; border-radius:50%; background:var(--live); animation:pulse 1.8s ease-in-out infinite; }
@keyframes pulse{ 0%,100%{ opacity:1; } 50%{ opacity:.35; } }
.project-name{ font-family:var(--font-display); font-size:clamp(28px,4vw,40px); font-weight:700; margin:0 0 6px; position:relative; }
.project-slogan{ font-family:var(--font-serif); font-style:italic; font-size:18px; color:var(--text-dim); margin:0 0 22px; position:relative; }
.plate-meta{ display:flex; flex-wrap:wrap; gap:10px; position:relative; }
.meta-chip{
font-family:var(--font-mono); font-size:11.5px;
background:var(--panel-raised); border:1px solid var(--border-soft);
color:var(--text-dim); padding:6px 11px; border-radius:8px;
}
.meta-chip b{ color:var(--text); font-weight:600; }
/* ---------- author strip ---------- */
.author-strip{
display:flex; flex-wrap:wrap; gap:10px 22px;
padding:16px 32px;
border:1px solid var(--border);
border-radius:12px;
margin-bottom:40px;
background:var(--panel);
font-size:13px;
}
.author-strip .item{ display:flex; gap:6px; color:var(--text-dim); }
.author-strip .item b{ color:var(--text); font-weight:600; }
/* ---------- spec grid ---------- */
.grid-head{ margin-bottom:18px; }
.grid-head .eyebrow{
font-family:var(--font-mono); font-size:11px; letter-spacing:.5px;
color:var(--accent); text-transform:uppercase; margin-bottom:6px;
}
.grid-head h2{ font-family:var(--font-display); font-size:20px; margin:0; }
.spec-grid{
display:grid;
grid-template-columns:repeat(2,1fr);
gap:14px;
}
@media (max-width:680px){ .spec-grid{ grid-template-columns:1fr; } }
.spec-card{
background:var(--panel);
border:1px solid var(--border);
border-radius:var(--radius);
padding:16px 18px 6px;
}
.spec-title{
font-family:var(--font-display); font-size:13.5px; font-weight:600;
text-transform:uppercase; letter-spacing:.4px; color:var(--text-dim);
margin-bottom:10px;
}
.spec-row{
display:flex; gap:10px; justify-content:space-between;
padding:9px 0; border-top:1px solid var(--border-soft);
font-size:12.5px;
}
.spec-row:first-of-type{ border-top:none; }
.spec-key{ font-family:var(--font-mono); color:var(--text-faint); flex:none; white-space:nowrap; }
.spec-val{ font-family:var(--font-mono); color:var(--text); text-align:right; word-break:break-word; }
/* ---------- footer ---------- */
footer{
margin-top:48px; padding-top:24px;
border-top:1px solid var(--border);
color:var(--text-faint); font-size:11.5px;
display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px;
}
footer code{ color:var(--text-dim); }
.empty-state{
border:1px dashed var(--border); border-radius:12px;
padding:26px; text-align:center; color:var(--text-faint);
font-family:var(--font-mono); font-size:12.5px;
}
</style>
</head>
<body>
<div class="wrap">
<div class="topbar">
<button class="theme-btn" id="themeBtn" type="button" aria-label="Cambiar tema claro/oscuro">
<span id="themeIcon">🌙</span> <span id="themeLabel">Oscuro</span>
</button>
</div>
<?php if (empty($sections)): ?>
<div class="empty-state">No se pudo leer el archivo <code>devbroken</code> en <code><?= htmlspecialchars($dataFile) ?></code>.</div>
<?php else: ?>
<div class="plate">
<div class="brand-row">
<div class="brand-mark"><?= htmlspecialchars(mb_substr($brand['NAME'] ?? 'DB', 0, 2)) ?></div>
<div>
<div class="brand-name"><?= htmlspecialchars($brand['NAME'] ?? '') ?></div>
<div class="brand-focus"><?= htmlspecialchars($brand['TYPE'] ?? '') ?> · <?= htmlspecialchars($brand['FOCUS'] ?? '') ?></div>
</div>
</div>
<div class="status-pill"><span class="status-dot"></span><?= htmlspecialchars($status) ?></div>
<h1 class="project-name"><?= htmlspecialchars($project['NAME'] ?? '') ?></h1>
<?php if (!empty($project['SLOGAN'])): ?>
<p class="project-slogan">"<?= htmlspecialchars($project['SLOGAN']) ?>"</p>
<?php endif; ?>
<div class="plate-meta">
<?php foreach (['VERSION' => 'v', 'CATEGORY' => '', 'LICENSE' => '', 'CREATED' => 'desde ', 'UPDATED' => 'act. '] as $key => $prefix): ?>
<?php if (!empty($project[$key])): ?>
<span class="meta-chip"><b><?= htmlspecialchars($prefix) ?><?= htmlspecialchars($project[$key]) ?></b></span>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<?php if (!empty($author)): ?>
<div class="author-strip">
<?php foreach ($author as $k => $v): ?>
<span class="item"><b><?= htmlspecialchars(ucfirst(strtolower($k))) ?>:</b> <?= linkify($v) ?></span>
<?php endforeach; ?>
</div>
<?php endif; ?>
<div class="grid-head">
<div class="eyebrow">Ficha técnica</div>
<h2>Stack, arquitectura y estado del proyecto</h2>
</div>
<div class="spec-grid">
<?php foreach ($sections as $secName => $fields): ?>
<?php if (in_array($secName, $hiddenFromGrid, true) || empty($fields)) continue; ?>
<div class="spec-card">
<div class="spec-title"><?= htmlspecialchars($secName) ?></div>
<?php foreach ($fields as $k => $v): ?>
<div class="spec-row">
<span class="spec-key">[<?= htmlspecialchars($k) ?>]</span>
<span class="spec-val"><?= linkify($v) ?></span>
</div>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
</div>
<footer>
<span>© <?= date('Y') ?> <?= htmlspecialchars($brand['NAME'] ?? '') ?> · <code>devbroken</code> — página aislada, sin dependencias del proyecto.</span>
<span>Generado desde <code>/devbroken</code></span>
</footer>
<?php endif; ?>
</div>
<script>
(function(){
"use strict";
var root = document.documentElement;
var btn = document.getElementById('themeBtn');
var icon = document.getElementById('themeIcon');
var label = document.getElementById('themeLabel');
function apply(theme){
root.setAttribute('data-theme', theme);
icon.textContent = theme === 'dark' ? '🌙' : '☀️';
label.textContent = theme === 'dark' ? 'Oscuro' : 'Claro';
}
var saved = null;
try { saved = localStorage.getItem('devbroken-theme'); } catch (e) {}
apply(saved === 'light' ? 'light' : 'dark');
btn.addEventListener('click', function(){
var next = root.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
apply(next);
try { localStorage.setItem('devbroken-theme', next); } catch (e) {}
});
})();
</script>
</body>
</html>