第十二章:【UCHome二次开发】全局变量

UCHome定义了一些全局变量保存常用信息,了解这些变量存放的内容将大大方便我们的二次开发。

以下依次罗列各全局变量所保存的内容:

个别全局变量在不同页面的值会有所不同,使用前最好先测试一下值是否存在。

下面是用print_r函数打印出来的各全局变量信息,方便参考:

$_SC:系统全局配置

$_SC: Array

(

    [dbhost] => localhost

    [dbuser] => root

    [dbpw] => 33023

    [dbcharset] => utf8

    [pconnect] => 0

    [dbname] => uchome

    [tablepre] => uch_

    [charset] => utf-8

    [gzipcompress] => 0

    [cookiepre] => uchome_  

    [cookiedomain] =>     //cookie域名

    [cookiepath] => /     //cookie路径

    [attachdir] => ./attachment/   上传图片新地址

    [attachurl] => attachment/

    [siteurl] => http://127.0.0.1:911/uchome/

    [tplrefresh] => 0  //刷新

    [founder] => 1   //创始人

    [allowedittpl] => 0 //

)

 

 

$_SCONFIG:个人空间配置

 

 

函数读取的是缓存中data_config文件中的信息,如果不存在本文件则调用souce中的函数文件function_cache重新写入一个data缓存文件,然后调用,本函数读取的数据库是config文件是数据库

$_SCONFIG :Array

(

   [sitename] => 我的空间

   [template] => blue

   [adminemail] => webmaster@127.0.0.1:911

   [onlinehold] => 1800

   [timeoffset] => 8

   [maxpage] => 100

   [starcredit] => 100

   [starlevelnum] => 5

   [cachemode] => database

   [cachegrade] => 0

   [allowcache] => 1

   [allowdomain] => 0

   [allowrewrite] => 0

   [allowwatermark] => 0

   [allowftp] => 0

   [holddomain] =>www|*blog*|*space*|x

   [mtagminnum] => 5

   [feedday] => 7

   [feedmaxnum] => 100

   [feedfilternum] => 10

   [importnum] => 100

   [maxreward] => 10

   [singlesent] => 50

   [groupnum] => 8

   [closeregister] => 0

   [closeinvite] => 0

   [close] => 0

   [networkpublic] => 1

   [networkpage] => 1

   [seccode_register] => 1

   [uc_tagrelated] => 1

   [manualmoderator] => 1

   [linkguide] => 1

   [showall] => 1

   [sendmailday] => 0

   [realname] => 0

   [namecheck] => 0

   [namechange] => 0

   [name_allowviewspace] => 1

   [name_allowfriend] => 1

   [name_allowpoke] => 1

   [name_allowdoing] => 1

   [name_allowblog] => 0

   [name_allowalbum] => 0

   [name_allowthread] => 0

   [name_allowshare] => 0

   [name_allowcomment] => 0

   [name_allowpost] => 0

   [showallfriendnum] => 10

   [feedtargetblank] => 1

   [feedread] => 1

   [feedhotnum] => 3

   [feedhotday] => 2

   [feedhotmin] => 3

   [feedhiddenicon] => friend,profile,task,wall

   [uc_tagrelatedtime] => 86400

   [privacy] => Array

        (

            [view] => Array

                (

                    [index] => 0

                    [profile] => 0

                    [friend] => 0

                    [wall] => 0

                    [feed] => 0

                    [mtag] => 0

                    [event] => 0

                    [doing] => 0

                    [blog] => 0

                    [album] => 0

                    [share] => 0

                    [poll] => 0

                )

 

            [feed] => Array

                (

                    [doing] => 1

                    [blog] => 1

                    [upload] => 1

                    [share] => 1

                    [poll] => 1

                    [joinpoll] => 1

                    [thread] => 1

                    [post] => 1

                    [mtag] => 1

                    [event] => 1

                    [join] => 1

                    [friend] => 1

                    [comment] => 1

                    [show] => 1

                    [spaceopen] => 1

                    [credit] => 1

                    [invite] => 1

                    [task] => 1

                    [profile] => 1

                    [album] => 1

                    [click] => 1

                )

 

        )

 

   [cronnextrun] => 1277406240

   [my_status] => 0

   [uniqueemail] => 1

   [updatestat] => 1

   [my_showgift] => 1

   [topcachetime] => 60

   [newspacenum] => 3

   [sitekey] => 40583eWvxxgU8xIv

   [my_siteid] => 2761584

   [my_sitekey] => baac4f0ecc0124cf1bef79d94b5b3215

   [siteallurl] =>

   [licensed] => 0

   [debuginfo] => 0

   [miibeian] =>

   [headercharset] => 0

   [avatarreal] => 0

   [uc_dir] =>

   [my_ip] =>

   [closereason] =>

   [checkemail] => 0

   [regipdate] =>

   [my_closecheckupdate] => 0

   [openxmlrpc] => 0

   [domainroot] =>

   [name_allowpoll] => 0

   [name_allowevent] => 0

   [name_allowuserapp] => 0

   [videophoto] => 0

   [video_allowviewphoto] => 0

   [video_allowfriend] => 0

   [video_allowpoke] => 0

   [video_allowwall] => 0

   [video_allowcomment] => 0

   [video_allowdoing] => 0

   [video_allowblog] => 0

   [video_allowalbum] => 0

   [video_allowthread] => 0

   [video_allowpoll] => 0

   [video_allowevent] => 0

   [video_allowshare] => 0

   [video_allowpost] => 0

   [video_allowuserapp] => 0

   [ftpurl] =>

   [newspaceavatar] => 0

   [newspacerealname] => 0

   [newspacevideophoto] => 0

   [login_action] => 1053cae73e58cd3b16c44d65b888097c

   [register_action] => 00fc52155732782b5e227052a372e091

   [uc_status] => 0

)

 

 

$_SCOOKIE:Cookie信息

 

 

$_SCOOKIE: Array

(

 [loginuser] => admin

 [checkpm] => 1

 [synfriend] => 1

 [sendmail] => 1

 [auth] =>61087Cgwu3hoB35cDmXGpe3juvbjJQC2e+wlWJ79GPejIYhB1j/d9VwyKGy8DPYcKQCHUYvYg+EBqJoQS5Vc

)

 

$_SGLOBAL:各类全局信息

 

$_SGLOBAL:Array

(

   [timestamp] => 1277865220 //页面请求时间  common.php

   [supe_starttime] => 1277865220.2591 //页面请求精确时间common.php

   [db] => dbstuff Object

        (

            [querynum] => 15

            [link] => Resource id #8

            [charset] => utf8

       )

 

   [app] => Array

        (

            [1] => Array

                (

                    [name] => 个人家园

                    [url] =>http://127.0.0.1:911/uchome

                    [type] => UCHOME

                    [open] => 0

                    [icon] => uchome

                )

 

        )

 

   [userapp] => Array

        (

        )

 

   [ad] => Array

        (

        )

 

   [magic] => Array

        (

            [invisible] => 隐身草

            [friendnum] => 好友增容卡

            [attachsize] => 附件增容卡

            [thunder] => 雷鸣之声

            [updateline] => 救生圈

            [downdateline] => 时空机

            [color] => 彩色灯

            [hot] => 热点灯

            [visit] => 互访卡

            [icon] => 彩虹蛋

            [flicker] => 彩虹炫

            [gift] => 红包卡

            [superstar] => 超级明星

            [viewmagiclog] => 八卦镜

            [viewmagic] => 透视镜

            [viewvisitor] => 偷窥镜

            [call] => 点名卡

            [coupon] => 代金券

            [frame] => 相框

            [bgimage] => 信纸

            [doodle] => 涂鸦板

            [anonymous] => 匿名卡

            [reveal] => 照妖镜

            [license] => 道具转让许可证

            [detector] => 探测器

        )

 

   [supe_uid] => 1

   [supe_username] => admin

   [inajax] => 0

   [mobile] =>

   [ajaxmenuid] =>

   [refer] => http://127.0.0.1:911/uchome/space.php

   [session] => Array

        (

            [uid] => 1

            [username] => admin

            [password] => c4425b70d49c23838c826fdfa240c607

            [lastactivity] => 1277865210

            [ip] => 192168000

            [magichidden] => 0

        )

 

   [username] => admin

   [uhash] => e424d0a595f52fd4434642dd8e97c638

   [my_menu] => Array

        (

        )

 

   [my_userapp] => Array

        (

        )

 

   [my_menu_more] => 0

   [appmenu] => Array

        (

        )

 

   [appmenus] => Array

        (

        )

 

   [member] => Array

        (

            [uid] => 1

            [sex] => 1

            [email] =>

            [newemail] =>

            [emailcheck] => 0

            [mobile] =>

            [qq] =>

            [msn] =>

            [msnrobot] =>

            [msncstatus] => 0

            [videopic] =>

            [birthyear] => 0

            [birthmonth] => 0

            [birthday] => 0

            [blood] =>

            [marry] => 0

            [birthprovince] =>

            [birthcity] =>

            [resideprovince] =>

            [residecity] =>

            [note] => 测试心情2

            [spacenote] => 测试心情2

            [authstr] =>

            [theme] => t10

            [nocss] => 0

            [menunum] => 0

            [css] =>

            [privacy] => Array

                (

                    [view] => Array

                        (

                            [index] => 0

                            [profile] => 0

                            [friend] => 0

                            [wall] => 0

                            [feed] => 0

                            [mtag] => 0

                            [event] => 0

                            [doing] => 0

                            [blog] => 0

                            [album] => 0

                            [share] => 0

                            [poll] => 0

                        )

 

                    [feed] => Array

                        (

                            [doing] => 1

                            [blog] => 1

                            [upload] => 1

                            [share] => 1

                            [poll] => 1

                            [joinpoll] => 1

                            [thread] => 1

                            [post] => 1

                            [mtag] => 1

                            [event] => 1

                            [join] => 1

                            [friend] => 1

                            [comment] => 1

                            [show] => 1

                            [spaceopen] => 1

                            [credit] => 1

                            [invite] => 1

                            [task] => 1

                            [profile] => 1

                            [album] => 1

                            [click] => 1

                        )

 

                )

 

            [friend] => 3

            [feedfriend] => 3

            [sendmail] =>

            [magicstar] => 0

            [magicexpire] => 1276950653

            [timeoffset] => 8

            [musictaste] =>

            [musicstotal] => 4

            [musicatotal] => 0

            [musicptotal] => 6

            [musicctotal] => 0

            [musicttotal] => 0

            [groupid] => 1

            [credit] => 3178

            [experience] => 860

            [username] => admin

            [name] =>

            [namestatus] => 1

            [videostatus] => 0

            [domain] =>

            [friendnum] => 1

            [viewnum] => 6

            [notenum] => 0

            [addfriendnum] => 0

            [mtaginvitenum] => 0

            [eventinvitenum] => 0

            [myinvitenum] => 0

            [pokenum] => 0

            [doingnum] => 13

            [blognum] => 1

            [albumnum] => 1

            [threadnum] => 1

            [pollnum] => 0

            [eventnum] => 0

            [sharenum] => 1

            [dateline] => 1275458247

            [updatetime] => 1277801840

            [lastsearch] => 0

            [lastpost] => 1277733181

            [lastlogin] => 1277859427

            [lastsend] => 0

            [attachsize] => 4294311912

            [addsize] => 0

            [addfriend] => 0

            [flag] => 1

            [newpm] => 0

            [avatar] => 1

            [regip] => 127.0.0.1

            [ip] => 192168000

            [mood] => 0

            [self] => 1

            [friends] => Array

                (

                    [0] => 3

                )

 

            [allnotenum] => 0

        )

 

   [space_1_uid] => Array

        (

            [uid] => 1

            [sex] => 1

            [email] =>

            [newemail] =>

            [emailcheck] => 0

            [mobile] =>

            [qq] =>

            [msn] =>

            [msnrobot] =>

            [msncstatus] => 0

            [videopic] =>

            [birthyear] => 0

            [birthmonth] => 0

            [birthday] => 0

            [blood] =>

            [marry] => 0

            [birthprovince] =>

            [birthcity] =>

            [resideprovince] =>

            [residecity] =>

            [note] => 测试心情2

            [spacenote] => 测试心情2

            [authstr] =>

            [theme] => t10

            [nocss] => 0

            [menunum] => 0

            [css] =>

           [privacy] => Array

                (

                    [view] => Array

                        (

                            [index] => 0

                            [profile] => 0

                            [friend] => 0

                            [wall] => 0

                            [feed] => 0

                            [mtag] => 0

                            [event] => 0

                            [doing] => 0

                            [blog] => 0

                            [album] => 0

                            [share] => 0

                            [poll] => 0

                        )

 

                    [feed] => Array

                        (

                            [doing] => 1

                            [blog] => 1

                            [upload] => 1

                            [share] => 1

                            [poll] => 1

                            [joinpoll] => 1

                            [thread] => 1

                            [post] => 1

                            [mtag] => 1

                            [event] => 1

                            [join] => 1

                            [friend] => 1

                            [comment] => 1

                            [show] => 1

                            [spaceopen] => 1

                            [credit] => 1

                            [invite] => 1

                            [task] => 1

                            [profile] => 1

                            [album] => 1

                            [click] => 1

                        )

 

                )

 

            [friend] => 3

            [feedfriend] => 3

            [sendmail] =>

            [magicstar] => 0

            [magicexpire] => 1276950653

            [timeoffset] => 8

            [musictaste] =>

            [musicstotal] => 4

            [musicatotal] => 0

            [musicptotal] => 6

            [musicctotal] => 0

            [musicttotal] => 0

            [groupid] => 1

            [credit] => 3178

            [experience] => 860

            [username] => admin

            [name] =>

            [namestatus] => 1

            [videostatus] => 0

            [domain] =>

            [friendnum] => 1

            [viewnum] => 6

            [notenum] => 0

            [addfriendnum] => 0

            [mtaginvitenum] => 0

            [eventinvitenum] => 0

            [myinvitenum] => 0

            [pokenum] => 0

            [doingnum] => 13

            [blognum] => 1

            [albumnum] => 1

            [threadnum] => 1

            [pollnum] => 0

            [eventnum] => 0

            [sharenum] => 1

            [dateline] => 1275458247

            [updatetime] => 1277801840

            [lastsearch] => 0

            [lastpost] => 1277733181

            [lastlogin] => 1277859427

           [lastsend] => 0

            [attachsize] => 4294311912

            [addsize] => 0

            [addfriend] => 0

            [flag] => 1

            [newpm] => 0

            [avatar] => 1

            [regip] => 127.0.0.1

            [ip] => 192168000

            [mood] => 0

            [self] => 1

            [friends] => Array

                (

                    [0] => 3

                )

 

            [allnotenum] => 0

        )

 

   [ckprivacy_feed_0] => 1

   [usergroup] => Array

        (

           [1] => Array

                (

                    [gid] => 1

                    [grouptitle] => 站点管理员

                    [system] => -1

                    [banvisit] => 0

                    [explower] => 0

                    [maxfriendnum] => 0

                    [maxattachsize] => 0

                    [allowhtml] => 1

                    [allowcomment] => 1

                    [searchinterval] => 0

                    [searchignore] => 1

                    [postinterval] => 0

                    [spamignore] => 1

                    [videophotoignore] => 1

                    [allowblog] => 1

                    [allowmovie] => 1

                    [allowdoing] => 1

                    [allowupload] => 1

                    [allowshare] => 1

                    [allowmtag] => 1

                    [allowthread] => 1

                    [allowpost] => 1

                    [allowcss] => 1

                    [allowpoke] => 1

                    [allowfriend] => 1

                    [allowpoll] => 1

                    [allowclick] => 1

                    [allowevent] => 1

                    [allowmagic] => 1

                    [allowpm] => 1

                    [allowviewvideopic] => 1

                    [allowmyop] => 1

                    [allowtopic] => 1

                    [allowstat] => 1

                    [magicdiscount] => 0

                    [verifyevent] => 0

                    [edittrail] => 0

                    [domainlength] => 1

                    [closeignore] => 1

                    [seccode] => 0

                    [color] => red

                    [icon] =>image/group/admin.gif

                    [manageconfig] => 1

                    [managenetwork] => 1

                    [manageprofilefield] =>1

                    [manageprofield] => 1

                    [manageusergroup] => 1

                    [managefeed] => 1

                    [manageshare] => 1

                    [managedoing] => 1

                    [manageblog] => 1

                    [managetag] => 1

                    [managetagtpl] => 0

                    [managealbum] => 1

                    [managecomment] => 1

                    [managemtag] => 1

                    [managethread] => 1

                    [manageevent] => 1

                   [manageeventclass]=> 1

                    [managecensor] => 1

                    [managead] => 1

                    [managesitefeed] => 0

                    [managebackup] => 1

                    [manageblock] => 1

                    [managetemplate] => 1

                    [managestat] => 1

                    [managecache] => 1

                    [managecredit] => 1

                    [managecron] => 1

                    [managename] => 1

                    [manageapp] => 1

                   [managetask] =>1

                    [managereport] => 1

                    [managepoll] => 1

                    [manageclick] => 1

                    [managemagic] => 1

                    [managemagiclog] => 1

                    [managebatch] => 1

                    [managedelspace] => 1

                    [managetopic] => 1

                    [manageip] => 1

                    [managehotuser] => 1

                    [managedefaultuser] => 1

                    [managespacegroup] => 1

                    [managespaceinfo] => 1

                    [managespacecredit] => 1

                    [managespacenote] => 1

                    [managevideophoto] => 1

                    [managelog] => 1

                    [magicaward] =>

                   [managemovie]=> 0

                )

 

        )

 

   [checkperm_banvisit] =>

   [today] => 1277827200

   [gift_appid] => 1027468

   [ckfriend_42417d7d9a15a84c53443f0843c36995] => 1

   [select_realname] => Array

        (

            [3] => 3

            [4] => 4

            [2] => 2

        )

 

   [checkperm_managereport] => 1

   [checkperm_manageevent] => 1

   [task] => Array

        (

            [2] => Array

                (

                    [taskid] => 2

                    [available] => 1

                    [name] => 将个人资料补充完整

                    [note] => 把自己的个人资料填写完整吧。
这样您会被更多的朋友找到的,系统也会帮您找到朋友。

                    [num] => 0

                    [maxnum] => 0

                    [image] =>image/task/profile.gif

                    [filename] => profile.php

                    [starttime] => 0

                    [endtime] => 0

                    [nexttime] => 0

                    [nexttype] => 2

                    [credit] => 20

                    [displayorder] => 0

                )

 

            [1] => Array

                (

                    [taskid] => 1

                    [available] => 1

                    [name] => 更新一下自己的头像

                    [note] => 头像就是你在这里的个人形象。
设置自己的头像后,会让更多的朋友记住您。

                    [num] => 1

                    [maxnum] => 0

                    [image] =>image/task/avatar.gif

                    [filename] => avatar.php

                    [starttime] => 0

                    [endtime] => 0

                    [nexttime] => 0

                   [nexttype] =>

                    [credit] => 20

                    [displayorder] => 1

                )

 

            [3] => Array

                (

                    [taskid] => 3

                    [available] => 1

                    [name] => 发表自己的第一篇日志

                    [note] =>现在,就写下自己的第一篇日志吧。
与大家一起分享自己的生活感悟。

                    [num] => 1

                    [maxnum] => 0

                    [image] =>image/task/blog.gif

                    [filename] => blog.php

                    [starttime] => 0

                    [endtime] => 0

                    [nexttime] => 0

                    [nexttype] =>

                    [credit] => 5

                    [displayorder] => 3

                )

 

            [4] => Array

               (

                    [taskid] => 4

                    [available] => 1

                    [name] => 寻找并添加五位好友

                    [note] =>有了好友,您发的日志、图片等会被好友及时看到并传播出去;
您也会在首页方便及时的看到好友的最新动态。

                    [num] => 0

                    [maxnum] => 0

                    [image] =>image/task/friend.gif

                    [filename] => friend.php

                    [starttime] => 0

                    [endtime] => 0

                    [nexttime] => 0

                    [nexttype] =>

                    [credit] => 50

                    [displayorder] => 4

                )

 

            [5] => Array

                (

                    [taskid] => 5

                    [available] => 1

                    [name] => 验证激活自己的邮箱

                    [note] => 填写自己真实的邮箱地址并验证通过。
您可以在忘记密码的时候使用该邮箱取回自己的密码;
还可以及时接受站内的好友通知等等。

                    [num] => 0

                    [maxnum] => 0

                    [image] =>image/task/email.gif

                    [filename] => email.php

                    [starttime] => 0

                    [endtime] => 0

                    [nexttime] => 0

                    [nexttype] =>

                    [credit] => 10

                    [displayorder] => 5

                )

 

            [6] => Array

               (

                    [taskid] => 6

                    [available] => 1

                    [name] => 邀请10个新朋友加入

                    [note] =>邀请一下自己的QQ好友或者邮箱联系人,让亲朋好友一起来加入我们吧。

                    [num] => 0

                    [maxnum] => 0

                   [image] =>image/task/friend.gif

                    [filename] => invite.php

                    [starttime] => 0

                    [endtime] => 0

                    [nexttime] => 0

                    [nexttype] =>

                    [credit] => 100

                    [displayorder] => 6

                )

 

            [7] => Array

                (

                    [taskid] => 7

                    [available] => 1

                    [name] => 领取每日访问大礼包

                    [note] =>每天登录访问自己的主页,就可领取大礼包。

                    [num] => 0

                    [maxnum] => 0

                    [image] =>image/task/gift.gif

                    [filename] => gift.php

                    [starttime] => 0

                    [endtime] => 0

                    [nexttime] => 0

                    [nexttype] => day

                    [credit] => 5

                    [displayorder] => 99

                )

 

        )

 

   [sourcelang] => Array

        (

            [hour] => 小时

            [before] => 前

            [minute] => 分钟

            [second] => 秒

            [now] => 现在

            [dot] => 、

            [mtag] => 群组

            [poll] => 投票

            [event] => 活动

            [thread] => 话题

            [blog] => 日志

            [friend_group_default] => 其他

            [friend_group_1] => 通过本站认识

            [friend_group_2] => 通过活动认识

            [friend_group_3] => 通过朋友认识

            [friend_group_4] => 亲人

            [friend_group_5] => 同事

            [friend_group_6] => 同学

            [friend_group_7] => 不认识

            [friend_group] => 自定义

            [default_albumname] => 默认相册

            [wall] => 留言

            [pic_comment] => 图片评论

            [blog_comment] => 日志评论

            [clickblog] => 日志表态

            [clickpic] => 图片表态

            [clickthread] => 话题表态

            [share_comment] => 分享评论

            [share_notice] => 分享

            [doing_comment] => 记录回复

            [friend_notice] => 好友

            [thread_comment] => 话题回复

            [event_comment] => 活动留言

            [event_member] => 活动成员管理

            [event_memberstatus] => 活动成员身份

            [poll_comment] => 投票评论

            [poll_invite] => 投票邀请

            [credit] => 积分

            [credit_unit] => 个

            [man] => 男

            [woman] => 女

            [year] => 年

            [month] => 月

            [day] => 日

            [unmarried] => 单身

            [married] => 非单身

            [hidden_username] => 匿名

        )

 

   [avatarfile_1_small_virtual] => 000/00/00/01_avatar_small.jpg

   [avatarfile_1_middle_virtual] => 000/00/00/01_avatar_middle.jpg

   [checkperm_manageconfig] => 1

   [checkperm_allowstat] => 1

   [grouptitle] => Array

        (

            [7] => Array

                (

                    [grouptitle] => 高级会员

                    [color] =>

                    [icon] =>

                )

 

            [6] => Array

                (

                    [grouptitle] => 中级会员

                    [color] =>

                    [icon] =>

                )

 

            [1] => Array

                (

                    [grouptitle] => 站点管理员

                    [color] => red

                    [icon] =>image/group/admin.gif

                )

 

            [2] => Array

                (

                    [grouptitle] => 信息管理员

                    [color] => blue

                    [icon] =>image/group/infor.gif

                )

 

            [3] => Array

                (

                    [grouptitle] => 贵宾VIP

                    [color] => green

                    [icon] => image/group/vip.gif

                )

 

            [5] => Array

                (

                    [grouptitle] => 普通会员

                    [color] =>

                    [icon] =>

                )

 

            [8] => Array

                (

                    [grouptitle] => 禁止发言

                    [color] =>

                    [icon] =>

                )

 

            [9] => Array

                (

                    [grouptitle] => 禁止访问

                    [color] =>

                    [icon] =>

               )

 

            [4] => Array

                (

                    [grouptitle] => 受限会员

                    [color] =>

                    [icon] =>

                )

 

        )

 

   [formhash] => 135b77af

   [avatarfile_4_small_virtual] => 000/00/00/04_avatar_small.jpg

   [avatarfile_3_small_virtual] => 000/00/00/03_avatar_small.jpg

   [avatarfile_2_small_virtual] => 000/00/00/02_avatar_small.jpg

)

 

 

$_SN:昵称信息

 

 

$_SN:Array

(

    [1] => admin

    [3] => admin3

    [4] => xiaoyu

    [2] => admin2

)

 

 

$_TPL:未知

 

 

$_SBLOCK:未知

 

举例说明:

 

在UCHome上增加一个功能,希望某些群组类别下只允许有群组管理的人才能新建群组,其他人无法新建这些类别的群组。只需修改模板中的cp_mtag.htm文件,将如下代码:

<div class="l_status">1.<strong>请选择一个群组分类</strong></div>

<table><tr>

<!--{eval $i=0;}-->

<!--{loop $fields $value}-->

<td><input type="radio"id="fieldid_$value[fieldid]" name="fieldid"value="$value[fieldid]"onclick="fieldselect(this.value)"><labelfor="fieldid_$value[fieldid]">$value[title]</label></td>

<!--{if $i%3==2}--></tr><tr><!--{/if}-->

<!--{eval $i++;}-->

<!--{/loop}-->

</tr></table>

更改为:

<div class="l_status">1.<strong>请选择一个群组分类</strong></div>

<table><tr>

<!--{eval $i=0;}-->

<!--{loop $fields $value}-->

 

<!--{evalif(!($_SGLOBAL['usergroup'][$_SGLOBAL['member']['groupid']]['manageprofield'])){/*判断当前用户是否有群组管理权限*/}-->

<!--{eval if(in_array($value[fieldid], array(1,4,5,6)))continue;/*过滤不允许普通用户创建的群组*/}-->

<!--{eval } }-->

 

<td><input type="radio"id="fieldid_$value[fieldid]" name="fieldid"value="$value[fieldid]"onclick="fieldselect(this.value)"><labelfor="fieldid_$value[fieldid]">$value[title]</label></td>

<!--{if $i%3==2}--></tr><tr><!--{/if}-->

<!--{eval $i++;}-->

<!--{/loop}-->

</tr></table>

 

简单说明一下:$_SGLOBAL['member']['groupid']返回当前用户的用户组编号,$_SGLOBAL['usergroup'][用户组编号]['manageprofield']返回特定用户组是否有群组管理权限,结合起来判断当前用户是否有群组管理权限。

 

效果就是当管理员登陆后,新建群组可选择所有分类。

 

管理员新建群组界面

而普通会员登录后,新建群组只能选个别分类。

 

普通会员新建群组界面

以上为个人实践的总结,如有不对之处,敬请指出!

 

所有章节下载:http://download.csdn.net/source/3579636

文章摘自:http://wenku.baidu.com/view/ffd8a5c14028915f804dc2e0.html
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值