Issues (2366)

Branch: master

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

html/template/admin/assets/js/function.js (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
/*!
2
 * function.js for EC-CUBE admin
3
 */
4
5
jQuery(document).ready(function ($) {
6
    /*
7
     * Brake point Check
8
     */
9
    $(window).on('load , resize', function () {
10
        $('body').removeClass('pc_view md_view sp_view');
11
        if (window.innerWidth < 768) {
12
            $('body').addClass('sp_view');
13
            $('#wrapper').removeClass('sidebar-open'); // for Drawer menu
14
        } else if (window.innerWidth < 992) {
15
            $('body').addClass('md_view');
16
            $('#wrapper').addClass('sidebar-open'); // for Drawer menu
17
        } else {
18
            $('body').addClass('pc_view');
19
            $('#wrapper').addClass('sidebar-open'); // for Drawer menu
20
        }
21
        return false;
22
    });
23
24
25
    /*
26
     * Drawer menu
27
     */
28
29
    $('.bt_drawermenu').on('click', function () {
30
        if ($('.sidebar-open #side').size() == 0) {
0 ignored issues
show
It is recommended to use === to compare with 0.

Generally, it is recommended to use strict comparison whenever possible and not to rely on the weaker type-juggling comparison operator.

Read more about comparison operations.

Loading history...
31
            $('#wrapper').addClass('sidebar-open');
32
        } else {
33
            $('#wrapper').removeClass('sidebar-open');
34
        }
35
        return false;
36
    });
37
38
39
/////////// SideBar accordion
40
41
    $("#side li .toggle").click(function () {
42
        if ($("+ul", this).css("display") == "none") {
43
            $(this).parent('li').addClass("active");
44
            $("+ul", this).slideDown(300);
45
        } else {
46
            $(this).parent('li').removeClass("active");
47
            $("+ul", this).slideUp(300);
48
        }
49
        return false;
50
    });
51
52
/////////// accordion
53
54
    $(".accordion .toggle").click(function () {
55
        if ($("+.accpanel", this).css("display") == "none") {
56
            $(this).addClass("active");
57
            $("+.accpanel", this).slideDown(300);
58
        } else {
59
            $(this).removeClass("active");
60
            $("+.accpanel", this).slideUp(300);
61
        }
62
        return false;
63
    });
64
65
66
/////////// dropdownの中をクリックしても閉じないようにする
67
68
    $(".dropdown-menu").click(function (e) {
69
        e.stopPropagation();
70
    });
71
72
73
/////////// 追従サイドバー
74
75
    // スクロールした時に以下の処理
76
    $(window).on("scroll", function () {
77
        //PC表示の時のみに適用
78
        if (window.innerWidth > 993) {
79
80
            if ($('#aside_wrap').length) {
81
82
                var side = $("#aside_column"),
83
                    wrap = $("#aside_wrap"),
84
                    heightH = $("#header").outerHeight(),
85
                    min_move = wrap.offset().top,
86
                    max_move = wrap.offset().top + wrap.height() - side.height() - 2 * parseInt(side.css("top")),
87
                    margin_bottom = max_move - min_move;
88
89
                var scrollTop = $(window).scrollTop();
90
                if (scrollTop > min_move && scrollTop < max_move) {
91
                    var margin_top = scrollTop - min_move;
92
                    side.css({"margin-top": margin_top + heightH + 10});
93
                } else if (scrollTop < min_move) {
94
                    side.css({"margin-top": 0});
95
                } else if (scrollTop > max_move) {
96
                    side.css({"margin-top": margin_bottom});
97
                }
98
            }
99
100
        }
101
102
        return false;
103
    });
104
105
106
//	var fixedcolumn = $('#aside_column'),
107
//	offset = fixedcolumn.offset();
108
//
109
//	$(window).scroll(function () {
110
//	  if($(window).scrollTop() > offset.top - 80) {
111
//		fixedcolumn.addClass('fixed');
112
//	  } else {
113
//		fixedcolumn.removeClass('fixed');
114
//	  }
115
//	});
116
117
    // マスク処理
118
    $('.prevention-mask').on('click', function() {
119
        $overlay = $('<div class="prevention-masked">');
120
        $('body').append($overlay);
121
    });
122
123
    // ダブルクリック禁止
124
    $('.prevention-btn').on('click', function() {
125
        $(this).attr('disabled', 'disabled');
126
        var $form = $(this).parents('form');
127
        // マスク表示させるためsetTimeoutを使って処理を遅らせる
128
        setTimeout(function(){
129
            $form.submit();
130
        }, 0);
131
        return false;
132
    });
133
134
/////////// 検索条件をクリア
135
    $('.search-clear').click(function (event) {
136
        event.preventDefault(event);
137
        $('#search_form .input_search, .search-box-inner input, .search-box-inner select').each(function () {
138
            if (this.type == "checkbox" || this.type == "radio") {
139
                this.checked = false;
140
            } else {
141
                if (this.type == "hidden") {
142
                    if (!this.name.match(/_token/i)) {
143
                        $(this).val("");
144
                    }
145
                } else {
146
                    $(this).val("");
147
                }
148
            }
149
        });
150
    });
151
152
/////////// アコーディオントグル制御( フォームに値があれば、アコーディオン中止 )
153
    //フォーム値確認用関数
154
    formPropStateSubscriber = function() {
155
        ad_flg = false;     //アコーディオン初期値
156
        return {
157
            formState : function() {
158
                this.chcekForm();
159
                return this.getFormState();
160
            },
161
            chcekForm : function(){
162
                 $('.search-box-inner input, .search-box-inner select').each(function () {
163
                    if (this.type == "checkbox" || this.type == "radio") {
164
                        if (this.checked) {
165
                            ad_flg = true;
166
                            return true;
167
                        }
168
                    } else {
169
                        if (this.type != "hidden") {
170
                            if ($(this).val()) {
171
                                ad_flg = true;
172
                                return true;
173
                            }
174
                        }
175
                    }
176
                });
177
            },
178
            getFormState : function() {
179
                return ad_flg;
180
            }
181
        };
182
    };
183
});
184
185
// anchorをクリックした時にformを裏で作って指定のメソッドでリクエストを飛ばす
186
// Twigには以下のように埋め込む
187
// <a href="PATH" {{ csrf_token_for_anchor() }} data-method="(put/delete/postのうちいずれか)" data-confirm="xxxx" data-message="xxxx">
188
//
189
// オプション要素
190
// data-confirm : falseを定義すると確認ダイアログを出さない。デフォルトはダイアログを出す
191
// data-message : 確認ダイアログを出す際のメッセージをデフォルトから変更する
192
//
193
$(function () {
194
    var createForm = function (action, data) {
195
        var $form = $('<form action="' + action + '" method="post"></form>');
196
        for (input in data) {
0 ignored issues
show
Creating global 'for' variable. Should be 'for (var input ...'.
Loading history...
197
            if (data.hasOwnProperty(input)) {
198
                $form.append('<input name="' + input + '" value="' + data[input] + '">');
199
            }
200
        }
201
        return $form;
202
    };
203
204
    $('a[token-for-anchor]').click(function (e) {
205
        e.preventDefault();
206
        var $this = $(this);
207
        var data = $this.data();
208
        if (data.confirm != false) {
0 ignored issues
show
It is recommended to use !== to compare with false.

Generally, it is recommended to use strict comparison whenever possible and not to rely on the weaker type-juggling comparison operator.

Read more about comparison operations.

Loading history...
209
            if (!confirm(data.message ? data.message : '削除してもよろしいですか?')) {
210
                return false;
211
            }
212
        }
213
214
        var $form = createForm($this.attr('href'), {
215
            _token: $this.attr('token-for-anchor'),
216
            _method: data.method
217
        }).hide();
218
219
        $('body').append($form); // Firefox requires form to be on the page to allow submission
220
        $form.submit();
221
    });
222
});
223
224
// 入力チェックエラー発生時にエラー発生箇所までスクロールさせる
225
$(window).load(function() {
226
    var el = $('.errormsg');
227
    if (el.length) {
228
        // Open panel when has error
229
        openPanel(el);
230
        var errorOffset = el.first().offset().top;
231
        var screenHeight = $(window).height();
232
        var errorMargin = parseInt(screenHeight / 10) + $('header').outerHeight();
233
234
        $('html, body').animate({
235
            scrollTop: (errorOffset - errorMargin)
236
        }, 500);
237
    }
238
239
    function openPanel(el) {
240
        var accordion = el.parents('div.accordion');
241
        var $ac = $('.accpanel', accordion);
242
        if (!$ac) {
243
            return false;
244
        }
245
246
        if ($ac.css('display') == 'none') {
247
            $ac.siblings('.toggle').addClass('active');
248
            $ac.slideDown(0);
249
        }
250
    }
251
});
252