|
- // 获取插件模块
- function pluginmodule($pluginid, $type) {
- global $_G;
- $pluginid = $pluginid ? preg_replace("/[^A-Za-z0-9_:]/", '', $pluginid) : '';
- if(!isset($_G['cache']['plugin'])) {
- loadcache('plugin');
- }
- list($identifier, $module) = explode(':', $pluginid);
- if(!is_array($_G['setting']['plugins'][$type]) || !array_key_exists($pluginid, $_G['setting']['plugins'][$type])) {
- showmessage('plugin_nonexistence');
- }
- if(!empty($_G['setting']['plugins'][$type][$pluginid]['url'])) {
- dheader('location: '.$_G['setting']['plugins'][$type][$pluginid]['url']);
- }
- $directory = $_G['setting']['plugins'][$type][$pluginid]['directory'];
- if(empty($identifier) || !preg_match("/^[a-z]+[a-z0-9_]*\/$/i", $directory) || !preg_match("/^[a-z0-9_\-]+$/i", $module)) {
- showmessage('undefined_action');
- }
- if(@!file_exists(DISCUZ_ROOT.($modfile = './source/plugin/'.$directory.$module.'.inc.php'))) {
- showmessage('plugin_module_nonexistence', '', array('mod' => $modfile));
- }
- return DISCUZ_ROOT.$modfile;
- }
复制代码 |
|