From e7fe9ff29a7a65fd09510ea785ce7668b8a95c78 Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Sat, 27 Dec 2008 07:33:17 -0500 Subject: [PATCH] Fixed: Username will be empty in sys_user when a tab is changed in client form. --- server/plugins-available/apache2_plugin.inc.php | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 40 insertions(+), 6 deletions(-) diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index b24369a..530c669 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -302,6 +302,10 @@ $tmp_symlink = str_replace("[website_domain]",$data["new"]["domain"],$tmp_symlink); // Remove trailing slash if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1); + //* Remove symlink if target folder has been changed. + if($data["old"]["document_root"] != '' && $data["old"]["document_root"] != $data["new"]["document_root"] && is_link($tmp_symlink)) { + unlink($tmp_symlink); + } // create the symlinks, if not exist if(!is_link($tmp_symlink)) { exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink)); @@ -326,22 +330,25 @@ exec("cp /usr/local/ispconfig/server/conf/error/".substr(escapeshellcmd($conf["language"]),0,2)."/* ".$error_page_path); } } - exec("chmod -R +r ".$error_page_path); + exec("chmod -R a+r ".$error_page_path); } // copy the standard index page - if (file_exists("/usr/local/ispconfig/server/conf-custom/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2))){ - exec("cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"]["document_root"])."/web/index.html"); + if (file_exists("/usr/local/ispconfig/server/conf-custom/index/".substr(escapeshellcmd($conf["language"]),0,2)."/index.html")){ + exec("cp /usr/local/ispconfig/server/conf-custom/index/".substr(escapeshellcmd($conf["language"]),0,2)."/* ".escapeshellcmd($data["new"]["document_root"])."/web/"); } else { - if (file_exists("/usr/local/ispconfig/server/conf-custom/index/standard_index.html")){ - exec("cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html ".escapeshellcmd($data["new"]["document_root"])."/web/index.html"); + if (file_exists("/usr/local/ispconfig/server/conf-custom/index/default/index.html")){ + exec("cp /usr/local/ispconfig/server/conf-custom/index/default/* ".escapeshellcmd($data["new"]["document_root"])."/web/"); } else { exec("cp /usr/local/ispconfig/server/conf/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"]["document_root"])."/web/index.html"); + exec("cp /usr/local/ispconfig/server/conf/index/favicon.ico ".escapeshellcmd($data["new"]["document_root"])."/web/"); + exec("cp /usr/local/ispconfig/server/conf/index/robots.txt ".escapeshellcmd($data["new"]["document_root"])."/web/"); + exec("cp /usr/local/ispconfig/server/conf/index/.htaccess ".escapeshellcmd($data["new"]["document_root"])."/web/"); } } - exec("chmod +r ".escapeshellcmd($data["new"]["document_root"])."/web/index.html"); + exec("chmod -R a+r ".escapeshellcmd($data["new"]["document_root"])."/web/"); } // Create group and user, if not exist @@ -416,6 +423,20 @@ $rewrite_rules[] = array( 'rewrite_domain' => $data["new"]["domain"], 'rewrite_type' => $data["new"]["redirect_type"], 'rewrite_target' => $data["new"]["redirect_path"]); + + switch($data["new"]["subdomain"]) { + case 'www': + $rewrite_rules[] = array( 'rewrite_domain' => 'www.'.$data["new"]["domain"], + 'rewrite_type' => $data["new"]["redirect_type"], + 'rewrite_target' => $data["new"]["redirect_path"]); + break; + case '*': + // TODO + //$rewrite_rules[] = array( 'rewrite_domain' => '*'.$alias["domain"], + // 'rewrite_type' => $alias["redirect_type"], + // 'rewrite_target' => $alias["redirect_path"]); + break; + } } // get alias domains (co-domains and subdomains) @@ -447,6 +468,19 @@ $rewrite_rules[] = array( 'rewrite_domain' => $alias["domain"], 'rewrite_type' => $alias["redirect_type"], 'rewrite_target' => $alias["redirect_path"]); + switch($alias["subdomain"]) { + case 'www': + $rewrite_rules[] = array( 'rewrite_domain' => 'www.'.$alias["domain"], + 'rewrite_type' => $alias["redirect_type"], + 'rewrite_target' => $alias["redirect_path"]); + break; + case '*': + // TODO + //$rewrite_rules[] = array( 'rewrite_domain' => '*'.$alias["domain"], + // 'rewrite_type' => $alias["redirect_type"], + // 'rewrite_target' => $alias["redirect_path"]); + break; + } } } } -- Gitblit v1.9.1