AntonLV 10 tahun lalu
induk
melakukan
54c6a77ffb

+ 1 - 0
modules/boonex/russian/data/langs/bx_timeline/ru.xml

@@ -115,6 +115,7 @@
 
 
 	<string name="_bx_timeline_txt_msg_no_results"><![CDATA[Пусто]]></string>
 	<string name="_bx_timeline_txt_msg_no_results"><![CDATA[Пусто]]></string>
 	<string name="_bx_timeline_txt_err_cannot_perform_action"><![CDATA[Невозможно выполнить действие. Пожалуйста, оповестите нас об этой проблеме.]]></string>
 	<string name="_bx_timeline_txt_err_cannot_perform_action"><![CDATA[Невозможно выполнить действие. Пожалуйста, оповестите нас об этой проблеме.]]></string>
+	<string name="_bx_timeline_txt_err_empty_post"><![CDATA[Сообщение пусто.]]></string>
 
 
 	<string name="_bx_timeline_txt_load_more"><![CDATA[Загрузить ещё]]></string>
 	<string name="_bx_timeline_txt_load_more"><![CDATA[Загрузить ещё]]></string>
 	<string name="_bx_timeline_txt_or_jump_to"><![CDATA[... или перейти к:]]></string>
 	<string name="_bx_timeline_txt_or_jump_to"><![CDATA[... или перейти к:]]></string>

+ 21 - 7
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -670,19 +670,29 @@ class BxTimelineModule extends BxBaseModNotificationsModule
 
 
             //--- Process Text ---//
             //--- Process Text ---//
             $sText = $oForm->getCleanValue('text');
             $sText = $oForm->getCleanValue('text');
+            $sText = $this->_prepareTextForSave($sText);
+            $bText = !empty($sText);
             unset($oForm->aInputs['text']);
             unset($oForm->aInputs['text']);
 
 
-            $aContent['text'] = $this->_prepareTextForSave($sText);
+            if($bText)
+            	$aContent['text'] = $sText;
 
 
             //--- Process Link ---//
             //--- Process Link ---//
             $aLinkIds = $oForm->getCleanValue('link');
             $aLinkIds = $oForm->getCleanValue('link');
+            $bLinkIds = !empty($aLinkIds) && is_array($aLinkIds);
 
 
             //--- Process Media ---//
             //--- Process Media ---//
             $aPhotoIds = $oForm->getCleanValue(BX_TIMELINE_MEDIA_PHOTO);
             $aPhotoIds = $oForm->getCleanValue(BX_TIMELINE_MEDIA_PHOTO);
+            $bPhotoIds = !empty($aPhotoIds) && is_array($aPhotoIds);
+
             $aVideoIds = $oForm->getCleanValue(BX_TIMELINE_MEDIA_VIDEO);
             $aVideoIds = $oForm->getCleanValue(BX_TIMELINE_MEDIA_VIDEO);
+            $bVideoIds = !empty($aVideoIds) && is_array($aVideoIds);
+
+            if(!$bText && !$bLinkIds && !$bPhotoIds && !$bVideoIds)
+            	return array('msg' => _t('_bx_timeline_txt_err_empty_post'));
 
 
             $sTitle = _t('_bx_timeline_txt_user_added_sample', $sUserName, _t('_bx_timeline_txt_sample'));
             $sTitle = _t('_bx_timeline_txt_user_added_sample', $sUserName, _t('_bx_timeline_txt_sample'));
-            $sDescription = !empty($aContent['text']) ? $aContent['text'] : '';
+            $sDescription = $bText ? $sText : '';
 
 
             $iId = $oForm->insert(array(
             $iId = $oForm->insert(array(
                 'object_id' => $iUserId,
                 'object_id' => $iUserId,
@@ -695,17 +705,21 @@ class BxTimelineModule extends BxBaseModNotificationsModule
 
 
             if(!empty($iId)) {
             if(!empty($iId)) {
             	$oMetatags = BxDolMetatags::getObjectInstance($this->_oConfig->getObject('metatags'));
             	$oMetatags = BxDolMetatags::getObjectInstance($this->_oConfig->getObject('metatags'));
- 				$oMetatags->keywordsAdd($iId, $aContent['text']);
+            	if($bText)
+ 					$oMetatags->keywordsAdd($iId, $sText);
  				$oMetatags->locationsAddFromForm($iId, $this->_oConfig->CNF['FIELD_LOCATION_PREFIX']);
  				$oMetatags->locationsAddFromForm($iId, $this->_oConfig->CNF['FIELD_LOCATION_PREFIX']);
 
 
 				//--- Process Link ---//
 				//--- Process Link ---//
-                if(!empty($aLinkIds) && is_array($aLinkIds))
+                if($bLinkIds)
                     foreach($aLinkIds as $iLinkId)
                     foreach($aLinkIds as $iLinkId)
                         $this->_oDb->saveLink($iId, $iLinkId);
                         $this->_oDb->saveLink($iId, $iLinkId);
 
 
-				//--- Process Media ---// 
-				$this->_saveMedia(BX_TIMELINE_MEDIA_PHOTO, $iId, $aPhotoIds);
-				$this->_saveMedia(BX_TIMELINE_MEDIA_VIDEO, $iId, $aVideoIds);
+				//--- Process Media ---//
+				if($bPhotoIds) 
+					$this->_saveMedia(BX_TIMELINE_MEDIA_PHOTO, $iId, $aPhotoIds);
+
+				if($bVideoIds)
+					$this->_saveMedia(BX_TIMELINE_MEDIA_VIDEO, $iId, $aVideoIds);
 
 
                 $this->onPost($iId);
                 $this->onPost($iId);
 
 

+ 1 - 0
modules/boonex/timeline/install/langs/en.xml

@@ -115,6 +115,7 @@
 
 
 	<string name="_bx_timeline_txt_msg_no_results"><![CDATA[Empty]]></string>
 	<string name="_bx_timeline_txt_msg_no_results"><![CDATA[Empty]]></string>
 	<string name="_bx_timeline_txt_err_cannot_perform_action"><![CDATA[Cannot perform action. Please report.]]></string>
 	<string name="_bx_timeline_txt_err_cannot_perform_action"><![CDATA[Cannot perform action. Please report.]]></string>
+	<string name="_bx_timeline_txt_err_empty_post"><![CDATA[The post is empty.]]></string>
 
 
 	<string name="_bx_timeline_txt_load_more"><![CDATA[Load More]]></string>
 	<string name="_bx_timeline_txt_load_more"><![CDATA[Load More]]></string>
 	<string name="_bx_timeline_txt_or_jump_to"><![CDATA[... or jump to:]]></string>
 	<string name="_bx_timeline_txt_or_jump_to"><![CDATA[... or jump to:]]></string>