mediawiki

Media wiki second POST still returns NeedToken result

落花浮王杯 提交于 2020-01-06 08:30:19
问题 After first POST request I get "NeedToken" result then in my second POST request I pass token and sessionid as parameters. Here is my Javascript code: function wiki_auth(login, pass, ref){ $.post(ref+'api.php?action=login&lgname=' + login + '&lgpassword=' + pass + '&format=json', function(data) { if(data.login.result == 'NeedToken') { $.post(ref+'api.php?action=login&lgname=' + login + '&lgpassword=' + pass + '&lgtoken='+data.login.token+'&format=json&sessionid='+data.login.sessionid+'

How can I create, read, update and delete Mediawiki articles via scripts?

巧了我就是萌 提交于 2020-01-04 07:03:32
问题 Currently I'm trying to figure out what's the easiest way to perform CRUD operations on wiki pages (using PHP). I've built an media wiki extension where it's possible to upload a file and parse its content. Depending on the content it is necessary to either create or update the respective wiki articles. The question is if there are already some nice implementations (or best practices) which I might use or if I have to start from scratch with the wiki api. 回答1: Ok, this was a lot easier than

Check if user is sysop [duplicate]

泄露秘密 提交于 2020-01-04 06:55:13
问题 This question already has answers here : How to check if user is Sysop using Php in Mediawiki? (2 answers) Closed 4 years ago . How to check if user have sysop or other permission (in file LocalSettings.php or extension)? 回答1: Ok found: $wgHooks['ParserFirstCallInit'][] = 'ifUserSysop'; function ifUserSysop() { global $wgUser; if (in_array("sysop", $wgUser->getEffectiveGroups())) { // if sysop } if($wgUser->isLoggedIn()) { // is logged in } return true; } Full contents of $wgUser-

How to get with Mediawiki API all images in a category which are not in another one?

谁说我不能喝 提交于 2020-01-04 03:57:17
问题 I am entirely new to API, so sorry if the question is silly. I would like to get all images in a category in Commons let's say X, but exclude those which are also in another one (Y). I do not understand if I can actually do this. https://commons.wikimedia.org/w/api.php?action=query&list=categorymembers&cmtype=file&cmtitle=Category:X will get all of them, how to exclude some? moreover I would like in the result to have the description of the images, not just the name of the file, is that

How to get with Mediawiki API all images in a category which are not in another one?

…衆ロ難τιáo~ 提交于 2020-01-04 03:56:09
问题 I am entirely new to API, so sorry if the question is silly. I would like to get all images in a category in Commons let's say X, but exclude those which are also in another one (Y). I do not understand if I can actually do this. https://commons.wikimedia.org/w/api.php?action=query&list=categorymembers&cmtype=file&cmtitle=Category:X will get all of them, how to exclude some? moreover I would like in the result to have the description of the images, not just the name of the file, is that

Equals signs in Wikipedia template parameters won't display properly

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-03 16:38:29
问题 I've noticed that using links with equals signs in them doesn't seem to work properly (when the link is placed inside the {{missing information}} template). Is there any way to work around this limitation so that links with equals signs can be included inside MediaWiki templates? {{missing information|[https://www.google.com/search?q=google+search+test This link has an equals sign in it, and the template is not displaying properly.]}} {{missing information|[https://www.google.com/ This link

Equals signs in Wikipedia template parameters won't display properly

徘徊边缘 提交于 2020-01-03 16:37:08
问题 I've noticed that using links with equals signs in them doesn't seem to work properly (when the link is placed inside the {{missing information}} template). Is there any way to work around this limitation so that links with equals signs can be included inside MediaWiki templates? {{missing information|[https://www.google.com/search?q=google+search+test This link has an equals sign in it, and the template is not displaying properly.]}} {{missing information|[https://www.google.com/ This link

Displaying a mediawiki within a iframe

爱⌒轻易说出口 提交于 2020-01-03 09:07:18
问题 First off... I don't really want to use iframes but I don't think I have a choice in this situation. I'm integrating some help docs into an already built system. The easiest thing for me to let other people write the help is to provide them with a mediawiki with a custom style, then to integrate this into the system I wanted to put a direct link to the mediawiki in a help tab. The problem is, my mediawiki appears to block iframes from loading it (maybe this is a default setting) but I was

How do I add a horizontal top menu bar to a MediaWiki site without hacking the skin?

独自空忆成欢 提交于 2020-01-03 02:41:12
问题 I want my MediaWiki site to have (either in addition to, or instead of, the sidebar) a bar of links at the top of the site, visible on every page. Requirements To minimize future maintenance burden, my requirements are: No modifications to core, extension or skin code. I do not want to maintain project forks. Ideally, privileged users should be able to edit the links shown in the menu bar by editing a special page, similar to how MediaWiki:Sidebar controls the content of the usual sidebar.

MediaWiki API section names encoding

好久不见. 提交于 2020-01-02 19:25:11
问题 For [[Test#?]] , I get " Test#.3F " from action=parse bit of MediaWiki API. What is this encoding and how do I bring it to human readable format using Perl's CPAN? URI::Encode works for the percent decoding, but not the section names one. 回答1: It is UTF-8 percent-encoding, but with . instead of % , and spaces replaced with underscores; additionally, multiple consecutive whitespaces are collapsed, and : is preserved (not encoded into .3A ). The exact code which handles it is Parser: