merge
This commit is contained in:
parent
0186c57aa6
commit
4521675196
1 changed files with 31 additions and 35 deletions
|
@ -15,23 +15,18 @@ if (!defined('_ECRIRE_INC_VERSION')) {
|
|||
|
||||
function trouver_blocklog($id_objet, $objet, $all = false){
|
||||
static $r;
|
||||
|
||||
if ($r == null) {
|
||||
$from = array(
|
||||
'spip_blocklogs',
|
||||
);
|
||||
$where = array(
|
||||
if (is_null($r)) {
|
||||
$where = [
|
||||
'id_objet='.intval($id_objet),
|
||||
'objet='.sql_quote($objet),
|
||||
);
|
||||
$r = sql_fetsel('id_blocklog, blockchaine, chaine, requete', $from, $where);
|
||||
];
|
||||
$r = sql_fetsel('id_blocklog, blockchaine, chaine, requete', 'spip_blocklogs', $where);
|
||||
}
|
||||
|
||||
if ($all) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
return $r['blockchaine'];
|
||||
return $r['blockchaine'] ?? '';
|
||||
}
|
||||
|
||||
function blockchaine_sur_pdf(){
|
||||
|
@ -41,7 +36,7 @@ function blockchaine_sur_pdf(){
|
|||
return false;
|
||||
}
|
||||
|
||||
function afficher_blocklog($texte = '', $id_dossier = 0, $objet = '', $type = 'chaine'){
|
||||
function afficher_blocklog($texte = '', $id_objet = 0, $objet = '', $type = 'chaine'){
|
||||
$objet = trim($objet);
|
||||
|
||||
$blockchaine = '<span class="affichage_blockchaine">';
|
||||
|
@ -50,10 +45,11 @@ function afficher_blocklog($texte = '', $id_dossier = 0, $objet = '', $type = 'c
|
|||
$img = '<img class="icone_blockchaine" src="'.$img.'" style="height:1em;width: 1em;">';
|
||||
$img .= " ";
|
||||
}
|
||||
if (!defined('_BLOCKLOG_CACHER_PDF') or (defined('_BLOCKLOG_CACHER_PDF') and _BLOCKLOG_CACHER_PDF !== true)){
|
||||
if (intval($id_dossier) and $objet) {
|
||||
if (!defined('_BLOCKLOG_CACHER_PDF') or _BLOCKLOG_CACHER_PDF !== true){
|
||||
if (intval($id_objet) and $objet) {
|
||||
$recup_bl = trouver_blocklog($id_objet, $objet, true);
|
||||
$blockchaine .= $img;
|
||||
$blockchaine .= trouver_blocklog($id_dossier, $objet, true)[$type];
|
||||
$blockchaine .= $recup_bl[$type] ?? '';
|
||||
$blockchaine .= '</span>';
|
||||
}
|
||||
}
|
||||
|
@ -75,23 +71,23 @@ function blocklog_verifier_blockchaine($num, $objet){
|
|||
);
|
||||
$r = sql_fetsel('id_blocklog, blockchaine, chaine, requete', 'spip_blocklogs', $where);
|
||||
|
||||
$where = array(
|
||||
'objet='.sql_quote($objet),
|
||||
'id_blocklog<'.intval($r['id_blocklog'])
|
||||
);
|
||||
if (is_array($r)) {
|
||||
$where = array(
|
||||
'objet='.sql_quote($objet),
|
||||
'id_blocklog<'.intval($r['id_blocklog'])
|
||||
);
|
||||
|
||||
$blockchaine_prec = sql_getfetsel('blockchaine', 'spip_blocklogs', $where, 'id_blocklog DESC', 1);
|
||||
$blockchaine_prec = sql_getfetsel('blockchaine', 'spip_blocklogs', $where, 'id_blocklog DESC', 1) ?? '';
|
||||
$blockchaine = $blockchaine_prec . $r['chaine'];
|
||||
$blockchaine = hash(_BLOCKLOG_ALGO, $blockchaine);
|
||||
|
||||
|
||||
$blockchaine = $blockchaine_prec . $r['chaine'];
|
||||
$blockchaine = hash(_BLOCKLOG_ALGO, $blockchaine);
|
||||
|
||||
return $blockchaine === $r['blockchaine'];
|
||||
return $blockchaine === $r['blockchaine'];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function blocklog_verifier_chaine($num, $objet){
|
||||
|
||||
if (intval($num) and $objet) {
|
||||
$where = array(
|
||||
'num='.intval($num),
|
||||
|
@ -99,11 +95,14 @@ function blocklog_verifier_chaine($num, $objet){
|
|||
);
|
||||
$r = sql_fetsel('id_blocklog, blockchaine, chaine, requete', 'spip_blocklogs', $where);
|
||||
|
||||
$chaine_bdd = $r['chaine'];
|
||||
$chaine_dynamique = blocklog_creer_chaine($r['requete']);
|
||||
if (isset($r['chaine']) and isset($r['requete'])) {
|
||||
$chaine_bdd = $r['chaine'];
|
||||
$chaine_dynamique = blocklog_creer_chaine($r['requete']);
|
||||
|
||||
return $chaine_bdd === $chaine_dynamique;
|
||||
return $chaine_bdd === $chaine_dynamique;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function blocklog_creer_chaine($requete = ""){
|
||||
|
@ -116,10 +115,7 @@ function blocklog_creer_chaine($requete = ""){
|
|||
|
||||
$r = sql_query($requete);
|
||||
|
||||
if (
|
||||
intval($version) < 2
|
||||
or defined('_BLOCKLOG_CHAINE_SIMPLE')
|
||||
) {
|
||||
if (intval($version) < 2 or defined('_BLOCKLOG_CHAINE_SIMPLE')) {
|
||||
$chaine = sql_fetch($r);
|
||||
if (is_array($chaine)) {
|
||||
$c = [];
|
||||
|
@ -141,10 +137,10 @@ function blocklog_creer_chaine($requete = ""){
|
|||
}
|
||||
|
||||
function blocklog_creer_blockchaine($chaine, $objet){
|
||||
$where = array(
|
||||
$where = [
|
||||
'objet='.sql_quote($objet)
|
||||
);
|
||||
$blockchaine = sql_getfetsel('blockchaine', 'spip_blocklogs', $where,'', 'id_blocklog DESC', '1');
|
||||
];
|
||||
$blockchaine = sql_getfetsel('blockchaine', 'spip_blocklogs', $where,'', 'id_blocklog DESC', '1') ?? '';
|
||||
$blockchaine .= $chaine;
|
||||
$blockchaine = hash(_BLOCKLOG_ALGO, $blockchaine);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue