]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
provide ability to use different port
[friendica.git] / boot.php
index 0a98399cd495afc41c86105d643d50bcf7ccf3c9..a72fbf6734269b63a822757a369696cfc4794fe5 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1,12 +1,8 @@
 <?php
 
-set_time_limit(0);
-ini_set('pcre.backtrack_limit', 250000);
-
-
-define ( 'FRIENDIKA_VERSION',      '2.2.1037' );
+define ( 'FRIENDIKA_VERSION',      '2.2.1052' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.21'    );
-define ( 'DB_UPDATE_VERSION',      1075      );
+define ( 'DB_UPDATE_VERSION',      1076      );
 
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
@@ -89,6 +85,7 @@ define ( 'PAGE_FREELOVE',          3 );
  * Network and protocol family types 
  */
 
+define ( 'NETWORK_ZOT',              'zot!');    // Zot!
 define ( 'NETWORK_DFRN',             'dfrn');    // Friendika, Mistpark, other DFRN implementations
 define ( 'NETWORK_OSTATUS',          'stat');    // status.net, identi.ca, GNU-social, other OStatus implementations
 define ( 'NETWORK_FEED',             'feed');    // RSS/Atom feeds with no known "post/notify" protocol
@@ -103,6 +100,13 @@ define ( 'NETWORK_FACEBOOK',         'face');    // Facebook API
 
 define ( 'MAX_LIKERS',    75);
 
+/**
+ * Communication timeout
+ */
+
+define ( 'ZCURL_TIMEOUT' , (-1));
+
+
 /**
  * email notification options
  */
@@ -117,6 +121,7 @@ define ( 'NOTIFY_MAIL',    0x0010 );
  * various namespaces we may need to parse
  */
 
+define ( 'NAMESPACE_ZOT',             'http://purl.org/macgirvin/zot' );
 define ( 'NAMESPACE_DFRN' ,           'http://purl.org/macgirvin/dfrn/1.0' ); 
 define ( 'NAMESPACE_THREAD' ,         'http://purl.org/syndication/thread/1.0' );
 define ( 'NAMESPACE_TOMB' ,           'http://purl.org/atompub/tombstones/1.0' );
@@ -130,7 +135,7 @@ define ( 'NAMESPACE_POCO',            'http://portablecontacts.net/spec/1.0' );
 define ( 'NAMESPACE_FEED',            'http://schemas.google.com/g/2010#updates-from' );
 define ( 'NAMESPACE_OSTATUS',         'http://ostatus.org/schema/1.0' );
 define ( 'NAMESPACE_STATUSNET',       'http://status.net/schema/api/1/' );
-
+define ( 'NAMESPACE_ATOM1',           'http://www.w3.org/2005/Atom' );
 /**
  * activity stream defines
  */
@@ -170,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);
+       }
+
 }
 
 /*
@@ -251,11 +264,14 @@ class App {
 
                $this->query_string = '';
 
+               startup();
+
                $this->scheme = ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS']))      ?  'https' : 'http' );
 
                if(x($_SERVER,'SERVER_NAME')) {
                        $this->hostname = $_SERVER['SERVER_NAME'];
-
+                       if(x($_SERVER,'SERVER_PORT') && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443)
+                               $this->hostname .= ':' . $_SERVER['SERVER_PORT'];
                        /** 
                         * Figure out if we are running at the top of a domain
                         * or in a sub-directory and adjust accordingly
@@ -756,15 +772,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));
@@ -2056,6 +2074,9 @@ function get_tags($s) {
                                // we might be inside a bbcode color tag - leave it alone
                                continue;
                        }
+                       // ignore strictly numeric tags like #1
+                       if((strpos($mtch,'#') === 0) && ctype_digit(substr($mtch,1)))
+                               continue;
                        if(substr($mtch,-1,1) === '.')
                                $ret[] = substr($mtch,0,-1);
                        else
@@ -2937,3 +2958,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