From cde8423ebaa718fda20db79b6dd23905abce157a Mon Sep 17 00:00:00 2001
From: Graham Cole <chckens@sucs.org>
Date: Thu, 17 Jan 2008 11:07:14 +0000
Subject: [PATCH] don't include societies without public_html dirs in the
 society website list

---
 components/societies.php | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/components/societies.php b/components/societies.php
index 3eb9ac7..698d6ca 100644
--- a/components/societies.php
+++ b/components/societies.php
@@ -19,9 +19,12 @@ $search = ldap_search($conn, _BASE_DN, 'uid=*', array('uid', 'cn', 'homedirector
                 $fullname = ldap_get_values($conn, $entryHandler, 'cn');
 		$homedir  = ldap_get_values($conn, $entryHandler, 'homedirectory');
 
-		$homedir  = explode('/', $homedir[0]);
+		$homedir = $homedir[0];
+		$homedirArray  = explode('/', $homedir);
 
-                if ($homedir[2]=="society") $usernames[] = array( "username" => $username[0], "fullname" => $fullname[0]);
+			if (($homedirArray[2]=="society") && file_exists( "$homedir/public_html")) { 
+				$usernames[] = array( "username" => $username[0], "fullname" => $fullname[0]);
+			}
                 $entryHandler = ldap_next_entry($conn, $entryHandler);
         }
 
-- 
GitLab