|
|
@ -21,23 +21,23 @@ if (!defined('_ECRIRE_INC_VERSION')) { |
|
|
|
* @return string |
|
|
|
*/ |
|
|
|
function nospam_private_key($jeton) { |
|
|
|
static $private_key; |
|
|
|
static $private_key = []; |
|
|
|
|
|
|
|
if (is_null($private_key)) { |
|
|
|
if (empty($private_key[$jeton])) { |
|
|
|
if (!function_exists('secret_du_site')) { |
|
|
|
include_spip('inc/securiser_action'); |
|
|
|
} |
|
|
|
|
|
|
|
$private_key = $jeton . ":" . __FILE__ . ":" . secret_du_site(); |
|
|
|
$pk = $jeton . ":" . __FILE__ . ":" . secret_du_site(); |
|
|
|
|
|
|
|
if (function_exists('sha1')) |
|
|
|
$private_key = sha1($private_key); |
|
|
|
$pk = sha1($pk); |
|
|
|
else |
|
|
|
$private_key = md5($private_key); |
|
|
|
$private_key = pack("H*", $private_key); |
|
|
|
$pk = md5($pk); |
|
|
|
$private_key[$jeton] = pack("H*", $pk); |
|
|
|
} |
|
|
|
|
|
|
|
return $private_key; |
|
|
|
return $private_key[$jeton]; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -102,6 +102,7 @@ function nospam_name_decode($name, $jeton = "") { |
|
|
|
$cname = _xor($cname, $private_key[$jeton]); |
|
|
|
// si ce n'etait pas un name encode, on retourne le name d'origine
|
|
|
|
if (strncmp($cname, "xx_", 3) !== 0) { |
|
|
|
spip_log("decodage $name avec jeton $jeton errone ($cname)", 'nospam' . _LOG_ERREUR); |
|
|
|
return $decoded[$jeton][$name] = $name; |
|
|
|
} |
|
|
|
|
|
|
|