normalise_link calls

implement normaliseLink function
This commit is contained in:
Adam Magness 2018-11-08 11:28:29 -05:00
parent 5276c28a78
commit ffc406d819
54 changed files with 248 additions and 222 deletions

View file

@ -5,6 +5,7 @@ namespace Friendica\Core\Console;
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Database\DBA;
use Friendica\Util\Strings;
use RuntimeException;
/**
@ -60,7 +61,7 @@ HELP;
throw new RuntimeException('Friendica isn\'t properly installed yet.');
}
$nurl = normalise_link($this->getArgument(0));
$nurl = Strings::normaliseLink($this->getArgument(0));
if (!DBA::exists('contact', ['nurl' => $nurl, 'archive' => false])) {
throw new RuntimeException(L10n::t('Could not find any unarchived contact entry for this URL (%s)', $nurl));
}

View file

@ -5,6 +5,7 @@ namespace Friendica\Core\Console;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Network\Probe;
use Friendica\Util\Strings;
use RuntimeException;
require_once 'include/text.php';
@ -79,7 +80,7 @@ HELP;
throw new RuntimeException('This account seems not to exist.');
}
$nurl = normalise_link($net['url']);
$nurl = Strings::normaliseLink($net['url']);
$contact = DBA::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]);
if (DBA::isResult($contact)) {
DBA::update("contact", ["hidden" => true], ["id" => $contact["id"]]);

View file

@ -511,7 +511,7 @@ class Installer
if (function_exists('curl_init')) {
$fetchResult = Network::fetchUrlFull($baseurl . "/install/testrewrite");
$url = normalise_link($baseurl . "/install/testrewrite");
$url = Strings::normaliseLink($baseurl . "/install/testrewrite");
if ($fetchResult->getReturnCode() != 204) {
$fetchResult = Network::fetchUrlFull($url);
}

View file

@ -10,6 +10,7 @@ use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Photo;
use Friendica\Object\Image;
use Friendica\Util\Strings;
require_once "include/dba.php";
@ -119,8 +120,8 @@ class UserImport
$oldbaseurl = $account['baseurl'];
$newbaseurl = System::baseUrl();
$oldaddr = str_replace('http://', '@', normalise_link($oldbaseurl));
$newaddr = str_replace('http://', '@', normalise_link($newbaseurl));
$oldaddr = str_replace('http://', '@', Strings::normaliseLink($oldbaseurl));
$newaddr = str_replace('http://', '@', Strings::normaliseLink($newbaseurl));
if (!empty($account['profile']['addr'])) {
$old_handle = $account['profile']['addr'];