// // ------------------------------------------------------------------------ // // 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; $mydirname = basename(dirname(dirname(__FILE__))); $my_dirpath = dirname(dirname(__FILE__)); $wp_prefix_only = preg_replace('/wordpress/','wp',$mydirname); $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 . "
\n"; } else { $error =false; $check_str = ''; while($row = $xoopsDB->fetchArray($res)){ $data_count = $row['data_count']; $meta_key = $row['meta_key']; if ( !preg_match('/^'.$db_prefix. '_.*/',$meta_key , $maches)){ $check_str .= sprintf(_AM_XP2_USER_META_ERR , $meta_key,$data_count) ."
\n"; $error = true; } } if (!$error) $check_str = _AM_XP2_USER_META_OK ; } if ($is_report) { echo "******** " . _AM_XP2_USER_META_KEY . "********" . "
\n"; echo $check_str . "
\n
\n"; } else { echo "
" . _AM_XP2_USER_META_KEY . ""; echo "
"; echo $check_str; echo "
"; echo ''; echo "

"; } } function get_xpress_plugin_data( $plugin_file, $markup = true, $translate = true ) { // We don't need to write to the file, so just open for reading. $fp = fopen($plugin_file, 'r'); // Pull only the first 8kiB of the file in. $plugin_data = fread( $fp, 8192 ); // PHP will close file handle, but we are good citizens. fclose($fp); preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $name ); preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $uri ); preg_match( '|Version:(.*)|i', $plugin_data, $version ); preg_match( '|Description:(.*)$|mi', $plugin_data, $description ); preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name ); preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri ); preg_match( '|Text Domain:(.*)$|mi', $plugin_data, $text_domain ); preg_match( '|Domain Path:(.*)$|mi', $plugin_data, $domain_path ); foreach ( array( 'name', 'uri', 'version', 'description', 'author_name', 'author_uri', 'text_domain', 'domain_path' ) as $field ) { if ( !empty( ${$field} ) ) ${$field} = trim(${$field}[1]); else ${$field} = ''; } $plugin_data = array( 'Name' => $name, 'Title' => $name, 'PluginURI' => $uri, 'Description' => $description, 'Author' => $author_name, 'AuthorURI' => $author_uri, 'Version' => $version, 'TextDomain' => $text_domain, 'DomainPath' => $domain_path ); // if ( $markup || $translate ) // $plugin_data = _get_plugin_data_markup_translate($plugin_data, $markup, $translate); return $plugin_data; } function get_xpress_active_plugin_list($before_str = '') { global $xoopsModule,$xoopsDB; $mydirname = basename(dirname(dirname(__FILE__))); $my_dirpath = dirname(dirname(__FILE__)); $prefix = preg_replace('/wordpress/','wp',$mydirname); $wp_prefix = $xoopsDB->prefix($prefix); $option_table = $wp_prefix . '_options'; $sql = "SELECT option_value FROM $option_table WHERE option_name = 'active_plugins'"; $res = $xoopsDB->query($sql, 0, 0); if ($res === false){ return ; } else { $row = $xoopsDB->fetchArray($res); $active_plugins = @unserialize($row['option_value']); $output = ''; foreach($active_plugins as $active_plugin_path){ $file_name = $my_dirpath . '/wp-content/plugins/' . $active_plugin_path; $active_plugin = get_xpress_plugin_data($file_name); $output .= $before_str . $active_plugin['Name'] . ': Version ' . $active_plugin['Version'] . ': (' .$active_plugin['PluginURI'] . ')
'; } return $output; } } function xpress_active_plugin_list($is_report = false) { if ($is_report) { echo "******** " . _AM_XP2_PLUGIN . "********" . "
\n"; echo get_xpress_active_plugin_list('') . "
\n"; } else { echo "
" . _AM_XP2_PLUGIN . ""; echo "
"; echo get_xpress_active_plugin_list(); echo "
"; echo ''; echo "

"; } } function xpress_sys_info($is_report = false) { global $xoopsModule; include(dirname(__FILE__) . '/../wp-includes/version.php'); require_once dirname(dirname( __FILE__ )).'/include/memory_limit.php' ; if ($is_report) { echo "******** " . _AM_XP2_SYSTEM_INFO . "********" . "
\n"; echo "SERVER: ". $_SERVER['SERVER_SOFTWARE']. "
\n"; echo "PHP Version: " . phpversion() . "
\n"; echo 'libxml Version: '; if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect."; echo "
\n";; echo "MySQL Version: " . mysql_get_server_info() . "
"; echo "XOOPS Version: " . XOOPS_VERSION . "
"; echo "XPressME Version: " . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "
\n"; echo "WordPress Version: " . $wp_version . "
\n"; echo "WP DB Version: " . $wp_db_version . "
\n"; echo "
\n"; echo "safemode: " ; echo ( ini_get( 'safe_mode' ) ) ? "ON" : "OFF"; echo "
\n"; echo "register_globals: " ; echo ( ini_get( 'register_globals' )) ? "ON" : "OFF" ; echo "
\n"; echo "allow_url_fopen: " ; echo ( ini_get( 'allow_url_fopen' )) ? "ON" : "OFF" ; echo "
\n"; echo "magic_quotes_gpc: " ; echo ( ini_get( 'magic_quotes_gpc' )) ? "ON" : "OFF"; echo "
\n"; echo "XML extension: " ; echo ( extension_loaded( 'xml' )) ? "ON" : "OFF"; echo "
\n"; echo "default memory_limit: " ; echo ini_get( 'memory_limit' ); echo "
\n"; xpress_set_memory_limmit(); echo "change memory_limit: " ; echo ini_get( 'memory_limit' ); echo "
\n"; echo "post_max_size: " ; echo ini_get( 'post_max_size' ); echo "
\n"; echo "upload_max_filesize: " ; echo ini_get( 'upload_max_filesize' ); echo "
\n"; echo "display_errors: " ; echo ( ini_get( 'display_errors' )) ? "ON" : "OFF"; echo "
\n"; echo "MB extension: " ; echo ( extension_loaded( 'mbstring' )) ? "ON" : "OFF"; echo "
\n"; echo "mbstring.language: " ; echo ini_get( 'mbstring.language' ); echo "
\n"; echo "mbstring.encoding_translation: " ; echo ( ini_get( 'mbstring.encoding_translation' )) ? "ON" : "OFF"; echo "
\n"; echo "mbstring.internal_encoding: " ; echo ini_get( 'mbstring.internal_encoding' ); echo "
\n"; echo "mbstring.http_input: " ; echo ini_get( 'mbstring.http_input' ); echo "
\n"; echo "mbstring.http_output: " ; echo ini_get( 'mbstring.http_output' ); echo "
\n"; echo "mbstring.detect_order: " ; echo ini_get( 'mbstring.detect_order' ); echo "
\n"; echo "mbstring.substitute_character: " ; echo ini_get( 'mbstring.substitute_character' ); echo "
\n"; echo "mbstring.func_overload: " ; echo ( ini_get( 'mbstring.func_overload' )) ? "ON" : "OFF"; echo "
\n"; echo "
\n"; } else { echo "
" . _AM_XP2_SYSTEM_INFO . ""; echo "
"; echo "" . $_SERVER['SERVER_SOFTWARE'] . "
"; echo "" . phpversion() . "
"; echo ""; if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect."; echo "
"; echo "" . mysql_get_server_info() . "
"; echo "" . XOOPS_VERSION . "
"; echo "" . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "
"; echo "" . $wp_version . "
"; echo "" . $wp_db_version . "
"; echo "
"; echo "
"; echo ""; echo ( ini_get( 'safe_mode' ) ) ? "ON" : "OFF"; echo "
"; echo ""; echo ( ini_get( 'register_globals' )) ? "ON" : "OFF"; echo "
"; echo ""; echo ( ini_get( 'allow_url_fopen' )) ? "ON" : "OFF"; echo "
"; echo ""; echo ( ini_get( 'magic_quotes_gpc' )) ? "ON" : "OFF"; echo "
"; echo ""; echo ( extension_loaded( 'xml' )) ? "ON" : "OFF"; echo "
"; echo ""; echo ini_get( 'memory_limit' ); echo "
"; xpress_set_memory_limmit(); echo ""; echo ini_get( 'memory_limit' ); echo "
"; echo ""; echo ini_get( 'post_max_size' ); echo "
"; echo ""; echo ini_get( 'upload_max_filesize' ); echo "
"; echo ""; echo ( ini_get( 'display_errors' )) ? "ON" : "OFF"; echo "
"; echo ""; echo ( extension_loaded( 'mbstring' )) ? "ON" : "OFF"; echo "
"; echo ""; echo ini_get( 'mbstring.language' ); echo "
"; echo ""; echo ( ini_get( 'mbstring.encoding_translation' )) ? "ON" : "OFF"; echo "
"; echo ""; echo ini_get( 'mbstring.internal_encoding' ); echo "
"; echo ""; echo ini_get( 'mbstring.http_input' ); echo "
"; echo ""; echo ini_get( 'mbstring.http_output' ); echo "
"; echo ""; echo ini_get( 'mbstring.detect_order' ); echo "
"; echo ""; echo ini_get( 'mbstring.substitute_character' ); echo "
"; echo ""; echo ( ini_get( 'mbstring.func_overload' )) ? "ON" : "OFF"; echo "
"; echo "
"; echo ''; echo "

"; } } function xpress_state($is_report = false) { global $xoopsModule,$xoopsDB; include(dirname(__FILE__) . '/../wp-includes/version.php'); include_once(dirname(__FILE__) . '/../include/general_functions.php'); $xp_prefix = $GLOBALS['xoopsModule']->getInfo('dirname'); $xp_prefix = preg_replace('/wordpress/','wp',$xp_prefix); $prefix = $xoopsDB->prefix($xp_prefix . '_'); $posts_tables = get_table_list($prefix,'posts'); $blogname = array(); $count_article = array(); $count_author = array(); $count_category = array(); $array_index = 0; foreach( $posts_tables as $posts_table){ $sql = "SELECT COUNT(DISTINCT post_author) AS count_author, COUNT(*) AS count_article FROM ". $posts_table . " WHERE post_type = 'post' AND (post_status = 'publish' OR post_status = 'private')"; $result = $xoopsDB->query($sql); if($myrow = $xoopsDB->fetchArray($result)){ $count_article[$array_index] = $myrow["count_article"]; $count_author[$array_index] = $myrow["count_author"]; } else { $count_article[$array_index] = 0; $count_author[$array_index] = 0; } $mid_prefix = get_multi_mid_prefix($prefix,'posts' , $posts_table); $sql = "SELECT option_value AS blogname FROM ".$prefix. $mid_prefix . "options" . " WHERE option_name = 'blogname'"; $result = $xoopsDB->query($sql); if($myrow = $xoopsDB->fetchArray($result)){ $blogname[$array_index] = $myrow["blogname"]; } else { $blogname[$array_index] = 'none name'; } if ($wp_db_version < 6124){ $sql = "SELECT COUNT(*) AS count_category FROM ".$prefix. $mid_prefix . "categories"; } else { $sql = "SELECT COUNT(*) AS count_category FROM ".$prefix. $mid_prefix . "term_taxonomy" . " WHERE taxonomy = 'category'"; } $result = $xoopsDB->query($sql); if($myrow = $xoopsDB->fetchArray($result)){ $count_category[$array_index] = $myrow["count_category"]; } else { $count_category[$array_index] = 0; } $array_index++; } for ($i = 0 ; $i < $array_index ; $i++){ if ($is_report){ echo "******** " . $blogname[$i] . _AM_XP2_STATS . "********" . "
\n"; echo _AM_XP2_CATEGORIES .": ".@$count_category[$i]. "
\n"; echo _AM_XP2_ARTICLES .": ". $count_article[$i]. "
\n"; echo _AM_XP2_AUTHORS .": ". $count_author[$i]. "
\n"; } else { echo "
" . $blogname[$i] . _AM_XP2_STATS . ""; echo "
"; echo "".@$count_category[$i]; echo "
"; echo "". $count_article[$i]; echo "
"; echo "". $count_author[$i]; echo ""; echo "
"; echo ''; echo "
"; } } } function xpress_group_role_state($is_report = false) { global $xoopsModule,$xoopsDB; $xp_prefix = $GLOBALS['xoopsModule']->getInfo('dirname'); $xp_prefix = preg_replace('/wordpress/','wp',$xp_prefix); $prefix = $xoopsDB->prefix($xp_prefix . '_'); $group_role_tables = $prefix.'group_role'; $sql = "SELECT groupid , name AS xoops_groupe ,group_type, role , login_all FROM ". $group_role_tables; $result = $xoopsDB->query($sql); if ($is_report){ echo "******** " . _AM_XP2_GROUP_ROLE . "********" . "
\n"; } else { echo "
" . _AM_XP2_GROUP_ROLE . ""; echo "
"; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } $groupe_list = ''; while ($myrow = $xoopsDB->fetchArray($result)){ $xoops_groupe = $myrow["xoops_groupe"] ; $group_type = empty($myrow["group_type"]) ? "None" : $myrow["group_type"] ; $role = empty($myrow["role"]) ? "inhibit register" : $myrow["role"] ; $login_all = empty($myrow["login_all"]) ? 'No' : 'Yes' ; if (!empty($groupe_list)) $groupe_list .= ','; $groupe_list .= $myrow["groupid"]; if ($is_report){ echo $xoops_groupe . ' : '; echo '(' . $group_type. ') : '; echo $role; echo '(' . $login_all. ') : '; echo '
'; } else { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } } if ($is_report){ echo "
"; } else { echo ''; echo '
GROUPGROUPE TYPEROLEAllways Check
' . $xoops_groupe . '' . $group_type . '' . $role . '' . $login_all . '
'; echo "
"; echo ''; echo "

"; } } function xpress_block_state($is_report = false) { $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; include_once(dirname(dirname(__FILE__) ). '/class/check_blocks_class.php'); $xoops_block_check =& xoops_block_check::getInstance(); $xoops_block_check->check_blocks($mydirname); if ($is_report){ echo "******** " . _AM_XP2_BLOCK_STATS . "********" . "
\n"; echo $xoops_block_check->get_message(); echo "
\n"; echo "
\n"; } else { echo "
" . _AM_XP2_BLOCK_STATS . ""; echo "
"; echo $xoops_block_check->get_message(); echo "
"; echo ''; echo "

"; } } function xpress_block_options($is_report = false) { global $xoopsModule; $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; $module_objs = & get_module_objects($mydirname); $module_obj = $module_objs[0]; $mod_id = $xoopsModule->getVar('mid', 'n'); $blocks = & get_block_object_orber_num_bymodule_id( $mod_id ); $infos = $xoopsModule->getInfo('blocks'); if ($is_report){ echo "******** " . _AM_XP2_BLOCK_OPTIONS . "********" . "
\n"; foreach ( $blocks as $block ) { echo $block->getVar('title') . ' : ' . $block->getVar('options') . '
'; } echo "
\n"; } else { echo "
" . _AM_XP2_BLOCK_OPTIONS . ""; echo "
"; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ( $blocks as $block ) { echo ''; echo ''; echo ''; echo ''; } echo ''; echo '
TitleOptions
' . $block->getVar('title') . '' . $block->getVar('options') . '
'; echo '
'; echo ''; echo "

"; } } //-------------------------------------------------------- // module handler //-------------------------------------------------------- function &get_module_objects($module_dir) { $criteria = new CriteriaCompo(); $criteria->add( new Criteria('isactive', '1', '=') ); $criteria->add( new Criteria('dirname', $module_dir, '=') ); $module_handler =& xoops_gethandler('module'); $objs =& $module_handler->getObjects( $criteria ); return $objs; } //-------------------------------------------------------- // block handler //-------------------------------------------------------- function &get_block_object_orber_num_bymodule_id( $mid ) { $arr = array(); $objs =& get_block_object_bymodule_id( $mid ); foreach ( $objs as $obj ) { $arr[ $obj->getVar('func_num', 'n') ] = $obj; } return $arr; } function &get_block_object_bymodule_id( $mid, $asobject=true ) { if ( defined('ICMS_VERSION_BUILD') && ICMS_VERSION_BUILD > 27 ) { /* ImpressCMS 1.2+ */ $block_handler =& xoops_gethandler ('block'); $objs =& $block_handler->getByModule( $mid, $asobject ); } else { /* legacy support */ $objs =& XoopsBlock::getByModule( $mid, $asobject ) ; /* from class/xoopsblock.php */ } return $objs; } $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; $mydirpath = dirname( dirname( __FILE__ ) ) ; //require_once($mydirpath.'/wp-config.php'); require_once '../../../include/cp_header.php' ; //require_once '../include/gtickets.php' ; //define( '_MYMENU_CONSTANT_IN_MODINFO' , '_MI_XP2_NAME' ) ; // branch for altsys if( defined( 'XOOPS_TRUST_PATH' ) && ! empty( $_GET['lib'] ) ) { // common libs (eg. altsys) $lib = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , $_GET['lib'] ) ; $page = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , @$_GET['page'] ) ; if( file_exists( XOOPS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ) ) { include XOOPS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ; } else if( file_exists( XOOPS_TRUST_PATH.'/libs/'.$lib.'/index.php' ) ) { include XOOPS_TRUST_PATH.'/libs/'.$lib.'/index.php' ; } else { die( 'wrong request' ) ; } exit ; } include_once $mydirpath .'/include/wp_check.php' ; // beggining of Output xoops_cp_header(); if(is_wpdb_installed()){ include( './mymenu.php' ) ; echo " "; if (!empty($_POST['submit_report'])) $report = true; else $report = false; xpress_sys_info($report); xpress_active_plugin_list($report); xpress_block_state($report); xpress_block_options($report); xpress_group_role_state($report); admin_check_user_meta_prefix($report); xpress_state($report); echo '
'."\n"; echo ''.' '; echo ''."
\n"; echo "
\n"; } else { include_once $mydirpath .'/include/wp_installer.php' ; if (!empty($_POST['submit_install'])) { $i_mess = wp_installer($mydirname); foreach( $i_mess as $message ) { echo $message ; } } else { echo ''. _AM_XP2_NO_WP. '

'; if (xp_permission_check($mydirname , $mydirpath)){ echo '
'."\n"; echo ''.' '; echo "
\n"; } else { include_once $mydirpath .'/admin/help/wp_install_help.php' ; wp_install_guide(); echo '
'."\n"; echo ''.' '; echo "
\n"; } } } xoops_cp_footer(); ?>