User talk:Nad

Total Watched users?
--Johnp125 01:50, 5 October 2007 (UTC) Nad do you have any extension that might count total watched pages by all users on a wiki?
 * No I don't know of anything for that currently --Nad 03:10, 5 October 2007 (UTC)

--Johnp125 01:05, 6 October 2007 (UTC)

When you don't know, that makes me feel better when I don't know.

What do you think?
Hi Nad, looking how many extensions you develop, i thought if you could help in adding features to Semantic Forms extension http://discoursedb.org/SemanticForms/ As i can see you are working with Ajax, so you could do improves in this direction. Here i'll post some features i requested in SF groups. Would like to know what you think and if you have interesting. I'm not a coder, just an user. The SF would more people working on it. Ideas: Lleoliveirabr 16:09, 19 June 2007 (UTC)
 * http://groups.google.com/group/semantic-forms/t/aedc83dced19b640
 * http://groups.google.com/group/semantic-forms/t/e60db1b0bf11d692
 * http://groups.google.com/group/semantic-forms/browse_thread/thread/a226f2abad02c8ab
 * I really lke Chat/Lace extension from Firebreather too. Why you don't help him in dev? i gave many ideas to him, included about the map.
 * Thanks for your interest, I'll definately look into the Semantic Forms discussion as I'm very interested in the Semantic MediaWiki extension. many of the extensions I'm writing are for clients who use MediaWiki on their intranets, and I have a lot of work to do which I can't really deviate from, but I'm helping FireBreather with WikiChat indirectly by working on a generic Ajax layer that he can use - in fact it can work more dynamically than Ajax by using SWF's XMLSocket which can receive incoming requests rather than just recieving responses which the Ajax objects are limited to. --Nad 23:44, 19 June 2007 (UTC)

Bots and MediaWiki API
I've left a reply on my talk page. --80.57.160.139 18:22, 24 June 2007 (UTC)

A information for you: Extension:Todo Tasks
Hi Nad! I'm Roc michael. I am in charge of both systems Workflow and Product Data Management (PDM) in my company I work for and I know you are developing the wiki workflow. Do you know the Todo Tasks Extension? Its function some what likes the workflow in my company. I hope that It would be useful to you. I also hope I can use wiki to replace the workflow system buying form the PDM manufacturer in one day. If you want leave massage to me you can user my talkpage--Roc michael 14:34, 29 August 2007 (UTC)

A interesting extension you may want to know
Hi Nad! I know you've done your best to develop the Simple Form Extension for a long time. There is a form extension ,I think, you would like to know.--Roc michael 12:31, 5 September 2007 (UTC)
 * Thanks, yes I've been keeping my eye on that one ;-) and Extension:Semantic Forms is a major MediaWiki forms tool too --Nad 12:37, 5 September 2007 (UTC)

Extension implementation types
Given the large number of extensions you have authored, I wonder if you would be willing to give some feedback on a current discussion on implementation types (see Template_talk:Extension). (And sorry about the misclassification of your interwiki extension). Egfrank 14:42, 11 September 2007 (UTC)

Thumbnails problem
Hi Nad,

Thank you for your reply in the project support desk. Do you mind taking another look as I am still having trouble Project:Support_desk. -David 60.52.107.235 04:21, 15 September 2007 (UTC)
 * Thank you, you helped me solve the problem! The solution was changing "$wgSharedUploadDirectory = "$IP/commons/images"; " 60.52.107.235 05:32, 15 September 2007 (UTC)
 * Just create a symlink from one to the other, eg,

ln -s ...public_html/commons ...public_html/fr/commons

Oops! my bad
Typo - it should be both, shouldn't it? action for the fact it nukes, special because it does it through a special page. Egfrank 00:49, 18 September 2007 (UTC)
 * Yip that makes sense :) --Nad 00:50, 18 September 2007 (UTC)

Adding snapshot scripts into Mediawiki
Hi, the forum is pretty busy. Just in case you miss my message, I have posted one at the project support desk for your attention and advice. &mdash; PM Poon 09:30, 20 September 2007 (UTC)

Hi Nad, sorry to trouble you again as I encountered an error when following your suggestions. Please see same link above. &mdash; PM Poon 02:15, 21 September 2007 (UTC)

Adding scripts to content page
Hi Nad, thank you very very much. Your code works like magic at http://e-komputer.info/wiki/Halaman_utama. Can't imagine that one small quotation mark can spell the difference between complete success and utter failure! — PM Poon 06:39, 26 September 2007 (UTC)
 * I'm glad it worked out for you - I can't read a word of it but it looks very tidy ;-) --Nad 08:51, 26 September 2007 (UTC)

Login Failed. Wrong Password??
When i'm trying to login using the pywikipediabot module login.py in a intranet wikipedia, the response is Login Failed. Wrong Password??. Why does is happens considering that my username and password are correct? Thank You. —Mapelo 15:04, 8 October 2007 (UTC)


 * Do you have any extensions that affect the login like a CAPTCHA? You could try getting the code to log it's posted data and :the servers response so you can see more clearly what's happening (or visa versa, get the wiki to log the incoming request :and its response). --Nad 21:07, 8 October 2007 (UTC)


 * Hi Nad.Thank you for the response.
 * I don't no whether there's an extension like that or not. I'm not the administrator, but i'm going to inform myself.
 * We have seen the server log and it just reports an http code 200 that means that the request operation was successful. ::Another thing... is it necessary to the administrator of the intranet wiki to give me permission of loging(login.py) and ::using the pagefromfile.py module? What permission? How can he do this? Thank you. Mapelo 15:54, 9 October 2007 (UTC)


 * To see what extensions are installed go to the special:version page. You shouldn't need to do anything different to make the pybot login as long as its using name and password that work when entered normally by a person. You really need to see what html is being returned to the pybot when it fails to gain more information since there's nothing specific in the error. There may be a debug option to offer more information, otherwise you could change the pybot script to add the html to the error message. --Nad 20:06, 9 October 2007 (UTC)


 * The only extensions that i have is the PHP and MySQL modules. I have analysed the TCP stream and here is the code sended & received


 * Sended:

POST /mediawiki-1.10.0/index.php?title=Especial:Userlogin&action=submit HTTP/1.1 Host: wikidevel.intranet.ef.pt Accept-Encoding: identity Content-Length: 92 Content-type: application/x-www-form-urlencoded User-agent: PythonWikipediaBot/1.0 wpPassword= MY PASSWORD &wpLoginattempt=Aanmelden%20%26%20Inschrijven&wpName= MY USERNAME &wpRemember=1


 * Received

HTTP/1.1 200 OK Date: Thu, 11 Oct 2007 16:16:32 GMT Server: Apache/2.2.3 (CentOS) X-Powered-By: PHP/5.1.6 Set-Cookie: wikidb_session=s8b2v6u9sukpf75oq9fapivns3; path=/ Content-language: en Vary: Accept-Encoding,Cookie Expires: Thu, 01 Jan 1970 00:00:00 GMT Cache-Control: private, must-revalidate, max-age=0 Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=UTF-8

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  . .. .. .. .. .. .. Editing Especial:Userlogin - Preview - EFwiki ../*<![CDATA[*/ @import "/mediawiki-1.10.0/skins/monobook/main.css?63"; /*]]>*/ .. .. .. .. .. .. .. .. ../*<![CDATA[*/ var skin = "monobook"; var stylepath = "/mediawiki-1.10.0/skins"; var wgArticlePath = "/mediawiki-1.10.0/index.php/$1"; var wgScriptPath = "/mediawiki-1.10.0"; var wgServer = "http://wikidevel.intranet.ef.pt"; var wgCanonicalNamespace = ""; var wgCanonicalSpecialPageName = false; var wgNamespaceNumber = 0; var wgPageName = "Especial:Userlogin"; var wgTitle = "Especial:Userlogin"; var wgAction = "submit"; var wgArticleId = "94"; var wgIsArticle = false; var wgUserName = null; var wgUserGroups = null; var wgUserLanguage = "en"; var wgContentLanguage = "en"; var wgBreakFrames = false; var wgCurRevisionId = "622"; /*]]>*/ .. .. ../*<![CDATA[*/ @import "/mediawiki-1.10.0/index.php?title=MediaWiki:Common.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000"; @import "/mediawiki-1.10.0/index.php?title=MediaWiki:Monobook.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000"; @import "/mediawiki-1.10.0/index.php?title=-&action=raw&gen=css&maxage=18000"; /*]]>*/ .. .   . ..  .  .. name="top" id="top"> ....<h1 class="firstHeading">Editing Especial:Userlogin .. ...<h3 id="siteSub">From EFwiki ... ......... Jump to: navigation</a>, search</a> ... ... Preview This is only a preview; changes have not yet been saved!

<script type='text/javascript'> /*<![CDATA[*/ addButton('/mediawiki-1.10.0/skins/common/images/button_bold.png','Bold text','\'\'\,'\'\'\,'Bold  text','mw-editbutton-bold'); addButton('/mediawiki-1.10.0/skins/common/images/button_italic.png','Italic text','\'\,'\'\,'Italic text','mw-editbutton-italic');

addButton('/mediawiki-1.10.0/skins/common/images/button_link.png','Internal link',,,'Link    title','mw-editbutton-link'); addButton('/mediawiki-1.10.0/skins/common/images/button_extlink.png','External link (remember http:// prefix)','[',']','http://www.example.com link title','mw-editbutton-extlink'); addButton('/mediawiki-1.10.0/skins/common/images/button_headline.png','Level 2 headline','\n== ',' ==\n','Headline  text','mw-editbutton-headline'); addButton('/mediawiki-1.10.0/skins/common/images/button_image.png','Embedded  image','','Example.jpg','mw-editbutton-image'); addButton('/mediawiki-1.10.0/skins/common/images/button_media.png','Media file  link','[[Media:',']]','Example.ogg','mw-editbutton-media'); addButton('/mediawiki-1.10.0/skins/common/images/button_math.png','Mathematical formula  (LaTeX)','','<\/math>','Insert formula here','mw-editbutton-math'); addButton('/mediawiki-1.10.0/skins/common/images/button_nowiki.png','Ignore wiki  formatting',' ','<\/nowiki>','Insert non-formatted text here','mw-editbutton-nowiki'); addButton('/mediawiki-1.10.0/skins/common/images/button_sig.png','Your signature with  timestamp','--~',,,'mw-editbutton-signature'); addButton('/mediawiki-1.10.0/skins/common/images/button_hr.png','Horizontal line (use sparingly)','\n\n',,,'mw-editbutton-hr'); /*]]>*/ <form id="editform" name="editform" method="post" action="/mediawiki-1.10.0/index.php?title=Especial:Userlogin&amp;action=submit" enctype="multipart/form-data"> <input type='hidden' value="" name="wpSection" /> <input type='hidden' value="" name="wpStarttime" />

<input type='hidden' value="" name="wpEdittime" />

<input type='hidden' value="" name="wpScrolltop" id="wpScrolltop" />

<textarea tabindex='1' accesskey="," name="wpTextbox1" id="wpTextbox1" rows='25' cols='80' > .. Please note that all contributions to EFwiki may be edited, altered, or removed by other contributors. If you don't   want your writing to be edited mercilessly, then don't submit it here.

You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Project:Copyrights</a> for details). DO NOT SUBMIT COPYRIGHTED WORK WITHOUT PERMISSION! <label for='wpSummary'>Summary: <input tabindex='2' type='text' value="" name='wpSummary' id='wpSummary' maxlength='200' size='60' />

<input id="wpSave" name="wpSave" type="submit" tabindex="3" value="Save page" accesskey="s" title="Save your changes [s]" /> <input id="wpPreview" name="wpPreview" type="submit" tabindex="4" value="Show preview" accesskey="p" title="Preview your changes, please use this before saving! [p]" /> <input id="wpDiff" name="wpDiff" type="submit" tabindex="5" value="Show changes" accesskey="v" title="Show which changes  you made to the text. [v]" /> . Cancel</a> | Editing help</a> (opens in new window)</span

<input type='hidden' value="\" name="wpEditToken" /> <input name="wpAutoSummary" type="hidden" value="d41d8cd98f00b204e9800998ecf8427e" /> Retrieved from " http://wikidevel.intranet.ef.pt/mediawiki-1.10.0/index.php/Especial:Userlogin</a>" ...... ... ..  .  ..  ..  .  .. Views .. ...<ul> ..... <li id="ca-nstab-main" class="selected">Article</a></li> ..... <li id="ca-talk" class="new">Discussion</a></li> ..... <li id="ca-edit" class="selected">Edit</a></li>

..... <li id="ca-history">History</a></li> ....</ul> .. .  .  .. Personal tools .. ...<ul> ....<li id="pt-anonuserpage">192.168.42.107</a></li> ....<li id="pt-anontalk">Talk for this IP</a></li> ....<li id="pt-anonlogin">Log in / create account</a></li> ...</ul> .. .  .  ..</a> . .<script type="text/javascript"> if (window.isMSIE55) fixalpha; .. .. Navigation .. ...<ul> ....<li id="n-mainpage">Main Page</a></li> ....<li id="n-portal">Community portal</a></li> ....<li id="n-currentevents"><a href="/mediawiki-1.10.0/index.php/Current_events" title="Find background information on  current events">Current events</a></li> ....<li id="n-recentchanges"><a href="/mediawiki-1.10.0/index.php/Special:Recentchanges" title="The list of recent changes  in the wiki. [r]" accesskey="r">Recent changes</a></li> ....<li id="n-randompage"><a href="/mediawiki-1.10.0/index.php/Special:Random" title="Load a random page [x]" accesskey="x">Random page</a></li> ....<li id="n-help"><a href="/mediawiki-1.10.0/index.php/Help:Contents" title="The place to find out.">Help</a></li> ....<li id="n-sitesupport"><a href="/mediawiki-1.10.0/index.php/EFwiki:Site_support" title="Support us">Donations</a></li> ...</ul> .. .  ..  .. <label for="searchInput">Search .. ...<form action="/mediawiki-1.10.0/index.php/Special:Search" id="searchform"> ....<input id="searchInput" name="search" type="text" title="Search EFwiki [f]" accesskey="f" value="" /> ....<input type='submit' name="go" class="searchButton" id="searchGoButton".value="Go" /> ....<input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="Search" /> ... ..  .  .  .. Toolbox .. ...<ul> ....<li id="t-whatlinkshere"><a href="/mediawiki-1.10.0/index.php/Special:Whatlinkshere/Especial:Userlogin" title="List of  all wiki pages that link here [j]" accesskey="j">What links here</a></li> ....<li id="t-recentchangeslinked"><a href="/mediawiki-1.10.0/index.php/Special:Recentchangeslinked/Especial:Userlogin" title="Recent changes in pages linked from this page [k]" accesskey="k">Related changes</a></li> <li id="t-upload"><a href="/mediawiki-1.10.0/index.php/Special:Upload" title="Upload images or media files [u]" accesskey="u">Upload file</a></li> <li id="t-specialpages"><a href="/mediawiki-1.10.0/index.php/Special:Specialpages" title="List of all special pages [q]" accesskey="q">Special pages</a></li> ...</ul> .. .  ..  ...  ...  .... <a href="http://www.mediawiki.org/"><img src="/mediawiki-1.10.0/skins/common/images/poweredby_mediawiki_88x31.png" alt="Powered by MediaWiki" /></a> ...<ul id="f-list"> .... <a href="/mediawiki-1.10.0/index.php/EFwiki:Privacy_policy" title="EFwiki:Privacy policy">Privacy policy</a></li> .... <a href="/mediawiki-1.10.0/index.php/EFwiki:About" title="EFwiki:About">About EFwiki</a></li> .... <a href="/mediawiki-1.10.0/index.php/EFwiki:General_disclaimer" title="EFwiki:General   disclaimer">Disclaimers</a></li> ...</ul> .. .. . ..<script type="text/javascript">if (window.runOnloadHook) runOnloadHook;


 * Here is my python files in case there's something wrong...
 * user-config.py

mylang = 'pt' family = 'ef' usernames['ef']['pt'] = 'MaPelo' console_encoding = 'utf-8'


 * ef_family.py

import family class Family(family.Family): def __init__(self): family.Family.__init__(self) self.name = 'ef' #Set the family name; this should be the same as in the filename. self.langs = { 'pt': 'wikidevel.intranet.ef.pt', #Put the hostname here. }           def version(self, code): return "1.10.0" #version used. Not very important in most cases. def path(self, code): return '/mediawiki-1.10.0/index.php'
 * 1) -*- coding: utf-8  -*-
 * 1) The official Mozilla Wiki. #Put a short project description here.


 * The html code retrieved when logging by the browser is diferent. It goes directly to my userpage in the intranet wikipedia.
 * Please help me Nad, i must put this thing working as soon as possible and i can't do it!

Mapelo 18:56, 11 October 2007 (UTC)
 * The html source returned looks fine, it's not a failed login - where is the failed login showing up? --Nad 20:57, 12 October 2007 (UTC)
 * An inconsistency though - the text content in the html shows a non-english language, but it says that wgUserLanguage and wgContentLanguage are both "en". --Nad 21:00, 12 October 2007 (UTC)

Mediawiki skin (from helpdesk)
I'm looking for someone who could adapt an existing skin to a mediawiki. I've tried asking on IRC and on the mailing-list, without any success. Is there any other way of getting in touch with someone who could do it? —82.242.73.180 17:30, 8 October 2007 (UTC)
 * I do a fair bit of skinning, but I'd need to know the specifics before I could give you a quote --Nad 21:13, 8 October 2007 (UTC)
 * Nad, I've tried emailing you through your website; if the message doesn't get to you, you can email me at xavier@flouzo.net, I'll give you the details. —82.242.73.180 15:47, 11 October 2007 (UTC)

Thanks
Thank you for your reply to my question at the support desk.

Thibgc 06:08, 19 October 2007 (UTC)

Thank you
Hi,

Thank you for your reply to my question at the support desk : to remove "edit" at the right of each section.

@+

Epheméride

Big security hole in Simple Security extension
Hi, Nad, I find other user can edit the page which they should not edit this way:

1. go to "History" of the article

2. compare one record with another previous record

3. on the comparision page, the record on the left, click "Edit"

4. Alough there are some prompt information said you can not edit it, but actually the user can still edit it in the edit area, even change the Simple Security script!

Note: on the comparision page, the record on the right, the user can not edit it.


 * What version of SimpleForms and LocalSettings? When I access the history of a restricted article it gives the message:

Sorry, action not permitted! Your user rights do not permit the view action to be performed on this article.
 * If I use another browser (logged on) to obtain the url in 3 that you suggest it still provides a restriction message --Zven 17:18, 18 November 2007 (UTC)


 * Do you mean you can not access the "History" section at all? Sorry, how can I check the version of SimpleForms and LocalSettings? I tested it on my two different wiki version website, 1.10.1 and 1.11.0, unfortunately, this problem happened on both of them. --Italways 20:59, 18 November 2007 (UTC)


 * Thats right, on http://www.organicdesign.co.nz I cannot access the history of a restricted article unless I have the required permission I am logged in. You can check your extension version through your Special:Version. Your LocalSettings.php file should have the settings you added from the installation instructions on Extension:Simple Security --Zven 00:33, 19 November 2007 (UTC)


 * my Simple Security is version 3.4.8, 2007-10-09. I did not use Simple Form, that is why I wonder how to check Simple Form version.what the exact meaning of "restricted" you mentioned? On my site, I use on a page, that means only user1 can edit it, and it works if other user (e.g. User2) click "Edit" and try to edit it, it will prompt that it can not be edited, but if User2 go to History (on my website,every user can see page History, I try to use  to restrict it, but it does not work), he ca can hack and edit this page using the above way I described. --Italways 15:22, 19 November 2007 (UTC)


 * I'm not going to support or develop this version anymore, it's too legacy to continue with. You'll need to wait for version 4. --Nad 19:06, 18 November 2007 (UTC)

PdfBook
Hi, Nad.. Thanks for PDF_Book. Hope this is the place to ask questions. Why does a generated pdf book show question marks "?" instead of an apostrophe " ' " in non English doc (i.e. French) ? Is there a place where I could find a more detailed help for using Doc_Book (I read already the help page)...I still did not manage using it without the Category tag. Thanks for help.

CSS and cite.php
See Extension talk:CSS

Thank you!
Thank you for your reply on the Support Desk. Unfortunately your solution didn't work. Could you please look at it again? See here and also here. —99.236.141.81 05:25, 15 December 2007 (UTC)
 * Never mind. I found a way to do it. Probably not the best way, but at least it works. —99.236.141.81 17:41, 20 December 2007 (UTC)

Support team
Hello, we are assembling a MedaiWiki Support Team  and wonder if you would like to join. This is so that we can provide optimum support to MediaWiki users. With this we can discuss issues, threads, etc. -PatPeter, MedaiWiki Support Team  03:26, 16 December 2007 (UTC)

CurrentUsers, Treeview4 cannot work fine with Extension:PHPBB/Users Integration
After I installed the PHPBB/Users Integration, I would get some PHP error code about Treeview4 and CurrentUsers

Notice: Undefined variable: bot in D:\AppServ\www\mediawiki-1.11.0\extensions\CurrentUsers\CurrentUsers.php on line 45 Notice: Undefined index: vert in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 196 Notice: Undefined index: vert in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 105 Notice: Undefined index: node in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 106 Notice: Undefined index: last in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 107 Notice: Undefined index: vert in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 105 Notice: Undefined index: node in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 106 Notice: Undefined index: last in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 107
 * Before Login, I saw the code:

Notice: Undefined variable: bot in D:\AppServ\www\mediawiki-1.11.0\extensions\CurrentUsers\CurrentUsers.php on line 45 Notice: Undefined index: vert in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 196
 * After login, I saw the code:

Could you give me a hand?
 * MediaWiki: 1.11.0
 * Win XP
 * The AppServ Open Project - 2.5.7 for Windows
 * Apache Web Server Version 2.2.3
 * PHP Script Language Version 5.1.6
 * MySQL Database Version 5.0.24a
 * phpMyAdmin Database Manager Version 2.9.0.2
 * CurrentUsers (version 1.0.2, 2007-07-26)
 * Treeview4 (version 4.0.8, 2007-10-10)

Installing code of phpBB in Localsetting.php
// PHPBB User Database Plugin. (Requires MySQL Database) require_once 'extensions/Auth_phpbb.php'; $GLOBALS['wgPHPBB_WikiGroupName'] = 'wiki';    // Name of your PHPBB group // users need to be a member // of to use the wiki. (i.e. wiki) $GLOBALS['wgPHPBB_UseWikiGroup']   = true;     // This tells the Plugin to require // a user to be a member of the above // phpBB group. (ie. wiki) Setting // this to false will let any phpBB // user edit the wiki. $GLOBALS['wgPHPBB_UseExtDatabase'] = false;    // This tells the plugin that the phpBB tables // are in a different database then the wiki. // The default settings is false. /*-[NOTE: You only need the next four settings if you set $wgPHPBB_UseExtDatabase to true.]-*/ //$GLOBALS['wgPHPBB_MySQL_Host']    = 'host';               // phpBB MySQL Host Name. //$GLOBALS['wgPHPBB_MySQL_Username'] = 'username';          // phpBB MySQL Username. //$GLOBALS['wgPHPBB_MySQL_Password'] = 'password';          // phpBB MySQL Password. //$GLOBALS['wgPHPBB_MySQL_Database'] = 'database_name';     // phpBB MySQL Database Name. $GLOBALS['wgPHPBB_UserTB']          = 'phpbb_users';        // Name of your PHPBB user table. (i.e. phpbb_users) $GLOBALS['wgPHPBB_GroupsTB']        = 'phpbb_groups';       // Name of your PHPBB groups table. (i.e. phpbb_groups) $GLOBALS['wgPHPBB_User_GroupTB']    = 'phpbb_user_group';   // Name of your PHPBB user_group table. (i.e. phpbb_user_group) $wgAuth                             = new Auth_PHPBB;     // Auth_PHPBB Plugin.

Auth_phpbb.php
<?php

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**    * This file makes MediaWiki use a phpbb user database to     * authenticate with. This forces users to have a PHPBB account * in order to log into the wiki. This should also force the user to    * be in a group called wiki. *    * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by    * the Free Software Foundation; either version 2 of the License, or     * (at your option) any later version. *    * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. *    * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * http://www.gnu.org/copyleft/gpl.html *    * @package MediaWiki * @subpackage Auth_PHPBB * @author Nicholas Dunnaway * @copyright 2004-2007 php|uber.leet * @license http://www.gnu.org/copyleft/gpl.html * @CVS: $Id: Auth_phpbb.php,v 2.6.0 2007/02/14 15:16:12 nkd Exp $ * @link http://uber.leetphp.com * @version $Revision: 2.6.0 $ *    */

error_reporting(E_ALL); // Debug

// First check if class has already been defined. if (!class_exists('AuthPlugin')) {

/**        * Auth Plugin *        */     // require_once './includes/AuthPlugin.php'; // Changeing this line for the extension "User:Hex2bit/Calendar" Michael Chang require_once "$IP/includes/AuthPlugin.php";

}

/**    * Handles the Authentication with the PHPBB database. *    */    class Auth_PHPBB extends AuthPlugin {

/**   	 * Add a user to the external authentication database. * Return true if successful. *   	 * NOTE: We are not allowed to add users to phpBB from the * wiki so this always returns false. *   	 * @param User $user * @param string $password * @return bool * @access public */   	function addUser( $user, $password ) { return false; }

/**		 * Can users change their passwords? *		 * @return bool */		function allowPasswordChange { return true; }

/**   	 * Check if a username+password pair is a valid login. * The name will be normalized to MediaWiki's requirements, so   	 * you might need to munge it (for instance, for lowercase initial    	 * letters). *   	 * @param string $username * @param string $password * @return bool * @access public * @todo Check if the password is being changed when it contains a slash or an escape char. */   	function authenticate($username, $password) {

// Connect to the database. $fresMySQLConnection = $this->connect;

// Clean $username and force lowercase username. $username = htmlentities(strtolower($username), ENT_QUOTES, 'UTF-8'); $username = str_replace('&#039;', '\\\'', $username); // Allow apostrophes (Escape them though)

// Check MySQLVersion if ($GLOBALS['gstrMySQLVersion'] >= 4.1) { // Check Database for username and password. $fstrMySQLQuery = 'SELECT `username`, `user_password` FROM `'. $GLOBALS['wgPHPBB_UserTB']. '`       		                   WHERE `username` = \''. $username. '\'                                   LIMIT 1'; } else { // Check Database for username and password. $fstrMySQLQuery = 'SELECT `username`, `user_password` FROM `'. $GLOBALS['wgPHPBB_UserTB']. '`       		                   WHERE `username` = \''. $username. '\'                                  LIMIT 1'; }

// Query Database. $fresMySQLResult = mysql_query($fstrMySQLQuery, $fresMySQLConnection) //<- or die($this->mySQLError('Unable to view external table'));

while($faryMySQLResult = mysql_fetch_array($fresMySQLResult)){ // Check if password submited matches the PHPBB password. // Also check if user is a member of the phpbb group 'wiki'. // print md5($password). ':' . $faryMySQLResult['user_password']. ' '; // Debug if (md5($password) == $faryMySQLResult['user_password'] && $this->isMemberOfWikiGroup($username)){ return true; }           }    		return false; }

/**   	 * Return true if the wiki should create a new local account automatically * when asked to login a user who doesn't exist locally but does in the * external auth database. *   	 * If you don't automatically create accounts, you must still create * accounts in some way. It's not possible to authenticate without * a local account. *   	 * This is just a question, and shouldn't perform any actions. *   	 * NOTE: I have set this to true to allow the wiki to create accounts. *      Without an accout in the wiki database a user will never be *      able to login and use the wiki. I think the password does not *      matter as long as authenticate returns true. *   	 * @return bool * @access public */   	function autoCreate { return true; }

/**   	 * Check to see if external accounts can be created. * Return true if external accounts can be created. *   	 * NOTE: We are not allowed to add users to phpBB from the * wiki so this always returns false. *   	 * @return bool * @access public */   	function canCreateAccounts { return false; }

/**        * Connect to the database. All of these settings are from the * LocalSettings.php file. This assumes that the PHPBB uses the same * database/server as the wiki. *        * {@source } * @return resource */       function connect {           // Check if the phpBB tables are in a different database then the Wiki. if ($GLOBALS['wgPHPBB_UseExtDatabase'] == true) {

// Connect to database. I supress the error here. $fresMySQLConnection = @mysql_connect($GLOBALS['wgPHPBB_MySQL_Host'],   //<-                                                     $GLOBALS['wgPHPBB_MySQL_Username'], //<-                                                     $GLOBALS['wgPHPBB_MySQL_Password'], true);

// Check if we are connected to the database. if (!$fresMySQLConnection) { $this->mySQLError('There was a problem when connecting to the phpBB database. ' . //<-                                     'Check your Host, Username, and Password settings. '); }

// Select Database $db_selected = mysql_select_db($GLOBALS['wgPHPBB_MySQL_Database'], $fresMySQLConnection);

// Check if we were able to select the database. if (!$db_selected) { $this->mySQLError('There was a problem when connecting to the phpBB database. ' .                                     'The database ' . $GLOBALS['wgPHPBB_MySQL_Database'] . ' was not found. '); }

} else {

// Connect to database. $fresMySQLConnection = mysql_connect($GLOBALS['wgDBserver'], $GLOBALS['wgDBuser'], $GLOBALS['wgDBpassword'], true);

// Check if we are connected to the database. if (!$fresMySQLConnection) { $this->mySQLError('There was a problem when connecting to the phpBB database. ' . //<-                                     'Check your Host, Username, and Password settings. '); }

// Select Database: This assumes the wiki and phpbb are in the same database. $db_selected = mysql_select_db($GLOBALS['wgDBname']);

// Check if we were able to select the database. if (!$db_selected) { $this->mySQLError('There was a problem when connecting to the phpBB database. ' .                                     'The database ' . $GLOBALS['wgDBname'] . ' was not found. '); }

}

$GLOBALS['gstrMySQLVersion'] = substr(mysql_get_server_info, 0, 3); // Get the mysql version.

return $fresMySQLConnection; }

/**   	 * If you want to munge the case of an account name before the final * check, now is your chance. */   	function getCanonicalName( $username ) { // Connect to the database. $fresMySQLConnection = $this->connect;

// Clean $username and force lowercase username. $username = htmlentities(strtolower($username), ENT_QUOTES, 'UTF-8'); $username = str_replace('&#039;', '\\\'', $username); // Allow apostrophes (Escape them though)

// Check MySQLVersion if ($GLOBALS['gstrMySQLVersion'] >= 4.1) {

// Check Database for username. We will return the correct casing of the name. $fstrMySQLQuery = 'SELECT `username` FROM `'. $GLOBALS['wgPHPBB_UserTB']. '`       		                   WHERE `username` = \''. $username. '\'                                   LIMIT 1'; } else {

// Check Database for username. We will return the correct casing of the name. $fstrMySQLQuery = 'SELECT `username` FROM `'. $GLOBALS['wgPHPBB_UserTB']. '`       		                   WHERE `username` = \''. $username. '\'                                  LIMIT 1'; }

// Query Database. $fresMySQLResult = mysql_query($fstrMySQLQuery, $fresMySQLConnection) //<- or die($this->mySQLError('Unable to view external table'));

while($faryMySQLResult = mysql_fetch_assoc($fresMySQLResult)){ return ucfirst($faryMySQLResult['username']); }

// At this point the username is invalid and should return just as it was passed. return $username; }

/**   	 * When creating a user account, optionally fill in preferences and such. * For instance, you might pull the email address or real name from the * external user database. *   	 * The User object is passed by reference so it can be modified; don't * forget the & on your function declaration. *   	 * NOTE: This gets the email address from PHPBB for the wiki account. *   	 * @param User $user * @access public */   	function initUser(&$user) {

// Connect to the database. $fresMySQLConnection = $this->connect;

// Clean $username and force lowercase username. $username = htmlentities(strtolower($user->mName), ENT_QUOTES, 'UTF-8'); $username = str_replace('&#039;', '\\\'', $username); // Allow apostrophes (Escape them though)

// Check MySQLVersion if ($GLOBALS['gstrMySQLVersion'] >= 4.1) { // Check Database for username and email address. $fstrMySQLQuery = 'SELECT `username`, `user_email` FROM `'. $GLOBALS['wgPHPBB_UserTB']. '`       		                   WHERE `username` = \''. $username. '\'                                   LIMIT 1'; } else { // Check Database for username and email address. $fstrMySQLQuery = 'SELECT `username`, `user_email` FROM `'. $GLOBALS['wgPHPBB_UserTB']. '`       		                   WHERE `username` = \''. $username. '\'                                  LIMIT 1'; }

// Query Database. $fresMySQLResult = mysql_query($fstrMySQLQuery, $fresMySQLConnection) //<- or die($this->mySQLError('Unable to view external table'));

while($faryMySQLResult = mysql_fetch_array($fresMySQLResult)){ $user->mEmail      = $faryMySQLResult['user_email']; // Set Email Address. $user->mRealName   = 'I need to Update My Profile';  // Set Real Name. }

}

/**   	 * Checks if the user is a member of the PHPBB group called wiki. *   	 * @param string $username * @access public * @return bool * @todo Remove 2nd connection to database. For function isMemberOfWikiGroup *   	 */    	function isMemberOfWikiGroup($username){

// In LocalSettings.php you can control if being a member of a wiki // is required or not. if (isset($GLOBALS['wgPHPBB_UseWikiGroup']) && $GLOBALS['wgPHPBB_UseWikiGroup'] === false){ return true; }

// Connect to the database. $fresMySQLConnection = $this->connect;

/**            *  This is a great query. It takes the username and gets the userid. Then * it gets the group_id number of the the Wiki group. Last it checks if the * userid and groupid are matched up. (The user is in the wiki group.) *            *  Last it returns TRUE or FALSE on if the user is in the wiki group. */

// Get UserId mysql_query('SELECT @userId := `user_id` FROM `' . $GLOBALS['wgPHPBB_UserTB'] . //<-                       '` WHERE `username` = \'' . $username . '\';', $fresMySQLConnection) //<- or die($this->mySQLError('Unable to get userID.'));

// Get WikiId mysql_query('SELECT @wikiId := `group_id` FROM `' . $GLOBALS['wgPHPBB_GroupsTB'] . //<-                       '` WHERE `group_name` = \'' . $GLOBALS['wgPHPBB_WikiGroupName'] . '\';', $fresMySQLConnection) //<- or die($this->mySQLError('Unable to get wikiID.'));

// Check UserId and WikiId mysql_query('SELECT @isThere := COUNT( * ) FROM `' . $GLOBALS['wgPHPBB_User_GroupTB'] . //<-                       '` WHERE `user_id` = @userId AND `group_id` = @wikiId;', $fresMySQLConnection) //<- or die($this->mySQLError('Unable to get validate user group.'));

// Return Result. $fstrMySQLQuery = 'SELECT IF(@isThere > 0, \'true\', \'false\') AS `result`;';

// Query Database. $fresMySQLResult = mysql_query($fstrMySQLQuery, $fresMySQLConnection) //<- or die($this->mySQLError('Unable to view external table'));

// Check for a true or false response. while($faryMySQLResult = mysql_fetch_array($fresMySQLResult)){ if ($faryMySQLResult['result'] == 'true') { return true; // User is in Wiki group. } else { return false; // User is not in Wiki group. }           }

}

/**   	 * Modify options in the login template. *   	 * NOTE: Turned off some Template stuff here. Anyone who knows where * to find all the template options please let me know. I was only able * to find a few. *   	 * @param UserLoginTemplate $template * @access public */   	function modifyUITemplate( &$template ) {   		$template->set('usedomain',   false); // We do not want a domain name. $template->set('create',     false); // Remove option to create new accounts from the wiki. $template->set('useemail',   false); // Disable the mail new password box. }

/**   	 * This prints an error when a MySQL error is found. *   	 * @param string $message * @access public */   	function mySQLError( $message ) {   	    echo $message. ' ';           echo 'MySQL Error Number: '. mysql_errno. ' ';           echo 'MySQL Error Message: '. mysql_error. '

';           exit; }

/**   	 * Set the domain this plugin is supposed to use when authenticating. *   	 * NOTE: We do not use this. *   	 * @param string $domain * @access public */   	function setDomain( $domain ) { $this->domain = $domain; }

/**   	 * Set the given password in the authentication database. * Return true if successful. *   	 * NOTE: We only allow the user to change their password via phpBB. *   	 * @param string $password * @return bool * @access public */   	function setPassword( $password ) { return true; }

/**   	 * Return true to prevent logins that don't authenticate here from being * checked against the local database's password fields. *   	 * This is just a question, and shouldn't perform any actions. *   	 * Note: This forces a user to pass Authentication with the above *      function authenticate. So if a user changes their PHPBB *      password, their old one will not work to log into the wiki. *      Wiki does not have a way to update it's password when PHPBB *      does. This however does not matter. *   	 * @return bool * @access public */   	function strict { return true; }

/**		 * Update user information in the external authentication database. * Return true if successful. *		 * @param $user User object. * @return bool * @public */		function updateExternalDB( $user ) { return true; }

/**   	 * When a user logs in, optionally fill in preferences and such. * For instance, you might pull the email address or real name from the * external user database. *   	 * The User object is passed by reference so it can be modified; don't * forget the & on your function declaration. *   	 * NOTE: Not useing right now. *   	 * @param User $user * @access public */   	function updateUser( &$user ) { return true; }

/**   	 * Check whether there exists a user account with the given name. * The name will be normalized to MediaWiki's requirements, so   	 * you might need to munge it (for instance, for lowercase initial    	 * letters). *   	 * NOTE: MediaWiki checks its database for the username. If it has *      no record of the username it then asks. "Is this really a   	 *       valid username?" If not then MediaWiki fails Authentication. *   	 * @param string $username * @return bool * @access public * @todo write this function. */   	function userExists($username) {

// Connect to the database. $fresMySQLConnection = $this->connect;

// Clean $username and force lowercase username. $username = htmlentities(strtolower($username), ENT_QUOTES, 'UTF-8'); $username = str_replace('&#039;', '\\\'', $username); // Allow apostrophes (Escape them though)

// Check MySQLVersion if ($GLOBALS['gstrMySQLVersion'] >= 4.1) {

// Check Database for username. $fstrMySQLQuery = 'SELECT `username` FROM `'. $GLOBALS['wgPHPBB_UserTB']. '`       		                   WHERE `username` = \''. $username. '\'                                   LIMIT 1';

} else {

// Check Database for username. $fstrMySQLQuery = 'SELECT `username` FROM `'. $GLOBALS['wgPHPBB_UserTB']. '`       		                   WHERE `username` = \''. $username. '\'                                  LIMIT 1';

}

// Query Database. $fresMySQLResult = mysql_query($fstrMySQLQuery, $fresMySQLConnection) //<- or die($this->mySQLError('Unable to view external table'));

while($faryMySQLResult = mysql_fetch_array($fresMySQLResult)){

// print htmlentities(strtolower($username), ENT_QUOTES, 'UTF-8'). ' : ' . htmlentities(strtolower($faryMySQLResult['username']), ENT_QUOTES, 'UTF-8'); // Debug // Double check match. if (htmlentities(strtolower($username), ENT_QUOTES, 'UTF-8') == htmlentities(strtolower($faryMySQLResult['username']), ENT_QUOTES, 'UTF-8')){ return true; // Pass }           }            return false; // Fail }

/**   	 * Check to see if the specific domain is a valid domain. *   	 * @param string $domain * @return bool * @access public */   	function validDomain( $domain ) { return true; }

} // End: class Auth_PHPBB

?>