XPressME Integration Kit

Trac

Changeset 548


Ignore:
Timestamp:
Mar 16, 2010, 12:33:18 PM (14 years ago)
Author:
toemon
Message:

Site URL,Home URLの自動修正を手動修正に変更 Fixes #312

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xpressme_integration_kit/include/add_xpress_process.php

    r534 r548  
    1111         
    1212        if (is_xpress_index_page_call()){ 
     13                 
     14                if (!empty($_POST['submit_url_change'])) { 
     15                        if (!empty($_POST['site_url_set'])) { 
     16                                update_option('siteurl' , $_POST['site_url_set']); 
     17                        } 
     18                        if (!empty($_POST['home_url_set'])) { 
     19                                update_option('home' , $_POST['home_url_set']); 
     20                        } 
     21                } 
     22 
    1323                $siteurl = get_option('siteurl'); 
    1424                $home = get_option('home'); 
     
    2434                } 
    2535                $guess_url .= $blog_sub_path; 
    26  
    27                 if(strcmp($siteurl,$module_url.$blog_sub_path) !== 0) { 
     36                $xoops_module_url = $module_url.$blog_sub_path; 
     37                 
     38                $site_url_error =  false; 
     39                if(strcmp($siteurl,$guess_url) !== 0) { 
    2840                        if (!@fclose(@fopen($siteurl . '/xoops_version.php', "r"))){ 
    29                                 update_option('siteurl' , $module_url.$blog_sub_path); 
     41                                $site_url_error = true; 
    3042                        } 
    3143                } 
     44                $home_url_error = false; 
     45                if(strcmp($guess_url,$home) !== 0) { 
     46                        $home_url_error = true; 
     47                } 
     48                if ($site_url_error || $home_url_error){ 
     49                        include $xoops_config->xoops_root_path ."/header.php"; 
     50                        $form = '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n"; 
     51                        $form .= '<table cellspacing="1" cellpadding="1" border="0">'; 
     52                        $form .= '<tbody>'; 
     53                        if ($site_url_error){ 
     54                                $site_url_error_log = sprintf('Can not access WordPress Site URL(%s)',$siteurl); 
     55                                $form .= '<tr><td colspan="3"><font color="red"><b>' . $site_url_error_log . '</b></font></td></tr>'; 
     56                                $form .= '<tr>'; 
     57                                $form .= '<td width="16">&nbsp;</td>'; 
     58                                $form .= '<td width="64">Site URL</td>'; 
     59                                $form .= '<td><input name="site_url_set" type="text" size="64" maxlength="200" value="'  . $guess_url . '" /></td>'; 
     60                                $form .= '</tr>'; 
    3261 
    33                 if(strcmp($guess_url,$home) !== 0) { 
    34                         if (@fclose(@fopen($guess_url . '/xoops_version.php', "r"))){ 
    35                                 update_option('home' , $guess_url); 
    3662                        } 
     63                        if ($home_url_error){ 
     64                                if ($site_url_error) $form .= '<tr><td colspan="3">&nbsp;</td></tr>';; 
     65                                $home_url_error_log = sprintf('WordPress Home URL(%s) is different from access URL. ',$home); 
     66                                $form .= '<tr><td colspan="3"><font color="red"><b>' . $home_url_error_log . '</b></font></td></tr>'; 
     67                                $form .= '<tr>'; 
     68                                $form .= '<td width="16">&nbsp;</td>'; 
     69                                $form .= '<td width="64">Home URL</td>'; 
     70                                $form .= '<td><input name="home_url_set" type="text" size="64" maxlength="200" value="'  . $guess_url . '" /></td>'; 
     71                                $form .= '</tr>'; 
     72                        } 
     73                        $form .= '</tbody>'; 
     74                        $form .= '</table><br />'; 
     75                        $form .= '<input type="submit" value= "Setting" name="submit_url_change" />' ."\n"; 
     76                        echo $form; 
     77                        include $xoops_config->xoops_root_path . '/footer.php'; 
     78                        exit(); 
    3779                } 
    3880        } 
     
    5496        //When it is not possible to connect it correctly at site home URL on the WordPress side,  
    5597        //URL is corrected based on accessed URL.  
    56         safe_site_url(); 
     98        global $xoopsUserIsAdmin; 
     99        if ($xoopsUserIsAdmin) safe_site_url(); 
    57100 
    58101        if (!is_object($xoopsUser)){    // before login auth cookie clear 
Note: See TracChangeset for help on using the changeset viewer.