X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fprofiles.php;h=18fe636d3d5ee229e553cd2f939c88e0937ef0e5;hb=e93fba51362a8cc212cb42542fd013ffd28b1164;hp=72bcac49fc0b6ebf7760111a069f67d8dca16428;hpb=9b12d23a9cc72f10ab5f2d4d1ebdf3366ec4118d;p=friendica.git diff --git a/mod/profiles.php b/mod/profiles.php index 72bcac49fc..18fe636d3d 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -16,11 +16,12 @@ use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Model\Profile; use Friendica\Model\User; -use Friendica\Module\Login; +use Friendica\Module\Security\Login; use Friendica\Network\Probe; use Friendica\Util\DateTimeFormat; use Friendica\Util\Strings; @@ -41,7 +42,7 @@ function profiles_init(App $a) { ); if (! DBA::isResult($r)) { notice(L10n::t('Profile not found.') . EOL); - $a->internalRedirect('profiles'); + DI::baseUrl()->redirect('profiles'); return; // NOTREACHED } @@ -62,7 +63,7 @@ function profiles_init(App $a) { info(L10n::t('Profile deleted.').EOL); } - $a->internalRedirect('profiles'); + DI::baseUrl()->redirect('profiles'); return; // NOTREACHED } @@ -96,10 +97,10 @@ function profiles_init(App $a) { info(L10n::t('New profile created.') . EOL); if (DBA::isResult($r3) && count($r3) == 1) { - $a->internalRedirect('profiles/' . $r3[0]['id']); + DI::baseUrl()->redirect('profiles/' . $r3[0]['id']); } - $a->internalRedirect('profiles'); + DI::baseUrl()->redirect('profiles'); } if (($a->argc > 2) && ($a->argv[1] === 'clone')) { @@ -134,10 +135,10 @@ function profiles_init(App $a) { ); info(L10n::t('New profile created.') . EOL); if ((DBA::isResult($r3)) && (count($r3) == 1)) { - $a->internalRedirect('profiles/'.$r3[0]['id']); + DI::baseUrl()->redirect('profiles/'.$r3[0]['id']); } - $a->internalRedirect('profiles'); + DI::baseUrl()->redirect('profiles'); return; // NOTREACHED } @@ -207,7 +208,7 @@ function profiles_post(App $a) { return; } - $dob = $_POST['dob'] ? Strings::escapeHtml(trim($_POST['dob'])) : '0000-00-00'; + $dob = !empty($_POST['dob']) ? Strings::escapeHtml(trim($_POST['dob'])) : '0000-00-00'; $y = substr($dob, 0, 4); if ((! ctype_digit($y)) || ($y < 1900)) { @@ -238,17 +239,17 @@ function profiles_post(App $a) { $namechanged = true; } - $pdesc = Strings::escapeTags(trim($_POST['pdesc'])); - $gender = Strings::escapeTags(trim($_POST['gender'])); - $address = Strings::escapeTags(trim($_POST['address'])); - $locality = Strings::escapeTags(trim($_POST['locality'])); - $region = Strings::escapeTags(trim($_POST['region'])); - $postal_code = Strings::escapeTags(trim($_POST['postal_code'])); - $country_name = Strings::escapeTags(trim($_POST['country_name'])); - $pub_keywords = profile_clean_keywords(Strings::escapeTags(trim($_POST['pub_keywords']))); - $prv_keywords = profile_clean_keywords(Strings::escapeTags(trim($_POST['prv_keywords']))); - $marital = Strings::escapeTags(trim($_POST['marital'])); - $howlong = Strings::escapeTags(trim($_POST['howlong'])); + $pdesc = Strings::escapeTags(trim($_POST['pdesc'] ?? '')); + $gender = Strings::escapeTags(trim($_POST['gender'] ?? '')); + $address = Strings::escapeTags(trim($_POST['address'] ?? '')); + $locality = Strings::escapeTags(trim($_POST['locality'] ?? '')); + $region = Strings::escapeTags(trim($_POST['region'] ?? '')); + $postal_code = Strings::escapeTags(trim($_POST['postal_code'] ?? '')); + $country_name = Strings::escapeTags(trim($_POST['country_name'] ?? '')); + $pub_keywords = profile_clean_keywords(Strings::escapeTags(trim($_POST['pub_keywords'] ?? ''))); + $prv_keywords = profile_clean_keywords(Strings::escapeTags(trim($_POST['prv_keywords'] ?? ''))); + $marital = Strings::escapeTags(trim($_POST['marital'] ?? '')); + $howlong = Strings::escapeTags(trim($_POST['howlong'] ?? '')); $with = (!empty($_POST['with']) ? Strings::escapeTags(trim($_POST['with'])) : ''); @@ -338,7 +339,7 @@ function profiles_post(App $a) { $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); - PConfig::set(local_user(), 'system', 'detailled_profile', (($_POST['detailed_profile'] == 1) ? 1: 0)); + PConfig::set(local_user(), 'system', 'detailled_profile', !empty($_POST['detailed_profile']) ? 1: 0); $changes = []; if ($is_default) { @@ -640,7 +641,7 @@ function profiles_content(App $a) { ); if (DBA::isResult($r)) { //Go to the default profile. - $a->internalRedirect('profiles/' . $r[0]['id']); + DI::baseUrl()->redirect('profiles/' . $r[0]['id']); } } @@ -654,7 +655,7 @@ function profiles_content(App $a) { $profiles = ''; foreach ($r as $rr) { $profiles .= Renderer::replaceMacros($tpl, [ - '$photo' => $a->removeBaseURL($rr['thumb']), + '$photo' => DI::baseUrl()->remove($rr['thumb']), '$id' => $rr['id'], '$alt' => L10n::t('Profile Image'), '$profile_name' => $rr['profile-name'],