Skip to content

Commit

Permalink
sabiaque.php: permitir uso de predefinições para cálculo do contador
Browse files Browse the repository at this point in the history
  • Loading branch information
albertoleoncio committed Feb 23, 2021
1 parent aafbb75 commit fa35a02
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions sabiaque.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,12 @@
//
////////////////////////////////////////////////////////////////////////////////////////

//Define página
$pageTime = $wiki->getPage("Wikipédia:Sabia que/Frequência");

//Recupera codigo-fonte da página
$htmlTime = $pageTime->getText();
//Recupera página do contador
$htmlTime = file_get_contents("https://pt.wikipedia.org/w/index.php?title=Wikip%C3%A9dia:Sabia_que/Frequ%C3%AAncia&action=raw&templates=expand");
if ($htmlTime === FALSE) die("Nao foi possível recuperar os dados do contador.");

//Limite de segurança
if (is_numeric($htmlTime) === FALSE OR $htmlTime < 43200) {
die("'Wikipédia:Sabia que/Frequência' possui valor não numérico ou menor que 43200. Bloqueio de segurança.");
}
if (is_numeric($htmlTime) === FALSE OR $htmlTime < 43200) die("'Wikipédia:Sabia que/Frequência' possui valor não numérico ou menor que 43200. Bloqueio de segurança.");

//Recupera horário da última alteração
$get = file_get_contents("https://pt.wikipedia.org/w/api.php?action=query&format=json&list=usercontribs&uclimit=1&ucuser=SabiaQueBot&ucprop=timestamp");
Expand Down Expand Up @@ -360,7 +356,7 @@

////////////////////////////////////////////////////////////////////////////////////////
//
// Seção provisória, até a ativação da função de gravar página
// Seção de debug, caso necessário
//
////////////////////////////////////////////////////////////////////////////////////////

Expand Down

0 comments on commit fa35a02

Please sign in to comment.