X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fprofiles.php;h=575d3443fb4d59bd3e73a5a9eb0a9261abe52569;hb=831fff0f5c4497ccb14a9e1cb3299136f5682a3d;hp=58f23e4634afff5d1a87a5af876a0cd5ccb98040;hpb=fa5525d0848af855ff770b206d9ff85911128a5d;p=friendica.git diff --git a/mod/profiles.php b/mod/profiles.php index 58f23e4634..575d3443fb 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -13,14 +13,14 @@ use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\PConfig; 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 +41,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 +62,7 @@ function profiles_init(App $a) { info(L10n::t('Profile deleted.').EOL); } - $a->internalRedirect('profiles'); + DI::baseUrl()->redirect('profiles'); return; // NOTREACHED } @@ -96,10 +96,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 +134,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 +207,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 +238,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 +338,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) { @@ -512,8 +512,8 @@ function profiles_content(App $a) { return; } - $a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('profed_head.tpl'), [ - '$baseurl' => System::baseUrl(true), + DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('profed_head.tpl'), [ + '$baseurl' => DI::baseUrl()->get(true), ]); $opt_tpl = Renderer::getMarkupTemplate("profile-hide-friends.tpl"); @@ -587,14 +587,14 @@ function profiles_content(App $a) { '$lbl_ex2' => L10n::t('Example: fishing photography software'), '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), - '$baseurl' => System::baseUrl(true), + '$baseurl' => DI::baseUrl()->get(true), '$profile_id' => $r[0]['id'], '$profile_name' => ['profile_name', L10n::t('Profile Name:'), $r[0]['profile-name'], L10n::t('Required'), '*'], '$is_default' => $is_default, '$default' => (($is_default) ? '

' . L10n::t('This is your public profile.
It may be visible to anybody using the internet.') . '

' : ""), '$name' => ['name', L10n::t('Your Full Name:'), $r[0]['name']], '$pdesc' => ['pdesc', L10n::t('Title/Description:'), $r[0]['pdesc']], - '$dob' => Temporal::getDateofBirthField($r[0]['dob']), + '$dob' => Temporal::getDateofBirthField($r[0]['dob'], $a->user['timezone']), '$hide_friends' => $hide_friends, '$address' => ['address', L10n::t('Street Address:'), $r[0]['address']], '$locality' => ['locality', L10n::t('Locality/City:'), $r[0]['locality']], @@ -640,7 +640,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 +654,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'],