当前位置: 首页>>代码示例>>PHP>>正文


PHP system_modules函数代码示例

本文整理汇总了PHP中system_modules函数的典型用法代码示例。如果您正苦于以下问题:PHP system_modules函数的具体用法?PHP system_modules怎么用?PHP system_modules使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了system_modules函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildframes

function buildframes($types = array('platform'), $modulename = '')
{
    global $_W;
    $ms = (include IA_ROOT . '/web/common/frames.inc.php');
    load()->model('module');
    $frames = array();
    $modules = uni_modules();
    //print_r($module);die();
    if (!empty($modules)) {
        $sysmods = system_modules();
        foreach ($modules as $m) {
            if (in_array($m['name'], $sysmods)) {
                continue;
            }
            $frames[$m['type']][] = $m;
        }
    }
    $types = module_types();
    if (!empty($frames)) {
        foreach ($frames as $type => $fs) {
            $items = array();
            if (!empty($fs)) {
                foreach ($fs as $m) {
                    $items[] = array('title' => $m['title'], 'url' => url('home/welcome/ext', array('m' => $m['name'])));
                }
            }
            $ms['ext'][] = array('title' => $types[$type]['title'], 'items' => $items);
        }
    }
    if (in_array('solution', $types)) {
        load()->model('module');
        $error = module_solution_check($modulename);
        if (is_error($error)) {
        } else {
            $module = module_fetch($modulename);
            $entries = module_entries($modulename, array('menu'));
            if ($_W['role'] == 'operator') {
                foreach ($entries as &$entry1) {
                    foreach ($entry1 as $index2 => &$entry2) {
                        $url_arr = parse_url($entry2['url']);
                        $url_query = $url_arr['query'];
                        parse_str($url_query, $query_arr);
                        $eid = intval($query_arr['eid']);
                        $data = pdo_fetch('SELECT * FROM ' . tablename('modules_bindings') . ' WHERE eid = :eid', array(':eid' => $eid));
                        $ixes = pdo_fetchcolumn('SELECT id FROM ' . tablename('solution_acl') . ' WHERE uid = :uid AND module = :module AND do = :do AND state = :state', array('uid' => $_W['uid'], ':module' => $modulename, ':do' => $data['do'], 'state' => $data['state']));
                        if (empty($ixes)) {
                            unset($entry1[$index2]);
                        }
                    }
                }
            }
            if ($entries['menu']) {
                $menus = array('title' => '业务功能菜单');
                foreach ($entries['menu'] as $menu) {
                    $menus['items'][] = array('title' => $menu['title'], 'url' => $menu['url']);
                }
                $ms['solution'][] = $menus;
            }
        }
    }
    if (empty($_W['isfounder'])) {
        $urls = array();
        $permurls = pdo_fetchall("SELECT url FROM " . tablename('users_permission') . " WHERE uid = :uid AND uniacid = :uniacid", array(':uid' => $_W['uid'], ':uniacid' => $_W['uniacid']));
        if (!empty($permurls)) {
            foreach ($permurls as $row) {
                $urls[] = $row['url'];
            }
        }
        if (!empty($urls)) {
            foreach ($ms as $name => $section) {
                $hassection = false;
                foreach ($section as $i => $menus) {
                    $hasitems = false;
                    foreach ($menus['items'] as $j => $menu) {
                        $_W['setting']['permurls']['menus'][] = ltrim($menu['url'], './index.php?');
                        if (!in_array(rtrim(ltrim($menu['url'], './index.php?'), '&'), $urls)) {
                            unset($ms[$name][$i]['items'][$j]);
                        } else {
                            $hasitems = true;
                            $hassection = true;
                        }
                    }
                    if (!$hasitems) {
                        unset($ms[$name][$i]);
                    }
                }
                if (!$hassection) {
                    unset($ms[$name]);
                } else {
                    $_W['setting']['permurls']['sections'][] = $name;
                }
            }
        }
    }
    $_W['setting']['permurls']['urls'] = $urls;
    return $ms;
}
开发者ID:6662680,项目名称:qday_wx,代码行数:97,代码来源:common.func.php

示例2: trim

}
if ($do == 'info') {
    $m = trim($_GPC['m']);
    if ($_W['isajax']) {
        $data = pdo_fetch('SELECT name, title, ability, description FROM ' . tablename('modules') . ' WHERE name = :m', array(':m' => $m));
        exit(json_encode($data));
    } else {
        if (checksubmit('submit')) {
            $update = array();
            !empty($_GPC['title']) && ($update['title'] = $_GPC['title']);
            !empty($_GPC['ability']) && ($update['ability'] = $_GPC['ability']);
            !empty($_GPC['description']) && ($update['description'] = $_GPC['description']);
            if (!empty($update)) {
                pdo_update('modules', $update, array('name' => $m));
            }
            $sysmodules = system_modules();
            if (in_array($m, $sysmodules)) {
                $root = IA_ROOT . '/framework/builtin/' . $m;
            } else {
                $root = IA_ROOT . '/addons/' . $m;
            }
            if ($_FILES['icon'] && $_FILES['icon']['error'] == '0' && !empty($_FILES['icon']['tmp_name'])) {
                $icon = $_FILES['icon']['tmp_name'];
            }
            if ($_FILES['preview'] && $_FILES['preview']['error'] == '0' && !empty($_FILES['preview']['tmp_name'])) {
                $preview = $_FILES['preview']['tmp_name'];
            }
            load()->func('file');
            mkdirs($root);
            if ($icon) {
                file_move($icon, "{$root}/icon-custom.jpg");
开发者ID:nsoff,项目名称:wdlcms,代码行数:31,代码来源:module.ctrl.php

示例3: array

$cmd = 'index.php';
$_SERVER['HTTP_HOST'] = 'default';
$_SERVER['PHP_SELF'] = '/index.php';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['SERVER_SOFTWARE'] = NULL;
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['QUERY_STRING'] = '';
$_SERVER['PHP_SELF'] = $_SERVER['REQUEST_URI'] = '/';
$_SERVER['HTTP_USER_AGENT'] = 'console';
$modules_to_enable = array('og', 'user', 'node');
// Bootstrap Drupal.
include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// Enable requested modules
include_once './modules/system/system.admin.inc';
$form = system_modules();
foreach ($modules_to_enable as $module) {
    $form_state['values']['status'][$module] = TRUE;
}
$form_state['values']['disabled_modules'] = $form['disabled_modules'];
system_modules_submit(NULL, $form_state);
unset($form_state);
// Run cron after installing
drupal_cron_run();
// Create new content types.
module_load_include('inc', 'node', 'content_types');
$form_state = array('values' => array());
$form_state['values']['name'] = 'test-group';
$form_state['values']['type'] = 'test_group';
$form_state['values']['og_content_type_usage'] = 'group';
drupal_execute('node_type_form', $form_state);
开发者ID:drupdateio,项目名称:teca,代码行数:31,代码来源:generate-og-ui-d6-content.php

示例4: uni_user_permission_check

function uni_user_permission_check($permission_name, $is_html = true, $action = '')
{
    global $_W, $_GPC;
    $status = uni_user_permission_exist();
    if (!is_error($status)) {
        return true;
    }
    $m = trim($_GPC['m']);
    $do = trim($_GPC['do']);
    $eid = intval($_GPC['eid']);
    if ($action == 'reply') {
        $system_modules = system_modules();
        if (!empty($m) && !in_array($m, $system_modules)) {
            $permission_name = $m . '_rule';
            $users_permission = uni_user_permission($m);
        }
    } elseif ($action == 'cover' && $eid > 0) {
        $entry = pdo_fetch('SELECT * FROM ' . tablename('modules_bindings') . ' WHERE `eid`=:eid', array(':eid' => $eid));
        if (!empty($entry)) {
            $permission_name = $entry['module'] . '_cover_' . trim($entry['do']);
            $users_permission = uni_user_permission($entry['module']);
        }
    } elseif ($action == 'nav') {
        if (!empty($m)) {
            $permission_name = "{$m}_{$do}";
            $users_permission = uni_user_permission($m);
        } else {
            return true;
        }
    } else {
        $users_permission = uni_user_permission('system');
    }
    if (!isset($users_permission)) {
        $users_permission = uni_user_permission('system');
    }
    if ($users_permission[0] != 'all' && !in_array($permission_name, $users_permission)) {
        if ($is_html) {
            message('您没有进行该操作的权限', referer(), 'error');
        } else {
            return false;
        }
    }
    return true;
}
开发者ID:wisemyth,项目名称:weizan,代码行数:44,代码来源:account.mod.php

示例5: buildframes

function buildframes($frame = array('platform'))
{
    global $_W, $_GPC;
    if ($_W['role'] == 'clerk') {
        return false;
    }
    $GLOBALS['top_nav'] = pdo_fetchall('SELECT name, title, append_title FROM ' . tablename('core_menu') . ' WHERE pid = 0 AND is_display = 1 ORDER BY displayorder DESC');
    $ms = cache_load('system_frame');
    if (empty($ms)) {
        cache_build_frame_menu();
        $ms = cache_load('system_frame');
    }
    load()->model('module');
    $frames = array();
    $modules = uni_modules(false);
    $modules_temp = array_keys($modules);
    $status = uni_user_permission_exist();
    if (is_error($status)) {
        $modules_temp = pdo_fetchall('SELECT type FROM ' . tablename('users_permission') . ' WHERE uniacid = :uniacid AND uid = :uid AND type != :type', array(':uniacid' => $_W['uniacid'], ':uid' => $_W['uid'], ':type' => 'system'), 'type');
        if (!empty($modules_temp)) {
            $modules_temp = array_keys($modules_temp);
        } else {
            $modules = array();
        }
    }
    if (!empty($modules)) {
        $sysmods = system_modules();
        foreach ($modules as $m) {
            if (in_array($m['name'], $sysmods)) {
                $_W['setting']['permurls']['modules'][] = $m['name'];
                continue;
            }
            if (in_array($m['name'], $modules_temp)) {
                if ($m['enabled']) {
                    $frames[$m['type']][] = $m;
                }
                $_W['setting']['permurls']['modules'][] = $m['name'];
            }
        }
    }
    if (is_error($status)) {
        $system = array();
        $system = uni_user_permission('system');
        if (!empty($system) || !empty($modules_temp)) {
            foreach ($ms as $name => $section) {
                $hassection = false;
                foreach ($section as $i => $menus) {
                    $hasitems = false;
                    if (empty($menus['items'])) {
                        continue;
                    }
                    foreach ($menus['items'] as $j => $menu) {
                        if (!in_array($menu['permission_name'], $system)) {
                            unset($ms[$name][$i]['items'][$j]);
                        } else {
                            $hasitems = true;
                            $hassection = true;
                        }
                    }
                    if (!$hasitems) {
                        unset($ms[$name][$i]);
                    }
                }
                if (!$hassection) {
                    unset($ms[$name]);
                } else {
                    $_W['setting']['permurls']['sections'][] = $name;
                }
            }
        }
    }
    $types = module_types();
    if (!empty($frames)) {
        foreach ($frames as $type => $fs) {
            $items = array();
            if (!empty($fs)) {
                foreach ($fs as $m) {
                    $items[] = array('title' => $m['title'], 'url' => url('home/welcome/ext', array('m' => $m['name'])));
                }
            }
            $ms['ext'][] = array('title' => $types[$type]['title'], 'items' => $items);
        }
        if (is_error($status)) {
            $_W['setting']['permurls']['sections'][] = 'ext';
        }
    }
    $GLOBALS['ext_type'] = 0;
    $m = trim($_GPC['m']);
    $eid = intval($_GPC['eid']);
    if (FRAME == 'ext' && (!empty($m) || !empty($eid)) && $GLOBALS['ext_type'] != 2) {
        if (empty($_COOKIE['ext_type'])) {
            setcookie('ext_type', 1, TIMESTAMP + 8640000, "/");
            $_COOKIE['ext_type'] = 1;
        }
        $GLOBALS['ext_type'] = $_COOKIE['ext_type'];
        if (empty($m)) {
            $m = pdo_fetchcolumn('SELECT module FROM ' . tablename('modules_bindings') . ' WHERE eid = :eid', array(':eid' => $eid));
        }
        $module = module_fetch($m);
        $entries = module_entries($m);
//.........这里部分代码省略.........
开发者ID:weikit,项目名称:wechat-addon,代码行数:101,代码来源:common.func.php


注:本文中的system_modules函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。