function previsu_verifier_cle_temporaire($cle) { $validite = 12; // validite de 12h maxi $old = 0; do { $date = date('Y-m-d H', strtotime("-{$old} hour")); if ($cle == previsu_cle_temporaire($date)) { return true; } } while ($old++ < $validite); return false; }
function spip_bonux_affichage_final($flux) { if (defined('_VAR_PREVIEW') and _VAR_PREVIEW) { $p = stripos($flux, "</body>"); $url_relecture = parametre_url(self(), 'var_mode', 'preview', '&'); $js = ""; if (!defined('_VAR_PREVIEW_EXCEPTION')) { $url_relecture = parametre_url($url_relecture, 'var_relecture', previsu_cle_temporaire(), '&'); $label = "Relecture temporaire"; } else { $label = _T('previsualisation'); $js = "jQuery('.spip-previsu').html('Relecture temporaire');"; } $js .= "jQuery('#spip-admin').append('<a class=\"spip-admin-boutons review_link\" href=\"{$url_relecture}\">{$label}</a>');"; $js = "jQuery(function(){ {$js} });"; $js = "<script>{$js}</script>"; $flux = substr_replace($flux, $js, $p, 0); } return $flux; }