From fea974d01416c9ecb57f801b1796d1332918063a Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Mon, 23 Jan 2012 09:53:52 -0500 Subject: [PATCH] Fixed: FS#1997 - Check encoding of the subject in ispconfig mail sending function. --- server/plugins-available/apache2_plugin.inc.php | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index ea215e4..66940a5 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -293,10 +293,19 @@ $app->uses('system'); if($web_config['connect_userid_to_webid'] == 'y') { + //* Calculate the uid and gid $connect_userid_to_webid_start = ($web_config['connect_userid_to_webid_start'] < 1000)?1000:intval($web_config['connect_userid_to_webid_start']); $fixed_uid_gid = intval($connect_userid_to_webid_start + $data['new']['domain_id']); $fixed_uid_param = '--uid '.$fixed_uid_gid; $fixed_gid_param = '--gid '.$fixed_uid_gid; + + //* Check if a ispconfigend user and group exists and create them + if(!$app->system->is_group('ispconfigend')) { + exec('groupadd --gid '.($connect_userid_to_webid_start + 10000).' ispconfigend'); + } + if(!$app->system->is_user('ispconfigend')) { + exec('useradd -g ispconfigend -d /usr/local/ispconfig --uid '.($connect_userid_to_webid_start + 10000).' ispconfigend'); + } } else { $fixed_uid_param = ''; $fixed_gid_param = ''; @@ -354,7 +363,13 @@ unset($tmp_docroot[count($tmp_docroot)-1]); $old_dir = implode('/',$tmp_docroot); - exec('rm -rf '.$data['new']['document_root']); + //* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path + if(@is_dir($data['new']['document_root'])) { + rename($data['new']['document_root'],$data['new']['document_root'].'_bak_'.date('Y_m_d')); + $app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d'),LOGLEVEL_DEBUG); + } + + //* Create new base directory, if it does not exist yet if(!is_dir($new_dir)) exec('mkdir -p '.$new_dir); exec('mv '.$data['old']['document_root'].' '.$new_dir); $app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir,LOGLEVEL_DEBUG); -- Gitblit v1.9.1