XPressME Integration Kit

Trac

Changeset 786


Ignore:
Timestamp:
Jun 1, 2011, 7:42:28 PM (13 years ago)
Author:
toemon
Message:

wpConfigInfoクラスをmofInfoクラスに統合
XE でWP-adminにアクセスした再 bootしないようにする。

Location:
trunk/xpressme_integration_kit
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/xpressme_integration_kit/class/modInfo_class.php

    r783 r786  
    1212 
    1313class modInfoClass { 
     14        var $db_name; 
     15        var $db_user; 
     16        var $db_pass; 
     17        var $db_host; 
     18        var $db_salt; 
     19        var $xoops_db_prefix; 
     20        var $module_db_prefix; 
     21         
    1422        var $xoops_mainfile_path; 
    1523        var $xoops_root_path; 
     
    2230        var $xoops_db_salt; 
    2331        var $xoops_salt; 
    24         var $xoops_db_prefix; 
    2532        var $xoops_language; 
    26         var $module_db_prefix; 
    2733        var $module_name; 
    2834        var $module_path; 
     
    4147        var $wp_version; 
    4248        var $wpConfigInfo; 
    43          
     49        var $factory; 
     50        var $module; 
     51        var $langInfo; 
    4452        function __constructor()        //for PHP5 
    4553    { 
     
    5058    function modInfoClass()     //for PHP4 constructor 
    5159    {   
    52         global $xoopsModule,$wpConfigInfo,$xoopsConfig; 
    53         if (!is_object($wpConfigInfo)){ 
    54                 include_once dirname(__FILE__).'/wpConfigInfo_class.php'; 
    55                 $this->wpConfigInfo = new wpConfigInfoClass; 
    56         } 
     60        global $xoopsModule; 
     61 
     62                 
    5763        if (! is_object($xoopsModule)){ 
    58                         $module_handler =& xoops_gethandler('module'); 
    59                         $xoopsModule =& $module_handler->getByDirname(basename(dirname(dirname(__FILE__)))); 
    60                 }        
    61  
    62         $this->xoops_root_path = XOOPS_ROOT_PATH; 
     64//                      $module_handler =& xoops_gethandler('module'); 
     65//                      $xoopsModule =& $module_handler->getByDirname(basename(dirname(dirname(__FILE__)))); 
     66                } 
     67                $this->_branches_cores(); 
     68                if ($this->is_xoops_legacy) $this->factory = XOOPS::factory(); 
     69                if (is_object($this->factory)){ 
     70//                      $module_handler = & XOOPS::getHandle('module'); 
     71                } else { 
     72//                      $module_handler =& xoops_gethandler('module'); 
     73                } 
     74//              $this->module =& $module_handler->getByDirname(basename(dirname(dirname(__FILE__)))); 
     75                $this->_get_db_ini(); 
     76                $this->module_db_prefix = $this->_get_module_db_prefix(); 
     77        $this->xoops_root_path = $this->_get_xoops_root_path(); 
    6378                $this->xoops_trust_path = (defined('XOOPS_TRUST_PATH')) ? XOOPS_TRUST_PATH : ''; 
    64                 $this->xoops_url = XOOPS_URL; 
    65         $this->xoops_mainfile_path = XOOPS_ROOT_PATH . '/mainfile.php'; 
    66                 $this->xoops_upload_path = XOOPS_UPLOAD_PATH; 
    67                 $this->xoops_upload_url = XOOPS_UPLOAD_URL; 
    68                 $this->xoops_cache_path = XOOPS_CACHE_PATH; 
     79                $this->xoops_var_path = $this->_get_xoops_var_path(); 
     80                $this->xoops_url = $this->_get_xoops_url(); 
     81        $this->xoops_mainfile_path = $this->xoops_root_path . '/mainfile.php'; 
     82                $this->xoops_upload_path = $this->_get_xoops_upload_path(); 
     83                $this->xoops_upload_url = $this->_get_xoops_upload_url(); 
     84                $this->xoops_cache_path = $this->_get_xoops_cache_path(); 
    6985        $this->module_path=dirname(dirname(__FILE__)); 
    7086        $this->module_name=basename($this->module_path); 
    7187                $this->module_url = $this->xoops_url . '/modules/' . $this->module_name; 
    72                 $this->xoops_db_prefix = XOOPS_DB_PREFIX . '_'; 
    73                 $this->module_db_prefix = $this->_get_module_db_prefix(); 
    7488                $this->xoops_lang =  @$GLOBALS["xoopsConfig"]['language']; 
    7589                $this->module_id = ! empty($xoopsModule) ? $xoopsModule->getVar('mid') : 0; 
     
    86100                        $this->xoops_time_zone = $xoopsConfig['default_TZ']; 
    87101                } 
     102                require_once dirname( __FILE__ ).'/langInfo_class.php' ; 
     103                $this->langInfo = new langInfoClass; 
    88104    } 
    89  
     105    function _get_xoops_root_path(){ 
     106        if (defined('XOOPS_ROOT_PATH')) return XOOPS_ROOT_PATH; 
     107        return $this->factory->path('www');     //XOOPS Engine 
     108        } 
     109    function _get_xoops_var_path(){ 
     110        if (defined('XOOPS_VAR_PATH')) return XOOPS_VAR_PATH; 
     111        return $this->factory->path('var');     //XOOPS Engine 
     112        } 
     113    function _get_xoops_cache_path(){ 
     114        if (defined('XOOPS_CACHE_PATH')) return XOOPS_CACHE_PATH; 
     115        return $this->factory->path('var'). "/cache/system";    //XOOPS Engine 
     116        } 
     117    function _get_xoops_url(){ 
     118        if (defined('XOOPS_URL')) return XOOPS_URL; 
     119        return $this->factory->url('',true);    //XOOPS Engine 
     120        } 
     121    function _get_xoops_upload_path(){ 
     122        if (defined('XOOPS_UPLOAD_PATH')) return XOOPS_UPLOAD_PATH; 
     123        return $this->factory->path('upload');  //XOOPS Engine 
     124        } 
     125    function _get_xoops_upload_url(){ 
     126        if (defined('XOOPS_UPLOAD_URL')) return XOOPS_UPLOAD_URL; 
     127        return $this->factory->url('upload',true);      //XOOPS Engine 
     128        }        
     129         
     130        function _get_db_ini(){ 
     131                if (defined('XOOPS_DB_NAME')){ 
     132                        $this->xoops_db_prefix = XOOPS_DB_PREFIX . '_'; 
     133                        $this->db_name = XOOPS_DB_NAME; 
     134                        $this->db_user = XOOPS_DB_USER; 
     135                        $this->db_pass = XOOPS_DB_PASS; 
     136                        $this->db_host = XOOPS_DB_HOST; 
     137                        return; 
     138                } 
     139 
     140                if(!defined('XOOPS_VAR_PATH') ) { 
     141                        $var_path = $this->factory->path('var');        //XOOPS Engine 
     142                } else { 
     143                        $var_path = XOOPS_VAR_PATH; 
     144                } 
     145                $def_file = $var_path . '/etc/resource.db.ini.php'; 
     146                if(! file_exists($def_file)) return; 
     147                $array_file = file($def_file); 
     148                foreach ($array_file as $line){ 
     149                        if (preg_match('/^\s*dbname\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs)) 
     150                                $this->db_name = $matchs[1]; 
     151                        if (preg_match('/^\s*host\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs)) 
     152                                $this->db_host = $matchs[1]; 
     153                        if (preg_match('/^\s*username\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs)) 
     154                                $this->db_user = $matchs[1]; 
     155                        if (preg_match('/^\s*password\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs)) 
     156                                $this->db_pass = $matchs[1]; 
     157                        if (preg_match('/^\s*prefix\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs)) 
     158                                $this->xoops_db_prefix = $matchs[1].'_'; 
     159                } 
     160        } 
    90161        function _get_module_db_prefix(){ 
    91         $module_db_prefix = XOOPS_DB_PREFIX . '_' . preg_replace('/wordpress/','wp',$this->module_name); 
     162                $module_name = basename(dirname(dirname(__FILE__))); 
     163        $module_db_prefix = $this->xoops_db_prefix . preg_replace('/wordpress/','wp',$module_name) . '_'; 
    92164        return $module_db_prefix; 
    93165        } 
     166 
    94167    function _branches_cores(){ 
    95168        /*  XOOPS include/version.php define value */ 
     
    106179                $this->is_xoops_legacy = false; 
    107180                $this->is_jpex = false; 
    108                  
     181                if (!defined('XOOPS_VERSION')){ 
     182                        $root_path = dirname(dirname(dirname(dirname(__FILE__)))); 
     183                        include_once $root_path . '/include/version.php'; 
     184                } 
    109185                $version = XOOPS_VERSION; 
    110186                 
    111187                 
    112188        // branches by cores 
    113                 if( preg_match('/JP$/', $this->xoops_version)) 
     189                if( preg_match('/JP$/', $version)) 
    114190                        $this->is_xoops2jp = true; 
    115                 if( preg_match('/Cube\s*Legacy/', $this->xoops_version)) 
     191                if( preg_match('/Cube\s*Legacy/', $version)) 
    116192                        $this->is_cube_legacy = true; 
    117                 if( preg_match('/ImpressCMS/', $this->xoops_version)) 
     193                if( preg_match('/ImpressCMS/', $version)) 
    118194                        $this->is_impress_cms = true; 
    119                 if( preg_match('/JPEx/', $this->xoops_version)) 
     195                if( preg_match('/JPEx/', $version)) 
    120196                        $this->is_jpex = true; 
    121                 if( preg_match('/XOOPS\s*[0-9|\.]*$/', $this->xoops_version)) 
     197                if( preg_match('/XOOPS\s*[0-9|\.]*$/', $version)) 
    122198                        $this->is_xoops2 = true; 
    123                 if( preg_match('/Xoops\s*Legacy/', $this->xoops_version)) 
     199                if( preg_match('/Xoops\s*Legacy/', $version)) 
    124200                        $this->is_xoops_legacy = true; 
    125201        } 
     
    150226                return $this->xoops_db_prefix; 
    151227        } 
     228        function get_module_db_prefix($module_dirnam=''){ 
     229                if (empty($module_dirname)){ 
     230                        return $this->module_db_prefix; 
     231                } else { 
     232                $module_db_prefix = $this->xoops_db_prefix . preg_replace('/wordpress/','wp',$module_dirname) . '_'; 
     233                return $module_db_prefix;                
     234                } 
     235        } 
     236        function get_db_name(){ 
     237                return $this->db_name; 
     238        } 
     239        function get_db_user(){ 
     240                return $this->db_user; 
     241        } 
     242        function get_db_pass(){ 
     243                return $this->db_pass; 
     244        } 
     245        function get_db_host(){ 
     246                return $this->db_host; 
     247        } 
     248        function get_db_salt(){ 
     249                return $this->db_salt; 
     250        } 
     251        function get_wpLang($xoops_lang=''){ 
     252                return $this->langInfo->get_wpLang($xoops_lang); 
     253        } 
    152254         
    153255        function get_xoops_root_path(){ 
     
    194296                return $this->module_url; 
    195297        } 
    196         function get_module_db_prefix(){ 
    197                 return $this->xpress_db_prefix; 
    198         } 
    199298        function get_xoops_time_zone(){ 
    200299                return $this->xoops_time_zone; 
     
    233332         
    234333        function get_moduleID_ByDirname($dir_name){ 
     334                if (! function_exists('xoops_gethandler')) return ''; 
    235335                $module_handler =& xoops_gethandler('module'); 
    236336                $module =& $module_handler->getByDirname($dir_name); 
     
    314414                return $SV; 
    315415        } 
    316         public function get_mod_image_link($file_name='')  
     416        function get_mod_image_link($file_name='')  
    317417        { 
    318418                $link_url = ''; 
     
    324424                return $link_url; 
    325425        } 
    326         function get_wpLang($xoops_lang=''){ 
    327                 return $this->wpConfigInfo->get_wpLang($xoops_lang); 
    328         } 
    329426         
    330427} 
  • trunk/xpressme_integration_kit/include/add_xpress_config.php

    r782 r786  
    99if ( defined('WP_ADMIN') )      { 
    1010        $nocommon_scripts = array( 
     11                'wp-admin', 
    1112                'wp-admin/async-upload.php', 
    1213        ); 
    1314        foreach($nocommon_scripts as $nocommon_script){ 
    1415                if (strstr($_SERVER['SCRIPT_NAME'],$nocommon_script) !== false) { 
    15                         $xoopsOption['nocommon'] = 1; 
     16                        defined('XOOPS_BOOTSTRAP') or define('XOOPS_BOOTSTRAP', false); // For XE 
     17                        $xoopsOption['nocommon'] = 1;                                                                   // For Other 
    1618                        break; 
    1719                } 
     
    2426 
    2527require_once dirname( __FILE__ ).'/xpress_debug_log.php' ; 
    26 require_once dirname(dirname( __FILE__ )).'/class/wpConfigInfo_class.php' ; 
    27 $wpConfigInfo = new wpConfigInfoClass; 
    2828require_once dirname(dirname( __FILE__ )).'/class/modInfo_class.php' ; 
    2929$modInfo = new modInfoClass; 
    30 require_once dirname(dirname( __FILE__ )).'/class/userInfo_class.php' ; 
    31 $userInfo = new userInfoClass; 
     30//require_once dirname(dirname( __FILE__ )).'/class/userInfo_class.php' ; 
     31//$userInfo = new userInfoClass; 
     32 
    3233require_once dirname( __FILE__ ).'/set_cash_cookie_path.php' ; 
     34 
     35 
    3336?> 
Note: See TracChangeset for help on using the changeset viewer.