diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/look.png b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/look.png index 55d7c216..d2eb2a79 100644 Binary files a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/look.png and b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/look.png differ diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/transnum-logo.png b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/transnum-logo.png index 55d7c216..d2eb2a79 100644 Binary files a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/transnum-logo.png and b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/transnum-logo.png differ diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php index 77b470ed..5bd24fbb 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php @@ -1003,86 +1003,94 @@ class PagewidgetController extends Controller $client = new \FeedIo\Adapter\Guzzle\Client($clientguzzle); $logger = new \Psr\Log\NullLogger(); $feedIo = new \FeedIo\FeedIo($client, $logger); - - $result = $feedIo->read($url); - $feedtitle = $result->getFeed()->getTitle(); - - - $backup=[]; - // Pour chaque articles - $nbflux=0; - foreach ($result->getFeed() as $item) { - $title = $item->getTitle(); - $link = $item->getLink(); - $description = substr(strip_tags($item->getDescription()),0,250); - $description = str_replace("¶","",$description); - $date = $item->getLastModified(); - $dateformat = ($date?$item->getLastModified()->format('d/m/Y H:i:s'):""); - $content = $item->getDescription(); - $media = $item->getMedias(); - $mediaurl = ""; - - foreach ($item->getMedias() as $itemMedia) { - if($itemMedia->getType()=="image/jpeg") - $mediaurl=$itemMedia->getUrl(); - } - - foreach ($item->getAllElements() as $element) { - - if($element->getName()=="content:encoded") - $content = $element->getValue(); - } - - if($mediaurl!="") { - $imgurl=$mediaurl; - } - else { - // Récupérer la première image du contenu - $imgcontent=""; - $imgurl=""; - $imgstart = stripos($content,"",$imgstart); - $imgcontent=substr($content,$imgstart,$imgend-$imgstart+1); - - $imgstart = stripos($imgcontent,"src="); - $imgurl=substr($imgcontent,$imgstart+5); - $imgend = stripos($imgurl,'"'); - - if($imgend===false) $imgend = stripos($imgurl,"'"); - $imgurl=substr($imgurl,0,$imgend); - } - } - - // Garder le flux - - $tmp=array( - "feedtitle" => $feedtitle, - "title" => $title, - "link" => $link, - "description" => $description, - "date" => $date, - "dateformat" => $dateformat, - "content" => $content, - "image" => $imgurl, - "color" => $flux->getColor(), - "fluxid" => $flux->getId(), - "fluxtitle" => $flux->getTitle(), - ); - - array_push($feeds,$tmp); - array_push($backup,$tmp); - - $nbflux++; - if($nbflux>=$flux->getMaxread()&&$flux->getMaxread()>0) break; + try { + $result = $feedIo->read($url); + } + catch (\Exception $e) { + $result=null; } - - - if($nbflux==0) unset($fluxs[$keyflux]); - // On sauvegarde le résultat en fichier on rechargera son contenu que s'il n'a pas été lu depuis 30mn - $filesystem->dumpFile($filecache, serialize($backup)); + if($result) { + $feedtitle = $result->getFeed()->getTitle(); + + + $backup=[]; + + // Pour chaque articles + $nbflux=0; + foreach ($result->getFeed() as $item) { + $title = $item->getTitle(); + $link = $item->getLink(); + $description = substr(strip_tags($item->getDescription()),0,250); + $description = str_replace("¶","",$description); + $date = $item->getLastModified(); + $dateformat = ($date?$item->getLastModified()->format('d/m/Y H:i:s'):""); + $content = $item->getDescription(); + $media = $item->getMedias(); + $mediaurl = ""; + + foreach ($item->getMedias() as $itemMedia) { + if($itemMedia->getType()=="image/jpeg") + $mediaurl=$itemMedia->getUrl(); + } + + foreach ($item->getAllElements() as $element) { + + if($element->getName()=="content:encoded") + $content = $element->getValue(); + } + + if($mediaurl!="") { + $imgurl=$mediaurl; + } + else { + // Récupérer la première image du contenu + $imgcontent=""; + $imgurl=""; + $imgstart = stripos($content,"",$imgstart); + $imgcontent=substr($content,$imgstart,$imgend-$imgstart+1); + + $imgstart = stripos($imgcontent,"src="); + $imgurl=substr($imgcontent,$imgstart+5); + $imgend = stripos($imgurl,'"'); + + if($imgend===false) $imgend = stripos($imgurl,"'"); + $imgurl=substr($imgurl,0,$imgend); + } + } + + // Garder le flux + + $tmp=array( + "feedtitle" => $feedtitle, + "title" => $title, + "link" => $link, + "description" => $description, + "date" => $date, + "dateformat" => $dateformat, + "content" => $content, + "image" => $imgurl, + "color" => $flux->getColor(), + "fluxid" => $flux->getId(), + "fluxtitle" => $flux->getTitle(), + ); + + array_push($feeds,$tmp); + array_push($backup,$tmp); + + $nbflux++; + if($nbflux>=$flux->getMaxread()&&$flux->getMaxread()>0) break; + } + + + if($nbflux==0) unset($fluxs[$keyflux]); + + // On sauvegarde le résultat en fichier on rechargera son contenu que s'il n'a pas été lu depuis 30mn + $filesystem->dumpFile($filecache, serialize($backup)); + } } } @@ -1218,82 +1226,90 @@ class PagewidgetController extends Controller $feeds=array(); // On lit le flux rss - $result = $feedIo->read($url); - $feedtitle = $result->getFeed()->getTitle(); - - - // Pour chaque articles - $nbflux=0; - foreach ($result->getFeed() as $item) { - $title = $item->getTitle(); - $link = $item->getLink(); - $description = substr(strip_tags($item->getDescription()),0,250); - $description = str_replace("¶","",$description); - $date = $item->getLastModified(); - $dateformat = ($date?$item->getLastModified()->format('d/m/Y H:i:s'):""); - $content = $item->getDescription(); - $media = $item->getMedias(); - $mediaurl = ""; + try { + $result = $feedIo->read($url); + } + catch (\Exception $e) { + $result=null; + } - foreach ($item->getMedias() as $itemMedia) { - if($itemMedia->getType()=="image/jpeg") - $mediaurl=$itemMedia->getUrl(); - } - - foreach ($item->getAllElements() as $element) { - if($element->getName()=="content:encoded") - $content = $element->getValue(); - } - - if($mediaurl!="") { - $imgurl=$mediaurl; - } - else { - // Récupérer la première image du contenu - $imgcontent=""; - $imgurl=""; - $imgstart = stripos($content,"",$imgstart); - $imgcontent=substr($content,$imgstart,$imgend-$imgstart+1); - - $imgstart = stripos($imgcontent,"src="); - $imgurl=substr($imgcontent,$imgstart+5); - $imgend = stripos($imgurl,'"'); - - if($imgend===false) $imgend = stripos($imgurl,"'"); - $imgurl=substr($imgurl,0,$imgend); - } - } + if($result) { + $feedtitle = $result->getFeed()->getTitle(); - // Garder le flux - array_push($feeds,array( - "feedtitle" => $feedtitle, - "title" => $title, - "link" => $link, - "description" => $description, - "date" => $date, - "dateformat" => $dateformat, - "content" => $content, - "image" => $imgurl, - // "color" => $flux->getColor(), - "fluxid" => 0, - "fluxtitle" => $entity->getName(), - )); + + // Pour chaque articles + $nbflux=0; + foreach ($result->getFeed() as $item) { + $title = $item->getTitle(); + $link = $item->getLink(); + $description = substr(strip_tags($item->getDescription()),0,250); + $description = str_replace("¶","",$description); + $date = $item->getLastModified(); + $dateformat = ($date?$item->getLastModified()->format('d/m/Y H:i:s'):""); + $content = $item->getDescription(); + $media = $item->getMedias(); + $mediaurl = ""; - $nbflux++; - if($nbflux>=$nbarticle&&$nbarticle>0) break; + foreach ($item->getMedias() as $itemMedia) { + if($itemMedia->getType()=="image/jpeg") + $mediaurl=$itemMedia->getUrl(); + } + + foreach ($item->getAllElements() as $element) { + if($element->getName()=="content:encoded") + $content = $element->getValue(); + } + + if($mediaurl!="") { + $imgurl=$mediaurl; + } + else { + // Récupérer la première image du contenu + $imgcontent=""; + $imgurl=""; + $imgstart = stripos($content,"",$imgstart); + $imgcontent=substr($content,$imgstart,$imgend-$imgstart+1); + + $imgstart = stripos($imgcontent,"src="); + $imgurl=substr($imgcontent,$imgstart+5); + $imgend = stripos($imgurl,'"'); + + if($imgend===false) $imgend = stripos($imgurl,"'"); + $imgurl=substr($imgurl,0,$imgend); + } + } + + // Garder le flux + array_push($feeds,array( + "feedtitle" => $feedtitle, + "title" => $title, + "link" => $link, + "description" => $description, + "date" => $date, + "dateformat" => $dateformat, + "content" => $content, + "image" => $imgurl, + // "color" => $flux->getColor(), + "fluxid" => 0, + "fluxtitle" => $entity->getName(), + )); + + $nbflux++; + if($nbflux>=$nbarticle&&$nbarticle>0) break; + } + + + $libelle=array(); + foreach ($feeds as $key => $valeur) { + $libelle[$key] = $valeur["date"]; + } + array_multisort($libelle, SORT_DESC, $feeds); + + // On sauvegarde le résultat en fichier on rechargera son contenu que s'il n'a pas été lu depuis 30mn + $filesystem->dumpFile($filecache, serialize($feeds)); } - - - $libelle=array(); - foreach ($feeds as $key => $valeur) { - $libelle[$key] = $valeur["date"]; - } - array_multisort($libelle, SORT_DESC, $feeds); - - // On sauvegarde le résultat en fichier on rechargera son contenu que s'il n'a pas été lu depuis 30mn - $filesystem->dumpFile($filecache, serialize($feeds)); } // Render diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewflux.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewflux.html.twig index f3c2ba9e..0b9c08c4 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewflux.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewflux.html.twig @@ -56,7 +56,6 @@ {% set firstflux="" %} - {% if fluxs is defined and fluxs is not empty %}
- {% endif %} +