From 2c09b2d5984a9ab70d0062bd08a0390edaca57b4 Mon Sep 17 00:00:00 2001
From: doekia <doekia@gmail.com>
Date: Mon, 17 Mar 2014 23:16:47 -0400
Subject: [PATCH] State <> Country

---
 server/plugins-available/apache2_plugin.inc.php |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index fd5149d..ade254c 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -2110,9 +2110,7 @@
 
 		//* Create the folder path, if it does not exist
 		if(!is_dir($folder_path)) {
-			$app->system->mkdirpath($folder_path);
-			$app->system->chown($folder_path, $website['system_user']);
-			$app->system->chgrp($folder_path, $website['system_group']);
+			$app->system->mkdirpath($folder_path, 0755, $website['system_user'], $website['system_group']);
 		}
 
 		//* Create empty .htpasswd file, if it does not exist
@@ -2338,6 +2336,15 @@
 			$app->system->chown($new_folder_path.'.htaccess', $website['system_user']);
 			$app->system->chgrp($new_folder_path.'.htaccess', $website['system_group']);
 			$app->log('Created/modified file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+			
+			//* Create empty .htpasswd file, if it does not exist
+			if(!is_file($folder_path.'.htpasswd')) {
+				$app->system->touch($new_folder_path.'.htpasswd');
+				$app->system->chmod($new_folder_path.'.htpasswd', 0750);
+				$app->system->chown($new_folder_path.'.htpasswd', $website['system_user']);
+				$app->system->chgrp($new_folder_path.'.htpasswd', $website['system_group']);
+				$app->log('Created file '.$new_folder_path.'.htpasswd', LOGLEVEL_DEBUG);
+			}
 		}
 
 		//* Remove .htaccess file
@@ -2802,8 +2809,8 @@
 					if(substr($ini_setting, 0, 1) == '#') continue;
 					if(substr($ini_setting, 0, 2) == '//') continue;
 					list($key, $value) = explode('=', $ini_setting, 2);
-					if($value){
-						$value = trim($value);
+					$value = trim($value);
+					if($value != ''){
 						$key = trim($key);
 						switch (strtolower($value)) {
 						case '0':

--
Gitblit v1.9.1