Commit 35957eb2 authored by Marius Burkard's avatar Marius Burkard

- fixed syntax and logical errors

parent 05161aeb
...@@ -69,6 +69,14 @@ class app { ...@@ -69,6 +69,14 @@ class app {
} }
public function __get($prop) {
if(property_exists($this, $prop)) return $this->{$prop};
$this->uses($prop);
if(property_exists($this, $prop)) return $this->{$prop};
else return null;
}
function setCaller($caller) { function setCaller($caller) {
$this->_calling_script = $caller; $this->_calling_script = $caller;
} }
......
...@@ -44,7 +44,7 @@ class letsencrypt { ...@@ -44,7 +44,7 @@ class letsencrypt {
} }
public function get_acme_script() { public function get_acme_script() {
$acme = excplode("\n", shell_exec('which /usr/local/ispconfig/server/scripts/acme.sh /root/.acme.sh/acme.sh')); $acme = explode("\n", shell_exec('which /usr/local/ispconfig/server/scripts/acme.sh /root/.acme.sh/acme.sh'));
$acme = reset($acme); $acme = reset($acme);
if(is_executable($acme)) { if(is_executable($acme)) {
return $acme; return $acme;
...@@ -233,7 +233,10 @@ class letsencrypt { ...@@ -233,7 +233,10 @@ class letsencrypt {
} }
private function get_ssl_domain($data) { private function get_ssl_domain($data) {
global $app;
$domain = $data['new']['ssl_domain']; $domain = $data['new']['ssl_domain'];
if(!$domain) $domain = $data['new']['domain']; if(!$domain) $domain = $data['new']['domain'];
if($data['new']['ssl'] == 'y' && $data['new']['ssl_letsencrypt'] == 'y') { if($data['new']['ssl'] == 'y' && $data['new']['ssl_letsencrypt'] == 'y') {
...@@ -249,8 +252,6 @@ class letsencrypt { ...@@ -249,8 +252,6 @@ class letsencrypt {
} }
public function get_website_certificate_paths($data) { public function get_website_certificate_paths($data) {
global $app;
$ssl_dir = $data['new']['document_root'].'/ssl'; $ssl_dir = $data['new']['document_root'].'/ssl';
$domain = $this->get_ssl_domain($data); $domain = $this->get_ssl_domain($data);
...@@ -472,4 +473,3 @@ class letsencrypt { ...@@ -472,4 +473,3 @@ class letsencrypt {
} }
} }
?>
...@@ -33,38 +33,44 @@ class plugin_webserver_base { ...@@ -33,38 +33,44 @@ class plugin_webserver_base {
public function registerEvents($server_type = 'apache') { public function registerEvents($server_type = 'apache') {
global $app; global $app;
$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'ssl'); if($server_type === 'apache') {
$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'ssl'); $plugin_name = 'apache2_plugin';
$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'ssl'); } else {
$plugin_name = 'nginx_plugin';
}
$app->plugins->registerEvent('web_domain_insert', $plugin_name, 'ssl');
$app->plugins->registerEvent('web_domain_update', $plugin_name, 'ssl');
$app->plugins->registerEvent('web_domain_delete', $plugin_name, 'ssl');
$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert'); $app->plugins->registerEvent('web_domain_insert', $plugin_name, 'insert');
$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update'); $app->plugins->registerEvent('web_domain_update', $plugin_name, 'update');
$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'delete'); $app->plugins->registerEvent('web_domain_delete', $plugin_name, 'delete');
$app->plugins->registerEvent('server_ip_insert', $this->plugin_name, 'server_ip'); $app->plugins->registerEvent('server_ip_insert', $plugin_name, 'server_ip');
$app->plugins->registerEvent('server_ip_update', $this->plugin_name, 'server_ip'); $app->plugins->registerEvent('server_ip_update', $plugin_name, 'server_ip');
$app->plugins->registerEvent('server_ip_delete', $this->plugin_name, 'server_ip'); $app->plugins->registerEvent('server_ip_delete', $plugin_name, 'server_ip');
$app->plugins->registerEvent('server_insert', $this->plugin_name, 'server_ip'); $app->plugins->registerEvent('server_insert', $plugin_name, 'server_ip');
$app->plugins->registerEvent('server_update', $this->plugin_name, 'server_ip'); $app->plugins->registerEvent('server_update', $plugin_name, 'server_ip');
$app->plugins->registerEvent('client_delete', $this->plugin_name, 'client_delete'); $app->plugins->registerEvent('client_delete', $plugin_name, 'client_delete');
$app->plugins->registerEvent('web_folder_user_insert', $this->plugin_name, 'web_folder_user'); $app->plugins->registerEvent('web_folder_user_insert', $plugin_name, 'web_folder_user');
$app->plugins->registerEvent('web_folder_user_update', $this->plugin_name, 'web_folder_user'); $app->plugins->registerEvent('web_folder_user_update', $plugin_name, 'web_folder_user');
$app->plugins->registerEvent('web_folder_user_delete', $this->plugin_name, 'web_folder_user'); $app->plugins->registerEvent('web_folder_user_delete', $plugin_name, 'web_folder_user');
$app->plugins->registerEvent('web_folder_update', $this->plugin_name, 'web_folder_update'); $app->plugins->registerEvent('web_folder_update', $plugin_name, 'web_folder_update');
$app->plugins->registerEvent('web_folder_delete', $this->plugin_name, 'web_folder_delete'); $app->plugins->registerEvent('web_folder_delete', $plugin_name, 'web_folder_delete');
$app->plugins->registerEvent('ftp_user_delete', $this->plugin_name, 'ftp_user_delete'); $app->plugins->registerEvent('ftp_user_delete', $plugin_name, 'ftp_user_delete');
$app->plugins->registerAction('php_ini_changed', $this->plugin_name, 'php_ini_changed'); $app->plugins->registerAction('php_ini_changed', $plugin_name, 'php_ini_changed');
if($server_type === 'apache') { if($server_type === 'apache') {
$app->plugins->registerEvent('webdav_user_insert', $this->plugin_name, 'webdav'); $app->plugins->registerEvent('webdav_user_insert', $plugin_name, 'webdav');
$app->plugins->registerEvent('webdav_user_update', $this->plugin_name, 'webdav'); $app->plugins->registerEvent('webdav_user_update', $plugin_name, 'webdav');
$app->plugins->registerEvent('webdav_user_delete', $this->plugin_name, 'webdav'); $app->plugins->registerEvent('webdav_user_delete', $plugin_name, 'webdav');
} }
} }
...@@ -1354,8 +1360,7 @@ class plugin_webserver_base { ...@@ -1354,8 +1360,7 @@ class plugin_webserver_base {
$app->system->file_put_contents($vhost_file, $this->nginx_merge_locations($tpl->grab())); $app->system->file_put_contents($vhost_file, $this->nginx_merge_locations($tpl->grab()));
} }
$app->log('Writing the vhost file: '.$vhost_file, LOGLEVEL_DEBUG); $app->log('Writing the vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
unset($tpl);
if($server_type === 'apache') { if($server_type === 'apache') {
/* /*
* maybe we have some webdav - user. If so, add them... * maybe we have some webdav - user. If so, add them...
......
...@@ -98,7 +98,7 @@ class apache2_plugin { ...@@ -98,7 +98,7 @@ class apache2_plugin {
if($this->action != 'insert') $this->action = 'update'; if($this->action != 'insert') $this->action = 'update';
$app->plugins_webserver_base->eventUpdate($event_name, $data, 'apache'); $app->plugin_webserver_base->eventUpdate($event_name, $data, 'apache');
//* Unset action to clean it for next processed vhost. //* Unset action to clean it for next processed vhost.
$this->action = ''; $this->action = '';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment