random_string calls
implement getRandomHex function
This commit is contained in:
parent
fd597472f1
commit
991f259ecb
23 changed files with 47 additions and 29 deletions
|
@ -43,6 +43,7 @@ use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\Proxy as ProxyUtils;
|
use Friendica\Util\Proxy as ProxyUtils;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
require_once 'include/conversation.php';
|
require_once 'include/conversation.php';
|
||||||
|
@ -4802,7 +4803,7 @@ function api_friendica_remoteauth()
|
||||||
$dfrn_id = '0:' . $orig_id;
|
$dfrn_id = '0:' . $orig_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sec = random_string();
|
$sec = Strings::getRandomHex();
|
||||||
|
|
||||||
$fields = ['uid' => api_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id,
|
$fields = ['uid' => api_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id,
|
||||||
'sec' => $sec, 'expire' => time() + 45];
|
'sec' => $sec, 'expire' => time() + 45];
|
||||||
|
|
|
@ -15,6 +15,7 @@ use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Emailer;
|
use Friendica\Util\Emailer;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates a notification entry and possibly sends a mail
|
* @brief Creates a notification entry and possibly sends a mail
|
||||||
|
@ -457,7 +458,7 @@ function notification($params)
|
||||||
Logger::log("adding notification entry", Logger::DEBUG);
|
Logger::log("adding notification entry", Logger::DEBUG);
|
||||||
do {
|
do {
|
||||||
$dups = false;
|
$dups = false;
|
||||||
$hash = random_string();
|
$hash = Strings::getRandomHex();
|
||||||
if (DBA::exists('notify', ['hash' => $hash])) {
|
if (DBA::exists('notify', ['hash' => $hash])) {
|
||||||
$dups = true;
|
$dups = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ use Friendica\Protocol\OStatus;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\ParseUrl;
|
use Friendica\Util\ParseUrl;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
use Friendica\Util\Temporal;
|
use Friendica\Util\Temporal;
|
||||||
|
|
||||||
require_once 'include/text.php';
|
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'];
|
$push_url = System::baseUrl() . '/pubsub/' . $user['nickname'] . '/' . $contact['id'];
|
||||||
|
|
||||||
// Use a single verify token, even if multiple hubs
|
// 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;
|
$params= 'hub.mode=' . $hubmode . '&hub.callback=' . urlencode($push_url) . '&hub.topic=' . urlencode($contact['poll']) . '&hub.verify=async&hub.verify_token=' . $verify_token;
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ use Friendica\Protocol\ActivityPub;
|
||||||
use Friendica\Util\Crypto;
|
use Friendica\Util\Crypto;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
require_once 'include/enotify.php';
|
require_once 'include/enotify.php';
|
||||||
|
@ -263,7 +264,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// birthday paradox - generate new dfrn-id and fall through.
|
// 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",
|
q("UPDATE contact SET `issued-id` = '%s' WHERE `id` = %d AND `uid` = %d",
|
||||||
DBA::escape($new_dfrn_id),
|
DBA::escape($new_dfrn_id),
|
||||||
intval($contact_id),
|
intval($contact_id),
|
||||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Protocol\DFRN;
|
use Friendica\Protocol\DFRN;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
require_once 'include/items.php';
|
require_once 'include/items.php';
|
||||||
|
|
||||||
|
@ -267,7 +268,7 @@ function dfrn_notify_content(App $a) {
|
||||||
$dfrn_id = substr($dfrn_id,2);
|
$dfrn_id = substr($dfrn_id,2);
|
||||||
}
|
}
|
||||||
|
|
||||||
$hash = random_string();
|
$hash = Strings::getRandomHex();
|
||||||
|
|
||||||
$status = 0;
|
$status = 0;
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Module\Login;
|
||||||
use Friendica\Protocol\DFRN;
|
use Friendica\Protocol\DFRN;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
require_once 'include/items.php';
|
require_once 'include/items.php';
|
||||||
|
@ -415,7 +416,7 @@ function dfrn_poll_content(App $a)
|
||||||
|
|
||||||
if ($dfrn_id != '') {
|
if ($dfrn_id != '') {
|
||||||
// initial communication from external contact
|
// initial communication from external contact
|
||||||
$hash = random_string();
|
$hash = Strings::getRandomHex();
|
||||||
|
|
||||||
$status = 0;
|
$status = 0;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Module\Login;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
require_once 'include/enotify.php';
|
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)) {
|
if (is_array($contact_record)) {
|
||||||
// There is a contact record but no issued-id, so this
|
// There is a contact record but no issued-id, so this
|
||||||
|
@ -415,7 +416,7 @@ function dfrn_request_post(App $a)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hash = random_string() . (string) time(); // Generate a confirm_key
|
$hash = Strings::getRandomHex() . (string) time(); // Generate a confirm_key
|
||||||
|
|
||||||
if (is_array($contact_record)) {
|
if (is_array($contact_record)) {
|
||||||
$ret = q("INSERT INTO `intro` ( `uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
|
$ret = q("INSERT INTO `intro` ( `uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
|
||||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
function fsuggest_post(App $a)
|
function fsuggest_post(App $a)
|
||||||
{
|
{
|
||||||
|
@ -34,7 +35,7 @@ function fsuggest_post(App $a)
|
||||||
|
|
||||||
$new_contact = intval($_POST['suggest']);
|
$new_contact = intval($_POST['suggest']);
|
||||||
|
|
||||||
$hash = random_string();
|
$hash = Strings::getRandomHex();
|
||||||
|
|
||||||
$note = escape_tags(trim(defaults($_POST, 'note', '')));
|
$note = escape_tags(trim(defaults($_POST, 'note', '')));
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ function pubsubhubbub_init(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// do subscriber verification according to the PuSH protocol
|
// do subscriber verification according to the PuSH protocol
|
||||||
$hub_challenge = random_string(40);
|
$hub_challenge = Strings::getRandomHex(40);
|
||||||
$params = 'hub.mode=' .
|
$params = 'hub.mode=' .
|
||||||
($subscribe == 1 ? 'subscribe' : 'unsubscribe') .
|
($subscribe == 1 ? 'subscribe' : 'unsubscribe') .
|
||||||
'&hub.topic=' . urlencode($hub_topic) .
|
'&hub.topic=' . urlencode($hub_topic) .
|
||||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
function redir_init(App $a) {
|
function redir_init(App $a) {
|
||||||
|
|
||||||
|
@ -93,7 +94,7 @@ function redir_init(App $a) {
|
||||||
$dfrn_id = '0:' . $orig_id;
|
$dfrn_id = '0:' . $orig_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sec = random_string();
|
$sec = Strings::getRandomHex();
|
||||||
|
|
||||||
$fields = ['uid' => local_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id,
|
$fields = ['uid' => local_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id,
|
||||||
'sec' => $sec, 'expire' => time() + 45];
|
'sec' => $sec, 'expire' => time() + 45];
|
||||||
|
|
|
@ -68,7 +68,7 @@ function removeme_content(App $a)
|
||||||
$a->internalRedirect();
|
$a->internalRedirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
$hash = random_string();
|
$hash = Strings::getRandomHex();
|
||||||
|
|
||||||
require_once("mod/settings.php");
|
require_once("mod/settings.php");
|
||||||
settings_init($a);
|
settings_init($a);
|
||||||
|
|
|
@ -38,7 +38,7 @@ text { font:12px Dialog; }
|
||||||
<text x="904" y="1084" style="font:13px Open Sans">where self = 0 to look if this contact is already there (if </text>
|
<text x="904" y="1084" style="font:13px Open Sans">where self = 0 to look if this contact is already there (if </text>
|
||||||
<text x="904" y="1107" style="font:13px Open Sans">issued-id or rel is already available return here because it </text>
|
<text x="904" y="1107" style="font:13px Open Sans">issued-id or rel is already available return here because it </text>
|
||||||
<text x="904" y="1130" style="font:13px Open Sans">seems that we are already connected)</text>
|
<text x="904" y="1130" style="font:13px Open Sans">seems that we are already connected)</text>
|
||||||
<text x="904" y="1176" style="font:13px Open Sans">- create a issued-id with $issued_id = random_string();</text>
|
<text x="904" y="1176" style="font:13px Open Sans">- create a issued-id with $issued_id = Strings::getRandomHex();</text>
|
||||||
<text x="904" y="1222" style="font:13px Open Sans">- if we already found a contact record above update the </text>
|
<text x="904" y="1222" style="font:13px Open Sans">- if we already found a contact record above update the </text>
|
||||||
<text x="904" y="1245" style="font:13px Open Sans">issued-id with the one we have created</text>
|
<text x="904" y="1245" style="font:13px Open Sans">issued-id with the one we have created</text>
|
||||||
<text x="904" y="1291" style="font:13px Open Sans">- otherwise if Bob is not already in the contact table scrape </text>
|
<text x="904" y="1291" style="font:13px Open Sans">- otherwise if Bob is not already in the contact table scrape </text>
|
||||||
|
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
|
@ -7,6 +7,7 @@ namespace Friendica\Content\Text;
|
||||||
|
|
||||||
use DOMDocument;
|
use DOMDocument;
|
||||||
use DOMXPath;
|
use DOMXPath;
|
||||||
|
use Friendica\Content\Feature;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
@ -17,9 +18,9 @@ use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\Proxy as ProxyUtils;
|
use Friendica\Util\Proxy as ProxyUtils;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
use League\HTMLToMarkdown\HtmlConverter;
|
use League\HTMLToMarkdown\HtmlConverter;
|
||||||
use Friendica\Content\Feature;
|
|
||||||
|
|
||||||
class HTML
|
class HTML
|
||||||
{
|
{
|
||||||
|
@ -1011,7 +1012,7 @@ class HTML
|
||||||
$tpl = Renderer::getMarkupTemplate('wall/content_filter.tpl');
|
$tpl = Renderer::getMarkupTemplate('wall/content_filter.tpl');
|
||||||
$html = Renderer::replaceMacros($tpl, [
|
$html = Renderer::replaceMacros($tpl, [
|
||||||
'$reasons' => $reasons,
|
'$reasons' => $reasons,
|
||||||
'$rnd' => random_string(8),
|
'$rnd' => Strings::getRandomHex(8),
|
||||||
'$openclose' => L10n::t('Click to open/close'),
|
'$openclose' => L10n::t('Click to open/close'),
|
||||||
'$html' => $html
|
'$html' => $html
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\Protocol\PortableContact;
|
||||||
use Friendica\Protocol\Salmon;
|
use Friendica\Protocol\Salmon;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
require_once 'boot.php';
|
require_once 'boot.php';
|
||||||
require_once 'include/dba.php';
|
require_once 'include/dba.php';
|
||||||
|
@ -1889,7 +1890,7 @@ class Contact extends BaseObject
|
||||||
$user = DBA::selectFirst('user', $fields, ['uid' => $importer['uid']]);
|
$user = DBA::selectFirst('user', $fields, ['uid' => $importer['uid']]);
|
||||||
if (DBA::isResult($user) && !in_array($user['page-flags'], [self::PAGE_SOAPBOX, self::PAGE_FREELOVE, self::PAGE_COMMUNITY])) {
|
if (DBA::isResult($user) && !in_array($user['page-flags'], [self::PAGE_SOAPBOX, self::PAGE_FREELOVE, self::PAGE_COMMUNITY])) {
|
||||||
// create notification
|
// create notification
|
||||||
$hash = random_string();
|
$hash = Strings::getRandomHex();
|
||||||
|
|
||||||
if (is_array($contact_record)) {
|
if (is_array($contact_record)) {
|
||||||
DBA::insert('intro', ['uid' => $importer['uid'], 'contact-id' => $contact_record['id'],
|
DBA::insert('intro', ['uid' => $importer['uid'], 'contact-id' => $contact_record['id'],
|
||||||
|
|
|
@ -33,6 +33,7 @@ use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Map;
|
use Friendica\Util\Map;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
use Friendica\Util\Security;
|
use Friendica\Util\Security;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
use Text_LanguageDetect;
|
use Text_LanguageDetect;
|
||||||
|
|
||||||
require_once 'boot.php';
|
require_once 'boot.php';
|
||||||
|
@ -3479,7 +3480,7 @@ class Item extends BaseObject
|
||||||
|
|
||||||
while ((strpos($s, $spoilersearch) !== false)) {
|
while ((strpos($s, $spoilersearch) !== false)) {
|
||||||
$pos = strpos($s, $spoilersearch);
|
$pos = strpos($s, $spoilersearch);
|
||||||
$rnd = random_string(8);
|
$rnd = Strings::getRandomHex(8);
|
||||||
$spoilerreplace = '<br /> <span id="spoiler-wrap-' . $rnd . '" class="spoiler-wrap fakelink" onclick="openClose(\'spoiler-' . $rnd . '\');">' . L10n::t('Click to open/close') . '</span>'.
|
$spoilerreplace = '<br /> <span id="spoiler-wrap-' . $rnd . '" class="spoiler-wrap fakelink" onclick="openClose(\'spoiler-' . $rnd . '\');">' . L10n::t('Click to open/close') . '</span>'.
|
||||||
'<blockquote class="spoiler" id="spoiler-' . $rnd . '" style="display: none;">';
|
'<blockquote class="spoiler" id="spoiler-' . $rnd . '" style="display: none;">';
|
||||||
$s = substr($s, 0, $pos) . $spoilerreplace . substr($s, $pos + strlen($spoilersearch));
|
$s = substr($s, 0, $pos) . $spoilerreplace . substr($s, $pos + strlen($spoilersearch));
|
||||||
|
@ -3490,7 +3491,7 @@ class Item extends BaseObject
|
||||||
|
|
||||||
while ((strpos($s, $authorsearch) !== false)) {
|
while ((strpos($s, $authorsearch) !== false)) {
|
||||||
$pos = strpos($s, $authorsearch);
|
$pos = strpos($s, $authorsearch);
|
||||||
$rnd = random_string(8);
|
$rnd = Strings::getRandomHex(8);
|
||||||
$authorreplace = '<br /> <span id="author-wrap-' . $rnd . '" class="author-wrap fakelink" onclick="openClose(\'author-' . $rnd . '\');">' . L10n::t('Click to open/close') . '</span>'.
|
$authorreplace = '<br /> <span id="author-wrap-' . $rnd . '" class="author-wrap fakelink" onclick="openClose(\'author-' . $rnd . '\');">' . L10n::t('Click to open/close') . '</span>'.
|
||||||
'<blockquote class="author" id="author-' . $rnd . '" style="display: block;">';
|
'<blockquote class="author" id="author-' . $rnd . '" style="display: block;">';
|
||||||
$s = substr($s, 0, $pos) . $authorreplace . substr($s, $pos + strlen($authorsearch));
|
$s = substr($s, 0, $pos) . $authorreplace . substr($s, $pos + strlen($authorsearch));
|
||||||
|
|
|
@ -7,6 +7,7 @@ namespace Friendica\Model;
|
||||||
|
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class interacting with the register database table
|
* Class interacting with the register database table
|
||||||
|
@ -100,7 +101,7 @@ class Register
|
||||||
*/
|
*/
|
||||||
public static function createForApproval($uid, $language, $note = '')
|
public static function createForApproval($uid, $language, $note = '')
|
||||||
{
|
{
|
||||||
$hash = random_string();
|
$hash = Strings::getRandomHex();
|
||||||
|
|
||||||
if (!User::exists($uid)) {
|
if (!User::exists($uid)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Util\HTTPSignature;
|
use Friendica\Util\HTTPSignature;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic Auth (remote authentication) module.
|
* Magic Auth (remote authentication) module.
|
||||||
|
@ -74,7 +75,7 @@ class Magic extends BaseModule
|
||||||
|
|
||||||
$headers = [];
|
$headers = [];
|
||||||
$headers['Accept'] = 'application/x-dfrn+json';
|
$headers['Accept'] = 'application/x-dfrn+json';
|
||||||
$headers['X-Open-Web-Auth'] = random_string();
|
$headers['X-Open-Web-Auth'] = Strings::getRandomHex();
|
||||||
|
|
||||||
// Create a header that is signed with the local users private key.
|
// Create a header that is signed with the local users private key.
|
||||||
$headers = HTTPSignature::createSig(
|
$headers = HTTPSignature::createSig(
|
||||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\OpenWebAuthToken;
|
use Friendica\Model\OpenWebAuthToken;
|
||||||
use Friendica\Util\HTTPSignature;
|
use Friendica\Util\HTTPSignature;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief OpenWebAuth verifier and token generator
|
* @brief OpenWebAuth verifier and token generator
|
||||||
|
@ -62,7 +63,7 @@ class Owa extends BaseModule
|
||||||
Logger::log('OWA success: ' . $contact['addr'], Logger::DATA);
|
Logger::log('OWA success: ' . $contact['addr'], Logger::DATA);
|
||||||
|
|
||||||
$ret['success'] = true;
|
$ret['success'] = true;
|
||||||
$token = random_string(32);
|
$token = Strings::getRandomHex(32);
|
||||||
|
|
||||||
// Store the generated token in the databe.
|
// Store the generated token in the databe.
|
||||||
OpenWebAuthToken::create('owt', 0, $token, $contact['addr']);
|
OpenWebAuthToken::create('owt', 0, $token, $contact['addr']);
|
||||||
|
|
|
@ -24,6 +24,7 @@ use Friendica\Protocol\ActivityPub;
|
||||||
use Friendica\Util\Crypto;
|
use Friendica\Util\Crypto;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
use DomXPath;
|
use DomXPath;
|
||||||
|
|
||||||
|
@ -1648,8 +1649,8 @@ class Probe
|
||||||
$data["nick"] = $data["name"];
|
$data["nick"] = $data["name"];
|
||||||
$data["photo"] = Network::lookupAvatarByEmail($uri);
|
$data["photo"] = Network::lookupAvatarByEmail($uri);
|
||||||
$data["url"] = 'mailto:'.$uri;
|
$data["url"] = 'mailto:'.$uri;
|
||||||
$data["notify"] = 'smtp '.random_string();
|
$data["notify"] = 'smtp ' . Strings::getRandomHex();
|
||||||
$data["poll"] = 'email '.random_string();
|
$data["poll"] = 'email ' . Strings::getRandomHex();
|
||||||
|
|
||||||
$x = Email::messageMeta($mbox, $msgs[0]);
|
$x = Email::messageMeta($mbox, $msgs[0]);
|
||||||
if (stristr($x[0]->from, $uri)) {
|
if (stristr($x[0]->from, $uri)) {
|
||||||
|
|
|
@ -33,6 +33,7 @@ use Friendica\Object\Image;
|
||||||
use Friendica\Util\Crypto;
|
use Friendica\Util\Crypto;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
use HTMLPurifier;
|
use HTMLPurifier;
|
||||||
use HTMLPurifier_Config;
|
use HTMLPurifier_Config;
|
||||||
|
@ -2009,7 +2010,7 @@ class DFRN
|
||||||
|
|
||||||
$fid = $r[0]["id"];
|
$fid = $r[0]["id"];
|
||||||
|
|
||||||
$hash = random_string();
|
$hash = Strings::getRandomHex();
|
||||||
|
|
||||||
$r = q(
|
$r = q(
|
||||||
"INSERT INTO `intro` (`uid`, `fid`, `contact-id`, `note`, `hash`, `datetime`, `blocked`)
|
"INSERT INTO `intro` (`uid`, `fid`, `contact-id`, `note`, `hash`, `datetime`, `blocked`)
|
||||||
|
@ -3030,7 +3031,7 @@ class DFRN
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sec = random_string();
|
$sec = Strings::getRandomHex();
|
||||||
|
|
||||||
DBA::insert('profile_check', ['uid' => local_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id, 'sec' => $sec, 'expire' => time() + 45]);
|
DBA::insert('profile_check', ['uid' => local_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id, 'sec' => $sec, 'expire' => time() + 45]);
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ use Friendica\Util\Crypto;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Map;
|
use Friendica\Util\Map;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
use SimpleXMLElement;
|
use SimpleXMLElement;
|
||||||
|
|
||||||
|
@ -2421,7 +2422,7 @@ class Diaspora
|
||||||
if (in_array($importer["page-flags"], [Contact::PAGE_NORMAL, Contact::PAGE_PRVGROUP])) {
|
if (in_array($importer["page-flags"], [Contact::PAGE_NORMAL, Contact::PAGE_PRVGROUP])) {
|
||||||
Logger::log("Sending intra message for author ".$author.".", Logger::DEBUG);
|
Logger::log("Sending intra message for author ".$author.".", Logger::DEBUG);
|
||||||
|
|
||||||
$hash = random_string().(string)time(); // Generate a confirm_key
|
$hash = Strings::getRandomHex().(string)time(); // Generate a confirm_key
|
||||||
|
|
||||||
$ret = q(
|
$ret = q(
|
||||||
"INSERT INTO `intro` (`uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
|
"INSERT INTO `intro` (`uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
|
||||||
|
@ -3055,7 +3056,7 @@ class Diaspora
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
$logid = random_string(4);
|
$logid = String::getRandomHex(4);
|
||||||
|
|
||||||
$dest_url = ($public_batch ? $contact["batch"] : $contact["notify"]);
|
$dest_url = ($public_batch ? $contact["batch"] : $contact["notify"]);
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ class LDSignature
|
||||||
{
|
{
|
||||||
$options = [
|
$options = [
|
||||||
'type' => 'RsaSignature2017',
|
'type' => 'RsaSignature2017',
|
||||||
'nonce' => random_string(64),
|
'nonce' => Strings::getRandomHex(64),
|
||||||
'creator' => $owner['url'] . '#main-key',
|
'creator' => $owner['url'] . '#main-key',
|
||||||
'created' => DateTimeFormat::utcNow(DateTimeFormat::ATOM)
|
'created' => DateTimeFormat::utcNow(DateTimeFormat::ATOM)
|
||||||
];
|
];
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Strings
|
||||||
* @param int $size
|
* @param int $size
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getRandomHex($size = 64) // random_string()
|
public static function getRandomHex($size = 64)
|
||||||
{
|
{
|
||||||
$byte_size = ceil($size / 2);
|
$byte_size = ceil($size / 2);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue