| | |
| | | |
| | | $app->plugins->registerEvent('web_folder_update',$this->plugin_name,'web_folder_update'); |
| | | $app->plugins->registerEvent('web_folder_delete',$this->plugin_name,'web_folder_delete'); |
| | | |
| | | $app->plugins->registerEvent('ftp_user_delete',$this->plugin_name,'ftp_user_delete'); |
| | | } |
| | | |
| | | // Handle the creation of SSL certificates |
| | |
| | | * website root has to be owned by the root user and we have to chmod it to 755 then |
| | | */ |
| | | |
| | | //* Check if there is a jailkit user for this site |
| | | //* Check if there is a jailkit user or cronjob for this site |
| | | $tmp = $app->db->queryOneRecord('SELECT count(shell_user_id) as number FROM shell_user WHERE parent_domain_id = '.$data['new']['domain_id']." AND chroot = 'jailkit'"); |
| | | if($tmp['number'] > 0) { |
| | | $tmp2 = $app->db->queryOneRecord('SELECT count(id) as number FROM cron WHERE parent_domain_id = '.$data['new']['domain_id']." AND `type` = 'chrooted'"); |
| | | if($tmp['number'] > 0 || $tmp2['number'] > 0) { |
| | | $this->_exec('chmod 755 '.escapeshellcmd($data['new']['document_root'])); |
| | | $this->_exec('chown root:root '.escapeshellcmd($data['new']['document_root'])); |
| | | } |
| | |
| | | |
| | | // Rewrite rules |
| | | $rewrite_rules = array(); |
| | | if($data['new']['redirect_type'] != '') { |
| | | if($data['new']['redirect_type'] != '' && $data['new']['redirect_path'] != '') { |
| | | if(substr($data['new']['redirect_path'],-1) != '/') $data['new']['redirect_path'] .= '/'; |
| | | if(substr($data['new']['redirect_path'],0,8) == '[scheme]') $data['new']['redirect_path'] = '$scheme'.substr($data['new']['redirect_path'],8); |
| | | /* Disabled path extension |
| | |
| | | } |
| | | $app->log('Add server alias: '.$alias['domain'],LOGLEVEL_DEBUG); |
| | | // Rewriting |
| | | if($alias['redirect_type'] != '') { |
| | | if($alias['redirect_type'] != '' && $alias['redirect_path'] != '') { |
| | | if(substr($alias['redirect_path'],-1) != '/') $alias['redirect_path'] .= '/'; |
| | | if(substr($alias['redirect_path'],0,8) == '[scheme]') $alias['redirect_path'] = '$scheme'.substr($alias['redirect_path'],8); |
| | | |
| | |
| | | $this->update('web_domain_update', $webdata); |
| | | } |
| | | |
| | | public function ftp_user_delete($event_name,$data) { |
| | | global $app, $conf; |
| | | |
| | | $ftpquota_file = $data['old']['dir'].'/.ftpquota'; |
| | | if(file_exists($ftpquota_file)) unlink($ftpquota_file); |
| | | |
| | | } |
| | | |
| | | function _create_web_folder_auth_configuration($website){ |
| | | global $app, $conf; |
| | | //* Create the domain.auth file which is included in the vhost configuration file |
| | |
| | | |
| | | $awstats_conf_dir = $web_config['awstats_conf_dir']; |
| | | |
| | | if(!is_dir($data['new']['document_root']."/web/stats/")) mkdir($data['new']['document_root']."/web/stats"); |
| | | 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'); |
| | |
| | | } |
| | | |
| | | if(is_file($data['new']['document_root']."/web/stats/index.html")) unlink($data['new']['document_root']."/web/stats/index.html"); |
| | | if(!is_dir($data['new']['document_root']."/web/stats/")) mkdir($data['new']['document_root']."/web/stats"); |
| | | copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$data['new']['document_root']."/web/stats/index.php"); |
| | | } |
| | | |