Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff -r -u xpressme_integration_kit/admin/index.php php7_patch/admin/index.php
--- xpressme_integration_kit/admin/index.php 2014-09-26 16:17:37.008000000 +0900
+++ php7_patch/admin/index.php 2015-05-07 11:04:59.910887800 +0900
@@ -164,6 +164,7 @@
global $xoopsModule;
include(dirname(__FILE__) . '/../wp-includes/version.php');
require_once dirname(dirname( __FILE__ )).'/include/memory_limit.php' ;
+ $db =& XoopsDatabaseFactory::getDatabaseConnection();
if ($is_report) {
echo "******** " . _AM_XP2_SYSTEM_INFO . "********" . "<br />\n";
@@ -172,7 +173,7 @@
echo 'libxml Version: ';
if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect.";
echo "<br />\n";;
- echo "MySQL Version: " . mysql_get_server_info() . "</text><br />";
+ echo "MySQL Version: " . mysqli_get_server_info($db->conn) . "</text><br />";
echo "XOOPS Version: " . XOOPS_VERSION . "</text><br />";
echo "XPressME Version: " . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "<br />\n";
echo "WordPress Version: " . $wp_version . "<br />\n";
@@ -246,7 +247,7 @@
echo "<label>" . "<strong>libxml Version:</strong>" . ":</label><text>";
if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect.";
echo "</text><br />";
- echo "<label>" . "<strong>MySQL Version:</strong>" . ":</label><text>" . mysql_get_server_info() . "</text><br />";
+ echo "<label>" . "<strong>MySQL Version:</strong>" . ":</label><text>" . mysqli_get_server_info($db->conn) . "</text><br />";
echo "<label>" . "<strong>XOOPS Version:</strong>" . ":</label><text>" . XOOPS_VERSION . "</text><br />";
echo "<label>" . "<strong>XPressME Version:</strong>" . ":</label><text>" . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "</text><br />";
echo "<label>" . "<strong>WordPress Version:</strong>" . ":</label><text>" . $wp_version . "</text><br />";
diff -r -u xpressme_integration_kit/class/xpressD3commentContent.class.php php7_patch/class/xpressD3commentContent.class.php
--- xpressme_integration_kit/class/xpressD3commentContent.class.php 2014-09-26 16:17:36.776000000 +0900
+++ php7_patch/class/xpressD3commentContent.class.php 2015-05-08 23:08:12.233474000 +0900
@@ -8,10 +8,17 @@
function fetchSummary( $external_link_id )
{
// include_once dirname(dirname(__FILE__)).'/include/common_functions.php' ;
- global $forum_id;
-
+ if ( empty( $this->forum_id ) ) {
+ global $forum_id;
+ if ( !empty( $forum_id ) ) {
+ $this->forum_id = $forum_id;
+ } else {
+ return parent::fetchSummary( $external_link_id );
+ }
+ }
+
$db =& XoopsDatabaseFactory::getDatabaseConnection() ;
- $myts =& MyTextsanitizer::getInstance() ;
+ (method_exists('MyTextsanitizer', 'sGetInstance') && ($myts =& MyTextsanitizer::sGetInstance())) || ($myts =& MyTextsanitizer::getInstance()) ;
$module_handler =& xoops_gethandler( 'module' ) ;
$module =& $module_handler->getByDirname( $this->mydirname ) ;
@@ -23,7 +30,7 @@
if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ;
$xpress_prefix = preg_replace('/wordpress/','wp',$mydirname);
- $blog_info = $this->get_comment_blog_info($forum_id);
+ $blog_info = $this->get_comment_blog_info($this->forum_id);
// query
$post_row = $db->fetchArray( $db->query( "SELECT * FROM ".$blog_info['mb_table_prefix']."posts WHERE ID=$post_id" ) ) ;
if( empty( $post_row ) ) return '' ;
@@ -67,8 +74,16 @@
//private for XPressME
function canAddComment($external_link_id)
{
- global $forum_id;
global $post;
+
+ if ( empty( $this->forum_id ) ) {
+ global $forum_id;
+ if ( !empty( $forum_id ) ) {
+ $this->forum_id = $forum_id;
+ } else {
+ return false;
+ }
+ }
if (is_object($post)){ // in wordpress
if ($post->ID == $external_link_id){
@@ -91,7 +106,7 @@
$mydirname = $this->mydirname ;
if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ;
- $blog_info = $this->get_comment_blog_info($forum_id);
+ $blog_info = $this->get_comment_blog_info($this->forum_id);
$xpress_prefix = preg_replace('/wordpress/','wp',$mydirname);
// query
@@ -175,11 +190,18 @@
function validate_id( $link_id )
{
- global $forum_id;
+ if ( empty( $this->forum_id ) ) {
+ global $forum_id;
+ if ( !empty( $forum_id ) ) {
+ $this->forum_id = $forum_id;
+ } else {
+ return false;
+ }
+ }
$post_id = intval( $link_id ) ;
$mydirname = $this->mydirname ;
$xpress_prefix = preg_replace('/wordpress/','wp',$mydirname);
- $blog_info = $this->get_comment_blog_info($forum_id);
+ $blog_info = $this->get_comment_blog_info($this->forum_id);
$db =& XoopsDatabaseFactory::getDatabaseConnection() ;
list( $count ) = $db->fetchRow( $db->query( "SELECT COUNT(*) FROM ".$blog_info['mb_table_prefix'] ."posts WHERE ID=$post_id AND comment_status ='open'" ) ) ;
diff -r -u xpressme_integration_kit/include/memory_limit.php php7_patch/include/memory_limit.php
--- xpressme_integration_kit/include/memory_limit.php 2014-09-26 16:17:33.840000000 +0900
+++ php7_patch/include/memory_limit.php 2015-05-07 10:51:24.631796000 +0900
@@ -14,9 +14,9 @@
$has_xoops_db = (!empty($xoopsDB));
if (!$has_xoops_db) {
- $cn = mysql_connect($xoops_config->xoops_db_host, $xoops_config->xoops_db_user, $xoops_config->xoops_db_pass);
+ $cn = mysqli_connect($xoops_config->xoops_db_host, $xoops_config->xoops_db_user, $xoops_config->xoops_db_pass);
if ($cn){
- $db_selected = mysql_select_db($xoops_config->xoops_db_name, $cn);
+ $db_selected = mysqli_select_db($cn, $xoops_config->xoops_db_name);
}
}
@@ -30,8 +30,8 @@
}
} else {
if ($db_selected){
- if($result = mysql_query($module_sql)){
- $row = mysql_fetch_assoc($result);
+ if($result = mysqli_query($cn, $module_sql)){
+ $row = mysqli_fetch_assoc($result);
$module_id = $row['mid'];
}
}
@@ -47,15 +47,15 @@
}
} else {
if ($db_selected){
- if($result = mysql_query($config_sql)){
- $row = mysql_fetch_assoc($result);
+ if($result = mysqli_query($cn, $config_sql)){
+ $row = mysqli_fetch_assoc($result);
$memory = $row['conf_value'];
}
}
}
}
if (!$has_xoops_db) {
- mysql_close($cn);
+ mysqli_close($cn);
}
if (empty($memory)) return;
diff -r -u xpressme_integration_kit/include/oninstall.php php7_patch/include/oninstall.php
--- xpressme_integration_kit/include/oninstall.php 2014-09-26 16:17:33.756000000 +0900
+++ php7_patch/include/oninstall.php 2015-05-07 11:33:43.568526400 +0900
@@ -89,7 +89,7 @@
$views_table = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_views' ;
$charset_collate = '';
- if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
+ if ( version_compare($wpdb->get_var('SELECT VERSION()'), '4.1.0', '>=') ) {
if ( ! empty($wpdb->charset) )
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
if ( ! empty($wpdb->collate) )
diff -r -u xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_disp.php php7_patch/wp-content/plugins/xpressme/include/d3forum_comment_disp.php
--- xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_disp.php 2014-09-26 16:17:38.344000000 +0900
+++ php7_patch/wp-content/plugins/xpressme/include/d3forum_comment_disp.php 2015-05-08 23:02:52.840759800 +0900
@@ -33,7 +33,7 @@
// force UPDATE forums.forum_external_link_format "(dirname)::(classname)::(trustdirname)"
$xoops_db->query( "UPDATE ".get_xoops_prefix() . $dir_name."_forums SET forum_external_link_format='".$external_link_format."' WHERE forum_id= $forum_id" ) ;
- $d3comment =& new xpressD3commentContent( $dir_name , $xpress_dirname ) ;
+ $d3comment = new xpressD3commentContent( $dir_name , $xpress_dirname ) ;
$post_title = get_the_title();
if (function_exists('get_the_ID')){ // upper wordpress 2.1
diff -r -u xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php php7_patch/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php
--- xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php 2014-09-26 16:17:38.439000000 +0900
+++ php7_patch/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php 2015-05-07 13:52:21.695580600 +0900
@@ -485,7 +485,7 @@
$wp_res = $xoops_db->query($wp_sql);
if ($wp_res === false) die( '...Err. INSERT' . $wp_comments . '(' . $wp_sql . ')');
- $comment_ID = mysql_insert_id();
+ $comment_ID = $xoops_db->insert_id;
$wp_sql = "UPDATE $wp_posts SET comment_count = comment_count +1 WHERE ID = $comment_post_ID";
$xoops_db->query($wp_sql);
$wp_sql = "INSERT INTO $wp_d3forum_link ";
@@ -695,7 +695,7 @@
// create post under specified post_id
$sql = "INSERT INTO ".$d3f_posts." SET $set4sql,pid=$reply_pid,topic_id=$topic_id,post_time=$post_time,poster_ip=$poster_ip";
$xoops_db->query($sql) ;
- $post_id = mysql_insert_id();
+ $post_id = $xoops_db->insert_id;
wp_d3forum_sync_topic( $d3forum_dirname , $topic_id ) ;
$wp_sql = "INSERT INTO $wp_d3forum_link ";
@@ -728,11 +728,11 @@
// create topic and get a new topic_id
$sql = "INSERT INTO ".$d3f_topic." SET forum_id=$forum_id,topic_invisible=$topic_invisible,topic_external_link_id='".addslashes($topic_external_link_id)."'";
$xoops_db->query($sql) ;
- $topic_id = mysql_insert_id();
+ $topic_id = $xoops_db->insert_id;
// create post in the topic
$sql = "INSERT INTO ".$d3f_posts." SET $set4sql,topic_id=$topic_id,post_time=$post_time,poster_ip=$poster_ip";
$xoops_db->query($sql) ;
- $post_id = mysql_insert_id();
+ $post_id = $xoops_db->insert_id;
wp_d3forum_sync_topic( $d3forum_dirname , $topic_id , true , true ) ;
$wp_sql = "INSERT INTO $wp_d3forum_link ";
@@ -1053,7 +1053,7 @@
if( $old_data == $data ) return ;
}
- $xoops_db->query( "INSERT INTO ".$d3forum_prefix."post_histories SET post_id=$post_id, history_time=UNIX_TIMESTAMP(), data='".mysql_real_escape_string( serialize( $data ) )."'" ) ;
+ $xoops_db->query( $xoops_db->prepare( "INSERT INTO ".$d3forum_prefix."post_histories SET post_id=$post_id, history_time=UNIX_TIMESTAMP(), data=%s", serialize( $data ) ) ) ;
}
?>
\ ファイル末尾に改行がありません
diff -r -u xpressme_integration_kit/wp-content/plugins/xpressme/include/user_sync_xoops.php php7_patch/wp-content/plugins/xpressme/include/user_sync_xoops.php
--- xpressme_integration_kit/wp-content/plugins/xpressme/include/user_sync_xoops.php 2014-09-26 16:17:38.405000000 +0900
+++ php7_patch/wp-content/plugins/xpressme/include/user_sync_xoops.php 2015-05-07 13:36:51.804658600 +0900
@@ -266,7 +266,7 @@
$wu_sql .= "('$xoops_user->uname', '$xoops_user->pass', '$xoops_user->email', '$xoops_user->url', '$xoops_user->uname' ";
$wu_sql .= " , '$user_regist_time', $user_status, '$user_display_name')";
$xoops_db->query($wu_sql);
- $wp_user_id = mysql_insert_id();
+ $wp_user_id = $xoops_db->insert_id;
} else { // WP User ID has not been used yet.
$wu_sql = "INSERT INTO $db_xpress_users ";
$wu_sql .= "(ID , user_login , user_pass ,user_email , user_url , user_nicename " ;
diff -r -u xpressme_integration_kit/wp-content/plugins/xpressme/xpressme_class.php php7_patch/wp-content/plugins/xpressme/xpressme_class.php
--- xpressme_integration_kit/wp-content/plugins/xpressme/xpressme_class.php 2014-09-26 16:17:38.276000000 +0900
+++ php7_patch/wp-content/plugins/xpressme/xpressme_class.php 2015-05-07 12:08:14.282245900 +0900
@@ -366,7 +366,7 @@
$sql .= "VALUES ";
$sql .= "('$cat_id', '', '$title','a:0:{}')";
$xoops_db->query($sql);
- $insert_forum_id = mysql_insert_id();
+ $insert_forum_id = $xoops_db->insert_id;
$sql = "INSERT INTO $d3forum_forum_access_tbl ";
$sql .= "(forum_id, groupid, can_post, can_edit, can_delete, post_auto_approved, is_moderator) ";
$sql .= "VALUES ";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.