Marius Burkard
2016-04-20 67d99a763eb9f44d3ef4fd334d1293ae8ccd847e
server/plugins-available/nginx_plugin.inc.php
@@ -1155,19 +1155,21 @@
      }
      
      // use vLib for template logic
      $nginx_directives_new = '';
      $ngx_conf_tpl = new tpl();
      $ngx_conf_tpl_tmp_file = tempnam($conf['temppath'], "ngx");
      file_put_contents($ngx_conf_tpl_tmp_file, $nginx_directives);
      $ngx_conf_tpl->newTemplate($ngx_conf_tpl_tmp_file);
      $ngx_conf_tpl->setVar('use_tcp', $use_tcp);
      $ngx_conf_tpl->setVar('use_socket', $use_socket);
      $ngx_conf_tpl->setVar('fpm_socket', $fpm_socket);
      $ngx_conf_tpl->setVar($vhost_data);
      $nginx_directives_new = $ngx_conf_tpl->grab();
      if(is_file($ngx_conf_tpl_tmp_file)) unlink($ngx_conf_tpl_tmp_file);
      if($nginx_directives_new != '') $nginx_directives = $nginx_directives_new;
      unset($nginx_directives_new);
      if(trim($nginx_directives) != '') {
         $nginx_directives_new = '';
         $ngx_conf_tpl = new tpl();
         $ngx_conf_tpl_tmp_file = tempnam($conf['temppath'], "ngx");
         file_put_contents($ngx_conf_tpl_tmp_file, $nginx_directives);
         $ngx_conf_tpl->newTemplate($ngx_conf_tpl_tmp_file);
         $ngx_conf_tpl->setVar('use_tcp', $use_tcp);
         $ngx_conf_tpl->setVar('use_socket', $use_socket);
         $ngx_conf_tpl->setVar('fpm_socket', $fpm_socket);
         $ngx_conf_tpl->setVar($vhost_data);
         $nginx_directives_new = $ngx_conf_tpl->grab();
         if(is_file($ngx_conf_tpl_tmp_file)) unlink($ngx_conf_tpl_tmp_file);
         if($nginx_directives_new != '') $nginx_directives = $nginx_directives_new;
         unset($nginx_directives_new);
      }
      
      // Make sure we only have Unix linebreaks
      $nginx_directives = str_replace("\r\n", "\n", $nginx_directives);