Till Brehm
2014-12-11 6935aa30cb402e25335ba730ee5657f6020c7cc5
Merge branch 'master' of git.ispconfig.org:ispconfig/ispconfig3
5 files added
36 files modified
392 ■■■■ changed files
install/sql/incremental/upd_0079.sql 2 ●●●●● patch | view | raw | blame | history
install/sql/ispconfig3.sql 2 ●●●●● patch | view | raw | blame | history
interface/lib/classes/plugin_directive_snippets.inc.php 72 ●●●●● patch | view | raw | blame | history
interface/lib/lang/en.lng 2 ●●● patch | view | raw | blame | history
interface/web/admin/form/directive_snippets.tform.php 6 ●●●●● patch | view | raw | blame | history
interface/web/admin/form/server_config.tform.php 2 ●●● patch | view | raw | blame | history
interface/web/admin/form/users.tform.php 13 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/de_directive_snippets.lng 1 ●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/de_server_config.lng 6 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/de_users.lng 1 ●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/en_directive_snippets.lng 1 ●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/en_server_config.lng 5 ●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/en_users.lng 1 ●●●● patch | view | raw | blame | history
interface/web/admin/templates/directive_snippets_edit.htm 17 ●●●●● patch | view | raw | blame | history
interface/web/admin/templates/server_config_web_edit.htm 2 ●●● patch | view | raw | blame | history
interface/web/admin/templates/users_user_edit.htm 8 ●●●● patch | view | raw | blame | history
interface/web/client/lib/lang/de_client.lng 25 ●●●●● patch | view | raw | blame | history
interface/web/client/lib/lang/en_client.lng 24 ●●●● patch | view | raw | blame | history
interface/web/client/templates/client_edit_limits.htm 4 ●●●● patch | view | raw | blame | history
interface/web/dns/dns_soa_edit.php 6 ●●●● patch | view | raw | blame | history
interface/web/js/scrigo.js.php 4 ●●●● patch | view | raw | blame | history
interface/web/login/lib/lang/de.lng 1 ●●●● patch | view | raw | blame | history
interface/web/login/lib/lang/en.lng 3 ●●●● patch | view | raw | blame | history
interface/web/login/password_reset.php 75 ●●●● patch | view | raw | blame | history
interface/web/sites/ajax_get_json.php 11 ●●●●● patch | view | raw | blame | history
interface/web/sites/form/web_vhost_domain.tform.php 8 ●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/de_web_directive_snippets.lng 3 ●●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/de_web_vhost_domain.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_web_directive_snippets.lng 3 ●●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_web_vhost_domain.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/sites/templates/web_directive_snippets.htm 14 ●●●●● patch | view | raw | blame | history
interface/web/sites/templates/web_vhost_domain_edit.htm 23 ●●●●● patch | view | raw | blame | history
interface/web/sites/web_vhost_domain_edit.php 6 ●●●● patch | view | raw | blame | history
interface/web/themes/default/templates/main.tpl.htm 4 ●●●● patch | view | raw | blame | history
server/conf/php-cgi-starter.master 4 ●●●● patch | view | raw | blame | history
server/conf/php-fcgi-starter.master 3 ●●●●● patch | view | raw | blame | history
server/conf/php_fpm_pool.conf.master 4 ●●●● patch | view | raw | blame | history
server/conf/vhost.conf.master 3 ●●●●● patch | view | raw | blame | history
server/lib/classes/db_mysql.inc.php 2 ●●● patch | view | raw | blame | history
server/plugins-available/apache2_plugin.inc.php 6 ●●●●● patch | view | raw | blame | history
server/plugins-available/nginx_plugin.inc.php 11 ●●●●● patch | view | raw | blame | history
install/sql/incremental/upd_0079.sql
New file
@@ -0,0 +1,2 @@
ALTER TABLE `directive_snippets` ADD `customer_viewable` ENUM('n','y') NOT NULL DEFAULT 'n' AFTER `snippet`;
ALTER TABLE `web_domain` ADD `directive_snippets_id` int(11) unsigned NOT NULL default '0';
install/sql/ispconfig3.sql
@@ -429,6 +429,7 @@
  `name` varchar(255) DEFAULT NULL,
  `type` varchar(255) DEFAULT NULL,
  `snippet` mediumtext,
  `customer_viewable` ENUM('n','y') NOT NULL DEFAULT 'n',
  `active` enum('n','y') NOT NULL DEFAULT 'y',
  PRIMARY KEY (`directive_snippets_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
@@ -1880,6 +1881,7 @@
  `rewrite_rules` mediumtext,
  `added_date` date NOT NULL DEFAULT '0000-00-00',
  `added_by` varchar(255) DEFAULT NULL,
  `directive_snippets_id` int(11) unsigned NOT NULL default '0',
  PRIMARY KEY  (`domain_id`),
  UNIQUE KEY `serverdomain` (  `server_id` , `ip_address`,  `domain` )
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
interface/lib/classes/plugin_directive_snippets.inc.php
New file
@@ -0,0 +1,72 @@
<?php
class plugin_directive_snippets extends plugin_base
{
    var $module;
    var $form;
    var $tab;
    var $record_id;
    var $formdef;
    var $options;
    public function onShow()
    {
        global $app;
        $listTpl = new tpl;
        $listTpl->newTemplate('templates/web_directive_snippets.htm');
        //* Loading language file
        $lng_file = "lib/lang/".$_SESSION["s"]["language"]."_web_directive_snippets.lng";
        include $lng_file;
        $listTpl->setVar($wb);
        $message = '';
        $error   = '';
        $server_type = $app->getconf->get_server_config($this->form->dataRecord['server_id'], 'web');
        $server_type = $server_type['server_type'];
        $records = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND type = ? ORDER BY name ASC", $server_type);
        for ($i = 0, $c = count($records); $i < $c; $i++)
        {
            $records[$i]['is_selected'] = false;
            if ($this->form->dataRecord['directive_snippets_id'] === $records[$i]['directive_snippets_id'])
                $records[$i]['is_selected'] = true;
        }
        $listTpl->setLoop('records', $records);
        $list_name = 'directive_snippets_list';
        $_SESSION["s"]["list"][$list_name]["parent_id"] = $this->form->id;
        $_SESSION["s"]["list"][$list_name]["parent_name"] = $app->tform->formDef["name"];
        $_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
        $_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
        $_SESSION["s"]["form"]["return_to"] = $list_name;
        return $listTpl->grab();
    }
    public function onUpdate()
    {
        global $app, $conf;
        if (isset($this->form->dataRecord['directive_snippets_id']) && $this->form->oldDataRecord['directive_snippets_id'] !== $this->form->dataRecord['directive_snippets_id']) {
            $app->db->query('UPDATE web_domain SET directive_snippets_id = ? WHERE domain_id = ?', $this->form->dataRecord['directive_snippets_id'], $this->form->id);
        }
    }
    public function onInsert()
    {
        global $app, $conf;
        if (isset($this->form->dataRecord['directive_snippets_id'])) {
            $app->db->query('UPDATE web_domain SET directive_snippets_id = ? WHERE domain_id = ?', $this->form->dataRecord['directive_snippets_id'], $this->form->id);
        }
    }
}
?>
interface/lib/lang/en.lng
@@ -26,7 +26,7 @@
$wb['filter_txt'] = "Filter";
$wb['add_new_record_txt'] = "Add new record";
$wb['btn_save_txt'] = "Save";
$wb['btn_cancel_txt'] = "Back";
$wb['btn_cancel_txt'] = "Cancel";
$wb['top_menu_system'] = 'System';
$wb['top_menu_client'] = 'Client';
$wb['top_menu_email'] = 'Email';
interface/web/admin/form/directive_snippets.tform.php
@@ -93,6 +93,12 @@
            'maxlength' => '255',
            'searchable' => 2
        ),
        'customer_viewable' => array (
            'datatype' => 'VARCHAR',
            'formtype' => 'CHECKBOX',
            'default' => 'n',
            'value'  => array(0 => 'n', 1 => 'y')
        ),
        'active' => array (
            'datatype' => 'VARCHAR',
            'formtype' => 'CHECKBOX',
interface/web/admin/form/server_config.tform.php
@@ -993,7 +993,7 @@
            'datatype' => 'VARCHAR',
            'formtype' => 'SELECT',
            'default' => 'fast-cgi',
            'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM'),
            'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM'),
            'searchable' => 2
        ),
        'nginx_cgi_socket' => array(
interface/web/admin/form/users.tform.php
@@ -260,6 +260,19 @@
            'maxlength' => '2',
            'rows'  => '',
            'cols'  => ''
        ),
        'lost_password_function' => array (
            'datatype' => 'INTEGER',
            'formtype' => 'CHECKBOX',
            'regex'  => '',
            'errmsg' => '',
            'default' => 1,
            'value'  => array(0 => 0, 1 => 1),
            'separator' => '',
            'width'  => '30',
            'maxlength' => '255',
            'rows'  => '',
            'cols'  => ''
        )
        //#################################
        // ENDE Datenbankfelder
interface/web/admin/lib/lang/de_directive_snippets.lng
@@ -7,4 +7,5 @@
$wb['directive_snippets_name_empty'] = 'Bitte geben Sie einen Namen für den Schnipsel an.';
$wb['directive_snippets_name_error_unique'] = 'Es existiert schon ein Direktiven-Schnipsel mit diesem Namen.';
$wb['variables_txt'] = 'Variablen';
$wb['customer_viewable_txt'] = 'Sichtbar für Kunden';
?>
interface/web/admin/lib/lang/de_server_config.lng
@@ -256,4 +256,10 @@
$wb['crontab_dir_error_regex'] = 'Invalid crontab directory.';
$wb['cron_wget_error_regex'] = 'Invalid cron wget path.';
$wb['network_filesystem_txt'] = 'Netzwerk-Dateisystem';
$wb['overquota_db_notify_admin_txt'] = 'Datenbank-Quota-Warnungen an den Administrator senden';
$wb['overquota_db_notify_client_txt'] = 'Datenbank-Quota-Warnungen an den Kunden senden';
$wb['php_ini_check_minutes_txt'] = 'Prüfe php.ini alle X Minuten auf Änderungen';
$wb['php_ini_check_minutes_error_empty'] = 'Bitte geben Sie einen Wert an, wie oft die php.ini auf Änderungen geprüft werden soll.';
$wb['php_ini_check_minutes_info_txt'] = '0 = keine Prüfung';
$wb['php_handler_txt'] = 'Standard-PHP-Handler';
?>
interface/web/admin/lib/lang/de_users.lng
@@ -31,4 +31,5 @@
$wb['password_match_txt'] = 'Die Passwörter stimmen überein.';
$wb['username_error_collision'] = 'Der Benutzername darf nicht <b>web<b> oder <b>web<b> gefolgt von einer Zahl sein.';
$wb['client_not_admin_err'] = 'A user that belongs to a client can not be set to type: admin';
$wb['lost_password_function_txt'] = 'Passwort vergessen Funktion steht zur Verfügung';
?>
interface/web/admin/lib/lang/en_directive_snippets.lng
@@ -7,4 +7,5 @@
$wb["directive_snippets_name_empty"] = 'Please specify a name for the snippet.';
$wb["directive_snippets_name_error_unique"] = 'There is already a directive snippet with this name.';
$wb['variables_txt'] = 'Variables';
$wb['customer_viewable_txt'] = 'Customer viewable';
?>
interface/web/admin/lib/lang/en_server_config.lng
@@ -205,7 +205,7 @@
$wb["overquota_db_notify_admin_txt"] = 'Send DB quota warnings to admin';
$wb["overquota_db_notify_client_txt"] = 'Send DB quota warnings to client';
$wb['monitor_system_updates_txt'] = 'Check for Linux updates';
$wb['php_handler_txt'] = "PHP Handler";
$wb['php_handler_txt'] = "Default PHP Handler";
$wb['disabled_txt'] = 'Disabled';
$wb['dkim_strength_txt'] = 'DKIM strength';
$wb['monitor_system_updates_txt'] = 'Check for Linux updates';
@@ -260,4 +260,7 @@
$wb['crontab_dir_error_regex'] = 'Invalid crontab directory.';
$wb['cron_wget_error_regex'] = 'Invalid cron wget path.';
$wb['network_filesystem_txt'] = 'Network Filesystem';
$wb['php_ini_check_minutes_txt'] = 'Check php.ini every X minutes for changes';
$wb['php_ini_check_minutes_error_empty'] = 'Please specify a value how often php.ini should be checked for changes.';
$wb['php_ini_check_minutes_info_txt'] = '0 = no check';
?>
interface/web/admin/lib/lang/en_users.lng
@@ -31,4 +31,5 @@
$wb['password_match_txt'] = 'The passwords do match.';
$wb['username_error_collision'] = 'The username may not be web or web plus a number."';
$wb['client_not_admin_err'] = 'A user that belongs to a client can not be set to type: admin';
$wb['lost_password_function_txt'] = 'Forgot password function is available';
?>
interface/web/admin/templates/directive_snippets_edit.htm
@@ -19,6 +19,12 @@
                <label for="snippet">{tmpl_var name='snippet_txt'}</label>
                <textarea name="snippet" id="snippet" rows='10' cols='50' style="width:400px;">{tmpl_var name='snippet'}</textarea><span class="nginx"> &nbsp; {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>
            <div class="ctrlHolder">
                <p class="label">{tmpl_var name='customer_viewable_txt'}</p>
                <div class="multiField">
                    {tmpl_var name='customer_viewable'}
                </div>
            </div>
            <div class="ctrlHolder">
                <p class="label">{tmpl_var name='active_txt'}</p>
                <div class="multiField">
@@ -43,8 +49,19 @@
    } else {
        jQuery('.nginx:visible').hide();
    }
    if (jQuery('#type').val() != 'nginx' && jQuery('#type').val() != 'apache') {
        jQuery('#customer_viewable').closest('div.ctrlHolder:visible').hide();
    }else {
        jQuery('#customer_viewable').closest('div.ctrlHolder:hidden').show();
    }
    
    jQuery('#type').change(function(){
        if (jQuery(this).val() != 'nginx' && jQuery(this).val() != 'apache') {
            jQuery('#customer_viewable').closest('div.ctrlHolder:visible').hide();
        } else {
            jQuery('#customer_viewable').closest('div.ctrlHolder:hidden').show();
        }
        if(jQuery(this).val() == 'nginx'){
            jQuery('.nginx:hidden').show();
        } else {
interface/web/admin/templates/server_config_web_edit.htm
@@ -237,7 +237,7 @@
                </div>
                <div class="ctrlHolder">
                    <label for="php_ini_check_minutes">{tmpl_var name='php_ini_check_minutes_txt'}</label>
                    <input name="php_ini_check_minutes" id="php_ini_check_minutes" value="{tmpl_var name='php_ini_check_minutes'}" size="40" type="text" class="textInput" /> {tmpl_var name='php_ini_check_minutes_info_txt'}
                    <input name="php_ini_check_minutes" id="php_ini_check_minutes" value="{tmpl_var name='php_ini_check_minutes'}" size="40" type="text" class="textInput" /> &nbsp;{tmpl_var name='php_ini_check_minutes_info_txt'}
                </div>
                <div class="ctrlHolder">
                    <label for="php_handler">{tmpl_var name='php_handler_txt'}</label>
interface/web/admin/templates/users_user_edit.htm
@@ -60,6 +60,12 @@
                    {tmpl_var name='language'}
                </select>
            </div>
            <div class="ctrlHolder">
                <p class="label">{tmpl_var name='lost_password_function_txt'}</p>
                <div class="multiField">
                    {tmpl_var name='lost_password_function'}
                </div>
            </div>
        </fieldset>
            
        <input type="hidden" name="id" value="{tmpl_var name='id'}">
@@ -70,4 +76,4 @@
        </div>
    </div>
  
</div>
</div>
interface/web/client/lib/lang/de_client.lng
@@ -151,8 +151,29 @@
$wb['gender_txt'] = 'Anrede';
$wb['gender_m_txt'] = 'Herr';
$wb['gender_f_txt'] = 'Frau';
$wb["web_servers_txt"] = 'Webserver';
$wb["web_servers_placeholder"] = 'Webserver auswählen';
$wb['no_web_server_error'] = 'Bitte wählen Sie mind. einen Webserver aus.';
$wb['web_servers_used'] = 'Der Server, den Sie entfernen möchten, wird als Webserver verwendet. Bitte stellen Sie sicher, daß dieser Server nicht von diesem Kunden benutzt wird, bevor Sie ihn entfernen.';
$wb["dns_servers_txt"] = 'DNS-Server';
$wb["dns_servers_placeholder"] = 'DNS-Server wählen';
$wb['no_dns_server_error'] = 'Bitte wählen Sie mind. einen DNS-Server aus.';
$wb['dns_servers_used'] = 'Der Server, den Sie entfernen möchten, wird als DNS-Server verwendet. Bitte stellen Sie sicher, daß dieser Server nicht von diesem Kunden benutzt wird, bevor Sie ihn entfernen.';
$wb["db_servers_txt"] = 'Datenbank-Server';
$wb["db_servers_placeholder"] = 'Datenbank-Server wählen';
$wb['no_db_server_error'] = 'Bitte wählen Sie mind. einen Datenbank-Server aus.';
$wb['db_servers_used'] = 'Der Server, den Sie entfernen möchten, wird als Datenbank-Server verwendet. Bitte stellen Sie sicher, daß dieser Server nicht von diesem Kunden benutzt wird, bevor Sie ihn entfernen.';
$wb["mail_servers_txt"] = 'Mailserver';
$wb["mail_servers_placeholder"] = 'Mailserver wählen';
$wb['no_mail_server_error'] = 'Bitte wählen Sie mind. einen Mailserver aus.';
$wb['mail_servers_used'] = 'Der Server, den Sie entfernen möchten, wird als Mailserver verwendet. Bitte stellen Sie sicher, daß dieser Server nicht von diesem Kunden benutzt wird, bevor Sie ihn entfernen.';
$wb['added_by_txt'] = 'Added by';
$wb['added_date_txt'] = 'Added date';
$wb['parent_client_id_txt'] = 'Client of reseller';
$wb['none_txt'] = 'none';
$wb['parent_client_id_txt'] = 'Kunde von Reseller';
$wb['none_txt'] = 'keiner';
$wb['limit_database_quota_txt'] = 'Datenbank-Quota';
$wb['limit_database_quota_error_notint'] = 'Das Datenbank-quota muß eine Nummer sein.';
$wb['reseller_txt'] = 'Reseller';
$wb['btn_save_txt'] = 'Speichern';
$wb['btn_cancel_txt'] = 'Abbrechen';
?>
interface/web/client/lib/lang/en_client.lng
@@ -155,21 +155,21 @@
$wb['gender_m_txt'] = 'Mr.';
$wb['gender_f_txt'] = 'Ms.';
$wb["web_servers_txt"] = 'Webservers';
$wb["web_servers_placeholder"] = 'Select Webservers';
$wb["web_servers_placeholder"] = 'Select webservers';
$wb['no_web_server_error'] = 'At least one webserver must be selected.';
$wb['web_servers_used'] = 'The server you are trying to remove from this client is used as a webserver. Be sure that this server is not used by this client before to remove it.';
$wb["dns_servers_txt"] = 'DNS Server';
$wb["dns_servers_placeholder"] = 'Select DNS Servers';
$wb['web_servers_used'] = 'The server you are trying to remove from this client is used as a webserver. Be sure that this server is not used by this client before you remove it.';
$wb["dns_servers_txt"] = 'DNS servers';
$wb["dns_servers_placeholder"] = 'Select DNS servers';
$wb['no_dns_server_error'] = 'At least one DNS server must be selected.';
$wb['dns_servers_used'] = 'The server you are trying to remove from this client is used as a DNS server. Be sure that this server is not used by this client before to remove it.';
$wb["db_servers_txt"] = 'Database Server';
$wb["db_servers_placeholder"] = 'Select Database Servers';
$wb['dns_servers_used'] = 'The server you are trying to remove from this client is used as a DNS server. Be sure that this server is not used by this client before you remove it.';
$wb["db_servers_txt"] = 'Database servers';
$wb["db_servers_placeholder"] = 'Select database servers';
$wb['no_db_server_error'] = 'At least one Database server must be selected.';
$wb['db_servers_used'] = 'The server you are trying to remove from this client is used as a Database server. Be sure that this server is not used by this client before to remove it.';
$wb['db_servers_used'] = 'The server you are trying to remove from this client is used as a Database server. Be sure that this server is not used by this client before you remove it.';
$wb["mail_servers_txt"] = 'Mailservers';
$wb["mail_servers_placeholder"] = 'Select Mailservers';
$wb['no_mail_server_error'] = 'At least one Mailserver must be selected.';
$wb['mail_servers_used'] = 'The server you are trying to remove from this client is used as a Mailserver. Be sure that this server is not used by this client before to remove it.';
$wb["mail_servers_placeholder"] = 'Select mailservers';
$wb['no_mail_server_error'] = 'At least one mailserver must be selected.';
$wb['mail_servers_used'] = 'The server you are trying to remove from this client is used as a Mailserver. Be sure that this server is not used by this client before you remove it.';
$wb['added_by_txt'] = 'Added by';
$wb['added_date_txt'] = 'Added date';
$wb['parent_client_id_txt'] = 'Client of reseller';
@@ -177,4 +177,6 @@
$wb['limit_database_quota_txt'] = 'Database quota';
$wb['limit_database_quota_error_notint'] = 'The database quota limit must be a number.';
$wb['reseller_txt'] = 'Reseller';
$wb['btn_save_txt'] = "Save";
$wb['btn_cancel_txt'] = "Cancel";
?>
interface/web/client/templates/client_edit_limits.htm
@@ -326,10 +326,6 @@
    return ($('#template_master').val() == '0' ? true : false);
}
$('.subsectiontoggle').on("click", function(){
    $(this).children().toggleClass('showing').end().next().slideToggle();
});
$('#template_additional_list').find('li > a').click(function(e) {
    e.preventDefault();
    delAdditionalTemplate($(this).parent().attr('rel'));
interface/web/dns/dns_soa_edit.php
@@ -283,7 +283,11 @@
    if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
        //* We do not allow users to change a domain which has been created by the admin
        $rec = $app->db->queryOneRecord("SELECT origin from dns_soa WHERE id = ".$this->id);
        if(isset($this->dataRecord["origin"]) && $rec['origin'] != $this->dataRecord["origin"] && $app->tform->checkPerm($this->id, 'u')) {
        $drOrigin = (isset($this->dataRecord['origin']))
            ? $app->functions->idn_encode($this->dataRecord['origin'])
            : false;
        if($rec['origin'] !== $drOrigin && $app->tform->checkPerm($this->id, 'u')) {
            //* Add a error message and switch back to old server
            $app->tform->errorMessage .= $app->lng('The Zone (soa) can not be changed. Please ask your Administrator if you want to change the Zone name.');
            $this->dataRecord["origin"] = $rec['origin'];
interface/web/js/scrigo.js.php
@@ -854,13 +854,13 @@
    return Math.floor(Math.random() * (max - min + 1)) + min;
}
jQuery('.addPlaceholder').on("click", function(){
jQuery(document).on("click", ".addPlaceholder", function(){
    var placeholderText = jQuery(this).text();
    var template = jQuery(this).siblings(':input');
    template.insertAtCaret(placeholderText);
});
jQuery('.addPlaceholderContent').on("click", function(){
jQuery(document).on("click", ".addPlaceholderContent", function(){
    var placeholderContentText = jQuery(this).find('.addPlaceholderContent').text();
    var template2 = jQuery(this).siblings(':input');
    template2.insertAtCaret(placeholderContentText);
interface/web/login/lib/lang/de.lng
@@ -24,4 +24,5 @@
$wb['back_txt'] = 'Zur&uuml;ck';
$wb['stay_logged_in_txt'] = 'Dauerhaft eingeloggt bleiben';
$wb['email_error'] = 'Email contains unallowed characters or has a invalid format.';
$wb['lost_password_function_disabled_txt'] = 'Die Passwort vergessen Funktion steht für diesen Benutzer nicht zur Verfügung.';
?>
interface/web/login/lib/lang/en.lng
@@ -24,4 +24,5 @@
$wb['error_maintenance_mode'] = 'This ISPConfig installation is currently under maintenance. We should be back shortly. Thank you for your patience.';
$wb['theme_not_compatible'] = 'The chosen theme is not compatible with the current ISPConfig version. Please check for a new version of the theme.<br />The default theme as been activated automatically.';
$wb['stay_logged_in_txt'] = 'Keep me logged in';
?>
$wb['lost_password_function_disabled_txt'] = 'The lost password function is not available for this user.';
?>
interface/web/login/password_reset.php
@@ -7,14 +7,14 @@
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.
    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -26,7 +26,7 @@
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 */
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
@@ -54,36 +54,39 @@
    $username = $app->db->quote($_POST['username']);
    $email = $app->db->quote($_POST['email']);
    $client = $app->db->queryOneRecord("SELECT * FROM client WHERE username = '$username' AND email = '$email'");
    $client = $app->db->queryOneRecord("SELECT client.*, sys_user.lost_password_function FROM client,sys_user WHERE client.username = ? AND client.email = ? AND client.client_id = sys_user.client_id", $username, $email);
    if($client['client_id'] > 0) {
        $new_password = $app->auth->get_random_password();
        $new_password_encrypted = $app->auth->crypt_password($new_password);
        $new_password_encrypted = $app->db->quote($new_password_encrypted);
        $username = $app->db->quote($client['username']);
        $app->db->query("UPDATE sys_user SET passwort = '$new_password_encrypted' WHERE username = '$username'");
        $app->db->query("UPDATE client SET password = '$new_password_encrypted' WHERE username = '$username'");
        $app->tpl->setVar("message", $wb['pw_reset']);
        $app->uses('getconf,ispcmail');
        $mail_config = $app->getconf->get_global_config('mail');
        if($mail_config['smtp_enabled'] == 'y') {
            $mail_config['use_smtp'] = true;
            $app->ispcmail->setOptions($mail_config);
        }
        $app->ispcmail->setSender($mail_config['admin_mail'], $mail_config['admin_name']);
        $app->ispcmail->setSubject($wb['pw_reset_mail_title']);
        $app->ispcmail->setMailText($wb['pw_reset_mail_msg'].$new_password);
        $app->ispcmail->send(array($client['contact_name'] => $client['email']));
        $app->ispcmail->finish();
        $app->plugin->raiseEvent('password_reset', true);
        $app->tpl->setVar("msg", $wb['pw_reset']);
    if($client['lost_password_function'] == 0) {
        $app->tpl->setVar("error", $wb['lost_password_function_disabled_txt']);
    } else {
        $app->tpl->setVar("error", $wb['pw_error']);
    }
        if($client['client_id'] > 0) {
            $new_password = $app->auth->get_random_password();
            $new_password_encrypted = $app->auth->crypt_password($new_password);
            $new_password_encrypted = $app->db->quote($new_password_encrypted);
            $username = $app->db->quote($client['username']);
            $app->db->query("UPDATE sys_user SET passwort = '$new_password_encrypted' WHERE username = '$username'");
            $app->db->query("UPDATE client SET password = '$new_password_encrypted' WHERE username = '$username'");
            $app->tpl->setVar("message", $wb['pw_reset']);
            $app->uses('getconf,ispcmail');
            $mail_config = $app->getconf->get_global_config('mail');
            if($mail_config['smtp_enabled'] == 'y') {
                $mail_config['use_smtp'] = true;
                $app->ispcmail->setOptions($mail_config);
            }
            $app->ispcmail->setSender($mail_config['admin_mail'], $mail_config['admin_name']);
            $app->ispcmail->setSubject($wb['pw_reset_mail_title']);
            $app->ispcmail->setMailText($wb['pw_reset_mail_msg'].$new_password);
            $app->ispcmail->send(array($client['contact_name'] => $client['email']));
            $app->ispcmail->finish();
            $app->plugin->raiseEvent('password_reset', true);
            $app->tpl->setVar("msg", $wb['pw_reset']);
        } else {
            $app->tpl->setVar("error", $wb['pw_error']);
        }
    }
} else {
    $app->tpl->setVar("msg", $wb['pw_error_noinput']);
}
interface/web/sites/ajax_get_json.php
@@ -190,6 +190,17 @@
    $json .= '"}';
}
if ($type == 'getdirectivesnippet') {
    $server_type = 'apache';
    $web_config = $app->getconf->get_server_config($server_id, 'web');
    if (!empty($web_config['server_type']))
        $server_type = $web_config['server_type'];
    $snippets = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND type = ? ORDER BY name ASC", $server_type);
    $json = json_encode($snippets);
}
//}
header('Content-type: application/json');
interface/web/sites/form/web_vhost_domain.tform.php
@@ -282,7 +282,13 @@
        //#################################
        // ENDE Datatable fields
        //#################################
    )
    ),
    'plugins' => array (
        // needs serverId for web.server_type
        'directive_snippets_id' => array (
            'class' => 'plugin_directive_snippets'
        ),
     )
);
// add type-specific field attributes
interface/web/sites/lib/lang/de_web_directive_snippets.lng
New file
@@ -0,0 +1,3 @@
<?php
$wb['directive_snippets_id_txt'] = 'Gewünschte Konfiguration';
?>
interface/web/sites/lib/lang/de_web_vhost_domain.lng
@@ -134,4 +134,6 @@
$wb['invalid_custom_php_ini_settings_txt'] = 'Unzulässige php.ini-Einstellungen';
$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
$wb['apache_directive_blocked_error'] = 'Die Apache Direktive wurde durch die Sicherheitsrichtline blockiert:';
$wb['btn_save_txt'] = 'Speichern';
$wb['btn_cancel_txt'] = 'Abbrechen';
?>
interface/web/sites/lib/lang/en_web_directive_snippets.lng
New file
@@ -0,0 +1,3 @@
<?php
$wb['directive_snippets_id_txt'] = 'Desired configuration';
?>
interface/web/sites/lib/lang/en_web_vhost_domain.lng
@@ -137,4 +137,6 @@
$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
$wb['subdomain_error_empty'] = 'The subdommain field is empty or contains invalid characters.';
$wb['btn_save_txt'] = "Save";
$wb['btn_cancel_txt'] = "Cancel";
?>
interface/web/sites/templates/web_directive_snippets.htm
New file
@@ -0,0 +1,14 @@
<div class="ctrlHolder">
    <label for="directive_snippets_id">
        {tmpl_var name='directive_snippets_id_txt'}
    </label>
    <select name="directive_snippets_id" id="directive_snippets_id" class="selectInput formLengthHalf">
        <option value="0"></option>
        <tmpl_loop name="records">
        <option {tmpl_if name='is_selected' op='==' value='true'}selected="selected" {/tmpl_if}value="{tmpl_var name='directive_snippets_id'}">
            {tmpl_var name='name'}
        </option>
        </tmpl_loop>
    </select>
</div>
interface/web/sites/templates/web_vhost_domain_edit.htm
@@ -219,6 +219,7 @@
                    {tmpl_var name='fastcgi_php_version'}
                </select>
            </div>
            {tmpl_var name="directive_snippets_id"}
            <div class="ctrlHolder">
                <p class="label">{tmpl_var name='active_txt'}</p>
                <div class="multiField">
@@ -249,6 +250,7 @@
            adjustForm();
            reloadWebIP();
            reloadFastcgiPHPVersions();
            reloadDirectiveSnippets();
        });
    }
    adjustForm(true);
@@ -316,6 +318,23 @@
            }
        });
    }
    function reloadDirectiveSnippets() {
        jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getdirectivesnippet"}, function(data) {
            var options = '<option value="0"></option>';
            for (var i = 0, len = data.length; i < len; i++) {
                var isSelected = '';
                 if ($('#directive_snippets_id').val() == i + 1) {
                     isSelected = 'selected="selected"';
                 }
                 options += '<option ' + isSelected + ' value="' + data[i]['directive_snippets_id'] + '">' + data[i]['name'] + '</option>';
            }
            $('#directive_snippets_id').html(options).change();
        });
    }
        
    function reloadWebIP() {
        loadOptionInto('ip_address','sites/ajax_get_ip.php?ip_type=IPv4&server_id='+serverId+'&client_group_id='+clientGroupId);
@@ -340,9 +359,9 @@
    }
    
    <tmpl_if name="readonly_tab">
        jQuery('div.panel_web_domain').find('fieldset').find('input,select,button').bind('click mousedown', function(e) { e.preventDefault(); }).focus(function() { $(this).blur(); });
        jQuery('div.panel_web_domain').find('fieldset').find('input,select,button').not('#directive_snippets_id').bind('click mousedown', function(e) { e.preventDefault(); }).focus(function() { $(this).blur(); });
        jQuery('#dom-edit-submit').click(function() {
               submitForm('pageForm','sites/web_vhost_domain_edit.php');
            submitForm('pageForm','sites/web_vhost_domain_edit.php');
        });
    <tmpl_else>
        jQuery('#dom-edit-submit').click(function() {
interface/web/sites/web_vhost_domain_edit.php
@@ -121,6 +121,10 @@
            $server_id = intval($settings['default_webserver']);
            $app->tform->formDef['tabs']['domain']['fields']['server_id']['default'] = $server_id;
        }
        if(!$server_id){
            $default_web_server = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = ? ORDER BY server_id LIMIT 0,1", 1);
            $server_id = $default_web_server['server_id'];
        }
        $web_config = $app->getconf->get_server_config($server_id, 'web');
        $app->tform->formDef['tabs']['domain']['fields']['php']['default'] = $web_config['php_handler'];
        $app->tform->formDef['tabs']['domain']['readonly'] = false;
@@ -187,7 +191,7 @@
            if($app->functions->intval($this->dataRecord["server_id"]) > 0) {
                // check if server is in client's servers or add it.
                $chk_sid = explode(',', $client['web_servers']);
                if(in_array($this->dataRecord["server_id"], $client['web_servers']) == false) {
                if(in_array($this->dataRecord["server_id"], explode(',', $client['web_servers'])) == false) {
                    if($client['web_servers'] != '') $client['web_servers'] .= ',';
                    $client['web_servers'] .= $app->functions->intval($this->dataRecord["server_id"]);
                }
interface/web/themes/default/templates/main.tpl.htm
@@ -37,6 +37,10 @@
                        e.preventDefault();
                    }
                });
                jQuery(document).on("click", ".subsectiontoggle", function(){
                    jQuery(this).children().toggleClass('showing').end().next().slideToggle();
                });
                
                $('#globalsearch').ispconfigSearch({
                    dataSrc: '/dashboard/ajax_get_json.php?type=globalsearch',
server/conf/php-cgi-starter.master
@@ -4,6 +4,10 @@
export PHPRC="<tmpl_var name='php_ini_path'>"
</tmpl_if>
export TMP=<tmpl_var name='document_root'>/tmp
export TMPDIR=<tmpl_var name='document_root'>/tmp
export TEMP=<tmpl_var name='document_root'>/tmp
exec <tmpl_var name='php_cgi_bin'> \
-d open_basedir=<tmpl_var name='open_basedir'> \
-d upload_tmp_dir=<tmpl_var name='document_root'>/tmp \
server/conf/php-fcgi-starter.master
@@ -9,6 +9,9 @@
# export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=<tmpl_var name='php_fcgi_max_requests'>
export PHP_FCGI_MAX_REQUESTS
export TMP=<tmpl_var name='document_root'>/tmp
export TMPDIR=<tmpl_var name='document_root'>/tmp
export TEMP=<tmpl_var name='document_root'>/tmp
exec <tmpl_var name='php_fcgi_bin'> \
<tmpl_if name="security_level" op="==" value="20"> -d open_basedir="<tmpl_var name='open_basedir'>" \
-d disable_functions="" \
server/conf/php_fpm_pool.conf.master
@@ -28,6 +28,10 @@
chdir = /
env[TMP] = <tmpl_var name='document_root'>/tmp
env[TMPDIR] = <tmpl_var name='document_root'>/tmp
env[TEMP] = <tmpl_var name='document_root'>/tmp
<tmpl_if name='security_level' op='==' value='20'>
<tmpl_var name='enable_php_open_basedir'>php_admin_value[open_basedir] = <tmpl_var name='php_open_basedir'>
php_admin_value[session.save_path] = <tmpl_var name='document_root'>/tmp
server/conf/vhost.conf.master
@@ -204,6 +204,9 @@
<tmpl_if name='php' op='==' value='mod'>
        # mod_php enabled
        AddType application/x-httpd-php .php .php3 .php4 .php5
        SetEnv TMP <tmpl_var name='document_root'>/tmp
        SetEnv TMPDIR <tmpl_var name='document_root'>/tmp
        SetEnv TEMP <tmpl_var name='document_root'>/tmp
        php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -fwebmaster@<tmpl_var name='domain'>"
        php_admin_value upload_tmp_dir <tmpl_var name='document_root'>/tmp
        php_admin_value session.save_path <tmpl_var name='document_root'>/tmp
server/lib/classes/db_mysql.inc.php
@@ -176,7 +176,7 @@
    private function _query($sQuery = '') {
        global $app;
        if($this->isConnected == false) return false;
        //if($this->isConnected == false) return false;
        if ($sQuery == '') {
            $this->_sqlerror('Keine Anfrage angegeben / No query given');
            return false;
server/plugins-available/apache2_plugin.inc.php
@@ -1030,6 +1030,12 @@
        $vhost_data['custom_php_ini_dir'] = escapeshellcmd($custom_php_ini_dir);
        // Custom Apache directives
        if(intval($data['new']['directive_snippets_id']) > 0){
            $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'apache' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id']));
            if(isset($snippet['snippet'])){
                $vhost_data['apache_directives'] = $snippet['snippet'];
            }
        }
        // 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']);
server/plugins-available/nginx_plugin.inc.php
@@ -1089,7 +1089,16 @@
        // Custom nginx directives
        $final_nginx_directives = array();
        $nginx_directives = $data['new']['nginx_directives'];
        if(intval($data['new']['directive_snippets_id']) > 0){
            $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'nginx' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id']));
            if(isset($snippet['snippet'])){
                $nginx_directives = $snippet['snippet'];
            } else {
                $nginx_directives = $data['new']['nginx_directives'];
            }
        } else {
            $nginx_directives = $data['new']['nginx_directives'];
        }
        // Make sure we only have Unix linebreaks
        $nginx_directives = str_replace("\r\n", "\n", $nginx_directives);
        $nginx_directives = str_replace("\r", "\n", $nginx_directives);