Index: ../ljxp-6.0/ljxp.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ljxp/ljxp.info,v
retrieving revision 1.2
diff -u -p -r1.2 ljxp.info
--- ../ljxp-6.0/ljxp.info	19 Nov 2007 01:36:33 -0000	1.2
+++ ../ljxp-6.0/ljxp.info	23 Feb 2008 13:11:30 -0000
@@ -1,3 +1,4 @@
 ; $Id: ljxp.info,v 1.2 2007/11/19 01:36:33 agileware Exp $
 name = LiveJournal crossposter
 description = Allows you or your users to automatically crosspost entries to a LiveJournal account.
+core = 6.x
\ No newline at end of file
Index: ../ljxp-6.0/ljxp.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ljxp/ljxp.install,v
retrieving revision 1.3
diff -u -p -r1.3 ljxp.install
--- ../ljxp-6.0/ljxp.install	6 Jan 2007 06:46:19 -0000	1.3
+++ ../ljxp-6.0/ljxp.install	23 Feb 2008 13:11:30 -0000
@@ -1,55 +1,42 @@
 <?php
 
 function ljxp_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysqli':
-    case 'mysql':
-    default:
-      db_query('CREATE TABLE {ljxp} ( ' .
-        'uid int PRIMARY KEY,' .
-        'active int,' .
-        'host varchar(255),' .
-        'name varchar(255),' .
-        'pass varchar(255),' .
-        'community varchar(255),' .
-        'site_name varchar(255),' .
-        'custom_header longtext,' .
-        'custom_header_format int,' .
-        'tags int,' .
-        'privacy varchar(20),' .
-        'comments int,' .
-        'post_type varchar(20),' .
-        'cut_text varchar(255)' .
-      ');');  
+  drupal_install_schema('ljxp');
+}
+
+function ljxp_schema() {
+  $schema['ljxp'] = array(
+    'fields' => array(
+      'uid' => array('type' => 'int'),
+      'active' => array('type' => 'int'),
+      'host' => array('type' => 'varchar', 'length' => 255),
+      'name' => array('type' => 'varchar', 'length' => 255),
+      'pass' => array('type' => 'varchar', 'length' => 255),
+      'community' => array('type' => 'varchar', 'length' => 255),
+      'site_name' => array('type' => 'varchar', 'length' => 255),
+      'custom_header' => array('type' => 'text', 'size' => 'big'),
+      'custom_header_format' => array('type' => 'int'),
+      'tags' => array('type' => 'int'),
+      'privacy' => array('type' => 'varchar', 'length' => 20),
+      'comments' => array('type' => 'int'),
+      'post_type' => array('type' => 'varchar', 'length' => 20),
+      'cut_text' => array('type' => 'varchar', 'length' => 255), 
+    ),
+    'indexes' => array(),
+    'primary key' => array('uid')
+  );
 
-      db_query('CREATE TABLE {ljxp_node} ( ' .
-        'nid int PRIMARY KEY,' .
-        'ljid int' .
-      ');');  
-      break;
-    case 'pgsql':
-      db_query('CREATE TABLE {ljxp} ( ' .
-        'uid int PRIMARY KEY,' .
-        'active int,' .
-        'host varchar(255),' .
-        'name varchar(255),' .
-        'pass varchar(255),' .
-        'community varchar(255),' .
-        'site_name varchar(255),' .
-        'custom_header text,' .
-        'custom_header_format int,' .
-        'tags int,' .
-        'privacy varchar(20),' .
-        'comments int,' .
-        'post_type varchar(20),' .
-        'cut_text varchar(255)' .
-      ');');  
+  $schema['ljxp_node'] = array(
+    'fields' => array(
+      'nid' => array('type' => 'int'),
+      'ljid' => array('type' => 'int')
+    ),
+  'indexes' => array(),
+  'primary key' => array('nid')	      
+  );
+  return $schema;
+}
 
-      db_query('CREATE TABLE {ljxp_node} ( ' .
-        'nid int PRIMARY KEY,' .
-        'ljid int' .
-      ');');  
-      break;
-  }
-  db_query("UPDATE {system} SET weight = 10 WHERE name = 'ljxp'");
+function ljxp_uninstall() {
+  drupal_uninstall_schema('ljxp');
 }
Index: ../ljxp-6.0/ljxp.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ljxp/ljxp.module,v
retrieving revision 1.12
diff -u -p -r1.12 ljxp.module
--- ../ljxp-6.0/ljxp.module	19 Nov 2007 02:10:17 -0000	1.12
+++ ../ljxp-6.0/ljxp.module	23 Feb 2008 13:11:31 -0000
@@ -11,39 +11,46 @@
 /**
  * Implementation of hook_help()
  */
-function ljxp_help($section = NULL) {
+function ljxp_help($path, $arg) {
+  $output = '';
+  switch($path){
+    case 'admin/help#ljxp':
+      $output = '<p>'.  t("Cross posts blog entries to LiveJournal-esque services") .'</p>';
+      break;
+  }		    
+  return $output;
 }
 
 function ljxp_perm() {
   return array('can crosspost to livejournal');
 }
 
-function ljxp_menu($may_cache) {
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/settings/ljxp',
-      'title' => t('LiveJournal crossposter'),
-      'description' => t('Allows you or your users to automatically crosspost entries to a LiveJournal account.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => 'ljxp_admin_settings',
-      'access' => user_access('administer site configuration'),
-      'type' => MENU_NORMAL_ITEM, // optional
-    );
-  }
+function ljxp_menu() {
+  $items['admin/settings/ljxp'] = array(
+    'title' => 'LiveJournal crossposter',
+    'description' => 'Allows you or your users to automatically crosspost entries to a LiveJournal account.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => 'ljxp_admin_settings',
+    'access callback' => 'user_access',
+    'access arguments' => array('administer site configuration'),
+    'type' => MENU_NORMAL_ITEM, // optional
+  );
   return $items;
 }
 
-function ljxp_form_alter($form_id, &$form) {
+function ljxp_form_alter(&$form, $form_state, $form_id) {
   global $user;
+
+// If not the right sort of form, or the user cannot crosspost to LJ or the user is not the owner...
   if ($form['#id'] != 'node-form' || 
     !user_access('can crosspost to livejournal') ||
     $user->uid != $form['uid']['#value']) {
-    return;
+      return;
   }
-  $default_state = variable_get('ljxp_type_' . $form['type']['#value'], 0);
 
+  $default_state = variable_get('ljxp_type_' . $form['type']['#value'], 0);
   if (!$default_state) {
-    return;
+      return;
   }
 
   $ljxp = ljxp_load_settings($user->uid);
@@ -54,12 +61,18 @@ function ljxp_form_alter($form_id, &$for
   if ($form['nid']['#value']) {
     $lj = db_fetch_array(db_query("SELECT ljid FROM {ljxp_node} WHERE nid = %d", $form['nid']['#value']));
     $form['ljid'] = array(
-      '#type' => 'value',
+      '#type' => 'hidden',
       '#value' => $lj['ljid'],
     );
   }
-  $form['ljxp'] = array('#type' => 'value', '#value' => true);
+  else {
+    $form['ljid'] = array(
+      '#type' => 'hidden',
+      '#value' => FALSE,
+    );
+  }
 
+  $form['ljxp'] = array('#type' => 'hidden', '#value' => true);
   $checked = $lj['ljid'] ? TRUE : ($default_state == 'yes');
   $form['ljxp_crosspost'] = array(
     '#type' => 'checkbox',
@@ -271,19 +284,17 @@ function ljxp_load_settings($uid = NULL,
     $uid = $user->uid;
   }
 
-  static $cache = array();
-  if (!$cache[$uid]) {
-    $result = db_query("SELECT * FROM {ljxp} WHERE uid = %d", $uid);
-    $ljxp = db_fetch_object($result);
-    if (!$ljxp) {
-      $cache[$uid] = ljxp_load_defaults($uid);
-    }
-    else {
-      $cache[$uid] = $ljxp;
-    }
+  $result = db_query("SELECT * FROM {ljxp} WHERE uid = %d", $uid);
+  $ljxp = db_fetch_object($result);
+  if (!$ljxp) {
+    $ljxp = ljxp_load_defaults($uid);
+    $ljxp->default = TRUE;
+  } 
+  else {
+    $ljxp->default = FALSE; 
   }
 
-  return $cache[$uid];
+  return $ljxp;
 }
 
 function ljxp_load_defaults($uid) {
@@ -295,6 +306,7 @@ function ljxp_load_defaults($uid) {
   $ljxp->post_type = 'teaser';
   $ljxp->default = TRUE;
   $ljxp->uid = $uid;
+  $ljxp->active = TRUE;
   return $ljxp;
 }
 
@@ -387,13 +399,13 @@ function ljxp_post($node) {
   if (!$ljxp->custom_header) {
     $post_header = '<p style="border: 1px solid black; padding: 3px;"><b>';
 
-    $post_header .= t('Originally published at !link. ', array('!link' => l($ljxp->site_name, $dest, NULL, NULL, NULL, TRUE, FALSE)));
+    $post_header .= t('Originally published at !link. ', array('!link' => l($ljxp->site_name, $dest, array('absolute' => TRUE))));
 
     if ($ljxp->comments) {
-      $post_header .= t('You can comment here or !link.', array('!link' => l(t('there'), $comment_dest, NULL, NULL, 'comment_form', TRUE, FALSE)));
+      $post_header .= t('You can comment here or !link.', array('!link' => l(t('there'), $comment_dest, array('fragment' => 'comment_form', 'absolute' => TRUE))));
     }
     else {
-      $post_header .= t('Please leave any !comments there.', array('!comments' => l(t('comments'), $comment_dest, NULL, NULL, 'comment_form', TRUE, FALSE)));
+      $post_header .= t('Please leave any !comments there.', array('!comments' => l(t('comments'), $comment_dest, array('fragment' => 'comment_form', 'absolute' => TRUE))));
     }
     $post_header .= '</b></p>';
   }
@@ -403,8 +415,8 @@ function ljxp_post($node) {
     $find = array('%blog_name', '%permalink', '%comments_link');
     $replace = array(
       $ljxp->site_name, 
-      url($dest, NULL, NULL, TRUE), 
-      url($comment_dest, NULL, 'comment_form', TRUE)
+      url($dest, array('absolute' => TRUE)), 
+      url($comment_dest, array('fragment' => 'comment_form', 'absolute' => TRUE))
     );
     $post_header = check_markup(str_replace($find, $replace, $post_header), $ljxp->custom_header_format, TRUE);
   }
@@ -422,7 +434,7 @@ function ljxp_post($node) {
     default:
       $message['event'] = check_markup($node->teaser, $node->format, TRUE);
       if (strlen($node->teaser < $node->body)) {
-        $message['event'] .= l(t('Read the rest of this post'), $dest, NULL, NULL, NULL, TRUE);
+        $message['event'] .= l(t('Read the rest of this post'), $dest, array('absolute' => TRUE));
       }
       break;
       $message['event'] = check_markup($node->teaser, $node->format, TRUE);
