Browse Source

Ticket #3157 - Points №1 and 2.

AntonLV 5 năm trước cách đây
mục cha
commit
8dc6ac581f

+ 12 - 0
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -409,6 +409,18 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
         if(empty($sUrl))
             return echoJson(array());
 
+        $sHeader = 'Content-Type';
+        $aHeaders = get_headers($sUrl, 1);
+        if(!empty($aHeaders) && is_array($aHeaders) && !empty($aHeaders[$sHeader])) {
+            $mixedContentType = $aHeaders[$sHeader];
+            if(!is_array($mixedContentType))
+                $mixedContentType = array($mixedContentType);
+
+            foreach($mixedContentType as $sContentType)
+                if(strpos($sContentType, 'image') !== false) 
+                    return echoJson(array());
+        }
+
         $iEventId = 0;
         if(bx_get('event_id') !== false)
             $iEventId = (int)bx_get('event_id');

+ 5 - 1
modules/boonex/timeline/js/post.js

@@ -276,8 +276,12 @@ BxTimelinePost.prototype.addAttachLink = function(oElement, sUrl)
             //--- Mark that 'attach link' process was finished.
             $this._oAttachedLinks[sUrl] = oData.id;
 
+            var iEventId = 0;
+            if(oData && oData.event_id != undefined)
+                iEventId = parseInt(oData.event_id);
+
             var oItem = $(oData.item).hide();
-            $('#' + $this._aHtmlIds['attach_link_form_field']).prepend(oItem).find('#' + oItem.attr('id')).bx_anim('show', $this._sAnimationEffect, $this._sAnimationSpeed);
+            $('#' + $this._aHtmlIds['attach_link_form_field'] + iEventId).prepend(oItem).find('#' + oItem.attr('id')).bx_anim('show', $this._sAnimationEffect, $this._sAnimationSpeed);
         },
         'json'
     );