diff -u hidden5/hidden.info hidden/hidden.info
--- hidden5/hidden.info	Mon Jan  7 00:05:20 2008
+++ hidden/hidden.info	Mon Jun 30 12:54:27 2008
@@ -1,10 +1,13 @@
 ; $Id: hidden.info,v 1.3 2007/08/30 09:23:25 ekes Exp $
 name = Hidden
 description = "Hide nodes or comments"
-dependencies = comment
+package = Indymedia
+dependencies[] = comment
+core = 6.x
 
 ; Information added by drupal.org packaging script on 2008-01-07
-version = "5.x-2.x-dev"
+version = "6.x-1.x-dev"
 project = "hidden"
+core = "6.x"
 datestamp = "1199664320"
 
diff -u hidden5/hidden.install hidden/hidden.install
--- hidden5/hidden.install	Sun Jan  6 16:03:54 2008
+++ hidden/hidden.install	Mon Jun 30 12:54:27 2008
@@ -1,288 +1,433 @@
 <?php
 /* $Id: hidden.install,v 1.2.2.2 2008/01/06 16:03:54 ekes Exp $ */
 
+
 function hidden_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query("CREATE TABLE {hidden_node} (
-        `hid` int(10) unsigned NOT NULL auto_increment,
-        `nid` int(10) unsigned NOT NULL default '0',
-        `created` int(10) unsigned NOT NULL default '0',
-        `rid` int(4) unsigned NOT NULL default '0',
-        `publicnote` text NOT NULL,
-        `privatenote` text NOT NULL,
-        `uid` int(10) unsigned NOT NULL default '0',
-        `delay` int(10) unsigned NOT NULL default '0',
-        PRIMARY KEY  (`hid`, `nid`)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
-      );
-      db_query("CREATE TABLE {hidden_comment} (
-        `hid` int(10) unsigned NOT NULL auto_increment,
-        `nid` int(10) unsigned NOT NULL default '0',
-        `cid` int(10) unsigned NOT NULL default '0',
-        `created` int(10) unsigned NOT NULL default '0',
-        `rid` int(4) unsigned NOT NULL default '0',
-        `publicnote` text NOT NULL,
-        `privatenote` text NOT NULL,
-        `uid` int(10) unsigned NOT NULL default '0',
-        `delay` int(10) unsigned NOT NULL default '0',
-        PRIMARY KEY  (`hid`, `nid`, `cid`)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
-      );
-      db_query("CREATE TABLE {hidden_reported_node} (
-        `repid` int(10) unsigned NOT NULL auto_increment,
-        `nid` int(10) unsigned NOT NULL default '0',
-        `created` int(10) unsigned NOT NULL default '0',
-        `rid` int(4) unsigned NOT NULL default '0',
-        `publicnote` text NOT NULL,
-        `privatenote` text NOT NULL,
-        `uid` int(10) unsigned NOT NULL default '0',
-        `seen` tinyint(2) unsigned,
-        `suid` int(10) unsigned,
-        PRIMARY KEY  (`repid`, `nid`)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
-      );
-      db_query("CREATE TABLE {hidden_reported_comment} (
-        `repid` int(10) unsigned NOT NULL auto_increment,
-        `nid` int(10) unsigned NOT NULL default '0',
-        `cid` int(10) unsigned NOT NULL default '0',
-        `created` int(10) unsigned NOT NULL default '0',
-        `rid` int(4) unsigned NOT NULL default '0',
-        `publicnote` text NOT NULL,
-        `privatenote` text NOT NULL,
-        `uid` int(10) unsigned NOT NULL default '0',
-        `seen` tinyint(2) unsigned,
-        `suid` int(10) unsigned,
-        PRIMARY KEY  (`repid`, `nid`, `cid`)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
-      );
-      db_query("CREATE TABLE {hidden_reasons} (
-        `rid` int(4) unsigned NOT NULL auto_increment,
-        `title` varchar(255) NOT NULL default '',
-        `description` text,
-        `enabled` tinyint(2) NOT NULL default '1',
-        PRIMARY KEY  (`rid`)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
-      );
-      db_query("CREATE TABLE {hidden_log} (
-        `hidetime` int(10) unsigned NOT NULL default '0',
-        `action` int(4) unsigned NOT NULL default '0',
-        `description` text NOT NULL,
-        `ids` text NOT NULL,
-        `uid` int(10) unsigned NOT NULL default '0',
-        PRIMARY KEY  (`hidetime`)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
-      );
-      db_query("CREATE TABLE {hidden_filters} (
-        `hfid` int(10) unsigned NOT NULL auto_increment,
-        `filter` varchar(255) NOT NULL,
-        `type` tinyint(2) unsigned NOT NULL default '1',
-        `hits` int(10) unsigned NOT NULL default '0',
-        `lasthit` int(10) unsigned NOT NULL default '0',
-        `enabled` tinyint(2) NOT NULL default '1',
-        `weight` int(10) NOT NULL default '0',
-        PRIMARY KEY (`hfid`)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
-      );
-      db_query("CREATE TABLE {hidden_filter_reasons} (
-        `hfid` int(10) unsigned NOT NULL,
-        `title` varchar(255) NOT NULL,
-        `rid` int(4) unsigned NOT NULL default '0',
-        `publicnote` text NOT NULL,
-        `privatenote` text NOT NULL,
-        `uid` int(10) unsigned NOT NULL default '0',
-        `delay` int(10) unsigned NOT NULL default '0',
-        PRIMARY KEY (`hfid`),
-        FOREIGN KEY (`hfid`) REFERENCES {hidden_filters}(`hfid`)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
-      );
-      db_next_id('{hidden_reasons}_rid');
-      db_query("INSERT INTO {hidden_reasons} (rid, title, description, enabled) VALUES (1,'Policy Violation','The post violates the <a href=\"/guidelines\">Editorial Guidelines</a>.',1)");
+  drupal_install_schema('hidden_node');
+  drupal_install_schema('hidden_comment');
+  drupal_install_schema('hidden_reported_node');
+  drupal_install_schema('hidden_reported_comment');
+  drupal_install_schema('hidden_log');
+  drupal_install_schema('hidden_reasons');
+  drupal_install_schema('hidden_filters');
+  drupal_install_schema('hidden_filter_reasons');
+  db_query("INSERT INTO {hidden_reasons} (title, description, enabled) VALUES ('Policy Violation','The post violates the <a href=\"/guidelines\">Editorial Guidelines</a>.',1)");
   }
+
+
+function hidden_node_schema() {
+  $schema['hidden_node'] = array(
+    'fields' => array(
+      'hid' => array(
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE
+      ),
+      'nid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'created' => array(
+      'type' => 'int',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => '0'
+      ),
+      'rid' => array(
+        'type' => 'int', 
+        'unsigned' => TRUE,
+        'not null' => TRUE, 
+        'default' => 0, 
+        'size' => 'tiny'),
+      'publicnote' => array(
+        'type' => 'text', 
+        'not null' => TRUE
+      ),
+      'privatenote' => array(
+        'type' => 'text', 
+        'not null' => TRUE
+      ),
+      'uid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'delay' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      )
+    ),
+    'primary key' => array('hid', 'nid')
+  );
+  
+  return $schema;
+}
+
+
+function hidden_comment_schema() {
+  $schema['hidden_comment'] = array(
+    'fields' => array(
+      'hid' => array(
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE
+      ),
+      'nid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'cid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'created' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'rid' => array(
+        'type' => 'int', 
+        'unsigned' => TRUE,
+        'not null' => TRUE, 
+        'default' => 0, 
+        'size' => 'tiny'
+      ),
+      'publicnote' => array(
+        'type' => 'text', 
+        'not null' => TRUE
+      ),
+      'privatenote' => array(
+        'type' => 'text', 
+        'not null' => TRUE
+      ),
+      'uid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'delay' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      )
+    ),
+    'primary key' => array('hid', 'nid', 'cid')
+  );
+  
+  return $schema;
+}
+
+
+function hidden_reported_node_schema() {
+  $schema['hidden_reported_node'] = array(
+    'fields' => array(
+      'repid' => array(
+      'type' => 'serial',
+      'unsigned' => TRUE,
+      'not null' => TRUE
+      ),
+      'nid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'created' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'rid' => array(
+        'type' => 'int', 
+        'unsigned' => TRUE,
+        'not null' => TRUE, 
+        'default' => 0, 
+        'size' => 'tiny'
+      ),
+      'publicnote' => array(
+        'type' => 'text', 
+        'not null' => TRUE
+      ),
+      'privatenote' => array(
+        'type' => 'text', 
+        'not null' => TRUE
+      ),
+      'uid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'seen' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'size' => 'tiny'
+      ),
+      'suid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE
+      )
+    ),
+    'primary key' => array('repid', 'nid')
+  );
+  
+  return $schema;
+}
+
+
+function hidden_reported_comment_schema() {
+  $schema['hidden_reported_comment'] = array(
+    'fields' => array(
+      'repid' => array(
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE
+      ),
+      'nid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'cid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'created' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'rid' => array(
+        'type' => 'int', 
+        'unsigned' => TRUE,
+        'not null' => TRUE, 
+        'default' => 0, 
+        'size' => 'tiny'
+      ),
+      'publicnote' => array(
+        'type' => 'text', 
+        'not null' => TRUE
+      ),
+      'privatenote' => array(
+        'type' => 'text', 
+        'not null' => TRUE
+      ),
+      'uid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'seen' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'size' => 'tiny'),
+      'suid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE
+      )
+    ),
+    'primary key' => array('repid', 'nid', 'cid')
+  );
+  
+  return $schema;
 }
 
+
+function hidden_reasons_schema() {
+  $schema['hidden_reasons'] = array(
+    'fields' => array(
+      'rid' => array(
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE
+      ),
+      'title' => array(
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+        'default' => ''
+      ),
+      'description' => array(
+        'type' => 'text'
+      ),
+      'enabled' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => '1'
+      )
+    ),
+    'primary key' => array('rid')
+  );
+  
+  return $schema;
+}
+
+
+function hidden_log_schema() {
+  $schema['hidden_log'] = array(
+    'fields' => array(
+      'hidetime' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'action' => array(
+        'type' => 'int', 
+        'unsigned' => TRUE,
+        'not null' => TRUE, 
+        'default' => 0, 
+        'size' => 'tiny'
+      ),
+      'description' => array(
+        'type' => 'text', 
+        'not null' => TRUE
+      ),
+      'ids' => array(
+        'type' => 'text', 
+        'not null' => TRUE
+      ),
+      'uid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      )
+    ),
+    'primary key' => array('hidetime')
+  );
+
+  return $schema;
+}
+
+
+function hidden_filters_schema() {
+  $schema['hidden_filters'] = array(
+    'fields' => array(
+      'hfid' => array(
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE
+      ),
+      'filter' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE
+      ),
+      'type' => array(
+        'type' => 'int',
+        'size' => 'tiny',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '1'
+      ),
+      'hits' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'lasthit' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'enabled' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => '1'
+      ),
+      'weight' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => '0'
+      )
+    ),
+    'primary key' => array('hfid')
+  );
+
+  return $schema;
+}
+
+
+function hidden_filter_reasons_schema() {
+  $schema['hidden_filter_reasons'] = array(
+    'fields' => array(
+      'hfid' => array(
+        'type' => 'int',
+	  		'unsigned' => TRUE,
+		  	'not null' => TRUE
+      ),
+      'title' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE
+      ),
+      'rid' => array(
+        'type' => 'int', 
+        'unsigned' => TRUE,
+        'not null' => TRUE, 
+        'default' => 0, 
+        'size' => 'tiny'
+      ),
+      'publicnote' => array(
+        'type' => 'text', 
+        'not null' => TRUE
+      ),
+      'privatenote' => array(
+        'type' => 'text', 
+        'not null' => TRUE
+      ),
+      'uid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      ),
+      'delay' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => '0'
+      )
+    ),
+    'primary key' => array('hfid')
+    );
+
+  return $schema;
+}
+
+
 function hidden_uninstall() {
 /* do table data, particularly hidden data want to be lost on uninstall? 
  * if so should the nodes be published!? */
-} // end hidden_uninstall
+  // Remove tables.
+  /*
+  drupal_uninstall_schema('hidden_node');
+  drupal_uninstall_schema('hidden_comment');
+  drupal_uninstall_schema('hidden_reported_node');
+  drupal_uninstall_schema('hidden_reported_comment');
+  drupal_uninstall_schema('hidden_log');
+  drupal_uninstall_schema('hidden_filter_reasons');
+  */
+ } // end hidden_uninstall
 
-// update for 5.x-2.x -> 5.x-3.x
-function hidden_update_5300() {
-  switch($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      // I doubt any hidden databases are too big, but just in case! Breaking this up
-      if (!isset($_SESSION['hidden_update_2_hid'])) {
-        // First call, make variables to keep track of our progress
-        $_SESSION['hidden_update_2_hid'] = 0;
-        $_SESSION['hidden_update_2_hid_max'] = db_result(db_query('SELECT MAX(hid) FROM {hidden}'));
-        $_SESSION['hidden_update_2_repid'] = 0;
-        $_SESSION['hidden_update_2_repid_max'] = db_result(db_query('SELECT MAX(repid) FROM {hidden_reported}'));
-        $_SESSION['hidden_update_2_total'] = $_SESSION['hidden_update_2_hid_max'] + $_SESSION['hidden_update_2_repid_max'] + 2;
-        // then make the new tables
-        $items = array();
-        $items[] = update_sql("CREATE TABLE {hidden_node} (
-          `hid` int(10) unsigned NOT NULL auto_increment,
-          `nid` int(10) unsigned NOT NULL default '0',
-          `created` int(10) unsigned NOT NULL default '0',
-          `rid` int(4) unsigned NOT NULL default '0',
-          `publicnote` text NOT NULL,
-          `privatenote` text NOT NULL,
-          `uid` int(10) unsigned NOT NULL default '0',
-          `delay` int(10) unsigned NOT NULL default '0',
-          PRIMARY KEY  (`hid`, `nid`)
-          ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
-        );
-        $items[] = update_sql("CREATE TABLE {hidden_comment} (
-          `hid` int(10) unsigned NOT NULL auto_increment,
-          `nid` int(10) unsigned NOT NULL default '0',
-          `cid` int(10) unsigned NOT NULL default '0',
-          `created` int(10) unsigned NOT NULL default '0',
-          `rid` int(4) unsigned NOT NULL default '0',
-          `publicnote` text NOT NULL,
-          `privatenote` text NOT NULL,
-          `uid` int(10) unsigned NOT NULL default '0',
-          `delay` int(10) unsigned NOT NULL default '0',
-          PRIMARY KEY  (`hid`, `nid`, `cid`)
-          ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
-        );
-        $items[] = update_sql("CREATE TABLE {hidden_reported_node} (
-          `repid` int(10) unsigned NOT NULL auto_increment,
-          `nid` int(10) unsigned NOT NULL default '0',
-          `created` int(10) unsigned NOT NULL default '0',
-          `rid` int(4) unsigned NOT NULL default '0',
-          `publicnote` text NOT NULL,
-          `privatenote` text NOT NULL,
-          `uid` int(10) unsigned NOT NULL default '0',
-          `seen` tinyint(2) unsigned,
-          `suid` int(10) unsigned,
-          PRIMARY KEY  (`repid`, `nid`)
-          ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
-        );
-        $items[] = update_sql("CREATE TABLE {hidden_reported_comment} (
-          `repid` int(10) unsigned NOT NULL auto_increment,
-          `nid` int(10) unsigned NOT NULL default '0',
-          `cid` int(10) unsigned NOT NULL default '0',
-          `created` int(10) unsigned NOT NULL default '0',
-          `rid` int(4) unsigned NOT NULL default '0',
-          `publicnote` text NOT NULL,
-          `privatenote` text NOT NULL,
-          `uid` int(10) unsigned NOT NULL default '0',
-          `seen` tinyint(2) unsigned,
-          `suid` int(10) unsigned,
-          PRIMARY KEY  (`repid`, `nid`, `cid`)
-          ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
-        );
-
-        $items['#finished'] = 1 / $_SESSION['hidden_update_2_total'];
-        return $items;
-      }
-
-      /***
-       * Migrating the table data
-       */
-
-      /* hidden table */
-      if ($_SESSION['hidden_update_2_hid'] < $_SESSION['hidden_update_2_hid_max']) {
-        // hidden table in blocks of 20
-        $result = db_query_range('SELECT * FROM {hidden} ORDER BY hid ASC', $_SESSION['hidden_update_2_hid'], 20);
-        while ($hidden = db_fetch_object($result)) {
-          if ($hidden->cid == 0) {
-            $_SESSION['hidden_update_2_node_hid'] = db_next_id('{hidden_node}_hid');
-            $query = "INSERT INTO {hidden_node} (hid, nid, created, rid, publicnote, privatenote, uid, delay) VALUES (%d, %d, %d, %d, '%s', '%s', %d, %d)";
-            $insert = db_query($query, $_SESSION['hidden_update_2_node_hid'], $hidden->nid, $hidden->created, $hidden->rid, $hidden->publicnote, $hidden->privatenote, $hidden->uid, $hidden->delay);
-            if (! $insert) {
-              return array('success' => false, 'query' => $query);
-            }
-          }
-          else {
-            $_SESSION['hidden_update_2_comment_hid'] = db_next_id('{hidden_comment}_cid');
-            $query = "INSERT INTO {hidden_comment} (hid, nid, cid, created, rid, publicnote, privatenote, uid, delay) VALUES (%d, %d, %d, %d, %d, '%s', '%s', %d, %d)";
-            $insert = db_query($query, $_SESSION['hidden_update_2_comment_hid'], $hidden->nid, $hidden->cid, $hidden->created, $hidden->rid, $hidden->publicnote, $hidden->privatenote, $hidden->uid, $hidden->delay);
-            if (! $insert) {
-              return array('success' => false, 'query' => $query);
-            }
-          }
-          $_SESSION['hidden_update_2_hid'] = $hidden->hid;
-        }
-
-        // See if we are done with hidden table
-        if ($_SESSION['hidden_update_2_hid'] < $_SESSION['hidden_update_2_hid_max']) {
-          // Not done yet. Return the progress.
-          return array('#finished' => (1 + $_SESSION['hidden_update_2_hid']) / $_SESSION['hidden_update_2_total']);
-        }
-        else {
-          // Done this table. Return progress
-          return array( array('success' => true, 'query' => 'Hidden content moved to new tables'), '#finished' => ( 1 + $_SESSION['hidden_update_2_hid']) / $_SESSION['hidden_update_2_total'] );
-        }
-      }
-
-      /* reported hidden table */
-      if ($_SESSION['hidden_update_2_repid'] < $_SESSION['hidden_update_2_repid_max']) {
-        // reported hidden table in blocks of 20
-        $result = db_query_range('SELECT * FROM {hidden_reported} ORDER BY repid ASC', $_SESSION['hidden_update_2_repid'], 20);
-        while ($reported = db_fetch_object($result)) {
-          if ($reported->cid == 0) {
-            $_SESSION['hidden_update_2_node_repid'] = db_next_id('{hidden_reported_node}_repid');
-            if ($reported->suid != NULL) {
-              // db_query doesn't do nulls :-( as it's internal data could as well have just
-              // made the sql string ourselves...
-              $query = "INSERT INTO {hidden_reported_node} (repid, nid, created, rid, publicnote, privatenote, uid, seen, suid) VALUES (%d, %d, %d, %d, '%s', '%s', %d, %d, %d)";
-              $insert = db_query($query, $_SESSION['hidden_update_2_node_repid'], $reported->nid, $reported->created, $reported->rid, $reported->publicnote, $reported->privatenote, $reported->uid, $reported->seen, $reported->suid);
-            } 
-            else {
-              $query = "INSERT INTO {hidden_reported_node} (repid, nid, created, rid, publicnote, privatenote, uid) VALUES (%d, %d, %d, %d, '%s', '%s', %d)";
-              $insert = db_query($query, $_SESSION['hidden_update_2_node_repid'], $reported->nid, $reported->created, $reported->rid, $reported->publicnote, $reported->privatenote, $reported->uid);
-            }
-            if (! $insert) {
-              return array('success' => false, 'query' => $query);
-            }
-          }
-          else {
-            $_SESSION['hidden_update_2_comment_repid'] = db_next_id('{hidden_reported_comment}_cid');
-            if ($reported->suid != NULL) {
-              $query = "INSERT INTO {hidden_reported_comment} (repid, nid, cid, created, rid, publicnote, privatenote, uid, seen, suid) VALUES (%d, %d, %d, %d, %d, '%s', '%s', %d, %d, %d)";
-              $insert = db_query($query, $_SESSION['hidden_update_2_comment_repid'], $reported->nid, $reported->cid, $reported->created, $reported->rid, $reported->publicnote, $reported->privatenote, $reported->uid, $reported->seen, $reported->suid);
-            }
-            else {
-              $query = "INSERT INTO {hidden_reported_comment} (repid, nid, cid, created, rid, publicnote, privatenote, uid) VALUES (%d, %d, %d, %d, %d, '%s', '%s', %d)";
-              $insert = db_query($query, $_SESSION['hidden_update_2_comment_repid'], $reported->nid, $reported->cid, $reported->created, $reported->rid, $reported->publicnote, $reported->privatenote, $reported->uid);
-            }
-            if (! $insert) {
-              return array('success' => false, 'query' => $query);
-            }
-          }
-          $_SESSION['hidden_update_2_repid'] = $reported->repid;
-        }
-
-        // See if we are done with hidden table
-        if ($_SESSION['hidden_update_2_repid'] < $_SESSION['hidden_update_2_repid_max']) {
-          // Not done yet. Return the progress.
-          return array('#finished' => (1 + $_SESSION['hidden_update_2_hid'] + $_SESSION['hidden_update_2_repid']) / $_SESSION['hidden_update_2_total']);
-        }
-        else {
-          // Done this one too, return progress
-          return array( array('success' => true, 'query' => 'Reported content moved to new tables'), '#finished' =>  (1 + $_SESSION['hidden_update_2_hid'] + $_SESSION['hidden_update_2_repid']) / $_SESSION['hidden_update_2_total'] );
-        }
-      }
-
-      /* both tables done */
-      unset($_SESSION['hidden_update_2_hid']);
-      unset($_SESSION['hidden_update_2_hid_max']);
-      unset($_SESSION['hidden_update_2_node_hid']);
-      unset($_SESSION['hidden_update_2_comment_hid']);
-      unset($_SESSION['hidden_update_2_repid']);
-      unset($_SESSION['hidden_update_2_repid_max']);
-      unset($_SESSION['hidden_update_2_node_repid']);
-      unset($_SESSION['hidden_update_2_comment_repid']);
-      unset($_SESSION['hidden_update_2_total']);
-
-      $items = array();
-      $items[] = update_sql('DROP TABLE {hidden}');
-      $items[] = update_sql('DROP TABLE {hidden_reported}');
-      $items['#finished'] = 1;
-
-      return $items;
-  }
-}
diff -u hidden5/hidden.module hidden/hidden.module
--- hidden5/hidden.module	Sun Jan  6 16:03:54 2008
+++ hidden/hidden.module	Mon Jun 30 12:54:27 2008
@@ -30,15 +30,21 @@
  * Standard hooks
  */
 
-/**
- * Implementation of hook_init().
+ /**
+ * Implementation of hook_boot().
  */
-function hidden_init() {
-  if (module_exists('views')) {
+function hidden_boot() {
+ if (module_exists('views')) {
     include_once drupal_get_path('module', 'hidden') . '/hidden.views.inc';
   }
 }
 
+/**
+ * Implementation of hook_init().
+ */
+function hidden_init() {
+  drupal_add_css(drupal_get_path('module', 'hidden') .'/hidden.css', 'module', 'all', false);
+}
 
 /**
  * Implementation of hook_help()
@@ -93,242 +99,240 @@
 } // end hidden_perm
 
 /**
+ * Implementation of hook_theme().
+ */
+function hidden_theme() {
+  return array(
+    'hidden_admin_settings' => array(
+      'arguments' => array(
+        'form' => NULL
+        ),
+      ),
+    'hidden_link' => array(
+      'arguments' => array(
+        'links' => NULL
+        ),
+      ),
+    'hidden_list_nodes' => array(
+      'arguments' => array(
+        'table' => NULL
+        ),
+      ),
+    'hidden_list_admin_nodes' => array(
+      'arguments' => array(
+        'form' => NULL
+        ),
+      ),
+    'hidden_list_admin_nodes_reported' => array(
+      'arguments' => array(
+        'form' => NULL
+        ),
+      ),
+    'hidden_list_comments' => array(
+      'arguments' => array(
+        'table' => NULL
+        ),
+      ),
+    'hidden_list_admin_comments' => array(
+      'arguments' => array(
+        'form' => NULL
+        ),
+      ),
+    'hidden_list_admin_comments_reported' => array(
+      'arguments' => array(
+        'form' => NULL
+        ),
+      ),
+    'hidden_view_reason' => array(
+      'arguments' => array(
+        'title' => NULL,
+        'public' => '',
+        'description' => '',
+        'private' => '',
+        'content' => '',
+        'view' => TRUE
+        ),
+      ),
+    'hidden_filters_admin_enabled_form' => array(
+      'arguments' => array(
+        'form' => NULL
+        ),
+    )
+  );
+  }
+
+
+/**
  * Implementation of hook_menu().
  */
-function hidden_menu($may_cache) {
+function hidden_menu() {
   $items = array();
-  $view = user_access('access hidden');
-  $report = user_access('report for hiding');
-  $hide = user_access('mark as hidden');
-  $admin = user_access('administer hidden');
-
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/settings/hidden',
-      'title' => t('Hidden settings'),
-      'description' => t('Administer settings for the hidden module.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('hidden_admin_settings'),
-      'access' => $admin,
-    );
-    $items[] = array(
-      'path' => 'admin/content/hidden',
-      'title' => t('Hidden reasons and filters'),
-      'description' => t('Manage reasons for hiding and content filters'),
-      'callback' => 'hidden_reasons_admin',
-      'access' => $admin,
-      'type' => MENU_NORMAL_ITEM,
-    );
-    $items[] = array(
-      'path' => 'admin/content/hidden/reasons',
-      'title' => t('Reasons'),
-      'type' => MENU_DEFAULT_LOCAL_TASK,
-      'weight' => -10,
-    );
-    $items[] = array(
-      'path' => 'admin/content/hidden/reasons/add',
-      'title' => t('Add hidden reason'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('hidden_reasons_admin_form', 'add'),
-      'access' => $admin,
-      'type' => MENU_CALLBACK,
-    );
-    $items[] = array(
-      'path' => 'admin/content/hidden/reasons/edit',
-      'title' => t('Edit hidden reason'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('hidden_reasons_admin_form', 'edit'),
-      'access' => $admin,
-      'type' => MENU_CALLBACK,
-    );
-    $items[] = array(
-      'path' => 'admin/content/hidden/reasons/enable',
-      'title' => t('Enable hidden reason'),
-      'callback' => 'hidden_reasons_admin_able',
-      'callback arguments' => array('enable'),
-      'access' => $admin,
-      'type' => MENU_CALLBACK,
-    );
-    $items[] = array(
-      'path' => 'admin/content/hidden/reasons/disable',
-      'title' => t('Disable hidden reason'),
-      'callback' => 'hidden_reasons_admin_able',
-      'callback arguments' => array('disable'),
-      'access' => $admin,
-      'type' => MENU_CALLBACK,
-    );
-    $items[] = array(
-      'path' => 'admin/content/hidden/filters',
-      'title' => t('Filters'),
-      'description' => t('Manage filters for hidden content'),
-      'callback' => 'hidden_filters_admin',
-      'access' => $admin,
-      'type' => MENU_LOCAL_TASK,
-    );
-    $items[] = array(
-      'path' => 'admin/content/hidden/filters/add',
-      'title' => t('Add filter'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('hidden_filters_admin_form', 'add'),
-      'access' => $admin,
-      'type' => MENU_CALLBACK,
-    );
-    $items[] = array(
-      'path' => 'admin/content/hidden/filters/edit',
-      'title' => t('Edit filter'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('hidden_filters_admin_form', 'edit'),
-      'access' => $admin,
-      'type' => MENU_CALLBACK,
-    );
-    $items[] = array(
-      'path' => 'admin/content/hidden/filters/enable',
-      'title' => t('Enable filter'),
-      'callback' => 'hidden_filters_admin_able',
-      'callback arguments' => array('enable'),
-      'access' => $admin,
-      'type' => MENU_CALLBACK,
-    );
-    $items[] = array(
-      'path' => 'admin/content/hidden/filters/disable',
-      'title' => t('Disable filter'),
-      'callback' => 'hidden_filters_admin_able',
-      'callback arguments' => array('disable'),
-      'access' => $admin,
-      'type' => MENU_CALLBACK,
-    );
-    $items[] = array(
-      'path' => 'admin/content/comment/list/hidden',
-      'title' => t('Hidden'),
-      'description' => t('Hidden comments'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('hidden_list_admin_comments'),
-      'access' => $hide,
-      'type' => MENU_LOCAL_TASK,
-    );
-    $items[] = array(
-      'path' => 'admin/content/comment/list/hiddenreported',
-      'title' => t('Reported'),
-      'description' => t('Reported comments'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('hidden_list_admin_comments_reported'),
-      'access' => $hide,
-      'type' => MENU_LOCAL_TASK,
-    );
-    $items[] = array(
-      'path' => 'admin/content/node/list/hidden',
-      'title' => t('Hidden'),
-      'description' => t('Hidden nodes'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('hidden_list_admin_nodes'),
-      'access' => $hide,
-      'type' => MENU_LOCAL_TASK,
-    );
-    $items[] = array(
-      'path' => 'admin/content/node/list/hiddenreported',
-      'title' => t('Reported'),
-      'description' => t('Reported nodes'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('hidden_list_admin_nodes_reported'),
-      'access' => $hide,
-      'type' => MENU_LOCAL_TASK,
-    );
-    $items[] = array(
-      'path' => 'hidden',
-      'title' => t('Hidden'),
-      'description' => t('Access hidden content'),
-      'callback' => 'hidden_list_nodes',
-      'access' => $view,
-//      'type' => MENU_SUGGESTED_ITEM,
-      'type' => MENU_NORMAL_ITEM,
-    );
-    $items[] = array(
-      'path' => 'hidden/node',
-      'title' => t('Hidden nodes'),
-      'type' => MENU_DEFAULT_LOCAL_TASK,
-    );
-    $items[] = array(
-      'path' => 'hidden/comment',
-      'title' => t('Hidden comments'),
-      'callback' => 'hidden_list_comments',
-      'access' => $view,
-      'type' => MENU_LOCAL_TASK,
-    );
-  } 
-  else {
-    drupal_add_css(drupal_get_path('module', 'hidden') .'/hidden.css', 'module', 'all', false);
-    if (arg(0) == 'hidden' && _hidden_check_param(arg(1), arg(2))) {
-      $type = (string)arg(1);
-      $id = (int)arg(2);
-      $hidden = _hidden_hidden_get($type, $id);
-
-      if ($hidden == false) {
-        // not hidden
-        $items[] = array(
-          'path' => "hidden/$type/$id/hide",
-          'title' => t('Hide content'),
-          'callback' => 'drupal_get_form',
-          'callback arguments' => array('hidden_hide', 'hide', $type, $id),
-          'access' => $hide,
-          'type' => MENU_CALLBACK,
-        );
-        $items[] = array(
-          'path' => "hidden/$type/$id/report",
-          'title' => t('Report post'),
-          'callback' => 'drupal_get_form',
-          'callback arguments' => array('hidden_hide', 'report', $type, $id),
-          'access' => $report,
-          'type' => MENU_CALLBACK,
-        );
-      } 
-      elseif ($hidden->delay != 0) {
-        // not yet hidden, but caught in a filter to be hidden by a cron job
-        $items[] = array(
-          'path' => "hidden/$type/$id/hide",
-          'title' => t('Hide content now'),
-          'callback' => 'drupal_get_form',
-          'callback arguments' => array('hidden_hide', 'hide', $type, $id),
-          'access' => $hide,
-          'type' => MENU_CALLBACK,
-        );
-        $items[] = array(
-          'path' => "hiddens/$type/$id/unhide",
-          'title' => t('Don\'t hide'),
-          'callback' => 'hidden_unhide',
-          'callback arguments' => array($hidden),
-          'access' => $hide,
-          'type' => MENU_CALLBACK,
-        );
-        $items[] = array(
-          'path' => "hidden/$type/$id/report",
-          'title' => t('Report post'),
-          'callback' => 'drupal_get_form',
-          'callback arguments' => array('hidden_hide', 'report', $type, $id),
-          'access' => $report,
-          'type' => MENU_CALLBACK,
-        );
-      }
-      else {
-        // hidden
-        $items[] = array(
-          'path' => "hidden/$type/$id",
-          'title' => t('view'),
-          'callback' => 'hidden_view',
-          'callback arguments' => array($hidden),
-          'access' => $view,
-          'type' => MENU_CALLBACK,
-        );
-        $items[] = array(
-          'path' => "hidden/$type/$id/unhide",
-          'title' => t('Unhide content'),
-          'callback' => 'hidden_unhide',
-          'callback arguments' => array($hidden),
-          'access' => $hide,
-          'type' => MENU_CALLBACK,
-        );
-      }
-    }
-  }
+  $view = array('access hidden');
+  $report = array('report for hiding');
+  $hide = array('mark as hidden');
+  $admin = array('administer hidden');
+
+  $items['admin/settings/hidden'] = array(
+    'title' => 'Hidden settings',
+    'description' => 'Administer settings for the hidden module.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('hidden_admin_settings'),
+    'access arguments' => $admin,
+  );
+  $items['admin/content/hidden'] = array(
+    'title' => 'Hidden reasons and filters',
+    'description' => 'Manage reasons for hiding and content filters',
+    'page callback' => 'hidden_reasons_admin',
+    'access arguments' =>  $admin,
+    'type' => MENU_NORMAL_ITEM,
+  );
+  $items['admin/content/hidden/reasons'] = array(
+    'title' => 'Reasons',
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+    'weight' => -10,
+  );
+  $items['admin/content/hidden/reasons/add'] = array(
+    'title' => 'Add hidden reason',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('hidden_reasons_admin_form', 'add'),
+    'access arguments' => $admin,
+    'type' => MENU_CALLBACK,
+  );
+  $items['admin/content/hidden/reasons/edit'] = array(
+    'title' => 'Edit hidden reason',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('hidden_reasons_admin_form', 'edit'),
+    'access arguments' => $admin,
+    'type' => MENU_CALLBACK,
+  );
+  $items['admin/content/hidden/reasons/enable'] = array(
+    'title' => 'Enable hidden reason',
+    'page callback' => 'hidden_reasons_admin_able',
+    'page arguments' => array('enable'),
+    'access arguments' => $admin,
+    'type' => MENU_CALLBACK,
+  );
+  $items['admin/content/hidden/reasons/disable'] = array(
+    'title' => 'Disable hidden reason',
+    'page callback' => 'hidden_reasons_admin_able',
+    'page arguments' => array('disable'),
+    'access arguments' => $admin,
+    'type' => MENU_CALLBACK,
+  );
+  $items['admin/content/hidden/filters'] = array(
+    'title' => 'Filters',
+    'description' => t('Manage filters for hidden content'),
+    'page callback' => 'hidden_filters_admin',
+    'access arguments' => $admin,
+    'type' => MENU_LOCAL_TASK,
+  );
+  $items['admin/content/hidden/filters/add'] = array(
+    'title' => 'Add filter',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('hidden_filters_admin_form', 'add'),
+    'access arguments' => $admin,
+    'type' => MENU_CALLBACK,
+  );
+  $items['admin/content/hidden/filters/edit'] = array(
+    'title' => 'Edit filter',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('hidden_filters_admin_form', 'edit'),
+    'access arguments' => $admin,
+    'type' => MENU_CALLBACK,
+  );
+  $items['admin/content/hidden/filters/enable'] = array(
+    'title' => 'Enable filter',
+    'page callback' => 'hidden_filters_admin_able',
+    'page arguments' => array('enable'),
+    'access arguments' => $admin,
+    'type' => MENU_CALLBACK,
+  );
+  $items['admin/content/hidden/filters/disable'] = array(
+    'title' => 'Disable filter',
+    'page callback' => 'hidden_filters_admin_able',
+    'page arguments' => array('disable'),
+    'access arguments' => $admin,
+    'type' => MENU_CALLBACK,
+  );
+  $items['admin/content/comment/list/hidden'] = array(
+    'title' => 'Hidden',
+    'description' => 'Hidden comments',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('hidden_list_admin_comments'),
+    'access arguments' => $hide,
+    'type' => MENU_LOCAL_TASK,
+  );
+  $items['admin/content/comment/list/hiddenreported'] = array(
+    'title' => 'Reported',
+    'description' => 'Reported comments',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('hidden_list_admin_comments_reported'),
+    'access arguments' => $hide,
+    'type' => MENU_LOCAL_TASK,
+  );
+  $items['admin/content/node/list/hidden'] = array(
+    'title' => 'Hidden',
+    'description' => 'Hidden nodes',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('hidden_list_admin_nodes'),
+    'access arguments' => $hide,
+    'type' => MENU_LOCAL_TASK,
+  );
+  $items['admin/content/node/list/hiddenreported'] = array(
+    'title' => 'Reported',
+    'description' => 'Reported nodes',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('hidden_list_admin_nodes_reported'),
+    'access arguments' => $hide,
+    'type' => MENU_LOCAL_TASK,
+  );
+  $items['hidden'] = array(
+    'title' => 'Hidden',
+    'description' => 'Access hidden content',
+    'page callback' => 'hidden_list_nodes',
+    'access arguments' => $view,
+  //      'type' => MENU_SUGGESTED_ITEM,
+    'type' => MENU_NORMAL_ITEM,
+  );
+  $items['hidden/node'] = array(
+    'title' => 'Hidden nodes',
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+  );
+  $items['hidden/comment'] = array(
+    'title' => 'Hidden comments',
+    'page callback' => 'hidden_list_comments',
+    'access arguments' => $view,
+    'type' => MENU_LOCAL_TASK,
+  );  
+  $items["hidden/%/%"] = array(
+    'title' => 'view',
+    'page callback' => 'hidden_view',
+    'page arguments' => array(1, 2),
+    'access arguments' =>  $view,
+    'type' => MENU_CALLBACK,
+  );
+
+  $items['hidden/%/%/hide'] = array(
+    'title' => 'Report post',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('hidden_hide', 'hide', 1, 2),
+    'access arguments' => $report,
+    'type' => MENU_CALLBACK
+  );
+  $items['hidden/%/%/report'] = array(
+    'title' => 'Report post',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('hidden_hide', 'report', 1, 2),
+    'access arguments' => $report,
+    'type' => MENU_CALLBACK
+  );
+  $items['hidden/%/%/unhide'] = array(
+    'title' => 'Don\'t hide',
+    'page callback' => 'hidden_unhide',
+    'page arguments' => array(1, 2),
+    'access arguments' => $hide,
+    'type' => MENU_CALLBACK
+  );
 
   return $items;
 }
@@ -336,7 +340,7 @@
 /**
  * Menu callback; Module Configuration.
  */
-function hidden_admin_settings() {
+function hidden_admin_settings(&$form_state) {
   $form['hidden_logging'] = array(
     '#tree' => 'true',
   );
@@ -542,9 +546,9 @@
       _hidden_hidden_hide_unpublish($hidden->nid, ($type == 'node') ? 0 : $hidden->cid);
       $query = "UPDATE {hidden_$hidden} SET delay=0 WHERE hid=%d";
       db_query($query, $hidden->hid);
-      _hidden_log(HIDDEN_LOG_HIDE, t('Hidden %type', array('%type' => $type), $type, 
+      _hidden_log(HIDDEN_LOG_HIDE, t('Hidden %type', array('%type' => $type)), $type, 
                   ($type == 'node') ? $hidden->nid : $hidden->cid, 
-                  $hidden->rid, $hidden->publicnote, $hidden->privatenote, $hidden->uid));
+                  $hidden->rid, $hidden->publicnote, $hidden->privatenote, $hidden->uid);
     }
   }
 }
@@ -608,8 +612,6 @@
   }
 }
 
-// hook_form_alter
-
 /**
  * Implementation of hook_nodeapi().
  *
@@ -673,11 +675,11 @@
   $operations = array(
       'hide' => array(
         'label' => t('Hide'),
-        'callback' => 'hidden_operations_hide',
+        'page callback' => 'hidden_operations_hide',
         ),
      'unhide' => array(
         'label' => t('Unhide'),
-        'callback' => 'hidden_operations_unhide',
+        'page callback' => 'hidden_operations_unhide',
         ),
       );
 
@@ -702,8 +704,9 @@
   else {
     return $links;
   }
-
+  
   $hidden=_hidden_hidden_get($type, $target);
+
   if ($hidden == false) {
     // not hidden
     if (user_access('mark as hidden')) {
@@ -758,7 +761,8 @@
     }
   }
 
-  return theme('hidden_link', $links);
+//  return theme('hidden_link', $links);
+  return $links;
 }
 
 /**
@@ -824,7 +828,7 @@
 /**
  * Menu callback; Admin list form of hidden nodes.
  */ 
-function hidden_list_admin_nodes() {
+function hidden_list_admin_nodes(&$form_state) {
   $form = _hidden_list_admin_options();
   $form['header'] = array( 
       '#type' => 'value', 
@@ -925,9 +929,9 @@
 /**
  * Implentation of form API hook; validate hidden_list_admin_nodes() form.
  */
-function hidden_list_admin_nodes_validate($form_id, $form_values) {
-  $form_values['nodes'] = array_diff($form_values['nodes'], array(0));
-  if (count($form_values['nodes']) == 0) {
+function hidden_list_admin_nodes_validate($form, &$form_state) {
+  $form_state['values']['nodes'] = array_diff($form_state['values']['nodes'], array(0));
+  if (count($form_state['values']['nodes']) == 0) {
     form_set_error('', t('Please select one or more nodes to perform the update on.'));
   }
 }
@@ -935,9 +939,9 @@
 /**
  * Implementation of form API hook; submit hidden_list_admin_nodes() form.
  */
-function hidden_list_admin_nodes_submit($form_id, $form_values) {
+function hidden_list_admin_nodes_submit($form, &$form_state) {
   $nids = array();
-  foreach ($form_values['nodes'] as $nid => $value) {
+  foreach ($form_state['values']['nodes'] as $nid => $value) {
     if ($value) {
       $nids[] = (int)$nid;
     }
@@ -948,7 +952,7 @@
 /**
  * Menu callback; Admin list form of reported nodes.
  */
-function hidden_list_admin_nodes_reported() {
+function hidden_list_admin_nodes_reported(&$form_state) {
   $form = _hidden_list_admin_reported_options();
   $form['header'] = array( 
     '#type' => 'value', 
@@ -1048,9 +1052,9 @@
 /**
  * Implentation of form API hook; validate hidden_list_admin_nodes_reported() form.
  */
-function hidden_list_admin_nodes_reported_validate($form_id, $form_values) {
-  $form_values['nodes'] = array_diff($form_values['nodes'], array(0));
-  if (count($form_values['nodes']) == 0) {
+function hidden_list_admin_nodes_reported_validate($form, &$form_state) {
+  $form_state['values']['nodes'] = array_diff($form_state['values']['nodes'], array(0));
+  if (count($form_state['values']['nodes']) == 0) {
     form_set_error('', t('Please select one or more nodes to perform the update on.'));
   }
 }
@@ -1058,13 +1062,13 @@
 /**
  * Implementation of form API hook; submit hidden_list_admin_nodes_reported() form.
  */
-function hidden_list_admin_nodes_reported_submit($form_id, $form_values) {
+function hidden_list_admin_nodes_reported_submit($form, &$form_state) {
   global $user;
-  switch ($form_values['operation']) {
+  switch ($form_state['values']['operation']) {
     case 'HIDE':
       $hide = array();
       $error = array();
-      foreach ($form_values['nodes'] as $nid => $value) {
+      foreach ($form_state['values']['nodes'] as $nid => $value) {
         $nid = (int)$nid;
         if ($value) {
           // would be nice to transfer reported reason(s) but there maybe more than one
@@ -1092,7 +1096,7 @@
         break;
       }
       $spam = array();
-      foreach ($form_values['nodes'] as $nid => $value) {
+      foreach ($form_state['values']['nodes'] as $nid => $value) {
         $nid = (int)$nid;
         spam_spam_node($nid);
         $spam[] = $nid;
@@ -1105,7 +1109,7 @@
     case 'SEEN':
       $error = array();
       $seen = array();
-      foreach ($form_values['nodes'] as $nid => $value) {
+      foreach ($form_state['values']['nodes'] as $nid => $value) {
         $nid = (int)$nid;
         if ($value) {
           if (_hidden_reported_seen('node', (int)$nid, $user->uid)) {
@@ -1175,7 +1179,7 @@
 /**
  * Menu callback; Admin list form of hidden comments.
  */ 
-function hidden_list_admin_comments() {
+function hidden_list_admin_comments(&$form_state) {
   $form = _hidden_list_admin_options();
   $form['header'] = array( 
     '#type' => 'value', 
@@ -1272,9 +1276,9 @@
 /**
  * Implentation of form API hook; validate hidden_list_admin_comments() form.
  */
-function hidden_list_admin_comments_validate($form_id, $form_values) {
-  $form_values['comments'] = array_diff($form_values['comments'], array(0));
-  if (count($form_values['comments']) == 0) {
+function hidden_list_admin_comments_validate($form, &$form_state) {
+  $form_state['values']['comments'] = array_diff($form_state['values']['comments'], array(0));
+  if (count($form_state['values']['comments']) == 0) {
     form_set_error('', t('Please select one or more comments to perform the update on.'));
     return 'admin/content/comment/list/hidden';
   }
@@ -1283,11 +1287,11 @@
 /**
  * Implementation of form API hook; submit hidden_list_admin_comments() form.
  */
-function hidden_list_admin_comments_submit($form_id, $form_values) {
-  if ($form_values['operation'] == 'UNHIDE') {
+function hidden_list_admin_comments_submit($form, &$form_state) {
+  if ($form_state['values']['operation'] == 'UNHIDE') {
     $unhide = array();
     $error = array();
-    foreach ($form_values['comments'] as $cid => $value) {
+    foreach ($form_state['values']['comments'] as $cid => $value) {
       $cid = (int)$cid;
       if ($value) {
         if (_hidden_hidden_unhide('comment', $cid)) {
@@ -1309,14 +1313,13 @@
       drupal_set_message($msg);
     }
   }
-
-  return 'admin/content/comment/list/hidden';
+  $form_state['redirect'] = 'admin/content/comment/list/hidden';
 }
 
 /**
  * Menu callback; admin list form of reported comments.
  */
-function hidden_list_admin_comments_reported() {
+function hidden_list_admin_comments_reported(&$form_state) {
   $form = _hidden_list_admin_reported_options();
   $form['header'] = array( 
     '#type' => 'value', 
@@ -1413,9 +1416,9 @@
 /**
  * Implentation of form API hook; validate hidden_list_admin_comments_reported() form.
  */
-function hidden_list_admin_comments_reported_validate($form_id, $form_values) {
-  $form_values['comments'] = array_diff($form_values['comments'], array(0));
-  if (count($form_values['comments']) == 0) {
+function hidden_list_admin_comments_reported_validate($form, &$form_state) {
+  $form_state['values']['comments'] = array_diff($form_state['values']['comments'], array(0));
+  if (count($form_state['values']['comments']) == 0) {
     form_set_error('', t('Please select one or more comments to perform the update on.'));
   }
 }
@@ -1423,13 +1426,13 @@
 /**
  * Implementation of form API hook; submit hidden_list_admin_comments_reported() form.
  */
-function hidden_list_admin_comments_reported_submit($form_id, $form_values) {
+function hidden_list_admin_comments_reported_submit($form, &$form_state) {
   global $user;
-  switch ($form_values['operation']) {
+  switch ($form_state['values']['operation']) {
     case 'HIDE':
       $hide = array();
       $error = array();
-      foreach ($form_values['comments'] as $cid => $value) {
+      foreach ($form_state['values']['comments'] as $cid => $value) {
         $cid = (int)$cid;
         if ($value) {
           // could transfer nid with form, but is there an elegant way?
@@ -1462,7 +1465,7 @@
         break;
       }
       $spam = array();
-      foreach ($form_values['comments'] as $cid => $value) {
+      foreach ($form_state['values']['comments'] as $cid => $value) {
         $cid = (int)$cid;
         if ($value) {
           $result = db_query('SELECT nid FROM {comments} WHERE cid=%d', $cid);
@@ -1481,7 +1484,7 @@
     case 'SEEN':
       $seen = array();
       $error = array();
-      foreach ($form_values['comments'] as $cid => $value) {
+      foreach ($form_state['values']['comments'] as $cid => $value) {
         $cid = (int)$cid;
         if ($value) {
           $result = db_query('SELECT nid FROM {comments} WHERE cid=%d', $cid);
@@ -1658,17 +1661,18 @@
  * @return 
  *   page content if is hidden.
  */
-function hidden_view($hidden) {
-  if ($hidden->type == 'comment') {
-    $comment = _comment_load($hidden->id);
+function hidden_view($type, $id) {
+  if ($type == 'comment') {
+    $comment = _comment_load($id);
+    $node = node_load($comment->nid);
     drupal_set_title(t('Hidden comment: ') . check_plain($comment->subject));
     $links = hidden_link('comment', $comment);
-    $output = theme_comment_view($comment, $links);
+    $output = theme_comment_view($comment, $node, $links);
   }
-  else if ($hidden->type == 'node') {
-    $node = node_load($hidden->id);
+  elseif ($type == 'node') {
+    $node = node_load($id);
     drupal_set_title(t('Hidden node: ') . check_plain($node->title));
-    $output = node_show($node, $cid);
+    $output = node_show($node, 0);
   }
   else {
     _hidden_log(HIDDEN_LOG_DEBUG, 'hidden_view() called with invalid $hidden->type.');
@@ -1687,7 +1691,8 @@
  *   form.
  * @ingroup themeable.
  */
-function hidden_hide($op, $type, $id) {
+
+function hidden_hide(&$form_state, $op, $type, $id) {
   $type = (string)$type;
   $id = (int)$id;
 
@@ -1733,9 +1738,10 @@
   else {
     $form = hidden_hide_form($op);
   }
-  $form['type'] = array('#type' => 'hidden', '#value' => $type);
-  $form['nid'] = array('#type' => 'hidden', '#value' => $nid);
-  $form['cid'] = array('#type' => 'hidden', '#value' => $cid);
+  $form['type'] = array('#type' => 'value', '#value' => $type);
+  $form['nid'] = array('#type' => 'value', '#value' => $nid);
+  $form['cid'] = array('#type' => 'value', '#value' => $cid);
+  $form['op'] = array('#type' => 'value', '#value' => $op);
   $form['submit'] = array('#type' => 'submit', '#value' => ($op=='hide') ? t('Hide') : t('Report'));
 
   return $form;
@@ -1799,11 +1805,11 @@
 /**
  * Implementation of form API hook; hide or report content submit hidden_hide().
  */
-function hidden_hide_validate($form_id, $form_values) {
+function hidden_hide_validate($form, &$form_state) {
   if (user_access('administer hidden')) {
     // Validate the "hidden by" field.
-    if (!empty($form_values['user']) && !($user = user_load(array('name' => $form_values['user'])))) {
-      form_set_error('user', t('The username %name does not exist.', array('%name' => $form_values['user'])));
+    if (!empty($form_state['values']['user']) && !($user = user_load(array('name' => $form_state['values']['user'])))) {
+      form_set_error('user', t('The username %name does not exist.', array('%name' => $form_state['values']['user'])));
     }
   }
   // check nid/cid/type? probably not _needed_ and note hidden_admin_filter_form_validate() uses this too
@@ -1812,8 +1818,8 @@
 /**
  * Implementation of form API hook; hide or report content submit hidden_hide().
  */
-function hidden_hide_submit($form_id, $form_values) {
-  $op = (string)$form_values['op'];
+function hidden_hide_submit($form, &$form_state) {
+  $op = $form_state['values']['op'];
   if ($op == 'Hide') {
     if (! user_access('mark as hidden')) {
       drupal_access_denied();
@@ -1825,12 +1831,12 @@
     }
   }
   else {
-    _hidden_log(HIDDEN_LOG_DEBUG, 'hidden_hide_submit() passed invalid $op');
+    _hidden_log(HIDDEN_LOG_DEBUG, '_hidden_hide_submit() passed invalid $op');
     drupal_goto('hidden');
   }
-  $type = (string)$form_values['type'];
-  $nid = (int)$form_values['nid'];
-  $cid = (int)$form_values['cid'];
+  $type = (string)$form_state['values']['type'];
+  $nid = (int)$form_state['values']['nid'];
+  $cid = (int)$form_state['values']['cid'];
   if (! _hidden_check_param($type, $nid, $cid)) {
     _hidden_log(HIDDEN_LOG_DEBUG, 'hidden_hide_submit() passed invalid parameters.');
     drupal_goto('hidden');
@@ -1888,18 +1894,19 @@
  * @param $hidden
  *   hidden details object see _hidden_hidden_check()
  */
-function hidden_unhide($hidden) {
-  $t_array = array('%type' => $hidden->type);
-  if (_hidden_hidden_unhide($hidden->type, $hidden->id)) {
+function hidden_unhide($type, $id) {
+  $t_array = array('%type' => $type);
+  if (_hidden_hidden_unhide($type, $id)) {
     $msg =  t('Hidden %type unhidden', $t_array);
-    _hidden_log(HIDDEN_LOG_UNHIDE, $msg, $hidden->type, $hidden->id);
+    _hidden_log(HIDDEN_LOG_UNHIDE, $msg, $type, $id);
     drupal_set_message($msg);
   }
   else {
     $msg = t('Error unhiding %type.', $t_array);
-    _hidden_log(HIDDEN_LOG_ERROR, $msg, $hidden->type, $hidden->id);
+    _hidden_log(HIDDEN_LOG_ERROR, $msg, $type, $id);
     drupal_set_message($msg, 'error');
   }
+  $hidden = _hidden_hidden_get($type, $id);
   _hidden_goto_unhidden($hidden->nid, $hidden->cid);
 }
 
@@ -2139,15 +2146,15 @@
   }
   else {
     // Insert into hidden table
-    $hid = db_next_id("{hidden_$type}_hid");
     if ($type == 'node') {
-      $query = "INSERT INTO {hidden_node} (hid, nid, uid, created, rid, publicnote, privatenote, delay) VALUES (%d, %d, %d, %d, %d, '%s', '%s', %d)";
-      $result = db_query($query, $hid, $nid, $uid, time(), $rid, $public, $private, $filter);
+      $query = "INSERT INTO {hidden_node} (nid, uid, created, rid, publicnote, privatenote, delay) VALUES (%d, %d, %d, %d, '%s', '%s', %d)";
+      $result = db_query($query, $nid, $uid, time(), $rid, $public, $private, $filter);
     }
     else {
-      $query = "INSERT INTO {hidden_comment} (hid, nid, cid, uid, created, rid, publicnote, privatenote, delay) VALUES (%d, %d, %d, %d, %d, %d, '%s', '%s', %d)";
-      $result = db_query($query, $hid, $nid, $cid, $uid, time(), $rid, $public, $private, $filter);
+      $query = "INSERT INTO {hidden_comment} (nid, cid, uid, created, rid, publicnote, privatenote, delay) VALUES (%d, %d, %d, %d, %d, '%s', '%s', %d)";
+      $result = db_query($query, $nid, $cid, $uid, time(), $rid, $public, $private, $filter);
     }
+    $hid = db_last_insert_id("{hidden_$type}_hid", "hid");
   }
   if (! $result) {
     if ($filter === false) {
@@ -2388,7 +2395,7 @@
 /**
  * Menu callback; Admin new or edit hidden reason
  */
-function hidden_reasons_admin_form($op, $rid=0) {
+function hidden_reasons_admin_form(&$form_state, $op, $rid=0) {
   $rid = (int)$rid;
   if ($op == 'edit') {
     if (!($item = db_fetch_array(db_query('SELECT * FROM {hidden_reasons} WHERE rid = %d', $rid)))) {
@@ -2433,11 +2440,11 @@
 /**
  * Implementation of form API hook; submit hidden_reasons_admin_form().
  */
-function hidden_reasons_admin_form_submit($form_id, $form_values) {
-  $title = (string) $form_values['title'];
-  $description = (string) $form_values['description'];
-  $rid = (int) $form_values['rid'];
-  $enabled = (bool) $form_values['enabled'];
+function hidden_reasons_admin_form_submit($form, &$form_state) {
+  $title = (string) $form_state['values']['title'];
+  $description = (string) $form_state['values']['description'];
+  $rid = (int) $form_state['values']['rid'];
+  $enabled = (bool) $form_state['values']['enabled'];
 
   $result = _hidden_reasons_admin_form_submit($title, $description, $rid, $enabled);
   $t_args = array('%title' => $title);
@@ -2486,11 +2493,11 @@
     }
   }
   else {
-    $rid = db_next_id('{hidden_reasons}_rid');
-    if (! db_query("INSERT INTO {hidden_reasons} (rid, title, description, enabled) VALUES (%d, '%s', '%s', %d)", $rid, $title, $description, $enabled)) {
+    if (! db_query("INSERT INTO {hidden_reasons} (title, description, enabled) VALUES ('%s', '%s', %d)", $title, $description, $enabled)) {
       _hidden_log(HIDDEN_LOG_DEBUG, '_hidden_reasons_form_submit() failed INSERT.');
       return false;
     }
+    $rid = db_last_insert_id("{hidden_reasons}_rid", "rid");
     return $rid;
   }
 }
@@ -2709,8 +2716,8 @@
 /**
  * Implementation of form API hook; submit hidden_filters_admin_form(). 
  */
-function hidden_filters_admin_enabled_form_submit($form_id, $form_values) {
-  foreach ($form_values['weight'] as $hfid => $weight) {
+function hidden_filters_admin_enabled_form_submit($form, &$form_state) {
+  foreach ($form_state['values']['weight'] as $hfid => $weight) {
     if (! db_query('UPDATE {hidden_filters} SET weight=%d WHERE hfid=%d', $weight, $hfid)) {
       $error = true;
     }
@@ -2727,7 +2734,7 @@
 /**
  * Menu callback; form to add or edit a filter
  */
-function hidden_filters_admin_form($op, $hfid=0) {
+function hidden_filters_admin_form(&$form_state, $op, $hfid=0) {
   $hfid = (int)$hfid;
   if ($op == 'edit') {
     if (! $item=_hidden_filter_get($hfid)) {
@@ -2795,11 +2802,11 @@
 /**
  * Implementation of form API hook; validate hidden_filters_admin_form(). 
  */
-function hidden_filters_admin_form_validate($form_id, $form_values) {
-  hidden_hide_validate($form_id, $form_values);
-  if ($form_values['type']==HIDDEN_FILTER_PREG) {
+function hidden_filters_admin_form_validate($form, &$form_state) {
+  hidden_hide_validate($form, &$form_state);
+  if ($form_state['values']['type']==HIDDEN_FILTER_PREG) {
 // TODO switch off error reporting
-    if (preg_match($form_values['filter'], 'string')===false) {
+    if (preg_match($form_state['values']['filter'], 'string')===false) {
       form_set_error('filter', t('The filter is not a valid regular expression'));
     }
 // turn it back
@@ -2809,14 +2816,14 @@
 /**
  * Implementation of form API hook; submit hidden_filters_admin_form().
  */
-function hidden_filters_admin_form_submit($form_id, $form_values) {
-  $hfid = (int)$form_values['hfid'];
-  $title = (string)$form_values['title'];
-  $filter = (string)$form_values['filter'];
-  $type = (int)$form_values['type'];
-  $delay = (int)$form_values['delay'];
-  $weight = (int)$form_values['weight'];
-  $enabled = (int)$form_values['enabled'];
+function hidden_filters_admin_form_submit($form, &$form_state) {
+  $hfid = (int)$form_state['values']['hfid'];
+  $title = (string)$form_state['values']['title'];
+  $filter = (string)$form_state['values']['filter'];
+  $type = (int)$form_state['values']['type'];
+  $delay = (int)$form_state['values']['delay'];
+  $weight = (int)$form_state['values']['weight'];
+  $enabled = (int)$form_state['values']['enabled'];
   if (user_access('administer hidden')) {
     $user = user_load(array('name' => $form_values['user']));
     $uid = $user->uid;
@@ -2825,12 +2832,12 @@
     global $user;
     $uid = $user->uid;
   }
-  $rid = (int)$form_values['reason'];
+  $rid = (int)$form_state['values']['reason'];
   if (! _hidden_reason_check($rid)) {
     $rid = 0;
   }
-  $public = (string)$form_values['publictext'];
-  $private = (string)$form_values['privatetext'];
+  $public = (string)$form_state['values']['publictext'];
+  $private = (string)$form_state['values']['privatetext'];
 
   $result = _hidden_filters_admin_form_submit($hfid, $title, $filter, $type, $delay, $weight, $enabled, $uid, $rid, $public, $private);
   if ($result == false) {
@@ -2864,11 +2871,11 @@
     }
   }
   else {
-    $hfid = db_next_id('{hidden_filters}_hfid');
-    if (! db_query("INSERT INTO {hidden_filters} (hfid, filter, type, weight, enabled) VALUES (%d, '%s', %d, %d, %d)", $hfid, $filter, $type, $weight, $enabled)) {
+    if (! db_query("INSERT INTO {hidden_filters} (filter, type, weight, enabled) VALUES ('%s', %d, %d, %d)", $filter, $type, $weight, $enabled)) {
       _hidden_log(HIDDEN_LOG_DEBUG, '_hidden_filters_admin_form_submit failed INSERT to {hidden_filters}', 'filter', $hfid);
       return false;
     }
+    $hfid = db_last_insert_id("{hidden_filters}_hfid", "hfid");
     if (! db_query("INSERT INTO {hidden_filter_reasons} (hfid, title, delay, uid, rid, publicnote, privatenote) VALUES (%d, '%s', %d, %d, %d, '%s', '%s')", $hfid, $title, $delay, $uid, $rid, $public, $private)) {
       _hidden_log(HIDDEN_LOG_DEBUG, '_hidden_filters_admin_form_submit() failed INSERT to {hidden_filter_reasons}', 'filter', $hfid);
       // maybe good to delete {hidden_filters} here?
@@ -3227,7 +3234,7 @@
     }
   }
 
-  return url($path, null, $fragment, $absolute);
+  return url($path, array('fragment' => $fragment, 'absolute' => $absolute));
 }
 
 /**
@@ -3269,6 +3276,7 @@
  *   cid (if comment)
  */
 function _hidden_goto_hidden($nid, $cid = 0) {
+  drupal_set_message("_hidden_goto_hidden $nid $cid");
   if ($cid == 0) {
     $access = user_access('administer nodes');          // it's a node can the user see unpublished nodes?
   }
@@ -3308,6 +3316,7 @@
  *   int cid (if comment)
  */
 function _hidden_goto_unhidden($nid, $cid = 0) {
+  drupal_set_message("_hidden_goto_unhidden $nid $cid");
   if (isset($_REQUEST['destination'])) { 
     // this is pre-empting the probability that views.module displays may return to same location
     // some other switch may be required as well
@@ -3361,3 +3370,4 @@
   );
   return variable_get('hidden_email', $default);
 }
+
Common subdirectories: hidden5/images and hidden/images
