- added {DOCROOT_CLIENT} to directive placeholders (non-symlink docroot)
- made placeholders visible for apache, too
- added event raise at formdef loading (on_before_formdef and on_after_formdef)
- added possibility to put plugin files into module/lib/plugin.d/ directory
| | |
| | | |
| | | if(isset($_SESSION['s']['plugin_cache'])) unset($_SESSION['s']['plugin_cache']); |
| | | |
| | | $plugins_dir = ISPC_LIB_PATH.FS_DIV.'plugins'.FS_DIV; |
| | | $plugin_dirs = array(); |
| | | $plugin_dirs[] = ISPC_LIB_PATH.FS_DIV.'plugins'.FS_DIV; |
| | | |
| | | if(is_dir(ISPC_WEB_PATH)) { |
| | | if($dh = opendir(ISPC_WEB_PATH)) { |
| | | while(($file = readdir($dh)) !== false) { |
| | | if($file !== '.' && $file !== '..' && is_dir($file) && is_dir(ISPC_WEB_PATH . '/' . $file . '/lib/plugin.d')) $plugin_dirs[] = ISPC_WEB_PATH . '/' . $file . '/lib/plugin.d'; |
| | | } |
| | | closedir($dh); |
| | | } |
| | | } |
| | | |
| | | $_SESSION['s']['plugin_cache'] = array(); |
| | | $tmp_plugins = array(); |
| | | |
| | | for($d = 0; $d < count($plugin_dirs); $d++) { |
| | | $plugins_dir = $plugin_dirs[$d]; |
| | | if (is_dir($plugins_dir)) { |
| | | if ($dh = opendir($plugins_dir)) { |
| | | //** Go trough all files in the plugin dir |
| | | while (($file = readdir($dh)) !== false) { |
| | | if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') { |
| | | if($file !== '.' && $file !== '..' && substr($file, -8, 8) == '.inc.php') { |
| | | $plugin_name = substr($file, 0, -8); |
| | | $tmp_plugins[$plugin_name] = $file; |
| | | } |
| | | } |
| | | closedir($dh); |
| | | //** sort the plugins by name |
| | | ksort($tmp_plugins); |
| | | |
| | |
| | | } else { |
| | | $app->log('Plugins directory missing: '.$plugins_dir, LOGLEVEL_ERROR); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | $app->load($plugin_class); |
| | | $this->plugins[$plugin_name] = new $plugin_class; |
| | | $this->plugins[$plugin_name]->setOptions($plugin_name, $plugin_settings['options']); |
| | | // Make the data of the form easily accessible for the plugib |
| | | // Make the data of the form easily accessible for the plugin |
| | | $this->plugins[$plugin_name]->form = $this; |
| | | $this->plugins[$plugin_name]->onLoad(); |
| | | } |
| | |
| | | function loadFormDef($file, $module = '') { |
| | | global $app, $conf; |
| | | |
| | | $app->plugin->raiseEvent('on_before_formdef', $module); |
| | | include $file; |
| | | $this->formDef = $form; |
| | | |
| | |
| | | } |
| | | if(isset($wb_global)) unset($wb_global); |
| | | |
| | | $app->plugin->raiseEvent('on_after_formdef', $module); |
| | | |
| | | $this->wordbook = $wb; |
| | | |
| | | $this->dateformat = $app->lng('conf_format_dateshort'); |
| | |
| | | </div> |
| | | <div class="form-group"> |
| | | <label for="snippet" class="col-sm-3 control-label">{tmpl_var name='snippet_txt'}</label> |
| | | <div class="col-sm-9"><textarea class="form-control" name="snippet" id="snippet" rows='10' cols='50'>{tmpl_var name='snippet'}</textarea></div><span class="nginx"> {tmpl_var name='variables_txt'}: </span><a href="javascript:void(0);" class="addPlaceholder nginx">{DOCROOT}</a><span class="nginx">, </span><a href="javascript:void(0);" class="addPlaceholder nginx">{FASTCGIPASS}</a> |
| | | <div class="col-sm-9"><textarea class="form-control" name="snippet" id="snippet" rows='10' cols='50'>{tmpl_var name='snippet'}</textarea></div><span> {tmpl_var name='variables_txt'}: </span><a href="javascript:void(0);" class="addPlaceholder">{DOCROOT}</a>, <a href="javascript:void(0);" class="addPlaceholder">{DOCROOT_CLIENT}</a><span class="nginx">, </span><a href="javascript:void(0);" class="addPlaceholder nginx">{FASTCGIPASS}</a> |
| | | </div> |
| | | <div class="form-group php"> |
| | | <label class="col-sm-3 control-label">{tmpl_var name='required_php_snippets_txt'}</label> |
| | |
| | | // Make sure we only have Unix linebreaks |
| | | $vhost_data['apache_directives'] = str_replace("\r\n", "\n", $vhost_data['apache_directives']); |
| | | $vhost_data['apache_directives'] = str_replace("\r", "\n", $vhost_data['apache_directives']); |
| | | $trans = array('{DOCROOT}' => $vhost_data['web_document_root_www']); |
| | | $trans = array( |
| | | '{DOCROOT}' => $vhost_data['web_document_root_www'], |
| | | '{DOCROOT_CLIENT}' => $vhost_data['web_document_root'] |
| | | ); |
| | | $vhost_data['apache_directives'] = strtr($vhost_data['apache_directives'], $trans); |
| | | |
| | | // Check if a SSL cert exists |
| | |
| | | $nginx_directives = str_replace("\r", "\n", $nginx_directives); |
| | | $nginx_directive_lines = explode("\n", $nginx_directives); |
| | | if(is_array($nginx_directive_lines) && !empty($nginx_directive_lines)){ |
| | | $trans = array('{DOCROOT}' => $vhost_data['web_document_root_www'], '{FASTCGIPASS}' => 'fastcgi_pass '.($data['new']['php_fpm_use_socket'] == 'y'? 'unix:'.$fpm_socket : '127.0.0.1:'.$vhost_data['fpm_port']).';'); |
| | | $trans = array( |
| | | '{DOCROOT}' => $vhost_data['web_document_root_www'], |
| | | '{DOCROOT_CLIENT}' => $vhost_data['web_document_root'], |
| | | '{FASTCGIPASS}' => 'fastcgi_pass '.($data['new']['php_fpm_use_socket'] == 'y'? 'unix:'.$fpm_socket : '127.0.0.1:'.$vhost_data['fpm_port']).';' |
| | | ); |
| | | foreach($nginx_directive_lines as $nginx_directive_line){ |
| | | $final_nginx_directives[] = array('nginx_directive' => strtr($nginx_directive_line, $trans)); |
| | | } |