@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | if ($options['user'] === 'init') { |
| 140 | 140 | |
| 141 | - if (! $this->dropbox_phpFound || empty($options['consumerKey']) || empty($options['consumerSecret']) || !class_exists('PDO', false)) { |
|
| 141 | + if (!$this->dropbox_phpFound || empty($options['consumerKey']) || empty($options['consumerSecret']) || !class_exists('PDO', false)) { |
|
| 142 | 142 | return array('exit' => true, 'body' => '{msg:errNetMountNoDriver}'); |
| 143 | 143 | } |
| 144 | 144 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | if (class_exists('OAuth', false)) { |
| 149 | 149 | $this->oauth = new Dropbox_OAuth_PHP($options['consumerKey'], $options['consumerSecret']); |
| 150 | 150 | } else { |
| 151 | - if (! class_exists('HTTP_OAuth_Consumer', false)) { |
|
| 151 | + if (!class_exists('HTTP_OAuth_Consumer', false)) { |
|
| 152 | 152 | // We're going to try to load in manually |
| 153 | 153 | include 'HTTP/OAuth/Consumer.php'; |
| 154 | 154 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if (! $this->oauth) { |
|
| 161 | + if (!$this->oauth) { |
|
| 162 | 162 | return array('exit' => true, 'body' => '{msg:errNetMountNoDriver}'); |
| 163 | 163 | } |
| 164 | 164 | |
@@ -179,25 +179,25 @@ discard block |
||
| 179 | 179 | unset($_SESSION['elFinderDropboxTokens']); |
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | - if (! $html) { |
|
| 182 | + if (!$html) { |
|
| 183 | 183 | // get customdata |
| 184 | 184 | $cdata = ''; |
| 185 | 185 | $innerKeys = array('cmd', 'host', 'options', 'pass', 'protocol', 'user'); |
| 186 | - $this->ARGS = $_SERVER['REQUEST_METHOD'] === 'POST'? $_POST : $_GET; |
|
| 187 | - foreach($this->ARGS as $k => $v) { |
|
| 188 | - if (! in_array($k, $innerKeys)) { |
|
| 189 | - $cdata .= '&' . $k . '=' . rawurlencode($v); |
|
| 186 | + $this->ARGS = $_SERVER['REQUEST_METHOD'] === 'POST' ? $_POST : $_GET; |
|
| 187 | + foreach ($this->ARGS as $k => $v) { |
|
| 188 | + if (!in_array($k, $innerKeys)) { |
|
| 189 | + $cdata .= '&'.$k.'='.rawurlencode($v); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | - if (strpos($options['url'], 'http') !== 0 ) { |
|
| 192 | + if (strpos($options['url'], 'http') !== 0) { |
|
| 193 | 193 | $options['url'] = $this->getConnectorUrl(); |
| 194 | 194 | } |
| 195 | - $callback = $options['url'] |
|
| 195 | + $callback = $options['url'] |
|
| 196 | 196 | . '?cmd=netmount&protocol=dropbox&host=dropbox.com&user=init&pass=return&node='.$options['id'].$cdata; |
| 197 | 197 | |
| 198 | 198 | try { |
| 199 | 199 | $tokens = $this->oauth->getRequestToken(); |
| 200 | - $url= $this->oauth->getAuthorizeUrl(rawurlencode($callback)); |
|
| 200 | + $url = $this->oauth->getAuthorizeUrl(rawurlencode($callback)); |
|
| 201 | 201 | } catch (Dropbox_Exception $e) { |
| 202 | 202 | return array('exit' => true, 'body' => '{msg:errAccess}'); |
| 203 | 203 | } |
@@ -244,14 +244,14 @@ discard block |
||
| 244 | 244 | if (isset($netVolumes[$key])) { |
| 245 | 245 | $dropboxUid = $netVolumes[$key]['dropboxUid']; |
| 246 | 246 | } |
| 247 | - foreach($netVolumes as $volume) { |
|
| 247 | + foreach ($netVolumes as $volume) { |
|
| 248 | 248 | if (@$volume['host'] === 'dropbox' && @$volume['dropboxUid'] === $dropboxUid) { |
| 249 | 249 | $count++; |
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | if ($count === 1) { |
| 253 | 253 | $this->DB->exec('drop table '.$this->DB_TableName); |
| 254 | - foreach(glob(rtrim($this->options['tmbPath'], '\\/').DIRECTORY_SEPARATOR.$this->tmbPrefix.'*.png') as $tmb) { |
|
| 254 | + foreach (glob(rtrim($this->options['tmbPath'], '\\/').DIRECTORY_SEPARATOR.$this->tmbPrefix.'*.png') as $tmb) { |
|
| 255 | 255 | unlink($tmb); |
| 256 | 256 | } |
| 257 | 257 | } |
@@ -265,10 +265,10 @@ discard block |
||
| 265 | 265 | * @author Naoki Sawada |
| 266 | 266 | */ |
| 267 | 267 | private function getConnectorUrl() { |
| 268 | - $url = ((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')? 'https://' : 'http://') |
|
| 268 | + $url = ((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') ? 'https://' : 'http://') |
|
| 269 | 269 | . $_SERVER['SERVER_NAME'] // host |
| 270 | - . ($_SERVER['SERVER_PORT'] == 80 ? '' : ':' . $_SERVER['SERVER_PORT']) // port |
|
| 271 | - . $_SERVER['REQUEST_URI']; // path & query |
|
| 270 | + . ($_SERVER['SERVER_PORT'] == 80 ? '' : ':'.$_SERVER['SERVER_PORT']) // port |
|
| 271 | + . $_SERVER['REQUEST_URI']; // path & query |
|
| 272 | 272 | list($url) = explode('?', $url); |
| 273 | 273 | return $url; |
| 274 | 274 | } |
@@ -304,14 +304,14 @@ discard block |
||
| 304 | 304 | // make net mount key |
| 305 | 305 | $this->netMountKey = md5(join('-', array('dropbox', $this->options['path']))); |
| 306 | 306 | |
| 307 | - if (! $this->oauth) { |
|
| 307 | + if (!$this->oauth) { |
|
| 308 | 308 | if (defined('ELFINDER_DROPBOX_USE_CURL_PUT')) { |
| 309 | 309 | $this->oauth = new Dropbox_OAuth_Curl($this->options['consumerKey'], $this->options['consumerSecret']); |
| 310 | 310 | } else { |
| 311 | 311 | if (class_exists('OAuth', false)) { |
| 312 | 312 | $this->oauth = new Dropbox_OAuth_PHP($this->options['consumerKey'], $this->options['consumerSecret']); |
| 313 | 313 | } else { |
| 314 | - if (! class_exists('HTTP_OAuth_Consumer', false)) { |
|
| 314 | + if (!class_exists('HTTP_OAuth_Consumer', false)) { |
|
| 315 | 315 | // We're going to try to load in manually |
| 316 | 316 | include 'HTTP/OAuth/Consumer.php'; |
| 317 | 317 | } |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - if (! $this->oauth) { |
|
| 325 | + if (!$this->oauth) { |
|
| 326 | 326 | return $this->setError('OAuth extension not loaded.'); |
| 327 | 327 | } |
| 328 | 328 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $this->root = $this->options['path'] = $this->_normpath($this->options['path']); |
| 331 | 331 | |
| 332 | 332 | if (empty($this->options['alias'])) { |
| 333 | - $this->options['alias'] = ($this->options['path'] === '/')? 'Dropbox.com' : 'Dropbox'.$this->options['path']; |
|
| 333 | + $this->options['alias'] = ($this->options['path'] === '/') ? 'Dropbox.com' : 'Dropbox'.$this->options['path']; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | $this->rootName = $this->options['alias']; |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | // setup PDO |
| 388 | - if (! $this->options['PDO_DSN']) { |
|
| 388 | + if (!$this->options['PDO_DSN']) { |
|
| 389 | 389 | $this->options['PDO_DSN'] = 'sqlite:'.$this->metaCache.DIRECTORY_SEPARATOR.'.elFinder_dropbox_db_'.md5($this->dropboxUid.$this->options['consumerSecret']); |
| 390 | 390 | } |
| 391 | 391 | // DataBase table name |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | // DataBase check or make table |
| 394 | 394 | try { |
| 395 | 395 | $this->DB = new PDO($this->options['PDO_DSN'], $this->options['PDO_User'], $this->options['PDO_Pass'], $this->options['PDO_Options']); |
| 396 | - if (! $this->checkDB()) { |
|
| 396 | + if (!$this->checkDB()) { |
|
| 397 | 397 | return $this->setError('Can not make DB table'); |
| 398 | 398 | } |
| 399 | 399 | } catch (PDOException $e) { |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | $res = false; |
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | - if (! $res) { |
|
| 458 | + if (!$res) { |
|
| 459 | 459 | try { |
| 460 | 460 | $this->DB->exec('CREATE TABLE '.$this->DB_TableName.'(path text, fname text, dat blob, isdir integer);'); |
| 461 | 461 | $this->DB->exec('CREATE UNIQUE INDEX nameidx ON '.$this->DB_TableName.'(path, fname)'); |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | */ |
| 506 | 506 | private function updateDBdat($path, $dat) { |
| 507 | 507 | return $this->query('update '.$this->DB_TableName.' set dat='.$this->DB->quote(serialize($dat)) |
| 508 | - . ', isdir=' . ($dat['is_dir']? 1 : 0) |
|
| 508 | + . ', isdir='.($dat['is_dir'] ? 1 : 0) |
|
| 509 | 509 | . ' where path='.$this->DB->quote(strtolower($this->_dirname($path))).' and fname='.$this->DB->quote(strtolower(basename($path)))); |
| 510 | 510 | } |
| 511 | 511 | /*********************************************************************/ |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | */ |
| 531 | 531 | protected function deltaCheck($refresh = true) { |
| 532 | 532 | $chk = false; |
| 533 | - if (! $refresh && $chk = $this->query('select dat from '.$this->DB_TableName.' where path=\'\' and fname=\'\' limit 1')) { |
|
| 533 | + if (!$refresh && $chk = $this->query('select dat from '.$this->DB_TableName.' where path=\'\' and fname=\'\' limit 1')) { |
|
| 534 | 534 | $chk = unserialize($chk[0]); |
| 535 | 535 | } |
| 536 | 536 | if ($chk && ($chk['mtime'] + $this->options['metaCacheTime']) > $_SERVER['REQUEST_TIME']) { |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | do { |
| 555 | 555 | @ ini_set('max_execution_time', 120); |
| 556 | 556 | $_info = $this->dropbox->delta($cursor); |
| 557 | - if (! empty($_info['reset'])) { |
|
| 557 | + if (!empty($_info['reset'])) { |
|
| 558 | 558 | $this->DB->exec('TRUNCATE table '.$this->DB_TableName); |
| 559 | 559 | $this->DB->exec('insert into '.$this->DB_TableName.' values(\'\', \'\', \''.serialize(array('cursor' => '', 'mtime' => 0)).'\', 0);'); |
| 560 | 560 | $this->DB->exec('insert into '.$this->DB_TableName.' values(\'/\', \'\', \''.serialize(array( |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | } |
| 568 | 568 | $cursor = $_info['cursor']; |
| 569 | 569 | |
| 570 | - foreach($_info['entries'] as $entry) { |
|
| 570 | + foreach ($_info['entries'] as $entry) { |
|
| 571 | 571 | $key = strtolower($entry[0]); |
| 572 | 572 | $pkey = strtolower($this->_dirname($key)); |
| 573 | 573 | |
@@ -576,22 +576,22 @@ discard block |
||
| 576 | 576 | $where = 'where path='.$path.' and fname='.$fname; |
| 577 | 577 | |
| 578 | 578 | if (empty($entry[1])) { |
| 579 | - $ptimes[$pkey] = isset($ptimes[$pkey])? max(array($now, $ptimes[$pkey])) : $now; |
|
| 579 | + $ptimes[$pkey] = isset($ptimes[$pkey]) ? max(array($now, $ptimes[$pkey])) : $now; |
|
| 580 | 580 | $this->DB->exec('delete from '.$this->DB_TableName.' '.$where); |
| 581 | - ! $delete && $delete = true; |
|
| 581 | + !$delete && $delete = true; |
|
| 582 | 582 | continue; |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | - $_itemTime = strtotime(isset($entry[1]['client_mtime'])? $entry[1]['client_mtime'] : $entry[1]['modified']); |
|
| 586 | - $ptimes[$pkey] = isset($ptimes[$pkey])? max(array($_itemTime, $ptimes[$pkey])) : $_itemTime; |
|
| 585 | + $_itemTime = strtotime(isset($entry[1]['client_mtime']) ? $entry[1]['client_mtime'] : $entry[1]['modified']); |
|
| 586 | + $ptimes[$pkey] = isset($ptimes[$pkey]) ? max(array($_itemTime, $ptimes[$pkey])) : $_itemTime; |
|
| 587 | 587 | $sql = 'select path from '.$this->DB_TableName.' '.$where.' limit 1'; |
| 588 | - if (! $reset && $this->query($sql)) { |
|
| 589 | - $this->DB->exec('update '.$this->DB_TableName.' set dat='.$this->DB->quote(serialize($entry[1])).', isdir='.($entry[1]['is_dir']? 1 : 0).' ' .$where); |
|
| 588 | + if (!$reset && $this->query($sql)) { |
|
| 589 | + $this->DB->exec('update '.$this->DB_TableName.' set dat='.$this->DB->quote(serialize($entry[1])).', isdir='.($entry[1]['is_dir'] ? 1 : 0).' '.$where); |
|
| 590 | 590 | } else { |
| 591 | - $this->DB->exec('insert into '.$this->DB_TableName.' values ('.$path.', '.$fname.', '.$this->DB->quote(serialize($entry[1])).', '.(int)$entry[1]['is_dir'].')'); |
|
| 591 | + $this->DB->exec('insert into '.$this->DB_TableName.' values ('.$path.', '.$fname.', '.$this->DB->quote(serialize($entry[1])).', '.(int) $entry[1]['is_dir'].')'); |
|
| 592 | 592 | } |
| 593 | 593 | } |
| 594 | - } while (! empty($_info['has_more'])); |
|
| 594 | + } while (!empty($_info['has_more'])); |
|
| 595 | 595 | |
| 596 | 596 | // update time stamp of parent holder |
| 597 | 597 | foreach ($ptimes as $_p => $_t) { |
@@ -613,14 +613,14 @@ discard block |
||
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | $this->DB->exec('update '.$this->DB_TableName.' set dat='.$this->DB->quote(serialize(array('cursor'=>$cursor, 'mtime'=>$_SERVER['REQUEST_TIME']))).' where path=\'\' and fname=\'\''); |
| 616 | - if (! $this->DB->commit()) { |
|
| 616 | + if (!$this->DB->commit()) { |
|
| 617 | 617 | $e = $this->DB->errorInfo(); |
| 618 | 618 | return $e[2]; |
| 619 | 619 | } |
| 620 | 620 | if ($delete) { |
| 621 | 621 | $this->DB->exec('vacuum'); |
| 622 | 622 | } |
| 623 | - } catch(Dropbox_Exception $e) { |
|
| 623 | + } catch (Dropbox_Exception $e) { |
|
| 624 | 624 | return $e->getMessage(); |
| 625 | 625 | } |
| 626 | 626 | return true; |
@@ -636,15 +636,14 @@ discard block |
||
| 636 | 636 | protected function parseRaw($raw) { |
| 637 | 637 | $stat = array(); |
| 638 | 638 | |
| 639 | - $stat['rev'] = isset($raw['rev'])? $raw['rev'] : 'root'; |
|
| 639 | + $stat['rev'] = isset($raw['rev']) ? $raw['rev'] : 'root'; |
|
| 640 | 640 | $stat['name'] = basename($raw['path']); |
| 641 | - $stat['mime'] = $raw['is_dir']? 'directory' : $raw['mime_type']; |
|
| 641 | + $stat['mime'] = $raw['is_dir'] ? 'directory' : $raw['mime_type']; |
|
| 642 | 642 | $stat['size'] = $stat['mime'] == 'directory' ? 0 : $raw['bytes']; |
| 643 | - $stat['ts'] = isset($raw['client_mtime'])? strtotime($raw['client_mtime']) : |
|
| 644 | - (isset($raw['modified'])? strtotime($raw['modified']) : $_SERVER['REQUEST_TIME']); |
|
| 643 | + $stat['ts'] = isset($raw['client_mtime']) ? strtotime($raw['client_mtime']) : (isset($raw['modified']) ? strtotime($raw['modified']) : $_SERVER['REQUEST_TIME']); |
|
| 645 | 644 | $stat['dirs'] = 0; |
| 646 | 645 | if ($raw['is_dir']) { |
| 647 | - $stat['dirs'] = (int)(bool)$this->query('select path from '.$this->DB_TableName.' where isdir=1 and path='.$this->DB->quote(strtolower($raw['path']))); |
|
| 646 | + $stat['dirs'] = (int) (bool) $this->query('select path from '.$this->DB_TableName.' where isdir=1 and path='.$this->DB->quote(strtolower($raw['path']))); |
|
| 648 | 647 | } |
| 649 | 648 | |
| 650 | 649 | if (!empty($raw['url'])) { |
@@ -670,7 +669,7 @@ discard block |
||
| 670 | 669 | $res = $this->query('select dat from '.$this->DB_TableName.' where path='.$this->DB->quote(strtolower($path))); |
| 671 | 670 | |
| 672 | 671 | if ($res) { |
| 673 | - foreach($res as $raw) { |
|
| 672 | + foreach ($res as $raw) { |
|
| 674 | 673 | $raw = unserialize($raw); |
| 675 | 674 | if ($stat = $this->parseRaw($raw)) { |
| 676 | 675 | $stat = $this->updateCache($raw['path'], $stat); |
@@ -695,10 +694,10 @@ discard block |
||
| 695 | 694 | protected function doSearch($path, $q, $mimes) { |
| 696 | 695 | $result = array(); |
| 697 | 696 | $sth = $this->DB->prepare('select dat from '.$this->DB_TableName.' WHERE path LIKE ? AND fname LIKE ?'); |
| 698 | - $sth->execute(array((($path === '/')? '' : strtolower($path)).'%', '%'.strtolower($q).'%')); |
|
| 697 | + $sth->execute(array((($path === '/') ? '' : strtolower($path)).'%', '%'.strtolower($q).'%')); |
|
| 699 | 698 | $res = $sth->fetchAll(PDO::FETCH_COLUMN); |
| 700 | 699 | if ($res) { |
| 701 | - foreach($res as $raw) { |
|
| 700 | + foreach ($res as $raw) { |
|
| 702 | 701 | $raw = unserialize($raw); |
| 703 | 702 | if ($stat = $this->parseRaw($raw)) { |
| 704 | 703 | if (!isset($this->cache[$raw['path']])) { |
@@ -791,10 +790,10 @@ discard block |
||
| 791 | 790 | $tmb = $this->tmbPath.DIRECTORY_SEPARATOR.$name; |
| 792 | 791 | |
| 793 | 792 | // copy image into tmbPath so some drivers does not store files on local fs |
| 794 | - if (! $data = $this->getThumbnail($path, $this->options['getTmbSize'])) { |
|
| 793 | + if (!$data = $this->getThumbnail($path, $this->options['getTmbSize'])) { |
|
| 795 | 794 | return false; |
| 796 | 795 | } |
| 797 | - if (! file_put_contents($tmb, $data)) { |
|
| 796 | + if (!file_put_contents($tmb, $data)) { |
|
| 798 | 797 | return false; |
| 799 | 798 | } |
| 800 | 799 | |
@@ -807,15 +806,15 @@ discard block |
||
| 807 | 806 | } |
| 808 | 807 | |
| 809 | 808 | /* If image smaller or equal thumbnail size - just fitting to thumbnail square */ |
| 810 | - if ($s[0] <= $tmbSize && $s[1] <= $tmbSize) { |
|
| 811 | - $result = $this->imgSquareFit($tmb, $tmbSize, $tmbSize, 'center', 'middle', $this->options['tmbBgColor'], 'png' ); |
|
| 809 | + if ($s[0] <= $tmbSize && $s[1] <= $tmbSize) { |
|
| 810 | + $result = $this->imgSquareFit($tmb, $tmbSize, $tmbSize, 'center', 'middle', $this->options['tmbBgColor'], 'png'); |
|
| 812 | 811 | |
| 813 | 812 | } else { |
| 814 | 813 | |
| 815 | 814 | if ($this->options['tmbCrop']) { |
| 816 | 815 | |
| 817 | 816 | /* Resize and crop if image bigger than thumbnail */ |
| 818 | - if (!(($s[0] > $tmbSize && $s[1] <= $tmbSize) || ($s[0] <= $tmbSize && $s[1] > $tmbSize) ) || ($s[0] > $tmbSize && $s[1] > $tmbSize)) { |
|
| 817 | + if (!(($s[0] > $tmbSize && $s[1] <= $tmbSize) || ($s[0] <= $tmbSize && $s[1] > $tmbSize)) || ($s[0] > $tmbSize && $s[1] > $tmbSize)) { |
|
| 819 | 818 | $result = $this->imgResize($tmb, $tmbSize, $tmbSize, true, false, 'png'); |
| 820 | 819 | } |
| 821 | 820 | |
@@ -829,7 +828,7 @@ discard block |
||
| 829 | 828 | $result = $this->imgResize($tmb, $tmbSize, $tmbSize, true, true, 'png'); |
| 830 | 829 | } |
| 831 | 830 | |
| 832 | - $result = $this->imgSquareFit($tmb, $tmbSize, $tmbSize, 'center', 'middle', $this->options['tmbBgColor'], 'png' ); |
|
| 831 | + $result = $this->imgSquareFit($tmb, $tmbSize, $tmbSize, 'center', 'middle', $this->options['tmbBgColor'], 'png'); |
|
| 833 | 832 | } |
| 834 | 833 | |
| 835 | 834 | if (!$result) { |
@@ -886,7 +885,7 @@ discard block |
||
| 886 | 885 | } |
| 887 | 886 | } |
| 888 | 887 | } |
| 889 | - if (! $url) { |
|
| 888 | + if (!$url) { |
|
| 890 | 889 | try { |
| 891 | 890 | $res = $this->dropbox->share($path, null, false); |
| 892 | 891 | $url = $res['url']; |
@@ -898,7 +897,7 @@ discard block |
||
| 898 | 897 | } |
| 899 | 898 | list($url) = explode('?', $url); |
| 900 | 899 | $url = str_replace('www.dropbox.com', $this->dropbox_dlhost, $url); |
| 901 | - if (! isset($cache['share']) || $cache['share'] !== $url) { |
|
| 900 | + if (!isset($cache['share']) || $cache['share'] !== $url) { |
|
| 902 | 901 | $cache['share'] = $url; |
| 903 | 902 | $this->updateDBdat($path, $cache); |
| 904 | 903 | } |
@@ -922,12 +921,12 @@ discard block |
||
| 922 | 921 | if (function_exists('curl_exec')) { |
| 923 | 922 | |
| 924 | 923 | $c = curl_init(); |
| 925 | - curl_setopt( $c, CURLOPT_RETURNTRANSFER, true ); |
|
| 926 | - curl_setopt( $c, CURLOPT_CUSTOMREQUEST, 'HEAD' ); |
|
| 927 | - curl_setopt( $c, CURLOPT_HEADER, 1 ); |
|
| 928 | - curl_setopt( $c, CURLOPT_NOBODY, true ); |
|
| 929 | - curl_setopt( $c, CURLOPT_URL, $url ); |
|
| 930 | - $res = curl_exec( $c ); |
|
| 924 | + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); |
|
| 925 | + curl_setopt($c, CURLOPT_CUSTOMREQUEST, 'HEAD'); |
|
| 926 | + curl_setopt($c, CURLOPT_HEADER, 1); |
|
| 927 | + curl_setopt($c, CURLOPT_NOBODY, true); |
|
| 928 | + curl_setopt($c, CURLOPT_URL, $url); |
|
| 929 | + $res = curl_exec($c); |
|
| 931 | 930 | |
| 932 | 931 | } else { |
| 933 | 932 | |
@@ -943,13 +942,13 @@ discard block |
||
| 943 | 942 | $result = $request2->send(); |
| 944 | 943 | $res = array(); |
| 945 | 944 | $res[] = 'HTTP/'.$result->getVersion().' '.$result->getStatus().' '.$result->getReasonPhrase(); |
| 946 | - foreach($result->getHeader() as $key => $val) { |
|
| 947 | - $res[] = $key . ': ' . $val; |
|
| 945 | + foreach ($result->getHeader() as $key => $val) { |
|
| 946 | + $res[] = $key.': '.$val; |
|
| 948 | 947 | } |
| 949 | 948 | $res = join("\r\n", $res); |
| 950 | - } catch( HTTP_Request2_Exception $e ){ |
|
| 949 | + } catch (HTTP_Request2_Exception $e) { |
|
| 951 | 950 | $res = ''; |
| 952 | - } catch (Exception $e){ |
|
| 951 | + } catch (Exception $e) { |
|
| 953 | 952 | $res = ''; |
| 954 | 953 | } |
| 955 | 954 | |
@@ -1001,7 +1000,7 @@ discard block |
||
| 1001 | 1000 | * @author Troex Nevelin |
| 1002 | 1001 | **/ |
| 1003 | 1002 | protected function _normpath($path) { |
| 1004 | - $path = '/' . ltrim($path, '/'); |
|
| 1003 | + $path = '/'.ltrim($path, '/'); |
|
| 1005 | 1004 | return $path; |
| 1006 | 1005 | } |
| 1007 | 1006 | |
@@ -1035,7 +1034,7 @@ discard block |
||
| 1035 | 1034 | * @author Dmitry (dio) Levashov |
| 1036 | 1035 | **/ |
| 1037 | 1036 | protected function _path($path) { |
| 1038 | - return $this->rootName . $this->_normpath(substr($path, strlen($this->root))); |
|
| 1037 | + return $this->rootName.$this->_normpath(substr($path, strlen($this->root))); |
|
| 1039 | 1038 | } |
| 1040 | 1039 | |
| 1041 | 1040 | /** |
@@ -1144,7 +1143,7 @@ discard block |
||
| 1144 | 1143 | * @return resource|false |
| 1145 | 1144 | * @author Dmitry (dio) Levashov |
| 1146 | 1145 | **/ |
| 1147 | - protected function _fopen($path, $mode='rb') { |
|
| 1146 | + protected function _fopen($path, $mode = 'rb') { |
|
| 1148 | 1147 | |
| 1149 | 1148 | if (($mode == 'rb' || $mode == 'r')) { |
| 1150 | 1149 | try { |
@@ -1154,7 +1153,7 @@ discard block |
||
| 1154 | 1153 | fputs($fp, "GET {$url['path']} HTTP/1.0\r\n"); |
| 1155 | 1154 | fputs($fp, "Host: {$url['host']}\r\n"); |
| 1156 | 1155 | fputs($fp, "\r\n"); |
| 1157 | - while(trim(fgets($fp)) !== ''){}; |
|
| 1156 | + while (trim(fgets($fp)) !== '') {}; |
|
| 1158 | 1157 | return $fp; |
| 1159 | 1158 | } catch (Dropbox_Exception $e) { |
| 1160 | 1159 | return false; |
@@ -1185,7 +1184,7 @@ discard block |
||
| 1185 | 1184 | * @return bool |
| 1186 | 1185 | * @author Dmitry (dio) Levashov |
| 1187 | 1186 | **/ |
| 1188 | - protected function _fclose($fp, $path='') { |
|
| 1187 | + protected function _fclose($fp, $path = '') { |
|
| 1189 | 1188 | @fclose($fp); |
| 1190 | 1189 | if ($path) { |
| 1191 | 1190 | @unlink($this->getTempFile($path)); |