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 |
|
---|
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 | 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 | }
|
---|
28 |
|
---|
29 | $siteurl = get_option('siteurl');
|
---|
30 | $home = get_option('home');
|
---|
31 | $module_url = $xoops_config->module_url;
|
---|
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'] );
|
---|
35 | $blog_sub_path = '';
|
---|
36 | if(function_exists('is_multisite') && is_multisite()){
|
---|
37 | if ($blog_id > 1){
|
---|
38 | $blog_sub_path = '/' .$blogname;
|
---|
39 | }
|
---|
40 | }
|
---|
41 | $guess_url .= $blog_sub_path;
|
---|
42 | $xoops_module_url = $module_url.$blog_sub_path;
|
---|
43 |
|
---|
44 | $site_url_error = false;
|
---|
45 | if(strcmp($siteurl,$guess_url) !== 0) {
|
---|
46 | if (!@fclose(@fopen($siteurl . '/xoops_version.php', "r"))){
|
---|
47 | $site_url_error = true;
|
---|
48 | }
|
---|
49 | }
|
---|
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){
|
---|
60 | $site_url_error_log = __('Can not access WordPress address (URL).','xpressme');
|
---|
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>';
|
---|
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>';
|
---|
69 | $form .= '</tr>';
|
---|
70 |
|
---|
71 | }
|
---|
72 | if ($home_url_error){
|
---|
73 | if ($site_url_error) $form .= '<tr><td colspan="3"> </td></tr>';;
|
---|
74 | $home_url_error_log = __('WordPress Blog address (URL) is different from access URL.','xpressme');
|
---|
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>';
|
---|
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>';
|
---|
83 | $form .= '</tr>';
|
---|
84 | }
|
---|
85 | $form .= '</tbody>';
|
---|
86 | $form .= '</table><br />';
|
---|
87 | $form .= '<input type="submit" value= "'.__('Save Changes').'" name="submit_url_change" />' ."\n";
|
---|
88 | $form .= '</form>' ."\n";
|
---|
89 | echo $form;
|
---|
90 | include $xoops_config->xoops_root_path . '/footer.php';
|
---|
91 | exit();
|
---|
92 | }
|
---|
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 |
|
---|
105 | }
|
---|
106 | }
|
---|
107 |
|
---|
108 | require_once( dirname( __FILE__ ).'/request_url.php');
|
---|
109 | if (is_xpress_index_page_call()){
|
---|
110 | //$_SERVER['REQUEST_METHOD'] = 'POST' is
|
---|
111 | //When notifying by a private message, Notification_reserve_send();
|
---|
112 | //it is evaded that the data base becomes read-only as a result of the check on the referrer and the method.
|
---|
113 | $request_method = (isset($_SERVER['REQUEST_METHOD'])) ? $_SERVER['REQUEST_METHOD'] : '';
|
---|
114 | $_SERVER['REQUEST_METHOD'] = 'POST';
|
---|
115 | require_once $xoops_config->xoops_mainfile_path; //It is necessary to execute it for the user attestation before wp-settings.php.
|
---|
116 | $_SERVER['REQUEST_METHOD'] = $request_method;
|
---|
117 |
|
---|
118 | unset($offset); //This Trap is provides the case where $offset is defined on the XOOPS side.
|
---|
119 | require_once(ABSPATH.'wp-settings.php');
|
---|
120 |
|
---|
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.
|
---|
123 | global $xoopsUserIsAdmin;
|
---|
124 | if ($xoopsUserIsAdmin) safe_site_url();
|
---|
125 |
|
---|
126 | if (!is_object($xoopsUser)){ // before login auth cookie clear
|
---|
127 | wp_logout();
|
---|
128 | }
|
---|
129 | wp();
|
---|
130 |
|
---|
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 |
|
---|
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 | }
|
---|
151 |
|
---|
152 | Notification_reserve_send();
|
---|
153 | ob_start();
|
---|
154 | if (version_compare($xoops_config->wp_version,'2.2', '<'))
|
---|
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();
|
---|
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;
|
---|
168 | } else {
|
---|
169 | require_once( dirname( __FILE__ ).'/xpress_render.php' );
|
---|
170 | xpress_render($wp_output);
|
---|
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 | }
|
---|
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
|
---|
183 | ?> |
---|