BxTimelineConfig.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup Timeline Timeline
  7. * @ingroup DolphinModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxDolPrivacy');
  12. bx_import('BxDolModuleConfig');
  13. class BxTimelineConfig extends BxDolModuleConfig
  14. {
  15. protected $_oDb;
  16. protected $_sAlertSystemName;
  17. protected $_sCommentSystemName;
  18. protected $_bAllowDelete;
  19. protected $_bAllowGuestComments;
  20. protected $_iPerPageProfile;
  21. protected $_iPerPageAccount;
  22. protected $_iRssLength;
  23. protected $_iCharsDisplayMax;
  24. protected $_aHandlers;
  25. protected $_aHandlersHidden;
  26. protected $_sStorageObject;
  27. protected $_sTranscoderObjectPreview;
  28. protected $_aImageUploaders;
  29. protected $_sConnObjSubscriptions;
  30. protected $_sMenuPost;
  31. protected $_sMenuItemManage;
  32. protected $_sMenuItemActions;
  33. protected $_bJsMode;
  34. protected $_aJsClass;
  35. protected $_aJsObjects;
  36. protected $_sAnimationEffect;
  37. protected $_iAnimationSpeed;
  38. protected $_sStylePrefix;
  39. protected $_sCommonPostPrefix;
  40. protected $_iPrivacyViewDefault;
  41. protected $_iTimelineVisibilityThreshold;
  42. /**
  43. * Constructor
  44. */
  45. public function __construct($aModule)
  46. {
  47. parent::BxDolModuleConfig($aModule);
  48. $this->_sAlertSystemName = $this->_sName;
  49. $this->_sCommentSystemName = $this->_sName;
  50. $this->_aHandlersHidden = array();
  51. $this->_aHandlers = array();
  52. $this->_sStorageObject = 'bx_timeline_photos';
  53. $this->_sTranscoderObjectPreview = 'bx_timeline_photos_preview';
  54. $this->_aImageUploaders = array('bx_timeline_simple');
  55. $this->_sConnObjSubscriptions = 'sys_profiles_subscriptions';
  56. $this->_sMenuPost = 'bx_timeline_menu_post';
  57. $this->_sMenuItemManage = 'bx_timeline_menu_item_manage';
  58. $this->_sMenuItemActions = 'bx_timeline_menu_item_actions';
  59. $this->_bJsMode = false;
  60. $this->_aJsClass = array(
  61. 'main' => 'BxTimelineMain',
  62. 'post' => 'BxTimelinePost',
  63. 'view' => 'BxTimelineView'
  64. );
  65. $this->_aJsObjects = array(
  66. 'post' => 'oTimelinePost',
  67. 'view' => 'oTimelineView'
  68. );
  69. $this->_sAnimationEffect = 'fade';
  70. $this->_iAnimationSpeed = 'slow';
  71. $this->_sStylePrefix = 'bx-tl';
  72. $this->_sCommonPostPrefix = 'timeline_common_';
  73. $this->_iPrivacyViewDefault = BX_DOL_PG_ALL;
  74. $this->_iTimelineVisibilityThreshold = 0;
  75. }
  76. public function init(&$oDb)
  77. {
  78. $this->_oDb = &$oDb;
  79. $this->_bAllowDelete = $this->_oDb->getParam('bx_timeline_enable_delete') == 'on';
  80. $this->_bAllowGuestComments = $this->_oDb->getParam('bx_timeline_enable_guest_comments') == 'on';
  81. $this->_iPerPageProfile = (int)$this->_oDb->getParam('bx_timeline_events_per_page_profile');
  82. $this->_iPerPageAccount = (int)$this->_oDb->getParam('bx_timeline_events_per_page_account');
  83. $this->_iRssLength = (int)$this->_oDb->getParam('bx_timeline_rss_length');
  84. $this->_iCharsDisplayMax = (int)$this->_oDb->getParam('bx_timeline_chars_display_max');
  85. $aHandlers = $this->_oDb->getHandlers();
  86. foreach($aHandlers as $aHandler) {
  87. if($aHandler['type'] === BX_TIMELINE_HANDLER_TYPE_INSERT && !empty($aHandler['content'])) {
  88. $aContent = unserialize($aHandler['content']);
  89. if(is_array($aContent) && !empty($aContent))
  90. $aHandler = array_merge($aHandler, $aContent);
  91. }
  92. $this->_aHandlers[$aHandler['alert_unit'] . '_' . $aHandler['alert_action']] = $aHandler;
  93. }
  94. $sHideTimeline = $this->_oDb->getParam('bx_timeline_events_hide');
  95. if(!empty($sHideTimeline))
  96. $this->_aHandlersHidden = explode(',', $sHideTimeline);
  97. }
  98. public function isAllowDelete()
  99. {
  100. return $this->_bAllowDelete;
  101. }
  102. public function isAllowGuestComments()
  103. {
  104. return $this->_bAllowGuestComments;
  105. }
  106. public function getSystemName($sType)
  107. {
  108. $sResult = '';
  109. switch($sType) {
  110. case 'alert':
  111. $sResult = $this->_sAlertSystemName;
  112. break;
  113. case 'comment':
  114. $sResult = $this->_sCommentSystemName;
  115. break;
  116. }
  117. return $sResult;
  118. }
  119. public function getPrefix($sType)
  120. {
  121. $sResult = '';
  122. switch($sType) {
  123. case 'common_post':
  124. $sResult = $this->_sCommonPostPrefix;
  125. break;
  126. case 'style':
  127. $sResult = $this->_sStylePrefix;
  128. break;
  129. }
  130. return $sResult;
  131. }
  132. public function getObject($sType)
  133. {
  134. $sResult = '';
  135. switch($sType) {
  136. case 'storage':
  137. $sResult = $this->_sStorageObject;
  138. break;
  139. case 'transcoder_preview':
  140. $sResult = $this->_sTranscoderObjectPreview;
  141. break;
  142. case 'conn_subscriptions':
  143. $sResult = $this->_sConnObjSubscriptions;
  144. break;
  145. case 'menu_post':
  146. $sResult = $this->_sMenuPost;
  147. break;
  148. case 'menu_item_manage':
  149. $sResult = $this->_sMenuItemManage;
  150. break;
  151. case 'menu_item_actions':
  152. $sResult = $this->_sMenuItemActions;
  153. break;
  154. }
  155. return $sResult;
  156. }
  157. public function getUploaders($sType)
  158. {
  159. $aResult = '';
  160. switch($sType) {
  161. case 'image':
  162. $aResult = $this->_aImageUploaders;
  163. break;
  164. }
  165. return $aResult;
  166. }
  167. public function getPerPage($sPage = 'profile')
  168. {
  169. $iResult = 10;
  170. switch($sPage) {
  171. case 'profile':
  172. $iResult = $this->_iPerPageProfile;
  173. break;
  174. case 'account':
  175. $iResult = $this->_iPerPageAccount;
  176. break;
  177. }
  178. return $iResult;
  179. }
  180. public function getRssLength()
  181. {
  182. return $this->_iRssLength;
  183. }
  184. public function getCharsDisplayMax()
  185. {
  186. return $this->_iCharsDisplayMax;
  187. }
  188. public function isHandler($sKey = '')
  189. {
  190. return isset($this->_aHandlers[$sKey]);
  191. }
  192. public function getHandlers($sKey = '')
  193. {
  194. if($sKey == '')
  195. return $this->_aHandlers;
  196. return $this->_aHandlers[$sKey];
  197. }
  198. public function getHandlersHidden()
  199. {
  200. return $this->_aHandlersHidden;
  201. }
  202. public function isJsMode()
  203. {
  204. return $this->_bJsMode;
  205. }
  206. public function getJsMode()
  207. {
  208. return $this->_bJsMode;
  209. }
  210. public function setJsMode($bJsMode)
  211. {
  212. $this->_bJsMode = $bJsMode;
  213. }
  214. public function getJsClass($sType)
  215. {
  216. return $this->_aJsClass[$sType];
  217. }
  218. public function getJsObject($sType)
  219. {
  220. return $this->_aJsObjects[$sType];
  221. }
  222. public function getAnimationEffect()
  223. {
  224. return $this->_sAnimationEffect;
  225. }
  226. public function getAnimationSpeed()
  227. {
  228. return $this->_iAnimationSpeed;
  229. }
  230. public function getPrivacyViewDefault()
  231. {
  232. return $this->_iPrivacyViewDefault;
  233. }
  234. public function getTimelineVisibilityThreshold()
  235. {
  236. return $this->_iTimelineVisibilityThreshold;
  237. }
  238. }
  239. /** @} */