X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=7effe308793ee0f6656aae3bd78ba23e450e5b30;hb=020deefba613327a1d8875ba7f2cf9a750be42dd;hp=6993282016d28f76498a040f30dc103fbb4885fd;hpb=7534b8873b7d0e857dbfe4c8085957f8a826ec03;p=friendica.git diff --git a/boot.php b/boot.php index 6993282016..7effe30879 100644 --- a/boot.php +++ b/boot.php @@ -1,12 +1,8 @@ \r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -104,6 +100,13 @@ define ( 'NETWORK_FACEBOOK', 'face'); // Facebook API define ( 'MAX_LIKERS', 75); +/** + * Communication timeout + */ + +define ( 'ZCURL_TIMEOUT' , (-1)); + + /** * email notification options */ @@ -172,20 +175,28 @@ define ( 'GRAVITY_COMMENT', 6); * */ -if (get_magic_quotes_gpc()) { - $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); - while (list($key, $val) = each($process)) { - foreach ($val as $k => $v) { - unset($process[$key][$k]); - if (is_array($v)) { - $process[$key][stripslashes($k)] = $v; - $process[] = &$process[$key][stripslashes($k)]; - } else { - $process[$key][stripslashes($k)] = stripslashes($v); - } - } - } - unset($process); +function startup() { + error_reporting(E_ERROR | E_WARNING | E_PARSE); + set_time_limit(0); + ini_set('pcre.backtrack_limit', 250000); + + + if (get_magic_quotes_gpc()) { + $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); + while (list($key, $val) = each($process)) { + foreach ($val as $k => $v) { + unset($process[$key][$k]); + if (is_array($v)) { + $process[$key][stripslashes($k)] = $v; + $process[] = &$process[$key][stripslashes($k)]; + } else { + $process[$key][stripslashes($k)] = stripslashes($v); + } + } + } + unset($process); + } + } /* @@ -253,6 +264,8 @@ class App { $this->query_string = ''; + startup(); + $this->scheme = ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'])) ? 'https' : 'http' ); if(x($_SERVER,'SERVER_NAME')) { @@ -758,15 +771,17 @@ function post_url($url,$params, $headers = null, &$redirects = 0) { $curl_time = intval(get_config('system','curl_timeout')); curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60)); - if(!is_array($headers)) { - $headers = array('Expect:'); - } else { - if(!in_array('Expect:', $headers)) { - array_push($headers, 'Expect:'); + if(defined('LIGHTTPD')) { + if(!is_array($headers)) { + $headers = array('Expect:'); + } else { + if(!in_array('Expect:', $headers)) { + array_push($headers, 'Expect:'); + } } } - - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + if($headers) + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $check_cert = get_config('system','verifyssl'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false)); @@ -2942,3 +2957,15 @@ function return_bytes ($size_str) { } }} +function generate_guid() { + $found = true; + do { + $guid = substr(random_string(),0,16); + $x = q("SELECT `uid` FROM `user` WHERE `guid` = '%s' LIMIT 1", + dbesc($guid) + ); + if(! count($x)) + $found = false; + } while ($found == true ); + return $guid; +} \ No newline at end of file