Index: CHANGELOG.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_pub/CHANGELOG.txt,v
retrieving revision 1.6
diff -u -p -r1.6 CHANGELOG.txt
--- CHANGELOG.txt	19 Nov 2008 14:39:58 -0000	1.6
+++ CHANGELOG.txt	21 Nov 2008 22:57:30 -0000
@@ -1,3 +1,7 @@
+19 November 2008
+----------------------------
+- Image module 6.0.0 support
+
 12 April 2007
 ----------------------------
 - Image module 5.0.0 support
Index: image_pub.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_pub/image_pub.info,v
retrieving revision 1.3
diff -u -p -r1.3 image_pub.info
--- image_pub.info	19 Nov 2008 14:39:58 -0000	1.3
+++ image_pub.info	21 Nov 2008 22:57:30 -0000
@@ -2,4 +2,6 @@
 name = Image Publishing
 description = "Supports image uploads using third party publishing applications."
 package = Image
-dependencies = image
+core = 6.x
+dependencies[] = image
+dependencies[] = image_gallery
Index: image_pub.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_pub/image_pub.module,v
retrieving revision 1.15
diff -u -p -r1.15 image_pub.module
--- image_pub.module	19 Nov 2008 14:39:58 -0000	1.15
+++ image_pub.module	21 Nov 2008 22:57:31 -0000
@@ -12,8 +12,8 @@
 /**
  * Implementation of hook_help().
  */
-function image_pub_help($section = 'admin/help#image_pub') {
-  switch ($section) {
+function image_pub_help($path = 'admin/help#image_pub', $arg=null) {
+  switch ($path) {
     case 'admin/help#image_pub':
       return '<p>'. t('The Image Publishing module supports third party image upload and management applications.') .'</p>';
   }
@@ -22,27 +22,25 @@ function image_pub_help($section = 'admi
 /**
  * Implementation of hook_menu().
  */
-function image_pub_menu($may_cache) {
+function image_pub_menu() {
   $items = array();
-  if ($may_cache) {
-    $items[] = array('path' => 'gallery_remote2.php',
-      'callback' => '_image_pub_gr_request',
-      'access' => TRUE,
+  $items['gallery_remote2.php'] = array(
+    'page callback' => '_image_pub_gr_request',
+    'access callback' => TRUE,
       'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'publish_xp',
-      'callback' => '_image_pub_xp_request',
-      'access' => TRUE,
+  $items['publish_xp'] = array(
+    'page callback' => '_image_pub_xp_request',
+    'access callback' => TRUE,
       'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/settings/image_pub_xp_reghack',
-      'callback' => '_image_pub_xp_reghack',
-      'access' => TRUE,
+  $items['admin/settings/image_pub_xp_reghack'] = array(
+    'page callback' => '_image_pub_xp_reghack',
+    'access callback' => TRUE,
       'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/settings/image_pub',
-      'title' => t('Image publishing'),
-      'description' => t('Provides information regarding remote image publishing.'),
-      'callback' => '_image_pub_admin',
-      'access' => user_access('create images'));
-  }
+  $items['admin/settings/image_pub'] = array(
+    'title' => 'Image publishing',
+    'description' => 'Provides information regarding remote image publishing.',
+    'page callback' => '_image_pub_admin',
+    'access arguments' => array('create images'));
   return $items;
 }
 
@@ -178,18 +176,18 @@ function _image_pub_album_images($tid) {
 function _image_pub_authenticate($uname, $pass) {
   global $user;
   if ($user->uid) {
-    watchdog('image_pub', t('Session closed for %user', array('%user' => theme('placeholder', $user->name))));
+    watchdog('image_pub', 'Session closed for %user', array('%user' => theme('placeholder', $user->name)));
     unset($user);
   }
-  $user = user_authenticate($uname, $pass);
+  $user = user_authenticate(array('name' => $uname, 'pass' => $pass));
   if (!$user->uid) {
     return FALSE;
   }
-  watchdog('image_pub', t('Session opened for %user', array('%user' => theme('placeholder', $user->name))));
+  watchdog('image_pub', 'Session opened for %user', array('%user' => theme('placeholder', $user->name)));
   return TRUE;
 }
 function _image_pub_album_add($title, $descr, $palbum) {
-  watchdog('image_pub', t('Album added with title %title', array('%title' => $title)));
+  watchdog('image_pub', 'Album added with title %title', array('%title' => $title));
 
   if (empty($title)) {
     $title = 'Untitled album';
@@ -229,31 +227,33 @@ function _image_pub_image_add($album, $c
   // Create a drupal node
   // In order for the image upload to work, the name, tmp_name and error 
   // of the $_FILES[$srcfield] have to be copied to locations
-  // that file_check_upload() recognises
+  // that file_check_upload() recognises.
+  // The size needs to go into $_FILES['files']['size']['image'] for image
+  // module's size checking to occur.
   $_FILES['files']['name']['image'] = $_FILES[$srcfield]['name'];
   $_FILES['files']['tmp_name']['image'] = $_FILES[$srcfield]['tmp_name'];
   $_FILES['files']['error']['image'] = $_FILES[$srcfield]['error'];
+  $_FILES['files']['size']['image'] = filesize($_FILES[$srcfield]['tmp_name']);
 
+  $form_state = array();
+  module_load_include('inc', 'node', 'node.pages'); 
   $node = array('type' => 'image');
-  $values['title'] = $caption;
-  $values['uid'] = $user->uid;
-  $values['name'] = $user->name;
-  $values['body_filter']['body'] = $description;
-  $redirect_url = drupal_execute('node_form', $values, $node, NULL);
+  $form_state['values']['title'] = $caption;
+  $form_state['values']['uid'] = $user->uid;
+  $form_state['values']['name'] = $user->name;
+  $form_state['values']['body_field'] = $description;
+  $form_state['values']['taxonomy'][_image_pub_get_vid()] = $album->tid;
+  $form_state['values']['op'] = t('Save');
+  $redirect_url = drupal_execute('image_node_form', $form_state, (object)$node);
 
   // Check that the uploaded image was accepted.
   $errors = form_get_errors();
   if (!empty($errors)) {
     return array('success' => FALSE,
-                 'reason' => implode($errors, '. '));
+                 'reason' => strip_tags(implode($errors, ' ')));
   }
 
-  // If it was accepted, tag it with the the album
-  $arguments = explode('/', $redirect_url);
-  $nid = $arguments[1];
-  taxonomy_node_save($nid, array($album->tid));
-
-  watchdog('image_pub', t('%image was added.', array('%image' => $_FILES[$srcfield]['name'])));
+  watchdog('image_pub', '%image was added.', array('%image' => $_FILES[$srcfield]['name']));
   return array('success' => TRUE, 'redirect_url' => $redirect_url);
 }
 
@@ -313,7 +313,7 @@ function _image_pub_gr_request() {
 
   $numref = FALSE;
 
-  //watchdog('image_pub', t('Processing command %cmd', array('%cmd' => theme('placeholder', $cmd))));
+  // watchdog('image_pub', 'Processing command %cmd', array('%cmd' => $cmd));
  
   switch ($cmd) {
     case 'login':
@@ -388,10 +388,10 @@ function _image_pub_gr_finish($code, $bo
     }
   }
   if ($code != GR_STAT_SUCCESS) {
-    watchdog('image_pub', t('Request failure: %code, %msg', array('%code' => $code, '%msg' => $message)));
+    watchdog('image_pub', 'Request failure: %code, %msg', array('%code' => $code, '%msg' => $message));
   } 
   else {
-    //watchdog('image_pub', t('Command succeeded: %msg', array('%msg' => theme('placeholder', $message))));
+    //watchdog('image_pub', 'Command succeeded: %msg', array('%msg' => theme('placeholder', $message)));
   }
   drupal_set_header("Content-Type: text/plain");
   echo "#__GR2PROTO__\n" .
@@ -654,7 +654,7 @@ function _image_pub_gr_add_image($albnam
  * usable destinations for the publishing wizard.
  */
 function _image_pub_xp_reghack() {
-  $pub_url = url('publish_xp', NULL, NULL, TRUE);
+  $pub_url = url('publish_xp', array('absolute' => TRUE));
   $site_name = variable_get('site_name', 'drupal');
   $site_descr = sprintf(t("Publish Your Photos to %s."), $site_name);
   if (!strncmp($pub_url, 'https:', 6)) {
@@ -805,7 +805,7 @@ function _image_pub_xp_page($body, $head
   $site_name = variable_get('site_name', 'drupal');
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language ?>" xml:lang="<?php print $language ?>">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language->language; ?>" xml:lang="<?php print $language->language; ?>">
 <head>
 </head>
 <body>
@@ -917,6 +917,7 @@ function _image_pub_xp_album_form($messa
 
   // Build a form array
   $form = array();
+  $form_state = array();
 
   // create a fieldset to wrap the form in
   // note #parents must be forced for this set to work with original code
@@ -1009,7 +1010,7 @@ function _image_pub_xp_album_form($messa
 
   // Render the form elements to themed HTML
   $body[] = '<form method="post" id="album">';
-  $body[] = drupal_render(form_builder('album', $form));
+  $body[] = drupal_render(form_builder('album', $form, $form_state));
   $body[] = '</form>';
   $body[] = '';
 
@@ -1040,7 +1041,7 @@ var files = xml.selectNodes("transferman
 
 for (i = 0; i < files.length; i++) {
 	var postTag = xml.createNode(1, "post", "");
-	postTag.setAttribute("href", "<?php echo url('publish_xp', NULL, NULL, TRUE); ?>");
+	postTag.setAttribute("href", "<?php echo url('publish_xp',  array('absolute' => TRUE)); ?>");
 	postTag.setAttribute("name", "userfile");
 
 	var dataTag = xml.createNode(1, "formdata", "");
@@ -1072,7 +1073,7 @@ for (i = 0; i < files.length; i++) {
 
 var uploadTag = xml.createNode(1, "uploadinfo", "");
 var htmluiTag = xml.createNode(1, "htmlui", "");
-htmluiTag.text = "<?php echo url('image/tid/'.$albumid, NULL, NULL, TRUE); ?>";
+htmluiTag.text = "<?php echo url('image/tid/'.$albumid, array('absolute' => TRUE)); ?>";
 uploadTag.appendChild(htmluiTag);
 
 xml.documentElement.appendChild(uploadTag);
