//
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
// Author: phppp (D.J.)                                                      //
// URL: http://xoopsforge.com, http://xoops.org.cn                           //
// ------------------------------------------------------------------------- //
//include_once 'cp_functions.php';
function admin_check_user_meta_prefix($is_report = false){
	global $xoopsModule;
	$xoopsDB =& Database::getInstance();
	
	$mydirname = basename(dirname(dirname(__FILE__)));
	$my_dirpath = dirname(dirname(__FILE__));
	$wp_prefix_only = $mydirname;
	if ($wp_prefix_only == 'wordpress') $wp_prefix_only ='wp';
	$db_prefix = $xoopsDB->prefix($wp_prefix_only);
	$usermeta_tbl = $db_prefix . '_usermeta';	
	$meta_key_pattern = '_' . $wp_prefix_only . '_';
	$sql = "SELECT count(umeta_id) as data_count ,meta_key FROM $usermeta_tbl GROUP BY meta_key HAVING meta_key LIKE '%" . $meta_key_pattern ."%'" ;
	$res =  $xoopsDB->query($sql, 0, 0);
	
	if ($res === false){
		$check_str = _AM_XP2_USER_META_NONE . "
" . _AM_XP2_USER_META_KEY . " ";
		echo "";
		echo $check_str;
		echo "
";
		echo "" . _AM_XP2_PLUGIN . " ";
		echo "";
		echo get_xpress_active_plugin_list();
		echo "
";
		echo "" . _AM_XP2_SYSTEM_INFO . " ";
		echo "";
		echo "" . "SERVER: " . ": " . $_SERVER['SERVER_SOFTWARE'] . " " . "PHP Version: " . ": " . phpversion() . " " . "libxml Version: " . ": ";
		if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect.";
		echo " " . "MySQL Version: " . ": " . mysql_get_server_info() . " " . "XOOPS Version: " . ": " . XOOPS_VERSION . " " . "XPressME Version: " . ": " . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . " " . "WordPress Version: " . ": " . $wp_version . " " . "WP DB Version: " . ": " . $wp_db_version . " 
";
		echo "";
		echo "safemode: ";
		echo ( ini_get( 'safe_mode' ) ) ? "ON" : "OFF";
		echo " register_globals: ";
		echo ( ini_get( 'register_globals' )) ? "ON" : "OFF";
		echo " magic_quotes_gpc: ";
		echo ( ini_get( 'magic_quotes_gpc' )) ? "ON" : "OFF";
		echo " XML extension: ";
		echo ( extension_loaded( 'xml' )) ? "ON" : "OFF";
		echo " memory_limit: ";
		echo  ini_get( 'memory_limit' );
		echo " post_max_size: ";
		echo  ini_get( 'post_max_size' );
		echo " upload_max_filesize: ";
		echo  ini_get( 'upload_max_filesize' );
		echo " display_errors: ";
		echo ( ini_get( 'display_errors' )) ? "ON" : "OFF";
		echo " MB extension: ";
		echo ( extension_loaded( 'mbstring' )) ? "ON" : "OFF";
		echo " mbstring.language: ";
		echo  ini_get( 'mbstring.language' );
		echo " mbstring.encoding_translation: ";
		echo  ( ini_get( 'mbstring.encoding_translation' )) ? "ON" : "OFF";
		echo " mbstring.internal_encoding: ";
		echo  ini_get( 'mbstring.internal_encoding' );
		echo " mbstring.http_input: ";
		echo  ini_get( 'mbstring.http_input' );
		echo " mbstring.http_output: ";
		echo  ini_get( 'mbstring.http_output' );
		echo " mbstring.detect_order: ";
		echo  ini_get( 'mbstring.detect_order' );
		echo " mbstring.substitute_character: ";
		echo  ini_get( 'mbstring.substitute_character' );
		echo " mbstring.func_overload: ";
		echo  ( ini_get( 'mbstring.func_overload' )) ? "ON" : "OFF";
		echo " 
";
		echo "" . _AM_XP2_XOOPS_CONFIG_INFO . " ";
		echo "";
		echo '
';
		echo '';
		echo '';
		echo 'Define item ';
		echo 'XOOPS setting value ';
		echo 'xoops_config get value ';
		echo ' ';
		echo '';
		if(XOOPS_ROOT_PATH !== $xoops_config->xoops_root_path)
			echo 'XOOPS_ROOT_PATH XOOPS_ROOT_PATH ';	
		echo '' . XOOPS_ROOT_PATH . ' ';
		echo '' . $xoops_config->xoops_root_path . ' ';
		echo ' ';
		echo '';
		if(XOOPS_TRUST_PATH !== $xoops_config->xoops_trust_path)
			echo 'XOOPS_TRUST_PATH XOOPS_TRUST_PATH ';	
		echo '' . XOOPS_TRUST_PATH . ' ';
		echo '' . $xoops_config->xoops_trust_path . ' ';
		echo ' ';
		echo '';
		if(XOOPS_URL !== $xoops_config->xoops_url)
			echo 'XOOPS_URL XOOPS_URL ';	
		echo '' . XOOPS_URL . ' ';
		echo '' . $xoops_config->xoops_url . ' ';
		echo ' ';
		if (defined('XOOPS_SALT')){
			echo '';
			if(XOOPS_SALT !== $xoops_config->xoops_salt)
				echo 'XOOPS_SALT XOOPS_SALT ';
			echo '' . XOOPS_SALT . ' ';
			echo '' . $xoops_config->xoops_salt . ' ';
			echo ' ';
		}
		if (defined('XOOPS_DB_SALT')){
			echo '';
			if(XOOPS_DB_SALT !== $xoops_config->xoops_db_salt)
				echo 'XOOPS_DB_SALT XOOPS_DB_SALT ';
			echo '' . XOOPS_DB_SALT . ' ';
			echo '' . $xoops_config->xoops_db_salt . ' ';
			echo ' ';
		}
		echo '';
		if(XOOPS_DB_HOST !== $xoops_config->xoops_db_host)
			echo 'XOOPS_DB_HOST XOOPS_DB_HOST ';
		echo '' . XOOPS_DB_HOST . ' ';
		echo '' . $xoops_config->xoops_db_host . ' ';
		echo ' ';
		echo '';
		if(XOOPS_DB_USER !== $xoops_config->xoops_db_user)
			echo 'XOOPS_DB_USER XOOPS_DB_USER ';
		echo '' . XOOPS_DB_USER . ' ';
		echo '' . $xoops_config->xoops_db_user . ' ';
		echo ' ';
		echo '';
		if(XOOPS_DB_PASS !== $xoops_config->xoops_db_pass)
			echo 'XOOPS_DB_PASS XOOPS_DB_PASS ';
		echo '' . XOOPS_DB_PASS . ' ';
		echo '' . $xoops_config->xoops_db_pass . ' ';
		echo ' ';
		echo '';
		if(XOOPS_DB_NAME !== $xoops_config->xoops_db_name)
			echo 'XOOPS_DB_NAME XOOPS_DB_NAME ';
		echo '' . XOOPS_DB_NAME . ' ';
		echo '' . $xoops_config->xoops_db_name . ' ';
		echo ' ';
		echo '';
		if(XOOPS_DB_PREFIX !== $xoops_config->xoops_db_prefix)
			echo 'XOOPS_DB_PREFIX XOOPS_DB_PREFIX ';
		echo '' . XOOPS_DB_PREFIX . ' ';
		echo '' . $xoops_config->xoops_db_prefix . ' ';
		echo ' ';
		echo ' ';
		echo '
';
		echo "
" . $blogname[$i] . _AM_XP2_STATS . " ";
			echo "";
			echo "" . _AM_XP2_CATEGORIES .": ".@$count_category[$i];
			echo " " . _AM_XP2_ARTICLES .": ". $count_article[$i];
			echo " " . _AM_XP2_AUTHORS .": ". $count_author[$i];
			echo " ";
			echo "
";
			echo "" . _AM_XP2_BLOCK_STATS . " ";
		echo "";
		echo $xoops_block_check->get_message();
		echo "
";
		echo "