Viewing File: /usr/local/cpanel/whostmgr/docroot/templates/easyapache4/views/php.js

/*
# templates/easyapache4/views/php.js                  Copyright(c) 2020 cPanel, L.L.C.
#                                                                   All rights reserved.
# copyright@cpanel.net                                                 http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/

define(
    [
        "angular",
        "cjt/util/locale",
    ],
    function(angular, LOCALE) {

        // Retrieve the current application
        var app = angular.module("App");

        app.controller("php",
            ["$scope", "PAGE", "$sce",
                function($scope, PAGE, $sce) {

                    /**
                    * Builds the CloudLinux promotion banner and shows it off.
                    *
                    * @method setClBanner
                    */
                    var setClBanner = function() {

                        var productData;
                        var phpelsProductData;
                        var productIsLicensed;

                        $scope.showCLBanner = false;
                        $scope.promotePhpEls = PAGE.promote_phpels === true;
                        $scope.promoteCL = PAGE.cl_data.cl_is_supported && !PAGE.cl_data.cl_is_installed;
                        phpelsProductData = PAGE.phpels_data;
                        $scope.phpelsHasCustomUrl = phpelsProductData.purchase_phpels_data.is_url;
                        $scope.phpelsIcon = PAGE.phpels_icon;
                        productData = PAGE.cl_data;
                        productIsLicensed = PAGE.cl_licensed === true;
                        $scope.hasCustomUrl = productData.purchase_cl_data.is_url;
                        $scope.clIcon = PAGE.cl_icon;
                        $scope.cl_is_supported = productData.cl_is_supported;

                        $scope.linkTarget = "_blank";
                        $scope.purchaseLink = "";
                        $scope.clActionText = "";
                        $scope.clBannerText = "";
                        $scope.clBannerHtml = $sce.trustAsHtml("");

                        var purchaseCLData = productData.purchase_cl_data;
                        if (productData.cl_is_supported && !productData.cl_is_installed && !purchaseCLData.disable_upgrade) {
                            if ( purchaseCLData.server_timeout || (purchaseCLData.error_msg && purchaseCLData.error_msg !== "")) {
                                $scope.hideUpgradeOption = true;
                            } else {
                                $scope.hideUpgradeOption = false;
                                if (productIsLicensed) {
                                    $scope.purchaseLink = "scripts13/install_cloudlinux_EA4";
                                    $scope.clActionText = LOCALE.maketext("Install [_1]", "CloudLinux");
                                    $scope.linkTarget = "_self"; // No need for popup if staying in WHM
                                } else {
                                    $scope.purchaseLink = productData.purchase_cl_data.url;
                                    $scope.clActionText = LOCALE.maketext("Upgrade to [_1]", "CloudLinux");
                                }
                            }
                            $scope.purchaseClData = purchaseCLData;
                        }

                        var purchaseData = phpelsProductData.purchase_phpels_data;
                        $scope.phpelsBannerTitle = LOCALE.maketext("[output,strong,Need to keep older PHP versions secure?]");
                        $scope.phpelsBannerBody = LOCALE.maketext("cPanel provides the latest stable versions of PHP. If you require legacy versions like PHP 5.6 or 7.x, you can keep outdated websites secure with [output,strong,TuxCare Extended Lifecycle Support (ELS)] from CloudLinux. This service provides hardened PHP versions continuously patched against known vulnerabilities, making it the easiest way to maintain security for older PHP versions. [output,url,_1,Learn more.,target,_2]",
                            "https://go.cpanel.net/about-elsphp",
                            "blank"
                        );
                        $scope.phpelsBannerText = $scope.phpelsBannerTitle + "<br>" + $scope.phpelsBannerBody;
                        $scope.phpelsBannerHtml = $sce.trustAsHtml($scope.phpelsBannerText);

                        $scope.clBannerTitle = LOCALE.maketext("[output,strong,Upgrade your server security and performance.]");
                        $scope.clBannerBody = LOCALE.maketext("[output,strong,CloudLinux OS] is a feature-rich platform solution that addresses multiple server challenges in a single package, including hardened PHP for legacy version, while also delivering enhanced security, performance, and resource isolation across your hosting environment. [output,url,_1,Learn more.,target,_2]",
                            "https://go.cpanel.net/about-cloudlinux",
                            "blank"
                        );
                        $scope.clBannerText = $scope.clBannerTitle + "<br>" + $scope.clBannerBody;
                        $scope.clBannerHtml = $sce.trustAsHtml($scope.clBannerText);
                        $scope.phpelsPurchaseLink = phpelsProductData.purchase_phpels_data.url || "scripts13/purchase_phpels_init_MULTIPHP";
                        $scope.phpelsActionText = LOCALE.maketext("Buy [_1]", "TuxCare ELS PHP");
                        $scope.purchasePhpelsData = purchaseData;


                        if ( $scope.promotePhpEls || $scope.promoteCL ) {
                            $scope.showCLBanner = true;
                        }

                    };

                    $scope.sendMixPanelEvent = function(eventName) {
                        var mixpanel = window && window.mixpanel;
                        if (mixpanel && typeof mixpanel.track === "function") {
                            mixpanel.track(eventName, {});
                        }
                    };

                    $scope.$on("$viewContentLoaded", function() {
                        $scope.customize.loadData("php");
                        setClBanner();
                    });
                },
            ]
        );
    }
);
Back to Directory File Manager