Code Duplication    Length = 14-14 lines in 3 locations

lib/elFinderFlysystemGoogleDriveNetmount.php 1 location

@@ 124-137 (lines=14) @@
121
                    $html .= '<script>
122
                        $("#'.$options['id'].'").elfinder("instance").trigger("netmount", {protocol: "googledrive", mode: "makebtn"});
123
                    </script>';
124
                    if (empty($options['pass']) && $options['host'] !== '1') {
125
                        $options['pass'] = 'return';
126
                        $this->session->set('GoogleDriveAuthParams', $options);
127
128
                        return ['exit' => true, 'body' => $html];
129
                    } else {
130
                        $out = [
131
                            'node' => $options['id'],
132
                            'json' => '{"protocol": "googledrive", "mode": "makebtn", "body" : "'.str_replace($html, '"', '\\"').'", "error" : "'.elFinder::ERROR_ACCESS_DENIED.'"}',
133
                            'bind' => 'netmount',
134
                        ];
135
136
                        return ['exit' => 'callback', 'out' => $out];
137
                    }
138
                } else {
139
                    if (! empty($_GET['code'])) {
140
                        $aToken = $client->fetchAccessTokenWithAuthCode($_GET['code']);

lib/elFinderVolumeDropbox2.class.php 1 location

@@ 199-212 (lines=14) @@
196
                    $html .= '<script>
197
                        $("#'.$options['id'].'").elfinder("instance").trigger("netmount", {protocol: "dropbox2", mode: "makebtn"});
198
                    </script>';
199
                    if (empty($options['pass']) && $options['host'] !== '1') {
200
                        $options['pass'] = 'return';
201
                        $this->session->set('Dropbox2AuthParams', $options);
202
203
                        return ['exit' => true, 'body' => $html];
204
                    } else {
205
                        $out = [
206
                            'node' => $options['id'],
207
                            'json' => '{"protocol": "dropbox2", "mode": "makebtn", "body" : "'.str_replace($html, '"', '\\"').'", "error" : "'.elFinder::ERROR_ACCESS_DENIED.'"}',
208
                            'bind' => 'netmount',
209
                        ];
210
211
                        return ['exit' => 'callback', 'out' => $out];
212
                    }
213
                } else {
214
                    if (! empty($_GET['code']) && isset($_GET['state'])) {
215
                        $tokenObj = $authHelper->getAccessToken($_GET['code'], $_GET['state'], $callback);

lib/elFinderVolumeGoogleDrive.class.php 1 location

@@ 230-243 (lines=14) @@
227
                    $html .= '<script>
228
                        $("#'.$options['id'].'").elfinder("instance").trigger("netmount", {protocol: "googledrive", mode: "makebtn"});
229
                    </script>';
230
                    if (empty($options['pass']) && $options['host'] !== '1') {
231
                        $options['pass'] = 'return';
232
                        $this->session->set('GoogleDriveAuthParams', $options);
233
234
                        return ['exit' => true, 'body' => $html];
235
                    } else {
236
                        $out = [
237
                            'node' => $options['id'],
238
                            'json' => '{"protocol": "googledrive", "mode": "makebtn", "body" : "'.str_replace($html, '"', '\\"').'", "error" : "'.elFinder::ERROR_ACCESS_DENIED.'"}',
239
                            'bind' => 'netmount',
240
                        ];
241
242
                        return ['exit' => 'callback', 'out' => $out];
243
                    }
244
                } else {
245
                    if (! empty($_GET['code'])) {
246
                        $aToken = $client->fetchAccessTokenWithAuthCode($_GET['code']);