Просмотр исходного кода

Merge branch 'master' of github.com:unaio/una

Alex Trofimov 9 лет назад
Родитель
Сommit
a434f7e7fd
49 измененных файлов с 708 добавлено и 420 удалено
  1. 11 4
      inc/classes/BxDolAcl.php
  2. 1 4
      inc/classes/BxDolCronPruning.php
  3. 5 26
      inc/classes/BxDolView.php
  4. 2 0
      install/sql/system.sql
  5. 7 7
      modules/base/general/classes/BxBaseModGeneralModule.php
  6. 1 1
      modules/base/general/template/css/main.css
  7. 1 1
      modules/base/general/template/entry-share.html
  8. 2 2
      modules/boonex/albums/install/sql/install.sql
  9. 24 1
      modules/boonex/convos/classes/BxCnvFormEntry.php
  10. 2 2
      modules/boonex/convos/install/sql/enable.sql
  11. 4 4
      modules/boonex/english/data/langs/system/en.xml
  12. 3 3
      modules/boonex/events/install/sql/enable.sql
  13. 21 1
      modules/boonex/forum/classes/BxForumModule.php
  14. 2 2
      modules/boonex/forum/install/sql/enable.sql
  15. 3 3
      modules/boonex/groups/install/sql/enable.sql
  16. 2 2
      modules/boonex/market/install/sql/install.sql
  17. 3 3
      modules/boonex/organizations/install/sql/enable.sql
  18. 3 3
      modules/boonex/persons/install/sql/enable.sql
  19. 2 2
      modules/boonex/posts/install/sql/install.sql
  20. 28 10
      modules/boonex/russian/data/langs/bx_timeline/ru.xml
  21. 4 4
      modules/boonex/russian/data/langs/system/ru.xml
  22. 14 14
      modules/boonex/timeline/classes/BxTimelineConfig.php
  23. 24 24
      modules/boonex/timeline/classes/BxTimelineDb.php
  24. 2 12
      modules/boonex/timeline/classes/BxTimelineMenuItemActions.php
  25. 13 30
      modules/boonex/timeline/classes/BxTimelineMenuItemManage.php
  26. 106 0
      modules/boonex/timeline/classes/BxTimelineMenuItemShare.php
  27. 90 64
      modules/boonex/timeline/classes/BxTimelineModule.php
  28. 1 1
      modules/boonex/timeline/classes/BxTimelineSearchResult.php
  29. 96 77
      modules/boonex/timeline/classes/BxTimelineTemplate.php
  30. 41 0
      modules/boonex/timeline/install/installer.php
  31. 28 11
      modules/boonex/timeline/install/langs/en.xml
  32. 4 0
      modules/boonex/timeline/install/sql/disable.sql
  33. 44 12
      modules/boonex/timeline/install/sql/enable.sql
  34. 6 6
      modules/boonex/timeline/install/sql/install.sql
  35. 2 0
      modules/boonex/timeline/install/sql/uninstall.sql
  36. 16 0
      modules/boonex/timeline/js/main.js
  37. 25 19
      modules/boonex/timeline/js/repost.js
  38. 48 0
      modules/boonex/timeline/template/css/repost.css
  39. 0 48
      modules/boonex/timeline/template/css/share.css
  40. 5 5
      modules/boonex/timeline/template/css/view.css
  41. 0 0
      modules/boonex/timeline/template/repost_by_list.html
  42. 0 0
      modules/boonex/timeline/template/repost_counter.html
  43. 7 0
      modules/boonex/timeline/template/repost_element_block.html
  44. 0 7
      modules/boonex/timeline/template/share_element_block.html
  45. 1 1
      modules/boonex/timeline/template/type_repost.html
  46. 1 1
      template/scripts/BxBaseFavorite.php
  47. 1 1
      template/scripts/BxBaseReport.php
  48. 1 1
      template/scripts/BxBaseView.php
  49. 1 1
      template/scripts/BxBaseVote.php

+ 11 - 4
inc/classes/BxDolAcl.php

@@ -182,16 +182,23 @@ class BxDolAcl extends BxDolFactory implements iBxDolSingleton
 
     /**
      * Check if member has one of the provided membership levels
-     * @param $iPermissions - integer value to check permissions for, every bit is matched with some membership id
+     * @param $mixedPermissions - integer value (every bit is matched with some membership ID) or an array of membership IDs to check permissions for
      * @param $iProfileId - profile to check, if it isn't provided or is false then currently logged in profile is used.
      * @return true if member has privided membership levels, or false if member hasn't.
      */
-    public function isMemberLevelInSet($iPermissions, $iProfileId = false)
+    public function isMemberLevelInSet($mixedPermissions, $iProfileId = false)
     {
-        if (!$iPermissions)
+        $iPermissions = 0;
+        if(is_array($mixedPermissions))
+            foreach($mixedPermissions as $iPermissionId)
+                $iPermissions += pow(2, $iPermissionId - 1);
+        else if(is_numeric($mixedPermissions))
+            $iPermissions = (int)$mixedPermissions;
+
+        if(!$iPermissions)
             return false;
 
-        if (false === $iProfileId) {
+        if(false === $iProfileId) {
             $oProfile = BxDolProfile::getInstance();
             $iProfileId = $oProfile ? $oProfile->id() : 0;
         }

+ 1 - 4
inc/classes/BxDolCronPruning.php

@@ -44,9 +44,6 @@ class BxDolCronPruning extends BxDolCron
         $oSession = BxDolSession::getInstance();
         $iSessions = $oSession ? $oSession->maintenance() : 0;
 
-        // clean old views
-        $iDeletedViews = BxDolView::maintenance ();
-
         // clean storage engine expired private file tokens
         $iDeletedExpiredTokens = BxDolStorage::pruning();
 
@@ -57,7 +54,7 @@ class BxDolCronPruning extends BxDolCron
         $oKey = BxDolKey::getInstance();
         $iDeletedKeys = $oKey ? $oKey->prune() : 0;
 
-        echo _t('_sys_pruning_db', $iDeleteMemLevels, $iSessions, $iDeletedViews, $iDeletedKeys, $iDeletedExpiredTokens, $iDeletedTranscodedImages);
+        echo _t('_sys_pruning_db', $iDeleteMemLevels, $iSessions, $iDeletedKeys, $iDeletedExpiredTokens, $iDeletedTranscodedImages);
     }
 
     /**

+ 5 - 26
inc/classes/BxDolView.php

@@ -104,6 +104,7 @@ class BxDolView extends BxDolObject
                     `is_on` AS `is_on`,
                     `trigger_table` AS `trigger_table`,
                     `trigger_field_id` AS `trigger_field_id`,
+                    `trigger_field_author` AS `trigger_field_author`,
                     `trigger_field_count` AS `trigger_field_count`,
                     `class_name` AS `class_name`,
                     `class_file` AS `class_file`
@@ -112,30 +113,6 @@ class BxDolView extends BxDolObject
         return $GLOBALS['bx_dol_view_systems'];
     }
 
-    /**
-     * it is called on cron every day or similar period to clean old votes
-     */
-    public static function maintenance()
-    {
-        $iResult = 0;
-        $oDb = BxDolDb::getInstance();
-
-        $aSystems = self::getSystems();
-        foreach($aSystems as $aSystem) {
-            if(!$aSystem['is_on'])
-                continue;
-
-            $sQuery = $oDb->prepare("DELETE FROM `{$aSystem['table_track']}` WHERE `date` < (UNIX_TIMESTAMP() - ?)", BX_DOL_VIEW_OLD_VIEWS);
-            $iDeleted = (int)$oDb->query($sQuery);
-            if($iDeleted > 0)
-                $oDb->query("OPTIMIZE TABLE `{$aSystem['table_track']}`");
-
-            $iResult += $iDeleted;
-        }
-
-        return $iResult;
-    }
-
     public function actionGetViewedBy()
     {
         if (!$this->isEnabled())
@@ -185,10 +162,12 @@ class BxDolView extends BxDolObject
 
     public function isAllowedViewViewViewers($isPerformAction = false)
     {
-        if(isAdmin())
+        $oAcl = BxDolAcl::getInstance();
+        if(isAdmin() || $oAcl->isMemberLevelInSet(array(MEMBERSHIP_ID_MODERATOR, MEMBERSHIP_ID_ADMINISTRATOR)))
             return true;
 
-        return $this->checkAction('view_view_viewers', $isPerformAction);
+        $iObjectAuthorId = $this->_oQuery->getObjectAuthorId($this->_iId);
+        return $iObjectAuthorId != 0 && $iObjectAuthorId == $this->_getAuthorId() && $this->checkAction('view_view_viewers', $isPerformAction);
     }
 
 	/**

+ 2 - 0
install/sql/system.sql

@@ -235,6 +235,7 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex
 (@iCategoryId, 'sys_template_cache_image_max_size', '_adm_stg_cpt_option_sys_template_cache_image_max_size', '5', 'digit', '', '', '', 21),
 
 (@iCategoryId, 'sys_email_confirmation', '_adm_stg_cpt_option_sys_email_confirmation', 'on', 'checkbox', '', '', '', 30),
+(@iCategoryId, 'sys_email_attachable_email_templates', '_adm_stg_cpt_option_sys_email_attachable_email_templates', '', 'digit', '', '', '', 31),
 
 (@iCategoryId, 'sys_redirect_after_account_added', '_adm_stg_cpt_option_sys_redirect_after_account_added', 'page.php?i=account-profile-switcher', 'digit', '', '', '', 40),
 
@@ -1198,6 +1199,7 @@ CREATE TABLE `sys_objects_view` (
   `is_on` tinyint(4) NOT NULL default '1',
   `trigger_table` varchar(32) NOT NULL,
   `trigger_field_id` varchar(32) NOT NULL,
+  `trigger_field_author` varchar(32) NOT NULL,
   `trigger_field_count` varchar(32) NOT NULL,
   `class_name` varchar(32) NOT NULL default '',
   `class_file` varchar(256) NOT NULL default '',

+ 7 - 7
modules/base/general/classes/BxBaseModGeneralModule.php

@@ -873,11 +873,11 @@ class BxBaseModGeneralModule extends BxDolModule
         if ($oFavorites)
             $sFavorites = $oFavorites->getElementBlock(array('show_do_favorite_as_button' => true));
 
-        //--- Timeline Repost (Internal Share)
-        $sShare = '';
+        //--- Timeline Repost
+        $sRepost = '';
         $iIdTimeline = isset($aParams['id_timeline']) ? (int)$aParams['id_timeline'] : $iId;
-        if ($iIdTimeline && BxDolRequest::serviceExists('bx_timeline', 'get_share_element_block'))
-            $sShare = BxDolService::call('bx_timeline', 'get_share_element_block', array(bx_get_logged_profile_id(), $this->_aModule['name'], 'added', $iIdTimeline, array('show_do_share_as_button' => true)));
+        if ($iIdTimeline && BxDolRequest::serviceExists('bx_timeline', 'get_repost_element_block'))
+            $sRepost = BxDolService::call('bx_timeline', 'get_repost_element_block', array(bx_get_logged_profile_id(), $this->_aModule['name'], 'added', $iIdTimeline, array('show_do_repost_as_button' => true)));
 
         //--- Report
 		$sReport = '';
@@ -887,7 +887,7 @@ class BxBaseModGeneralModule extends BxDolModule
 
         $sSocial = $bSocialSharing ? BxTemplSocialSharing::getInstance()->getCode($iId, $this->_aModule['name'], BX_DOL_URL_ROOT . $sUrl, $sTitle, $aCustomParams) : '';
 
-        if(empty($sComments) && empty($sVotes) && empty($sFavorites) && empty($sShare) && empty($sReport) && empty($sSocial))
+        if(empty($sComments) && empty($sVotes) && empty($sFavorites) && empty($sRepost) && empty($sReport) && empty($sSocial))
             return '';
 
         return $this->_oTemplate->parseHtmlByName('entry-share.html', array(
@@ -895,11 +895,11 @@ class BxBaseModGeneralModule extends BxDolModule
         	'view' => $sViews,
             'vote' => $sVotes,
             'favorite' => $sFavorites,
-            'share' => $sShare,
+            'repost' => $sRepost,
         	'report' => $sReport,
             'social' => $sSocial,
         ));
-        //TODO: Rebuild using menus engine when it will be ready for such elements like Vote, Share, etc.
+        //TODO: Rebuild using menus engine when it will be ready for such elements like Vote, Repost, etc.
     }
 }
 

+ 1 - 1
modules/base/general/template/css/main.css

@@ -8,7 +8,7 @@
 .bx-base-general-entity-share .bx-vote,
 .bx-base-general-entity-share .bx-favorite,
 .bx-base-general-entity-share .bx-report,
-.bx-base-general-entity-share .bx-tl-share,
+.bx-base-general-entity-share .bx-tl-repost,
 .bx-base-general-entity-share .bx-social-sharing {
 	position: relative;
 	float: left;

+ 1 - 1
modules/base/general/template/entry-share.html

@@ -1 +1 @@
-<div class="bx-base-general-entity-share bx-clearfix">__comments____view____vote____favorite____share____report____social__</div>
+<div class="bx-base-general-entity-share bx-clearfix">__comments____view____vote____favorite____repost____report____social__</div>

+ 2 - 2
modules/boonex/albums/install/sql/install.sql

@@ -357,9 +357,9 @@ INSERT INTO `sys_objects_report` (`name`, `table_main`, `table_track`, `is_on`,
 
 -- VIEWS
 
-INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
+INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
 ('bx_albums', 'bx_albums_views_track', '86400', '1', 'bx_albums_albums', 'id', 'views', '', ''),
-('bx_albums_media', 'bx_albums_views_media_track', '86400', '1', 'bx_albums_files2albums', 'id', 'views', '', '');
+('bx_albums_media', 'bx_albums_views_media_track', '86400', '1', 'bx_albums_files2albums', 'id', 'author', 'views', '', '');
 
 -- FAFORITES
 INSERT INTO `sys_objects_favorite` (`name`, `table_track`, `is_on`, `is_undo`, `is_public`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 

+ 24 - 1
modules/boonex/convos/classes/BxCnvFormEntry.php

@@ -140,7 +140,30 @@ class BxCnvFormEntry extends BxBaseModTextFormEntry
             $a = array_unique(BxDolFormCheckerHelper::passInt($a));
             if ($a)
                 $aValues['recipients'] = array_merge(empty($aValues['recipients']) ? array() : $aValues['recipients'], $a);            
-        }        
+        }
+
+        $sEt = bx_get('et');
+        if($sEt !== false) { // if 'attachable email template' was specified, process it
+            $aEt = unserialize(base64_decode(urldecode($sEt)));
+
+            if(!empty($aEt) && is_array($aEt) && !empty($aEt['name'])) {
+                $sName = bx_process_input($aEt['name']);
+                $aParams = isset($aEt['params']) ? bx_process_input($aEt['params']) : array();
+
+                $sAet = getParam('sys_email_attachable_email_templates');
+                if(strpos($sAet, $sName) !== false) {
+                    $aTemplate = BxDolEmailTemplates::getInstance()->parseTemplate($sName, $aParams);
+                    if(!empty($aTemplate) && is_array($aTemplate)) {
+                        if(isset($this->aInputs[$CNF['FIELD_TITLE']]) && empty($this->aInputs[$CNF['FIELD_TITLE']]['value']))
+                            $this->aInputs[$CNF['FIELD_TITLE']]['value'] = $aTemplate['Subject'];
+
+                        if(isset($this->aInputs[$CNF['FIELD_TEXT']]) && empty($this->aInputs[$CNF['FIELD_TEXT']]['value']))
+                            $this->aInputs[$CNF['FIELD_TEXT']]['value'] = $aTemplate['Body'];
+                    }
+                }
+            }
+            
+        }
 
         return parent::initChecker ($aValues, $aSpecificValues);
     }

+ 2 - 2
modules/boonex/convos/install/sql/enable.sql

@@ -186,8 +186,8 @@ INSERT INTO `sys_objects_cmts` (`Name`, `Table`, `CharsPostMin`, `CharsPostMax`,
 ('bx_convos', 'bx_convos_cmts', 1, 5000, 1000, 1, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-convo&id={object_id}', '', 'bx_convos_conversations', 'id', 'author', '', 'comments', 'BxCnvCmts', 'modules/boonex/convos/classes/BxCnvCmts.php');
 
 -- VIEWS
-INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
-('bx_convos', 'bx_convos_views_track', '86400', '1', 'bx_convos_conversations', 'id', 'views', '', '');
+INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
+('bx_convos', 'bx_convos_views_track', '86400', '1', 'bx_convos_conversations', 'id', 'author', 'views', '', '');
 
 -- ALERTS
 

+ 4 - 4
modules/boonex/english/data/langs/system/en.xml

@@ -1218,6 +1218,7 @@
 	<string name="_adm_stg_cpt_option_sys_cache_memcache_port"><![CDATA[Memcached server port]]></string>
 	<string name="_adm_stg_cpt_option_sys_captcha_default"><![CDATA[Сaptcha object]]></string>
 	<string name="_adm_stg_cpt_option_sys_email_confirmation"><![CDATA[Enable email confirmation]]></string>
+	<string name="_adm_stg_cpt_option_sys_email_attachable_email_templates"><![CDATA[Attachable email templates list]]></string>
 	<string name="_adm_stg_cpt_option_sys_db_cache_enable"><![CDATA[Enable DB cache]]></string>
 	<string name="_adm_stg_cpt_option_sys_db_cache_engine"><![CDATA[DB cache engine (other than File option may require custom server setup)]]></string>
 	<string name="_adm_stg_cpt_option_sys_default_payment"><![CDATA[Payment module]]></string>
@@ -2173,10 +2174,9 @@ If it is not enabled then please consider implement this optimization, since it
         <ul>
             <li><b>{0}</b> deleted expired membership levels</li>
             <li><b>{1}</b> deleted expired sessions</li>
-            <li><b>{2}</b> deleted expired views</li>
-            <li><b>{3}</b> deleted expired keys</li>
-            <li><b>{4}</b> deleted expired storage tokens</li>
-            <li><b>{5}</b> deleted outdated transcoded images</li>
+            <li><b>{2}</b> deleted expired keys</li>
+            <li><b>{3}</b> deleted expired storage tokens</li>
+            <li><b>{4}</b> deleted outdated transcoded images</li>
         </ul>]]></string>
     <string name="_sys_pruning_files"><![CDATA[<h3>Files pruning:</h3>
         <ul>

+ 3 - 3
modules/boonex/events/install/sql/enable.sql

@@ -312,8 +312,8 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 
 
 -- VIEWS
-INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
-('bx_events', 'bx_events_views_track', '86400', '1', 'bx_events_data', 'id', 'views', '', '');
+INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
+('bx_events', 'bx_events_views_track', '86400', '1', 'bx_events_data', 'id', 'author', 'views', '', '');
 
 -- VOTES
 INSERT INTO `sys_objects_vote` (`Name`, `TableMain`, `TableTrack`, `PostTimeout`, `MinValue`, `MaxValue`, `IsUndo`, `IsOn`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldRate`, `TriggerFieldRateCount`, `ClassName`, `ClassFile`) VALUES 
@@ -408,7 +408,7 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 ('bx_events', 'timeline_comment', @iHandler),
 ('bx_events', 'timeline_vote', @iHandler),
 ('bx_events', 'timeline_report', @iHandler),
-('bx_events', 'timeline_share', @iHandler);
+('bx_events', 'timeline_repost', @iHandler);
 
 -- PRIVACY 
 

+ 21 - 1
modules/boonex/forum/classes/BxForumModule.php

@@ -98,12 +98,32 @@ class BxForumModule extends BxBaseModTextModule
     {
     	$sType = 'top';
 
-    	if($sUnitView != 'table')   
+    	if($sUnitView != 'table')
         	return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
 
 		return $this->_serviceBrowseTable(array('type' => $sType));
     }
 
+    public function serviceBrowsePopular ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true)
+    {
+        $sType = 'popular';
+
+        if($sUnitView != 'table')
+            $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
+
+        return $this->_serviceBrowseTable(array('type' => $sType));
+    }
+
+    public function serviceBrowseUpdated ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true)
+    {
+        $sType = 'updated';
+
+        if($sUnitView != 'table')
+            $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
+
+        return $this->_serviceBrowseTable(array('type' => $sType));
+    }
+
 	public function serviceBrowseIndex($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = true)
     {
     	$sType = 'index';

+ 2 - 2
modules/boonex/forum/install/sql/enable.sql

@@ -433,8 +433,8 @@ INSERT INTO `sys_objects_cmts` (`Name`, `Table`, `CharsPostMin`, `CharsPostMax`,
 
 
 -- VIEWS
-INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
-(@sName, 'bx_forum_views_track', '86400', '1', 'bx_forum_discussions', 'id', 'views', '', '');
+INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
+(@sName, 'bx_forum_views_track', '86400', '1', 'bx_forum_discussions', 'id', 'author', 'views', '', '');
 
 
 -- VOTES

+ 3 - 3
modules/boonex/groups/install/sql/enable.sql

@@ -299,8 +299,8 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 
 
 -- VIEWS
-INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
-('bx_groups', 'bx_groups_views_track', '86400', '1', 'bx_groups_data', 'id', 'views', '', '');
+INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
+('bx_groups', 'bx_groups_views_track', '86400', '1', 'bx_groups_data', 'id', 'author', 'views', '', '');
 
 -- VOTES
 INSERT INTO `sys_objects_vote` (`Name`, `TableMain`, `TableTrack`, `PostTimeout`, `MinValue`, `MaxValue`, `IsUndo`, `IsOn`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldRate`, `TriggerFieldRateCount`, `ClassName`, `ClassFile`) VALUES 
@@ -395,7 +395,7 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 ('bx_groups', 'timeline_comment', @iHandler),
 ('bx_groups', 'timeline_vote', @iHandler),
 ('bx_groups', 'timeline_report', @iHandler),
-('bx_groups', 'timeline_share', @iHandler);
+('bx_groups', 'timeline_repost', @iHandler);
 
 -- PRIVACY 
 

+ 2 - 2
modules/boonex/market/install/sql/install.sql

@@ -495,8 +495,8 @@ INSERT INTO `sys_objects_report` (`name`, `table_main`, `table_track`, `is_on`,
 ('bx_market', 'bx_market_reports', 'bx_market_reports_track', '1', 'page.php?i=view-product&id={object_id}', 'bx_market_products', 'id', 'author', 'reports', '', '');
 
 -- VIEWS
-INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
-('bx_market', 'bx_market_views_track', '86400', '1', 'bx_market_products', 'id', 'views', '', '');
+INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
+('bx_market', 'bx_market_views_track', '86400', '1', 'bx_market_products', 'id', 'author', 'views', '', '');
 
 -- FAFORITES
 INSERT INTO `sys_objects_favorite` (`name`, `table_track`, `is_on`, `is_undo`, `is_public`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 

+ 3 - 3
modules/boonex/organizations/install/sql/enable.sql

@@ -315,8 +315,8 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 
 
 -- VIEWS
-INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
-('bx_organizations', 'bx_organizations_views_track', '86400', '1', 'bx_organizations_data', 'id', 'views', '', '');
+INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
+('bx_organizations', 'bx_organizations_views_track', '86400', '1', 'bx_organizations_data', 'id', 'author', 'views', '', '');
 
 -- FAFORITES
 INSERT INTO `sys_objects_favorite` (`name`, `table_track`, `is_on`, `is_undo`, `is_public`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
@@ -382,7 +382,7 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 ('bx_organizations', 'timeline_comment', @iHandler),
 ('bx_organizations', 'timeline_vote', @iHandler),
 ('bx_organizations', 'timeline_report', @iHandler),
-('bx_organizations', 'timeline_share', @iHandler);
+('bx_organizations', 'timeline_repost', @iHandler);
 
 -- PRIVACY 
 

+ 3 - 3
modules/boonex/persons/install/sql/enable.sql

@@ -306,8 +306,8 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 
 
 -- VIEWS
-INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
-('bx_persons', 'bx_persons_views_track', '86400', '1', 'bx_persons_data', 'id', 'views', '', '');
+INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
+('bx_persons', 'bx_persons_views_track', '86400', '1', 'bx_persons_data', 'id', 'author', 'views', '', '');
 
 -- FAFORITES
 INSERT INTO `sys_objects_favorite` (`name`, `table_track`, `is_on`, `is_undo`, `is_public`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
@@ -369,7 +369,7 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 ('bx_persons', 'timeline_comment', @iHandler),
 ('bx_persons', 'timeline_vote', @iHandler),
 ('bx_persons', 'timeline_report', @iHandler),
-('bx_persons', 'timeline_share', @iHandler);
+('bx_persons', 'timeline_repost', @iHandler);
 
 -- PRIVACY 
 

+ 2 - 2
modules/boonex/posts/install/sql/install.sql

@@ -298,8 +298,8 @@ INSERT INTO `sys_objects_report` (`name`, `table_main`, `table_track`, `is_on`,
 
 -- VIEWS
 
-INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
-('bx_posts', 'bx_posts_views_track', '86400', '1', 'bx_posts_posts', 'id', 'views', '', '');
+INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
+('bx_posts', 'bx_posts_views_track', '86400', '1', 'bx_posts_posts', 'id', 'author', 'views', '', '');
 
 -- FAFORITES
 

+ 28 - 10
modules/boonex/russian/data/langs/bx_timeline/ru.xml

@@ -48,11 +48,14 @@
 	<string name="_bx_timeline_acl_action_post"><![CDATA[Сообщение]]></string>
 	<string name="_bx_timeline_acl_action_delete"><![CDATA[Удалить]]></string>
 	<string name="_bx_timeline_acl_action_vote"><![CDATA[Голосовать]]></string>
-	<string name="_bx_timeline_acl_action_share"><![CDATA[Поделиться]]></string>
+	<string name="_bx_timeline_acl_action_repost"><![CDATA[Сделать репост]]></string>
+	<string name="_bx_timeline_acl_action_send"><![CDATA[Послать]]></string>
 	<string name="_bx_timeline_acl_action_pin"><![CDATA[Прикреплять]]></string>
 
-	<string name="_bx_timeline_page_title_sys_view"><![CDATA[Лента]]></string>
+	<string name="_bx_timeline_page_title_sys_view"><![CDATA[Лента профиля]]></string>
 	<string name="_bx_timeline_page_title_view"><![CDATA[Лента]]></string>
+	<string name="_bx_timeline_page_title_sys_view_home"><![CDATA[Лента главной страницы]]></string>
+    <string name="_bx_timeline_page_title_view_home"><![CDATA[Лента]]></string>
 	<string name="_bx_timeline_page_title_sys_item"><![CDATA[Элемент Ленты]]></string>
 	<string name="_bx_timeline_page_title_item"><![CDATA[Элемент Ленты]]></string>
 	<string name="_bx_timeline_page_title_sys_account"><![CDATA[Лента]]></string>
@@ -76,6 +79,13 @@
     <string name="_bx_timeline_menu_item_view_other"><![CDATA[Сообщения от других]]></string>
     <string name="_bx_timeline_menu_item_get_rss"><![CDATA[RSS]]></string>
 
+    <string name="_bx_timeline_menu_title_item_share"><![CDATA[Поделиться]]></string>
+    <string name="_bx_timeline_menu_set_title_item_share"><![CDATA[Поделиться]]></string>
+    <string name="_bx_timeline_menu_item_title_system_item_repost"><![CDATA[Сделать репост]]></string>
+    <string name="_bx_timeline_menu_item_title_item_repost"><![CDATA[Сделать репост]]></string>
+    <string name="_bx_timeline_menu_item_title_system_item_send"><![CDATA[Послать]]></string>
+    <string name="_bx_timeline_menu_item_title_item_send"><![CDATA[Послать другу]]></string>
+
     <string name="_bx_timeline_menu_title_item_manage"><![CDATA[Управлять Элементом]]></string>
     <string name="_bx_timeline_menu_set_title_item_manage"><![CDATA[Управлять Элементом]]></string>
     <string name="_bx_timeline_menu_item_title_system_item_pin"><![CDATA[Прикалывать]]></string>
@@ -114,7 +124,7 @@
 	<string name="_bx_timeline_menu_item_title_view_timeline_view"><![CDATA[Лента]]></string>
 
 	<string name="_bx_timeline_alert_module_timeline_common_post"><![CDATA[Лента (разместить)]]></string>
-	<string name="_bx_timeline_alert_module_timeline_common_share"><![CDATA[Лента (разместить снова)]]></string>
+	<string name="_bx_timeline_alert_module_timeline_common_repost"><![CDATA[Лента (сделать репост)]]></string>
 	<string name="_bx_timeline_alert_action_added"><![CDATA[добавить]]></string>
 
 	<string name="_bx_timeline_txt_msg_no_results"><![CDATA[Пусто]]></string>
@@ -130,7 +140,7 @@
 	<string name="_bx_timeline_txt_rss_caption"><![CDATA[Лента {0}]]></string>
 	<string name="_bx_timeline_txt_added_sample"><![CDATA[добавил {0}]]></string>
 	<string name="_bx_timeline_txt_user_added_sample"><![CDATA[{0} добавил {1}]]></string>
-	<string name="_bx_timeline_txt_user_shared_sample"><![CDATA[{0} снова разместил {1} {2}]]></string>
+	<string name="_bx_timeline_txt_user_reposted_sample"><![CDATA[{0} сделал репост {1} {2}]]></string>
 	<string name="_bx_timeline_txt_sample"><![CDATA[сообщение]]></string>
 	<string name="_bx_timeline_txt_sample_with_article"><![CDATA[сообщение]]></string>
 	<string name="_bx_timeline_txt_sample_ext"><![CDATA[сообщение в ленте]]></string>
@@ -138,12 +148,20 @@
 	<string name="_bx_timeline_txt_sample_vote_single"><![CDATA[голос за сообщение в ленте]]></string>
     <string name="_bx_timeline_txt_today"><![CDATA[Сегодня]]></string>
 
-	<string name="_bx_timeline_txt_do_share"><![CDATA[Поделиться]]></string>
-	<string name="_bx_timeline_txt_shared"><![CDATA[Поделился {0} {1}.]]></string>
-	<string name="_bx_timeline_txt_shared_by"><![CDATA[Поделился]]></string>
-	<string name="_bx_timeline_txt_err_cannot_share"><![CDATA[Невозможно поделиться. Пожалуйста, сообщите нам об этой проблеме.]]></string>
-	<string name="_bx_timeline_txt_err_already_shared"><![CDATA[Вы уже поделились этим элементом.]]></string>
-	<string name="_bx_timeline_txt_msg_success_share"><![CDATA[]]></string>
+	<string name="_bx_timeline_txt_do_repost"><![CDATA[Сделать репост]]></string>
+	<string name="_bx_timeline_txt_reposted"><![CDATA[Сделал репост {0} {1}.]]></string>
+	<string name="_bx_timeline_txt_reposted_by"><![CDATA[Сделал репост]]></string>
+	<string name="_bx_timeline_txt_err_cannot_repost"><![CDATA[Невозможно сделать репост. Пожалуйста, сообщите нам об этой проблеме.]]></string>
+	<string name="_bx_timeline_txt_err_already_reposted"><![CDATA[Вы уже сделали репост этого элемента.]]></string>
+	<string name="_bx_timeline_txt_msg_success_repost"><![CDATA[Репост данного элемента был сделан успешно.]]></string>
+
+    <!-- EMAIL TEMPLATES -->
+    <string name="_bx_timeline_et_txt_name_send"><![CDATA[Послать другу.]]></string>
+    <string name="_bx_timeline_et_txt_subject_send"><![CDATA[Это может быть интересно для вас.]]></string>
+    <string name="_bx_timeline_et_txt_body_send"><![CDATA[{email_header}
+<p>Привет.</p>
+<p>Взгляните на <a href="{ViewLink}">это сообщение</a>, оно может быть интересно для вас.</p>
+{email_footer}]]></string>
 
 	<string name="_bx_ntfs_alert_action_post_common"><![CDATA[добавить сообщение]]></string>
 </resources>

+ 4 - 4
modules/boonex/russian/data/langs/system/ru.xml

@@ -1216,6 +1216,7 @@
 	<string name="_adm_stg_cpt_option_sys_cache_memcache_port"><![CDATA[Memcached - порт сервера]]></string>
 	<string name="_adm_stg_cpt_option_sys_captcha_default"><![CDATA[Объект CAPTCHA]]></string>
 	<string name="_adm_stg_cpt_option_sys_email_confirmation"><![CDATA[Задействовать подтверждение эл. адреса]]></string>
+	<string name="_adm_stg_cpt_option_sys_email_attachable_email_templates"><![CDATA[Список присоединяемых имейл темплейтов]]></string>
 	<string name="_adm_stg_cpt_option_sys_db_cache_enable"><![CDATA[Задействовать кэш БД]]></string>
 	<string name="_adm_stg_cpt_option_sys_db_cache_engine"><![CDATA[Кэш-движок для БД (значение, отличное от File, может потребовать дополнительной настройки сервера)]]></string>
 	<string name="_adm_stg_cpt_option_sys_default_payment"><![CDATA[Модуль оплаты]]></string>
@@ -2171,10 +2172,9 @@
         <ul>
             <li><b>{0}</b> удалено просроченных членств</li>
             <li><b>{1}</b> удалено просроченных сессий</li>
-            <li><b>{2}</b> удалено просроченных просмотров</li>
-            <li><b>{3}</b> удалено просроченных ключей</li>
-            <li><b>{4}</b> удалено просроченных токенов хранилища</li>
-            <li><b>{5}</b> удалено просроченных транскодированных изображений</li>
+            <li><b>{2}</b> удалено просроченных ключей</li>
+            <li><b>{3}</b> удалено просроченных токенов хранилища</li>
+            <li><b>{4}</b> удалено просроченных транскодированных изображений</li>
         </ul>]]></string>
     <string name="_sys_pruning_files"><![CDATA[<h3>Очистка Файлов:</h3>
         <ul>

+ 14 - 14
modules/boonex/timeline/classes/BxTimelineConfig.php

@@ -27,7 +27,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
     protected $_sMenuItemManage;
     protected $_sMenuItemActions;
 
-    protected $_aShareDefaults;
+    protected $_aRepostDefaults;
 
     protected $_iTimelineVisibilityThreshold;
     protected $_aPregPatterns;
@@ -104,12 +104,12 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
             'main' => 'BxTimelineMain',
             'view' => 'BxTimelineView',
             'post' => 'BxTimelinePost',
-            'share' => 'BxTimelineShare'
+            'repost' => 'BxTimelineRepost'
         );
         $this->_aJsObjects = array(
             'view' => 'oTimelineView',
             'post' => 'oTimelinePost',
-            'share' => 'oTimelineShare'
+            'repost' => 'oTimelineRepost'
         );
 
         $sHp = str_replace('_', '-', $this->_sName);
@@ -136,18 +136,18 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
             	'main_' . $sHpT => $sHp . '-' . $sHpT,
             	'main_' . $sHpO => $sHp . '-' . $sHpO,
             ),
-            'share' => array(
-                'main' => $sHp . '-share-',
-                'counter' => $sHp . '-share-counter-',
-                'by_popup' => $sHp . '-share-by-',
+            'repost' => array(
+                'main' => $sHp . '-repost-',
+                'counter' => $sHp . '-repost-counter-',
+                'by_popup' => $sHp . '-repost-by-',
             )
         );
 
-        $this->_aShareDefaults = array(
-            'show_do_share_as_button' => false,
-            'show_do_share_as_button_small' => false,
-            'show_do_share_icon' => true,
-            'show_do_share_label' => false,
+        $this->_aRepostDefaults = array(
+            'show_do_repost_as_button' => false,
+            'show_do_repost_as_button_small' => false,
+            'show_do_repost_icon' => true,
+            'show_do_repost_label' => false,
             'show_counter' => true
         );
 
@@ -209,9 +209,9 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
         return $this->_iCharsDisplayMax;
     }
 
-    public function getShareDefaults()
+    public function getRepostDefaults()
     {
-        return $this->_aShareDefaults;
+        return $this->_aRepostDefaults;
     }
 
     public function getPregPattern($sType)

+ 24 - 24
modules/boonex/timeline/classes/BxTimelineDb.php

@@ -11,7 +11,7 @@
 
 class BxTimelineDb extends BxBaseModNotificationsDb
 {
-    protected $_sTablesShareTrack;
+    protected $_sTablesRepostTrack;
 
     protected $_aTablesMedia;
     protected $_aTablesMedia2Events;
@@ -22,7 +22,7 @@ class BxTimelineDb extends BxBaseModNotificationsDb
     function __construct(&$oConfig)
     {
         parent::__construct($oConfig);
-        $this->_sTableSharesTrack = $this->_sPrefix . 'shares_track';
+        $this->_sTableRepostsTrack = $this->_sPrefix . 'reposts_track';
 
         $this->_aTablesMedia = array(
         	BX_TIMELINE_MEDIA_PHOTO => $this->_sPrefix . 'photos',
@@ -40,8 +40,8 @@ class BxTimelineDb extends BxBaseModNotificationsDb
     		//Delete system events.
             $this->deleteEvent(array('type' => $aHandler['alert_unit'], 'action' => $aHandler['alert_action']));
 
-            //Delete shared events.
-    		$aEvents = $this->getEvents(array('browse' => 'shared_by_descriptor', 'type' => $aHandler['alert_unit'], 'action' => $aHandler['alert_action']));
+            //Delete reposted events.
+    		$aEvents = $this->getEvents(array('browse' => 'reposted_by_descriptor', 'type' => $aHandler['alert_unit'], 'action' => $aHandler['alert_action']));
 			foreach($aEvents as $aEvent) {
 				$aContent = unserialize($aEvent['content']);
 				if(isset($aContent['type']) && $aContent['type'] == $aHandler['alert_unit'] && isset($aContent['action']) && $aContent['action'] == $aHandler['alert_action'])
@@ -58,8 +58,8 @@ class BxTimelineDb extends BxBaseModNotificationsDb
     		//Activate (deactivate) system events.
             $this->updateEvent(array('active' => $iActivate), array('type' => $aHandler['alert_unit'], 'action' => $aHandler['alert_action']));
 
-			//Activate (deactivate) shared events.
-			$aEvents = $this->getEvents(array('browse' => 'shared_by_descriptor', 'type' => $aHandler['alert_unit'], 'action' => $aHandler['alert_action']));
+			//Activate (deactivate) reposted events.
+			$aEvents = $this->getEvents(array('browse' => 'reposted_by_descriptor', 'type' => $aHandler['alert_unit'], 'action' => $aHandler['alert_action']));
 			foreach($aEvents as $aEvent) {
 				$aContent = unserialize($aEvent['content']);
 				if(isset($aContent['type']) && $aContent['type'] == $aHandler['alert_unit'] && isset($aContent['action']) && $aContent['action'] == $aHandler['alert_action'])
@@ -82,27 +82,27 @@ class BxTimelineDb extends BxBaseModNotificationsDb
         return (int)$aEvent['year'] < $iNowYear ? (int)$aEvent['year'] : 0;
     }
 
-    //--- Share related methods ---//
-    public function insertShareTrack($iEventId, $iAuthorId, $sAuthorIp, $iSharedId)
+    //--- Repost related methods ---//
+    public function insertRepostTrack($iEventId, $iAuthorId, $sAuthorIp, $iRepostedId)
     {
         $iNow = time();
         $iAuthorNip = ip2long($sAuthorIp);
-        $sQuery = $this->prepare("INSERT INTO `{$this->_sTableSharesTrack}` SET `event_id` = ?, `author_id` = ?, `author_nip` = ?, `shared_id` = ?, `date` = ?", $iEventId, $iAuthorId, $iAuthorNip, $iSharedId, $iNow);
+        $sQuery = $this->prepare("INSERT INTO `{$this->_sTableRepostsTrack}` SET `event_id` = ?, `author_id` = ?, `author_nip` = ?, `reposted_id` = ?, `date` = ?", $iEventId, $iAuthorId, $iAuthorNip, $iRepostedId, $iNow);
         return (int)$this->query($sQuery) > 0;
     }
 
-    public function deleteShareTrack($iEventId)
+    public function deleteRepostTrack($iEventId)
     {
-        $sQuery = $this->prepare("DELETE FROM `{$this->_sTableSharesTrack}` WHERE `event_id` = ?", $iEventId);
+        $sQuery = $this->prepare("DELETE FROM `{$this->_sTableRepostsTrack}` WHERE `event_id` = ?", $iEventId);
         return (int)$this->query($sQuery) > 0;
     }
 
-    public function updateShareCounter($iId, $iCounter, $iIncrement = 1)
+    public function updateRepostCounter($iId, $iCounter, $iIncrement = 1)
     {
-        return (int)$this->updateEvent(array('shares' => (int)$iCounter + $iIncrement), array('id' => $iId)) > 0;
+        return (int)$this->updateEvent(array('reposts' => (int)$iCounter + $iIncrement), array('id' => $iId)) > 0;
     }
 
-    public function getShared($sType, $sAction, $iObjectId)
+    public function getReposted($sType, $sAction, $iObjectId)
     {
     	$bSystem = $this->_oConfig->isSystem($sType, $sAction);
 
@@ -111,8 +111,8 @@ class BxTimelineDb extends BxBaseModNotificationsDb
         else
             $aParams = array('browse' => 'id', 'value' => $iObjectId);
 
-		$aShared = $this->getEvents($aParams);
-		if($bSystem && (empty($aShared) || !is_array($aShared))) {
+		$aReposted = $this->getEvents($aParams);
+		if($bSystem && (empty($aReposted) || !is_array($aReposted))) {
 			$iOwnerId = 0;
 			$iDate = 0;
 			$iHidden = 1;
@@ -138,25 +138,25 @@ class BxTimelineDb extends BxBaseModNotificationsDb
 				'hidden' => $iHidden
 			));
 
-			$aShared = $this->getEvents(array('browse' => 'id', 'value' => $iId));
+			$aReposted = $this->getEvents(array('browse' => 'id', 'value' => $iId));
 		}
 
-        return $aShared;
+        return $aReposted;
     }
 
-    function getSharedBy($iSharedId)
+    function getRepostedBy($iRepostedId)
     {
-        $sQuery = $this->prepare("SELECT `author_id` FROM `{$this->_sTableSharesTrack}` WHERE `shared_id`=?", $iSharedId);
+        $sQuery = $this->prepare("SELECT `author_id` FROM `{$this->_sTableRepostsTrack}` WHERE `reposted_id`=?", $iRepostedId);
         return $this->getColumn($sQuery);
     }
 
-    function isShared($iSharedId, $iOwnerId, $iAuthorId)
+    function isReposted($iRepostedId, $iOwnerId, $iAuthorId)
     {
     	$sQuery = $this->prepare("SELECT 
     			`te`.`id`
-    		FROM `{$this->_sTableSharesTrack}` AS `tst` 
+    		FROM `{$this->_sTableRepostsTrack}` AS `tst` 
     		LEFT JOIN `{$this->_sTable}` AS `te` ON `tst`.`event_id`=`te`.`id` 
-    		WHERE `tst`.`author_id`=? AND `tst`.`shared_id`=? AND `te`.`owner_id`=?", $iAuthorId, $iSharedId, $iOwnerId);
+    		WHERE `tst`.`author_id`=? AND `tst`.`reposted_id`=? AND `te`.`owner_id`=?", $iAuthorId, $iRepostedId, $iOwnerId);
 
     	return (int)$this->getOne($sQuery) > 0;
     }
@@ -318,7 +318,7 @@ class BxTimelineDb extends BxBaseModNotificationsDb
 				$sLimitClause = "LIMIT 1";
                 break;
 
-            case 'shared_by_descriptor':
+            case 'reposted_by_descriptor':
             	$sWhereClause = "";
 
             	if(isset($aParams['type']))

+ 2 - 12
modules/boonex/timeline/classes/BxTimelineMenuItemActions.php

@@ -40,7 +40,7 @@ class BxTimelineMenuItemActions extends BxTemplMenuCustom
         }
 
         $this->addMarkers(array(
-        	'js_object_view' => $this->_oModule->_oConfig->getJsObject('view_' . $sView),
+        	'js_object_view' => $this->_oModule->_oConfig->getJsObject('view'),
 
             'view' => $sView,
             'content_id' => $aEvent['id'],
@@ -98,16 +98,6 @@ class BxTimelineMenuItemActions extends BxTemplMenuCustom
     	return $this->_oModule->getReportObject($sReportsSystem, $iReportsObject)->getElementInline(array('dynamic_mode' => $this->_bDynamicMode));
     }
 
-	protected function _getMenuItemItemShare($aItem)
-    {
-		$iOwnerId = $this->_oModule->getUserId(); //--- in whose timeline the content will be shared
-        $sType = $this->_aEvent['type'];
-        $sAction = $this->_aEvent['action'];
-        $iObjectId = $this->_oModule->_oConfig->isSystem($sType, $sAction) ? $this->_aEvent['object_id'] : $this->_aEvent['id'];
-
-        return $this->_oModule->serviceGetShareElementBlock($iOwnerId, $sType, $sAction, $iObjectId);
-    }
-
     /**
      * Check if menu items is visible.
      * @param $a menu item array
@@ -122,7 +112,7 @@ class BxTimelineMenuItemActions extends BxTemplMenuCustom
         $aCheckFuncParams = array($this->_aEvent);
         switch ($a['name']) {
             case 'item-view':
-                $sCheckFuncName = 'isAllowedView';
+                $sCheckFuncName = 'isAllowedViewCounter';
                 break;
 
             case 'item-comment':

+ 13 - 30
modules/boonex/timeline/classes/BxTimelineMenuItemManage.php

@@ -14,9 +14,10 @@
  */
 class BxTimelineMenuItemManage extends BxTemplMenu
 {
-	protected $_iEvent;
     protected $_oModule;
 
+	protected $_iEvent;
+	protected $_aEvent;
 
     public function __construct($aObject, $oTemplate = false)
     {
@@ -24,37 +25,20 @@ class BxTimelineMenuItemManage extends BxTemplMenu
 
         $this->_oModule = BxDolModule::getInstance('bx_timeline');
 
-        $this->_iEvent = 0;
         if(bx_get('content_id') !== false)
-        	$this->_iEvent = (int)bx_get('content_id');
-
-        $this->addMarkers(array(
-            'js_object_view' => $this->_oModule->_oConfig->getJsObject('view'),
-
-        	'content_id' => $this->_iEvent,
-        ));
+            $this->setEventId((int)bx_get('content_id'));
     }
 
     public function setEventId($iEventId)
     {
     	$this->_iEvent = $iEventId;
-    }
+    	$this->_aEvent = $this->_oModule->_oDb->getEvents(array('browse' => 'id', 'value' => $this->_iEvent));
 
-    public function isVisible()
-    {
-    	if(!isset($this->_aObject['menu_items']))
-			$this->_aObject['menu_items'] = $this->_oQuery->getMenuItems();
-
-    	$bVisible = false;
-    	foreach ($this->_aObject['menu_items'] as $a) {
-    		if((isset($a['active']) && !$a['active']) || (isset($a['visible_for_levels']) && !$this->_isVisible($a)))
-				continue;
-			
-			$bVisible = true;
-			break;
-    	}
-
-    	return $bVisible;
+    	$this->addMarkers(array(
+            'js_object_view' => $this->_oModule->_oConfig->getJsObject('view'),
+
+        	'content_id' => $this->_iEvent,
+        ));
     }
 
     /**
@@ -67,8 +51,7 @@ class BxTimelineMenuItemManage extends BxTemplMenu
         if(!parent::_isVisible($a))
             return false;
 
-		$aEvent = $this->_oModule->_oDb->getEvents(array('browse' => 'id', 'value' => $this->_iEvent));
-		if(empty($aEvent) || !is_array($aEvent))
+		if(empty($this->_aEvent) || !is_array($this->_aEvent))
 			return false;
 
         $sCheckFuncName = '';
@@ -76,17 +59,17 @@ class BxTimelineMenuItemManage extends BxTemplMenu
         switch ($a['name']) {
         	case 'item-pin':
                 $sCheckFuncName = 'isAllowedPin';
-				$aCheckFuncParams = array($aEvent);
+				$aCheckFuncParams = array($this->_aEvent);
                 break;
 
 			case 'item-unpin':
                 $sCheckFuncName = 'isAllowedUnpin';
-				$aCheckFuncParams = array($aEvent);
+				$aCheckFuncParams = array($this->_aEvent);
                 break;
 
             case 'item-delete':
                 $sCheckFuncName = 'isAllowedDelete';
-				$aCheckFuncParams = array($aEvent);
+				$aCheckFuncParams = array($this->_aEvent);
                 break;
         }
 

+ 106 - 0
modules/boonex/timeline/classes/BxTimelineMenuItemShare.php

@@ -0,0 +1,106 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Timeline Timeline
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+/**
+ * 'Item' menu.
+ */
+class BxTimelineMenuItemShare extends BxTemplMenu
+{
+    protected $_oModule;
+
+	protected $_iEvent;
+	protected $_aEvent;
+
+    public function __construct($aObject, $oTemplate = false)
+    {
+        parent::__construct($aObject, $oTemplate);
+
+        $this->_oModule = BxDolModule::getInstance('bx_timeline');
+
+        if(bx_get('content_id') !== false)
+        	$this->setEventId((int)bx_get('content_id'));
+    }
+
+    public function setEventId($iEventId)
+    {
+    	$this->_iEvent = $iEventId;
+    	$this->_aEvent = $this->_oModule->_oDb->getEvents(array('browse' => 'id', 'value' => $this->_iEvent));
+        $bEvent = !empty($this->_aEvent) && is_array($this->_aEvent);
+    	
+    	//--- Repost item
+    	$sRepostOnclick = '';
+    	if($bEvent) {
+        	$iOwnerId = $this->_oModule->getUserId(); //--- in whose timeline the content will be reposted
+            $sType = $this->_aEvent['type'];
+            $sAction = $this->_aEvent['action'];
+            $iObjectId = $this->_oModule->_oConfig->isSystem($sType, $sAction) ? $this->_aEvent['object_id'] : $this->_aEvent['id'];
+
+            $sRepostOnclick = $this->_oModule->serviceGetRepostJsClick($iOwnerId, $sType, $sAction, $iObjectId);
+    	}
+
+    	//--- Send item
+    	$sEtSend = '';
+    	if($bEvent) {
+    	    $aEt = array(
+    	        'name' => 'bx_timeline_send',
+    	        'params' => array(
+    	            'ViewLink' => $this->_oModule->_oConfig->getItemViewUrl($this->_aEvent)
+    	        )
+    	    );
+
+    	    $sAetSend = urlencode(base64_encode(serialize($aEt))); 
+    	}
+
+    	$this->addMarkers(array(
+        	'js_object_view' => $this->_oModule->_oConfig->getJsObject('view'),
+
+        	'content_id' => $this->_iEvent,
+
+    	    'js_onclick_repost' => $sRepostOnclick,
+    		'et_send' => $sAetSend
+    	));
+    }
+
+    /**
+     * Check if menu items is visible.
+     * @param $a menu item array
+     * @return boolean
+     */
+    protected function _isVisible ($a)
+    {
+        if(!parent::_isVisible($a))
+            return false;
+
+		if(empty($this->_aEvent) || !is_array($this->_aEvent))
+			return false;
+
+        $sCheckFuncName = '';
+        $aCheckFuncParams = array();
+        switch ($a['name']) {
+        	case 'item-repost':
+                $sCheckFuncName = 'isAllowedRepost';
+				$aCheckFuncParams = array($this->_aEvent);
+                break;
+
+			case 'item-send':
+                $sCheckFuncName = 'isAllowedSend';
+				$aCheckFuncParams = array($this->_aEvent);
+                break;
+        }
+
+        if(!$sCheckFuncName || !method_exists($this->_oModule, $sCheckFuncName))
+            return true;
+
+        return call_user_func_array(array($this->_oModule, $sCheckFuncName), $aCheckFuncParams) === true;
+    }
+}
+
+/** @} */

+ 90 - 64
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -24,7 +24,7 @@ define('BX_TIMELINE_FILTER_OWNER', 'owner');
 define('BX_TIMELINE_FILTER_OTHER', 'other');
 
 define('BX_TIMELINE_PARSE_TYPE_POST', 'post');
-define('BX_TIMELINE_PARSE_TYPE_SHARE', 'share');
+define('BX_TIMELINE_PARSE_TYPE_REPOST', 'repost');
 define('BX_TIMELINE_PARSE_TYPE_DEFAULT', BX_TIMELINE_PARSE_TYPE_POST);
 
 define('BX_TIMELINE_MEDIA_PHOTO', 'photo');
@@ -117,7 +117,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule
         ));
     }
 
-    public function actionShare()
+    public function actionRepost()
     {
     	$iAuthorId = $this->getUserId();
 
@@ -128,27 +128,27 @@ class BxTimelineModule extends BxBaseModNotificationsModule
             'object_id' => bx_process_input(bx_get('object_id'), BX_DATA_INT),
         );
 
-        $aShared = $this->_oDb->getShared($aContent['type'], $aContent['action'], $aContent['object_id']);
-        if(empty($aShared) || !is_array($aShared)) {
-            echoJson(array('code' => 1, 'msg' => _t('_bx_timeline_txt_err_cannot_share')));
+        $aReposted = $this->_oDb->getReposted($aContent['type'], $aContent['action'], $aContent['object_id']);
+        if(empty($aReposted) || !is_array($aReposted)) {
+            echoJson(array('code' => 1, 'msg' => _t('_bx_timeline_txt_err_cannot_repost')));
             return;
         }
 
-        $mixedAllowed = $this->isAllowedShare($aShared, true);
+        $mixedAllowed = $this->isAllowedRepost($aReposted, true);
         if($mixedAllowed !== true) {
             echoJson(array('code' => 2, 'msg' => strip_tags($mixedAllowed)));
             return;
         }
 
-        $bShared = $this->_oDb->isShared($aShared['id'], $iOwnerId, $iAuthorId);
-		if($bShared) {
-        	echoJson(array('code' => 3, 'msg' => _t('_bx_timeline_txt_err_already_shared')));
+        $bReposted = $this->_oDb->isReposted($aReposted['id'], $iOwnerId, $iAuthorId);
+		if($bReposted) {
+        	echoJson(array('code' => 3, 'msg' => _t('_bx_timeline_txt_err_already_reposted')));
             return;
         }
 
         $iId = $this->_oDb->insertEvent(array(
             'owner_id' => $iOwnerId,
-            'type' => $this->_oConfig->getPrefix('common_post') . 'share',
+            'type' => $this->_oConfig->getPrefix('common_post') . 'repost',
             'action' => '',
             'object_id' => $iAuthorId,
             'object_privacy_view' => $this->_oConfig->getPrivacyViewDefault('object'),
@@ -158,21 +158,21 @@ class BxTimelineModule extends BxBaseModNotificationsModule
         ));
 
         if(empty($iId)) {
-	        echoJson(array('code' => 4, 'msg' => _t('_bx_timeline_txt_err_cannot_share')));        
+	        echoJson(array('code' => 4, 'msg' => _t('_bx_timeline_txt_err_cannot_repost')));        
 	        return;
         }
 
-        $this->onShare($iId, $aShared);
+        $this->onRepost($iId, $aReposted);
 
-        $aShared = $this->_oDb->getShared($aContent['type'], $aContent['action'], $aContent['object_id']);
-		$sCounter = $this->_oTemplate->getShareCounter($aShared);
+        $aReposted = $this->_oDb->getReposted($aContent['type'], $aContent['action'], $aContent['object_id']);
+		$sCounter = $this->_oTemplate->getRepostCounter($aReposted);
 
 		echoJson(array(
 			'code' => 0, 
-			'msg' => _t('_bx_timeline_txt_msg_success_share'), 
-			'count' => $aShared['shares'], 
+			'msg' => _t('_bx_timeline_txt_msg_success_repost'), 
+			'count' => $aReposted['reposts'], 
 			'counter' => $sCounter,
-			'disabled' => !$bShared
+			'disabled' => !$bReposted
 		));
     }
 
@@ -277,11 +277,11 @@ class BxTimelineModule extends BxBaseModNotificationsModule
         echo $this->_oTemplate->getAttachLinkForm();
     }
 
-    public function actionGetSharedBy()
+    public function actionGetRepostedBy()
     {
-        $iSharedId = bx_process_input(bx_get('id'), BX_DATA_INT);
+        $iRepostedId = bx_process_input(bx_get('id'), BX_DATA_INT);
 
-        echo $this->_oTemplate->getSharedBy($iSharedId);
+        echo $this->_oTemplate->getRepostedBy($iRepostedId);
     }
 
     function actionRss()
@@ -510,39 +510,39 @@ class BxTimelineModule extends BxBaseModNotificationsModule
 		);
     }
 
-    public function serviceGetShareElementBlock($iOwnerId, $sType, $sAction, $iObjectId, $aParams = array())
+    public function serviceGetRepostElementBlock($iOwnerId, $sType, $sAction, $iObjectId, $aParams = array())
     {
     	if(!$this->isEnabled())
     		return '';
 
-        $aParams = array_merge($this->_oConfig->getShareDefaults(), $aParams);
-        return $this->_oTemplate->getShareElement($iOwnerId, $sType, $sAction, $iObjectId, $aParams);
+        $aParams = array_merge($this->_oConfig->getRepostDefaults(), $aParams);
+        return $this->_oTemplate->getRepostElement($iOwnerId, $sType, $sAction, $iObjectId, $aParams);
     }
 
-    public function serviceGetShareCounter($sType, $sAction, $iObjectId)
+    public function serviceGetRepostCounter($sType, $sAction, $iObjectId)
     {
     	if(!$this->isEnabled())
     		return '';
 
-		$aShared = $this->_oDb->getShared($sType, $sAction, $iObjectId);
+		$aReposted = $this->_oDb->getReposted($sType, $sAction, $iObjectId);
 
-        return $this->_oTemplate->getShareCounter($aShared);
+        return $this->_oTemplate->getRepostCounter($aReposted);
     }
 
-    public function serviceGetShareJsScript()
+    public function serviceGetRepostJsScript()
     {
     	if(!$this->isEnabled())
     		return '';
 
-        return $this->_oTemplate->getShareJsScript();
+        return $this->_oTemplate->getRepostJsScript();
     }
 
-    public function serviceGetShareJsClick($iOwnerId, $sType, $sAction, $iObjectId)
+    public function serviceGetRepostJsClick($iOwnerId, $sType, $sAction, $iObjectId)
     {
     	if(!$this->isEnabled())
     		return '';
 
-        return $this->_oTemplate->getShareJsClick($iOwnerId, $sType, $sAction, $iObjectId);
+        return $this->_oTemplate->getRepostJsClick($iOwnerId, $sType, $sAction, $iObjectId);
     }
 
     public function serviceGetMenuItemAddonComment($sSystem, $iObjectId)
@@ -721,7 +721,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule
             return false;
 
         $oCmts = BxDolCmts::getObjectInstance($sSystem, $iId, true, $this->_oTemplate);
-        if(!$oCmts->isEnabled())
+        if(!$oCmts || !$oCmts->isEnabled())
             return false;
 
         return $oCmts;
@@ -733,7 +733,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule
             return false;
 
         $oView = BxDolView::getObjectInstance($sSystem, $iId, true, $this->_oTemplate);
-        if(!$oView->isEnabled())
+        if(!$oView || !$oView->isEnabled())
             return false;
 
         return $oView;
@@ -745,7 +745,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule
             return false;
 
         $oVote = BxDolVote::getObjectInstance($sSystem, $iId, true, $this->_oTemplate);
-        if(!$oVote->isEnabled())
+        if(!$oVote || !$oVote->isEnabled())
             return false;
 
         return $oVote;
@@ -757,7 +757,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule
             return false;
 
         $oReport = BxDolReport::getObjectInstance($sSystem, $iId, true, $this->_oTemplate);
-        if(!$oReport->isEnabled())
+        if(!$oReport || !$oReport->isEnabled())
             return false;
 
         return $oReport;
@@ -808,7 +808,8 @@ class BxTimelineModule extends BxBaseModNotificationsModule
 
         $aCheckResult = checkActionModule($iUserId, 'delete', $this->getName(), $bPerform);
 
-        if ($oProfileOwner = BxDolProfile::getInstance((int)$aEvent['owner_id']))
+        $oProfileOwner = BxDolProfile::getInstance((int)$aEvent['owner_id']);
+        if($oProfileOwner !== false)
             bx_alert($oProfileOwner->getModule(), $this->_oConfig->getUri() . '_delete', $oProfileOwner->id(), $iUserId, array('check_result' => &$aCheckResult));
 
         return $aCheckResult[CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED ? $aCheckResult[CHECK_ACTION_MESSAGE] : true;
@@ -826,13 +827,14 @@ class BxTimelineModule extends BxBaseModNotificationsModule
 
         $bResult = true;
 
-        if ($oProfileOwner = BxDolProfile::getInstance($aEvent['owner_id']))
+        $oProfileOwner = BxDolProfile::getInstance($aEvent['owner_id']);
+        if($oProfileOwner !== false)
             bx_alert($oProfileOwner->getModule(), $this->_oConfig->getUri() . '_comment', $oProfileOwner->id(), (int)$this->getUserId(), array('result' => &$bResult));
 
         return $bResult;
     }
 
-    public function isAllowedView($aEvent, $bPerform = false)
+    public function isAllowedViewCounter($aEvent, $bPerform = false)
     {
         $mixedViews = $this->getViewsData($aEvent['views']);
         if($mixedViews === false)
@@ -843,8 +845,9 @@ class BxTimelineModule extends BxBaseModNotificationsModule
 
         $bResult = true;
 
-        if ($oProfileOwner = BxDolProfile::getInstance($aEvent['owner_id']))
-            bx_alert($oProfileOwner->getModule(), $this->_oConfig->getUri() . '_view', $oProfileOwner->id(), (int)$this->getUserId(), array('result' => &$bResult));
+        $oProfileOwner = BxDolProfile::getInstance($aEvent['owner_id']);
+        if($oProfileOwner !== false)
+            bx_alert($oProfileOwner->getModule(), $this->_oConfig->getUri() . '_view_counter', $oProfileOwner->id(), (int)$this->getUserId(), array('result' => &$bResult));
 
         return $bResult;
     }
@@ -861,7 +864,8 @@ class BxTimelineModule extends BxBaseModNotificationsModule
 
         $bResult = true;
 
-        if ($oProfileOwner = BxDolProfile::getInstance($aEvent['owner_id']))
+        $oProfileOwner = BxDolProfile::getInstance($aEvent['owner_id']);
+        if($oProfileOwner !== false)
             bx_alert($oProfileOwner->getModule(), $this->_oConfig->getUri() . '_vote', $oProfileOwner->id(), (int)$this->getUserId(), array('result' => &$bResult));
 
         return $bResult;
@@ -879,13 +883,14 @@ class BxTimelineModule extends BxBaseModNotificationsModule
 
         $bResult = true;
 
-        if ($oProfileOwner = BxDolProfile::getInstance($aEvent['owner_id']))
+        $oProfileOwner = BxDolProfile::getInstance($aEvent['owner_id']);
+        if($oProfileOwner !== false)
             bx_alert($oProfileOwner->getModule(), $this->_oConfig->getUri() . '_report', $oProfileOwner->id(), (int)$this->getUserId(), array('result' => &$bResult));
 
         return $bResult;
     }
 
-    public function isAllowedShare($aEvent, $bPerform = false)
+    public function isAllowedRepost($aEvent, $bPerform = false)
     {
         if(isAdmin())
             return true;
@@ -894,10 +899,29 @@ class BxTimelineModule extends BxBaseModNotificationsModule
         if($iUserId == 0)
             return false;
 
-        $aCheckResult = checkActionModule($iUserId, 'share', $this->getName(), $bPerform);
+        $aCheckResult = checkActionModule($iUserId, 'repost', $this->getName(), $bPerform);
 
-        if ($oProfileOwner = BxDolProfile::getInstance($aEvent['owner_id']))
-            bx_alert($oProfileOwner->getModule(), $this->_oConfig->getUri() . '_share', $oProfileOwner->id(), $iUserId, array('check_result' => &$aCheckResult));
+        $oProfileOwner = BxDolProfile::getInstance($aEvent['owner_id']);
+        if($oProfileOwner !== false)
+            bx_alert($oProfileOwner->getModule(), $this->_oConfig->getUri() . '_repost', $oProfileOwner->id(), $iUserId, array('check_result' => &$aCheckResult));
+
+        return $aCheckResult[CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED ? $aCheckResult[CHECK_ACTION_MESSAGE] : true;
+    }
+
+    public function isAllowedSend($aEvent, $bPerform = false)
+    {
+        if(isAdmin())
+            return true;
+
+        $iUserId = (int)$this->getUserId();
+        if($iUserId == 0)
+            return false;
+
+        $aCheckResult = checkActionModule($iUserId, 'send', $this->getName(), $bPerform);
+
+        $oProfileOwner = BxDolProfile::getInstance($aEvent['owner_id']);
+        if($oProfileOwner !== false)
+            bx_alert($oProfileOwner->getModule(), $this->_oConfig->getUri() . '_send', $oProfileOwner->id(), $iUserId, array('check_result' => &$aCheckResult));
 
         return $aCheckResult[CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED ? $aCheckResult[CHECK_ACTION_MESSAGE] : true;
     }
@@ -945,24 +969,24 @@ class BxTimelineModule extends BxBaseModNotificationsModule
         //--- Event -> Post for Alerts Engine ---//
     }
 
-    public function onShare($iId, $aShared = array())
+    public function onRepost($iId, $aReposted = array())
     {
         $aEvent = $this->_oDb->getEvents(array('browse' => 'id', 'value' => $iId));
 
-        if(empty($aShared)) {
+        if(empty($aReposted)) {
             $aContent = unserialize($aEvent['content']);
 
-            $aShared = $this->_oDb->getShared($aContent['type'], $aContent['action'], $aContent['object_id']);
-            if(empty($aShared) || !is_array($aShared))
+            $aReposted = $this->_oDb->getReposted($aContent['type'], $aContent['action'], $aContent['object_id']);
+            if(empty($aReposted) || !is_array($aReposted))
                 return;
         }
 
         $iUserId = $this->getUserId();
-        $this->_oDb->insertShareTrack($aEvent['id'], $iUserId, $this->getUserIp(), $aShared['id']);
-        $this->_oDb->updateShareCounter($aShared['id'], $aShared['shares']);
+        $this->_oDb->insertRepostTrack($aEvent['id'], $iUserId, $this->getUserIp(), $aReposted['id']);
+        $this->_oDb->updateRepostCounter($aReposted['id'], $aReposted['reposts']);
 
         //--- Timeline -> Update for Alerts Engine ---//
-        $oAlert = new BxDolAlerts($this->_oConfig->getObject('alert'), 'share', $aShared['id'], $iUserId);
+        $oAlert = new BxDolAlerts($this->_oConfig->getObject('alert'), 'repost', $aReposted['id'], $iUserId);
         $oAlert->alert();
         //--- Timeline -> Update for Alerts Engine ---//
     }
@@ -979,23 +1003,23 @@ class BxTimelineModule extends BxBaseModNotificationsModule
 	        $this->_deleteLinks($aEvent['id']);
     	}
 
-    	//--- Update parent event when share event was deleted.
-        if($aEvent['type'] == $sCommonPostPrefix . BX_TIMELINE_PARSE_TYPE_SHARE) {
-            $this->_oDb->deleteShareTrack($aEvent['id']);
+    	//--- Update parent event when repost event was deleted.
+        if($aEvent['type'] == $sCommonPostPrefix . BX_TIMELINE_PARSE_TYPE_REPOST) {
+            $this->_oDb->deleteRepostTrack($aEvent['id']);
 
             $aContent = unserialize($aEvent['content']);
-            $aShared = $this->_oDb->getShared($aContent['type'], $aContent['action'], $aContent['object_id']);
-            if(!empty($aShared) && is_array($aShared))
-                $this->_oDb->updateShareCounter($aShared['id'], $aShared['shares'], -1);
+            $aReposted = $this->_oDb->getReposted($aContent['type'], $aContent['action'], $aContent['object_id']);
+            if(!empty($aReposted) && is_array($aReposted))
+                $this->_oDb->updateRepostCounter($aReposted['id'], $aReposted['reposts'], -1);
         }
 
-        //--- Find and delete share events when parent event was deleted.
+        //--- Find and delete repost events when parent event was deleted.
         $bSystem = $this->_oConfig->isSystem($aEvent['type'], $aEvent['action']);
-	    $aShareEvents = $this->_oDb->getEvents(array('browse' => 'shared_by_descriptor', 'type' => $aEvent['type']));
-		foreach($aShareEvents as $aShareEvent) {
-			$aContent = unserialize($aShareEvent['content']);
+	    $aRepostEvents = $this->_oDb->getEvents(array('browse' => 'reposted_by_descriptor', 'type' => $aEvent['type']));
+		foreach($aRepostEvents as $aRepostEvent) {
+			$aContent = unserialize($aRepostEvent['content']);
 			if(isset($aContent['type']) && $aContent['type'] == $aEvent['type'] && isset($aContent['object_id']) && (($bSystem && (int)$aContent['object_id'] == (int)$aEvent['object_id']) || (!$bSystem  && (int)$aContent['object_id'] == (int)$aEvent['id'])))
-				$this->_oDb->deleteEvent(array('id' => (int)$aShareEvent['id']));
+				$this->_oDb->deleteEvent(array('id' => (int)$aRepostEvent['id']));
 		}
 
 		//--- Delete associated meta.
@@ -1168,7 +1192,9 @@ class BxTimelineModule extends BxBaseModNotificationsModule
            return true;
 
         $aCheckResult = checkActionModule($iUserId, 'pin', $this->getName(), $bPerform);
-        if ($oProfileOwner = BxDolProfile::getInstance($aEvent['owner_id']))
+
+        $oProfileOwner = BxDolProfile::getInstance($aEvent['owner_id']);
+        if($oProfileOwner !== false)
             bx_alert($oProfileOwner->getModule(), $this->_oConfig->getUri() . '_pin', $oProfileOwner->id(), $iUserId, array('check_result' => &$aCheckResult));
 
         return $aCheckResult[CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED ? $aCheckResult[CHECK_ACTION_MESSAGE] : true;

+ 1 - 1
modules/boonex/timeline/classes/BxTimelineSearchResult.php

@@ -20,7 +20,7 @@ class BxTimelineSearchResult extends BxBaseModNotificationsSearchResult
             'module_name' => 'bx_timeline',
             'title' => _t('_bx_timeline_page_title_browse'),
             'table' => 'bx_timeline_events',
-            'ownFields' => array('id', 'owner_id', 'type', 'action', 'object_id', 'object_privacy_view', 'content', 'title', 'description', 'rate', 'votes', 'comments', 'reports', 'shares', 'date', 'active', 'hidden', 'pinned'),
+            'ownFields' => array('id', 'owner_id', 'type', 'action', 'object_id', 'object_privacy_view', 'content', 'title', 'description', 'rate', 'votes', 'comments', 'reports', 'reposts', 'date', 'active', 'hidden', 'pinned'),
             'searchFields' => array('description'),
             'restriction' => array(
         		'internal' => array('value' => 'timeline_common_post', 'field' => 'type', 'operator' => '='),

+ 96 - 77
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -28,7 +28,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
         	BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'flickity/|flickity.css',
             'jquery-ui/jquery-ui.css',
             'post.css',
-            'share.css',
+            'repost.css',
         ));
         $this->addJs(array(
             'jquery-ui/jquery-ui.custom.min.js',
@@ -39,7 +39,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
             'modernizr.js',
         	'flickity/flickity.pkgd.min.js',
             'post.js',
-            'share.js',
+            'repost.js',
         ));
     }
 
@@ -80,7 +80,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
 	                'modules' => $aParams['modules'],
 	                'timeline' => $aParams['timeline'],
         		)
-            )) . $this->getJsCode('share')
+            )) . $this->getJsCode('repost')
         ));
     }
 
@@ -97,7 +97,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
         $sContent = $this->getPost($aEvent, $aParams);
 
         $oModule = $this->getModule();
-        if($oModule->isAllowedView($aEvent) !== true)
+        if($oModule->isAllowedViewCounter($aEvent) !== true)
             return '';
 
         if(!$this->_oConfig->isSystem($aEvent['type'], $aEvent['action'])) {
@@ -351,47 +351,47 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
         ));
     }
 
-    public function getShareElement($iOwnerId, $sType, $sAction, $iObjectId, $aParams = array())
+    public function getRepostElement($iOwnerId, $sType, $sAction, $iObjectId, $aParams = array())
     {
-        $aShared = $this->_oDb->getShared($sType, $sAction, $iObjectId);
-        if(empty($aShared) || !is_array($aShared))
+        $aReposted = $this->_oDb->getReposted($sType, $sAction, $iObjectId);
+        if(empty($aReposted) || !is_array($aReposted))
             return '';
 
 		$oModule = $this->getModule();
-		$bDisabled = $oModule->isAllowedShare($aShared) !== true || $this->_oDb->isShared($aShared['id'], $iOwnerId, $oModule->getUserId());
-		if($bDisabled && (int)$aShared['shares'] == 0)
+		$bDisabled = $oModule->isAllowedRepost($aReposted) !== true || $this->_oDb->isReposted($aReposted['id'], $iOwnerId, $oModule->getUserId());
+		if($bDisabled && (int)$aReposted['reposts'] == 0)
             return '';
 
 		$sStylePrefix = $this->_oConfig->getPrefix('style');
-        $sStylePrefixShare = $sStylePrefix . '-share-';
+        $sStylePrefixRepost = $sStylePrefix . '-repost-';
 
-        $bShowDoShareAsButtonSmall = isset($aParams['show_do_share_as_button_small']) && $aParams['show_do_share_as_button_small'] == true;
-        $bShowDoShareAsButton = !$bShowDoShareAsButtonSmall && isset($aParams['show_do_share_as_button']) && $aParams['show_do_share_as_button'] == true;
+        $bShowDoRepostAsButtonSmall = isset($aParams['show_do_repost_as_button_small']) && $aParams['show_do_repost_as_button_small'] == true;
+        $bShowDoRepostAsButton = !$bShowDoRepostAsButtonSmall && isset($aParams['show_do_repost_as_button']) && $aParams['show_do_repost_as_button'] == true;
 
-        $bShowDoShareIcon = isset($aParams['show_do_share_icon']) && $aParams['show_do_share_icon'] == true;
-        $bShowDoShareLabel = isset($aParams['show_do_share_label']) && $aParams['show_do_share_label'] == true;
+        $bShowDoRepostIcon = isset($aParams['show_do_repost_icon']) && $aParams['show_do_repost_icon'] == true;
+        $bShowDoRepostLabel = isset($aParams['show_do_repost_label']) && $aParams['show_do_repost_label'] == true;
         $bShowCounter = isset($aParams['show_counter']) && $aParams['show_counter'] === true;
 
-        //--- Do share link ---//
-		$sClass = $sStylePrefixShare . 'do-share';
-		if($bShowDoShareAsButton)
+        //--- Do repost link ---//
+		$sClass = $sStylePrefixRepost . 'do-repost';
+		if($bShowDoRepostAsButton)
 			$sClass .= ' bx-btn';
-		else if($bShowDoShareAsButtonSmall)
+		else if($bShowDoRepostAsButtonSmall)
 			$sClass .= ' bx-btn bx-btn-small';
 
 		$sOnClick = '';
 		if(!$bDisabled) {
 			$sCommonPrefix = $this->_oConfig->getPrefix('common_post');
-			if(str_replace($sCommonPrefix, '', $sType) == BX_TIMELINE_PARSE_TYPE_SHARE) {
-				$aSharedData = $this->_getCommonData($aShared);
+			if(str_replace($sCommonPrefix, '', $sType) == BX_TIMELINE_PARSE_TYPE_REPOST) {
+				$aRepostedData = $this->_getCommonData($aReposted);
 	
-	            $sOnClick = $this->getShareJsClick($iOwnerId, $aSharedData['content']['type'], $aSharedData['content']['action'], $aSharedData['content']['object_id']);
+	            $sOnClick = $this->_getRepostJsClick($iOwnerId, $aRepostedData['content']['type'], $aRepostedData['content']['action'], $aRepostedData['content']['object_id']);
 			}
 			else
-				$sOnClick = $this->getShareJsClick($iOwnerId, $sType, $sAction, $iObjectId);
+				$sOnClick = $this->_getRepostJsClick($iOwnerId, $sType, $sAction, $iObjectId);
 		}
 		else
-			$sClass .= $bShowDoShareAsButton || $bShowDoShareAsButtonSmall ? ' bx-btn-disabled' : ' ' . $sStylePrefixShare . 'disabled';
+			$sClass .= $bShowDoRepostAsButton || $bShowDoRepostAsButtonSmall ? ' bx-btn-disabled' : ' ' . $sStylePrefixRepost . 'disabled';
 
 		$aOnClickAttrs = array();
 		if(!empty($sClass))
@@ -399,72 +399,72 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
 		if(!empty($sOnClick))
 			$aOnClickAttrs[] = array('key' => 'onclick', 'value' => $sOnClick);
 
-		$sDoShare = '';
-        if($bShowDoShareIcon)
-            $sDoShare .= $this->parseHtmlByName('bx_icon.html', array('name' => 'repeat'));
+		$sDoRepost = '';
+        if($bShowDoRepostIcon)
+            $sDoRepost .= $this->parseHtmlByName('bx_icon.html', array('name' => 'repeat'));
 
-        if($bShowDoShareLabel)
-            $sDoShare .= ($sDoShare != '' ? ' ' : '') . _t('_bx_timeline_txt_do_share');
+        if($bShowDoRepostLabel)
+            $sDoRepost .= ($sDoRepost != '' ? ' ' : '') . _t('_bx_timeline_txt_do_repost');
 
-        return $this->parseHtmlByName('share_element_block.html', array(
+        return $this->parseHtmlByName('repost_element_block.html', array(
             'style_prefix' => $sStylePrefix,
-            'html_id' => $this->_oConfig->getHtmlIds('share', 'main') . $aShared['id'],
-            'class' => ($bShowDoShareAsButton ? $sStylePrefixShare . 'button' : '') . ($bShowDoShareAsButtonSmall ? $sStylePrefixShare . 'button-small' : ''),
-            'count' => $aShared['shares'],
-            'do_share' => $this->parseHtmlByName('bx_a.html', array(
+            'html_id' => $this->_oConfig->getHtmlIds('repost', 'main') . $aReposted['id'],
+            'class' => ($bShowDoRepostAsButton ? $sStylePrefixRepost . 'button' : '') . ($bShowDoRepostAsButtonSmall ? $sStylePrefixRepost . 'button-small' : ''),
+            'count' => $aReposted['reposts'],
+            'do_repost' => $this->parseHtmlByName('bx_a.html', array(
 	            'href' => 'javascript:void(0)',
-	            'title' => _t('_bx_timeline_txt_do_share'),
+	            'title' => _t('_bx_timeline_txt_do_repost'),
 	            'bx_repeat:attrs' => $aOnClickAttrs,
-	            'content' => $sDoShare
+	            'content' => $sDoRepost
 	        )),
             'bx_if:show_counter' => array(
                 'condition' => $bShowCounter,
                 'content' => array(
                     'style_prefix' => $sStylePrefix,
         			'bx_if:show_hidden' => array(
-        				'condition' => (int)$aShared['shares'] == 0,
+        				'condition' => (int)$aReposted['reposts'] == 0,
         				'content' => array()
         			),
-                    'counter' => $this->getShareCounter($aShared, $aParams)
+                    'counter' => $this->getRepostCounter($aReposted, $aParams)
                 )
             ),
-            'script' => $this->getShareJsScript()
+            'script' => $this->getRepostJsScript()
         ));
     }
 
-    public function getShareCounter($aEvent, $aParams = array())
+    public function getRepostCounter($aEvent, $aParams = array())
     {
         $sStylePrefix = $this->_oConfig->getPrefix('style');
-        $sJsObject = $this->_oConfig->getJsObject('share');
+        $sJsObject = $this->_oConfig->getJsObject('repost');
 
-        $bShowDoShareAsButtonSmall = isset($aParams['show_do_share_as_button_small']) && $aParams['show_do_share_as_button_small'] == true;
-        $bShowDoShareAsButton = !$bShowDoShareAsButtonSmall && isset($aParams['show_do_share_as_button']) && $aParams['show_do_share_as_button'] == true;
+        $bShowDoRepostAsButtonSmall = isset($aParams['show_do_repost_as_button_small']) && $aParams['show_do_repost_as_button_small'] == true;
+        $bShowDoRepostAsButton = !$bShowDoRepostAsButtonSmall && isset($aParams['show_do_repost_as_button']) && $aParams['show_do_repost_as_button'] == true;
 
-        $sClass = $sStylePrefix . '-share-counter';
-        if($bShowDoShareAsButtonSmall)
+        $sClass = $sStylePrefix . '-repost-counter';
+        if($bShowDoRepostAsButtonSmall)
             $sClass .= ' bx-btn-small-height';
-        if($bShowDoShareAsButton)
+        if($bShowDoRepostAsButton)
             $sClass .= ' bx-btn-height';
 
-        return $this->parseHtmlByName('share_counter.html', array(
+        return $this->parseHtmlByName('repost_counter.html', array(
             'href' => 'javascript:void(0)',
-            'title' => _t('_bx_timeline_txt_shared_by'),
+            'title' => _t('_bx_timeline_txt_reposted_by'),
             'bx_repeat:attrs' => array(
-                array('key' => 'id', 'value' => $this->_oConfig->getHtmlIds('share', 'counter') . $aEvent['id']),
+                array('key' => 'id', 'value' => $this->_oConfig->getHtmlIds('repost', 'counter') . $aEvent['id']),
                 array('key' => 'class', 'value' => $sClass),
                 array('key' => 'onclick', 'value' => 'javascript:' . $sJsObject . '.toggleByPopup(this, ' . $aEvent['id'] . ')')
             ),
-            'content' => !empty($aEvent['shares']) && (int)$aEvent['shares'] > 0 ? $aEvent['shares'] : ''
+            'content' => !empty($aEvent['reposts']) && (int)$aEvent['reposts'] > 0 ? $aEvent['reposts'] : ''
         ));
     }
 
-    public function getSharedBy($iId)
+    public function getRepostedBy($iId)
     {
         $aTmplUsers = array();
         $oModule = $this->getModule();
         $sStylePrefix = $this->_oConfig->getPrefix('style');
 
-        $aUserIds = $this->_oDb->getSharedBy($iId);
+        $aUserIds = $this->_oDb->getRepostedBy($iId);
         foreach($aUserIds as $iUserId) {
             list($sUserName, $sUserUrl, $sUserIcon, $sUserUnit) = $oModule->getUserInfo($iUserId);
             $aTmplUsers[] = array(
@@ -476,27 +476,37 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
         if(empty($aTmplUsers))
             $aTmplUsers = MsgBox(_t('_Empty'));
 
-        return $this->parseHtmlByName('share_by_list.html', array(
+        return $this->parseHtmlByName('repost_by_list.html', array(
             'style_prefix' => $sStylePrefix,
             'bx_repeat:list' => $aTmplUsers
         ));
     }
 
-    public function getShareJsScript()
+    public function getRepostJsScript()
     {
-        $this->addCss(array('share.css'));
-        $this->addJs(array('main.js', 'share.js'));
+        $this->addCss(array('repost.css'));
+        $this->addJs(array('main.js', 'repost.js'));
 
-        return $this->getJsCode('share');
+        return $this->getJsCode('repost');
     }
 
-    public function getShareJsClick($iOwnerId, $sType, $sAction, $iObjectId)
+    public function getRepostJsClick($iOwnerId, $sType, $sAction, $iObjectId)
     {
-        $sJsObject = $this->_oConfig->getJsObject('share');
-        $sFormat = "%s.shareItem(this, %d, '%s', '%s', %d);";
+        $aReposted = $this->_oDb->getReposted($sType, $sAction, $iObjectId);
+        if(empty($aReposted) || !is_array($aReposted))
+            return '';
 
-        $iOwnerId = !empty($iOwnerId) ? (int)$iOwnerId : $this->getModule()->getUserId(); //--- in whose timeline the content will be shared
-        return sprintf($sFormat, $sJsObject, $iOwnerId, $sType, $sAction, (int)$iObjectId);
+        $sResult = '';
+        $sCommonPrefix = $this->_oConfig->getPrefix('common_post');
+        if(str_replace($sCommonPrefix, '', $sType) == BX_TIMELINE_PARSE_TYPE_REPOST) {
+            $aRepostedData = $this->_getCommonData($aReposted);
+
+            $sResult = $this->_getRepostJsClick($iOwnerId, $aRepostedData['content']['type'], $aRepostedData['content']['action'], $aRepostedData['content']['object_id']);
+        }
+        else
+            $sResult = $this->_getRepostJsClick($iOwnerId, $sType, $sAction, $iObjectId);
+
+        return $sResult;
     }
 
     public function getAttachLinkForm()
@@ -680,6 +690,15 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
     	return BxTemplFunctions::getInstance()->transBox($sViewImagePopupId, $sViewImagePopupContent, true);
     }
 
+    protected function _getRepostJsClick($iOwnerId, $sType, $sAction, $iObjectId)
+    {
+        $sJsObject = $this->_oConfig->getJsObject('repost');
+        $sFormat = "%s.repostItem(this, %d, '%s', '%s', %d);";
+
+        $iOwnerId = !empty($iOwnerId) ? (int)$iOwnerId : $this->getModule()->getUserId(); //--- in whose timeline the content will be reposted
+        return sprintf($sFormat, $sJsObject, $iOwnerId, $sType, $sAction, (int)$iObjectId);
+    }
+
     protected function _getTmplVarsMenuItemActions(&$aEvent, $aBrowseParams = array())
     {
         $oMenu = BxDolMenu::getObjectInstance($this->_oConfig->getObject('menu_item_actions'));
@@ -894,7 +913,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
         );
     }
 
-    protected function _getTmplVarsContentShare($aEvent, $aBrowseParams = array())
+    protected function _getTmplVarsContentRepost($aEvent, $aBrowseParams = array())
     {
     	$aContent = &$aEvent['content'];
         $sStylePrefix = $this->_oConfig->getPrefix('style');
@@ -914,7 +933,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
             'content' => $sSample
         ));
 
-        $sTitle = _t('_bx_timeline_txt_shared', $sOwnerLink, $sSampleLink);
+        $sTitle = _t('_bx_timeline_txt_reposted', $sOwnerLink, $sSampleLink);
         $sText = $this->_getContent($aContent['parse_type'], $aEvent);
 
         return array(
@@ -1029,34 +1048,34 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
                 }
                 break;
 
-            case BX_TIMELINE_PARSE_TYPE_SHARE:
+            case BX_TIMELINE_PARSE_TYPE_REPOST:
                 if(empty($aEvent['content']))
                     return array();
 
                 $aContent = unserialize($aEvent['content']);
 
                 if(!$this->_oConfig->isSystem($aContent['type'] , $aContent['action'])) {
-                    $aShared = $this->_oDb->getEvents(array('browse' => 'id', 'value' => $aContent['object_id']));
-                    $aShared = $this->_getCommonData($aShared);
+                    $aReposted = $this->_oDb->getEvents(array('browse' => 'id', 'value' => $aContent['object_id']));
+                    $aReposted = $this->_getCommonData($aReposted);
                 } 
                 else
-                	$aShared = $this->_getSystemData($aContent);
+                	$aReposted = $this->_getSystemData($aContent);
 
-				if(empty($aShared) || !is_array($aShared))
+				if(empty($aReposted) || !is_array($aReposted))
 					return array();
 
-                $aResult['content'] = array_merge($aContent, $aShared['content']);
-                $aResult['content']['parse_type'] = !empty($aShared['content_type']) ? $aShared['content_type'] : BX_TIMELINE_PARSE_TYPE_DEFAULT;
-                $aResult['content']['owner_id'] = $aShared['owner_id'];
-                list($aResult['content']['owner_name'], $aResult['content']['owner_url']) = $oModule->getUserInfo($aShared['owner_id']);
+                $aResult['content'] = array_merge($aContent, $aReposted['content']);
+                $aResult['content']['parse_type'] = !empty($aReposted['content_type']) ? $aReposted['content_type'] : BX_TIMELINE_PARSE_TYPE_DEFAULT;
+                $aResult['content']['owner_id'] = $aReposted['owner_id'];
+                list($aResult['content']['owner_name'], $aResult['content']['owner_url']) = $oModule->getUserInfo($aReposted['owner_id']);
 
-                if(!empty($aShared['sample']))
-                    $aResult['content']['sample'] = $aShared['sample'];
-                if(!empty($aShared['sample_wo_article']))
-                    $aResult['content']['sample'] = $aShared['sample_wo_article'];
+                if(!empty($aReposted['sample']))
+                    $aResult['content']['sample'] = $aReposted['sample'];
+                if(!empty($aReposted['sample_wo_article']))
+                    $aResult['content']['sample'] = $aReposted['sample_wo_article'];
 
                 list($sUserName) = $oModule->getUserInfo($aEvent['object_id']);
-                $aResult['title'] = _t('_bx_timeline_txt_user_shared_sample', $sUserName, $aResult['content']['owner_name'], _t($aResult['content']['sample']));
+                $aResult['title'] = _t('_bx_timeline_txt_user_reposted_sample', $sUserName, $aResult['content']['owner_name'], _t($aResult['content']['sample']));
                 $aResult['description'] = '';
                 break;
         }

+ 41 - 0
modules/boonex/timeline/install/installer.php

@@ -17,6 +17,47 @@ class BxTimelineInstaller extends BxBaseModNotificationsInstaller
     {
         parent::__construct($aConfig);
     }
+
+    public function enable($aParams)
+    {
+        $aResult = parent::enable($aParams);
+        if($aResult['result'])
+            $this->updateParamAET(true);
+
+        return $aResult;
+    }
+
+    public function disable($aParams)
+    {
+        $aResult = parent::disable($aParams);
+        if($aResult['result'])
+            $this->updateParamAET(false);
+        
+        return $aResult;
+    }
+
+    protected function updateParamAET($bAdd)
+    {
+        $sAetDivider = ',';
+        $sAetName = 'bx_timeline_send';
+
+        $sAetParam = 'sys_email_attachable_email_templates';
+        $sAetParamValue = getParam($sAetParam);
+
+        if($bAdd)
+            $sAetParamValue = trim($sAetParamValue . $sAetDivider . $sAetName, $sAetDivider);
+        else {
+            $aAet = explode($sAetDivider, $sAetParamValue);
+
+            $mixedKey = array_search($sAetName, $aAet);
+            if($mixedKey !== false) {
+                unset($aAet[$mixedKey]);
+                $sAetParamValue = implode($sAetDivider, $aAet);
+            }
+        }
+
+        return setParam($sAetParam, $sAetParamValue);
+    }
 }
 
 /** @} */

+ 28 - 11
modules/boonex/timeline/install/langs/en.xml

@@ -48,11 +48,14 @@
 	<string name="_bx_timeline_acl_action_post"><![CDATA[Post]]></string>
 	<string name="_bx_timeline_acl_action_delete"><![CDATA[Delete]]></string>
 	<string name="_bx_timeline_acl_action_vote"><![CDATA[Vote]]></string>
-	<string name="_bx_timeline_acl_action_share"><![CDATA[Repost]]></string>
+	<string name="_bx_timeline_acl_action_repost"><![CDATA[Repost]]></string>
+	<string name="_bx_timeline_acl_action_send"><![CDATA[Send]]></string>
 	<string name="_bx_timeline_acl_action_pin"><![CDATA[Pin]]></string>
 
-	<string name="_bx_timeline_page_title_sys_view"><![CDATA[Timeline]]></string>
+	<string name="_bx_timeline_page_title_sys_view"><![CDATA[Profile Timeline]]></string>
 	<string name="_bx_timeline_page_title_view"><![CDATA[Timeline]]></string>
+	<string name="_bx_timeline_page_title_sys_view_home"><![CDATA[Home page Timeline]]></string>
+    <string name="_bx_timeline_page_title_view_home"><![CDATA[Timeline]]></string>
 	<string name="_bx_timeline_page_title_sys_item"><![CDATA[Timeline Item]]></string>
 	<string name="_bx_timeline_page_title_item"><![CDATA[Timeline Item]]></string>
 	<string name="_bx_timeline_page_title_sys_account"><![CDATA[Timeline]]></string>
@@ -76,6 +79,13 @@
     <string name="_bx_timeline_menu_item_view_other"><![CDATA[Posts by others]]></string>
     <string name="_bx_timeline_menu_item_get_rss"><![CDATA[RSS]]></string>
 
+    <string name="_bx_timeline_menu_title_item_share"><![CDATA[Share Item]]></string>
+    <string name="_bx_timeline_menu_set_title_item_share"><![CDATA[Share Item]]></string>
+    <string name="_bx_timeline_menu_item_title_system_item_repost"><![CDATA[Repost]]></string>
+    <string name="_bx_timeline_menu_item_title_item_repost"><![CDATA[Repost]]></string>
+    <string name="_bx_timeline_menu_item_title_system_item_send"><![CDATA[Send]]></string>
+    <string name="_bx_timeline_menu_item_title_item_send"><![CDATA[Send to Friend]]></string>
+    
     <string name="_bx_timeline_menu_title_item_manage"><![CDATA[Manage Item]]></string>
     <string name="_bx_timeline_menu_set_title_item_manage"><![CDATA[Manage Item]]></string>
 	<string name="_bx_timeline_menu_item_title_system_item_pin"><![CDATA[Pin]]></string>
@@ -91,7 +101,7 @@
     <string name="_bx_timeline_menu_item_title_item_comment"><![CDATA[Comment]]></string>
     <string name="_bx_timeline_menu_item_title_system_item_view"><![CDATA[View]]></string>
     <string name="_bx_timeline_menu_item_title_system_item_vote"><![CDATA[Vote]]></string>
-    <string name="_bx_timeline_menu_item_title_system_item_share"><![CDATA[Repost]]></string>
+    <string name="_bx_timeline_menu_item_title_system_item_share"><![CDATA[Share]]></string>
     <string name="_bx_timeline_menu_item_title_system_item_report"><![CDATA[Report]]></string>
     <string name="_bx_timeline_menu_item_title_system_item_more"><![CDATA[More]]></string>
 
@@ -114,7 +124,7 @@
 	<string name="_bx_timeline_menu_item_title_view_timeline_view"><![CDATA[Timeline]]></string>
 
 	<string name="_bx_timeline_alert_module_timeline_common_post"><![CDATA[Timeline (post)]]></string>
-	<string name="_bx_timeline_alert_module_timeline_common_share"><![CDATA[Timeline (repost)]]></string>
+	<string name="_bx_timeline_alert_module_timeline_common_repost"><![CDATA[Timeline (repost)]]></string>
 	<string name="_bx_timeline_alert_action_added"><![CDATA[add]]></string>
 
 	<string name="_bx_timeline_txt_msg_no_results"><![CDATA[Empty]]></string>
@@ -130,7 +140,7 @@
 	<string name="_bx_timeline_txt_rss_caption"><![CDATA[{0}'s timeline]]></string>
 	<string name="_bx_timeline_txt_added_sample"><![CDATA[added {0}]]></string>
 	<string name="_bx_timeline_txt_user_added_sample"><![CDATA[{0} added {1}]]></string>
-	<string name="_bx_timeline_txt_user_shared_sample"><![CDATA[{0} reposted {1}'s {2}]]></string>
+	<string name="_bx_timeline_txt_user_reposted_sample"><![CDATA[{0} reposted {1}'s {2}]]></string>
 	<string name="_bx_timeline_txt_sample"><![CDATA[post]]></string>
 	<string name="_bx_timeline_txt_sample_with_article"><![CDATA[a post]]></string>
 	<string name="_bx_timeline_txt_sample_ext"><![CDATA[timeline post]]></string>
@@ -138,12 +148,19 @@
     <string name="_bx_timeline_txt_sample_vote_single"><![CDATA[timeline post's vote]]></string>
     <string name="_bx_timeline_txt_today"><![CDATA[Today]]></string>
 
-	<string name="_bx_timeline_txt_do_share"><![CDATA[Repost]]></string>
-	<string name="_bx_timeline_txt_shared"><![CDATA[Reposted {0}'s {1}.]]></string>
-	<string name="_bx_timeline_txt_shared_by"><![CDATA[Reposted by]]></string>
-	<string name="_bx_timeline_txt_err_cannot_share"><![CDATA[Cannot repost. Please report.]]></string>
-	<string name="_bx_timeline_txt_err_already_shared"><![CDATA[You already reposted the item.]]></string>
-	<string name="_bx_timeline_txt_msg_success_share"><![CDATA[]]></string>
+	<string name="_bx_timeline_txt_do_repost"><![CDATA[Repost]]></string>
+	<string name="_bx_timeline_txt_reposted"><![CDATA[Reposted {0}'s {1}.]]></string>
+	<string name="_bx_timeline_txt_reposted_by"><![CDATA[Reposted by]]></string>
+	<string name="_bx_timeline_txt_err_cannot_repost"><![CDATA[Cannot repost. Please report.]]></string>
+	<string name="_bx_timeline_txt_err_already_reposted"><![CDATA[You already reposted the item.]]></string>
+	<string name="_bx_timeline_txt_msg_success_repost"><![CDATA[The item was successfully reposted.]]></string>
+
+    <!-- EMAIL TEMPLATES -->
+    <string name="_bx_timeline_et_txt_name_send"><![CDATA[Send to Friend.]]></string>
+    <string name="_bx_timeline_et_txt_subject_send"><![CDATA[It may be interesting for you.]]></string>
+    <string name="_bx_timeline_et_txt_body_send"><![CDATA[
+<p>Hello.</p>
+<p>Take a look at <a href="{ViewLink}">this post</a>, it may be interesting for you.</p>]]></string>
 
 	<string name="_bx_ntfs_alert_action_post_common"><![CDATA[add post]]></string>
 </resources>

+ 4 - 0
modules/boonex/timeline/install/sql/disable.sql

@@ -54,3 +54,7 @@ DELETE FROM `sys_objects_search` WHERE `ObjectName` IN ('bx_timeline', 'bx_timel
 
 -- METATAGS
 DELETE FROM `sys_objects_metatags` WHERE `object` = 'bx_timeline';
+
+
+-- EMAIL TEMPLATES
+DELETE FROM `sys_email_templates` WHERE `Module` = 'bx_timeline';

+ 44 - 12
modules/boonex/timeline/install/sql/enable.sql

@@ -1,6 +1,7 @@
 -- PAGES & BLOCKS
 INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_timeline_view', '_bx_timeline_page_title_sys_view', '_bx_timeline_page_title_view', 'bx_timeline', 5, 2147483647, 1, 'timeline-view', 'page.php?i=timeline-view', '', '', '', 0, 1, 0, 'BxTimelinePageView', 'modules/boonex/timeline/classes/BxTimelinePageView.php'),
+('bx_timeline_view_home', '_bx_timeline_page_title_sys_view_home', '_bx_timeline_page_title_view_home', 'bx_timeline', 5, 2147483647, 1, 'timeline-view-home', 'page.php?i=timeline-view-home', '', '', '', 0, 1, 0, '', ''),
 ('bx_timeline_item', '_bx_timeline_page_title_sys_item', '_bx_timeline_page_title_item', 'bx_timeline', 5, 2147483647, 1, 'timeline-item', 'page.php?i=timeline-item', '', '', '', 0, 1, 0, '', '');
 
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
@@ -8,6 +9,10 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designb
 ('bx_timeline_view', 1, 'bx_timeline', '_bx_timeline_page_block_title_view', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:14:"get_block_view";}', 0, 0, 2),
 ('bx_timeline_view', 1, 'bx_timeline', '_bx_timeline_page_block_title_view_outline', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:22:"get_block_view_outline";}', 0, 0, 3),
 
+('bx_timeline_view_home', 1, 'bx_timeline', '_bx_timeline_page_block_title_post_home', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:19:"get_block_post_home";}', 0, 0, 1),
+('bx_timeline_view_home', 1, 'bx_timeline', '_bx_timeline_page_block_title_view_home', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:19:"get_block_view_home";}', 0, 0, 2),
+('bx_timeline_view_home', 1, 'bx_timeline', '_bx_timeline_page_block_title_view_home_outline', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:27:"get_block_view_home_outline";}', 0, 0, 3),
+
 ('bx_timeline_item', 1, 'bx_timeline', '_bx_timeline_page_block_title_item', 0, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:14:"get_block_item";}', 0, 0, 1);
 
 -- PAGES: add page block on dashboard
@@ -37,7 +42,19 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designb
 ('trigger_page_group_view_entry', @iPBCellGroup, 'bx_timeline', '_bx_timeline_page_block_title_view_profile', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:22:"get_block_view_profile";s:6:"params";a:1:{i:0;s:6:"{type}";}}', 0, 0, 0),
 ('trigger_page_group_view_entry', @iPBCellGroup, 'bx_timeline', '_bx_timeline_page_block_title_view_profile_outline', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:22:"get_block_view_profile_outline";s:6:"params";a:1:{i:0;s:6:"{type}";}}', 0, 0, 0);
 
--- MENU: Item Manage (Delete)
+
+-- MENU: Item Share (Repost, Send to Friend, etc)
+INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
+('bx_timeline_menu_item_share', '_bx_timeline_menu_title_item_share', 'bx_timeline_menu_item_share', 'bx_timeline', 6, 0, 1, 'BxTimelineMenuItemShare', 'modules/boonex/timeline/classes/BxTimelineMenuItemShare.php');
+
+INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
+('bx_timeline_menu_item_share', 'bx_timeline', '_bx_timeline_menu_set_title_item_share', 0);
+
+INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES
+('bx_timeline_menu_item_share', 'bx_timeline', 'item-repost', '_bx_timeline_menu_item_title_system_item_repost', '_bx_timeline_menu_item_title_item_repost', 'javascript:void(0)', 'javascript:{js_onclick_repost}', '_self', 'repeat', '', 2147483647, 1, 0, 1),
+('bx_timeline_menu_item_share', 'bx_timeline', 'item-send', '_bx_timeline_menu_item_title_system_item_send', '_bx_timeline_menu_item_title_item_send', 'page.php?i=start-convo&et={et_send}', '', '_self', 'envelope', '', 2147483647, 1, 0, 2);
+
+-- MENU: Item Manage (Pin, Delete, etc)
 INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_timeline_menu_item_manage', '_bx_timeline_menu_title_item_manage', 'bx_timeline_menu_item_manage', 'bx_timeline', 6, 0, 1, 'BxTimelineMenuItemManage', 'modules/boonex/timeline/classes/BxTimelineMenuItemManage.php');
 
@@ -49,7 +66,7 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_timeline_menu_item_manage', 'bx_timeline', 'item-unpin', '_bx_timeline_menu_item_title_system_item_unpin', '_bx_timeline_menu_item_title_item_unpin', 'javascript:void(0)', 'javascript:{js_object_view}.pinPost(this, {content_id}, 0)', '_self', 'thumb-tack', '', 2147483647, 1, 0, 1),
 ('bx_timeline_menu_item_manage', 'bx_timeline', 'item-delete', '_bx_timeline_menu_item_title_system_item_delete', '_bx_timeline_menu_item_title_item_delete', 'javascript:void(0)', 'javascript:{js_object_view}.deletePost(this, {content_id})', '_self', 'remove', '', 2147483647, 1, 0, 2);
 
--- MENU: Item Actions (Comment, Plus)
+-- MENU: Item Actions (Comment, Vote, Share, Report, etc)
 INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_timeline_menu_item_actions', '_bx_timeline_menu_title_item_actions', 'bx_timeline_menu_item_actions', 'bx_timeline', 15, 0, 1, 'BxTimelineMenuItemActions', 'modules/boonex/timeline/classes/BxTimelineMenuItemActions.php');
 
@@ -60,7 +77,7 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_timeline_menu_item_actions', 'bx_timeline', 'item-view', '_bx_timeline_menu_item_title_system_item_view', '', 'javascript:void(0)', '', '', '', '', '', 0, 2147483647, 1, 0, 0, 0),
 ('bx_timeline_menu_item_actions', 'bx_timeline', 'item-comment', '_bx_timeline_menu_item_title_system_item_comment', '_bx_timeline_menu_item_title_item_comment', 'javascript:void(0)', 'javascript:{comment_onclick}', '_self', 'comment', 'a:3:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:27:"get_menu_item_addon_comment";s:6:"params";a:3:{i:0;s:16:"{comment_system}";i:1;s:16:"{comment_object}";i:2;s:6:"{view}";}}', '', 0, 2147483647, 1, 0, 1, 1),
 ('bx_timeline_menu_item_actions', 'bx_timeline', 'item-vote', '_bx_timeline_menu_item_title_system_item_vote', '', 'javascript:void(0)', '', '', '', '', '', 0, 2147483647, 1, 0, 0, 2),
-('bx_timeline_menu_item_actions', 'bx_timeline', 'item-share', '_bx_timeline_menu_item_title_system_item_share', '', 'javascript:void(0)', '', '', '', '', '', 0, 2147483647, 1, 0, 0, 3),
+('bx_timeline_menu_item_actions', 'bx_timeline', 'item-share', '_bx_timeline_menu_item_title_system_item_share', '', 'javascript:void(0)', 'bx_menu_popup(''bx_timeline_menu_item_share'', this, {''id'':''bx_timeline_menu_item_share_{content_id}''}, {content_id:{content_id}});', '', 'share-alt', '', 'bx_timeline_menu_item_share', 1, 2147483647, 1, 0, 0, 3),
 ('bx_timeline_menu_item_actions', 'bx_timeline', 'item-report', '_bx_timeline_menu_item_title_system_item_report', '', 'javascript:void(0)', '', '', '', '', '', 0, 2147483647, 1, 0, 0, 4),
 ('bx_timeline_menu_item_actions', 'bx_timeline', 'item-more', '_bx_timeline_menu_item_title_system_item_more', '', 'javascript:void(0)', 'bx_menu_popup(''bx_timeline_menu_item_manage'', this, {''id'':''bx_timeline_menu_item_manage_{content_id}''}, {content_id:{content_id}});', '', 'ellipsis-h', '', 'bx_timeline_menu_item_manage', 1, 2147483647, 1, 0, 0, 5);
 
@@ -127,8 +144,12 @@ INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`,
 SET @iIdActionVote = LAST_INSERT_ID();
 
 INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
-('bx_timeline', 'share', NULL, '_bx_timeline_acl_action_share', '', 1, 3);
-SET @iIdActionShare = LAST_INSERT_ID();
+('bx_timeline', 'repost', NULL, '_bx_timeline_acl_action_repost', '', 1, 3);
+SET @iIdActionRepost = LAST_INSERT_ID();
+
+INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
+('bx_timeline', 'send', NULL, '_bx_timeline_acl_action_send', '', 1, 3);
+SET @iIdActionSend = LAST_INSERT_ID();
 
 INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
 ('bx_timeline', 'pin', NULL, '_bx_timeline_acl_action_pin', '', 1, 3);
@@ -162,11 +183,17 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 (@iAdministrator, @iIdActionVote),
 (@iPremium, @iIdActionVote),
 
--- share
-(@iStandard, @iIdActionShare),
-(@iModerator, @iIdActionShare),
-(@iAdministrator, @iIdActionShare),
-(@iPremium, @iIdActionShare),
+-- repost
+(@iStandard, @iIdActionRepost),
+(@iModerator, @iIdActionRepost),
+(@iAdministrator, @iIdActionRepost),
+(@iPremium, @iIdActionRepost),
+
+-- send
+(@iStandard, @iIdActionSend),
+(@iModerator, @iIdActionSend),
+(@iAdministrator, @iIdActionSend),
+(@iPremium, @iIdActionSend),
 
 -- pin
 (@iModerator, @iIdActionPin),
@@ -188,8 +215,8 @@ INSERT INTO `sys_objects_cmts` (`Name`, `Table`, `CharsPostMin`, `CharsPostMax`,
 
 
 -- VIEWS
-INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
-('bx_timeline', 'bx_timeline_views_track', '86400', '1', 'bx_timeline_events', 'id', 'views', '', '');
+INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
+('bx_timeline', 'bx_timeline_views_track', '86400', '1', 'bx_timeline_events', 'id', 'object_id', 'views', '', '');
 
 
 -- VOTES
@@ -212,3 +239,8 @@ INSERT INTO `sys_objects_search` (`ObjectName`, `Title`, `Order`, `ClassName`, `
 -- METATAGS
 INSERT INTO `sys_objects_metatags` (`object`, `table_keywords`, `table_locations`, `table_mentions`, `override_class_name`, `override_class_file`) VALUES
 ('bx_timeline', 'bx_timeline_meta_keywords', 'bx_timeline_meta_locations', '', '', '');
+
+
+-- EMAIL TEMPLATES
+INSERT INTO `sys_email_templates` (`Module`, `NameSystem`, `Name`, `Subject`, `Body`) VALUES 
+('bx_timeline', '_bx_timeline_et_txt_name_send', 'bx_timeline_send', '_bx_timeline_et_txt_subject_send', '_bx_timeline_et_txt_body_send');

+ 6 - 6
modules/boonex/timeline/install/sql/install.sql

@@ -17,7 +17,7 @@ CREATE TABLE IF NOT EXISTS `bx_timeline_events` (
   `votes` int(11) unsigned NOT NULL default '0',
   `comments` int(11) unsigned NOT NULL default '0',
   `reports` int(11) unsigned NOT NULL default '0',
-  `shares` int(11) unsigned NOT NULL default '0',
+  `reposts` int(11) unsigned NOT NULL default '0',
   `date` int(11) NOT NULL default '0',
   `active` tinyint(4) NOT NULL default '1',
   `hidden` tinyint(4) NOT NULL default '0',
@@ -42,7 +42,7 @@ CREATE TABLE IF NOT EXISTS `bx_timeline_handlers` (
 
 INSERT INTO `bx_timeline_handlers`(`group`, `type`, `alert_unit`, `alert_action`, `content`) VALUES
 ('common_post', 'insert', 'timeline_common_post', '', ''),
-('common_share', 'insert', 'timeline_common_share', '', ''),
+('common_repost', 'insert', 'timeline_common_repost', '', ''),
 ('profile', 'delete', 'profile', 'delete', '');
 
 -- TABLES: STORAGES, TRANSCODERS, UPLOADERS
@@ -146,15 +146,15 @@ CREATE TABLE IF NOT EXISTS `bx_timeline_links2events` (
   UNIQUE KEY `link` (`event_id`, `link_id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
 
--- TABLES: SHARES
-CREATE TABLE IF NOT EXISTS `bx_timeline_shares_track` (
+-- TABLES: REPOSTS
+CREATE TABLE IF NOT EXISTS `bx_timeline_reposts_track` (
   `event_id` int(11) NOT NULL default '0',
   `author_id` int(11) NOT NULL default '0',
   `author_nip` int(11) unsigned NOT NULL default '0',
-  `shared_id` int(11) NOT NULL default '0',
+  `reposted_id` int(11) NOT NULL default '0',
   `date` int(11) NOT NULL default '0',
   UNIQUE KEY `event_id` (`event_id`),
-  KEY `share` (`shared_id`, `author_nip`)
+  KEY `repost` (`reposted_id`, `author_nip`)
 ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
 
 -- TABLES: COMMENTS

+ 2 - 0
modules/boonex/timeline/install/sql/uninstall.sql

@@ -14,6 +14,8 @@ DROP TABLE IF EXISTS `bx_timeline_videos2events`;
 DROP TABLE IF EXISTS `bx_timeline_links`;
 DROP TABLE IF EXISTS `bx_timeline_links2events`;
 
+DROP TABLE IF EXISTS `bx_timeline_reposts_track`;
+
 DROP TABLE IF EXISTS `bx_timeline_comments`;
 
 DROP TABLE IF EXISTS `bx_timeline_views_track`;

+ 16 - 0
modules/boonex/timeline/js/main.js

@@ -190,6 +190,22 @@ BxTimelineMain.prototype.loadingInPopup = function(e, bShow) {
 	bx_loading(oParent, bShow);
 };
 
+BxTimelineMain.prototype.loadingIn = function(e, bShow) {
+	var oElement = $(e);
+	var bElement = oElement.length > 0;
+
+	if(bElement && oElement.hasClass('bx-btn'))
+		this.loadingInButton(e, bShow);
+	else if(bElement && (oElement.hasClass(this.sClassItem) || oElement.parents('.' + this.sClassItem + ':first').length > 0))
+		this.loadingInItem(e, bShow);
+	else if(bElement && oElement.parents('.bx-popup-content:first').length > 0)
+		this.loadingInPopup(e, bShow);
+	else if(bElement && oElement.parents('.bx-db-container:first').length > 0)
+		this.loadingInBlock(e, bShow);
+	else 
+		bx_loading($('body'), bShow);
+};
+
 BxTimelineMain.prototype._loading = function(e, bShow) {
 	var oParent = $(e).length ? $(e) : $('body'); 
 	bx_loading(oParent, bShow);

+ 25 - 19
modules/boonex/timeline/js/share.js → modules/boonex/timeline/js/repost.js

@@ -8,10 +8,10 @@
  * @{
  */
 
-function BxTimelineShare(oOptions) {
+function BxTimelineRepost(oOptions) {
 	this._sActionsUri = oOptions.sActionUri;
     this._sActionsUrl = oOptions.sActionUrl;
-    this._sObjName = oOptions.sObjName == undefined ? 'oTimelineShare' : oOptions.sObjName;
+    this._sObjName = oOptions.sObjName == undefined ? 'oTimelineRepost' : oOptions.sObjName;
     this._iOwnerId = oOptions.iOwnerId == undefined ? 0 : oOptions.iOwnerId;
     this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'slide' : oOptions.sAnimationEffect;
     this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
@@ -19,9 +19,9 @@ function BxTimelineShare(oOptions) {
     this._oRequestParams = oOptions.oRequestParams == undefined ? {} : oOptions.oRequestParams;
 }
 
-BxTimelineShare.prototype = new BxTimelineMain();
+BxTimelineRepost.prototype = new BxTimelineMain();
 
-BxTimelineShare.prototype.shareItem = function(oLink, iOwnerId, sType, sAction, iId) {
+BxTimelineRepost.prototype.repostItem = function(oLink, iOwnerId, sType, sAction, iId) {
 	var $this = this;
 	var oDate = new Date();
 	var oParams = {
@@ -32,49 +32,55 @@ BxTimelineShare.prototype.shareItem = function(oLink, iOwnerId, sType, sAction,
 		_t: oDate.getTime()	
 	};
 
-	this.loadingInItem(oLink, true);
+	this.loadingIn(oLink, true);
 
 	jQuery.post(
-        this._sActionsUrl + 'share/',
+        this._sActionsUrl + 'repost/',
         oParams,
         function(oData) {
-        	$this.loadingInItem(oLink, false);
+        	$this.loadingIn(oLink, false);
 
-        	if(oData && oData.msg != undefined && oData.msg.length > 0)
-                alert(oData.msg);
+        	var oPopup = $(oLink).parents('.bx-popup-applied:visible:first');
+        	if(oPopup.length >0)
+        		oPopup.dolPopupHide();
 
         	var oCounter = $this._getCounter(oLink);
-        	if(oData && oData.counter != undefined && oCounter && oCounter.length > 0) {
-        		var oCounterHolder = oCounter.parents('.' + $this.sSP + '-share-counter-holder:first');
+        	var bCounter = oCounter && oCounter.length > 0;
+        	
+        	if(oData && oData.msg != undefined && oData.msg.length > 0 && !bCounter)
+                alert(oData.msg);
+        	
+        	if(oData && oData.counter != undefined && bCounter) {
+        		var oCounterHolder = oCounter.parents('.' + $this.sSP + '-repost-counter-holder:first');
 
         		oCounter.replaceWith(oData.counter);
         		oCounterHolder.bx_anim(oData.count > 0 ? 'show' : 'hide');
         	}
 
         	if(oData && oData.disabled)
-    			$(oLink).removeAttr('onclick').addClass($(oLink).hasClass('bx-btn') ? 'bx-btn-disabled' : $this.sSP + '-share-disabled');
+    			$(oLink).removeAttr('onclick').addClass($(oLink).hasClass('bx-btn') ? 'bx-btn-disabled' : $this.sSP + '-repost-disabled');
         },
         'json'
     );
 };
 
-BxTimelineShare.prototype.toggleByPopup = function(oLink, iId) {
+BxTimelineRepost.prototype.toggleByPopup = function(oLink, iId) {
     var oData = this._getDefaultData();
     oData['id'] = iId;
 
 	$(oLink).dolPopupAjax({
 		id: this._aHtmlIds['by_popup'] + iId, 
-		url: bx_append_url_params(this._sActionsUri + 'get_shared_by/', oData)
+		url: bx_append_url_params(this._sActionsUri + 'get_reposted_by/', oData)
 	});
 
 	return false;
 };
 
-BxTimelineShare.prototype._getCounter = function(oElement) {
-	var sSPShare = this.sSP + '-share';
+BxTimelineRepost.prototype._getCounter = function(oElement) {
+	var sSPRepost = this.sSP + '-repost';
 
-	if($(oElement).hasClass(sSPShare))
-		return $(oElement).find('.' + sSPShare + '-counter');
+	if($(oElement).hasClass(sSPRepost))
+		return $(oElement).find('.' + sSPRepost + '-counter');
 	else 
-		return $(oElement).parents('.' + sSPShare + ':first').find('.' + sSPShare + '-counter');
+		return $(oElement).parents('.' + sSPRepost + ':first').find('.' + sSPRepost + '-counter');
 };

+ 48 - 0
modules/boonex/timeline/template/css/repost.css

@@ -0,0 +1,48 @@
+/*--- Reposted By ---*/
+div.bx-tl-by-list {}
+div.bx-tl-by-list-cnt {
+	max-height: 200px;
+	max-height: 12.5rem;
+	min-width: 220px;
+	min-width: 13.75rem;
+	overflow: auto;
+}
+div.bx-tl-by-list div.bx-base-pofile-unit {
+	float: none;
+	margin-right: 0px;
+	margin-bottom: 0px;
+}
+
+/*--- Repost Element Styles ---*/
+.bx-tl-repost .bx-tl-repost-element-holder .bx-tl-repost-do-repost.bx-tl-repost-disabled,
+.bx-tl-repost .bx-tl-repost-element-holder .bx-tl-repost-do-repost.bx-tl-repost-disabled .sys-icon {
+	color: #ddd;
+}
+.bx-tl-repost .bx-tl-repost-counter-holder {
+	margin-left: 5px;
+	margin-left: 0.3125rem;
+}
+.bx-tl-repost-button .bx-tl-repost-element-holder,
+.bx-tl-repost-button .bx-tl-repost-counter-holder {
+	line-height: 36px;
+	line-height: 2.25rem;
+}
+.bx-tl-repost.bx-tl-repost-button .bx-tl-repost-counter-holder {
+	margin-left: 10px;
+	margin-left: 0.625rem;
+}
+.bx-tl-repost-button-small .bx-tl-repost-element-holder,
+.bx-tl-repost-button-small .bx-tl-repost-counter-holder {
+	line-height: 24px;
+	line-height: 1.6rem;
+}
+.bx-tl-repost-button .bx-tl-repost-counter-holder,
+.bx-tl-repost-button-small .bx-tl-repost-counter-holder {
+	font-size: 1.5rem;
+}
+
+div.bx-tl-repost div.bx-tl-repost-element-holder,
+div.bx-tl-repost div.bx-tl-repost-counter-holder {
+	position: relative;
+	float: left;
+}

+ 0 - 48
modules/boonex/timeline/template/css/share.css

@@ -1,48 +0,0 @@
-/*--- Shared By ---*/
-div.bx-tl-by-list {}
-div.bx-tl-by-list-cnt {
-	max-height: 200px;
-	max-height: 12.5rem;
-	min-width: 220px;
-	min-width: 13.75rem;
-	overflow: auto;
-}
-div.bx-tl-by-list div.bx-base-pofile-unit {
-	float: none;
-	margin-right: 0px;
-	margin-bottom: 0px;
-}
-
-/*--- Share Element Styles ---*/
-.bx-tl-share .bx-tl-share-element-holder .bx-tl-share-do-share.bx-tl-share-disabled,
-.bx-tl-share .bx-tl-share-element-holder .bx-tl-share-do-share.bx-tl-share-disabled .sys-icon {
-	color: #ddd;
-}
-.bx-tl-share .bx-tl-share-counter-holder {
-	margin-left: 5px;
-	margin-left: 0.3125rem;
-}
-.bx-tl-share-button .bx-tl-share-element-holder,
-.bx-tl-share-button .bx-tl-share-counter-holder {
-	line-height: 36px;
-	line-height: 2.25rem;
-}
-.bx-tl-share.bx-tl-share-button .bx-tl-share-counter-holder {
-	margin-left: 10px;
-	margin-left: 0.625rem;
-}
-.bx-tl-share-button-small .bx-tl-share-element-holder,
-.bx-tl-share-button-small .bx-tl-share-counter-holder {
-	line-height: 24px;
-	line-height: 1.6rem;
-}
-.bx-tl-share-button .bx-tl-share-counter-holder,
-.bx-tl-share-button-small .bx-tl-share-counter-holder {
-	font-size: 1.5rem;
-}
-
-div.bx-tl-share div.bx-tl-share-element-holder,
-div.bx-tl-share div.bx-tl-share-counter-holder {
-	position: relative;
-	float: left;
-}

+ 5 - 5
modules/boonex/timeline/template/css/view.css

@@ -247,21 +247,21 @@ div.bx-tl-view-outline div.bx-tl-il-thumbnail img {
 	max-height: 100px;
 }
 
-/*+++ Item Shared +++*/
-div.bx-tl-view-outline div.bx-tl-shared div.bx-tl-item-text {
+/*+++ Item Reposted +++*/
+div.bx-tl-view-outline div.bx-tl-reposted div.bx-tl-item-text {
 	padding-left: 5px;
 	padding-left: 0.3rem;
 
 	border-left: 1px solid #999999;
 	border-left: 0.07rem solid #999999;
 }
-div.bx-tl-view-outline div.bx-tl-shared div.bx-tl-title {
+div.bx-tl-view-outline div.bx-tl-reposted div.bx-tl-title {
 	font-size: 1.0rem;
 }
-div.bx-tl-view-outline div.bx-tl-shared div.bx-tl-title a {
+div.bx-tl-view-outline div.bx-tl-reposted div.bx-tl-title a {
 	color: #999999;
 }
-div.bx-tl-view-outline div.bx-tl-shared div.bx-tl-content {
+div.bx-tl-view-outline div.bx-tl-reposted div.bx-tl-content {
 	font-size: 0.875rem;
 	color: #999999;
 }

+ 0 - 0
modules/boonex/timeline/template/share_by_list.html → modules/boonex/timeline/template/repost_by_list.html


+ 0 - 0
modules/boonex/timeline/template/share_counter.html → modules/boonex/timeline/template/repost_counter.html


+ 7 - 0
modules/boonex/timeline/template/repost_element_block.html

@@ -0,0 +1,7 @@
+<div id="__html_id__" class="__style_prefix__-repost __class__ bx-def-margin-right-auto bx-def-margin-thd-topbottom bx-clearfix" bx_repost_data_count="__count__">
+	<div class="__style_prefix__-repost-element-holder">__do_repost__</div>
+	<bx_if:show_counter>
+		<div class="__style_prefix__-repost-counter-holder bx-btn-border"<bx_if:show_hidden> style="display:none"</bx_if:show_hidden>>__counter__</div>
+	</bx_if:show_counter>
+</div>
+__script__

+ 0 - 7
modules/boonex/timeline/template/share_element_block.html

@@ -1,7 +0,0 @@
-<div id="__html_id__" class="__style_prefix__-share __class__ bx-def-margin-right-auto bx-def-margin-thd-topbottom bx-clearfix" bx_share_data_count="__count__">
-	<div class="__style_prefix__-share-element-holder">__do_share__</div>
-	<bx_if:show_counter>
-		<div class="__style_prefix__-share-counter-holder bx-btn-border"<bx_if:show_hidden> style="display:none"</bx_if:show_hidden>>__counter__</div>
-	</bx_if:show_counter>
-</div>
-__script__

+ 1 - 1
modules/boonex/timeline/template/type_share.html → modules/boonex/timeline/template/type_repost.html

@@ -2,7 +2,7 @@
 	<div class="__style_prefix__-title bx-def-margin-sec-bottom bx-def-font-large">__title__</div>
 </bx_if:show_title>
 <bx_if:show_content>
-	<div class="__style_prefix__-content __style_prefix__-shared bx-def-margin-sec-bottom">
+	<div class="__style_prefix__-content __style_prefix__-reposted bx-def-margin-sec-bottom">
 	__content__
 	</div>
 </bx_if:show_content>

+ 1 - 1
template/scripts/BxBaseFavorite.php

@@ -60,7 +60,7 @@ class BxBaseFavorite extends BxDolFavorite
     	if($bDynamicMode || $this->_bCssJsAdded)
     		return;
 
-    	$this->_oTemplate->addJs(array('BxDolFavorite.js'));
+    	$this->_oTemplate->addJs(array('jquery.anim.js', 'BxDolFavorite.js'));
         $this->_oTemplate->addCss(array('favorite.css'));
 
         $this->_bCssJsAdded = true;

+ 1 - 1
template/scripts/BxBaseReport.php

@@ -62,7 +62,7 @@ class BxBaseReport extends BxDolReport
     	if($bDynamicMode || $this->_bCssJsAdded)
     		return;
 
-    	$this->_oTemplate->addJs(array('BxDolReport.js'));
+    	$this->_oTemplate->addJs(array('jquery.form.min.js', 'jquery.anim.js', 'BxDolReport.js'));
         $this->_oTemplate->addCss(array('report.css'));
 
         $this->_bCssJsAdded = true;

+ 1 - 1
template/scripts/BxBaseView.php

@@ -59,7 +59,7 @@ class BxBaseView extends BxDolView
     	if($bDynamicMode || $this->_bCssJsAdded)
     		return;
 
-    	$this->_oTemplate->addJs(array('BxDolView.js'));
+    	$this->_oTemplate->addJs(array('jquery.anim.js', 'BxDolView.js'));
         $this->_oTemplate->addCss(array('view.css'));
 
         $this->_bCssJsAdded = true;

+ 1 - 1
template/scripts/BxBaseVote.php

@@ -71,7 +71,7 @@ class BxBaseVote extends BxDolVote
     	if($bDynamicMode || $this->_bCssJsAdded)
     		return;
 
-    	$this->_oTemplate->addJs(array('BxDolVote.js'));
+    	$this->_oTemplate->addJs(array('jquery.anim.js', 'BxDolVote.js'));
         $this->_oTemplate->addCss(array('vote.css'));
 
         $this->_bCssJsAdded = true;