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 @@ + +
+ $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 = ' + +HTML; + } + + $novoConteudo .= <<❮ +❯ + +Use imagens com a proporção 81/46. As dimensões de exibição são 405px de largura por 230px de altura.
+ +