@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | function getChild($name) |
| 67 | 67 | { |
| 68 | 68 | //error_log(__METHOD__."('$name') this->path=$this->path, this->vfs_path=$this->vfs_path"); |
| 69 | - $path = $this->vfs_path . '/' . $name; |
|
| 70 | - $vfs_path = $this->vfs_path . '/' . Vfs::encodePathComponent($name); |
|
| 69 | + $path = $this->vfs_path.'/'.$name; |
|
| 70 | + $vfs_path = $this->vfs_path.'/'.Vfs::encodePathComponent($name); |
|
| 71 | 71 | |
| 72 | - if (!Vfs::file_exists($vfs_path)) throw new DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); |
|
| 72 | + if (!Vfs::file_exists($vfs_path)) throw new DAV\Exception\NotFound('File with name '.$path.' could not be located'); |
|
| 73 | 73 | |
| 74 | 74 | if (Vfs::is_dir($vfs_path)) |
| 75 | 75 | { |
@@ -88,6 +88,6 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | function getQuotaInfo() |
| 90 | 90 | { |
| 91 | - return [ false, false ]; |
|
| 91 | + return [false, false]; |
|
| 92 | 92 | } |
| 93 | 93 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @param boolean $store_request =false if true whole request data will be made available in $this->request |
| 98 | 98 | * @access public |
| 99 | 99 | */ |
| 100 | - function __construct($path, $store_request=false) |
|
| 100 | + function __construct($path, $store_request = false) |
|
| 101 | 101 | { |
| 102 | 102 | $this->success = true; |
| 103 | 103 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | xml_parser_set_option($xml_parser, |
| 124 | 124 | XML_OPTION_CASE_FOLDING, false); |
| 125 | 125 | |
| 126 | - while($this->success && !feof($f_in)) { |
|
| 126 | + while ($this->success && !feof($f_in)) { |
|
| 127 | 127 | $line = fgets($f_in); |
| 128 | 128 | if ($store_request) $this->request .= $line; |
| 129 | 129 | if (is_string($line)) { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if($had_input) { |
|
| 135 | + if ($had_input) { |
|
| 136 | 136 | $this->success &= xml_parse($xml_parser, "", true); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $prop = array("name" => $tag); |
| 170 | 170 | $this->current = array("name" => $tag, "ns" => $ns, "status"=> 200); |
| 171 | 171 | if ($this->mode == "set") { |
| 172 | - $this->current["val"] = ""; // default set val |
|
| 172 | + $this->current["val"] = ""; // default set val |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $this->current["val"] .= "<$tag"; |
| 178 | 178 | if (isset($attr)) { |
| 179 | 179 | foreach ($attr as $key => $val) { |
| 180 | - $this->current["val"] .= ' '.$key.'="'.str_replace('"','"', $val).'"'; |
|
| 180 | + $this->current["val"] .= ' '.$key.'="'.str_replace('"', '"', $val).'"'; |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | $this->current["val"] .= ">"; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @param string $path |
| 112 | 112 | * @param boolean $store_request =false if true whole request data will be made available in $this->request |
| 113 | 113 | */ |
| 114 | - function __construct($path, $store_request=false) |
|
| 114 | + function __construct($path, $store_request = false) |
|
| 115 | 115 | { |
| 116 | 116 | // success state flag |
| 117 | 117 | $this->success = true; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | array(&$this, "_endElement")); |
| 142 | 142 | |
| 143 | 143 | xml_set_character_data_handler($xml_parser, |
| 144 | - array(&$this,'_charData') |
|
| 144 | + array(&$this, '_charData') |
|
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | 147 | // we want a case sensitive parser |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | fclose($f_in); |
| 171 | 171 | |
| 172 | 172 | // if no input was parsed it was a request |
| 173 | - if(!count($this->props)) $this->props = "all"; // default |
|
| 173 | + if (!count($this->props)) $this->props = "all"; // default |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | break; |
| 214 | 214 | case 'filter': |
| 215 | 215 | $this->use = 'filters'; |
| 216 | - $this->filters['attrs'] = $attrs; // need attrs eg. <filters test="(anyof|alloff)"> |
|
| 216 | + $this->filters['attrs'] = $attrs; // need attrs eg. <filters test="(anyof|alloff)"> |
|
| 217 | 217 | break; |
| 218 | 218 | default: |
| 219 | 219 | $this->use = 'other'; |
@@ -244,8 +244,8 @@ discard block |
||
| 244 | 244 | // this can happen if we have allprop and prop in one propfind: |
| 245 | 245 | // <allprop /><prop><blah /></prop>, eg. blah is not automatic returned by allprop |
| 246 | 246 | if (!is_array($this->{$this->use}) && $this->{$this->use}) $this->{$this->use} = array($this->{$this->use}); |
| 247 | - $this->{$this->use}[] =& $prop; |
|
| 248 | - $this->last_prop =& $prop; |
|
| 247 | + $this->{$this->use}[] = & $prop; |
|
| 248 | + $this->last_prop = & $prop; |
|
| 249 | 249 | unset($prop); |
| 250 | 250 | } |
| 251 | 251 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | function _charData($parser, $data) |
| 280 | 280 | { |
| 281 | 281 | if ($this->use != 'props' && ($n = count($this->{$this->use})) && ($data = trim($data))) { |
| 282 | - $this->{$this->use}[$n-1]['data'] = $data; |
|
| 282 | + $this->{$this->use}[$n - 1]['data'] = $data; |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | function PROPFIND(&$options, &$files) |
| 152 | 152 | { |
| 153 | 153 | // get absolute fs path to requested resource |
| 154 | - $fspath = $this->base . $options["path"]; |
|
| 154 | + $fspath = $this->base.$options["path"]; |
|
| 155 | 155 | |
| 156 | 156 | // sanity check |
| 157 | 157 | if (!file_exists($fspath)) { |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | function fileinfo($path) |
| 199 | 199 | { |
| 200 | 200 | // map URI path to filesystem path |
| 201 | - $fspath = $this->base . $path; |
|
| 201 | + $fspath = $this->base.$path; |
|
| 202 | 202 | |
| 203 | 203 | // create result array |
| 204 | 204 | $info = array(); |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | $info["props"][] = $this->mkprop("displayname", strtoupper($path)); |
| 211 | 211 | |
| 212 | 212 | // creation and modification time |
| 213 | - $info["props"][] = $this->mkprop("creationdate", filectime($fspath)); |
|
| 213 | + $info["props"][] = $this->mkprop("creationdate", filectime($fspath)); |
|
| 214 | 214 | $info["props"][] = $this->mkprop("getlastmodified", filemtime($fspath)); |
| 215 | 215 | |
| 216 | 216 | // Microsoft extensions: last access time and 'hidden' status |
| 217 | - $info["props"][] = $this->mkprop("lastaccessed", fileatime($fspath)); |
|
| 217 | + $info["props"][] = $this->mkprop("lastaccessed", fileatime($fspath)); |
|
| 218 | 218 | $info["props"][] = $this->mkprop("ishidden", ('.' === substr(basename($fspath), 0, 1))); |
| 219 | 219 | |
| 220 | 220 | // type and size (caller already made sure that path exists) |
@@ -341,8 +341,8 @@ discard block |
||
| 341 | 341 | // so we test the format of the returned string |
| 342 | 342 | |
| 343 | 343 | // the reply begins with the requested filename |
| 344 | - if (!strncmp($reply, "$fspath: ", strlen($fspath)+2)) { |
|
| 345 | - $reply = substr($reply, strlen($fspath)+2); |
|
| 344 | + if (!strncmp($reply, "$fspath: ", strlen($fspath) + 2)) { |
|
| 345 | + $reply = substr($reply, strlen($fspath) + 2); |
|
| 346 | 346 | // followed by the mime type (maybe including options) |
| 347 | 347 | if (preg_match('|^[[:alnum:]_-]+/[[:alnum:]_-]+;?.*|', $reply, $matches)) { |
| 348 | 348 | $mime_type = $matches[0]; |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | function HEAD(&$options) |
| 393 | 393 | { |
| 394 | 394 | // get absolute fs path to requested resource |
| 395 | - $fspath = $this->base . $options["path"]; |
|
| 395 | + $fspath = $this->base.$options["path"]; |
|
| 396 | 396 | |
| 397 | 397 | // sanity check |
| 398 | 398 | if (!file_exists($fspath)) return false; |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | function GET(&$options) |
| 422 | 422 | { |
| 423 | 423 | // get absolute fs path to requested resource |
| 424 | - $fspath = $this->base . $options["path"]; |
|
| 424 | + $fspath = $this->base.$options["path"]; |
|
| 425 | 425 | |
| 426 | 426 | // is this a collection? |
| 427 | 427 | if (is_dir($fspath)) { |
@@ -504,14 +504,14 @@ discard block |
||
| 504 | 504 | */ |
| 505 | 505 | function PUT(&$options) |
| 506 | 506 | { |
| 507 | - $fspath = $this->base . $options["path"]; |
|
| 507 | + $fspath = $this->base.$options["path"]; |
|
| 508 | 508 | |
| 509 | 509 | $dir = dirname($fspath); |
| 510 | 510 | if (!file_exists($dir) || !is_dir($dir)) { |
| 511 | 511 | return "409 Conflict"; // TODO right status code for both? |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - $options["new"] = ! file_exists($fspath); |
|
| 514 | + $options["new"] = !file_exists($fspath); |
|
| 515 | 515 | |
| 516 | 516 | if ($options["new"] && !$this->_is_writable($dir)) { |
| 517 | 517 | return "403 Forbidden"; |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | */ |
| 538 | 538 | function MKCOL($options) |
| 539 | 539 | { |
| 540 | - $path = $this->base .$options["path"]; |
|
| 540 | + $path = $this->base.$options["path"]; |
|
| 541 | 541 | $parent = dirname($path); |
| 542 | 542 | $name = basename($path); |
| 543 | 543 | |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | return "403 Forbidden"; |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | - if ( file_exists($parent."/".$name) ) { |
|
| 552 | + if (file_exists($parent."/".$name)) { |
|
| 553 | 553 | return "405 Method not allowed"; |
| 554 | 554 | } |
| 555 | 555 | |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | */ |
| 575 | 575 | function DELETE($options) |
| 576 | 576 | { |
| 577 | - $path = $this->base . "/" .$options["path"]; |
|
| 577 | + $path = $this->base."/".$options["path"]; |
|
| 578 | 578 | |
| 579 | 579 | if (!file_exists($path)) { |
| 580 | 580 | return "404 Not found"; |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | * @param array general parameter passing array |
| 614 | 614 | * @return bool true on success |
| 615 | 615 | */ |
| 616 | - function COPY($options, $del=false) |
|
| 616 | + function COPY($options, $del = false) |
|
| 617 | 617 | { |
| 618 | 618 | // TODO Property updates still broken (Litmus should detect this?) |
| 619 | 619 | |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | return "502 bad gateway"; |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | - $source = $this->base . $options["path"]; |
|
| 629 | + $source = $this->base.$options["path"]; |
|
| 630 | 630 | if (!file_exists($source)) { |
| 631 | 631 | return "404 Not found"; |
| 632 | 632 | } |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | } |
| 647 | 647 | } |
| 648 | 648 | |
| 649 | - $dest = $this->base . $options["dest"]; |
|
| 649 | + $dest = $this->base.$options["dest"]; |
|
| 650 | 650 | $destdir = dirname($dest); |
| 651 | 651 | |
| 652 | 652 | if (!file_exists($destdir) || !is_dir($destdir)) { |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | function LOCK(&$options) |
| 796 | 796 | { |
| 797 | 797 | // get absolute fs path to requested resource |
| 798 | - $fspath = $this->base . $options["path"]; |
|
| 798 | + $fspath = $this->base.$options["path"]; |
|
| 799 | 799 | |
| 800 | 800 | // TODO recursive locks on directories not supported yet |
| 801 | 801 | // makes litmus test "32. lock_collection" fail |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | return "409 Conflict"; |
| 804 | 804 | } |
| 805 | 805 | |
| 806 | - $options["timeout"] = time()+300; // 5min. hardcoded |
|
| 806 | + $options["timeout"] = time() + 300; // 5min. hardcoded |
|
| 807 | 807 | |
| 808 | 808 | if (isset($options["update"])) { // Lock Update |
| 809 | 809 | $where = "WHERE path = '$options[path]' AND token = '$options[update]'"; |
@@ -822,7 +822,7 @@ discard block |
||
| 822 | 822 | |
| 823 | 823 | $options['owner'] = $row['owner']; |
| 824 | 824 | $options['scope'] = $row["exclusivelock"] ? "exclusive" : "shared"; |
| 825 | - $options['type'] = $row["exclusivelock"] ? "write" : "read"; |
|
| 825 | + $options['type'] = $row["exclusivelock"] ? "write" : "read"; |
|
| 826 | 826 | |
| 827 | 827 | return true; |
| 828 | 828 | } else { |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | , modified = ".time()." |
| 838 | 838 | , owner = '$options[owner]' |
| 839 | 839 | , expires = '$options[timeout]' |
| 840 | - , exclusivelock = " .($options['scope'] === "exclusive" ? "1" : "0") |
|
| 840 | + , exclusivelock = ".($options['scope'] === "exclusive" ? "1" : "0") |
|
| 841 | 841 | ; |
| 842 | 842 | mysql_query($query); |
| 843 | 843 | |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | mysql_free_result($res); |
| 882 | 882 | |
| 883 | 883 | if ($row) { |
| 884 | - $result = array( "type" => "write", |
|
| 884 | + $result = array("type" => "write", |
|
| 885 | 885 | "scope" => $row["exclusivelock"] ? "exclusive" : "shared", |
| 886 | 886 | "depth" => 0, |
| 887 | 887 | "owner" => $row['owner'], |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | 'script-src' => array("'unsafe-eval'"), |
| 34 | 34 | 'style-src' => array("'unsafe-inline'"), |
| 35 | 35 | 'connect-src' => array(), |
| 36 | - 'frame-src' => null, // NOT array(), to allow setting no default frame-src! |
|
| 36 | + 'frame-src' => null, // NOT array(), to allow setting no default frame-src! |
|
| 37 | 37 | ); |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $attrs = array('www.egroupware.org'); |
| 56 | 56 | if (($app_additional = Api\Hooks::process('csp-frame-src'))) |
| 57 | 57 | { |
| 58 | - foreach($app_additional as $addtional) |
|
| 58 | + foreach ($app_additional as $addtional) |
|
| 59 | 59 | { |
| 60 | 60 | if ($addtional) $attrs = array_unique(array_merge($attrs, $addtional)); |
| 61 | 61 | } |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | self::$sources[$source] = array(); |
| 65 | 65 | } |
| 66 | - foreach((array)$attrs as $attr) |
|
| 66 | + foreach ((array)$attrs as $attr) |
|
| 67 | 67 | { |
| 68 | 68 | if (in_array($attr, array('none', 'self', 'unsafe-eval', 'unsafe-inline'))) |
| 69 | 69 | { |
| 70 | - $attr = "'$attr'"; // automatic add quotes |
|
| 70 | + $attr = "'$attr'"; // automatic add quotes |
|
| 71 | 71 | } |
| 72 | 72 | if (!in_array($attr, self::$sources[$source])) |
| 73 | 73 | { |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @param string|array $set =array() 'unsafe-eval' and/or 'unsafe-inline' (without quotes!) or URL (incl. protocol!) |
| 90 | 90 | */ |
| 91 | - public static function add_script_src($set=null) |
|
| 91 | + public static function add_script_src($set = null) |
|
| 92 | 92 | { |
| 93 | 93 | self::add('script-src', $set); |
| 94 | 94 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @param string|array $set =array() 'unsafe-inline' (without quotes!) and/or URL (incl. protocol!) |
| 102 | 102 | */ |
| 103 | - public static function add_style_src($set=null) |
|
| 103 | + public static function add_style_src($set = null) |
|
| 104 | 104 | { |
| 105 | 105 | self::add('style-src', $set); |
| 106 | 106 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @param string|array $set =array() URL (incl. protocol!) |
| 112 | 112 | */ |
| 113 | - public static function add_connect_src($set=null) |
|
| 113 | + public static function add_connect_src($set = null) |
|
| 114 | 114 | { |
| 115 | 115 | self::add('connect-src', $set); |
| 116 | 116 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @param string|array $set =array() URL (incl. protocol!) |
| 124 | 124 | * @return string with attributes eg. "'unsafe-inline'" |
| 125 | 125 | */ |
| 126 | - public static function add_frame_src($set=null) |
|
| 126 | + public static function add_frame_src($set = null) |
|
| 127 | 127 | { |
| 128 | 128 | self::add('frame-src', $set); |
| 129 | 129 | } |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public static function send() |
| 137 | 137 | { |
| 138 | - self::add('frame-src', null); // set defaults for frame-src |
|
| 138 | + self::add('frame-src', null); // set defaults for frame-src |
|
| 139 | 139 | |
| 140 | 140 | $policies = array(); |
| 141 | - foreach(self::$sources as $source => $urls) |
|
| 141 | + foreach (self::$sources as $source => $urls) |
|
| 142 | 142 | { |
| 143 | 143 | $policies[] = "$source 'self' ".implode(' ', $urls); |
| 144 | 144 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | // recommendaton ist to not send regular AND deprecated headers together, as they can cause unexpected behavior |
| 153 | 153 | if ($user_agent == 'chrome' && $version < 25 || $user_agent == 'safari' && $version < 7) |
| 154 | 154 | { |
| 155 | - header("X-Webkit-CSP: $csp"); // Chrome: <= 24, Safari incl. iOS |
|
| 155 | + header("X-Webkit-CSP: $csp"); // Chrome: <= 24, Safari incl. iOS |
|
| 156 | 156 | } |
| 157 | 157 | elseif ($user_agent == 'firefox' && $version < 23 || $user_agent == 'msie') // Edge is reported as 'edge'! |
| 158 | 158 | { |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | // should be Ok for all HTML 4 compatible browsers |
| 78 | 78 | $parts = $all_parts = null; |
| 79 | - if(!preg_match('/compatible; ([a-z]+)[\/ ]+([0-9.]+)/i',$_SERVER['HTTP_USER_AGENT'],$parts)) |
|
| 79 | + if (!preg_match('/compatible; ([a-z]+)[\/ ]+([0-9.]+)/i', $_SERVER['HTTP_USER_AGENT'], $parts)) |
|
| 80 | 80 | { |
| 81 | - preg_match_all('/([a-z]+)\/([0-9.]+)/i',$_SERVER['HTTP_USER_AGENT'],$all_parts,PREG_SET_ORDER); |
|
| 81 | + preg_match_all('/([a-z]+)\/([0-9.]+)/i', $_SERVER['HTTP_USER_AGENT'], $all_parts, PREG_SET_ORDER); |
|
| 82 | 82 | $parts = array_pop($all_parts); |
| 83 | - foreach($all_parts as $p) |
|
| 83 | + foreach ($all_parts as $p) |
|
| 84 | 84 | { |
| 85 | 85 | if ($p[1] == 'Chrome' && $parts[1] != 'Edge') |
| 86 | 86 | { |
@@ -89,12 +89,12 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | - list(,self::$user_agent,self::$ua_version) = $parts; |
|
| 92 | + list(,self::$user_agent, self::$ua_version) = $parts; |
|
| 93 | 93 | if ((self::$user_agent = strtolower(self::$user_agent)) == 'version') self::$user_agent = 'opera'; |
| 94 | 94 | // IE no longer reports MSIE, but "Trident/7.0; rv:11.0" |
| 95 | - if (self::$user_agent=='trident') |
|
| 95 | + if (self::$user_agent == 'trident') |
|
| 96 | 96 | { |
| 97 | - self::$user_agent='msie'; |
|
| 97 | + self::$user_agent = 'msie'; |
|
| 98 | 98 | $matches = null; |
| 99 | 99 | self::$ua_version = preg_match('|Trident/[0-9.]+; rv:([0-9.]+)|i', $_SERVER['HTTP_USER_AGENT'], $matches) ? |
| 100 | 100 | $matches[1] : 11.0; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param boolean $force_download =true send content-disposition attachment header |
| 39 | 39 | * @param boolean $no_content_type =false do not send actual content-type and content-length header, just content-disposition |
| 40 | 40 | */ |
| 41 | - public static function safe(&$content, $path, &$mime='', &$length=0, $nocache=true, $force_download=true, $no_content_type=false) |
|
| 41 | + public static function safe(&$content, $path, &$mime = '', &$length = 0, $nocache = true, $force_download = true, $no_content_type = false) |
|
| 42 | 42 | { |
| 43 | 43 | // change old/aliased mime-types to new one, eg. image/pdf to application/pdf |
| 44 | 44 | $mime = Api\MimeMagic::fix_mime_type($mime); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | if (UserAgent::type() == 'chrome' || UserAgent::type() == 'msie' && UserAgent::version() >= 8) |
| 54 | 54 | { |
| 55 | 55 | $mime = 'text/plain'; |
| 56 | - header('X-Content-Type-Options: nosniff'); // stop IE & Chrome from content-type sniffing |
|
| 56 | + header('X-Content-Type-Options: nosniff'); // stop IE & Chrome from content-type sniffing |
|
| 57 | 57 | } |
| 58 | 58 | // for the rest we change mime-type to text/html and let code below handle it safely |
| 59 | 59 | // this stops Safari and Firefox from using it as src attribute in a script tag |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $data = fread($content, $length); |
| 67 | 67 | fclose($content); |
| 68 | - $content =& $data; |
|
| 68 | + $content = & $data; |
|
| 69 | 69 | unset($data); |
| 70 | 70 | } |
| 71 | 71 | $content = '<pre>'.$content; |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | if (UserAgent::type() == 'chrome' && UserAgent::version() >= 24 || |
| 80 | 80 | // mobile FF 24 on Android does NOT honor CSP! |
| 81 | 81 | UserAgent::type() == 'firefox' && !UserAgent::mobile() && UserAgent::version() >= 24 || |
| 82 | - UserAgent::type() == 'safari' && !UserAgent::mobile() && UserAgent::version() >= 536 || // OS X |
|
| 82 | + UserAgent::type() == 'safari' && !UserAgent::mobile() && UserAgent::version() >= 536 || // OS X |
|
| 83 | 83 | UserAgent::type() == 'safari' && UserAgent::mobile() && UserAgent::version() >= 9537) // iOS 7 |
| 84 | 84 | { |
| 85 | - $csp = "script-src 'none'"; // forbid to execute any javascript |
|
| 85 | + $csp = "script-src 'none'"; // forbid to execute any javascript |
|
| 86 | 86 | header("Content-Security-Policy: $csp"); |
| 87 | - header("X-Webkit-CSP: $csp"); // Chrome: <= 24, Safari incl. iOS |
|
| 87 | + header("X-Webkit-CSP: $csp"); // Chrome: <= 24, Safari incl. iOS |
|
| 88 | 88 | //header("X-Content-Security-Policy: $csp"); // FF <= 22 |
| 89 | 89 | //error_log(__METHOD__."('$options[path]') ".UserAgent::type().'/'.UserAgent::version().(UserAgent::mobile()?'/mobile':'').": using Content-Security-Policy: $csp"); |
| 90 | 90 | } |
@@ -117,25 +117,25 @@ discard block |
||
| 117 | 117 | * @param boolean $nocache =true send headers to disallow browser/proxies to cache the download |
| 118 | 118 | * @param boolean $forceDownload =true send headers to handle as attachment/download |
| 119 | 119 | */ |
| 120 | - public static function type($fn,$mime='',$length=0,$nocache=True,$forceDownload=true) |
|
| 120 | + public static function type($fn, $mime = '', $length = 0, $nocache = True, $forceDownload = true) |
|
| 121 | 121 | { |
| 122 | 122 | // if no mime-type is given or it's the default binary-type, guess it from the extension |
| 123 | - if(empty($mime) || $mime == 'application/octet-stream') |
|
| 123 | + if (empty($mime) || $mime == 'application/octet-stream') |
|
| 124 | 124 | { |
| 125 | 125 | $mime = Api\MimeMagic::filename2mime($fn); |
| 126 | 126 | } |
| 127 | - if($fn) |
|
| 127 | + if ($fn) |
|
| 128 | 128 | { |
| 129 | 129 | // Show this for all |
| 130 | - self::disposition($fn,$forceDownload); |
|
| 130 | + self::disposition($fn, $forceDownload); |
|
| 131 | 131 | header('Content-type: '.$mime); |
| 132 | 132 | |
| 133 | - if($length) |
|
| 133 | + if ($length) |
|
| 134 | 134 | { |
| 135 | 135 | header('Content-length: '.$length); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if($nocache) |
|
| 138 | + if ($nocache) |
|
| 139 | 139 | { |
| 140 | 140 | header('Pragma: no-cache'); |
| 141 | 141 | header('Pragma: public'); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @param string $fn filename |
| 152 | 152 | * @param boolean $forceDownload =true send headers to handle as attachment/download |
| 153 | 153 | */ |
| 154 | - public static function disposition($fn, $forceDownload=true) |
|
| 154 | + public static function disposition($fn, $forceDownload = true) |
|
| 155 | 155 | { |
| 156 | 156 | if ($forceDownload) |
| 157 | 157 | { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @return string |
| 27 | 27 | * @todo get "real" referer for jDots template |
| 28 | 28 | */ |
| 29 | - static function get($default='',$referer='') |
|
| 29 | + static function get($default = '', $referer = '') |
|
| 30 | 30 | { |
| 31 | 31 | // HTTP_REFERER seems NOT to get urldecoded |
| 32 | 32 | if (!$referer) $referer = urldecode($_SERVER['HTTP_REFERER']); |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | $webserver_url = $GLOBALS['egw_info']['server']['webserver_url']; |
| 35 | 35 | if (empty($webserver_url) || $webserver_url{0} == '/') // url is just a path |
| 36 | 36 | { |
| 37 | - $referer = preg_replace('/^https?:\/\/[^\/]+/','',$referer); // removing the domain part |
|
| 37 | + $referer = preg_replace('/^https?:\/\/[^\/]+/', '', $referer); // removing the domain part |
|
| 38 | 38 | } |
| 39 | 39 | if (strlen($webserver_url) > 1) |
| 40 | 40 | { |
| 41 | - list(,$referer) = explode($webserver_url,$referer,2); |
|
| 41 | + list(,$referer) = explode($webserver_url, $referer, 2); |
|
| 42 | 42 | } |
| 43 | 43 | $ret = str_replace('/etemplate/process_exec.php', '/index.php', $referer); |
| 44 | 44 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @param string $cname |
| 62 | 62 | */ |
| 63 | - public function beforeSendToClient($cname, array $expand=array()) |
|
| 63 | + public function beforeSendToClient($cname, array $expand = array()) |
|
| 64 | 64 | { |
| 65 | 65 | $attrs = $this->attrs; |
| 66 | 66 | |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | $attrs['id'] = $this->id; |
| 69 | 69 | |
| 70 | 70 | $form_name = self::form_name($cname, $this->id); |
| 71 | - $data_id = $attrs['value'] ? self::form_name($cname, $attrs['value']) : self::form_name($cname, self::ID_PREFIX . $this->id); |
|
| 71 | + $data_id = $attrs['value'] ? self::form_name($cname, $attrs['value']) : self::form_name($cname, self::ID_PREFIX.$this->id); |
|
| 72 | 72 | |
| 73 | 73 | // No need to proceed |
| 74 | - if(!$data_id) return; |
|
| 74 | + if (!$data_id) return; |
|
| 75 | 75 | |
| 76 | 76 | // Find out which record to load |
| 77 | 77 | $value = self::get_array(self::$request->content, $form_name, false, true); |
| 78 | - if(!$value) |
|
| 78 | + if (!$value) |
|
| 79 | 79 | { |
| 80 | 80 | // Try here... legacy / fallback / just make it work |
| 81 | 81 | $value = self::get_array(self::$request->content, $data_id, true, false); |
@@ -85,23 +85,23 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | // Get the record itself |
| 87 | 87 | $data = self::get_array(self::$request->content, $data_id, true, false); |
| 88 | - if(!$data) |
|
| 88 | + if (!$data) |
|
| 89 | 89 | { |
| 90 | 90 | $data = static::get_entry($value, $attrs); |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Set the new value so transformer can find it. Use prefix to avoid changing the original value |
| 95 | - $new_value =& self::get_array(self::$request->content, self::ID_PREFIX .$this->id, true, false); |
|
| 95 | + $new_value = & self::get_array(self::$request->content, self::ID_PREFIX.$this->id, true, false); |
|
| 96 | 96 | if (true) $new_value = $data; |
| 97 | - $this->id = self::ID_PREFIX . $this->id . "[{$attrs['field']}]"; |
|
| 97 | + $this->id = self::ID_PREFIX.$this->id."[{$attrs['field']}]"; |
|
| 98 | 98 | |
| 99 | 99 | $old_type = self::getElementAttribute($this->id, 'type'); |
| 100 | 100 | |
| 101 | 101 | parent::beforeSendToClient($cname, $expand); |
| 102 | 102 | |
| 103 | 103 | // Check for conflict - more than one with same id/field and different type |
| 104 | - if($old_type && $old_type != $this->type) |
|
| 104 | + if ($old_type && $old_type != $this->type) |
|
| 105 | 105 | { |
| 106 | 106 | //self::set_validation_error($this->id, lang('%1, duplicate ID', $this)); |
| 107 | 107 | } |