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