[355] | 1 | <?php
|
---|
[410] | 2 | // used wptouch plugin & iPhone access check (thx uemu)
|
---|
| 3 | function is_iphone_with_wptouch(){
|
---|
| 4 | global $wptouch_plugin;
|
---|
| 5 | if (is_object($wptouch_plugin)) return $wptouch_plugin->applemobile;
|
---|
| 6 | return false;
|
---|
| 7 | }
|
---|
| 8 |
|
---|
[454] | 9 | function safe_site_url(){
|
---|
[524] | 10 | global $xoops_config,$blog_id,$blogname;
|
---|
[454] | 11 |
|
---|
| 12 | if (is_xpress_index_page_call()){
|
---|
[548] | 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 | }
|
---|
[549] | 22 | if (!empty($_POST['submit_redirect'])) {
|
---|
| 23 | $url = get_option('home') . '/wp-admin/options-permalink.php';
|
---|
| 24 | // echo $url;
|
---|
| 25 | wp_redirect($url);
|
---|
| 26 | exit();
|
---|
| 27 | }
|
---|
[548] | 28 |
|
---|
[454] | 29 | $siteurl = get_option('siteurl');
|
---|
| 30 | $home = get_option('home');
|
---|
| 31 | $module_url = $xoops_config->module_url;
|
---|
[475] | 32 | $module_name = $xoops_config->module_name;
|
---|
| 33 | $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
|
---|
| 34 | $guess_url = preg_replace('|/' . $module_name . '/.*|i', '/' . $module_name, $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
|
---|
[524] | 35 | $blog_sub_path = '';
|
---|
[534] | 36 | if(function_exists('is_multisite') && is_multisite()){
|
---|
[524] | 37 | if ($blog_id > 1){
|
---|
| 38 | $blog_sub_path = '/' .$blogname;
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
| 41 | $guess_url .= $blog_sub_path;
|
---|
[548] | 42 | $xoops_module_url = $module_url.$blog_sub_path;
|
---|
| 43 |
|
---|
| 44 | $site_url_error = false;
|
---|
| 45 | if(strcmp($siteurl,$guess_url) !== 0) {
|
---|
[454] | 46 | if (!@fclose(@fopen($siteurl . '/xoops_version.php', "r"))){
|
---|
[548] | 47 | $site_url_error = true;
|
---|
[454] | 48 | }
|
---|
| 49 | }
|
---|
[548] | 50 | $home_url_error = false;
|
---|
| 51 | if(strcmp($guess_url,$home) !== 0) {
|
---|
| 52 | $home_url_error = true;
|
---|
| 53 | }
|
---|
| 54 | if ($site_url_error || $home_url_error){
|
---|
| 55 | include $xoops_config->xoops_root_path ."/header.php";
|
---|
| 56 | $form = '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n";
|
---|
| 57 | $form .= '<table cellspacing="1" cellpadding="1" border="0">';
|
---|
| 58 | $form .= '<tbody>';
|
---|
| 59 | if ($site_url_error){
|
---|
[549] | 60 | $site_url_error_log = __('Can not access WordPress address (URL).','xpressme');
|
---|
[548] | 61 | $form .= '<tr><td colspan="3"><font color="red"><b>' . $site_url_error_log . '</b></font></td></tr>';
|
---|
| 62 | $form .= '<tr>';
|
---|
| 63 | $form .= '<td width="16"> </td>';
|
---|
[549] | 64 | $form .= '<td width="64">'.__('WordPress address (URL)').'</td>';
|
---|
| 65 | $form .= '<td>';
|
---|
| 66 | $form .= $siteurl . '<br />';
|
---|
| 67 | $form .= ' to<br />';
|
---|
| 68 | $form .= '<input name="site_url_set" type="text" size="64" maxlength="200" value="' . $guess_url . '" /></td>';
|
---|
[548] | 69 | $form .= '</tr>';
|
---|
[475] | 70 |
|
---|
[454] | 71 | }
|
---|
[548] | 72 | if ($home_url_error){
|
---|
| 73 | if ($site_url_error) $form .= '<tr><td colspan="3"> </td></tr>';;
|
---|
[549] | 74 | $home_url_error_log = __('WordPress Blog address (URL) is different from access URL.','xpressme');
|
---|
[548] | 75 | $form .= '<tr><td colspan="3"><font color="red"><b>' . $home_url_error_log . '</b></font></td></tr>';
|
---|
| 76 | $form .= '<tr>';
|
---|
| 77 | $form .= '<td width="16"> </td>';
|
---|
[549] | 78 | $form .= '<td width="144">'. __('Blog address (URL)') .'</td>';
|
---|
| 79 | $form .= '<td>';
|
---|
| 80 | $form .= $home . '<br />';
|
---|
| 81 | $form .= ' to<br />';
|
---|
| 82 | $form .= '<input name="home_url_set" type="text" size="64" maxlength="200" value="' . $guess_url . '" /></td>';
|
---|
[548] | 83 | $form .= '</tr>';
|
---|
| 84 | }
|
---|
| 85 | $form .= '</tbody>';
|
---|
| 86 | $form .= '</table><br />';
|
---|
[549] | 87 | $form .= '<input type="submit" value= "'.__('Save Changes').'" name="submit_url_change" />' ."\n";
|
---|
| 88 | $form .= '</form>' ."\n";
|
---|
[548] | 89 | echo $form;
|
---|
| 90 | include $xoops_config->xoops_root_path . '/footer.php';
|
---|
| 91 | exit();
|
---|
[454] | 92 | }
|
---|
[549] | 93 | if (!empty($_POST['home_url_set'])) {
|
---|
| 94 | $url = get_option('home') . '/wp-admin/options-permalink.php';
|
---|
| 95 | $form = '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n";
|
---|
| 96 | $form .= '<p><font color="blue"><b>'. __('After Blog address (URL) is set, it is necessary to set the permalink again.','xpressme').'</b></font></p>';
|
---|
| 97 | $form .= '<input type="submit" value= "'.__('Permalink Settings').'" name="submit_redirect" />' ."\n";
|
---|
| 98 | $form .= '</form>' ."\n";
|
---|
| 99 | include $xoops_config->xoops_root_path ."/header.php";
|
---|
| 100 | echo $form;
|
---|
| 101 | include $xoops_config->xoops_root_path . '/footer.php';
|
---|
| 102 | exit();
|
---|
| 103 | }
|
---|
| 104 |
|
---|
[454] | 105 | }
|
---|
| 106 | }
|
---|
| 107 |
|
---|
[355] | 108 | require_once( dirname( __FILE__ ).'/request_url.php');
|
---|
| 109 | if (is_xpress_index_page_call()){
|
---|
[479] | 110 | //$_SERVER['REQUEST_METHOD'] = 'POST' is
|
---|
[360] | 111 | //When notifying by a private message, Notification_reserve_send();
|
---|
[358] | 112 | //it is evaded that the data base becomes read-only as a result of the check on the referrer and the method.
|
---|
[477] | 113 | $request_method = (isset($_SERVER['REQUEST_METHOD'])) ? $_SERVER['REQUEST_METHOD'] : '';
|
---|
[358] | 114 | $_SERVER['REQUEST_METHOD'] = 'POST';
|
---|
[355] | 115 | require_once $xoops_config->xoops_mainfile_path; //It is necessary to execute it for the user attestation before wp-settings.php.
|
---|
[477] | 116 | $_SERVER['REQUEST_METHOD'] = $request_method;
|
---|
[479] | 117 |
|
---|
| 118 | unset($offset); //This Trap is provides the case where $offset is defined on the XOOPS side.
|
---|
[355] | 119 | require_once(ABSPATH.'wp-settings.php');
|
---|
[454] | 120 |
|
---|
[479] | 121 | //When it is not possible to connect it correctly at site home URL on the WordPress side,
|
---|
| 122 | //URL is corrected based on accessed URL.
|
---|
[548] | 123 | global $xoopsUserIsAdmin;
|
---|
| 124 | if ($xoopsUserIsAdmin) safe_site_url();
|
---|
[454] | 125 |
|
---|
[355] | 126 | if (!is_object($xoopsUser)){ // before login auth cookie clear
|
---|
| 127 | wp_logout();
|
---|
| 128 | }
|
---|
| 129 | wp();
|
---|
| 130 |
|
---|
[421] | 131 | //for Event notification update on single post to which link is changed by permalink
|
---|
| 132 | if ( is_404() ) {
|
---|
| 133 | if (!empty($_POST['not_redirect'])) {
|
---|
| 134 | include '../../mainfile.php';
|
---|
| 135 | require_once XOOPS_ROOT_PATH.'/include/notification_update.php';
|
---|
| 136 | exit();
|
---|
| 137 | }
|
---|
| 138 | }
|
---|
| 139 |
|
---|
[355] | 140 | if (!function_exists('is_wordpress_style')){ // When the XPressME plug-in is invalid
|
---|
| 141 | require_once dirname( __FILE__ ).'/xpress_active_plugin.php' ;
|
---|
| 142 | xpress_pulugin_activation('xpressme/xpressme.php');
|
---|
| 143 | // reloaded
|
---|
| 144 | header('Location: ' . $xoops_config->module_url . '/');
|
---|
| 145 |
|
---|
| 146 | $err_str = "The activation of the XPressME plugin was executed.<br />\n";
|
---|
| 147 | $err_str .= "Because the XPressME plugin was invalid.<br />\n";
|
---|
| 148 | $err_str .= "Please do the rereading seeing on the page.\n";
|
---|
| 149 | die($err_str);
|
---|
| 150 | }
|
---|
[358] | 151 |
|
---|
| 152 | Notification_reserve_send();
|
---|
[355] | 153 | ob_start();
|
---|
[360] | 154 | if (version_compare($xoops_config->wp_version,'2.2', '<'))
|
---|
[355] | 155 | require_once dirname( __FILE__ ).'/old_template-loader.php' ;
|
---|
| 156 | else
|
---|
| 157 | require_once( ABSPATH . WPINC . '/template-loader.php' );
|
---|
| 158 | $wp_output = ob_get_contents();
|
---|
| 159 | ob_end_clean();
|
---|
[410] | 160 |
|
---|
| 161 | //Rendering Select
|
---|
| 162 | if(
|
---|
| 163 | is_wordpress_style() // When the display mode is WordPress style
|
---|
| 164 | || is_feed() // It judges it here because it does in is_index_page() through feed to which the permalink is set.
|
---|
| 165 | || is_iphone_with_wptouch() // When iPhone access & used wptouch plugin (thx uemu)
|
---|
| 166 | ){
|
---|
| 167 | echo $wp_output;
|
---|
[355] | 168 | } else {
|
---|
[410] | 169 | require_once( dirname( __FILE__ ).'/xpress_render.php' );
|
---|
| 170 | xpress_render($wp_output);
|
---|
[355] | 171 | }
|
---|
| 172 |
|
---|
| 173 | //When there is no block cache, and an optional block is different, cache is refreshed.
|
---|
| 174 | //When adding, and changing and deleting Post & Comment, block cache is refreshed by add_action at any time.
|
---|
| 175 | // This Function in xpressme plugin
|
---|
| 176 | require_once( dirname( __FILE__ ).'/xpress_block_render.php' );
|
---|
| 177 | xpress_unnecessary_block_cache_delete($xoops_config->module_name);
|
---|
| 178 | if (is_home()) xpress_block_cache_refresh($xoops_config->module_name);
|
---|
| 179 | exit(); // The return to wp-blog-header.php is stolen here
|
---|
| 180 | }
|
---|
[360] | 181 | if (is_admin_post_call()) require_once $xoops_config->xoops_mainfile_path; // for Notification_triggerEvent
|
---|
| 182 | if (is_xpress_comments_post_call()) require_once $xoops_config->xoops_mainfile_path; // for Notification_triggerEvent
|
---|
[355] | 183 | ?> |
---|