Jump to content

Debughelper Firefox Add-on: Difference between revisions

From NusaATK
No edit summary
No edit summary
Line 1: Line 1:
= ATK changer =
= Local ATK changes =
Change the following functions in <code>atk/class.atkconfig.inc</code> (it's not yet committed, so make a local change in your own project)
Change the following functions in <code>atk/class.atkconfig.inc</code> (it's not yet committed in ATK, so make this local change in your own project)


     function requestDebugEnabled($params)
     function requestDebugEnabled($params)

Revision as of 07:56, 17 June 2009

Local ATK changes

Change the following functions in atk/class.atkconfig.inc (it's not yet committed in ATK, so make this local change in your own project)

   function requestDebugEnabled($params)
   {
     $session = &atkSessionManager::getSession();

     if (isset($_REQUEST["atkdebug"]["key"]))
     {
       $session["debug"]["key"] = $_REQUEST["atkdebug"]["key"];
     }
     else if (isset($_COOKIE['ATKDEBUG_KEY']) && !empty($_COOKIE['ATKDEBUG_KEY']))
     {
       $session["debug"]["key"] = $_COOKIE['ATKDEBUG_KEY'];
     }
     
     return (isset($session["debug"]["key"]) && $session["debug"]["key"] == $params["key"]);
   }
   function smartDebugLevel($default, $options=array())
   {
     $session = &atkSessionManager::getSession();

     $enabled = $default > 0;

     foreach ($options as $option)
     {
       $method = $option["type"]."DebugEnabled";
       if (is_callable(array("atkconfig", $method)))
         $enabled = $enabled || atkconfig::$method($option);
     }

     if ($enabled)
     {
       if (isset($_REQUEST["atkdebug"]["level"]))
       {
         $session["debug"]["level"] = $_REQUEST["atkdebug"]["level"];
       }
       else if (isset($_COOKIE['ATKDEBUG_LEVEL']))
       {
         $session["debug"]["level"] = $_COOKIE['ATKDEBUG_LEVEL'];
       }
       
       if (isset($session["debug"]["level"]))
         return $session["debug"]["level"];
       else return max($default, 1);
     }

     return $default;
   }

more info coming soon