File manager - Edit - /usr/local/cpanel/whostmgr/docroot/templates/mod_security/views/addRuleController.min.js
Back
define(["angular","lodash","jquery","cjt/util/locale","cjt/util/parse","uiBootstrap","cjt/directives/autoFocus","cjt/directives/spinnerDirective","cjt/services/alertService","app/services/ruleService"],(function(angular,_,$,LOCALE,PARSE){"use strict";var app=angular.module("App");var controller=app.controller("addRuleController",["$scope","$location","$anchorScroll","$routeParams","$q","spinnerAPI","alertService","ruleService","PAGE",function($scope,$location,$anchorScroll,$routeParams,$q,spinnerAPI,alertService,ruleService,PAGE){$scope.disableSave=function(form){return form.rule.$pristine&&form.enabled.$pristine||form.$dirty&&form.$invalid};$scope.clearForm=function(){$scope.enabled=true;$scope.rule="";$scope.deploy=false;$scope.clearNotices()};$scope.clearNotices=function(){alertService.clear();$scope.notice=""};$scope.cancel=function(){$scope.clearNotices();$scope.loadView("rulesList")};$scope.save=function(form,exit){$scope.clearNotices();if(!form.$valid){return}spinnerAPI.start("loadingSpinner");return ruleService.addRule($scope.rule,$scope.enabled,$scope.deploy).then((function success(rule){$scope.clearNotices();form.$setPristine();spinnerAPI.stop("loadingSpinner");$scope.clearForm();alertService.add({type:"success",message:LOCALE.maketext("You have successfully saved your [asis,ModSecurity™] rule with the following ID: [_1].",_.escape(rule.id)),id:"alertAddSuccess",replace:true});if(exit){$scope.loadView("rulesList")}else{if($scope.isCopy){$scope.getClonedRule(rule)}$scope.scrollTo("top");document.getElementById("txtRuleText").focus()}}),(function failure(error){$scope.notice="";if(error&&error.duplicate){alertService.add({type:"warning",message:LOCALE.maketext("There is a duplicate [asis,ModSecurity™] rule in the staged configuration file. You cannot add a duplicate rule."),id:"alertAddWarning"})}else{var message=error.message||error;alertService.add({type:"danger",message:_.escape(message),id:"alertAddFailure"})}$scope.scrollTo("top");document.getElementById("txtRuleText").focus()}),(function notify(notice){$scope.notice+=notice+"\n"})).finally((function(){spinnerAPI.stop("loadingSpinner")}))};$scope.disableOriginalRule=function(rule){return ruleService.disableRule(rule.config,rule.id,false).then((function success(){rule.disabled=true;alertService.add({type:"success",message:LOCALE.maketext("You successfully disabled the [asis,ModSecurity™] rule with the following ID: [_1]",_.escape(rule.id)),id:"alertDisableSuccess"})}),(function failure(error){var message=error.message||error;alertService.add({type:"danger",message:message,id:"alertDisableFailure"})})).finally((function(){$scope.scrollTo("top");document.getElementById("txtRuleText").focus()}))};$scope.getClonedRule=function(rule){spinnerAPI.start("loadingSpinner");return ruleService.cloneRule(rule.id,rule.config).then((function success(rule){$scope.id=rule.id;$scope.enabled=!rule.disabled;$scope.rule=rule.rule;$scope.form.rule.$pristine=false}),(function failure(error){var message=error.message||error;alertService.add({type:"danger",message:_.escape(message),id:"alertCopyFailure"});$scope.scrollTo("top");document.getElementById("txtRuleText").focus()})).finally((function(){spinnerAPI.stop("loadingSpinner")}))};$scope.isInstalled=PAGE.installed;if(!$scope.isInstalled){$scope.loadView("hitList")}$scope.clearForm();if($location.$$path.indexOf("copy")!==-1){$scope.originalRule={id:$routeParams["id"],config:$routeParams["config"],disabled:$routeParams["disabled"]};if($scope.originalRule.id&&$scope.originalRule.config){$scope.isCopy=true;$scope.getClonedRule($scope.originalRule)}}}]);return controller}));
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings