Index: trunk/wp-content/plugins/xpressme/language/xpressme-ja.po
===================================================================
--- trunk/wp-content/plugins/xpressme/language/xpressme-ja.po	(revision 87)
+++ trunk/wp-content/plugins/xpressme/language/xpressme-ja.po	(revision 88)
@@ -3,5 +3,5 @@
 "Project-Id-Version: XPressME Plugin\n"
 "POT-Creation-Date: \n"
-"PO-Revision-Date: 2009-01-31 22:42+0900\n"
+"PO-Revision-Date: 2009-02-04 16:00+0900\n"
 "Last-Translator: toemon <toychee@toemon.com>\n"
 "Language-Team: \n"
@@ -20,120 +20,126 @@
 
 #: xpressme_class.php:47
-#: xpressme_class.php:139
+#: xpressme_class.php:141
 msgid "to Old Post"
 msgstr "前の投稿へ"
 
 #: xpressme_class.php:48
-#: xpressme_class.php:141
+#: xpressme_class.php:143
 msgid "to Newer Post"
 msgstr "次の投稿へ"
 
-#: xpressme_class.php:167
-#: xpressme_class.php:280
-#: xpressme_class.php:285
-#: xpressme_class.php:306
+#: xpressme_class.php:170
+#: xpressme_class.php:283
+#: xpressme_class.php:288
+#: xpressme_class.php:309
+#: xpressme_class.php:314
 msgid "YES"
 msgstr "はい"
 
-#: xpressme_class.php:168
-#: xpressme_class.php:281
-#: xpressme_class.php:286
-#: xpressme_class.php:307
+#: xpressme_class.php:171
+#: xpressme_class.php:284
+#: xpressme_class.php:289
+#: xpressme_class.php:310
+#: xpressme_class.php:315
 msgid "NO"
 msgstr "いいえ"
 
-#: xpressme_class.php:208
+#: xpressme_class.php:211
 msgid "Role Setting at Login"
 msgstr "ログイン時の権限設定"
 
-#: xpressme_class.php:211
+#: xpressme_class.php:214
 msgid "XOOPS Groupe"
 msgstr "XOOPSグループ名"
 
-#: xpressme_class.php:211
+#: xpressme_class.php:214
 msgid "WordPress Role"
 msgstr "WordPressでの権限"
 
-#: xpressme_class.php:211
+#: xpressme_class.php:214
 msgid "Role is set at each login"
 msgstr "ログイン時、常に権限を更新する"
 
-#: xpressme_class.php:232
-#: xpressme_class.php:236
+#: xpressme_class.php:235
 #: xpressme_class.php:239
+#: xpressme_class.php:242
 msgid "Default Role of WordPress"
 msgstr "WordPressのデフォルト権限"
 
-#: xpressme_class.php:233
-#: xpressme_class.php:237
+#: xpressme_class.php:236
 #: xpressme_class.php:240
+#: xpressme_class.php:243
 msgid "Group User Doesn't Register"
 msgstr "ユーザ登録しない"
 
-#: xpressme_class.php:270
+#: xpressme_class.php:273
 msgid "XPressME Configuration Page"
 msgstr "XPressMEの設定ページ"
 
-#: xpressme_class.php:274
+#: xpressme_class.php:277
 msgid "Media Upload Base Path"
 msgstr "メディアアップロードのベースパス設定"
 
-#: xpressme_class.php:275
+#: xpressme_class.php:278
 msgid "Use XOOPS UPLOAD PATH"
 msgstr "XOOPSのアップロードパスを使用する。"
 
-#: xpressme_class.php:276
+#: xpressme_class.php:279
 msgid "USE WordPress BASE_PATH"
 msgstr "WordPressのベースパスを使用する。"
 
-#: xpressme_class.php:279
+#: xpressme_class.php:282
 msgid "Thema Sidebar Display"
 msgstr "テーマ表示時にサイドバー表示する。"
 
-#: xpressme_class.php:284
+#: xpressme_class.php:287
 msgid "The change tracking of the post is preserved"
 msgstr "投稿の変更履歴を有効にする。"
 
-#: xpressme_class.php:289
+#: xpressme_class.php:292
 msgid "Display Navi Title of Old Post Link"
 msgstr "古い記事へのナビタイトルを設定"
 
-#: xpressme_class.php:292
+#: xpressme_class.php:295
 msgid "Display Navi Title of Newer Post Link"
 msgstr "新しい記事へのナビタイトルを設定"
 
-#: xpressme_class.php:295
+#: xpressme_class.php:298
 msgid "Select Display name of PostNavi Link"
 msgstr "投稿記事リンクナビのタイトル設定"
 
-#: xpressme_class.php:296
+#: xpressme_class.php:299
 msgid "Title of post"
 msgstr "投稿記事のタイトルを表示"
 
-#: xpressme_class.php:297
+#: xpressme_class.php:300
 msgid "Title of Navi"
 msgstr "ナビタイトルを表示"
 
-#: xpressme_class.php:300
+#: xpressme_class.php:303
 msgid "Adjustment of Navi link display position"
 msgstr "投稿記事ナビリンクの表示位置設定"
 
-#: xpressme_class.php:301
+#: xpressme_class.php:304
 msgid "'Old Post Link' is displayed in the left, and 'Newer Post Link' is displayed in the right"
 msgstr "古い記事へのリンクを左に、より新しい記事へのリンクを右に表示"
 
-#: xpressme_class.php:302
+#: xpressme_class.php:305
 msgid "'Newer Post Link' is displayed in the left, and 'Old Post Link' is displayed in the right"
 msgstr "より新しい記事へのリンクを左に、古い記事へのリンクを右に表示"
 
-#: xpressme_class.php:305
+#: xpressme_class.php:308
 msgid "Is the posts author views counted?"
 msgstr "投稿者の閲覧をカウントしますか？"
 
-#: xpressme_class.php:314
+#: xpressme_class.php:313
+msgid "Is SQL debugging window displayed?"
+msgstr "SQLデバッグウィンドを表示しますか？"
+
+#: xpressme_class.php:323
 msgid "Update Config"
 msgstr "更新"
 
-#: xpressme_class.php:315
+#: xpressme_class.php:324
 msgid "Preset Config"
 msgstr "プリセット"
Index: trunk/wp-content/plugins/xpressme/xpressme.php
===================================================================
--- trunk/wp-content/plugins/xpressme/xpressme.php	(revision 87)
+++ trunk/wp-content/plugins/xpressme/xpressme.php	(revision 88)
@@ -50,3 +50,9 @@
 add_action('user_register', 'user_sync_to_xoops');
 //require_once('../include/custom_functions.php');
+
+// SQL debug windows
+add_filter('query', array(&$XPressME, 'xpress_sql_debug'));
+add_action('admin_footer', array(&$XPressME, 'displayDebugLog'));
+add_action('get_footer', array(&$XPressME, 'displayDebugLog'));
+
 ?>
Index: trunk/wp-content/plugins/xpressme/xpressme_class.php
===================================================================
--- trunk/wp-content/plugins/xpressme/xpressme_class.php	(revision 87)
+++ trunk/wp-content/plugins/xpressme/xpressme_class.php	(revision 88)
@@ -13,5 +13,5 @@
 	var $newer_post_link_text;
 	var $is_author_view_count;
-	var $groupe_role_serial;
+	var $is_sql_debug;
 	var $groupe_role;
 
@@ -48,4 +48,5 @@
 		$this->newer_post_link_text = __('to Newer Post', 'xpressme');
 		$this->is_author_view_count = false;
+		$this->is_sql_debug = false;
 	}
 	
@@ -77,5 +78,6 @@
 			'old_post_link_text' => $this->old_post_link_text ,
 			'newer_post_link_text' => $this->newer_post_link_text,
-			'is_author_view_count' => $this->is_author_view_count
+			'is_author_view_count' => $this->is_author_view_count,
+			'is_sql_debug' => $this->is_sql_debug
 		);
 		if ($mode == 'add_new') {
@@ -141,4 +143,5 @@
 		if(empty($this->newer_post_link_text)) $this->newer_post_link_text = __('to Newer Post', 'xpressme');
 		$this->is_author_view_count = stripslashes(trim($_POST['ch_is_author_view_count']));
+		$this->is_sql_debug = stripslashes(trim($_POST['ch_is_sql_debug']));
 		
 		global $xoops_db;
@@ -307,4 +310,10 @@
 												__('NO','xpressme')		
 												);
+		echo				$this->yes_no_radio_option('is_sql_debug',
+												__('Is SQL debugging window displayed?','xpressme'),
+												__('YES','xpressme'),
+												__('NO','xpressme')		
+												);
+		
 		echo				$this->groupe_role_option();				
 //		$this->is_use_xoops_upload_path_html();
@@ -339,4 +348,53 @@
 		}
 		return $uploads;
+	}
+
+	// SQL DEBUG TEST
+	function is_sql_debug_permission()
+	{
+		global $current_user;
+
+		if ($this->is_sql_debug && ($current_user->user_level >= 10))
+			return true;
+		else
+			return false;
+	}
+	
+	function xpress_sql_debug($query_strings)
+	{
+		if ($this->is_sql_debug_permission()){
+			if (empty($GLOBALS['XPress_SQL_Query'])) $GLOBALS['XPress_SQL_Query'] = '';
+			$GLOBALS['XPress_SQL_Query'] .= $query_strings . '<br />';
+		}
+		return $query_strings;
+	}
+	
+	function displayDebugLog()
+	{
+		if ($this->is_sql_debug_permission()){
+			$content = '';
+			$content .= '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" />';
+			$content .= '<meta http-equiv="content-language" content="'._LANGCODE.'" />' ;
+			$content .= '<title>XPressME SQL DEBUG</title>' ;
+			$content .= '<link rel="stylesheet" type="text/css" media="all" href="'.getcss($GLOBALS['xoopsConfig']['theme_set']).'" />';
+			$content .= '</head><body>';
+			$content .= $GLOBALS['XPress_SQL_Query'];
+			$content .= '<div style="text-align:center;"><input class="formButton" value="CLOSE" type="button" onclick="javascript:window.close();" /></div></body></html>';
+
+			echo '<script type="text/javascript">
+				<!--//
+				xpress_debug_window = window.open("", "xpress_debug", "width=680 , height=600 ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no");
+				xpress_debug_window.document.clear();
+				xpress_debug_window.focus();
+				';
+			$lines = preg_split("/(\r\n|\r|\n)( *)/", $content);
+			foreach ($lines as $line) {
+				echo 'xpress_debug_window.document.writeln("'.str_replace('"', '\"', $line).'");';
+			}
+			echo '
+				xpress_debug_window.document.close();
+				//-->
+			</script>';
+		}
 	}	
 
