示例#1
0
// Convert to regex format
$s_str = '/' . $s_str . '/';
// Create regex pattern
file_search_replace($usf_small_my_ini, $s_str, $r_str);
// Update MySQL medium config with new port
$r_str = "port=" . $MySQL_port;
$s_str = "port=" . $MySQL_port_old;
$s_str = preg_quote($s_str, '/');
// Convert to regex format
$s_str = '/' . $s_str . '/';
// Create regex pattern
file_search_replace($usf_medium_my_ini, $s_str, $r_str);
// Update Apanel redirect.html to new port
$r_str = ":" . $Apache_port;
$s_str = ":" . $Apache_port_old;
$s_str = preg_quote($s_str, '/');
// Convert to regex format
$s_str = '/' . $s_str . '/';
// Create regex pattern
file_search_replace($usf_redirect, $s_str, $r_str);
// Update Apanel redirect2.html to new port
$r_str = ":" . $Apache_port;
$s_str = ":" . $Apache_port_old;
$s_str = preg_quote($s_str, '/');
// Convert to regex format
$s_str = '/' . $s_str . '/';
// Create regex pattern
file_search_replace($usf_redirect2, $s_str, $r_str);
//=============== END UPDATE SERVER ========================
print " Server ports have been changed and services renamed \n\n";
exit;
示例#2
0
function run_location_tracker()
{
    global $usf_location_tracker;
    // Tracker file previous location
    global $base_f;
    // Current server base folder
    global $usf_apache_cnf;
    // Apache configuration file
    global $usf_apache_ssl_cnf;
    // Apache SSL configuration file
    global $usf_my_ini;
    // MySQL  configuration file
    global $usf_small_my_ini;
    // MySQL  alternative configuration file
    global $usf_medium_my_ini;
    // MySQL  alternativeconfiguration file
    global $usf_php_ini;
    // PHP configuration file
    global $usf_php_ini_prod;
    // PHP production configuration file
    global $usf_php_ini_dev;
    // PHP pdelvelopment configuration file
    global $usf_msmtp;
    // msmtp configuration file
    global $us_cgi_bin;
    // Per folder
    if (get_location_tracker() != $base_f) {
        // Server has been moved
        $s_str = get_location_tracker();
        // yes: Get old location
        $s_str = preg_quote($s_str, '/');
        // Convert to regex format
        $s_str = '/' . $s_str . '/';
        // Create regex pattern
        file_search_replace($usf_apache_cnf, $s_str, $base_f);
        // Update Apache cnf
        file_search_replace($usf_apache_ssl_cnf, $s_str, $base_f);
        // Update Apache SSL cnf
        file_search_replace($usf_my_ini, $s_str, $base_f);
        // Update MySQL ini
        file_search_replace($usf_small_my_ini, $s_str, $base_f);
        // Update alternative MySQL ini
        file_search_replace($usf_medium_my_ini, $s_str, $base_f);
        // Update alternative MySQL ini
        file_search_replace($usf_php_ini, $s_str, $base_f);
        // Update PHP ini
        file_search_replace($usf_php_ini_prod, $s_str, $base_f);
        // Update PHP production ini
        file_search_replace($usf_php_ini_dev, $s_str, $base_f);
        // Update PHP delvelopment ini
        if (file_exists($usf_msmtp)) {
            // Only update if exists
            file_search_replace($usf_msmtp, $s_str, $base_f);
            // Update msmpt ini
        }
        //=== Docs redirect ==
        $file = $base_f . "/unicon/docs/redirect.html";
        // new location of file
        $old_str = get_location_tracker() . "/docs/";
        // old folder location
        $new_str = $base_f . "/docs/";
        // new folder location
        $old_str = preg_replace('/\\//', '\\', $old_str);
        // Replace / with \ to keeps IE happy
        $new_str = preg_replace('/\\//', '\\\\\\', $new_str);
        // Replace / with \ to keeps IE happy
        $s_str = preg_quote($old_str, '/');
        // Convert to regex format
        $s_str = '/' . $s_str . '/';
        // Create regex pattern
        file_search_replace($file, $s_str, $new_str);
        // Update redirection file
        //=== Update shebang in all files in folder cgi-bin and sub-folders ===========
        if (perl_installed()) {
            // Only update if Perl installed
            $start_dir = $us_cgi_bin;
            // Main Perl folder
            $file_type = '/(\\.pl|\\.cgi)/';
            // List of file types
            $search_str = "/#!.*/";
            // Old shebang
            $replace_str = "#!" . $base_f . "/usr/bin/perl.exe";
            // New shebang
            recursive_search_replace($start_dir, $file_type, $search_str, $replace_str);
        }
        set_location_tracker();
        // Update to new location
    }
    // no: return
}
示例#3
0
// Create two parameters dummy used for checking second is used as is
$cmd = getcwd() . "\\ssl_gen.bat" . " dummy" . " \"" . $str4 . "\"";
exec($cmd);
print "Creating a private key and signing request\n\n";
//=== Copying new certificate and key to Server
print " #----------------------------------------------------------------------------#\n";
print " # Copying new certificate and key to Server                                  #\n";
print " # Location:                                                                  #\n";
print " #           Certificate:  usr/local/apache2/conf/ssl.crt/server.crt          #\n";
print " #           Key:          usr/local/apache2/conf/ssl.key/server.key          #\n";
print " #                                                                            #\n";
print " # Certificate Signing Request                                                #\n";
print " # Location:                                                                  #\n";
print " #           Certificate:  unicon/key_cert_gen/server.csr                     #\n";
print " #----------------------------------------------------------------------------#\n";
print " #                                                                            #\n";
print " # You must now restart the servers to enable the new configuration.          #\n";
print " #                                                                            #\n";
print " ##############################################################################\n\n";
//== Enable SSL in Apache's config file \usr\local\apache2\conf\httpd.conf
$s_str = "#LoadModule ssl_module modules/mod_ssl.so";
// search for
$s_str = preg_quote($s_str, '/');
// Convert to regex format
$s_str = '/' . $s_str . '/';
// Create regex pattern
$replace_str = "LoadModule ssl_module modules/mod_ssl.so";
// replace with
file_search_replace($usf_apache_cnf, $s_str, $replace_str);
// Update Apache cnf
exit;