static function controller() { $value = Classes::get_config('module_host'); if ($value == 1) { $all = DB::all('host'); if (!$all) { return; } foreach ($all as $v) { $url = $v['url']; $redirect = $v['redirect']; $arr[$url] = $redirect; } $host = Str::new_replace(host(), array('http://' => '', 'https://' => '')); if ($arr[$host]) { redirect("http://" . $arr[$host] . $_SERVER['REQUEST_URI']); } } }
/** * 用户组绑定权限 */ public function actionIndex($id) { $id = (int) $id; $model = \app\modules\auth\models\Group::find($id); foreach ($model->access as $g) { $access[] = $g->access_id; } $d = $this->_get_modules(); Access::generate($d); $rows = DB::all('auth_access', array('select' => "id,name,pid")); foreach ($rows as $v) { $out[$v['id']] = $v; } $rows = Arr::_tree_id($rows); if ($_POST) { $auth = $_POST['auth']; GroupAccess::saveAccess($id, $auth); flash('success', __('set access success')); redirect(url('auth/auth/index', array('id' => $id))); } echo $this->render('index', array('rows' => $rows, 'out' => $out, 'model' => $model, 'id' => $id, 'access' => $access)); }
/** * 过滤字段 */ static function filter() { $all = DB::all('comment_filter'); if (!$all) { return array(); } foreach ($all as $v) { $row[$v['name']] = $v['replace'] ?: '*'; } return $row; }
function run() { $rows = DB::all('oauth_config', array('orderBy' => 'sort desc,id desc', 'where' => array('display' => 1))); echo $this->render('@app/modules/oauth/widget/views/login', array('rows' => $rows, 'img' => $this->img)); }