*/
/**
* Show information about a specific eduOrg Organizational Unit. To be called
* by main directory service.
*/
/**
* Define's and include's
*/
include_once ('config.php');
if($ldq_standalone) {
include_once ('standalone/standalone.php');
} else {
$public_mode = false;
if (file_exists('../../include/init.php')) {
include_once('../../include/init.php');
} else if (file_exists('../../include/validate.php')) {
define('SM_PATH', "../../");
include_once (SM_PATH . 'include/validate.php');
include_once (SM_PATH . 'include/load_prefs.php');
}
define('DIR_PATH', SM_PATH . "plugins/directory/");
$language = $lang_iso = getPref($data_dir, $username, 'language');
}
define('DIRECTORY_DEBUG', 0);
$prev = sq_bindtextdomain ('directory', DIR_PATH . 'locale');
textdomain ('directory');
include_once (DIR_PATH . "include/html.php");
include_once (DIR_PATH . "include/functions.php");
include_once (DIR_PATH . "include/constants.php");
include_once (DIR_PATH . "include/edit.php");
sqgetGlobalVar('formname', $formname, SQ_FORM);
sqgetGlobalVar('inputname', $inputname, SQ_FORM);
sqgetGlobalVar('popup', $popup, SQ_GET);
if($ldq_support_eduperson) {
include_once(DIR_PATH . 'include/eduorg.inc.php');
include_once(DIR_PATH . 'include/eduorg_html.inc.php');
} else {
print "Error: No EduOrg Support enabled in config.php";
exit;
}
if(isset($ldq_custom) && !(empty($ldq_custom)) &&
file_exists(DIR_PATH . "include/custom/$ldq_custom.php")) {
include_once (DIR_PATH . "include/custom/$ldq_custom.php");
}
if(isset($_SESSION['orgs'])) {
$orgs = $_SESSION['orgs'];
$orgs3 = $_SESSION['orgs3'];
} else {
/* Orgs Not cached into session. */
global $orgs, $orgs3;
cache_orgunitdns();
}
if(isset($_GET['dn'])) {
$ldq_dn = urldecode($_GET['dn']);
} else {
print "No Organizational Unit Specified.";
exit;
}
$compose_new_win = getPref($data_dir, $username, 'compose_new_win');
$editlink = directory_access_level();
$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(isset($ldap_server[$ldq_lds]['binddn'])) {
$ldq_bind_dn = $ldap_server[$ldq_lds]['binddn'];
}
if(isset($ldap_server[$ldq_lds]['bindpw'])) {
$ldq_pass = $ldap_server[$ldq_lds]['bindpw'];
}
if (!($ldq_ldap=ldap_connect($ldq_Server,$ldq_Port))) {
print ("Could not connect to LDAP server " . $ldq_Server);
exit;
}
if(isset($ldq_bind_dn)) {
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_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.") . '
' . $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++) { list($urlhost, $askdn) = directory_parse_eduorg_superior_url($ldq_entry[$i][$attr][0]); if(isset($orgs[$askdn])) { /* Get from $orgs cache */ if($ldq_lang != 'en' && isset($orgs[$askdn]['struct;lang-'.$ldq_lang])) { $askdn_desc = '('. htmlspecialchars($orgs[$askdn]['struct;lang-'.$ldq_lang]) . ') '. htmlspecialchars($orgs[$askdn]['text;lang-'.$ldq_lang]); } else { $askdn_desc = '('. htmlspecialchars($orgs[$askdn]['struct']) . ') '. htmlspecialchars($orgs[$askdn]['text']); } } else { /* ask LDAP - FIXME */ //echo eduorgunit_link($askdn); /* if($ldq_entry2[$j]['dn'] == $askdn) { $attr2 = 'cn'; $attr2_lang = $attr2.';lang-'.$ldq_lang; if(isset($ldq_entry2[$j][$attr2_lang][0]) && !empty($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]; } $askdn_desc = htmlspecialchars(directory_string_convert($val, "UTF-8", $charset)); break; } */ } } print ''.$askdn_desc.''; } else { print directory_href($attr, $val); } if(isset($ldq_attributes[$attr]['important'])) { print ''; } print ' | '; } print '
' . _("In this Organizational Unit:");
if($directory_enable_browse) {
echo ' '.
'![]() ![]() '. _("Browse people with specific affiliation:"); foreach($affiliations_map as $aff=>$text) { print ''.$text.' '; } print ' '; } if($editlink > 0) { echo ''.
' |