@@ -1302,22 +1302,22 @@ |
||
| 1302 | 1302 | if(isset($field['type'])) |
| 1303 | 1303 | { |
| 1304 | 1304 | switch($field["type"]){ |
| 1305 | - case "relate": |
|
| 1306 | - case "parent": |
|
| 1307 | - case "int": |
|
| 1308 | - case "contact_id": |
|
| 1309 | - case "assigned_user_name": |
|
| 1310 | - case "account_id": |
|
| 1311 | - case "account_name": |
|
| 1312 | - case "bool": |
|
| 1313 | - case "enum": |
|
| 1314 | - case "multienum": |
|
| 1315 | - case "radioenum": |
|
| 1316 | - case "datetimecombo": |
|
| 1317 | - case "datetime": |
|
| 1318 | - case "date": |
|
| 1319 | - return true; |
|
| 1320 | - break; |
|
| 1305 | + case "relate": |
|
| 1306 | + case "parent": |
|
| 1307 | + case "int": |
|
| 1308 | + case "contact_id": |
|
| 1309 | + case "assigned_user_name": |
|
| 1310 | + case "account_id": |
|
| 1311 | + case "account_name": |
|
| 1312 | + case "bool": |
|
| 1313 | + case "enum": |
|
| 1314 | + case "multienum": |
|
| 1315 | + case "radioenum": |
|
| 1316 | + case "datetimecombo": |
|
| 1317 | + case "datetime": |
|
| 1318 | + case "date": |
|
| 1319 | + return true; |
|
| 1320 | + break; |
|
| 1321 | 1321 | } |
| 1322 | 1322 | } |
| 1323 | 1323 | } |
@@ -501,34 +501,34 @@ discard block |
||
| 501 | 501 | // here we strip all unrequested entries out of the response |
| 502 | 502 | |
| 503 | 503 | switch($options['props']) { |
| 504 | - case "all": |
|
| 505 | - // nothing to remove |
|
| 506 | - break; |
|
| 504 | + case "all": |
|
| 505 | + // nothing to remove |
|
| 506 | + break; |
|
| 507 | 507 | |
| 508 | - case "names": |
|
| 509 | - // only the names of all existing properties were requested |
|
| 510 | - // so we remove all values |
|
| 511 | - unset($files["files"][$filekey]["props"][$key]["val"]); |
|
| 512 | - break; |
|
| 508 | + case "names": |
|
| 509 | + // only the names of all existing properties were requested |
|
| 510 | + // so we remove all values |
|
| 511 | + unset($files["files"][$filekey]["props"][$key]["val"]); |
|
| 512 | + break; |
|
| 513 | 513 | |
| 514 | - default: |
|
| 515 | - $found = false; |
|
| 514 | + default: |
|
| 515 | + $found = false; |
|
| 516 | 516 | |
| 517 | - // search property name in requested properties |
|
| 518 | - foreach((array)$options["props"] as $reqprop) { |
|
| 519 | - if ( $reqprop["name"] == $prop["name"] |
|
| 520 | - && $reqprop["xmlns"] == $prop["ns"]) { |
|
| 521 | - $found = true; |
|
| 522 | - break; |
|
| 517 | + // search property name in requested properties |
|
| 518 | + foreach((array)$options["props"] as $reqprop) { |
|
| 519 | + if ( $reqprop["name"] == $prop["name"] |
|
| 520 | + && $reqprop["xmlns"] == $prop["ns"]) { |
|
| 521 | + $found = true; |
|
| 522 | + break; |
|
| 523 | + } |
|
| 523 | 524 | } |
| 524 | - } |
|
| 525 | 525 | |
| 526 | - // unset property and continue with next one if not found/requested |
|
| 527 | - if (!$found) { |
|
| 528 | - $files["files"][$filekey]["props"][$key]=""; |
|
| 529 | - continue(2); |
|
| 530 | - } |
|
| 531 | - break; |
|
| 526 | + // unset property and continue with next one if not found/requested |
|
| 527 | + if (!$found) { |
|
| 528 | + $files["files"][$filekey]["props"][$key]=""; |
|
| 529 | + continue(2); |
|
| 530 | + } |
|
| 531 | + break; |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | // namespace handling |
@@ -629,32 +629,32 @@ discard block |
||
| 629 | 629 | } else if ($prop["ns"] == "DAV:") { |
| 630 | 630 | // some WebDAV properties need special treatment |
| 631 | 631 | switch ($prop["name"]) { |
| 632 | - case "creationdate": |
|
| 633 | - echo " <D:creationdate ns0:dt=\"dateTime.tz\">" |
|
| 634 | - . gmdate("Y-m-d\\TH:i:s\\Z",$prop['val']) |
|
| 635 | - . "</D:creationdate>\n"; |
|
| 636 | - break; |
|
| 637 | - case "getlastmodified": |
|
| 638 | - echo " <D:getlastmodified ns0:dt=\"dateTime.rfc1123\">" |
|
| 639 | - . TimeDate::httptime($prop['val']) |
|
| 640 | - . "</D:getlastmodified>\n"; |
|
| 641 | - break; |
|
| 642 | - case "resourcetype": |
|
| 643 | - echo " <D:resourcetype><D:$prop[val]/></D:resourcetype>\n"; |
|
| 644 | - break; |
|
| 645 | - case "supportedlock": |
|
| 646 | - echo " <D:supportedlock>$prop[val]</D:supportedlock>\n"; |
|
| 647 | - break; |
|
| 648 | - case "lockdiscovery": |
|
| 649 | - echo " <D:lockdiscovery>\n"; |
|
| 650 | - echo $prop["val"]; |
|
| 651 | - echo " </D:lockdiscovery>\n"; |
|
| 652 | - break; |
|
| 653 | - default: |
|
| 654 | - echo " <D:$prop[name]>" |
|
| 655 | - . $this->_prop_encode(htmlspecialchars($prop['val'])) |
|
| 656 | - . "</D:$prop[name]>\n"; |
|
| 657 | - break; |
|
| 632 | + case "creationdate": |
|
| 633 | + echo " <D:creationdate ns0:dt=\"dateTime.tz\">" |
|
| 634 | + . gmdate("Y-m-d\\TH:i:s\\Z",$prop['val']) |
|
| 635 | + . "</D:creationdate>\n"; |
|
| 636 | + break; |
|
| 637 | + case "getlastmodified": |
|
| 638 | + echo " <D:getlastmodified ns0:dt=\"dateTime.rfc1123\">" |
|
| 639 | + . TimeDate::httptime($prop['val']) |
|
| 640 | + . "</D:getlastmodified>\n"; |
|
| 641 | + break; |
|
| 642 | + case "resourcetype": |
|
| 643 | + echo " <D:resourcetype><D:$prop[val]/></D:resourcetype>\n"; |
|
| 644 | + break; |
|
| 645 | + case "supportedlock": |
|
| 646 | + echo " <D:supportedlock>$prop[val]</D:supportedlock>\n"; |
|
| 647 | + break; |
|
| 648 | + case "lockdiscovery": |
|
| 649 | + echo " <D:lockdiscovery>\n"; |
|
| 650 | + echo $prop["val"]; |
|
| 651 | + echo " </D:lockdiscovery>\n"; |
|
| 652 | + break; |
|
| 653 | + default: |
|
| 654 | + echo " <D:$prop[name]>" |
|
| 655 | + . $this->_prop_encode(htmlspecialchars($prop['val'])) |
|
| 656 | + . "</D:$prop[name]>\n"; |
|
| 657 | + break; |
|
| 658 | 658 | } |
| 659 | 659 | } else { |
| 660 | 660 | // properties from namespaces != "DAV:" or without any namespace |
@@ -1041,56 +1041,56 @@ discard block |
||
| 1041 | 1041 | foreach ($_SERVER as $key => $val) { |
| 1042 | 1042 | if (strncmp($key, "HTTP_CONTENT", 11)) continue; |
| 1043 | 1043 | switch ($key) { |
| 1044 | - case 'HTTP_CONTENT_ENCODING': // RFC 2616 14.11 |
|
| 1045 | - // TODO support this if ext/zlib filters are available |
|
| 1046 | - $this->http_status("501 not implemented"); |
|
| 1047 | - echo "The service does not support '$val' content encoding"; |
|
| 1048 | - return; |
|
| 1044 | + case 'HTTP_CONTENT_ENCODING': // RFC 2616 14.11 |
|
| 1045 | + // TODO support this if ext/zlib filters are available |
|
| 1046 | + $this->http_status("501 not implemented"); |
|
| 1047 | + echo "The service does not support '$val' content encoding"; |
|
| 1048 | + return; |
|
| 1049 | 1049 | |
| 1050 | - case 'HTTP_CONTENT_LANGUAGE': // RFC 2616 14.12 |
|
| 1051 | - // we assume it is not critical if this one is ignored |
|
| 1052 | - // in the actual PUT implementation ... |
|
| 1053 | - $options["content_language"] = $value; |
|
| 1054 | - break; |
|
| 1050 | + case 'HTTP_CONTENT_LANGUAGE': // RFC 2616 14.12 |
|
| 1051 | + // we assume it is not critical if this one is ignored |
|
| 1052 | + // in the actual PUT implementation ... |
|
| 1053 | + $options["content_language"] = $value; |
|
| 1054 | + break; |
|
| 1055 | 1055 | |
| 1056 | - case 'HTTP_CONTENT_LOCATION': // RFC 2616 14.14 |
|
| 1057 | - /* The meaning of the Content-Location header in PUT |
|
| 1056 | + case 'HTTP_CONTENT_LOCATION': // RFC 2616 14.14 |
|
| 1057 | + /* The meaning of the Content-Location header in PUT |
|
| 1058 | 1058 | or POST requests is undefined; servers are free |
| 1059 | 1059 | to ignore it in those cases. */ |
| 1060 | - break; |
|
| 1061 | - |
|
| 1062 | - case 'HTTP_CONTENT_RANGE': // RFC 2616 14.16 |
|
| 1063 | - // single byte range requests are supported |
|
| 1064 | - // the header format is also specified in RFC 2616 14.16 |
|
| 1065 | - // TODO we have to ensure that implementations support this or send 501 instead |
|
| 1066 | - if (!preg_match('@bytes\s+(\d+)-(\d+)/((\d+)|\*)@', $value, $matches)) { |
|
| 1067 | - $this->http_status("400 bad request"); |
|
| 1068 | - echo "The service does only support single byte ranges"; |
|
| 1069 | - return; |
|
| 1070 | - } |
|
| 1060 | + break; |
|
| 1071 | 1061 | |
| 1072 | - $range = array("start"=>$matches[1], "end"=>$matches[2]); |
|
| 1073 | - if (is_numeric($matches[3])) { |
|
| 1074 | - $range["total_length"] = $matches[3]; |
|
| 1075 | - } |
|
| 1076 | - $option["ranges"][] = $range; |
|
| 1062 | + case 'HTTP_CONTENT_RANGE': // RFC 2616 14.16 |
|
| 1063 | + // single byte range requests are supported |
|
| 1064 | + // the header format is also specified in RFC 2616 14.16 |
|
| 1065 | + // TODO we have to ensure that implementations support this or send 501 instead |
|
| 1066 | + if (!preg_match('@bytes\s+(\d+)-(\d+)/((\d+)|\*)@', $value, $matches)) { |
|
| 1067 | + $this->http_status("400 bad request"); |
|
| 1068 | + echo "The service does only support single byte ranges"; |
|
| 1069 | + return; |
|
| 1070 | + } |
|
| 1077 | 1071 | |
| 1078 | - // TODO make sure the implementation supports partial PUT |
|
| 1079 | - // this has to be done in advance to avoid data being overwritten |
|
| 1080 | - // on implementations that do not support this ... |
|
| 1081 | - break; |
|
| 1072 | + $range = array("start"=>$matches[1], "end"=>$matches[2]); |
|
| 1073 | + if (is_numeric($matches[3])) { |
|
| 1074 | + $range["total_length"] = $matches[3]; |
|
| 1075 | + } |
|
| 1076 | + $option["ranges"][] = $range; |
|
| 1082 | 1077 | |
| 1083 | - case 'HTTP_CONTENT_MD5': // RFC 2616 14.15 |
|
| 1084 | - // TODO: maybe we can just pretend here? |
|
| 1085 | - $this->http_status("501 not implemented"); |
|
| 1086 | - echo "The service does not support content MD5 checksum verification"; |
|
| 1087 | - return; |
|
| 1078 | + // TODO make sure the implementation supports partial PUT |
|
| 1079 | + // this has to be done in advance to avoid data being overwritten |
|
| 1080 | + // on implementations that do not support this ... |
|
| 1081 | + break; |
|
| 1088 | 1082 | |
| 1089 | - default: |
|
| 1090 | - // any other unknown Content-* headers |
|
| 1091 | - $this->http_status("501 not implemented"); |
|
| 1092 | - echo "The service does not support '$key'"; |
|
| 1093 | - return; |
|
| 1083 | + case 'HTTP_CONTENT_MD5': // RFC 2616 14.15 |
|
| 1084 | + // TODO: maybe we can just pretend here? |
|
| 1085 | + $this->http_status("501 not implemented"); |
|
| 1086 | + echo "The service does not support content MD5 checksum verification"; |
|
| 1087 | + return; |
|
| 1088 | + |
|
| 1089 | + default: |
|
| 1090 | + // any other unknown Content-* headers |
|
| 1091 | + $this->http_status("501 not implemented"); |
|
| 1092 | + echo "The service does not support '$key'"; |
|
| 1093 | + return; |
|
| 1094 | 1094 | } |
| 1095 | 1095 | } |
| 1096 | 1096 | |
@@ -1853,13 +1853,13 @@ discard block |
||
| 1853 | 1853 | function _prop_encode($text) |
| 1854 | 1854 | { |
| 1855 | 1855 | switch (strtolower($this->_prop_encoding)) { |
| 1856 | - case "utf-8": |
|
| 1857 | - return $text; |
|
| 1858 | - case "iso-8859-1": |
|
| 1859 | - case "iso-8859-15": |
|
| 1860 | - case "latin-1": |
|
| 1861 | - default: |
|
| 1862 | - return utf8_encode($text); |
|
| 1856 | + case "utf-8": |
|
| 1857 | + return $text; |
|
| 1858 | + case "iso-8859-1": |
|
| 1859 | + case "iso-8859-15": |
|
| 1860 | + case "latin-1": |
|
| 1861 | + default: |
|
| 1862 | + return utf8_encode($text); |
|
| 1863 | 1863 | } |
| 1864 | 1864 | } |
| 1865 | 1865 | } |
@@ -71,21 +71,21 @@ |
||
| 71 | 71 | */ |
| 72 | 72 | function parse(&$context) { |
| 73 | 73 | switch($context->ScanCharacter()) { |
| 74 | - case '/': |
|
| 75 | - return XML_HTMLSAX3_STATE_CLOSING_TAG; |
|
| 76 | - break; |
|
| 77 | - case '?': |
|
| 78 | - return XML_HTMLSAX3_STATE_PI; |
|
| 79 | - break; |
|
| 80 | - case '%': |
|
| 81 | - return XML_HTMLSAX3_STATE_JASP; |
|
| 82 | - break; |
|
| 83 | - case '!': |
|
| 84 | - return XML_HTMLSAX3_STATE_ESCAPE; |
|
| 85 | - break; |
|
| 86 | - default: |
|
| 87 | - $context->unscanCharacter(); |
|
| 88 | - return XML_HTMLSAX3_STATE_OPENING_TAG; |
|
| 74 | + case '/': |
|
| 75 | + return XML_HTMLSAX3_STATE_CLOSING_TAG; |
|
| 76 | + break; |
|
| 77 | + case '?': |
|
| 78 | + return XML_HTMLSAX3_STATE_PI; |
|
| 79 | + break; |
|
| 80 | + case '%': |
|
| 81 | + return XML_HTMLSAX3_STATE_JASP; |
|
| 82 | + break; |
|
| 83 | + case '!': |
|
| 84 | + return XML_HTMLSAX3_STATE_ESCAPE; |
|
| 85 | + break; |
|
| 86 | + default: |
|
| 87 | + $context->unscanCharacter(); |
|
| 88 | + return XML_HTMLSAX3_STATE_OPENING_TAG; |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -178,10 +178,10 @@ |
||
| 178 | 178 | $request = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters); |
| 179 | 179 | $request->sign_request($this->sha1_method, $this->consumer, $this->token); |
| 180 | 180 | switch ($method) { |
| 181 | - case 'GET': |
|
| 182 | - return $this->http($request->to_url(), 'GET'); |
|
| 183 | - default: |
|
| 184 | - return $this->http($request->get_normalized_http_url(), $method, $request->to_postdata()); |
|
| 181 | + case 'GET': |
|
| 182 | + return $this->http($request->to_url(), 'GET'); |
|
| 183 | + default: |
|
| 184 | + return $this->http($request->get_normalized_http_url(), $method, $request->to_postdata()); |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
@@ -182,34 +182,34 @@ discard block |
||
| 182 | 182 | * <img src="blah"/> |
| 183 | 183 | */ |
| 184 | 184 | switch (substr($body, $pos, 1)) { |
| 185 | - case '/': |
|
| 186 | - $tagtype = 2; |
|
| 187 | - $pos++; |
|
| 188 | - break; |
|
| 189 | - case '!': |
|
| 190 | - /** |
|
| 185 | + case '/': |
|
| 186 | + $tagtype = 2; |
|
| 187 | + $pos++; |
|
| 188 | + break; |
|
| 189 | + case '!': |
|
| 190 | + /** |
|
| 191 | 191 | * A comment or an SGML declaration. |
| 192 | 192 | */ |
| 193 | - if (substr($body, $pos + 1, 2) == '--') { |
|
| 194 | - $gt = strpos($body, '-->', $pos); |
|
| 195 | - if ($gt === false) { |
|
| 196 | - $gt = strlen($body); |
|
| 193 | + if (substr($body, $pos + 1, 2) == '--') { |
|
| 194 | + $gt = strpos($body, '-->', $pos); |
|
| 195 | + if ($gt === false) { |
|
| 196 | + $gt = strlen($body); |
|
| 197 | + } else { |
|
| 198 | + $gt += 2; |
|
| 199 | + } |
|
| 200 | + return array(false, false, false, $lt, $gt); |
|
| 197 | 201 | } else { |
| 198 | - $gt += 2; |
|
| 202 | + $gt = tln_findnxstr($body, $pos, '>'); |
|
| 203 | + return array(false, false, false, $lt, $gt); |
|
| 199 | 204 | } |
| 200 | - return array(false, false, false, $lt, $gt); |
|
| 201 | - } else { |
|
| 202 | - $gt = tln_findnxstr($body, $pos, '>'); |
|
| 203 | - return array(false, false, false, $lt, $gt); |
|
| 204 | - } |
|
| 205 | - break; |
|
| 206 | - default: |
|
| 207 | - /** |
|
| 205 | + break; |
|
| 206 | + default: |
|
| 207 | + /** |
|
| 208 | 208 | * Assume tagtype 1 for now. If it's type 3, we'll switch values |
| 209 | 209 | * later. |
| 210 | 210 | */ |
| 211 | - $tagtype = 1; |
|
| 212 | - break; |
|
| 211 | + $tagtype = 1; |
|
| 212 | + break; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -231,36 +231,36 @@ discard block |
||
| 231 | 231 | * Whatever else we find there indicates an invalid tag. |
| 232 | 232 | */ |
| 233 | 233 | switch ($match) { |
| 234 | - case '/': |
|
| 235 | - /** |
|
| 234 | + case '/': |
|
| 235 | + /** |
|
| 236 | 236 | * This is an xhtml-style tag with a closing / at the |
| 237 | 237 | * end, like so: <img src="blah"/>. Check if it's followed |
| 238 | 238 | * by the closing bracket. If not, then this tag is invalid |
| 239 | 239 | */ |
| 240 | - if (substr($body, $pos, 2) == '/>') { |
|
| 241 | - $pos++; |
|
| 242 | - $tagtype = 3; |
|
| 243 | - } else { |
|
| 244 | - $gt = tln_findnxstr($body, $pos, '>'); |
|
| 245 | - $retary = array(false, false, false, $lt, $gt); |
|
| 246 | - return $retary; |
|
| 247 | - } |
|
| 248 | - //intentional fall-through |
|
| 249 | - case '>': |
|
| 250 | - return array($tagname, false, $tagtype, $lt, $pos); |
|
| 251 | - break; |
|
| 252 | - default: |
|
| 253 | - /** |
|
| 240 | + if (substr($body, $pos, 2) == '/>') { |
|
| 241 | + $pos++; |
|
| 242 | + $tagtype = 3; |
|
| 243 | + } else { |
|
| 244 | + $gt = tln_findnxstr($body, $pos, '>'); |
|
| 245 | + $retary = array(false, false, false, $lt, $gt); |
|
| 246 | + return $retary; |
|
| 247 | + } |
|
| 248 | + //intentional fall-through |
|
| 249 | + case '>': |
|
| 250 | + return array($tagname, false, $tagtype, $lt, $pos); |
|
| 251 | + break; |
|
| 252 | + default: |
|
| 253 | + /** |
|
| 254 | 254 | * Check if it's whitespace |
| 255 | 255 | */ |
| 256 | - if (!preg_match('/\s/', $match)) { |
|
| 257 | - /** |
|
| 256 | + if (!preg_match('/\s/', $match)) { |
|
| 257 | + /** |
|
| 258 | 258 | * This is an invalid tag! Look for the next closing ">". |
| 259 | 259 | */ |
| 260 | - $gt = tln_findnxstr($body, $lt, '>'); |
|
| 261 | - return array(false, false, false, $lt, $gt); |
|
| 262 | - } |
|
| 263 | - break; |
|
| 260 | + $gt = tln_findnxstr($body, $lt, '>'); |
|
| 261 | + return array(false, false, false, $lt, $gt); |
|
| 262 | + } |
|
| 263 | + break; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /** |
@@ -332,32 +332,32 @@ discard block |
||
| 332 | 332 | * anything else means the attribute is invalid. |
| 333 | 333 | */ |
| 334 | 334 | switch ($match) { |
| 335 | - case '/': |
|
| 336 | - /** |
|
| 335 | + case '/': |
|
| 336 | + /** |
|
| 337 | 337 | * This is an xhtml-style tag with a closing / at the |
| 338 | 338 | * end, like so: <img src="blah"/>. Check if it's followed |
| 339 | 339 | * by the closing bracket. If not, then this tag is invalid |
| 340 | 340 | */ |
| 341 | - if (substr($body, $pos, 2) == '/>') { |
|
| 342 | - $pos++; |
|
| 343 | - $tagtype = 3; |
|
| 344 | - } else { |
|
| 345 | - $gt = tln_findnxstr($body, $pos, '>'); |
|
| 346 | - $retary = array(false, false, false, $lt, $gt); |
|
| 347 | - return $retary; |
|
| 348 | - } |
|
| 349 | - //intentional fall-through |
|
| 350 | - case '>': |
|
| 351 | - $attary{$attname} = '"yes"'; |
|
| 352 | - return array($tagname, $attary, $tagtype, $lt, $pos); |
|
| 353 | - break; |
|
| 354 | - default: |
|
| 355 | - /** |
|
| 341 | + if (substr($body, $pos, 2) == '/>') { |
|
| 342 | + $pos++; |
|
| 343 | + $tagtype = 3; |
|
| 344 | + } else { |
|
| 345 | + $gt = tln_findnxstr($body, $pos, '>'); |
|
| 346 | + $retary = array(false, false, false, $lt, $gt); |
|
| 347 | + return $retary; |
|
| 348 | + } |
|
| 349 | + //intentional fall-through |
|
| 350 | + case '>': |
|
| 351 | + $attary{$attname} = '"yes"'; |
|
| 352 | + return array($tagname, $attary, $tagtype, $lt, $pos); |
|
| 353 | + break; |
|
| 354 | + default: |
|
| 355 | + /** |
|
| 356 | 356 | * Skip whitespace and see what we arrive at. |
| 357 | 357 | */ |
| 358 | - $pos = tln_skipspace($body, $pos); |
|
| 359 | - $char = substr($body, $pos, 1); |
|
| 360 | - /** |
|
| 358 | + $pos = tln_skipspace($body, $pos); |
|
| 359 | + $char = substr($body, $pos, 1); |
|
| 360 | + /** |
|
| 361 | 361 | * Two things are valid here: |
| 362 | 362 | * '=' means this is attribute type 1 2 or 3. |
| 363 | 363 | * \w means this was attribute type 4. |
@@ -365,60 +365,60 @@ discard block |
||
| 365 | 365 | * invalid stuff will be caught by our checks at the beginning |
| 366 | 366 | * of the loop. |
| 367 | 367 | */ |
| 368 | - if ($char == '=') { |
|
| 369 | - $pos++; |
|
| 370 | - $pos = tln_skipspace($body, $pos); |
|
| 371 | - /** |
|
| 368 | + if ($char == '=') { |
|
| 369 | + $pos++; |
|
| 370 | + $pos = tln_skipspace($body, $pos); |
|
| 371 | + /** |
|
| 372 | 372 | * Here are 3 possibilities: |
| 373 | 373 | * "'" attribute type 1 |
| 374 | 374 | * '"' attribute type 2 |
| 375 | 375 | * everything else is the content of tag type 3 |
| 376 | 376 | */ |
| 377 | - $quot = substr($body, $pos, 1); |
|
| 378 | - if ($quot == '\'') { |
|
| 379 | - $regary = tln_findnxreg($body, $pos + 1, '\''); |
|
| 380 | - if ($regary == false) { |
|
| 381 | - return array(false, false, false, $lt, strlen($body)); |
|
| 382 | - } |
|
| 383 | - list($pos, $attval, $match) = $regary; |
|
| 384 | - $pos++; |
|
| 385 | - $attary{$attname} = '\'' . $attval . '\''; |
|
| 386 | - } elseif ($quot == '"') { |
|
| 387 | - $regary = tln_findnxreg($body, $pos + 1, '\"'); |
|
| 388 | - if ($regary == false) { |
|
| 389 | - return array(false, false, false, $lt, strlen($body)); |
|
| 390 | - } |
|
| 391 | - list($pos, $attval, $match) = $regary; |
|
| 392 | - $pos++; |
|
| 393 | - $attary{$attname} = '"' . $attval . '"'; |
|
| 394 | - } else { |
|
| 395 | - /** |
|
| 377 | + $quot = substr($body, $pos, 1); |
|
| 378 | + if ($quot == '\'') { |
|
| 379 | + $regary = tln_findnxreg($body, $pos + 1, '\''); |
|
| 380 | + if ($regary == false) { |
|
| 381 | + return array(false, false, false, $lt, strlen($body)); |
|
| 382 | + } |
|
| 383 | + list($pos, $attval, $match) = $regary; |
|
| 384 | + $pos++; |
|
| 385 | + $attary{$attname} = '\'' . $attval . '\''; |
|
| 386 | + } elseif ($quot == '"') { |
|
| 387 | + $regary = tln_findnxreg($body, $pos + 1, '\"'); |
|
| 388 | + if ($regary == false) { |
|
| 389 | + return array(false, false, false, $lt, strlen($body)); |
|
| 390 | + } |
|
| 391 | + list($pos, $attval, $match) = $regary; |
|
| 392 | + $pos++; |
|
| 393 | + $attary{$attname} = '"' . $attval . '"'; |
|
| 394 | + } else { |
|
| 395 | + /** |
|
| 396 | 396 | * These are hateful. Look for \s, or >. |
| 397 | 397 | */ |
| 398 | - $regary = tln_findnxreg($body, $pos, '[\s>]'); |
|
| 399 | - if ($regary == false) { |
|
| 400 | - return array(false, false, false, $lt, strlen($body)); |
|
| 401 | - } |
|
| 402 | - list($pos, $attval, $match) = $regary; |
|
| 403 | - /** |
|
| 398 | + $regary = tln_findnxreg($body, $pos, '[\s>]'); |
|
| 399 | + if ($regary == false) { |
|
| 400 | + return array(false, false, false, $lt, strlen($body)); |
|
| 401 | + } |
|
| 402 | + list($pos, $attval, $match) = $regary; |
|
| 403 | + /** |
|
| 404 | 404 | * If it's ">" it will be caught at the top. |
| 405 | 405 | */ |
| 406 | - $attval = preg_replace('/\"/s', '"', $attval); |
|
| 407 | - $attary{$attname} = '"' . $attval . '"'; |
|
| 408 | - } |
|
| 409 | - } elseif (preg_match('|[\w/>]|', $char)) { |
|
| 410 | - /** |
|
| 406 | + $attval = preg_replace('/\"/s', '"', $attval); |
|
| 407 | + $attary{$attname} = '"' . $attval . '"'; |
|
| 408 | + } |
|
| 409 | + } elseif (preg_match('|[\w/>]|', $char)) { |
|
| 410 | + /** |
|
| 411 | 411 | * That was attribute type 4. |
| 412 | 412 | */ |
| 413 | - $attary{$attname} = '"yes"'; |
|
| 414 | - } else { |
|
| 415 | - /** |
|
| 413 | + $attary{$attname} = '"yes"'; |
|
| 414 | + } else { |
|
| 415 | + /** |
|
| 416 | 416 | * An illegal character. Find next '>' and return. |
| 417 | 417 | */ |
| 418 | - $gt = tln_findnxstr($body, $pos, '>'); |
|
| 419 | - return array(false, false, false, $lt, $gt); |
|
| 420 | - } |
|
| 421 | - break; |
|
| 418 | + $gt = tln_findnxstr($body, $pos, '>'); |
|
| 419 | + return array(false, false, false, $lt, $gt); |
|
| 420 | + } |
|
| 421 | + break; |
|
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | /** |
@@ -295,49 +295,49 @@ |
||
| 295 | 295 | foreach ($_SERVER as $key => $val) { |
| 296 | 296 | if (strncmp($key, "HTTP_CONTENT", 11)) continue; |
| 297 | 297 | switch ($key) { |
| 298 | - case 'HTTP_CONTENT_ENCODING': // RFC 2616 14.11 |
|
| 299 | - // TODO support this if ext/zlib filters are available |
|
| 300 | - $this->http_status("501 not implemented"); |
|
| 301 | - echo "The service does not support '$val' content encoding"; |
|
| 302 | - return; |
|
| 298 | + case 'HTTP_CONTENT_ENCODING': // RFC 2616 14.11 |
|
| 299 | + // TODO support this if ext/zlib filters are available |
|
| 300 | + $this->http_status("501 not implemented"); |
|
| 301 | + echo "The service does not support '$val' content encoding"; |
|
| 302 | + return; |
|
| 303 | 303 | |
| 304 | - case 'HTTP_CONTENT_LANGUAGE': // RFC 2616 14.12 |
|
| 305 | - // we assume it is not critical if this one is ignored |
|
| 306 | - // in the actual PUT implementation ... |
|
| 307 | - $options["content_language"] = $val; |
|
| 308 | - break; |
|
| 304 | + case 'HTTP_CONTENT_LANGUAGE': // RFC 2616 14.12 |
|
| 305 | + // we assume it is not critical if this one is ignored |
|
| 306 | + // in the actual PUT implementation ... |
|
| 307 | + $options["content_language"] = $val; |
|
| 308 | + break; |
|
| 309 | 309 | |
| 310 | - case 'HTTP_CONTENT_LOCATION': // RFC 2616 14.14 |
|
| 311 | - /* The meaning of the Content-Location header in PUT |
|
| 310 | + case 'HTTP_CONTENT_LOCATION': // RFC 2616 14.14 |
|
| 311 | + /* The meaning of the Content-Location header in PUT |
|
| 312 | 312 | or POST requests is undefined; servers are free |
| 313 | 313 | to ignore it in those cases. */ |
| 314 | - break; |
|
| 315 | - |
|
| 316 | - case 'HTTP_CONTENT_RANGE': // RFC 2616 14.16 |
|
| 317 | - // single byte range requests are NOT supported |
|
| 318 | - // the header format is also specified in RFC 2616 14.16 |
|
| 319 | - // TODO we have to ensure that implementations support this or send 501 instead |
|
| 320 | - $this->http_status("400 bad request"); |
|
| 321 | - echo "The service does only support single byte ranges"; |
|
| 314 | + break; |
|
| 315 | + |
|
| 316 | + case 'HTTP_CONTENT_RANGE': // RFC 2616 14.16 |
|
| 317 | + // single byte range requests are NOT supported |
|
| 318 | + // the header format is also specified in RFC 2616 14.16 |
|
| 319 | + // TODO we have to ensure that implementations support this or send 501 instead |
|
| 320 | + $this->http_status("400 bad request"); |
|
| 321 | + echo "The service does only support single byte ranges"; |
|
| 322 | + return; |
|
| 323 | + |
|
| 324 | + case 'HTTP_CONTENT_MD5': // RFC 2616 14.15 |
|
| 325 | + // TODO: maybe we can just pretend here? |
|
| 326 | + $this->http_status("501 not implemented"); |
|
| 327 | + echo "The service does not support content MD5 checksum verification"; |
|
| 322 | 328 | return; |
| 323 | 329 | |
| 324 | - case 'HTTP_CONTENT_MD5': // RFC 2616 14.15 |
|
| 325 | - // TODO: maybe we can just pretend here? |
|
| 326 | - $this->http_status("501 not implemented"); |
|
| 327 | - echo "The service does not support content MD5 checksum verification"; |
|
| 328 | - return; |
|
| 329 | - |
|
| 330 | 330 | case 'HTTP_CONTENT_LENGTH': // RFC 2616 14.14 |
| 331 | 331 | /* The meaning of the Content-Location header in PUT |
| 332 | 332 | or POST requests is undefined; servers are free |
| 333 | 333 | to ignore it in those cases. */ |
| 334 | 334 | break; |
| 335 | 335 | |
| 336 | - default: |
|
| 337 | - // any other unknown Content-* headers |
|
| 338 | - $this->http_status("501 not implemented"); |
|
| 339 | - echo "The service does not support '$key'"; |
|
| 340 | - return; |
|
| 336 | + default: |
|
| 337 | + // any other unknown Content-* headers |
|
| 338 | + $this->http_status("501 not implemented"); |
|
| 339 | + echo "The service does not support '$key'"; |
|
| 340 | + return; |
|
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | |
@@ -78,52 +78,52 @@ |
||
| 78 | 78 | { |
| 79 | 79 | $return_array = parent::getMapping($module); |
| 80 | 80 | switch ($module) { |
| 81 | - case 'Contacts': |
|
| 82 | - case 'Leads': |
|
| 83 | - return $return_array + array( |
|
| 84 | - "Web Site"=>"website", |
|
| 85 | - "Company"=>"account_name", |
|
| 86 | - "Name Suffix"=>"salutation", |
|
| 87 | - "Address 1"=>"primary_address_street", |
|
| 88 | - "Address 2"=>"primary_address_street_2", |
|
| 89 | - "Address 3"=>"primary_address_street_3", |
|
| 90 | - "City"=>"primary_address_city", |
|
| 91 | - "State"=>"primary_address_state", |
|
| 92 | - "Zip"=>"primary_address_postalcode", |
|
| 93 | - "Country"=>"primary_address_country", |
|
| 94 | - "Phone"=>"phone_work", |
|
| 95 | - "Phone Ext-"=>"phone_work_ext", |
|
| 96 | - "Mobile Phone"=>"phone_mobile", |
|
| 97 | - "Alt Phone"=>"phone_other", |
|
| 98 | - "Fax"=>"phone_fax", |
|
| 99 | - "E-mail Login"=>"email1", |
|
| 100 | - "E-mail"=>"email1", |
|
| 101 | - "Assistant"=>"assistant", |
|
| 102 | - "Asst. Phone"=>"assistant_phone", |
|
| 103 | - "Home Address 1"=>"alt_address_street", |
|
| 104 | - "Home Address 2"=>"alt_address_street_2", |
|
| 105 | - "Home Address 3"=>"alt_address_street_3", |
|
| 106 | - "Home Zip"=>"alt_address_postalcode", |
|
| 107 | - "Home Country"=>"alt_address_country", |
|
| 108 | - "Home Phone"=>"phone_home", |
|
| 109 | - ); |
|
| 110 | - break; |
|
| 111 | - case 'Accounts': |
|
| 112 | - return $return_array + array( |
|
| 113 | - "Revenue"=>"annual_revenue", |
|
| 114 | - "Number of Employees"=>"employees", |
|
| 115 | - "Address 1"=>"billing_address_street", |
|
| 116 | - "City"=>"billing_address_city", |
|
| 117 | - "State"=>"billing_address_state", |
|
| 118 | - "Zip Code"=>"billing_address_postalcode", |
|
| 119 | - "Country"=>"billing_address_country", |
|
| 120 | - "Phone"=>"phone_office", |
|
| 121 | - "Fax Phone"=>"phone_fax", |
|
| 122 | - "Ticker Symbol"=>"ticker_symbol", |
|
| 123 | - ); |
|
| 124 | - break; |
|
| 125 | - default: |
|
| 126 | - return $return_array; |
|
| 81 | + case 'Contacts': |
|
| 82 | + case 'Leads': |
|
| 83 | + return $return_array + array( |
|
| 84 | + "Web Site"=>"website", |
|
| 85 | + "Company"=>"account_name", |
|
| 86 | + "Name Suffix"=>"salutation", |
|
| 87 | + "Address 1"=>"primary_address_street", |
|
| 88 | + "Address 2"=>"primary_address_street_2", |
|
| 89 | + "Address 3"=>"primary_address_street_3", |
|
| 90 | + "City"=>"primary_address_city", |
|
| 91 | + "State"=>"primary_address_state", |
|
| 92 | + "Zip"=>"primary_address_postalcode", |
|
| 93 | + "Country"=>"primary_address_country", |
|
| 94 | + "Phone"=>"phone_work", |
|
| 95 | + "Phone Ext-"=>"phone_work_ext", |
|
| 96 | + "Mobile Phone"=>"phone_mobile", |
|
| 97 | + "Alt Phone"=>"phone_other", |
|
| 98 | + "Fax"=>"phone_fax", |
|
| 99 | + "E-mail Login"=>"email1", |
|
| 100 | + "E-mail"=>"email1", |
|
| 101 | + "Assistant"=>"assistant", |
|
| 102 | + "Asst. Phone"=>"assistant_phone", |
|
| 103 | + "Home Address 1"=>"alt_address_street", |
|
| 104 | + "Home Address 2"=>"alt_address_street_2", |
|
| 105 | + "Home Address 3"=>"alt_address_street_3", |
|
| 106 | + "Home Zip"=>"alt_address_postalcode", |
|
| 107 | + "Home Country"=>"alt_address_country", |
|
| 108 | + "Home Phone"=>"phone_home", |
|
| 109 | + ); |
|
| 110 | + break; |
|
| 111 | + case 'Accounts': |
|
| 112 | + return $return_array + array( |
|
| 113 | + "Revenue"=>"annual_revenue", |
|
| 114 | + "Number of Employees"=>"employees", |
|
| 115 | + "Address 1"=>"billing_address_street", |
|
| 116 | + "City"=>"billing_address_city", |
|
| 117 | + "State"=>"billing_address_state", |
|
| 118 | + "Zip Code"=>"billing_address_postalcode", |
|
| 119 | + "Country"=>"billing_address_country", |
|
| 120 | + "Phone"=>"phone_office", |
|
| 121 | + "Fax Phone"=>"phone_fax", |
|
| 122 | + "Ticker Symbol"=>"ticker_symbol", |
|
| 123 | + ); |
|
| 124 | + break; |
|
| 125 | + default: |
|
| 126 | + return $return_array; |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | } |
@@ -113,23 +113,23 @@ |
||
| 113 | 113 | break; |
| 114 | 114 | |
| 115 | 115 | |
| 116 | - case '2': |
|
| 117 | - $login=$current_user->getPreference('loginexpiration'); |
|
| 118 | - $current_user->setPreference('loginexpiration',$login+1); |
|
| 119 | - $current_user->save(); |
|
| 120 | - if ($login+1 >= $res[$type.'expirationlogin']){ |
|
| 121 | - $_SESSION['expiration_type']= $mod_strings['LBL_PASSWORD_EXPIRATION_LOGIN']; |
|
| 122 | - return true; |
|
| 123 | - } |
|
| 124 | - else |
|
| 125 | - { |
|
| 126 | - return false; |
|
| 127 | - } |
|
| 128 | - break; |
|
| 129 | - |
|
| 130 | - case '0': |
|
| 131 | - return false; |
|
| 132 | - break; |
|
| 116 | + case '2': |
|
| 117 | + $login=$current_user->getPreference('loginexpiration'); |
|
| 118 | + $current_user->setPreference('loginexpiration',$login+1); |
|
| 119 | + $current_user->save(); |
|
| 120 | + if ($login+1 >= $res[$type.'expirationlogin']){ |
|
| 121 | + $_SESSION['expiration_type']= $mod_strings['LBL_PASSWORD_EXPIRATION_LOGIN']; |
|
| 122 | + return true; |
|
| 123 | + } |
|
| 124 | + else |
|
| 125 | + { |
|
| 126 | + return false; |
|
| 127 | + } |
|
| 128 | + break; |
|
| 129 | + |
|
| 130 | + case '0': |
|
| 131 | + return false; |
|
| 132 | + break; |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | } |
@@ -72,21 +72,21 @@ |
||
| 72 | 72 | $_REQUEST["recaptcha_response_field"]); |
| 73 | 73 | if(!$response->is_valid){ |
| 74 | 74 | switch ($response->error){ |
| 75 | - case 'invalid-site-private-key': |
|
| 76 | - echo $mod_strings['LBL_RECAPTCHA_INVALID_PRIVATE_KEY']; |
|
| 77 | - break; |
|
| 78 | - case 'incorrect-captcha-sol' : |
|
| 79 | - echo $mod_strings['LBL_RECAPTCHA_FILL_FIELD']; |
|
| 80 | - break; |
|
| 81 | - case 'invalid-request-cookie' : |
|
| 82 | - echo $mod_strings['LBL_RECAPTCHA_INVALID_REQUEST_COOKIE']; |
|
| 83 | - break; |
|
| 84 | - case 'unknown' : |
|
| 85 | - echo $mod_strings['LBL_RECAPTCHA_UNKNOWN']; |
|
| 86 | - break; |
|
| 87 | - |
|
| 88 | - default: |
|
| 89 | - echo "Invalid captcha entry, go back and fix. ". $response->error. " "; |
|
| 75 | + case 'invalid-site-private-key': |
|
| 76 | + echo $mod_strings['LBL_RECAPTCHA_INVALID_PRIVATE_KEY']; |
|
| 77 | + break; |
|
| 78 | + case 'incorrect-captcha-sol' : |
|
| 79 | + echo $mod_strings['LBL_RECAPTCHA_FILL_FIELD']; |
|
| 80 | + break; |
|
| 81 | + case 'invalid-request-cookie' : |
|
| 82 | + echo $mod_strings['LBL_RECAPTCHA_INVALID_REQUEST_COOKIE']; |
|
| 83 | + break; |
|
| 84 | + case 'unknown' : |
|
| 85 | + echo $mod_strings['LBL_RECAPTCHA_UNKNOWN']; |
|
| 86 | + break; |
|
| 87 | + |
|
| 88 | + default: |
|
| 89 | + echo "Invalid captcha entry, go back and fix. ". $response->error. " "; |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | else { |