phpldapadmin/htdocs/edit.php

60 lines
1.9 KiB
PHP
Raw Normal View History

2009-06-30 09:22:30 +00:00
<?php
2009-06-30 09:29:51 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/edit.php,v 1.56 2005/09/25 16:11:44 wurley Exp $
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
/**
2009-06-30 08:05:37 +00:00
* Displays the specified dn from the specified server for editing
2009-06-30 08:09:20 +00:00
* in its template as determined by get_template(). This is a simple
* shell for displaying entries. The real work is done by the templates
* found in tempaltes/modification/
2009-06-30 08:05:37 +00:00
*
2009-06-30 09:29:51 +00:00
* Variables that come in via common.php
* - server_id
2009-06-30 08:05:37 +00:00
* Variables that come in as GET vars:
* - dn (rawurlencoded)
2009-06-30 08:09:20 +00:00
* - use_default_template (optional) If set, use the default template no matter what
* - Other vars may be set and used by the modification templates
2009-06-30 09:29:51 +00:00
*
* @package phpLDAPadmin
*/
/**
2009-06-30 08:05:37 +00:00
*/
2009-06-30 09:29:51 +00:00
require './common.php';
require TMPLDIR.'template_config.php';
2009-06-30 09:22:30 +00:00
2009-06-30 09:29:51 +00:00
if( ! $ldapserver->haveAuthInfo())
pla_error( $lang['not_enough_login_info'] );
2009-06-30 08:09:20 +00:00
2009-06-30 09:29:51 +00:00
$dn = isset($_GET['dn']) ? $_GET['dn'] : false;
$dn !== false or pla_error($lang['missing_dn_in_query_string']);
2009-06-30 09:22:30 +00:00
2009-06-30 09:29:51 +00:00
$decoded_dn = rawurldecode($dn);
$encoded_dn = rawurlencode($decoded_dn);
2009-06-30 09:22:30 +00:00
2009-06-30 09:29:51 +00:00
/* Template authors may wish to present the user with a link back to the default, generic
template for editing. They may use this as the target of the href to do so.
@deprectated
*/
$default_href = sprintf("edit.php?server_id=%s&amp;dn=%s&amp;use_default_template=true",$ldapserver->server_id,$encoded_dn);
$use_default_template = isset( $_GET['use_default_template'] ) || $config->GetValue('template_engine','enable');
2009-06-30 08:09:20 +00:00
if( $use_default_template ) {
2009-06-30 09:29:51 +00:00
if ($config->GetValue('template_engine','enable'))
require './template_engine.php';
else
require TMPLDIR.'modification/default.php';
2009-06-30 08:09:20 +00:00
} else {
2009-06-30 09:29:51 +00:00
$template = get_template($ldapserver,$dn);
$template_file = TMPLDIR."modification/$template.php";
if (file_exists($template_file))
require $template_file;
2009-06-30 08:09:20 +00:00
else {
2009-06-30 09:29:51 +00:00
printf('%s <b>%s</b> %s<br />',$lang['missing_template_file'],$template_file,$lang['using_default']);
require TMPLDIR.'modification/default.php';
2009-06-30 08:07:14 +00:00
}
2009-06-30 08:05:37 +00:00
}
?>