ew"> 13
         <br>
14
-        <input type='text' name='idCard' class='form-control' placeholder='หมายเลขบัตรประชาชน' required />
15
-        <br>
14
+        <!-- 
15
+        <input type='text' name='idCard' class='form-control' placeholder='หมายเลขบัตรประชาชน' required /> 
16
+        <br> -->
17
+        <label>วันเกิด</label>
16 18
         <input type='date' name='bd' class='form-control' placeholder='วันเกิด' required />
17 19
         <br>
18 20
         <textarea name='address' class='form-control' placeholder='ที่อยู่' required></textarea>  
@@ -24,7 +26,7 @@
24 26
         <input type='text' name='line_id' class='form-control' placeholder='Line ID'/>
25 27
         <br>
26 28
         <label>อัพโหลดภาพ</label>
27
-        <input type="file" name='photo' accept="image/*;capture=camera" class='form-control' required> </br>
29
+        <input type="file" name='photo' accept="image/*;capture=camera" class='form-control'> </br>
28 30
         <span class="glyphicon glyphicon-map-marker"></span>
29 31
         <a class='btn btn-primary form-control' id="currentLocationBtn">
30 32
         <i class="bi bi-geo-alt-fill"></i>

+ 6 - 1
app/front/views.py

@@ -10,7 +10,7 @@ def index(request):
10 10
         p = Patient()
11 11
         p.first_name = request.POST.get('firstName')
12 12
         p.last_name = request.POST.get('lastName')
13
-        p.idcard = request.POST.get('idCard')
13
+        #p.idcard = request.POST.get('idCard')
14 14
         p.address = request.POST.get('address')
15 15
         p.geolocation = request.POST.get('geo')
16 16
         p.birth_date = request.POST.get('bd')
@@ -25,3 +25,8 @@ def index(request):
25 25
 
26 26
 def success(request):
27 27
     return render(request, 'front/success.html')
28
+
29
+def my404(request,exception):
30
+    return render(request, 'front/404.html')
31
+    #return redirect("index")
32
+

BIN
app/shaqfindbed/__pycache__/settings.cpython-39.pyc


BIN
app/shaqfindbed/__pycache__/urls.cpython-39.pyc


+ 1 - 1
app/shaqfindbed/settings.py

@@ -25,7 +25,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
25 25
 SECRET_KEY = 'django-insecure-!=!d6rsewcddw=hr-j46#))^nd-32(kkjmnpxxioi(v&c9!*xn'
26 26
 
27 27
 # SECURITY WARNING: don't run with debug turned on in production!
28
-DEBUG = True
28
+DEBUG = False
29 29
 
30 30
 ALLOWED_HOSTS = [
31 31
     "167.71.218.44",

+ 5 - 0
app/shaqfindbed/urls.py

@@ -18,13 +18,18 @@ from django.urls import path, include
18 18
 from django.conf import settings
19 19
 from django.conf.urls import url
20 20
 from django.conf.urls.static import static
21
+from django.views.static import serve
22
+
21 23
 
22 24
 urlpatterns = [
23 25
     path('', include('front.urls')),
24 26
     path('backend/', include('backend.urls')),
25 27
     path('admin/', admin.site.urls),
26 28
     url(r'^chaining/', include('smart_selects.urls')),
29
+    url(r'^media/(?P<path>.*)$', serve,{'document_root': settings.MEDIA_ROOT}),
27 30
 ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
28 31
 
32
+
29 33
 if settings.DEBUG:
30 34
     urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
35
+handler404 = 'front.views.my404'

+ 162 - 0
app/staticfile/autocomplete_light/autocomplete.init.js

@@ -0,0 +1,162 @@
1
+/*
2
+This script garantees that this will be called once in django admin.
3
+However, its the callback's responsability to clean up if the
4
+element was cloned with data - which should be the case.
5
+*/
6
+
7
+;(function ($) {
8
+    $.fn.getFormPrefix = function() {
9
+        /* Get the form prefix for a field.
10
+         *
11
+         * For example:
12
+         *
13
+         *     $(':input[name$=owner]').getFormsetPrefix()
14
+         *
15
+         * Would return an empty string for an input with name 'owner' but would return
16
+         * 'inline_model-0-' for an input named 'inline_model-0-owner'.
17
+         */
18
+        var parts = $(this).attr('name').split('-');
19
+        var prefix = '';
20
+
21
+        for (var i in parts) {
22
+            var testPrefix = parts.slice(0, -i).join('-');
23
+            if (! testPrefix.length) continue;
24
+            testPrefix += '-';
25
+
26
+            var result = $(':input[name^=' + testPrefix + ']')
27
+
28
+            if (result.length) {
29
+                return testPrefix;
30
+            }
31
+        }
32
+
33
+        return '';
34
+    }
35
+
36
+    $.fn.getFormPrefixes = function() {
37
+        /*
38
+         * Get the form prefixes for a field, from the most specific to the least.
39
+         *
40
+         * For example:
41
+         *
42
+         *      $(':input[name$=owner]').getFormPrefixes()
43
+         *
44
+         * Would return:
45
+         * - [''] for an input named 'owner'.
46
+         * - ['inline_model-0-', ''] for an input named 'inline_model-0-owner' (i.e. nested with a nested inline).
47
+         * - ['sections-0-items-0-', 'sections-0-', ''] for an input named 'sections-0-items-0-product'
48
+         *   (i.e. nested multiple time with django-nested-admin).
49
+         */
50
+        var parts = $(this).attr('name').split('-').slice(0, -1);
51
+        var prefixes = [];
52
+
53
+        for (i = 0; i < parts.length; i += 2) {
54
+            var testPrefix = parts.slice(0, -i || parts.length).join('-');
55
+            if (!testPrefix.length)
56
+                continue;
57
+
58
+            testPrefix += '-';
59
+
60
+            var result = $(':input[name^=' + testPrefix + ']')
61
+
62
+            if (result.length)
63
+                prefixes.push(testPrefix);
64
+        }
65
+
66
+        prefixes.push('');
67
+
68
+        return prefixes;
69
+    }
70
+
71
+    var initialized = [];
72
+
73
+    function initialize(element) {
74
+        if (typeof element === 'undefined' || typeof element === 'number') {
75
+            element = this;
76
+        }
77
+
78
+        if (window.__dal__initListenerIsSet !== true || initialized.indexOf(element) >= 0) {
79
+            return;
80
+        }
81
+
82
+        $(element).trigger('autocompleteLightInitialize');
83
+        initialized.push(element);
84
+    }
85
+
86
+    if (!window.__dal__initialize) {
87
+        window.__dal__initialize = initialize;
88
+
89
+        $(document).ready(function () {
90
+            $('[data-autocomplete-light-function=select2]:not([id*="__prefix__"])').each(initialize);
91
+        });
92
+
93
+        $(document).bind('DOMNodeInserted', function (e) {
94
+            $(e.target).find('[data-autocomplete-light-function=select2]').each(initialize);
95
+        });
96
+    }
97
+
98
+    // using jQuery
99
+    function getCookie(name) {
100
+        var cookieValue = null;
101
+        if (document.cookie && document.cookie != '') {
102
+            var cookies = document.cookie.split(';');
103
+            for (var i = 0; i < cookies.length; i++) {
104
+                var cookie = $.trim(cookies[i]);
105
+                // Does this cookie string begin with the name we want?
106
+                if (cookie.substring(0, name.length + 1) == (name + '=')) {
107
+                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
108
+                    break;
109
+                }
110
+            }
111
+        }
112
+        return cookieValue;
113
+    }
114
+
115
+    document.csrftoken = getCookie('csrftoken');
116
+    if (document.csrftoken === null) {
117
+        // Try to get CSRF token from DOM when cookie is missing
118
+        var $csrf = $('form :input[name="csrfmiddlewaretoken"]');
119
+        if ($csrf.length > 0) {
120
+            document.csrftoken = $csrf[0].value;
121
+        }
122
+    }
123
+})(yl.jQuery);
124
+
125
+// Does the same thing as django's admin/js/autocomplete.js, but uses yl.jQuery.
126
+(function($) {
127
+    'use strict';
128
+    var init = function($element, options) {
129
+        var settings = $.extend({
130
+            ajax: {
131
+                data: function(params) {
132
+                    return {
133
+                        term: params.term,
134
+                        page: params.page
135
+                    };
136
+                }
137
+            }
138
+        }, options);
139
+        $element.select2(settings);
140
+    };
141
+
142
+    $.fn.djangoAdminSelect2 = function(options) {
143
+        var settings = $.extend({}, options);
144
+        $.each(this, function(i, element) {
145
+            var $element = $(element);
146
+            init($element, settings);
147
+        });
148
+        return this;
149
+    };
150
+
151
+    $(function() {
152
+        // Initialize all autocomplete widgets except the one in the template
153
+        // form used when a new formset is added.
154
+        $('.admin-autocomplete').not('[name*=__prefix__]').djangoAdminSelect2();
155
+    });
156
+
157
+    $(document).on('formset:added', (function() {
158
+        return function(event, $newFormset) {
159
+            return $newFormset.find('.admin-autocomplete').djangoAdminSelect2();
160
+        };
161
+    })(this));
162
+}(yl.jQuery));

+ 191 - 0
app/staticfile/autocomplete_light/forward.js

@@ -0,0 +1,191 @@
1
+;(function($, yl) {
2
+    yl.forwardHandlerRegistry = yl.forwardHandlerRegistry || {};
3
+
4
+    yl.registerForwardHandler = function(name, handler) {
5
+        yl.forwardHandlerRegistry[name] = handler;
6
+    };
7
+
8
+    yl.getForwardHandler = function(name) {
9
+        return yl.forwardHandlerRegistry[name];
10
+    };
11
+
12
+    function getForwardStrategy(element) {
13
+        var checkForCheckboxes = function() {
14
+            var all = true;
15
+            $.each(element, function(ix, e) {
16
+                if ($(e).attr("type") !== "checkbox") {
17
+                    all = false;
18
+                }
19
+            });
20
+            return all;
21
+        };
22
+
23
+        if (element.length === 1 &&
24
+                element.attr("type") === "checkbox" &&
25
+                element.attr("value") === undefined) {
26
+            // Single checkbox without 'value' attribute
27
+            // Boolean field
28
+            return "exists";
29
+        } else if (element.length === 1 &&
30
+                element.attr("multiple") !== undefined) {
31
+            // Multiple by HTML semantics. E. g. multiple select
32
+            // Multiple choice field
33
+            return "multiple";
34
+        } else if (checkForCheckboxes()) {
35
+            // Multiple checkboxes or one checkbox with 'value' attribute.
36
+            // Multiple choice field represented by checkboxes
37
+            return "multiple";
38
+        } else {
39
+            // Other cases
40
+            return "single";
41
+        }
42
+    }
43
+
44
+    /**
45
+     * Get fields with name `name` relative to `element` with considering form
46
+     * prefixes.
47
+     * @param element the element
48
+     * @param name name of the field
49
+     * @returns jQuery object with found fields or empty jQuery object if no
50
+     * field was found
51
+     */
52
+    yl.getFieldRelativeTo = function(element, name) {
53
+        var prefixes = $(element).getFormPrefixes();
54
+
55
+        for (var i = 0; i < prefixes.length; i++) {
56
+            var fieldSelector = "[name=" + prefixes[i] + name + "]";
57
+            var field = $(fieldSelector);
58
+
59
+            if (field.length) {
60
+                return field;
61
+            }
62
+        }
63
+
64
+        return $();
65
+    };
66
+
67
+    /**
68
+     * Get field value which is put to forwarded dictionary
69
+     * @param field the field
70
+     * @returns forwarded value
71
+     */
72
+    yl.getValueFromField = function(field) {
73
+        var strategy = getForwardStrategy(field);
74
+        var serializedField = $(field).serializeArray();
75
+
76
+        if ((serializedField == false) && ($(field).prop('disabled'))) {
77
+            $(field).prop('disabled', false);
78
+            serializedField = $(field).serializeArray();
79
+            $(field).prop('disabled', true);
80
+        }
81
+
82
+        var getSerializedFieldElementAt = function (index) {
83
+            // Return serializedField[index]
84
+            // or null if something went wrong
85
+            if (serializedField.length > index) {
86
+                return serializedField[index];
87
+            } else {
88
+                return null;
89
+            }
90
+        };
91
+
92
+        var getValueOf = function (elem) {
93
+            // Return elem.value
94
+            // or null if something went wrong
95
+            if (elem.hasOwnProperty("value") &&
96
+                elem.value !== undefined
97
+            ) {
98
+                return elem.value;
99
+            } else {
100
+                return null;
101
+            }
102
+        };
103
+
104
+        var getSerializedFieldValueAt = function (index) {
105
+            // Return serializedField[index].value
106
+            // or null if something went wrong
107
+            var elem = getSerializedFieldElementAt(index);
108
+            if (elem !== null) {
109
+                return getValueOf(elem);
110
+            } else {
111
+                return null;
112
+            }
113
+        };
114
+
115
+        if (strategy === "multiple") {
116
+            return serializedField.map(
117
+                function (item) {
118
+                    return getValueOf(item);
119
+                }
120
+            );
121
+        } else if (strategy === "exists") {
122
+            return serializedField.length > 0;
123
+        } else {
124
+            return getSerializedFieldValueAt(0);
125
+        }
126
+    };
127
+
128
+    yl.getForwards = function(element) {
129
+        var forwardElem,
130
+            forwardList,
131
+            forwardedData,
132
+            divSelector,
133
+            form;
134
+        divSelector = "div.dal-forward-conf#dal-forward-conf-for-" +
135
+                element.attr("id") + ", " +
136
+                "div.dal-forward-conf#dal-forward-conf-for_" +
137
+                element.attr("id");
138
+        form = element.length > 0 ? $(element[0].form) : $();
139
+
140
+        forwardElem =
141
+            form.find(divSelector).find('script');
142
+        if (forwardElem.length === 0) {
143
+            return;
144
+        }
145
+        try {
146
+            forwardList = JSON.parse(forwardElem.text());
147
+        } catch (e) {
148
+            return;
149
+        }
150
+
151
+        if (!Array.isArray(forwardList)) {
152
+            return;
153
+        }
154
+
155
+        forwardedData = {};
156
+
157
+        $.each(forwardList, function(ix, field) {
158
+            var srcName, dstName;
159
+            if (field.type === "const") {
160
+                forwardedData[field.dst] = field.val;
161
+            } else if (field.type === "self") {
162
+                if (field.hasOwnProperty("dst")) {
163
+                    dstName = field.dst;
164
+                } else {
165
+                    dstName = "self";
166
+                }
167
+                forwardedData[dstName] = yl.getValueFromField(element);
168
+            } else if (field.type === "field") {
169
+                srcName = field.src;
170
+                if (field.hasOwnProperty("dst")) {
171
+                    dstName = field.dst;
172
+                } else {
173
+                    dstName = srcName;
174
+                }
175
+                var forwardedField = yl.getFieldRelativeTo(element, srcName);
176
+
177
+                if (!forwardedField.length) {
178
+                    return;
179
+                }
180
+
181
+                forwardedData[dstName] = yl.getValueFromField(forwardedField);
182
+            } else if (field.type === "javascript") {
183
+                var handler = yl.getForwardHandler(field.handler);
184
+                forwardedData[field.dst || field.handler] = handler(element);
185
+            }
186
+
187
+        });
188
+        return JSON.stringify(forwardedData);
189
+    };
190
+
191
+})(yl.jQuery, yl);

+ 36 - 0
app/staticfile/autocomplete_light/jquery.init.js

@@ -0,0 +1,36 @@
1
+var yl = yl || {};
2
+if (typeof django !== 'undefined' && typeof django.jQuery !== 'undefined') {
3
+    // If django.jQuery is already defined, use it.
4
+    yl.jQuery = django.jQuery;
5
+}
6
+else {
7
+    // We include jquery itself in our widget's media, because we need it.
8
+    // Normally, we expect our widget's reference to admin/js/vendor/jquery/jquery.js
9
+    // to be skipped, because django's own code has already included it.
10
+    // However, if django.jQuery is NOT defined, we know that jquery was not
11
+    // included before we did it ourselves. This can happen if we're not being
12
+    // rendered in a django admin form.
13
+    // However, someone ELSE'S jQuery may have been included before ours, in
14
+    // which case we must ensure that our jquery doesn't override theirs, since
15
+    // it might be a newer version that other code on the page relies on.
16
+    // Thus, we must run jQuery.noConflict(true) here to move our jQuery out of
17
+    // the way.
18
+    yl.jQuery = jQuery.noConflict(true);
19
+}
20
+
21
+// In addition to all of this, we must ensure that the global jQuery and $ are
22
+// defined, because Select2 requires that. jQuery will only be undefined at
23
+// this point if only we or django included it.
24
+if (typeof jQuery === 'undefined') {
25
+    jQuery = yl.jQuery;
26
+    $ = yl.jQuery;
27
+}
28
+else {
29
+    // jQuery IS still defined, which means someone else also included jQuery.
30
+    // In this situation, we need to store the old jQuery in a
31
+    // temp variable, set the global jQuery to our yl.jQuery, then let select2
32
+    // set itself up. We restore the global jQuery to its original value in
33
+    // jquery.post-setup.js.
34
+    dal_jquery_backup = jQuery.noConflict(true);
35
+    jQuery = yl.jQuery;
36
+}

+ 7 - 0
app/staticfile/autocomplete_light/jquery.post-setup.js

@@ -0,0 +1,7 @@
1
+if (typeof dal_jquery_backup !== 'undefined') {
2
+    // We made a backup of the original global jQuery before forcing it to our
3
+    // yl.jQuery value. Now that select2 has been set up, we need to restore
4
+    // our backup to its rightful place.
5
+    jQuery = dal_jquery_backup;
6
+    $ = dal_jquery_backup;
7
+}

+ 14 - 0
app/staticfile/autocomplete_light/select2.css

@@ -0,0 +1,14 @@
1
+.select2-container {
2
+    min-width: 20em;
3
+}
4
+
5
+ul li.select2-selection__choice,
6
+ul li.select2-search {
7
+    /* Cancel out django's style */
8
+    list-style-type: none;
9
+}
10
+
11
+.errors .select2-selection {
12
+    /* Highlight select box with error */
13
+    border-color: #ba2121;
14
+}

+ 122 - 0
app/staticfile/autocomplete_light/select2.js

@@ -0,0 +1,122 @@
1
+;(function ($) {
2
+    if (window.__dal__initListenerIsSet)
3
+        return;
4
+
5
+    $(document).on('autocompleteLightInitialize', '[data-autocomplete-light-function=select2]', function() {
6
+        var element = $(this);
7
+
8
+        // Templating helper
9
+        function template(text, is_html) {
10
+            if (is_html) {
11
+                var $result = $('<span>');
12
+                $result.html(text);
13
+                return $result;
14
+            } else {
15
+                return text;
16
+            }
17
+        }
18
+
19
+        function result_template(item) {
20
+            var text = template(item.text,
21
+                element.attr('data-html') !== undefined || element.attr('data-result-html') !== undefined
22
+            );
23
+
24
+            if (item.create_id) {
25
+                return $('<span></span>').text(text).addClass('dal-create')
26
+            } else {
27
+                return text
28
+            }
29
+        }
30
+
31
+        function selected_template(item) {
32
+            if (item.selected_text !== undefined) {
33
+                return template(item.selected_text,
34
+                    element.attr('data-html') !== undefined || element.attr('data-selected-html') !== undefined
35
+                );
36
+            } else {
37
+                return result_template(item);
38
+            }
39
+            return
40
+        }
41
+
42
+        var ajax = null;
43
+        if ($(this).attr('data-autocomplete-light-url')) {
44
+            ajax = {
45
+                url: $(this).attr('data-autocomplete-light-url'),
46
+                dataType: 'json',
47
+                delay: 250,
48
+
49
+                data: function (params) {
50
+                    var data = {
51
+                        q: params.term, // search term
52
+                        page: params.page,
53
+                        create: element.attr('data-autocomplete-light-create') && !element.attr('data-tags'),
54
+                        forward: yl.getForwards(element)
55
+                    };
56
+
57
+                    return data;
58
+                },
59
+                processResults: function (data, page) {
60
+                    if (element.attr('data-tags')) {
61
+                        $.each(data.results, function(index, value) {
62
+                            value.id = value.text;
63
+                        });
64
+                    }
65
+
66
+                    return data;
67
+                },
68
+                cache: true
69
+            };
70
+        }
71
+
72
+        $(this).select2({
73
+            tokenSeparators: element.attr('data-tags') ? [','] : null,
74
+            debug: true,
75
+            containerCssClass: ':all:',
76
+            placeholder: element.attr('data-placeholder') || '',
77
+            language: element.attr('data-autocomplete-light-language'),
78
+            minimumInputLength: element.attr('data-minimum-input-length') || 0,
79
+            allowClear: ! $(this).is('[required]'),
80
+            templateResult: result_template,
81
+            templateSelection: selected_template,
82
+            ajax: ajax,
83
+            tags: Boolean(element.attr('data-tags')),
84
+        });
85
+
86
+        $(this).on('select2:selecting', function (e) {
87
+            var data = e.params.args.data;
88
+
89
+            if (data.create_id !== true)
90
+                return;
91
+
92
+            e.preventDefault();
93
+
94
+            var select = $(this);
95
+
96
+            $.ajax({
97
+                url: $(this).attr('data-autocomplete-light-url'),
98
+                type: 'POST',
99
+                dataType: 'json',
100
+                data: {
101
+                    text: data.id,
102
+                    forward: yl.getForwards($(this))
103
+                },
104
+                beforeSend: function(xhr, settings) {
105
+                    xhr.setRequestHeader("X-CSRFToken", document.csrftoken);
106
+                },
107
+                success: function(data, textStatus, jqXHR ) {
108
+                    select.append(
109
+                        $('<option>', {value: data.id, text: data.text, selected: true})
110
+                    );
111
+                    select.trigger('change');
112
+                    select.select2('close');
113
+                }
114
+            });
115
+        });
116
+
117
+    });
118
+    window.__dal__initListenerIsSet = true;
119
+    $('[data-autocomplete-light-function=select2]:not([id*="__prefix__"])').each(function() {
120
+        window.__dal__initialize(this);
121
+    });
122
+})(yl.jQuery);

BIN
app/staticfile/img/heartbeat.png


+ 22 - 0
app/staticfile/import_export/action_formats.js

@@ -0,0 +1,22 @@
1
+(function($) {
2
+  $(document).ready(function() {
3
+    var $actionsSelect, $formatsElement;
4
+    if ($('body').hasClass('grp-change-list')) {
5
+        // using grappelli
6
+        $actionsSelect = $('#grp-changelist-form select[name="action"]');
7
+        $formatsElement = $('#grp-changelist-form select[name="file_format"]');
8
+    } else {
9
+        // using default admin
10
+        $actionsSelect = $('#changelist-form select[name="action"]');
11
+        $formatsElement = $('#changelist-form select[name="file_format"]').parent();
12
+    }
13
+    $actionsSelect.change(function() {
14
+      if ($(this).val() === 'export_admin_action') {
15
+        $formatsElement.show();
16
+      } else {
17
+        $formatsElement.hide();
18
+      }
19
+    });
20
+    $actionsSelect.change();
21
+  });
22
+})(django.jQuery);

+ 81 - 0
app/staticfile/import_export/import.css

@@ -0,0 +1,81 @@
1
+.import-preview .errors {
2
+  position: relative;
3
+}
4
+
5
+.validation-error-count {
6
+  display: inline-block;
7
+  background-color: #e40000;
8
+  border-radius: 6px;
9
+  color: white;
10
+  font-size: 0.9em;
11
+  position: relative;
12
+  font-weight: bold;
13
+  margin-top: -2px;
14
+  padding: 0.2em 0.4em;
15
+}
16
+
17
+.validation-error-container {
18
+  position: absolute;
19
+  opacity: 0;
20
+  pointer-events: none;
21
+  background-color: #ffc1c1;
22
+  padding: 14px 15px 10px;
23
+  top: 25px;
24
+  margin: 0 0 20px 0;
25
+  width: 200px;
26
+  z-index: 2;
27
+}
28
+
29
+table.import-preview tr.skip {
30
+  background-color: #d2d2d2;
31
+}
32
+
33
+table.import-preview tr.new {
34
+  background-color: #bdd8b2;
35
+}
36
+
37
+table.import-preview tr.delete {
38
+  background-color: #f9bebf;
39
+}
40
+
41
+table.import-preview tr.update {
42
+  background-color: #fdfdcf;
43
+}
44
+
45
+.import-preview td:hover .validation-error-count {
46
+  z-index: 3;
47
+}
48
+.import-preview td:hover .validation-error-container {
49
+  opacity: 1;
50
+  pointer-events: auto;
51
+}
52
+
53
+.validation-error-list {
54
+  margin: 0;
55
+  padding: 0;
56
+}
57
+
58
+.validation-error-list li {
59
+  list-style: none;
60
+  margin: 0;
61
+}
62
+
63
+.validation-error-list > li > ul {
64
+  margin: 8px 0;
65
+  padding: 0;
66
+}
67
+
68
+.validation-error-list > li > ul > li {
69
+  padding: 0;
70
+  margin: 0 0 10px;
71
+  line-height: 1.28em;
72
+}
73
+
74
+.validation-error-field-label {
75
+  display: block;
76
+  border-bottom: 1px solid #e40000;
77
+  color: #e40000;
78
+  text-transform: uppercase;
79
+  font-weight: bold;
80
+  font-size: 0.85em;
81
+}

+ 15 - 0
app/staticfile/js/main.js

@@ -0,0 +1,15 @@
1
+$(function(){
2
+    $("#currentLocationBtn").click(function(){
3
+        if ("geolocation" in navigator){ //check geolocation available
4
+            //try to get user current location using getCurrentPosition() method
5
+            console.log("current location");
6
+            navigator.geolocation.getCurrentPosition(function(position){
7
+                console.log("xxxx");
8
+                $("#geoText").val(position.coords.latitude+","+position.coords.longitude );
9
+
10
+            });
11
+        }else{
12
+            console.log("Browser doesn't support geolocation!");
13
+        }
14
+    });
15
+});

+ 262 - 0
app/staticfile/vendor/select2/Gruntfile.js

@@ -0,0 +1,262 @@
1
+const sass = require('node-sass');
2
+
3
+module.exports = function (grunt) {
4
+  // Full list of files that must be included by RequireJS
5
+  includes = [
6
+    'jquery.select2',
7
+    'almond',
8
+
9
+    'jquery-mousewheel' // shimmed for non-full builds
10
+  ];
11
+
12
+  fullIncludes = [
13
+    'jquery',
14
+
15
+    'select2/compat/containerCss',
16
+    'select2/compat/dropdownCss',
17
+
18
+    'select2/compat/initSelection',
19
+    'select2/compat/inputData',
20
+    'select2/compat/matcher',
21
+    'select2/compat/query',
22
+
23
+    'select2/dropdown/attachContainer',
24
+    'select2/dropdown/stopPropagation',
25
+
26
+    'select2/selection/stopPropagation'
27
+  ].concat(includes);
28
+
29
+  var i18nModules = [];
30
+  var i18nPaths = {};
31
+
32
+  var i18nFiles = grunt.file.expand({
33
+    cwd: 'src/js'
34
+  }, 'select2/i18n/*.js');
35
+
36
+  var testFiles = grunt.file.expand('tests/**/*.html');
37
+  var testUrls = testFiles.map(function (filePath) {
38
+    return 'http://localhost:9999/' + filePath;
39
+  });
40
+
41
+  var testBuildNumber = "unknown";
42
+
43
+  if (process.env.TRAVIS_JOB_ID) {
44
+    testBuildNumber = "travis-" + process.env.TRAVIS_JOB_ID;
45
+  } else {
46
+    var currentTime = new Date();
47
+
48
+    testBuildNumber = "manual-" + currentTime.getTime();
49
+  }
50
+
51
+  for (var i = 0; i < i18nFiles.length; i++) {
52
+    var file = i18nFiles[i];
53
+    var name = file.split('.')[0];
54
+
55
+    i18nModules.push({
56
+      name: name
57
+    });
58
+
59
+    i18nPaths[name] = '../../' + name;
60
+  }
61
+
62
+  var minifiedBanner = '/*! Select2 <%= package.version %> | https://github.com/select2/select2/blob/master/LICENSE.md */';
63
+
64
+  grunt.initConfig({
65
+    package: grunt.file.readJSON('package.json'),
66
+
67
+    concat: {
68
+      'dist': {
69
+        options: {
70
+          banner: grunt.file.read('src/js/wrapper.start.js'),
71
+        },
72
+        src: [
73
+          'dist/js/select2.js',
74
+          'src/js/wrapper.end.js'
75
+        ],
76
+        dest: 'dist/js/select2.js'
77
+      },
78
+      'dist.full': {
79
+        options: {
80
+          banner: grunt.file.read('src/js/wrapper.start.js'),
81
+        },
82
+        src: [
83
+          'dist/js/select2.full.js',
84
+          'src/js/wrapper.end.js'
85
+        ],
86
+        dest: 'dist/js/select2.full.js'
87
+      }
88
+    },
89
+
90
+    connect: {
91
+      tests: {
92
+        options: {
93
+          base: '.',
94
+          hostname: '127.0.0.1',
95
+          port: 9999
96
+        }
97
+      }
98
+    },
99
+
100
+    uglify: {
101
+      'dist': {
102
+        src: 'dist/js/select2.js',
103
+        dest: 'dist/js/select2.min.js',
104
+        options: {
105
+          banner: minifiedBanner
106
+        }
107
+      },
108
+      'dist.full': {
109
+        src: 'dist/js/select2.full.js',
110
+        dest: 'dist/js/select2.full.min.js',
111
+        options: {
112
+          banner: minifiedBanner
113
+        }
114
+      }
115
+    },
116
+
117
+    qunit: {
118
+      all: {
119
+        options: {
120
+          urls: testUrls
121
+        }
122
+      }
123
+    },
124
+
125
+    jshint: {
126
+      options: {
127
+        jshintrc: true,
128
+        reporterOutput: ''
129
+      },
130
+      code: {
131
+        src: ['src/js/**/*.js']
132
+      },
133
+      tests: {
134
+        src: ['tests/**/*.js']
135
+      }
136
+    },
137
+
138
+    sass: {
139
+      dist: {
140
+        options: {
141
+          implementation: sass,
142
+          outputStyle: 'compressed'
143
+        },
144
+        files: {
145
+          'dist/css/select2.min.css': [
146
+            'src/scss/core.scss',
147
+            'src/scss/theme/default/layout.css'
148
+          ]
149
+        }
150
+      },
151
+      dev: {
152
+        options: {
153
+          implementation: sass,
154
+          outputStyle: 'nested'
155
+        },
156
+        files: {
157
+          'dist/css/select2.css': [
158
+            'src/scss/core.scss',
159
+            'src/scss/theme/default/layout.css'
160
+          ]
161
+        }
162
+      }
163
+    },
164
+
165
+    requirejs: {
166
+      'dist': {
167
+        options: {
168
+          baseUrl: 'src/js',
169
+          optimize: 'none',
170
+          name: 'select2/core',
171
+          out: 'dist/js/select2.js',
172
+          include: includes,
173
+          namespace: 'S2',
174
+          paths: {
175
+            'almond': require.resolve('almond').slice(0, -3),
176
+            'jquery': 'jquery.shim',
177
+            'jquery-mousewheel': 'jquery.mousewheel.shim'
178
+          },
179
+          wrap: {
180
+            startFile: 'src/js/banner.start.js',
181
+            endFile: 'src/js/banner.end.js'
182
+          }
183
+        }
184
+      },
185
+      'dist.full': {
186
+        options: {
187
+          baseUrl: 'src/js',
188
+          optimize: 'none',
189
+          name: 'select2/core',
190
+          out: 'dist/js/select2.full.js',
191
+          include: fullIncludes,
192
+          namespace: 'S2',
193
+          paths: {
194
+            'almond': require.resolve('almond').slice(0, -3),
195
+            'jquery': 'jquery.shim',
196
+            'jquery-mousewheel': require.resolve('jquery-mousewheel').slice(0, -3)
197
+          },
198
+          wrap: {
199
+            startFile: 'src/js/banner.start.js',
200
+            endFile: 'src/js/banner.end.js'
201
+          }
202
+        }
203
+      },
204
+      'i18n': {
205
+        options: {
206
+          baseUrl: 'src/js/select2/i18n',
207
+          dir: 'dist/js/i18n',
208
+          paths: i18nPaths,
209
+          modules: i18nModules,
210
+          namespace: 'S2',
211
+          wrap: {
212
+            start: minifiedBanner + grunt.file.read('src/js/banner.start.js'),
213
+            end: grunt.file.read('src/js/banner.end.js')
214
+          }
215
+        }
216
+      }
217
+    },
218
+
219
+    watch: {
220
+      js: {
221
+        files: [
222
+          'src/js/select2/**/*.js',
223
+          'tests/**/*.js'
224
+        ],
225
+        tasks: [
226
+          'compile',
227
+          'test',
228
+          'minify'
229
+        ]
230
+      },
231
+      css: {
232
+        files: [
233
+          'src/scss/**/*.scss'
234
+        ],
235
+        tasks: [
236
+          'compile',
237
+          'minify'
238
+        ]
239
+      }
240
+    }
241
+  });
242
+
243
+  grunt.loadNpmTasks('grunt-contrib-concat');
244
+  grunt.loadNpmTasks('grunt-contrib-connect');
245
+  grunt.loadNpmTasks('grunt-contrib-jshint');
246
+  grunt.loadNpmTasks('grunt-contrib-qunit');
247
+  grunt.loadNpmTasks('grunt-contrib-requirejs');
248
+  grunt.loadNpmTasks('grunt-contrib-uglify');
249
+  grunt.loadNpmTasks('grunt-contrib-watch');
250
+
251
+  grunt.loadNpmTasks('grunt-sass');
252
+
253
+  grunt.registerTask('default', ['compile', 'test', 'minify']);
254
+
255
+  grunt.registerTask('compile', [
256
+    'requirejs:dist', 'requirejs:dist.full', 'requirejs:i18n',
257
+    'concat:dist', 'concat:dist.full',
258
+    'sass:dev'
259
+  ]);
260
+  grunt.registerTask('minify', ['uglify', 'sass:dist']);
261
+  grunt.registerTask('test', ['connect:tests', 'qunit', 'jshint']);
262
+};

+ 13 - 0
app/staticfile/vendor/select2/bower.json

@@ -0,0 +1,13 @@
1
+{
2
+    "name": "select2",
3
+    "description": "Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.",
4
+    "main": [
5
+        "dist/js/select2.js",
6
+        "src/scss/core.scss"
7
+    ],
8
+    "license": "MIT",
9
+    "repository": {
10
+        "type": "git",
11
+        "url": "git@github.com:select2/select2.git"
12
+    }
13
+}

+ 19 - 0
app/staticfile/vendor/select2/component.json

@@ -0,0 +1,19 @@
1
+{
2
+  "name": "select2",
3
+  "repo": "select/select2",
4
+  "description": "Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.",
5
+  "version": "4.0.7",
6
+  "demo": "https://select2.org/",
7
+  "keywords": [
8
+    "jquery"
9
+  ],
10
+  "main": "dist/js/select2.js",
11
+  "styles": [
12
+    "dist/css/select2.css"
13
+  ],
14
+  "scripts": [
15
+    "dist/js/select2.js",
16
+    "dist/js/i18n/*.js"
17
+  ],
18
+  "license": "MIT"
19
+}

+ 22 - 0
app/staticfile/vendor/select2/composer.json

@@ -0,0 +1,22 @@
1
+{
2
+  "name": "select2/select2",
3
+  "description": "Select2 is a jQuery based replacement for select boxes.",
4
+  "type": "component",
5
+  "homepage": "https://select2.org/",
6
+  "license": "MIT",
7
+  "extra": {
8
+    "component": {
9
+      "scripts": [
10
+        "dist/js/select2.js"
11
+      ],
12
+      "styles": [
13
+        "dist/css/select2.css"
14
+      ],
15
+      "files": [
16
+        "dist/js/select2.js",
17
+        "dist/js/i18n/*.js",
18
+        "dist/css/select2.css"
19
+      ]
20
+    }
21
+  }
22
+}

+ 484 - 0
app/staticfile/vendor/select2/dist/css/select2.css

@@ -0,0 +1,484 @@
1
+.select2-container {
2
+  box-sizing: border-box;
3
+  display: inline-block;
4
+  margin: 0;
5
+  position: relative;
6
+  vertical-align: middle; }
7
+  .select2-container .select2-selection--single {
8
+    box-sizing: border-box;
9
+    cursor: pointer;
10
+    display: block;
11
+    height: 28px;
12
+    user-select: none;
13
+    -webkit-user-select: none; }
14
+    .select2-container .select2-selection--single .select2-selection__rendered {
15
+      display: block;
16
+      padding-left: 8px;
17
+      padding-right: 20px;
18
+      overflow: hidden;
19
+      text-overflow: ellipsis;
20
+      white-space: nowrap; }
21
+    .select2-container .select2-selection--single .select2-selection__clear {
22
+      position: relative; }
23
+  .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
24
+    padding-right: 8px;
25
+    padding-left: 20px; }
26
+  .select2-container .select2-selection--multiple {
27
+    box-sizing: border-box;
28
+    cursor: pointer;
29
+    display: block;
30
+    min-height: 32px;
31
+    user-select: none;
32
+    -webkit-user-select: none; }
33
+    .select2-container .select2-selection--multiple .select2-selection__rendered {
34
+      display: inline-block;
35
+      overflow: hidden;
36
+      padding-left: 8px;
37
+      text-overflow: ellipsis;
38
+      white-space: nowrap; }
39
+  .select2-container .select2-search--inline {
40
+    float: left; }
41
+    .select2-container .select2-search--inline .select2-search__field {
42
+      box-sizing: border-box;
43
+      border: none;
44
+      font-size: 100%;
45
+      margin-top: 5px;
46
+      padding: 0; }
47
+      .select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
48
+        -webkit-appearance: none; }
49
+
50
+.select2-dropdown {
51
+  background-color: white;
52
+  border: 1px solid #aaa;
53
+  border-radius: 4px;
54
+  box-sizing: border-box;
55
+  display: block;
56
+  position: absolute;
57
+  left: -100000px;
58
+  width: 100%;
59
+  z-index: 1051; }
60
+
61
+.select2-results {
62
+  display: block; }
63
+
64
+.select2-results__options {
65
+  list-style: none;
66
+  margin: 0;
67
+  padding: 0; }
68
+
69
+.select2-results__option {
70
+  padding: 6px;
71
+  user-select: none;
72
+  -webkit-user-select: none; }
73
+  .select2-results__option[aria-selected] {
74
+    cursor: pointer; }
75
+
76
+.select2-container--open .select2-dropdown {
77
+  left: 0; }
78
+
79
+.select2-container--open .select2-dropdown--above {
80
+  border-bottom: none;
81
+  border-bottom-left-radius: 0;
82
+  border-bottom-right-radius: 0; }
83
+
84
+.select2-container--open .select2-dropdown--below {
85
+  border-top: none;
86
+  border-top-left-radius: 0;
87
+  border-top-right-radius: 0; }
88
+
89
+.select2-search--dropdown {
90
+  display: block;
91
+  padding: 4px; }
92
+  .select2-search--dropdown .select2-search__field {
93
+    padding: 4px;
94
+    width: 100%;
95
+    box-sizing: border-box; }
96
+    .select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
97
+      -webkit-appearance: none; }
98
+  .select2-search--dropdown.select2-search--hide {
99
+    display: none; }
100
+
101
+.select2-close-mask {
102
+  border: 0;
103
+  margin: 0;
104
+  padding: 0;
105
+  display: block;
106
+  position: fixed;
107
+  left: 0;
108
+  top: 0;
109
+  min-height: 100%;
110
+  min-width: 100%;
111
+  height: auto;
112
+  width: auto;
113
+  opacity: 0;
114
+  z-index: 99;
115
+  background-color: #fff;
116
+  filter: alpha(opacity=0); }
117
+
118
+.select2-hidden-accessible {
119
+  border: 0 !important;
120
+  clip: rect(0 0 0 0) !important;
121
+  -webkit-clip-path: inset(50%) !important;
122
+  clip-path: inset(50%) !important;
123
+  height: 1px !important;
124
+  overflow: hidden !important;
125
+  padding: 0 !important;
126
+  position: absolute !important;
127
+  width: 1px !important;
128
+  white-space: nowrap !important; }
129
+
130
+.select2-container--default .select2-selection--single {
131
+  background-color: #fff;
132
+  border: 1px solid #aaa;
133
+  border-radius: 4px; }
134
+  .select2-container--default .select2-selection--single .select2-selection__rendered {
135
+    color: #444;
136
+    line-height: 28px; }
137
+  .select2-container--default .select2-selection--single .select2-selection__clear {
138
+    cursor: pointer;
139
+    float: right;
140
+    font-weight: bold; }
141
+  .select2-container--default .select2-selection--single .select2-selection__placeholder {
142
+    color: #999; }
143
+  .select2-container--default .select2-selection--single .select2-selection__arrow {
144
+    height: 26px;
145
+    position: absolute;
146
+    top: 1px;
147
+    right: 1px;
148
+    width: 20px; }
149
+    .select2-container--default .select2-selection--single .select2-selection__arrow b {
150
+      border-color: #888 transparent transparent transparent;
151
+      border-style: solid;
152
+      border-width: 5px 4px 0 4px;
153
+      height: 0;
154
+      left: 50%;
155
+      margin-left: -4px;
156
+      margin-top: -2px;
157
+      position: absolute;
158
+      top: 50%;
159
+      width: 0; }
160
+
161
+.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
162
+  float: left; }
163
+
164
+.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
165
+  left: 1px;
166
+  right: auto; }
167
+
168
+.select2-container--default.select2-container--disabled .select2-selection--single {
169
+  background-color: #eee;
170
+  cursor: default; }
171
+  .select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
172
+    display: none; }
173
+
174
+.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
175
+  border-color: transparent transparent #888 transparent;
176
+  border-width: 0 4px 5px 4px; }
177
+
178
+.select2-container--default .select2-selection--multiple {
179
+  background-color: white;
180
+  border: 1px solid #aaa;
181
+  border-radius: 4px;
182
+  cursor: text; }
183
+  .select2-container--default .select2-selection--multiple .select2-selection__rendered {
184
+    box-sizing: border-box;
185
+    list-style: none;
186
+    margin: 0;
187
+    padding: 0 5px;
188
+    width: 100%; }
189
+    .select2-container--default .select2-selection--multiple .select2-selection__rendered li {
190
+      list-style: none; }
191
+  .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
192
+    color: #999;
193
+    margin-top: 5px;
194
+    float: left; }
195
+  .select2-container--default .select2-selection--multiple .select2-selection__clear {
196
+    cursor: pointer;
197
+    float: right;
198
+    font-weight: bold;
199
+    margin-top: 5px;
200
+    margin-right: 10px; }
201
+  .select2-container--default .select2-selection--multiple .select2-selection__choice {
202
+    background-color: #e4e4e4;
203
+    border: 1px solid #aaa;
204
+    border-radius: 4px;
205
+    cursor: default;
206
+    float: left;
207
+    margin-right: 5px;
208
+    margin-top: 5px;
209
+    padding: 0 5px; }
210
+  .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
211
+    color: #999;
212
+    cursor: pointer;
213
+    display: inline-block;
214
+    font-weight: bold;
215
+    margin-right: 2px; }
216
+    .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
217
+      color: #333; }
218
+
219
+.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
220
+  float: right; }
221
+
222
+.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
223
+  margin-left: 5px;
224
+  margin-right: auto; }
225
+
226
+.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
227
+  margin-left: 2px;
228
+  margin-right: auto; }
229
+
230
+.select2-container--default.select2-container--focus .select2-selection--multiple {
231
+  border: solid black 1px;
232
+  outline: 0; }
233
+
234
+.select2-container--default.select2-container--disabled .select2-selection--multiple {
235
+  background-color: #eee;
236
+  cursor: default; }
237
+
238
+.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
239
+  display: none; }
240
+
241
+.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
242
+  border-top-left-radius: 0;
243
+  border-top-right-radius: 0; }
244
+
245
+.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
246
+  border-bottom-left-radius: 0;
247
+  border-bottom-right-radius: 0; }
248
+
249
+.select2-container--default .select2-search--dropdown .select2-search__field {
250
+  border: 1px solid #aaa; }
251
+
252
+.select2-container--default .select2-search--inline .select2-search__field {
253
+  background: transparent;
254
+  border: none;
255
+  outline: 0;
256
+  box-shadow: none;
257
+  -webkit-appearance: textfield; }
258
+
259
+.select2-container--default .select2-results > .select2-results__options {
260
+  max-height: 200px;
261
+  overflow-y: auto; }
262
+
263
+.select2-container--default .select2-results__option[role=group] {
264
+  padding: 0; }
265
+
266
+.select2-container--default .select2-results__option[aria-disabled=true] {
267
+  color: #999; }
268
+
269
+.select2-container--default .select2-results__option[aria-selected=true] {
270
+  background-color: #ddd; }
271
+
272
+.select2-container--default .select2-results__option .select2-results__option {
273
+  padding-left: 1em; }
274
+  .select2-container--default .select2-results__option .select2-results__option .select2-results__group {
275
+    padding-left: 0; }
276
+  .select2-container--default .select2-results__option .select2-results__option .select2-results__option {
277
+    margin-left: -1em;
278
+    padding-left: 2em; }
279
+    .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
280
+      margin-left: -2em;
281
+      padding-left: 3em; }
282
+      .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
283
+        margin-left: -3em;
284
+        padding-left: 4em; }
285
+        .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
286
+          margin-left: -4em;
287
+          padding-left: 5em; }
288
+          .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
289
+            margin-left: -5em;
290
+            padding-left: 6em; }
291
+
292
+.select2-container--default .select2-results__option--highlighted[aria-selected] {
293
+  background-color: #5897fb;
294
+  color: white; }
295
+
296
+.select2-container--default .select2-results__group {
297
+  cursor: default;
298
+  display: block;
299
+  padding: 6px; }
300
+
301
+.select2-container--classic .select2-selection--single {
302
+  background-color: #f7f7f7;
303
+  border: 1px solid #aaa;
304
+  border-radius: 4px;
305
+  outline: 0;
306
+  background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
307
+  background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
308
+  background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
309
+  background-repeat: repeat-x;
310
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
311
+  .select2-container--classic .select2-selection--single:focus {
312
+    border: 1px solid #5897fb; }
313
+  .select2-container--classic .select2-selection--single .select2-selection__rendered {
314
+    color: #444;
315
+    line-height: 28px; }
316
+  .select2-container--classic .select2-selection--single .select2-selection__clear {
317
+    cursor: pointer;
318
+    float: right;
319
+    font-weight: bold;
320
+    margin-right: 10px; }
321
+  .select2-container--classic .select2-selection--single .select2-selection__placeholder {
322
+    color: #999; }
323
+  .select2-container--classic .select2-selection--single .select2-selection__arrow {
324
+    background-color: #ddd;
325
+    border: none;
326
+    border-left: 1px solid #aaa;
327
+    border-top-right-radius: 4px;
328
+    border-bottom-right-radius: 4px;
329
+    height: 26px;
330
+    position: absolute;
331
+    top: 1px;
332
+    right: 1px;
333
+    width: 20px;
334
+    background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
335
+    background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
336
+    background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
337
+    background-repeat: repeat-x;
338
+    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
339
+    .select2-container--classic .select2-selection--single .select2-selection__arrow b {
340
+      border-color: #888 transparent transparent transparent;
341
+      border-style: solid;
342
+      border-width: 5px 4px 0 4px;
343
+      height: 0;
344
+      left: 50%;
345
+      margin-left: -4px;
346
+      margin-top: -2px;
347
+      position: absolute;
348
+      top: 50%;
349
+      width: 0; }
350
+
351
+.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
352
+  float: left; }
353
+
354
+.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
355
+  border: none;
356
+  border-right: 1px solid #aaa;
357
+  border-radius: 0;
358
+  border-top-left-radius: 4px;
359
+  border-bottom-left-radius: 4px;
360
+  left: 1px;
361
+  right: auto; }
362
+
363
+.select2-container--classic.select2-container--open .select2-selection--single {
364
+  border: 1px solid #5897fb; }
365
+  .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
366
+    background: transparent;
367
+    border: none; }
368
+    .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
369
+      border-color: transparent transparent #888 transparent;
370
+      border-width: 0 4px 5px 4px; }
371
+
372
+.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
373
+  border-top: none;
374
+  border-top-left-radius: 0;
375
+  border-top-right-radius: 0;
376
+  background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
377
+  background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
378
+  background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
379
+  background-repeat: repeat-x;
380
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
381
+
382
+.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
383
+  border-bottom: none;
384
+  border-bottom-left-radius: 0;
385
+  border-bottom-right-radius: 0;
386
+  background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
387
+  background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
388
+  background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
389
+  background-repeat: repeat-x;
390
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
391
+
392
+.select2-container--classic .select2-selection--multiple {
393
+  background-color: white;
394
+  border: 1px solid #aaa;
395
+  border-radius: 4px;
396
+  cursor: text;
397
+  outline: 0; }
398
+  .select2-container--classic .select2-selection--multiple:focus {
399
+    border: 1px solid #5897fb; }
400
+  .select2-container--classic .select2-selection--multiple .select2-selection__rendered {
401
+    list-style: none;
402
+    margin: 0;
403
+    padding: 0 5px; }
404
+  .select2-container--classic .select2-selection--multiple .select2-selection__clear {
405
+    display: none; }
406
+  .select2-container--classic .select2-selection--multiple .select2-selection__choice {
407
+    background-color: #e4e4e4;
408
+    border: 1px solid #aaa;
409
+    border-radius: 4px;
410
+    cursor: default;
411
+    float: left;
412
+    margin-right: 5px;
413
+    margin-top: 5px;
414
+    padding: 0 5px; }
415
+  .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
416
+    color: #888;
417
+    cursor: pointer;
418
+    display: inline-block;
419
+    font-weight: bold;
420
+    margin-right: 2px; }
421
+    .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
422
+      color: #555; }
423
+
424
+.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
425
+  float: right;
426
+  margin-left: 5px;
427
+  margin-right: auto; }
428
+
429
+.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
430
+  margin-left: 2px;
431
+  margin-right: auto; }
432
+
433
+.select2-container--classic.select2-container--open .select2-selection--multiple {
434
+  border: 1px solid #5897fb; }
435
+
436
+.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
437
+  border-top: none;
438
+  border-top-left-radius: 0;
439
+  border-top-right-radius: 0; }
440
+
441
+.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
442
+  border-bottom: none;
443
+  border-bottom-left-radius: 0;
444
+  border-bottom-right-radius: 0; }
445
+
446
+.select2-container--classic .select2-search--dropdown .select2-search__field {
447
+  border: 1px solid #aaa;
448
+  outline: 0; }
449
+
450
+.select2-container--classic .select2-search--inline .select2-search__field {
451
+  outline: 0;
452
+  box-shadow: none; }
453
+
454
+.select2-container--classic .select2-dropdown {
455
+  background-color: white;
456
+  border: 1px solid transparent; }
457
+
458
+.select2-container--classic .select2-dropdown--above {
459
+  border-bottom: none; }
460
+
461
+.select2-container--classic .select2-dropdown--below {
462
+  border-top: none; }
463
+
464
+.select2-container--classic .select2-results > .select2-results__options {
465
+  max-height: 200px;
466
+  overflow-y: auto; }
467
+
468
+.select2-container--classic .select2-results__option[role=group] {
469
+  padding: 0; }
470
+
471
+.select2-container--classic .select2-results__option[aria-disabled=true] {
472
+  color: grey; }
473
+
474
+.select2-container--classic .select2-results__option--highlighted[aria-selected] {
475
+  background-color: #3875d7;
476
+  color: white; }
477
+
478
+.select2-container--classic .select2-results__group {
479
+  cursor: default;
480
+  display: block;
481
+  padding: 6px; }
482
+
483
+.select2-container--classic.select2-container--open .select2-dropdown {
484
+  border-color: #5897fb; }

Разлика између датотеке није приказан због своје велике величине
+ 1 - 0
app/staticfile/vendor/select2/dist/css/select2.min.css


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/af.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/ar.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/az.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/bg.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/bn.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/bs.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/ca.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/cs.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/da.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/de.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/dsb.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/el.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/en.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/es.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/et.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/eu.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/fa.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/fi.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/fr.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/gl.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/he.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/hi.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/hr.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/hsb.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/hu.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/hy.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/id.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/is.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/it.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/ja.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/ka.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/km.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/ko.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/lt.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/lv.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/mk.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/ms.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/nb.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/ne.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/nl.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/pl.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/ps.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/pt-BR.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/pt.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/ro.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/ru.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/sk.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/sl.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/sq.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/sr-Cyrl.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/sr.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/sv.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/th.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/tk.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/tr.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/uk.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/vi.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/zh-CN.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
app/staticfile/vendor/select2/dist/js/i18n/zh-TW.js


Разлика између датотеке није приказан због своје велике величине
+ 6597 - 0
app/staticfile/vendor/select2/dist/js/select2.full.js


Разлика између датотеке није приказан због своје велике величине
+ 2 - 0
app/staticfile/vendor/select2/dist/js/select2.full.min.js


Разлика између датотеке није приказан због своје велике величине
+ 5885 - 0
app/staticfile/vendor/select2/dist/js/select2.js


Разлика између датотеке није приказан због своје велике величине
+ 2 - 0
app/staticfile/vendor/select2/dist/js/select2.min.js


+ 12 - 0
app/staticfile/vendor/select2/docs/announcements-4.0.html

@@ -0,0 +1,12 @@
1
+<!DOCTYPE html>
2
+<html>
3
+  <head>
4
+    <meta charset="UTF-8">
5
+    <title>select2</title>
6
+  </head>
7
+  <body>
8
+    <script>
9
+      window.location = 'https://select2.org/upgrading/new-in-40';
10
+    </script>
11
+  </body>
12
+</html>

+ 12 - 0
app/staticfile/vendor/select2/docs/community.html

@@ -0,0 +1,12 @@
1
+<!DOCTYPE html>
2
+<html>
3
+  <head>
4
+    <meta charset="UTF-8">
5
+    <title>select2</title>
6
+  </head>
7
+  <body>
8
+    <script>
9
+      window.location = 'https://select2.org/getting-help';
10
+    </script>
11
+  </body>
12
+</html>

+ 12 - 0
app/staticfile/vendor/select2/docs/examples.html

@@ -0,0 +1,12 @@
1
+<!DOCTYPE html>
2
+<html>
3
+  <head>
4
+    <meta charset="UTF-8">
5
+    <title>select2</title>
6
+  </head>
7
+  <body>
8
+    <script>
9
+      window.location = 'https://select2.org/getting-started/basic-usage';
10
+    </script>
11
+  </body>
12
+</html>

+ 12 - 0
app/staticfile/vendor/select2/docs/index.html

@@ -0,0 +1,12 @@
1
+<!DOCTYPE html>
2
+<html>
3
+  <head>
4
+    <meta charset="UTF-8">
5
+    <title>select2</title>
6
+  </head>
7
+  <body>
8
+    <script>
9
+      window.location = 'https://select2.org';
10
+    </script>
11
+  </body>
12
+</html>

+ 12 - 0
app/staticfile/vendor/select2/docs/options-old.html

@@ -0,0 +1,12 @@
1
+<!DOCTYPE html>
2
+<html>
3
+  <head>
4
+    <meta charset="UTF-8">
5
+    <title>select2</title>
6
+  </head>
7
+  <body>
8
+    <script>
9
+      window.location = 'https://select2.org/configuration';
10
+    </script>
11
+  </body>
12
+</html>

+ 12 - 0
app/staticfile/vendor/select2/docs/options.html

@@ -0,0 +1,12 @@
1
+<!DOCTYPE html>
2
+<html>
3
+  <head>
4
+    <meta charset="UTF-8">
5
+    <title>select2</title>
6
+  </head>
7
+  <body>
8
+    <script>
9
+      window.location = 'https://select2.org/configuration';
10
+    </script>
11
+  </body>
12
+</html>

+ 65 - 0
app/staticfile/vendor/select2/package.json

@@ -0,0 +1,65 @@
1
+{
2
+  "name": "select2",
3
+  "description": "Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.",
4
+  "homepage": "https://select2.org",
5
+  "author": {
6
+    "name": "Kevin Brown",
7
+    "url": "https://github.com/kevin-brown"
8
+  },
9
+  "contributors": [
10
+    {
11
+      "name": "Igor Vaynberg",
12
+      "url": "https://github.com/ivaynberg"
13
+    },
14
+    {
15
+      "name": "Alex Weissman",
16
+      "url": "https://github.com/alexweissman"
17
+    }
18
+  ],
19
+  "repository": {
20
+    "type": "git",
21
+    "url": "git://github.com/select2/select2.git"
22
+  },
23
+  "bugs": {
24
+    "url": "https://github.com/select2/select2/issues"
25
+  },
26
+  "keywords": [
27
+    "select",
28
+    "autocomplete",
29
+    "typeahead",
30
+    "dropdown",
31
+    "multiselect",
32
+    "tag",
33
+    "tagging"
34
+  ],
35
+  "license": "MIT",
36
+  "main": "dist/js/select2.js",
37
+  "style": "dist/css/select2.css",
38
+  "files": [
39
+    "src",
40
+    "dist"
41
+  ],
42
+  "version": "4.0.7",
43
+  "jspm": {
44
+    "main": "js/select2",
45
+    "directories": {
46
+      "lib": "dist"
47
+    }
48
+  },
49
+  "devDependencies": {
50
+    "almond": "~0.3.1",
51
+    "grunt": "^0.4.5",
52
+    "grunt-cli": "^1.3.2",
53
+    "grunt-contrib-concat": "^1.0.1",
54
+    "grunt-contrib-connect": "^2.0.0",
55
+    "grunt-contrib-jshint": "^1.1.0",
56
+    "grunt-contrib-qunit": "^1.3.0",
57
+    "grunt-contrib-requirejs": "^1.0.0",
58
+    "grunt-contrib-uglify": "~4.0.1",
59
+    "grunt-contrib-watch": "~1.1.0",
60
+    "grunt-sass": "^2.1.0",
61
+    "jquery-mousewheel": "~3.1.13",
62
+    "node-sass": "^4.12.0"
63
+  },
64
+  "dependencies": {}
65
+}

+ 6 - 0
app/staticfile/vendor/select2/src/js/banner.end.js

@@ -0,0 +1,6 @@
1
+  // Return the AMD loader configuration so it can be used outside of this file
2
+  return {
3
+    define: S2.define,
4
+    require: S2.require
5
+  };
6
+}());

+ 0 - 0
app/staticfile/vendor/select2/src/js/banner.start.js


Неке датотеке нису приказане због велике количине промена

tum/whitesports - Gogs: Simplico Git Service

Bez popisu

update-core.php 43KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262
  1. <?php
  2. /**
  3. * Update Core administration panel.
  4. *
  5. * @package WordPress
  6. * @subpackage Administration
  7. */
  8. /** WordPress Administration Bootstrap */
  9. require_once __DIR__ . '/admin.php';
  10. wp_enqueue_style( 'plugin-install' );
  11. wp_enqueue_script( 'plugin-install' );
  12. wp_enqueue_script( 'updates' );
  13. add_thickbox();
  14. if ( is_multisite() && ! is_network_admin() ) {
  15. wp_redirect( network_admin_url( 'update-core.php' ) );
  16. exit;
  17. }
  18. if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_languages' ) ) {
  19. wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
  20. }
  21. /**
  22. * Lists available core updates.
  23. *
  24. * @since 2.7.0
  25. *
  26. * @global string $wp_local_package Locale code of the package.
  27. * @global wpdb $wpdb WordPress database abstraction object.
  28. *
  29. * @param object $update
  30. */
  31. function list_core_update( $update ) {
  32. global $wp_local_package, $wpdb;
  33. static $first_pass = true;
  34. $wp_version = get_bloginfo( 'version' );
  35. $version_string = sprintf( '%s&ndash;%s', $update->current, get_locale() );
  36. if ( 'en_US' === $update->locale && 'en_US' === get_locale() ) {
  37. $version_string = $update->current;
  38. } elseif ( 'en_US' === $update->locale && $update->packages->partial && $wp_version == $update->partial_version ) {
  39. $updates = get_core_updates();
  40. if ( $updates && 1 === count( $updates ) ) {
  41. // If the only available update is a partial builds, it doesn't need a language-specific version string.
  42. $version_string = $update->current;
  43. }
  44. }
  45. $current = false;
  46. if ( ! isset( $update->response ) || 'latest' === $update->response ) {
  47. $current = true;
  48. }
  49. $message = '';
  50. $form_action = 'update-core.php?action=do-core-upgrade';
  51. $php_version = phpversion();
  52. $mysql_version = $wpdb->db_version();
  53. $show_buttons = true;
  54. // Nightly build versions have two hyphens and a commit number.
  55. if ( preg_match( '/-\w+-\d+/', $update->current ) ) {
  56. // Retrieve the major version number.
  57. preg_match( '/^\d+.\d+/', $update->current, $update_major );
  58. /* translators: %s: WordPress version. */
  59. $submit = sprintf( __( 'Update to latest %s nightly' ), $update_major[0] );
  60. } else {
  61. /* translators: %s: WordPress version. */
  62. $submit = sprintf( __( 'Update to version %s' ), $version_string );
  63. }
  64. if ( 'development' === $update->response ) {
  65. $message = __( 'You can update to the latest nightly build manually:' );
  66. } else {
  67. if ( $current ) {
  68. /* translators: %s: WordPress version. */
  69. $submit = sprintf( __( 'Re-install version %s' ), $version_string );
  70. $form_action = 'update-core.php?action=do-core-reinstall';
  71. } else {
  72. $php_compat = version_compare( $php_version, $update->php_version, '>=' );
  73. if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) {
  74. $mysql_compat = true;
  75. } else {
  76. $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' );
  77. }
  78. $version_url = sprintf(
  79. /* translators: %s: WordPress version. */
  80. esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
  81. sanitize_title( $update->current )
  82. );
  83. $php_update_message = '</p><p>' . sprintf(
  84. /* translators: %s: URL to Update PHP page. */
  85. __( '<a href="%s">Learn more about updating PHP</a>.' ),
  86. esc_url( wp_get_update_php_url() )
  87. );
  88. $annotation = wp_get_update_php_annotation();
  89. if ( $annotation ) {
  90. $php_update_message .= '</p><p><em>' . $annotation . '</em>';
  91. }
  92. if ( ! $mysql_compat && ! $php_compat ) {
  93. $message = sprintf(
  94. /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number. */
  95. __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher and MySQL version %4$s or higher. You are running PHP version %5$s and MySQL version %6$s.' ),
  96. $version_url,
  97. $update->current,
  98. $update->php_version,
  99. $update->mysql_version,
  100. $php_version,
  101. $mysql_version
  102. ) . $php_update_message;
  103. } elseif ( ! $php_compat ) {
  104. $message = sprintf(
  105. /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Current PHP version number. */
  106. __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher. You are running version %4$s.' ),
  107. $version_url,
  108. $update->current,
  109. $update->php_version,
  110. $php_version
  111. ) . $php_update_message;
  112. } elseif ( ! $mysql_compat ) {
  113. $message = sprintf(
  114. /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required MySQL version number, 4: Current MySQL version number. */
  115. __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires MySQL version %3$s or higher. You are running version %4$s.' ),
  116. $version_url,
  117. $update->current,
  118. $update->mysql_version,
  119. $mysql_version
  120. );
  121. } else {
  122. $message = sprintf(
  123. /* translators: 1: Installed WordPress version number, 2: URL to WordPress release notes, 3: New WordPress version number, including locale if necessary. */
  124. __( 'You can update from WordPress %1$s to <a href="%2$s">WordPress %3$s</a> manually:' ),
  125. $wp_version,
  126. $version_url,
  127. $version_string
  128. );
  129. }
  130. if ( ! $mysql_compat || ! $php_compat ) {
  131. $show_buttons = false;
  132. }
  133. }
  134. }
  135. echo '<p>';
  136. echo $message;
  137. echo '</p>';
  138. echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">';
  139. wp_nonce_field( 'upgrade-core' );
  140. echo '<p>';
  141. echo '<input name="version" value="' . esc_attr( $update->current ) . '" type="hidden" />';
  142. echo '<input name="locale" value="' . esc_attr( $update->locale ) . '" type="hidden" />';
  143. if ( $show_buttons ) {
  144. if ( $first_pass ) {
  145. submit_button( $submit, $current ? '' : 'primary regular', 'upgrade', false );
  146. $first_pass = false;
  147. } else {
  148. submit_button( $submit, '', 'upgrade', false );
  149. }
  150. }
  151. if ( 'en_US' !== $update->locale ) {
  152. if ( ! isset( $update->dismissed ) || ! $update->dismissed ) {
  153. submit_button( __( 'Hide this update' ), '', 'dismiss', false );
  154. } else {
  155. submit_button( __( 'Bring back this update' ), '', 'undismiss', false );
  156. }
  157. }
  158. echo '</p>';
  159. if ( 'en_US' !== $update->locale && ( ! isset( $wp_local_package ) || $wp_local_package != $update->locale ) ) {
  160. echo '<p class="hint">' . __( 'This localized version contains both the translation and various other localization fixes.' ) . '</p>';
  161. } elseif ( 'en_US' === $update->locale && 'en_US' !== get_locale() && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) {
  162. // Partial builds don't need language-specific warnings.
  163. echo '<p class="hint">' . sprintf(
  164. /* translators: %s: WordPress version. */
  165. __( 'You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.' ),
  166. 'development' !== $update->response ? $update->current : ''
  167. ) . '</p>';
  168. }
  169. echo '</form>';
  170. }
  171. /**
  172. * Display dismissed updates.
  173. *
  174. * @since 2.7.0
  175. */
  176. function dismissed_updates() {
  177. $dismissed = get_core_updates(
  178. array(
  179. 'dismissed' => true,
  180. 'available' => false,
  181. )
  182. );
  183. if ( $dismissed ) {
  184. $show_text = esc_js( __( 'Show hidden updates' ) );
  185. $hide_text = esc_js( __( 'Hide hidden updates' ) );
  186. ?>
  187. <script type="text/javascript">
  188. jQuery(function( $ ) {
  189. $( 'dismissed-updates' ).show();
  190. $( '#show-dismissed' ).toggle( function() { $( this ).text( '<?php echo $hide_text; ?>' ).attr( 'aria-expanded', 'true' ); }, function() { $( this ).text( '<?php echo $show_text; ?>' ).attr( 'aria-expanded', 'false' ); } );
  191. $( '#show-dismissed' ).click( function() { $( '#dismissed-updates' ).toggle( 'fast' ); } );
  192. });
  193. </script>
  194. <?php
  195. echo '<p class="hide-if-no-js"><button type="button" class="button" id="show-dismissed" aria-expanded="false">' . __( 'Show hidden updates' ) . '</button></p>';
  196. echo '<ul id="dismissed-updates" class="core-updates dismissed">';
  197. foreach ( (array) $dismissed as $update ) {
  198. echo '<li>';
  199. list_core_update( $update );
  200. echo '</li>';
  201. }
  202. echo '</ul>';
  203. }
  204. }
  205. /**
  206. * Display upgrade WordPress for downloading latest or upgrading automatically form.
  207. *
  208. * @since 2.7.0
  209. *
  210. * @global string $required_php_version The required PHP version string.
  211. * @global string $required_mysql_version The required MySQL version string.
  212. */
  213. function core_upgrade_preamble() {
  214. global $required_php_version, $required_mysql_version;
  215. $updates = get_core_updates();
  216. // Include an unmodified $wp_version.
  217. require ABSPATH . WPINC . '/version.php';
  218. $is_development_version = preg_match( '/alpha|beta|RC/', $wp_version );
  219. if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) {
  220. echo '<h2 class="response">';
  221. _e( 'An updated version of WordPress is available.' );
  222. echo '</h2>';
  223. echo '<div class="notice notice-warning inline"><p>';
  224. printf(
  225. /* translators: 1: Documentation on WordPress backups, 2: Documentation on updating WordPress. */
  226. __( '<strong>Important:</strong> Before updating, please <a href="%1$s">back up your database and files</a>. For help with updates, visit the <a href="%2$s">Updating WordPress</a> documentation page.' ),
  227. __( 'https://wordpress.org/support/article/wordpress-backups/' ),
  228. __( 'https://wordpress.org/support/article/updating-wordpress/' )
  229. );
  230. echo '</p></div>';
  231. } elseif ( $is_development_version ) {
  232. echo '<h2 class="response">' . __( 'You are using a development version of WordPress.' ) . '</h2>';
  233. } else {
  234. echo '<h2 class="response">' . __( 'You have the latest version of WordPress.' ) . '</h2>';
  235. }
  236. echo '<ul class="core-updates">';
  237. foreach ( (array) $updates as $update ) {
  238. echo '<li>';
  239. list_core_update( $update );
  240. echo '</li>';
  241. }
  242. echo '</ul>';
  243. // Don't show the maintenance mode notice when we are only showing a single re-install option.
  244. if ( $updates && ( count( $updates ) > 1 || 'latest' !== $updates[0]->response ) ) {
  245. echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, this mode will be deactivated.' ) . '</p>';
  246. } elseif ( ! $updates ) {
  247. list( $normalized_version ) = explode( '-', $wp_version );
  248. echo '<p>' . sprintf(
  249. /* translators: 1: URL to About screen, 2: WordPress version. */
  250. __( '<a href="%1$s">Learn more about WordPress %2$s</a>.' ),
  251. esc_url( self_admin_url( 'about.php' ) ),
  252. $normalized_version
  253. ) . '</p>';
  254. }
  255. dismissed_updates();
  256. }
  257. /**
  258. * Display WordPress auto-updates settings.
  259. *
  260. * @since 5.6.0
  261. */
  262. function core_auto_updates_settings() {
  263. if ( isset( $_GET['core-major-auto-updates-saved'] ) ) {
  264. if ( 'enabled' === $_GET['core-major-auto-updates-saved'] ) {
  265. $notice_text = __( 'Automatic updates for all WordPress versions have been enabled. Thank you!' );
  266. echo '<div class="notice notice-success is-dismissible"><p>' . $notice_text . '</p></div>';
  267. } elseif ( 'disabled' === $_GET['core-major-auto-updates-saved'] ) {
  268. $notice_text = __( 'WordPress will only receive automatic security and maintenance releases from now on.' );
  269. echo '<div class="notice notice-success is-dismissible"><p>' . $notice_text . '</p></div>';
  270. }
  271. }
  272. require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
  273. $updater = new WP_Automatic_Updater();
  274. // Defaults:
  275. $upgrade_dev = get_site_option( 'auto_update_core_dev', 'enabled' ) === 'enabled';
  276. $upgrade_minor = get_site_option( 'auto_update_core_minor', 'enabled' ) === 'enabled';
  277. $upgrade_major = get_site_option( 'auto_update_core_major', 'unset' ) === 'enabled';
  278. $can_set_update_option = true;
  279. // WP_AUTO_UPDATE_CORE = true (all), 'beta', 'rc', 'development', 'branch-development', 'minor', false.
  280. if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) {
  281. if ( false === WP_AUTO_UPDATE_CORE ) {
  282. // Defaults to turned off, unless a filter allows it.
  283. $upgrade_dev = false;
  284. $upgrade_minor = false;
  285. $upgrade_major = false;
  286. } elseif ( true === WP_AUTO_UPDATE_CORE
  287. || in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true )
  288. ) {
  289. // ALL updates for core.
  290. $upgrade_dev = true;
  291. $upgrade_minor = true;
  292. $upgrade_major = true;
  293. } elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) {
  294. // Only minor updates for core.
  295. $upgrade_dev = false;
  296. $upgrade_minor = true;
  297. $upgrade_major = false;
  298. }
  299. // The UI is overridden by the `WP_AUTO_UPDATE_CORE` constant.
  300. $can_set_update_option = false;
  301. }
  302. if ( $updater->is_disabled() ) {
  303. $upgrade_dev = false;
  304. $upgrade_minor = false;
  305. $upgrade_major = false;
  306. /*
  307. * The UI is overridden by the `AUTOMATIC_UPDATER_DISABLED` constant
  308. * or the `automatic_updater_disabled` filter,
  309. * or by `wp_is_file_mod_allowed( 'automatic_updater' )`.
  310. * See `WP_Automatic_Updater::is_disabled()`.
  311. */
  312. $can_set_update_option = false;
  313. }
  314. // Is the UI overridden by a plugin using the `allow_major_auto_core_updates` filter?
  315. if ( has_filter( 'allow_major_auto_core_updates' ) ) {
  316. $can_set_update_option = false;
  317. }
  318. /** This filter is documented in wp-admin/includes/class-core-upgrader.php */
  319. $upgrade_dev = apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev );
  320. /** This filter is documented in wp-admin/includes/class-core-upgrader.php */
  321. $upgrade_minor = apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor );
  322. /** This filter is documented in wp-admin/includes/class-core-upgrader.php */
  323. $upgrade_major = apply_filters( 'allow_major_auto_core_updates', $upgrade_major );
  324. $auto_update_settings = array(
  325. 'dev' => $upgrade_dev,
  326. 'minor' => $upgrade_minor,
  327. 'major' => $upgrade_major,
  328. );
  329. if ( $upgrade_major ) {
  330. $wp_version = get_bloginfo( 'version' );
  331. $updates = get_core_updates();
  332. if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) {
  333. echo '<p>' . wp_get_auto_update_message() . '</p>';
  334. }
  335. }
  336. $action_url = self_admin_url( 'update-core.php?action=core-major-auto-updates-settings' );
  337. ?>
  338. <p class="auto-update-status">
  339. <?php
  340. if ( $updater->is_vcs_checkout( ABSPATH ) ) {
  341. _e( 'This site appears to be under version control. Automatic updates are disabled.' );
  342. } elseif ( $upgrade_major ) {
  343. _e( 'This site is automatically kept up to date with each new version of WordPress.' );
  344. if ( $can_set_update_option ) {
  345. echo '<br>';
  346. printf(
  347. '<a href="%s" class="core-auto-update-settings-link core-auto-update-settings-link-disable">%s</a>',
  348. wp_nonce_url( add_query_arg( 'value', 'disable', $action_url ), 'core-major-auto-updates-nonce' ),
  349. __( 'Switch to automatic updates for maintenance and security releases only.' )
  350. );
  351. }
  352. } elseif ( $upgrade_minor ) {
  353. _e( 'This site is automatically kept up to date with maintenance and security releases of WordPress only.' );
  354. if ( $can_set_update_option ) {
  355. echo '<br>';
  356. printf(
  357. '<a href="%s" class="core-auto-update-settings-link core-auto-update-settings-link-enable">%s</a>',
  358. wp_nonce_url( add_query_arg( 'value', 'enable', $action_url ), 'core-major-auto-updates-nonce' ),
  359. __( 'Enable automatic updates for all new versions of WordPress.' )
  360. );
  361. }
  362. } else {
  363. _e( 'This site will not receive automatic updates for new versions of WordPress.' );
  364. }
  365. ?>
  366. </p>
  367. <?php
  368. /**
  369. * Fires after the major core auto-update settings.
  370. *
  371. * @since 5.6.0
  372. *
  373. * @param array $auto_update_settings {
  374. * Array of core auto-update settings.
  375. *
  376. * @type bool $dev Whether to enable automatic updates for development versions.
  377. * @type bool $minor Whether to enable minor automatic core updates.
  378. * @type bool $major Whether to enable major automatic core updates.
  379. * }
  380. */
  381. do_action( 'after_core_auto_updates_settings', $auto_update_settings );
  382. }
  383. /**
  384. * Display the upgrade plugins form.
  385. *
  386. * @since 2.9.0
  387. */
  388. function list_plugin_updates() {
  389. $wp_version = get_bloginfo( 'version' );
  390. $cur_wp_version = preg_replace( '/-.*$/', '', $wp_version );
  391. require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
  392. $plugins = get_plugin_updates();
  393. if ( empty( $plugins ) ) {
  394. echo '<h2>' . __( 'Plugins' ) . '</h2>';
  395. echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>';
  396. return;
  397. }
  398. $form_action = 'update-core.php?action=do-plugin-upgrade';
  399. $core_updates = get_core_updates();
  400. if ( ! isset( $core_updates[0]->response ) || 'latest' === $core_updates[0]->response || 'development' === $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=' ) ) {
  401. $core_update_version = false;
  402. } else {
  403. $core_update_version = $core_updates[0]->current;
  404. }
  405. $plugins_count = count( $plugins );
  406. ?>
  407. <h2>
  408. <?php
  409. printf(
  410. '%s <span class="count">(%d)</span>',
  411. __( 'Plugins' ),
  412. number_format_i18n( $plugins_count )
  413. );
  414. ?>
  415. </h2>
  416. <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click &#8220;Update Plugins&#8221;.' ); ?></p>
  417. <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade">
  418. <?php wp_nonce_field( 'upgrade-core' ); ?>
  419. <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e( 'Update Plugins' ); ?>" name="upgrade" /></p>
  420. <table class="widefat updates-table" id="update-plugins-table">
  421. <thead>
  422. <tr>
  423. <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></td>
  424. <td class="manage-column"><label for="plugins-select-all"><?php _e( 'Select All' ); ?></label></td>
  425. </tr>
  426. </thead>
  427. <tbody class="plugins">
  428. <?php
  429. $auto_updates = array();
  430. if ( wp_is_auto_update_enabled_for_type( 'plugin' ) ) {
  431. $auto_updates = (array) get_site_option( 'auto_update_plugins', array() );
  432. $auto_update_notice = ' | ' . wp_get_auto_update_message();
  433. }
  434. foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
  435. $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true );
  436. $icon = '<span class="dashicons dashicons-admin-plugins"></span>';
  437. $preferred_icons = array( 'svg', '2x', '1x', 'default' );
  438. foreach ( $preferred_icons as $preferred_icon ) {
  439. if ( ! empty( $plugin_data->update->icons[ $preferred_icon ] ) ) {
  440. $icon = '<img src="' . esc_url( $plugin_data->update->icons[ $preferred_icon ] ) . '" alt="" />';
  441. break;
  442. }
  443. }
  444. // Get plugin compat for running version of WordPress.
  445. if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $cur_wp_version, '>=' ) ) {
  446. /* translators: %s: WordPress version. */
  447. $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %s: 100%% (according to its author)' ), $cur_wp_version );
  448. } else {
  449. /* translators: %s: WordPress version. */
  450. $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %s: Unknown' ), $cur_wp_version );
  451. }
  452. // Get plugin compat for updated version of WordPress.
  453. if ( $core_update_version ) {
  454. if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) {
  455. /* translators: %s: WordPress version. */
  456. $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %s: 100%% (according to its author)' ), $core_update_version );
  457. } else {
  458. /* translators: %s: WordPress version. */
  459. $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %s: Unknown' ), $core_update_version );
  460. }
  461. }
  462. $requires_php = isset( $plugin_data->update->requires_php ) ? $plugin_data->update->requires_php : null;
  463. $compatible_php = is_php_version_compatible( $requires_php );
  464. if ( ! $compatible_php && current_user_can( 'update_php' ) ) {
  465. $compat .= '<br>' . __( 'This update doesn&#8217;t work with your version of PHP.' ) . '&nbsp;';
  466. $compat .= sprintf(
  467. /* translators: %s: URL to Update PHP page. */
  468. __( '<a href="%s">Learn more about updating PHP</a>.' ),
  469. esc_url( wp_get_update_php_url() )
  470. );
  471. $annotation = wp_get_update_php_annotation();
  472. if ( $annotation ) {
  473. $compat .= '</p><p><em>' . $annotation . '</em>';
  474. }
  475. }
  476. // Get the upgrade notice for the new plugin version.
  477. if ( isset( $plugin_data->update->upgrade_notice ) ) {
  478. $upgrade_notice = '<br />' . strip_tags( $plugin_data->update->upgrade_notice );
  479. } else {
  480. $upgrade_notice = '';
  481. }
  482. $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '&section=changelog&TB_iframe=true&width=640&height=662' );
  483. $details = sprintf(
  484. '<a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>',
  485. esc_url( $details_url ),
  486. /* translators: 1: Plugin name, 2: Version number. */
  487. esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_data->Name, $plugin_data->update->new_version ) ),
  488. /* translators: %s: Plugin version. */
  489. sprintf( __( 'View version %s details.' ), $plugin_data->update->new_version )
  490. );
  491. $checkbox_id = 'checkbox_' . md5( $plugin_file );
  492. ?>
  493. <tr>
  494. <td class="check-column">
  495. <?php if ( $compatible_php ) : ?>
  496. <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" />
  497. <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text">
  498. <?php
  499. /* translators: %s: Plugin name. */
  500. printf( __( 'Select %s' ), $plugin_data->Name );
  501. ?>
  502. </label>
  503. <?php endif; ?>
  504. </td>
  505. <td class="plugin-title"><p>
  506. <?php echo $icon; ?>
  507. <strong><?php echo $plugin_data->Name; ?></strong>
  508. <?php
  509. printf(
  510. /* translators: 1: Plugin version, 2: New version. */
  511. __( 'You have version %1$s installed. Update to %2$s.' ),
  512. $plugin_data->Version,
  513. $plugin_data->update->new_version
  514. );
  515. echo ' ' . $details . $compat . $upgrade_notice;
  516. if ( in_array( $plugin_file, $auto_updates, true ) ) {
  517. echo $auto_update_notice;
  518. }
  519. ?>
  520. </p></td>
  521. </tr>
  522. <?php
  523. }
  524. ?>
  525. </tbody>
  526. <tfoot>
  527. <tr>
  528. <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td>
  529. <td class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></td>
  530. </tr>
  531. </tfoot>
  532. </table>
  533. <p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e( 'Update Plugins' ); ?>" name="upgrade" /></p>
  534. </form>
  535. <?php
  536. }
  537. /**
  538. * Display the upgrade themes form.
  539. *
  540. * @since 2.9.0
  541. */
  542. function list_theme_updates() {
  543. $themes = get_theme_updates();
  544. if ( empty( $themes ) ) {
  545. echo '<h2>' . __( 'Themes' ) . '</h2>';
  546. echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>';
  547. return;
  548. }
  549. $form_action = 'update-core.php?action=do-theme-upgrade';
  550. $themes_count = count( $themes );
  551. ?>
  552. <h2>
  553. <?php
  554. printf(
  555. '%s <span class="count">(%d)</span>',
  556. __( 'Themes' ),
  557. number_format_i18n( $themes_count )
  558. );
  559. ?>
  560. </h2>
  561. <p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click &#8220;Update Themes&#8221;.' ); ?></p>
  562. <p>
  563. <?php
  564. printf(
  565. /* translators: %s: Link to documentation on child themes. */
  566. __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ),
  567. __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' )
  568. );
  569. ?>
  570. </p>
  571. <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade">
  572. <?php wp_nonce_field( 'upgrade-core' ); ?>
  573. <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e( 'Update Themes' ); ?>" name="upgrade" /></p>
  574. <table class="widefat updates-table" id="update-themes-table">
  575. <thead>
  576. <tr>
  577. <td class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td>
  578. <td class="manage-column"><label for="themes-select-all"><?php _e( 'Select All' ); ?></label></td>
  579. </tr>
  580. </thead>
  581. <tbody class="plugins">
  582. <?php
  583. $auto_updates = array();
  584. if ( wp_is_auto_update_enabled_for_type( 'theme' ) ) {
  585. $auto_updates = (array) get_site_option( 'auto_update_themes', array() );
  586. $auto_update_notice = ' | ' . wp_get_auto_update_message();
  587. }
  588. foreach ( $themes as $stylesheet => $theme ) {
  589. $requires_wp = isset( $theme->update['requires'] ) ? $theme->update['requires'] : null;
  590. $requires_php = isset( $theme->update['requires_php'] ) ? $theme->update['requires_php'] : null;
  591. $compatible_wp = is_wp_version_compatible( $requires_wp );
  592. $compatible_php = is_php_version_compatible( $requires_php );
  593. $compat = '';
  594. if ( ! $compatible_wp && ! $compatible_php ) {
  595. $compat .= '<br>' . __( 'This update doesn&#8217;t work with your versions of WordPress and PHP.' ) . '&nbsp;';
  596. if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
  597. $compat .= sprintf(
  598. /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
  599. __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
  600. self_admin_url( 'update-core.php' ),
  601. esc_url( wp_get_update_php_url() )
  602. );
  603. $annotation = wp_get_update_php_annotation();
  604. if ( $annotation ) {
  605. $compat .= '</p><p><em>' . $annotation . '</em>';
  606. }
  607. } elseif ( current_user_can( 'update_core' ) ) {
  608. $compat .= sprintf(
  609. /* translators: %s: URL to WordPress Updates screen. */
  610. __( '<a href="%s">Please update WordPress</a>.' ),
  611. self_admin_url( 'update-core.php' )
  612. );
  613. } elseif ( current_user_can( 'update_php' ) ) {
  614. $compat .= sprintf(
  615. /* translators: %s: URL to Update PHP page. */
  616. __( '<a href="%s">Learn more about updating PHP</a>.' ),
  617. esc_url( wp_get_update_php_url() )
  618. );
  619. $annotation = wp_get_update_php_annotation();
  620. if ( $annotation ) {
  621. $compat .= '</p><p><em>' . $annotation . '</em>';
  622. }
  623. }
  624. } elseif ( ! $compatible_wp ) {
  625. $compat .= '<br>' . __( 'This update doesn&#8217;t work with your version of WordPress.' ) . '&nbsp;';
  626. if ( current_user_can( 'update_core' ) ) {
  627. $compat .= sprintf(
  628. /* translators: %s: URL to WordPress Updates screen. */
  629. __( '<a href="%s">Please update WordPress</a>.' ),
  630. self_admin_url( 'update-core.php' )
  631. );
  632. }
  633. } elseif ( ! $compatible_php ) {
  634. $compat .= '<br>' . __( 'This update doesn&#8217;t work with your version of PHP.' ) . '&nbsp;';
  635. if ( current_user_can( 'update_php' ) ) {
  636. $compat .= sprintf(
  637. /* translators: %s: URL to Update PHP page. */
  638. __( '<a href="%s">Learn more about updating PHP</a>.' ),
  639. esc_url( wp_get_update_php_url() )
  640. );
  641. $annotation = wp_get_update_php_annotation();
  642. if ( $annotation ) {
  643. $compat .= '</p><p><em>' . $annotation . '</em>';
  644. }
  645. }
  646. }
  647. $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
  648. ?>
  649. <tr>
  650. <td class="check-column">
  651. <?php if ( $compatible_wp && $compatible_php ) : ?>
  652. <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" />
  653. <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text">
  654. <?php
  655. /* translators: %s: Theme name. */
  656. printf( __( 'Select %s' ), $theme->display( 'Name' ) );
  657. ?>
  658. </label>
  659. <?php endif; ?>
  660. </td>
  661. <td class="plugin-title"><p>
  662. <img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" />
  663. <strong><?php echo $theme->display( 'Name' ); ?></strong>
  664. <?php
  665. printf(
  666. /* translators: 1: Theme version, 2: New version. */
  667. __( 'You have version %1$s installed. Update to %2$s.' ),
  668. $theme->display( 'Version' ),
  669. $theme->update['new_version']
  670. );
  671. echo ' ' . $compat;
  672. if ( in_array( $stylesheet, $auto_updates, true ) ) {
  673. echo $auto_update_notice;
  674. }
  675. ?>
  676. </p></td>
  677. </tr>
  678. <?php
  679. }
  680. ?>
  681. </tbody>
  682. <tfoot>
  683. <tr>
  684. <td class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td>
  685. <td class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></td>
  686. </tr>
  687. </tfoot>
  688. </table>
  689. <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e( 'Update Themes' ); ?>" name="upgrade" /></p>
  690. </form>
  691. <?php
  692. }
  693. /**
  694. * Display the update translations form.
  695. *
  696. * @since 3.7.0
  697. */
  698. function list_translation_updates() {
  699. $updates = wp_get_translation_updates();
  700. if ( ! $updates ) {
  701. if ( 'en_US' !== get_locale() ) {
  702. echo '<h2>' . __( 'Translations' ) . '</h2>';
  703. echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>';
  704. }
  705. return;
  706. }
  707. $form_action = 'update-core.php?action=do-translation-upgrade';
  708. ?>
  709. <h2><?php _e( 'Translations' ); ?></h2>
  710. <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade">
  711. <p><?php _e( 'New translations are available.' ); ?></p>
  712. <?php wp_nonce_field( 'upgrade-translations' ); ?>
  713. <p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p>
  714. </form>
  715. <?php
  716. }
  717. /**
  718. * Upgrade WordPress core display.
  719. *
  720. * @since 2.7.0
  721. *
  722. * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
  723. *
  724. * @param bool $reinstall
  725. */
  726. function do_core_upgrade( $reinstall = false ) {
  727. global $wp_filesystem;
  728. require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
  729. if ( $reinstall ) {
  730. $url = 'update-core.php?action=do-core-reinstall';
  731. } else {
  732. $url = 'update-core.php?action=do-core-upgrade';
  733. }
  734. $url = wp_nonce_url( $url, 'upgrade-core' );
  735. $version = isset( $_POST['version'] ) ? $_POST['version'] : false;
  736. $locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
  737. $update = find_core_update( $version, $locale );
  738. if ( ! $update ) {
  739. return;
  740. }
  741. // Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
  742. // that it's safe to do so. This only happens when there are no new files to create.
  743. $allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files;
  744. ?>
  745. <div class="wrap">
  746. <h1><?php _e( 'Update WordPress' ); ?></h1>
  747. <?php
  748. $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );
  749. if ( false === $credentials ) {
  750. echo '</div>';
  751. return;
  752. }
  753. if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) {
  754. // Failed to connect. Error and request again.
  755. request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );
  756. echo '</div>';
  757. return;
  758. }
  759. if ( $wp_filesystem->errors->has_errors() ) {
  760. foreach ( $wp_filesystem->errors->get_error_messages() as $message ) {
  761. show_message( $message );
  762. }
  763. echo '</div>';
  764. return;
  765. }
  766. if ( $reinstall ) {
  767. $update->response = 'reinstall';
  768. }
  769. add_filter( 'update_feedback', 'show_message' );
  770. $upgrader = new Core_Upgrader();
  771. $result = $upgrader->upgrade(
  772. $update,
  773. array(
  774. 'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership,
  775. )
  776. );
  777. if ( is_wp_error( $result ) ) {
  778. show_message( $result );
  779. if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() ) {
  780. show_message( __( 'Installation failed.' ) );
  781. }
  782. echo '</div>';
  783. return;
  784. }
  785. show_message( __( 'WordPress updated successfully.' ) );
  786. show_message(
  787. '<span class="hide-if-no-js">' . sprintf(
  788. /* translators: 1: WordPress version, 2: URL to About screen. */
  789. __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ),
  790. $result,
  791. esc_url( self_admin_url( 'about.php?updated' ) )
  792. ) . '</span>'
  793. );
  794. show_message(
  795. '<span class="hide-if-js">' . sprintf(
  796. /* translators: 1: WordPress version, 2: URL to About screen. */
  797. __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ),
  798. $result,
  799. esc_url( self_admin_url( 'about.php?updated' ) )
  800. ) . '</span>'
  801. );
  802. ?>
  803. </div>
  804. <script type="text/javascript">
  805. window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>';
  806. </script>
  807. <?php
  808. }
  809. /**
  810. * Dismiss a core update.
  811. *
  812. * @since 2.7.0
  813. */
  814. function do_dismiss_core_update() {
  815. $version = isset( $_POST['version'] ) ? $_POST['version'] : false;
  816. $locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
  817. $update = find_core_update( $version, $locale );
  818. if ( ! $update ) {
  819. return;
  820. }
  821. dismiss_core_update( $update );
  822. wp_redirect( wp_nonce_url( 'update-core.php?action=upgrade-core', 'upgrade-core' ) );
  823. exit;
  824. }
  825. /**
  826. * Undismiss a core update.
  827. *
  828. * @since 2.7.0
  829. */
  830. function do_undismiss_core_update() {
  831. $version = isset( $_POST['version'] ) ? $_POST['version'] : false;
  832. $locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
  833. $update = find_core_update( $version, $locale );
  834. if ( ! $update ) {
  835. return;
  836. }
  837. undismiss_core_update( $version, $locale );
  838. wp_redirect( wp_nonce_url( 'update-core.php?action=upgrade-core', 'upgrade-core' ) );
  839. exit;
  840. }
  841. $action = isset( $_GET['action'] ) ? $_GET['action'] : 'upgrade-core';
  842. $upgrade_error = false;
  843. if ( ( 'do-theme-upgrade' === $action || ( 'do-plugin-upgrade' === $action && ! isset( $_GET['plugins'] ) ) )
  844. && ! isset( $_POST['checked'] ) ) {
  845. $upgrade_error = ( 'do-theme-upgrade' === $action ) ? 'themes' : 'plugins';
  846. $action = 'upgrade-core';
  847. }
  848. $title = __( 'WordPress Updates' );
  849. $parent_file = 'index.php';
  850. $updates_overview = '<p>' . __( 'On this screen, you can update to the latest version of WordPress, as well as update your themes, plugins, and translations from the WordPress.org repositories.' ) . '</p>';
  851. $updates_overview .= '<p>' . __( 'If an update is available, you&#8127;ll see a notification appear in the Toolbar and navigation menu.' ) . ' ' . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' ) . '</p>';
  852. get_current_screen()->add_help_tab(
  853. array(
  854. 'id' => 'overview',
  855. 'title' => __( 'Overview' ),
  856. 'content' => $updates_overview,
  857. )
  858. );
  859. $updates_howto = '<p>' . __( '<strong>WordPress</strong> &mdash; Updating your WordPress installation is a simple one-click procedure: just <strong>click on the &#8220;Update now&#8221; button</strong> when you are notified that a new version is available.' ) . ' ' . __( 'In most cases, WordPress will automatically apply maintenance and security updates in the background for you.' ) . '</p>';
  860. $updates_howto .= '<p>' . __( '<strong>Themes and Plugins</strong> &mdash; To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate &#8220;Update&#8221; button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.' ) . '</p>';
  861. if ( 'en_US' !== get_locale() ) {
  862. $updates_howto .= '<p>' . __( '<strong>Translations</strong> &mdash; The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the &#8220;Update Translations&#8221;</strong> button.' ) . '</p>';
  863. }
  864. get_current_screen()->add_help_tab(
  865. array(
  866. 'id' => 'how-to-update',
  867. 'title' => __( 'How to Update' ),
  868. 'content' => $updates_howto,
  869. )
  870. );
  871. $help_sidebar_autoupdates = '';
  872. if ( ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) || ( current_user_can( 'update_plugins' ) && wp_is_auto_update_enabled_for_type( 'plugin' ) ) ) {
  873. $help_tab_autoupdates = '<p>' . __( 'Auto-updates can be enabled or disabled for WordPress major versions and for each individual theme or plugin. Themes or plugins with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates depends on the WP-Cron task scheduling system.' ) . '</p>';
  874. $help_tab_autoupdates .= '<p>' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>';
  875. get_current_screen()->add_help_tab(
  876. array(
  877. 'id' => 'plugins-themes-auto-updates',
  878. 'title' => __( 'Auto-updates' ),
  879. 'content' => $help_tab_autoupdates,
  880. )
  881. );
  882. $help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/support/article/plugins-themes-auto-updates/">Learn more: Auto-updates documentation</a>' ) . '</p>';
  883. }
  884. get_current_screen()->set_help_sidebar(
  885. '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
  886. '<p>' . __( '<a href="https://wordpress.org/support/article/dashboard-updates-screen/">Documentation on Updating WordPress</a>' ) . '</p>' .
  887. $help_sidebar_autoupdates .
  888. '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
  889. );
  890. if ( 'upgrade-core' === $action ) {
  891. // Force a update check when requested.
  892. $force_check = ! empty( $_GET['force-check'] );
  893. wp_version_check( array(), $force_check );
  894. require_once ABSPATH . 'wp-admin/admin-header.php';
  895. ?>
  896. <div class="wrap">
  897. <h1><?php _e( 'WordPress Updates' ); ?></h1>
  898. <p><?php _e( 'Here you can find information about updates, set auto-updates and see what plugins or themes need updating.' ); ?></p>
  899. <?php
  900. if ( $upgrade_error ) {
  901. echo '<div class="error"><p>';
  902. if ( 'themes' === $upgrade_error ) {
  903. _e( 'Please select one or more themes to update.' );
  904. } else {
  905. _e( 'Please select one or more plugins to update.' );
  906. }
  907. echo '</p></div>';
  908. }
  909. $last_update_check = false;
  910. $current = get_site_transient( 'update_core' );
  911. if ( $current && isset( $current->last_checked ) ) {
  912. $last_update_check = $current->last_checked + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
  913. }
  914. echo '<h2 class="wp-current-version">';
  915. /* translators: Current version of WordPress. */
  916. printf( __( 'Current version: %s' ), get_bloginfo( 'version' ) );
  917. echo '</h2>';
  918. echo '<p class="update-last-checked">';
  919. /* translators: 1: Date, 2: Time. */
  920. printf( __( 'Last checked on %1$s at %2$s.' ), date_i18n( __( 'F j, Y' ), $last_update_check ), date_i18n( __( 'g:i a' ), $last_update_check ) );
  921. echo ' <a href="' . esc_url( self_admin_url( 'update-core.php?force-check=1' ) ) . '">' . __( 'Check again.' ) . '</a>';
  922. echo '</p>';
  923. if ( current_user_can( 'update_core' ) ) {
  924. core_auto_updates_settings();
  925. core_upgrade_preamble();
  926. }
  927. if ( current_user_can( 'update_plugins' ) ) {
  928. list_plugin_updates();
  929. }
  930. if ( current_user_can( 'update_themes' ) ) {
  931. list_theme_updates();
  932. }
  933. if ( current_user_can( 'update_languages' ) ) {
  934. list_translation_updates();
  935. }
  936. /**
  937. * Fires after the core, plugin, and theme update tables.
  938. *
  939. * @since 2.9.0
  940. */
  941. do_action( 'core_upgrade_preamble' );
  942. echo '</div>';
  943. wp_localize_script(
  944. 'updates',
  945. '_wpUpdatesItemCounts',
  946. array(
  947. 'totals' => wp_get_update_data(),
  948. )
  949. );
  950. require_once ABSPATH . 'wp-admin/admin-footer.php';
  951. } elseif ( 'do-core-upgrade' === $action || 'do-core-reinstall' === $action ) {
  952. if ( ! current_user_can( 'update_core' ) ) {
  953. wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
  954. }
  955. check_admin_referer( 'upgrade-core' );
  956. // Do the (un)dismiss actions before headers, so that they can redirect.
  957. if ( isset( $_POST['dismiss'] ) ) {
  958. do_dismiss_core_update();
  959. } elseif ( isset( $_POST['undismiss'] ) ) {
  960. do_undismiss_core_update();
  961. }
  962. require_once ABSPATH . 'wp-admin/admin-header.php';
  963. if ( 'do-core-reinstall' === $action ) {
  964. $reinstall = true;
  965. } else {
  966. $reinstall = false;
  967. }
  968. if ( isset( $_POST['upgrade'] ) ) {
  969. do_core_upgrade( $reinstall );
  970. }
  971. wp_localize_script(
  972. 'updates',
  973. '_wpUpdatesItemCounts',
  974. array(
  975. 'totals' => wp_get_update_data(),
  976. )
  977. );
  978. require_once ABSPATH . 'wp-admin/admin-footer.php';
  979. } elseif ( 'do-plugin-upgrade' === $action ) {
  980. if ( ! current_user_can( 'update_plugins' ) ) {
  981. wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
  982. }
  983. check_admin_referer( 'upgrade-core' );
  984. if ( isset( $_GET['plugins'] ) ) {
  985. $plugins = explode( ',', $_GET['plugins'] );
  986. } elseif ( isset( $_POST['checked'] ) ) {
  987. $plugins = (array) $_POST['checked'];
  988. } else {
  989. wp_redirect( admin_url( 'update-core.php' ) );
  990. exit;
  991. }
  992. $url = 'update.php?action=update-selected&plugins=' . urlencode( implode( ',', $plugins ) );
  993. $url = wp_nonce_url( $url, 'bulk-update-plugins' );
  994. $title = __( 'Update Plugins' );
  995. require_once ABSPATH . 'wp-admin/admin-header.php';
  996. ?>
  997. <div class="wrap">
  998. <h1><?php _e( 'Update Plugins' ); ?></h1>
  999. <iframe src="<?php echo $url; ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e( 'Update progress' ); ?>"></iframe>
  1000. </div>
  1001. <?php
  1002. wp_localize_script(
  1003. 'updates',
  1004. '_wpUpdatesItemCounts',
  1005. array(
  1006. 'totals' => wp_get_update_data(),
  1007. )
  1008. );
  1009. require_once ABSPATH . 'wp-admin/admin-footer.php';
  1010. } elseif ( 'do-theme-upgrade' === $action ) {
  1011. if ( ! current_user_can( 'update_themes' ) ) {
  1012. wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
  1013. }
  1014. check_admin_referer( 'upgrade-core' );
  1015. if ( isset( $_GET['themes'] ) ) {
  1016. $themes = explode( ',', $_GET['themes'] );
  1017. } elseif ( isset( $_POST['checked'] ) ) {
  1018. $themes = (array) $_POST['checked'];
  1019. } else {
  1020. wp_redirect( admin_url( 'update-core.php' ) );
  1021. exit;
  1022. }
  1023. $url = 'update.php?action=update-selected-themes&themes=' . urlencode( implode( ',', $themes ) );
  1024. $url = wp_nonce_url( $url, 'bulk-update-themes' );
  1025. $title = __( 'Update Themes' );
  1026. require_once ABSPATH . 'wp-admin/admin-header.php';
  1027. ?>
  1028. <div class="wrap">
  1029. <h1><?php _e( 'Update Themes' ); ?></h1>
  1030. <iframe src="<?php echo $url; ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e( 'Update progress' ); ?>"></iframe>
  1031. </div>
  1032. <?php
  1033. wp_localize_script(
  1034. 'updates',
  1035. '_wpUpdatesItemCounts',
  1036. array(
  1037. 'totals' => wp_get_update_data(),
  1038. )
  1039. );
  1040. require_once ABSPATH . 'wp-admin/admin-footer.php';
  1041. } elseif ( 'do-translation-upgrade' === $action ) {
  1042. if ( ! current_user_can( 'update_languages' ) ) {
  1043. wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
  1044. }
  1045. check_admin_referer( 'upgrade-translations' );
  1046. require_once ABSPATH . 'wp-admin/admin-header.php';
  1047. require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
  1048. $url = 'update-core.php?action=do-translation-upgrade';
  1049. $nonce = 'upgrade-translations';
  1050. $title = __( 'Update Translations' );
  1051. $context = WP_LANG_DIR;
  1052. $upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) );
  1053. $result = $upgrader->bulk_upgrade();
  1054. wp_localize_script(
  1055. 'updates',
  1056. '_wpUpdatesItemCounts',
  1057. array(
  1058. 'totals' => wp_get_update_data(),
  1059. )
  1060. );
  1061. require_once ABSPATH . 'wp-admin/admin-footer.php';
  1062. } elseif ( 'core-major-auto-updates-settings' === $action ) {
  1063. if ( ! current_user_can( 'update_core' ) ) {
  1064. wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
  1065. }
  1066. $redirect_url = self_admin_url( 'update-core.php' );
  1067. if ( isset( $_GET['value'] ) ) {
  1068. check_admin_referer( 'core-major-auto-updates-nonce' );
  1069. if ( 'enable' === $_GET['value'] ) {
  1070. update_site_option( 'auto_update_core_major', 'enabled' );
  1071. $redirect_url = add_query_arg( 'core-major-auto-updates-saved', 'enabled', $redirect_url );
  1072. } elseif ( 'disable' === $_GET['value'] ) {
  1073. update_site_option( 'auto_update_core_major', 'disabled' );
  1074. $redirect_url = add_query_arg( 'core-major-auto-updates-saved', 'disabled', $redirect_url );
  1075. }
  1076. }
  1077. wp_redirect( $redirect_url );
  1078. exit;
  1079. } else {
  1080. /**
  1081. * Fires for each custom update action on the WordPress Updates screen.
  1082. *
  1083. * The dynamic portion of the hook name, `$action`, refers to the
  1084. * passed update action. The hook fires in lieu of all available
  1085. * default update actions.
  1086. *
  1087. * @since 3.2.0
  1088. */
  1089. do_action( "update-core-custom_{$action}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
  1090. }