diff modules/block/block.module @ 5:2427550111ae 6.2

Drupal 6.2
author Franck Deroche <webmaster@defr.org>
date Tue, 23 Dec 2008 14:30:08 +0100
parents c1f4ac30525a
children fff6d4c8c043
line wrap: on
line diff
--- a/modules/block/block.module	Tue Dec 23 14:29:21 2008 +0100
+++ b/modules/block/block.module	Tue Dec 23 14:30:08 2008 +0100
@@ -1,5 +1,5 @@
 <?php
-// $Id: block.module,v 1.299 2008/02/03 19:12:57 goba Exp $
+// $Id: block.module,v 1.299.2.2 2008/04/09 21:11:45 goba Exp $
 
 /**
  * @file
@@ -132,6 +132,7 @@
   $items['admin/build/block/list/js'] = array(
     'title' => 'JavaScript List Form',
     'page callback' => 'block_admin_display_js',
+    'access arguments' => array('administer blocks'),
     'type' => MENU_CALLBACK,
     'file' => 'block.admin.inc',
   );
@@ -139,6 +140,7 @@
     'title' => 'Configure block',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('block_admin_configure'),
+    'access arguments' => array('administer blocks'),
     'type' => MENU_CALLBACK,
     'file' => 'block.admin.inc',
   );
@@ -146,6 +148,7 @@
     'title' => 'Delete block',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('block_box_delete'),
+    'access arguments' => array('administer blocks'),
     'type' => MENU_CALLBACK,
     'file' => 'block.admin.inc',
   );
@@ -153,6 +156,7 @@
     'title' => 'Add block',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('block_add_block_form'),
+    'access arguments' => array('administer blocks'),
     'type' => MENU_LOCAL_TASK,
     'file' => 'block.admin.inc',
   );
@@ -439,8 +443,23 @@
       else {
         $page_match = TRUE;
       }
+      $block->enabled = $enabled;
+      $block->page_match = $page_match;
+      $blocks[$block->region]["{$block->module}_{$block->delta}"] = $block;
+    }
+  }
 
-      if ($enabled && $page_match) {
+  // Create an empty array if there were no entries
+  if (!isset($blocks[$region])) {
+    $blocks[$region] = array();
+  }
+
+  foreach ($blocks[$region] as $key => $block) {
+    // Render the block content if it has not been created already.
+    if (!isset($block->content)) {
+      // Erase the block from the static array - we'll put it back if it has content.
+      unset($blocks[$region][$key]);
+      if ($block->enabled && $block->page_match) {
         // Check the current throttle status and see if block should be displayed
         // based on server load.
         if (!($block->throttle && (module_invoke('throttle', 'status') > 0))) {
@@ -477,10 +496,6 @@
       }
     }
   }
-  // Create an empty array if there were no entries
-  if (!isset($blocks[$region])) {
-    $blocks[$region] = array();
-  }
   return $blocks[$region];
 }