1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-02-01 01:52:18 +01:00

put building syncurl in a function

This commit is contained in:
Klas Lindfors 2016-03-07 21:16:21 +01:00
parent 2a0f74c78d
commit ba0d6fc193

View File

@ -315,10 +315,7 @@ class SyncLib
$handle = $ch[$entry['server']]; $handle = $ch[$entry['server']];
$this->log(LOG_INFO, "server=" . $entry['server'] . ", server_nonce=" . $entry['server_nonce'] . ", info=" . $entry['info']); $this->log(LOG_INFO, "server=" . $entry['server'] . ", server_nonce=" . $entry['server_nonce'] . ", info=" . $entry['info']);
$url = $entry['server'] . $url = $this->buildSyncUrl($entry);
"?otp=" . $entry['otp'] .
"&modified=" . $entry['modified'] .
"&" . $this->otpPartFromInfoString($entry['info']);
curl_settings($this, 'YK-VAL resync', $handle, $url, $timeout, $this->curlopts); curl_settings($this, 'YK-VAL resync', $handle, $url, $timeout, $this->curlopts);
$entries[$entry['server']] = $entry; $entries[$entry['server']] = $entry;
@ -432,10 +429,7 @@ class SyncLib
} }
$this->log(LOG_INFO, "server=" . $entry['server'] . ", server_nonce=" . $entry['server_nonce'] . ", info=" . $entry['info']); $this->log(LOG_INFO, "server=" . $entry['server'] . ", server_nonce=" . $entry['server_nonce'] . ", info=" . $entry['info']);
$url = $entry['server'] . $url = $this->buildSyncUrl($entry);
"?otp=" . $entry['otp'] .
"&modified=" . $entry['modified'] .
"&" . $this->otpPartFromInfoString($entry['info']);
curl_settings($this, 'YK-VAL resync', $handle, $url, $timeout, $this->curlopts); curl_settings($this, 'YK-VAL resync', $handle, $url, $timeout, $this->curlopts);
$entries[$server] = $entry; $entries[$server] = $entry;
@ -469,10 +463,7 @@ class SyncLib
)); ));
foreach ($res as $row) foreach ($res as $row)
{ {
$urls[] = $row['server'] . $urls[] = $this->buildSyncUrl($row);
"?otp=" . $row['otp'] .
"&modified=" . $row['modified'] .
"&" . $this->otpPartFromInfoString($row['info']);
} }
// send out requests // send out requests
@ -665,4 +656,12 @@ class SyncLib
'server' => $server 'server' => $server
)); ));
} }
private function buildSyncUrl($entry)
{
return $entry['server'] .
"?otp=" . $entry['otp'] .
"&modified=" . $entry['modified'] .
"&" . $this->otpPartFromInfoString($entry['info']);
}
} }