diff --git a/INSTALL b/INSTALL index 2f150fe..e079b12 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ For install instructions in non-English languages, see the wiki: - http://phpldapadmin.wiki.sourceforge.net + http://phpldapadmin.sourceforge.net * Requirements @@ -17,7 +17,7 @@ For install instructions in non-English languages, see the wiki: * For additional help See the wiki: - http://phpldapadmin.wiki.sourceforge.net + http://phpldapadmin.sourceforge.net Join our mailing list: https://lists.sourceforge.net/lists/listinfo/phpldapadmin-devel diff --git a/VERSION b/VERSION index ab8bba9..09636ab 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -$Name: RELEASE-1_1_0_5 $ +$Name: RELEASE-1_1_0_6 $ diff --git a/config/config.php.example b/config/config.php.example index faa0be0..f8d1d4e 100644 --- a/config/config.php.example +++ b/config/config.php.example @@ -134,11 +134,17 @@ $config->custom->commands['all'] = array( An AttributeFactory defines which class to use to represent a given attribute */ // $config->custom->appearance['attribute_factory'] = "AttributeFactory"; +/* Just show your custom templates. */ +// $config->custom->appearance['custom_templates_only'] = false; + +/* Disable the default template. */ +// $config->custom->appearance['disable_default_template'] = false; + /* Configure what objects are shown in left hand tree */ // $config->custom->appearance['tree_filter'] = '(objectclass=*)'; /* The height and width of the tree. If these values are not set, then - no tree scroll bars are provided. + no tree scroll bars are provided. */ // $config->custom->appearance['tree_height'] = null; # $config->custom->appearance['tree_height'] = 600; // $config->custom->appearance['tree_width'] = null; @@ -270,7 +276,8 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server'); authentication with dn. This is useful, when users should be able to log in with their uid, but the ldap administrator wants to log in with his root-dn, that does not - necessarily have the uid attribute. */ + necessarily have the uid attribute. + When using this feature, login_class is ignored. */ // $ldapservers->SetValue($i,'login','fallback_dn',false); /* If you specified 'cookie' or 'session' as the auth_type above, and you @@ -314,7 +321,7 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server'); // $ldapservers->SetValue($i,'auto_number','min','1000'); /* The DN of the uidPool entry when 'uidpool' mechanism is used above. */ -# $servers[$i]['auto_uid_number_uid_pool_dn'] = 'cn=uidPool,dc=example,dc=com'; +// $ldapservers->SetValue($i,'auto_number','uidpool_dn','cn=uidPool,dc=example,dc=com'); /* If you set this, then phpldapadmin will bind to LDAP with this user ID when searching for the uidnumber. The idea is, this user id would have full @@ -364,6 +371,25 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server'); has children. Certain servers are known to allow it, certain are not */ // $ldapservers->SetValue($i,'server','branch_rename',false); +/* If you set this, then phpldapadmin will show these attributes as + internal attributes, even if they are not defined in your schema. */ +// $ldapservers->SetValue($i,'server','custom_sys_attrs',array('')); +# $ldapservers->SetValue($i,'server','custom_sys_attrs',array('passwordExpirationTime','passwordAllowChangeTime')); + +/* If you set this, then phpldapadmin will show these attributes on + objects, even if they are not defined in your schema. */ +// $ldapservers->SetValue($i,'server','custom_attrs',array('')); +# $ldapservers->SetValue($i,'server','custom_attrs',array('nsRoleDN','nsRole','nsAccountLock')); + +/* These attributes will be forced to MAY attributes and become option in the + templates. If they are not defined in the templates, then they wont appear + as per normal template processing. You may want to do this becuase your LDAP + server may automatically calculate a default value. + In Fedora Directory Server using the DNA Plugin one could ignore uidNumber, + gidNumber and sambaSID. */ +// $ldapservers->SetValue($i,'force_may','attrs',array('')); +# $ldapservers->SetValue($i,'force_may','attrs',array('uidNumber','gidNumber','sambaSID')); + /************************************************************************** * If you want to configure additional LDAP servers, do so below. * * Remove the commented lines and use this section as a template for all * @@ -494,7 +520,7 @@ $friendly_attrs['uid'] = 'User Name'; /*********************************************/ /* Add "modify group members" link to the attribute. */ -// $config->custom->modify_member['groupattr'] = array('member','uniqueMember','memberUid') +// $config->custom->modify_member['groupattr'] = array('member','uniqueMember','memberUid'); /* Configure filter for member search. This only applies to "modify group members" feature */ // $config->custom->modify_member['filter'] = '(objectclass=Person)'; diff --git a/doc/uidpool.schema b/doc/uidpool.schema new file mode 100755 index 0000000..7154740 --- /dev/null +++ b/doc/uidpool.schema @@ -0,0 +1,11 @@ +## +## Used for storing the next gid and next uid in the the directory +## +objectclass ( 1.3.6.1.4.1.7165.1.2.2.3 NAME 'uidPool' SUP top AUXILIARY + DESC 'Pool for allocating UNIX uids' + MUST ( uidNumber $ cn ) ) + + +objectclass ( 1.3.6.1.4.1.7165.1.2.2.4 NAME 'gidPool' SUP top AUXILIARY + DESC 'Pool for allocating UNIX gids' + MUST ( gidNumber $ cn ) ) diff --git a/htdocs/add_attr.php b/htdocs/add_attr.php index 6bb205f..574e4f1 100644 --- a/htdocs/add_attr.php +++ b/htdocs/add_attr.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute')),'error','index.php'); +$entry = array(); $entry['val'] = get_request('val','POST'); $entry['binary'] = get_request('binary','POST'); @@ -34,7 +35,7 @@ $entry['attr']['string'] = get_request('attr','POST'); $entry['attr']['encode'] = rawurlencode($entry['attr']['string']); if ((strlen($entry['binary']) <= 0) && (strlen($entry['val']) <= 0)) - pla_error(_('You left the attribute value blank. Please go back and try again.')); + error(_('You left the attribute value blank. Please go back and try again.'),'error','index.php'); /* * Special case for binary attributes (like jpegPhoto and userCertificate): @@ -48,44 +49,44 @@ if ($badattr = $ldapserver->checkUniqueAttr($entry['dn']['string'],$entry['attr' $href = htmlspecialchars(sprintf('cmd.php?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s', $ldapserver->server_id,$entry['attr']['string'],$badattr)); - pla_error(sprintf(_('Your attempt to add %s (%s) to
%s
is NOT allowed. That attribute/value belongs to another entry.

You might like to search for that entry.'),$entry['attr']['string'],$badattr,$entry['dn']['string'],$href)); + error(sprintf(_('Your attempt to add %s (%s) to
%s
is NOT allowed. That attribute/value belongs to another entry.

You might like to search for that entry.'),$entry['attr']['string'],$badattr,$entry['dn']['string'],$href),'error','index.php'); } if (strlen($entry['binary']) > 0) { if ($_FILES['val']['size'] == 0) - pla_error(_('The file you chose is either empty or does not exist. Please go back and try again.')); + error(_('The file you chose is either empty or does not exist. Please go back and try again.'),'error','index.php'); if (! is_uploaded_file($_FILES['val']['tmp_name'])) { if (isset($_FILES['val']['error'])) switch($_FILES['val']['error']) { case 0: # No error; possible file attack! - pla_error(_('Security error: The file being uploaded may be malicious.')); + error(_('Security error: The file being uploaded may be malicious.'),'error','index.php'); break; case 1: # Uploaded file exceeds the upload_max_filesize directive in php.ini - pla_error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting')); + error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting'),'error','index.php'); break; case 2: # Uploaded file exceeds the MAX_FILE_SIZE directive specified in the html form - pla_error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting')); + error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting'),'error','index.php'); break; case 3: # Uploaded file was only partially uploaded - pla_error(_('The file you selected was only partially uploaded, likley due to a network error.')); + error(_('The file you selected was only partially uploaded, likley due to a network error.'),'error','index.php'); break; case 4: # No file was uploaded - pla_error(_('You left the attribute value blank. Please go back and try again.')); + error(_('You left the attribute value blank. Please go back and try again.'),'error','index.php'); break; default: # A default error, just in case! :) - pla_error(_('Security error: The file being uploaded may be malicious.')); + error(_('Security error: The file being uploaded may be malicious.'),'error','index.php'); break; } else - pla_error(_('Security error: The file being uploaded may be malicious.')); + error(_('Security error: The file being uploaded may be malicious.'),'error','index.php'); } $binaryfile['name'] = $_FILES['val']['tmp_name']; @@ -125,7 +126,10 @@ if ($result) { die(); } else { - pla_error(_('Failed to add the attribute.'),$ldapserver->error(),$ldapserver->errno()); + system_message(array( + 'title'=>_('Failed to add the attribute.'), + 'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()), + 'type'=>'error')); } /** diff --git a/htdocs/add_attr_form.php b/htdocs/add_attr_form.php index 76feae6..4455163 100644 --- a/htdocs/add_attr_form.php +++ b/htdocs/add_attr_form.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); +$entry = array(); $entry['dn']['string'] = get_request('dn','GET'); $entry['rdn'] = get_rdn($entry['dn']['string']); @@ -24,6 +25,7 @@ printf('

%s %s

',_('Add new attribute'),htmlspecialc printf('

%s: %s     %s: %s

', _('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($entry['dn']['string'])); +$dn = array(); $dn['attrs'] = $ldapserver->getDNAttrs($entry['dn']['string']); $dn['oclasses'] = $ldapserver->getDNAttr($entry['dn']['string'],'objectClass'); diff --git a/htdocs/add_oclass.php b/htdocs/add_oclass.php index 6064ea0..c270071 100644 --- a/htdocs/add_oclass.php +++ b/htdocs/add_oclass.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); if ($ldapserver->isAttrReadOnly('objectClass')) - pla_error(_('ObjectClasses are flagged as read only in the phpLDAPadmin configuration.')); + error(_('ObjectClasses are flagged as read only in the phpLDAPadmin configuration.'),'error','index.php'); +$entry = array(); $entry['dn']['encode'] = get_request('dn'); $entry['dn']['string'] = urldecode($entry['dn']['encode']); @@ -42,7 +43,7 @@ if (is_array($entry['new']['attrs']) && count($entry['new']['attrs']) > 0) $href['search'] = htmlspecialchars(sprintf('cmd.php?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s', $ldapserver->server_id,$attr,$badattr)); - pla_error(sprintf(_('Your attempt to add %s (%s) to
%s
is NOT allowed. That attribute/value belongs to another entry.

You might like to search for that entry.'),$attr,$badattr,$entry['dn']['string'],$href['search'])); + error(sprintf(_('Your attempt to add %s (%s) to
%s
is NOT allowed. That attribute/value belongs to another entry.

You might like to search for that entry.'),$attr,$badattr,$entry['dn']['string'],$href['search']),'error','index.php'); } $new_entry[$attr] = $val; @@ -51,7 +52,10 @@ if (is_array($entry['new']['attrs']) && count($entry['new']['attrs']) > 0) $result = $ldapserver->attrModify($entry['dn']['string'],$new_entry); if (! $result) - pla_error(_('Could not perform ldap_mod_add operation.'),$ldapserver->error(),$ldapserver->errno()); + system_message(array( + 'title'=>_('Could not perform ldap_mod_add operation.'), + 'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()), + 'type'=>'error')); else { $modified_attrs = array_keys($entry['new']['attrs']); diff --git a/htdocs/add_oclass_form.php b/htdocs/add_oclass_form.php index eafd013..22490f4 100644 --- a/htdocs/add_oclass_form.php +++ b/htdocs/add_oclass_form.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); if (! $entry['oclass']['new']) - pla_error(_('You did not select any ObjectClasses for this object. Please go back and do so.')); + error(_('You did not select any ObjectClasses for this object. Please go back and do so.'),'error','index.php'); /* Ensure that the object has defined all MUST attrs for this objectClass. * If it hasn't, present a form to have the user enter values for all the @@ -108,7 +109,10 @@ if (count($ldap['attrs']['need']) > 0) { $result = $ldapserver->attrModify($entry['dn']['string'],array('objectClass'=>$entry['oclass']['new'])); if (! $result) - pla_error('Could not perform ldap_mod_add operation.',$ldapserver->error(),$ldapserver->errno()); + system_message(array( + 'title'=>_('Could not perform ldap_mod_add operation.'), + 'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()), + 'type'=>'error')); else { $href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s&modified_attrs[]=objectClass', diff --git a/htdocs/add_value.php b/htdocs/add_value.php index de1fa4b..e75608f 100644 --- a/htdocs/add_value.php +++ b/htdocs/add_value.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value')),'error','index.php'); # The DN and ATTR we are working with. +$entry = array(); $entry['dn']['encode'] = get_request('dn','POST',true); $entry['dn']['string'] = rawurldecode($entry['dn']['encode']); $entry['attr']['encode'] = get_request('attr','POST',true); @@ -34,7 +35,7 @@ $entry['value']['string'] = get_request('new_value','POST',true); $entry['value']['bin'] = get_request('binary','POST') ? true : false; if ($ldapserver->isAttrReadOnly($entry['attr']['string'])) - pla_error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),$entry['attr']['html'])); + error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),$entry['attr']['html']),'error','index.php'); /* * Special case for binary attributes: @@ -56,7 +57,7 @@ if ($badattr = $ldapserver->checkUniqueAttr($entry['dn']['string'],$entry['attr' $href = htmlspecialchars(sprintf('cmd.php?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s', $ldapserver->server_id,$entry['attr']['string'],$badattr)); - pla_error(sprintf(_('Your attempt to add %s (%s) to
%s
is NOT allowed. That attribute/value belongs to another entry.

You might like to search for that entry.'),$entry['attr']['string'],$badattr,$entry['dn']['string'],$href)); + error(sprintf(_('Your attempt to add %s (%s) to
%s
is NOT allowed. That attribute/value belongs to another entry.

You might like to search for that entry.'),$entry['attr']['string'],$badattr,$entry['dn']['string'],$href),'error','index.php'); } # Call the custom callback for each attribute modification and verify that it should be modified. @@ -69,8 +70,11 @@ if (run_hook('pre_attr_add', $add_result = $ldapserver->attrModify($entry['dn']['string'],$new_entry); if (! $add_result) { - pla_error(_('Could not perform ldap_mod_add operation.'), - $ldapserver->error(),$ldapserver->errno()); + system_message(array( + 'title'=>_('Could not perform ldap_mod_add operation.'), + 'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()), + 'type'=>'error')); + } else { run_hook('post_attr_modify', array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']['string'],'attr_name'=>$entry['attr']['string'],'new_value'=>$new_entry)); diff --git a/htdocs/add_value_form.php b/htdocs/add_value_form.php index ec12e65..e77792e 100644 --- a/htdocs/add_value_form.php +++ b/htdocs/add_value_form.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); # The DN and ATTR we are working with. +$entry = array(); $entry['dn']['encode'] = get_request('dn','GET',true); $entry['dn']['string'] = urldecode($entry['dn']['encode']); $entry['dn']['html'] = htmlspecialchars($entry['dn']['string']); @@ -34,7 +35,7 @@ $entry['rdn']['html'] = htmlspecialchars($entry['rdn']['string']); /***************/ if (! $entry['dn']['string'] || ! $ldapserver->dnExists($entry['dn']['string'])) - pla_error(sprintf(_('The entry (%s) does not exist.'),$entry['dn']['html']),null,-1,true); + error(sprintf(_('The entry (%s) does not exist.'),$entry['dn']['html']),'error','index.php'); $tree = get_cached_item($ldapserver->server_id,'tree'); $entry['ldap'] = null; @@ -52,7 +53,7 @@ eval('$reader = new '.$_SESSION[APPCONFIG]->GetValue('appearance','entry_reader' $reader->visit('Start', $entry['ldap']); if (! $entry['ldap'] || $entry['ldap']->isReadOnly()) - pla_error(sprintf(_('The entry (%s) is in readonly mode.'),$entry['dn']['html']),null,-1,true); + error(sprintf(_('The entry (%s) is in readonly mode.'),$entry['dn']['html']),'error','index.php'); /*********************/ /* attribute values */ @@ -71,11 +72,13 @@ if (!$ldap['attr']) { $ldap['count'] = $ldap['attr']->getValueCount(); if ($ldap['attr']->isReadOnly()) - pla_error(sprintf(_('The attribute (%s) is in readonly mode.'),$entry['attr']['html']),null,-1,true); + error(sprintf(_('The attribute (%s) is in readonly mode.'),$entry['attr']['html']),'error','index.php'); + if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value')),'error','index.php'); + if (($ldap['attr']->getValueCount() == 0) && ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute')),'error','index.php'); $entry['attr']['oclass'] = (strcasecmp($entry['attr']['string'],'objectClass') == 0) ? true : false; @@ -156,8 +159,8 @@ if ($entry['attr']['oclass']) { echo ''; if ($_SESSION[APPCONFIG]->GetValue('appearance','show_hints')) - printf('
Hint%s
', - _('Note: You may be required to enter new attributes that these objectClass(es) require')); + printf('
Hint%s
', + IMGDIR,_('Note: You may be required to enter new attributes that these objectClass(es) require')); echo ''; echo ''; echo ''; @@ -165,7 +168,7 @@ if ($entry['attr']['oclass']) { } else { # Draw a blank field echo ''; @@ -322,8 +323,7 @@ foreach ($attrs_all as $attr) { if ($side == 'dst') { printf('',htmlspecialchars($user_password)); - echo enc_type_select_list($enc_type); - + echo enc_type_select_list($enc_type,'enc','userpassword',0); } echo '
'; @@ -383,8 +383,8 @@ foreach ($attrs_all as $attr) { # Is this value is a structural objectClass, make it read-only if (0 == strcasecmp($attr,'objectClass')) { - printf('', - _('View the schema description for this objectClass'),$ldapserver->server_id,htmlspecialchars($val)); + printf('', + _('View the schema description for this objectClass'),$ldapserver->server_id,htmlspecialchars($val),IMGDIR); $schema_object = $ldapserver->getSchemaObjectClass($val); @@ -400,14 +400,14 @@ foreach ($attrs_all as $attr) { } if (is_dn_string($val) || $ldapserver->isDNAttr($attr)) - printf('', - sprintf(_('Go to %s'),htmlspecialchars($val)),$ldapserver->server_id,rawurlencode($val)); + printf('', + sprintf(_('Go to %s'),htmlspecialchars($val)),$ldapserver->server_id,rawurlencode($val),IMGDIR); elseif (is_mail_string($val)) - printf('',htmlspecialchars($val)); + printf('',htmlspecialchars($val),IMGDIR); elseif (is_url_string($val)) - printf('',htmlspecialchars($val)); + printf('',htmlspecialchars($val),IMGDIR); if ($ldapserver->isMultiLineAttr($attr,$val)) { if ($side == 'dst') diff --git a/htdocs/compare_form.php b/htdocs/compare_form.php index 7eaafb9..89bce98 100644 --- a/htdocs/compare_form.php +++ b/htdocs/compare_form.php @@ -1,5 +1,5 @@ server_id,true,'server_id_dst'); diff --git a/htdocs/copy.php b/htdocs/copy.php index c9d6333..3dab63b 100644 --- a/htdocs/copy.php +++ b/htdocs/copy.php @@ -1,5 +1,5 @@ isCommandAvailable('entry_move')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('copy entry'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('copy entry')),'error','index.php'); +$entry = array(); $entry['src']['id'] = get_request('server_id'); $entry['dst']['id'] = get_request('dest_server_id'); @@ -26,10 +27,10 @@ $entry['src']['ldapserver'] = $_SESSION[APPCONFIG]->ldapservers->Instance($entry $entry['dst']['ldapserver'] = $_SESSION[APPCONFIG]->ldapservers->Instance($entry['dst']['id']); if ($entry['dst']['ldapserver']->isReadOnly()) - pla_error(_('Destination server is currently READ-ONLY.')); + error(_('Destination server is currently READ-ONLY.'),'error','index.php'); if (! $entry['src']['ldapserver']->haveAuthInfo() || ! $entry['dst']['ldapserver']->haveAuthInfo()) - pla_error(_('Not enough information to login to server. Please check your configuration.')); + error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php'); $entry['src']['dn'] = get_request('old_dn'); $entry['dst']['dn'] = get_request('new_dn'); @@ -38,19 +39,19 @@ $entry['src']['remove'] = (get_request('remove') == 'yes') ? true : false; # Error checking if (strlen(trim($entry['dst']['dn'])) == 0) - pla_error(_('You left the destination DN blank.')); + error(_('You left the destination DN blank.'),'error','index.php'); if (pla_compare_dns($entry['src']['dn'],$entry['dst']['dn']) == 0 && $entry['src']['id'] == $entry['dst']['id']) - pla_error(_('The source and destination DN are the same.')); + error(_('The source and destination DN are the same.'),'error','index.php'); if ($entry['dst']['ldapserver']->dnExists($entry['dst']['dn'])) - pla_error(sprintf(_('The destination entry (%s) already exists.'),pretty_print_dn($entry['dst']['dn']))); + error(sprintf(_('The destination entry (%s) already exists.'),pretty_print_dn($entry['dst']['dn'])),'error','index.php'); if (! $entry['dst']['ldapserver']->dnExists(get_container($entry['dst']['dn']))) - pla_error(sprintf(_('The destination container (%s) does not exist.'),pretty_print_dn(get_container($entry['dst']['dn'])))); + error(sprintf(_('The destination container (%s) does not exist.'),pretty_print_dn(get_container($entry['dst']['dn']))),'error','index.php'); if ($entry['src']['recursive']) { - $filter = isset($_POST['filter']) ? $_POST['filter'] : '(objectClass=*)'; + $filter = get_request('filter','POST',false,'(objectClass=*)'); # Build a tree similar to that of the tree browser to give to r_copy_dn $snapshot_tree = array(); @@ -141,7 +142,11 @@ function copy_dn($ldapserver_src,$ldapserver_dst,$dn_src,$dn_dst) { $add_result = $ldapserver_dst->add($dn_dst,$new_entry); if (! $add_result) { echo '

'; - pla_error(_('Failed to copy DN: ').$dn_dst,$ldapserver_dst->error(),$ldapserver_dst->errno()); + system_message(array( + 'title'=>_('Failed to copy DN.').sprintf(' (%s)',$dn_dst), + 'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()), + 'type'=>'error')); + } else { run_hook('post_entry_create', array('server_id'=>$ldapserver_dst->server_id,'dn'=>$dn_dst,'attrs'=>$new_entry)); diff --git a/htdocs/copy_form.php b/htdocs/copy_form.php index 1c09fb1..b397e18 100644 --- a/htdocs/copy_form.php +++ b/htdocs/copy_form.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); +$entry = array(); $entry['dn'] = get_request('dn','GET'); $entry['rdn'] = get_rdn($entry['dn']); @@ -99,7 +100,7 @@ echo '
'; - $writer->draw('BlankValue', $ldap['attr'], $ldap['count']); + $writer->draw('BlankValue',$ldap['attr'],$ldap['count'],$reader); echo '
'; if ($ldap['schema']->getDescription()) diff --git a/htdocs/compare.php b/htdocs/compare.php index ede7d83..24a4e4a 100644 --- a/htdocs/compare.php +++ b/htdocs/compare.php @@ -1,5 +1,5 @@ ldapservers->Instance($server_id_src); if (! $ldapserver_src->haveAuthInfo()) - pla_error(_('Not enough information to login to server. Please check your configuration.')); + error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php'); $ldapserver_dst = $_SESSION[APPCONFIG]->ldapservers->Instance($server_id_dst); if (! $ldapserver_src->haveAuthInfo()) - pla_error(_('Not enough information to login to server. Please check your configuration.')); + error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php'); if (! $ldapserver_src->dnExists($dn_src)) - pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn_src))); + error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($dn_src)),'error','index.php'); + if (! $ldapserver_dst->dnExists($dn_dst)) - pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn_dst))); + error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($dn_dst)),'error','index.php'); $attrs_src = $ldapserver_src->getDNAttrs($dn_src,false,$_SESSION[APPCONFIG]->GetValue('deref','view')); $attrs_dst = $ldapserver_dst->getDNAttrs($dn_dst,false,$_SESSION[APPCONFIG]->GetValue('deref','view')); @@ -253,12 +254,12 @@ foreach ($attrs_all as $attr) { if (count($vals) > 1) for ($i=1; $i<=count($vals); $i++) - printf(' %s(%s)
',$href,$i,_('download value'),$i); + printf(' %s(%s)
',$href,$i,_('download value'),IMGDIR,$i); else - printf(' %s
',$href,_('download value')); + printf(' %s
',$href,IMGDIR,_('download value')); if ($side == 'dst' && ! $ldapserver_dst->isReadOnly() && ! $ldapserver->isAttrReadOnly($attr)) - printf(' %s',$attr,_('delete attribute')); + printf(' %s',$attr,IMGDIR,_('delete attribute')); echo ''; echo '
'; echo "\n"; if ($_SESSION[APPCONFIG]->GetValue('appearance','show_hints')) - printf('Light%s',_('Hint: Copying between different servers only works if there are no schema violations')); + printf('Light%s',IMGDIR,_('Hint: Copying between different servers only works if there are no schema violations')); echo ''; ?> diff --git a/htdocs/create.php b/htdocs/create.php index 15f0698..07ca5c2 100644 --- a/htdocs/create.php +++ b/htdocs/create.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode'), null, -1, true); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_create')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('create entry'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('create entry')),'error','index.php'); -$rdn_attr = isset($_POST['rdn_attribute']) ? $_POST['rdn_attribute'] : null; +$rdn_attr = get_request('rdn_attribute'); $entryfactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','entry_factory'); eval('$entry_factory = new '.$entryfactoryclass.'();'); @@ -36,7 +36,7 @@ $entry->accept($reader); $container = $entry->getContainer(); if (!$container || !$ldapserver->dnExists($container)) - pla_error(sprintf(_('The container you specified (%s) does not exist. Please try again.'),htmlspecialchars($container)),null,-1,true); + error(sprintf(_('The container you specified (%s) does not exist. Please try again.'),htmlspecialchars($container)),'error','index.php'); $tree = get_cached_item($ldapserver->server_id,'tree'); if ($tree) { @@ -46,18 +46,18 @@ if ($tree) { $container_entry = $tree->getEntry($container); if ($container_entry->isLeaf()) - pla_error(sprintf(_('The container (%s) is a leaf.'), htmlspecialchars($container)), null, -1, true); + error(sprintf(_('The container (%s) is a leaf.'), htmlspecialchars($container)),'error','index.php'); } $entry->setRdnAttributeName($rdn_attr); if (!$entry->getRdnAttribute()) - pla_error(sprintf(_('The Rdn attribute (%s) does not exist.'), htmlspecialchars($rdn_attr)), null, -1, true); + error(sprintf(_('The Rdn attribute (%s) does not exist.'), htmlspecialchars($rdn_attr)),'error','index.php'); $new_dn = $entry->getDn(); if (! $new_dn) - pla_error(_('You left the RDN field blank.')); + error(_('You left the RDN field blank.'),'error','index.php'); -$redirect = isset($_POST['redirect']) ? $_POST['redirect'] : false; +$redirect = get_request('redirect','POST',false,false); $new_entry = array(); $attrs = $entry->getAttributes(); @@ -69,8 +69,9 @@ foreach ($attrs as $attr) { $new_vals[] = $val; } - if ($attr->isRequired() && !$new_vals) - pla_error(sprintf(_('You left the value blank for required attribute (%s).'), htmlspecialchars($attr->getName()))); + if ($attr->isRequired() && !$new_vals && !$ldapserver->isIgnoredAttr($attr->getName())) + error(sprintf(_('You left the value blank for required attribute (%s).'),htmlspecialchars($attr->getName())),'error','index.php'); + if ($new_vals) $new_entry[$attr->getName()] = $new_vals; @@ -83,7 +84,7 @@ foreach ($new_entry as $attr => $vals) { # Check to see if this is a unique Attribute if ($badattr = $ldapserver->checkUniqueAttr($new_dn,$attr,$vals)) { $search_href = sprintf('?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s', $ldapserver->server_id,$attr,$badattr); - pla_error(sprintf(_('Your attempt to add %s (%s) to
%s
is NOT allowed. That attribute/value belongs to another entry.

You might like to search for that entry.'),$attr,$badattr,$new_dn,$search_href)); + error(sprintf(_('Your attempt to add %s (%s) to
%s
is NOT allowed. That attribute/value belongs to another entry.

You might like to search for that entry.'),$attr,$badattr,$new_dn,$search_href),'error','index.php'); } } @@ -129,6 +130,9 @@ if ($add_result) { } } else { - pla_error(_('Could not add the object to the LDAP server.'),$ldapserver->error(),$ldapserver->errno()); + system_message(array( + 'title'=>_('Could not add the object to the LDAP server.'), + 'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()), + 'type'=>'error')); } ?> diff --git a/htdocs/css/style.css b/htdocs/css/style.css index cd5751b..3ddc2ab 100644 --- a/htdocs/css/style.css +++ b/htdocs/css/style.css @@ -1,4 +1,4 @@ -/* $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/css/style.css,v 1.48.2.4 2008/01/13 07:17:23 wurley Exp $ */ +/* $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/css/style.css,v 1.48.2.8 2008/12/19 00:38:31 wurley Exp $ */ /* Global Page */ table.page { @@ -96,7 +96,7 @@ table.page table.control td.logo img.logo { text-align: right; width: 100px; - height: 60px; + height: 50px; } /* Global Page - LDAP Tree */ @@ -276,6 +276,7 @@ table.tree td.rdn a:hover { font-size: 13px; color: #841212; background-color: #FFF0C0; + text-decoration: none; } table.tree td.rdn span.count { @@ -300,13 +301,6 @@ table.tree td.link a:hover { text-decoration: none; } -table.tree td.rdn a:hover { - font-size: 13px; - color: #841212; - background-color: #FFF0C0; - text-decoration: none; -} - table.tree td.links a:hover { text-decoration: none; color: blue; @@ -438,6 +432,7 @@ table.entry input { } table.entry input.value { + color: #000000; font-size: 14px; width: 350px; background-color: #FFFFFF; @@ -447,15 +442,16 @@ table.entry div.helper { text-align: left; white-space: nowrap; background-color: #FFFFFF; + color: #888; font-size: 14px; font-weight: normal; - color: #888; } table.entry input.roval { font-size: 14px; width: 350px; background-color: #FFFFFF; + color: #000000; border: none; } @@ -463,12 +459,14 @@ table.entry textarea.value { font-size: 14px; width: 350px; background-color: #FFFFFF; + color: #000000; } table.entry textarea.roval { font-size: 14px; width: 350px; background-color: #FFFFFF; + color: #000000; border: none; } @@ -604,41 +602,50 @@ table.entry tr.updated td.ew2_val { #login { background: url('../images/uid.png') no-repeat 0 1px; background-color: #FAFAFF; + color: #000000; padding-left: 17px; } #login:focus { background-color: #F0F0FF; + color: #000000; } #login:disabled { background-color: #DDDDFF; + color: #000000; } #password { background: url('../images/key.png') no-repeat 0 1px; background-color: #FAFAFF; + color: #000000; padding-left: 17px; } #password:focus { background-color: #F0F0FF; + color: #000000; } #password:disabled { background-color: #DDDDFF; + color: #000000; } #generic { background-color: #FAFAFF; + color: #000000; padding-left: 17px; } #generic:focus { background-color: #F0F0FF; + color: #000000; } #generic:disabled { background-color: #DDDDFF; + color: #000000; } /* After input results */ diff --git a/htdocs/delete.php b/htdocs/delete.php index 37017ff..277e0a2 100644 --- a/htdocs/delete.php +++ b/htdocs/delete.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete', 'simple_delete')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry')),'error','index.php'); +$entry = array(); $entry['dn'] = get_request('dn'); if (! $entry['dn']) - pla_error(_('You must specify a DN')); + error(_('You must specify a DN'),'error','index.php'); if (! $ldapserver->dnExists($entry['dn'])) - pla_error(sprintf(_('No such entry: %s'),''.pretty_print_dn($entry['dn']).'')); + error(sprintf('%s (%s)',_('No such entry.'),''.pretty_print_dn($entry['dn']).''),'error','index.php'); # Check the user-defined custom callback first. if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']))) $result = $ldapserver->delete($entry['dn']); else - pla_error(sprintf(_('Could not delete the entry: %s'),''.pretty_print_dn($entry['dn']).'')); + error(sprintf(_('Could not delete the entry: %s'),''.pretty_print_dn($entry['dn']).''),'error','index.php'); if ($result) { # Custom callback @@ -46,7 +47,9 @@ if ($result) { sprintf('index.php?server_id=%s',$ldapserver->server_id)); } else { - pla_error(sprintf(_('Could not delete the entry: %s'),''.pretty_print_dn($entry['dn']).''), - $ldapserver->error(),$ldapserver->errno()); + system_message(array( + 'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($entry['dn'])), + 'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()), + 'type'=>'error')); } ?> diff --git a/htdocs/delete_attr.php b/htdocs/delete_attr.php index cbce0d2..94f364f 100644 --- a/htdocs/delete_attr.php +++ b/htdocs/delete_attr.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete attribute'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete attribute')),'error','index.php'); +$entry = array(); $entry['dn']['string'] = get_request('dn'); $entry['dn']['encode'] = rawurlencode($entry['dn']['string']); $entry['attr'] = get_request('attr'); if (! $entry['dn']['string']) - pla_error(_('No DN specified')); + error(_('No DN specified'),'error','index.php'); if (! $entry['attr']) - pla_error(_('No attribute name specified.')); + error(_('No attribute name specified.'),'error','index.php'); if ($ldapserver->isAttrReadOnly($entry['attr'])) - pla_error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),htmlspecialchars($entry['attr']))); + error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),htmlspecialchars($entry['attr'])),'error','index.php'); $update_array = array(); $update_array[$entry['attr']] = array(); @@ -47,6 +48,9 @@ if ($result) { die(); } else { - pla_error(_('Could not perform ldap_modify operation.'),$ldapserver->error(),$ldapserver->errno()); + system_message(array( + 'title'=>_('Could not perform ldap_modify operation.'), + 'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()), + 'type'=>'error')); } ?> diff --git a/htdocs/delete_form.php b/htdocs/delete_form.php index bb73667..9e27481 100644 --- a/htdocs/delete_form.php +++ b/htdocs/delete_form.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); +$entry = array(); $entry['dn']['string'] = get_request('dn','GET'); $entry['dn']['html'] = htmlspecialchars($entry['dn']['string']); diff --git a/htdocs/download_binary_attr.php b/htdocs/download_binary_attr.php index 2acd2f3..bdbf7a2 100644 --- a/htdocs/download_binary_attr.php +++ b/htdocs/download_binary_attr.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); -if (! $ldapserver->haveAuthInfo()) - pla_error(_('Not enough information to login to server. Please check your configuration.')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); -$dn = rawurldecode($_GET['dn']); -$attr = $_GET['attr']; +if (! $ldapserver->haveAuthInfo()) + error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php'); + +$dn = rawurldecode(get_request('dn','GET')); +$attr = get_request('attr','GET'); # if there are multiple values in this attribute, which one do you want to see? -$value_num = isset($_GET['value_num']) ? $_GET['value_num'] : null; +$value_num = get_request('value_num','GET'); if (! $ldapserver->dnExists($dn)) - pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn))); + error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($dn)),'error','index.php'); $search = $ldapserver->search(null,$dn,'(objectClass=*)',array($attr),'base',false,$_SESSION[APPCONFIG]->GetValue('deref','view')); # Dump the binary data to the browser -if (ob_get_level()) ob_end_clean(); +$obStatus = ob_get_status(); +if (isset($obStatus['type']) && $obStatus['type'] && $obStatus['status']) + ob_end_clean(); + header('Content-type: octet-stream'); header("Content-disposition: attachment; filename=$attr"); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + if ($value_num && is_array($search[$attr][$dn])) echo $search[$dn][$attr][$value_num]; else diff --git a/htdocs/draw_tree_node.php b/htdocs/draw_tree_node.php index 7839d0a..edbe477 100644 --- a/htdocs/draw_tree_node.php +++ b/htdocs/draw_tree_node.php @@ -1,41 +1,42 @@ getEntry($entry['dn']); - if (! $dnentry) { - $tree->addEntry($entry['dn']); - $dnentry = $this->getEntry($entry['dn']); - } - - if (! $dnentry) - die(); - - if ($entry['action'] == 0) { - $dnentry->close(); - - } elseif ($entry['action'] == 2) { - $dnentry->open(); - - } else { - $dnentry->open(); - if ($entry['dn']) { - echo $tree->draw_children($dnentry,$entry['code']); - } else { - $tree->draw(true); - } - } +$tree = Tree::getInstance($entry['server_id']); +if (! $tree) die(); + +$dnentry = $tree->getEntry($entry['dn']); +if (! $dnentry) { + $tree->addEntry($entry['dn']); + $dnentry = $this->getEntry($entry['dn']); +} + +if (! $dnentry) + die(); + +if ($entry['action'] == 0) { + $dnentry->close(); + +} elseif ($entry['action'] == 2) { + $dnentry->open(); + +} else { + $dnentry->open(); + if ($entry['dn']) { + echo $tree->draw_children($dnentry,$entry['code']); + } else { + $tree->draw(true); + } +} +die(); ?> diff --git a/htdocs/entry_chooser.php b/htdocs/entry_chooser.php index a788095..09dbf73 100644 --- a/htdocs/entry_chooser.php +++ b/htdocs/entry_chooser.php @@ -1,5 +1,5 @@ haveAuthInfo()) - pla_error(_('Not enough information to login to server. Please check your configuration.')); + error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php'); $entry['children'] = $ldapserver->getContainerContents($entry['container'],0,'(objectClass=*)',$_SESSION[APPCONFIG]->GetValue('deref','tree')); sort($entry['children']); @@ -61,7 +62,7 @@ if (isset($ldapserver) && ! is_null($entry['container'])) { echo ''; echo ' '; - printf('Up',$href['up']); + printf('Up',$href['up'],IMGDIR); printf('%s',$href['up'],_('Back Up...')); echo ''; @@ -76,7 +77,7 @@ if (isset($ldapserver) && ! is_null($entry['container'])) { echo ''; echo ' '; - printf('Plus',$href['expand']); + printf('Plus',$href['expand'],IMGDIR); printf('%s',$href['return'],htmlspecialchars($dn)); echo ''; @@ -107,7 +108,7 @@ if (isset($ldapserver) && ! is_null($entry['container'])) { echo ''; echo ' '; - printf('Plus',$href['expand']); + printf('Plus',$href['expand'],IMGDIR); printf('%s',$href['return'],htmlspecialchars($dn)); } } diff --git a/htdocs/export.php b/htdocs/export.php index 6ecb620..4a2bc0a 100755 --- a/htdocs/export.php +++ b/htdocs/export.php @@ -1,5 +1,5 @@ isCommandAvailable('export')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('export'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('export')),'error','index.php'); +$entry = array(); $entry['base_dn'] = get_request('dn'); $entry['format'] = get_request('format','POST',false,'unix'); $entry['scope'] = get_request('scope','POST',false,'base'); @@ -40,8 +41,8 @@ if ($entry['sys_attr']) { array_push($attributes,'+'); } -(! is_null($entry['exporter_id'])) or pla_error(_('You must choose an export format.')); -isset($exporters[$entry['exporter_id']]) or pla_error(_('Invalid export format')); +(! is_null($entry['exporter_id'])) or error(_('You must choose an export format.'),'error','index.php'); +isset($exporters[$entry['exporter_id']]) or error(_('Invalid export format'),'error','index.php'); # Initialisation of other variables $friendly_rdn = get_rdn($entry['base_dn'],1); @@ -85,13 +86,13 @@ switch ($entry['exporter_id']) { default: # truly speaking,this default case will never be reached. See check at the bottom. - pla_error(_('No available exporter found.')); + error(_('No available exporter found.'),'error','index.php'); } # set the CLRN $exporter->setOutputFormat($br); -if (isset($_REQUEST['compress']) && $_REQUEST['compress'] = 'on') +if (get_request('compress','REQUEST') == 'on') $exporter->compress(true); # prevent script from bailing early for long search @@ -99,7 +100,10 @@ if (isset($_REQUEST['compress']) && $_REQUEST['compress'] = 'on') # send the header if ($entry['file']) { - if (ob_get_level()) ob_end_clean(); + $obStatus = ob_get_status(); + if (isset($obStatus['type']) && $obStatus['type'] && $obStatus['status']) + ob_end_clean(); + header('Content-type: application/download'); header(sprintf('Content-Disposition: filename="%s.%s"',$friendly_rdn,$exporters[$entry['exporter_id']]['extension'].($exporter->isCompressed()?'.gz':''))); $exporter->export(); diff --git a/htdocs/export_form.php b/htdocs/export_form.php index bb9fe25..c0a9d1e 100755 --- a/htdocs/export_form.php +++ b/htdocs/export_form.php @@ -1,5 +1,5 @@ Your install of PHP appears to be missing PCRE support.

Please install PCRE support before using phpLDAPadmin.
(Dont forget to restart your web server afterwards)

'); + require LIBDIR.'functions.php'; # Define the path to our configuration file. @@ -48,9 +52,30 @@ if (defined('CONFDIR')) else $app['config_file'] = 'config.php'; +# Make sure this PHP install has session support +if (! extension_loaded('session')) + error('

Your install of PHP appears to be missing php-session support.

Please install php-session support before using phpLDAPadmin.
(Dont forget to restart your web server afterwards)

','error',null,true); + # Make sure this PHP install has gettext, we use it for language translation if (! extension_loaded('gettext')) - error('

Your install of PHP appears to be missing GETTEXT support.

GETTEXT is used for language translation.

Please install GETTEXT support before using phpLDAPadmin.
(Dont forget to restart your web server afterwards)

','error',true); + system_message(array( + 'title'=>_('Missing required extension'), + 'body'=>'Your install of PHP appears to be missing GETTEXT support.

GETTEXT is used for language translation.

Please install GETTEXT support before using phpLDAPadmin.
(Dont forget to restart your web server afterwards)', + 'type'=>'error')); + +# Make sure this PHP install has all our required extensions +if (! extension_loaded('ldap')) + system_message(array( + 'title'=>_('Missing required extension'), + 'body'=>'Your install of PHP appears to be missing LDAP support.

Please install LDAP support before using phpLDAPadmin.
(Dont forget to restart your web server afterwards)', + 'type'=>'error')); + +# Make sure that we have php-xml loaded. +if (! function_exists('xml_parser_create')) + system_message(array( + 'title'=>_('Missing required extension'), + 'body'=>'Your install of PHP appears to be missing XML support.

Please install XML support before using phpLDAPadmin.
(Dont forget to restart your web server afterwards)', + 'type'=>'error')); /** * Helper functions. @@ -59,10 +84,10 @@ if (! extension_loaded('gettext')) if (isset($app['function_files']) && is_array($app['function_files'])) foreach ($app['function_files'] as $file_name ) { if (! file_exists($file_name)) - error(sprintf('Fatal error: Required file "%s" does not exist.',$file_name),'error',true); + error(sprintf('Fatal error: Required file "%s" does not exist.',$file_name),'error',null,true); if (! is_readable($file_name)) - error(sprintf('Fatal error: Cannot read the file "%s", its permissions may be too strict.',$file_name),'error',true); + error(sprintf('Fatal error: Cannot read the file "%s", its permissions may be too strict.',$file_name),'error',null,true); ob_start(); require $file_name; @@ -71,10 +96,10 @@ if (isset($app['function_files']) && is_array($app['function_files'])) # Configuration File check if (! file_exists($app['config_file'])) { - error(sprintf(_('You need to configure %s. Edit the file "%s" to do so. An example config file is provided in "%s.example".'),'phpLDAPadmin',$app['config_file'],$app['config_file']),'error',true); + error(sprintf(_('You need to configure %s. Edit the file "%s" to do so. An example config file is provided in "%s.example".'),'phpLDAPadmin',$app['config_file'],$app['config_file']),'error',null,true); } elseif (! is_readable($app['config_file'])) { - error(sprintf('Fatal error: Cannot read your configuration file "%s", its permissions may be too strict.',$app['config_file']),'error',true); + error(sprintf('Fatal error: Cannot read your configuration file "%s", its permissions may be too strict.',$app['config_file']),'error',null,true); } # If our config file fails the sanity check, then stop now. @@ -87,5 +112,8 @@ if (! check_config($app['config_file'])) { exit; } +if ($uri = get_request('URI','GET')) + header(sprintf('Location: cmd.php?%s',base64_decode($uri))); + include './cmd.php'; ?> diff --git a/htdocs/ldif_import.php b/htdocs/ldif_import.php index 4d08d70..50d6b40 100644 --- a/htdocs/ldif_import.php +++ b/htdocs/ldif_import.php @@ -1,5 +1,5 @@ isCommandAvailable('import')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('import'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('import')),'error','index.php'); +$entry = array(); $entry['continuous_mode'] = get_request('continuous_mode') ? true : false; $entry['ldif'] = get_request('ldif'); @@ -31,20 +32,20 @@ if ($entry['ldif']) { $entry['size'] = $_FILES['ldif_file']['size']; if (! is_array($_FILES['ldif_file'])) { - pla_error(_('Missing uploaded file.'),null,-1,false); + error(_('Missing uploaded file.'),'error'); return; } if (! file_exists($file)) { - pla_error(_('No LDIF file specified. Please try again.'),null,-1,false); + error(_('No LDIF file specified. Please try again.'),'error'); return; } if ($entry['size'] <= 0) { - pla_error(_('Uploaded LDIF file is empty.'),null,-1,false); + error(_('Uploaded LDIF file is empty.'),'error'); return; } } else { - pla_error(_('You must either upload a file or provide an LDIF in the text box.'),null,-1,false); + error(_('You must either upload a file or provide an LDIF in the text box.'),'error'); return; } @@ -182,7 +183,7 @@ function display_pla_parse_error($exception,$faultyEntry) { $errorMessage = $actionErrorMsg[$faultyEntry->getChangeType()]; echo '

'; - echo ''; + printf('
',IMGDIR); echo '',_('Maximum echo ''; printf('',_('Or paste your LDIF here')); -echo ''; +echo ''; echo ''; printf('', _("Don't stop on errors")); diff --git a/htdocs/login.php b/htdocs/login.php index fda54b9..a1ea2ba 100644 --- a/htdocs/login.php +++ b/htdocs/login.php @@ -1,5 +1,5 @@ auth_type = $save_auth_type; -$ldapserver->setLoginDN($login['dn'],$login['pass'],$anon_bind) or pla_error(_('Could not set cookie.')); +$ldapserver->setLoginDN($login['dn'],$login['pass'],$anon_bind) or error(_('Could not set cookie.'),'error','index.php'); set_lastactivity($ldapserver); if (! $anon_bind) { diff --git a/htdocs/login_form.php b/htdocs/login_form.php index d82be02..fcb6f87 100644 --- a/htdocs/login_form.php +++ b/htdocs/login_form.php @@ -1,5 +1,5 @@ auth_type, array('cookie','session'))) - pla_error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($ldapserver->auth_type))); + error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($ldapserver->auth_type)),'error','index.php'); printf('

%s %s

',_('Authenticate to server'),$ldapserver->name); # Check for a secure connection -if (! isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') { +if (! isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on') { echo '
'; echo '
'; echo ''; @@ -36,8 +36,8 @@ echo '
'; echo ''; printf('',$ldapserver->server_id); -if (isset($_GET['redirect'])) - printf('',rawurlencode($_GET['redirect'])); +if (get_request('redirect','GET',false,false)) + printf('',rawurlencode(get_request('redirect','GET'))); echo '
'; echo '
'; printf('

%s

',_('LDIF Parse Error')); echo '
'; diff --git a/htdocs/ldif_import_form.php b/htdocs/ldif_import_form.php index 006dd90..ab883c0 100644 --- a/htdocs/ldif_import_form.php +++ b/htdocs/ldif_import_form.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); printf('

%s

',_('Import LDIF File')); printf('

%s: %s

',_('Server'),htmlspecialchars($ldapserver->name)); @@ -38,7 +38,7 @@ printf('
 %s %s
 
%s
 
 %s
'; diff --git a/htdocs/logout.php b/htdocs/logout.php index 3bb771b..39e6101 100644 --- a/htdocs/logout.php +++ b/htdocs/logout.php @@ -1,5 +1,5 @@ haveAuthInfo()) - pla_error(_('No one is logged in to that server.')); + error(_('No one is logged in to that server.'),'error','index.php'); if (in_array($ldapserver->auth_type, array('cookie','session','http'))) { syslog_notice (sprintf('Logout for %s',$ldapserver->getLoggedInDN())); if($ldapserver->auth_type!='http') - $ldapserver->unsetLoginDN() or pla_error(_('Could not logout.')); + $ldapserver->unsetLoginDN() or error(_('Could not logout.'),'error','index.php'); unset_lastactivity($ldapserver); @session_destroy(); } else - pla_error(sprintf(_('Unknown auth_type: %s'), htmlspecialchars($ldapserver->auth_type))); + error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($ldapserver->auth_type)),'error','index.php'); system_message(array( 'title'=>_('Logout'), diff --git a/htdocs/mass_delete.php b/htdocs/mass_delete.php index 71a8adf..81dfa48 100644 --- a/htdocs/mass_delete.php +++ b/htdocs/mass_delete.php @@ -1,5 +1,5 @@ isReadOnly() ) - pla_error(_('Unable to delete, server is in READY-ONLY mode.')); +if ($ldapserver->isReadOnly()) + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); -if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete', 'mass_delete')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete mass entries'))); +if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete','mass_delete')) + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete mass entries')),'error','index.php'); $confirmed = isset($_POST['confirmed']) ? true : false; isset($_POST['mass_delete']) or - pla_error(_('Error calling mass_delete.php. Missing mass_delete in POST vars.')); + error(_('Error calling mass_delete.php. Missing mass_delete in POST vars.'),'error','index.php'); $mass_delete = $_POST['mass_delete']; is_array($mass_delete) or - pla_error(_('mass_delete POST var is not an array.')); + error(_('mass_delete POST var is not an array.'),'error','index.php'); $ldapserver->isMassDeleteEnabled() or - pla_error(_('Mass deletion is not enabled. Please enable it in config.php before proceeding.')); + error(_('Mass deletion is not enabled. Please enable it in config.php before proceeding.'),'error','index.php'); printf('

%s

',_('Mass Deleting')); @@ -48,7 +48,7 @@ if ($confirmed == true) { $failed_dns = array(); if (! is_array($mass_delete)) - pla_error(_('Malformed mass_delete array.')); + error(_('Malformed mass_delete array.'),'error','index.php'); if (count($mass_delete) == 0) { echo '
'; diff --git a/htdocs/modify_member_form.php b/htdocs/modify_member_form.php index 22dc66f..a90e777 100644 --- a/htdocs/modify_member_form.php +++ b/htdocs/modify_member_form.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); if (! $ldapserver->haveAuthInfo()) - pla_error(_('Not enough information to login to server. Please check your configuration.')); + error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php'); -$attr = $_GET['attr']; -$dn = isset($_GET['dn']) ? $_GET['dn'] : null; +$attr = get_request('attr','GET'); +$dn = get_request('dn','GET'); $encoded_dn = rawurlencode($dn); $encoded_attr = rawurlencode($attr); @@ -39,7 +39,7 @@ if ($current_members) else $num_current_members = 0; -sort($current_members); +usort($current_members,'pla_compare_dns'); # Loop through all base dn's and search possible member entries foreach ($ldapserver->getBaseDN() as $base_dn) { @@ -74,6 +74,7 @@ printf('

%s %s     %s: %s

' printf('%s %s %s %s:', _('There are'),$num_current_members,_('members in group'),htmlspecialchars($rdn)); +$possible_members = array(); for ($i=0; $iGetValue('modify_member','posixgroupattr'))) $possible_members[$i] = $possible_values[$i][$_SESSION[APPCONFIG]->GetValue('modify_member','posixattr')]; @@ -81,7 +82,7 @@ for ($i=0; $iGetValue('modify_member','attr')]; } -sort($possible_members); +usort($possible_members,'pla_compare_dns'); /* * Show only user that are not already in group. @@ -110,8 +111,8 @@ echo ''; echo '
'; echo ''; -printf('',_('Available members')); -printf('',_('Group members')); +printf('',IMGDIR,_('Available members')); +printf('',IMGDIR,_('Group members')); echo ''; # Generate select box from all possible members diff --git a/htdocs/password_checker.php b/htdocs/password_checker.php index e059155..4190c7f 100644 --- a/htdocs/password_checker.php +++ b/htdocs/password_checker.php @@ -1,5 +1,5 @@ '; +$entry = array(); $entry['hash'] = get_request('hash','REQUEST'); $entry['password'] = get_request('check_password','REQUEST'); $entry['action'] = get_request('action','REQUEST'); @@ -34,7 +35,7 @@ echo '
Users %sMembers %sUsers %sMembers %s
'; echo ''; printf('',_('Compare')); printf('', - $entry['enc_type'] ? 'text' : 'password',htmlspecialchars($entry['hash'])); + (obfuscate_password_display($entry['enc_type']) ? 'password' : 'text'),htmlspecialchars($entry['hash'])); echo ''; echo ''; diff --git a/htdocs/purge_cache.php b/htdocs/purge_cache.php index 15de8e4..911d88e 100644 --- a/htdocs/purge_cache.php +++ b/htdocs/purge_cache.php @@ -1,5 +1,5 @@ isCommandAvailable('purge')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('purge'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('purge')),'error','index.php'); $purge_session_keys = array('cache'); diff --git a/htdocs/rdelete.php b/htdocs/rdelete.php index 96595eb..fde4e9a 100644 --- a/htdocs/rdelete.php +++ b/htdocs/rdelete.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); -if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete', 'simple_delete')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry'))); +if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete','simple_delete')) + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry')),'error','index.php'); -$entry['dn'] = $_POST['dn']; +$entry = array(); +$entry['dn'] = get_request('dn'); if (! $entry['dn']) - pla_error(_('You must specify a DN')); + error(_('You must specify a DN'),'error','index.php'); if (! $ldapserver->dnExists($entry['dn'])) - pla_error(sprintf(_('No such entry: %s'),htmlspecialchars($entry['dn']))); + error(sprintf('%s (%s)',_('No such entry.'),htmlspecialchars($entry['dn'])),'error','index.php'); printf('

'._('Deleting %s').'

',htmlspecialchars(get_rdn($entry['dn']))); printf('

%s

',_('Recursive delete progress')); @@ -42,8 +43,10 @@ if ($result) { printf(_('Entry %s and sub-tree deleted successfully.'),''.htmlspecialchars($entry['dn']).''); } else { - pla_error(sprintf(_('Could not delete the entry: %s'),htmlspecialchars($entry['dn'])), - $ldapserver->error(),$ldapserver->errno()); + system_message(array( + 'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($entry['dn'])), + 'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()), + 'type'=>'error')); } function pla_rdelete($ldapserver,$dn) { @@ -60,8 +63,10 @@ function pla_rdelete($ldapserver,$dn) { return true; } else { - pla_error(sprintf(_('Failed to delete entry %s'),htmlspecialchars($dn)), - $ldapserver->error(),$ldapserver->errno()); + system_message(array( + 'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($entry['dn'])), + 'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()), + 'type'=>'error')); } } else { @@ -77,8 +82,10 @@ function pla_rdelete($ldapserver,$dn) { return true; } else { - pla_error(sprintf(_('Failed to delete entry %s'),htmlspecialchars($dn)), - $ldapserver->error(),$ldapserver->errno()); + system_message(array( + 'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($entry['dn'])), + 'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()), + 'type'=>'error')); } } } diff --git a/htdocs/refresh.php b/htdocs/refresh.php index cab3f82..5658a83 100644 --- a/htdocs/refresh.php +++ b/htdocs/refresh.php @@ -1,5 +1,5 @@ isCommandAvailable('server_refresh')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('refresh server'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('refresh server')),'error','index.php'); unset($_SESSION['cache'][$ldapserver->server_id]['tree']); diff --git a/htdocs/rename.php b/htdocs/rename.php index 9670fb5..6459192 100644 --- a/htdocs/rename.php +++ b/htdocs/rename.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_rename')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('rename entry'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('rename entry')),'error','index.php'); -$dn = ($_POST['dn']); +$dn = get_request('dn'); if (! $ldapserver->isBranchRenameEnabled()) { # we search all children, not only the visible children in the tree $children = $ldapserver->getContainerContents($dn); if (count($children) > 0) - pla_error(_('You cannot rename an entry which has children entries (eg, the rename operation is not allowed on non-leaf entries)')); + error(_('You cannot rename an entry which has children entries (eg, the rename operation is not allowed on non-leaf entries)'),'error','index.php'); } -$new_rdn = ($_POST['new_rdn']); +$new_rdn = get_request('new_rdn'); $container = get_container($dn); $new_dn = sprintf('%s,%s',$new_rdn,$container); if ($new_dn == $dn) - pla_error(_('You did not change the RDN')); + error(_('You did not change the RDN'),'error','index.php'); $old_dn_attr = explode('=',$dn); $old_dn_attr = $old_dn_attr[0]; @@ -44,7 +44,7 @@ $old_dn_attr = $old_dn_attr[0]; $new_dn_value = explode('=',$new_rdn,2); if (count($new_dn_value) != 2 || ! isset($new_dn_value[1])) - pla_error(_('Invalid RDN value')); + error(_('Invalid RDN value'),'error','index.php'); $new_dn_attr = $new_dn_value[0]; $new_dn_value = $new_dn_value[1]; @@ -58,7 +58,7 @@ if ($success) { $success = $ldapserver->rename($dn,$new_rdn,$container,$deleteoldrdn); } else { - pla_error(_('Could not rename the entry') ); + error(_('Could not rename the entry'),'error','index.php'); } if ($success) { diff --git a/htdocs/rename_form.php b/htdocs/rename_form.php index cee7784..d251a48 100644 --- a/htdocs/rename_form.php +++ b/htdocs/rename_form.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); if (! $ldapserver->haveAuthInfo()) - pla_error(_('Not enough information to login to server. Please check your configuration.')); + error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php'); $dn = $_GET['dn']; $rdn = get_rdn($dn); diff --git a/htdocs/schema.php b/htdocs/schema.php index a39fb34..7eece09 100644 --- a/htdocs/schema.php +++ b/htdocs/schema.php @@ -1,5 +1,5 @@ isCommandAvailable('schema')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('view schema'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('view schema')),'error','index.php'); +$entry = array(); $entry['view'] = get_request('view','GET','false','objectClasses'); $entry['value'] = get_request('viewvalue','GET'); @@ -63,7 +64,7 @@ echo '
'; switch($entry['view']) { case 'syntaxes': - $highlight_oid = isset($_GET['highlight_oid']) ? $_GET['highlight_oid'] : false; + $highlight_oid = get_request('highlight_oid','GET',false,false); echo '
'; print '
%s
'; @@ -73,7 +74,7 @@ switch($entry['view']) { $schema_syntaxes = $ldapserver->SchemaSyntaxes(null,true); if (! $schema_syntaxes) - pla_error($schema_error_str); + error($schema_error_str,'error','index.php'); foreach ($schema_syntaxes as $syntax) { $counter++; @@ -108,14 +109,15 @@ switch($entry['view']) { 'usage' => _('Usage'), 'maximum_length' => _('Maximum Length'), 'aliases' => _('Aliases'), - 'used_by_objectclasses' => _('Used by objectClasses') + 'used_by_objectclasses' => _('Used by objectClasses'), + 'force_as_may' => _('Force as MAY by config') ); $schema_attrs = $ldapserver->SchemaAttributes(); $schema_object_classes = $ldapserver->SchemaObjectClasses(); if (! $schema_attrs || ! $schema_object_classes) - pla_error($schema_error_str); + error($schema_error_str,'error','index.php'); printf('%s:',_('Jump to an attribute type')); echo ''; @@ -279,6 +281,10 @@ switch($entry['view']) { print ''; break; + case 'force_as_may': + printf('',$attr->forced_as_may ? _('Yes') : _('No')); + break; + } print ''; } @@ -292,7 +298,7 @@ switch($entry['view']) { case 'matching_rules': $schema_matching_rules = $ldapserver->MatchingRules(null,true); if (! $schema_matching_rules) - pla_error($schema_error_str); + error($schema_error_str,'error','index.php'); printf('%s
',_('Jump to a matching rule')); @@ -371,7 +377,7 @@ switch($entry['view']) { case 'objectClasses': $schema_oclasses = $ldapserver->SchemaObjectClasses(); if (! $schema_oclasses) - pla_error($schema_error_str); + error($schema_error_str,'error','index.php'); printf('%s:',_('Jump to an objectClass')); @@ -485,6 +491,11 @@ switch($entry['view']) { $href = htmlspecialchars(sprintf($entry['href']['objectClasses'],strtolower($attr->getSource()))); printf('(%s %s)',_('Inherited from'),$href,$attr->getSource()); } + + if ($oclass->isForceMay($attr->getName())) { + echo '
'; + printf('%s',_('This attribute has been forced as a MAY attribute by the configuration')); + } echo ''; } echo ''; @@ -502,5 +513,5 @@ switch($entry['view']) { } if (! is_null($entry['value']) && ! $entry['viewed']) - pla_error(sprintf(_('No such schema item: "%s"'),htmlspecialchars($entry['value']))); + error(sprintf(_('No such schema item: "%s"'),htmlspecialchars($entry['value'])),'error','index.php'); ?> diff --git a/htdocs/search.php b/htdocs/search.php index 05ec0f6..7f2764d 100644 --- a/htdocs/search.php +++ b/htdocs/search.php @@ -1,5 +1,5 @@ GetValue('search','display')); $entry['form'] = get_request('form','GET',false,get_request('form','SESSION')); @@ -117,15 +118,15 @@ echo '
'; if ($entry['search']) { if ($entry['form'] == 'advanced') { if (! $_SESSION[APPCONFIG]->isCommandAvailable('search','advanced_search')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('advanced search'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('advanced search')),'error','index.php'); } elseif ($entry['form'] == 'predefined') { if (! $_SESSION[APPCONFIG]->isCommandAvailable('search','predefined_search')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('predefined search'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('predefined search')),'error','index.php'); } elseif ($entry['form'] == 'simple') { if (! $_SESSION[APPCONFIG]->isCommandAvailable('search','simple_search')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('simple search'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('simple search')),'error','index.php'); } if ($entry['form'] == 'advanced') { @@ -247,7 +248,10 @@ if ($entry['search']) { $entry['scope'],$entry['orderby']['array'],$_SESSION[APPCONFIG]->GetValue('deref','search')); if ((! $results) && $ldapserver->errno()) - pla_error(_('Encountered an error while performing search.'),$ldapserver->error(),$ldapserver->errno()); + system_message(array( + 'title'=>_('Encountered an error while performing search.'), + 'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()), + 'type'=>'error')); $errno = $ldapserver->errno(); @@ -269,11 +273,11 @@ if ($entry['search']) { $href = htmlspecialchars(sprintf('cmd.php?cmd=export_form&server_id=%s&scope=%s&dn=%s&filter=%s&attributes=%s', $ldapserver->server_id,$entry['scope'],$base_dn,rawurlencode($entry['filter']['clean']),rawurlencode(join(', ',$search_result_attributes)))); - printf(''; if (preg_match('/^[0-9]+\.[0-9]+/',$value)) { - printf('', - htmlspecialchars($value), htmlspecialchars($value)); + printf('', + IMGDIR,htmlspecialchars($value), htmlspecialchars($value)); if ($oidtext = support_oid_to_text($value)) if (isset($oidtext['ref'])) diff --git a/htdocs/show_cache.php b/htdocs/show_cache.php index 302efa9..0ea9e1d 100644 --- a/htdocs/show_cache.php +++ b/htdocs/show_cache.php @@ -1,5 +1,5 @@ GetValue('appearance','hide_debug_info')) { poststr += "&index=" + encodeURI(xx); } - obj.innerHTML = ' Loading...'; + obj.innerHTML = ' Loading...'; makePOSTRequest('cmd.php',poststr,'alertCacheContents','cancelCacheContents'); } diff --git a/htdocs/template_engine.php b/htdocs/template_engine.php index 1b8fb38..1502816 100644 --- a/htdocs/template_engine.php +++ b/htdocs/template_engine.php @@ -1,5 +1,5 @@ dnExists($entry['dn']['string']) - or pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($entry['dn']['string']))); + or error(sprintf('%s (%s)',_('No such entry'),pretty_print_dn($entry['dn']['string'])),'error','index.php'); $tree = get_cached_item($ldapserver->server_id,'tree'); @@ -51,7 +52,7 @@ if ($entry['dn']['string']) { } else { if ($ldapserver->isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); # Create a new empty entry $entryfactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','entry_factory'); diff --git a/htdocs/timeout.php b/htdocs/timeout.php deleted file mode 100644 index dcc7b1b..0000000 --- a/htdocs/timeout.php +++ /dev/null @@ -1,41 +0,0 @@ -session_timeout ? $ldapserver->session_timeout : session_cache_expire()-1; -?> - -

name; ?>

-
-
-
- -
-
-
- -
- - - diff --git a/htdocs/update.php b/htdocs/update.php index fe31f55..6faf8ff 100644 --- a/htdocs/update.php +++ b/htdocs/update.php @@ -1,5 +1,5 @@ server_id,$entry['dn']['encode'])); die(); } if ($ldapserver->isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); $entry['update'] = get_request('update_array','POST',false,array()); $entry['skip'] = get_request('skip_array','POST',false,array()); $failed_attrs = array(); if (! is_array($entry['update'])) - pla_error(_('update_array is malformed. This might be a phpLDAPadmin bug. Please report it.')); + error(_('update_array is malformed. This might be a phpLDAPadmin bug. Please report it.'),'error','index.php'); run_hook ('pre_update', array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']['string'],'update_array'=>$entry['update'])); @@ -58,13 +59,14 @@ foreach ($entry['update'] as $attr => $val) { $entry['update'][$attr] = array(); if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete attribute'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete attribute')),'error','index.php'); + } else { # Skip change $entry['update'][$attr] = $val; if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value') && ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete_value')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('modify attribute values'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('modify attribute values')),'error','index.php'); } } else { @@ -77,7 +79,7 @@ foreach ($entry['update'] as $attr => $val) { if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value') && ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete_value')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('modify attribute values'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('modify attribute values')),'error','index.php'); } } } @@ -89,8 +91,8 @@ foreach ($entry['update'] as $attr_name => $val) { $href['search'] = sprintf('cmd.php?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s', $ldapserver->server_id,$attr_name,$badattr); - pla_error(sprintf(_('Your attempt to add %s (%s) to
%s
is NOT allowed. That attribute/value belongs to another entry.

You might like to search for that entry.'), - $attr_name,$badattr,$entry['dn']['string'],$href['search'])); + error(sprintf(_('Your attempt to add %s (%s) to
%s
is NOT allowed. That attribute/value belongs to another entry.

You might like to search for that entry.'), + $attr_name,$badattr,$entry['dn']['string'],$href['search']),'error','index.php'); } if (run_hook('pre_attr_modify', @@ -100,8 +102,9 @@ foreach ($entry['update'] as $attr_name => $val) { $failed_attrs[$attr_name] = $val; } elseif ($ldapserver->isAttrReadOnly($attr)) { - pla_error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'), - htmlspecialchars($attr_name))); + error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'), + htmlspecialchars($attr_name)),'error','index.php'); + } else { // binary values if (isset($_SESSION['submitform'][$attr_name])) { @@ -175,6 +178,9 @@ if ($result) { die(); } else { - pla_error(_('Could not perform ldap_modify operation.'),$ldapserver->error(),$ldapserver->errno()); + system_message(array( + 'title'=>_('Could not perform ldap_modify operation.'), + 'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()), + 'type'=>'error')); } ?> diff --git a/htdocs/update_confirm.php b/htdocs/update_confirm.php index 9909553..dcfc4d0 100644 --- a/htdocs/update_confirm.php +++ b/htdocs/update_confirm.php @@ -1,5 +1,5 @@ isReadOnly()) - pla_error(_('You cannot perform updates while server is in read-only mode')); + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); /***************/ /* get entry */ /***************/ - + +$entry = array(); $entry['dn']['string'] = get_request('dn'); $entry['dn']['encode'] = rawurlencode($entry['dn']['string']); if (! $entry['dn']['string'] || ! $ldapserver->dnExists($entry['dn']['string'])) - pla_error(sprintf(_('The entry (%s) does not exist.'),htmlspecialchars($entry['dn']['string'])),null,-1,true); + error(sprintf(_('The entry (%s) does not exist.'),htmlspecialchars($entry['dn']['string'])),'error','index.php'); $tree = get_cached_item($ldapserver->server_id,'tree'); $entry['ldap'] = null; @@ -40,7 +41,7 @@ if ($tree) { } if (! $entry['ldap'] || $entry['ldap']->isReadOnly()) - pla_error(sprintf(_('The entry (%s) is in readonly mode.'),htmlspecialchars($entry['dn']['string'])),null,-1,true); + error(sprintf(_('The entry (%s) is in readonly mode.'),htmlspecialchars($entry['dn']['string'])),'error','index.php'); /***************/ /* old values */ @@ -96,9 +97,9 @@ $attr_to_delete = array(); // if objectClass attribute is modified if (isset($entry['values']['new']['objectClass'])) { - if (!isset($entry['values']['old']['objectClass'])) { - pla_error(_('An entry should have one structural objectClass.')); - } + if (!isset($entry['values']['old']['objectClass'])) + error(_('An entry should have one structural objectClass.'),'error','index.php'); + // deleted objectClasses foreach ($entry['values']['old']['objectClass'] as $oldOC) { if (!in_array($oldOC, $entry['values']['new']['objectClass'])) { diff --git a/htdocs/view_jpeg_photo.php b/htdocs/view_jpeg_photo.php index ed9313d..8dcdfd2 100644 --- a/htdocs/view_jpeg_photo.php +++ b/htdocs/view_jpeg_photo.php @@ -1,5 +1,5 @@ GetValue('jpeg','tmpdir'),$file['name']); if (! file_exists($file['name'])) - pla_error(sprintf('%s%s %s',_('No such file'),_(':'),htmlspecialchars($file['name']))); + error(sprintf('%s%s %s',_('No such file'),_(':'),htmlspecialchars($file['name'])),'error','index.php'); $file['handle'] = fopen($file['name'],'r'); $file['data'] = fread($file['handle'],filesize($file['name'])); fclose($file['handle']); -if (ob_get_level()) - ob_clean(); +$obStatus = ob_get_status(); +if (isset($obStatus['type']) && $obStatus['type'] && $obStatus['status']) + ob_end_clean(); Header('Content-type: image/jpeg'); Header('Content-disposition: inline; filename=jpeg_photo.jpg'); diff --git a/htdocs/welcome.php b/htdocs/welcome.php index fb7aca2..078a88c 100644 --- a/htdocs/welcome.php +++ b/htdocs/welcome.php @@ -1,5 +1,5 @@ '; echo '

'; -printf('%s',_('phpLDAPadmin logo'),_('phpLDAPadmin logo')); +printf('%s',IMGDIR,_('phpLDAPadmin logo'),_('phpLDAPadmin logo')); echo '

'; echo _('Use the menu to the left to navigate'); echo '

'; diff --git a/lib/AJAXTree.php b/lib/AJAXTree.php index b4a2e8c..9c902a6 100644 --- a/lib/AJAXTree.php +++ b/lib/AJAXTree.php @@ -1,5 +1,5 @@ '; - echo '->'; + printf('->',$node_id,IMGDIR,$entry->getIcon($ldapserver)); echo ''; echo ' '; echo ''; @@ -131,6 +131,10 @@ class AJAXTree extends PLMTree { $first_child = $this->get_plm_before_first_child($parent_entry,$code); $last_child = $this->get_plm_after_last_child($parent_entry,$code); + # If compression is on, we need to compress this output - but only if called by draw_tree_node + if (function_exists('isCompress') && isCompress() && get_request('cmd','REQUEST') == 'draw_tree_node') + ob_start(); + echo $first_child; for ($i=0; $i
'._('Retrieving DN').'...<\/small>\'); + if (mainPageDiv) includeHTML(mainPageDiv, \'
'._('Retrieving DN').'...<\/small>\'); makeGETRequest(\'cmd.php\', urlParameters+\'&meth=get_body\', \'alertMainPage\', \'cancelMainPage\'); return false; } @@ -337,7 +347,7 @@ class AJAXTree extends PLMTree { $output .= $this->get_indentation($level); $output .= '--'; $output .= '
'; - $output .= '->'; + $output .= sprintf('->',IMGDIR); $output .= ''; $output .= ' '; $output .= ''; @@ -361,7 +371,7 @@ class AJAXTree extends PLMTree { $output .= $this->get_indentation($level); $output .= '--'; $output .= ''; - $output .= '->'; + $output .= sprintf('->',IMGDIR); $output .= ''; $output .= ' '; $output .= ''; diff --git a/lib/Attribute.php b/lib/Attribute.php index 016c9fd..492203c 100644 --- a/lib/Attribute.php +++ b/lib/Attribute.php @@ -1,5 +1,5 @@ entry) { - //$rdn = get_rdn($this->entry->getDn()); - //$attr = $this->name; - //return preg_match("/^${attr}=/", $rdn); - return ($this->name == $this->entry->getRdnAttributeName()); + return (preg_grep('/'.$this->name.'/',$this->entry->getRdnAttributeName())); } else { return false; } diff --git a/lib/DefaultCreatingEntry.php b/lib/DefaultCreatingEntry.php index 7ea1b7d..85ad8b6 100644 --- a/lib/DefaultCreatingEntry.php +++ b/lib/DefaultCreatingEntry.php @@ -1,5 +1,5 @@ getRdnAttribute(); - if ($attr) return $attr->getName(); - else return ''; + if ($attr) return array($attr->getName()); + else return array(''); } public function getRdnAttribute() { diff --git a/lib/DefaultEditingEntry.php b/lib/DefaultEditingEntry.php index cfca77a..9efc40e 100644 --- a/lib/DefaultEditingEntry.php +++ b/lib/DefaultEditingEntry.php @@ -1,5 +1,5 @@ getCustomDNSysAttrs($this->getDn()); + if (! $custom_int_attrs_vals) $attrs_vals = array(); + elseif (! is_array($custom_int_attrs_vals)) $custom_int_attrs_vals = array($custom_int_attrs_vals); + $attrs_vals = $ldapserver->getDNAttrs($this->getDn(),false,$_SESSION[APPCONFIG]->GetValue('deref','view')); if (! $attrs_vals) $attrs_vals = array(); elseif (! is_array($attrs_vals)) $attrs_vals = array($attrs_vals); + $custom_attrs_vals = $ldapserver->getCustomDNAttrs($this->getDn(),false,$_SESSION[APPCONFIG]->GetValue('deref','view')); + if (! $custom_attrs_vals) $attrs_vals = array(); + elseif (! is_array($custom_attrs_vals)) $custom_attrs_vals = array($custom_attrs_vals); + + $int_attrs_vals = array_merge($int_attrs_vals,$custom_int_attrs_vals); + $attrs_vals = array_merge($attrs_vals,$custom_attrs_vals); $attrs_vals = array_merge($attrs_vals, $int_attrs_vals); uksort($attrs_vals,'sortAttrs'); # Sort these entries diff --git a/lib/Entry.php b/lib/Entry.php index 35b1d0d..c253875 100644 --- a/lib/Entry.php +++ b/lib/Entry.php @@ -1,5 +1,5 @@ dn) { - $i = strpos($this->dn, '='); - if ($i !== false) $attr = substr($this->dn, 0, $i); + $i = strpos($this->dn, ','); + if ($i !== false) { + $attrs = split('\+',substr($this->dn, 0, $i)); + foreach ($attrs as $id => $attr) { + list ($name,$value) = split('=',$attr); + $attrs[$id] = $name; + } + $attr = array_unique($attrs); + } } return $attr; } diff --git a/lib/EntryReader.php b/lib/EntryReader.php index 599042e..dc559c3 100644 --- a/lib/EntryReader.php +++ b/lib/EntryReader.php @@ -1,5 +1,5 @@ context == ENTRY_READER_CREATION_CONTEXT) && ($name == 'objectClass')) return; - $old_vals = $this->get('OldValues', $attribute); + if ($this->context == ENTRY_READER_EDITING_CONTEXT) + $old_vals = $this->get('OldValues', $attribute); + else + $old_vals = array(); + $new_vals = $this->get('NewValues', $attribute); if (isset($_POST['old_values'][$name])) { @@ -205,7 +209,7 @@ class EntryReader extends Visitor { } if (is_null($val)) { - pla_error(sprintf(_('Your template is missing variable (%s)'), $request)); + error(sprintf(_('Your template is missing variable (%s)'),$request),'error','index.php'); } return $val; @@ -255,7 +259,7 @@ class EntryReader extends Visitor { if (function_exists($matches[1])) { $val = call_user_func($matches[1], $matches[2], $attribute, $i, $val); } else { - pla_error(sprintf(_('Your template has an unknown post function (%s).'), $matches[1])); + error(sprintf(_('Your template has an unknown post function (%s).'),$matches[1]),'error','index.php'); } } } diff --git a/lib/EntryWriter1.php b/lib/EntryWriter1.php index 02a3d89..7f80981 100644 --- a/lib/EntryWriter1.php +++ b/lib/EntryWriter1.php @@ -1,5 +1,5 @@ draw('Title', $entry); $this->draw('Subtitle', $entry); echo "\n"; - // menu + # Menu $this->draw('Menu', $entry); } @@ -56,13 +56,20 @@ class EntryWriter1 extends EntryWriter { protected function drawEntryMenu($entry) {} protected function drawEntryJavascript($entry) { + printf("\n\n",__METHOD__); + if (isset($_SESSION[APPCONFIG])) { - echo ''; + echo "\n"; + echo ''."\n"; + echo ''."\n"; + echo "\n"; } + echo ''."\n"; echo ''; + } - echo ''; + return values; + } + '."\n"; + echo ''."\n"; + echo "\n"; echo ''; + '."\n"; echo ''; + '."\n"; for ($i = 0; $i < count($this->shown_attributes); $i++) { $this->draw('Javascript', $this->shown_attributes[$i]); @@ -175,7 +188,9 @@ class EntryWriter1 extends EntryWriter { echo ''; + '."\n"; + + printf("\n\n",__METHOD__); } /********************************/ @@ -186,10 +201,10 @@ class EntryWriter1 extends EntryWriter { if (DEBUG_ENABLED) debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$entry->getDn()); - // init + # Init $this->visit('Entry::Start', $entry); - // check + # Check $container = $entry->getContainer(); $container_ok = true; $objectclasses_ok = true; @@ -205,17 +220,17 @@ class EntryWriter1 extends EntryWriter { } } - // header + # Header $this->draw('Header', $entry); - // errors + # Errors if (!$container_ok) { - pla_error(sprintf(_('The container you specified (%s) does not exist.'),htmlspecialchars($container)), null, -1, false); + error(sprintf(_('The container you specified (%s) does not exist.'),htmlspecialchars($container)),'error'); echo '
'; } if (!$objectclasses_ok) { - pla_error(_('You did not select any objectClasses for this object.'), null, -1, false); + error(_('You did not select any objectClasses for this object.'),'error'); echo '
'; } } @@ -318,7 +333,7 @@ class EntryWriter1 extends EntryWriter { public function drawDefaultCreatingEntryStepFormEnd($entry, $step) { echo ''; - // javascript + # Javascript $this->draw('Javascript', $entry); } @@ -381,13 +396,11 @@ class EntryWriter1 extends EntryWriter { protected function drawDefaultCreatingEntryShownAttributes($entry) { $attrs = array(); - // put required attributes first - foreach ($this->shown_attributes as $sa) { + # Put required attributes first + foreach ($this->shown_attributes as $sa) if ($sa->isRequired()) $attrs[] = $sa; - } - foreach ($this->shown_attributes as $sa) { + foreach ($this->shown_attributes as $sa) if (!$sa->isRequired()) $attrs[] = $sa; - } $has_required_attrs = false; $has_optional_attrs = false; @@ -409,7 +422,7 @@ class EntryWriter1 extends EntryWriter { } } - $this->draw('', $attr); + $this->draw('',$attr,$entry); echo "\n"; } @@ -421,7 +434,7 @@ class EntryWriter1 extends EntryWriter { protected function drawDefaultCreatingEntryHiddenAttributes($entry) { foreach ($this->hidden_attributes as $attr) { - $this->draw('', $attr); + $this->draw('',$attr,$entry); echo "\n"; } } @@ -438,13 +451,13 @@ class EntryWriter1 extends EntryWriter { if (DEBUG_ENABLED) debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$entry->getDn()); - // init + # Init $this->visit('Entry::Start', $entry); - // header + # Header $this->draw('Header', $entry); - // form start + # Form start if (! $entry->isReadOnly()) { echo '
'; printf('',$this->index); @@ -459,21 +472,21 @@ class EntryWriter1 extends EntryWriter { if (DEBUG_ENABLED) debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$entry->getDn()); - // draw internal attributes + # Draw internal attributes if (get_request('show_internal_attrs','REQUEST')) { $this->draw('InternalAttributes', $entry); echo "\n\n"; } - // draw visible attributes + # Draw visible attributes $this->draw('ShownAttributes', $entry); - // form end + # Form end if (! $entry->isReadOnly()) { $this->draw('FormSubmitButton', $entry); echo '

%s
[ Save %s ]', - $href,_('export results')); + printf('[ Save %s ]', + $href,IMGDIR,_('export results')); } - printf('[ rename %s%s',_('Format'),_(':')); + printf('[ rename %s%s',IMGDIR,_('Format'),_(':')); foreach ($result_formats as $f) { echo ' '; @@ -380,7 +384,7 @@ if ($entry['search']) { elseif ($entry['format'] == 'table') require LIBDIR.'search_results_table.php'; else - pla_error(sprintf(_('Unrecognized search result format: %s'),htmlspecialchars($entry['format']))); + error(sprintf(_('Unrecognized search result format: %s'),htmlspecialchars($entry['format'])),'error','index.php'); echo '
'; if (trim($pager_html)) diff --git a/htdocs/server_info.php b/htdocs/server_info.php index 5fef5cd..1d3d586 100644 --- a/htdocs/server_info.php +++ b/htdocs/server_info.php @@ -1,5 +1,5 @@ isCommandAvailable('server_info')) - pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('view server informations'))); + error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('view server information')),'error','index.php'); # The attributes we'll examine when searching the LDAP server's RootDSE $root_dse_attributes = array( @@ -94,8 +94,8 @@ foreach ($attrs as $attr => $values) { print '
%s%s
'; - // draw hidden attributes + # Draw hidden attributes $this->draw('HiddenAttributes', $entry); printf(''); @@ -482,7 +495,7 @@ class EntryWriter1 extends EntryWriter { printf(''); } - // javascript + # Javascript $this->draw('Javascript', $entry); } @@ -631,13 +644,13 @@ class EntryWriter1 extends EntryWriter { case IdEntryRenameMenuItem : if (!$entry->isReadOnly() && $config->isCommandAvailable('entry_rename')) { - $rdnAttr = $entry->getAttribute($entry->getRdnAttributeName()); - if ($rdnAttr && $rdnAttr->isVisible() && !$rdnAttr->isReadOnly()) { - return $this->get('RenameMenuItem', $entry); - } else { - return ''; + foreach ($entry->getRdnAttributeName() as $rdnAttr) { + $rdnAttr = $entry->getAttribute($rdnAttr); + if ($rdnAttr && $rdnAttr->isVisible() && !$rdnAttr->isReadOnly()) + return $this->get('RenameMenuItem', $entry); } - } else return ''; + } + return ''; case IdEntryDeleteAttributeMessage : if ($config->GetValue('appearance', 'show_hints') @@ -666,15 +679,15 @@ class EntryWriter1 extends EntryWriter { static $children_count = false; static $more_children = false; if ($children_count === false) { - // visible children in the tree + # Visible children in the tree $children_count = $entry->getChildrenNumber(); - // is there filtered children ? + # Is there filtered children ? $more_children = $entry->isSizeLimited(); if (!$more_children) { - // all children in ldap + # All children in ldap $all_children = $this->getLDAPServer()->getContainerContents( - $entry->getDn(), $children_count + 1, - '(objectClass=*)', $config->GetValue('deref','view')); + $entry->getDn(), $children_count + 1, + '(objectClass=*)', $config->GetValue('deref','view')); $more_children = (count($all_children) > $children_count); } } @@ -805,7 +818,7 @@ class EntryWriter1 extends EntryWriter { } protected function getDefaultEditingEntryDeleteAttributeMessage($entry) { - if ($_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete_value')) + if ($_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete_value') && ! $entry->isReadOnly()) return sprintf($this->hint_layout,_('Hint: To delete an attribute, empty the text field and click save.')); else return ''; @@ -830,7 +843,7 @@ class EntryWriter1 extends EntryWriter { $counter = 0; foreach ($this->internal_attributes as $attr) { - $this->draw('',$attr); + $this->draw('',$attr,$entry); $counter++; echo "\n"; } @@ -844,14 +857,14 @@ class EntryWriter1 extends EntryWriter { protected function drawDefaultEditingEntryShownAttributes($entry) { foreach ($this->shown_attributes as $attr) { - $this->draw('',$attr); + $this->draw('',$attr,$entry); echo "\n"; } } protected function drawDefaultEditingEntryHiddenAttributes($entry) { foreach ($this->hidden_attributes as $attr) { - $this->draw('',$attr); + $this->draw('',$attr,$entry); echo "\n"; } } @@ -970,13 +983,11 @@ class EntryWriter1 extends EntryWriter { echo '
'; } else { - // Patch 1539633 - // default action is create.php - // you can change this behavior by setting myscript.php in template header echo ''; printf('', $entry->hasProperty('action') ? rawurlencode($entry->getProperty('action')) : 'create'); } + } else { $this->draw('DefaultCreatingEntry::StepFormStart', $entry, $step); } @@ -998,7 +1009,7 @@ class EntryWriter1 extends EntryWriter { $this->draw('RdnChooser', $entry); - // draw attributes + # Draw attributes $this->draw('ShownAttributes', $entry); $this->draw('StepFormSubmitButton', $entry, $step); @@ -1040,6 +1051,7 @@ class EntryWriter1 extends EntryWriter { $i = -1; $templates = &$entry->getTemplates(); $nb_templates = count($templates); + if ($entry->hasDefaultTemplate()) $nb_templates++; foreach ($templates as $template_name => $template_attrs) { @@ -1109,12 +1121,13 @@ class EntryWriter1 extends EntryWriter { foreach ($this->shown_attributes as $attr) { $page = $attr->getProperty('page'); + if ($page == $this->step) { - $this->draw('', $attr); + $this->draw('',$attr,$entry); echo "\n"; - //} elseif ($page < $this->step) { + } else { - // the displayed attributes are the visible attributes in shown_attributes list + # The displayed attributes are the visible attributes in shown_attributes list $attr->hide(); $this->hidden_attributes[] = $attr; } @@ -1128,15 +1141,13 @@ class EntryWriter1 extends EntryWriter { } foreach ($this->hidden_attributes as $attr) { - //$page = $attr->hasProperty('page') ? $attr->getProperty('page') : -1; - //if ($page <= $this->step) { - $this->draw('', $attr); - echo "\n"; - //} + $this->draw('',$attr,$entry); + echo "\n"; } } protected function drawTemplateCreatingEntryJavascript($entry) { + printf("\n\n",__METHOD__); $this->draw('DefaultCreatingEntry::Javascript', $entry); $templates = new Templates($this->index); @@ -1173,17 +1184,21 @@ class EntryWriter1 extends EntryWriter { // here comes template-specific implementation, generated by php if (false) {}'; foreach ($entry->getAttributes() as $attribute) { - $attr = $attribute->getName(); - echo "\n\t\t\t\t\telse if ((i = id.indexOf('_".$attr."_')) >= 0) {\n"; - echo "\t\t\t\t\t\tpre = id.substring(0, i+1);\n"; - echo "\t\t\t\t\t\tsuf = id.substring(i + 1 + '$attr'.length, id.length);\n"; - $this->draw('FillJavascript', $attribute, 'id', 'value'); - if (isset($hash['autoFill'.$attr])) { - echo $hash['autoFill'.$attr]; + if ($attribute->isVisible() && ($attribute->hasProperty('onchange')) || $attribute->isRequired()) { + $attr = $attribute->getName(); + echo "\n\t\t\t\t\telse if ((i = id.indexOf('_".$attr."_')) >= 0) {\n"; + echo "\t\t\t\t\t\tpre = id.substring(0, i+1);\n"; + echo "\t\t\t\t\t\tsuf = id.substring(i + 1 + '$attr'.length, id.length);\n"; + $this->draw('FillJavascript', $attribute, 'id', 'value'); + if (isset($hash['autoFill'.$attr])) { + echo $hash['autoFill'.$attr]; + } + echo "\t\t\t}\n"; } - echo "\t\t\t}\n"; } echo '}}'; + + printf("\n\n",__METHOD__); } /********************************/ @@ -1258,6 +1273,7 @@ class EntryWriter1 extends EntryWriter { $i = -1; $templates = &$entry->getTemplates(); $nb_templates = count($templates); + if ($entry->hasDefaultTemplate()) $nb_templates++; foreach ($templates as $template_name => $template_attrs) { @@ -1309,7 +1325,7 @@ class EntryWriter1 extends EntryWriter { protected function drawTemplateEditingEntryShownAttributes($entry) { foreach ($this->shown_attributes as $attr) { // @todo if this->page == attr->page - $this->draw('', $attr); + $this->draw('',$attr,$entry); echo "\n"; } } @@ -1320,6 +1336,7 @@ class EntryWriter1 extends EntryWriter { } protected function drawTemplateEditingEntryJavascript($entry) { + printf("\n\n",__METHOD__); $this->draw('DefaultEditingEntry::Javascript', $entry); $templates = new Templates($this->index); @@ -1354,44 +1371,47 @@ class EntryWriter1 extends EntryWriter { // here comes template-specific implementation, generated by php if (false) {}'; foreach ($entry->getAttributes() as $attribute) { - $attr = $attribute->getName(); - echo "\n\t\t\telse if ((i = id.indexOf('_".$attr."_')) >= 0) {\n"; - echo "\t\t\t\tpre = id.substring(0, i+1);\n"; - echo "\t\t\t\tsuf = id.substring(i + 1 + '$attr'.length, id.length);\n"; - $this->draw('FillJavascript', $attribute, 'id', 'value'); - if (isset($hash['autoFill'.$attr])) { - echo $hash['autoFill'.$attr]; + if ($attribute->isVisible() && ($attribute->hasProperty('onchange')) || $attribute->isRequired()) { + $attr = $attribute->getName(); + echo "\n\t\t\telse if ((i = id.indexOf('_".$attr."_')) >= 0) {\n"; + echo "\t\t\t\tpre = id.substring(0, i+1);\n"; + echo "\t\t\t\tsuf = id.substring(i + 1 + '$attr'.length, id.length);\n"; + $this->draw('FillJavascript', $attribute, 'id', 'value'); + if (isset($hash['autoFill'.$attr])) { + echo $hash['autoFill'.$attr]; + } + echo "\t\t\t}\n"; } - echo "\t\t\t}\n"; } echo '}}'; + printf("\n\n",__METHOD__); } /**************************/ /* Paint an Attribute */ /**************************/ - protected function drawAttribute($attribute) { + protected function drawAttribute($attribute,$entry) { if ($attribute->isVisible()) $this->draw('Informations', $attribute); - $this->draw('Values', $attribute); + $this->draw('Values',$attribute,$entry); } protected function drawAttributeJavascript($attribute) { - echo ''; + echo '}'."\n"; + echo ''."\n"; } protected function drawAttributeFocusJavascript($attribute, $component) { @@ -1413,11 +1433,12 @@ class EntryWriter1 extends EntryWriter { echo 'var vals = getAttributeValues("new", "'.$attribute->getName().'"); if (vals.length <= 0) { '.$var_valid.' = false; - alertError("'._('This attribute is required')._(':').' '.$attribute->getFriendlyName().'", '.$silence.'); + alertError("'._('This attribute is required')._(':').' '.$attribute->getFriendlyName().'", '.$silence.'); }'; echo 'var comp = getAttributeComponents("new", "'.$attribute->getName().'"); for (var i = 0; i < comp.length; i++) { - comp[i].style.backgroundColor = '.$var_valid.' ? "white" : \'#F0F0FF\'; + comp[i].style.backgroundColor = '.$var_valid.' ? "white" : \'#FFFFA0\'; + comp[i].style.color = '.$var_valid.' ? "black" : \'#00005F\'; }'; } } @@ -1436,7 +1457,6 @@ class EntryWriter1 extends EntryWriter { protected function getTemplateCreatingEntryAttributeBlurJavascript($entry, $attribute, $component) { $j = 'fill('.$component.'.id, pla_getComponentValue('.$component.'));'; - //$j .= $this->get('DefaultCreatingEntry::AttributeBlurJavascript',$entry, $attribute, $component); return $j; } @@ -1446,7 +1466,6 @@ class EntryWriter1 extends EntryWriter { protected function getTemplateEditingEntryAttributeBlurJavascript($entry, $attribute, $component) { $j = 'fill('.$component.'.id, pla_getComponentValue('.$component.'));'; - //$j .= $this->get('DefaultEditingEntry::AttributeBlurJavascript',$entry, $attribute, $component); return $j; } @@ -1494,6 +1513,12 @@ class EntryWriter1 extends EntryWriter { $attr_note .= $rdn_note; } + $hint_note = $this->get('HintNote',$attribute); + if ($hint_note) { + if (trim($attr_note)) $attr_note .= ', '; + $attr_note .= $hint_note; + } + if ($attr_note) printf('%s', $attr_note); if ($attribute->isReadOnly() && $this->getLDAPServer()->isAttrReadOnly($attribute->getName())) { @@ -1503,14 +1528,14 @@ class EntryWriter1 extends EntryWriter { } } - protected function drawAttributeValues($attribute) { + protected function drawAttributeValues($attribute,$entry) { if ($attribute->isVisible()) $this->draw('StartValueLine', $attribute); # draws values $value_count = $attribute->getValueCount(); $i = 0; for (; $i < $value_count; $i++) { - $this->draw('Value', $attribute, $i); + $this->draw('Value',$attribute,$i,$entry); } if ($this->context == ENTRY_WRITER_CREATION_CONTEXT) { @@ -1519,7 +1544,7 @@ class EntryWriter1 extends EntryWriter { else $blankvalue_count -= $value_count; for ($j = 0; $j < $blankvalue_count; $j++) { - $this->draw('BlankValue', $attribute, $i + $j); + $this->draw('BlankValue',$attribute,$i+$j,$entry); } } @@ -1548,7 +1573,7 @@ class EntryWriter1 extends EntryWriter { switch ($i) { case IdAttributeAddValueMenuItem : if ($attribute->isVisible() && !$attribute->isReadOnly() - && !$attribute->isRdn() && $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')) { + && $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')) { if ($attribute->getMaxValueCount() < 0 || $attribute->getValueCount() < $attribute->getMaxValueCount()) { return $this->get('AddValueMenuItem', $attribute); } @@ -1595,7 +1620,7 @@ class EntryWriter1 extends EntryWriter { } } - protected function drawAttributeValue($attribute, $i) { + protected function drawAttributeValue($attribute,$i,$entry) { if (DEBUG_ENABLED) debug_log('Entered with (%s, %d)',1,__FILE__,__LINE__,__METHOD__,$attribute->getName(),$i); @@ -1610,7 +1635,7 @@ class EntryWriter1 extends EntryWriter { $this->draw('OldValue', $attribute, $i); - $this->draw('NewValue', $attribute, $i); + $this->draw('NewValue',$attribute,$i,$entry); if ($attribute->isVisible()) { echo ''; @@ -1626,7 +1651,10 @@ class EntryWriter1 extends EntryWriter { * Save the current value to detect changes */ protected function drawAttributeOldValue($attribute, $i) { - $val = $attribute->getValue($i); + if ($this->context == ENTRY_WRITER_EDITING_CONTEXT) + $val = $attribute->getValue($i); + else + $val = ''; if (!is_string($val)) $val = ''; if ($i < 0) $i = 0; @@ -1637,20 +1665,33 @@ class EntryWriter1 extends EntryWriter { /** * Display the current value */ - protected function drawAttributeNewValue($attribute, $i) { + protected function drawAttributeNewValue($attribute,$i,$entry) { if (!$attribute->isVisible()) { $this->draw('HiddenValue', $attribute, $i); + $this->draw('Javascript',$attribute); } elseif ($attribute->isReadOnly() || ($attribute->getEntry() && $attribute->getEntry()->getDn() && $attribute->isRdn())) { - $this->draw('ReadOnlyValue', $attribute, $i); + + /* If this is the RDN, we need to see if it has multiple values. If it does, and the multivalues are not + * not in the RDN, then we need to make them editable. */ + + if ($attribute->isRdn()) { + $rdn = split('\+',get_rdn($entry->getDN())); + if (in_array(sprintf('%s=%s',$attribute->getName(),$attribute->getValue($i)),$rdn)) + $this->draw('ReadOnlyValue', $attribute, $i); + else + $this->draw('ReadWriteValue', $attribute, $i); + + } else + $this->draw('ReadOnlyValue', $attribute, $i); } else { $this->draw('ReadWriteValue', $attribute, $i); - } + } } - protected function drawAttributeBlankValue($attribute, $i) { - $this->draw('Value', $attribute, $i); + protected function drawAttributeBlankValue($attribute,$i,$entry) { + $this->draw('Value',$attribute,$i,$entry); } protected function drawAttributeHiddenValue($attribute, $i) { @@ -1753,8 +1794,8 @@ class EntryWriter1 extends EntryWriter { $found = false; printf(''; } else { printf('', - $id, htmlspecialchars($attribute->getName()), $i, - $id, htmlspecialchars($attribute->getName()), $i, - htmlspecialchars($default)); + $id, htmlspecialchars($attribute->getName()), $i, + $id, htmlspecialchars($attribute->getName()), $i, + htmlspecialchars($default)); } if ($display) { @@ -1854,9 +1895,8 @@ class EntryWriter1 extends EntryWriter { printf('Go ',IMGDIR); } elseif ($this->getLDAPServer()->dnExists($val)) { - $href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',$this->index,$val); - printf('Go ',_('Go to'), - htmlspecialchars($val), htmlspecialchars($href),IMGDIR); + printf('Go ', + _('Go to'),htmlspecialchars($val),$this->index,rawurlencode($val),IMGDIR); } else { printf('Go ',_('DN not available'),htmlspecialchars($val),IMGDIR); @@ -1872,8 +1912,9 @@ class EntryWriter1 extends EntryWriter { protected function drawAttributeUrlValueIcon($attribute, $val) { $img = sprintf('%s',IMGDIR,_('URL')); + $url = split(' +',$val,2); if (strlen($val) <= 0) echo $img; - else printf(''.$img.'', htmlspecialchars($val)); + else printf('%s',htmlspecialchars($url[0]),$img); echo ' '; } @@ -1884,24 +1925,26 @@ class EntryWriter1 extends EntryWriter { if ($attribute->getEntry() && $attribute->getEntry()->getDn() // if not creating attribute && $config->isCommandAvailable('schema') ) { + $href = sprintf('cmd.php?cmd=schema&server_id=%s&view=attributes&viewvalue=%s', $this->index, real_attr_name($attribute->getName())); printf('%s', $attribute->getName(), htmlspecialchars($href), $attr_display); + } else { printf('%s', $attr_display); } } protected function getAttributeAliasNote($attribute) { - # is there a user-friendly translation available for this attribute? + # Is there a user-friendly translation available for this attribute? $friendly_name = $attribute->getFriendlyName(); - if ($friendly_name != $attribute->getName()) { - return sprintf('%s',_('Note'),$friendly_name,_('is an alias for'),$attribute->getName(),_('alias')); - } else { + if ($friendly_name != $attribute->getName()) + return sprintf('%s', + _('Note'),$friendly_name,_('is an alias for'),$attribute->getName(),_('alias')); + else return ''; - } } protected function getAttributeRequiredNote($attribute) { @@ -1949,6 +1992,15 @@ class EntryWriter1 extends EntryWriter { } } + protected function getAttributeHintNote($attribute) { + # Is there a hint for this attribute + if ($attribute->getHint()) { + return sprintf('%s ',htmlspecialchars($attribute->getHint()),_('hint')); + } else { + return ''; + } + } + protected function drawAttributeRequiredSymbol($attribute) { echo '*'; } @@ -2029,6 +2081,7 @@ class EntryWriter1 extends EntryWriter { } protected function drawBinaryAttributeJavascript($attribute) { + printf("\n\n",__METHOD__); $this->draw('Attribute::Javascript', $attribute); $dn = ''; @@ -2057,6 +2110,7 @@ class EntryWriter1 extends EntryWriter { } } '; + printf("\n\n",__METHOD__); } protected function drawBinaryAttributeBlurJavascript($attribute, $component) { @@ -2071,16 +2125,17 @@ class EntryWriter1 extends EntryWriter { if (!is_string($val)) $val = ''; printf(' ', + .' name="new_values[%s][%s]" value="%s" onFocus="focus_%s(this);" onBlur="blur_%s(this);" %s %s/> ', $attribute->getName(), $i, htmlspecialchars($attribute->getName()), $i, htmlspecialchars($val), $attribute->getName(), $attribute->getName(), ($attribute->getSize() > 0) ? 'size="'.$attribute->getSize().'"' : '', ($attribute->getMaxLength() > 0) ? 'maxlength="'.$attribute->getMaxLength().'"' : ''); draw_date_selector_link($attribute->getName().'_'.$i); - echo ''; + echo ''."\n"; } protected function drawDateAttributeJavascript($attribute) { + printf("\n\n",__METHOD__); $this->draw('Attribute::Javascript', $attribute); $entry['date'] = $_SESSION[APPCONFIG]->GetValue('appearance','date_attrs'); @@ -2100,6 +2155,7 @@ class EntryWriter1 extends EntryWriter { if (in_array_ignore_case($attribute->getName(),array_keys($entry['time'])) && ($entry['time'][$attribute->getName()])) printf('',$attribute->getName(),$i,'true'); } + printf("\n\n",__METHOD__); } /***************************/ @@ -2119,7 +2175,7 @@ class EntryWriter1 extends EntryWriter { $input_id = sprintf('new_values_%s_%s', htmlspecialchars($attribute->getName()), $i); printf(' ', + .' onFocus="focus_%s(this);" onBlur="blur_%s(this);" %s %s/> ', $input_name, $input_id, htmlspecialchars($val), $attribute->getName(), $attribute->getName(), ($attribute->getSize() > 0) ? 'size="'.$attribute->getSize().'"' : '', @@ -2135,6 +2191,7 @@ class EntryWriter1 extends EntryWriter { $this->draw('Helper', $attribute, $i); echo ''; } + echo "\n"; } protected function drawDnAttributeIcon($attribute, $val) { @@ -2261,7 +2318,7 @@ class EntryWriter1 extends EntryWriter { /* Paint a ObjectClassAttribute */ /********************************/ - protected function drawObjectClassAttributeNewValue($attribute, $i) { + protected function drawObjectClassAttributeNewValue($attribute,$i,$entry) { $val = $attribute->getValue($i); if (!is_string($val)) $val = ''; if ($i < 0) $i = 0; @@ -2282,7 +2339,7 @@ class EntryWriter1 extends EntryWriter { _('This is a structural ObjectClass and cannot be removed.'), _('structural')); } else { - $this->draw('Attribute::NewValue', $attribute, $i); + $this->draw('Attribute::NewValue',$attribute,$i,$entry); } } @@ -2300,15 +2357,12 @@ class EntryWriter1 extends EntryWriter { /*****************************/ protected function drawPasswordAttributeOldValue($attribute, $i) { - //if ($this->context == ENTRY_WRITER_CREATION_CONTEXT) { - $this->draw('Attribute::OldValue', $attribute, $i); - //} + $this->draw('Attribute::OldValue', $attribute, $i); } protected function drawPasswordAttributeHiddenValue($attribute, $i) { - if ($this->context == ENTRY_WRITER_CREATION_CONTEXT) { + if ($this->context == ENTRY_WRITER_CREATION_CONTEXT) $this->draw('Attribute::HiddenValue', $attribute, $i); - } } protected function drawPasswordAttributeReadOnlyValue($attribute, $i) { @@ -2321,9 +2375,10 @@ class EntryWriter1 extends EntryWriter { $obfuscate_password = obfuscate_password_display($enc_type); printf('
', - ($obfuscate_password ? 'password' : 'text'), + ($obfuscate_password ? 'password' : 'text'), htmlspecialchars($attribute->getName()), $i, htmlspecialchars($attribute->getName()), $i, htmlspecialchars($val), ($attribute->getSize() > 0) ? 'size="'.$attribute->getSize().'"' : ''); + if ($val != '') $this->draw('CheckLink', $attribute, 'new_values_'.htmlspecialchars($attribute->getName()).'_'.$i); } @@ -2335,16 +2390,15 @@ class EntryWriter1 extends EntryWriter { $enc_type = get_enc_type($val); # Set the default hashing type if the password is blank (must be newly created) - if ($val == '') { + if ($val == '') $enc_type = get_default_hash($this->index); - } echo '', - $id, htmlspecialchars($attribute->getName()), $value, - $attribute->getName(), $attribute->getName(), + .' onFocus="focus_%s(this);" onClick="blur_%s(this);" %s />', + $id, htmlspecialchars($attribute->getName()), $value, + $attribute->getName(), $attribute->getName(), isset($selected[$value]) ? 'checked' : '', " $description"); } + foreach ($vals as $val) { if (!isset($selected[$val])) { $id = 'new_values_'.htmlspecialchars($attribute->getName()).'_'.($j++); @@ -2516,35 +2583,49 @@ class EntryWriter1 extends EntryWriter { } echo '
'; $obfuscate_password = obfuscate_password_display($enc_type); $id = sprintf('new_values_%s_%s', htmlspecialchars($attribute->getName()), $i); printf('', + .' onFocus="focus_%s(this);" onBlur="blur_%s(this);" %s %s/>', ($obfuscate_password ? 'password' : 'text'), htmlspecialchars($attribute->getName()), $i, $id, htmlspecialchars($val), @@ -2353,19 +2407,20 @@ class EntryWriter1 extends EntryWriter { ($attribute->getMaxLength() > 0) ? 'maxlength="'.$attribute->getMaxLength().'"' : ''); echo ''; - if ($attribute->hasProperty('helper')) { + + if ($attribute->hasProperty('helper')) $this->draw('Helper', $attribute, $i); - } else { - echo enc_type_select_list($enc_type,'enc',$attribute,$i); - } + else + echo enc_type_select_list($enc_type,'enc',$attribute->getName(),$i); + echo '
'; if ($attribute->hasProperty('verify') && $attribute->getProperty('verify') && $obfuscate_password) { $id_v = sprintf('new_values_verify_%s_%s', htmlspecialchars($attribute->getName()), $i); printf('', - htmlspecialchars($attribute->getName()), $i, $id_v, - ($attribute->getSize() > 0) ? 'size="'.$attribute->getSize().'"' : '', - ($attribute->getMaxLength() > 0) ? 'maxlength="'.$attribute->getMaxLength().'"' : ''); + htmlspecialchars($attribute->getName()), $i, $id_v, + ($attribute->getSize() > 0) ? 'size="'.$attribute->getSize().'"' : '', + ($attribute->getMaxLength() > 0) ? 'maxlength="'.$attribute->getMaxLength().'"' : ''); echo ''; printf('(%s)', _('confirm')); echo '
'; @@ -2394,6 +2449,7 @@ class EntryWriter1 extends EntryWriter { } protected function drawPasswordAttributeJavascript($attribute) { + printf("\n\n",__METHOD__); $this->draw('Attribute::Javascript', $attribute); static $already_draw = false; @@ -2401,6 +2457,7 @@ class EntryWriter1 extends EntryWriter { else $already_draw = true; # add the javascript so we can call check password later. + printf("\n\n",__METHOD__); echo ' '; + printf("\n\n",__METHOD__); } /***********************************/ @@ -2416,12 +2474,14 @@ class EntryWriter1 extends EntryWriter { /***********************************/ protected function drawRandomPasswordAttributeJavascript($attribute) { + printf("\n\n",__METHOD__); $this->draw('PasswordAttribute::Javascript', $attribute); $pwd = password_generate(); $pwd = str_replace("\\", "\\\\", $pwd); $pwd = str_replace("'", "\\'", $pwd); + printf("\n\n",__METHOD__); echo ''; + printf("\n\n",__METHOD__); } /******************************/ /* Paint a SelectionAttribute */ /******************************/ - protected function drawSelectionAttributeValues($attribute) { + protected function drawSelectionAttributeValues($attribute,$entry) { if (!$attribute->isVisible() || !$attribute->isMultiple() || ($attribute->getValueCount() > 0)) { - $this->draw('Attribute::Values', $attribute); + $this->draw('Attribute::Values',$attribute,$entry); } else { $this->draw('StartValueLine', $attribute); $this->draw('Value', $attribute, 0); @@ -2463,7 +2524,7 @@ class EntryWriter1 extends EntryWriter { protected function drawSelectionAttributeReadWriteValue($attribute, $i) { if ($attribute->isMultiple()) { - // for multiple selection, we draw the component only one time + # For multiple selection, we draw the component only one time if ($i > 0) return; if (($attribute->getSize() > 0) && ($attribute->getSize() < $attribute->getOptionCount())) { @@ -2472,22 +2533,27 @@ class EntryWriter1 extends EntryWriter { htmlspecialchars($attribute->getName()), $attribute->getSize()); $vals = $attribute->getValues(); $j = 0; + foreach ($attribute->getSelection() as $value => $description) { if (in_array($value, $vals)) $selected[$value] = true; $id = 'new_values_'.htmlspecialchars($attribute->getName()).'_'.($j++); printf('', - $id, $value, htmlspecialchars($attribute->getName()), htmlspecialchars($attribute->getName()), - isset($selected[$value]) ? 'selected' : '', $description); + $id, $value, htmlspecialchars($attribute->getName()), htmlspecialchars($attribute->getName()), + isset($selected[$value]) ? 'selected' : '', $description); + echo "\n"; } + foreach ($vals as $val) { if (!isset($selected[$val])) { $id = 'new_values_'.htmlspecialchars($attribute->getName()).'_'.($j++); printf('', $id, $val, htmlspecialchars($attribute->getName()), - htmlspecialchars($attribute->getName()), $val); + .'%s', $id, $val, htmlspecialchars($attribute->getName()), + htmlspecialchars($attribute->getName()), $val); } + echo "\n"; } echo ''; + } else { $selected = array(); $vals = $attribute->getValues(); @@ -2498,12 +2564,13 @@ class EntryWriter1 extends EntryWriter { if (in_array($value, $vals)) $selected[$value] = true; $id = 'new_values_'.htmlspecialchars($attribute->getName()).'_'.($j++); printf('
%s
%s
'; } + } else { $val = $attribute->getValue($i); if (!is_string($val)) $val = ''; if ($i < 0) $i = 0; - if ($attribute->hasProperty('helper')) { + if ($attribute->hasProperty('helper')) echo '',$this->getDepth()+3); printf('',_('Error number'),$errnum,$verbose_error['title']); + $body .= sprintf('',_('Description'),$verbose_error['desc']); } else { - $body = $msg; + $body .= sprintf('',_('Error number'),$errnum); + $body .= sprintf('',_('Description'),_('no description available')); } - system_message(array('title'=>$title ? $title : 'Error','body'=>$body,'type'=>'error'),$fatal ? 'index.php' : null); + $body .= '
'; - } $found = false; $empty_value = false; $id = 'new_values_'.htmlspecialchars($attribute->getName()).'_'.$i; + + # If we are a required attribute, and the selection is blank, then the user cannot submit this form. + if ($attribute->isRequired() && ! count($attribute->getSelection())) + system_message(array( + 'title'=>_('Template Value Error'), + 'body'=>sprintf('This template uses a selection list for attribute [%s], however the selection list is empty.
You may need to create some dependancy entries in your LDAP server so that this attribute renders with values. Alternatively, you may be able to define the appropriate selection values in the template file.',$attribute->getName()), + 'type'=>'warn')); + + printf(''; @@ -2563,17 +2644,18 @@ class EntryWriter1 extends EntryWriter { return $this->get('Attribute::MenuItem', $attribute, $i); } return ''; + case IdAttributeModifyMemberMenuItem : return ''; + default : return $this->get('Attribute::MenuItem', $attribute, $i); } } protected function drawSelectionAttributeIcon($attribute, $val) { - if (!$attribute->isMultiple() || $attribute->isReadOnly()) { + if (!$attribute->isMultiple() || $attribute->isReadOnly()) $this->draw('Attribute::Icon', $attribute, $val); - } } /***************************/ @@ -2626,7 +2708,6 @@ class EntryWriter1 extends EntryWriter { protected function drawShadowAttributeShadowDate($attribute, $shadow_date) { $config = $_SESSION[APPCONFIG]; - //$shadow_format_attrs = array_merge($shadow_before_today_attrs,$shadow_after_today_attrs); $shadow_before_today_attrs = arrayLower($attribute->shadow_before_today_attrs); $shadow_after_today_attrs = arrayLower($attribute->shadow_after_today_attrs); $today = date('U'); diff --git a/lib/EntryWriter2.php b/lib/EntryWriter2.php index d647f3a..1185bd1 100644 --- a/lib/EntryWriter2.php +++ b/lib/EntryWriter2.php @@ -1,5 +1,5 @@ getHint() /*&& $_SESSION[APPCONFIG]->GetValue('appearance', 'show_hints')*/) { - echo 'Hint '.$attribute->getHint().''; - } + if ($attribute->getHint()) + printf('Hint %s',IMGDIR,$attribute->getHint()); + parent::drawAttributeMenu($attribute); } diff --git a/lib/HTMLTree.php b/lib/HTMLTree.php index a872cea..779225a 100644 --- a/lib/HTMLTree.php +++ b/lib/HTMLTree.php @@ -1,5 +1,5 @@
 
 
', - $_SESSION['plaConfig']->GetValue('appearance','tree_width') ? sprintf('width: %spx; ',$_SESSION['plaConfig']->GetValue('appearance','tree_width')) : '', - $_SESSION['plaConfig']->GetValue('appearance','tree_height') ? sprintf('height: %spx; ',$_SESSION['plaConfig']->GetValue('appearance','tree_height')) : ''); + $_SESSION[APPCONFIG]->GetValue('appearance','tree_width') ? sprintf('width: %spx; ',$_SESSION[APPCONFIG]->GetValue('appearance','tree_width')) : '', + $_SESSION[APPCONFIG]->GetValue('appearance','tree_height') ? sprintf('height: %spx; ',$_SESSION[APPCONFIG]->GetValue('appearance','tree_height')) : ''); foreach ($ldapserver->getBaseDN() as $base_dn) { # Did we get a base_dn for this server somehow? @@ -55,7 +55,7 @@ class HTMLTree extends Tree { if (! $ldapserver->dnExists($base_dn)) { $javascript_id++; - printf('',$this->getDepth()+3-3,pretty_print_dn($base_dn)); + printf('',IMGDIR,$this->getDepth()+3-3,pretty_print_dn($base_dn)); /* Move this form and add it to the end of the html - otherwise the javascript * doesnt work when isMassDeleteEnabled returning true. @@ -103,9 +103,10 @@ class HTMLTree extends Tree { } } else { // end if $ldapserver->haveAuthInfo() /* We don't have enough information to login to this server - * Draw the "login..." link - */ - $this->draw_login_link(); + * Draw the "login..." link */ + + if ($ldapserver->auth_type != 'http') + $this->draw_login_link(); } $this->draw_mass_deletion_submit_button(); @@ -153,14 +154,14 @@ class HTMLTree extends Tree { $ldapserver = $this->getLdapServer(); echo ''; - printf('',_('Server')); + printf('',IMGDIR,_('Server')); printf(''; } @@ -209,7 +210,7 @@ class HTMLTree extends Tree { if ($_SESSION[APPCONFIG]->isCommandAvailable('export')) return $this->get_export_menu_item(); else return ''; case 6 : - if ($ldapserver->auth_type != 'config') return $this->get_logout_menu_item(); + if (! in_array($ldapserver->auth_type,array('config','http'))) return $this->get_logout_menu_item(); else return ''; default : return false; @@ -220,56 +221,56 @@ class HTMLTree extends Tree { $ldapserver = $this->getLdapServer(); $href = sprintf('cmd.php?cmd=schema&server_id=%s',$ldapserver->server_id); - return sprintf('%s
%s
', - _('View schema for'),$ldapserver->name,htmlspecialchars($href),'images/schema.png',_('schema'),_('schema')); + return sprintf('%s
%s
', + _('View schema for'),$ldapserver->name,htmlspecialchars($href),IMGDIR,'schema.png',_('schema'),_('schema')); } protected function get_search_menu_item() { $ldapserver = $this->getLdapServer(); $href = sprintf('cmd.php?cmd=search&server_id=%s&form=undefined',$ldapserver->server_id); - return sprintf('%s
%s
', - _('search'),$ldapserver->name,htmlspecialchars($href),'images/search.png',_('search'),_('search')); + return sprintf('%s
%s
', + _('search'),$ldapserver->name,htmlspecialchars($href),IMGDIR,'search.png',_('search'),_('search')); } protected function get_refresh_menu_item() { $ldapserver = $this->getLdapServer(); $href = sprintf('cmd.php?cmd=refresh&server_id=%s',$ldapserver->server_id); - return sprintf('%s
%s
', - _('Refresh all expanded containers for'),$ldapserver->name,htmlspecialchars($href),'images/refresh-big.png',_('refresh'),_('refresh')); + return sprintf('%s
%s
', + _('Refresh all expanded containers for'),$ldapserver->name,htmlspecialchars($href),IMGDIR,'refresh-big.png',_('refresh'),_('refresh')); } protected function get_info_menu_item() { $ldapserver = $this->getLdapServer(); $href = sprintf('cmd.php?cmd=server_info&server_id=%s',$ldapserver->server_id); - return sprintf('%s
%s
', - _('View server-supplied information'),htmlspecialchars($href),'images/info.png',_('info'),_('info')); + return sprintf('%s
%s
', + _('View server-supplied information'),htmlspecialchars($href),IMGDIR,'info.png',_('info'),_('info')); } protected function get_import_menu_item() { $ldapserver = $this->getLdapServer(); $href = sprintf('cmd.php?cmd=ldif_import_form&server_id=%s',$ldapserver->server_id); - return sprintf('%s
%s
', - _('Import entries from an LDIF file'),htmlspecialchars($href),'images/import.png',_('import'),_('import')); + return sprintf('%s
%s
', + _('Import entries from an LDIF file'),htmlspecialchars($href),IMGDIR,'import.png',_('import'),_('import')); } protected function get_export_menu_item() { $ldapserver = $this->getLdapServer(); $href = sprintf('cmd.php?cmd=export_form&server_id=%s',$ldapserver->server_id); - return sprintf('%s
%s
', - _('Export entries'),htmlspecialchars($href),'images/export.png',_('export'),_('export')); + return sprintf('%s
%s
', + _('Export entries'),htmlspecialchars($href),IMGDIR,'export.png',_('export'),_('export')); } protected function get_logout_menu_item() { $ldapserver = $this->getLdapServer(); $href = sprintf('cmd.php?cmd=logout&server_id=%s',$ldapserver->server_id); - return sprintf('%s
%s
', - _('Logout of this server'),htmlspecialchars($href),'images/logout.png',_('logout'),_('logout')); + return sprintf('%s
%s
', + _('Logout of this server'),htmlspecialchars($href),IMGDIR,'logout.png',_('logout'),_('logout')); } protected function draw_logged_in_dn() { @@ -338,7 +339,7 @@ class HTMLTree extends Tree { $href['expand'] = sprintf('cmd.php?cmd=expand&server_id=%s&dn=%s',$ldapserver->server_id,$encoded_dn); $href['collapse'] = sprintf('cmd.php?cmd=collapse&server_id=%s&dn=%s',$ldapserver->server_id,$encoded_dn); $href['edit'] = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',$ldapserver->server_id,$encoded_dn); - $img_src = sprintf('images/%s',$dnEntry->getIcon($ldapserver)); + $img_src = sprintf('%s/%s',IMGDIR,$dnEntry->getIcon($ldapserver)); $rdn = get_rdn($dn); echo ''; @@ -362,15 +363,15 @@ class HTMLTree extends Tree { # Is this node expanded? (deciding whether to draw "+" or "-") if ($dnEntry->isOpened()) { if (!$child_count && !$ldapserver->isShowCreateEnabled()) { - echo ''; + printf('',IMGDIR); } else { - printf('',$href['collapse']); + printf('',$href['collapse'],IMGDIR); } } else { if (($child_count !== false) && (!$child_count) && (!$ldapserver->isShowCreateEnabled())) { - echo ''; + printf('',IMGDIR); } else { - printf('',$href['expand']); + printf('',$href['expand'],IMGDIR); } } $colspan--; @@ -458,7 +459,7 @@ class HTMLTree extends Tree { echo ''; echo ''; - printf('',$href,_('new')); + printf('',$href,IMGDIR,_('new')); printf('', $this->getDepth()+3-$level-1-3,$href,_('Create a new entry in'),$rdn,_('Create new entry here')); echo ''; @@ -473,7 +474,7 @@ class HTMLTree extends Tree { sprintf('cmd.php?cmd=%s&server_id=%s',get_custom_file($ldapserver->server_id,'login_form',''),$ldapserver->server_id)); echo ''; - printf('',$href,_('login')); + printf('',$href,IMGDIR,_('login')); printf('',$this->getDepth()+3-2,$href,_('Login').'...'); echo ''; @@ -489,7 +490,7 @@ class HTMLTree extends Tree { protected function draw_logout_link() { $ldapserver = $this->getLdapServer(); - if ($ldapserver->auth_type != 'config') { + if (! in_array($ldapserver->auth_type,array('config','http'))) { printf('', $this->getDepth()+3-1,get_custom_file($ldapserver->server_id,'logout',''),$ldapserver->server_id,_('logout')); } diff --git a/lib/PLMTree.php b/lib/PLMTree.php index bdc253f..6261a43 100644 --- a/lib/PLMTree.php +++ b/lib/PLMTree.php @@ -1,5 +1,5 @@ setDirroot(JSDIR.'phplayersmenu/'); - $tm->setIcondir(HTDOCDIR.'/images/'); - $tm->setIconwww('images/'); + $tm->setIcondir(IMGDIR); + $tm->setIconwww(IMGDIR); $tm->setImgwww(JSDIR.'phplayersmenu/menuimages/'); } diff --git a/lib/TemplateCreatingEntry.php b/lib/TemplateCreatingEntry.php index 4d1ed75..bbe461f 100644 --- a/lib/TemplateCreatingEntry.php +++ b/lib/TemplateCreatingEntry.php @@ -1,5 +1,5 @@ default_template; + if ($_SESSION[APPCONFIG]->GetValue('appearance','disable_default_template')) + return false; + else + return $this->default_template; } public function getAttributes() { diff --git a/lib/TemplateEditingEntry.php b/lib/TemplateEditingEntry.php index da6ad0d..8fb8a9a 100644 --- a/lib/TemplateEditingEntry.php +++ b/lib/TemplateEditingEntry.php @@ -1,5 +1,5 @@ templates = array(); $this->valid = false; - $this->default_template = false; + $this->default_template = true; $this->selected_template = ''; } @@ -81,7 +81,10 @@ class TemplateEditingEntry extends DefaultEditingEntry { } public function hasDefaultTemplate() { - return $this->default_template; + if ($_SESSION[APPCONFIG]->GetValue('appearance','disable_default_template')) + return false; + else + return $this->default_template; } public function getAttributes() { @@ -105,12 +108,22 @@ class TemplateEditingEntry extends DefaultEditingEntry { $int_attrs_vals = $ldapserver->getDNSysAttrs($this->getDn()); if (! $int_attrs_vals) $attrs_vals = array(); - elseif (! is_array($int_attrs_vals)) $int_attrs_vals = array($attrs_vals); + elseif (! is_array($int_attrs_vals)) $int_attrs_vals = array($int_attrs_vals); + + $custom_int_attrs_vals = $ldapserver->getCustomDNSysAttrs($this->getDn()); + if (! $custom_int_attrs_vals) $attrs_vals = array(); + elseif (! is_array($custom_int_attrs_vals)) $custom_int_attrs_vals = array($custom_int_attrs_vals); $attrs_vals = $ldapserver->getDNAttrs($this->getDn(),false,$_SESSION[APPCONFIG]->GetValue('deref','view')); if (! $attrs_vals) $attrs_vals = array(); elseif (! is_array($attrs_vals)) $attrs_vals = array($attrs_vals); + $custom_attrs_vals = $ldapserver->getCustomDNAttrs($this->getDn(),false,$_SESSION[APPCONFIG]->GetValue('deref','view')); + if (! $custom_attrs_vals) $attrs_vals = array(); + elseif (! is_array($custom_attrs_vals)) $custom_attrs_vals = array($custom_attrs_vals); + + $int_attrs_vals = array_merge($int_attrs_vals,$custom_int_attrs_vals); + $attrs_vals = array_merge($attrs_vals,$custom_attrs_vals); $attrs_vals = array_merge($attrs_vals,$int_attrs_vals); $selected_tmpl = isset($this->templates[$this->selected_template]) diff --git a/lib/blowfish.php b/lib/blowfish.php index 90f423d..8c48aec 100644 --- a/lib/blowfish.php +++ b/lib/blowfish.php @@ -1,5 +1,5 @@ - * @version $Revision: 1.4 $ + * @version $Revision: 1.4.2.1 $ * @since Horde 2.2 * @package horde.cipher */ @@ -440,9 +440,9 @@ class Horde_Cipher_blowfish { $unpack = unpack('N*', $block); if (! is_array($unpack)) - pla_error( + error( sprintf('BLOWFISH: decryptBock()
We expected unpack to produce an array, but instead it produced [%s]. This function was entered with (%s,%s). If you think that this is a bug, then please tell the PLA developers how you got here. You are using PLA [%s,%s]', - serialize($unpack),rawurlencode($block),$key,pla_version(),phpversion())); + serialize($unpack),rawurlencode($block),$key,pla_version(),phpversion()),'error','index.php'); list($L, $R) = array_values($unpack); diff --git a/lib/common.php b/lib/common.php index 9eb21e5..6ad22a7 100644 --- a/lib/common.php +++ b/lib/common.php @@ -1,5 +1,5 @@ CheckCustom(); } +# Check for safe mode. +if (ini_get('safe_mode') && ! get_request('cmd','GET')) + system_message(array( + 'title'=>_('PHP Safe Mode'), + 'body'=>_('You have PHP Safe Mode enabled. PLA may work unexpectedly in Safe Mode.'), + 'type'=>'info')); + # Set our timezone, if it is specified in config.php if ($_SESSION[APPCONFIG]->GetValue('appearance','timezone')) date_default_timezone_set($_SESSION[APPCONFIG]->GetValue('appearance','timezone')); @@ -163,11 +176,11 @@ if (DEBUG_ENABLED) # Set our PHP timelimit. if ($_SESSION[APPCONFIG]->GetValue('session','timelimit')) - set_time_limit($_SESSION[APPCONFIG]->GetValue('session','timelimit')); + @set_time_limit($_SESSION[APPCONFIG]->GetValue('session','timelimit')); # If debug mode is set, increase the time_limit, since we probably need it. if (DEBUG_ENABLED && $_SESSION[APPCONFIG]->GetValue('session','timelimit')) - set_time_limit($_SESSION[APPCONFIG]->GetValue('session','timelimit') * 5); + @set_time_limit($_SESSION[APPCONFIG]->GetValue('session','timelimit') * 5); /** * Language configuration. Auto or specified? @@ -204,7 +217,7 @@ if ($language == 'auto') { (file_exists($language_dir) && is_readable($language_dir))) { # Set language - putenv('LANG='.$HTTP_LANG); # e.g. LANG=de_DE + @putenv('LANG='.$HTTP_LANG); # e.g. LANG=de_DE $HTTP_LANG .= '.UTF-8'; setlocale(LC_ALL,$HTTP_LANG); # set LC_ALL to de_DE bindtextdomain('messages',LANGDIR); @@ -225,7 +238,7 @@ if ($language == 'auto') { $language = 'en_GB'; # Set language - putenv('LANG='.$language); # e.g. LANG=de_DE + @putenv('LANG='.$language); # e.g. LANG=de_DE $language .= '.UTF-8'; setlocale(LC_ALL,$language); # set LC_ALL to de_DE bindtextdomain('messages',LANGDIR); @@ -261,16 +274,23 @@ if (isset($_REQUEST['server_id'])) { * Look/evaluate our timeout */ if (isset($ldapserver) && is_object($ldapserver) && method_exists($ldapserver,'haveAuthInfo')) { - if ($ldapserver->haveAuthInfo() && isset($ldapserver->auth_type) && $ldapserver->auth_type != 'config') { + if ($ldapserver->haveAuthInfo() && isset($ldapserver->auth_type) && ! in_array($ldapserver->auth_type,array('config','http'))) { /** * If time out value has been reached: * - log out user * - put $server_id in array of recently timed out servers */ if (function_exists('session_timed_out') && session_timed_out($ldapserver)) { - $app['url_timeout'] = sprintf('cmd.php?cmd=timeout&server_id=%s',$_REQUEST['server_id']); - printf('', - htmlspecialchars($app['url_timeout'])); + + # If $session_timeout not defined, use ( session_cache_expire() - 1 ) + $session_timeout = $ldapserver->session_timeout ? $ldapserver->session_timeout : session_cache_expire()-1; + + system_message(array( + 'title'=>_('Session Timed Out'), + 'body'=>sprintf('%s %s %s', + _('Your Session timed out after'),$session_timeout, + _('min. of inactivity. You have been automatically logged out.')), + 'type'=>'info'),'index.php'); die(); } } diff --git a/lib/config_default.php b/lib/config_default.php index 00bef1a..7030b88 100644 --- a/lib/config_default.php +++ b/lib/config_default.php @@ -1,5 +1,5 @@ 'Array of attributes that should show a the time when showing the jscalendar', 'default'=>array('')); + $this->default->appearance['disable_default_template'] = array( + 'desc'=>'Disabled the Default Template', + 'default'=>false); + $this->default->appearance['hide_debug_info'] = array( 'desc'=>'Hide the features that may provide sensitive debugging information to the browser', 'default'=>true); @@ -508,10 +512,10 @@ class Config { if (! isset($config[$key])) error(sprintf('A call was made in [%s] to GetValue requesting [%s] that isnt predefined.', - basename($_SERVER['PHP_SELF']),$key),'error',true); + basename($_SERVER['PHP_SELF']),$key),'error',null,true); if (! isset($config[$key][$index])) - error(sprintf('Requesting an index [%s] in key [%s] that isnt predefined.',$index,$key),'error',true); + error(sprintf('Requesting an index [%s] in key [%s] that isnt predefined.',$index,$key),'error',null,true); return isset($config[$key][$index]['value']) ? $config[$key][$index]['value'] : $config[$key][$index]['default']; } @@ -526,23 +530,23 @@ class Config { if (isset($this->default->$masterkey)) { if (! is_array($masterdetails)) - error(sprintf('Error in configuration file, [%s] should be an ARRAY.',$masterdetails),'error',true); + error(sprintf('Error in configuration file, [%s] should be an ARRAY.',$masterdetails),'error',null,true); foreach ($masterdetails as $key => $value) { # Test that the key is correct. if (! in_array($key,array_keys($this->default->$masterkey))) - error(sprintf('Error in configuration file, [%s] has not been defined as a configurable variable.',$key),'error',true); + error(sprintf('Error in configuration file, [%s] has not been defined as a configurable variable.',$key),'error',null,true); # Test if its should be an array or not. if (is_array($this->default->{$masterkey}[$key]['default']) && ! is_array($value)) - error(sprintf('Error in configuration file, %s[\'%s\'] SHOULD be an array of values.',$masterkey,$key),'error',true); + error(sprintf('Error in configuration file, %s[\'%s\'] SHOULD be an array of values.',$masterkey,$key),'error',null,true); if (! is_array($this->default->{$masterkey}[$key]['default']) && is_array($value)) - error(sprintf('Error in configuration file, %s[\'%s\'] should NOT be an array of values.',$masterkey,$key),'error',true); + error(sprintf('Error in configuration file, %s[\'%s\'] should NOT be an array of values.',$masterkey,$key),'error',null,true); } } else { - error(sprintf('Error in configuration file, [%s] has not been defined as a MASTER configurable variable.',$masterkey),'error',true); + error(sprintf('Error in configuration file, [%s] has not been defined as a MASTER configurable variable.',$masterkey),'error',null,true); } } } diff --git a/lib/emuhash_functions.php b/lib/emuhash_functions.php index b6727b2..335488a 100644 --- a/lib/emuhash_functions.php +++ b/lib/emuhash_functions.php @@ -1,5 +1,5 @@ results && $this->ldap_info->ldapserver->errno()) - pla_error(_('Encountered an error while performing search.'),$this->ldap_info->ldapserver->error(), - $this->ldap_info->ldapserver->errno()); + system_message(array( + 'title'=>_('Encountered an error while performing search.'), + 'body'=>ldap_error_msg($this->ldap_info->ldapserver->error(),$this->ldap_info->ldapserver->errno()), + 'type'=>'error')); usort($this->results,'pla_compare_dns'); $this->num_entries = count($this->results); diff --git a/lib/functions.php b/lib/functions.php index c14badd..b4b8443 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1,5 +1,5 @@ 'error')); } +/** + * If gettext is not installed, we will emulate it here. + */ +if (! function_exists('_')) { + function _($msg) { + return $msg; + } +} + /** * Generic Utility Functions */ @@ -151,7 +158,7 @@ function pla_error_handler($errno,$errstr,$file,$lineno) { } # If this is a more serious error, call the error call. - error(sprintf('%s: %s',$errtype,$errstr),'error',true,true); + error(sprintf('%s: %s',$errtype,$errstr),'error',null,true,true); } /** @@ -161,6 +168,11 @@ function pla_error_handler($errno,$errstr,$file,$lineno) { * @return string The current version as read from the VERSION file. */ function pla_version() { + static $return = null; + + if ($return) + return $return; + $version_file = realpath(LIBDIR.'../VERSION'); if (! file_exists($version_file)) $return = 'UNKNOWN'; @@ -229,27 +241,6 @@ function check_config($config_file) { REQUIRED_PHP_VERSION,phpversion()), 'type'=>'error')); - # Make sure this PHP install has all our required extensions - if (! extension_loaded('ldap')) - system_message(array( - 'title'=>_('Missing required extension'), - 'body'=>'Your install of PHP appears to be missing LDAP support.

Please install LDAP support before using phpLDAPadmin.
(Dont forget to restart your web server afterwards)', - 'type'=>'error')); - - # Make sure that we have php-xml loaded. - if (! function_exists('xml_parser_create')) - system_message(array( - 'title'=>_('Missing required extension'), - 'body'=>'Your install of PHP appears to be missing XML support.

Please install XML support before using phpLDAPadmin.
(Dont forget to restart your web server afterwards)', - 'type'=>'error')); - - # Make sure their session save path is writable, if they are using a file system session module, that is. - if (! strcasecmp('Files',session_module_name() && ! is_writable(realpath(session_save_path())))) - system_message(array( - 'title'=>_('PHP session configuration incorrect'), - 'body'=>sprintf('Your PHP session configuration is incorrect. Please check the value of session.save_path in your php.ini to ensure that the directory specified there exists and is writable. The current setting of "%s" is un-writable by the web server.',session_save_path()), - 'type'=>'error')); - $config = new Config; ob_start(); @@ -353,19 +344,19 @@ function check_config($config_file) { */ function cmd_control_pane() { return array( - 'home'=>array('link'=>sprintf('%s
%s
',_('Home'),_('Home'),_('Home'))), - 'purge'=>array('link'=>sprintf('%s
%s
', - _('Purge caches'),_('Purge all cached data in phpLDAPadmin, including server schemas.'),_('Purge caches'))), - 'external_links:feature'=>array('link'=>sprintf('%s
%s
', - get_href('add_rfe'),_('Request feature'),_('light'),_('Request feature'))), - 'external_links:bug'=>array('link'=>sprintf('%s
%s
', - get_href('add_bug'),_('Report a bug'),_('bug'),_('Report a bug'))), - 'external_links:donation'=>array('link'=>sprintf('%s
%s
', - get_href('donate'),_('Donate'),_('Donate'),_('Donate'))), - 'appearance:hide_debug_info'=>array('link'=>sprintf('%s
%s
', - _('Show Cache'),_('Show Cache'),_('Show Cache'))), - 'external_links:help'=>array('link'=>sprintf('%s
%s
', - get_href('documentation'),_('Help'),_('Help'),_('Help'))) + 'home'=>array('link'=>sprintf('%s
%s
',_('Home'),IMGDIR,_('Home'),_('Home'))), + 'purge'=>array('link'=>sprintf('%s
%s
', + _('Purge caches'),IMGDIR,_('Purge all cached data in phpLDAPadmin, including server schemas.'),_('Purge caches'))), + 'external_links:feature'=>array('link'=>sprintf('%s
%s
', + get_href('add_rfe'),_('Request feature'),IMGDIR,_('light'),_('Request feature'))), + 'external_links:bug'=>array('link'=>sprintf('%s
%s
', + get_href('add_bug'),_('Report a bug'),IMGDIR,_('bug'),_('Report a bug'))), + 'external_links:donation'=>array('link'=>sprintf('%s
%s
', + get_href('donate'),_('Donate'),IMGDIR,_('Donate'),_('Donate'))), + 'appearance:hide_debug_info'=>array('link'=>sprintf('%s
%s
', + _('Show Cache'),IMGDIR,_('Show Cache'),_('Show Cache'))), + 'external_links:help'=>array('link'=>sprintf('%s
%s
', + get_href('documentation'),_('Help'),IMGDIR,_('Help'),_('Help'))) ); } @@ -389,6 +380,14 @@ function debug_dump($variable,$die=false,$onlydebugaddr=false) { die(); } +/** + * This function generates a backtrace + * @param boolean Whether to stop execution or not. + */ +function debug_dump_backtrace($msg='Calling BackTrace',$die=false) { + error($msg,'note',null,$die,true); +} + /** * Debug Logging to Syslog * @@ -498,7 +497,7 @@ function debug_log($msg,$level=0) { /** * Display an error message in the system message panel of the page. */ -function error($msg,$type='note',$fatal=false,$backtrace=false) { +function error($msg,$type='note',$redirect=null,$fatal=false,$backtrace=false) { global $www; global $counter; @@ -510,7 +509,10 @@ function error($msg,$type='note',$fatal=false,$backtrace=false) { if (! isset($www['page'])) $www['page'] = new page(); - $www['page']->setsysmsg(array('title'=>_('Error'),'body'=>$msg,'type'=>$type)); + if ($fatal) + $www['page']->setsysmsg(array('title'=>_('Error'),'body'=>$msg,'type'=>$type)); + else + system_message(array('title'=>_('Error'),'body'=>$msg,'type'=>$type),$redirect); # Spin loop detection if ($counter++ > 20) { @@ -525,24 +527,33 @@ function error($msg,$type='note',$fatal=false,$backtrace=false) { $body = '
%s
%s
%s%s',$this->getDepth()+3-1); printf('%s',htmlspecialchars($ldapserver->name)); - if ($ldapserver->haveAuthInfo() && $ldapserver->auth_type != 'config') { + if ($ldapserver->haveAuthInfo() && ! in_array($ldapserver->auth_type,array('config','http'))) { $m = sprintf(_('Inactivity will log you off at %s'), strftime('%H:%M',time() + ($ldapserver->session_timeout*60))); - printf(' %s',$m,$m); + printf(' %s',IMGDIR,$m,$m); } echo '
------++%s%s
%s%s%s
%s
'; $body .= "\n"; - foreach (debug_backtrace() as $error => $line) { - $body .= sprintf('', - _('File'),isset($line['file']) ? $line['file'] : '',isset($line['line']) ? $line['line'] : ''); + foreach (debug_backtrace() as $error => $line) { + $_SESSION['backtrace'][$error]['file'] = $line['file']; + $_SESSION['backtrace'][$error]['line'] = $line['line']; + $body .= sprintf('', + _('File'),isset($line['file']) ? $line['file'] : $last['file'],isset($line['line']) ? $line['line'] : ''); + + $_SESSION['backtrace'][$error]['function'] = $line['function']; $body .= sprintf(''; $body .= "\n"; + + if ($line['file']) + $last['file'] = $line['file']; } + $body .= '
%s%s (%s)
%s%s (%s)
 %s%s', _('Function'),$line['function']); - if (isset($line['args'])) + if (isset($line['args'])) { + $display = strlen(serialize($line['args'])) < 50 ? serialize($line['args']) : substr(serialize($line['args']),0,50).'...'; + $_SESSION['backtrace'][$error]['args'] = $line['args']; if (file_exists(LIBDIR.'../tools/unserialize.php')) - $body .= sprintf(' (%s)', - '/tools/unserialize.php', - htmlspecialchars(serialize($line['args'])), - htmlspecialchars(serialize($line['args']))); + $body .= sprintf(' (%s)', + '../tools/unserialize.php',$error,htmlspecialchars($display)); else - $body .= sprintf(' (%s)',htmlspecialchars(serialize($line['args']))); + $body .= sprintf(' (%s)',htmlspecialchars($display)); + } $body .= '
'; $body .= "\n"; $backtraceblock->SetBody($body); @@ -609,7 +620,16 @@ function system_message($msg,$redirect=null) { $_SESSION['sysmsg'][] = $msg; + if (get_request('redirect','GET')) + debug_dump_backtrace('Redirect Loop Detected',true); + if ($redirect) { + if (preg_match('/\?/',$redirect)) + $redirect .= '&'; + else + $redirect .= '?'; + $redirect .= 'redirect=true'; + header("Location: $redirect"); die(); } @@ -1149,17 +1169,17 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid',$increment=false $base_dn = $_SESSION[APPCONFIG]->ldapservers->GetValue($ldapserver->server_id,'auto_number','search_base'); if (is_null($base_dn)) - pla_error(sprintf(_('You specified the "auto_uid_number_mechanism" as "search" in your + error(sprintf(_('You specified the "auto_uid_number_mechanism" as "search" in your configuration for server %s, but you did not specify the - "auto_uid_number_search_base". Please specify it before proceeding.'),$ldapserver->name)); + "auto_uid_number_search_base". Please specify it before proceeding.'),$ldapserver->name),'error','index.php'); } else { $base_dn = $startbase; } if (! $ldapserver->dnExists($base_dn)) - pla_error(sprintf(_('Your phpLDAPadmin configuration specifies an invalid auto_uid_search_base for server %s'), - $ldapserver->name)); + error(sprintf(_('Your phpLDAPadmin configuration specifies an invalid auto_uid_search_base for server %s'), + $ldapserver->name),'error','index.php'); $filter = '(|(uidNumber=*)(gidNumber=*))'; $results = array(); @@ -1170,12 +1190,13 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid',$increment=false $_SESSION[APPCONFIG]->ldapservers->GetValue($ldapserver->server_id,'auto_number','pass')); if (! $con) - pla_error(sprintf(_('Unable to bind to %s with your with auto_uid credentials. Please check your configuration file.'),$ldapserver->name)); + error(sprintf(_('Unable to bind to %s with your with auto_uid credentials. Please check your configuration file.'),$ldapserver->name), + 'error','index.php'); $search = $ldapserver->search($con,$base_dn,$filter,array('uidNumber','gidNumber'),'sub',false,$_SESSION[APPCONFIG]->GetValue('deref','search')); if (! is_array($search)) - pla_error('Untrapped error.'); + error(_('Untrapped error.'),'error','index.php'); foreach ($search as $dn => $attrs) { $attrs = array_change_key_case($attrs); @@ -1198,7 +1219,7 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid',$increment=false } break; default : - pla_error(sprintf('Unknown type [%s] in search',$type)); + error(sprintf('Unknown type [%s] in search',$type),'error','index.php'); } } @@ -1234,13 +1255,15 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid',$increment=false $_SESSION[APPCONFIG]->ldapservers->GetValue($ldapserver->server_id,'auto_number','pass')); if (! $con) - pla_error(sprintf(_('Unable to bind to %s with your with auto_uid credentials. Please check your configuration file.'),$ldapserver->name)); + error(sprintf(_('Unable to bind to %s with your with auto_uid credentials. Please check your configuration file.'),$ldapserver->name), + 'error','index.php'); # assume that uidpool dn is set in config file if no filter given - if (empty($filter)) + if (empty($filter)) { $uidpool_dn = $_SESSION[APPCONFIG]->ldapservers->GetValue($ldapserver->server_id,'auto_number','uidpool_dn'); + $filter = '(objectclass=*)'; - else { + } else { $filter = str_replace(array('&',':::'),array('&',','),$filter); $dns = $ldapserver->search($con,$startbase,$filter,array('dn'),'sub'); @@ -1249,10 +1272,10 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid',$increment=false break; case '0': - pla_error(_('Uidpool dn not found, please change filter parameter')); + error(_('Uidpool dn not found, please change filter parameter'),'error','index.php'); default: - pla_error(_('There is more than one dn for uidpool,please change filter parameter')); + error(_('There is more than one dn for uidpool,please change filter parameter'),'error','index.php'); } list ($key,$attrs) = each($dns); @@ -1260,31 +1283,38 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid',$increment=false $uidpool_dn = $attrs['dn']; } - if (empty($uidpool_dn)) - pla_error(_('uidpool_dn not found. Please check filter (arg 3) or set up uidpool_dn in config file')); + # Check that the UIDPOOL DN exists. + if (empty($uidpool_dn) || (! $ldapserver->dnExists($uidpool_dn))) + error(_('uidpool_dn not found. Please check filter (arg 3) or set up uidpool_dn in config file'),'error','index.php'); - $attrs = array($type); - $key = strtolower($type); - $realkey = $type; + switch ($type) { + case 'uid' : $attr = 'uidnumber'; + break; + case 'gid' : $attr = 'gidnumber'; + break; + default : + error(_('Unknown uidpool type.'),'error','index.php'); + } - $number = $ldapserver->search($con,$uidpool_dn,$filter,$attrs,'base'); - list($rkey,$number) = each($number); - $number = array_change_key_case($number); - $number = $number[$key]; + $number = $ldapserver->search($con,$uidpool_dn,$filter,array($attr),'base'); + $numbers = array_change_key_case($number[$uidpool_dn]); - if (isset($increment) && ($increment == 'true')) { - $updatedattr = array ($key => $number + 1); + if (! isset($numbers[$attr])) + error(_('A query on the uidpool_dn did return a valid uidNumber.'),'error','index.php'); + else + + if ($increment) { + $updatedattr = array($attr => $numbers[$attr] + 1); $ldapserver->modify($uidpool_dn,$updatedattr); } - return $number; + return $numbers[$attr]; break; # No other cases allowed. The user has an error in the configuration default : - pla_error( sprintf( _('You specified an invalid value for auto_uid_number_mechanism ("%s") - in your configration. Only "uidpool" and "search" are valid. - Please correct this problem.') , $mechanism) ); + error(sprintf(_('You specified an invalid value for auto_uid_number_mechanism ("%s") in your configration. Only "uidpool" and "search" are valid. + Please correct this problem.'),$mechanism),'error','index.php'); } } @@ -1380,7 +1410,7 @@ function get_icon( $ldapserver, $dn ) { $cval = explode( '=', $tmp[0], 2 ); $cval = isset( $cval[1] ) ? $cval[1] : false; if( $cval && false === strpos( $cval, ".." ) && - file_exists( realpath( sprintf("./images/countries/%s.png",strtolower($cval)) ) ) ) + file_exists(realpath(sprintf('%s/countries/%s.png',IMGDIR,strtolower($cval))))) return sprintf("countries/%s.png",strtolower($cval)); @@ -1732,56 +1762,28 @@ function support_oid_to_text($oid_id) { } /** - * Prints an HTML-formatted error string. If you specify the optional - * parameters $ldap_err_msg and $ldap_err_no, this function will - * lookup the error number and display a verbose message in addition - * to the message you pass it. - * - * @param string $msg The error message to display. - * @param string $ldap_err_msg (optional) The error message supplied by the LDAP server - * @param string $ldap_err_no (optional) The hexadecimal error number string supplied by the LDAP server - * @param bool $fatal (optional) If true, phpLDAPadmin will terminate execution with the PHP die() function. - * - * @see die - * @see ldap_errno - * @see pla_verbose_error + * Print an LDAP error message */ -function pla_error($msg,$ldap_err_msg=null,$ldap_err_no=-1,$fatal=true) { - if (defined('DEBUG_ENABLED') && (DEBUG_ENABLED)) - debug_log('Entered with (%s,%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__, - $msg,$ldap_err_msg,$ldap_err_no,$fatal); +function ldap_error_msg($msg,$errnum) { + $body = ''; - $title = ''; + $errnum = ('0x'.str_pad(dechex($errnum),2,0,STR_PAD_LEFT)); + $verbose_error = pla_verbose_error($errnum); - if (function_exists('syslog_err')) - syslog_err($msg); + $body .= sprintf('',_('LDAP said'),htmlspecialchars($msg)); - if ($ldap_err_msg) - $title = sprintf('%s: %s',_('LDAP said'),htmlspecialchars($ldap_err_msg)); - - if ($ldap_err_no != -1) { - $body = '
%s:%s
'; - - $ldap_err_no = ('0x'.str_pad(dechex($ldap_err_no),2,0,STR_PAD_LEFT)); - $verbose_error = pla_verbose_error($ldap_err_no); - - if ($verbose_error) { - $body .= sprintf('',_('Error number'),$ldap_err_no,$verbose_error['title']); - $body .= sprintf('',_('Description'),$verbose_error['desc']); - } else { - $body .= sprintf('',_('Error number'),$ldap_err_no); - $body .= sprintf('',_('Description'),_('no description available')); - } - $body .= '
%s: %s (%s)
%s: %s
%s: %s
%s: (%s)
'; - - if (function_exists('syslog_err')) - syslog_err(sprintf('%s %s',_('Error number'),$ldap_err_no)); + if ($verbose_error) { + $body .= sprintf('
%s:%s (%s)
%s:%s
%s:%s
%s:(%s)
'; + + return $body; } /** @@ -1832,7 +1834,7 @@ function draw_jpeg_photos($ldapserver,$dn,$attr_name='jpegPhoto',$draw_delete_bu $jpeg_temp_dir = realpath($_SESSION[APPCONFIG]->GetValue('jpeg','tmpdir').'/'); if (! is_writable($jpeg_temp_dir)) - pla_error(_('Please set $jpeg_temp_dir to a writable directory in the phpLDAPadmin config.php') ); + error(_('Please set $jpeg_temp_dir to a writable directory in the phpLDAPadmin config.php'),'error','index.php'); if (! is_array($jpeg_data[$attr_name])) $jpeg_data[$attr_name] = array($jpeg_data[$attr_name]); @@ -1841,7 +1843,8 @@ function draw_jpeg_photos($ldapserver,$dn,$attr_name='jpegPhoto',$draw_delete_bu $jpeg_filename = tempnam($jpeg_temp_dir.'/','pla'); $outjpeg = @fopen($jpeg_filename,'wb'); if (! $outjpeg) - pla_error(sprintf(_('Could not write to the $jpeg_temp_dir directory %s. Please verify that your web server can write files there.'),$jpeg_temp_dir)); + error(sprintf(_('Could not write to the $jpeg_temp_dir directory %s. Please verify that your web server can write files there.'),$jpeg_temp_dir), + 'error','index.php'); fwrite($outjpeg,$jpeg); fclose ($outjpeg); @@ -1902,7 +1905,7 @@ function draw_jpeg_photos($ldapserver,$dn,$attr_name='jpegPhoto',$draw_delete_bu } closedir($handle); } else { - pla_error(sprintf('failed to open dir %s : permission denied', $jpeg_temp_dir), null, -1, false, false); + error(sprintf('failed to open dir %s : permission denied',$jpeg_temp_dir),'error'); } } @@ -1932,21 +1935,21 @@ function password_hash( $password_clear, $enc_type ) { case 'ext_des': // extended des crypt. see OpenBSD crypt man page. if ( ! defined( 'CRYPT_EXT_DES' ) || CRYPT_EXT_DES == 0 ) - pla_error( _('Your system crypt library does not support extended DES encryption.') ); + error(_('Your system crypt library does not support extended DES encryption.'),'error','index.php'); $new_value = '{CRYPT}' . crypt( $password_clear, '_' . random_salt(8) ); break; case 'md5crypt': if( ! defined( 'CRYPT_MD5' ) || CRYPT_MD5 == 0 ) - pla_error( _('Your system crypt library does not support md5crypt encryption.') ); + error(_('Your system crypt library does not support md5crypt encryption.'),'error','index.php'); $new_value = '{CRYPT}' . crypt( $password_clear , '$1$' . random_salt(9) ); break; case 'blowfish': if( ! defined( 'CRYPT_BLOWFISH' ) || CRYPT_BLOWFISH == 0 ) - pla_error( _('Your system crypt library does not support blowfish encryption.') ); + error(_('Your system crypt library does not support blowfish encryption.'),'error','index.php'); // hardcoded to second blowfish version and set number of rounds $new_value = '{CRYPT}' . crypt( $password_clear , '$2a$12$' . random_salt(13) ); @@ -1965,7 +1968,7 @@ function password_hash( $password_clear, $enc_type ) { $new_value = '{SHA}' . base64_encode( mhash( MHASH_SHA1, $password_clear) ); } else { - pla_error( _('Your PHP install does not have the mhash() function. Cannot do SHA hashes.') ); + error(_('Your PHP install does not have the mhash() function. Cannot do SHA hashes.'),'error','index.php'); } break; @@ -1976,7 +1979,7 @@ function password_hash( $password_clear, $enc_type ) { $new_value = "{SSHA}".base64_encode( mhash( MHASH_SHA1, $password_clear.$salt ).$salt ); } else { - pla_error( _('Your PHP install does not have the mhash() function. Cannot do SHA hashes.') ); + error(_('Your PHP install does not have the mhash() function. Cannot do SHA hashes.'),'error','index.php'); } break; @@ -1987,7 +1990,7 @@ function password_hash( $password_clear, $enc_type ) { $new_value = "{SMD5}".base64_encode( mhash( MHASH_MD5, $password_clear.$salt ).$salt ); } else { - pla_error( _('Your PHP install does not have the mhash() function. Cannot do SHA hashes.') ); + error(_('Your PHP install does not have the mhash() function. Cannot do SHA hashes.'),'error','index.php'); } break; @@ -2026,7 +2029,8 @@ function password_check( $cryptedpassword, $plainpassword ) { // check php mhash support before using it if( function_exists( 'mhash' ) ) { $hash = base64_decode($cryptedpassword); - $salt = substr($hash, -4); + # OpenLDAP uses a 4 byte salt, SunDS uses an 8 byte salt - both from char 20. + $salt = substr($hash,20); $new_hash = base64_encode( mhash( MHASH_SHA1, $plainpassword.$salt).$salt ); if( strcmp( $cryptedpassword, $new_hash ) == 0 ) @@ -2035,7 +2039,7 @@ function password_check( $cryptedpassword, $plainpassword ) { return false; } else { - pla_error( _('Your PHP install does not have the mhash() function. Cannot do SHA hashes.') ); + error(_('Your PHP install does not have the mhash() function. Cannot do SHA hashes.'),'error','index.php'); } break; @@ -2053,7 +2057,7 @@ function password_check( $cryptedpassword, $plainpassword ) { return false; } else { - pla_error( _('Your PHP install does not have the mhash() function. Cannot do SHA hashes.') ); + error(_('Your PHP install does not have the mhash() function. Cannot do SHA hashes.'),'error','index.php'); } break; @@ -2080,7 +2084,7 @@ function password_check( $cryptedpassword, $plainpassword ) { // make sure that web server supports blowfish crypt if( ! defined( 'CRYPT_BLOWFISH' ) || CRYPT_BLOWFISH == 0 ) - pla_error( _('Your system crypt library does not support blowfish encryption.') ); + error(_('Your system crypt library does not support blowfish encryption.'),'error','index.php'); list(,$version,$rounds,$salt_hash) = explode('$',$cryptedpassword); @@ -2095,7 +2099,7 @@ function password_check( $cryptedpassword, $plainpassword ) { // make sure that web server supports md5 crypt if( ! defined( 'CRYPT_MD5' ) || CRYPT_MD5 == 0 ) - pla_error( _('Your system crypt library does not support md5crypt encryption.') ); + error(_('Your system crypt library does not support md5crypt encryption.'),'error','index.php'); list(,$type,$salt,$hash) = explode('$',$cryptedpassword); @@ -2110,7 +2114,7 @@ function password_check( $cryptedpassword, $plainpassword ) { // make sure that web server supports ext_des if ( ! defined( 'CRYPT_EXT_DES' ) || CRYPT_EXT_DES == 0 ) - pla_error( _('Your system crypt library does not support extended DES encryption.') ); + error(_('Your system crypt library does not support extended DES encryption.'),'error','index.php'); if( crypt($plainpassword, $cryptedpassword ) == $cryptedpassword ) return true; @@ -2218,7 +2222,7 @@ function draw_chooser_link( $form_element, $include_choose_text=true, $rdn="none $title = _('Click to popup a dialog to select an entry (DN) graphically'); - printf('Find',$href,$title); + printf('Find',$href,$title,IMGDIR); if ($include_choose_text) printf('%s',$href,$title,_('browse')); } @@ -2330,7 +2334,7 @@ function dn_unescape($dn) { */ function get_href($type,$extra_info='') { $sf = 'https://sourceforge.net'; - $pla = 'http://phpldapadmin.wiki.sourceforge.net'; + $pla = 'http://phpldapadmin.sourceforge.net'; $group_id = '61828'; $bug_atid = '498546'; $rfe_atid = '498549'; @@ -2921,13 +2925,13 @@ function server_info_list($visible=false) { return $server_info_list; } -function enc_type_select_list($enc_type,$id,$attribute,$i) { +function enc_type_select_list($enc_type,$id,$attributename,$i) { if (DEBUG_ENABLED) - debug_log('Entered with (%s,%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__,$enc_type,$id,$attribute,$i); + debug_log('Entered with (%s,%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__,$enc_type,$id,$attributename,$i); $html = sprintf('