diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1511538 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# Ignorar o arquivo .env com senhas e configurações +.env + +# Ignorar diretórios de upload temporário e imagens +imagens/ +*.log + +# Ignorar cache do sistema operacional +.DS_Store +Thumbs.db + +# Ignorar arquivos temporários de editores +*.swp +*.swo +*.bak +*.tmp + +# Ignorar arquivos de backup do VS Code ou outros editores +*.code-workspace +.vscode/ diff --git a/Captura.png b/Captura.png deleted file mode 100644 index a48c257..0000000 Binary files a/Captura.png and /dev/null differ diff --git a/Imagem1.png b/Imagem1.png deleted file mode 100644 index a772d0e..0000000 Binary files a/Imagem1.png and /dev/null differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..d299e3a --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +Pequeno slideshow para apresentar os destaques da Editora Moan e do Meta Museu da Matemática. + +Em produção, troque a senha do arquivo .env. \ No newline at end of file diff --git a/pasta_publica/edit.php b/pasta_publica/edit.php new file mode 100644 index 0000000..b351187 --- /dev/null +++ b/pasta_publica/edit.php @@ -0,0 +1,341 @@ + +
+

Entrar

+ $erro

"; ?> + + +
+ $imgName, + 'texto' => trim($_POST['texto'] ?? ''), + 'cor' => $_POST['cor'] ?? '', + 'direcao' => $_POST['direcao'] ?? '', + 'link' => trim($_POST['link'] ?? ''), + ]; + + if (file_put_contents($jsonPath, json_encode($slides, JSON_PRETTY_PRINT)) === false) { + die("Erro ao gravar no slides.json"); + } + + atualizarHTML($slides, $htmlPath); + header("Location: " . basename(__FILE__)); + exit; +} + +// SALVAR ALTERAÇÕES (editar e reordenar) +if (isset($_POST['save'])) { + $novos_slides = []; + $ids = array_keys($slides); + $ordem = $_POST['ordem'] ?? []; + + foreach ($ids as $i) { + $texto = trim($_POST['texto'][$i] ?? ''); + $cor = $_POST['cor'][$i] ?? ''; + $link = trim($_POST['link'][$i] ?? ''); + $direcao = $_POST['direcao'][$i] ?? ''; + $ord = intval($ordem[$i] ?? 0); + + $novos_slides[$i] = [ + 'imagem' => $slides[$i]['imagem'], + 'texto' => $texto, + 'cor' => $cor, + 'link' => $link, + 'direcao' => $direcao, + 'ordem' => $ord, + ]; + } + + usort($novos_slides, function($a, $b) { + return ($a['ordem'] ?? 0) <=> ($b['ordem'] ?? 0); + }); + + foreach ($novos_slides as &$slide) { + unset($slide['ordem']); + } + + $slides = $novos_slides; + + if (file_put_contents($jsonPath, json_encode($slides, JSON_PRETTY_PRINT)) === false) { + die("Erro ao gravar no slides.json"); + } + + atualizarHTML($slides, $htmlPath); + header("Location: " . basename(__FILE__)); + exit; +} + +// EXCLUIR SLIDE +if (isset($_GET['delete'])) { + $index = (int) $_GET['delete']; + if (isset($slides[$index])) { + $imgDel = $slides[$index]['imagem']; + @unlink("$imagensDir/$imgDel"); + array_splice($slides, $index, 1); + file_put_contents($jsonPath, json_encode($slides, JSON_PRETTY_PRINT)); + atualizarHTML($slides, $htmlPath); + } + header("Location: " . basename(__FILE__)); + exit; +} + +function atualizarHTML($slides, $htmlPath) { + $novoConteudo = '
' . PHP_EOL; + foreach ($slides as $slide) { + $botao = ''; + if (!empty(trim($slide['texto'] ?? ''))) { + $cor = $slide['cor'] ?? '#000'; + $dir = $slide['direcao'] ?? 'up'; + $txt = htmlspecialchars($slide['texto']); + $link = htmlspecialchars($slide['link'] ?? '#') ?: '#'; + $botao = "$txt"; + } + + $novoConteudo .= << + + $botao +
+ +HTML; + } + + $novoConteudo .= <<❮ + + +
+HTML; + + foreach ($slides as $i => $_) { + $n = $i + 1; + $novoConteudo .= " "; + } + + $novoConteudo .= '
'; + + $html = file_get_contents($htmlPath); + + $novoHtml = preg_replace( + '#
.*?
\s*#s', + $novoConteudo, + $html + ); + + file_put_contents($htmlPath, $novoHtml); +} +?> + + + + + + Editar Slides + + + +

Gerenciar Slides

+ +

Use imagens com a proporção 81/46. As dimensões de exibição são 405px de largura por 230px de altura.

+ +
+
+

+

+

+

+

+ +

+

+
+
+ +
+ +

Editar slides existentes

+ +
+ + + + + + + + + + + + + + $s): ?> + + + + + + + + + + + +
OrdemImagemTexto do botãoLink do botãoCor do botãoDireçãoAções
+ + + + + + + + + + + + + Excluir +
+ +

+
+ + + diff --git a/index.html b/pasta_publica/index.html similarity index 87% rename from index.html rename to pasta_publica/index.html index 5f4c2ab..db7c0d5 100644 --- a/index.html +++ b/pasta_publica/index.html @@ -10,8 +10,12 @@ body {font-family: Verdana, sans-serif; margin:0} img {vertical-align: middle;} - @keyframes up { + from {margin-bottom: 40px;} + to {margin-bottom: 0;} +} + +@keyframes down { from {margin-bottom: -40px;} to {margin-bottom: 0;} } @@ -143,6 +147,10 @@ img {vertical-align: middle;} animation: up .5s ease-in-out; } +.moan-down{ + animation: down .5s ease-in-out; +} + .moan-from-left { animation: from-left .8s ease-in-out; } @@ -151,7 +159,6 @@ img {vertical-align: middle;} animation: from-right .8s ease-in-out; } -/* On smaller screens, decrease text size */ @media only screen and (max-width: 310px) { .prev, .next,.text {font-size: 11px} } @@ -160,33 +167,18 @@ img {vertical-align: middle;}
-
- - - - Veja - + + Adquira já!
-
- - - - Leia agora - + + Adquira Já!
- - -
- - -
- -
+
@@ -244,6 +236,8 @@ function showSlides(n) { if (direction === "up") { temp.classList.remove('moan-up'); + } else if (direction === "down") { + temp.classList.remove('moan-down'); } else if (direction === "from-left") { temp.classList.remove('moan-from-left'); } else if (direction === "from-right") { @@ -268,6 +262,8 @@ function showSlides(n) { if (direction === "up") { link.classList.add('moan-up'); + } else if (direction === "down") { + link.classList.add('moan-down'); } else if (direction === "from-left") { link.classList.add('moan-from-left'); } else if (direction === "from-right") { diff --git a/pasta_publica/slides.json b/pasta_publica/slides.json new file mode 100644 index 0000000..5bcc489 --- /dev/null +++ b/pasta_publica/slides.json @@ -0,0 +1,16 @@ +[ + { + "imagem": "img_688fb8b5c8ee6.webp", + "texto": "Adquira j\u00e1!", + "cor": "#339d08", + "link": "", + "direcao": "down" + }, + { + "imagem": "img_688fbff50d93b.webp", + "texto": "Adquira J\u00e1!", + "cor": "#ec606d", + "link": "", + "direcao": "up" + } +] \ No newline at end of file