本文整理汇总了PHP中iMSCP_pTemplate::getLastParseResult方法的典型用法代码示例。如果您正苦于以下问题:PHP iMSCP_pTemplate::getLastParseResult方法的具体用法?PHP iMSCP_pTemplate::getLastParseResult怎么用?PHP iMSCP_pTemplate::getLastParseResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iMSCP_pTemplate
的用法示例。
在下文中一共展示了iMSCP_pTemplate::getLastParseResult方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _client_generateOpenSSLConfFile
/**
* Generate temporary openssl coonfiguration file
*
* @throws iMSCP_Exception_Database
* @param array $data User data
* @return bool|string Path to generate openssl temporary file, FALSE on failure
*/
function _client_generateOpenSSLConfFile($data)
{
global $domainType, $domainId;
$config = iMSCP_Registry::get('config');
$altNames = <<<'EOF'
DNS.1 = {DOMAIN_NAME}
DNS.2 = www.{DOMAIN_NAME}
EOF;
if ($domainType == 'dmn') {
$altNames .= "\nDNS.3 = {ADMIN_SYS_NAME}.{BASE_SERVER_VHOST}\n";
} elseif ($domainType == 'als') {
$altNames .= "\nDNS.3 = {ADMIN_SYS_NAME}als{$domainId}.{BASE_SERVER_VHOST}\n";
} elseif ($domainType == 'sub') {
$altNames .= "\nDNS.3 = {ADMIN_SYS_NAME}sub{$domainId}.{BASE_SERVER_VHOST}\n";
} else {
$altNames .= "\nDNS.3 = {ADMIN_SYS_NAME}alssub{$domainId}.{BASE_SERVER_VHOST}\n";
}
$sslTpl = new iMSCP_pTemplate();
$sslTpl->setRootDir(LIBRARY_PATH . '/Resources/ssl');
$sslTpl->define('tpl', 'openssl.cnf.tpl');
$sslTpl->assign(array('DOMAIN_NAME' => $data['domain_name'], 'ALT_NAMES' => $altNames, 'ADMIN_SYS_NAME' => $data['admin_sys_name'], 'BASE_SERVER_VHOST' => $config['BASE_SERVER_VHOST']));
$sslTpl->parse('TPL', 'tpl');
if (!($opensslConfFile = @tempnam(sys_get_temp_dir(), $_SESSION['user_id'] . '-openssl.cnf'))) {
write_log('Could not create temporary openssl configuration file.', E_USER_ERROR);
return false;
}
register_shutdown_function(function ($file) {
@unlink($file);
}, $opensslConfFile);
if (!@file_put_contents($opensslConfFile, $sslTpl->getLastParseResult())) {
write_log(sprintf('Could not write in %s openssl temporary configuration file.', $opensslConfFile), E_USER_ERROR);
return false;
}
return $opensslConfFile;
}