{"id":2643,"date":"2013-04-01T16:52:39","date_gmt":"2013-04-01T08:52:39","guid":{"rendered":"https:\/\/kyle.ai\/blog\/?p=2643"},"modified":"2013-04-01T16:52:39","modified_gmt":"2013-04-01T08:52:39","slug":"mediawiki%e7%a6%81%e6%ad%a2%e5%8c%bf%e5%90%8d%e7%94%a8%e6%88%b7%e6%b5%8f%e8%a7%88%e7%bc%96%e8%be%91","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/2643.html","title":{"rendered":"MediaWiki\u7981\u6b62\u533f\u540d\u7528\u6237\u6d4f\u89c8\u7f16\u8f91"},"content":{"rendered":"<p><span style=\"font-size: small;\">\u6765\u6e90\uff1ahttp:\/\/www.mediawiki.org\/wiki\/Manual:Preventing_access\/zh<\/span><\/p>\n<p><span style=\"font-size: small;\">\u7f16\u8f91LocalSettings.php\u6587\u4ef6\uff1a<\/span><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/\u533f\u540d\u7528\u6237\u4e0d\u80fd\u6d4f\u89c8\u548c\u7f16\u8f91\u9875\u9762\r\n$wgGroupPermissions&#x5B;'*'    ]&#x5B;'createaccount']   = false;\r\n$wgGroupPermissions&#x5B;'*'    ]&#x5B;'read']            = false;\r\n$wgGroupPermissions&#x5B;'*'    ]&#x5B;'edit']            = false;\r\n<\/pre>\n<p><span style=\"font-size: small;\">\u518d\u7528\u4e00\u4e2a\u63d2\u4ef6\uff0c\u7981\u6b62\u533f\u540d\u7528\u6237\u67e5\u770b\u5bfc\u822a\u680f\uff0c\u6765\u6e90\uff1ahttp:\/\/www.mediawiki.org\/wiki\/Extension:HideSidebar<\/span><\/p>\n<p><span style=\"font-size: small;\">\u7f16\u8f91LocalSettings.php\u6587\u4ef6\uff0c\u52a0\u5165\uff1a<\/span><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nrequire_once(&quot;$IP\/extensions\/HideSidebar\/HideSidebar.php&quot;);  \/\/\u533f\u540d\u7528\u6237\u9690\u85cfsidebar\r\n<\/pre>\n<p><span style=\"font-size: small;\">\u5176\u4e2d$IP\u4e3a\u4f60\u5b89\u88c5wiki\u7cfb\u7edf\u7684\u6839\u76ee\u5f55\u3002<\/span><\/p>\n<p><span style=\"font-size: small;\">extensions\/HideSidebar\/HideSidebar.php \u5185\u5bb9\uff1a<\/span><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nif ( !defined( 'MEDIAWIKI' ) ) {\r\n        echo &quot;Not a valid entry point&quot;;\r\n        exit( 1 );\r\n}\r\n\r\n$wgExtensionCredits&#x5B;'other']&#x5B;] = array(\r\n        'path' =&gt; __FILE__,\r\n        'name' =&gt; 'HideSidebar',\r\n        'version' =&gt; '1.0.1',\r\n        'author' =&gt; 'Jlerner',\r\n        'url' =&gt; 'http:\/\/www.mediawiki.org\/wiki\/Extension:HideSidebar',\r\n        'description' =&gt; 'Allows to hide the sidebar from anonymos users',\r\n);\r\n\r\n$wgHooks&#x5B;'SkinBuildSidebar']&#x5B;] = 'efHideSidebar';\r\n\r\nfunction efHideSidebar($skin, &amp;$bar) {\r\n        global $wgUser;\r\n        \/\/ Hide sidebar for anonymous users\r\n        if (!$wgUser-&gt;isLoggedIn()) {\r\n                $url = Title::makeTitle(NS_SPECIAL, wfMsg('login'))-&gt;getLocalUrl();\r\n                $bar = array(\r\n                        'navigation' =&gt; array(\r\n                                array('text'   =&gt; 'Login',\r\n                                      'href'   =&gt; $url,\r\n                                      'id'     =&gt; 'n-login',\r\n                                      'active' =&gt; '')\r\n                        )\r\n                );\r\n        }\r\n        return true;\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6765\u6e90\uff1ahttp:\/\/www.mediawiki.org\/wiki\/Manual:Preventing_acce [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-2643","post","type-post","status-publish","format-standard","hentry","category-skill"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/2643","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=2643"}],"version-history":[{"count":1,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/2643\/revisions"}],"predecessor-version":[{"id":2644,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/2643\/revisions\/2644"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=2643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=2643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=2643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}