From 0f7d3e2306acbdf618ed2a2d48d1c8cf3457fd87 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 30 Jun 2010 06:06:16 -0400
Subject: [PATCH] Fixed regex for email filed to allow _ in email addresses.
---
server/plugins-available/apache2_plugin.inc.php | 54 ++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 48 insertions(+), 6 deletions(-)
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 61202c6..c0fd822 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -838,6 +838,11 @@
unset($htp_file);
}
}
+
+ //* Create awstats configuration
+ if($data["new"]["stats_type"] == 'awstats' && $data["new"]["type"] == "vhost") {
+ $this->awstats_update($data,$web_config);
+ }
if($apache_chrooted) {
@@ -942,6 +947,11 @@
$command .= ' '.$data["old"]["system_user"];
exec($command);
if($apache_chrooted) $this->_exec("chroot ".escapeshellcmd($web_config['website_basedir'])." ".$command);
+
+ //* Remove the awstats configuration file
+ if($data["old"]["stats_type"] == 'awstats') {
+ $this->awstats_delete($data,$web_config);
+ }
}
}
@@ -1085,7 +1095,6 @@
$changed = false;
$in = fopen($filename, 'r');
$output = '';
-
/*
* read line by line and search for the username and authname
*/
@@ -1096,10 +1105,9 @@
/*
* found the user. delete or change it?
*/
- if ($pwd != '') {
- $tmp[2] = $pwdhash;
- $output .= $tmp[0] . ':' . $tmp[1] . ':' . $tmp[2] . "\n";
- }
+ if ($pwdhash != '') {
+ $output .= $tmp[0] . ':' . $tmp[1] . ':' . $pwdhash . "\n";
+ }
$changed = true;
}
else {
@@ -1110,7 +1118,7 @@
* if we didn't change anything, we have to add the new user at the end of the file
*/
if (!$changed) {
- $output .= $username . ':' . $authname . ':' . md5($username . ':' . $authname . ':' . $pwd) . "\n";
+ $output .= $username . ':' . $authname . ':' . $pwdhash . "\n";
}
fclose($in);
@@ -1198,6 +1206,40 @@
file_put_contents($fileName, $output);
}
+
+ //* Update the awstats configuration file
+ private function awstats_update ($data,$web_config) {
+ global $app;
+
+ $awstats_conf_dir = $web_config['awstats_conf_dir'];
+
+ if(!@is_file($awstats_conf_dir."/awstats.".$data["new"]["domain"].".conf") || ($data["old"]["domain"] != '' && $data["new"]["domain"] != $data["old"]["domain"])) {
+ if ( @is_file($awstats_conf_dir."/awstats.".$data["old"]["domain"].".conf") ) {
+ unlink($awstats_conf_dir."/awstats.".$data["old"]["domain"].".conf");
+ }
+
+ $content = '';
+ $content .= "Include \"".$awstats_conf_dir."/awstats.conf\"\n";
+ $content .= "LogFile=\"/var/log/ispconfig/httpd/".$data["new"]["domain"]."/access.log\"\n";
+ $content .= "SiteDomain=\"".$data["new"]["domain"]."\"\n";
+ $content .= "HostAliases=\"www.".$data["new"]["domain"]." localhost 127.0.0.1\"\n";
+
+ file_put_contents($awstats_conf_dir.'/awstats.'.$data["new"]["domain"].'.conf',$content);
+ $app->log("Created awstats config file: ".$awstats_conf_dir.'/awstats.'.$data["new"]["domain"].'.conf',LOGLEVEL_DEBUG);
+ }
+ }
+
+ //* Delete the awstats configuration file
+ private function awstats_delete ($data,$web_config) {
+ global $app;
+
+ $awstats_conf_dir = $web_config['awstats_conf_dir'];
+
+ if ( @is_file($awstats_conf_dir."/awstats.".$data["old"]["domain"].".conf") ) {
+ unlink($awstats_conf_dir."/awstats.".$data["old"]["domain"].".conf");
+ $app->log("Removed awstats config file: ".$awstats_conf_dir.'/awstats.'.$data["old"]["domain"].'.conf',LOGLEVEL_DEBUG);
+ }
+ }
//* Wrapper for exec function for easier debugging
private function _exec($command) {
--
Gitblit v1.9.1