XPressME Integration Kit

Trac

Changeset 860


Ignore:
Timestamp:
Jun 15, 2016, 9:52:13 AM (8 years ago)
Author:
toemon
Message:

PHP7 対応 Fix #431
thx nao-pon

Location:
trunk/xpressme_integration_kit
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/xpressme_integration_kit/admin/index.php

    r835 r860  
    165165        include(dirname(__FILE__) . '/../wp-includes/version.php'); 
    166166        require_once dirname(dirname( __FILE__ )).'/include/memory_limit.php' ; 
     167        $db =& XoopsDatabaseFactory::getDatabaseConnection(); 
    167168 
    168169        if ($is_report) { 
     
    173174                if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect."; 
    174175                echo "<br />\n";; 
    175                 echo "MySQL Version:   " . mysql_get_server_info() . "</text><br />"; 
     176                echo "MySQL Version:   " . mysqli_get_server_info($db->conn) . "</text><br />"; 
    176177                echo "XOOPS Version:   " . XOOPS_VERSION . "</text><br />"; 
    177178                echo "XPressME Version:   " . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "<br />\n"; 
     
    247248                if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect."; 
    248249                echo "</text><br />"; 
    249                 echo "<label>" . "<strong>MySQL Version:</strong>" . ":</label><text>" . mysql_get_server_info() . "</text><br />"; 
     250                echo "<label>" . "<strong>MySQL Version:</strong>" . ":</label><text>" . mysqli_get_server_info($db->conn) . "</text><br />"; 
    250251                echo "<label>" . "<strong>XOOPS Version:</strong>" . ":</label><text>" . XOOPS_VERSION . "</text><br />"; 
    251252                echo "<label>" . "<strong>XPressME Version:</strong>" . ":</label><text>" . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "</text><br />"; 
  • trunk/xpressme_integration_kit/class/xpressD3commentContent.class.php

    r835 r860  
    99                { 
    1010                //      include_once dirname(dirname(__FILE__)).'/include/common_functions.php' ; 
    11                         global $forum_id; 
    12                          
     11                        if ( empty( $this->forum_id ) ) { 
     12                                global $forum_id; 
     13                                if ( !empty( $forum_id ) ) { 
     14                                        $this->forum_id = $forum_id; 
     15                                } else { 
     16                                        return parent::fetchSummary( $external_link_id ); 
     17                                } 
     18                        } 
     19 
    1320                        $db =& XoopsDatabaseFactory::getDatabaseConnection() ; 
    14                         $myts =& MyTextsanitizer::getInstance() ; 
     21                        (method_exists('MyTextsanitizer', 'sGetInstance') && ($myts =& MyTextsanitizer::sGetInstance())) || ($myts =& MyTextsanitizer::getInstance()) ; 
    1522 
    1623                        $module_handler =& xoops_gethandler( 'module' ) ; 
     
    2431                         
    2532                        $xpress_prefix = preg_replace('/wordpress/','wp',$mydirname); 
    26                         $blog_info = $this->get_comment_blog_info($forum_id); 
     33                        $blog_info = $this->get_comment_blog_info($this->forum_id); 
    2734                        // query 
    2835                        $post_row = $db->fetchArray( $db->query( "SELECT * FROM ".$blog_info['mb_table_prefix']."posts WHERE ID=$post_id" ) ) ; 
     
    6875                function canAddComment($external_link_id) 
    6976                { 
    70                         global $forum_id; 
    7177                        global $post; 
     78 
     79                        if ( empty( $this->forum_id ) ) { 
     80                                global $forum_id; 
     81                                if ( !empty( $forum_id ) ) { 
     82                                        $this->forum_id = $forum_id; 
     83                                } else { 
     84                                        return false; 
     85                                } 
     86                        } 
    7287                         
    7388                        if (is_object($post)){  // in wordpress  
     
    92107                                        if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ; 
    93108                                         
    94                                         $blog_info = $this->get_comment_blog_info($forum_id); 
     109                                        $blog_info = $this->get_comment_blog_info($this->forum_id); 
    95110                                        $xpress_prefix = preg_replace('/wordpress/','wp',$mydirname); 
    96111 
     
    176191                function validate_id( $link_id ) 
    177192                { 
    178                         global $forum_id; 
     193                        if ( empty( $this->forum_id ) ) { 
     194                                global $forum_id; 
     195                                if ( !empty( $forum_id ) ) { 
     196                                        $this->forum_id = $forum_id; 
     197                                } else { 
     198                                        return false; 
     199                                } 
     200                        } 
    179201                        $post_id = intval( $link_id ) ; 
    180202                        $mydirname = $this->mydirname ; 
    181203                        $xpress_prefix = preg_replace('/wordpress/','wp',$mydirname); 
    182                         $blog_info = $this->get_comment_blog_info($forum_id);            
     204                        $blog_info = $this->get_comment_blog_info($this->forum_id); 
    183205                        $db =& XoopsDatabaseFactory::getDatabaseConnection() ; 
    184206                         
  • trunk/xpressme_integration_kit/include/memory_limit.php

    r551 r860  
    1515                $has_xoops_db = (!empty($xoopsDB)); 
    1616                if (!$has_xoops_db) { 
    17                         $cn = mysql_connect($xoops_config->xoops_db_host, $xoops_config->xoops_db_user, $xoops_config->xoops_db_pass); 
     17                        $cn = mysqli_connect($xoops_config->xoops_db_host, $xoops_config->xoops_db_user, $xoops_config->xoops_db_pass); 
    1818                        if ($cn){ 
    19                                 $db_selected = mysql_select_db($xoops_config->xoops_db_name, $cn); 
     19                                $db_selected = mysqli_select_db($cn, $xoops_config->xoops_db_name); 
    2020                        } 
    2121                } 
     
    3131                } else { 
    3232                        if ($db_selected){ 
    33                                 if($result = mysql_query($module_sql)){ 
    34                                         $row = mysql_fetch_assoc($result); 
     33                                if($result = mysqli_query($cn, $module_sql)){ 
     34                                        $row = mysqli_fetch_assoc($result); 
    3535                                        $module_id = $row['mid']; 
    3636                                } 
     
    4848                        } else { 
    4949                                if ($db_selected){ 
    50                                         if($result = mysql_query($config_sql)){ 
    51                                                 $row = mysql_fetch_assoc($result); 
     50                                        if($result = mysqli_query($cn, $config_sql)){ 
     51                                                $row = mysqli_fetch_assoc($result); 
    5252                                                $memory = $row['conf_value']; 
    5353                                        } 
     
    5656                } 
    5757                if (!$has_xoops_db) { 
    58                         mysql_close($cn); 
     58                        mysqli_close($cn); 
    5959                } 
    6060                 
  • trunk/xpressme_integration_kit/include/oninstall.php

    r852 r860  
    9090 
    9191        $charset_collate = ''; 
    92         if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) { 
     92        if ( version_compare($wpdb->get_var('SELECT VERSION()'), '4.1.0', '>=') ) { 
    9393                if ( ! empty($wpdb->charset) ) 
    9494                        $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 
  • trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_disp.php

    r144 r860  
    3434                $xoops_db->query( "UPDATE ".get_xoops_prefix() . $dir_name."_forums SET forum_external_link_format='".$external_link_format."' WHERE forum_id= $forum_id" ) ; 
    3535                 
    36                 $d3comment =& new xpressD3commentContent( $dir_name , $xpress_dirname ) ; 
     36                $d3comment = new xpressD3commentContent( $dir_name , $xpress_dirname ) ; 
    3737 
    3838                $post_title = get_the_title(); 
  • trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php

    r616 r860  
    486486                                $wp_res =       $xoops_db->query($wp_sql); 
    487487                                if ($wp_res === false) die( '...Err. INSERT' . $wp_comments . '(' . $wp_sql . ')'); 
    488                                 $comment_ID = mysql_insert_id(); 
     488                                $comment_ID = $xoops_db->insert_id; 
    489489                                $wp_sql  = "UPDATE $wp_posts SET  comment_count = comment_count +1 WHERE ID = $comment_post_ID"; 
    490490                                $xoops_db->query($wp_sql); 
     
    696696                        $sql = "INSERT INTO ".$d3f_posts." SET $set4sql,pid=$reply_pid,topic_id=$topic_id,post_time=$post_time,poster_ip=$poster_ip"; 
    697697                        $xoops_db->query($sql) ; 
    698                         $post_id = mysql_insert_id(); 
     698                        $post_id = $xoops_db->insert_id; 
    699699                        wp_d3forum_sync_topic( $d3forum_dirname , $topic_id ) ; 
    700700                         
     
    729729                        $sql = "INSERT INTO ".$d3f_topic." SET forum_id=$forum_id,topic_invisible=$topic_invisible,topic_external_link_id='".addslashes($topic_external_link_id)."'"; 
    730730                        $xoops_db->query($sql) ; 
    731                         $topic_id = mysql_insert_id(); 
     731                        $topic_id = $xoops_db->insert_id; 
    732732                        // create post in the topic 
    733733                        $sql = "INSERT INTO ".$d3f_posts." SET $set4sql,topic_id=$topic_id,post_time=$post_time,poster_ip=$poster_ip"; 
    734734                        $xoops_db->query($sql) ; 
    735                         $post_id = mysql_insert_id(); 
     735                        $post_id = $xoops_db->insert_id; 
    736736                        wp_d3forum_sync_topic( $d3forum_dirname , $topic_id , true , true ) ; 
    737737                         
     
    10541054        } 
    10551055 
    1056         $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 ) )."'" ) ; 
     1056        $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 ) ) ) ; 
    10571057} 
    10581058 
  • trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/user_sync_xoops.php

    r665 r860  
    267267                                $wu_sql .=              " , '$user_regist_time', $user_status, '$user_display_name')"; 
    268268                                $xoops_db->query($wu_sql); 
    269                                 $wp_user_id = mysql_insert_id(); 
     269                                $wp_user_id = $xoops_db->insert_id; 
    270270                        } else {         // WP User ID has not been used yet.  
    271271                                $wu_sql  =      "INSERT INTO $db_xpress_users "; 
  • trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme_class.php

    r833 r860  
    367367                $sql .=    "('$cat_id', '', '$title','a:0:{}')"; 
    368368                $xoops_db->query($sql); 
    369                 $insert_forum_id = mysql_insert_id(); 
     369                $insert_forum_id = $xoops_db->insert_id; 
    370370                $sql  = "INSERT INTO $d3forum_forum_access_tbl "; 
    371371                $sql .=    "(forum_id, groupid, can_post, can_edit, can_delete, post_auto_approved, is_moderator) "; 
Note: See TracChangeset for help on using the changeset viewer.