1
1
Fork 0

random_string calls

implement getRandomHex function
This commit is contained in:
Adam Magness 2018-11-08 08:45:46 -05:00
commit 991f259ecb
23 changed files with 47 additions and 29 deletions

View file

@ -43,6 +43,7 @@ use Friendica\Protocol\Diaspora;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings;
use Friendica\Util\XML;
require_once 'include/conversation.php';
@ -4802,7 +4803,7 @@ function api_friendica_remoteauth()
$dfrn_id = '0:' . $orig_id;
}
$sec = random_string();
$sec = Strings::getRandomHex();
$fields = ['uid' => api_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id,
'sec' => $sec, 'expire' => time() + 45];

View file

@ -15,6 +15,7 @@ use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Emailer;
use Friendica\Util\Strings;
/**
* @brief Creates a notification entry and possibly sends a mail
@ -457,7 +458,7 @@ function notification($params)
Logger::log("adding notification entry", Logger::DEBUG);
do {
$dups = false;
$hash = random_string();
$hash = Strings::getRandomHex();
if (DBA::exists('notify', ['hash' => $hash])) {
$dups = true;
}

View file

@ -21,6 +21,7 @@ use Friendica\Protocol\OStatus;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\ParseUrl;
use Friendica\Util\Strings;
use Friendica\Util\Temporal;
require_once 'include/text.php';
@ -308,7 +309,7 @@ function subscribe_to_hub($url, array $importer, array $contact, $hubmode = 'sub
$push_url = System::baseUrl() . '/pubsub/' . $user['nickname'] . '/' . $contact['id'];
// Use a single verify token, even if multiple hubs
$verify_token = ((strlen($contact['hub-verify'])) ? $contact['hub-verify'] : random_string());
$verify_token = ((strlen($contact['hub-verify'])) ? $contact['hub-verify'] : Strings::getRandomHex());
$params= 'hub.mode=' . $hubmode . '&hub.callback=' . urlencode($push_url) . '&hub.topic=' . urlencode($contact['poll']) . '&hub.verify=async&hub.verify_token=' . $verify_token;