Index: trunk/include/onuninstall.php
===================================================================
--- trunk/include/onuninstall.php	(revision 187)
+++ trunk/include/onuninstall.php	(revision 188)
@@ -24,23 +24,34 @@
 	$db =& Database::getInstance() ;
 	$mid = $module->getVar('mid') ;
-/*
-	// TABLES (loading mysql.sql)
-	$sql_file_path = dirname(__FILE__).'/sql/mysql.sql' ;
-	$prefix_mod = $db->prefix() . '_' . $mydirname ;
-	if( file_exists( $sql_file_path ) ) {
-		$ret[] = "SQL file found at <b>".htmlspecialchars($sql_file_path)."</b>.<br  /> Deleting tables...<br />";
-		$sql_lines = file( $sql_file_path ) ;
-		foreach( $sql_lines as $sql_line ) {
-			if( preg_match( '/^CREATE TABLE \`?([a-zA-Z0-9_-]+)\`? /i' , $sql_line , $regs ) ) {
-				$sql = 'DROP TABLE '.$prefix_mod.'_'.$regs[1] ;
-				if (!$db->query($sql)) {
-					$ret[] = '<span style="color:#ff0000;">ERROR: Could not drop table <b>'.htmlspecialchars($prefix_mod.'_'.$regs[1]).'<b>.</span><br />';
-				} else {
-					$ret[] = 'Table <b>'.htmlspecialchars($prefix_mod.'_'.$regs[1]).'</b> dropped.<br />';
-				}
+	
+	$xp_prefix = $mydirname;
+	if ($xp_prefix == 'wordpress'){
+	 	$xp_prefix = 'wp';
+	}
+	
+	$xoops_prefix = $db->prefix();
+
+	if (empty($xoops_prefix) || empty($xp_prefix)) {
+		$ret[] = '<span style="color:#ff0000;">ERROR: Empty Prefix.</span><br />';
+		return false;
+	}
+	
+	$prefix_mod = $xoops_prefix  . '_' . $xp_prefix;
+	$sql = "SHOW TABLES LIKE '$prefix_mod%'";
+	if ($result = $db->query($sql)) {
+		while ($table = $db->fetchRow($result)){
+			$drop_sql = 'DROP TABLE '. $table[0] ;
+			if (!$db->queryF($drop_sql)) {
+				$ret[] = '<span style="color:#ff0000;">ERROR: Could not drop table <b>'.htmlspecialchars($table[0]).'<b>.</span><br />';
+			} else {
+				$ret[] = 'Table <b>'.htmlspecialchars($table[0]).'</b> dropped.<br />';
 			}
 		}
+	} else {
+		$ret[] = '<span style="color:#ff0000;">ERROR: Table not found of prefix <b>'.htmlspecialchars($prefix_mod).'<b> .</span><br />';
+		return false;
 	}
-*/
+
+
 	// TEMPLATES (Not necessary because modulesadmin removes all templates)
 	/* $tplfile_handler =& xoops_gethandler( 'tplfile' ) ;
