本文整理汇总了PHP中makeCorrectFile函数的典型用法代码示例。如果您正苦于以下问题:PHP makeCorrectFile函数的具体用法?PHP makeCorrectFile怎么用?PHP makeCorrectFile使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makeCorrectFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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)
{
global $db, $settings, $pathtophpfiles;
if ($force || (int) $settings['system']['store_index_file_subs'] == 1) {
$result = $db->query("SELECT `t`.`value`, `c`.`email` AS `customer_email`, `a`.`email` AS `admin_email`, `c`.`loginname` AS `customer_login`, `a`.`loginname` AS `admin_login` FROM `" . TABLE_PANEL_CUSTOMERS . "` AS `c` INNER JOIN `" . TABLE_PANEL_ADMINS . "` AS `a` ON `c`.`adminid` = `a`.`adminid` INNER JOIN `" . TABLE_PANEL_TEMPLATES . "` AS `t` ON `a`.`adminid` = `t`.`adminid` WHERE `varname` = 'index_html' AND `c`.`loginname` = '" . $db->escape($loginname) . "'");
if ($db->num_rows($result) > 0) {
$template = $db->fetch_array($result);
$replace_arr = array('SERVERNAME' => $settings['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['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['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 ' . $pathtophpfiles . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
}
safe_exec('cp -a ' . $pathtophpfiles . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
}
}
return;
}
示例3: 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;
}
示例4: 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;
}
示例5: createAWStatsConf
/**
* Create or modify the AWStats configuration file for the given domain.
* Modified by Berend Dekens to allow custom configurations.
*
* @param logFile
* @param siteDomain
* @param hostAliases
* @return null
*/
function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot, $awstats_params = array())
{
global $pathtophpfiles, $settings;
// Generation header
$header = "## GENERATED BY FROXLOR\n";
$header2 = "## Do not remove the line above! This tells Froxlor to update this configuration\n## If you wish to manually change this configuration file, remove the first line to make sure Froxlor won't rebuild this file\n## Generated for domain {SITE_DOMAIN} on " . date('l dS \\of F Y h:i:s A') . "\n";
$awstats_dir = makeCorrectDir($customerDocroot . '/awstats/' . $siteDomain . '/');
if (!is_dir($awstats_dir)) {
safe_exec('mkdir -p ' . escapeshellarg($awstats_dir));
}
// chown created folder, #258
makeChownWithNewStats($awstats_params);
// weird but could happen...
if (!is_dir($settings['system']['awstats_conf'])) {
safe_exec('mkdir -p ' . escapeshellarg($settings['system']['awstats_conf']));
}
// These are the variables we will replace
$regex = array('/\\{LOG_FILE\\}/', '/\\{SITE_DOMAIN\\}/', '/\\{HOST_ALIASES\\}/', '/\\{CUSTOMER_DOCROOT\\}/', '/\\{AWSTATS_CONF\\}/');
$replace = array(makeCorrectFile($logFile), $siteDomain, $hostAliases, $awstats_dir, makeCorrectDir($settings['system']['awstats_conf']));
// File names
$domain_file = makeCorrectFile($settings['system']['awstats_conf'] . '/awstats.' . $siteDomain . '.conf');
$model_file = dirname(dirname(dirname(dirname(__FILE__))));
$model_file .= '/templates/misc/awstatsmodel/';
if ($settings['system']['mod_log_sql'] == '1') {
$model_file .= 'awstats.froxlor.model_log_sql.conf';
} else {
$model_file .= 'awstats.froxlor.model.conf';
}
$model_file = makeCorrectFile($model_file);
// Test if the file exists
if (file_exists($domain_file)) {
// Check for the generated header - if this is a manual modification we won't update
$awstats_domain_conf = fopen($domain_file, 'r');
if (fgets($awstats_domain_conf, strlen($header)) != $header) {
fclose($awstats_domain_conf);
return;
}
// Close the file
fclose($awstats_domain_conf);
}
$awstats_domain_conf = fopen($domain_file, 'w');
$awstats_model_conf = fopen($model_file, 'r');
// Write the header
fwrite($awstats_domain_conf, $header);
fwrite($awstats_domain_conf, preg_replace($regex, $replace, $header2));
// Write the configuration file
while (($line = fgets($awstats_model_conf, 4096)) !== false) {
if (!preg_match('/^#/', $line) && trim($line) != '') {
fwrite($awstats_domain_conf, preg_replace($regex, $replace, $line));
}
}
fclose($awstats_domain_conf);
fclose($awstats_model_conf);
}
示例6: includeCronjobs
function includeCronjobs($debugHandler, $pathtophpfiles)
{
global $settings;
$cronjobs = getNextCronjobs();
$jobs_to_run = array();
$cron_path = makeCorrectDir($pathtophpfiles . '/scripts/jobs/');
if ($cronjobs !== false && is_array($cronjobs) && isset($cronjobs[0])) {
foreach ($cronjobs as $cronjob) {
$cron_file = makeCorrectFile($cron_path . $cronjob);
$jobs_to_run[] = $cron_file;
}
}
return $jobs_to_run;
}
示例7: validateFormFieldString
/**
* This file is part of the SysCP project.
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org>
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
* @package Functions
* @version $Id$
*/
function validateFormFieldString($fieldname, $fielddata, $newfieldvalue)
{
if (isset($fielddata['string_delimiter']) && $fielddata['string_delimiter'] != '') {
$newfieldvalues = explode($fielddata['string_delimiter'], $newfieldvalue);
unset($fielddata['string_delimiter']);
$returnvalue = true;
foreach ($newfieldvalues as $single_newfieldvalue) {
$single_returnvalue = validateFormFieldString($fieldname, $fielddata, $single_newfieldvalue);
if ($single_returnvalue !== true) {
$returnvalue = $single_returnvalue;
break;
}
}
} else {
$returnvalue = false;
if (isset($fielddata['string_type']) && $fielddata['string_type'] == 'mail') {
$returnvalue = filter_var($newfieldvalue, FILTER_VALIDATE_EMAIL) == $newfieldvalue;
} elseif (isset($fielddata['string_type']) && $fielddata['string_type'] == 'url') {
$returnvalue = validateUrl($newfieldvalue);
} elseif (isset($fielddata['string_type']) && $fielddata['string_type'] == 'dir') {
$returnvalue = $newfieldvalue == makeCorrectDir($newfieldvalue);
} elseif (isset($fielddata['string_type']) && $fielddata['string_type'] == 'file') {
$returnvalue = $newfieldvalue == makeCorrectFile($newfieldvalue);
} elseif (isset($fielddata['string_type']) && $fielddata['string_type'] == 'filedir') {
$returnvalue = $newfieldvalue == makeCorrectDir($newfieldvalue) || $newfieldvalue == makeCorrectFile($newfieldvalue);
} elseif (preg_match('/^[^\\r\\n\\t\\f\\0]*$/D', $newfieldvalue)) {
$returnvalue = true;
}
if (isset($fielddata['string_regexp']) && $fielddata['string_regexp'] != '') {
if (preg_match($fielddata['string_regexp'], $newfieldvalue)) {
$returnvalue = true;
} else {
$returnvalue = false;
}
}
if (isset($fielddata['string_emptyallowed']) && $fielddata['string_emptyallowed'] === true && $newfieldvalue === '') {
$returnvalue = true;
} elseif (isset($fielddata['string_emptyallowed']) && $fielddata['string_emptyallowed'] === false && $newfieldvalue === '') {
$returnvalue = 'stringmustntbeempty';
}
}
if ($returnvalue === true) {
return true;
} elseif ($returnvalue === false) {
return 'stringformaterror';
} else {
return $returnvalue;
}
}
示例8: getPreConfig
/**
* Function getPreConfig
*
* outputs various content before the update process
* can be continued (askes for agreement whatever is being asked)
*
* @param string version
*
* @return string
*/
function getPreConfig($current_version)
{
$has_preconfig = false;
$return = '<div class="preconfig"><h3 style="color:#ff0000;">PLEASE NOTE - Important update notifications</h3>';
include_once makeCorrectFile(dirname(__FILE__) . '/preconfig/0.9/preconfig_0.9.inc.php');
parseAndOutputPreconfig($has_preconfig, $return, $current_version);
$return .= '<br /><br />' . makecheckbox('update_changesagreed', '<strong>I have read the update notifications above and I am aware of the changes made to my system.</strong>', '1', true, '0', true);
$return .= '</div>';
$return .= '<input type="hidden" name="update_preconfig" value="1" />';
if ($has_preconfig) {
return $return;
} else {
return '';
}
}
示例9: wipeOutOldConfigs
private function wipeOutOldConfigs()
{
fwrite($this->debugHandler, ' apache::wipeOutOldConfigs: cleaning ' . $this->settings['system']['apacheconf_vhost'] . "\n");
$this->logger->logAction(CRON_ACTION, LOG_INFO, "cleaning " . $this->settings['system']['apacheconf_vhost']);
if (isConfigDir($this->settings['system']['apacheconf_vhost']) && file_exists($this->settings['system']['apacheconf_vhost']) && is_dir($this->settings['system']['apacheconf_vhost'])) {
$vhost_file_dirhandle = opendir($this->settings['system']['apacheconf_vhost']);
while (false !== ($vhost_filename = readdir($vhost_file_dirhandle))) {
if ($vhost_filename != '.' && $vhost_filename != '..' && !in_array($vhost_filename, $this->known_filenames) && preg_match('/^(10|20|30)_syscp_ipandport_(.+)\\.conf$/', $vhost_filename) && file_exists(makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/' . $vhost_filename))) {
fwrite($this->debugHandler, ' apache::wipeOutOldConfigs: unlinking ' . $vhost_filename . "\n");
$this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'unlinking ' . $vhost_filename);
unlink(makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/' . $vhost_filename));
}
}
}
}
示例10: _connectToPdnsDb
private function _connectToPdnsDb()
{
// get froxlor pdns config
$cf = Settings::Get('system.bindconf_directory') . '/froxlor/pdns_froxlor.conf';
$config = makeCorrectFile($cf);
if (!file_exists($config)) {
$this->_logger->logAction(CRON_ACTION, LOG_ERROR, 'PowerDNS configuration file (' . $config . ') not found. Did you go through the configuration templates?');
die('PowerDNS configuration file (' . $config . ') not found. Did you go through the configuration templates?' . PHP_EOL);
}
$lines = file($config);
$mysql_data = array();
foreach ($lines as $line) {
$line = trim($line);
if (strtolower(substr($line, 0, 6)) == 'gmysql') {
$namevalue = explode("=", $line);
$mysql_data[$namevalue[0]] = $namevalue[1];
}
}
// build up connection string
$driver = 'mysql';
$dsn = $driver . ":";
$options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'set names utf8');
$attributes = array('ATTR_ERRMODE' => 'ERRMODE_EXCEPTION');
$dbconf = array();
$dbconf["dsn"] = array('dbname' => $mysql_data["gmysql-dbname"], 'charset' => 'utf8');
if (isset($mysql_data['gmysql-socket']) && !empty($mysql_data['gmysql-socket'])) {
$dbconf["dsn"]['unix_socket'] = makeCorrectFile($mysql_data['gmysql-socket']);
} else {
$dbconf["dsn"]['host'] = $mysql_data['gmysql-host'];
$dbconf["dsn"]['port'] = $mysql_data['gmysql-port'];
}
// add options to dsn-string
foreach ($dbconf["dsn"] as $k => $v) {
$dsn .= $k . "=" . $v . ";";
}
// clean up
unset($dbconf);
// try to connect
try {
$this->pdns_db = new PDO($dsn, $mysql_data['gmysql-user'], $mysql_data['gmysql-password'], $options);
} catch (PDOException $e) {
die($e->getMessage());
}
// set attributes
foreach ($attributes as $k => $v) {
$this->pdns_db->setAttribute(constant("PDO::" . $k), constant("PDO::" . $v));
}
}
示例11: while
Database::pexecute($result_stmt, $result_data);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if (isset($row['traffic']) && $row['traffic'] > 0 && $row['traffic_used_total'] * 100 / $row['traffic'] >= (int) Settings::Get('system.report_trafficmax')) {
$replace_arr = array('NAME' => $row['name'], 'TRAFFIC' => round($row['traffic'] / 1024, 2), 'TRAFFICUSED' => round($row['traffic_used_total'] / 1024, 2), 'USAGE_PERCENT' => round($row['traffic_used_total'] * 100 / $row['traffic'], 2), 'MAX_PERCENT' => Settings::Get('system.report_trafficmax'));
$lngfile_stmt = Database::prepare("\n\t\t\tSELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "`\n\t\t\tWHERE `language` = :deflang\n\t\t");
$lngfile = Database::pexecute_first($lngfile_stmt, array('deflang' => $row['def_language']));
if ($lngfile !== null) {
$langfile = $lngfile['file'];
} else {
$lngfile = Database::pexecute_first($lngfile_stmt, array('deflang' => Settings::Get('panel.standardlanguage')));
$langfile = $lngfile['file'];
}
// include english language file (fallback)
include_once makeCorrectFile(FROXLOR_INSTALL_DIR . '/lng/english.lng.php');
// include admin/customer language file
include_once makeCorrectFile(FROXLOR_INSTALL_DIR . '/' . $langfile);
// Get mail templates from database; the ones from 'admin' are fetched for fallback
$result2_stmt = Database::prepare("\n\t\t\tSELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`\n\t\t\tWHERE `adminid` = :adminid\n\t\t\tAND `language` = :lang\n\t\t\tAND `templategroup` = 'mails' AND `varname` = :varname\n\t\t");
$resul2_data = array('adminid' => $row['adminid'], 'lang' => $row['def_language'], 'varname' => 'trafficmaxpercent_subject');
$result2 = Database::pexecute_first($result2_stmt, $result2_data);
$mail_subject = html_entity_decode(replace_variables($result2['value'] != '' ? $result2['value'] : $lng['mails']['trafficmaxpercent']['subject'], $replace_arr));
$resul2_data['varname'] = 'trafficmaxpercent_mailbody';
$result2 = Database::pexecute_first($result2_stmt, $result2_data);
$mail_body = html_entity_decode(replace_variables($result2['value'] != '' ? $result2['value'] : $lng['mails']['trafficmaxpercent']['mailbody'], $replace_arr));
$_mailerror = false;
try {
$mail->SetFrom($row['email'], $row['name']);
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML(nl2br($mail_body));
$mail->AddAddress($row['email'], $row['name']);
示例12: makeCorrectFile
if (isset($argv[$x])) {
// --force
if (strtolower($argv[$x]) == '--force') {
$crontasks = makeCorrectFile(FROXLOR_INSTALL_DIR . '/scripts/jobs/cron_tasks.php');
// really force re-generating of config-files by
// inserting task 1
inserttask('1');
// bind (if enabled, inserttask() checks this)
inserttask('4');
// also regenerate cron.d-file
inserttask('99');
addToQueue($jobs_to_run, $crontasks);
$lastrun_update['tasks'] = $crontasks;
} elseif (substr(strtolower($argv[$x]), 0, 2) == '--') {
if (strlen($argv[$x]) > 3) {
$cronfile = makeCorrectFile(FROXLOR_INSTALL_DIR . '/scripts/jobs/cron_' . substr(strtolower($argv[$x]), 2) . '.php');
addToQueue($jobs_to_run, $cronfile);
$lastrun_update[substr(strtolower($argv[$x]), 2)] = $cronfile;
}
}
}
}
// do we have anything to include?
if (count($jobs_to_run) > 0) {
// include all jobs we want to execute
foreach ($jobs_to_run as $cron) {
updateLastRunOfCron($lastrun_update, $cron);
require_once $cron;
}
}
fwrite($debugHandler, 'Cronfiles have been included' . "\n");
示例13: getSocketFile
/**
* return path of fpm-socket file
*
* @param boolean $createifnotexists create the directory if it does not exist
*
* @return string the full path to the socket
*/
public function getSocketFile($createifnotexists = true)
{
$socketdir = makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir'));
$socket = makeCorrectFile($socketdir . '/' . $this->_domain['loginname'] . '-' . $this->_domain['domain'] . '-php-fpm.socket');
if (!is_dir($socketdir) && $createifnotexists) {
safe_exec('mkdir -p ' . escapeshellarg($socketdir));
safe_exec('chown -R ' . Settings::Get('system.httpuser') . ':' . Settings::Get('system.httpgroup') . ' ' . escapeshellarg($socketdir));
}
return $socket;
}
示例14: posix_getpwuid
* This file is part of the Froxlor project.
* 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 Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Configfiles
*
*/
// Try to guess user/group from settings' email UID/GID
$vmail_user = posix_getpwuid(Settings::Get('system.vmail_uid'));
$vmail_group = posix_getgrgid(Settings::Get('system.vmail_gid'));
/* If one of them are not set, call it 'vmail' and suggest creating user/group
* in scripts. */
if ($vmail_user === false) {
$vmail_username = "vmail";
} else {
$vmail_username = $vmail_user['name'];
}
if ($vmail_group === false) {
$vmail_groupname = "vmail";
} else {
$vmail_groupname = $vmail_group['name'];
}
return array('freebsd' => array('label' => 'FreeBSD', 'services' => array('http' => array('label' => $lng['admin']['configfiles']['http'], 'daemons' => array('nginx' => array('label' => 'Nginx Webserver', 'commands_1' => array('cd /usr/ports/www/nginx', 'make config', 'set [x] IPv6 protocol (default)', 'set [x] Enable HTTP module (default)', 'set [x] Enable http_cache module (default)', 'set [x] Enable http_gzip_static module', 'set [x] Enable http_rewrite module (default)', 'set [x] Enable http_ssl module (default)', 'set [x] Enable http_stub_status module (default)', 'make install clean; rehash'), 'commands_2' => array($configcommand['vhost'], $configcommand['diroptions'], Settings::Get('system.deactivateddocroot') != '' ? 'mkdir -p ' . Settings::Get('system.deactivateddocroot') : '', 'mkdir -p ' . Settings::Get('system.documentroot_prefix'), 'mkdir -p ' . Settings::Get('system.mod_fcgid_tmpdir'), 'mkdir -p ' . Settings::Get('system.logfiles_directory'), 'echo "nginx_enable=\\"YES\\"" >> /etc/rc.conf'), 'files' => array('usr_local_etc_nginx_nginx.conf' => '/usr/local/etc/nginx/nginx.conf'), 'restart' => array('/usr/local/etc/rc.d/nginx restart')), 'apache2' => array('label' => 'Apache2 Webserver', 'commands' => array('cd /usr/ports/www/apache22', 'make config', 'make install', $configcommand['vhost'], 'chown root:0 ' . Settings::Get('system.apacheconf_vhost'), 'chmod 0600 ' . Settings::Get('system.apacheconf_vhost'), $configcommand['diroptions'], 'chown root:0 ' . Settings::Get('system.apacheconf_diroptions'), 'chmod 0600 ' . Settings::Get('system.apacheconf_diroptions'), 'mkdir -p ' . Settings::Get('system.documentroot_prefix'), 'mkdir -p ' . Settings::Get('system.logfiles_directory'), Settings::Get('system.deactivateddocroot') != '' ? 'mkdir -p ' . Settings::Get('system.deactivateddocroot') : '', 'mkdir -p ' . Settings::Get('system.mod_fcgid_tmpdir'), 'chmod 1777 ' . Settings::Get('system.mod_fcgid_tmpdir'), 'echo "accf_http_load=\\"YES\\"" >> /boot/loader.conf', 'echo "accf_data_load=\\"YES\\"" >> /boot/loader.conf', 'echo "apache22_enable=\\"YES\\"" >> /etc/rc.conf'), 'restart' => array('sh /usr/local/etc/rc.d/apache22 restart')))), 'dns' => array('label' => $lng['admin']['configfiles']['dns'], 'daemons' => array('bind9' => array('label' => 'Bind9 Nameserver', 'commands_1' => array('cd /usr/ports/dns/bind99', 'make config', 'set [x] International Domain Names', 'set [x] IPv6 protocol (default)', 'set [x] 64-bit file support', 'set [x] Replace base BIND with this version', 'set [x] Enable RPZ NSDNAME policy records', 'set [x] Enable RPZ NSIP trigger rules', 'set [x] dig/host/nslookup will do DNSSEC validation', 'set [x] Build with OpenSSL (Required for DNSSEC) (default)', 'set [x] Threading support (default)', 'make install clean; rehash'), 'commands_2' => array('echo "named_enable=\\"YES\\"" >> /etc/rc.conf', PHP_EOL, strpos(Settings::Get('system.bindconf_directory'), '/etc/namedb') === false ? '(TIP: Be sure the path below is "/etc/namedb", if not you have configured the bind-directory in a false way in PANEL->SETTINGS->NAMESERVER SETTINGS!)' : null, 'echo "include \\"' . Settings::Get('system.bindconf_directory') . 'froxlor_bind.conf\\";" >> ' . Settings::Get('system.bindconf_directory') . 'named.conf', 'echo "include \\"' . Settings::Get('system.bindconf_directory') . 'default-zone\\";" >> ' . Settings::Get('system.bindconf_directory') . 'named.conf'), 'files' => array('etc_namedb_named.conf' => Settings::Get('system.bindconf_directory') . 'named.conf', 'etc_namedb_master_default.zone' => Settings::Get('system.bindconf_directory') . 'master/default.zone', 'etc_namedb_default-zone' => Settings::Get('system.bindconf_directory') . 'default-zone'), 'restart' => array('/etc/rc.d/named restart')), 'powerdns' => array('label' => 'PowerDNS', 'commands_1' => array('cd /usr/ports/dns/powerdns', 'make config', 'set MySQL backend', 'make install', 'echo "pdns_enable=\\"YES\\"" >> /etc/rc.conf'), 'files' => array('usr_local_etc_pdns_pdns.conf' => '/usr/local/etc/pdns/pdns.conf'), 'commands' => array('touch ' . Settings::Get('system.bindconf_directory') . 'froxlor_bind.conf', 'chown root:0 ' . Settings::Get('system.bindconf_directory') . 'froxlor_bind.conf', 'chmod 0600 ' . Settings::Get('system.bindconf_directory') . 'froxlor_bind.conf'), 'restart' => array('sh /usr/local/etc/rc.d/pdns restart')))), 'smtp' => array('label' => $lng['admin']['configfiles']['smtp'], 'daemons' => array('postfix' => array('label' => 'Postfix', 'commands_1' => array('cd /usr/ports/mail/postfix', 'make config', 'set Dovecot SASL authentication method', 'set Enable SSL and TLS support', 'set MySQL maps (choose version with WITH_MYSQL_VER)', 'make install'), 'commands_2' => array($vmail_group === false ? 'pw groupadd ' . $vmail_groupname . ' -g ' . Settings::Get('system.vmail_gid') : '', $vmail_user === false ? 'pw useradd ' . $vmail_username . ' -u ' . Settings::Get('system.vmail_uid') . ' -g ' . Settings::Get('system.vmail_gid') . ' -s/sbin/nologin -d/dev/null' : '', 'mkdir -p ' . Settings::Get('system.vmail_homedir'), 'chown -R ' . $vmail_username . ':' . $vmail_groupname . ' ' . Settings::Get('system.vmail_homedir'), 'chmod 0750 ' . Settings::Get('system.vmail_homedir')), 'commands_3' => array('echo "sendmail_enable=\\"NO\\"" >> /etc/rc.conf', 'echo "sendmail_submit_enable=\\"NO\\"" >> /etc/rc.conf', 'echo "sendmail_outbound_enable=\\"NO\\"" >> /etc/rc.conf', 'echo "sendmail_msp_queue_enable=\\"NO\\"" >> /etc/rc.conf', 'echo "postfix_enable=\\"YES\\"" >> /etc/rc.conf'), 'files' => array('etc_periodic.conf' => '/etc/periodic.conf', 'usr_local_etc_postfix_main.cf' => '/usr/local/etc/postfix/main.cf', 'usr_local_etc_postfix_mysql-virtual_alias_maps.cf' => '/usr/local/etc/postfix/mysql-virtual_alias_maps.cf', 'usr_local_etc_postfix_mysql-virtual_mailbox_domains.cf' => '/usr/local/etc/postfix/mysql-virtual_mailbox_domains.cf', 'usr_local_etc_postfix_mysql-virtual_mailbox_maps.cf' => '/usr/local/etc/postfix/mysql-virtual_mailbox_maps.cf', 'usr_local_etc_postfix_mysql-virtual_sender_permissions.cf' => '/usr/local/etc/postfix/mysql-virtual_sender_permissions.cf'), 'restart' => array('newaliases', 'mkdir /var/spool/postfix/etc', 'cp /etc/resolv.conf /var/spool/postfix/etc', 'sh /usr/local/etc/rc.d/postfix restart')), 'postgrey' => array('label' => 'Postgrey', 'commands_1' => array('cd /usr/ports/mail/postgrey', 'make install clean'), 'commands_2' => array('sed -i.bak \'s/# *check_policy_service *inet:127\\.0\\.0\\.1:10023/ check_policy_service inet:127\\.0\\.0\\.1:10023/\' /usr/local/etc/postfix/main.cf', 'echo "postgrey_enable=\\"YES\\"" >> /etc/rc.conf'), 'restart' => array('/usr/local/etc/rc.d/postgrey restart', '/usr/local/etc/rc.d/postfix restart')), 'postfix_mxaccess' => array('label' => 'Postfix MX-Access (anti spam)', 'files' => array('etc_postfix_mx_access' => '/usr/local/etc/postfix/mx_access', 'etc_postfix_main.cf' => '/usr/local/etc/postfix/main.cf'), 'commands_1' => array('postmap /usr/local/etc/postfix/mx_access'), 'restart' => array('/usr/local/etc/rc.d/postfix restart')), 'dkim' => array('label' => 'DomainKey filter', 'commands' => array('cd /usr/ports/mail/dkim-milter/', 'make install clean', 'touch /usr/local/etc/mail/dkim-filter.conf'), 'files' => array('dkim-filter.conf' => '/usr/local/etc/mail/dkim-filter.conf', 'postfix_dkim_addition.cf' => '/usr/local/etc/postfix/main.cf'), 'restart' => array('/usr/local/etc/rc.d/milter-dkim restart ')))), 'mail' => array('label' => $lng['admin']['configfiles']['mail'], 'daemons' => array('dovecot' => array('label' => 'Dovecot', 'commands_1' => array('cd /usr/ports/mail/dovecot', 'make config', 'set kqueue(2) support ', 'set SSL support ', 'set ManageSieve support (optional)', 'set MySQL support ', 'make install', 'echo "dovecot_enable=\\"YES\\"" >> /etc/rc.conf'), 'files' => array('usr_local_etc_dovecot.conf' => '/usr/local/etc/dovecot.conf', 'usr_local_etc_dovecot-sql.conf' => '/usr/local/etc/dovecot-sql.conf'), 'commands_2' => array('echo "dovecot unix - n n - - pipe
flags=DRhu user=' . $vmail_username . ':' . $vmail_groupname . ' argv=/usr/local/libexec/dovecot/deliver -f ${sender} -d ${recipient}" >> /usr/local/etc/postfix/master.cf', 'chmod 0640 /usr/local/etc/dovecot-sql.conf'), 'restart' => array('sh /usr/local/etc/rc.d/dovecot restart')), 'dovecot2' => array('label' => 'Dovecot 2.x', 'commands_1' => array('cd /usr/ports/mail/dovecot2', 'make config', 'set [x] kqueue(2) support (default)', 'set [x] MySQL database', 'set [x] SSL protocol (default)', 'make install clean; rehash'), 'commands_2' => array('echo "dovecot_enable=\\"YES\\"" >> /etc/rc.conf', PHP_EOL, 'pw adduser ' . $vmail_username . ' -g ' . $vmail_groupname . ' -u ' . Settings::Get('system.vmail_gid') . ' -d /nonexistent -s /usr/sbin/nologin -c "User for virtual mailtransport used by Postfix and Dovecot"', PHP_EOL, 'chmod 0640 /usr/local/etc/dovecot-sql.conf'), 'files' => array('usr_local_etc_dovecot_dovecot.conf' => '/usr/local/etc/dovecot/dovecot.conf', 'usr_local_etc_dovecot_dovecot-sql.conf' => '/usr/local/etc/dovecot/dovecot-sql.conf'), 'commands_3' => array('echo "dovecot unix - n n - - pipe' . PHP_EOL . 'flags=DRhu user=' . $vmail_username . ':' . $vmail_groupname . ' argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient} -a ${recipient}" >> /usr/local/etc/postfix/master.cf'), 'restart' => array('/usr/local/etc/rc.d/dovecot restart')))), 'ftp' => array('label' => $lng['admin']['configfiles']['ftp'], 'daemons' => array('proftpd' => array('label' => 'ProFTPd', 'commands_1' => array('cd /usr/ports/ftp/proftpd', 'make config', 'set MySQL auth', 'set Include mod_quota', 'make install clean'), 'commands_2' => array('touch /usr/local/etc/proftpd.conf', 'chown root:0 /usr/local/etc/proftpd.conf', 'chmod 0600 /usr/local/etc/proftpd.conf', 'echo "proftpd_enable=\\"YES\\"" >> /etc/rc.conf'), 'files' => array('etc_proftpd_proftpd.conf' => '/usr/local/etc/proftpd.conf'), 'restart' => array('/usr/local/etc/rc.d/proftpd restart')), 'pure-ftpd' => array('label' => 'Pure-FTPd', 'commands_1' => array('cd /usr/ports/ftp/pure-ftpd', 'make config', '# select LARGEFILE,MYSQL,PAM,PRIVSEP,SENDFILE,THROTTLING,TLS,UTF8,VIRTUALCHROOT', 'make install clean'), 'commands_2' => array('touch /usr/local/etc/pure-ftpd.conf', 'touch /usr/local/etc/pureftpd-mysql.conf', 'chown root:0 /usr/local/etc/pure-ftpd.conf', 'chown root:0 /usr/local/etc/pureftpd-mysql.conf', 'chmod 0600 /usr/local/etc/pure-ftpd.conf', 'chmod 0600 /usr/local/etc/pureftpd-mysql.conf', 'echo "pure-ftpd_enable="YES" >> /etc/rc.conf'), 'files' => array('usr_local_etc_pure-ftpd.conf' => '/usr/local/etc/pure-ftpd.conf', 'usr_local_etc_pureftpd-mysql.conf' => '/usr/local/etc/pureftpd-mysql.conf'), 'restart' => array('service pure-ftpd restart')))), 'etc' => array('label' => $lng['admin']['configfiles']['etc'], 'daemons' => array('cron' => array('label' => 'Crond (cronscript)', 'commands' => array('echo "*/5 * * * * root nice -n 5 /usr/local/bin/php -q ' . makeCorrectDir(dirname(dirname(dirname(__FILE__)))) . 'scripts/froxlor_master_cronjob.php" >> /etc/crontab'), 'restart' => array(Settings::Get('system.crondreload'))), 'awstats' => array('label' => 'Awstats', 'commands' => array('cd /usr/ports/www/awstats/', 'make install clean', 'cp /usr/local/www/awstats/cgi-bin/awstats.model.conf ' . makeCorrectDir(Settings::Get('system.awstats_conf')), 'sed -i.bak \'s/^LogFile/# LogFile/\' ' . makeCorrectFile(Settings::Get('system.awstats_conf') . '/awstats.model.conf'), 'sed -i.bak \'s/^LogType/# LogType/\' ' . makeCorrectFile(Settings::Get('system.awstats_conf') . '/awstats.model.conf'), 'sed -i.bak \'s/^LogFormat/# LogFormat/\' ' . makeCorrectFile(Settings::Get('system.awstats_conf') . '/awstats.model.conf'), 'sed -i.bak \'s/^LogSeparator/# LogSeparator/\' ' . makeCorrectFile(Settings::Get('system.awstats_conf') . '/awstats.model.conf'), 'sed -i.bak \'s/^SiteDomain/# SiteDomain/\' ' . makeCorrectFile(Settings::Get('system.awstats_conf') . '/awstats.model.conf'), 'sed -i.bak \'s/^DirData/# DirData/\' ' . makeCorrectFile(Settings::Get('system.awstats_conf') . '/awstats.model.conf'), 'sed -i.bak \'s|^\\(DirIcons=\\).*$|\\1\\"/awstats-icon\\"|\' ' . makeCorrectFile(Settings::Get('system.awstats_conf') . '/awstats.model.conf'), '# Please make sure you deactivate awstats own cronjob as Froxlor handles that itself')), 'libnss' => array('label' => 'libnss (system login with mysql)', 'commands_1' => array('cd /usr/ports/net/libnss-mysql', 'make install clean', 'echo "nscd_enable=\\"YES\\"" >> /etc/rc.conf'), 'files' => array('usr_local_etc_libnss-mysql.cfg' => '/usr/local/etc/libnss-mysql.cfg', 'usr_local_etc_libnss-mysql-root.cfg' => '/usr/local/etc/libnss-mysql-root.cfg', 'etc_nsswitch.conf' => '/etc/nsswitch.conf'), 'commands_2' => array('chmod 600 /usr/local/etc/libnss-mysql.cfg /usr/local/etc/libnss-mysql-root.cfg'), 'restart' => array('sh /etc/rc.d/nscd restart')), 'logrotate' => array('label' => 'Logrotate', 'commands_1' => array('cd /usr/ports/sysutils/logrotate/', 'make install clean clean-depends', 'touch /etc/logrotate.d/froxlor', 'chmod 644 /etc/logrotate.d/froxlor'), 'files' => array('etc_logrotated_froxlor' => '/etc/logrotate.d/froxlor'), 'commands_2' => array('# create cronjob-entry (daily-recommended)', '0 2 * * * /usr/local/sbin/logrotate -f /etc/logrotate.d/froxlor')))))));
示例15: posix_getpwuid
* 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 Andrej Semen <asemen@suse.de> (2010-2011)
* @author Wolfgang Rosenauer <wr@rosenauer.org> (2011)
* @author Froxlor team <team@froxlor.org> (2011-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Configfiles
*
*/
// Try to guess user/group from settings' email UID/GID
$vmail_user = posix_getpwuid(Settings::Get('system.vmail_uid'));
$vmail_group = posix_getgrgid(Settings::Get('system.vmail_gid'));
/* If one of them are not set, call it 'vmail' and suggest creating user/group
* in scripts. */
if ($vmail_user === false) {
$vmail_username = "vmail";
} else {
$vmail_username = $vmail_user['name'];
}
if ($vmail_group === false) {
$vmail_groupname = "vmail";
} else {
$vmail_groupname = $vmail_group['name'];
}
return array('sle_11' => array('label' => 'SUSE Linux Enterprise 11', 'services' => array('http' => array('label' => $lng['admin']['configfiles']['http'], 'daemons' => array('apache' => array('label' => 'Apache', 'commands' => array('mkdir -p ' . Settings::Get('system.documentroot_prefix'), 'mkdir -p ' . Settings::Get('system.logfiles_directory'), 'Maybe add to /etc/apache2/httpd.conf', 'Alias /mail /srv/www/htdocs/roundcubemail', 'Alias /webmail /srv/www/htdocs/squirrelmail', Settings::Get('system.deactivateddocroot') != '' ? 'mkdir -p ' . Settings::Get('system.deactivateddocroot') : ''), 'restart' => array(' ' . '/etc/init.d/apache2 restart')))), 'dns' => array('label' => $lng['admin']['configfiles']['dns'], 'daemons' => array('bind' => array('label' => 'Bind9', 'commands' => array('Add froxlor_bind.conf to the NAMED_CONF_INCLUDE_FILES in /etc/sysconfig/named'), 'restart' => array('/etc/init.d/named restart')))), 'smtp' => array('label' => $lng['admin']['configfiles']['smtp'], 'daemons' => array('postfix' => array('label' => 'Postfix', 'files' => array('etc_postfix_main.cf' => '/etc/postfix/main.cf', 'etc_postfix_mysql-virtual_alias_maps.cf' => '/etc/postfix/mysql_virtual_alias_maps.cf', 'etc_postfix_mysql-virtual_mailbox_domains.cf' => '/etc/postfix/mysql_virtual_mailbox_domains.cf', 'etc_postfix_mysql-virtual_mailbox_maps.cf' => '/etc/postfix/mysql_virtual_mailbox_maps.cf', 'etc_sasl2_smtpd.conf' => '/etc/sasl2/smtpd.conf'), 'commands' => array($vmail_group === false ? 'groupadd -g ' . Settings::Get('system.vmail_gid') . ' ' . $vmail_groupname : '', $vmail_user === false ? 'useradd -u ' . Settings::Get('system.vmail_uid') . ' -g ' . $vmail_groupname . ' ' . $vmail_username : '', 'mkdir -p ' . Settings::Get('system.vmail_homedir'), 'chown -R ' . $vmail_username . ':' . $vmail_groupname . ' ' . Settings::Get('system.vmail_homedir'), 'mkdir -p /var/spool/postfix/etc/pam.d', 'touch /etc/postfix/mysql-virtual_alias_maps.cf', 'touch /etc/postfix/mysql-virtual_mailbox_domains.cf', 'touch /etc/postfix/mysql-virtual_mailbox_maps.cf', 'touch /etc/sasl2/smtpd.conf', 'chmod 660 /etc/postfix/mysql_virtual_alias_maps.cf', 'chmod 660 /etc/postfix/mysql_virtual_mailbox_domains.cf', 'chmod 660 /etc/postfix/mysql_virtual_mailbox_maps.cf', 'chmod 660 /etc/sasl2/smtpd.conf', 'chgrp postfix /etc/postfix/mysql_virtual_alias_maps.cf', 'chgrp postfix /etc/postfix/mysql_virtual_mailbox_domains.cf', 'chgrp postfix /etc/postfix/mysql_virtual_mailbox_maps.cf', 'chgrp postfix /etc/sasl2/smtpd.conf'), 'restart' => array('/etc/init.d/postfix restart')), 'postfix_mxaccess' => array('label' => 'Postfix MX-Access (anti spam)', 'files' => array('etc_postfix_mx_access' => '/etc/postfix/mx_access', 'etc_postfix_main.cf' => '/etc/postfix/main.cf'), 'commands_1' => array('postmap /etc/postfix/mx_access'), 'restart' => array('/etc/init.d/postfix restart')), 'postfix_dovecot' => array('label' => 'Postfix/Dovecot', 'commands' => array($vmail_group === false ? 'groupadd -g ' . Settings::Get('system.vmail_gid') . ' ' . $vmail_groupname : '', $vmail_user === false ? 'useradd -u ' . Settings::Get('system.vmail_uid') . ' -g ' . $vmail_groupname . ' ' . $vmail_username : '', 'zypper install postfix postfix-mysql', 'mkdir -p /var/spool/postfix/etc/pam.d', 'mkdir -p /var/spool/postfix/var/run/mysqld', 'mkdir -p ' . Settings::Get('system.vmail_homedir'), 'chown -R ' . $vmail_username . ':' . $vmail_groupname . ' ' . Settings::Get('system.vmail_homedir'), 'touch /etc/postfix/mysql-virtual_alias_maps.cf', 'touch /etc/postfix/mysql-virtual_mailbox_domains.cf', 'touch /etc/postfix/mysql-virtual_mailbox_maps.cf', 'touch /etc/postfix/mysql-virtual_sender_permissions.cf', 'chown root:postfix /etc/postfix/mysql-virtual_alias_maps.cf', 'chown root:postfix /etc/postfix/mysql-virtual_mailbox_domains.cf', 'chown root:postfix /etc/postfix/mysql-virtual_mailbox_maps.cf', 'chown root:postfix /etc/postfix/mysql-virtual_sender_permissions.cf', 'chmod 0640 /etc/postfix/mysql-virtual_alias_maps.cf', 'chmod 0640 /etc/postfix/mysql-virtual_mailbox_domains.cf', 'chmod 0640 /etc/postfix/mysql-virtual_mailbox_maps.cf', 'chmod 0640 /etc/postfix/mysql-virtual_sender_permissions.cf'), 'files' => array('etc_postfix_main.cf' => '/etc/postfix/main.cf', 'etc_postfix_master.cf' => '/etc/postfix/master.cf', 'etc_postfix_mysql-virtual_alias_maps.cf' => '/etc/postfix/mysql-virtual_alias_maps.cf', 'etc_postfix_mysql-virtual_mailbox_domains.cf' => '/etc/postfix/mysql-virtual_mailbox_domains.cf', 'etc_postfix_mysql-virtual_mailbox_maps.cf' => '/etc/postfix/mysql-virtual_mailbox_maps.cf', 'etc_postfix_mysql-virtual_sender_permissions.cf' => '/etc/postfix/mysql-virtual_sender_permissions.cf'), 'restart' => array('/etc/init.d/postfix restart', 'newaliases')), 'exim4' => array('label' => 'Exim4', 'commands_1' => array('zypper install exim'), 'files' => array('etc_exim4_conf.d_acl_30_exim4-config_check_rcpt.rul' => '/etc/exim4/conf.d/acl/30_exim4-config_check_rcpt.rul', 'etc_exim4_conf.d_auth_30_froxlor-config' => '/etc/exim4/conf.d/auth/30_froxlor-config', 'etc_exim4_conf.d_main_10_froxlor-config_options' => '/etc/exim4/conf.d/main/10_froxlor-config_options', 'etc_exim4_conf.d_router_180_froxlor-config' => '/etc/exim4/conf.d/router/180_froxlor-config', 'etc_exim4_conf.d_transport_30_froxlor-config' => '/etc/exim4/conf.d/transport/30_froxlor-config'), 'commands_2' => array('chmod o-rx /var/lib/exim4', 'chmod o-rx /etc/exim4/conf.d/main/10_froxlor-config_options'), 'restart' => array('/etc/init.d/exim4 restart')))), 'mail' => array('label' => $lng['admin']['configfiles']['mail'], 'daemons' => array('courier' => array('label' => 'Courier', 'commands' => array('zypper install courier-imap courier-authlib-mysql'), 'files' => array('etc_authlib_authdaemonrc' => '/etc/authlib/authdaemonrc', 'etc_authlib_authmysqlrc' => '/etc/authlib/authmysqlrc'), 'restart' => array('/etc/init.d/courier-authdaemon restart', '/etc/init.d/courier-pop restart')), 'dovecot' => array('label' => 'Dovecot 1.1', 'commands_1' => array('zypper install dovecot11'), 'files' => array('etc_dovecot_dovecot.conf' => '/etc/dovecot/dovecot.conf', 'etc_dovecot_dovecot-sql.conf' => '/etc/dovecot/dovecot-sql.conf'), 'commands_2' => array('chmod 0640 /etc/dovecot/dovecot-sql.conf'), 'restart' => array('/etc/init.d/dovecot restart')))), 'ftp' => array('label' => $lng['admin']['configfiles']['ftp'], 'daemons' => array('proftpd' => array('label' => 'ProFTPd', 'files' => array('etc_proftpd_modules.conf' => '/etc/proftpd/modules.conf', 'etc_proftpd_proftpd.conf' => '/etc/proftpd/proftpd.conf'), 'restart' => array('/etc/init.d/proftpd restart')), 'pure-ftpd' => array('label' => 'Pure-FTPd', 'files' => array('etc_pure-ftpd.conf' => '/etc/pure-ftpd/pure-ftpd.conf', 'etc_pure-ftpd_mysql.conf' => '/etc/pure-ftpd/pure-ftpd-mysql.conf'), 'restart' => array('/etc/init.d/pure-ftpd restart')))), 'etc' => array('label' => $lng['admin']['configfiles']['etc'], 'daemons' => array('cron' => array('label' => 'Crond (cronscript)', 'files' => array('etc_cron.d_froxlor' => '/etc/cron.d/froxlor'), 'restart' => array(Settings::Get('system.crondreload'))), 'awstats' => array('label' => 'Awstats', 'commands' => array('cp /usr/share/doc/packages/awstats/awstats.model.conf /etc/awstats/', 'sed -i.bak \'s/^DirData/# DirData/\'' . makeCorrectFile(Settings::Get('system.awstats_conf') . '/awstats.model.conf'), 'sed -i.bak \'s|^\\(DirIcons=\\).*$|\\1\\"/awstats-icon\\"|\' ' . makeCorrectFile(Settings::Get('system.awstats_conf') . '/awstats.model.conf'), '# Please make sure you deactivate awstats own cronjob as Froxlor handles that itself')))))));