? .DS_Store
Index: advanced_help.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advanced_help/advanced_help.info,v
retrieving revision 1.2
diff -u -p -r1.2 advanced_help.info
--- advanced_help.info	19 Apr 2008 16:45:57 -0000	1.2
+++ advanced_help.info	12 Nov 2009 19:34:23 -0000
@@ -1,4 +1,8 @@
-; $Id: advanced_help.info,v 1.2 2008/04/19 16:45:57 merlinofchaos Exp $
+; $Id: $
 name = Advanced help
 description = Allow advanced help and documentation.
-core = 6.x
+core = 7.x
+
+files[] = advanced-help-popup.tpl.php
+files[] = advanced_help.install
+files[] = advanced_help.module
Index: advanced_help.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advanced_help/advanced_help.module,v
retrieving revision 1.41
diff -u -p -r1.41 advanced_help.module
--- advanced_help.module	28 Oct 2008 17:33:47 -0000	1.41
+++ advanced_help.module	12 Nov 2009 19:34:26 -0000
@@ -88,11 +88,11 @@ function advanced_help_menu_alter(&$call
  */
 function advanced_help_theme() {
   $hooks['advanced_help_topic'] = array(
-    'arguments' => array('module' => NULL, 'topic' => NULL),
+    'variables' => array('module' => NULL, 'topic' => NULL, 'type' => 'icon'),
   );
 
   $hooks['advanced_help_popup'] = array(
-    'arguments' => array('content' => NULL),
+    'variables' => array('content' => NULL),
     'template' => 'advanced-help-popup',
   );
 
@@ -138,20 +138,21 @@ function advanced_help_search_view() {
       $results = search_data($keys, 'advanced_help');
 
       if ($results) {
-        $results = theme('box', t('Search results'), $results);
+        $results = '<h2>'. t('Search results') .'</h2>' . $results;
       }
       else {
-        $results = theme('box', t('Your search yielded no results'), search_help('search#noresults', drupal_help_arg()));
+        $results = '<h2>'. t('Your search yielded no results') .'</h2>';
+        $results .= search_help('search#noresults', drupal_help_arg());
       }
     }
 
     // Construct the search form.
-    $output = drupal_get_form('advanced_help_search_form', $keys);
+    $output = drupal_render(drupal_get_form('advanced_help_search_form', $keys));
     $output .= $results;
 
   }
   else {
-    $output = drupal_get_form('advanced_help_search_form', empty($keys) ? '' : $keys);
+    $output = drupal_render(drupal_get_form('advanced_help_search_form', empty($keys) ? '' : $keys));
   }
 
   $popup = !empty($_GET['popup']) && user_access('view advanced help popup');
@@ -159,7 +160,7 @@ function advanced_help_search_view() {
     $GLOBALS['devel_shutdown'] = FALSE; // Prevent devel module from spewing.
     module_invoke('admin_menu', 'suppress'); // Suppress admin_menu.
     drupal_set_breadcrumb(array_reverse($breadcrumb));
-    print theme('advanced_help_popup', $output);
+    print theme('advanced_help_popup', array('content' => $output));
     return;
   }
 
@@ -178,7 +179,7 @@ function advanced_help_index_page($modul
   // Print a search widget.
   $output = '';
   if (module_exists('search')) {
-    $output .= drupal_get_form('advanced_help_search_form');
+    $output .= drupal_render(drupal_get_form('advanced_help_search_form'));
   }
   else {
     $output .= t('Enable the search module to search help.');
@@ -196,13 +197,13 @@ function advanced_help_index_page($modul
     $breadcrumb[] = advanced_help_l(t('Help'), 'admin/advanced_help');
 
     drupal_set_title(t('@module help index', array('@module' => advanced_help_get_module_name($module))));
-    $output .= theme('item_list', $items);
+    $output .= theme('item_list', array('items' => $items));
   }
   else {
     // Print a module index.
     $modules = array();
     $result = db_query("SELECT * FROM {system}");
-    while ($info = db_fetch_object($result)) {
+    foreach ($result as $info) {
       $module_info = unserialize($info->info);
       $modules[$info->name] = $module_info['name'];
     }
@@ -226,7 +227,7 @@ function advanced_help_index_page($modul
     }
 
     drupal_set_title(t('Module help index'));
-    $output .= theme('item_list', $items);
+    $output .= theme('item_list', array('items' => $items));
   }
 
   $popup = !empty($_GET['popup']) && user_access('view advanced help popup');
@@ -234,7 +235,7 @@ function advanced_help_index_page($modul
     $GLOBALS['devel_shutdown'] = FALSE; // Prevent devel module from spewing.
     module_invoke('admin_menu', 'suppress'); // Suppress admin_menu.
     drupal_set_breadcrumb(array_reverse($breadcrumb));
-    print theme('advanced_help_popup', $output);
+    print theme('advanced_help_popup', array('content' =>  $output));
     return;
   }
 
@@ -254,7 +255,7 @@ function advanced_help_get_tree($topics,
     list($module, $topic) = $info;
     $item = advanced_help_l($topics[$module][$topic]['title'], "help/$module/$topic");
     if (!empty($topics[$module][$topic]['children']) && ($max_depth == -1 || $depth < $max_depth)) {
-      $item .= theme('item_list', advanced_help_get_tree($topics, $topics[$module][$topic]['children'], $max_depth, $depth + 1));
+      $item .= theme('item_list', array('items' => advanced_help_get_tree($topics, $topics[$module][$topic]['children'], $max_depth, $depth + 1)));
     }
 
     $items[] = $item;
@@ -346,8 +347,11 @@ function advanced_help_get_module_name($
     $name = $settings[$module]['name'];
   }
   else {
-    $info = db_fetch_object(db_query("SELECT * FROM {system} WHERE name = '%s'", $module));
-    $info = unserialize($info->info);
+    $result = db_query("SELECT * FROM {system} WHERE name = :module", array(':module' => $module));
+    foreach($result as $record) {
+      $info = unserialize($record->info);
+      break;
+    }
     $name = t($info['name']);
   }
   return $name;
@@ -398,6 +402,7 @@ function advanced_help_topic_page($modul
   $breadcrumb[] = advanced_help_l(advanced_help_get_module_name($pmodule), "admin/advanced_help/$pmodule");
   $breadcrumb[] = advanced_help_l(t('Help'), "admin/advanced_help");
 
+
   $output = advanced_help_view_topic($module, $topic, $popup);
   if (empty($output)) {
     $output = t('Missing help topic.');
@@ -407,7 +412,7 @@ function advanced_help_topic_page($modul
     $GLOBALS['devel_shutdown'] = FALSE; // Prevent devel module from spewing.
     module_invoke('admin_menu', 'suppress'); // Suppress admin_menu.
     drupal_set_breadcrumb(array_reverse($breadcrumb));
-    print theme('advanced_help_popup', $output);
+    print theme('advanced_help_popup', array('content' => $output));
     return;
   }
 
@@ -436,7 +441,8 @@ function advanced_help_perm() {
  *   - 'title' to display the topic's title
  *   - any other text to display the text. Be sure to t() it!
  */
-function theme_advanced_help_topic($module, $topic, $type = 'icon') {
+function theme_advanced_help_topic($variables) {
+  extract($variables);
   $info = advanced_help_get_topic($module, $topic);
   if (!$info) {
     return;
@@ -493,7 +499,7 @@ function advanced_help_get_topic_filenam
  * Load and render a help topic.
  */
 function advanced_help_get_topic_file_info($module, $topic) {
-  init_theme();
+//  init_theme();
   global $language;
 
   $info = advanced_help_get_topic($module, $topic);
@@ -531,9 +537,9 @@ function advanced_help_view_topic($modul
 
     // Change 'topic:' to the URL for another help topic.
     if ($popup) {
-      $output = preg_replace('/href="topic:([^"]+)"/', 'href="' . strtr(url('help/$1', array('query' => 'popup=true')), array('%24' => '$')) . '"', $output);
-      $output = preg_replace('/src="topic:([^"]+)"/', 'src="' . strtr(url('help/$1', array('query' => 'popup=true')), array('%24' => '$')) . '"', $output);
-      $output = preg_replace('/&topic:([^"]+)&/', strtr(url('help/$1', array('query' => 'popup=true')), array('%24' => '$')), $output);
+      $output = preg_replace('/href="topic:([^"]+)"/', 'href="' . strtr(url('help/$1', array('query' => array('popup' => 'true'))), array('%24' => '$')) . '"', $output);
+      $output = preg_replace('/src="topic:([^"]+)"/', 'src="' . strtr(url('help/$1', array('query' => array('popup' => 'true'))), array('%24' => '$')) . '"', $output);
+      $output = preg_replace('/&topic:([^"]+)&/', strtr(url('help/$1', array('query' => array('popup' => 'true'))), array('%24' => '$')), $output);
     }
     else {
       $output = preg_replace('/href="topic:([^"]+)"/', 'href="' . strtr(url('help/$1'), array('%24' => '$')) . '"', $output);
@@ -571,7 +577,7 @@ function advanced_help_view_topic($modul
       advanced_help_get_topic_hierarchy($topics);
       if (!empty($topics[$module][$topic]['children'])) {
         $items = advanced_help_get_tree($topics, $topics[$module][$topic]['children']);
-        $output .= theme('item_list', $items);
+        $output .= theme('item_list', array('items' => $items));
       }
 
       list($parent_module, $parent_topic) = $topics[$module][$topic]['_parent'];
@@ -672,7 +678,7 @@ function _advanced_help_parse_ini() {
       }
       elseif (!file_exists("$module_path/help")) {
         // Look for one or more README files.
-        $files = file_scan_directory("./$module_path", '^(README|readme).*\.(txt|TXT)$', array('.', '..', 'CVS'), 0, FALSE);
+        $files = file_scan_directory("./$module_path", '/^(README|readme).*\.(txt|TXT)$/', array('.', '..', 'CVS'), 0, FALSE);
         $path = "./$module_path";
         foreach ($files as $name => $fileinfo) {
           $info[$fileinfo->basename] = array('line break' => TRUE, 'readme file' => TRUE, 'file' => $fileinfo->basename, 'title' => $fileinfo->name);
@@ -743,15 +749,16 @@ function advanced_help_search($op = 'sea
         return;
       }
 
-      $results = array();
-
-      $placeholders = implode(', ', array_fill(0, count($find), '%d'));
+      $query = db_select('advanced_help_index', 'a', $options);
+      
       foreach ($find as $item) {
         $sids[] = $item->sid;
       }
+      $query->condition('sid', $sids, 'IN');
+      $result = $query->execute();
 
-      $result = db_query("SELECT * FROM {advanced_help_index} WHERE sid IN ($placeholders)", $sids);
-      while ($sid = db_fetch_object($result)) {
+      
+      foreach($result as $sid) {
         // Guard against removed help topics that are still indexed.
         if (empty($topics[$sid->module][$sid->topic])) {
           continue;
@@ -773,7 +780,7 @@ function advanced_help_search($op = 'sea
 function advanced_help_get_sids(&$topics) {
   global $language;
   $result = db_query("SELECT * FROM {advanced_help_index} WHERE language = '%s'", $language->language);
-  while ($sid = db_fetch_object($result)) {
+  foreach($result as $sid) {
     if (empty($topics[$sid->module][$sid->topic])) {
       db_query("DELETE FROM {advanced_help_index} WHERE sid = %d", $sid->sid);
     }
@@ -845,7 +852,7 @@ function advanced_help_update_index() {
 function template_preprocess_advanced_help_popup(&$variables) {
   // Add favicon.
   if (theme_get_setting('toggle_favicon')) {
-    drupal_set_html_head('<link rel="shortcut icon" href="'. check_url(theme_get_setting('favicon')) .'" type="image/x-icon" />');
+    drupal_add_html_head('<link rel="shortcut icon" href="'. check_url(theme_get_setting('favicon')) .'" type="image/x-icon" />');
   }
 
   global $theme;
@@ -866,7 +873,7 @@ function template_preprocess_advanced_he
   $variables['head_title']        = implode(' | ', $head_title);
   $variables['base_path']         = base_path();
   $variables['front_page']        = url();
-  $variables['breadcrumb']        = theme('breadcrumb', drupal_get_breadcrumb());
+  $variables['breadcrumb']        = theme('breadcrumb', array('breadcrumb' => drupal_get_breadcrumb()));
   $variables['feed_icons']        = drupal_get_feeds();
   $variables['head']              = drupal_get_html_head();
   $variables['language']          = $GLOBALS['language'];
Index: help_example/help_example.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advanced_help/help_example/help_example.info,v
retrieving revision 1.3
diff -u -p -r1.3 help_example.info
--- help_example/help_example.info	10 May 2008 17:32:14 -0000	1.3
+++ help_example/help_example.info	12 Nov 2009 19:34:26 -0000
@@ -1,5 +1,6 @@
 ; $Id: help_example.info,v 1.3 2008/05/10 17:32:14 merlinofchaos Exp $
 name = Advanced help example
 description = A example help module to demonstrate the advanced help module.
-core = 6.x
-dependencies[] = advanced_help
\ No newline at end of file
+core = 7.x
+dependencies[] = advanced_help
+files[] = help_example.module
Index: help_example/help_example.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advanced_help/help_example/help_example.module,v
retrieving revision 1.2
diff -u -p -r1.2 help_example.module
--- help_example/help_example.module	19 Apr 2008 16:45:57 -0000	1.2
+++ help_example/help_example.module	12 Nov 2009 19:34:27 -0000
@@ -20,7 +20,7 @@ function help_example_menu() {
 }
 
 function help_example_index_page() {
-  $output = theme('advanced_help_topic', 'help_example', 'about-php');
+  $output = theme('advanced_help_topic', array('module' => 'help_example', 'topic' => 'about-php'));
   $output .= '&nbsp;' . t('Click the help icon to view some example help about the PHP programming language (from wikipedia.org). Be sure to run cron to update the index if you want to try out the search features.');
   return $output;
 }
