diff -u ../bloginfo.bak/bloginfo.info ./bloginfo.info --- ../bloginfo.bak/bloginfo.info 2007-06-21 18:05:03.000000000 -0700 +++ ./bloginfo.info 2007-12-01 23:08:43.000000000 -0800 @@ -1,9 +1,8 @@ ; $Id: bloginfo.info,v 1.4 2007/04/02 01:11:34 mfer Exp $ name = Bloginfo -description = Blog title and description. +description = Blog title, description, and custom headers. dependencies = blog ; Information added by drupal.org packaging script on 2007-06-22 version = "5.x-2.4" project = "bloginfo" datestamp = "1182474303" - diff -u ../bloginfo.bak/bloginfo.install ./bloginfo.install --- ../bloginfo.bak/bloginfo.install 2007-06-21 17:51:00.000000000 -0700 +++ ./bloginfo.install 2007-12-02 02:44:53.000000000 -0800 @@ -11,6 +11,7 @@ 'title varchar(128) NOT NULL, '. 'description text NOT NULL, '. "format int NOT NULL default '0',". + "headers varchar(512) NOT NULL,". 'PRIMARY KEY(uid) '. ') /*!40100 DEFAULT CHARACTER SET utf8 */'); break; @@ -20,6 +21,7 @@ title varchar(128) NOT NULL DEFAULT '', description text NOT NULL DEFAULT '', format int NOT NULL default '0', + headers varchar(128) NOT NULL DEFAULT '', UNIQUE (uid) ) ; CREATE INDEX bloginfo_uid_idx ON {bloginfo} (uid); @@ -31,7 +33,7 @@ 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')); + drupal_set_message(t('Bloginfo module installation was unsuccesful. The necessary database table may be created by hand. See the "README.txt" file in the "bloginfo/" modules directory for instructions.', 'error')); } return $ins; } @@ -69,4 +71,18 @@ break; } return $items; -} \ No newline at end of file +} + +function bloginfo_update_3() { + $items = array(); + switch ($GLOBALS['db_type']) { + case 'pgsql': + db_add_column($items, 'bloginfo', 'headers', 'varchar(512)', array('not null' => TRUE, 'default' => '')); + break; + case 'mysql': + case 'mysqli': + $items[] = update_sql("ALTER TABLE {bloginfo} ADD COLUMN headers varchar(512) NOT NULL default ''"); + break; + } + return $items; +} diff -u ../bloginfo.bak/bloginfo.module ./bloginfo.module --- ../bloginfo.bak/bloginfo.module 2007-06-21 17:51:00.000000000 -0700 +++ ./bloginfo.module 2007-12-02 12:01:37.000000000 -0800 @@ -6,15 +6,15 @@ function bloginfo_help($section) { switch ($section) { case 'admin/help#bloginfo': - $output = '

'. 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.') .'

'; - $output .= '

'. t('The title and description is displayed in a block and is editable in a users \'my account\' options.') .'

'; + $output = '

'. 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 description of blogs such as those at blogspot.com provided by blogger. It also allows bloggers to set custom HTML in the HEAD section of their blog pages.') .'

'; + $output .= '

'. t('The title, description, and custom headers are displayed in a block and are editable in a users \'my account\' options.') .'

'; return $output; } } // hook_perm function bloginfo_perm() { - return array('administer bloginfo', 'edit own bloginfo'); + return array('administer bloginfo', 'edit own bloginfo', 'edit own blog page headers', 'use blog page headers'); } /** @@ -47,8 +47,11 @@ else if ($node->type == 'blog') $authorid = $node->uid; $count = db_result(db_query("SELECT COUNT(*) FROM {bloginfo} WHERE uid = %d", $authorid)); if ($count == 1) { - $results = db_query("SELECT title, description, format FROM {bloginfo} WHERE uid = %d", $authorid); + $results = db_query("SELECT title, description, format, headers FROM {bloginfo} WHERE uid = %d", $authorid); $bloginfo = db_fetch_object($results); + if (user_access('use blog page headers')) { + drupal_set_html_head("\n" . $bloginfo->headers); + } $block['subject'] = check_plain($bloginfo->title); $block['content'] = theme('bloginfo_block', $bloginfo->description, $bloginfo->format, $authorid); return $block; @@ -69,11 +72,12 @@ */ function bloginfo_form_bloginfo($edit, $account, $category) { if ($category == 'account' && is_numeric(arg(1)) && (user_access('edit own bloginfo') || user_access('administer bloginfo'))) { - $result = db_query('SELECT title, description, format FROM {bloginfo} WHERE uid = %d', arg(1)); + $result = db_query('SELECT title, description, format, headers FROM {bloginfo} WHERE uid = %d', arg(1)); while ($bloginfo = db_fetch_object($result)) { $mybloginfo['title'] = $bloginfo->title; $mybloginfo['description'] = $bloginfo->description; $mybloginfo['format'] = $bloginfo->format; + $mybloginfo['headers'] = $bloginfo->headers; } $fields['bloginfo_settings'] = array( '#type' => 'fieldset', @@ -90,7 +94,14 @@ '#title' => t('Blog Description'), '#default_value' => $mybloginfo['description'], '#description' => t('Your blog description will display on your blog and blog posts.')); - $fields['bloginfo_settings']['desc_format'] = filter_form($mybloginfo['format']); + $fields['bloginfo_settings']['desc_format'] = filter_form($mybloginfo['format']); + if (user_access('edit own blog page headers') || user_access('administer bloginfo')) { + $fields['bloginfo_settings']['Headers'] = array( + '#type' => 'textarea', + '#title' => t('Custom Blog Headers'), + '#default_value' => $mybloginfo['headers'], + '#description' => t('Some aggregators require custom header fields in your block. You may add them here.')); + } return $fields; }//end if }//end function bloginfo_form_bloginfo() @@ -105,12 +116,17 @@ //This is to update where info already exists in the database if (db_num_rows($results) == 1) { - db_query("UPDATE {bloginfo} SET title = '%s', description = '%s', format = %d WHERE uid = %d", $edit['Title'], $edit['Description'], $edit['format'], arg(1)); + if (user_access('edit own blog page headers') || user_access('administer bloginfo')) { + db_query("UPDATE {bloginfo} SET title = '%s', description = '%s', format = %d, headers = '%s' WHERE uid = %d", $edit['Title'], $edit['Description'], $edit['format'], $edit['Headers'], arg(1)); + } + else { + db_query("UPDATE {bloginfo} SET title = '%s', description = '%s', format = %d WHERE uid = %d", $edit['Title'], $edit['Description'], $edit['format'], arg(1)); + } } //This adds it to the database for the first time else { - db_query("INSERT INTO {bloginfo} (uid, title, description, format) VALUES (%d, '%s', '%s', %d)", arg(1), $edit['Title'], $edit['Description'], $edit['format']); + db_query("INSERT INTO {bloginfo} (uid, title, description, format, headers) VALUES (%d, '%s', '%s', %d, '%s')", arg(1), $edit['Title'], $edit['Description'], $edit['format'], $edit['Headers']); } } } diff -u ../bloginfo.bak/README.txt ./README.txt --- ../bloginfo.bak/README.txt 2007-04-02 17:41:57.000000000 -0700 +++ ./README.txt 2007-12-02 12:48:58.000000000 -0800 @@ -4,7 +4,9 @@ contact: http://drupal.org/user/25701/contact ----------------------------------------------------------- -The bloginfo module adds a blog title and description to your blogs. It is a simple module that adds 2 additional fields to the users account screen, for those who have permission, to have a blog title and blog description. These are then put into a block that can be placed like any other block. The title is the block title and the description is the block content. +The bloginfo module adds a blog title and description to your blogs. It is a simple module that adds additional fields to the users account screen, for those who have permission, to have a blog title, blog description, and extra HTML head content for their blog page. The title and description are put into a block that can be placed like any other block. The title is the block title and the description is the block content. When that block is viewed, the HTML head of that page will be altered. + +Because the ability to place custom HTML content in the HEAD element could be easily abused, ability to edit that content is controlled by the access control mechanism. Only trusted users should be given this capability. The idea is to have a blog title and description like one via blogger.com. @@ -19,4 +21,4 @@ UPGRADE ------- 1) Replace the bloginfo folder in the modules folder. -2) Run update.php to update the database. \ No newline at end of file +2) Run update.php to update the database.