X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fdirectory.php;h=6ef3134517cf60cf3bd3ecf8ef8681eb7b794b79;hb=41663c7592abe55a958632c3a48265e0a8544d2b;hp=10eaa449225c207dbaf15c379db000917bde62fe;hpb=7d5494dd67f58e1fc63c6571946e26290092321c;p=friendica.git
diff --git a/mod/directory.php b/mod/directory.php
index 10eaa44922..6ef3134517 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -7,14 +7,15 @@ use Friendica\App;
use Friendica\Content\Nav;
use Friendica\Content\Pager;
use Friendica\Content\Widget;
-use Friendica\Core\Addon;
use Friendica\Core\Config;
+use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Util\Proxy as ProxyUtils;
+use Friendica\Util\Strings;
function directory_init(App $a)
{
@@ -29,7 +30,7 @@ function directory_init(App $a)
function directory_post(App $a)
{
- if (x($_POST, 'search')) {
+ if (!empty($_POST['search'])) {
$a->data['search'] = $_POST['search'];
}
}
@@ -46,10 +47,10 @@ function directory_content(App $a)
$o = '';
Nav::setSelected('directory');
- if (x($a->data, 'search')) {
- $search = notags(trim($a->data['search']));
+ if (!empty($a->data['search'])) {
+ $search = Strings::escapeTags(trim($a->data['search']));
} else {
- $search = ((x($_GET, 'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
+ $search = (!empty($_GET['search']) ? Strings::escapeTags(trim(rawurldecode($_GET['search']))) : '');
}
$gdirpath = '';
@@ -110,12 +111,12 @@ function directory_content(App $a)
$photo = 'photo';
}
- while ($rr = DBA::fetch($r)) {
- $itemurl= '';
+ $entries = [];
+ while ($rr = DBA::fetch($r)) {
$itemurl = (($rr['addr'] != "") ? $rr['addr'] : $rr['profile_url']);
- $profile_link = 'profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
+ $profile_link = $rr['profile_url'];
$pdesc = (($rr['pdesc']) ? $rr['pdesc'] . '
' : '');
@@ -137,28 +138,28 @@ function directory_content(App $a)
}
// if(strlen($rr['dob'])) {
// if(($years = age($rr['dob'],$rr['timezone'],'')) != 0)
-// $details .= '
' . L10n::t('Age: ') . $years ;
+// $details .= '
' . L10n::t('Age: ') . $years;
// }
// if(strlen($rr['gender']))
// $details .= '
' . L10n::t('Gender: ') . $rr['gender'];
$profile = $rr;
- if ((x($profile, 'address') == 1)
- || (x($profile, 'locality') == 1)
- || (x($profile, 'region') == 1)
- || (x($profile, 'postal-code') == 1)
- || (x($profile, 'country-name') == 1)
+ if (!empty($profile['address'])
+ || !empty($profile['locality'])
+ || !empty($profile['region'])
+ || !empty($profile['postal-code'])
+ || !empty($profile['country-name'])
) {
$location = L10n::t('Location:');
} else {
$location = '';
}
- $gender = ((x($profile, 'gender') == 1) ? L10n::t('Gender:') : false);
- $marital = ((x($profile, 'marital') == 1) ? L10n::t('Status:') : false);
- $homepage = ((x($profile, 'homepage') == 1) ? L10n::t('Homepage:') : false);
- $about = ((x($profile, 'about') == 1) ? L10n::t('About:') : false);
+ $gender = (!empty($profile['gender']) ? L10n::t('Gender:') : false);
+ $marital = (!empty($profile['marital']) ? L10n::t('Status:') : false);
+ $homepage = (!empty($profile['homepage']) ? L10n::t('Homepage:') : false);
+ $about = (!empty($profile['about']) ? L10n::t('About:') : false);
$location_e = $location;
@@ -168,7 +169,7 @@ function directory_content(App $a)
$entry = [
'id' => $rr['id'],
- 'url' => $profile_link,
+ 'url' => Contact::magicLInk($profile_link),
'itemurl' => $itemurl,
'thumb' => ProxyUtils::proxifyUrl($rr[$photo], false, ProxyUtils::SIZE_THUMB),
'img_hover' => $rr['name'],
@@ -189,7 +190,7 @@ function directory_content(App $a)
$arr = ['contact' => $rr, 'entry' => $entry];
- Addon::callHooks('directory_item', $arr);
+ Hook::callAll('directory_item', $arr);
unset($profile);
unset($location);