*/ include_once(DIR_PATH . 'include/misc.php'); /** * Determine if editing is allowed. * You should probably edit this for your environment. * Default is to allow editing only from localhost. * * @return int */ function directory_access_level() { global $ldq_trusted_networks; if($_SERVER['REMOTE_ADDR'] == '127.0.0.1') { return 2; } foreach($ldq_trusted_networks as $allowed) { if(IP_Match($allowed['network'], $allowed['mask'], $_SERVER['REMOTE_ADDR'])) { return 2; } } return 0; } /** * Print a table with attributes, in the manner of HTML form elements, and * their current values filled in. * * @var array $attrs Attributes to print. * @var array $entry Current LDAP entry array * @var boolean $printdescriptions * @var string $mode * @return void */ function directory_print_editable_attributes($attrs, $entry, $printdescriptions = true, $mode = 'edit') { global $color, $editprofile_langs, $ldq_attributes, $orgs3, $charset, $ldq_base; $toggle = false; if($mode == 'add') { echo ''. '' . _("DN (Distinguished Name)") . ':'. ''. ''. ''; } foreach($attrs as $attr) { echo ''; echo '' . $ldq_attributes[$attr]['text'] . ':'. ''; if(isset($ldq_attributes[$attr]['input']) && $ldq_attributes[$attr]['input'] == 'eduorgselect') { /* Select box for eduorg dn */ if(isset($entry[0][$attr]['count']) && $entry[0][$attr]['count'] > 0 ) { global $restrict; for($i=0; $i < $entry[0][$attr]['count']; $i++) { list($urlhost, $urlpath) = directory_parse_eduorg_superior_url($entry[0][$attr][$i]); $restrict[] = $urlpath; unset($urlpath); } } echo ''; if(isset($entry[0][$attr])) { unset($restrict); } } elseif(isset($ldq_attributes[$attr]['posvals']) && $ldq_attributes[$attr]['input'] == 'checkboxes') { /* Controlled values - multiple choices available, many checkboxes */ foreach($ldq_attributes[$attr]['posvals'] as $p) { echo ''. '
'; } } elseif(isset($ldq_attributes[$attr]['map'])) { /* Controlled values - single-value, select box */ echo ''; } elseif(isset($ldq_attributes[$attr]['url'])) { switch ($ldq_attributes[$attr]['url']) { case 'eduorg': echo ''; break; case 'labeled': if(isset($entry[0][$attr])) { for($k=0; $k < $entry[0][$attr]['count']; $k++) { $parts = explode(' ', $entry[0][$attr][$k], 2); if(!isset($parts[1])) { $parts[1] = ''; } $labeleduris[$k]['url'] = $parts[0]; $labeleduris[$k]['desc'] = directory_string_convert($parts[1], 'UTF-8', $charset); } } $k=0; if(isset($labeleduris)) { for($k=0; $k'. _("Description:") . '
'; } } echo _("URL:") . ' '. _("Description:") . ' '; break; case 'callto': case 'mailto': default: echo ''; } } else { if(empty($editprofile_langs)) { $editprofile_langs = array('en'); } foreach($editprofile_langs as $l) { if($l != 'en') { $a = $attr.';lang-'.$l; } else { $a = $attr; } echo '['.$l.'] '; if(isset($ldq_attributes[$attr]['posvals']) && $ldq_attributes[$attr]['input'] == 'select') { /* Controlled values - single select box */ echo ''; }elseif(isset($ldq_attributes[$attr]['input']) && $ldq_attributes[$attr]['input'] == 'textarea') { echo ''; } else { /* Freely editable, Input Box */ echo ''; } echo '
'; } } if ($printdescriptions && isset($ldq_attributes[$attr]['inputdesc'])) { echo '
'.$ldq_attributes[$attr]['inputdesc'] . ''; } echo ''; if($toggle == false) { $toggle = true; } else { $toggle = false; } } } ?>