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