From c19a987e2ee3721e24cf7fb223815223ae4d3229 Mon Sep 17 00:00:00 2001 From: Craig Russell Date: Sat, 15 Jan 2011 15:59:03 +0000 Subject: [PATCH] Moved settings in to seperate file --- README | 14 +-------- ldap-raplet.php | 47 +---------------------------- settings.php | 80 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 59 deletions(-) create mode 100644 settings.php diff --git a/README b/README index f9ac99e..98ae56c 100644 --- a/README +++ b/README @@ -7,19 +7,7 @@ API development docs and discussion at http://groups.google.com/group/raplet-dev Searches for user in LDAP Directory based upon email address. Returns various attributes for display alongside GMail thread. -Settings to configure: - -$ldap_server['hostname'] LDAP Server Hostname or IP -$ldap_server['port'] LDAP Server Port -$ldap_server['bind_rdn'] Bind User Fully Qualified DN -$ldap_server['bind_pass'] Bind User Password -$ldap_server['base_dn'] Search Base -$ldap_server['protocol_version'] LDAP Protocol Version - -$ldap_attributes Array of attributes to return - Key is attribute name (lowercase) - Value is label displayed to user - Elements in display order +Configure settings in settings.php Use test.html to test JSON response to queries. diff --git a/ldap-raplet.php b/ldap-raplet.php index a442e33..7ceb0c7 100644 --- a/ldap-raplet.php +++ b/ldap-raplet.php @@ -15,52 +15,7 @@ ****************************************/ -/******************************** - SETTINGS -********************************/ - -$rapplet_meta['name'] = "LDAP Raplet"; -$rapplet_meta['description'] = "Searches for user in LDAP Directory based upon email address."; -$rapplet_meta['welcome_text'] = "Thanks for using LDAP Raplet"; -$rapplet_meta['icon_url'] = "http://localhost/LDAP-Raplet/icon.png"; -$rapplet_meta['preview_url'] = "http://localhost/LDAP-Raplet/preview.png"; -$rapplet_meta['provider_name'] = "Craig Russell"; -$rapplet_meta['provider_url'] = "http://www.craig-russell.co.uk"; -$rapplet_meta['data_provider_name'] = ""; -$rapplet_meta['data_provider_url'] = ""; -$rapplet_meta['configuration'] = ""; - -// LDAP Server Details -$ldap_server['hostname'] = "localhost"; -$ldap_server['port'] = "389"; -$ldap_server['bind_rdn'] = "cn=admin,dc=example,dc=com"; -$ldap_server['bind_pass'] = "passw0rd"; -$ldap_server['base_dn'] = "ou=People,dc=example,dc=com"; -$ldap_server['protocol_version'] = 3; - -// Required attributes (lower case) and label strings in display order -$ldap_attributes = array ( - 'displayname' => 'Name', - 'o' => 'Organisation', - 'title' => 'Job Title', - 'ou' => 'Department', - 'mail' => 'Email', - 'telephonenumber' => 'Tel', - 'mobile' => 'Mob' - ); - -// JSON Response CSS and JavaScript -$css = " - ul {list-style-type: none; margin: 0; padding: 0;} - li {font-size: 1.1em; margin: 0 0 0.5em 0; padding: 0;} - li span {font-weight: bold; margin-right: 0.5em;} - "; -$js = ""; - - -/******************************** - THE GUTS -********************************/ +include_once('settings.php'); // Get data from query String $get_data['email'] = (isset($_GET['email'])) ? $_GET['email'] : ""; diff --git a/settings.php b/settings.php new file mode 100644 index 0000000..40b2ff8 --- /dev/null +++ b/settings.php @@ -0,0 +1,80 @@ + 'Name', + 'o' => 'Organisation', + 'title' => 'Job Title', + 'ou' => 'Department', + 'mail' => 'Email', + 'telephonenumber' => 'Tel', + 'mobile' => 'Mob' + ); + + +/******************************** + +Display CSS and JS + +********************************/ +$css = " + ul {list-style-type: none; margin: 0; padding: 0;} + li {font-size: 1.1em; margin: 0 0 0.5em 0; padding: 0;} + li span {font-weight: bold; margin-right: 0.5em;} + "; +$js = ""; + +?>