diff --git a/mod/directory.php b/mod/directory.php index 6fd99256f..46c4f38ad 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -6,6 +6,8 @@ function directory_init(&$a) { if(local_user()) { require_once('include/contact_widgets.php'); + $a->page['aside'] .= follow_widget(); + $a->page['aside'] .= findpeople_widget(); } @@ -31,7 +33,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 +46,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 +146,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 +153,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,12 +178,27 @@ function directory_content(&$a) { unset($profile); unset($location); - $o .= $entry; + if(! $arr['entry']) + continue; + + $entries[] = $arr['entry']; } - $o .= "
\r\n"; - $o .= paginate($a); + $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 : ""), + '$title' => t('Site Directory'), + '$submit' => t('Find'), + '$paginate' => paginate($a), + )); } else diff --git a/view/templates/directory_header.tpl b/view/templates/directory_header.tpl index 2274f2e1f..eda887a89 100644 --- a/view/templates/directory_header.tpl +++ b/view/templates/directory_header.tpl @@ -1,17 +1,31 @@ -

{{$sitedir}}

+{{include file="section_title.tpl"}} -{{$globaldir}} -{{$admin}} +{{if $gdirpath}} + +{{/if}} -{{$finding}}
-
-{{$desc}} - - -
+
+ {{$desc}} + + +
+ +{{if $findterm}} +

{{$finding}} '{{$findterm}}'

+{{/if}} +
+{{foreach $entries as $entry}} + {{include file="directory_item.tpl"}} +{{/foreach}} + +
+ +{{$paginate}} 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 @@ -
-
-
- {{$alt_text}} +
+
+
-
{{$name}}
-
{{$details}}
+
{{$entry.name}}
+
{{$entry.details}}