]> git.mxchange.org Git - friendica.git/commitdiff
The useragent string doesn't contains of the words "Mozilla" anymore - but the name...
authorMichael Vogel <icarus@dabo.de>
Sun, 7 Sep 2014 08:47:37 +0000 (10:47 +0200)
committerMichael Vogel <icarus@dabo.de>
Sun, 7 Sep 2014 08:47:37 +0000 (10:47 +0200)
boot.php
include/bbcode.php
include/network.php
mod/parse_url.php

index 5ef24f4944b7060ad5483211e468a3233f4a187f..bea1fc74c9d57aeeeffa22e53f0d9b33ae19b121 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -865,6 +865,10 @@ if(! class_exists('App')) {
                        $this->performance["markstart"] = microtime(true) - $this->performance["markstart"] - $this->performance["marktime"];
                }
 
+               function get_useragent() {
+                       return(FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION."; ".$this->get_baseurl());
+               }
+
        }
 }
 
index 017673423b50aaa7080cfb1a75a3da890207f070..25d60647f32f2c8ea96ca0170eb91ff22fc49bdf 100644 (file)
@@ -674,10 +674,12 @@ function bb_RemovePictureLinks($match) {
        $text = Cache::get($match[1]);
 
        if(is_null($text)){
+               $a = get_app();
+
                $ch = @curl_init($match[1]);
                @curl_setopt($ch, CURLOPT_NOBODY, true);
                @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-               @curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")");
+               @curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
                @curl_exec($ch);
                $curl_info = @curl_getinfo($ch);
 
@@ -722,10 +724,12 @@ function bb_CleanPictureLinksSub($match) {
        $text = Cache::get($match[1]);
 
        if(is_null($text)){
+               $a = get_app();
+
                $ch = @curl_init($match[1]);
                @curl_setopt($ch, CURLOPT_NOBODY, true);
                @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-               @curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")");
+               @curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
                @curl_exec($ch);
                $curl_info = @curl_getinfo($ch);
 
index 4c6af8e71b45e0e599b4dc7c5c67394f33f67f79..0f6e61705e55ff7bb480f8e215cc59380a30ad58 100644 (file)
@@ -35,7 +35,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
        }
 
        @curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
-       @curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")");
+       @curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
 
 
        if(intval($timeout)) {
@@ -134,7 +134,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0)
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
        curl_setopt($ch, CURLOPT_POST,1);
        curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
-       curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")");
+       curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
 
        if(intval($timeout)) {
                curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
@@ -1114,6 +1114,8 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority =
 
 function original_url($url, $depth=1, $fetchbody = false) {
 
+       $a = get_app();
+
        // Remove Analytics Data from Google and other tracking platforms
        $urldata = parse_url($url);
        if (is_string($urldata["query"])) {
@@ -1163,7 +1165,7 @@ function original_url($url, $depth=1, $fetchbody = false) {
 
         curl_setopt($ch, CURLOPT_TIMEOUT, 10);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-       curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")");
+       curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
 
         $header = curl_exec($ch);
         $curl_info = @curl_getinfo($ch);
index 5048f4fa53903ac6ea90d74eb7d827ff6928cf54..4953b8f4cb23efc5a492e51858cd0168f4a830a6 100644 (file)
@@ -52,6 +52,8 @@ function completeurl($url, $scheme) {
 
 function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $count = 1) {
 
+       $a = get_app();
+
        $siteinfo = array();
 
        if ($count > 10) {
@@ -71,7 +73,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
        curl_setopt($ch, CURLOPT_TIMEOUT, 3);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
-       curl_setopt($ch,CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")");
+       curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
 
        $header = curl_exec($ch);
        $curl_info = @curl_getinfo($ch);