diff -ruN /home/mathan/Desktop/modr8//modr8_admin.inc /home/mathan/Desktop/modr8_new//modr8_admin.inc
--- /home/mathan/Desktop/modr8//modr8_admin.inc	2010-04-02 08:41:13.000000000 +0530
+++ /home/mathan/Desktop/modr8_new//modr8_admin.inc	2011-11-01 14:45:32.000000000 +0530
@@ -1,6 +1,15 @@
 <?php
 // $Id: modr8_admin.inc,v 1.31 2010/04/02 03:11:13 pwolanin Exp $
 
+/**
+ * @file
+ * Admin pages for moderation
+ */
+
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function modr8_settings_form($form_state) {
 
   $form['modr8_default_option'] = array(
@@ -13,13 +22,25 @@
     ),
     '#default_value' => variable_get('modr8_default_option', 'nada'),
   );
-
+  
+  $form['modr8_nodes_by_domain'] = array(
+    '#type' => 'radios',
+    '#title' => t('Restrict modr8 nodes by domain'),
+    '#default_value' => variable_get('modr8_nodes_by_domain', 0),
+    '#options' => array(1  =>  t('Yes'),  0  =>  t('No')),
+  );
   $form['modr8_nodes_per_page'] = array(
     '#type' => 'select',
     '#title' => t('Number of moderated posts to display per page'),
     '#options' => drupal_map_assoc(array(5, 10, 15, 20, 25, 50, 75, 100, 150, 200)),
     '#default_value' => variable_get('modr8_nodes_per_page', 10),
   );
+  $form['modr8_logs_per_page'] = array(
+    '#type' => 'select',
+    '#title' => t('Number of moderated logs to display per page'),
+    '#options' => drupal_map_assoc(array(5, 10, 15, 20, 25, 50, 75, 100, 150, 200)),
+    '#default_value' => variable_get('modr8_logs_per_page', 15),
+  );
   $period = drupal_map_assoc(array(86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 7257600), 'format_interval');
   $period[0] = t('Never');
   $form['modr8_log_clear'] = array(
@@ -27,7 +48,7 @@
     '#title' => t('Discard log entries older than'),
     '#default_value' => variable_get('modr8_log_clear', 0),
     '#options' => $period,
-    '#description' => t('The time log entries should be kept. Older entries will be automatically discarded. Requires crontab.')
+    '#description' => t('The time log entries should be kept. Older entries will be automatically discarded. Requires crontab.'),
   );
   $form['text'] = array(
     '#type' => 'fieldset',
@@ -37,7 +58,7 @@
   $form['text']['modr8_email_from'] = array(
     '#type' => 'textfield',
     '#title' => t('Moderator email address'),
-    '#description' => t('E-mail notices sent by modr8 will have this as the "From" address. Leave empty to use same "From" address  as is used for user registration other administrative notices as set at <a href="@site-info">Site information</a>.', array('@site-info' => url('admin/settings/site-information'))),
+    '#description' => t('E-mail notices sent by modr8 will have this as the "From" address. Leave empty to use same "From" address  as is used for user registration other administrative notices as set at <a href="@site-info">Site information</a>.', array('@site-info' => url('admin/config/site-information'))),
     '#default_value' => variable_get('modr8_email_from', ''),
   );
 
@@ -110,6 +131,10 @@
   return system_settings_form($form);
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function modr8_settings_validate($form, &$form_state) {
   if ($form_state['values']['modr8_email_from'] && !valid_email_address($form_state['values']['modr8_email_from'])) {
     form_set_error('modr8_email_from', t('You must either enter a valid e-mail address, or leave the moderator e-mail field empty.'));
@@ -121,16 +146,20 @@
  */
 function modr8_response_page($node) {
   if ($node->moderate) {
-    drupal_set_title(t('Submit response regarding %title', array('%title' => $node->title)));
+    drupal_set_title(t('Submit response regarding %title', array('%title' => $node->title)), PASS_THROUGH);
     return drupal_get_form('modr8_response_form', $node);
   }
   else {
-    drupal_set_title(t('The moderator already approved %title', array('%title' => $node->title)));
-    return '<p>'. t('This post has already been approved by the moderator. No response is needed.') .'</p>';
+    drupal_set_title(t('The moderator already approved %title', array('%title' => $node->title)), PASS_THROUGH);
+    return '<p>' . t('This post has already been approved by the moderator. No response is needed.') . '</p>';
   }
 }
 
-function modr8_response_form($form_state, $node) {
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
+function modr8_response_form($form, $form_state, $node) {
   $form = array();
   $form['title'] = array(
     '#type' => 'textfield',
@@ -151,10 +180,11 @@
     '#value' => t('Submit'),
     '#weight' => 5,
   );
-  // This flag can be used by modr8, or other modules to change the teaser specifically
-  // for when it's being shown in the moderation list.
+  // This flag can be used by modr8, or other modules to change the
+  // teaser specifically for when it's being shown in the moderation
+  // list.
   $node->modr8_form_teaser = TRUE;
-  $teaser = node_view($node, TRUE, FALSE, FALSE);
+  $teaser = drupal_render(node_view($node, 'teaser'));
   $form['preview'] = array(
     '#type' => 'value',
     '#value' => $teaser,
@@ -180,7 +210,7 @@
   $form_state['values']['title'] = check_plain($form_state['values']['title']);
   $message = filter_xss(nl2br($form_state['values']['body']), array('br'));
   modr8_log_action('response', $form_state['values']['nid'], $form_state['values'], $message);
-  $form_state['redirect'] = 'node/'. $form_state['values']['nid'];
+  $form_state['redirect'] = 'node/' . $form_state['values']['nid'];
   drupal_set_message(t('Your response has been logged.'));
 }
 
@@ -188,33 +218,52 @@
  * Menu callback; displays the content moderation form.
  */
 function modr8_page() {
-
-  $is_published = '';
+  global  $_domain;
+  $is_published = array(0,  1);
   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 ';
+    $is_published = 1;
   }
-  $count_sql = db_rewrite_sql('SELECT COUNT(*) FROM {node} n WHERE '. $is_published .' n.moderate = 1');
-  $page_sql = db_rewrite_sql('SELECT n.nid, n.changed 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/reports/modr8') .'</p>';
+  $qry = db_select('modr8_moderate', 'm')
+    ->extend('PagerDefault')
+    ->limit(variable_get('modr8_nodes_per_page', 10))
+    ->fields('n', array('nid', 'changed'))
+    ->condition('m.moderate', 1);
+  $qry->join('node', 'n', 'n.nid = m.nid');
+  $qry->condition('n.status',  $is_published);
+  //To fetch the contents from the current domain
+  if  (variable_get('modr8_nodes_by_domain', 0)  &&  module_exists('domain'))  {
+    $qry->join('domain_source', 'd', 'n.nid = d.nid');
+    $qry->condition('d.domain_id',  $_domain['domain_id']);
+  }
+  $result = $qry->execute()->fetchAll();
+  $output['header'] = array(
+    '#type' => 'markup',
+    '#markup' => '<p>' . l(t('Show log of all actions on moderated content.'), 'admin/reports/modr8') . '</p>',
+  );
 
   $nid_list = array();
-  while ($r = db_fetch_object($result)) {
+  foreach ($result as $r) {
     $nid_list[] = $r->nid;
   }
   if ($nid_list) {
-    $output .= drupal_get_form('modr8_form', $nid_list);
-    $output .= theme('pager');
-
+    $output['form'] = drupal_get_form('modr8_form', $nid_list);
+    $output['pager_pager'] = array('#theme' => 'pager');
   }
   else {
-    $output .= '<p>'. t('@items in moderation', array('@items' => format_plural(0, '1 post', '@count posts'))) .'</p>';
+    $output['footer'] = array(
+      '#type' => 'markup',
+      '#markup' => '<p>' . t('@items in moderation', array('@items' => format_plural(0, '1 post', '@count posts'))) . '</p>',
+    );
   }
   return $output;
 }
 
-function modr8_form($form_state, $nid_list = array()) {
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
+function modr8_form($form, $form_state, $nid_list = array()) {
   $form = array(
     '#theme' => 'modr8_form',
     '#tree' => TRUE,
@@ -227,7 +276,7 @@
     // for when it's being shown in the moderation list.
     $node->modr8_form_teaser = TRUE;
     $node->build_mode = NODE_BUILD_MODR8_TEASER;
-    $teaser = node_view($node, TRUE, FALSE, FALSE);
+    $teaser = drupal_render(node_view($node, 'teaser'));
 
     $form[$node->nid] = array(
       '#tree' => TRUE,
@@ -257,20 +306,21 @@
     );
 
     $log_link = '';
-    $events = db_query("SELECT modid FROM {modr8_log} WHERE nid = %d", $node->nid);
-    $count = db_result(db_query("SELECT COUNT(modid) FROM {modr8_log} WHERE nid = %d", $node->nid));
+    $events = db_query("SELECT modid FROM {modr8_log} WHERE nid = :nid", array(':nid' => $node->nid));
+    $count = db_query("SELECT COUNT(modid) FROM {modr8_log} WHERE nid = :nid", array(':nid' => $node->nid))->fetchField();
     if ($count) {
       if ($count == 1) {
-        $url = 'admin/reports/modr8/event/'. db_result($events);
+        $url = 'admin/reports/modr8/event/' . $events->fetchField();
       }
       else {
-        $url = 'node/'. $node->nid .'/modr8/';
+        $url = 'node/' . $node->nid . '/modr8/';
       }
       $message = format_plural($count, 'See the 1 moderation log event for this post', 'Overview of the @count moderation log events for this post');
       $log_link .= l($message, $url);
     }
     $form[$node->nid]['log_link'] = array(
-      '#value' => $log_link,
+      '#type' => 'markup',
+      '#markup' => $log_link,
     );
     $form[$node->nid]['author_uid'] = array(
       '#type' => 'value',
@@ -283,7 +333,7 @@
 
     $form[$node->nid]['type'] = array(
       '#type' => 'value',
-      '#value' => node_get_types('name', $node),
+      '#value' => node_type_get_name($node),
     );
   }
   $form['submit'] = array(
@@ -297,11 +347,13 @@
 /**
  * Themes the content moderation form.
  */
-function theme_modr8_form($form) {
+function theme_modr8_form($variables) {
+  $form = $variables['form'];
   $headers = array(
     t('Operations'),
-    t('Content')
+    t('Content'),
   );
+  $rows = array();
   foreach (element_children($form) as $key) {
     // Only do this for nodes; not the submit button.
     if (is_numeric($key)) {
@@ -312,14 +364,12 @@
       }
       $row[] = array(
         'data' => drupal_render($form[$key]['ops']) . $note_field,
-        'style' => 'vertical-align:top;'
+        'style' => 'vertical-align:top;',
       );
-      // Apply extra filtering to insure we don't have nested form elements,
-      // unexpected script, etc.
-      $preview = filter_xss_admin($form[$key]['preview']['#value']);
+      $preview = $form[$key]['preview']['#value'];
 
-      if (!empty($form[$key]['log_link']['#value'])) {
-        $preview .= '<div><em>'. drupal_render($form[$key]['log_link']) .'</em></div>';
+      if (!empty($form[$key]['log_link']['#markup'])) {
+        $preview .= '<div><em>' . drupal_render($form[$key]['log_link']) . '</em></div>';
       }
       $row[] = array(
         'data' => $preview,
@@ -328,8 +378,8 @@
       $rows[] = $row;
     }
   }
-  $output = theme('table', $headers, $rows);
-  $output .= drupal_render($form);
+  $output = theme('table', array('header' => $headers, 'rows' => $rows));
+  $output .= drupal_render_children($form);
 
   return $output;
 }
@@ -359,6 +409,8 @@
           $message = modr8_usermail('deny', $nid, $values);
         }
         node_delete($nid);
+        //To delete the entry in the modr8_moderate after the node deletion
+        db_delete('modr8_moderate')->condition('nid', $nid)->execute();
         // drupal does its own message
         modr8_log_action('delete', $nid, $values, $message);
         break;
@@ -372,16 +424,40 @@
   }
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function modr8_log_action($op, $nid, $values, $message) {
   global $user;
-  $actions = array('approve' => 'Approve', 'delete' => 'Delete', 'nada' => 'No action', 'response' => 'Response');
-
-  db_query("INSERT INTO {modr8_log} (nid, uid, author_uid, action, title, message, teaser, timestamp) VALUES (%d, %d, %d, '%s', '%s', '%s', '%s', %d)", $nid, $user->uid, $values['author_uid'], $actions[$op], $values['title'], $message, $values['preview'], time());
+  $actions = array(
+    'approve' => 'Approve',
+    'delete' => 'Delete',
+    'nada' => 'No action',
+    'response' => 'Response',
+  );
+
+  $id = db_insert('modr8_log')
+  ->fields(array(
+    'nid' => $nid,
+    'uid' => $user->uid,
+    'author_uid' => $values['author_uid'],
+    'action' => $actions[$op],
+    'title' => $values['title'],
+    'message' => $message,
+    'teaser' => $values['preview'],
+    'timestamp' => REQUEST_TIME,
+  ))
+  ->execute();
   // Notify modules interested in each action we took.
   // modules have to implement the function: hook_modr8_log ( $op ,$nid , $values, $message);
   module_invoke_all('modr8_log', $op, $nid, $values, $message);
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function modr8_usermail($op, $nid, $values) {
   $node = node_load($nid);
 
@@ -406,9 +482,9 @@
     }
 
     // get the user info for author
-    $account = user_load(array('uid' => $node->uid));
+    $account = user_load($node->uid);
 
-    $note = theme('modr8_note', $values['note']);
+    $note = theme('modr8_note', array('0' => $values['note']));
 
     $sendmail_from = '';
     $site_mail = variable_get('modr8_email_from', '');
@@ -417,11 +493,17 @@
       $site_mail = variable_get('site_mail', $sendmail_from);
     }
     if (empty($site_mail) || $site_mail == $sendmail_from) {
-      drupal_set_message(t('You should create an administrator mail address for your site! <a href="@url">Do it here</a>.', array('@url' => url('admin/settings/site-information'))), 'error');
+      drupal_set_message(t('You should create an administrator mail address for your site! <a href="@url">Do it here</a>.', array('@url' => url('admin/config/site-information'))), 'error');
     }
     // send the email
     $language = user_preferred_language($account);
-    $params = array('account' => $account, 'node' => $node, 'subject' => $subject, 'message' => $message, 'note' => $note);
+    $params = array(
+      'account' => $account,
+      'node' => $node,
+      'subject' => $subject,
+      'message' => $message,
+      'note' => $note,
+    );
 
     if ($account->uid == 0) {
       $message = t('Anonymous user; no %type message was sent.', array('%type' => $optype));
@@ -446,7 +528,7 @@
 }
 
 /**
- * Implementation of hook_mail()
+ * Implements hook_mail().
  */
 function modr8_mail($key, &$message, $params) {
   $language = $message['language'];
@@ -458,7 +540,7 @@
       // eval the replacements
       $replacements_raw = modr8_replacements();
       foreach ($replacements_raw as $key => $val) {
-        eval('$replacements["$key"] = '. $val .';');
+        eval('$replacements["$key"] = ' . $val . ';');
       }
       $params['subject'] = strtr($params['subject'], $replacements);
       $params['message'] = strtr($params['message'], $replacements);
@@ -468,7 +550,12 @@
   }
 }
 
-function theme_modr8_note($note) {
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
+function theme_modr8_note($variables) {
+  $note = $variables['0'];
   if ($note) {
     // Do not filter here (use !) since this note is sanitized after e-mailing
     $note = t("Note:
@@ -477,6 +564,10 @@
   return $note;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function modr8_replacements() {
   return array(
     '%title' => '$node->title',
@@ -497,6 +588,10 @@
   );
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function modr8_accept_default() {
   return t(
 'Your %type entry entitled "%title" has been approved by our content moderator! Other visitors to %site will now be able to view it.
@@ -509,6 +604,10 @@
 The %site team');
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function modr8_denial_default() {
   return t(
 'Your %type entry entitled "%title" has been denied by our content moderator. The content has been deleted from our site.
@@ -519,6 +618,10 @@
 The %site team');
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function modr8_noact_default() {
   return t(
 'Your %type entry entitled "%title" has been reviewed by our content moderator, but not yet approved.
@@ -546,7 +649,7 @@
       if (is_numeric($id)) {
         $node = node_load($id);
         if (!empty($node->title)) {
-          drupal_set_title(check_plain($node->title));
+          drupal_set_title($node->title);
         }
         return modr8_log_overview($id);
       }
@@ -562,75 +665,132 @@
   drupal_not_found();
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function modr8_log_overview($nid = 0) {
 
+  global  $_domain;
   $header = array(
-    array('data' => t('Action'), ),
-    array('data' => t('User'), 'field' => 'u.name'),
-    array('data' => t('Date'), 'field' => 'ml.modid', 'sort' => 'desc'),
+    array('data' => t('Action')),
+    array(
+      'data' => t('User'),
+      'field' => 'u.name',
+    ),
+    array(
+      'data' => t('Date'),
+      'field' => 'ml.modid',
+      'sort' => 'desc',
+    ),
     array('data' => t('Title (view event)')),
   );
-  $tablesort = tablesort_sql($header);
-
-  $count_sql = "SELECT COUNT(*) FROM {modr8_log} ml";
-  $pager_sql = "SELECT ml.modid, ml.action, ml.title, ml.timestamp, u.name, u.uid FROM {modr8_log} ml LEFT JOIN {users} u ON u.uid = ml.uid";
-  if ($nid) {
-    $count_sql .= " WHERE ml.nid = %d";
-    $pager_sql .= " WHERE ml.nid = %d";
-  }
-  $count_sql = db_rewrite_sql($count_sql, 'ml');
-  $pager_sql = db_rewrite_sql($pager_sql, 'ml');
-  $result = pager_query($pager_sql . $tablesort, 50, 0, $count_sql, $nid);
-
-  $rows = array();
-
-  while ($event = db_fetch_object($result)) {
-    $rows[] = array(t($event->action), theme('username', $event), format_date($event->timestamp, 'small'),
-    l(truncate_utf8($event->title, 50, TRUE, TRUE), 'admin/reports/modr8/event/'. $event->modid, array(), NULL, NULL, FALSE, TRUE)
+  $events = db_select('modr8_log', 'ml')
+              ->extend('TableSort')
+              ->extend('PagerDefault')
+              ->limit(variable_get('modr8_logs_per_page', 15));
+  $events  
+     ->leftJoin('users',  'u',  'ml.uid = u.uid');
+  $events
+     ->fields('ml',  array('modid',  'action',  'title',  'timestamp'))
+     ->fields('u',  array('name',  'uid'))
+     ->orderByHeader($header);
+  //To fetch the logs for current current domain
+  if  (variable_get('modr8_nodes_by_domain', 0)  &&  module_exists('domain'))  {
+    $events->join('domain_source', 'd', 'ml.nid = d.nid');
+    $events->condition('d.domain_id',  $_domain['domain_id']);
+  }
+  $events  =  $events->execute();
+  
+  foreach ($events  as  $event) {
+    $rows[] = array(
+      t($event->action),
+      theme('username', array('account' => $event)),
+      format_date($event->timestamp, 'short'),
+      l(truncate_utf8($event->title, 50, TRUE, TRUE), 'admin/reports/modr8/event/' . $event->modid, array(), NULL, NULL, FALSE, TRUE),
     );
   }
 
   if (!$rows) {
-    $rows[] = array(array('data' => t('No log messages available.'), 'colspan' => 4));
+    $rows[] = array(array(
+        'data' => t('No log messages available.'),
+        'colspan' => 4,
+      ));
   }
   $output = '';
-  $output .= theme('table', $header, $rows);
-  $output .= theme('pager', NULL, 50, 0);
+  $output .= theme('table', array('header' => $header, 'rows' => $rows));
+  $output .= theme('pager', array('tags' => NULL, 'element' => 0));
 
   return $output;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function modr8_log_event($modid) {
 
   if (is_numeric($modid)) {
-    $sql = db_rewrite_sql("SELECT ml.*, u.name FROM {modr8_log} ml LEFT JOIN {users} u ON u.uid = ml.uid WHERE ml.modid = %d", 'ml');
-    $event = db_fetch_object(db_query($sql, $modid));
-    if ($event) {
-      $event->author = db_fetch_object(db_query("SELECT u.name, u.uid from {users} u WHERE u.uid = %d", $event->author_uid));
-      return theme('moderation_event', $event);
+    $qry  =  db_select('modr8_log', 'm')
+      ->condition('m.modid',  $modid);
+    $qry->join('users', 'u', 'u.uid = m.uid');
+    $qry->fields('m')
+      ->fields('u',  array('name'));
+    $events  =  $qry->execute()->fetchAll();
+    if ($events) {
+      $event = $events[0];
+      $qry  =  db_select('users', 'u')
+        ->condition('u.uid',  $event->author_uid)
+        ->fields('u',  array('name',  'uid'))
+        ->execute()
+        ->fetchAll();
+      if ($qry) {
+        $event->author  =  $qry[0];
+      }
+      return theme('moderation_event', array('0' => $event));
     }
   }
 
   drupal_not_found();
 }
 
-function theme_moderation_event($event) {
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
+function theme_moderation_event($variables) {
+  $event = $variables['0'];
 
-  $rows[] = array(array('data' => l(t('Overview of all moderation log events for this post'), 'node/'. $event->nid .'/modr8/'), 'colspan' => 2));
+  $rows[] = array(array(
+      'data' => l(t('Overview of all moderation log events for this post'), 'node/' . $event->nid . '/modr8/'),
+      'colspan' => 2,
+    ));
   $rows[] = array(t('Action:'), t($event->action));
-  $rows[] = array(t('Date:'), format_date($event->timestamp, 'small'));
+  $rows[] = array(t('Date:'), format_date($event->timestamp, 'short'));
   if ($event->action == 'Response') {
-    $rows[] = array(t('Author:'), theme('username', $event));
+    $rows[] = array(t('Author:'), theme('username', array('account' => $event)));
     $rows[] = array(t('Response title:'), $event->title);
-    $rows[] = array('data' => array(t('Response message:'), $event->message), 'style' => 'vertical-align:top;');
-    $rows[] = array('data' => array(t('Teaser (as of response):'), $event->teaser), 'style' => 'vertical-align:top;');
+    $rows[] = array(
+      'data' => array(t('Response message:'), $event->message),
+      'style' => 'vertical-align:top;',
+    );
+    $rows[] = array(
+      'data' => array(t('Teaser (as of response):'), $event->teaser),
+      'style' => 'vertical-align:top;',
+    );
   }
   else {
-    $rows[] = array(t('Moderator:'), theme('username', $event));
-    $rows[] = array('data' => array(t('E-mail message:'), $event->message), 'style' => 'vertical-align:top;');
-    $rows[] = array(t('Author:'), theme('username', $event->author));
-    $rows[] = array('data' => array(t('Teaser (as reviewed):'), $event->teaser), 'style' => 'vertical-align:top;');
+    $rows[] = array(t('Moderator:'), theme('username', array('account' => $event)));
+    $rows[] = array(
+      'data' => array(t('E-mail message:'), $event->message),
+      'style' => 'vertical-align:top;',
+    );
+    $rows[] = array(t('Author:'), theme('username', array('account' => $event->author)));
+    $rows[] = array(
+      'data' => array(t('Teaser (as reviewed):'), $event->teaser),
+      'style' => 'vertical-align:top;',
+    );
   }
 
-  return theme('table', NULL, $rows);
-}
+  return theme('table', array('header' => NULL, 'rows' => $rows));
+}
\ No newline at end of file
diff -ruN /home/mathan/Desktop/modr8//modr8.info /home/mathan/Desktop/modr8_new//modr8.info
--- /home/mathan/Desktop/modr8//modr8.info	2010-04-03 03:10:09.000000000 +0530
+++ /home/mathan/Desktop/modr8_new//modr8.info	2011-11-01 14:45:32.000000000 +0530
@@ -1,10 +1,8 @@
-; $Id: modr8.info,v 1.2 2008/03/03 02:59:20 pwolanin Exp $
+; $Id$
 name = Modr8
 description = Easy, dedicated moderation of content
-core = 6.x
-; Information added by drupal.org packaging script on 2010-04-02
-version = "6.x-1.3"
-core = "6.x"
-project = "modr8"
-datestamp = "1270244409"
-
+core = 7.x
+configure = admin/config/system/modr8
+files[] = modr8_admin.inc
+files[] = modr8.install
+files[] = modr8.module
\ No newline at end of file
diff -ruN /home/mathan/Desktop/modr8//modr8.install /home/mathan/Desktop/modr8_new//modr8.install
--- /home/mathan/Desktop/modr8//modr8.install	2010-04-02 08:29:08.000000000 +0530
+++ /home/mathan/Desktop/modr8_new//modr8.install	2011-11-01 14:45:32.000000000 +0530
@@ -2,20 +2,82 @@
 // $Id: modr8.install,v 1.5 2010/04/02 02:59:08 pwolanin Exp $
 
 /**
- * Implementation of hook_schema().
+ * @file
+ * Install, update and uninstall functions for the modr8 module.
+ * TODO: write upgrade from Drupal 6.
+ *
+ */
+
+/**
+ * Implements hook_schema().
  */
 function modr8_schema() {
+  $schema['modr8_moderate'] = array(
+    'fields' => array(
+      'nid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'moderate' => array(
+        'description' => 'Boolean indicating if a node is "in moderation".',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0),
+    ),
+    'primary key' => array('nid'),
+  );
   $schema['modr8_log'] = array(
     'fields' => array(
-      'modid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
-      'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
-      'uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
-      'author_uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
-      'action' => array('type' => 'varchar', 'length' => 16, 'not null' => TRUE, 'default' => ''),
-      'title' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
-      'message' => array('type' => 'text', 'size' => 'big',  'not null' => TRUE),
-      'teaser' => array('type' => 'text', 'size' => 'big',  'not null' => TRUE),
-      'timestamp' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
+      'modid' => array(
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ),
+      'nid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'uid' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'author_uid' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'action' => array(
+        'type' => 'varchar',
+        'length' => 16,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'title' => array(
+        'type' => 'varchar',
+        'length' => 128,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'message' => array(
+        'type' => 'text',
+        'size' => 'big',
+        'not null' => TRUE,
+      ),
+      'teaser' => array(
+        'type' => 'text',
+        'size' => 'big',
+        'not null' => TRUE,
+      ),
+      'timestamp' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
     ),
     'indexes' => array(
       'nid_time' => array('nid', 'modid'),
@@ -28,22 +90,6 @@
 }
 
 /**
- * Implementation of hook_install().
- */
-function modr8_install() {
-  // Create tables.
-  drupal_install_schema('modr8');
-}
-
-/**
- * Implementation of hook_uninstall().
- */
-function modr8_uninstall() {
-  // Remove tables.
-  drupal_uninstall_schema('modr8');
-}
-
-/**
  * Update table definitions.
  */
 function modr8_update_1000() {
@@ -51,24 +97,66 @@
   $name = 'modr8_log';
   $table = array(
     'fields' => array(
-      'modid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
-      'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
-      'uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
-      'author_uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
-      'action' => array('type' => 'varchar', 'length' => 16, 'not null' => TRUE, 'default' => ''),
-      'title' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
-      'message' => array('type' => 'text', 'size' => 'big',  'not null' => TRUE),
-      'teaser' => array('type' => 'text', 'size' => 'big',  'not null' => TRUE),
-      'timestamp' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
+      'modid' => array(
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ),
+      'nid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'uid' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'author_uid' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'action' => array(
+        'type' => 'varchar',
+        'length' => 16,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'title' => array(
+        'type' => 'varchar',
+        'length' => 128,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'message' => array(
+        'type' => 'text',
+        'size' => 'big',
+        'not null' => TRUE,
+      ),
+      'teaser' => array(
+        'type' => 'text',
+        'size' => 'big',
+        'not null' => TRUE,
+      ),
+      'timestamp' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
     ),
     'indexes' => array(
       'nid_time' => array('nid', 'modid'),
-      'action' => array('action')
+      'action' => array('action'),
     ),
     'primary key' => array('modid'),
   );
-  db_create_table($ret, $name, $table);
-  return $ret;
+  db_create_table($name, $table);
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
 
 /**
@@ -76,7 +164,10 @@
  */
 function modr8_update_6001() {
   $ret = array();
-  db_drop_index($ret, 'modr8_log', 'action');
-  db_add_index($ret, 'modr8_log', 'time_action', array('timestamp', 'action'));
-  return $ret;
+  db_drop_index('modr8_log', 'action');
+  db_add_index('modr8_log', 'time_action', array('timestamp', 'action'));
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
diff -ruN /home/mathan/Desktop/modr8//modr8.module /home/mathan/Desktop/modr8_new//modr8.module
--- /home/mathan/Desktop/modr8//modr8.module	2010-04-03 03:03:09.000000000 +0530
+++ /home/mathan/Desktop/modr8_new//modr8.module	2011-12-24 19:32:07.671567817 +0530
@@ -13,12 +13,12 @@
 define('NODE_BUILD_MODR8_TEASER', 1242526499);
 
 /**
- * Implementation of hook_help().
+ * Implements hook_help().
  */
 function modr8_help($path, $arg) {
   switch ($path) {
     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>';
+      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.
   }
 }
@@ -26,12 +26,12 @@
 /**
  * An access function for Moderation Menu Tab
  */
-function modr8_moderation_access($nid) {
-  return user_access('moderate content') && db_result(db_query("SELECT COUNT(*) FROM {modr8_log} ml WHERE ml.nid = %d", $nid));
+function modr8_moderation_access($node) {
+  return user_access('moderate content') && db_query("SELECT COUNT(*) FROM {modr8_log} ml WHERE ml.nid = :nid", array(':nid' => $node->nid))->fetchField();
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function modr8_menu() {
   $items = array();
@@ -43,6 +43,7 @@
     'access arguments' => array('moderate content'),
     'page callback' => 'modr8_page',
     'file' => 'modr8_admin.inc',
+    'type' => MENU_LOCAL_TASK,
   );
   $items['admin/reports/modr8'] = array(
     'title' => 'Content moderation log',
@@ -52,7 +53,7 @@
     'page callback' => 'modr8_log_view',
     'file' => 'modr8_admin.inc',
   );
-  $items['admin/settings/modr8'] = array(
+  $items['admin/config/system/modr8'] = array(
     'title' => 'Modr8 settings',
     'description' => 'Configure content moderation.',
     'page callback' => 'modr8_settings',
@@ -60,7 +61,7 @@
     'access arguments' => array('administer site configuration'),
     'file' => 'modr8_admin.inc',
   );
-  $items['node/%/modr8'] = array(
+  $items['node/%node/modr8'] = array(
     'title' => 'Moderation',
     'page callback' => 'modr8_log_view',
     'page arguments' => array('node', 1),
@@ -68,7 +69,7 @@
     'access arguments' => array(1),
     'file' => 'modr8_admin.inc',
     'weight' => 10,
-    'type' => MENU_LOCAL_TASK
+    'type' => MENU_LOCAL_TASK,
   );
   $items['node/%node/log/response/%'] = array(
     'title' => 'Moderation response',
@@ -97,20 +98,29 @@
  * Calculates a HMAC-MD5 according to RFC2104 (http://www.ietf.org/rfc/rfc2104.txt).
  */
 function modr8_response_token($nid, $uid) {
-  $key = md5(drupal_get_private_key() .'modr8token');
+  $key = md5(drupal_get_private_key() . 'modr8token');
 
   return bin2hex(
     pack("H*", md5((str_pad($key, 64, chr(0x00)) ^ (str_repeat(chr(0x5c), 64))) .
     pack("H*", md5((str_pad($key, 64, chr(0x00)) ^ (str_repeat(chr(0x36), 64))) .
-    $nid .':'. $key .':'. $uid))))
+    $nid . ':' . $key . ':' . $uid))))
   );
 }
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_permission().
  */
-function modr8_perm() {
-  return array('moderate content', 'bypass moderation queue');
+function modr8_permission() {
+  return array(
+    'moderate content' => array(
+      'title' => t('moderate content'),
+      'description' => t('TODO Add a description for \'moderate content\''),
+    ),
+    'bypass moderation queue' => array(
+      'title' => t('bypass moderation queue'),
+      'description' => t('TODO Add a description for \'bypass moderation queue\''),
+    ),
+  );
 }
 
 /**
@@ -122,64 +132,103 @@
 }
 
 /**
- * Implementation of hook_nodeapi().
+ * Implements hook_node_load().
  */
-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) && !user_access('bypass moderation queue');
+function modr8_node_load($nodes) {
+ $result = db_query('SELECT nid, moderate FROM {modr8_moderate} WHERE nid IN (:nids)', array(':nids' => array_keys($nodes)));
+  foreach ($result as $record) {
+    $nodes[$record->nid]->moderate = $record->moderate;
+  }
+  foreach ($nodes as &$node) {
+    if (! isset($node->moderate))
+      $node->moderate = FALSE;
+  }
       }
-      break;
 
-    case 'submit':
-      if ($node->moderate && user_access('bypass moderation queue')) {
-        if (!user_access('administer nodes')) { // Don't reset for admins
-          $node->moderate = 0;
+/**
+ * Implements hook_node_prepare().
+ */
+function modr8_node_prepare($node) {
+  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) && !user_access('bypass moderation queue');
         }
       }
-      break;
 
-    case 'view':
-      if ($node->moderate && empty($node->modr8_form_teaser) && ($node->build_mode == NODE_BUILD_NORMAL) && ($teaser || $page)) {
+/**
+ * Implements hook_node_view().
+ */
+function modr8_node_view($node, $view_mode = 'full', $langcode) {
+  if ($node->moderate && ($view_mode = 'full' || $view_mode == 'teaser')) {
         $node->content['modr8_message'] = array(
-          '#value' => theme('modr8_message', $teaser, $node->type, 'view'),
+      '#type' => 'markup',
+      '#markup' => theme('modr8_message', array('0' => $view_mode == 'teaser', '1' => $node->type, '2' => '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':
+
+/**
+ * Implements hook_node_update().
+ */
+function modr8_node_update($node) {
+  db_delete('modr8_moderate')->condition('nid', $node->nid)->execute();
+  if ($node->moderate) {
+    db_insert('modr8_moderate')
+      ->fields(array(
+          'nid' => $node->nid,
+          'moderate' => $node->moderate,
+        ))
+      ->execute();
+    //cut this?
+    theme('modr8_message', array('0' => FALSE, '1' => $node->type, '2' => 'update'));
+  }
+}
+
+/**
+ * Implements hook_node_insert().
+ */
+function modr8_node_insert($node) {
+  // We only put a node in moderation if explicitly set.
+  if ($node->moderate) {
+    db_insert('modr8_moderate')
+      ->fields(array(
+          'nid' => $node->nid,
+          'moderate' => $node->moderate,
+        ))
+      ->execute();
+    //cut this?
+    theme('modr8_message', array('0' => FALSE, '1' => $node->type, '2' => 'insert'));
+  }
+}
+
+/**
+ * Implements hook_node_delete().
+ */
+function modr8_node_delete($node) {
       // 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;
-  }
+  db_delete('modr8_log')
+    ->condition('nid', $node->nid)
+    ->execute();
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function modr8_form_alter(&$form, $form_state, $form_id) {
 
-  if (isset($form['type']['#value']) && $form['type']['#value'] .'_node_form' == $form_id)  {
+  if (isset($form['type']['#value']) && $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'))),
+      '#description' => t('This %type will be placed in moderation if the %moderate checkbox is selected.', array('%type' => node_type_get_name($form['#node']), '%moderate' => t('In moderation queue'))),
     );
     if (user_access('administer nodes')) {
       $form['options']['moderate'] = $moderate_checkbox;
@@ -194,7 +243,8 @@
       );
       if ($form['#node']->moderate) {
         $form['modr8_message'] = array(
-          '#value' => theme('modr8_message', FALSE, $form['#node']->type, 'node_form'),
+          '#type' => 'markup',
+          '#markup' => theme('modr8_message', array('0' => FALSE, '1' => $form['#node']->type, '2' => 'node_form')),
           '#weight' => -100,
         );
       }
@@ -206,7 +256,7 @@
 }
 
 /**
- * Implementation of hook_db_rewrite_sql().
+ * Implements hook_db_rewrite_sql().
  */
 function modr8_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
   $node_table = $primary_table;
@@ -225,7 +275,7 @@
           $return['where'] = "($node_table.moderate != 1)";
         }
         else {
-          $return['where'] = "($node_table.moderate != 1 OR $node_table.uid = ". (int)$user->uid .")";
+          $return['where'] = "($node_table.moderate != 1 OR $node_table.uid = " . (int)$user->uid . ")";
         }
         return $return;
       }
@@ -235,84 +285,134 @@
 }
 
 /**
- * Implementation of hook_cron().
+ * Implements 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);
+    db_delete('modr8_log')
+      ->condition('timestamp', REQUEST_TIME - $log_clear, '<')
+      ->execute();
   }
 }
 
 /**
- * Implementation of hook_block().
+ * Implements hook_block_info().
  */
-function modr8_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
-    $blocks[0]['info'] = t("Modr8 moderator's block");
+function modr8_block_info() {
+  // TODO Rename block deltas (e.g. delta-0) to readable strings.
+  if (TRUE) {
+    $blocks['delta-0']['info'] = t("Modr8 moderator's block");
     $blocks['modr8-moderators']['info'] = t("Modr8 moderators credit list");
-    $blocks['modr8-moderators']['cache'] = BLOCK_CACHE_GLOBAL;
+    $blocks['modr8-moderators']['cache'] = DRUPAL_CACHE_GLOBAL;
     return $blocks;
   }
-  elseif ($op == 'view') {
+}
+
+/**
+ * Implements hook_block_view().
+ */
+function modr8_block_view($delta) {
+  global  $_domain;
+  if (TRUE) {
     if ($delta == 'modr8-moderators') {
       $block = array();
       $cutoff = strtotime('now -6 months');
-      $result = db_query_range("SELECT COUNT(ml.modid) AS number, u.* FROM {modr8_log} ml INNER JOIN {users} u on u.uid = ml.uid WHERE ml.action != 'Response' AND ml.timestamp > %d AND u.status = 1 GROUP BY u.uid ORDER BY number DESC", $cutoff, 0, variable_get('modr8_top_moderators_limit', 10));
+      $qry  =  db_select('modr8_log', 'm')
+        ->condition('m.action',  'Response',  '<>')
+        ->condition('m.timestamp',  $cutoff,  '>');
+      $qry->join('users', 'u', 'u.uid = m.uid');
+      $qry->fields('u');
+      $qry->condition('u.status',  1)
+        ->addExpression('COUNT(m.modid)', 'number');
+      $accounts  =  $qry->execute()->fetchAll();
       $header = array(t('User'), t('Number of actions'));
       $rows = array();
-      while ($account = db_fetch_object($result)) {
-        $rows[] = array(theme('username', $account), $account->number);
+      foreach ($accounts as  $key  =>  $account) {
+        $rows[] = array(theme('username', array('account' => $account)), $account->number);
       }
       if ($rows) {
-        $block['content'] = t('Last 6 months:') . '<br />' . theme('table', $header, $rows);
+        $block['content'] = t('Last 6 months:') . '<br />' . theme('table', array('header' => $header, 'rows' => $rows));
         $block['subject'] = t('Top moderators');
       }
       return $block;
     }
     elseif (user_access('moderate content')) {
       $block['subject'] = t('Moderation queue');
-      $is_published = '';
+      $is_published = array(0,  1);
       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 ';
+        $is_published = 1;
+      }
+      $qry  =  db_select('modr8_moderate', 'm')
+        ->condition('m.moderate',  1)
+        ->addTag('node_access');
+      $qry->join('node', 'n', 'n.nid = m.nid');
+      $qry->condition('n.status',  $is_published);
+      //To fetch the contents from the current domain
+      if  (variable_get('modr8_nodes_by_domain', 0)  &&  module_exists('domain'))  {
+        $qry->join('domain_source', 'd', 'n.nid = d.nid');
+        $qry->condition('d.domain_id',  $_domain['domain_id']);
       }
-      $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>';
+      $count  =  $qry->countQuery()->execute()->fetchField();
+      $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:'));
+        $qry = db_select('modr8_moderate', 'm')
+          ->extend('PagerDefault')
+          ->limit(6)
+          ->fields('n', array('nid', 'title'))
+          ->condition('m.moderate', 1);
+        $qry->join('node', 'n', 'n.nid = m.nid');
+        $qry->condition('n.status',  $is_published);
+        //To fetch the contents from the current domain
+        if  (variable_get('modr8_nodes_by_domain', 0)  &&  module_exists('domain'))  {
+          $qry->join('domain_source', 'd', 'n.nid = d.nid');
+          $qry->condition('d.domain_id',  $_domain['domain_id']);
+        }
+        $result = $qry->execute()->fetchAll();
+        if  (!empty($result))  {
+          $modr8_nodes = node_title_list($result, t('Recent additions:'));
+          $content  .=  theme('item_list', $modr8_nodes);
+        }
       }
       $block['content'] = $content;
       return $block;
     }
   }
 }
+
 /**
- * Implementation of hook_theme().
+ * Implements hook_block().
  */
-function modr8_theme() {
-  return array(
-    'modr8_message' => array('arguments' => array('teaser', 'nodetype', 'op')),
-    'modr8_form' => array('arguments' => array('form')),
-    'moderation_event' => array('arguments' => array('event')),
-    'modr8_note' => array('arguments' => array('note')),
+function modr8_block_OLD($op = 'list', $delta = 0) { }
+
 
+/**
+ * Implements hook_theme().
+ */
+function modr8_theme($existing, $type, $theme, $path) {
+  return array(
+    'modr8_message' => array('variables' => array('teaser', 'nodetype', 'op')),
+    'modr8_form' => array('render element' => 'form'),
+    'moderation_event' => array('variables' => array('event')),
+    'modr8_note' => array('variables' => array('note')),
   );
 }
 /**
  * Theming function for messages.
  */
-function theme_modr8_message($teaser = FALSE, $nodetype = 'page', $op = 'view') {
+function theme_modr8_message($variables) {
+  $teaser = $variables['0'];
+  $nodetype = $variables['1'];
+  $op = $variables['2'];
   static $already_messaged = FALSE;
   // Don't add the message more than once per page load.
   if ($already_messaged) {
     return;
   }
   if ($teaser) {
-    return ' <div class="marker">'. t('Pending moderation') .'</div>';
+    return ' <div class="marker">' . t('Pending moderation') . '</div>';
   }
   else {
     switch ($op) {
@@ -321,7 +421,7 @@
         break;
       case 'node_form':
         if (!user_access('bypass moderation queue')) {
-          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))));
+          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_type_get_name($nodetype))));
         }
         break;
     }
diff -ruN /home/mathan/Desktop/modr8//README.txt /home/mathan/Desktop/modr8_new//README.txt
--- /home/mathan/Desktop/modr8//README.txt	2008-09-05 06:43:10.000000000 +0530
+++ /home/mathan/Desktop/modr8_new//README.txt	2011-11-01 14:45:32.000000000 +0530
@@ -1,6 +1,6 @@
 $Id: README.txt,v 1.8 2008/09/05 01:13:10 pwolanin Exp $
 
-Modr8 module for Drupal 6.x.
+Modr8 module for Drupal 7.x.
 
 The moderation of content was removed from core in 5.x.  This module adds back
 that capability and also prevents posts that are in moderation from showing
@@ -22,14 +22,14 @@
 preview content in moderation, as well as approve or delete each moderated post,
 and (optionally) to send an e-mail to the author informing him/her of the choice.
 *Important note:* as of version 5.x-2.3 unpublished nodes in the WILL be shown
-in the moderation queue listing for users with the "adminiser nodes" permission.
-For these users, approving a post in the queue will also publish it. However,
-posts to be moderated should generally be set to be published so that users
-without the "administer nodes" permission can also effectively work as
-moderators.
+in the moderation queue listing for users with the "administer nodes"
+permission. For these users, approving a post in the queue will also publish it.
+However, posts to be moderated should generally be set to be published
+so that users without the "administer nodes" permission can also
+effectively work as moderators.
 
 Visit the settings page to customize the e-mail messages and set other defaults
-(path: admin/settings/modr8).
+(path: admin/config/system/modr8).
 
 As of version 5.x-2.0, modr8 also includes a moderation log to record the
 actions of moderators on items in the moderation queue.  This may be especially
@@ -47,3 +47,4 @@
 (jjeff@drupal).  Upgrade to 5.x and 5.x, 6.x maintenance by 
 Peter Wolanin (pwolanin@drupal).
 Initial upgrade to 6.x by Croitor Alexander (Placinta@drupal)
+Initial upgrade to 7.x by Berend de Boer (berend@pobox.com).
\ No newline at end of file
