diff -u "c:/xampp/htdocs/drupal-fresh/sites/all/modules/modr8-5.x-2.3.tar/modr8/modr8.module" "c:/xampp/htdocs/drupal-fresh/sites/all/modules/modr8/modr8.module"
--- c:/xampp/htdocs/drupal-fresh/sites/all/modules/modr8-5.x-2.3.tar/modr8/modr8.module	2007-08-16 03:58:04.000000000 +0100
+++ c:/xampp/htdocs/drupal-fresh/sites/all/modules/modr8/modr8.module	2007-09-18 09:39:53.500000000 +0100
@@ -1,295 +1,410 @@
-<?php
-// $Id: modr8.module,v 1.5.2.12 2007/08/16 02:58:04 pwolanin Exp $
-
-/**
- * @file
- * Easy dedicated content moderation
- */
-
-/**
- * Implementation of hook_help().
- */
-function modr8_help($section) {
-  switch ($section) {
-    case 'admin/help#modr8':
-      return '<p>'. t("Easy, dedicated moderation of content.  Assign the 'moderate content' permission to one or mode user roles.  Set up the default moderation option for each node type."). '</p>';
-    // OPTIONAL: Add additional cases for other paths that should display help text.
-  }
-}
-
-
-/**
- * Implementation of hook_menu().
- */
-function modr8_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/content/modr8',
-      'title' => t('Moderated content'),
-      'description' => t('Approve or delete moderated content.'),
-      'access' => user_access('moderate content'),
-      'callback' => 'modr8_page',
-    );
-    $items[] = array(
-      'path' => 'admin/logs/modr8',
-      'title' => t('Content moderation log'),
-      'description' => t('Show log of all actions on moderated content.'),
-      'access' => user_access('moderate content'),
-      'callback' => 'modr8_log_view',
-    );    
-    $items[] = array(
-      'path' => 'admin/settings/modr8',
-      'title' => t('Modr8 settings'),
-      'description' => t('Configure content moderation.'),
-      'callback' => 'modr8_settings',
-      'access' => user_access('administer site configuration'), 
-    );
-  }
-  elseif (arg(0) == 'node' && is_numeric($nid = arg(1))) {  
-    $items[] = array(
-      'path' => 'node/'. $nid .'/modr8', 
-      'title' => t('Moderation'),
-      'callback' => 'modr8_log_view',
-      'callback arguments' => array('node', $nid),
-      'access' => user_access('moderate content') && db_result(db_query("SELECT COUNT(*) FROM {modr8_log} ml WHERE ml.nid = %d", $nid)),
-      'weight' => 10,
-      'type' => MENU_LOCAL_TASK
-    );
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_perm().
- */
-function modr8_perm() {
-  return array('moderate content');  
-}
-
-/**
- * menu callback for moderation log.
- */
-function modr8_log_view($op = '', $id = 0) {  
-  
-  require_once drupal_get_path('module', 'modr8'). '/modr8_admin.inc';
-  
-  switch ($op) {
-    case '':
-      return modr8_log_overview();
-    case 'event':
-      if (is_numeric($id)) {
-        drupal_set_title(t('Moderation log event'));
-        return modr8_log_event($id);
-      }
-      break;
-    case 'node':
-      if (is_numeric($id)) {
-        $node = node_load($id);
-         if ($node->nid) {
-           drupal_set_title(check_plain($node->title));
-         }
-         return modr8_log_overview($id);
-      }
-      break;
-  }
-  drupal_not_found();
-}
-
-
-/**
- * menu callback for settings form.
- */
-function modr8_settings() {  
-  
-  require_once drupal_get_path('module', 'modr8'). '/modr8_admin.inc';
-  
-  return drupal_get_form('modr8_settings_form');
-}
-
-/**
- * Implementation of hook_nodeapi
- */
-function modr8_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
-  // add messages here..
-  switch ($op) {
-    case 'load':
-      return db_fetch_array(db_query('SELECT n.moderate FROM {node} n WHERE n.nid = %d', $node->nid)); 
-    case 'prepare':
-      if (!isset($node->nid)) {//a new node
-        $node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
-        $node->moderate = in_array('moderate', $node_options);
-      }
-      break;
-    case 'view':
-      if ($node->moderate && empty($node->modr8_form_teaser) && empty($node->in_preview)) {
-        $node->content['modr8_message'] = array(
-          '#value' => theme('modr8_message', $teaser, $node->type, 'view'),
-          '#weight' => -100,
-        );
-      }
-      break;
-    case 'update' :
-    case 'insert' :
-      db_query('UPDATE {node} SET moderate = %d WHERE nid = %d', $node->moderate, $node->nid);
-      if ($node->moderate) { //cut this?
-        theme('modr8_message', FALSE, $node->type, $op);
-      }
-      break;
-    case 'delete':
-      // Delete log entries when a node is deleted, unless it's deleted while
-      // in moderation.  In the latter case, we want to retain the log to see
-      // which moderator deleted the node  and any message they sent.
-      if (!$node->moderate) {
-        db_query("DELETE FROM {modr8_log} WHERE nid = %d", $node->nid);
-      }
-      break;
-  }
-}
-
-function modr8_form_alter($form_id, &$form){
-
-  if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id)  {
-
-    $moderate_checkbox = array(
-      '#type' => 'checkbox', 
-      '#title' => t('In moderation queue'), 
-      '#default_value' => $form['#node']->moderate,
-      '#weight' => 24,
-      '#description' => t('This %type will be placed in moderation if the %moderate checkbox is selected.', array('%type' => node_get_types('name', $form['#node']), '%moderate' => t('In moderation queue'))),
-    );
-    if (user_access('administer nodes')) {
-      $form['options']['moderate'] = $moderate_checkbox;
-    }
-    elseif (user_access('moderate content')) {
-      $form['moderate'] = $moderate_checkbox;
-    }
-    else {
-      $form['moderate'] = array(
-        '#type' => 'value',
-        '#value' => $form['#node']->moderate,
-      );
-      if ($form['#node']->moderate) {
-        $form['modr8_message'] = array(
-          '#value' => theme('modr8_message', FALSE, $form['#node']->type, 'node_form'),
-          '#weight' => -100,
-        );
-      }
-    }
-  }
-  elseif ($form_id == 'node_type_form') {
-    $form['workflow']['node_options']['#options']['moderate'] = t('In moderation queue');
-  }
-}
-
-/**
- * Menu callback; displays the content moderation form.
- */
-function modr8_page() {
-  require_once drupal_get_path('module', 'modr8'). '/modr8_admin.inc';
-
-  $is_published = '';
-  if (!user_access('administer nodes')) {
-    // Users who don't have the 'administer nodes' permission can only see published nodes.
-    $is_published = 'n.status = 1 AND ';
-  }
-  $count_sql = db_rewrite_sql('SELECT COUNT(*) FROM {node} n WHERE '. $is_published .' n.moderate = 1');
-  $page_sql = db_rewrite_sql('SELECT n.nid FROM {node} n WHERE '. $is_published .' n.moderate = 1 ORDER BY n.changed DESC');
-  $result = pager_query($page_sql, variable_get('modr8_nodes_per_page', 10), 0, $count_sql);
-  
-  $output = '<p>'. l(t('Show log of all actions on moderated content.'), 'admin/logs/modr8') .'</p>';
-  if (db_num_rows($result)) {
-    $output .= drupal_get_form('modr8_form', $result);
-    $output .= theme('pager');
-  }
-  else {
-    $output .= '<p>'. t('@items in moderation', array('@items' => format_plural(0, '1 post', '@count posts'))). '</p>';
-  }
-  return $output;
-}
-
-/**
- * Implementation of hook_db_rewrite_sql().
- */
-function modr8_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
-  switch ($primary_field) {
-    case 'nid':
-      // this query deals with node objects
-      $access = (user_access('administer nodes') || user_access('moderate content'));
-      if (!$access) {
-        global $user;
-        $return = array();
-        if ($primary_table != 'n') {
-          $return['join'] = "LEFT JOIN {node} n ON $primary_table.nid = n.nid";
-        }
-        if ($user->uid == 0) {
-          $return['where'] = "(n.moderate != 1)";
-        }
-        else {
-          $return['where'] = "(n.moderate != 1 OR n.uid = ". (int)$user->uid .")";
-        }
-        return $return;
-      }
-      break;
-
-  }
-} 
-
-/**
- * Implementation of hook_cron()
- *
- *.Remove expired moderation log events.
- */
-function modr8_cron() {
-  if ($log_clear = variable_get('modr8_log_clear', 0)) {
-    db_query('DELETE FROM {modr8_log} WHERE timestamp < %d', time() - $log_clear);
-  }
-} 
-
-/**
- * Implementation of hook_block().
- */
-function modr8_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
-    $blocks[0]['info'] = t("Modr8 moderator's block");
-    return $blocks;
-  }
-  elseif ($op == 'view') {
-    if (user_access('moderate content')){
-      $block['subject'] = t('Moderation queue');
-      $is_published = '';
-      if (!user_access('administer nodes')) {
-        // Users who don't have the 'administer nodes' permission can only see published nodes.
-        $is_published = 'n.status = 1 AND ';
-      }
-      $count = db_result(db_query(db_rewrite_sql('SELECT COUNT(*) FROM {node} n WHERE '. $is_published .' n.moderate = 1')));
-      $content = '<p>'. l(t('@items in moderation',array('@items' => format_plural($count, '1 post', '@count posts'))),'admin/content/modr8'). '</p>';
-      if ($count) {
-        $sql = db_rewrite_sql('SELECT n.nid, n.title FROM {node} n WHERE '. $is_published .' n.moderate = 1 ORDER BY n.changed DESC');
-        $result = db_query_range($sql,0,6);
-        $content .= node_title_list($result, t('Recent additions:'));
-      }
-      $block['content'] = $content;
-      return $block;
-    }
-  }
-}
-
-function theme_modr8_message($teaser = FALSE, $nodetype = 'page', $op = 'view') {
-  if ($teaser) {
-    return ' <div class="marker">'. t('Pending moderation') .'</div>';
-  }
-  else {
-    switch ($op) {
-      case 'view':
-        drupal_set_message(t("The post has been submitted for moderation and won't be listed publicly until it has been approved."), 'error');
-        break;
-      case 'node_form':
-        drupal_set_message(t('This %type will be submitted for moderation and will not be accessible to other users until it has been approved.', array('%type' => node_get_types('name', $nodetype))));
-        break;
-    }
-    return '';
-  }
-}
+<?php
+// $Id: modr8.module,v 1.5.2.12 2007/08/16 02:58:04 pwolanin Exp $
+
+/**
+ * @file
+ * Easy dedicated content moderation
+ */
+
+/**
+ * Implementation of hook_help().
+ */
+function modr8_help($section) {
+  switch ($section) {
+    case 'admin/help#modr8':
+      return '<p>'. t("Easy, dedicated moderation of content.  Assign the 'moderate content' permission to one or mode user roles.  Set up the default moderation option for each node type."). '</p>';
+    // OPTIONAL: Add additional cases for other paths that should display help text.
+  }
+}
+
+
+/**
+ * Implementation of hook_menu().
+ */
+function modr8_menu($may_cache) {
+  $items = array();
+
+  if ($may_cache) {
+    $items[] = array(
+      'path' => 'admin/content/modr8',
+      'title' => t('Moderated content'),
+      'description' => t('Approve or delete moderated content.'),
+      'access' => user_access('moderate content'),
+      'callback' => 'modr8_page',
+    );
+    $items[] = array(
+      'path' => 'admin/logs/modr8',
+      'title' => t('Content moderation log'),
+      'description' => t('Show log of all actions on moderated content.'),
+      'access' => user_access('moderate content'),
+      'callback' => 'modr8_log_view',
+    );    
+    $items[] = array(
+      'path' => 'admin/settings/modr8',
+      'title' => t('Modr8 settings'),
+      'description' => t('Configure content moderation.'),
+      'callback' => 'modr8_settings',
+      'access' => user_access('administer site configuration'), 
+    );
+  }
+  elseif (arg(0) == 'node' && is_numeric($nid = arg(1))) {  
+    $items[] = array(
+      'path' => 'node/'. $nid .'/modr8', 
+      'title' => t('Moderation'),
+      'callback' => 'modr8_log_view',
+      'callback arguments' => array('node', $nid),
+      'access' => user_access('moderate content') && db_result(db_query("SELECT COUNT(*) FROM {modr8_log} ml WHERE ml.nid = %d", $nid)),
+      'weight' => 10,
+      'type' => MENU_LOCAL_TASK
+    );
+    
+    $node = node_load($nid);
+    $teaser = node_view($node, TRUE, FALSE, FALSE);
+    $items[] = array(
+      'path' => 'node/' . $nid . '/approve',
+      'title' => t('Approve node'),
+      'callback' => 'modr8_approve_callback',
+      'callback arguments' => array($nid, $teaser),
+      'type' => MENU_CALLBACK
+      );
+  }
+
+  return $items;
+}
+
+/**
+ * Implementation of hook_perm().
+ */
+function modr8_perm() {
+  return array('moderate content', 'publish content unmoderated');  
+}
+
+/**
+ * menu callback for moderation log.
+ */
+function modr8_log_view($op = '', $id = 0) {  
+  
+  require_once drupal_get_path('module', 'modr8'). '/modr8_admin.inc';
+  
+  switch ($op) {
+    case '':
+      return modr8_log_overview();
+    case 'event':
+      if (is_numeric($id)) {
+        drupal_set_title(t('Moderation log event'));
+        return modr8_log_event($id);
+      }
+      break;
+    case 'node':
+      if (is_numeric($id)) {
+        $node = node_load($id);
+         if ($node->nid) {
+           drupal_set_title(check_plain($node->title));
+         }
+         return modr8_log_overview($id);
+      }
+      break;
+  }
+  drupal_not_found();
+}
+
+
+/**
+ * menu callback for settings form.
+ */
+function modr8_settings() {  
+  
+  require_once drupal_get_path('module', 'modr8'). '/modr8_admin.inc';
+  
+  return drupal_get_form('modr8_settings_form');
+}
+
+/**
+ * Implementation of hook_nodeapi
+ */
+function modr8_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
+  // add messages here..
+  switch ($op) {
+    case 'load':
+      return db_fetch_array(db_query('SELECT n.moderate FROM {node} n WHERE n.nid = %d', $node->nid)); 
+    case 'prepare':
+      // If we're dealing with a new node and the user doesn't have the right to
+      // publish without moderation:
+      if (!isset($node->nid) && !user_access('publish content unmoderated')) {
+        $node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
+        $node->moderate = in_array('moderate', $node_options);
+      }
+      break;
+    case 'update' :
+    case 'insert' :
+      db_query('UPDATE {node} SET moderate = %d WHERE nid = %d', $node->moderate, $node->nid);
+      if ($node->moderate) { //cut this?
+        theme('modr8_message', $node->type, $op);
+      }
+      break;
+    case 'delete':
+      // Delete log entries when a node is deleted, unless it's deleted while
+      // in moderation.  In the latter case, we want to retain the log to see
+      // which moderator deleted the node  and any message they sent.
+      if (!$node->moderate) {
+        db_query("DELETE FROM {modr8_log} WHERE nid = %d", $node->nid);
+      } else {
+        $teaser = node_view($node, TRUE, FALSE, FALSE);
+        modr8_log_action('delete', $node, $teaser, '');
+      }
+      break;
+  }
+}
+
+function modr8_form_alter($form_id, &$form){
+
+  if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id)  {
+
+    $moderate_checkbox = array(
+      '#type' => 'checkbox', 
+      '#title' => t('In moderation queue'), 
+      '#default_value' => $form['#node']->moderate,
+      '#weight' => 24,
+      '#description' => t('This %type will be placed in moderation if the %moderate checkbox is selected.', array('%type' => node_get_types('name', $form['#node']), '%moderate' => t('In moderation queue'))),
+    );
+    if (user_access('administer nodes')) {
+      $form['options']['moderate'] = $moderate_checkbox;
+    }
+    elseif (user_access('moderate content')) {
+      $form['moderate'] = $moderate_checkbox;
+    }
+    else {
+      $form['moderate'] = array(
+        '#type' => 'value',
+        '#value' => $form['#node']->moderate,
+      );
+      if ($form['#node']->moderate) {
+        $form['modr8_message'] = array(
+          '#value' => theme('modr8_message', $form['#node']->type, 'node_form'),
+          '#weight' => -100,
+        );
+      }
+    }
+  }
+  elseif ($form_id == 'node_type_form') {
+    $form['workflow']['node_options']['#options']['moderate'] = t('In moderation queue');
+  }
+}
+
+/**
+ * Menu callback; displays the content moderation form.
+ */
+function modr8_page() {
+  require_once drupal_get_path('module', 'modr8'). '/modr8_admin.inc';
+
+  $is_published = '';
+  if (!user_access('administer nodes')) {
+    // Users who don't have the 'administer nodes' permission can only see published nodes.
+    $is_published = 'n.status = 1 AND ';
+  }
+  $count_sql = db_rewrite_sql('SELECT COUNT(*) FROM {node} n WHERE '. $is_published .' n.moderate = 1');
+  $page_sql = db_rewrite_sql('SELECT n.nid FROM {node} n WHERE '. $is_published .' n.moderate = 1 ORDER BY n.changed DESC');
+  $result = pager_query($page_sql, variable_get('modr8_nodes_per_page', 10), 0, $count_sql);
+  
+  $output = '<p>'. l(t('Show log of all actions on moderated content.'), 'admin/logs/modr8') .'</p>';
+  if (db_num_rows($result)) {
+    $output .= drupal_get_form('modr8_form', $result);
+    $output .= theme('pager');
+  }
+  else {
+    $output .= '<p>'. t('@items in moderation', array('@items' => format_plural(0, '1 post', '@count posts'))). '</p>';
+  }
+  return $output;
+}
+
+/**
+ * Implementation of hook_db_rewrite_sql().
+ */
+function modr8_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
+  switch ($primary_field) {
+    case 'nid':
+      // this query deals with node objects
+      $access = (user_access('administer nodes') || user_access('moderate content'));
+      if (!$access) {
+        global $user;
+        $return = array();
+        if ($primary_table != 'n') {
+          $return['join'] = "LEFT JOIN {node} n ON $primary_table.nid = n.nid";
+        }
+        if ($user->uid == 0) {
+          $return['where'] = "(n.moderate != 1)";
+        }
+        else {
+          $return['where'] = "(n.moderate != 1 OR n.uid = ". (int)$user->uid .")";
+        }
+        return $return;
+      }
+      break;
+
+  }
+} 
+
+/**
+ * Implementation of hook_cron()
+ *
+ *.Remove expired moderation log events.
+ */
+function modr8_cron() {
+  if ($log_clear = variable_get('modr8_log_clear', 0)) {
+    db_query('DELETE FROM {modr8_log} WHERE timestamp < %d', time() - $log_clear);
+  }
+} 
+
+/**
+ * Implementation of hook_block().
+ */
+function modr8_block($op = 'list', $delta = 0) {
+  if ($op == 'list') {
+    $blocks[0]['info'] = t("Modr8 moderator's block");
+    return $blocks;
+  }
+  elseif ($op == 'view') {
+    if (user_access('moderate content')){
+      $block['subject'] = t('Moderation queue');
+      $is_published = '';
+      if (!user_access('administer nodes')) {
+        // Users who don't have the 'administer nodes' permission can only see published nodes.
+        $is_published = 'n.status = 1 AND ';
+      }
+      $count = db_result(db_query(db_rewrite_sql('SELECT COUNT(*) FROM {node} n WHERE '. $is_published .' n.moderate = 1')));
+      $content = '<p>'. l(t('@items in moderation',array('@items' => format_plural($count, '1 post', '@count posts'))),'admin/content/modr8'). '</p>';
+      if ($count) {
+        $sql = db_rewrite_sql('SELECT n.nid, n.title FROM {node} n WHERE '. $is_published .' n.moderate = 1 ORDER BY n.changed DESC');
+        $result = db_query_range($sql,0,6);
+        $content .= node_title_list($result, t('Recent additions:'));
+      }
+      $block['content'] = $content;
+      return $block;
+    }
+  }
+}
+
+/**
+ * A message to indicate that the node is being held for moderation.
+ */
+function theme_modr8_message($nodetype = 'page', $op = 'view') {
+  switch ($op) {
+    case 'view':
+      drupal_set_message
+        (t("The post has been submitted for moderation and won't be listed " .
+           "until it has been approved.")
+         ,'error');
+      break;
+    case 'node_form':
+      drupal_set_message
+        (t('This %type will be submitted for moderation and will not be ' .
+           'accessible to other users until it has been approved.',
+           array('%type' => node_get_types('name', $nodetype))));
+      break;
+  }
+}
+
+function modr8_approve_callback($nid, $teaser) {
+  modr8_approve_node($nid, $teaser);
+  drupal_goto('node/' . $nid);
+}
+
+/* MINIMOD FORM
+
+ */
+
+function modr8_link($type, $node) {
+  if ($node->moderate) {
+    $pending = 
+      array(
+        'title' => 'Pending moderation',
+        'attributes' => array ('class' => 'modr8-minimod-pending'),
+        );
+    if (user_access('moderate content')) {
+      return array(
+        $pending,
+        array(
+          'href' => 'node/' . $node->nid . '/approve',
+          'title' => 'Approve',
+          'attributes' => array ('class' => 'modr8-minimod-link')
+          ),
+        array(
+          'href' => 'node/' . $node->nid . '/delete',
+          'title' => 'Delete',
+          'attributes' => array ('class' => 'modr8-minimod-link')
+          )
+        );
+    } else {
+      return array($pending);
+    }
+  }
+}
+
+
+/* PERFORMING THE MODERATION
+
+*/
+
+/**
+ * Approve a node
+ */
+function modr8_approve_node($nid, $teaser, $note = '') {
+  $node = node_load($nid);
+  if (variable_get('modr8_send_approve', FALSE)){
+    $message = modr8_usermail('approve', $node, $note);
+  }
+  if (user_access('administer nodes')) {
+    $publish = ', status = 1';
+  }
+
+  db_query('UPDATE {node} SET moderate = 0 '. $publish .' WHERE nid = %d', $nid);
+  drupal_set_message(t('The %type with title %title has been approved.',
+                       array( '%title' => $node->title, '%type' => $node->type)
+                       ));
+  cache_clear_all();
+  modr8_log_action('approve', $node, $teaser, $message);
+}
+
+/**
+ * Delete a node
+ */
+function modr8_delete_node($nid, $teaser, $note = '') {
+  $node = node_load($nid);
+  if (variable_get('modr8_send_deny', FALSE)){
+    $message = modr8_usermail('deny', $node, $note);
+  }
+  node_delete($nid);
+  // drupal does its own message
+  modr8_log_action('delete', $node, $teaser, $message);
+}
+
+/**
+ * Do nothing to a node
+ */
+function modr8_nada_node($nid, $teaser, $note = '') {
+  $node = node_load($nid);
+  if (variable_get('modr8_send_noact', FALSE) && !empty($note)){
+    $message = modr8_usermail('nada', $node, $note);
+    modr8_log_action('nada', $node, $teaser, $message);
+  }    
+}
+
+/**
+ * Log a moderation action
+ */
+function modr8_log_action($op, $node, $teaser, $message) {
+  global $user;
+  $actions = array(
+    'approve' => 'Approve',
+    'delete' => 'Delete',
+    'nada' => 'No action');
+
+  db_query(
+    "INSERT INTO {modr8_log} " .
+    "(nid, uid, author_uid, action, title, message, teaser, timestamp) " .
+    "VALUES (%d, %d, %d, '%s', '%s', '%s', '%s', %d)",
+    $node->nid, $user->uid, $node->uid, $actions[$op], $node->title,
+    $message, $teaser, time());
+}
+
+?>
\ No newline at end of file

Diff finished.  Tue Sep 18 09:41:06 2007
