From 9e81b1fd728758f6fba3a34ab27d56ab96e391f2 Mon Sep 17 00:00:00 2001 From: Jean Paul Galea Date: Fri, 17 Jul 2015 22:51:11 +0200 Subject: [PATCH] Refactor. - minor improvements. - move $ret init right before it's used. - use string substitution rather than concatenation. --- ykval-common.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ykval-common.php b/ykval-common.php index 681e09b..f4ebb52 100644 --- a/ykval-common.php +++ b/ykval-common.php @@ -169,11 +169,12 @@ function retrieveURLasync($ident, $urls, $logger, $ans_req=1, $match="^OK", $ret while ($info = curl_multi_info_read($mh)) { - $logger->log(LOG_DEBUG, $ident . " curl multi info : ", $info); + $logger->log(LOG_DEBUG, "$ident curl multi info : ", $info); if ($info['result'] == CURLE_OK) { $str = curl_multi_getcontent($info['handle']); + $logger->log(LOG_DEBUG, "$ident curl multi content : $str"); if (preg_match("/$match/", $str)) @@ -227,8 +228,6 @@ function retrieveURLasync($ident, $urls, $logger, $ans_req=1, $match="^OK", $ret function KSMdecryptOTP($urls, $logger, $curlopts) { - $ret = array(); - if (!is_array($urls)) { $urls = array($urls); @@ -245,6 +244,8 @@ function KSMdecryptOTP($urls, $logger, $curlopts) $logger->log(LOG_DEBUG, log_format('YK-KSM response: ', $response)); + $ret = array(); + if (sscanf($response, 'OK counter=%04x low=%04x high=%02x use=%02x', $ret['session_counter'],