Viewing File: /usr/local/cpanel/whostmgr/docroot/templates/mod_security/config.cmb.min.js

define("app/views/commonController",["angular","cjt/filters/wrapFilter","cjt/services/alertService","cjt/directives/alertList","uiBootstrap"],(function(e){var t;try{t=e.module("App")}catch(i){t=e.module("App",["ui.bootstrap","ngSanitize"])}return t.controller("commonController",["$scope","$location","$rootScope","alertService","PAGE",function(e,t,i,r,n){e.isInstalled=n.installed,e.alerts=r.getAlerts(),e.route=null,e.closeAlert=function(e){r.remove(e)},e.isCurrentView=function(t){return!(!e.route||!e.route.$$route)&&e.route.$$route.originalPath===t},i.$on("$routeChangeStart",(function(t,i,r){e.route=i}))}])})),define("app/services/configService",["angular","cjt/util/locale","cjt/util/parse","cjt/io/api","cjt/io/whm-v1-request","cjt/io/whm-v1","cjt/services/APIService"],(function(e,t,i,r,n,o){function a(e){e.default&&e.missing&&("number"===e.type?e.state=parseInt(e.default,10):e.state=e.default)}function c(e){var t=[];if(e.status){for(var r=e.data,n=0,o=r.length;n<o;n++){var c=r[n];void 0!==c.engine&&(c.engine=i.parsePerlBoolean(c.engine)),a(c),c.changed=!1,t.push(c)}return t}return[]}e.module("App").factory("configService",["$q","APIService",function(t,i){var r=function(){};return r.prototype=new i,e.extend(r.prototype,{fetchList:function(){var e=new n.Class;return e.initialize("","modsec_get_settings"),this.deferred(e,{transformAPISuccess:c}).promise},save:function(e){if(e){for(var t=[],i=0,r=e.length;i<r;i++)e[i].changed&&t.push(e[i]);if(t.length>0){var o=new n.Class;o.initialize("","modsec_batch_settings");for(var a=0,c=t.length;a<c;a++){var s=t[a];!s.engine&&s.default&&(("text"===s.type||"radio"===s.type)&&s.state===s.default||"number"===s.type&&parseInt(s.state,10)===s.default)||""===s.state?s.missing||(o.addArgument("setting_id",t[a].setting_id,!0),o.addArgument("remove",1,!0)):(o.addArgument("setting_id",t[a].setting_id,!0),o.addArgument("state",s.state,!0)),o.incrementAuto()}o.addArgument("commit",1);var l=this.deferred(o,{apiSuccess:function(t,i){for(var r=0,n=e.length;r<n;r++)e[r].changed&&(e[r].changed=!1);i.resolve(t.data)},apiFailure:function(e){l.reject(e.error)}});return l.promise}}},prepareList:function(e){return c(e=o.parse_response(e).parsedResponse)},applyDefaults:a}),new r}])})),define("app/views/configController",["angular","lodash","cjt/validator/datatype-validators","cjt/validator/ascii-data-validators","cjt/util/locale","uiBootstrap","cjt/directives/autoFocus","cjt/filters/wrapFilter","cjt/directives/spinnerDirective","app/services/configService","cjt/directives/validationContainerDirective","cjt/validator/validateDirectiveFactory","cjt/directives/dynamicValidatorDirective","cjt/decorators/dynamicName"],(function(e,t,i,r,n){var o=e.module("App");return o.controller("configController",["$scope","$location","$anchorScroll","$routeParams","$q","configService","spinnerAPI","PAGE",function(e,a,c,s,l,u,d,f){e.saveSuccess=!1,e.saveError=!1,e.configs=[],e.isInstalled=f.installed;var v=function(e){return t.each(e,(function(e){if("SecAuditEngine"===e.directive)return t.reverse(e.radio_options),!1})),e};e.validateField=function(e,t,o,a){var c;if(!e)return a.isValid=!0,!0;switch(t){case"path":break;case"startsWith":(c=r.methods.startsWith(e,o)).isValid||(a.isValid=!1,a.add(t,n.maketext("The value must start with the “[_1]” character.","|")));break;case"honeypotAccessKey":/^[a-z]{12}$/.test(e)||(a.isValid=!1,a.add(t,n.maketext("The value that you provided is not a valid [asis,honeypot] access key. This value must be a sequence of 12 lower-case alphabetic characters.")));break;case"positiveInteger":(c=i.methods.positiveInteger(e)).isValid||(a.isValid=!1,a.add(t,c.get("positiveInteger").message));break;default:window.console&&window.console.log("Unknown validation type.")}return a.isValid},e.toggleSearch=function(t){t||(e.searchPattern="")},e.clearSearch=function(t){27===t.keyCode&&(e.searchPattern="")},e.fetch=function(){return e.saveSuccess=!1,e.saveError=!1,d.startGroup("loadingSpinner"),u.fetchList().then((function(t){e.configs=v(t),d.stopGroup("loadingSpinner")}),(function(t){e.saveError=t,d.stopGroup("loadingSpinner")}))},e.disableSave=function(e){return e.$pristine||e.$dirty&&e.$invalid},e.changed=function(e){e.changed=!0},e.getFieldType=function(e){return e.field_type||"text"},e.makeModelName=function(e,t){return e+t},e.save=function(i){if(e.saveSuccess=!1,e.saveError=!1,i.$valid){var r=u.save(e.configs);return r?(r.then((function(r){e.saveError=!1,e.saveSuccess=!0,i.$setPristine();for(var n=function(e){return function(t){return t.setting_id===e.setting_id}},o=0,a=e.configs.length;o<a;o++)u.applyDefaults(e.configs[o]);for(var c=0,s=r.length;c<s;c++){var l=t.find(e.configs,n(r[c]));l&&(l.state=r[c].state||r[c].default,l.missing=r[c].missing)}}),(function(t){e.saveError=t||n.maketext("The system experienced an unknown error when it attempted to save the file."),e.saveSuccess=!1})).then((function(){e.scrollTo("top",!0)})),r):r}},e.showLogAllWarning=function(e,t){return"On"===e&&"SecAuditEngine"===t},e.showLogNoteworthyLabel=function(e,t){return"RelevantOnly"===e&&"SecAuditEngine"===t},o.firstLoad.configs&&f.configs?(o.firstLoad.configs=!1,e.configs=u.prepareList(f.configs),e.configs=v(e.configs)):e.fetch()}])})),define("app/config",["angular","jquery","lodash","cjt/core","cjt/modules","ngRoute","uiBootstrap"],(function(e,t,i,r){return e.module("App",["cjt2.config.whm.configProvider","ngRoute","ui.bootstrap","cjt2.whm"]),require(["cjt/bootstrap","cjt/util/locale","cjt/views/applicationController","app/views/commonController","app/views/configController","cjt/services/autoTopService","cjt/services/whm/breadcrumbService","cjt/services/whm/titleService"],(function(t,i){var n=e.module("App");n.value("PAGE",PAGE),n.firstLoad={configs:!0,vendors:!0},n.config(["$routeProvider",function(e){e.when("/config",{controller:"configController",templateUrl:r.buildFullPath("mod_security/views/configView.ptt"),breadcrumb:i.maketext("Configure Global Directives"),title:i.maketext("Configure Global Directives"),reloadOnSearch:!1,group:"config",name:"config"}),e.otherwise({redirectTo:function(e,t,i){return"/config?"+window.location.search}})}]),n.run(["autoTopService","breadcrumbService","titleService",function(e,t,i){e.initialize(),t.initialize(),i.initialize()}]),t(document)}))}));
Back to Directory File Manager