IndexAction.class.php
2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
class IndexAction extends CommonAction {
public $tab_sys='';
public function __construct() {
parent::__construct();
$this->tab_sys='System';
}
public function index(){
//获取字段信息
$where_field['isshow'] = array('eq',1); //状态为开启的字段
$where_field['isheader'] = array('eq',1); //在导航中显示
if($where){
$where_field=array_merge($where_field,$where);
}
$m = M('Regfields')->where($where_field);
if($field){
$m = $m->field($field);
}
$file_info = $m->order('sort')->limit(11)->select();
$this->assign('head_top',$file_info);
$this->display();
}
public function main(){
//获取服务器信息
$sysdata['sysos'] = $_SERVER["SERVER_SOFTWARE"]; //获取服务器标识的字串
$sysdata['sysversion'] = PHP_VERSION; //获取PHP服务器版本
//以下两条代码连接MySQL数据库并获取MySQL数据库版本信息
mysql_connect("localhost", "mysql_user", "mysql_pass");
$sysdata['mysqlinfo'] = mysql_get_server_info();
//从服务器中获取GD库的信息
if(function_exists("gd_info")){
$gd = gd_info();
$sysdata['gdinfo'] = $gd['GD Version'];
}else {
$sysdata['gdinfo'] = "未知";
}
if(IS_WIN){//是否属于Windows 环境
$sysdata['system']='Liunx';
}else{
$sysdata['system']='WINNT';
}
//从GD库中查看是否支持FreeType字体
$sysdata['freetype'] = $gd["FreeType Support"] ? "支持" : "不支持";
//从PHP配置文件中获得是否可以远程文件获取
$sysdata['allowurl']= ini_get("allow_url_fopen") ? "支持" : "不支持";
//从PHP配置文件中获得最大上传限制
$sysdata['max_upload'] = ini_get("file_uploads") ? ini_get("upload_max_filesize") : "Disabled";
//从PHP配置文件中获得脚本的最大执行时间
$sysdata['max_ex_time']= ini_get("max_execution_time")."秒";
//以下两条获取服务器时间,中国大陆采用的是东八区的时间,设置时区写成Etc/GMT-8
date_default_timezone_set("Etc/GMT-8");
$sysdata['systemtime'] = date("Y-m-d H:i:s",time());
$this->assign('role',$this->getRole());
$this->assign('system',$sysdata);
$this->display();
}
private function getRole(){
$m=M('Authgroupaccessf');
$where['uid']=array('eq',cookie('uid'));
$info=$m->where($where)->order($order)->getField('group_id');
$info=explode(',',$info);
// 所有用户组
$groups=R('Admin/Power/getRules',array('Authgroupf','title,id'));
if($groups)
{
foreach($groups as $k2 => $v2)
{
if(in_array($v2['id'],$info)) $newgroups[$v2['id']]=$v2['title'];
}
}
return implode(',', $newgroups);
}
/**
* 左侧导航
* pp new
**/
public function menu(){
$this->assign('authlist',$this->getPower());
$this->display();
}
}