phpldapadmin/htdocs/creation_template.php

72 lines
2.1 KiB
PHP
Raw Permalink Normal View History

2009-06-30 08:05:37 +00:00
<?php
2009-06-30 09:40:37 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/creation_template.php,v 1.29 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
* This file simply acts as a plugin grabber for the creator templates in
* the directory templates/creation/
*
2009-06-30 09:29:51 +00:00
* Variables that come in via common.php
2009-06-30 08:05:37 +00:00
* server_id
2009-06-30 09:29:51 +00:00
* Expected POST vars:
2009-06-30 08:05:37 +00:00
* template
2009-06-30 09:29:51 +00:00
*
* @package phpLDAPadmin
* @deprecated This file is no longer need when the template engine is up and running.
*/
/**
2009-06-30 08:05:37 +00:00
*/
2009-06-30 09:29:51 +00:00
require './common.php';
if ($config->GetValue('template_engine','enable') && (! is_numeric($_REQUEST['template']))) {
require './template_engine.php';
die();
}
require TMPLDIR.'template_config.php';
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
if ($ldapserver->isReadOnly())
pla_error($lang['no_updates_in_read_only_mode']);
if (! $ldapserver->haveAuthInfo())
pla_error($lang['not_enough_login_info']);
2009-06-30 09:22:30 +00:00
2009-06-30 09:29:51 +00:00
$template = (isset($_REQUEST['template']) ? $_REQUEST['template'] : null);
! is_null($template) or pla_error($lang['ctemplate_no_template']);
if ($template == 'custom') {
foreach ($templates as $id => $template) {
if ($template['handler'] == 'custom.php') {
2009-06-30 09:22:30 +00:00
$template = $id;
break;
}
}
}
2009-06-30 09:29:51 +00:00
isset($templates[$template]) or pla_error(sprintf($lang['invalid_template'], htmlspecialchars($template)));
2009-06-30 09:22:30 +00:00
$template_id = $template;
2009-06-30 09:29:51 +00:00
$template = isset($templates[$template]) ? $templates[$template_id] : null;
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
if (! array_key_exists('no_header',$template)) {
include './header.php';
2009-06-30 08:05:37 +00:00
?>
<body>
2009-06-30 08:09:20 +00:00
<h3 class="title"><?php echo $lang['createf_create_object']?></h3>
2009-06-30 09:29:51 +00:00
<h3 class="subtitle"><?php echo $lang['ctemplate_on_server']?> '<?php echo htmlspecialchars($ldapserver->name); ?>', <?php echo $lang['using_template']?> '<?php echo htmlspecialchars($template['desc']); ?>'</h3>
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
<?php }
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
$handler = TMPLDIR.'creation/' . $template['handler'];
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
if (! file_exists($handler))
pla_error(sprintf($lang['template_does_not_exist'],htmlspecialchars($template['handler'])));
if (! is_readable($handler))
pla_error(sprintf($lang['template_not_readable'],htmlspecialchars($template['handler'])));
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
include $handler;
2009-06-30 09:22:30 +00:00
2009-06-30 09:29:51 +00:00
if (! array_key_exists('no_header',$template))
echo "</body>\n</html>";
2009-06-30 09:22:30 +00:00
?>