本文整理汇总了PHP中Settings::Get方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::Get方法的具体用法?PHP Settings::Get怎么用?PHP Settings::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dieWithMail
/**
* Cronjob function to end a cronjob in a critical condition
* but not without sending a notification mail to the admin
*
* @param string $message
* @param string $subject
*
* @return void
*/
function dieWithMail($message, $subject = "[froxlor] Cronjob error")
{
if (Settings::Get('system.send_cron_errors') == '1') {
$_mail = new PHPMailer(true);
$_mail->CharSet = "UTF-8";
if (PHPMailer::ValidateAddress(Settings::Get('panel.adminmail')) !== false) {
// set return-to address and custom sender-name, see #76
$_mail->SetFrom(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
if (Settings::Get('panel.adminmail_return') != '') {
$_mail->AddReplyTo(Settings::Get('panel.adminmail_return'), Settings::Get('panel.adminmail_defname'));
}
}
$_mailerror = false;
try {
$_mail->Subject = $subject;
$_mail->AltBody = $message;
$_mail->MsgHTML(nl2br($message));
$_mail->AddAddress(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
$_mail->Send();
} catch (phpmailerException $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
$_mail->ClearAddresses();
if ($_mailerror) {
echo 'Error sending mail: ' . $mailerr_msg . "\n";
}
}
die($message);
}
示例2: makeCryptPassword
/**
* Make crypted password from clear text password
*
* @author Michal Wojcik <m.wojcik@sonet3.pl>
* @author Michael Kaufmann <mkaufmann@nutime.de>
* @author Froxlor team <team@froxlor.org> (2010-)
*
* 0 - default crypt (depenend on system configuration)
* 1 - MD5 $1$
* 2 - BLOWFISH $2a$ | $2y$07$ (on php 5.3.7+)
* 3 - SHA-256 $5$ (default)
* 4 - SHA-512 $6$
*
* @param string $password Password to be crypted
*
* @return string encrypted password
*/
function makeCryptPassword($password)
{
$type = Settings::Get('system.passwordcryptfunc') !== null ? (int) Settings::Get('system.passwordcryptfunc') : 3;
switch ($type) {
case 0:
$cryptPassword = crypt($password);
break;
case 1:
$cryptPassword = crypt($password, '$1$' . generatePassword(true) . generatePassword(true));
break;
case 2:
if (version_compare(phpversion(), '5.3.7', '<')) {
$cryptPassword = crypt($password, '$2a$' . generatePassword(true) . generatePassword(true));
} else {
// Blowfish hashing with a salt as follows: "$2a$", "$2x$" or "$2y$",
// a two digit cost parameter, "$", and 22 characters from the alphabet "./0-9A-Za-z"
$cryptPassword = crypt($password, '$2y$07$' . substr(generatePassword(true) . generatePassword(true) . generatePassword(true), 0, 22));
}
break;
case 3:
$cryptPassword = crypt($password, '$5$' . generatePassword(true) . generatePassword(true));
break;
case 4:
$cryptPassword = crypt($password, '$6$' . generatePassword(true) . generatePassword(true));
break;
default:
$cryptPassword = crypt($password);
break;
}
return $cryptPassword;
}
示例3: hasUpdates
/**
* Function hasUpdates
*
* checks if a given version is not equal the current one
*
* @param string $to_check version to check
*
* @return bool true if version to check does not match, else false
*/
function hasUpdates($to_check = null)
{
if (Settings::Get('panel.version') == null || Settings::Get('panel.version') != $to_check) {
return true;
}
return false;
}
示例4: storeSettingWebserverFcgidFpmUser
/**
* Whenever the webserver- / FCGID- or FPM-user gets updated
* we need to update ftp_groups accordingly
*/
function storeSettingWebserverFcgidFpmUser($fieldname, $fielddata, $newfieldvalue)
{
if (is_array($fielddata) && isset($fielddata['settinggroup']) && isset($fielddata['varname'])) {
$update_user = null;
// webserver
if ($fielddata['settinggroup'] == 'system' && $fielddata['varname'] == 'httpuser') {
$update_user = Settings::Get('system.httpuser');
}
// fcgid
if ($fielddata['settinggroup'] == 'system' && $fielddata['varname'] == 'mod_fcgid_httpuser') {
$update_user = Settings::Get('system.mod_fcgid_httpuser');
}
// webserver
if ($fielddata['settinggroup'] == 'phpfpm' && $fielddata['varname'] == 'vhost_httpuser') {
$update_user = Settings::Get('phpfpm.vhost_httpuser');
}
$returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue);
if ($returnvalue !== false) {
/**
* only update if anything changed
*/
if ($update_user != null && $newfieldvalue != $update_user) {
$upd_stmt = Database::prepare("UPDATE `" . TABLE_FTP_GROUPS . "` SET `members` = REPLACE(`members`, :olduser, :newuser)");
Database::pexecute($upd_stmt, array('olduser' => $update_user, 'newuser' => $newfieldvalue));
}
}
}
return $returnvalue;
}
示例5: storeSettingDefaultIp
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Functions
*
*/
function storeSettingDefaultIp($fieldname, $fielddata, $newfieldvalue)
{
$defaultips_old = Settings::Get('system.defaultip');
$returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue);
if ($returnvalue !== false && is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'system' && isset($fielddata['varname']) && $fielddata['varname'] == 'defaultip') {
$customerstddomains_result_stmt = Database::prepare("\n\t\t\tSELECT `standardsubdomain` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `standardsubdomain` <> '0'\n\t\t");
Database::pexecute($customerstddomains_result_stmt);
$ids = array();
while ($customerstddomains_row = $customerstddomains_result_stmt->fetch(PDO::FETCH_ASSOC)) {
$ids[] = (int) $customerstddomains_row['standardsubdomain'];
}
if (count($ids) > 0) {
$defaultips_new = explode(',', $newfieldvalue);
// Delete the existing mappings linking to default IPs
$del_stmt = Database::prepare("\n\t\t\t\t\tDELETE FROM `" . TABLE_DOMAINTOIP . "`\n\t\t\t\t\tWHERE `id_domain` IN (" . implode(', ', $ids) . ")\n\t\t\t\t\tAND `id_ipandports` IN (" . $defaultips_old . ", " . $newfieldvalue . ")\n\t\t\t");
Database::pexecute($del_stmt);
// Insert the new mappings
$ins_stmt = Database::prepare("\n\t\t\t\tINSERT INTO `" . TABLE_DOMAINTOIP . "`\n\t\t\t\tSET `id_domain` = :domainid, `id_ipandports` = :ipandportid\n\t\t\t");
foreach ($ids as $id) {
foreach ($defaultips_new as $defaultip_new) {
Database::pexecute($ins_stmt, array('domainid' => $id, 'ipandportid' => $defaultip_new));
}
}
}
}
return $returnvalue;
}
示例6: getFilesystemQuota
/**
* This file is part of the Froxlor project.
* Copyright (c) 2011- the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2011-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Functions
*
*/
function getFilesystemQuota()
{
// enabled at all?
if (Settings::Get('system.diskquota_enabled')) {
// set linux defaults
$repquota_params = "-np";
//$quota_line_regex = "/^#([0-9]+)\s*[+-]{2}\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)/i";
$quota_line_regex = "/^#([0-9]+)\\s+[+-]{2}\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)/i";
// check for freebsd - which needs other values
if (isFreeBSD()) {
$repquota_params = "-nu";
$quota_line_regex = "/^([0-9]+)\\s+[+-]{2}\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\S+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\S+)/i";
}
// Fetch all quota in the desired partition
exec(Settings::Get('system.diskquota_repquota_path') . " " . $repquota_params . " " . escapeshellarg(Settings::Get('system.diskquota_customer_partition')), $repquota);
$usedquota = array();
foreach ($repquota as $tmpquota) {
// Let's see if the line matches a quota - line
if (preg_match($quota_line_regex, $tmpquota, $matches)) {
// It matches - put it into an array with userid as key (for easy lookup later)
$usedquota[$matches[1]] = array('block' => array('used' => $matches[2], 'soft' => $matches[3], 'hard' => $matches[4], 'grace' => isFreeBSD() ? '0' : $matches[5]), 'file' => array('used' => $matches[6], 'soft' => $matches[7], 'hard' => $matches[8], 'grace' => isFreeBSD() ? '0' : $matches[9]));
}
}
return $usedquota;
}
return false;
}
示例7: storeDefaultIndex
/**
* store the default index-file in a given destination folder
*
* @param string $loginname customers loginname
* @param string $destination path where to create the file
* @param object $logger FroxlorLogger object
* @param boolean $force force creation whatever the settings say (needed for task #2, create new user)
*
* @return null
*/
function storeDefaultIndex($loginname = null, $destination = null, $logger = null, $force = false)
{
if ($force || (int) Settings::Get('system.store_index_file_subs') == 1) {
$result_stmt = Database::prepare("\n\t\t\tSELECT `t`.`value`, `c`.`email` AS `customer_email`, `a`.`email` AS `admin_email`, `c`.`loginname` AS `customer_login`, `a`.`loginname` AS `admin_login`\n\t\t\tFROM `" . TABLE_PANEL_CUSTOMERS . "` AS `c` INNER JOIN `" . TABLE_PANEL_ADMINS . "` AS `a`\n\t\t\tON `c`.`adminid` = `a`.`adminid`\n\t\t\tINNER JOIN `" . TABLE_PANEL_TEMPLATES . "` AS `t`\n\t\t\tON `a`.`adminid` = `t`.`adminid`\n\t\t\tWHERE `varname` = 'index_html' AND `c`.`loginname` = :loginname");
Database::pexecute($result_stmt, array('loginname' => $loginname));
if (Database::num_rows() > 0) {
$template = $result_stmt->fetch(PDO::FETCH_ASSOC);
$replace_arr = array('SERVERNAME' => Settings::Get('system.hostname'), 'CUSTOMER' => $template['customer_login'], 'ADMIN' => $template['admin_login'], 'CUSTOMER_EMAIL' => $template['customer_email'], 'ADMIN_EMAIL' => $template['admin_email']);
$htmlcontent = replace_variables($template['value'], $replace_arr);
$indexhtmlpath = makeCorrectFile($destination . '/index.' . Settings::Get('system.index_file_extension'));
$index_html_handler = fopen($indexhtmlpath, 'w');
fwrite($index_html_handler, $htmlcontent);
fclose($index_html_handler);
if ($logger !== null) {
$logger->logAction(CRON_ACTION, LOG_NOTICE, 'Creating \'index.' . Settings::Get('system.index_file_extension') . '\' for Customer \'' . $template['customer_login'] . '\' based on template in directory ' . escapeshellarg($indexhtmlpath));
}
} else {
$destination = makeCorrectDir($destination);
if ($logger !== null) {
$logger->logAction(CRON_ACTION, LOG_NOTICE, 'Running: cp -a ' . FROXLOR_INSTALL_DIR . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
}
safe_exec('cp -a ' . FROXLOR_INSTALL_DIR . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
}
}
return;
}
示例8: createOwnVhostStarter
public function createOwnVhostStarter()
{
if (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.enabled_ownvhost') == '1') {
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__))));
// /var/www/froxlor, needed for chown
$user = Settings::Get('phpfpm.vhost_httpuser');
$group = Settings::Get('phpfpm.vhost_httpgroup');
$domain = array('id' => 'none', 'domain' => Settings::Get('system.hostname'), 'adminid' => 1, 'mod_fcgid_starter' => -1, 'mod_fcgid_maxrequests' => -1, 'guid' => $user, 'openbasedir' => 0, 'email' => Settings::Get('panel.adminmail'), 'loginname' => 'froxlor.panel', 'documentroot' => $mypath);
// all the files and folders have to belong to the local user
// now because we also use fcgid for our own vhost
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
// get php.ini for our own vhost
$php = new phpinterface($domain);
// get php-config
if (Settings::Get('phpfpm.enabled') == '1') {
// fpm
$phpconfig = $php->getPhpConfig(Settings::Get('phpfpm.vhost_defaultini'));
} else {
// fcgid
$phpconfig = $php->getPhpConfig(Settings::Get('system.mod_fcgid_defaultini_ownvhost'));
}
// create starter-file | config-file
$php->getInterface()->createConfig($phpconfig);
// create php.ini (fpm does nothing here, as it
// defines ini-settings in its pool config)
$php->getInterface()->createIniFile($phpconfig);
}
}
示例9: correctErrorDocument
/**
* this functions validates a given value as ErrorDocument
* refs #267
*
* @param string error-document-string
*
* @return string error-document-string
*
*/
function correctErrorDocument($errdoc = null)
{
global $idna_convert;
if ($errdoc !== null && $errdoc != '') {
// not a URL
if (strtoupper(substr($errdoc, 0, 5)) != 'HTTP:' && strtoupper(substr($errdoc, 0, 6)) != 'HTTPS:' || !validateUrl($errdoc)) {
// a file
if (substr($errdoc, 0, 1) != '"') {
$errdoc = makeCorrectFile($errdoc);
// apache needs a starting-slash (starting at the domains-docroot)
if (!substr($errdoc, 0, 1) == '/') {
$errdoc = '/' . $errdoc;
}
} else {
// string won't work for lighty
if (Settings::Get('system.webserver') == 'lighttpd') {
standard_error('stringerrordocumentnotvalidforlighty');
} elseif (substr($errdoc, -1) != '"') {
$errdoc .= '"';
}
}
} else {
if (Settings::Get('system.webserver') == 'lighttpd') {
standard_error('urlerrordocumentnotvalidforlighty');
}
}
}
return $errdoc;
}
示例10: __construct
/**
* Instantiate object
* @global object $config Site configuration settings
* @return object Returns object of class type
*/
public function __construct()
{
global $config;
$this->config = $config;
$this->phpmailer = new PHPMailer();
// Retrieve "From" name and address
$url = parse_url(HOST);
$this->from_name = Settings::Get('from_name');
$this->from_address = Settings::Get('from_address');
$this->from_name = empty($this->from_name) ? $this->config->sitename : $this->from_name;
$this->from_address = empty($this->from_address) ? 'cumulusclips@' . $url['host'] : $this->from_address;
$this->phpmailer->FromName = $this->from_name;
$this->phpmailer->From = $this->from_address;
// Retrieve SMTP settings
$smtp = unserialize(Settings::Get('smtp'));
if ($smtp->enabled == '1') {
// PHPMailer SMTP Connection Settings
$this->phpmailer->IsSMTP();
// telling the class to use SMTP
$this->phpmailer->SMTPAuth = true;
// enable SMTP authentication
$this->phpmailer->Host = $smtp->host;
// sets the SMTP server
$this->phpmailer->Port = $smtp->port;
// set the port for the SMTP server
$this->phpmailer->Username = $smtp->username;
// SMTP account username
$this->phpmailer->Password = $smtp->password;
// SMTP account password
}
}
示例11: getCategoryGames
static function getCategoryGames($tag, $game_limit)
{
$games = array();
if (Settings::Get('homepage_order') == 'random') {
$order = 'rand()';
} else {
if (Settings::Get('homepage_order') == 'newest') {
$order = 'tbl_games.game_id DESC';
} else {
if (Settings::Get('homepage_order') == 'rating') {
$order = 'rating DESC';
}
}
}
$result = Game::query('SELECT tbl_games.game_id, title, plays, tbl_games.desc, catID FROM tbl_games, tbl_tag_relations WHERE tag_id=' . $tag . ' AND tbl_tag_relations.game_id=tbl_games.game_id ORDER BY ' . $order . ' LIMIT ' . $game_limit);
while ($row = $result->fetch_assoc()) {
$description_stripped = strip_tags($row['desc']);
$game['plays'] = $row['plays'];
$game['id'] = $row['game_id'];
$game['file'] = Utils::TitleToFile($row['title']);
$game['name'] = Utils::shortenStr($row['title'], Settings::Get('home_game_chars'));
$game['description'] = Utils::shortenStr($description_stripped, Settings::Get('home_game_desc_chars'));
$game['url'] = Settings::Get('site_url') . '/view/' . $row['game_id'];
//Utils::GameUrl($row['game_id'], $row['title'], $row['catID']);
$game['image_url'] = Utils::FileToGameImageURL($game['file'], 'png');
/*if ($this->request['admin'] == 1) {
$game['admin_edit'] = '<a href="' . $this->request['settings']->get('site_url') . '/admin/?task=manage_games#id=' . $row['game_id'] . '">Edit</a>';
} else {
$game['admin_edit'] = '';
}*/
$game['admin_edit'] = '';
array_push($games, $game);
}
return $games;
}
示例12: __construct
/**
* constructor
* @param string logFile
* @param int startTime
* @param string logFileExim
*/
public function __construct($startTime = 0)
{
$this->startTime = $startTime;
// Get all domains from Database
$stmt = Database::prepare("SELECT domain FROM `" . TABLE_PANEL_DOMAINS . "`");
Database::pexecute($stmt, array());
while ($domain_row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$this->myDomains[] = $domain_row["domain"];
}
// Parse MTA traffic
if (Settings::Get("system.mtaserver") == "postfix") {
$this->_parsePostfixLog(Settings::Get("system.mtalog"));
$this->_parsePostfixLog(Settings::Get("system.mtalog") . ".1");
} elseif (Settings::Get("system.mtaserver") == "exim4") {
$this->_parseExim4Log(Settings::Get("system.mtalog"));
}
// Parse MDA traffic
if (Settings::Get("system.mdaserver") == "dovecot") {
$this->_parseDovecotLog(Settings::Get("system.mdalog"));
$this->_parsePostfixLog(Settings::Get("system.mdalog") . ".1");
} elseif (Settings::Get("system.mdaserver") == "courier") {
$this->_parseCourierLog(Settings::Get("system.mdalog"));
$this->_parsePostfixLog(Settings::Get("system.mdalog") . ".1");
}
}
示例13: validatePasswordLogin
/**
* Function validatePasswordLogin
*
* compare user password-hash with given user-password
* and check if they are the same
* additionally it updates the hash if the system settings changed
* or if the very old md5() sum is used
*
* @param array $userinfo user-data from table
* @param string $password the password to validate
* @param string $table either panel_customers or panel_admins
* @param string $uid user-id-field in $table
*
* @return boolean
*/
function validatePasswordLogin($userinfo = null, $password = null, $table = 'panel_customers', $uid = 'customerid')
{
$systype = 3;
// SHA256
if (Settings::Get('system.passwordcryptfunc') !== null) {
$systype = (int) Settings::Get('system.passwordcryptfunc');
}
$pwd_hash = $userinfo['password'];
$update_hash = false;
// check for good'ole md5
if (strlen($pwd_hash) == 32 && ctype_xdigit($pwd_hash)) {
$pwd_check = md5($password);
$update_hash = true;
} else {
// cut out the salt from the hash
$pwd_salt = str_replace(substr(strrchr($pwd_hash, "\$"), 1), "", $pwd_hash);
// create same hash to compare
$pwd_check = crypt($password, $pwd_salt);
// check whether the hash needs to be updated
$hash_type_chk = substr($pwd_hash, 0, 3);
if ($systype == 1 && $hash_type_chk != '$1$' || $systype == 2 && $hash_type_chk != '$2$' || $systype == 3 && $hash_type_chk != '$5$' || $systype == 4 && $hash_type_chk != '$6$') {
$update_hash = true;
}
}
if ($pwd_hash == $pwd_check) {
// check for update of hash
if ($update_hash) {
$upd_stmt = Database::prepare("\n\t\t\t\tUPDATE " . $table . " SET `password` = :newpasswd WHERE `" . $uid . "` = :uid\n\t\t\t");
$params = array('newpasswd' => makeCryptPassword($password), 'uid' => $userinfo[$uid]);
Database::pexecute($upd_stmt, $params);
}
return true;
}
return false;
}
示例14: assignCompanyInfoAndTheme
function assignCompanyInfoAndTheme()
{
$this->assign('url', Settings::Get('hosturl', Resources::Get('site.url')));
$this->assign('company', Settings::Get('company_name', Resources::Get('company.webim')));
$this->assign('logo', Settings::Get('logo', WEBIM_ROOT . '/themes/default/images/logo.gif'));
$this->assign('theme', Browser::getCurrentTheme());
}
示例15: setDomainSSLFilesArray
/**
* read domain-related (or if empty, parentdomain-related) ssl-certificates from the database
* and (if not empty) set the corresponding array-indices (ssl_cert_file, ssl_key_file,
* ssl_ca_file and ssl_cert_chainfile). Hence the parameter as reference.
*
* @param array $domain domain-array as reference so we can set the corresponding array-indices
*
* @return null
*/
public function setDomainSSLFilesArray(array &$domain = null)
{
// check if the domain itself has a certificate defined
$dom_certs_stmt = Database::prepare("\n\t\t\tSELECT * FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` WHERE `domainid` = :domid\n\t\t");
$dom_certs = Database::pexecute_first($dom_certs_stmt, array('domid' => $domain['id']));
if (!is_array($dom_certs) || !isset($dom_certs['ssl_cert_file']) || $dom_certs['ssl_cert_file'] == '') {
// maybe its parent?
if ($domain['parentdomainid'] != null) {
$dom_certs = Database::pexecute_first($dom_certs_stmt, array('domid' => $domain['parentdomainid']));
}
}
// check if it's an array and if the most important field is set
if (is_array($dom_certs) && isset($dom_certs['ssl_cert_file']) && $dom_certs['ssl_cert_file'] != '') {
// get destination path
$sslcertpath = makeCorrectDir(Settings::Get('system.customer_ssl_path'));
// create path if it does not exist
if (!file_exists($sslcertpath)) {
safe_exec('mkdir -p ' . escapeshellarg($sslcertpath));
}
// make correct files for the certificates
$ssl_files = array('ssl_cert_file' => makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '.crt'), 'ssl_key_file' => makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '.key'));
if (Settings::Get('system.webserver') == 'lighttpd') {
// put my.crt and my.key together for lighty.
$dom_certs['ssl_cert_file'] = trim($dom_certs['ssl_cert_file']) . "\n" . trim($dom_certs['ssl_key_file']) . "\n";
$ssl_files['ssl_key_file'] = '';
}
// initialize optional files
$ssl_files['ssl_ca_file'] = '';
$ssl_files['ssl_cert_chainfile'] = '';
// set them if they are != empty
if ($dom_certs['ssl_ca_file'] != '') {
$ssl_files['ssl_ca_file'] = makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '_CA.pem');
}
if ($dom_certs['ssl_cert_chainfile'] != '') {
if (Settings::Get('system.webserver') == 'nginx') {
// put ca.crt in my.crt, as nginx does not support a separate chain file.
$dom_certs['ssl_cert_file'] = trim($dom_certs['ssl_cert_file']) . "\n" . trim($dom_certs['ssl_cert_chainfile']) . "\n";
} else {
$ssl_files['ssl_cert_chainfile'] = makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '_chain.pem');
}
}
// create them on the filesystem
foreach ($ssl_files as $type => $filename) {
if ($filename != '') {
touch($filename);
$_fh = fopen($filename, 'w');
fwrite($_fh, $dom_certs[$type]);
fclose($_fh);
chmod($filename, 0600);
}
}
// override corresponding array values
$domain['ssl_cert_file'] = $ssl_files['ssl_cert_file'];
$domain['ssl_key_file'] = $ssl_files['ssl_key_file'];
$domain['ssl_ca_file'] = $ssl_files['ssl_ca_file'];
$domain['ssl_cert_chainfile'] = $ssl_files['ssl_cert_chainfile'];
}
return;
}