? components/views_ui.inc
? components/views_ui.inc.txt
Index: patterns.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/patterns/patterns.module,v
retrieving revision 1.1.2.2.2.80
diff -u -p -r1.1.2.2.2.80 patterns.module
--- patterns.module	2 Oct 2009 09:15:47 -0000	1.1.2.2.2.80
+++ patterns.module	20 Nov 2009 23:51:09 -0000
@@ -682,11 +682,11 @@ function patterns_list() {
     $title = '<span id="pid-'. $pid .'" class="pattern-title">'. $pattern->title .'</span>';
     //     $view_more = '<div>'. t('Clik on pattern title to see more details.') .'</div>';
     $info = array();
-    $info[] = t('Author: ') . $pattern->info['author'];
-    $info[] = t('Email: ') . $pattern->info['author_email'];
-    $info[] = t('Web: ') . $pattern->info['author_website'];
+    $info[] = t('Author: ') . @$pattern->info['author'];
+    $info[] = t('Email: ') . @$pattern->info['author_email'];
+    $info[] = t('Web: ') . @$pattern->info['author_website'];
     $author = theme('item_list', $info);
-    $title .= '<div id="pid-'. $pid .'-info" class="pattern-info">'. $author . $pattern->description . $view_more .'</div>';
+    $title .= '<div id="pid-'. $pid .'-info" class="pattern-info">'. $author . $pattern->description .'</div>';
     $cells[] = array('data' => $title, 'class' => 'title');
     $cells[] = array('data' => $pattern->status ? t('Enabled') : t('Disabled'), 'class' => 'status');
     $cells[] = array('data' => $pattern->info['version'], 'class' => 'version');
@@ -697,6 +697,7 @@ function patterns_list() {
   }
 
   ksort($rows);
+  $output = '';
   foreach ($rows as $title => $category) {
     $fieldset = array(
       '#title' => t($title),
@@ -930,7 +931,7 @@ function patterns_get_patterns($reset = 
     $result = db_query('SELECT file FROM {patterns} WHERE status = 1');
 
     while ($pattern = db_fetch_object($result)) {
-      $enabled[] = $result->file;
+      $enabled[] = $pattern->file;
     }
 
     $priority = array();
@@ -1213,18 +1214,20 @@ function patterns_from_source($xml) {
 function _patterns_parse_tag($data, &$index = 0) {
   $pattern = array();
 
-  while ($current = $data[$index]) {
+  while (isset($data[$index]) && $current = $data[$index]) {
     $type = $current['type'];
 
-    foreach((array)$current['attributes'] as $key => $value) {
-      $current[strtolower($key)] = $value;
+    if (! empty($current['attributes'])) {
+      foreach((array)$current['attributes'] as $key => $value) {
+        $current[strtolower($key)] = $value;
+      }
     }
 
     $current['tag'] = strtolower($current['tag']);
 
     unset($current['type'], $current['level'], $current['attributes']);
 
-    if (!trim($current['value']) && $current['value'] != "0") {
+    if (isset($current['value']) && !trim($current['value']) && $current['value'] != "0") {
       unset($current['value']);
     }
 
@@ -1240,7 +1243,7 @@ function _patterns_parse_tag($data, &$in
         break;
       case 'complete':
         // In order to support more complex/non-standard features we can use serialized data
-        if ($current['attributes']['serialized']) {
+        if (!empty($current['attributes']['serialized'])) {
           $value = unserialize($current['value']);
 
           if (isset($value)) {
@@ -1472,6 +1475,8 @@ function patterns_prepare_actions(&$acti
     }
   }
 
+  $errors = array();
+
   // Prepare actions for validation/processing
   foreach($actions as $key => &$data) {
     patterns_invoke($actions[$key], 'prepare');
@@ -1544,7 +1549,7 @@ function patterns_batch_actions($action,
  */
 function patterns_batch_finish($success, $results, $operations) {
   $info = $_SESSION['patterns_batch_info'];
-  if (!($results['abort'])) {
+  if (empty($results['abort'])) {
     foreach ($info as $key => $i) {
       drupal_set_message(t('Pattern "@pattern" ran successfully.', array('@pattern' => $i['title'])));
       db_query('UPDATE {patterns} SET status = 1, enabled = "%s" WHERE pid = %d', time(), $key);
@@ -1973,6 +1978,10 @@ function _patterns_rearrange_data($data,
   $count=0;
 
   foreach($data as $key => $value) {
+    if (! isset($value['value'])) {
+      // Avoid 'undefined index' errors
+      $value['value'] = NULL;
+    }
     if ($value['value'] == 'false') {
       $value['value'] = false;
     }
Index: components/block.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/patterns/components/block.inc,v
retrieving revision 1.1.4.11
diff -u -p -r1.1.4.11 block.inc
--- components/block.inc	14 May 2009 11:24:45 -0000	1.1.4.11
+++ components/block.inc	20 Nov 2009 23:51:09 -0000
@@ -1,6 +1,18 @@
 <?php
 
 function block_patterns($op, $id = null, &$data = null) {
+  $defaults = array(
+    'id'          => NULL, // May be a combo of module+delta
+    'module'      => NULL,
+    #'delta'       => NULL, // Always use isset with delta, because 0 is a legal value
+    'description' => NULL,
+    'info'        => NULL,
+    'pages'       => NULL,
+    'delete'      => NULL,
+  );
+  // Initialize the expected attributes to avoid PHP warnings. Makes later logic easier.
+  $data = array_merge($defaults, (array)$data);
+  
   switch($op) {
     // Return the valid tags that this component can prepare and process
     case 'tags':
@@ -27,9 +39,9 @@ function block_patterns($op, $id = null,
         unset($data['id']);
       }
       // Block description for custom blocks is always unique so we can try to get delta by looking up info field
-      elseif (!empty($data['info'])) {
+      elseif ($data['info']) {
         $delta = db_result(db_query('SELECT delta FROM {blocks} bl INNER JOIN {boxes} bo ON bl.delta = bo.bid AND bl.module = "block" WHERE info = "%s"', $data['info']));
-        if (!empty($delta)) {
+        if ($delta) {
           $data['delta'] = $delta;
           $data['module'] = 'block';
         }
@@ -40,23 +52,23 @@ function block_patterns($op, $id = null,
         unset($data['description']);
       }
 
-      if ($data['delete'] && empty($data['info']) && $data['module'] == 'block') {
+      if ($data['delete'] && !$data['info'] && $data['module'] == 'block') {
         $data['info'] = db_result(db_query('SELECT info FROM {boxes} WHERE bid = "%d"', $data['delta']));
       }
 
-      if (!empty($data['pages']) && is_array($data['pages'])) {
+      if ($data['pages'] && is_array($data['pages'])) {
         $pages = implode("\r\n", $data['pages']);
         $data['pages'] = str_replace('[front]', '<front>', $pages);
       }
 
-      if (!($data['module'] && $data['delta']) && $data['info']) {
+      if (!($data['module'] && isset($data['delta'])) && $data['info']) {
         $data['module'] = 'block';
       }
     break;
 
     // Pre validate actions
     case 'pre-validate':
-      if (!(isset($data['module']) && isset($data['delta'])) && !$data['info']) {
+      if (!($data['module'] && isset($data['delta'])) && !$data['info']) {
         return t('Missing required &lt;module&gt;, &lt;delta&gt; tags. Possibly malformed &lt;id&gt; tag could be the problem too. If creating a new block, tag &lt;info&gt; is required.');
       }
       else if ($data['delete'] && $data['module'] != 'block') {
Index: components/system.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/patterns/components/system.inc,v
retrieving revision 1.1.2.2.2.13
diff -u -p -r1.1.2.2.2.13 system.inc
--- components/system.inc	28 Jul 2009 09:10:06 -0000	1.1.2.2.2.13
+++ components/system.inc	20 Nov 2009 23:51:09 -0000
@@ -138,7 +138,7 @@ function system_patterns($op, $id = null
           // attempt to load required include file
           $menu = menu_router_build(TRUE);
           foreach ($menu as $item) {
-            if ($item['page arguments'][0] == $data['form_id']) {
+            if (isset($item['page arguments'][0]) && $item['page arguments'][0] == $data['form_id']) {
               $data['include'] = $item['include file'];
               break;
             }
