From ad576c6ab43242fad2b7489296a05158babc08e3 Mon Sep 17 00:00:00 2001 From: Till Brehm <tbrehm@ispconfig.org> Date: Tue, 09 Feb 2016 09:08:33 -0500 Subject: [PATCH] Merge branch 'stable-3.1' of git.ispconfig.org:ispconfig/ispconfig3 into stable-3.1 --- interface/web/sites/web_vhost_domain_edit.php | 4 - security/check.php | 22 ++++--- interface/web/client/client_del.php | 2 server/lib/classes/monitor_tools.inc.php | 5 + install/update.php | 2 README.md | 10 +++ interface/web/sites/database_user_del.php | 2 interface/lib/classes/remote.d/client.inc.php | 2 server/plugins-available/apache2_plugin.inc.php | 8 +- interface/web/themes/default/assets/javascripts/ispconfig.min.js | 2 server/plugins-available/mail_plugin.inc.php | 18 +++++- server/plugins-available/nginx_plugin.inc.php | 8 +- LICENSE | 25 ++++++++ interface/web/themes/default/assets/javascripts/ispconfig.js | 31 ++++++++++ interface/web/js/scrigo.js.php | 6 ++ interface/web/sites/form/web_vhost_domain.tform.php | 8 +- 16 files changed, 120 insertions(+), 35 deletions(-) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..139b12f --- /dev/null +++ b/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2007-2016, Till Brehm, ISPConfig UG +All rights reserved. + +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. + +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 +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +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. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..4676d2b --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# ISPConfig - Hosting Control Panel + +- Manage multiple servers from one control panel +- Web server management (Apache2 and nginx) +- Mail server management (with virtual mail users) +- DNS server management (BIND and MyDNS) +- Virtualization (OpenVZ) +- Administrator, reseller and client login +- Configuration mirroring and clusters +- Open Source software (BSD license) \ No newline at end of file diff --git a/install/update.php b/install/update.php index 04c5289..504a637 100644 --- a/install/update.php +++ b/install/update.php @@ -545,7 +545,7 @@ //* Create md5 filelist $md5_filename = '/usr/local/ispconfig/security/data/file_checksums_'.date('Y-m-d_h-i').'.md5'; -exec('find /usr/local/ispconfig -type f -print0 | xargs -0 md5sum > '.$md5_filename); +exec('find /usr/local/ispconfig -type f -print0 | xargs -0 md5sum > '.$md5_filename . ' 2>/dev/null'); chmod($md5_filename,0700); echo "Update finished.\n"; diff --git a/interface/lib/classes/remote.d/client.inc.php b/interface/lib/classes/remote.d/client.inc.php index 8e1324e..c9441f5 100644 --- a/interface/lib/classes/remote.d/client.inc.php +++ b/interface/lib/classes/remote.d/client.inc.php @@ -406,7 +406,7 @@ $app->db->query("DELETE FROM sys_user WHERE client_id = ?", $client_id); //* Delete all records (sub-clients, mail, web, etc....) of this client. - $tables = 'client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic'; + $tables = 'cron,client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic,domain'; $tables_array = explode(',', $tables); $client_group_id = $app->functions->intval($client_group['groupid']); diff --git a/interface/web/client/client_del.php b/interface/web/client/client_del.php index 4344118..206082c 100644 --- a/interface/web/client/client_del.php +++ b/interface/web/client/client_del.php @@ -77,7 +77,7 @@ $client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ?", $client_id); // Get all records (sub-clients, mail, web, etc....) of this client. - $tables = 'cron,client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain'; + $tables = 'cron,client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic,domain'; $tables_array = explode(',', $tables); $client_group_id = $app->functions->intval($client_group['groupid']); diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php index 7ba19d1..a30a9ec 100644 --- a/interface/web/js/scrigo.js.php +++ b/interface/web/js/scrigo.js.php @@ -204,6 +204,12 @@ var pword = password(<?php echo $min_password_length; ?>, false, 1); jQuery('#'+repeatPasswordFieldID).val(pword); newPWField.attr('id', passwordFieldID).val(pword).trigger('keyup').select(); + newPWField.unbind('keyup').on('keyup', function(e) { + if($(this).val() != pword) { + var pos = $(this).getCursorPosition(); + $(this).attr('type', 'password').unbind('keyup').setCursorPosition(pos); + } + }); } var funcDisableClick = function(e) { e.preventDefault(); return false; }; diff --git a/interface/web/sites/database_user_del.php b/interface/web/sites/database_user_del.php index d80ba4f..379a9a1 100644 --- a/interface/web/sites/database_user_del.php +++ b/interface/web/sites/database_user_del.php @@ -55,7 +55,7 @@ $old_record = $app->tform->getDataRecord($this->id); /* we cannot use datalogDelete here, as we need to set server_id to 0 */ - $app->db->query("DELETE FROM `web_database_user` WHERE ?? = ?", $index_field, $index_value); + $app->db->query("DELETE FROM `web_database_user` WHERE `database_user_id` = ?", $this->id); $new_rec = array(); $old_record['server_id'] = 0; $app->db->datalogSave('web_database_user', 'DELETE', 'database_user_id', $this->id, $old_record, $new_rec); diff --git a/interface/web/sites/form/web_vhost_domain.tform.php b/interface/web/sites/form/web_vhost_domain.tform.php index c447b1e..894ea0c 100644 --- a/interface/web/sites/form/web_vhost_domain.tform.php +++ b/interface/web/sites/form/web_vhost_domain.tform.php @@ -447,7 +447,7 @@ 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/', + 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{0,255}))$/', 'errmsg'=> 'ssl_state_error_regex'), ), 'default' => '', @@ -459,7 +459,7 @@ 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/', + 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{0,255}))$/', 'errmsg'=> 'ssl_locality_error_regex'), ), 'default' => '', @@ -471,7 +471,7 @@ 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/', + 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{0,255}))$/', 'errmsg'=> 'ssl_organisation_error_regex'), ), 'default' => '', @@ -483,7 +483,7 @@ 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/', + 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{0,255}))$/', 'errmsg'=> 'ssl_organistaion_unit_error_regex'), ), 'default' => '', diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php index 86cc522..8bbc5e1 100644 --- a/interface/web/sites/web_vhost_domain_edit.php +++ b/interface/web/sites/web_vhost_domain_edit.php @@ -1415,10 +1415,6 @@ //* Check that all fields for the SSL cert creation are filled if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'create') { - if($this->dataRecord['ssl_state'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_state_empty').'<br />'; - if($this->dataRecord['ssl_locality'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_locality_empty').'<br />'; - if($this->dataRecord['ssl_organisation'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_empty').'<br />'; - if($this->dataRecord['ssl_organisation_unit'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_unit_empty').'<br />'; if($this->dataRecord['ssl_country'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_country_empty').'<br />'; } diff --git a/interface/web/themes/default/assets/javascripts/ispconfig.js b/interface/web/themes/default/assets/javascripts/ispconfig.js index b369b53..b9ebee4 100644 --- a/interface/web/themes/default/assets/javascripts/ispconfig.js +++ b/interface/web/themes/default/assets/javascripts/ispconfig.js @@ -747,4 +747,35 @@ e.preventDefault(); } }); + + $.fn.setCursorPosition = function(pos) { + var self = $(this).get(0); + if(self.setSelectionRange) { + self.setSelectionRange(pos, pos); + } else if(self.createTextRange) { + var range = self.createTextRange(); + range.collapse(true); + if(pos < 0) { + pos = $(this).val().length + pos; + } + range.moveEnd('character', pos); + range.moveStart('character', pos); + range.select(); + } + }; + + $.fn.getCursorPosition = function() { + var iCaretPos = 0; + var self = $(this).get(0); + + if(typeof self.selectionStart === 'number') { + iCaretPos = self.selectionDirection == 'backward' ? self.selectionStart : self.selectionEnd; + } else if(document.selection) { + this.focus(); + var oSel = document.selection.createRange(); + oSel.moveStart('character', -self.value.length); + iCaretPos = oSel.text.length; + } + return iCaretPos; + }; }); diff --git a/interface/web/themes/default/assets/javascripts/ispconfig.min.js b/interface/web/themes/default/assets/javascripts/ispconfig.min.js index 2bd1234..0df4d49 100644 --- a/interface/web/themes/default/assets/javascripts/ispconfig.min.js +++ b/interface/web/themes/default/assets/javascripts/ispconfig.min.js @@ -1 +1 @@ -var ISPConfig={pageFormChanged:false,tabChangeWarningTxt:"",tabChangeDiscardTxt:"",tabChangeWarning:false,tabChangeDiscard:false,requestsRunning:0,indicatorCompleted:false,registeredHooks:new Array(),new_tpl_add_id:0,options:{useLoadIndicator:false,useComboBox:false},setOption:function(a,b){ISPConfig.options[a]=b},setOptions:function(a){$.extend(ISPConfig.options,a)},reportError:function(a){},registerHook:function(a,c){if(!ISPConfig.registeredHooks[a]){ISPConfig.registeredHooks[a]=new Array()}var b=ISPConfig.registeredHooks[a].length;ISPConfig.registeredHooks[a][b]=c},callHook:function(a,c){if(!ISPConfig.registeredHooks[a]){return}for(var b=0;b<ISPConfig.registeredHooks[a].length;b++){var d=ISPConfig.registeredHooks[a][b];d(a,c)}},resetFormChanged:function(){ISPConfig.pageFormChanged=false},showLoadIndicator:function(){document.body.style.cursor="wait";if(ISPConfig.options.useLoadIndicator==true){ISPConfig.requestsRunning+=1;if(ISPConfig.requestsRunning<2){var a=$("#ajaxloader");if(a.length<1){a=$('<div id="ajaxloader" style="display: none;"></div>');a.appendTo("body")}var b=$("#content");if(b.length<1){return}ISPConfig.indicatorCompleted=false;var d=b.offset().left+150;var c=b.offset().top+150;a.css({left:d,top:c}).fadeIn("fast",function(){ISPConfig.indicatorCompleted=true;if(ISPConfig.requestsRunning<1){$(this).fadeOut("fast",function(){$(this).hide()})}})}}},hideLoadIndicator:function(){document.body.style.cursor="";ISPConfig.requestsRunning-=1;if(ISPConfig.requestsRunning<1){ISPConfig.requestsRunning=0;if(ISPConfig.indicatorCompleted==true){$("#ajaxloader").fadeOut("fast",function(){$("#ajaxloader").hide()})}}},onAfterSideNavLoaded:function(){if(ISPConfig.options.useComboBox==true){$("#sidebar").find("select:not(.chosen-select)").select2({placeholder:"",width:"element",selectOnBlur:true,allowClear:true})}},onAfterContentLoad:function(a,b){if(!b){b=""}else{b="&"+b}if(ISPConfig.options.useComboBox==true){$("#pageContent").find("select:not(.chosen-select)").select2({placeholder:"",width:"element",selectOnBlur:true,allowClear:true,formatResult:function(c){if(c.id&&$(c.element).parent().hasClass("flags")){return'<span class="flags flag-'+c.id.toLowerCase()+'">'+c.text+"</span>"}else{return c.text}},formatSelection:function(c){if(c.id&&$(c.element).parent().hasClass("flags")){return'<span class="flags flag-'+c.id.toLowerCase()+'">'+c.text+"</span>"}else{return c.text}}}).on("change",function(c){if($("#pageForm .table #Filter").length>0){$("#pageForm .table #Filter").trigger("click")}})}$('input[data-input-element="date"]').datetimepicker({language:"en",todayHighlight:true,todayBtn:"linked",bootcssVer:3,fontAwesome:true,autoclose:true,minView:"month"});$('input[data-input-element="datetime"]').datetimepicker({language:"en",todayHighlight:true,todayBtn:"linked",bootcssVer:3,fontAwesome:true,autoclose:true});ISPConfig.callHook("onAfterContentLoad",{url:a,data:b})},submitForm:function(d,e,c){var b=arguments[3];if(!c){c=false}if(!c||window.confirm(c)){var a=$.ajax({type:"POST",url:e,data:$("#"+d).serialize(),dataType:"html",beforeSend:function(){ISPConfig.showLoadIndicator()},success:function(g,i,f){if(b){alert(b)}if(f.responseText.indexOf("HEADER_REDIRECT:")>-1){var h=f.responseText.split(":");ISPConfig.loadContent(h[1])}else{if(f.responseText.indexOf("LOGIN_REDIRECT:")>-1){document.location.href="/index.php"}else{$("#pageContent").html(f.responseText);ISPConfig.onAfterContentLoad(e,$("#"+d).serialize());ISPConfig.pageFormChanged=false}}ISPConfig.hideLoadIndicator()},error:function(f,i,h){ISPConfig.hideLoadIndicator();var g=f.responseText.split(":");ISPConfig.reportError("Ajax Request was not successful. 111")}})}},submitUploadForm:function(c,d){var b=function(n){var h,j=n.contentWindow.document.body.innerHTML;try{h=JSON.parse(j)}catch(k){h=j}var o=$("<div></div>").html(h);var f="";var l=o.find("#OKMsg").html();if(l){f='<div id="OKMsg">'+l+"</div>"}var i=o.find("#errorMsg").html();if(i){f=f+'<div id="errorMsg">'+i+"</div>"}var m=o.find('input[name="_csrf_key"]').val();var g=o.find('input[name="_csrf_id"]').val();f=f+'<input type="hidden" name="_csrf_id" value="'+g+'" /><input type="hidden" name="_csrf_key" value="'+m+'" />';return f};var a="ajaxUploader-iframe-"+Math.round(new Date().getTime()/1000);$("body").append('<iframe width="0" height="0" style="display:none;" name="'+a+'" id="'+a+'"/>');$("#"+a).load(function(){var e=b(this);$("#errorMsg").remove();$("#OKMsg").remove();$('input[name="_csrf_key"]').remove();$('input[name="_csrf_id"]').remove();$('input[name="id"]').before(e);$(this).remove()});$('input[type="file"]').closest("form").attr({target:a,action:d}).submit()},capp:function(b,c){var a=$.ajax({type:"GET",url:"capp.php",data:"mod="+b+((c!=undefined)?"&redirect="+c:""),dataType:"html",beforeSend:function(){ISPConfig.showLoadIndicator()},success:function(e,h,d){if(d.responseText!=""){if(d.responseText.indexOf("HEADER_REDIRECT:")>-1){var g=d.responseText.split(":");ISPConfig.loadContent(g[1])}else{if(d.responseText.indexOf("URL_REDIRECT:")>-1){var f=d.responseText.substr(d.responseText.indexOf("URL_REDIRECT:")+"URL_REDIRECT:".length);document.location.href=f}else{}}}ISPConfig.loadMenus();ISPConfig.hideLoadIndicator()},error:function(){ISPConfig.hideLoadIndicator();ISPConfig.reportError("Ajax Request was not successful."+b)}})},loadContent:function(b){var c=arguments[1];var a=$.ajax({type:"GET",url:b,data:(c?c:null),dataType:"html",beforeSend:function(){ISPConfig.showLoadIndicator()},success:function(e,h,d){if(d.responseText.indexOf("HEADER_REDIRECT:")>-1){var g=d.responseText.split(":");ISPConfig.loadContent(g[1])}else{if(d.responseText.indexOf("URL_REDIRECT:")>-1){var f=d.responseText.substr(d.responseText.indexOf("URL_REDIRECT:")+"URL_REDIRECT:".length);document.location.href=f}else{$("#pageContent").html(d.responseText);ISPConfig.onAfterContentLoad(b,(c?c:null));ISPConfig.pageFormChanged=false}}ISPConfig.hideLoadIndicator()},error:function(){ISPConfig.hideLoadIndicator();ISPConfig.reportError("Ajax Request was not successful. 113")}})},loadContentRefresh:function(b){if($("#refreshinterval").val()>0){var a=$.ajax({type:"GET",url:b,data:"refresh="+document.getElementById("refreshinterval").value,dataType:"html",beforeSend:function(){ISPConfig.showLoadIndicator()},success:function(d,e,c){ISPConfig.hideLoadIndicator();$("#pageContent").html(c.responseText);ISPConfig.onAfterContentLoad(b,"refresh="+document.getElementById("refreshinterval").value);ISPConfig.pageFormChanged=false},error:function(){ISPConfig.hideLoadIndicator();ISPConfig.reportError("Ajax Request was not successful."+b)}});setTimeout("ISPConfig.loadContentRefresh('"+b+"&refresh="+document.getElementById("refreshinterval").value+"')",document.getElementById("refreshinterval").value*1000*60)}},loadInitContent:function(){var a=$.ajax({type:"GET",url:"dashboard/dashboard.php",data:"",dataType:"html",beforeSend:function(){ISPConfig.showLoadIndicator()},success:function(c,e,b){if(b.responseText.indexOf("HEADER_REDIRECT:")>-1){var d=b.responseText.split(":");ISPConfig.loadContent(d[1])}else{$("#pageContent").html(b.responseText);ISPConfig.onAfterContentLoad("dashboard/dashboard.php","");ISPConfig.pageFormChanged=false}ISPConfig.hideLoadIndicator()},error:function(){ISPConfig.hideLoadIndicator();ISPConfig.reportError("Ajax Request was not successful. 114")}});ISPConfig.loadMenus();ISPConfig.keepalive();setTimeout(function(){try{$("form#pageForm").find('input[name="username"]').focus()}catch(b){}},1000)},loadMenus:function(){var b=$.ajax({type:"GET",url:"nav.php",data:"nav=side",dataType:"html",beforeSend:function(){ISPConfig.showLoadIndicator()},success:function(d,e,c){ISPConfig.hideLoadIndicator();$("#sidebar").html(c.responseText);ISPConfig.onAfterSideNavLoaded();ISPConfig.loadPushyMenu()},error:function(){ISPConfig.hideLoadIndicator();ISPConfig.reportError("Ajax Request was not successful. 115")}});var a=$.ajax({type:"GET",url:"nav.php",data:"nav=top",dataType:"html",beforeSend:function(){ISPConfig.showLoadIndicator()},success:function(d,e,c){ISPConfig.hideLoadIndicator();$("#topnav-container").html(c.responseText);ISPConfig.loadPushyMenu()},error:function(c){ISPConfig.hideLoadIndicator();ISPConfig.reportError("Ajax Request was not successful. 116")}})},changeTab:function(c,e,d){if(ISPConfig.requestsRunning>0){return false}document.pageForm.next_tab.value=c;var b=$("form#pageForm").find('[name="id"]');var f=null;if(b.length>0){f=b.val()}if(ISPConfig.tabChangeDiscard=="y"&&!d){if((b.length<1||f)&&(ISPConfig.pageFormChanged==false||window.confirm(ISPConfig.tabChangeDiscardTxt))){var a=c;if(f){ISPConfig.loadContent(e,{next_tab:a,id:f})}else{ISPConfig.loadContent(e,{next_tab:a})}}else{return false}}else{if(f&&ISPConfig.tabChangeWarning=="y"&&ISPConfig.pageFormChanged==true){if(window.confirm(ISPConfig.tabChangeWarningTxt)){ISPConfig.submitForm("pageForm",e)}else{var a=c;if(f){ISPConfig.loadContent(e,{next_tab:a,id:f})}else{ISPConfig.loadContent(e,{next_tab:a})}}}else{ISPConfig.submitForm("pageForm",e)}}},confirm_action:function(b,a){if(window.confirm(a)){ISPConfig.loadContent(b)}},loadContentInto:function(b,c){var a=$.ajax({type:"GET",url:c,dataType:"html",beforeSend:function(){},success:function(e,f,d){$("#"+b).html(d.responseText)},error:function(){ISPConfig.reportError("Ajax Request was not successful. 118")}})},loadOptionInto:function(b,c,d){var a=$.ajax({type:"GET",url:c,dataType:"html",beforeSend:function(){},success:function(h,l,g){var j=g.responseText;var k=j.split("#");el=document.getElementById(b);el.innerHTML="";for(var f=0;f<k.length;++f){var e=document.createElement("option");e.appendChild(document.createTextNode(k[f]));e.value=k[f];el.appendChild(e)}if(typeof(d)!="undefined"){d(b,c)}},error:function(){ISPConfig.reportError("Ajax Request was not successful. 119")}})},keepalive:function(){var a=$.ajax({type:"GET",url:"keepalive.php",dataType:"html",success:function(c,d,b){setTimeout(function(){ISPConfig.keepalive()},1000000)},error:function(){ISPConfig.reportError("Session expired. Please login again.")}})},addAdditionalTemplate:function(){var e=$("#template_additional").val();var a=$("#tpl_add_select").val().split("|",2);var d=a[0];var f=a[1];if(d>0){var c=e.split("/");ISPConfig.new_tpl_add_id+=1;var b=$('<a href="#"></a>').attr("class","button icons16 icoDelete").click(function(g){g.preventDefault();ISPConfig.delAdditionalTemplate($(this).parent().attr("rel"))});c[c.length]="n"+ISPConfig.new_tpl_add_id+":"+d;$("<li>"+f+"</li>").attr("rel","n"+new_tpl_add_id).append(b).appendTo("#template_additional_list ul");$("#template_additional").val(c.join("/"));alert("additional template "+f+" added to customer")}else{alert("no additional template selcted")}},delAdditionalTemplate:function(d){var a=$("#template_additional").val();if(d){var l=$("#template_additional_list ul").find('li[rel="'+d+'"]').eq(0);var k=l.text();l.remove();var j=a.split("/");var b=new Array();for(var e=0;e<j.length;e++){var f=j[e].split(":",2);if(f.length==2&&f[0]==d){continue}b[b.length]=j[e]}$("#template_additional").val(b.join("/"));alert("additional template "+k+" deleted from customer")}else{if(a!=""){var c=document.getElementById("tpl_add_select").value.split("|",2);var h=c[0];var k=c[1];$("#template_additional_list ul").find("li:not([rel])").each(function(){var i=$(this).text();if(i==k){$(this).remove();return false}return this});var b=a;var g=new RegExp("(^|/)"+h+"(/|$)");b=b.replace(g,"");b=b.replace("//","/");$("#template_additional").val(b);alert("additional template "+k+" deleted from customer")}else{alert("no additional template selcted")}}}};$(document).on("change",function(a){var b=a.target.localName;if($("#pageForm .table #Filter").length>0&&b=="select"){a.preventDefault();$("#pageForm .table #Filter").trigger("click")}if(b=="select"||b=="input"||b=="textarea"){if($(a.target).hasClass("no-page-form-change")==false){ISPConfig.pageFormChanged=true}}});$(document).on("click","a[data-load-content],button[data-load-content]",function(b){b.preventDefault();$("html, body").animate({scrollTop:0},1000);var a=$(this).attr("data-load-content");if(!a){return this}ISPConfig.loadContent(a)});$(document).on("click","a[data-capp],button[data-capp]",function(b){b.preventDefault();$("html, body").animate({scrollTop:0},1000);var a=$(this).attr("data-capp");if(!a){return this}ISPConfig.capp(a)});$(document).on("click","a[data-submit-form],button[data-submit-form]",function(d){d.preventDefault();$("html, body").animate({scrollTop:0},1000);var b=$(this);var a=b.attr("data-form-action");var c=b.attr("data-submit-form");if(b.attr("data-form-upload")=="true"){ISPConfig.submitUploadForm(c,a)}else{ISPConfig.submitForm(c,a)}});$(document).bind("keypress",function(a){if(a.which=="13"&&$("#pageForm .table #Filter").length>0&&$(a.target).hasClass("ui-autocomplete-input")==false){a.preventDefault();$("#pageForm .table #Filter").trigger("click")}if(a.which=="13"&&$(".pnl_formsarea button.positive").length>0&&a.target.localName!="textarea"&&$(a.target).is(":input")){a.preventDefault();$(".pnl_formsarea button.positive:first").not("[disabled='disabled']").trigger("click")}});$(document).on("click","th[data-column]",function(h){var i=$(this);var d=i.attr("data-column");if(!d){return this}if($("#pageForm .table #Filter").length>0&&i.attr("data-sortable")!="false"){var c=$("#Filter");var a=c.attr("data-form-action");var f=c.attr("data-submit-form");var b=i.attr("data-ordered");var g="?";if(a.indexOf("?")>=0){g="&"}a=a+g+"orderby="+d;ISPConfig.submitForm(f,a);$(document).ajaxComplete(function(){var e=$('#pageForm .table th[data-column="'+d+'"]');e.parent().children("th[data-column]").removeAttr("data-ordered");if(b&&b=="asc"){e.attr("data-ordered","desc")}else{e.attr("data-ordered","asc")}})}});$(document).on("click",".addPlaceholder",function(){var a=$(this).text();var b=$(this).siblings(":input");b.insertAtCaret(a)});$(document).on("click",".addPlaceholderContent",function(){var b=$(this).find(".addPlaceholderContent").text();var a=$(this).siblings(":input");a.insertAtCaret(b)});$(document).on("ready",function(){$.fn.extend({insertAtCaret:function(a){return this.each(function(d){if(document.selection){this.focus();sel=document.selection.createRange();sel.text=a;this.focus()}else{if(this.selectionStart||this.selectionStart=="0"){var c=this.selectionStart;var b=this.selectionEnd;var e=this.scrollTop;this.value=this.value.substring(0,c)+a+this.value.substring(b,this.value.length);this.focus();this.selectionStart=c+a.length;this.selectionEnd=c+a.length;this.scrollTop=e}else{this.value+=a;this.focus()}}})}});$(".progress .progress-bar").css("width",function(){return $(this).attr("aria-valuenow")+"%"});ISPConfig.loadInitContent();$("#searchform").submit(function(a){a.preventDefault()});$("#pageForm").submit(function(a){if($("#pageForm .table #Filter").length>0){a.preventDefault()}})}); \ No newline at end of file +var ISPConfig={pageFormChanged:false,tabChangeWarningTxt:"",tabChangeDiscardTxt:"",tabChangeWarning:false,tabChangeDiscard:false,requestsRunning:0,indicatorCompleted:false,registeredHooks:new Array(),new_tpl_add_id:0,options:{useLoadIndicator:false,useComboBox:false},setOption:function(a,b){ISPConfig.options[a]=b},setOptions:function(a){$.extend(ISPConfig.options,a)},reportError:function(a){},registerHook:function(a,c){if(!ISPConfig.registeredHooks[a]){ISPConfig.registeredHooks[a]=new Array()}var b=ISPConfig.registeredHooks[a].length;ISPConfig.registeredHooks[a][b]=c},callHook:function(a,c){if(!ISPConfig.registeredHooks[a]){return}for(var b=0;b<ISPConfig.registeredHooks[a].length;b++){var d=ISPConfig.registeredHooks[a][b];d(a,c)}},resetFormChanged:function(){ISPConfig.pageFormChanged=false},showLoadIndicator:function(){document.body.style.cursor="wait";if(ISPConfig.options.useLoadIndicator==true){ISPConfig.requestsRunning+=1;if(ISPConfig.requestsRunning<2){var a=$("#ajaxloader");if(a.length<1){a=$('<div id="ajaxloader" style="display: none;"></div>');a.appendTo("body")}var b=$("#content");if(b.length<1){return}ISPConfig.indicatorCompleted=false;var d=b.offset().left+150;var c=b.offset().top+150;a.css({left:d,top:c}).fadeIn("fast",function(){ISPConfig.indicatorCompleted=true;if(ISPConfig.requestsRunning<1){$(this).fadeOut("fast",function(){$(this).hide()})}})}}},hideLoadIndicator:function(){document.body.style.cursor="";ISPConfig.requestsRunning-=1;if(ISPConfig.requestsRunning<1){ISPConfig.requestsRunning=0;if(ISPConfig.indicatorCompleted==true){$("#ajaxloader").fadeOut("fast",function(){$("#ajaxloader").hide()})}}},onAfterSideNavLoaded:function(){if(ISPConfig.options.useComboBox==true){$("#sidebar").find("select:not(.chosen-select)").select2({placeholder:"",width:"element",selectOnBlur:true,allowClear:true})}},onAfterContentLoad:function(a,b){if(!b){b=""}else{b="&"+b}if(ISPConfig.options.useComboBox==true){$("#pageContent").find("select:not(.chosen-select)").select2({placeholder:"",width:"element",selectOnBlur:true,allowClear:true,formatResult:function(c){if(c.id&&$(c.element).parent().hasClass("flags")){return'<span class="flags flag-'+c.id.toLowerCase()+'">'+c.text+"</span>"}else{return c.text}},formatSelection:function(c){if(c.id&&$(c.element).parent().hasClass("flags")){return'<span class="flags flag-'+c.id.toLowerCase()+'">'+c.text+"</span>"}else{return c.text}}}).on("change",function(c){if($("#pageForm .table #Filter").length>0){$("#pageForm .table #Filter").trigger("click")}})}$('input[data-input-element="date"]').datetimepicker({language:"en",todayHighlight:true,todayBtn:"linked",bootcssVer:3,fontAwesome:true,autoclose:true,minView:"month"});$('input[data-input-element="datetime"]').datetimepicker({language:"en",todayHighlight:true,todayBtn:"linked",bootcssVer:3,fontAwesome:true,autoclose:true});ISPConfig.callHook("onAfterContentLoad",{url:a,data:b})},submitForm:function(d,e,c){var b=arguments[3];if(!c){c=false}if(!c||window.confirm(c)){var a=$.ajax({type:"POST",url:e,data:$("#"+d).serialize(),dataType:"html",beforeSend:function(){ISPConfig.showLoadIndicator()},success:function(g,i,f){if(b){alert(b)}if(f.responseText.indexOf("HEADER_REDIRECT:")>-1){var h=f.responseText.split(":");ISPConfig.loadContent(h[1])}else{if(f.responseText.indexOf("LOGIN_REDIRECT:")>-1){document.location.href="/index.php"}else{$("#pageContent").html(f.responseText);ISPConfig.onAfterContentLoad(e,$("#"+d).serialize());ISPConfig.pageFormChanged=false}}ISPConfig.hideLoadIndicator()},error:function(f,i,h){ISPConfig.hideLoadIndicator();var g=f.responseText.split(":");ISPConfig.reportError("Ajax Request was not successful. 111")}})}},submitUploadForm:function(c,d){var b=function(n){var h,j=n.contentWindow.document.body.innerHTML;try{h=JSON.parse(j)}catch(k){h=j}var o=$("<div></div>").html(h);var f="";var l=o.find("#OKMsg").html();if(l){f='<div id="OKMsg">'+l+"</div>"}var i=o.find("#errorMsg").html();if(i){f=f+'<div id="errorMsg">'+i+"</div>"}var m=o.find('input[name="_csrf_key"]').val();var g=o.find('input[name="_csrf_id"]').val();f=f+'<input type="hidden" name="_csrf_id" value="'+g+'" /><input type="hidden" name="_csrf_key" value="'+m+'" />';return f};var a="ajaxUploader-iframe-"+Math.round(new Date().getTime()/1000);$("body").append('<iframe width="0" height="0" style="display:none;" name="'+a+'" id="'+a+'"/>');$("#"+a).load(function(){var e=b(this);$("#errorMsg").remove();$("#OKMsg").remove();$('input[name="_csrf_key"]').remove();$('input[name="_csrf_id"]').remove();$('input[name="id"]').before(e);$(this).remove()});$('input[type="file"]').closest("form").attr({target:a,action:d}).submit()},capp:function(b,c){var a=$.ajax({type:"GET",url:"capp.php",data:"mod="+b+((c!=undefined)?"&redirect="+c:""),dataType:"html",beforeSend:function(){ISPConfig.showLoadIndicator()},success:function(e,h,d){if(d.responseText!=""){if(d.responseText.indexOf("HEADER_REDIRECT:")>-1){var g=d.responseText.split(":");ISPConfig.loadContent(g[1])}else{if(d.responseText.indexOf("URL_REDIRECT:")>-1){var f=d.responseText.substr(d.responseText.indexOf("URL_REDIRECT:")+"URL_REDIRECT:".length);document.location.href=f}else{}}}ISPConfig.loadMenus();ISPConfig.hideLoadIndicator()},error:function(){ISPConfig.hideLoadIndicator();ISPConfig.reportError("Ajax Request was not successful."+b)}})},loadContent:function(b){var c=arguments[1];var a=$.ajax({type:"GET",url:b,data:(c?c:null),dataType:"html",beforeSend:function(){ISPConfig.showLoadIndicator()},success:function(e,h,d){if(d.responseText.indexOf("HEADER_REDIRECT:")>-1){var g=d.responseText.split(":");ISPConfig.loadContent(g[1])}else{if(d.responseText.indexOf("URL_REDIRECT:")>-1){var f=d.responseText.substr(d.responseText.indexOf("URL_REDIRECT:")+"URL_REDIRECT:".length);document.location.href=f}else{$("#pageContent").html(d.responseText);ISPConfig.onAfterContentLoad(b,(c?c:null));ISPConfig.pageFormChanged=false}}ISPConfig.hideLoadIndicator()},error:function(){ISPConfig.hideLoadIndicator();ISPConfig.reportError("Ajax Request was not successful. 113")}})},loadContentRefresh:function(b){if($("#refreshinterval").val()>0){var a=$.ajax({type:"GET",url:b,data:"refresh="+document.getElementById("refreshinterval").value,dataType:"html",beforeSend:function(){ISPConfig.showLoadIndicator()},success:function(d,e,c){ISPConfig.hideLoadIndicator();$("#pageContent").html(c.responseText);ISPConfig.onAfterContentLoad(b,"refresh="+document.getElementById("refreshinterval").value);ISPConfig.pageFormChanged=false},error:function(){ISPConfig.hideLoadIndicator();ISPConfig.reportError("Ajax Request was not successful."+b)}});setTimeout("ISPConfig.loadContentRefresh('"+b+"&refresh="+document.getElementById("refreshinterval").value+"')",document.getElementById("refreshinterval").value*1000*60)}},loadInitContent:function(){var a=$.ajax({type:"GET",url:"dashboard/dashboard.php",data:"",dataType:"html",beforeSend:function(){ISPConfig.showLoadIndicator()},success:function(c,e,b){if(b.responseText.indexOf("HEADER_REDIRECT:")>-1){var d=b.responseText.split(":");ISPConfig.loadContent(d[1])}else{$("#pageContent").html(b.responseText);ISPConfig.onAfterContentLoad("dashboard/dashboard.php","");ISPConfig.pageFormChanged=false}ISPConfig.hideLoadIndicator()},error:function(){ISPConfig.hideLoadIndicator();ISPConfig.reportError("Ajax Request was not successful. 114")}});ISPConfig.loadMenus();ISPConfig.keepalive();setTimeout(function(){try{$("form#pageForm").find('input[name="username"]').focus()}catch(b){}},1000)},loadMenus:function(){var b=$.ajax({type:"GET",url:"nav.php",data:"nav=side",dataType:"html",beforeSend:function(){ISPConfig.showLoadIndicator()},success:function(d,e,c){ISPConfig.hideLoadIndicator();$("#sidebar").html(c.responseText);ISPConfig.onAfterSideNavLoaded();ISPConfig.loadPushyMenu()},error:function(){ISPConfig.hideLoadIndicator();ISPConfig.reportError("Ajax Request was not successful. 115")}});var a=$.ajax({type:"GET",url:"nav.php",data:"nav=top",dataType:"html",beforeSend:function(){ISPConfig.showLoadIndicator()},success:function(d,e,c){ISPConfig.hideLoadIndicator();$("#topnav-container").html(c.responseText);ISPConfig.loadPushyMenu()},error:function(c){ISPConfig.hideLoadIndicator();ISPConfig.reportError("Ajax Request was not successful. 116")}})},changeTab:function(c,e,d){if(ISPConfig.requestsRunning>0){return false}document.pageForm.next_tab.value=c;var b=$("form#pageForm").find('[name="id"]');var f=null;if(b.length>0){f=b.val()}if(ISPConfig.tabChangeDiscard=="y"&&!d){if((b.length<1||f)&&(ISPConfig.pageFormChanged==false||window.confirm(ISPConfig.tabChangeDiscardTxt))){var a=c;if(f){ISPConfig.loadContent(e,{next_tab:a,id:f})}else{ISPConfig.loadContent(e,{next_tab:a})}}else{return false}}else{if(f&&ISPConfig.tabChangeWarning=="y"&&ISPConfig.pageFormChanged==true){if(window.confirm(ISPConfig.tabChangeWarningTxt)){ISPConfig.submitForm("pageForm",e)}else{var a=c;if(f){ISPConfig.loadContent(e,{next_tab:a,id:f})}else{ISPConfig.loadContent(e,{next_tab:a})}}}else{ISPConfig.submitForm("pageForm",e)}}},confirm_action:function(b,a){if(window.confirm(a)){ISPConfig.loadContent(b)}},loadContentInto:function(b,c){var a=$.ajax({type:"GET",url:c,dataType:"html",beforeSend:function(){},success:function(e,f,d){$("#"+b).html(d.responseText)},error:function(){ISPConfig.reportError("Ajax Request was not successful. 118")}})},loadOptionInto:function(b,c,d){var a=$.ajax({type:"GET",url:c,dataType:"html",beforeSend:function(){},success:function(h,l,g){var j=g.responseText;var k=j.split("#");el=document.getElementById(b);el.innerHTML="";for(var f=0;f<k.length;++f){var e=document.createElement("option");e.appendChild(document.createTextNode(k[f]));e.value=k[f];el.appendChild(e)}if(typeof(d)!="undefined"){d(b,c)}},error:function(){ISPConfig.reportError("Ajax Request was not successful. 119")}})},keepalive:function(){var a=$.ajax({type:"GET",url:"keepalive.php",dataType:"html",success:function(c,d,b){setTimeout(function(){ISPConfig.keepalive()},1000000)},error:function(){ISPConfig.reportError("Session expired. Please login again.")}})},addAdditionalTemplate:function(){var e=$("#template_additional").val();var a=$("#tpl_add_select").val().split("|",2);var d=a[0];var f=a[1];if(d>0){var c=e.split("/");ISPConfig.new_tpl_add_id+=1;var b=$('<a href="#"></a>').attr("class","button icons16 icoDelete").click(function(g){g.preventDefault();ISPConfig.delAdditionalTemplate($(this).parent().attr("rel"))});c[c.length]="n"+ISPConfig.new_tpl_add_id+":"+d;$("<li>"+f+"</li>").attr("rel","n"+new_tpl_add_id).append(b).appendTo("#template_additional_list ul");$("#template_additional").val(c.join("/"));alert("additional template "+f+" added to customer")}else{alert("no additional template selcted")}},delAdditionalTemplate:function(d){var a=$("#template_additional").val();if(d){var l=$("#template_additional_list ul").find('li[rel="'+d+'"]').eq(0);var k=l.text();l.remove();var j=a.split("/");var b=new Array();for(var e=0;e<j.length;e++){var f=j[e].split(":",2);if(f.length==2&&f[0]==d){continue}b[b.length]=j[e]}$("#template_additional").val(b.join("/"));alert("additional template "+k+" deleted from customer")}else{if(a!=""){var c=document.getElementById("tpl_add_select").value.split("|",2);var h=c[0];var k=c[1];$("#template_additional_list ul").find("li:not([rel])").each(function(){var i=$(this).text();if(i==k){$(this).remove();return false}return this});var b=a;var g=new RegExp("(^|/)"+h+"(/|$)");b=b.replace(g,"");b=b.replace("//","/");$("#template_additional").val(b);alert("additional template "+k+" deleted from customer")}else{alert("no additional template selcted")}}}};$(document).on("change",function(a){var b=a.target.localName;if($("#pageForm .table #Filter").length>0&&b=="select"){a.preventDefault();$("#pageForm .table #Filter").trigger("click")}if(b=="select"||b=="input"||b=="textarea"){if($(a.target).hasClass("no-page-form-change")==false){ISPConfig.pageFormChanged=true}}});$(document).on("click","a[data-load-content],button[data-load-content]",function(b){b.preventDefault();$("html, body").animate({scrollTop:0},1000);var a=$(this).attr("data-load-content");if(!a){return this}ISPConfig.loadContent(a)});$(document).on("click","a[data-capp],button[data-capp]",function(b){b.preventDefault();$("html, body").animate({scrollTop:0},1000);var a=$(this).attr("data-capp");if(!a){return this}ISPConfig.capp(a)});$(document).on("click","a[data-submit-form],button[data-submit-form]",function(d){d.preventDefault();$("html, body").animate({scrollTop:0},1000);var b=$(this);var a=b.attr("data-form-action");var c=b.attr("data-submit-form");if(b.attr("data-form-upload")=="true"){ISPConfig.submitUploadForm(c,a)}else{ISPConfig.submitForm(c,a)}});$(document).bind("keypress",function(a){if(a.which=="13"&&$("#pageForm .table #Filter").length>0&&$(a.target).hasClass("ui-autocomplete-input")==false){a.preventDefault();$("#pageForm .table #Filter").trigger("click")}if(a.which=="13"&&$(".pnl_formsarea button.positive").length>0&&a.target.localName!="textarea"&&$(a.target).is(":input")){a.preventDefault();$(".pnl_formsarea button.positive:first").not("[disabled='disabled']").trigger("click")}});$(document).on("click","th[data-column]",function(h){var i=$(this);var d=i.attr("data-column");if(!d){return this}if($("#pageForm .table #Filter").length>0&&i.attr("data-sortable")!="false"){var c=$("#Filter");var a=c.attr("data-form-action");var f=c.attr("data-submit-form");var b=i.attr("data-ordered");var g="?";if(a.indexOf("?")>=0){g="&"}a=a+g+"orderby="+d;ISPConfig.submitForm(f,a);$(document).ajaxComplete(function(){var e=$('#pageForm .table th[data-column="'+d+'"]');e.parent().children("th[data-column]").removeAttr("data-ordered");if(b&&b=="asc"){e.attr("data-ordered","desc")}else{e.attr("data-ordered","asc")}})}});$(document).on("click",".addPlaceholder",function(){var a=$(this).text();var b=$(this).siblings(":input");b.insertAtCaret(a)});$(document).on("click",".addPlaceholderContent",function(){var b=$(this).find(".addPlaceholderContent").text();var a=$(this).siblings(":input");a.insertAtCaret(b)});$(document).on("ready",function(){$.fn.extend({insertAtCaret:function(a){return this.each(function(d){if(document.selection){this.focus();sel=document.selection.createRange();sel.text=a;this.focus()}else{if(this.selectionStart||this.selectionStart=="0"){var c=this.selectionStart;var b=this.selectionEnd;var e=this.scrollTop;this.value=this.value.substring(0,c)+a+this.value.substring(b,this.value.length);this.focus();this.selectionStart=c+a.length;this.selectionEnd=c+a.length;this.scrollTop=e}else{this.value+=a;this.focus()}}})}});$(".progress .progress-bar").css("width",function(){return $(this).attr("aria-valuenow")+"%"});ISPConfig.loadInitContent();$("#searchform").submit(function(a){a.preventDefault()});$("#pageForm").submit(function(a){if($("#pageForm .table #Filter").length>0){a.preventDefault()}});$.fn.setCursorPosition=function(c){var b=$(this).get(0);if(b.setSelectionRange){b.setSelectionRange(c,c)}else{if(b.createTextRange){var a=b.createTextRange();a.collapse(true);if(c<0){c=$(this).val().length+c}a.moveEnd("character",c);a.moveStart("character",c);a.select()}}};$.fn.getCursorPosition=function(){var c=0;var b=$(this).get(0);if(typeof b.selectionStart==="number"){c=b.selectionDirection=="backward"?b.selectionStart:b.selectionEnd}else{if(document.selection){this.focus();var a=document.selection.createRange();a.moveStart("character",-b.value.length);c=a.text.length}}return c}}); \ No newline at end of file diff --git a/security/check.php b/security/check.php index dc930c5..cfa820f 100644 --- a/security/check.php +++ b/security/check.php @@ -53,18 +53,20 @@ $data_file = $data_dir.'/admincount'; //get number of admins $tmp = $app->db->queryOneRecord("SELECT count(userid) AS number FROM sys_user WHERE typ = 'admin'"); - $admin_user_count_new = intval($tmp['number']); - - if(is_file($data_file)) { - $admin_user_count_old = intval(file_get_contents($data_file)); - if($admin_user_count_new != $admin_user_count_old) { - $alert .= "The number of ISPConfig administrator users has changed. Old: $admin_user_count_old New: $admin_user_count_new \n"; + if($tmp) { + $admin_user_count_new = intval($tmp['number']); + + if(is_file($data_file)) { + $admin_user_count_old = intval(file_get_contents($data_file)); + if($admin_user_count_new != $admin_user_count_old) { + $alert .= "The number of ISPConfig administrator users has changed. Old: $admin_user_count_old New: $admin_user_count_new \n"; + file_put_contents($data_file,$admin_user_count_new); + } + } else { + // first run, so we save the current count file_put_contents($data_file,$admin_user_count_new); + chmod($data_file,0700); } - } else { - // first run, so we save the current count - file_put_contents($data_file,$admin_user_count_new); - chmod($data_file,0700); } } diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php index de8d085..9493dc6 100644 --- a/server/lib/classes/monitor_tools.inc.php +++ b/server/lib/classes/monitor_tools.inc.php @@ -711,7 +711,10 @@ } if($inHeader == true) { $parts = explode(':', $lines[$l], 2); - if(strtolower($parts[0]) == 'subject') $mailSubject = trim($parts[1]); + if(strtolower($parts[0]) == 'subject') { + $mailSubject = trim($parts[1]); + continue; + } unset($parts); $mailHeaders .= trim($lines[$l]) . "\n"; } else { diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 4a6437e..76528c2 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -275,10 +275,10 @@ [ req_distinguished_name ] C = ".trim($data['new']['ssl_country'])." - ST = ".trim($data['new']['ssl_state'])." - L = ".trim($data['new']['ssl_locality'])." - O = ".trim($data['new']['ssl_organisation'])." - OU = ".trim($data['new']['ssl_organisation_unit'])." + " . (trim($data['new']['ssl_state']) == '' ? '' : "ST = ".trim($data['new']['ssl_state'])) . " + " . (trim($data['new']['ssl_locality']) == '' ? '' : "L = ".trim($data['new']['ssl_locality']))." + " . (trim($data['new']['ssl_organisation']) == '' ? '' : "O = ".trim($data['new']['ssl_organisation']))." + " . (trim($data['new']['ssl_organisation_unit']) == '' ? '' : "OU = ".trim($data['new']['ssl_organisation_unit']))." CN = $domain emailAddress = webmaster@".$data['new']['domain']." diff --git a/server/plugins-available/mail_plugin.inc.php b/server/plugins-available/mail_plugin.inc.php index 20388a4..8696205 100644 --- a/server/plugins-available/mail_plugin.inc.php +++ b/server/plugins-available/mail_plugin.inc.php @@ -207,7 +207,14 @@ //* Send the welcome email message $domain = explode('@', $data["new"]["email"])[1]; - if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.txt')) { + $html = false; + if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.html')) { + $lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.html'); + $html = true; + } elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.html')) { + $lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.html'); + $html = true; + } elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.txt')) { $lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.txt'); } elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt')) { $lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt'); @@ -236,8 +243,13 @@ unset($tmp); $mailHeaders = "MIME-Version: 1.0" . "\n"; - $mailHeaders .= "Content-type: text/plain; charset=utf-8" . "\n"; - $mailHeaders .= "Content-Transfer-Encoding: 8bit" . "\n"; + if($html) { + $mailHeaders .= "Content-Type: text/html; charset=utf-8" . "\n"; + $mailHeaders .= "Content-Transfer-Encoding: quoted-printable" . "\n"; + } else { + $mailHeaders .= "Content-Type: text/plain; charset=utf-8" . "\n"; + $mailHeaders .= "Content-Transfer-Encoding: 8bit" . "\n"; + } $mailHeaders .= "From: $welcome_mail_from" . "\n"; $mailHeaders .= "Reply-To: $welcome_mail_from" . "\n"; $mailTarget = $data["new"]["email"]; diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index f4c5f9d..d351bb2 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -156,10 +156,10 @@ [ req_distinguished_name ] C = ".trim($data['new']['ssl_country'])." - ST = ".trim($data['new']['ssl_state'])." - L = ".trim($data['new']['ssl_locality'])." - O = ".trim($data['new']['ssl_organisation'])." - OU = ".trim($data['new']['ssl_organisation_unit'])." + " . (trim($data['new']['ssl_state']) == '' ? '' : "ST = ".trim($data['new']['ssl_state'])) . " + " . (trim($data['new']['ssl_locality']) == '' ? '' : "L = ".trim($data['new']['ssl_locality']))." + " . (trim($data['new']['ssl_organisation']) == '' ? '' : "O = ".trim($data['new']['ssl_organisation']))." + " . (trim($data['new']['ssl_organisation_unit']) == '' ? '' : "OU = ".trim($data['new']['ssl_organisation_unit']))." CN = $domain emailAddress = webmaster@".$data['new']['domain']." -- Gitblit v1.9.1