Index: pqp.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pqp/pqp.js,v
retrieving revision 1.1.2.9
diff -u -p -r1.1.2.9 pqp.js
--- pqp.js	18 May 2009 10:18:45 -0000	1.1.2.9
+++ pqp.js	20 May 2009 20:03:43 -0000
@@ -1,27 +1,31 @@
 (function($) {
 
-  Drupal.behaviors.pqp_toggle = function() {
-    if (Drupal.settings.pqp) {
-      var url = Drupal.settings.basePath + Drupal.settings.pqp.lang + '/devel/pqp';
-    }
-    else {
-      var url = Drupal.settings.basePath + 'devel/pqp';
+  Drupal.behaviors.pqp_toggle = {
+    attach: function() {
+      if (Drupal.settings.pqp) {
+        var url = Drupal.settings.basePath + Drupal.settings.pqp.lang + '/devel/pqp';
+      }
+      else {
+        var url = Drupal.settings.basePath + 'devel/pqp';
+      }
+      $('a[href*="' + url + '"]').click( function(e) {
+        e.preventDefault();
+        $.get(url, null, function(data) {
+          window.location = location.href;
+        })
+      });
     }
-    $('a[href*="' + url + '"]').click( function(e) {
-      e.preventDefault();
-      $.get(url, null, function(data) {
-        window.location = location.href;
-      })
-    });
   }
   
-  Drupal.behaviors.pqp = function () {
-    if (Drupal.settings.pqp) {
-      $.post(Drupal.settings.basePath + 'pqp/get', { 'pqp_key': Drupal.settings.pqp.key }, function(data) {
-        $(document.body).append(data);
-        $("#pqp-container").fadeIn('normal');
-        $.pqp.init();
-      });
+  Drupal.behaviors.pqp = {
+    attach: function () {
+      if (Drupal.settings.pqp) {
+        $.post(Drupal.settings.basePath + 'pqp/get', { 'pqp_key': Drupal.settings.pqp.key }, function(data) {
+          $(document.body).append(data);
+          $("#pqp-container").fadeIn('normal');
+          $.pqp.init();
+        });
+      }
     }
   }
 
@@ -37,16 +41,19 @@
           var $tabname = $(this).attr('id').replace('pqp_','');
           e.preventDefault();
           $.pqp.changeTab($tabname);
+          return false;
       	});
       });
 
       $('#pqp_toggleDetails').click( function(e) {
         e.preventDefault();
         $.pqp.toggleDetails();
+        return false;
       });
       $('#pqp_toggleHeight').click( function(e) {
         e.preventDefault();
         $.pqp.toggleHeight();
+        return false;
       });
       
       $('#pqp-queries .log-query .row:not(.noquery)').each( function() {
Index: pqp.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pqp/pqp.module,v
retrieving revision 1.1.2.17.2.4
diff -u -p -r1.1.2.17.2.4 pqp.module
--- pqp.module	20 May 2009 10:54:01 -0000	1.1.2.17.2.4
+++ pqp.module	23 May 2009 01:06:41 -0000
@@ -59,7 +59,6 @@ function pqp_help($path, $arg) {
  * Implementation of hook_menu().
  */
 function pqp_menu() {
-  $items = array();
   $items['admin/settings/pqp'] = array(
     'title' => 'PHP Quick Profiler',
     'description' => 'Adjust PHP Quick Profiler settings.',
@@ -121,7 +120,7 @@ function pqp_init() {
       break;
     default:
       $path = drupal_get_path('module', 'pqp');
-      drupal_add_js($path .'/pqp.js', 'module', 'header');
+      drupal_add_js($path .'/pqp.js');
     
       if (module_exists('i18n')) {
         $settings = array(
@@ -131,14 +130,17 @@ function pqp_init() {
       }
     
       if (variable_get('pqp_enable', 0) && user_access('access devel information')) {
-        drupal_add_css($path .'/pqp/pqp.css', 'module', 'all');
+        drupal_add_css($path .'/pqp/pqp.css');
         // Start the whole shabang
         pqp_start();
       }
     
       // Cleanup task, no need for hook_cron, we're debugging
+      if (!isset($_POST['pqp_key'])) {
+        return;
+      }
       $pqp_key = $_POST['pqp_key'];
-      $cleanup = db_query('SELECT * FROM variable WHERE name LIKE "pqp_key_%"');
+      $cleanup = db_query("SELECT * FROM variable WHERE name LIKE 'pqp_key_%%'");
       while ($leftover = db_fetch_object($cleanup)) {
         if (!empty($pqp_key) && $leftover->name != $pqp_key) {
           variable_del($leftover->name);
@@ -155,7 +157,6 @@ function pqp_exit($destination = NULL) {
 
     variable_set($pqp_key, pqp_display());
 
-/* print pqp_display(); */
     print '<script type="text/javascript">
     <!--//--><![CDATA[//><!--
     jQuery.extend(Drupal.settings, { "pqp": { "key": "'. $pqp_key .'" } });
@@ -166,7 +167,7 @@ function pqp_exit($destination = NULL) {
 }
 
 function pqp_get() {
-  if (variable_get('pqp_enable', 0) && user_access('access devel information')) {
+  if (variable_get('pqp_enable', 0) && drupal_function_exists('kpr') && user_access('access devel information')) {
     kpr(array('foo')); // force load krumo
     print variable_get($_POST['pqp_key'], '');
     variable_del($pqp_key);
@@ -567,6 +568,13 @@ function pqp_log($data) {
 		"data" => $data,
 		"type" => 'log'
 	);
+  if (!isset($GLOBALS['debugger_logs'])) {
+    $GLOBALS['debugger_logs'] = array();
+  }
+  $GLOBALS['debugger_logs'] += array(
+    'console' => array(),
+    'logCount' => 0,
+  );
 	$GLOBALS['debugger_logs']['console'][] = $logItem;
 	$GLOBALS['debugger_logs']['logCount'] += 1;
 }
@@ -622,10 +630,12 @@ function pqp_logSpeed($name = 'Point in 
 ------------------------------------*/
 
 function pqp_getLogs() {
-	if(!$GLOBALS['debugger_logs']['memoryCount']) $GLOBALS['debugger_logs']['memoryCount'] = 0;
-	if(!$GLOBALS['debugger_logs']['logCount']) $GLOBALS['debugger_logs']['logCount'] = 0;
-	if(!$GLOBALS['debugger_logs']['speedCount']) $GLOBALS['debugger_logs']['speedCount'] = 0;
-	if(!$GLOBALS['debugger_logs']['errorCount']) $GLOBALS['debugger_logs']['errorCount'] = 0;
-	return $GLOBALS['debugger_logs'];
+  $GLOBALS['debugger_logs'] += array(
+    'memoryCount' => 0,
+    'logCount' => 0,
+    'speedCount' => 0,
+    'errorCount' => 0,
+  );
+  return $GLOBALS['debugger_logs'];
 }
 
