@@ -75,6 +75,6 @@ |
||
75 | 75 | */ |
76 | 76 | public function render() |
77 | 77 | { |
78 | - return '<input type="hidden" name="' . $this->getName() . '" id="' . $this->getName() . '" value="' . $this->getValue() . '" />'; |
|
78 | + return '<input type="hidden" name="'.$this->getName().'" id="'.$this->getName().'" value="'.$this->getValue().'" />'; |
|
79 | 79 | } |
80 | 80 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | { |
194 | 194 | $access = $this->getAccessKey(); |
195 | 195 | if (!empty($access) && (false !== ($pos = strpos($str, $access)))) { |
196 | - return htmlspecialchars(substr($str, 0, $pos), ENT_QUOTES) . '<span style="text-decoration: underline;">' . htmlspecialchars(substr($str, $pos, 1), ENT_QUOTES) . '</span>' . htmlspecialchars(substr($str, $pos + 1), ENT_QUOTES); |
|
196 | + return htmlspecialchars(substr($str, 0, $pos), ENT_QUOTES).'<span style="text-decoration: underline;">'.htmlspecialchars(substr($str, $pos, 1), ENT_QUOTES).'</span>'.htmlspecialchars(substr($str, $pos + 1), ENT_QUOTES); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | return htmlspecialchars($str, ENT_QUOTES); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | public function getTitle($encode = true) |
261 | 261 | { |
262 | 262 | if (strlen($this->_description) > 0) { |
263 | - return $encode ? htmlspecialchars(strip_tags($this->_caption . ' - ' . $this->_description), ENT_QUOTES) : strip_tags($this->_caption . ' - ' . $this->_description); |
|
263 | + return $encode ? htmlspecialchars(strip_tags($this->_caption.' - '.$this->_description), ENT_QUOTES) : strip_tags($this->_caption.' - '.$this->_description); |
|
264 | 264 | } else { |
265 | 265 | return $encode ? htmlspecialchars(strip_tags($this->_caption), ENT_QUOTES) : strip_tags($this->_caption); |
266 | 266 | } |
@@ -345,14 +345,14 @@ discard block |
||
345 | 345 | public function getExtra($encode = false) |
346 | 346 | { |
347 | 347 | if (!$encode) { |
348 | - return ' ' . implode(' ', $this->_extra); |
|
348 | + return ' '.implode(' ', $this->_extra); |
|
349 | 349 | } |
350 | 350 | $value = array(); |
351 | 351 | foreach ($this->_extra as $val) { |
352 | 352 | $value[] = str_replace('>', '>', str_replace('<', '<', $val)); |
353 | 353 | } |
354 | 354 | |
355 | - return empty($value) ? '' : ' ' . implode(' ', $value); |
|
355 | + return empty($value) ? '' : ' '.implode(' ', $value); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -428,10 +428,10 @@ discard block |
||
428 | 428 | echo $this->getFormType(); |
429 | 429 | switch ($this->getFormType()) { |
430 | 430 | case 'checkbox': |
431 | - return NWLINE . "if (!myform.{$eltname}.checked) { window.alert(\"{$eltmsg}\"); myform.{$eltname}.focus(); return false; }\n"; |
|
431 | + return NWLINE."if (!myform.{$eltname}.checked) { window.alert(\"{$eltmsg}\"); myform.{$eltname}.focus(); return false; }\n"; |
|
432 | 432 | break; |
433 | 433 | default: |
434 | - return NWLINE . "if (myform.{$eltname}.value == \"\") { window.alert(\"{$eltmsg}\"); myform.{$eltname}.focus(); return false; }\n"; |
|
434 | + return NWLINE."if (myform.{$eltname}.value == \"\") { window.alert(\"{$eltmsg}\"); myform.{$eltname}.focus(); return false; }\n"; |
|
435 | 435 | break; |
436 | 436 | } // switch |
437 | 437 | } |
@@ -156,11 +156,11 @@ |
||
156 | 156 | $searchUsers->setExtra(' onclick="openWithSelfMain(\'' . XOOPS_URL . '/include/findusers.php?target=' . $name . '&multiple=' . $multiple . '&token=' . $token . '\', \'userselect\', 800, 600, null); return false;" '); |
157 | 157 | $action_tray->addElement($searchUsers); |
158 | 158 | |
159 | - if (isset($GLOBALS['xoTheme']) && is_object($GLOBALS['xoTheme'])) { |
|
160 | - $GLOBALS['xoTheme']->addScript('', array(), $js_addusers); |
|
161 | - } else { |
|
162 | - echo '<script>' . $js_addusers . '</script>'; |
|
163 | - } |
|
159 | + if (isset($GLOBALS['xoTheme']) && is_object($GLOBALS['xoTheme'])) { |
|
160 | + $GLOBALS['xoTheme']->addScript('', array(), $js_addusers); |
|
161 | + } else { |
|
162 | + echo '<script>' . $js_addusers . '</script>'; |
|
163 | + } |
|
164 | 164 | parent::__construct($caption, '', $name); |
165 | 165 | $this->addElement($select_element); |
166 | 166 | $this->addElement($action_tray); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $selectedUsers = array(); |
78 | 78 | if (count($value) > 0) { |
79 | 79 | // fetch the set of uids in $value |
80 | - $criteria = new Criteria('uid', '(' . implode(',', $value) . ')', 'IN'); |
|
80 | + $criteria = new Criteria('uid', '('.implode(',', $value).')', 'IN'); |
|
81 | 81 | $criteria->setSort('uname'); |
82 | 82 | $criteria->setOrder('ASC'); |
83 | 83 | $selectedUsers = $member_handler->getUserList($criteria); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | var num = opts.substring(0, opts.indexOf(':')); |
124 | 124 | opts = opts.substring(opts.indexOf(':')+1, opts.length); |
125 | - var sel = xoopsGetElementById('" . $name . "'); |
|
125 | + var sel = xoopsGetElementById('" . $name."'); |
|
126 | 126 | var arr = new Array(num); |
127 | 127 | for (var n=0; n < num; n++) { |
128 | 128 | var nm = opts.substring(0, opts.indexOf(':')); |
@@ -148,18 +148,18 @@ discard block |
||
148 | 148 | }"; |
149 | 149 | $token = $GLOBALS['xoopsSecurity']->createToken(); |
150 | 150 | $action_tray = new XoopsFormElementTray('', ''); |
151 | - $removeUsers = new XoopsFormButton('', 'rmvusr_' . $name, _MA_USER_REMOVE, 'button'); |
|
152 | - $removeUsers->setExtra(' onclick="var sel = xoopsGetElementById(\'' . $name . '\');for (var i = sel.options.length-1; i >= 0; i--) {if (!sel.options[i].selected) {sel.options[i] = null;}}; return false;" '); |
|
151 | + $removeUsers = new XoopsFormButton('', 'rmvusr_'.$name, _MA_USER_REMOVE, 'button'); |
|
152 | + $removeUsers->setExtra(' onclick="var sel = xoopsGetElementById(\''.$name.'\');for (var i = sel.options.length-1; i >= 0; i--) {if (!sel.options[i].selected) {sel.options[i] = null;}}; return false;" '); |
|
153 | 153 | $action_tray->addElement($removeUsers); |
154 | 154 | |
155 | - $searchUsers = new XoopsFormButton('', 'srchusr_' . $name, _MA_USER_MORE, 'button'); |
|
156 | - $searchUsers->setExtra(' onclick="openWithSelfMain(\'' . XOOPS_URL . '/include/findusers.php?target=' . $name . '&multiple=' . $multiple . '&token=' . $token . '\', \'userselect\', 800, 600, null); return false;" '); |
|
155 | + $searchUsers = new XoopsFormButton('', 'srchusr_'.$name, _MA_USER_MORE, 'button'); |
|
156 | + $searchUsers->setExtra(' onclick="openWithSelfMain(\''.XOOPS_URL.'/include/findusers.php?target='.$name.'&multiple='.$multiple.'&token='.$token.'\', \'userselect\', 800, 600, null); return false;" '); |
|
157 | 157 | $action_tray->addElement($searchUsers); |
158 | 158 | |
159 | 159 | if (isset($GLOBALS['xoTheme']) && is_object($GLOBALS['xoTheme'])) { |
160 | 160 | $GLOBALS['xoTheme']->addScript('', array(), $js_addusers); |
161 | 161 | } else { |
162 | - echo '<script>' . $js_addusers . '</script>'; |
|
162 | + echo '<script>'.$js_addusers.'</script>'; |
|
163 | 163 | } |
164 | 164 | parent::__construct($caption, '', $name); |
165 | 165 | $this->addElement($select_element); |
@@ -32,6 +32,6 @@ |
||
32 | 32 | */ |
33 | 33 | public function __construct($name = 'XOOPS_TOKEN', $timeout = 0) |
34 | 34 | { |
35 | - parent::__construct($name . '_REQUEST', $GLOBALS['xoopsSecurity']->createToken($timeout, $name)); |
|
35 | + parent::__construct($name.'_REQUEST', $GLOBALS['xoopsSecurity']->createToken($timeout, $name)); |
|
36 | 36 | } |
37 | 37 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | public function __construct($caption, $name, $value = null) |
46 | 46 | { |
47 | 47 | /* @var $member_handler XoopsMemberHandler */ |
48 | - $member_handler = xoops_getHandler('member'); |
|
48 | + $member_handler = xoops_getHandler('member'); |
|
49 | 49 | $userGroups = $member_handler->getGroupList(); |
50 | 50 | parent::__construct($caption, $name, $value); |
51 | 51 | $this->columns = 3; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | // using proxy, send entire URI |
144 | 144 | $this->_httprequest($URI, $fp, $URI, $this->_httpmethod); |
145 | 145 | } else { |
146 | - $path = $URI_PARTS["path"] . ($URI_PARTS["query"] ? "?" . $URI_PARTS["query"] : ""); |
|
146 | + $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); |
|
147 | 147 | // no proxy, send only the path |
148 | 148 | $this->_httprequest($path, $fp, $URI, $this->_httpmethod); |
149 | 149 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | /* url was redirected, check if we've hit the max depth */ |
155 | 155 | if ($this->maxredirs > $this->_redirectdepth) { |
156 | 156 | // only follow redirect if it's on this site, or offsiteok is true |
157 | - if (preg_match("|^http://" . preg_quote($this->host) . "|i", $this->_redirectaddr) || $this->offsiteok) { |
|
157 | + if (preg_match("|^http://".preg_quote($this->host)."|i", $this->_redirectaddr) || $this->offsiteok) { |
|
158 | 158 | /* follow the redirect */ |
159 | 159 | $this->_redirectdepth++; |
160 | 160 | $this->lastredirectaddr = $this->_redirectaddr; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // using proxy, send entire URI |
194 | 194 | $this->_httpsrequest($URI, $URI, $this->_httpmethod); |
195 | 195 | } else { |
196 | - $path = $URI_PARTS["path"] . ($URI_PARTS["query"] ? "?" . $URI_PARTS["query"] : ""); |
|
196 | + $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); |
|
197 | 197 | // no proxy, send only the path |
198 | 198 | $this->_httpsrequest($path, $URI, $this->_httpmethod); |
199 | 199 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | /* url was redirected, check if we've hit the max depth */ |
203 | 203 | if ($this->maxredirs > $this->_redirectdepth) { |
204 | 204 | // only follow redirect if it's on this site, or offsiteok is true |
205 | - if (preg_match("|^http://" . preg_quote($this->host) . "|i", $this->_redirectaddr) || $this->offsiteok) { |
|
205 | + if (preg_match("|^http://".preg_quote($this->host)."|i", $this->_redirectaddr) || $this->offsiteok) { |
|
206 | 206 | /* follow the redirect */ |
207 | 207 | $this->_redirectdepth++; |
208 | 208 | $this->lastredirectaddr = $this->_redirectaddr; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | break; |
228 | 228 | default: |
229 | 229 | // not a valid protocol |
230 | - $this->error = 'Invalid protocol "' . $URI_PARTS["scheme"] . '"\n'; |
|
230 | + $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; |
|
231 | 231 | return false; |
232 | 232 | break; |
233 | 233 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | // using proxy, send entire URI |
272 | 272 | $this->_httprequest($URI, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata); |
273 | 273 | } else { |
274 | - $path = $URI_PARTS["path"] . ($URI_PARTS["query"] ? "?" . $URI_PARTS["query"] : ""); |
|
274 | + $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); |
|
275 | 275 | // no proxy, send only the path |
276 | 276 | $this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata); |
277 | 277 | } |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | if ($this->_redirectaddr) { |
282 | 282 | /* url was redirected, check if we've hit the max depth */ |
283 | 283 | if ($this->maxredirs > $this->_redirectdepth) { |
284 | - if (!preg_match("|^" . $URI_PARTS["scheme"] . "://|", $this->_redirectaddr)) |
|
285 | - $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"] . "://" . $URI_PARTS["host"]); |
|
284 | + if (!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) |
|
285 | + $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"]."://".$URI_PARTS["host"]); |
|
286 | 286 | |
287 | 287 | // only follow redirect if it's on this site, or offsiteok is true |
288 | - if (preg_match("|^http://" . preg_quote($this->host) . "|i", $this->_redirectaddr) || $this->offsiteok) { |
|
288 | + if (preg_match("|^http://".preg_quote($this->host)."|i", $this->_redirectaddr) || $this->offsiteok) { |
|
289 | 289 | /* follow the redirect */ |
290 | 290 | $this->_redirectdepth++; |
291 | 291 | $this->lastredirectaddr = $this->_redirectaddr; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | // using proxy, send entire URI |
329 | 329 | $this->_httpsrequest($URI, $URI, $this->_submit_method, $this->_submit_type, $postdata); |
330 | 330 | } else { |
331 | - $path = $URI_PARTS["path"] . ($URI_PARTS["query"] ? "?" . $URI_PARTS["query"] : ""); |
|
331 | + $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); |
|
332 | 332 | // no proxy, send only the path |
333 | 333 | $this->_httpsrequest($path, $URI, $this->_submit_method, $this->_submit_type, $postdata); |
334 | 334 | } |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | if ($this->_redirectaddr) { |
337 | 337 | /* url was redirected, check if we've hit the max depth */ |
338 | 338 | if ($this->maxredirs > $this->_redirectdepth) { |
339 | - if (!preg_match("|^" . $URI_PARTS["scheme"] . "://|", $this->_redirectaddr)) |
|
340 | - $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"] . "://" . $URI_PARTS["host"]); |
|
339 | + if (!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) |
|
340 | + $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"]."://".$URI_PARTS["host"]); |
|
341 | 341 | |
342 | 342 | // only follow redirect if it's on this site, or offsiteok is true |
343 | - if (preg_match("|^http://" . preg_quote($this->host) . "|i", $this->_redirectaddr) || $this->offsiteok) { |
|
343 | + if (preg_match("|^http://".preg_quote($this->host)."|i", $this->_redirectaddr) || $this->offsiteok) { |
|
344 | 344 | /* follow the redirect */ |
345 | 345 | $this->_redirectdepth++; |
346 | 346 | $this->lastredirectaddr = $this->_redirectaddr; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | |
370 | 370 | default: |
371 | 371 | // not a valid protocol |
372 | - $this->error = 'Invalid protocol "' . $URI_PARTS["scheme"] . '"\n'; |
|
372 | + $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; |
|
373 | 373 | return false; |
374 | 374 | break; |
375 | 375 | } |
@@ -667,9 +667,9 @@ discard block |
||
667 | 667 | $match = preg_replace("|/$|", "", $match); |
668 | 668 | $match_part = parse_url($match); |
669 | 669 | $match_root = |
670 | - $match_part["scheme"] . "://" . $match_part["host"]; |
|
670 | + $match_part["scheme"]."://".$match_part["host"]; |
|
671 | 671 | |
672 | - $search = array("|^http://" . preg_quote($this->host) . "|i", |
|
672 | + $search = array("|^http://".preg_quote($this->host)."|i", |
|
673 | 673 | "|^(\/)|i", |
674 | 674 | "|^(?!http://)(?!mailto:)|i", |
675 | 675 | "|/\./|", |
@@ -677,8 +677,8 @@ discard block |
||
677 | 677 | ); |
678 | 678 | |
679 | 679 | $replace = array("", |
680 | - $match_root . "/", |
|
681 | - $match . "/", |
|
680 | + $match_root."/", |
|
681 | + $match."/", |
|
682 | 682 | "/", |
683 | 683 | "/" |
684 | 684 | ); |
@@ -707,17 +707,17 @@ discard block |
||
707 | 707 | $URI_PARTS = parse_url($URI); |
708 | 708 | if (empty($url)) |
709 | 709 | $url = "/"; |
710 | - $headers = $http_method . " " . $url . " " . $this->_httpversion . "\r\n"; |
|
710 | + $headers = $http_method." ".$url." ".$this->_httpversion."\r\n"; |
|
711 | 711 | if (!empty($this->agent)) |
712 | - $headers .= "User-Agent: " . $this->agent . "\r\n"; |
|
712 | + $headers .= "User-Agent: ".$this->agent."\r\n"; |
|
713 | 713 | if (!empty($this->host) && !isset($this->rawheaders['Host'])) { |
714 | - $headers .= "Host: " . $this->host; |
|
714 | + $headers .= "Host: ".$this->host; |
|
715 | 715 | if (!empty($this->port) && $this->port != '80') |
716 | - $headers .= ":" . $this->port; |
|
716 | + $headers .= ":".$this->port; |
|
717 | 717 | $headers .= "\r\n"; |
718 | 718 | } |
719 | 719 | if (!empty($this->accept)) |
720 | - $headers .= "Accept: " . $this->accept . "\r\n"; |
|
720 | + $headers .= "Accept: ".$this->accept."\r\n"; |
|
721 | 721 | if ($this->use_gzip) { |
722 | 722 | // make sure PHP was built with --with-zlib |
723 | 723 | // and we can handle gzipp'ed data |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | $headers .= "Accept-encoding: gzip\r\n"; |
726 | 726 | } else { |
727 | 727 | trigger_error( |
728 | - "use_gzip is on, but PHP was built without zlib support." . |
|
728 | + "use_gzip is on, but PHP was built without zlib support.". |
|
729 | 729 | " Requesting file(s) without gzip encoding.", |
730 | 730 | E_USER_NOTICE); |
731 | 731 | } |
732 | 732 | } |
733 | 733 | if (!empty($this->referer)) |
734 | - $headers .= "Referer: " . $this->referer . "\r\n"; |
|
734 | + $headers .= "Referer: ".$this->referer."\r\n"; |
|
735 | 735 | if (!empty($this->cookies)) { |
736 | 736 | if (!is_array($this->cookies)) |
737 | 737 | $this->cookies = (array)$this->cookies; |
@@ -740,31 +740,31 @@ discard block |
||
740 | 740 | if (count($this->cookies) > 0) { |
741 | 741 | $cookie_headers .= 'Cookie: '; |
742 | 742 | foreach ($this->cookies as $cookieKey => $cookieVal) { |
743 | - $cookie_headers .= $cookieKey . "=" . urlencode($cookieVal) . "; "; |
|
743 | + $cookie_headers .= $cookieKey."=".urlencode($cookieVal)."; "; |
|
744 | 744 | } |
745 | - $headers .= substr($cookie_headers, 0, -2) . "\r\n"; |
|
745 | + $headers .= substr($cookie_headers, 0, -2)."\r\n"; |
|
746 | 746 | } |
747 | 747 | } |
748 | 748 | if (!empty($this->rawheaders)) { |
749 | 749 | if (!is_array($this->rawheaders)) |
750 | 750 | $this->rawheaders = (array)$this->rawheaders; |
751 | 751 | while (list($headerKey, $headerVal) = each($this->rawheaders)) |
752 | - $headers .= $headerKey . ": " . $headerVal . "\r\n"; |
|
752 | + $headers .= $headerKey.": ".$headerVal."\r\n"; |
|
753 | 753 | } |
754 | 754 | if (!empty($content_type)) { |
755 | 755 | $headers .= "Content-type: $content_type"; |
756 | 756 | if ($content_type == "multipart/form-data") |
757 | - $headers .= "; boundary=" . $this->_mime_boundary; |
|
757 | + $headers .= "; boundary=".$this->_mime_boundary; |
|
758 | 758 | $headers .= "\r\n"; |
759 | 759 | } |
760 | 760 | if (!empty($body)) |
761 | - $headers .= "Content-length: " . strlen($body) . "\r\n"; |
|
761 | + $headers .= "Content-length: ".strlen($body)."\r\n"; |
|
762 | 762 | if (!empty($this->user) || !empty($this->pass)) |
763 | - $headers .= "Authorization: Basic " . base64_encode($this->user . ":" . $this->pass) . "\r\n"; |
|
763 | + $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n"; |
|
764 | 764 | |
765 | 765 | //add proxy auth headers |
766 | 766 | if (!empty($this->proxy_user)) |
767 | - $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass) . "\r\n"; |
|
767 | + $headers .= 'Proxy-Authorization: '.'Basic '.base64_encode($this->proxy_user.':'.$this->proxy_pass)."\r\n"; |
|
768 | 768 | |
769 | 769 | |
770 | 770 | $headers .= "\r\n"; |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | socket_set_timeout($fp, $this->read_timeout); |
775 | 775 | $this->timed_out = false; |
776 | 776 | |
777 | - fwrite($fp, $headers . $body, strlen($headers . $body)); |
|
777 | + fwrite($fp, $headers.$body, strlen($headers.$body)); |
|
778 | 778 | |
779 | 779 | $this->_redirectaddr = false; |
780 | 780 | unset($this->headers); |
@@ -798,10 +798,10 @@ discard block |
||
798 | 798 | // look for :// in the Location header to see if hostname is included |
799 | 799 | if (!preg_match("|\:\/\/|", $matches[2])) { |
800 | 800 | // no host in the path, so prepend |
801 | - $this->_redirectaddr = $URI_PARTS["scheme"] . "://" . $this->host . ":" . $this->port; |
|
801 | + $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; |
|
802 | 802 | // eliminate double slash |
803 | 803 | if (!preg_match("|^/|", $matches[2])) |
804 | - $this->_redirectaddr .= "/" . $matches[2]; |
|
804 | + $this->_redirectaddr .= "/".$matches[2]; |
|
805 | 805 | else |
806 | 806 | $this->_redirectaddr .= $matches[2]; |
807 | 807 | } else |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | if (($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i", $results, $match)) { |
854 | 854 | $this->results[] = $results; |
855 | 855 | for ($x = 0; $x < count($match[1]); $x++) |
856 | - $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"] . "://" . $this->host); |
|
856 | + $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"]."://".$this->host); |
|
857 | 857 | } // have we already fetched framed content? |
858 | 858 | elseif (is_array($this->results)) |
859 | 859 | $this->results[] = $results; |
@@ -886,16 +886,16 @@ discard block |
||
886 | 886 | // GET ... header not needed for curl |
887 | 887 | //$headers[] = $http_method." ".$url." ".$this->_httpversion; |
888 | 888 | if (!empty($this->agent)) |
889 | - $headers[] = "User-Agent: " . $this->agent; |
|
889 | + $headers[] = "User-Agent: ".$this->agent; |
|
890 | 890 | if (!empty($this->host)) |
891 | 891 | if (!empty($this->port)) |
892 | - $headers[] = "Host: " . $this->host . ":" . $this->port; |
|
892 | + $headers[] = "Host: ".$this->host.":".$this->port; |
|
893 | 893 | else |
894 | - $headers[] = "Host: " . $this->host; |
|
894 | + $headers[] = "Host: ".$this->host; |
|
895 | 895 | if (!empty($this->accept)) |
896 | - $headers[] = "Accept: " . $this->accept; |
|
896 | + $headers[] = "Accept: ".$this->accept; |
|
897 | 897 | if (!empty($this->referer)) |
898 | - $headers[] = "Referer: " . $this->referer; |
|
898 | + $headers[] = "Referer: ".$this->referer; |
|
899 | 899 | if (!empty($this->cookies)) { |
900 | 900 | if (!is_array($this->cookies)) |
901 | 901 | $this->cookies = (array)$this->cookies; |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | if (count($this->cookies) > 0) { |
905 | 905 | $cookie_str = 'Cookie: '; |
906 | 906 | foreach ($this->cookies as $cookieKey => $cookieVal) { |
907 | - $cookie_str .= $cookieKey . "=" . urlencode($cookieVal) . "; "; |
|
907 | + $cookie_str .= $cookieKey."=".urlencode($cookieVal)."; "; |
|
908 | 908 | } |
909 | 909 | $headers[] = substr($cookie_str, 0, -2); |
910 | 910 | } |
@@ -913,33 +913,33 @@ discard block |
||
913 | 913 | if (!is_array($this->rawheaders)) |
914 | 914 | $this->rawheaders = (array)$this->rawheaders; |
915 | 915 | while (list($headerKey, $headerVal) = each($this->rawheaders)) |
916 | - $headers[] = $headerKey . ": " . $headerVal; |
|
916 | + $headers[] = $headerKey.": ".$headerVal; |
|
917 | 917 | } |
918 | 918 | if (!empty($content_type)) { |
919 | 919 | if ($content_type == "multipart/form-data") |
920 | - $headers[] = "Content-type: $content_type; boundary=" . $this->_mime_boundary; |
|
920 | + $headers[] = "Content-type: $content_type; boundary=".$this->_mime_boundary; |
|
921 | 921 | else |
922 | 922 | $headers[] = "Content-type: $content_type"; |
923 | 923 | } |
924 | 924 | if (!empty($body)) |
925 | - $headers[] = "Content-length: " . strlen($body); |
|
925 | + $headers[] = "Content-length: ".strlen($body); |
|
926 | 926 | if (!empty($this->user) || !empty($this->pass)) |
927 | - $headers[] = "Authorization: BASIC " . base64_encode($this->user . ":" . $this->pass); |
|
927 | + $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); |
|
928 | 928 | |
929 | 929 | for ($curr_header = 0; $curr_header < count($headers); $curr_header++) { |
930 | 930 | $safer_header = strtr($headers[$curr_header], "\"", " "); |
931 | - $cmdline_params .= " -H \"" . $safer_header . "\""; |
|
931 | + $cmdline_params .= " -H \"".$safer_header."\""; |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | if (!empty($body)) |
935 | 935 | $cmdline_params .= " -d \"$body\""; |
936 | 936 | |
937 | 937 | if ($this->read_timeout > 0) |
938 | - $cmdline_params .= " -m " . $this->read_timeout; |
|
938 | + $cmdline_params .= " -m ".$this->read_timeout; |
|
939 | 939 | |
940 | 940 | $headerfile = tempnam($temp_dir, "sno"); |
941 | 941 | |
942 | - exec($this->curl_path . " -k -D \"$headerfile\"" . $cmdline_params . " " . escapeshellarg($URI), $results, $return); |
|
942 | + exec($this->curl_path." -k -D \"$headerfile\"".$cmdline_params." ".escapeshellarg($URI), $results, $return); |
|
943 | 943 | |
944 | 944 | if ($return) { |
945 | 945 | $this->error = "Error: cURL could not retrieve the document, error $return."; |
@@ -963,10 +963,10 @@ discard block |
||
963 | 963 | // look for :// in the Location header to see if hostname is included |
964 | 964 | if (!preg_match("|\:\/\/|", $matches[2])) { |
965 | 965 | // no host in the path, so prepend |
966 | - $this->_redirectaddr = $URI_PARTS["scheme"] . "://" . $this->host . ":" . $this->port; |
|
966 | + $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; |
|
967 | 967 | // eliminate double slash |
968 | 968 | if (!preg_match("|^/|", $matches[2])) |
969 | - $this->_redirectaddr .= "/" . $matches[2]; |
|
969 | + $this->_redirectaddr .= "/".$matches[2]; |
|
970 | 970 | else |
971 | 971 | $this->_redirectaddr .= $matches[2]; |
972 | 972 | } else |
@@ -993,7 +993,7 @@ discard block |
||
993 | 993 | if (($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i", $results, $match)) { |
994 | 994 | $this->results[] = $results; |
995 | 995 | for ($x = 0; $x < count($match[1]); $x++) |
996 | - $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"] . "://" . $this->host); |
|
996 | + $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"]."://".$this->host); |
|
997 | 997 | } // have we already fetched framed content? |
998 | 998 | elseif (is_array($this->results)) |
999 | 999 | $this->results[] = $results; |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | case -5: |
1081 | 1081 | $this->error = "connection refused or timed out (-5)"; |
1082 | 1082 | default: |
1083 | - $this->error = "connection failed (" . $errno . ")"; |
|
1083 | + $this->error = "connection failed (".$errno.")"; |
|
1084 | 1084 | } |
1085 | 1085 | return false; |
1086 | 1086 | } |
@@ -1121,26 +1121,26 @@ discard block |
||
1121 | 1121 | while (list($key, $val) = each($formvars)) { |
1122 | 1122 | if (is_array($val) || is_object($val)) { |
1123 | 1123 | while (list($cur_key, $cur_val) = each($val)) { |
1124 | - $postdata .= urlencode($key) . "[]=" . urlencode($cur_val) . "&"; |
|
1124 | + $postdata .= urlencode($key)."[]=".urlencode($cur_val)."&"; |
|
1125 | 1125 | } |
1126 | 1126 | } else |
1127 | - $postdata .= urlencode($key) . "=" . urlencode($val) . "&"; |
|
1127 | + $postdata .= urlencode($key)."=".urlencode($val)."&"; |
|
1128 | 1128 | } |
1129 | 1129 | break; |
1130 | 1130 | |
1131 | 1131 | case "multipart/form-data": |
1132 | - $this->_mime_boundary = "Snoopy" . md5(uniqid(microtime())); |
|
1132 | + $this->_mime_boundary = "Snoopy".md5(uniqid(microtime())); |
|
1133 | 1133 | |
1134 | 1134 | reset($formvars); |
1135 | 1135 | while (list($key, $val) = each($formvars)) { |
1136 | 1136 | if (is_array($val) || is_object($val)) { |
1137 | 1137 | while (list($cur_key, $cur_val) = each($val)) { |
1138 | - $postdata .= "--" . $this->_mime_boundary . "\r\n"; |
|
1138 | + $postdata .= "--".$this->_mime_boundary."\r\n"; |
|
1139 | 1139 | $postdata .= "Content-Disposition: form-data; name=\"$key\[\]\"\r\n\r\n"; |
1140 | 1140 | $postdata .= "$cur_val\r\n"; |
1141 | 1141 | } |
1142 | 1142 | } else { |
1143 | - $postdata .= "--" . $this->_mime_boundary . "\r\n"; |
|
1143 | + $postdata .= "--".$this->_mime_boundary."\r\n"; |
|
1144 | 1144 | $postdata .= "Content-Disposition: form-data; name=\"$key\"\r\n\r\n"; |
1145 | 1145 | $postdata .= "$val\r\n"; |
1146 | 1146 | } |
@@ -1157,12 +1157,12 @@ discard block |
||
1157 | 1157 | fclose($fp); |
1158 | 1158 | $base_name = basename($file_name); |
1159 | 1159 | |
1160 | - $postdata .= "--" . $this->_mime_boundary . "\r\n"; |
|
1160 | + $postdata .= "--".$this->_mime_boundary."\r\n"; |
|
1161 | 1161 | $postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n"; |
1162 | 1162 | $postdata .= "$file_content\r\n"; |
1163 | 1163 | } |
1164 | 1164 | } |
1165 | - $postdata .= "--" . $this->_mime_boundary . "--\r\n"; |
|
1165 | + $postdata .= "--".$this->_mime_boundary."--\r\n"; |
|
1166 | 1166 | break; |
1167 | 1167 | } |
1168 | 1168 |
@@ -124,20 +124,25 @@ discard block |
||
124 | 124 | |
125 | 125 | //preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS); |
126 | 126 | $URI_PARTS = parse_url($URI); |
127 | - if (!empty($URI_PARTS["user"])) |
|
128 | - $this->user = $URI_PARTS["user"]; |
|
129 | - if (!empty($URI_PARTS["pass"])) |
|
130 | - $this->pass = $URI_PARTS["pass"]; |
|
131 | - if (empty($URI_PARTS["query"])) |
|
132 | - $URI_PARTS["query"] = ''; |
|
133 | - if (empty($URI_PARTS["path"])) |
|
134 | - $URI_PARTS["path"] = ''; |
|
127 | + if (!empty($URI_PARTS["user"])) { |
|
128 | + $this->user = $URI_PARTS["user"]; |
|
129 | + } |
|
130 | + if (!empty($URI_PARTS["pass"])) { |
|
131 | + $this->pass = $URI_PARTS["pass"]; |
|
132 | + } |
|
133 | + if (empty($URI_PARTS["query"])) { |
|
134 | + $URI_PARTS["query"] = ''; |
|
135 | + } |
|
136 | + if (empty($URI_PARTS["path"])) { |
|
137 | + $URI_PARTS["path"] = ''; |
|
138 | + } |
|
135 | 139 | |
136 | 140 | switch (strtolower($URI_PARTS["scheme"])) { |
137 | 141 | case "http": |
138 | 142 | $this->host = $URI_PARTS["host"]; |
139 | - if (!empty($URI_PARTS["port"])) |
|
140 | - $this->port = $URI_PARTS["port"]; |
|
143 | + if (!empty($URI_PARTS["port"])) { |
|
144 | + $this->port = $URI_PARTS["port"]; |
|
145 | + } |
|
141 | 146 | if ($this->_connect($fp)) { |
142 | 147 | if ($this->_isproxy) { |
143 | 148 | // using proxy, send entire URI |
@@ -171,8 +176,9 @@ discard block |
||
171 | 176 | if ($this->_framedepth < $this->maxframes) { |
172 | 177 | $this->fetch($frameurl); |
173 | 178 | $this->_framedepth++; |
174 | - } else |
|
175 | - break; |
|
179 | + } else { |
|
180 | + break; |
|
181 | + } |
|
176 | 182 | } |
177 | 183 | } |
178 | 184 | } else { |
@@ -181,14 +187,17 @@ discard block |
||
181 | 187 | return true; |
182 | 188 | break; |
183 | 189 | case "https": |
184 | - if (!$this->curl_path) |
|
185 | - return false; |
|
186 | - if (function_exists("is_executable")) |
|
187 | - if (!is_executable($this->curl_path)) |
|
190 | + if (!$this->curl_path) { |
|
191 | + return false; |
|
192 | + } |
|
193 | + if (function_exists("is_executable")) { |
|
194 | + if (!is_executable($this->curl_path)) |
|
188 | 195 | return false; |
196 | + } |
|
189 | 197 | $this->host = $URI_PARTS["host"]; |
190 | - if (!empty($URI_PARTS["port"])) |
|
191 | - $this->port = $URI_PARTS["port"]; |
|
198 | + if (!empty($URI_PARTS["port"])) { |
|
199 | + $this->port = $URI_PARTS["port"]; |
|
200 | + } |
|
192 | 201 | if ($this->_isproxy) { |
193 | 202 | // using proxy, send entire URI |
194 | 203 | $this->_httpsrequest($URI, $URI, $this->_httpmethod); |
@@ -219,8 +228,9 @@ discard block |
||
219 | 228 | if ($this->_framedepth < $this->maxframes) { |
220 | 229 | $this->fetch($frameurl); |
221 | 230 | $this->_framedepth++; |
222 | - } else |
|
223 | - break; |
|
231 | + } else { |
|
232 | + break; |
|
233 | + } |
|
224 | 234 | } |
225 | 235 | } |
226 | 236 | return true; |
@@ -252,20 +262,25 @@ discard block |
||
252 | 262 | $postdata = $this->_prepare_post_body($formvars, $formfiles); |
253 | 263 | |
254 | 264 | $URI_PARTS = parse_url($URI); |
255 | - if (!empty($URI_PARTS["user"])) |
|
256 | - $this->user = $URI_PARTS["user"]; |
|
257 | - if (!empty($URI_PARTS["pass"])) |
|
258 | - $this->pass = $URI_PARTS["pass"]; |
|
259 | - if (empty($URI_PARTS["query"])) |
|
260 | - $URI_PARTS["query"] = ''; |
|
261 | - if (empty($URI_PARTS["path"])) |
|
262 | - $URI_PARTS["path"] = ''; |
|
265 | + if (!empty($URI_PARTS["user"])) { |
|
266 | + $this->user = $URI_PARTS["user"]; |
|
267 | + } |
|
268 | + if (!empty($URI_PARTS["pass"])) { |
|
269 | + $this->pass = $URI_PARTS["pass"]; |
|
270 | + } |
|
271 | + if (empty($URI_PARTS["query"])) { |
|
272 | + $URI_PARTS["query"] = ''; |
|
273 | + } |
|
274 | + if (empty($URI_PARTS["path"])) { |
|
275 | + $URI_PARTS["path"] = ''; |
|
276 | + } |
|
263 | 277 | |
264 | 278 | switch (strtolower($URI_PARTS["scheme"])) { |
265 | 279 | case "http": |
266 | 280 | $this->host = $URI_PARTS["host"]; |
267 | - if (!empty($URI_PARTS["port"])) |
|
268 | - $this->port = $URI_PARTS["port"]; |
|
281 | + if (!empty($URI_PARTS["port"])) { |
|
282 | + $this->port = $URI_PARTS["port"]; |
|
283 | + } |
|
269 | 284 | if ($this->_connect($fp)) { |
270 | 285 | if ($this->_isproxy) { |
271 | 286 | // using proxy, send entire URI |
@@ -281,18 +296,22 @@ discard block |
||
281 | 296 | if ($this->_redirectaddr) { |
282 | 297 | /* url was redirected, check if we've hit the max depth */ |
283 | 298 | if ($this->maxredirs > $this->_redirectdepth) { |
284 | - if (!preg_match("|^" . $URI_PARTS["scheme"] . "://|", $this->_redirectaddr)) |
|
285 | - $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"] . "://" . $URI_PARTS["host"]); |
|
299 | + if (!preg_match("|^" . $URI_PARTS["scheme"] . "://|", $this->_redirectaddr)) { |
|
300 | + $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"] . "://" . $URI_PARTS["host"]); |
|
301 | + } |
|
286 | 302 | |
287 | 303 | // only follow redirect if it's on this site, or offsiteok is true |
288 | 304 | if (preg_match("|^http://" . preg_quote($this->host) . "|i", $this->_redirectaddr) || $this->offsiteok) { |
289 | 305 | /* follow the redirect */ |
290 | 306 | $this->_redirectdepth++; |
291 | 307 | $this->lastredirectaddr = $this->_redirectaddr; |
292 | - if (strpos($this->_redirectaddr, "?") > 0) |
|
293 | - $this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get |
|
294 | - else |
|
295 | - $this->submit($this->_redirectaddr, $formvars, $formfiles); |
|
308 | + if (strpos($this->_redirectaddr, "?") > 0) { |
|
309 | + $this->fetch($this->_redirectaddr); |
|
310 | + } |
|
311 | + // the redirect has changed the request method from post to get |
|
312 | + else { |
|
313 | + $this->submit($this->_redirectaddr, $formvars, $formfiles); |
|
314 | + } |
|
296 | 315 | } |
297 | 316 | } |
298 | 317 | } |
@@ -305,8 +324,9 @@ discard block |
||
305 | 324 | if ($this->_framedepth < $this->maxframes) { |
306 | 325 | $this->fetch($frameurl); |
307 | 326 | $this->_framedepth++; |
308 | - } else |
|
309 | - break; |
|
327 | + } else { |
|
328 | + break; |
|
329 | + } |
|
310 | 330 | } |
311 | 331 | } |
312 | 332 | |
@@ -316,14 +336,17 @@ discard block |
||
316 | 336 | return true; |
317 | 337 | break; |
318 | 338 | case "https": |
319 | - if (!$this->curl_path) |
|
320 | - return false; |
|
321 | - if (function_exists("is_executable")) |
|
322 | - if (!is_executable($this->curl_path)) |
|
339 | + if (!$this->curl_path) { |
|
340 | + return false; |
|
341 | + } |
|
342 | + if (function_exists("is_executable")) { |
|
343 | + if (!is_executable($this->curl_path)) |
|
323 | 344 | return false; |
345 | + } |
|
324 | 346 | $this->host = $URI_PARTS["host"]; |
325 | - if (!empty($URI_PARTS["port"])) |
|
326 | - $this->port = $URI_PARTS["port"]; |
|
347 | + if (!empty($URI_PARTS["port"])) { |
|
348 | + $this->port = $URI_PARTS["port"]; |
|
349 | + } |
|
327 | 350 | if ($this->_isproxy) { |
328 | 351 | // using proxy, send entire URI |
329 | 352 | $this->_httpsrequest($URI, $URI, $this->_submit_method, $this->_submit_type, $postdata); |
@@ -336,18 +359,22 @@ discard block |
||
336 | 359 | if ($this->_redirectaddr) { |
337 | 360 | /* url was redirected, check if we've hit the max depth */ |
338 | 361 | if ($this->maxredirs > $this->_redirectdepth) { |
339 | - if (!preg_match("|^" . $URI_PARTS["scheme"] . "://|", $this->_redirectaddr)) |
|
340 | - $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"] . "://" . $URI_PARTS["host"]); |
|
362 | + if (!preg_match("|^" . $URI_PARTS["scheme"] . "://|", $this->_redirectaddr)) { |
|
363 | + $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"] . "://" . $URI_PARTS["host"]); |
|
364 | + } |
|
341 | 365 | |
342 | 366 | // only follow redirect if it's on this site, or offsiteok is true |
343 | 367 | if (preg_match("|^http://" . preg_quote($this->host) . "|i", $this->_redirectaddr) || $this->offsiteok) { |
344 | 368 | /* follow the redirect */ |
345 | 369 | $this->_redirectdepth++; |
346 | 370 | $this->lastredirectaddr = $this->_redirectaddr; |
347 | - if (strpos($this->_redirectaddr, "?") > 0) |
|
348 | - $this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get |
|
349 | - else |
|
350 | - $this->submit($this->_redirectaddr, $formvars, $formfiles); |
|
371 | + if (strpos($this->_redirectaddr, "?") > 0) { |
|
372 | + $this->fetch($this->_redirectaddr); |
|
373 | + } |
|
374 | + // the redirect has changed the request method from post to get |
|
375 | + else { |
|
376 | + $this->submit($this->_redirectaddr, $formvars, $formfiles); |
|
377 | + } |
|
351 | 378 | } |
352 | 379 | } |
353 | 380 | } |
@@ -360,8 +387,9 @@ discard block |
||
360 | 387 | if ($this->_framedepth < $this->maxframes) { |
361 | 388 | $this->fetch($frameurl); |
362 | 389 | $this->_framedepth++; |
363 | - } else |
|
364 | - break; |
|
390 | + } else { |
|
391 | + break; |
|
392 | + } |
|
365 | 393 | } |
366 | 394 | } |
367 | 395 | return true; |
@@ -386,19 +414,24 @@ discard block |
||
386 | 414 | function fetchlinks($URI) |
387 | 415 | { |
388 | 416 | if ($this->fetch($URI)) { |
389 | - if ($this->lastredirectaddr) |
|
390 | - $URI = $this->lastredirectaddr; |
|
417 | + if ($this->lastredirectaddr) { |
|
418 | + $URI = $this->lastredirectaddr; |
|
419 | + } |
|
391 | 420 | if (is_array($this->results)) { |
392 | - for ($x = 0; $x < count($this->results); $x++) |
|
393 | - $this->results[$x] = $this->_striplinks($this->results[$x]); |
|
394 | - } else |
|
395 | - $this->results = $this->_striplinks($this->results); |
|
421 | + for ($x = 0; $x < count($this->results); $x++) { |
|
422 | + $this->results[$x] = $this->_striplinks($this->results[$x]); |
|
423 | + } |
|
424 | + } else { |
|
425 | + $this->results = $this->_striplinks($this->results); |
|
426 | + } |
|
396 | 427 | |
397 | - if ($this->expandlinks) |
|
398 | - $this->results = $this->_expandlinks($this->results, $URI); |
|
428 | + if ($this->expandlinks) { |
|
429 | + $this->results = $this->_expandlinks($this->results, $URI); |
|
430 | + } |
|
399 | 431 | return true; |
400 | - } else |
|
401 | - return false; |
|
432 | + } else { |
|
433 | + return false; |
|
434 | + } |
|
402 | 435 | } |
403 | 436 | |
404 | 437 | /*======================================================================*\ |
@@ -414,14 +447,17 @@ discard block |
||
414 | 447 | if ($this->fetch($URI)) { |
415 | 448 | |
416 | 449 | if (is_array($this->results)) { |
417 | - for ($x = 0; $x < count($this->results); $x++) |
|
418 | - $this->results[$x] = $this->_stripform($this->results[$x]); |
|
419 | - } else |
|
420 | - $this->results = $this->_stripform($this->results); |
|
450 | + for ($x = 0; $x < count($this->results); $x++) { |
|
451 | + $this->results[$x] = $this->_stripform($this->results[$x]); |
|
452 | + } |
|
453 | + } else { |
|
454 | + $this->results = $this->_stripform($this->results); |
|
455 | + } |
|
421 | 456 | |
422 | 457 | return true; |
423 | - } else |
|
424 | - return false; |
|
458 | + } else { |
|
459 | + return false; |
|
460 | + } |
|
425 | 461 | } |
426 | 462 | |
427 | 463 | |
@@ -436,13 +472,16 @@ discard block |
||
436 | 472 | { |
437 | 473 | if ($this->fetch($URI)) { |
438 | 474 | if (is_array($this->results)) { |
439 | - for ($x = 0; $x < count($this->results); $x++) |
|
440 | - $this->results[$x] = $this->_striptext($this->results[$x]); |
|
441 | - } else |
|
442 | - $this->results = $this->_striptext($this->results); |
|
475 | + for ($x = 0; $x < count($this->results); $x++) { |
|
476 | + $this->results[$x] = $this->_striptext($this->results[$x]); |
|
477 | + } |
|
478 | + } else { |
|
479 | + $this->results = $this->_striptext($this->results); |
|
480 | + } |
|
443 | 481 | return true; |
444 | - } else |
|
445 | - return false; |
|
482 | + } else { |
|
483 | + return false; |
|
484 | + } |
|
446 | 485 | } |
447 | 486 | |
448 | 487 | /*======================================================================*\ |
@@ -455,22 +494,26 @@ discard block |
||
455 | 494 | function submitlinks($URI, $formvars = "", $formfiles = "") |
456 | 495 | { |
457 | 496 | if ($this->submit($URI, $formvars, $formfiles)) { |
458 | - if ($this->lastredirectaddr) |
|
459 | - $URI = $this->lastredirectaddr; |
|
497 | + if ($this->lastredirectaddr) { |
|
498 | + $URI = $this->lastredirectaddr; |
|
499 | + } |
|
460 | 500 | if (is_array($this->results)) { |
461 | 501 | for ($x = 0; $x < count($this->results); $x++) { |
462 | 502 | $this->results[$x] = $this->_striplinks($this->results[$x]); |
463 | - if ($this->expandlinks) |
|
464 | - $this->results[$x] = $this->_expandlinks($this->results[$x], $URI); |
|
503 | + if ($this->expandlinks) { |
|
504 | + $this->results[$x] = $this->_expandlinks($this->results[$x], $URI); |
|
505 | + } |
|
465 | 506 | } |
466 | 507 | } else { |
467 | 508 | $this->results = $this->_striplinks($this->results); |
468 | - if ($this->expandlinks) |
|
469 | - $this->results = $this->_expandlinks($this->results, $URI); |
|
509 | + if ($this->expandlinks) { |
|
510 | + $this->results = $this->_expandlinks($this->results, $URI); |
|
511 | + } |
|
470 | 512 | } |
471 | 513 | return true; |
472 | - } else |
|
473 | - return false; |
|
514 | + } else { |
|
515 | + return false; |
|
516 | + } |
|
474 | 517 | } |
475 | 518 | |
476 | 519 | /*======================================================================*\ |
@@ -483,22 +526,26 @@ discard block |
||
483 | 526 | function submittext($URI, $formvars = "", $formfiles = "") |
484 | 527 | { |
485 | 528 | if ($this->submit($URI, $formvars, $formfiles)) { |
486 | - if ($this->lastredirectaddr) |
|
487 | - $URI = $this->lastredirectaddr; |
|
529 | + if ($this->lastredirectaddr) { |
|
530 | + $URI = $this->lastredirectaddr; |
|
531 | + } |
|
488 | 532 | if (is_array($this->results)) { |
489 | 533 | for ($x = 0; $x < count($this->results); $x++) { |
490 | 534 | $this->results[$x] = $this->_striptext($this->results[$x]); |
491 | - if ($this->expandlinks) |
|
492 | - $this->results[$x] = $this->_expandlinks($this->results[$x], $URI); |
|
535 | + if ($this->expandlinks) { |
|
536 | + $this->results[$x] = $this->_expandlinks($this->results[$x], $URI); |
|
537 | + } |
|
493 | 538 | } |
494 | 539 | } else { |
495 | 540 | $this->results = $this->_striptext($this->results); |
496 | - if ($this->expandlinks) |
|
497 | - $this->results = $this->_expandlinks($this->results, $URI); |
|
541 | + if ($this->expandlinks) { |
|
542 | + $this->results = $this->_expandlinks($this->results, $URI); |
|
543 | + } |
|
498 | 544 | } |
499 | 545 | return true; |
500 | - } else |
|
501 | - return false; |
|
546 | + } else { |
|
547 | + return false; |
|
548 | + } |
|
502 | 549 | } |
503 | 550 | |
504 | 551 | |
@@ -550,13 +597,15 @@ discard block |
||
550 | 597 | // catenate the non-empty matches from the conditional subpattern |
551 | 598 | |
552 | 599 | while (list($key, $val) = each($links[2])) { |
553 | - if (!empty($val)) |
|
554 | - $match[] = $val; |
|
600 | + if (!empty($val)) { |
|
601 | + $match[] = $val; |
|
602 | + } |
|
555 | 603 | } |
556 | 604 | |
557 | 605 | while (list($key, $val) = each($links[3])) { |
558 | - if (!empty($val)) |
|
559 | - $match[] = $val; |
|
606 | + if (!empty($val)) { |
|
607 | + $match[] = $val; |
|
608 | + } |
|
560 | 609 | } |
561 | 610 | |
562 | 611 | // return the links |
@@ -701,23 +750,28 @@ discard block |
||
701 | 750 | function _httprequest($url, $fp, $URI, $http_method, $content_type = "", $body = "") |
702 | 751 | { |
703 | 752 | $cookie_headers = ''; |
704 | - if ($this->passcookies && $this->_redirectaddr) |
|
705 | - $this->setcookies(); |
|
753 | + if ($this->passcookies && $this->_redirectaddr) { |
|
754 | + $this->setcookies(); |
|
755 | + } |
|
706 | 756 | |
707 | 757 | $URI_PARTS = parse_url($URI); |
708 | - if (empty($url)) |
|
709 | - $url = "/"; |
|
758 | + if (empty($url)) { |
|
759 | + $url = "/"; |
|
760 | + } |
|
710 | 761 | $headers = $http_method . " " . $url . " " . $this->_httpversion . "\r\n"; |
711 | - if (!empty($this->agent)) |
|
712 | - $headers .= "User-Agent: " . $this->agent . "\r\n"; |
|
762 | + if (!empty($this->agent)) { |
|
763 | + $headers .= "User-Agent: " . $this->agent . "\r\n"; |
|
764 | + } |
|
713 | 765 | if (!empty($this->host) && !isset($this->rawheaders['Host'])) { |
714 | 766 | $headers .= "Host: " . $this->host; |
715 | - if (!empty($this->port) && $this->port != '80') |
|
716 | - $headers .= ":" . $this->port; |
|
767 | + if (!empty($this->port) && $this->port != '80') { |
|
768 | + $headers .= ":" . $this->port; |
|
769 | + } |
|
717 | 770 | $headers .= "\r\n"; |
718 | 771 | } |
719 | - if (!empty($this->accept)) |
|
720 | - $headers .= "Accept: " . $this->accept . "\r\n"; |
|
772 | + if (!empty($this->accept)) { |
|
773 | + $headers .= "Accept: " . $this->accept . "\r\n"; |
|
774 | + } |
|
721 | 775 | if ($this->use_gzip) { |
722 | 776 | // make sure PHP was built with --with-zlib |
723 | 777 | // and we can handle gzipp'ed data |
@@ -730,11 +784,13 @@ discard block |
||
730 | 784 | E_USER_NOTICE); |
731 | 785 | } |
732 | 786 | } |
733 | - if (!empty($this->referer)) |
|
734 | - $headers .= "Referer: " . $this->referer . "\r\n"; |
|
787 | + if (!empty($this->referer)) { |
|
788 | + $headers .= "Referer: " . $this->referer . "\r\n"; |
|
789 | + } |
|
735 | 790 | if (!empty($this->cookies)) { |
736 | - if (!is_array($this->cookies)) |
|
737 | - $this->cookies = (array)$this->cookies; |
|
791 | + if (!is_array($this->cookies)) { |
|
792 | + $this->cookies = (array)$this->cookies; |
|
793 | + } |
|
738 | 794 | |
739 | 795 | reset($this->cookies); |
740 | 796 | if (count($this->cookies) > 0) { |
@@ -746,32 +802,39 @@ discard block |
||
746 | 802 | } |
747 | 803 | } |
748 | 804 | if (!empty($this->rawheaders)) { |
749 | - if (!is_array($this->rawheaders)) |
|
750 | - $this->rawheaders = (array)$this->rawheaders; |
|
751 | - while (list($headerKey, $headerVal) = each($this->rawheaders)) |
|
752 | - $headers .= $headerKey . ": " . $headerVal . "\r\n"; |
|
805 | + if (!is_array($this->rawheaders)) { |
|
806 | + $this->rawheaders = (array)$this->rawheaders; |
|
807 | + } |
|
808 | + while (list($headerKey, $headerVal) = each($this->rawheaders)) { |
|
809 | + $headers .= $headerKey . ": " . $headerVal . "\r\n"; |
|
810 | + } |
|
753 | 811 | } |
754 | 812 | if (!empty($content_type)) { |
755 | 813 | $headers .= "Content-type: $content_type"; |
756 | - if ($content_type == "multipart/form-data") |
|
757 | - $headers .= "; boundary=" . $this->_mime_boundary; |
|
814 | + if ($content_type == "multipart/form-data") { |
|
815 | + $headers .= "; boundary=" . $this->_mime_boundary; |
|
816 | + } |
|
758 | 817 | $headers .= "\r\n"; |
759 | 818 | } |
760 | - if (!empty($body)) |
|
761 | - $headers .= "Content-length: " . strlen($body) . "\r\n"; |
|
762 | - if (!empty($this->user) || !empty($this->pass)) |
|
763 | - $headers .= "Authorization: Basic " . base64_encode($this->user . ":" . $this->pass) . "\r\n"; |
|
819 | + if (!empty($body)) { |
|
820 | + $headers .= "Content-length: " . strlen($body) . "\r\n"; |
|
821 | + } |
|
822 | + if (!empty($this->user) || !empty($this->pass)) { |
|
823 | + $headers .= "Authorization: Basic " . base64_encode($this->user . ":" . $this->pass) . "\r\n"; |
|
824 | + } |
|
764 | 825 | |
765 | 826 | //add proxy auth headers |
766 | - if (!empty($this->proxy_user)) |
|
767 | - $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass) . "\r\n"; |
|
827 | + if (!empty($this->proxy_user)) { |
|
828 | + $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass) . "\r\n"; |
|
829 | + } |
|
768 | 830 | |
769 | 831 | |
770 | 832 | $headers .= "\r\n"; |
771 | 833 | |
772 | 834 | // set the read timeout if needed |
773 | - if ($this->read_timeout > 0) |
|
774 | - socket_set_timeout($fp, $this->read_timeout); |
|
835 | + if ($this->read_timeout > 0) { |
|
836 | + socket_set_timeout($fp, $this->read_timeout); |
|
837 | + } |
|
775 | 838 | $this->timed_out = false; |
776 | 839 | |
777 | 840 | fwrite($fp, $headers . $body, strlen($headers . $body)); |
@@ -788,8 +851,9 @@ discard block |
||
788 | 851 | return false; |
789 | 852 | } |
790 | 853 | |
791 | - if ($currentHeader == "\r\n") |
|
792 | - break; |
|
854 | + if ($currentHeader == "\r\n") { |
|
855 | + break; |
|
856 | + } |
|
793 | 857 | |
794 | 858 | // if a header begins with Location: or URI:, set the redirect |
795 | 859 | if (preg_match("/^(Location:|URI:)/i", $currentHeader)) { |
@@ -800,12 +864,14 @@ discard block |
||
800 | 864 | // no host in the path, so prepend |
801 | 865 | $this->_redirectaddr = $URI_PARTS["scheme"] . "://" . $this->host . ":" . $this->port; |
802 | 866 | // eliminate double slash |
803 | - if (!preg_match("|^/|", $matches[2])) |
|
804 | - $this->_redirectaddr .= "/" . $matches[2]; |
|
805 | - else |
|
806 | - $this->_redirectaddr .= $matches[2]; |
|
807 | - } else |
|
808 | - $this->_redirectaddr = $matches[2]; |
|
867 | + if (!preg_match("|^/|", $matches[2])) { |
|
868 | + $this->_redirectaddr .= "/" . $matches[2]; |
|
869 | + } else { |
|
870 | + $this->_redirectaddr .= $matches[2]; |
|
871 | + } |
|
872 | + } else { |
|
873 | + $this->_redirectaddr = $matches[2]; |
|
874 | + } |
|
809 | 875 | } |
810 | 876 | |
811 | 877 | if (preg_match("|^HTTP/|", $currentHeader)) { |
@@ -852,14 +918,17 @@ discard block |
||
852 | 918 | // have we hit our frame depth and is there frame src to fetch? |
853 | 919 | if (($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i", $results, $match)) { |
854 | 920 | $this->results[] = $results; |
855 | - for ($x = 0; $x < count($match[1]); $x++) |
|
856 | - $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"] . "://" . $this->host); |
|
921 | + for ($x = 0; $x < count($match[1]); $x++) { |
|
922 | + $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"] . "://" . $this->host); |
|
923 | + } |
|
857 | 924 | } // have we already fetched framed content? |
858 | - elseif (is_array($this->results)) |
|
859 | - $this->results[] = $results; |
|
925 | + elseif (is_array($this->results)) { |
|
926 | + $this->results[] = $results; |
|
927 | + } |
|
860 | 928 | // no framed content |
861 | - else |
|
862 | - $this->results = $results; |
|
929 | + else { |
|
930 | + $this->results = $results; |
|
931 | + } |
|
863 | 932 | |
864 | 933 | return true; |
865 | 934 | } |
@@ -875,30 +944,37 @@ discard block |
||
875 | 944 | |
876 | 945 | function _httpsrequest($url, $URI, $http_method, $content_type = "", $body = "") |
877 | 946 | { |
878 | - if ($this->passcookies && $this->_redirectaddr) |
|
879 | - $this->setcookies(); |
|
947 | + if ($this->passcookies && $this->_redirectaddr) { |
|
948 | + $this->setcookies(); |
|
949 | + } |
|
880 | 950 | |
881 | 951 | $headers = array(); |
882 | 952 | |
883 | 953 | $URI_PARTS = parse_url($URI); |
884 | - if (empty($url)) |
|
885 | - $url = "/"; |
|
954 | + if (empty($url)) { |
|
955 | + $url = "/"; |
|
956 | + } |
|
886 | 957 | // GET ... header not needed for curl |
887 | 958 | //$headers[] = $http_method." ".$url." ".$this->_httpversion; |
888 | - if (!empty($this->agent)) |
|
889 | - $headers[] = "User-Agent: " . $this->agent; |
|
890 | - if (!empty($this->host)) |
|
891 | - if (!empty($this->port)) |
|
959 | + if (!empty($this->agent)) { |
|
960 | + $headers[] = "User-Agent: " . $this->agent; |
|
961 | + } |
|
962 | + if (!empty($this->host)) { |
|
963 | + if (!empty($this->port)) |
|
892 | 964 | $headers[] = "Host: " . $this->host . ":" . $this->port; |
893 | - else |
|
894 | - $headers[] = "Host: " . $this->host; |
|
895 | - if (!empty($this->accept)) |
|
896 | - $headers[] = "Accept: " . $this->accept; |
|
897 | - if (!empty($this->referer)) |
|
898 | - $headers[] = "Referer: " . $this->referer; |
|
965 | + } else { |
|
966 | + $headers[] = "Host: " . $this->host; |
|
967 | + } |
|
968 | + if (!empty($this->accept)) { |
|
969 | + $headers[] = "Accept: " . $this->accept; |
|
970 | + } |
|
971 | + if (!empty($this->referer)) { |
|
972 | + $headers[] = "Referer: " . $this->referer; |
|
973 | + } |
|
899 | 974 | if (!empty($this->cookies)) { |
900 | - if (!is_array($this->cookies)) |
|
901 | - $this->cookies = (array)$this->cookies; |
|
975 | + if (!is_array($this->cookies)) { |
|
976 | + $this->cookies = (array)$this->cookies; |
|
977 | + } |
|
902 | 978 | |
903 | 979 | reset($this->cookies); |
904 | 980 | if (count($this->cookies) > 0) { |
@@ -910,32 +986,39 @@ discard block |
||
910 | 986 | } |
911 | 987 | } |
912 | 988 | if (!empty($this->rawheaders)) { |
913 | - if (!is_array($this->rawheaders)) |
|
914 | - $this->rawheaders = (array)$this->rawheaders; |
|
915 | - while (list($headerKey, $headerVal) = each($this->rawheaders)) |
|
916 | - $headers[] = $headerKey . ": " . $headerVal; |
|
989 | + if (!is_array($this->rawheaders)) { |
|
990 | + $this->rawheaders = (array)$this->rawheaders; |
|
991 | + } |
|
992 | + while (list($headerKey, $headerVal) = each($this->rawheaders)) { |
|
993 | + $headers[] = $headerKey . ": " . $headerVal; |
|
994 | + } |
|
917 | 995 | } |
918 | 996 | if (!empty($content_type)) { |
919 | - if ($content_type == "multipart/form-data") |
|
920 | - $headers[] = "Content-type: $content_type; boundary=" . $this->_mime_boundary; |
|
921 | - else |
|
922 | - $headers[] = "Content-type: $content_type"; |
|
997 | + if ($content_type == "multipart/form-data") { |
|
998 | + $headers[] = "Content-type: $content_type; boundary=" . $this->_mime_boundary; |
|
999 | + } else { |
|
1000 | + $headers[] = "Content-type: $content_type"; |
|
1001 | + } |
|
1002 | + } |
|
1003 | + if (!empty($body)) { |
|
1004 | + $headers[] = "Content-length: " . strlen($body); |
|
1005 | + } |
|
1006 | + if (!empty($this->user) || !empty($this->pass)) { |
|
1007 | + $headers[] = "Authorization: BASIC " . base64_encode($this->user . ":" . $this->pass); |
|
923 | 1008 | } |
924 | - if (!empty($body)) |
|
925 | - $headers[] = "Content-length: " . strlen($body); |
|
926 | - if (!empty($this->user) || !empty($this->pass)) |
|
927 | - $headers[] = "Authorization: BASIC " . base64_encode($this->user . ":" . $this->pass); |
|
928 | 1009 | |
929 | 1010 | for ($curr_header = 0; $curr_header < count($headers); $curr_header++) { |
930 | 1011 | $safer_header = strtr($headers[$curr_header], "\"", " "); |
931 | 1012 | $cmdline_params .= " -H \"" . $safer_header . "\""; |
932 | 1013 | } |
933 | 1014 | |
934 | - if (!empty($body)) |
|
935 | - $cmdline_params .= " -d \"$body\""; |
|
1015 | + if (!empty($body)) { |
|
1016 | + $cmdline_params .= " -d \"$body\""; |
|
1017 | + } |
|
936 | 1018 | |
937 | - if ($this->read_timeout > 0) |
|
938 | - $cmdline_params .= " -m " . $this->read_timeout; |
|
1019 | + if ($this->read_timeout > 0) { |
|
1020 | + $cmdline_params .= " -m " . $this->read_timeout; |
|
1021 | + } |
|
939 | 1022 | |
940 | 1023 | $headerfile = tempnam($temp_dir, "sno"); |
941 | 1024 | |
@@ -965,12 +1048,14 @@ discard block |
||
965 | 1048 | // no host in the path, so prepend |
966 | 1049 | $this->_redirectaddr = $URI_PARTS["scheme"] . "://" . $this->host . ":" . $this->port; |
967 | 1050 | // eliminate double slash |
968 | - if (!preg_match("|^/|", $matches[2])) |
|
969 | - $this->_redirectaddr .= "/" . $matches[2]; |
|
970 | - else |
|
971 | - $this->_redirectaddr .= $matches[2]; |
|
972 | - } else |
|
973 | - $this->_redirectaddr = $matches[2]; |
|
1051 | + if (!preg_match("|^/|", $matches[2])) { |
|
1052 | + $this->_redirectaddr .= "/" . $matches[2]; |
|
1053 | + } else { |
|
1054 | + $this->_redirectaddr .= $matches[2]; |
|
1055 | + } |
|
1056 | + } else { |
|
1057 | + $this->_redirectaddr = $matches[2]; |
|
1058 | + } |
|
974 | 1059 | } |
975 | 1060 | |
976 | 1061 | if (preg_match("|^HTTP/|", $result_headers[$currentHeader])) { |
@@ -992,14 +1077,17 @@ discard block |
||
992 | 1077 | // have we hit our frame depth and is there frame src to fetch? |
993 | 1078 | if (($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i", $results, $match)) { |
994 | 1079 | $this->results[] = $results; |
995 | - for ($x = 0; $x < count($match[1]); $x++) |
|
996 | - $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"] . "://" . $this->host); |
|
1080 | + for ($x = 0; $x < count($match[1]); $x++) { |
|
1081 | + $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"] . "://" . $this->host); |
|
1082 | + } |
|
997 | 1083 | } // have we already fetched framed content? |
998 | - elseif (is_array($this->results)) |
|
999 | - $this->results[] = $results; |
|
1084 | + elseif (is_array($this->results)) { |
|
1085 | + $this->results[] = $results; |
|
1086 | + } |
|
1000 | 1087 | // no framed content |
1001 | - else |
|
1002 | - $this->results = $results; |
|
1088 | + else { |
|
1089 | + $this->results = $results; |
|
1090 | + } |
|
1003 | 1091 | |
1004 | 1092 | unlink("$headerfile"); |
1005 | 1093 | |
@@ -1014,8 +1102,9 @@ discard block |
||
1014 | 1102 | function setcookies() |
1015 | 1103 | { |
1016 | 1104 | for ($x = 0; $x < count($this->headers); $x++) { |
1017 | - if (preg_match('/^set-cookie:[\s]+([^=]+)=([^;]+)/i', $this->headers[$x], $match)) |
|
1018 | - $this->cookies[$match[1]] = urldecode($match[2]); |
|
1105 | + if (preg_match('/^set-cookie:[\s]+([^=]+)=([^;]+)/i', $this->headers[$x], $match)) { |
|
1106 | + $this->cookies[$match[1]] = urldecode($match[2]); |
|
1107 | + } |
|
1019 | 1108 | } |
1020 | 1109 | } |
1021 | 1110 | |
@@ -1112,8 +1201,9 @@ discard block |
||
1112 | 1201 | settype($formfiles, "array"); |
1113 | 1202 | $postdata = ''; |
1114 | 1203 | |
1115 | - if (count($formvars) == 0 && count($formfiles) == 0) |
|
1116 | - return; |
|
1204 | + if (count($formvars) == 0 && count($formfiles) == 0) { |
|
1205 | + return; |
|
1206 | + } |
|
1117 | 1207 | |
1118 | 1208 | switch ($this->_submit_type) { |
1119 | 1209 | case "application/x-www-form-urlencoded": |
@@ -1123,8 +1213,9 @@ discard block |
||
1123 | 1213 | while (list($cur_key, $cur_val) = each($val)) { |
1124 | 1214 | $postdata .= urlencode($key) . "[]=" . urlencode($cur_val) . "&"; |
1125 | 1215 | } |
1126 | - } else |
|
1127 | - $postdata .= urlencode($key) . "=" . urlencode($val) . "&"; |
|
1216 | + } else { |
|
1217 | + $postdata .= urlencode($key) . "=" . urlencode($val) . "&"; |
|
1218 | + } |
|
1128 | 1219 | } |
1129 | 1220 | break; |
1130 | 1221 | |
@@ -1150,7 +1241,9 @@ discard block |
||
1150 | 1241 | while (list($field_name, $file_names) = each($formfiles)) { |
1151 | 1242 | settype($file_names, "array"); |
1152 | 1243 | while (list(, $file_name) = each($file_names)) { |
1153 | - if (!is_readable($file_name)) continue; |
|
1244 | + if (!is_readable($file_name)) { |
|
1245 | + continue; |
|
1246 | + } |
|
1154 | 1247 | |
1155 | 1248 | $fp = fopen($file_name, "r"); |
1156 | 1249 | $file_content = fread($fp, filesize($file_name)); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | // Increment number of files |
217 | 217 | $this->numFiles++; |
218 | 218 | // Create us a new file in our array |
219 | - $activeFile =& $this->files[]; |
|
219 | + $activeFile = & $this->files[]; |
|
220 | 220 | // Asign Values |
221 | 221 | $activeFile['name'] = $file_name; |
222 | 222 | $activeFile['mode'] = $file_mode; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | // Increment number of directories |
233 | 233 | $this->numDirectories++; |
234 | 234 | // Create a new directory in our array |
235 | - $activeDir =& $this->directories[]; |
|
235 | + $activeDir = & $this->directories[]; |
|
236 | 236 | // Assign values |
237 | 237 | $activeDir['name'] = $file_name; |
238 | 238 | $activeDir['mode'] = $file_mode; |
@@ -298,16 +298,16 @@ discard block |
||
298 | 298 | // Generate tar header for this directory |
299 | 299 | // Filename, Permissions, UID, GID, size, Time, checksum, typeflag, linkname, magic, version, user name, group name, devmajor, devminor, prefix, end |
300 | 300 | $header .= str_pad($information['name'], 100, chr(0)); |
301 | - $header .= str_pad(decoct($information['mode']), 7, '0', STR_PAD_LEFT) . chr(0); |
|
302 | - $header .= str_pad(decoct($information['user_id']), 7, '0', STR_PAD_LEFT) . chr(0); |
|
303 | - $header .= str_pad(decoct($information['group_id']), 7, '0', STR_PAD_LEFT) . chr(0); |
|
304 | - $header .= str_pad(decoct(0), 11, '0', STR_PAD_LEFT) . chr(0); |
|
305 | - $header .= str_pad(decoct($information['time']), 11, '0', STR_PAD_LEFT) . chr(0); |
|
301 | + $header .= str_pad(decoct($information['mode']), 7, '0', STR_PAD_LEFT).chr(0); |
|
302 | + $header .= str_pad(decoct($information['user_id']), 7, '0', STR_PAD_LEFT).chr(0); |
|
303 | + $header .= str_pad(decoct($information['group_id']), 7, '0', STR_PAD_LEFT).chr(0); |
|
304 | + $header .= str_pad(decoct(0), 11, '0', STR_PAD_LEFT).chr(0); |
|
305 | + $header .= str_pad(decoct($information['time']), 11, '0', STR_PAD_LEFT).chr(0); |
|
306 | 306 | $header .= str_repeat(' ', 8); |
307 | 307 | $header .= '5'; |
308 | 308 | $header .= str_repeat(chr(0), 100); |
309 | 309 | $header .= str_pad('ustar', 6, chr(32)); |
310 | - $header .= chr(32) . chr(0); |
|
310 | + $header .= chr(32).chr(0); |
|
311 | 311 | $header .= str_pad('', 32, chr(0)); |
312 | 312 | $header .= str_pad('', 32, chr(0)); |
313 | 313 | $header .= str_repeat(chr(0), 8); |
@@ -333,16 +333,16 @@ discard block |
||
333 | 333 | // Generate the TAR header for this file |
334 | 334 | // Filename, Permissions, UID, GID, size, Time, checksum, typeflag, linkname, magic, version, user name, group name, devmajor, devminor, prefix, end |
335 | 335 | $header = str_pad($information['name'], 100, chr(0)); |
336 | - $header .= str_pad(decoct($information['mode']), 7, '0', STR_PAD_LEFT) . chr(0); |
|
337 | - $header .= str_pad(decoct($information['user_id']), 7, '0', STR_PAD_LEFT) . chr(0); |
|
338 | - $header .= str_pad(decoct($information['group_id']), 7, '0', STR_PAD_LEFT) . chr(0); |
|
339 | - $header .= str_pad(decoct($information['size']), 11, '0', STR_PAD_LEFT) . chr(0); |
|
340 | - $header .= str_pad(decoct($information['time']), 11, '0', STR_PAD_LEFT) . chr(0); |
|
336 | + $header .= str_pad(decoct($information['mode']), 7, '0', STR_PAD_LEFT).chr(0); |
|
337 | + $header .= str_pad(decoct($information['user_id']), 7, '0', STR_PAD_LEFT).chr(0); |
|
338 | + $header .= str_pad(decoct($information['group_id']), 7, '0', STR_PAD_LEFT).chr(0); |
|
339 | + $header .= str_pad(decoct($information['size']), 11, '0', STR_PAD_LEFT).chr(0); |
|
340 | + $header .= str_pad(decoct($information['time']), 11, '0', STR_PAD_LEFT).chr(0); |
|
341 | 341 | $header .= str_repeat(' ', 8); |
342 | 342 | $header .= '0'; |
343 | 343 | $header .= str_repeat(chr(0), 100); |
344 | 344 | $header .= str_pad('ustar', 6, chr(32)); |
345 | - $header .= chr(32) . chr(0); |
|
345 | + $header .= chr(32).chr(0); |
|
346 | 346 | $header .= str_pad($information['user_name'], 32, chr(0)); // How do I get a file's user name from PHP? |
347 | 347 | $header .= str_pad($information['group_name'], 32, chr(0)); // How do I get a file's group name from PHP? |
348 | 348 | $header .= str_repeat(chr(0), 8); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | // Pad file contents to byte count divisible by 512 |
360 | 360 | $file_contents = str_pad($information['file'], ceil($information['size'] / 512) * 512, chr(0)); |
361 | 361 | // Add new tar formatted data to tar file contents |
362 | - $this->tar_file .= $header . $file_contents; |
|
362 | + $this->tar_file .= $header.$file_contents; |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | // Add 512 bytes of NULLs to designate EOF |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | $file_information = stat($dirname); |
500 | 500 | // Add directory to processed data |
501 | 501 | $this->numDirectories++; |
502 | - $activeDir =& $this->directories[]; |
|
502 | + $activeDir = & $this->directories[]; |
|
503 | 503 | $activeDir['name'] = $dirname; |
504 | 504 | $activeDir['mode'] = $file_information['mode']; |
505 | 505 | $activeDir['time'] = $file_information['time']; |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | fclose($fp); |
540 | 540 | // Add file to processed data |
541 | 541 | $this->numFiles++; |
542 | - $activeFile =& $this->files[]; |
|
542 | + $activeFile = & $this->files[]; |
|
543 | 543 | $activeFile['name'] = $filename; |
544 | 544 | $activeFile['mode'] = $file_information['mode']; |
545 | 545 | $activeFile['user_id'] = $file_information['uid']; |
@@ -28,4 +28,4 @@ |
||
28 | 28 | * Load the new XoopsLogger class |
29 | 29 | **/ |
30 | 30 | require_once $GLOBALS['xoops']->path('class/logger/xoopslogger.php'); |
31 | -trigger_error('Instance of ' . __FILE__ . " file is deprecated, check 'XoopsLogger' in class/logger/xoopslogger.php"); |
|
31 | +trigger_error('Instance of '.__FILE__." file is deprecated, check 'XoopsLogger' in class/logger/xoopslogger.php"); |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | */ |
19 | 19 | defined('XOOPS_ROOT_PATH') || exit('Restricted access'); |
20 | 20 | |
21 | -include_once XOOPS_ROOT_PATH . '/class/xml/saxparser.php'; |
|
22 | -include_once XOOPS_ROOT_PATH . '/class/xml/xmltaghandler.php'; |
|
21 | +include_once XOOPS_ROOT_PATH.'/class/xml/saxparser.php'; |
|
22 | +include_once XOOPS_ROOT_PATH.'/class/xml/xmltaghandler.php'; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Class XoopsThemeSetParser |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | if (!isset($this->tempArr[$name])) { |
122 | 122 | $this->tempArr[$name] = &$value; |
123 | 123 | } else { |
124 | - $this->tempArr[$name] .= $delim . $value; |
|
124 | + $this->tempArr[$name] .= $delim.$value; |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 |