]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Option to suppress visible errors in token validation code.
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 29 May 2009 11:33:10 +0000 (11:33 +0000)
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 29 May 2009 11:33:10 +0000 (11:33 +0000)
git-svn-id: https://code.elgg.org/elgg/trunk@3316 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/actions.php

index d7de3961c0bb67063ca924e2d360700cc217601c..b1a87645483ca267286e0b05c8038c72deeef54e 100644 (file)
@@ -64,7 +64,7 @@
                                if ($event_result) // Event_result being false doesn't produce an error - since i assume this will be handled in the hook itself. TODO make this better!
                                {
                                            /** Refs #749: We now warn if action token is missing. Later this will be replaced with action_gatekeeper() as detailed in #750 */
-                                           if (!validate_action_token())
+                                           if (!validate_action_token(false))
                                            { 
                                                // Display a temporary warning message - in future versions this will be a hard fail via an action gatekeeper.
                                                $message = "WARNING: Action $action was called without an action token. It is stongly recommended that you consider doing this. Plugin authors should use 'input/form' or pass is_action=true to 'output/confirmlink' or 'output/url'.";
          *
          * @return unknown
          */
-        function validate_action_token()
+        function validate_action_token($visibleerrors = true)
         {
                $token = get_input('__elgg_token');
                $ts = get_input('__elgg_ts');
                                        
                                        if ($returnval)
                                                return true;
-                                       else
+                                       else if ($visibleerrors)
                                                register_error(elgg_echo('actiongatekeeper:pluginprevents'));
                                }
-                               else
+                               else if ($visibleerrors)
                                        register_error(elgg_echo('actiongatekeeper:timeerror'));
                        }
-                       else
+                       else if ($visibleerrors)
                                register_error(elgg_echo('actiongatekeeper:tokeninvalid'));
                }
-               else
+               else if ($visibleerrors)
                        register_error(elgg_echo('actiongatekeeper:missingfields'));
                        
                return false;