* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* $Id: showeduorginfo.php,v 1.1.1.1 2004/01/02 16:00:18 avel Exp $
*
* @package plugins
* @subpackage directory
*/
/**
* Show information about a specific eduOrg Organizational Unit. To be called
* by main directory service.
*/
/**
* Includes.
*/
define('DIRECTORY_DEBUG', 0);
define('SM_PATH', "../../");
include_once (SM_PATH . 'include/validate.php');
include_once (SM_PATH . 'include/load_prefs.php');
include_once (SM_PATH . "plugins/directory/config.php");
$prev = bindtextdomain ('directory', SM_PATH . 'plugins/directory/locale');
textdomain ('directory');
include_once (SM_PATH . "plugins/directory/html.php");
include_once (SM_PATH . "plugins/directory/functions.php");
include_once (SM_PATH . "plugins/directory/constants.php");
if(isset($_GET['dn'])) {
$ldq_dn = urldecode($_GET['dn']);
} else {
if(DIRECTORY_DEBUG == 1) {
/* Insert here your dn's for testing purposes. */
$ldq_dn[] = 'ou=NetOpeCen,ou=Admin,dc=edu-net,dc=gr';
$ldq_dn[] = 'ou=Phy,ou=Sci,ou=Schools,dc=edu-net,dc=gr';
$ldq_dn[] = 'ou=SolStaPhy,ou=Phy,ou=Sci,ou=Schools,dc=edu-net,dc=gr';
} else {
print "No Organizational Unit Specified.";
exit;
}
}
$ldq_lds = 0;
if(isset($_GET['lds'])) {
/* TODO: Verify that we are allowed to ask this LDAP server... */
if(is_numeric($_GET['lds'])) {
$ldq_lds = $_GET[$ldq_lds];
}
}
$ldq_Server = $ldap_server[$ldq_lds]['host'];
$ldq_Port = $ldap_server[$ldq_lds]['port'];
$ldq_base = $ldap_server[$ldq_lds]['base'];
$ldq_maxrows = $ldap_server[$ldq_lds]['maxrows'];
$ldq_timeout = $ldap_server[$ldq_lds]['timeout'];
if (!($ldq_ldap=ldap_connect($ldq_Server,$ldq_Port))) {
print ("Could not connect to LDAP server " . $ldq_Server);
exit;
}
if (!ldap_bind($ldq_ldap, $ldq_bind_dn, $ldq_pass)) {
print ("Unable to bind to LDAP server
\n");
exit;
}
$ldq_tattr = $ldq_enable_ou_attrs;
foreach ($ldq_tattr as $attr) {
/* Additional attributes */
if(isset($ldq_attributes[$attr]['additional_attrs'])) {
foreach($ldq_attributes[$attr]['additional_attrs'] as $additional) {
$ldq_tattr[] = $additional;
}
}
}
/* Perform search for relevant dn */
$old_error_reporting = error_reporting(E_ALL & ~(E_WARNING | E_NOTICE ));
$ldq_base = $ldap_base_dn;
$ldq_filter = directory_build_filter_from_dn($ldq_dn);
if (!($ldq_result = ldap_search($ldq_ldap, $ldq_base, $ldq_filter, $ldq_tattr, 0, $ldq_maxrows, $ldq_timeout))) {
print '
' . _("No entries found.") . '
'; } error_reporting($old_error_reporting); $ldq_errno = ldap_errno($ldq_ldap); if($ldq_errno == 4) { $toomanyfound = true; print ''.
_("Warning: Too many results were found, a partial list follows.").
'
'.
_("You may redefine your search to get more specific results.") . '
\nRESULTS"; print_r($ldq_entry); print ""; */ /** * ------ Print results (presentation logic) ------ */ if ($compose_new_win == '1') { /* I am a popup window */ displayHtmlHeader(_("Organizational Unit Information"), '', false); } else { $prev = bindtextdomain ('squirrelmail', SM_PATH . 'locale'); textdomain ('squirrelmail'); displayPageHeader($color, 'None'); $prev = bindtextdomain ('directory', SM_PATH . 'plugins/directory/locale'); textdomain ('directory'); } directory_LoadPrefs(); $lang_iso = getPref($data_dir, $username, 'language'); $ldq_lang = substr($lang_iso, 0, 2); $charset = $languages[$lang_iso]['CHARSET']; directory_print_all_sections_start(); directory_print_section_start( _("Organizational Unit Information") ); print '
' . $ldq_attributes[$attr]['text'] . ' | '; /* value columns */ for($i = 0; $i<$ldq_entry['count']; $i++) { if(array_key_exists($attr_lang, $ldq_entry[$i]) && !is_null($ldq_entry[$i][$attr_lang][0]) && ($ldq_entry[$i][$attr_lang][0] != " ") ) { $val = directory_string_convert($ldq_entry[$i][$attr_lang][0], "UTF-8", $charset); } elseif(array_key_exists($attr, $ldq_entry[$i])) { $val = $ldq_entry[$i][$attr][0]; } else { $val = ''; } echo ''; if(isset($ldq_attributes[$attr]['important'])) { print ''; } if(isset($ldq_attributes[$attr]['followme']) && isset($ldq_entry[$i][$attr])) { for($j=0; $j<$ldq_entry2['count']; $j++) { $url = parse_url($ldq_entry[$i][$attr][0]); $askdn = str_replace('/', '', $url['path']); if($ldq_entry2[$j]['dn'] == $askdn) { /* Print Link for superior */ $attr2 = 'cn'; $attr2_lang = $attr2.';lang-'.$ldq_lang; if(!is_null($ldq_entry2[$j][$attr2_lang][0]) && ($ldq_entry2[$j][$attr2_lang][0] != " ") ) { $val = $ldq_entry2[$j][$attr2_lang][0]; } else { $val = $ldq_entry2[$j][$attr2][0]; } $val = directory_string_convert($ldq_entry2[$j][$attr2_lang][0], "UTF-8", $charset); print ''; print $val; print ''; break; } } } else { print directory_href($attr, $val); } if(isset($ldq_attributes[$attr]['important'])) { print ''; } print ' | '; } print '