Index: trunk/wp-content/plugins/xpressme/include/custom_functions.php
===================================================================
--- trunk/wp-content/plugins/xpressme/include/custom_functions.php	(revision 95)
+++ trunk/wp-content/plugins/xpressme/include/custom_functions.php	(revision 96)
@@ -3,7 +3,9 @@
 function xpress_credit($show = false)
 {
-	global $xoopsModule,$wp_version;
-	
-	$ret = '<a href="http://www.toemon.com"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xoopsModule->getInfo('version'),$xoopsModule->getInfo('codename')) .'</a>';
+	global $wp_version , $modversion;
+	
+	$xpress_version = $modversion['version'];
+	$xpress_codename = $modversion['codename'];
+	$ret = '<a href="http://www.toemon.com"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename) .'</a>';
 	if (strstr($wp_version,'ME')){
 		$ret .= '(included <a href="http://wpme.sourceforge.jp/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)';
@@ -192,4 +194,5 @@
 // Set post views given a post ID or post object. 
 function post_views_counting($post_id = 0) {
+	global $xoops_db,$wpdb;
 	global $table_prefix;
 	static $views;
@@ -201,5 +204,5 @@
 
 
-	$views_db = $table_prefix . "views";
+	$views_db = get_wp_prefix() . 'views';
 
 	if($post_id==0 || !empty($views[$post_id])) return null;
@@ -212,20 +215,11 @@
 
     $sql = "SELECT post_views FROM " . $views_db . " WHERE post_id=$post_id";
-    $exist = false;
-    if ($result = $GLOBALS["xoopsDB"]->query($sql)) {
-        while($row = $GLOBALS["xoopsDB"]->fetchArray($result)){
-        	$exist = true;
-	        break;
-    	}
-	}
-	if($exist){
+	$post_views_found = $xoops_db->get_var($sql);
+	if($post_views_found){
         $sql = "UPDATE " . $views_db . " SET post_views=post_views+1 WHERE post_id=$post_id";
     }else{
         $sql = "INSERT INTO " . $views_db . " (post_id, post_views) VALUES ($post_id, 1)";
     }
-    if ($result = $GLOBALS["xoopsDB"]->queryF($sql)) {
-    	$views[$post_id] = 1;
-    }
-    
+    $xoops_db->query($sql);
 	return true;
 }
