<?php  // Headers específicos para LiteSpeed Cache header('Cache-Control: no-cache, no-store, must-revalidate, max-age=0'); header('Pragma: no-cache'); header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');  // Headers específicos para LiteSpeed if (function_exists('litespeed_purge_all')) {     header('X-LiteSpeed-Cache-Control: no-cache'); }  // Desabilitar cache do WordPress para este arquivo if (!defined('DONOTCACHEPAGE')) {     define('DONOTCACHEPAGE', true); } if (!defined('DONOTCACHEOBJECT')) {     define('DONOTCACHEOBJECT', true); } if (!defined('DONOTCACHEDB')) {     define('DONOTCACHEDB', true); }  // Verificar se existe um parâmetro para forçar atualização do cookie $force_refresh = isset($_GET['refresh_user']) || isset($_POST['refresh_user']);  // Tentar obter o cookie de diferentes formas $idpessoacode = null;  // Método 1: Cookie tradicional if (isset($_COOKIE['idpessoacode']) && !empty($_COOKIE['idpessoacode'])) {     $idpessoacode = sanitize_text_field($_COOKIE['idpessoacode']); }  // Método 2: Verificar via JavaScript se o cookie não foi encontrado if (empty($idpessoacode)) {     echo '<script>         // Tentar obter cookie via JavaScript         function getCookie(name) {             let value = "; " + document.cookie;             let parts = value.split("; " + name + "=");             if (parts.length == 2) return parts.pop().split(";").shift();             return null;         }                  let cookieValue = getCookie("idpessoacode");         if (cookieValue && cookieValue !== "") {             // Reenviar via POST se encontrou cookie no JS             let form = document.createElement("form");             form.method = "POST";             form.style.display = "none";                          let input = document.createElement("input");             input.name = "js_cookie_value";             input.value = cookieValue;             form.appendChild(input);                          let refresh = document.createElement("input");             refresh.name = "refresh_user";             refresh.value = "1";             form.appendChild(refresh);                          document.body.appendChild(form);             form.submit();         }     </script>'; }  // Método 3: Verificar se foi enviado via POST do JavaScript if (empty($idpessoacode) && isset($_POST['js_cookie_value']) && !empty($_POST['js_cookie_value'])) {     $idpessoacode = sanitize_text_field($_POST['js_cookie_value']); }  // Debug (remover em produção) error_log('Cookie idpessoacode: ' . ($idpessoacode ? $idpessoacode : 'não encontrado'));  if (!empty($idpessoacode)) {     $url = "https://cmsv3.portasabertas.org.br/api/pessoas/mev3";      $headers = [         'Authorization' => 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJNREV5VW10R1ZGWkZUazVWZHowOVRXcEJNRTlCUFQwIn0=.sR2PWTqcv/2a1efuM7mlshQ0hEkCGRnV0HmVi7rzQro=',          'Content-Type'  => 'application/json',         'Cache-Control' => 'no-cache',         'User-Agent' => 'WordPress/' . get_bloginfo('version') . '; ' . get_bloginfo('url')     ];      $body = json_encode([         'idpessoacode' => $idpessoacode     ]);      // Adicionar timestamp para evitar cache na API     $response = wp_remote_post($url . '?t=' . time(), [         'headers' => $headers,         'body'    => $body,         'timeout' => 15,         'sslverify' => true,         'blocking' => true,         'httpversion' => '1.1'     ]);      if (!is_wp_error($response)) {         $response_code = wp_remote_retrieve_response_code($response);         $body_response = wp_remote_retrieve_body($response);                  // Debug da resposta (remover em produção)         error_log('Response code: ' . $response_code);         error_log('Response body: ' . $body_response);                  $data = json_decode($body_response, true);          if (!empty($data) && isset($data['data']['despessoa'])) {             $nome   = esc_html($data['data']['despessoa']);             $imagem = !empty($data['data']['desimage'])                          ? esc_url($data['data']['desimage'])                          : "https://sitepa.s3.amazonaws.com/wp-content/uploads/br/2025/09/Vertical-container-1.avif";              // Adicionar um identificador único para evitar cache do browser             $cache_buster = '?v=' . time();             if (strpos($imagem, '?') !== false) {                 $cache_buster = '&v=' . time();             }              // Usuário logado             echo '             <div class="user-menu" style="position:relative;display:inline-block;" data-user-loaded="true">                 <div class="user-box" style="display:flex;align-items:center;gap:8px;cursor:pointer;" onclick="toggleUserDropdown(this)">                     <img src="'.$imagem.$cache_buster.'" alt="'.$nome.'" style="width:35px;height:35px;border-radius:50%;object-fit:cover;" onload="this.style.opacity=1" style="opacity:0;transition:opacity 0.3s;">                     <span style="font-size:14px;">Hola, <strong>'.$nome.'</strong></span>                     <img src="https://sitepa.s3.amazonaws.com/wp-content/uploads/br/2025/09/Arrows-Diagrams.svg" alt="Seta" style="width:25px;height:25px;">                 </div>                 <div class="user-dropdown" style="display:none;position:absolute;right:0;top:100%;background:#fff;border:1px solid #ddd;border-radius:6px;box-shadow:0 2px 6px rgba(0,0,0,0.15);min-width:200px;z-index:999;">                     <a href="https://parceiro.portasabertas.org.br/" style="display:flex;align-items:center;gap:6px;padding:10px;color:#333;text-decoration:none;font-size:14px;">                         <img src="https://sitepa.s3.amazonaws.com/wp-content/uploads/br/2025/09/login-enter-arrow-right-circle.svg" alt="Área restrita" style="width:16px;height:16px;">                         Acceder al portal                     </a>                                      </div>             </div>              <script>             function toggleUserDropdown(element) {                 let dropdown = element.nextElementSibling;                 dropdown.style.display = dropdown.style.display === "block" ? "none" : "block";             }              function refreshUserData() {                 window.location.href = window.location.href + (window.location.href.includes("?") ? "&" : "?") + "refresh_user=1";             }              // Fechar dropdown ao clicar fora             document.addEventListener("click", function(e) {                 document.querySelectorAll(".user-dropdown").forEach(function(drop){                     if (!drop.previousElementSibling.contains(e.target)) {                         drop.classList.remove("show");                         drop.style.display = "none";                     }                 });             });              // Verificar se o usuário foi carregado corretamente             document.addEventListener("DOMContentLoaded", function() {                 if (!document.querySelector("[data-user-loaded]")) {                     console.log("Usuário não carregado, tentando novamente em 2 segundos...");                     setTimeout(function() {                         window.location.reload();                     }, 2000);                 }             });             </script>             ';         } else {             // Dados inválidos na API             error_log('Dados inválidos retornados pela API: ' . json_encode($data));             showFallbackLogin();         }     } else {         // Erro na API         error_log('Erro na API: ' . $response->get_error_message());         showFallbackLogin();     } } else {     // Sem cookie     showFallbackLogin(); }  // Função para mostrar o fallback de login function showFallbackLogin() {     echo '<div class="user-login" style="display:flex;align-items:center;gap:10px;">';     echo '<img src="https://sitepa.s3.amazonaws.com/wp-content/uploads/br/2025/09/Vertical-container-1.avif" alt="Login" style="width:35px;height:35px;">';     echo '<a href="https://auth.parceiro.portasabertas.org.br/login">Entrar</a>';     echo '<span class="header__divider">|</span>';     echo '<a href="https://auth.parceiro.portasabertas.org.br/cadastro">Regístrate</a>';     echo '</div>'; }  // CSS adicional para melhorar a experiência echo '<style> .user-menu img {     transition: opacity 0.3s ease-in-out; } .user-dropdown.show {     display: block !important; } </style>'; ?>
.header__divider {   color: #D0D5DD; }  .user-login {   color: #101828; }
<?php  // Headers específicos para LiteSpeed Cache header('Cache-Control: no-cache, no-store, must-revalidate, max-age=0'); header('Pragma: no-cache'); header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');  // Headers específicos para LiteSpeed if (function_exists('litespeed_purge_all')) {     header('X-LiteSpeed-Cache-Control: no-cache'); }  // Desabilitar cache do WordPress para este arquivo if (!defined('DONOTCACHEPAGE')) {     define('DONOTCACHEPAGE', true); } if (!defined('DONOTCACHEOBJECT')) {     define('DONOTCACHEOBJECT', true); } if (!defined('DONOTCACHEDB')) {     define('DONOTCACHEDB', true); }  // Verificar se existe um parâmetro para forçar atualização do cookie $force_refresh = isset($_GET['refresh_user']) || isset($_POST['refresh_user']);  // Tentar obter o cookie de diferentes formas $idpessoacode = null;  // Método 1: Cookie tradicional if (isset($_COOKIE['idpessoacode']) && !empty($_COOKIE['idpessoacode'])) {     $idpessoacode = sanitize_text_field($_COOKIE['idpessoacode']); }  // Método 2: Verificar via JavaScript se o cookie não foi encontrado if (empty($idpessoacode)) {     echo '<script>         // Tentar obter cookie via JavaScript         function getCookie(name) {             let value = "; " + document.cookie;             let parts = value.split("; " + name + "=");             if (parts.length == 2) return parts.pop().split(";").shift();             return null;         }                  let cookieValue = getCookie("idpessoacode");         if (cookieValue && cookieValue !== "") {             // Reenviar via POST se encontrou cookie no JS             let form = document.createElement("form");             form.method = "POST";             form.style.display = "none";                          let input = document.createElement("input");             input.name = "js_cookie_value";             input.value = cookieValue;             form.appendChild(input);                          let refresh = document.createElement("input");             refresh.name = "refresh_user";             refresh.value = "1";             form.appendChild(refresh);                          document.body.appendChild(form);             form.submit();         }     </script>'; }  // Método 3: Verificar se foi enviado via POST do JavaScript if (empty($idpessoacode) && isset($_POST['js_cookie_value']) && !empty($_POST['js_cookie_value'])) {     $idpessoacode = sanitize_text_field($_POST['js_cookie_value']); }  // Debug (remover em produção) error_log('Cookie idpessoacode: ' . ($idpessoacode ? $idpessoacode : 'não encontrado'));  if (!empty($idpessoacode)) {     $url = "https://cmsv3.portasabertas.org.br/api/pessoas/mev3";      $headers = [         'Authorization' => 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJNREV5VW10R1ZGWkZUazVWZHowOVRXcEJNRTlCUFQwIn0=.sR2PWTqcv/2a1efuM7mlshQ0hEkCGRnV0HmVi7rzQro=',          'Content-Type'  => 'application/json',         'Cache-Control' => 'no-cache',         'User-Agent' => 'WordPress/' . get_bloginfo('version') . '; ' . get_bloginfo('url')     ];      $body = json_encode([         'idpessoacode' => $idpessoacode     ]);      // Adicionar timestamp para evitar cache na API     $response = wp_remote_post($url . '?t=' . time(), [         'headers' => $headers,         'body'    => $body,         'timeout' => 15,         'sslverify' => true,         'blocking' => true,         'httpversion' => '1.1'     ]);      if (!is_wp_error($response)) {         $response_code = wp_remote_retrieve_response_code($response);         $body_response = wp_remote_retrieve_body($response);                  // Debug da resposta (remover em produção)         error_log('Response code: ' . $response_code);         error_log('Response body: ' . $body_response);                  $data = json_decode($body_response, true);          if (!empty($data) && isset($data['data']['despessoa'])) {             $nome   = esc_html($data['data']['despessoa']);             $imagem = !empty($data['data']['desimage'])                          ? esc_url($data['data']['desimage'])                          : "https://sitepa.s3.amazonaws.com/wp-content/uploads/br/2025/09/Vertical-container-1.avif";              // Adicionar um identificador único para evitar cache do browser             $cache_buster = '?v=' . time();             if (strpos($imagem, '?') !== false) {                 $cache_buster = '&v=' . time();             }              // Usuário logado             echo '             <div class="user-menu" style="position:relative;display:inline-block;" data-user-loaded="true">                 <div class="user-box" style="display:flex;align-items:center;gap:8px;cursor:pointer;" onclick="toggleUserDropdown(this)">                     <img src="'.$imagem.$cache_buster.'" alt="'.$nome.'" style="width:35px;height:35px;border-radius:50%;object-fit:cover;" onload="this.style.opacity=1" style="opacity:0;transition:opacity 0.3s;">                     <span style="font-size:14px;">Hola, <strong>'.$nome.'</strong></span>                     <img src="https://sitepa.s3.amazonaws.com/wp-content/uploads/br/2025/09/Arrows-Diagrams.svg" alt="Seta" style="width:25px;height:25px;">                 </div>                 <div class="user-dropdown" style="display:none;position:absolute;right:0;top:100%;background:#fff;border:1px solid #ddd;border-radius:6px;box-shadow:0 2px 6px rgba(0,0,0,0.15);min-width:200px;z-index:999;">                     <a href="https://parceiro.portasabertas.org.br/" style="display:flex;align-items:center;gap:6px;padding:10px;color:#333;text-decoration:none;font-size:14px;">                         <img src="https://sitepa.s3.amazonaws.com/wp-content/uploads/br/2025/09/login-enter-arrow-right-circle.svg" alt="Área restrita" style="width:16px;height:16px;">                         Acceder al portal                     </a>                                      </div>             </div>              <script>             function toggleUserDropdown(element) {                 let dropdown = element.nextElementSibling;                 dropdown.style.display = dropdown.style.display === "block" ? "none" : "block";             }              function refreshUserData() {                 window.location.href = window.location.href + (window.location.href.includes("?") ? "&" : "?") + "refresh_user=1";             }              // Fechar dropdown ao clicar fora             document.addEventListener("click", function(e) {                 document.querySelectorAll(".user-dropdown").forEach(function(drop){                     if (!drop.previousElementSibling.contains(e.target)) {                         drop.classList.remove("show");                         drop.style.display = "none";                     }                 });             });              // Verificar se o usuário foi carregado corretamente             document.addEventListener("DOMContentLoaded", function() {                 if (!document.querySelector("[data-user-loaded]")) {                     console.log("Usuário não carregado, tentando novamente em 2 segundos...");                     setTimeout(function() {                         window.location.reload();                     }, 2000);                 }             });             </script>             ';         } else {             // Dados inválidos na API             error_log('Dados inválidos retornados pela API: ' . json_encode($data));             showFallbackLogin();         }     } else {         // Erro na API         error_log('Erro na API: ' . $response->get_error_message());         showFallbackLogin();     } } else {     // Sem cookie     showFallbackLogin(); }  // Função para mostrar o fallback de login function showFallbackLogin() {     echo '<div class="user-login" style="display:flex;align-items:center;gap:10px;">';     echo '<img src="https://sitepa.s3.amazonaws.com/wp-content/uploads/br/2025/09/Vertical-container-1.avif" alt="Login" style="width:35px;height:35px;">';     echo '<a href="https://auth.parceiro.portasabertas.org.br/login">Entrar</a>';     echo '<span class="header__divider">|</span>';     echo '<a href="https://auth.parceiro.portasabertas.org.br/cadastro">Regístrate</a>';     echo '</div>'; }  // CSS adicional para melhorar a experiência echo '<style> .user-menu img {     transition: opacity 0.3s ease-in-out; } .user-dropdown.show {     display: block !important; } </style>'; ?>
Bem vindo
Acesse sua conta ou registre-se gratuitamente.

Panfleto ameaça de morte mulheres que votarem no Afeganistão

Portas Abertas • 20 abr 2004

Em panfletos distribuídos na Província de Logar (leste do Afeganistão), os talebans ameaçaram executar todos os afegãos, particularmente as mulheres, que se inscreverem para participar nas eleições de setembro.

Leia mais na Folha Online