Extension:Discuz X Single Sign-On

This is tool for Chinese Forum: Discuz.

这是一个真正的discusX2和mediawiki的同步登陆插件，不是用户共享，也不是UCenter自带的样例程序，只用一套登陆系统，用户登陆的通道就能双向打通. 我甚至直接用discuz登陆页替换了mediawiki的登陆页.

This plugin is a hacked version of Extension:AuthUCenter and Extension:Phpbb Single Sign-On - It was used as the base for this, I just replaced all needed code to be specific to discuz

This is very beta - Please make any edits to this code to make it better. I probably will not keep the code curent, so please, take control.

下载并修改mediawiki配置
To install this extension, download the plugin, deccompress it and upload to the extensions directory, add the following to :

在UCenter中添加应用
在UCenter中添加应用mediawiki;

应用类型选择："其他"；应用的主URL： "你的wiki地址/extensions/DiscuzXSSO"；通信密钥随便写一个复杂点的，其他的不用填，直接点击确定.

修改插件程序里面的配置
这个同步登陆没有可能一下子搞定，但是我尽量把相关注释写进去了，下面是DiscuzXSSO的代码，里面有需要添加的配置，请自己补全：

替换下载包中的mediawiki登陆程序
主要是添加了对同步登陆中的用户名为中文的支持

修改Mediawiki的默认登陆按钮
You probably want to change the login/register / logout links to work with the system.

This is how I did this for my wiki.

修改SkinTemplate.php为如下的形式

How It Works
So... This little guy, what he does is: When a user comes to the wiki, it checks to see if the user is currently logged into the forum. If not, nothing happens. If so, he then looks to see if the user is logged into the wiki. If the user is, then everything is good. If the user is not, he takes the session data from discuz and logs the user in automatically to the wiki. If there is no such user on the wiki, he creates the user.

权限组管理
还没有整合论坛的权限和mediawiki的权限，理想的情况应该类似: 这里

新建用户
新用户第一次登陆需要在维基数据库创建用户，然后显示白板，我在新建用户之后强刷了一次页面，暂时隐藏了这个问题.

Safari
用苹果浏览器直接从维基百科登陆后回退页面不会自动刷新，还是显示未登陆，但是刷新后正常.

Cookies
If the user has cookies turned off, they will probably find themselves in an endless redirection loop.