]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'upstream/develop' into 1601-network-performance
authorMichael Vogel <icarus@dabo.de>
Mon, 18 Jan 2016 17:49:04 +0000 (18:49 +0100)
committerMichael Vogel <icarus@dabo.de>
Mon, 18 Jan 2016 17:49:04 +0000 (18:49 +0100)
include/Photo.php
include/network.php
mod/admin.php
mod/parse_url.php
view/global.css
view/templates/admin_federation.tpl

index 30424747da82a33af4ee88c733e0b712f9967e0b..5fdd682e74e4925d40f7514b07c9f75c91a15d47 100644 (file)
@@ -792,15 +792,19 @@ function get_photo_info($url) {
 
                $filesize = strlen($img_str);
 
-               $tempfile = tempnam(get_temppath(), "cache");
+               if (function_exists("getimagesizefromstring"))
+                       $data = getimagesizefromstring($img_str);
+               else {
+                       $tempfile = tempnam(get_temppath(), "cache");
 
-               $a = get_app();
-               $stamp1 = microtime(true);
-               file_put_contents($tempfile, $img_str);
-               $a->save_timestamp($stamp1, "file");
+                       $a = get_app();
+                       $stamp1 = microtime(true);
+                       file_put_contents($tempfile, $img_str);
+                       $a->save_timestamp($stamp1, "file");
 
-               $data = getimagesize($tempfile);
-               unlink($tempfile);
+                       $data = getimagesize($tempfile);
+                       unlink($tempfile);
+               }
 
                if ($data)
                        $data["size"] = $filesize;
index ac5191b259c876306ebd8ae898b94a52cdbc0540..611f00632f4a5d507008b7d9308fa33704f77206 100644 (file)
@@ -1246,6 +1246,9 @@ function original_url($url, $depth=1, $fetchbody = false) {
 
        $a->save_timestamp($stamp1, "network");
 
+       if ($http_code == 0)
+               return($url);
+
        if ((($curl_info['http_code'] == "301") OR ($curl_info['http_code'] == "302"))
                AND (($curl_info['redirect_url'] != "") OR ($curl_info['location'] != ""))) {
                if ($curl_info['redirect_url'] != "")
index 95ab2b0c5a17d1f259be6475a0346785922c3a56..70ef5f75116c1be7e0c2d68e9233628f6c33426c 100644 (file)
@@ -160,7 +160,7 @@ function admin_content(&$a) {
        $aside_tools['plugins_admin']=array();
        foreach ($r as $h){
                $plugin =$h['name'];
-               $aside['plugins_admin'][] = array($a->get_baseurl(true)."/admin/plugins/".$plugin, $plugin, "plugin");
+               $aside_tools['plugins_admin'][] = array($a->get_baseurl(true)."/admin/plugins/".$plugin, $plugin, "plugin");
                // temp plugins with admin
                $a->plugins_admin[] = $plugin;
        }
index 1ca5dc1dacfe60cac9646b6adc913a6a565b26a5..a1ca5a3db5e2e1c831d35bada4b52a3502b54183 100644 (file)
@@ -80,6 +80,7 @@ function parseurl_getsiteinfo_cached($url, $no_guessing = false, $do_oembed = tr
 
 function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $count = 1) {
        require_once("include/network.php");
+       require_once("include/Photo.php");
 
        $a = get_app();
 
@@ -330,7 +331,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
                        $attr[$attribute->name] = $attribute->value;
 
                        $src = completeurl($attr["src"], $url);
-                       $photodata = @getimagesize($src);
+                       $photodata = get_photo_info($src);
 
                        if (($photodata) && ($photodata[0] > 150) and ($photodata[1] > 150)) {
                                if ($photodata[0] > 300) {
@@ -347,12 +348,12 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
                        }
 
                }
-    } else {
+    } elseif ($siteinfo["image"] != "") {
                $src = completeurl($siteinfo["image"], $url);
 
                unset($siteinfo["image"]);
 
-               $photodata = @getimagesize($src);
+               $photodata = get_photo_info($src);
 
                if (($photodata) && ($photodata[0] > 10) and ($photodata[1] > 10))
                        $siteinfo["images"][] = array("src"=>$src,
index ce69e2e27d9e08a64b67ff812b0c54e909fe86d5..8646bf8e448c532ee66165f6f7e77a831c847faf 100644 (file)
@@ -280,6 +280,18 @@ a {
     font-weight: bold;
     color: #00a700;
 }
+.federation-graph {
+    width: 400px; 
+    height: 400px; 
+    float: right; 
+    margin: 20px;
+}
+.federation-network-graph {
+    width: 240px; 
+    height: 240px; 
+    float: left; 
+    margin: 20px;
+}
 ul.federation-stats,
 ul.credits {
   list-style: none;
@@ -289,6 +301,12 @@ ul.credits li {
   float: left;
   width: 240px;
 }
+table#federation-stats {
+    width: 100%;
+}
+td.federation-data {
+    border-bottom: 1px solid #000;
+}
 
 .contact-entry-photo img {
   max-width: 80px;
index b1c56cd0755a25de412c52d157c6e924003e469f..fb751575852c80deba83661f6f3af32ac2752a4a 100644 (file)
@@ -1,5 +1,5 @@
 <script src="{{$baseurl}}/library/Chart.js-1.0.2/Chart.min.js"></script>
-<canvas id="FederationChart" style="width: 400px; height: 400px; float: right; margin: 20px;"></canvas>
+<canvas id="FederationChart" class="federation-graph"></canvas>
 <div id="adminpage">
     <h1>{{$title}} - {{$page}}</h1>
     <p>{{$intro}}</p>
@@ -30,7 +30,7 @@ var myDoughnutChart = new Chart(ctx).Doughnut(FedData,
 document.getElementById('FederationLegend').innerHTML = myDoughnutChart.generateLegend();
 </script>
 
-<table style="width: 100%">
+<table id="federation-stats">
 {{foreach $counts as $c}}
 {{if $c[0]['total'] > 0}}
 <tr>
@@ -39,9 +39,8 @@ document.getElementById('FederationLegend').innerHTML = myDoughnutChart.generate
        <td>{{$c[0]['network']}}</td>
 </tr>
 <tr>
-<td colspan="3" style="border-bottom: 1px solid #000;">
-<canvas id="{{$c[2]}}Chart" style="width: 240px; height: 240px; float: left;
-margin: 20px;"></canvas>
+<td colspan="3" class="federation-data">
+<canvas id="{{$c[2]}}Chart" class="federation-network-graph"></canvas>
 <script>
 var {{$c[2]}}data = [
 {{foreach $c[1] as $v}}
@@ -49,8 +48,7 @@ var {{$c[2]}}data = [
 {{/foreach}}
 ];
 var ctx = document.getElementById("{{$c[2]}}Chart").getContext("2d");
-var my{{$c[2]}}DoughnutChart = new Chart(ctx).Doughnut({{$c[2]}}data,
-{animateRotate : false,});
+var my{{$c[2]}}DoughnutChart = new Chart(ctx).Doughnut({{$c[2]}}data, {animateRotate : false,});
 </script>
 <ul class="federation-stats">
 {{foreach $c[1] as $v}}