roman.lesnikov@gmail.com 2 лет назад
Родитель
Сommit
fc614ed10d

+ 159 - 3
inc/classes/BxDolAccount.php

@@ -123,6 +123,18 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
                 
         }
 
+        /**
+         * @hooks
+         * @hookdef hook-account-is_confirmed 'account', 'is_confirmed' - hook in  $oAccount->isConfirmed check
+         * - $unit_name - equals `account`
+         * - $action - equals `is_confirmed` 
+         * - $object_id - account id 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `type` - [string] confirmation type can be none/phone/email/email_and_phone/email_or_phone
+         *      - `override_result` - [bool] by ref, if account confirmed = true, otherwise false, can be overridden in hook processing
+         * @hook @ref hook-account-is_confirmed
+         */
         bx_alert('account', 'is_confirmed', $iId, false, array('type' => $sConfirmationType, 'override_result' => &$bResult));
 
         return $bResult;
@@ -156,6 +168,17 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
         else 
             $bResult = true;
 
+        /**
+         * @hooks
+         * @hookdef hook-account-is_confirmed 'account', 'is_confirmed_email' - hook in  $oAccount->isConfirmedEmail check
+         * - $unit_name - equals `account`
+         * - $action - equals `is_confirmed_email` 
+         * - $object_id - account id 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `override_result` - [bool] by ref, if email confirmed = true, otherwise false, can be overridden in hook processing
+         * @hook @ref hook-account-is_confirmed_email
+         */
         bx_alert('account', 'is_confirmed_email', $iId, false, array('override_result' => &$bResult));
 
         return $bResult;
@@ -174,6 +197,17 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
         else
             $bResult = true;
 
+        /**
+         * @hooks
+         * @hookdef hook-account-is_confirmed_phone 'account', 'is_confirmed_phone' - hook in  $oAccount->isConfirmedPhone check
+         * - $unit_name - equals `account`
+         * - $action - equals `is_confirmed_phone` 
+         * - $object_id - account id 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `override_result` - [bool] by ref, if phone confirmed = true, otherwise false, can be overridden in hook processing
+         * @hook @ref hook-account-is_confirmed_phone
+         */
         bx_alert('account', 'is_confirmed_phone', $iId, false, array('override_result' => &$bResult));
 
         return $bResult;
@@ -216,6 +250,16 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
 
         if ($this->_oQuery->updateEmailConfirmed($isConfirmed, $iId)) {
             $this->_aInfo = false;
+            /**
+             * @hooks
+             * @hookdef hook-account-confirm 'account', 'confirm' - hook in email confirmation $oAccount->updateEmailConfirmed 
+             * - $unit_name - equals `account`
+             * - $action - can be confirm/unconfirm
+             * - $object_id - account id 
+             * - $sender_id - not used 
+             * - $extra_params - not used 
+             * @hook @ref hook-account-confirm
+             */
             bx_alert('account', $this->isConfirmed() ? 'confirm' : 'unconfirm', $iId);
             return true;
         }
@@ -256,6 +300,17 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
         $iPasswordExpired = $this->getPasswordExpiredDateByAccount($iAccountId);
         
         if((int)$this->_oQuery->updatePassword($sPasswordHash, $sSalt, $iId, $iPasswordExpired) > 0) {
+            /**
+             * @hooks
+             * @hookdef hook-account-edited 'account', 'edited' - hook on account edited $oAccount->updatePassword 
+             * - $unit_name - equals `account`
+             * - $action - equals edited
+             * - $object_id - account id 
+             * - $sender_id - account sender id 
+             * - $extra_params - array of additional params with the following array keys:
+             *      - `action` - [string] action's name, can be reset_password
+             * @hook @ref hook-account-edited
+             */
             bx_alert('account', 'edited', $iId, $oAccountSender ? $oAccountSender->id() : $iId, array('action' => 'reset_password'));
             $this->doAudit($iId, '_sys_audit_action_account_reset_password');
             return true;
@@ -272,6 +327,16 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
     {
         $iId = (int)$iAccountId ? (int)$iAccountId : $this->_iAccountID;
         if ($this->_oQuery->updatePhone($sPhone, $iId)) {
+            /**
+             * @hooks
+             * @hookdef hook-account-set_phone 'account', 'set_phone' - hook after accout password changed
+             * - $unit_name - equals `account`
+             * - $action - equals `set_phone` 
+             * - $object_id - account id 
+             * - $sender_id - not used 
+             * - $extra_params - not used
+             * @hook @ref hook-account-set_phone
+             */
             bx_alert('account', 'set_phone', $iId);
             return true;
         }
@@ -318,6 +383,18 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
             return false;
 
         $ret = null;
+        /**
+         * @hooks
+         * @hookdef hook-account-before_switch_context 'account', 'before_switch_context' - hook before switch profile_id frof current logged user
+         * - $unit_name - equals `account`
+         * - $action - equals `before_switch_context` 
+         * - $object_id - account id 
+         * - $sender_id - profile_id to switch to
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `profile_id_current` - [int] current profile_id
+         *      - `override_result` - [int] by ref, profile_id to switch to, can be overridden in hook processing
+         * @hook @ref hook-account-before_switch_context
+         */
         bx_alert('account', 'before_switch_context', $iId, $iSwitchToProfileId, array('profile_id_current' => $aInfo['profile_id'], 'override_result' => &$ret));
         if ($ret !== null)
             return $ret;
@@ -326,7 +403,18 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
             return false;
 
         $this->_aInfo = false;
-            
+        
+        /**
+         * @hooks
+         * @hookdef hook-account-switch_context 'account', 'switch_context' - hook before switch profile_id frof current logged user
+         * - $unit_name - equals `account`
+         * - $action - equals `switch_context` 
+         * - $object_id - account id 
+         * - $sender_id - profile_id to switch to
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `profile_id_old` - [int] old profile_id
+         * @hook @ref hook-account-switch_context
+         */
         bx_alert('account', 'switch_context', $iId, $iSwitchToProfileId, array('profile_id_old' => $aInfo['profile_id']));
 
         return true;
@@ -410,6 +498,19 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
         $aInfo = $this->getInfo($iAccountId);
 
         $sDisplayName = !empty($aInfo['name']) ? $aInfo['name'] : _t('_sys_txt_user_n', $aInfo['id']);
+        
+        /**
+         * @hooks
+         * @hookdef hook-account-account_name 'account', 'account_name' - hook on get account display name
+         * - $unit_name - equals `account`
+         * - $action - equals `account_name` 
+         * - $object_id - account id 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `info` - [array] contains account info from $oAccount->getInfo()
+         *      - `display_name` - [string] by ref, account display name,  can be overridden in hook processing
+         * @hook @ref hook-account-account_name
+         */
         bx_alert('account', 'account_name', $iAccountId, 0, array('info' => $aInfo, 'display_name' => &$sDisplayName));
 
         return bx_process_output($sDisplayName);
@@ -569,6 +670,18 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
     public function isProfilesLimitReached ()
     {
         $iProfilesLimit = (int)getParam('sys_account_limit_profiles_number');
+        /**
+         * @hooks
+         * @hookdef hook-account-get_limit_profiles_number 'account', 'get_limit_profiles_number' - hook on get account limit on the number of profiles
+         * - $unit_name - equals `account`
+         * - $action - equals `get_limit_profiles_number` 
+         * - $object_id - not used 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `account_id` - [int] account id 
+         *      - `number` - [int] by ref, account limit on the number of profiles,  can be overridden in hook processing
+         * @hook @ref hook-account-get_limit_profiles_number
+         */
         bx_alert('account', 'get_limit_profiles_number', 0, 0, array('account_id' => $this->_iAccountID, 'number' => &$iProfilesLimit));
         if (!isAdmin() && $iProfilesLimit && ($iProfilesNum = $this->getProfilesNumber()) && $iProfilesNum >= $iProfilesLimit)
             return true;
@@ -633,6 +746,18 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
 
         // create system event before deletion
         $isStopDeletion = false;
+        /**
+         * @hooks
+         * @hookdef hook-account-before_delete 'account', 'before_delete' - hook on before delete account, 
+         * - $unit_name - equals `account`
+         * - $action - equals `before_delete` 
+         * - $object_id - account id 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `delete_with_content` - [bool] if account will delete with content = true, otherwise = false
+         *      - `stop_deletion` - [bool] by ref, if it set to true account deletion will stopped, can be overridden in hook processing
+         * @hook @ref hook-account-before_delete
+         */
         bx_alert('account', 'before_delete', $this->_iAccountID, 0, array('delete_with_content' => $bDeleteWithContent, 'stop_deletion' => &$isStopDeletion));
         if ($isStopDeletion)
             return false;
@@ -656,7 +781,17 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
         $sClass = __CLASS__ . '_' . $this->_iAccountID;
         unset($GLOBALS['bxDolClasses'][$sClass]);
 
-       // create system event
+       /**
+         * @hooks
+         * @hookdef hook-account-delete 'account', 'delete' - hook on after delete account 
+         * - $unit_name - equals `account`
+         * - $action - equals `delete` 
+         * - $object_id - account id 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `delete_with_content` - [bool] if account will delete with content = true, otherwise = false
+         * @hook @ref hook-account-delete
+         */
         bx_alert('account', 'delete', $this->_iAccountID, 0, array ('delete_with_content' => $bDeleteWithContent));
         
         $this->doAudit($this->_iAccountID, $bDeleteWithContent ? '_sys_audit_action_account_deleted_with_content' : '_sys_audit_action_account_deleted');
@@ -761,7 +896,17 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
         if (isset($aPageParams['i']) && $aPageParams['i'] == 'account-settings-password')
             $bNeedRedirectToChangePassword = false;
 
-        
+        /**
+         * @hooks
+         * @hookdef hook-account-is_need_to_change_password 'account', 'is_need_to_change_password' - hook on after delete account 
+         * - $unit_name - equals `account`
+         * - $action - equals `is_need_to_change_password` 
+         * - $object_id - account id 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `override_result` - [bool] by ref, if Need Redirect To Change Password = true, otherwise = false, can be overridden in hook processing
+         * @hook @ref hook-account-is_need_to_change_password
+         */
         bx_alert('account', 'is_need_to_change_password',  $iAccountId, false, array('override_result' => &$bNeedRedirectToChangePassword));
         
         if ($aAccountInfo['password_expired'] >0 && $aAccountInfo['password_expired'] < time() && $bNeedRedirectToChangePassword){
@@ -813,6 +958,17 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
         if($oProfile && $oProfile->getAccountId() != getLoggedId())
             $bResult = false;
 
+        /**
+         * @hooks
+         * @hookdef hook-account-allow_create_another_profile 'profile', 'allow_create_another_profile' - hook on check allow create profile 
+         * - $unit_name - equals `profile`
+         * - $action - equals `allow_create_another_profile` 
+         * - $object_id - profile id 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `override_result` - [bool] by ref, if allow create another profile = true, otherwise = false, can be overridden in hook processing
+         * @hook @ref hook-account-allow_create_another_profile
+         */
         bx_alert('profile', 'allow_create_another_profile', $iProfileId, 0, [
             'override_result' => &$bResult
         ]);

+ 1 - 1
inc/profiles.inc.php

@@ -336,7 +336,7 @@ function bx_check_password($sLogin, $sPassword, $iRole = BX_DOL_ROLE_MEMBER)
      * - $object_id - account id  
      * - $sender_id - not used 
      * - $extra_params - array of additional params with the following array keys:
-     *      - `error_msg` - [string] by ref, contains string with error description, can be overrided in hook processing
+     *      - `error_msg` - [string] by ref, contains string with error description, can be overridden in hook processing
      * @hook @ref hook-account-check_login
      */
     bx_alert('account', 'check_login',  $aAccountInfo['id'], false, array('error_msg' => &$sErrorMsg));

+ 1 - 1
inc/utils.inc.php

@@ -783,7 +783,7 @@ function clear_xss($val)
      * - $extra_params - array of additional params with the following array keys:
      *      - `oHtmlPurifier` - [object] HtmlPurifier object 
      *      - `input_data` - [string] string before check xss
-     *      - `return_data` - [string] by ref, string before check xss, can be overrided in hook processing
+     *      - `return_data` - [string] by ref, string before check xss, can be overridden in hook processing
      * @hook @ref hook-system-clear_xss
      */
     bx_alert('system', 'clear_xss', 0, 0, array('oHtmlPurifier' => $oHtmlPurifier, 'input_data' => $val, 'return_data' => &$sNewVal));

+ 46 - 4
template/scripts/BxBaseAccountForms.php

@@ -27,6 +27,17 @@ class BxBaseAccountForms extends BxDolProfileForms
     {
         $oForm = BxDolForm::getObjectInstance('sys_account', 'sys_account_create');
 
+        /**
+         * @hooks
+         * @hookdef hook-account-add_form_get 'account', 'add_form_get' - hook in get some account form
+         * - $unit_name - equals `account`
+         * - $action - equals `add_form_get` 
+         * - $object_id - not used 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `form_object` - [object] by ref, form object, can be overridden in hook processing
+         * @hook @ref hook-account-add_form_get
+         */
         bx_alert('account', 'add_form_get', 0, 0, [
             'form_object' => &$oForm
         ]);
@@ -60,6 +71,17 @@ class BxBaseAccountForms extends BxDolProfileForms
         $oForm->aFormAttrs['action'] = !empty($aParams['action']) ? $aParams['action'] : bx_absolute_url(BxDolPermalinks::getInstance()->permalink('page.php?i=create-account'));
         $oForm->initChecker(self::$PROFILE_FIELDS);
 
+        /**
+         * @hooks
+         * @hookdef hook-account-add_form_check 'account', 'add_form_check' - hook in  some account form after check
+         * - $unit_name - equals `account`
+         * - $action - equals `add_form_check` 
+         * - $object_id - not used 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `form_object` - [object] by ref, form object, can be overridden in hook processing
+         * @hook @ref hook-account-add_form_check
+         */
         bx_alert('account', 'add_form_check', 0, 0, array(
             'form_object' => &$oForm
         ));
@@ -68,6 +90,18 @@ class BxBaseAccountForms extends BxDolProfileForms
             
             $sCode = $oForm->getCode();
 
+            /**
+             * @hooks
+             * @hookdef hook-account-add_form 'account', 'add_form' - hook in  some account form after check
+             * - $unit_name - equals `account`
+             * - $action - equals `add_form` 
+             * - $object_id - not used 
+             * - $sender_id - not used 
+             * - $extra_params - array of additional params with the following array keys:
+             *      - `form_object` - [object] by ref, form object, can be overridden in hook processing
+             *      - `form_code` - [string] by ref, html for form, can be overridden in hook processing
+             * @hook @ref hook-account-add_form
+             */
             bx_alert('account', 'add_form', 0, 0, array(
                     'form_object' => &$oForm,
                     'form_code' => &$sCode
@@ -155,8 +189,7 @@ class BxBaseAccountForms extends BxDolProfileForms
 
     public function onAccountCreated ($iAccountId, $isSetPendingApproval, $iAction = BX_PROFILE_ACTION_MANUAL, $bNeedToLogin = true)
     {
-        // alert
-        bx_alert('account', 'add', $iAccountId, 0);
+        bx_alert('account', 'add', $iAccountId);
 
         // if email_confirmation procedure is enabled - send email confirmation letter
         $oAccount = BxDolAccount::getInstance($iAccountId);
@@ -173,7 +206,16 @@ class BxBaseAccountForms extends BxDolProfileForms
         if ($sStatus == BX_PROFILE_STATUS_PENDING && $isAutoApprove)
             $oProfile->approve(BX_PROFILE_ACTION_AUTO, $iProfileId, getParam('sys_account_activation_letter') == 'on');
 
-        // alert
+        /**
+         * @hooks
+         * @hookdef hook-account-added 'account', 'added' - hook on new account created
+         * - $unit_name - equals `system`
+         * - $action - equals `added` 
+         * - $object_id - account id 
+         * - $sender_id - not used 
+         * - $extra_params - not used
+         * @hook @ref hook-account-added
+         */
         bx_alert('account', 'added', $iAccountId);
 
         // login to the created account automatically
@@ -299,7 +341,7 @@ class BxBaseAccountForms extends BxDolProfileForms
                 $oProfile->disapprove(BX_PROFILE_ACTION_AUTO);  // change profile to 'pending' only if some text fields were changed and profile is active
         }
 
-        // create an alert
+        
         bx_alert('account', 'edited', $aAccountInfo['id'], $aAccountInfo['id'], array('display' => $sDisplayName));
 
         // display result message            

+ 15 - 0
template/scripts/BxBaseCmts.php

@@ -488,6 +488,21 @@ class BxBaseCmts extends BxDolCmts
         
         $sResult = $this->_oTemplate->parseHtmlByName($this->_sTmplNameItem, $aVars);
         
+        /**
+         * @hooks
+         * @hookdef hook-system-view_comment 'system', 'view_comment' - hook on get comment
+         * - $unit_name - equals `system`
+         * - $action - equals `view_comment` 
+         * - $object_id - comment_id
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `comment` - [array] comment's data
+         *      - `system` - [string] comment's system name
+         *      - `tmpl_name` - [string] template file path
+         *      - `tmpl_vars` - [string] params for template file parsing
+         *      - `override_result` - [string] by ref, if account confirmed = true, otherwise false, can be overridden in hook processing
+         * @hook @ref hook-system-view_comment
+         */
         bx_alert('system', 'view_comment', $aCmt['cmt_id'], 0, array('comment' => $aCmt, 'system' => $this->_sSystem, 'tmpl_name' => $this->_sTmplNameItem, 'tmpl_vars' => $aVars, 'override_result' => &$sResult));
         
         return $sResult;

+ 27 - 0
template/scripts/BxBaseFavorite.php

@@ -248,6 +248,19 @@ class BxBaseFavorite extends BxDolFavorite
             $this->_triggerValue($bPerformUndo ? -1 : 1);
 
             bx_alert($this->_sSystem, ($bPerformUndo ? 'un' : '') . 'favorite', $iObjectId, $iAuthorId, array('favorite_author_id' => $iAuthorId, 'object_author_id' => $iObjectAuthorId));
+            /**
+             * @hooks
+             * @hookdef hook-report-undo 'favorite', 'favorite' - hook on add new object to favorites lists or remove object from favorites lists 
+             * - $unit_name - equals `favorite`
+             * - $action - can be  do/undo 
+             * - $object_id - not used
+             * - $sender_id - profile_id for favorite's author
+             * - $extra_params - array of additional params with the following array keys:
+             *      - `object_system` - [string] system name, ex: bx_posts
+             *      - `object_id` - [int] reported object id 
+             *      - `object_author_id` - [int] author's profile_id for reported object_id 
+             * @hook @ref hook-favorite-undo
+             */
             bx_alert('favorite', ($bPerformUndo ? 'un' : '') . 'do', 0, $iAuthorId, array('object_system' => $this->_sSystem, 'object_id' => $iObjectId, 'object_author_id' => $iObjectAuthorId));
 
             $aFavorite = $this->_oQuery->getFavorite($iObjectId);
@@ -310,6 +323,20 @@ class BxBaseFavorite extends BxDolFavorite
             $this->_trigger();
 
             bx_alert($this->_sSystem, 'favorite', $iObjectId, $iAuthorId, array('favorite_author_id' => $iAuthorId, 'object_author_id' => $iObjectAuthorId, 'list_ids' => $aList));
+            /**
+             * @hooks
+             * @hookdef hook-report-do 'favorite', 'favorite' - hook on add new object to  favorites lists
+             * - $unit_name - equals `favorite`
+             * - $action - equals `favorite` 
+             * - $object_id - favorited object id 
+             * - $sender_id - profile_id for favorite's author
+             * - $extra_params - array of additional params with the following array keys:
+             *      - `object_system` - [string] system name, ex: bx_posts
+             *      - `object_id` - [int] reported object id 
+             *      - `object_author_id` - [int] author's profile_id for reported object_id 
+             *      - `list_ids` - [array] array of id's list 
+             * @hook @ref hook-favorite-do
+             */
             bx_alert('favorite', 'do', 0, $iAuthorId, array('object_system' => $this->_sSystem, 'object_id' => $iObjectId, 'object_author_id' => $iObjectAuthorId, 'list_ids' => $aList));
 
             $bPerformed = count($aList) > 0;

+ 14 - 0
template/scripts/BxBaseFormAccount.php

@@ -195,6 +195,20 @@ class BxBaseFormAccount extends BxTemplFormView
             $oAccount = BxDolAccount::getInstance($val, true);
             if ($oAccount) { 
                 $aAccountInfo = $oAccount->getInfo();
+                /**
+                 * @hooks
+                 * @hookdef hook-account-change_receive_news 'account', 'change_receive_news' - hook after change receive_news parameter for account
+                 * - $unit_name - equals `system`
+                 * - $action - equals `change_receive_news` 
+                 * - $object_id - not used 
+                 * - $sender_id - not used 
+                 * - $extra_params - array of additional params with the following array keys:
+                 *      - `account_id` - [int] account id 
+                 *      - `old_value` - [bool] old value for receive_news parameter
+                 *      - `new_value` - [bool] new value for receive_news parameter
+                 *      - `email` - [string] account's email
+                 * @hook @ref hook-account-change_receive_news
+                 */
                 bx_alert('account', 'change_receive_news', 0, false, array('account_id' => $val, 'old_value' => $aAccountInfo['receive_news'], 'new_value' => $this->getCleanValue('receive_news'), 'email' => $aAccountInfo['email']));
             }
         }

+ 1 - 0
template/scripts/BxBasePage.php

@@ -602,6 +602,7 @@ class BxBasePage extends BxDolPage
         else if(!$bIsVisible)
             $a['page_status'] = 403;
 
+        
         bx_alert('system', 'get_page_api', 0, 0, $aExtras);
 
         return $a;

+ 28 - 0
template/scripts/BxBaseReport.php

@@ -93,6 +93,19 @@ class BxBaseReport extends BxDolReport
                 $this->_trigger();
 
                 bx_alert($this->_sSystem, 'undoReport', $iObjectId, $iAuthorId, array('report_id' => $iId, 'report_author_id' => $iAuthorId, 'object_author_id' => $iObjectAuthorId));
+                /**
+                 * @hooks
+                 * @hookdef hook-report-undo 'report', 'undo' - hook on cancel report 
+                 * - $unit_name - equals `report`
+                 * - $action - equals `undo` 
+                 * - $object_id - report id 
+                 * - $sender_id - profile_id for report's author
+                 * - $extra_params - array of additional params with the following array keys:
+                 *      - `object_system` - [string] system name, ex: bx_posts
+                 *      - `object_id` - [int] reported object id 
+                 *      - `object_author_id` - [int] author's profile_id for reported object_id 
+                 * @hook @ref hook-report-undo
+                 */
                 bx_alert('report', 'undo', $iId, $iAuthorId, array('object_system' => $this->_sSystem, 'object_id' => $iObjectId, 'object_author_id' => $iObjectAuthorId));
 
                 $aReport = $this->_getReport($iObjectId, true);
@@ -173,6 +186,21 @@ class BxBaseReport extends BxDolReport
                 $this->_trigger();
 
                 bx_alert($this->_sSystem, 'doReport', $iObjectId, $iAuthorId, array('report_id' => $iId, 'report_author_id' => $iAuthorId, 'object_author_id' => $iObjectAuthorId, 'type' => $sType, 'text' => $sText));
+                /**
+                 * @hooks
+                 * @hookdef hook-report-do 'report', 'do' - hook on create new report 
+                 * - $unit_name - equals `report`
+                 * - $action - equals `do` 
+                 * - $object_id - report id 
+                 * - $sender_id - profile_id for report's author
+                 * - $extra_params - array of additional params with the following array keys:
+                 *      - `object_system` - [string] system name, ex: bx_posts
+                 *      - `object_id` - [int] reported object id 
+                 *      - `object_author_id` - [int] author's profile_id for reported object_id 
+                 *      - `type` - [string] report type
+                 *      - `text` - [bool] report text
+                 * @hook @ref hook-report-do
+                 */
                 bx_alert('report', 'do', $iId, $iAuthorId, array('object_system' => $this->_sSystem, 'object_id' => $iObjectId, 'object_author_id' => $iObjectAuthorId, 'type' => $sType, 'text' => $sText));
 
                 $aResult = $this->_returnReportData($iObjectId, $iAuthorId, $iId, $aReport, !$bPerformed);

+ 12 - 0
template/scripts/BxBaseSearch.php

@@ -145,6 +145,18 @@ class BxBaseSearch extends BxDolSearch
             $aForm['inputs']['keyword']['attrs']['onpaste'] = $aForm['inputs']['keyword']['attrs']['onkeydown'];
         }
         
+        /**
+         * @hooks
+         * @hookdef hook-search-get_form 'search', 'get_form' - hook in create search form 
+         * - $unit_name - equals `search`
+         * - $action - equals `get_form` 
+         * - $object_id - not used 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `object` - [object] current search object
+         *      - `override_result` - [array] by ref, form arrray defenition, can be overridden in hook processing
+         * @hook @ref hook-search-get_form
+         */
         bx_alert('search', 'get_form', 0, 0, array('object' => $this, 'override_result' => &$aForm));
 
         return $aForm;

+ 13 - 0
template/scripts/BxBaseSearchExtended.php

@@ -172,6 +172,19 @@ class BxBaseSearchExtended extends BxDolSearchExtended
             $aParamsSearch['order'] = [['field' => $aTmp[0], 'direction' => $aTmp[1]]];
         }
         
+        /**
+         * @hooks
+         * @hookdef hook-search-get_data 'search', 'get_data' - hook in get data for serach
+         * - $unit_name - equals `search`
+         * - $action - equals `get_data` 
+         * - $object_id - not used 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `object` - [array] by ref, object info for current search, can be overridden in hook processing
+         *      - `search_params` - [string] by ref, search params, can be overridden in hook processing
+         *      - `search_results` - [string] by ref, html for block, can be overridden in hook processing
+         * @hook @ref hook-search-get_data
+         */
         bx_alert('search', 'get_data', 0, false, array('object' => $this->_aObject, 'search_params' => &$aParamsSearch, 'search_results' => &$aResults));
 
     	if($aResults === false)

+ 13 - 0
template/scripts/BxBaseSearchResult.php

@@ -82,6 +82,19 @@ class BxBaseSearchResult extends BxDolSearchResult
             ]);
         }
 
+        /**
+         * @hooks
+         * @hookdef hook-simple_search-show_data 'simple_search', 'show_data' - hook in display block for search
+         * - $unit_name - equals `simple_search`
+         * - $action - equals `show_data` 
+         * - $object_id - not used 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `object` - [array] by ref, object info for current search, can be overridden in hook processing
+         *      - `mode` - [string], search mode
+         *      - `search_results` - [string] by ref, html for block, can be overridden in hook processing
+         * @hook @ref hook-simple_search-show_data
+         */
         bx_alert('simple_search', 'show_data', 0, false, [
             'object' => &$this->aCurrent, 
             'mode' => $this->_sMode, 

+ 61 - 0
template/scripts/BxBaseServiceAccount.php

@@ -421,6 +421,19 @@ class BxBaseServiceAccount extends BxDol
                     $sActivationCode = rand(1000, 9999);
                     $sActivationText =_t('_sys_txt_confirm_phone_sms_text', $sActivationCode);
                     $ret = null;
+                    /**
+                     * @hooks
+                     * @hookdef hook-account-before_confirm_phone_send_sms 'account', 'before_confirm_phone_send_sms' - hook in confirm phone 
+                     * - $unit_name - equals `account`
+                     * - $action - equals `before_confirm_phone_send_sms` 
+                     * - $object_id - account id 
+                     * - $sender_id - logged profile_id
+                     * - $extra_params - array of additional params with the following array keys:
+                     *      - `phone_number` - [string]  by ref, phone number to send sms, can be overridden in hook processing
+                     *      - `sms_text` - [string] by ref, text for sms, can be overridden in hook processing
+                     *      - `override_result` - [mixed] by ref, can be object, can be overridden in hook processing
+                     * @hook @ref hook-account-before_confirm_phone_send_sms
+                     */
                     bx_alert('account', 'before_confirm_phone_send_sms', $oAccount->id(), bx_get_logged_profile_id(), array('phone_number' => $sPhoneNumber, 'sms_text' => $sActivationText, 'override_result' => &$ret));
                     if ($ret === null) 
                     {
@@ -464,6 +477,17 @@ class BxBaseServiceAccount extends BxDol
 
         // redirect with success message
         $sUrl = getParam('sys_redirect_after_email_confirmation');
+        /**
+         * @hooks
+         * @hookdef hook-account-after_email_confirmation 'account', 'after_email_confirmation' - hook after email confirmed
+         * - $unit_name - equals `account`
+         * - $action - equals `after_email_confirmation` 
+         * - $object_id - account id 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `override_result` - [string] by ref, url for redirect after email confirmed, can be overridden in hook processing
+         * @hook @ref hook-account-after_email_confirmation
+         */
         bx_alert('account', 'after_email_confirmation', $mixedAccountId, false, ['override_result' => &$sUrl]);
 
         $oTemplate = BxDolTemplate::getInstance();
@@ -605,6 +629,19 @@ class BxBaseServiceAccount extends BxDol
                 $sSmsText = _t('_sys_txt_forgot_pasword_sms_text', $sForgotPasswordUrl);
 
                 $mixedOverrideResult = null;
+                /**
+                 * @hooks
+                 * @hookdef hook-account-before_forgot_password_send_sms 'account', 'before_forgot_password_send_sms' - hook in  $oAccount->isConfirmed check
+                 * - $unit_name - equals `account`
+                 * - $action - equals `before_forgot_password_send_sms` 
+                 * - $object_id - account id 
+                 * - $sender_id - not used 
+                 * - $extra_params - array of additional params with the following array keys:
+                 *      - `phone_number` - [string]  by ref, phone number to send sms, can be overridden in hook processing
+                 *      - `sms_text` - [string] by ref, text for sms, can be overridden in hook processing
+                 *      - `override_result` - [mixed] by ref, can be object, can be overridden in hook processing
+                 * @hook @ref hook-account-before_forgot_password_send_sms
+                 */
                 bx_alert('account', 'before_forgot_password_send_sms', $aAccountInfo['id'], false, array('phone_number' => &$sPhone, 'sms_text' => &$sSmsText, 'override_result' => &$mixedOverrideResult));
                 if ($mixedOverrideResult === null) {
                     $oTwilio = BxDolTwilio::getInstance();
@@ -679,6 +716,19 @@ class BxBaseServiceAccount extends BxDol
         $bAllowSwitchToAnyProfile = $aCheck[CHECK_ACTION_RESULT] === CHECK_ACTION_RESULT_ALLOWED;
 
         $bCanSwitch = ($iSwitchToAccountId == $iViewerAccountId || $bAllowSwitchToAnyProfile);
+        /**
+         * @hooks
+         * @hookdef hook-account-check_switch_context 'account', 'check_switch_context' - hook on switch profile_id
+         * - $unit_name - equals `account`
+         * - $action - equals `check_switch_context` 
+         * - $object_id - account id 
+         * - $sender_id - viewer profile_id
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `switch_to_profile` - [int] profile_id to switch
+         *      - `viewer_account` - [int] viewer's profile_id, can be overridden in hook processing
+         *      - `override_result` - [bool] by ref, true if allow switch profile, otherwise false, can be overridden in hook processing
+         * @hook @ref hook-account-check_switch_context
+         */
         bx_alert('account', 'check_switch_context', $iSwitchToAccountId, $iViewerProfileId, array('switch_to_profile' => $iSwitchToProfileId, 'viewer_account' => $iViewerAccountId, 'override_result' => &$bCanSwitch));
 
         if (!$bCanSwitch) {
@@ -771,6 +821,17 @@ class BxBaseServiceAccount extends BxDol
         
         $this->_oAccountQuery->updatePassword($sPasswordHash, $sSalt, $iAccountId, $iPasswordExpired);
 
+        /**
+         * @hooks
+         * @hookdef hook-account-edited 'account', 'edited' - hook on account edited
+         * - $unit_name - equals `account`
+         * - $action - equals `edited` 
+         * - $object_id - account id 
+         * - $sender_id - account id 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `action` - [string] can be forgot_password/change_password or $sDisplayName  (display name for current form)
+         * @hook @ref hook-account-edited
+         */
         bx_alert('account', 'edited', $iAccountId, $iAccountId, array('action' => 'forgot_password'));
 
         return $sPwd;

+ 41 - 0
template/scripts/BxBaseServiceLogin.php

@@ -158,6 +158,21 @@ class BxBaseServiceLogin extends BxDol
 
         $sCustomHtmlBefore = '';
         $sCustomHtmlAfter = '';
+        /**
+         * @hooks
+         * @hookdef hook-profile-show_login_form 'profile', 'show_login_form' - hook before dhow login form
+         * - $unit_name - equals `profile`
+         * - $action - equals `show_login_form` 
+         * - $object_id - not used  
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `oForm` - [object] by ref, object of BxDolForm, can be overridden in hook processing
+         *      - `sParams` - [string] by ref, paramenters, can be overridden in hook processing
+         *      - `sCustomHtmlBefore` - [string] by ref, html before form, can be overridden in hook processing
+         *      - `sCustomHtmlAfter` - [string] by ref,  html after form, can be overridden in hook processing
+         *      - `aAuthTypes` - [array] by ref,  Auth Types, can be overridden in hook processing
+         * @hook @ref hook-account-show_login_form
+         */
         bx_alert('profile', 'show_login_form', 0, 0, array('oForm' => &$oForm, 'sParams' => &$sParams, 'sCustomHtmlBefore' => &$sCustomHtmlBefore, 'sCustomHtmlAfter' => &$sCustomHtmlAfter, 'aAuthTypes' => &$aAuthTypes));
 
         if (isset($oForm->aInputs['relocate'])) {
@@ -250,6 +265,20 @@ class BxBaseServiceLogin extends BxDol
             $sActivationCode = rand(1000, 9999);
             $sActivationText =_t('_sys_txt_login_2fa_sms_text', $sActivationCode);
             $ret = null;
+            
+            /**
+             * @hooks
+             * @hookdef hook-account-before_2fa_send_sms 'account', 'before_2fa_send_sms' - hook after user performed login
+             * - $unit_name - equals `system`
+             * - $action - equals `before_2fa_send_sms` 
+             * - $object_id - account id 
+             * - $sender_id - not used 
+             * - $extra_params - array of additional params with the following array keys:
+             *      - `phone_number` - [array] contains account info from $oAccount->getInfo()
+             *      - `sms_text` - [string] the password entered by the user
+             *      - `override_result` - [string] the password after encription, to save in db
+             * @hook @ref hook-account-before_2fa_send_sms
+             */
             bx_alert('account', 'before_2fa_send_sms', $oAccount->id(), false, array('phone_number' => $sPhoneNumber, 'sms_text' => $sActivationText, 'override_result' => &$ret));
             if ($ret === null) 
             {
@@ -288,6 +317,18 @@ class BxBaseServiceLogin extends BxDol
             if (!$sUrlRelocate || 0 !== strncmp($sUrlRelocate, BX_DOL_URL_ROOT, strlen(BX_DOL_URL_ROOT)))
                 $sUrlRelocate = BX_DOL_ROLE_ADMIN == $oForm->getRole() ? BX_DOL_URL_STUDIO . 'launcher.php' : BX_DOL_URL_ROOT . 'member.php';
 
+            /**
+             * @hooks
+             * @hookdef hook-account-login_after 'account', 'login_after' - hook on after login to rewrite url for redirect after login
+             * - $unit_name - equals `account`
+             * - $action - equals `login_after` 
+             * - $object_id - account id 
+             * - $sender_id - not used 
+             * - $extra_params - array of additional params with the following array keys:
+             *      - `account` - [array] contains account info from $oAccount->getInfo()
+             *      - `url_relocate` - [string] by ref, rl for redirect after login, can be overridden in hook processing
+             * @hook @ref hook-account-login_after
+             */
             bx_alert('account', 'login_after', $oAccount->id(),  false, array(
                 'account' => $aAccount,
                 'url_relocate' => &$sUrlRelocate               

+ 45 - 0
template/scripts/BxBaseServiceProfiles.php

@@ -488,6 +488,19 @@ class BxBaseServiceProfiles extends BxDol
             return strcmp($r1['label'], $r2['label']);
         });
 
+         /**
+         * @hooks
+         * @hookdef hook-system-profiles_search_by_location 'system', 'profiles_search_by_location' - hook on serach profiles by location
+         * - $unit_name - equals `system`
+         * - $action - equals `profiles_search_by_location` 
+         * - $object_id - not used 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `module` - [string]  module name
+         *      - `term` - [string] term for searching
+         *      - `result` - [array] by ref, array of results, can be overridden in hook processing
+         * @hook @ref hook-account-profiles_search_by_location
+         */
         bx_alert('system', 'profiles_search', 0, 0, array(
             'module' => is_array($mixedParems) && isset($mixedParems['module']) ? $mixedParems['module'] : '',
             'term' => $sTerm,
@@ -527,6 +540,20 @@ class BxBaseServiceProfiles extends BxDol
             $aResult = array_merge($aResult, $oProfileQuery->getProfiles(['type' => 'id_by_module_content_id', 'module' => $aModule['name'], 'content_id' => $aContentIds]));
         }
 
+        /**
+         * @hooks
+         * @hookdef hook-system-profiles_search_by_location 'system', 'profiles_search_by_location' - hook on serach profiles by location
+         * - $unit_name - equals `system`
+         * - $action - equals `profiles_search_by_location` 
+         * - $object_id - not used 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `module` - [string]  module name
+         *      - `location` - [array] location's info
+         *      - `radius` - [int] radius for search
+         *      - `result` - [array] by ref, array of results, can be overridden in hook processing
+         * @hook @ref hook-account-profiles_search_by_location
+         */
         bx_alert('system', 'profiles_search_by_location', 0, 0, [
             'module' => $sModule,
             'location' => $aLocation,
@@ -958,6 +985,24 @@ class BxBaseServiceProfiles extends BxDol
             'bx_repeat:row' => array(),
         );
         
+        /**
+         * @hooks
+         * @hookdef hook-system-account_profile_switcher 'system', 'account_profile_switcher' - hook to get account profile switcher
+         * - $unit_name - equals `system`
+         * - $action - equals `account_profile_switcher` 
+         * - $object_id - not used 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `account_id` - [int] account id 
+         *      - `active_profile_id` - [int] by ref, current profile id, can be overridden in hook processing
+         *      - `url_profile_action` - [string] url profile action
+         *      - `show_all` - [bool] by ref, show all profiles or not, can be overridden in hook processing
+         *      - `button_title` - [string] by ref,  title for button, can be overridden in hook processing
+         *      - `profile_template` - [string] by ref,  profile template, can be overridden in hook processing
+         *      - `profiles` - [array] by ref, array of profiles info , can be overridden in hook processing
+         * @hook @ref hook-system-account_profile_switcher
+         */
+        
         bx_alert('system', 'account_profile_switcher', 0, false, array(
             'account_id' => $iAccountId,
             'active_profile_id' => &$iActiveProfileId,

+ 24 - 0
template/scripts/BxBaseServices.php

@@ -1326,6 +1326,19 @@ class BxBaseServices extends BxDol implements iBxDolProfileService
         else {
 
             $bSpam = null;
+            /**
+             * @hooks
+             * @hookdef hook-system-check_spam_url 'system', 'check_spam_url' - hook to override sClass for search
+             * - $unit_name - equals `system`
+             * - $action - equals `check_spam_url` 
+             * - $object_id - not used 
+             * - $sender_id - logged account id 
+             * - $extra_params - array of additional params with the following array keys:
+             *      - `is_spam` - [bool] by ref, spam url or not, can be overridden in hook processing
+             *      - `content` - [string] by ref, url of link, can be overridden in hook processing
+             *      - `where` - [string]  equal redirect
+             * @hook @ref hook-system-check_spam_url
+             */
             bx_alert('system', 'check_spam_url', 0, getLoggedId(), array('is_spam' => &$bSpam, 'content' => &$sUrl, 'where' => 'redirect'));
 
             $sLangKey = $bSpam ? '_sys_redirect_confirmation_harmful' : '_sys_redirect_confirmation';
@@ -1393,6 +1406,17 @@ class BxBaseServices extends BxDol implements iBxDolProfileService
             bx_import('Search', $oModule->_aModule);
             $sClass = 'BxElsSearch';
         }
+        /**
+         * @hooks
+         * @hookdef hook-system-search_keyword 'system', 'search_keyword' - hook to override sClass for search
+         * - $unit_name - equals `system`
+         * - $action - equals `search_keyword` 
+         * - $object_id - not used 
+         * - $sender_id - not used 
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `override_result` - [string] by ref, class name for search, can be overridden in hook processing
+         * @hook @ref hook-system-search_keyword
+         */
         bx_alert('system', 'search_keyword', 0, 0, array('class' => &$sClass));
 
         $oSearch = new $sClass(bx_get('section'));