@@ -57,7 +57,7 @@ function __construct($cookies = true, $cookie = 'cookies.txt', $compression = WE
5757 $ this ->cookies = $ cookies ;
5858 $ this ->debug = $ debug ;
5959
60- if ($ this ->cookies === true ){
60+ if ($ this ->cookies === true ) {
6161 $ this ->cookie ($ cookie );
6262 }
6363
@@ -67,7 +67,7 @@ function __construct($cookies = true, $cookie = 'cookies.txt', $compression = WE
6767 $ this ->compression = 0 ;
6868 }
6969
70- $ this ->results = array ( 'result ' => 0 , 'time ' => time (), 'error ' => '' ) ;
70+ $ this ->results = [ 'result ' => 0 , 'time ' => time (), 'error ' => '' ] ;
7171 $ this ->bundle = $ config ['base_path ' ] . '/plugins/webseer/ca-bundle.crt ' ;
7272 }
7373
@@ -78,36 +78,37 @@ function cookie($cookie_file) {
7878 $ this ->cookie_file = $ cookie_file ;
7979 } elseif (is_writable ($ cookie_file )) {
8080 $ this ->cookie_file = $ cookie_file ;
81- }else {
81+ } else {
8282 $ this ->results ['error ' ] = 'The cookie file could not be opened. Make sure this directory has the correct permissions ' ;
8383 }
8484 }
8585
86- function post ($ url , $ data = array () ) {
86+ function post ($ url , $ data = [] ) {
8787 global $ httpcompressions ;
8888
8989 $ this ->debug ('Executing Post Request ' );
9090
91- $ process = curl_init ($ url );
91+ $ process = curl_init ($ url );
9292 $ this ->headers [] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8 ' ;
9393
94- $ d = array ();
94+ $ d = [];
95+
9596 foreach ($ data as $ i => $ j ) {
9697 $ d [] = "$ i= $ j " ;
9798 }
9899
99100 $ data = implode ('& ' , $ d );
100101
101- $ options = array (
102- CURLOPT_HTTPHEADER => $ this ->headers ,
103- CURLOPT_HEADER => true ,
104- CURLOPT_USERAGENT => $ this ->user_agent ,
105- CURLOPT_TIMEOUT => 4 ,
106- CURLOPT_POSTFIELDS => $ data ,
102+ $ options = [
103+ CURLOPT_HTTPHEADER => $ this ->headers ,
104+ CURLOPT_HEADER => true ,
105+ CURLOPT_USERAGENT => $ this ->user_agent ,
106+ CURLOPT_TIMEOUT => 4 ,
107+ CURLOPT_POSTFIELDS => $ data ,
107108 CURLOPT_RETURNTRANSFER => true ,
108109 CURLOPT_FOLLOWLOCATION => true ,
109- CURLOPT_POST => true ,
110- ) ;
110+ CURLOPT_POST => true ,
111+ ] ;
111112
112113 if (!empty ($ this ->compression )) {
113114 $ options [CURLOPT_ENCODING ] = $ httpcompressions [$ this ->compression ];
@@ -135,15 +136,15 @@ function get() {
135136
136137 $ process = curl_init ($ url );
137138
138- $ options = array (
139+ $ options = [
139140 CURLOPT_HEADER => true ,
140141 CURLOPT_USERAGENT => $ this ->user_agent ,
141142 CURLOPT_RETURNTRANSFER => true ,
142143 CURLOPT_FOLLOWLOCATION => true ,
143144 CURLOPT_MAXREDIRS => 4 ,
144145 CURLOPT_TIMEOUT => $ this ->host ['timeout_trigger ' ],
145146 CURLOPT_FAILONERROR => ($ this ->host ['requiresauth ' ] == '' ? true : false ),
146- ) ;
147+ ] ;
147148
148149 if (!empty ($ this ->compression )) {
149150 $ options [CURLOPT_ENCODING ] = $ httpcompressions [$ this ->compression ];
@@ -152,50 +153,50 @@ function get() {
152153 // CURLOPT_ENCODING => $this->compression,
153154 // CURLOPT_VERBOSE => 1,
154155
155-
156156 // if ($this->cookies == TRUE) CURLOPT_COOKIEFILE => $this->cookie_file,
157157 // if ($this->cookies == TRUE) CURLOPT_COOKIEJAR => $this->cookie_file,
158158
159-
160159 // CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0,
161160 // CURLOPT_SSLVERSION => 3, // FORCE SSL v3
162161
163162 if ($ this ->proxy_hostname != '' ) {
164163 $ port_http = intval ($ this ->proxy_http_port );
164+
165165 if ($ port_http < 0 || $ port_http > 65535 ) {
166- $ port_http = 80 ;
166+ $ port_http = 80 ;
167167 $ this ->proxy_http_port = $ port_http ;
168168 }
169169
170170 $ port_https = intval ($ this ->proxy_https_port );
171+
171172 if ($ port_https < 0 || $ port_https > 65535 ) {
172- $ port_https = 443 ;
173+ $ port_https = 443 ;
173174 $ this ->proxy_https_port = $ port_http ;
174175 }
175176
176177 $ is_https = (substr (strtolower ($ url ), 0 , 5 ) == 'https ' );
177178
178- $ proxy_opts = array (
179+ $ proxy_opts = [
179180 CURLOPT_UNRESTRICTED_AUTH => true ,
180181 CURLOPT_PROXY => $ this ->proxy_hostname ,
181182 CURLOPT_PROXYPORT => $ is_https ? $ port_https : $ port_http ,
182- ) ;
183+ ] ;
183184
184185 if ($ this ->proxy_username != '' ) {
185186 $ proxy_opts [CURLOPT_PROXYUSERPWD ] = $ this ->proxy_username . ': ' . $ this ->proxy_password ;
186187 }
187188 } else {
188- $ proxy_opts = array () ;
189+ $ proxy_opts = [] ;
189190 }
190191
191192 // Disable Cert checking for now
192193 if ($ this ->host ['checkcert ' ] == '' ) {
193- $ cert_opts = array (
194- CURLOPT_SSL_VERIFYPEER => FALSE ,
195- CURLOPT_SSL_VERIFYHOST => FALSE ,
196- ) ;
194+ $ cert_opts = [
195+ CURLOPT_SSL_VERIFYPEER => false ,
196+ CURLOPT_SSL_VERIFYHOST => false ,
197+ ] ;
197198 } else {
198- $ cert_opts = array () ;
199+ $ cert_opts = [] ;
199200 }
200201
201202 $ options += $ proxy_opts ;
@@ -206,14 +207,15 @@ function get() {
206207
207208 $ data = curl_exec ($ process );
208209
209- $ this ->data = str_replace (array ( "' " , "\\" ), array ( '' ) , $ data );
210+ $ this ->data = str_replace ([ "' " , '\\' ], [ '' ] , $ data );
210211
211- $ this ->results ['options ' ] = curl_getinfo ($ process );
212+ $ this ->results ['options ' ] = curl_getinfo ($ process );
212213 $ this ->results ['options ' ]['compression ' ] = $ this ->compression ;
213214
214215 $ errnum = curl_errno ($ process );
215216
216217 $ this ->debug ('cURL errno: ' . $ errnum );
218+
217219 if ($ errnum ) {
218220 $ this ->debug ('cURL error: ' . curl_error ($ process ));
219221 }
@@ -222,7 +224,7 @@ function get() {
222224 case 0 :
223225 break ;
224226 default :
225- $ this ->results ['error ' ] = 'HTTP ERROR: ' . str_replace (array ( '" ' , "' " ) , '' , (curl_error ($ process )));
227+ $ this ->results ['error ' ] = 'HTTP ERROR: ' . str_replace ([ '" ' , "' " ] , '' , (curl_error ($ process )));
226228
227229 break ;
228230 }
@@ -236,10 +238,10 @@ function get() {
236238 if (strpos ($ data , $ this ->host ['search_failed ' ]) !== false ) {
237239 $ this ->results ['error ' ] = 'Failure Search string found! ' ;
238240 } else {
239- $ this ->results ['error ' ] = '' ;
241+ $ this ->results ['error ' ] = '' ;
240242 $ this ->results ['result ' ] = 1 ;
241243 }
242- }elseif ($ errnum == 0 ) {
244+ } elseif ($ errnum == 0 ) {
243245 $ this ->debug ('Processing search ' );
244246
245247 if ($ this ->host ['search ' ] != '' ) {
0 commit comments