Alex Trofimov пре 12 година
родитељ
комит
d2a4e04ea8

+ 1 - 1
inc/classes/BxDolAcl.php

@@ -220,7 +220,7 @@ class BxDolAcl extends BxDol implements iBxDolSingleton {
 
     	$aAction = $this->oDb->getAction($aMembership['id'], $iActionId);
     	if (!$aAction)
-            trigger_error ('Unknown action ID: ' . $iActionId, E_USER_ERROR);
+            bx_trigger_error('Unknown action ID: ' . $iActionId, 2);
 
     	$aResult[CHECK_ACTION_PARAMETER] = $aAction['additional_param_value'];
     	$aLangFileParams[CHECK_ACTION_LANG_FILE_ACTION] = !empty($aAction['title']) ? _t($aAction['title']) : $aAction['name'];

+ 11 - 0
inc/utils.inc.php

@@ -1049,5 +1049,16 @@ function bx_gen_method_name ($s, $sWordsDelimiter = '_') {
     return str_replace(' ', '', ucwords(str_replace($sWordsDelimiter, ' ', $s)));
 }
 
+/**
+ * Trigger user error
+ * @param $sMsg message to display
+ * @param $iNumLevelsBack add additional debug backtracing N levels back
+ */
+function bx_trigger_error ($sMsg, $iNumLevelsBack = 0) {
+    $a = debug_backtrace();
+    $sMsgAdd = "<br />\n related code in <b>{$a[$iNumLevelsBack]['file']}</b> on line <b>{$a[$iNumLevelsBack]['line']}</b> <br />\n";
+    trigger_error ($sMsg . $sMsgAdd, E_USER_ERROR);
+}
+
 /** @} */ 
 

+ 4 - 4
modules/boonex/notes/classes/BxNotesModule.php

@@ -357,7 +357,7 @@ class BxNotesModule extends BxDolModule
     function _checkModeratorAccess ($isPerformAction = false) 
     {
         // check moderator ACL
-        $aCheck = checkActionModule($this->_iProfileId, 'edit any note', $this->getName(), $isPerformAction); 
+        $aCheck = checkActionModule($this->_iProfileId, 'edit any entry', $this->getName(), $isPerformAction); 
         return $aCheck[CHECK_ACTION_RESULT] === CHECK_ACTION_RESULT_ALLOWED;
     }
 
@@ -373,7 +373,7 @@ class BxNotesModule extends BxDolModule
             return CHECK_ACTION_RESULT_ALLOWED;
 
         // check ACL
-        $aCheck = checkActionModule($this->_iProfileId, 'view note', $this->getName(), $isPerformAction);
+        $aCheck = checkActionModule($this->_iProfileId, 'view entry', $this->getName(), $isPerformAction);
         if ($aCheck[CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED)
             return $aCheck[CHECK_ACTION_MESSAGE];
 
@@ -400,7 +400,7 @@ class BxNotesModule extends BxDolModule
     function isAllowedAdd ($isPerformAction = false) 
     {
         // check ACL
-        $aCheck = checkActionModule($this->_iProfileId, 'create note', $this->getName(), $isPerformAction);
+        $aCheck = checkActionModule($this->_iProfileId, 'create entry', $this->getName(), $isPerformAction);
         if ($aCheck[CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED)
             return $aCheck[CHECK_ACTION_MESSAGE];
         return CHECK_ACTION_RESULT_ALLOWED;
@@ -427,7 +427,7 @@ class BxNotesModule extends BxDolModule
             return CHECK_ACTION_RESULT_ALLOWED;
 
         // check ACL
-        $aCheck = checkActionModule($this->_iProfileId, 'delete note', $this->getName(), $isPerformAction);
+        $aCheck = checkActionModule($this->_iProfileId, 'delete entry', $this->getName(), $isPerformAction);
         if ($aDataEntry[$this->_oConfig->CNF['FIELD_AUTHOR']] == $this->_iProfileId && $aCheck[CHECK_ACTION_RESULT] === CHECK_ACTION_RESULT_ALLOWED)
             return CHECK_ACTION_RESULT_ALLOWED;
 

+ 4 - 4
modules/boonex/notes/install/sql/enable.sql

@@ -189,15 +189,15 @@ INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `defau
 -- ACL
 
 INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
-('bx_notes', 'create note', NULL, '_bx_notes_acl_action_create_entry', '', 1, 1);
+('bx_notes', 'create entry', NULL, '_bx_notes_acl_action_create_entry', '', 1, 1);
 SET @iIdActionNoteCreate = LAST_INSERT_ID();
 
 INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
-('bx_notes', 'delete note', NULL, '_bx_notes_acl_action_delete_entry', '', 1, 1);
+('bx_notes', 'delete entry', NULL, '_bx_notes_acl_action_delete_entry', '', 1, 1);
 SET @iIdActionNoteDelete = LAST_INSERT_ID();
 
 INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
-('bx_notes', 'view note', NULL, '_bx_notes_acl_action_view_entry', '', 1, 1);
+('bx_notes', 'view entry', NULL, '_bx_notes_acl_action_view_entry', '', 1, 1);
 SET @iIdActionNoteView = LAST_INSERT_ID();
 
 INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
@@ -205,7 +205,7 @@ INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`,
 SET @iIdActionSetThumb = LAST_INSERT_ID();
 
 INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
-('bx_notes', 'edit any note', NULL, '_bx_notes_acl_action_edit_any_entry', '', 1, 1);
+('bx_notes', 'edit any entry', NULL, '_bx_notes_acl_action_edit_any_entry', '', 1, 1);
 SET @iIdActionNoteEditAny = LAST_INSERT_ID();