2009-06-30 08:05:37 +00:00
|
|
|
<?php
|
2009-06-30 08:12:47 +00:00
|
|
|
// $Header: /cvsroot/phpldapadmin/phpldapadmin/creation_template.php,v 1.11 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
|
|
|
|
2009-06-30 08:05:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* file: creation_template.php
|
|
|
|
* This file simply acts as a plugin grabber for the creator templates in
|
|
|
|
* the directory templates/creation/
|
|
|
|
*
|
|
|
|
* Expected POST vars:
|
|
|
|
* server_id
|
|
|
|
* template
|
|
|
|
*/
|
|
|
|
|
2009-06-30 08:07:14 +00:00
|
|
|
require 'common.php';
|
2009-06-30 08:10:17 +00:00
|
|
|
require 'templates/template_config.php';
|
2009-06-30 08:05:37 +00:00
|
|
|
|
2009-06-30 08:12:47 +00:00
|
|
|
isset( $_POST['template'] ) or pla_error( $lang['must_choose_template'] );
|
2009-06-30 08:07:14 +00:00
|
|
|
$template = $_POST['template'];
|
2009-06-30 08:12:47 +00:00
|
|
|
isset( $templates[$template] ) or pla_error( sprintf( $lang['invalid_template'], htmlspecialchars( $template ) ) );
|
2009-06-30 08:10:17 +00:00
|
|
|
$template = isset( $templates[$template] ) ? $templates[$template] : null;
|
2009-06-30 08:05:37 +00:00
|
|
|
$server_id = $_POST['server_id'];
|
2009-06-30 08:12:47 +00:00
|
|
|
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
2009-06-30 08:09:20 +00:00
|
|
|
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
2009-06-30 08:10:17 +00:00
|
|
|
pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
2009-06-30 08:05:37 +00:00
|
|
|
$server_name = $servers[ $server_id ][ 'name' ];
|
|
|
|
|
2009-06-30 08:07:14 +00:00
|
|
|
if( is_server_read_only( $server_id ) )
|
2009-06-30 08:09:20 +00:00
|
|
|
pla_error( $lang['no_updates_in_read_only_mode'] );
|
2009-06-30 08:07:14 +00:00
|
|
|
|
2009-06-30 08:05:37 +00:00
|
|
|
include 'header.php';
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<body>
|
2009-06-30 08:09:20 +00:00
|
|
|
<h3 class="title"><?php echo $lang['createf_create_object']?></h3>
|
2009-06-30 08:12:47 +00:00
|
|
|
<h3 class="subtitle"><?php echo $lang['ctemplate_on_server']?> '<?php echo htmlspecialchars( $server_name ); ?>', <?php echo $lang['using_template']?> '<?php echo htmlspecialchars( $template['desc'] ); ?>'</h3>
|
2009-06-30 08:05:37 +00:00
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
if( ! isset( $_POST['template'] ) )
|
2009-06-30 08:09:20 +00:00
|
|
|
pla_error( $lang['ctemplate_no_template'] );
|
2009-06-30 08:05:37 +00:00
|
|
|
|
|
|
|
$handler = 'templates/creation/' . $template['handler'];
|
2009-06-30 08:07:14 +00:00
|
|
|
$handler = realpath( $handler );
|
2009-06-30 08:05:37 +00:00
|
|
|
if( file_exists( $handler ) )
|
|
|
|
include $handler;
|
|
|
|
else
|
2009-06-30 08:09:20 +00:00
|
|
|
pla_error( $lang['ctemplate_config_handler'] . " <b>" . htmlspecialchars( $template['handler'] ) .
|
|
|
|
"</b> " . $lang['ctemplate_handler_does_not_exist']);
|
2009-06-30 08:05:37 +00:00
|
|
|
|
|
|
|
|