[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(){
|
---|
| 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;
|
---|
[475] | 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) {
|
---|
[454] | 21 | if (!@fclose(@fopen($siteurl . '/xoops_version.php', "r"))){
|
---|
| 22 | update_option('siteurl' , $module_url);
|
---|
| 23 | }
|
---|
| 24 | }
|
---|
[475] | 25 |
|
---|
| 26 | if(strcmp($guess_ur,$home) !== 0) {
|
---|
| 27 | if (@fclose(@fopen($guess_url . '/xoops_version.php', "r"))){
|
---|
[454] | 28 | update_option('home' , $guess_url);
|
---|
| 29 | }
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
| 33 |
|
---|
[355] | 34 | require_once( dirname( __FILE__ ).'/request_url.php');
|
---|
| 35 | if (is_xpress_index_page_call()){
|
---|
[479] | 36 | //$_SERVER['REQUEST_METHOD'] = 'POST' is
|
---|
[360] | 37 | //When notifying by a private message, Notification_reserve_send();
|
---|
[358] | 38 | //it is evaded that the data base becomes read-only as a result of the check on the referrer and the method.
|
---|
[477] | 39 | $request_method = (isset($_SERVER['REQUEST_METHOD'])) ? $_SERVER['REQUEST_METHOD'] : '';
|
---|
[358] | 40 | $_SERVER['REQUEST_METHOD'] = 'POST';
|
---|
[355] | 41 | require_once $xoops_config->xoops_mainfile_path; //It is necessary to execute it for the user attestation before wp-settings.php.
|
---|
[477] | 42 | $_SERVER['REQUEST_METHOD'] = $request_method;
|
---|
[479] | 43 |
|
---|
| 44 | unset($offset); //This Trap is provides the case where $offset is defined on the XOOPS side.
|
---|
[355] | 45 | require_once(ABSPATH.'wp-settings.php');
|
---|
[454] | 46 |
|
---|
[479] | 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.
|
---|
[454] | 49 | safe_site_url();
|
---|
| 50 |
|
---|
[355] | 51 | if (!is_object($xoopsUser)){ // before login auth cookie clear
|
---|
| 52 | wp_logout();
|
---|
| 53 | }
|
---|
| 54 | wp();
|
---|
| 55 |
|
---|
[421] | 56 | //for Event notification update on single post to which link is changed by permalink
|
---|
| 57 | if ( is_404() ) {
|
---|
| 58 | if (!empty($_POST['not_redirect'])) {
|
---|
| 59 | include '../../mainfile.php';
|
---|
| 60 | require_once XOOPS_ROOT_PATH.'/include/notification_update.php';
|
---|
| 61 | exit();
|
---|
| 62 | }
|
---|
| 63 | }
|
---|
| 64 |
|
---|
[355] | 65 | if (!function_exists('is_wordpress_style')){ // When the XPressME plug-in is invalid
|
---|
| 66 | require_once dirname( __FILE__ ).'/xpress_active_plugin.php' ;
|
---|
| 67 | xpress_pulugin_activation('xpressme/xpressme.php');
|
---|
| 68 | // reloaded
|
---|
| 69 | header('Location: ' . $xoops_config->module_url . '/');
|
---|
| 70 |
|
---|
| 71 | $err_str = "The activation of the XPressME plugin was executed.<br />\n";
|
---|
| 72 | $err_str .= "Because the XPressME plugin was invalid.<br />\n";
|
---|
| 73 | $err_str .= "Please do the rereading seeing on the page.\n";
|
---|
| 74 | die($err_str);
|
---|
| 75 | }
|
---|
[358] | 76 |
|
---|
| 77 | Notification_reserve_send();
|
---|
[355] | 78 | ob_start();
|
---|
[360] | 79 | if (version_compare($xoops_config->wp_version,'2.2', '<'))
|
---|
[355] | 80 | require_once dirname( __FILE__ ).'/old_template-loader.php' ;
|
---|
| 81 | else
|
---|
| 82 | require_once( ABSPATH . WPINC . '/template-loader.php' );
|
---|
| 83 | $wp_output = ob_get_contents();
|
---|
| 84 | ob_end_clean();
|
---|
[410] | 85 |
|
---|
| 86 | //Rendering Select
|
---|
| 87 | if(
|
---|
| 88 | is_wordpress_style() // When the display mode is WordPress style
|
---|
| 89 | || is_feed() // It judges it here because it does in is_index_page() through feed to which the permalink is set.
|
---|
| 90 | || is_iphone_with_wptouch() // When iPhone access & used wptouch plugin (thx uemu)
|
---|
| 91 | ){
|
---|
| 92 | echo $wp_output;
|
---|
[355] | 93 | } else {
|
---|
[410] | 94 | require_once( dirname( __FILE__ ).'/xpress_render.php' );
|
---|
| 95 | xpress_render($wp_output);
|
---|
[355] | 96 | }
|
---|
| 97 |
|
---|
| 98 | //When there is no block cache, and an optional block is different, cache is refreshed.
|
---|
| 99 | //When adding, and changing and deleting Post & Comment, block cache is refreshed by add_action at any time.
|
---|
| 100 | // This Function in xpressme plugin
|
---|
| 101 | require_once( dirname( __FILE__ ).'/xpress_block_render.php' );
|
---|
| 102 | xpress_unnecessary_block_cache_delete($xoops_config->module_name);
|
---|
| 103 | if (is_home()) xpress_block_cache_refresh($xoops_config->module_name);
|
---|
| 104 | exit(); // The return to wp-blog-header.php is stolen here
|
---|
| 105 | }
|
---|
[360] | 106 | if (is_admin_post_call()) require_once $xoops_config->xoops_mainfile_path; // for Notification_triggerEvent
|
---|
| 107 | if (is_xpress_comments_post_call()) require_once $xoops_config->xoops_mainfile_path; // for Notification_triggerEvent
|
---|
[355] | 108 | ?> |
---|