Issues (2873)

Security Analysis    not enabled

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

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

ui/js/jquery.pods.migrate.js (42 issues)

Upgrade to new PHP Analysis Engine

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

1
/*@global PodsI18n */
2
(function ( $ ) {
3
    var methods = {
4
        prepare : function () {
5
            var $wizard_box = $( '#pods-wizard-box' ),
6
                pods_ajaxurl = $wizard_box.data( 'url' );
7
8
            if ( 'undefined' != typeof pods_ajaxurl && '' != pods_ajaxurl )
0 ignored issues
show
!== was expected, but instead != was given.
Loading history...
9
                pods_ajaxurl = pods_ajaxurl.replace( /\?nojs\=1/, '?pods_ajax=1' );
0 ignored issues
show
{ was expected, but instead pods_ajaxurl was given.
Loading history...
10
11
            if ( 'undefined' != typeof ajaxurl && ( 'undefined' == typeof pods_ajaxurl || '' == pods_ajaxurl || '?pods_ajax=1' == pods_ajaxurl || document.location.href == pods_ajaxurl || document.location.href.replace( /\?nojs\=1/, '?pods_ajax=1' ) == pods_ajaxurl ) )
0 ignored issues
show
!== was expected, but instead != was given.
Loading history...
=== was expected, but instead == was given.
Loading history...
12
                pods_ajaxurl = ajaxurl + '?pods_ajax=1';
0 ignored issues
show
{ was expected, but instead pods_ajaxurl was given.
Loading history...
13
14
            var $table_pending = $( '#pods-wizard-panel-2 table tbody tr.pods-wizard-table-pending' );
15
16
            if ( $table_pending[ 0 ] ) {
17
                var $row = $table_pending.first();
18
19
                $row.removeClass( 'pods-wizard-table-pending' ).addClass( 'pods-wizard-table-active' );
20
21
                var postdata = {
22
                    'action' : $wizard_box.data( 'action' ),
23
                    'method' : $wizard_box.data( 'method' ),
24
                    '_wpnonce' : $wizard_box.data( '_wpnonce' ),
25
                    'migration' : $wizard_box.data( 'migration' ),
26
                    'step' : 'prepare',
27
                    'type' : $row.data( 'migrate' ),
28
                    'object' : ''
29
                };
30
31
                if ( 'undefined' != typeof $row.data( 'object' ) )
0 ignored issues
show
!== was expected, but instead != was given.
Loading history...
32
                    postdata[ 'object' ] = $row.data( 'object' );
0 ignored issues
show
{ was expected, but instead postdata was given.
Loading history...
['object'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
33
34
                var $step_3 = $( '#pods-wizard-panel-3 table tbody' ),
35
                    $table = $row.parent();
36
37
                $.ajax( {
38
                    type : 'POST',
39
                    url : pods_ajaxurl,
40
                    cache : false,
41
                    data : postdata,
42
                    success : function ( d ) {
43
                        var message = d.replace( '<e>', '' ).replace( '</e>', '' );
44
45
                        if ( -1 == d.indexOf( '<e>' ) && -1 != d ) {
0 ignored issues
show
=== was expected, but instead == was given.
Loading history...
!== was expected, but instead != was given.
Loading history...
46
                            $row.find( 'td.pods-wizard-count' ).text( d );
47
                            $row.removeClass( 'pods-wizard-table-active' ).addClass( 'pods-wizard-table-complete' );
48
49
                            if ( 'undefined' != typeof $row.data( 'object' ) ) {
0 ignored issues
show
!== was expected, but instead != was given.
Loading history...
50
                                $table.find( 'tr[data-migrate="' + $row.data( 'migrate' ) + '"][data-object="' + $row.data( 'object' ) + '"] td.pods-wizard-count' ).text( d );
51
                                $step_3.find( 'tr[data-migrate="' + $row.data( 'migrate' ) + '"][data-object="' + $row.data( 'object' ) + '"] td.pods-wizard-count' ).text( d );
52
                            }
53
                            else {
54
                                $table.find( 'tr[data-migrate="' + $row.data( 'migrate' ) + '"] td.pods-wizard-count' ).text( d );
55
                                $step_3.find( 'tr[data-migrate="' + $row.data( 'migrate' ) + '"] td.pods-wizard-count' ).text( d );
56
                            }
57
                        }
58
                        else {
59
                            $row.removeClass( 'pods-wizard-table-active' ).addClass( 'pods-wizard-table-warning' );
60
                            $row.find( 'td span.pods-wizard-info' ).html( message );
61
62
                            if ( window.console ) console.log( message );
0 ignored issues
show
{ was expected, but instead console was given.
Loading history...
63
                        }
64
65
                        // Run next
66
                        return methods[ 'prepare' ]();
0 ignored issues
show
['prepare'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
67
                    },
68
                    error : function () {
69
                        $row.removeClass( 'pods-wizard-table-active' ).addClass( 'pods-wizard-table-error' );
70
                        $row.find( 'td span.pods-wizard-info' ).text( PodsI18n.__( 'Unable to process request, please try again.' ) );
71
                    },
72
                    dataType : 'html'
73
                } );
74
            }
75
            else {
76
                $( '#pods-wizard-next' ).show();
77
            }
78
        },
79
        migrate : function ( postdata, $row ) {
80
            var $wizard_box = $( '#pods-wizard-box' ),
81
                pods_ajaxurl = $wizard_box.data( 'url' );
82
83
            if ( 'undefined' != typeof pods_ajaxurl )
0 ignored issues
show
!== was expected, but instead != was given.
Loading history...
84
                pods_ajaxurl = pods_ajaxurl.replace( /\?nojs\=1/, '?pods_ajax=1' );
0 ignored issues
show
{ was expected, but instead pods_ajaxurl was given.
Loading history...
85
86
            if ( 'undefined' != typeof ajaxurl && ('undefined' == typeof pods_ajaxurl || '' == pods_ajaxurl || '?pods_ajax=1' == pods_ajaxurl || document.location.href == pods_ajaxurl || document.location.href.replace( /\?nojs\=1/, '?pods_ajax=1' ) == pods_ajaxurl) )
0 ignored issues
show
!== was expected, but instead != was given.
Loading history...
=== was expected, but instead == was given.
Loading history...
87
                pods_ajaxurl = ajaxurl + '?pods_ajax=1';
0 ignored issues
show
{ was expected, but instead pods_ajaxurl was given.
Loading history...
88
89
            var $table_pending = $( '#pods-wizard-panel-3 table tbody tr.pods-wizard-table-pending' );
90
91
            if ( 'undefined' != typeof postdata || $table_pending[ 0 ] ) {
0 ignored issues
show
!== was expected, but instead != was given.
Loading history...
92
                if ( 'undefined' == typeof $row )
0 ignored issues
show
=== was expected, but instead == was given.
Loading history...
93
                    $row = $table_pending.first();
0 ignored issues
show
{ was expected, but instead $row was given.
Loading history...
94
95
                if ( 'undefined' == typeof postdata ) {
0 ignored issues
show
=== was expected, but instead == was given.
Loading history...
96
                    $row.removeClass( 'pods-wizard-table-pending' ).addClass( 'pods-wizard-table-active' );
97
98
                    postdata = {
99
                        'action' : $wizard_box.data( 'action' ),
100
                        'method' : $wizard_box.data( 'method' ),
101
                        '_wpnonce' : $wizard_box.data( '_wpnonce' ),
102
                        'migration' : $wizard_box.data( 'migration' ),
103
                        'step' : 'migrate',
104
                        'type' : $row.data( 'migrate' ),
105
                        'object' : ''
106
                    };
107
108
                    if ( 'undefined' != typeof $row.data( 'object' ) )
0 ignored issues
show
!== was expected, but instead != was given.
Loading history...
109
                        postdata[ 'object' ] = $row.data( 'object' );
0 ignored issues
show
{ was expected, but instead postdata was given.
Loading history...
['object'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
110
                }
111
112
                $.ajax( {
113
                    type : 'POST',
114
                    url : pods_ajaxurl,
115
                    cache : false,
116
                    data : postdata,
117
                    success : function ( d ) {
118
                        var message = d.replace( '<e>', '' ).replace( '</e>', '' );
119
120
                        if ( -1 == d.indexOf( '<e>' ) && '-1' != d ) {
0 ignored issues
show
=== was expected, but instead == was given.
Loading history...
!== was expected, but instead != was given.
Loading history...
121
                            if ( '-2' == d ) {
0 ignored issues
show
=== was expected, but instead == was given.
Loading history...
122
                                // Run next
123
                                return methods[ 'migrate' ]( postdata, $row );
0 ignored issues
show
['migrate'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
124
                            }
125
                            else if ( '1' == d ) {
0 ignored issues
show
=== was expected, but instead == was given.
Loading history...
126
                                $row.removeClass( 'pods-wizard-table-active' ).addClass( 'pods-wizard-table-complete' );
127
128
                                // Run next
129
                                return methods[ 'migrate' ]();
0 ignored issues
show
['migrate'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
130
                            }
131
                            else if ( ( d.length - 2 ) == d.indexOf( '-2' ) ) {
0 ignored issues
show
=== was expected, but instead == was given.
Loading history...
132
                                $row.removeClass( 'pods-wizard-table-active' ).addClass( 'pods-wizard-table-warning' );
133
                                $row.find( 'td span.pods-wizard-info' ).html( message );
134
135
                                if ( window.console ) console.log( message );
0 ignored issues
show
{ was expected, but instead console was given.
Loading history...
136
137
                                // Run next
138
                                return methods[ 'migrate' ]( postdata, $row );
0 ignored issues
show
['migrate'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
139
                            }
140
                            else if ( ( d.length - 1 ) == d.indexOf( '1' ) ) {
0 ignored issues
show
=== was expected, but instead == was given.
Loading history...
141
                                $row.removeClass( 'pods-wizard-table-active' ).addClass( 'pods-wizard-table-warning' );
142
                                $row.find( 'td span.pods-wizard-info' ).html( message );
143
144
                                if ( window.console ) console.log( message );
0 ignored issues
show
{ was expected, but instead console was given.
Loading history...
145
146
                                // Run next
147
                                return methods[ 'migrate' ]();
0 ignored issues
show
['migrate'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
148
                            }
149
                            else {
150
                                $row.removeClass( 'pods-wizard-table-active' ).addClass( 'pods-wizard-table-error' );
151
                                $row.find( 'td span.pods-wizard-info' ).html( message );
152
153
                                if ( window.console ) console.log( message );
0 ignored issues
show
{ was expected, but instead console was given.
Loading history...
154
                            }
155
                        }
156
                        else if ( -1 < d.indexOf( 'Database Error;' ) ) {
157
                            $row.removeClass( 'pods-wizard-table-active' ).addClass( 'pods-wizard-table-error' );
158
                            $row.find( 'td span.pods-wizard-info' ).html( message );
159
160
                            if ( window.console ) console.log( message );
0 ignored issues
show
{ was expected, but instead console was given.
Loading history...
161
                        }
162
                        else {
163
                            $row.removeClass( 'pods-wizard-table-active' ).addClass( 'pods-wizard-table-warning' );
164
                            $row.find( 'td span.pods-wizard-info' ).html( message );
165
166
                            if ( window.console ) console.log( message );
0 ignored issues
show
{ was expected, but instead console was given.
Loading history...
167
168
                            // Run next
169
                            return methods[ 'migrate' ]();
0 ignored issues
show
['migrate'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
There were too many errors found in this file; checking aborted after 86%.

If JSHint finds too many errors in a file, it aborts checking altogether because it suspects a configuration issue.

Further Reading:

Loading history...
170
                        }
171
172
                        return true;
173
                    },
174
                    error : function () {
175
                        $row.removeClass( 'pods-wizard-table-active' ).addClass( 'pods-wizard-table-error' );
176
                        $row.find( 'td span.pods-wizard-info' ).text( PodsI18n.__( 'Unable to process request, please try again.' ) );
177
                    },
178
                    dataType : 'html'
179
                } );
180
            }
181
            else {
182
                var $wizard_next = $( '#pods-wizard-next' );
183
                $wizard_next.click().text( 'Start using Pods' ).addClass( 'finished' );
184
                $wizard_next.off( 'click' );
185
                $wizard_next.prop( 'href', 'admin.php?page=pods' );
186
                $wizard_next.show();
187
                $( '#pods-wizard-finished' ).show();
188
            }
189
        }
190
    };
191
192
    $.fn.PodsMigrate = function ( method ) {
193
        return methods[ method ]();
194
        // go through tr by tr, run if/else checks
195
    };
196
})( jQuery );