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 | * There is a function that detects the kind of the page that the access is here.
|
---|
13 | */
|
---|
14 | function check_page_call($check_file =''){
|
---|
15 | global $xoops_config; // not object at install
|
---|
16 | if (empty($check_file)) return false;
|
---|
17 | $xpress_page = basename(dirname(dirname(__FILE__))) . '/' . $check_file;
|
---|
18 | $php_script_name = $_SERVER['SCRIPT_NAME'];
|
---|
19 | $php_query_string = $_SERVER['QUERY_STRING'];
|
---|
20 | if (strstr($php_script_name,$xpress_page) === false) return false;
|
---|
21 | if ($check_file !== 'index.php' ) return true;
|
---|
22 | // index.php check
|
---|
23 | if (strstr($php_query_string,'preview') === false) {
|
---|
24 | if (strstr($php_query_string,'feed') === false) {
|
---|
25 | return true;
|
---|
26 | }
|
---|
27 | }
|
---|
28 | return false;
|
---|
29 | }
|
---|
30 |
|
---|
31 | function is_xpress_index_page_call(){
|
---|
32 | return check_page_call('index.php');
|
---|
33 | }
|
---|
34 |
|
---|
35 | function is_admin_page_call(){
|
---|
36 | return check_page_call('wp-admin');
|
---|
37 | }
|
---|
38 |
|
---|
39 | function is_media_upload_page_call(){
|
---|
40 | return check_page_call('wp-admin/async-upload.php');
|
---|
41 | }
|
---|
42 |
|
---|
43 | function is_wp_cron_page_call(){
|
---|
44 | return check_page_call('wp-cron.php');
|
---|
45 | }
|
---|
46 |
|
---|
47 | function is_admin_post_call(){
|
---|
48 | return check_page_call('wp-admin/post.php');
|
---|
49 | }
|
---|
50 |
|
---|
51 | function is_xmlrpc_call(){
|
---|
52 | $ret = check_page_call('xmlrpc.php');
|
---|
53 |
|
---|
54 | $xmlrpc_debug = 0;
|
---|
55 | if ($xmlrpc_debug && $ret) {
|
---|
56 | xpress_debug_message('is_xmlrpc_call()'. "\n" . sprint_r($_SERVER) );
|
---|
57 | }
|
---|
58 | return $ret;
|
---|
59 | }
|
---|
60 |
|
---|
61 | function is_xpress_install_call(){
|
---|
62 | $action = 'action=ModuleInstall&dirname=';
|
---|
63 | $php_script_name = $_SERVER['SCRIPT_NAME'];
|
---|
64 | $php_query_string = $_SERVER['QUERY_STRING'];
|
---|
65 | if (strstr($php_query_string,$action) !== false) return true;
|
---|
66 | return false;
|
---|
67 | }
|
---|
68 | ?>
|
---|