|
安装破解
本破解易于安装.
第一步: 创建 MediaWiki:New
首先,在您的wiki中创建一个“MediaWiki:New”。您必须以管理员身份登录系统才能创建该页面。当前页当中的任何文本和格式将作为默认内容出现在每篇文章当中。 First, create MediaWiki:New in your wiki. You will have to login as an administrator to create this page. The page should include whatever text and formatting should appear by default in each article.
第二步: 编辑“EditPage.php”页面
。注意:编辑此文件可能会导致您的wiki出现问题,所以需要格外小心。找到
。在函数顶部得变量中,添加以下内容:
。找到类似下面代码的语句:
- if(!$this->mTitle->getArticleID()) { # new article
- $wgOut->addWikiText(wfmsg('newarticletext'));
- }
复制代码 在上述代码的if条件语句中,添加如下内容:
- if(!$this->preview) {
- $startText = htmlspecialchars(wfMsgForContent("new"));
- }
复制代码 添加完成后的内容如下所示:
- if(!$this->mTitle->getArticleID()) { # new article
- $wgOut->addWikiText(wfmsg('newarticletext'));
- if(!$this->preview) {
- $startText = htmlspecialchars(wfMsgForContent("new"));
- }
- }
复制代码 最后,找到第一个代码块
textarea
:
- <textarea tabindex='1' accesskey="," name="wpTextbox1" rows='{$rows}'
- cols='{$cols}'{$ew}>" .
- htmlspecialchars( $wgContLang->recodeForEdit( $this->textbox1 ) ) .
- "
- </textarea>
复制代码 Edit
. Warning: editing this file could lead to problems throughout your wiki, so be very careful. Find
. In the list of variables at the top of this function, add this:
Find an if statement that looks like this:
- if(!$this->mTitle->getArticleID()) { # new article
- $wgOut->addWikiText(wfmsg('newarticletext'));
- }
复制代码 Within that statement, nest this if statement:
- if(!$this->preview) {
- $startText = htmlspecialchars(wfMsgForContent("new"));
- }
复制代码 So the overall statement now looks like this:
- if(!$this->mTitle->getArticleID()) { # new article
- $wgOut->addWikiText(wfmsg('newarticletext'));
- if(!$this->preview) {
- $startText = htmlspecialchars(wfMsgForContent("new"));
- }
- }
复制代码 Finally, find the first
textarea
block of code:
- <textarea tabindex='1' accesskey="," name="wpTextbox1" rows='{$rows}'
- cols='{$cols}'{$ew}>" .
- htmlspecialchars( $wgContLang->recodeForEdit( $this->textbox1 ) ) .
- "
- </textarea>
复制代码 Between the . and ", add
, so now you have this:
- <textarea tabindex='1' accesskey="," name="wpTextbox1" rows='{$rows}'
- cols='{$cols}'{$ew}>" .
- htmlspecialchars( $wgContLang->recodeForEdit( $this->textbox1 ) ) . $startText .
- "
- </textarea>
复制代码 If the article is new and not being previewed, the contents of MediaWiki:New will be added to the editing textbox. Otherwise, nothing is added.
Step 3: Upload and Test
If you worked on a local copy of
, upload this file to your live
directory. Try editing a new article and an old article, and confirm that the hack works as intended.
|
|