浏览代码

Anomalie #454: Vidéos youtube non prises en charge

Sevajol Bastien 12 年前
父节点
当前提交
b943e2322a
共有 2 个文件被更改,包括 7 次插入4 次删除
  1. 6 3
      src/Muzich/CoreBundle/Entity/Element.php
  2. 1 1
      src/Muzich/CoreBundle/Managers/ElementManager.php

+ 6 - 3
src/Muzich/CoreBundle/Entity/Element.php 查看文件

724
   
724
   
725
   public function hasFavoriteUser($user_id)
725
   public function hasFavoriteUser($user_id)
726
   {
726
   {
727
-    foreach ($this->elements_favorites as $favorite)
727
+    if (count($this->elements_favorites))
728
     {
728
     {
729
-      if ($favorite->getUser()->getId() == $user_id)
729
+      foreach ($this->elements_favorites as $favorite)
730
       {
730
       {
731
-        return true;
731
+        if ($favorite->getUser()->getId() == $user_id)
732
+        {
733
+          return true;
734
+        }
732
       }
735
       }
733
     }
736
     }
734
     
737
     

+ 1 - 1
src/Muzich/CoreBundle/Managers/ElementManager.php 查看文件

101
     // On ne prend pas de risque avec le www, on l'enlève
101
     // On ne prend pas de risque avec le www, on l'enlève
102
     $url = str_replace('www.', '', $this->element->getUrl());
102
     $url = str_replace('www.', '', $this->element->getUrl());
103
     
103
     
104
-    preg_match("/^(http:\/\/)?([^\/]+)/i", $url, $chaines);
104
+    preg_match("/^(http:\/\/|https:\/\/)?([^\/]+)/i", $url, $chaines);
105
     
105
     
106
     $type = 'unknow';
106
     $type = 'unknow';
107
     if (array_key_exists(2, $chaines))
107
     if (array_key_exists(2, $chaines))