| 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 |                         // Because the judgment is difficult, the feed to which the permalink is set is confirmed here by the after processing. 
 | 
|---|
| 26 |                         return true;
 | 
|---|
| 27 |                 }
 | 
|---|
| 28 |         }
 | 
|---|
| 29 |         return false;
 | 
|---|
| 30 | }
 | 
|---|
| 31 | 
 | 
|---|
| 32 | function is_xpress_comments_post_call(){
 | 
|---|
| 33 |         return check_page_call('wp-comments-post.php');
 | 
|---|
| 34 | }
 | 
|---|
| 35 | 
 | 
|---|
| 36 | function is_xpress_index_page_call(){
 | 
|---|
| 37 |         return check_page_call('index.php');
 | 
|---|
| 38 | }
 | 
|---|
| 39 | 
 | 
|---|
| 40 | function is_admin_page_call(){
 | 
|---|
| 41 |         return check_page_call('wp-admin');
 | 
|---|
| 42 | }
 | 
|---|
| 43 | 
 | 
|---|
| 44 | function is_media_upload_page_call(){
 | 
|---|
| 45 |         return check_page_call('wp-admin/async-upload.php');
 | 
|---|
| 46 | }
 | 
|---|
| 47 | 
 | 
|---|
| 48 | function is_wp_cron_page_call(){
 | 
|---|
| 49 |         return check_page_call('wp-cron.php');
 | 
|---|
| 50 | }
 | 
|---|
| 51 | 
 | 
|---|
| 52 | function is_admin_post_call(){
 | 
|---|
| 53 |         return check_page_call('wp-admin/post.php');
 | 
|---|
| 54 | }
 | 
|---|
| 55 | 
 | 
|---|
| 56 | function is_xmlrpc_call(){
 | 
|---|
| 57 |         $ret =  check_page_call('xmlrpc.php');
 | 
|---|
| 58 | 
 | 
|---|
| 59 |         $xmlrpc_debug = 0;
 | 
|---|
| 60 |         if ($xmlrpc_debug && $ret) {
 | 
|---|
| 61 |                 xpress_debug_message('is_xmlrpc_call()'. "\n" . sprint_r($_SERVER) );
 | 
|---|
| 62 |         }
 | 
|---|
| 63 |         return $ret;
 | 
|---|
| 64 | }
 | 
|---|
| 65 | 
 | 
|---|
| 66 | function is_xpress_install_call(){
 | 
|---|
| 67 |         $action = 'action=ModuleInstall&dirname=';
 | 
|---|
| 68 |         $php_script_name = $_SERVER['SCRIPT_NAME'];
 | 
|---|
| 69 |         $php_query_string = $_SERVER['QUERY_STRING'];
 | 
|---|
| 70 |         if (strstr($php_query_string,$action) !== false) return true;
 | 
|---|
| 71 |         return false;
 | 
|---|
| 72 | }
 | 
|---|
| 73 | ?>
 | 
|---|