From: Happy-melon Date: Mon, 28 Sep 2009 19:04:10 +0000 (+0000) Subject: Recommit some of the 'backend' stuff from the Login branch, after talking with Brion: X-Git-Tag: 1.31.0-rc.0~39486 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=0e436d09c3d52b9d71cd85102edee007a4058cfa;p=lhc%2Fweb%2Fwiklou.git Recommit some of the 'backend' stuff from the Login branch, after talking with Brion: * ExternalUser::getLocalUser() from r56683 * Documentation and style tweaks for HTMLForm from r56682 * HTMLForm::add{HiddenField|(Pre|Post|Header)Text|Button}() functions, from 56782 and r56896. Frontend stuff will wait until after 1.16 is branched. --- diff --git a/includes/ExternalUser.php b/includes/ExternalUser.php index a5f932232e..18a50f360d 100644 --- a/includes/ExternalUser.php +++ b/includes/ExternalUser.php @@ -282,7 +282,25 @@ abstract class ExternalUser { $dbw->replace( 'external_user', array( 'eu_wiki_id', 'eu_external_id' ), array( 'eu_wiki_id' => $id, - 'eu_external_id' => $this->getId() ), - __METHOD__ ); + 'eu_external_id' => $this->getId() ), + __METHOD__ ); } -} + + /** + * Check whether this external user id is already linked with + * a local user. + * @return Mixed User if the account is linked, Null otherwise. + */ + public final function getLocalUser(){ + $dbr = wfGetDb( DB_SLAVE ); + $row = $dbr->selectRow( + 'external_user', + '*', + array( 'eu_external_id' => $this->getId() ) + ); + return $row + ? User::newFromId( $row->eu_wiki_id ) + : null; + } + +} \ No newline at end of file diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 2abe7dadaa..65948f39be 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -1,16 +1,54 @@ $info, + * where $info is an Associative Array with any of the following: + * + * 'class' -- the subclass of HTMLFormField that will be used + * to create the object. *NOT* the CSS class! + * 'type' -- roughly translates into the