1 | <?php
|
---|
2 | /*
|
---|
3 | * XPressME - WordPress for XOOPS
|
---|
4 | *
|
---|
5 | * @copyright XPressME Project http://www.toemon.com
|
---|
6 | * @license http://www.fsf.org/copyleft/gpl.html GNU public license
|
---|
7 | * @author toemon
|
---|
8 | * @package module::xpress
|
---|
9 | */
|
---|
10 |
|
---|
11 | /*
|
---|
12 | * The module loads the XOOPS system only at the time of reading to route index.php.
|
---|
13 | *
|
---|
14 | * When "Media up-loading" is executed, WordPress calls the SWFUpload script.
|
---|
15 | * After completing up-loading
|
---|
16 | * The SWFUpload script executes wp-admin/async-upload.php.
|
---|
17 | * At this time, session ID is not succeeded to.
|
---|
18 | * And, admin/async-upload.php becomes an access inhibit when wordpress is under the management of XOOPS.
|
---|
19 | */
|
---|
20 |
|
---|
21 | function is_xpress_index_page_call(){
|
---|
22 | $xpress_root_index = basename(dirname(dirname( __FILE__ ))) . '/index.php';
|
---|
23 | $php_script_name = $_SERVER['SCRIPT_NAME'];
|
---|
24 | $php_query_string = $_SERVER['QUERY_STRING'];
|
---|
25 | if (strstr($php_script_name,$xpress_root_index) !== false) {
|
---|
26 | if (strstr($php_query_string,'preview') === false) return true; else return false;;
|
---|
27 | } else {
|
---|
28 | return false;
|
---|
29 | }
|
---|
30 | }
|
---|
31 |
|
---|
32 | function is_admin_page_call(){
|
---|
33 | $xpress_root_index = basename(dirname(dirname( __FILE__ ))) . '/wp-admin';
|
---|
34 | $php_script_name = $_SERVER['SCRIPT_NAME'];
|
---|
35 | if (strstr($php_script_name,$xpress_root_index) !== false) return true; else return false;
|
---|
36 | }
|
---|
37 |
|
---|
38 | function is_media_upload_page_call(){
|
---|
39 | $xpress_root_indexs[0] = basename(dirname(dirname( __FILE__ ))) . '/wp-admin/async-upload.php';
|
---|
40 | $php_script_name = $_SERVER['SCRIPT_NAME'];
|
---|
41 | foreach ($xpress_root_indexs as $xpress_root_index) {
|
---|
42 | if (strstr($php_script_name,$xpress_root_index) !== false) return true;
|
---|
43 | }
|
---|
44 | return false;
|
---|
45 | }
|
---|
46 |
|
---|
47 | function is_xmlrpc_call(){
|
---|
48 |
|
---|
49 | $xpress_root_index = basename(dirname(dirname( __FILE__ ))) . '/xmlrpc.php';
|
---|
50 | $php_script_name = $_SERVER['SCRIPT_NAME'];
|
---|
51 | if(strstr($php_script_name,$xpress_root_index) !== false) $ret = true; else $ret = false;
|
---|
52 | $xmlrpc_debug = 0;
|
---|
53 |
|
---|
54 |
|
---|
55 | if ($xmlrpc_debug) {
|
---|
56 | $_debug_file = './wp-content/debug.log';
|
---|
57 | $log_data = '';
|
---|
58 | $log_data .= 'is_xmlrpc_call()***********************************************************************'. "\n";
|
---|
59 | if ($ret) $ret_val = 'true'; else $ret_val = 'false';
|
---|
60 | $log_data .= 'return value = ' . $ret_val . "\n";
|
---|
61 |
|
---|
62 | foreach($_SERVER as $key => $value){
|
---|
63 | $log_data .= $key . ' = ' . $value . "\n";
|
---|
64 | }
|
---|
65 |
|
---|
66 | $_fp = fopen($_debug_file, 'a');
|
---|
67 | fwrite($_fp, $log_data);
|
---|
68 | fwrite($_fp, "\n\n");
|
---|
69 | fclose($_fp);
|
---|
70 | }
|
---|
71 | return $ret;
|
---|
72 | }
|
---|
73 |
|
---|
74 | function is_wp_cron_call(){
|
---|
75 | $xpress_root_index = basename(dirname(dirname( __FILE__ ))) . '/wp-cron.php';
|
---|
76 | $php_script_name = $_SERVER['SCRIPT_NAME'];
|
---|
77 | if (strstr($php_script_name,$xpress_root_index) !== false) return true; else return false;
|
---|
78 | }
|
---|
79 |
|
---|
80 |
|
---|
81 | if (is_wp_cron_call() ){
|
---|
82 | $_SERVER['HTTP_REFERER'] = 'http://'. $_SERVER[HTTP_HOST] . $_SERVER['PHP_SELF'];
|
---|
83 | $_SERVER['REQUEST_METHOD'] = 'POST';
|
---|
84 | }
|
---|
85 |
|
---|
86 | if (is_media_upload_page_call() ){
|
---|
87 | if ( !defined("XOOPS_ROOT_PATH") ) {
|
---|
88 | //Module process will not load any XOOPS Cube classes.
|
---|
89 | define('_LEGACY_PREVENT_EXEC_COMMON_', 1); // for XCL
|
---|
90 | $xoopsOption['nocommon'] = 1; // for XOOPS
|
---|
91 | include_once dirname( __FILE__ ).'/../../../mainfile.php';
|
---|
92 | }
|
---|
93 | if (!defined("XOOPS_UPLOAD_PATH"))
|
---|
94 | define("XOOPS_UPLOAD_PATH", XOOPS_ROOT_PATH."/uploads");
|
---|
95 | if (!defined("XOOPS_UPLOAD_URL"))
|
---|
96 | define("XOOPS_UPLOAD_URL", XOOPS_URL."/uploads");
|
---|
97 | } else {
|
---|
98 | // index page is load xoops
|
---|
99 | require dirname( __FILE__ ).'/../../../mainfile.php' ;
|
---|
100 | }
|
---|
101 | ?>
|
---|