当前位置: 首页>>代码示例>>PHP>>正文


PHP iMSCP_pTemplate::getLastParseResult方法代码示例

本文整理汇总了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;
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:42,代码来源:cert_view.php


注:本文中的iMSCP_pTemplate::getLastParseResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。