directory.php - code beautification (PSR)
This commit is contained in:
parent
2efd4ba780
commit
c78572bf47
1 changed files with 78 additions and 71 deletions
|
@ -12,12 +12,12 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
|
||||
function directory_init(App $a) {
|
||||
function directory_init(App $a)
|
||||
{
|
||||
$a->set_pager_itemspage(60);
|
||||
|
||||
if (local_user()) {
|
||||
$a->page['aside'] .= Widget::findPeople();
|
||||
|
||||
$a->page['aside'] .= Widget::follow();
|
||||
} else {
|
||||
unset($_SESSION['theme']);
|
||||
|
@ -25,16 +25,20 @@ function directory_init(App $a) {
|
|||
}
|
||||
}
|
||||
|
||||
function directory_post(App $a) {
|
||||
if(x($_POST,'search'))
|
||||
function directory_post(App $a)
|
||||
{
|
||||
if (x($_POST, 'search')) {
|
||||
$a->data['search'] = $_POST['search'];
|
||||
}
|
||||
}
|
||||
|
||||
function directory_content(App $a) {
|
||||
function directory_content(App $a)
|
||||
{
|
||||
require_once("mod/proxy.php");
|
||||
|
||||
if((Config::get('system','block_public')) && (! local_user()) && (! remote_user()) ||
|
||||
(Config::get('system','block_local_dir')) && (! local_user()) && (! remote_user())) {
|
||||
if ((Config::get('system', 'block_public') && !local_user() && !remote_user())
|
||||
|| (Config::get('system', 'block_local_dir') && !local_user() && !remote_user())
|
||||
) {
|
||||
notice(L10n::t('Public access denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
@ -42,10 +46,11 @@ function directory_content(App $a) {
|
|||
$o = '';
|
||||
Nav::setSelected('directory');
|
||||
|
||||
if(x($a->data,'search'))
|
||||
if (x($a->data, 'search')) {
|
||||
$search = notags(trim($a->data['search']));
|
||||
else
|
||||
} else {
|
||||
$search = ((x($_GET, 'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
|
||||
}
|
||||
|
||||
$gdirpath = '';
|
||||
$dirurl = Config::get('system', 'directory');
|
||||
|
@ -76,11 +81,13 @@ function directory_content(App $a) {
|
|||
$publish = ((Config::get('system', 'publish_all')) ? '' : " AND `publish` = 1 " );
|
||||
|
||||
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `profile`
|
||||
$total = q("SELECT COUNT(*) AS `total` FROM `profile`
|
||||
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
||||
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra ");
|
||||
if (DBM::is_result($r))
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra "
|
||||
);
|
||||
if (DBM::is_result($total)) {
|
||||
$a->set_pager_total($total[0]['total']);
|
||||
}
|
||||
|
||||
$order = " ORDER BY `name` ASC ";
|
||||
|
||||
|
@ -90,18 +97,16 @@ function directory_content(App $a) {
|
|||
`contact`.`addr`, `contact`.`url` AS profile_url FROM `profile`
|
||||
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
||||
LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid`
|
||||
WHERE `is-default` $publish AND `user`.`blocked` = 0 AND `contact`.`self` $sql_extra $order LIMIT ".$limit);
|
||||
WHERE `is-default` $publish AND `user`.`blocked` = 0 AND `contact`.`self` $sql_extra $order LIMIT ".$limit
|
||||
);
|
||||
if (DBM::is_result($r)) {
|
||||
|
||||
if (in_array('small', $a->argv)) {
|
||||
$photo = 'thumb';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$photo = 'photo';
|
||||
}
|
||||
|
||||
while ($rr = dba::fetch($r)) {
|
||||
|
||||
$itemurl= '';
|
||||
|
||||
$itemurl = (($rr['addr'] != "") ? $rr['addr'] : $rr['profile_url']);
|
||||
|
@ -111,16 +116,19 @@ function directory_content(App $a) {
|
|||
$pdesc = (($rr['pdesc']) ? $rr['pdesc'] . '<br />' : '');
|
||||
|
||||
$details = '';
|
||||
if(strlen($rr['locality']))
|
||||
if (strlen($rr['locality'])) {
|
||||
$details .= $rr['locality'];
|
||||
}
|
||||
if (strlen($rr['region'])) {
|
||||
if(strlen($rr['locality']))
|
||||
if (strlen($rr['locality'])) {
|
||||
$details .= ', ';
|
||||
}
|
||||
$details .= $rr['region'];
|
||||
}
|
||||
if (strlen($rr['country-name'])) {
|
||||
if(strlen($details))
|
||||
if (strlen($details)) {
|
||||
$details .= ', ';
|
||||
}
|
||||
$details .= $rr['country-name'];
|
||||
}
|
||||
// if(strlen($rr['dob'])) {
|
||||
|
@ -136,16 +144,15 @@ function directory_content(App $a) {
|
|||
|| (x($profile, 'locality') == 1)
|
||||
|| (x($profile, 'region') == 1)
|
||||
|| (x($profile, 'postal-code') == 1)
|
||||
|| (x($profile,'country-name') == 1))
|
||||
|| (x($profile, 'country-name') == 1)
|
||||
) {
|
||||
$location = L10n::t('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 = ((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);
|
||||
|
||||
$location_e = $location;
|
||||
|
||||
|
|
Loading…
Reference in a new issue