XPressME Integration Kit

Trac


Ignore:
Timestamp:
Dec 15, 2009, 4:52:57 PM (15 years ago)
Author:
toemon
Message:

開発ベースにVer2.2をマージ

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/XPressMU/xpressme_integration_kit/include/add_xpress_process.php

    r451 r488  
    77} 
    88 
     9function safe_site_url(){ 
     10        global $xoops_config; 
     11         
     12        if (is_xpress_index_page_call()){ 
     13                $siteurl = get_option('siteurl'); 
     14                $home = get_option('home'); 
     15                $module_url = $xoops_config->module_url; 
     16                $module_name = $xoops_config->module_name; 
     17                $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://'; 
     18                $guess_url = preg_replace('|/' . $module_name . '/.*|i', '/' . $module_name, $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); 
     19 
     20                if(strcmp($siteurl,$module_url) !== 0) { 
     21                        if (!@fclose(@fopen($siteurl . '/xoops_version.php', "r"))){ 
     22                                update_option('siteurl' , $module_url); 
     23                        } 
     24                } 
     25 
     26                if(strcmp($guess_ur,$home) !== 0) { 
     27                        if (@fclose(@fopen($guess_url . '/xoops_version.php', "r"))){ 
     28                                update_option('home' , $guess_url); 
     29                        } 
     30                } 
     31        } 
     32} 
     33 
    934require_once( dirname( __FILE__ ).'/request_url.php'); 
    1035if (is_xpress_index_page_call()){ 
     36        //$_SERVER['REQUEST_METHOD'] = 'POST' is 
    1137        //When notifying by a private message, Notification_reserve_send(); 
    1238        //it is evaded that the data base becomes read-only as a result of the check on the referrer and the method.  
     39        $request_method =  (isset($_SERVER['REQUEST_METHOD'])) ? $_SERVER['REQUEST_METHOD'] : ''; 
    1340        $_SERVER['REQUEST_METHOD'] = 'POST'; 
     41        require_once $xoops_config->xoops_mainfile_path; //It is necessary to execute it for the user attestation before wp-settings.php.  
     42        $_SERVER['REQUEST_METHOD'] = $request_method; 
     43         
     44        unset($offset);         //This Trap is provides the case where $offset is defined on the XOOPS side. 
     45        require_once(ABSPATH.'wp-settings.php'); 
     46         
     47        //When it is not possible to connect it correctly at site home URL on the WordPress side,  
     48        //URL is corrected based on accessed URL.  
     49        safe_site_url(); 
    1450 
    15         require_once $xoops_config->xoops_mainfile_path; //It is necessary to execute it for the user attestation before wp-settings.php.  
    16         unset($offset); 
    17         require_once(ABSPATH.'wp-settings.php'); 
    1851        if (!is_object($xoopsUser)){    // before login auth cookie clear 
    1952                wp_logout(); 
Note: See TracChangeset for help on using the changeset viewer.