? advanced_forum.imagecachepreset.patch
Index: advanced_forum.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advanced_forum/advanced_forum.module,v
retrieving revision 1.21.2.139
diff -u -p -r1.21.2.139 advanced_forum.module
--- advanced_forum.module	1 Jul 2009 20:00:05 -0000	1.21.2.139
+++ advanced_forum.module	17 Oct 2009 03:14:42 -0000
@@ -5,7 +5,7 @@
  * @file
  * Enables the look and feel of other popular forum software.
  */
- 
+
 // DRUPAL HOOKS **************************************************************/
 
 /**
@@ -79,7 +79,7 @@ function advanced_forum_theme() {
         'node' => NULL,
         )
   );
-  
+
   return $items;
 }
 
@@ -172,7 +172,7 @@ function advanced_forum_settings_page() 
     '#collapsible' => TRUE,
     '#collapsed' => FALSE,
   );
-  
+
   // Choose style
   $options = array();
   $available_styles = advanced_forum_get_styles();
@@ -196,7 +196,7 @@ function advanced_forum_settings_page() 
     '#description' => t('Images are assumed to be in the "images" subdirectory of your style. If you need images to be somewhere else, put the full path here.'),
     '#default_value' => variable_get('advanced_forum_image_directory', ''),
   );
-  
+
   // Use buttons for links
   $form['advanced_forum_general']['advanced_forum_button_links'] = array(
     '#type' => 'checkbox',
@@ -220,7 +220,7 @@ function advanced_forum_settings_page() 
     '#collapsible' => TRUE,
     '#collapsed' => FALSE,
   );
-  
+
   // Hide 'created' column
   $form['advanced_forum_lists']['advanced_forum_hide_created'] = array(
     '#type' => 'checkbox',
@@ -271,7 +271,7 @@ function advanced_forum_settings_page() 
     '#collapsible' => TRUE,
     '#collapsed' => FALSE,
   );
-  
+
   // Use topic navigation
   $form['advanced_forum_topics']['advanced_forum_use_topic_navigation'] = array(
     '#type' => 'checkbox',
@@ -323,10 +323,10 @@ function advanced_forum_preprocess_autho
  */
 function advanced_forum_preprocess_advanced_forum_topic_header(&$variables) {
   $variables['template_files'][] = 'advanced_forum-topic-header';
-  
+
   // Build the reply link / button
   $variables['reply_link'] = theme('advanced_forum_reply_link', $variables['node']);
-  
+
   // Total & new replies
   if (!empty($variables['comment_count'])) {
     $variables['total_posts'] = format_plural($variables['comment_count'], '1 reply', '@count replies');
@@ -363,9 +363,9 @@ function theme_advanced_forum_reply_link
           'attributes' => array('title' => t('Share your thoughts and opinions related to this posting.')),
           'fragment' => 'comment-form',
           'query' => ($_GET['page']) ? "page=" . $_GET['page'] : NULL,
-          );       
+          );
       }
-      
+
       // Change to using a button if so set
       if (variable_get('advanced_forum_button_links', 1)) {
         $links['topic_reply']['title'] = advanced_forum_theme_image(t('post-reply.png'), t('Post reply'));
@@ -378,12 +378,12 @@ function theme_advanced_forum_reply_link
         'title' => t('Topic Locked'),
         'attributes' => array('title' => t('This topic is locked')),
       );
-      
+
       // Change to using a button if so set
       if (variable_get('advanced_forum_button_links', 1)) {
         $links['topic_locked']['title'] = advanced_forum_theme_image(t('locked-topic.png'), t('Locked'));
         $links['topic_locked']['html'] = TRUE;
-      }   
+      }
     }
   }
   else {
@@ -391,7 +391,7 @@ function theme_advanced_forum_reply_link
     $links['comment_forbidden']['title'] = theme('comment_post_forbidden', $node);
     $links['comment_forbidden']['html'] = TRUE;
   }
-  
+
   return theme('links', $links, array('class' => 'forum-links'));
 }
 
@@ -421,10 +421,10 @@ function advanced_forum_preprocess_node(
 
   // The node is the first post, aka topic head
   $variables['top_post'] = TRUE;
-  
+
   // Build the topic header
   $variables['topic_header'] = theme('advanced_forum_topic_header', $variables['node'], $variables['comment_count']);
-    
+
   /* Node links changes */
   // Change first post from "add comment" to "Reply"
   if (!empty($variables['node']->links) && !empty($variables['node']->links['comment_add'])) {
@@ -442,7 +442,7 @@ function advanced_forum_preprocess_node(
 
   // User information / author pane
   $variables['account'] = user_load(array('uid' => $variables['node']->uid));
-  $variables['author_pane'] = theme('author_pane', $variables['account'], advanced_forum_path_to_images(), 'advf-author-pane');
+  $variables['author_pane'] = theme('author_pane', $variables['account'], advanced_forum_path_to_images(), variable_get('advanced_forum_user_picture_preset', ''));
 
   // Load the signature.
   if (module_exists('signature_forum')) {
@@ -493,7 +493,7 @@ function advanced_forum_preprocess_comme
     }
 
     // Create the author pane
-    $variables['author_pane'] = theme('author_pane', $variables['account'], advanced_forum_path_to_images(), 'advf-author-pane');
+    $variables['author_pane'] = theme('author_pane', $variables['account'], advanced_forum_path_to_images(), variable_get('advanced_forum_user_picture_preset', ''));
 
     if (arg(1) != 'reply') {
       // Because the $links array isn't available here, we recreate it
@@ -568,10 +568,10 @@ function advanced_forum_preprocess_comme
 
     $variables['reply_link'] = '';
     if ($variables['node']->comment != COMMENT_NODE_READ_WRITE || variable_get('comment_form_location_'. $variables['node']->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
-      // If the post is locked or the comment form is on a seperate page, build 
+      // If the post is locked or the comment form is on a seperate page, build
       // the reply/locked link / button
       $variables['reply_link'] = theme('advanced_forum_reply_link', $variables['node']);
-    }      
+    }
   }
 }
 
@@ -660,7 +660,7 @@ function advanced_forum_preprocess_advf_
  */
 function advanced_forum_preprocess_advanced_forum_forum_legend(&$variables) {
   $variables['template_files'][] = 'advanced_forum-forum-legend';
-  
+
   $variables['folder_new_posts'] = advanced_forum_theme_image(t('forum-folder-new-posts.png'), t('Forum Contains New Posts'));
   $variables['folder_default'] = advanced_forum_theme_image(t('/forum-folder.png'), t('Forum Contains No New Posts'));
   $variables['folder_locked'] = advanced_forum_theme_image(t('forum-folder-locked.png'), t('Forum is Locked'));
@@ -668,14 +668,14 @@ function advanced_forum_preprocess_advan
 
 function advanced_forum_preprocess_advanced_forum_topic_legend(&$variables) {
   $variables['template_files'][] = 'advanced_forum-topic-legend';
-  
+
   $variables['topic_new'] = advanced_forum_theme_image(t('topic-new.png'), t('New Posts'));
   $variables['topic_hot_new'] = advanced_forum_theme_image(t('topic-hot-new.png'), t('Hot Thread (New)'));
   $variables['topic_hot'] = advanced_forum_theme_image(t('topic-hot.png'), t('Hot Thread (No New)'));
   $variables['topic_default'] = advanced_forum_theme_image(t('topic-default.png'), t('No New Posts'));
   $variables['topic_sticky'] = advanced_forum_theme_image(t('topic-sticky.png'), t('Sticky Thread'));
   $variables['topic_closed'] = advanced_forum_theme_image(t('topic-closed.png'), t('Locked Thread'));
-  
+
 }
 
 /**
@@ -1182,18 +1182,18 @@ function advanced_forum_get_current_styl
  */
 function advanced_forum_path_to_theme() {
   global $theme;
- 
+
   if (!empty($theme)) {
     // Normally, the global theme variable is set, so we use that.
     return drupal_get_path('theme', $theme);
   }
-  
+
   // For some reason I've never figured out, some users are reporting
   // that the global theme variable is not set when this is called.
   // As a band-aid solution, this will pull the default theme out of the
   // database and use that.
   $default_theme = variable_get('theme_default', 'garland');
-  return drupal_get_path('theme', $default_theme); 
+  return drupal_get_path('theme', $default_theme);
 }
 
 /**
@@ -1242,7 +1242,7 @@ function advanced_forum_path_to_images()
 	if (file_exists($image_path_language_prefix)) {
 		$image_path = $image_path_language_prefix;
 	}
-	
+
   return $image_path;
 }
 
@@ -1255,7 +1255,7 @@ function advanced_forum_theme_image($ima
   if ($title == NULL) {
     $title = $alt;
   }
-  
+
   if (file_exists($image)) {
     return theme('image', $image, $alt, $title);
   }
@@ -1270,8 +1270,8 @@ function advanced_forum_theme_image($ima
 function theme_advanced_forum_user_picture($account) {
   // Get the imagecache preset to use, if any.
   $preset = variable_get('advanced_forum_user_picture_preset', '');
-  
-  // Only proceed if user pictures are enabled, and there is a preset set, and 
+
+  // Only proceed if user pictures are enabled, and there is a preset set, and
   // imagecache is enabled. For performace reasons, we return nothing if these
   // critera aren't met because we only call this function when the non
   // imagecached version is already created. If you use this function elsewhere
@@ -1280,23 +1280,23 @@ function theme_advanced_forum_user_pictu
     if ($account->picture && file_exists($account->picture)) {
       // User has picture, so use that
       $alt = t("@user's picture", array('@user' => $account->name ? $account->name : 'Visitor'));
-      $picture = theme('imagecache', $preset, $account->picture);   
-    } 
+      $picture = theme('imagecache', $preset, $account->picture);
+    }
     else {
       // User doesn't have a picture so use the default, if any
-      $default_picture = variable_get('user_picture_default', ''); 
+      $default_picture = variable_get('user_picture_default', '');
       if ($default_picture) {
         $picture = theme('imagecache', $preset, $default_picture);
-      }     
+      }
     }
-    
+
     if (!empty($picture)) {
       // If the user has access to view profiles, link the picture
       if (!empty($account->uid) && user_access('access user profiles')) {
         $picture = l($picture, "user/$account->uid", array('title' => t('View user profile.'), 'html' => TRUE));
       }
     }
-    
+
     return '<div class="picture">' . $picture . '</div>';
   }
 }
@@ -1331,13 +1331,13 @@ function _advanced_forum_buttonify_links
         default:
           // Attempt to buttonify by key name.
           $image = advanced_forum_theme_image($link_key . '.png', $link['title']);
-          
+
           if (!$image) {
             // If no luck there, try the adjusted title.
             $title = strtolower(str_replace(' ', '-', $link['title']));
             $image = advanced_forum_theme_image($title . '.png', $link['title']);
           }
-          
+
           if ($image) {
             // If we found an image, use it. Otherwise leave the title alone.
             $links[$link_key]['title'] = $image;
