From 800ac30ecefea5213aa9172de1f5388154b7690a Mon Sep 17 00:00:00 2001 From: ftimme <ft@falkotimme.com> Date: Thu, 07 Feb 2013 08:17:02 -0500 Subject: [PATCH] - Remove trailing slash from $master_php_ini_path. - Make sure $custom_fastcgi_php_ini_dir is a directory. --- server/plugins-available/apache2_plugin.inc.php | 31 ++++++++++++++++++++++++++++++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 42b9c63..3181952 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -243,7 +243,17 @@ if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file,$data["new"]["ssl_request"]); if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file,$data["new"]["ssl_cert"]); if(trim($data["new"]["ssl_bundle"]) != '') $app->system->file_put_contents($bundle_file,$data["new"]["ssl_bundle"]); - if(trim($data["new"]["ssl_key"]) != '') $app->system->file_put_contents($key_file2,$data["new"]["ssl_key"]); + + //* Write the key file, if field is empty then import the key into the db + if(trim($data["new"]["ssl_key"]) != '') { + $app->system->file_put_contents($key_file2,$data["new"]["ssl_key"]); + } else { + $ssl_key2 = $app->db->quote($app->system->file_get_contents($key_file2)); + /* Update the DB of the (local) Server */ + $app->db->query("UPDATE web_domain SET ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'"); + /* Update also the master-DB of the Server-Farm */ + $app->dbmaster->query("UPDATE web_domain SET ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'"); + } /* Update the DB of the (local) Server */ $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'"); @@ -824,6 +834,13 @@ $master_php_ini_path = $web_config['php_ini_path_cgi']; } } + + //* Add php.ini to the path in case that the master_php_ini_path is a directory + if($master_php_ini_path != '' && is_dir($master_php_ini_path) && is_file($master_php_ini_path.'/php.ini')) { + if(substr($master_php_ini_path,-1) == '/') $master_php_ini_path = substr($master_php_ini_path,0,-1); + $master_php_ini_path .= '/php.ini'; + } + if($master_php_ini_path != '' && substr($master_php_ini_path,-7) == 'php.ini' && is_file($master_php_ini_path)) { $php_ini_content .= $app->system->file_get_contents($master_php_ini_path)."\n"; } @@ -1110,6 +1127,7 @@ if(trim($data['new']['fastcgi_php_version']) != ''){ $default_fastcgi_php = false; list($custom_fastcgi_php_name, $custom_fastcgi_php_executable, $custom_fastcgi_php_ini_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); + if(is_file($custom_fastcgi_php_ini_dir)) $custom_fastcgi_php_ini_dir = dirname($custom_fastcgi_php_ini_dir); if(substr($custom_fastcgi_php_ini_dir,-1) != '/') $custom_fastcgi_php_ini_dir .= '/'; } else { $default_fastcgi_php = true; @@ -2656,6 +2674,17 @@ $client_dir = $web_config['website_basedir'].'/clients/client'.$client_id; if(is_dir($client_dir) && !stristr($client_dir,'..')) { + // remove symlinks from $client_dir + $files = array_diff(scandir($client_dir), array('.','..')); + if(is_array($files) && !empty($files)){ + foreach($files as $file){ + if(is_link($client_dir.'/'.$file)){ + unlink($client_dir.'/'.$file); + $app->log('Removed symlink: '.$client_dir.'/'.$file,LOGLEVEL_DEBUG); + } + } + } + @rmdir($client_dir); $app->log('Removed client directory: '.$client_dir,LOGLEVEL_DEBUG); } -- Gitblit v1.9.1