diff --git a/mod/directory.php b/mod/directory.php
index 6fd99256f..2093b1186 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -31,7 +31,7 @@ function directory_content(&$a) {
require_once("mod/proxy.php");
if((get_config('system','block_public')) && (! local_user()) && (! remote_user()) ||
- (get_config('system','block_local_dir')) && (! local_user()) && (! remote_user())) {
+ (get_config('system','block_local_dir')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
return;
}
@@ -44,27 +44,12 @@ function directory_content(&$a) {
else
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
- $tpl = get_markup_template('directory_header.tpl');
-
- $globaldir = '';
- $gdirpath = get_config('system','directory');
- if(strlen($gdirpath)) {
- $globaldir = '
';
+ $gdirpath = '';
+ $dirurl = get_config('system','directory');
+ if(strlen($dirurl)) {
+ $gdirpath = zrl($dirurl,true);
}
- $admin = '';
-
- $o .= replace_macros($tpl, array(
- '$search' => $search,
- '$globaldir' => $globaldir,
- '$desc' => t('Find on this site'),
- '$admin' => $admin,
- '$finding' => (strlen($search) ? '' . t('Finding: ') . "'" . $search . "'" . '
' : ""),
- '$sitedir' => t('Site Directory'),
- '$submit' => t('Find')
- ));
-
if($search) {
$search = dbesc($search);
@@ -159,8 +144,6 @@ function directory_content(&$a) {
$about = ((x($profile,'about') == 1) ? t('About:') : False);
- $tpl = get_markup_template('directory_item.tpl');
-
if($a->theme['template_engine'] === 'internal') {
$location_e = template_escape($location);
}
@@ -168,23 +151,23 @@ function directory_content(&$a) {
$location_e = $location;
}
- $entry = replace_macros($tpl,array(
- '$id' => $rr['id'],
- '$profile_link' => $profile_link,
- '$photo' => proxy_url($a->get_cached_avatar_image($rr[$photo]), false, PROXY_SIZE_THUMB),
- '$alt_text' => $rr['name'],
- '$name' => $rr['name'],
- '$details' => $pdesc . $details,
- '$page_type' => $page_type,
- '$profile' => $profile,
- '$location' => $location_e,
- '$gender' => $gender,
- '$pdesc' => $pdesc,
- '$marital' => $marital,
- '$homepage' => $homepage,
- '$about' => $about,
+ $entry = array(
+ 'id' => $rr['id'],
+ 'profile_link' => $profile_link,
+ 'photo' => proxy_url($a->get_cached_avatar_image($rr[$photo]), false, PROXY_SIZE_THUMB),
+ 'alt_text' => $rr['name'],
+ 'name' => $rr['name'],
+ 'details' => $pdesc . $details,
+ 'page_type' => $page_type,
+ 'profile' => $profile,
+ 'location' => $location_e,
+ 'gender' => $gender,
+ 'pdesc' => $pdesc,
+ 'marital' => $marital,
+ 'homepage' => $homepage,
+ 'about' => $about,
- ));
+ );
$arr = array('contact' => $rr, 'entry' => $entry);
@@ -193,11 +176,27 @@ function directory_content(&$a) {
unset($profile);
unset($location);
- $o .= $entry;
+ if(! $arr['entry'])
+ continue;
+
+ $entries[] = $arr['entry'];
}
- $o .= "\r\n";
+ $tpl = get_markup_template('directory_header.tpl');
+
+ $o .= replace_macros($tpl, array(
+ '$search' => $search,
+ '$globaldir' => t('Global Directory'),
+ '$gdirpath' => $gdirpath,
+ '$desc' => t('Find on this site'),
+ '$entries' => $entries,
+ '$finding' => t('Finding:'),
+ '$findterm' => (strlen($search) ? $search : ""),
+ '$sitedir' => t('Site Directory'),
+ '$submit' => t('Find')
+ ));
+
$o .= paginate($a);
}
diff --git a/view/templates/directory_header.tpl b/view/templates/directory_header.tpl
index 2274f2e1f..ef9aa04af 100644
--- a/view/templates/directory_header.tpl
+++ b/view/templates/directory_header.tpl
@@ -1,17 +1,29 @@
{{$sitedir}}
-{{$globaldir}}
-{{$admin}}
+{{if $gdirpath}}
+
+{{/if}}
-{{$finding}}
-
+
+
+{{if $findterm}}
+ {{$finding}} '{{$findterm}}'
+{{/if}}
+
+{{foreach $entries as $entry}}
+ {{include file="directory_item.tpl"}}
+{{/foreach}}
+
+
\ No newline at end of file
diff --git a/view/templates/directory_item.tpl b/view/templates/directory_item.tpl
index b43fcd28c..4dbe8a951 100644
--- a/view/templates/directory_item.tpl
+++ b/view/templates/directory_item.tpl
@@ -1,12 +1,14 @@
-