Index: bloginfo.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bloginfo/bloginfo.info,v
retrieving revision 1.4
diff -u -p -r1.4 bloginfo.info
--- bloginfo.info	2 Apr 2007 01:11:34 -0000	1.4
+++ bloginfo.info	11 Mar 2008 22:51:20 -0000
@@ -1,4 +1,5 @@
 ; $Id: bloginfo.info,v 1.4 2007/04/02 01:11:34 mfer Exp $
 name = Bloginfo
 description = Blog title and description.
-dependencies = blog
\ No newline at end of file
+dependencies[] = blog
+core = 6.x
\ No newline at end of file
Index: bloginfo.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bloginfo/bloginfo.install,v
retrieving revision 1.5
diff -u -p -r1.5 bloginfo.install
--- bloginfo.install	22 Jun 2007 00:56:54 -0000	1.5
+++ bloginfo.install	11 Mar 2008 22:51:20 -0000
@@ -3,70 +3,69 @@
 
 /* Installing bloginfo */
 function bloginfo_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      $ins = db_query('CREATE TABLE {bloginfo} ( '.
-                      'uid int(10) NOT NULL, '.
-                      'title varchar(128) NOT NULL, '.
-                      'description text NOT NULL, '.
-                      "format int NOT NULL default '0',".
-                      'PRIMARY KEY(uid) '.
-                      ') /*!40100 DEFAULT CHARACTER SET utf8 */');
-      break;
-    case 'pgsql':
-      $ins = db_query("CREATE TABLE {bloginfo} (
-            uid int NOT NULL DEFAULT '0',
-            title varchar(128) NOT NULL DEFAULT '',
-            description text NOT NULL DEFAULT '',
-            format int NOT NULL default '0',
-                      UNIQUE (uid)
-            ) ;
-            CREATE INDEX bloginfo_uid_idx ON {bloginfo} (uid);
-            ");
-      break;
-  }
+  $result = drupal_install_schema('bloginfo');
 
-  if ($ins) {
+  if ($result[0]['success'] == 1) {
     drupal_set_message(t('Bloginfo module installed succesfully.'));
   } 
   else {
     drupal_set_message(t('Bloginfo module installation was unsuccesfull. The necessary database table may be created by hand. See the "README.txt" file in the "bloginfo/" modules directory for instructions.', 'error'));
   }
-  return $ins;
+}
+
+/**
+ * Implementation of hook_schema().
+ */
+function bloginfo_schema() {
+  $schema['bloginfo'] = array(
+    'description' => t('This holds the bloginfo data.'),
+    'fields' => array(
+      'uid' => array(
+        'type' => 'int', 
+        'unsigned' => TRUE, 
+        'not null' => TRUE, 
+      ),
+      'title' => array(
+        'type' => 'varchar',
+        'length' => 128,
+        'not null' => TRUE, 
+      ),
+      'description' => array(
+        'type' => 'text', 
+        'not null' => TRUE, 
+      ),
+      'format' => array(
+        'type' => 'int', 
+        'unsigned' => TRUE, 
+        'not null' => TRUE, 
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array('uid'),
+  );
+
+  return $schema;
 }
 
 /**
  * Implementation of hook_uninstall().
  */
 function bloginfo_uninstall() {
-  db_query('DROP TABLE {bloginfo}');
+  drupal_uninstall_schema('bloginfo');
 }
 
 function bloginfo_update_1() {
-  $items = array();
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-      db_add_column($items, 'bloginfo', 'format', 'int', array('not null' => TRUE, 'default' => 0));
-      break;
-    case 'mysql':
-    case 'mysqli':
-      $items[] = update_sql("ALTER TABLE {bloginfo} ADD COLUMN format int NOT NULL default '0'");
-      break;
-  }
-  return $items;
+  $ret = array();
+  
+  db_add_field($ret, 'bloginfo', 'format', array('type' => 'int', 'not null' => TRUE, 'default' => 0));
+
+  return $ret;
 }
 
 function bloginfo_update_2() {
-  $items = array();
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-      db_change_column($items, 'bloginfo', 'uid', 'uid', 'int', array('not null' => TRUE));
-      break;
-    case 'mysql':
-    case 'mysqli':
-      $items[] = update_sql("ALTER TABLE {bloginfo} CHANGE uid uid INT( 10 ) NOT NULL");
-      break;
-  }
-  return $items;
+  $ret = array();
+
+  db_change_field($ret, 'bloginfo', 'uid', 'uid', array('type' => 'int', 'not null' => TRUE));
+
+  return $ret;
 }
\ No newline at end of file
Index: bloginfo.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bloginfo/bloginfo.module,v
retrieving revision 1.7
diff -u -p -r1.7 bloginfo.module
--- bloginfo.module	22 Jun 2007 00:56:54 -0000	1.7
+++ bloginfo.module	11 Mar 2008 22:51:20 -0000
@@ -1,10 +1,9 @@
 <?php
 // $Id: bloginfo.module,v 1.7 2007/06/22 00:56:54 mfer Exp $
 
-
 // hook_help
-function bloginfo_help($section) {
-  switch ($section) {
+function bloginfo_help($path, $arg) {
+  switch ($path) {
     case 'admin/help#bloginfo':
       $output = '<p>'. t('This module allows bloggers to have a title and description for their blog that is seperate from their username.  This is similar to the title and descriptioin of blogs such as those at blogspot.com provided by blogger.') .'</p>';
       $output .= '<p>'. t('The title and description is displayed in a block and is editable in a users \'my account\' options.') .'</p>';
@@ -33,6 +32,18 @@ function bloginfo_user($op, &$edit, &$ac
 }
 
 /**
+ * Implementation of hook_menu_alter().
+ */
+function bloginfo_menu_alter(&$callbacks) {
+  // Use wrapper function instead of blog_page_user() so the page title
+  // can be set.
+  $callbacks['blog/%user_current']['page callback'] = 'bloginfo_page_user';
+  // Use wrapper function instead of blog_feed_user() so the feed title
+  // can be set.
+  $callbacks['blog/%user/feed']['page callback'] = 'bloginfo_feed_user';
+}
+
+/**
  * Implementation of hook_block().
  */
 function bloginfo_block($op = 'list', $delta = 0) {
@@ -58,6 +69,33 @@ function bloginfo_block($op = 'list', $d
 }
 
 /**
+ * Implementation of hook_link_alter().
+ */
+function bloginfo_link_alter(&$links, $node) {
+  foreach ($links AS $module => &$link) {
+    if ($module == 'blog_usernames_blog') {
+      $count = db_result(db_query("SELECT COUNT(*) FROM {bloginfo} WHERE uid = %d", $node->uid));
+      if ($count == 1) {
+        $results = db_query("SELECT title, description, format FROM {bloginfo} WHERE uid = %d", $node->uid);
+        $bloginfo = db_fetch_object($results);
+        $link['title'] = strlen($bloginfo->title) ? $bloginfo->title : $link['title'];
+      }      
+    }
+  }
+}
+
+/**
+ * Implementation of hook_theme()
+ */
+function bloginfo_theme() {
+  return array(
+    'bloginfo_block' => array(
+      'arguments' => array('description', 'format', 'author'),
+    ),
+  );
+}
+
+/**
  * Theme Function:  Theme bloginfo block content
  */
 function theme_bloginfo_block($description, $format, $author) {
@@ -104,7 +142,7 @@ function bloginfo_save_bloginfo(&$edit, 
       $results = db_query('SELECT uid FROM {bloginfo} WHERE uid = %d', arg(1));
   
       //This is to update where info already exists in the database
-      if (db_num_rows($results) == 1) {
+      if (db_result(db_query('SELECT COUNT(uid) FROM {bloginfo} WHERE uid = %d', arg(1))) == 1) {
         db_query("UPDATE {bloginfo} SET title = '%s', description = '%s', format = %d WHERE uid = %d", $edit['Title'], $edit['Description'], $edit['format'], arg(1));  
       }
   
@@ -115,3 +153,49 @@ function bloginfo_save_bloginfo(&$edit, 
     }
   }
 }
+
+/**
+ * Wrapper for blog_page_user(). Sets the page title if available.
+ */
+function bloginfo_page_user($account) {
+  $output = blog_page_user($account);
+
+  $count = db_result(db_query("SELECT COUNT(*) FROM {bloginfo} WHERE uid = %d", $account->uid));
+  if ($count == 1) {
+    $results = db_query("SELECT title, description, format FROM {bloginfo} WHERE uid = %d", $account->uid);
+    $bloginfo = db_fetch_object($results);
+    
+    if (strlen($bloginfo->title)) {
+      drupal_set_title($bloginfo->title);
+    }
+  }
+  
+  return $output;
+}
+
+/**
+ * Menu callback; displays an RSS feed containing recent blog entries of all users.
+ *
+ * Customization of blog_feed_user().
+ */
+function bloginfo_feed_user($account) {
+  $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n  WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $account->uid, 0, variable_get('feed_default_items', 10));
+  $channel['title'] = $account->name ."'s blog";
+  $channel['link'] = url('blog/'. $account->uid, array('absolute' => TRUE));
+
+  $items = array();
+  while ($row = db_fetch_object($result)) {
+    $items[] = $row->nid;
+  }
+
+  $count = db_result(db_query("SELECT COUNT(*) FROM {bloginfo} WHERE uid = %d", $account->uid));
+  if ($count == 1) {
+    $results = db_query("SELECT title, description, format FROM {bloginfo} WHERE uid = %d", $account->uid);
+    $bloginfo = db_fetch_object($results);
+
+    $channel['title'] = strlen($bloginfo->title) ? $bloginfo->title : $channel['title'];
+    $channel['description'] = $bloginfo->description;
+  }
+
+  node_feed($items, $channel);
+}
