On ajoute une nouvelle methode pour calculer la chaine, pour cela, une
serialize une array 3 dimensions : sql_fetch_all on ajoute une constante define("_BLOCKLOG_CHAINE_SIMPLE", true); pour garder l'ancien fonctionnement et on peut utliser aussi la branche V1
This commit is contained in:
parent
0ae0147a1c
commit
b6710055e7
3 changed files with 35 additions and 15 deletions
21
README.md
21
README.md
|
@ -3,14 +3,9 @@
|
|||
## Utilisation
|
||||
> Génération du blocklog
|
||||
```php
|
||||
$requete = sql_allfetsel($s, $f, $w,'','','','','', false);
|
||||
$blocklog = charger_fonction('blocklog', 'inc');
|
||||
// $chaine : string ou array
|
||||
$blocklog("monObjet", $id_objet, $num_dossier, $chaine);
|
||||
```
|
||||
|
||||
## Page html de generation d'un bloclog
|
||||
```
|
||||
?page=sha256sum
|
||||
$blocklog($objet, $id_objet, $numero_facture, $requete);
|
||||
```
|
||||
|
||||
## options :
|
||||
|
@ -21,4 +16,16 @@ define("_BLOCKLOG_ALGO", 'sha256');
|
|||
//activer les log : blocklog.log
|
||||
define("_DEBUG_BLOCKLOG", true);
|
||||
|
||||
// garder le calcul de la chaine simple, requete avec sql_fetch et non sql_fetch_all
|
||||
// utiliser sur lcdp
|
||||
// l'autre solution est de rester en version 1 du plugin
|
||||
define("_BLOCKLOG_CHAINE_SIMPLE", true);
|
||||
|
||||
|
||||
```
|
||||
|
||||
## Page html de generation d'un bloclog
|
||||
```
|
||||
?page=sha256sum
|
||||
```
|
||||
|
||||
|
|
|
@ -108,15 +108,28 @@ function blocklog_creer_chaine($requete = ""){
|
|||
return '';
|
||||
}
|
||||
|
||||
$r = sql_query($requete);
|
||||
$chaine = sql_fetch($r);
|
||||
$get_infos = charger_fonction('get_infos', 'plugins');
|
||||
$version = $get_infos('blocklog');
|
||||
|
||||
if (is_array($chaine)) {
|
||||
$c = [];
|
||||
foreach ($chaine as $i => $v) {
|
||||
$c[] = $v;
|
||||
$r = sql_query($requete);
|
||||
|
||||
if (
|
||||
intval($version) < 2
|
||||
or defined('_BLOCKLOG_CHAINE_SIMPLE')
|
||||
) {
|
||||
$chaine = sql_fetch($r);
|
||||
if (is_array($chaine)) {
|
||||
$c = [];
|
||||
foreach ($chaine as $i => $v) {
|
||||
$c[] = $v;
|
||||
}
|
||||
$chaine = implode('|', $c);
|
||||
}
|
||||
} else {
|
||||
$chaine = sql_fetch_all($r);
|
||||
if (is_array($chaine)) {
|
||||
$chaine = serialize($chaine);
|
||||
}
|
||||
$chaine = implode('|', $c);
|
||||
}
|
||||
|
||||
$chaine = hash(_BLOCKLOG_ALGO, $chaine);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<paquet
|
||||
prefix="blocklog"
|
||||
categorie="outil"
|
||||
version="1.1.5"
|
||||
version="2.0.0"
|
||||
etat="dev"
|
||||
compatibilite="[3.2.0;4.0.*]"
|
||||
logo="prive/themes/spip/images/blocklog-64.png"
|
||||
|
|
Loading…
Add table
Reference in a new issue