1
0
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

@ -33,6 +33,7 @@ use Friendica\Protocol\ActivityPub;
use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\Strings;
use Friendica\Util\XML;
require_once 'include/enotify.php';
@ -263,7 +264,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
break;
case 1:
// birthday paradox - generate new dfrn-id and fall through.
$new_dfrn_id = random_string();
$new_dfrn_id = Strings::getRandomHex();
q("UPDATE contact SET `issued-id` = '%s' WHERE `id` = %d AND `uid` = %d",
DBA::escape($new_dfrn_id),
intval($contact_id),

View file

@ -14,6 +14,7 @@ use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\Diaspora;
use Friendica\Util\Strings;
require_once 'include/items.php';
@ -267,7 +268,7 @@ function dfrn_notify_content(App $a) {
$dfrn_id = substr($dfrn_id,2);
}
$hash = random_string();
$hash = Strings::getRandomHex();
$status = 0;

View file

@ -14,6 +14,7 @@ use Friendica\Module\Login;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\OStatus;
use Friendica\Util\Network;
use Friendica\Util\Strings;
use Friendica\Util\XML;
require_once 'include/items.php';
@ -415,7 +416,7 @@ function dfrn_poll_content(App $a)
if ($dfrn_id != '') {
// initial communication from external contact
$hash = random_string();
$hash = Strings::getRandomHex();
$status = 0;

View file

@ -28,6 +28,7 @@ use Friendica\Module\Login;
use Friendica\Network\Probe;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\Strings;
require_once 'include/enotify.php';
@ -320,7 +321,7 @@ function dfrn_request_post(App $a)
}
}
$issued_id = random_string();
$issued_id = Strings::getRandomHex();
if (is_array($contact_record)) {
// There is a contact record but no issued-id, so this
@ -415,7 +416,7 @@ function dfrn_request_post(App $a)
return;
}
$hash = random_string() . (string) time(); // Generate a confirm_key
$hash = Strings::getRandomHex() . (string) time(); // Generate a confirm_key
if (is_array($contact_record)) {
$ret = q("INSERT INTO `intro` ( `uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)

View file

@ -9,6 +9,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
function fsuggest_post(App $a)
{
@ -34,7 +35,7 @@ function fsuggest_post(App $a)
$new_contact = intval($_POST['suggest']);
$hash = random_string();
$hash = Strings::getRandomHex();
$note = escape_tags(trim(defaults($_POST, 'note', '')));

View file

@ -93,7 +93,7 @@ function pubsubhubbub_init(App $a) {
}
// do subscriber verification according to the PuSH protocol
$hub_challenge = random_string(40);
$hub_challenge = Strings::getRandomHex(40);
$params = 'hub.mode=' .
($subscribe == 1 ? 'subscribe' : 'unsubscribe') .
'&hub.topic=' . urlencode($hub_topic) .

View file

@ -8,6 +8,7 @@ use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Util\Strings;
function redir_init(App $a) {
@ -93,7 +94,7 @@ function redir_init(App $a) {
$dfrn_id = '0:' . $orig_id;
}
$sec = random_string();
$sec = Strings::getRandomHex();
$fields = ['uid' => local_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id,
'sec' => $sec, 'expire' => time() + 45];

View file

@ -68,7 +68,7 @@ function removeme_content(App $a)
$a->internalRedirect();
}
$hash = random_string();
$hash = Strings::getRandomHex();
require_once("mod/settings.php");
settings_init($a);