AnonSec Shell
Server IP : 213.186.33.4  /  Your IP : 216.73.216.193
Web Server : Apache
System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : awebpaca ( 35430)
PHP Version : 8.5.0
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/awebpaca/piwik/plugins/CoreAdminHome/angularjs/branding/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/awebpaca/piwik/plugins/CoreAdminHome/angularjs/branding/branding.controller.js
/*!
 * Matomo - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

/**
 * Controller to save mail smtp settings
 */
(function () {
    angular.module('piwikApp').controller('BrandingController', BrandingController);

    BrandingController.$inject = ['$scope', 'piwikApi'];

    function BrandingController($scope, piwikApi) {

        var self = this;
        this.isLoading = false;

        function refreshCustomLogo() {
            var selectors = ['#currentLogo', '#currentFavicon'];
            var index;
            for (index = 0; index < selectors.length; index++) {
                var imageDiv = $(selectors[index]);
                if (imageDiv && imageDiv.data("src") && imageDiv.data("srcExists")) {
                    var logoUrl = imageDiv.data("src");
                    imageDiv.attr("src", logoUrl + "?" + (new Date()).getTime());
                    imageDiv.show();
                } else {
                    imageDiv.hide();
                }
            }
        }

        this.updateLogo = function () {
            var isSubmittingLogo = (this.customLogo != undefined && this.customLogo != '');
            var isSubmittingFavicon = (this.customFavicon != undefined && this.customFavicon != '');

            if (!isSubmittingLogo && !isSubmittingFavicon) {
                return;
            }

            var $uploadError = $('.uploaderror');
            $uploadError.fadeOut();
            var frameName = "upload" + (new Date()).getTime();
            var uploadFrame = $("<iframe name=\"" + frameName + "\" />");
            uploadFrame.css("display", "none");
            uploadFrame.load(function (data) {
                setTimeout(function () {
                    var frameContent = $(uploadFrame.contents()).find('body').html();
                    frameContent = $.trim(frameContent);

                    if ('0' === frameContent) {
                        $uploadError.show();
                    } else {
                        // Upload succeed, so we update the images availability
                        // according to what have been uploaded
                        if (isSubmittingLogo) {
                            $('#currentLogo').data("srcExists", true);
                        }
                        if (isSubmittingFavicon) {
                            $('#currentFavicon').data("srcExists", true);
                        }
                        refreshCustomLogo();
                    }

                    if ('1' === frameContent || '0' === frameContent) {
                        uploadFrame.remove();
                    }
                }, 1000);
            });
            $("body:first").append(uploadFrame);
            var submittingForm = $('#logoUploadForm');
            submittingForm.attr("target", frameName);
            submittingForm.submit();

            this.customLogo = '';
            this.customFavicon = '';
        };

        refreshCustomLogo();

        this.toggleCustomLogo = function () {
            refreshCustomLogo();
        };

        this.save = function () {

            this.isLoading = true;

            piwikApi.post({module: 'API', method: 'CoreAdminHome.setBrandingSettings'}, {
                useCustomLogo: this.enabled ? '1' : '0'
            }).then(function (success) {
                self.isLoading = false;

                var UI = require('piwik/UI');
                var notification = new UI.Notification();
                notification.show(_pk_translate('CoreAdminHome_SettingsSaveSuccess'), {
                    id: 'generalSettings', context: 'success'
                });
                notification.scrollToNotification();
            }, function () {
                self.isLoading = false;
            });
        };
    }
})();

Anon7 - 2022
AnonSec Team