XPressME Integration Kit

Trac

source: trunk/include/include_xoops_define.php @ 60

Last change on this file since 60 was 60, checked in by toemon, 15 years ago

SWFuploadのセッション問題を回避するために、WordPress管理画面ではXOOPSの定数だけを読み込むようにしていたが、イベント通知でXoopsシステムを必要とする場合もあるので、preloadフォルダ内のActionFilter呼び出しとか、ユーザー認証及びセッション管理、xoopsConfigの読み込み、モジュール情報の初期化などを省いたサブセットを利用するものとした。
参考 http://www.nobunobu.com/blog/2006/11/12/xoopsoptionnocommon/

どの部分まで読み込めば、イベント通知が可能かわからないので、まずはこの状態でイベント通知の確認を行う
ただこれらのやり方はXCL専用となっていますので、出来れば
$xoopsOptionnocommon?)=1;
include '../../mainfile.php';
の状態でイベント通知が可能であれば XCL専用というしがらみから抜けられるのだけど・・・

File size: 1.9 KB
Line 
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
21function is_root_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
32function 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
38if (is_admin_page_call()){
39        if ( !defined("XOOPS_ROOT_PATH") ) {   
40//              define('_LEGACY_PREVENT_LOAD_CORE_', 1);                //Module process will not load any XOOPS Cube classes.
41                define('_LEGACY_PREVENT_EXEC_COMMON_', 1);     
42                include_once dirname( __FILE__ ).'/../../../mainfile.php';
43                $root=&XCube_Root::getSingleton();
44                $root->mController->executeCommonSubset();
45        }
46        if (!defined("XOOPS_UPLOAD_PATH"))
47                define("XOOPS_UPLOAD_PATH", XOOPS_ROOT_PATH."/uploads");
48        if (!defined("XOOPS_UPLOAD_URL"))
49                define("XOOPS_UPLOAD_URL", XOOPS_URL."/uploads");
50} else {
51        // index page is load xoops
52        require dirname( __FILE__ ).'/../../../mainfile.php' ;
53}
54?>
Note: See TracBrowser for help on using the repository browser.