User talk:Marc.M~mediawikiwiki

From mediawiki.org
Latest comment: 18 years ago by Bdk in topic Missing licences

Oldies...[edit]

archives

Missing licences[edit]

Hello Marc, could you please add proper information on source and licence to every image you've uploaded? Some of them are copyrighted and are not really used on this site. Have a look at Image:Mediawiki-logo 171x105.png, Image:MediaWiki-icon-text_84x21.png, Image:Corneille.jpg, Image:150px-Pierre_corneille_auteur.jpg, Image:Phpdoc-logo-trans.png, Image:Sourceforge.net_logo.png. You can add {{deletebecause|reason ...}} to the files, of course. If you want to store and use Wikimedia logos, use the Commons please (most images are already there). Thanks and greetings --:Bdk: 05:00, 15 August 2005 (UTC)Reply

  • Nice job you did... (my version became much too large and difficult to maintain due to vandalism)
  • Corneille's images : I am not sure we still need the images. Anyway, I should have preferably first look at commons, but, in fact, the images I used to illustrate Corneille's quotation came from en and fr
  • Mediawiki images : some attempts to cut existing images so that they may fit within text. Probably not needed anymore.
  • Sourceforge logo : I may not place the logo on commons (even if, for us, SF is of course related to our vision of sharing knowledge) because is is subject to http://www.vasoftware.com/legal.php (shortly said : non commercial) and commons may not accept non commercial. I don't know regarding mediawiki policy. Anyway we may decide not to use the logo.
  • PhpDoc : another logo related to our vision... http://www.phpdoc.org source indicates Copyright © 2000-2005 Joshua Eichorn (one of the authors of phpDoc). I did not find the image on commons. If needed, may be we can ask the authorization? But again, the image was only needed because I made a very large page and I was willing to made it a little bit more smiling.
Is fair-use acceptable on mediawiki? 
Otherwise, I'll put the {{deletebecause|reason ...}} on Sourceforge and PhpDoc images...

I made a small addition to your excellent extension. It now displays the current user's (or any other user for that matter) permissions before the permission table. The new code is below. Feel free to include it into your extension.

<?php
// !FILE : includes/SpecialPermissions.php
// !CLASS : Permissions // !INNER-CLASS
/**
 * Dump the global variable $wgGroupPermissions
 *
 * @package MediaWiki
 * @subpackage SpecialPage
 * @version  1.5.104.9 
 * @requires MediaWiki mw 1.5 , beta 4
 * @since 1.5.104.2 (2005-08-03)
 * @author marc.meurrens@ACM.org
 * @author nathan.meurrens@cassiopea.org
 * @copyright {@link http://www.meurrens.org}
 * @copyleft {@link http://www.meurrens.org}
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 
 *@fixed up by Adam1213.tk if is set on line 150 + 350 aprox + moved up checkign that Permissions_SHOW_RIGHTS_ON_META is defined
 
 */
 
 
// !ANTI-CRASH : mediawiki stuff + version stuff
 
if (!defined('MEDIAWIKI'))
{
        // die( "<h2>File ".__FILE__." is part of MediaWiki and is not a valid entry point</h2>\n" );
        // __FILE__ may be a privacy issue (reveals the linux user name, etc)
        die( "<h2>This file is part of MediaWiki and is not a valid entry point</h2>\n" );
}
 
// just in case the class has been defined in another file :
if( defined('Permissions_VERSION') || defined('Permissions_BACKWARD') )
{
        die("<h2>Attempt to include file <u>".__FILE__."</u> while
              <u>Permissions</u> class already defined with 
    <br />Permissions_VERSION = " 
        . Permissions_VERSION . "
    <br />Permissions_YYYY_MM_DD_TIME = " 
        . Permissions_YYYY_MM_DD_TIME . "
    <br />Permissions_BACKWARD = " 
        . Permissions_BACKWARD . "
    </h2>\n") ;
}
 
 
 
if(!defined('Permissions_SHOW_RIGHTS_ON_META'))
{
        /**
     * by default, links to groups are provided
     */
        define( 'Permissions_SHOW_GROUPS_ON_META' , true ) ;
 
}
 
 
// !VERSION // !DVRM  :
 
/**
 * current version in DVRM format
 */
define('Permissions_VERSION', '1.5.104.9')  ;
 
// modify Permissions_BACKWARD only if your changes may affect other classes!
/**
 * backward compatibility in DVRM format
 */
define('Permissions_BACKWARD', '1.5.104.8')  ;
 
/**
 * date of current version
 */
define('Permissions_YYYY_MM_DD_TIME', '2005-08-05 11:24')  ;
 
 
// !CONFIG : default values (to be eventually modified before include) :
 
if(! defined('Permissions_CONVENIENCE_LINKS'))
{
        /**
     * by default, convenience links are provided
     */
        define( 'Permissions_CONVENIENCE_LINKS' , true )  ;
}
 
if(!defined('Permissions_SHOW_RIGHTS_ON_META'))
{
        /**
     * by default, links to rights are provided
     */
        define( 'Permissions_SHOW_RIGHTS_ON_META' , true ) ;
}
 
 
 
if(!defined('Permissions_TH_STYLE'))
{
        /**
     * style definition for header cells
     * @internal use CSS !!!
     */
        define( 'Permissions_TH_STYLE' , " style=' background-color : #ff0 ; ' " ) ;
}
 
if(!defined('Permissions_TABLE_STYLE'))
{
        /**
     * style definition for HTML table
     * @internal use CSS !!!
     */
        define( 'Permissions_TABLE_STYLE' , " border='1' " ) ;
}
 
// !CONSTANT's : internal constants
 
define( 'Permissions_URL_SPECIAL' , "http://meta.wikimedia.org/wiki/Special_" ) ;
define( 'Permissions_URL_RIGHT' , "http://meta.wikimedia.org/wiki/Right_" ) ;
define( 'Permissions_URL_GROUP' , "http://meta.wikimedia.org/wiki/Group_" ) ;
 
 
// !INIT : pre-init stuff processed because of an include_once in the LocalSettings.php file :
 
$wgExtensionFunctions[] = 'wfSpecialPermissions' ;
 
$wgExtensionCredits['specialpage'][] = array(
'name'
=> 'Permissions' ,
'version'
=> ( '[http://meta.wikimedia.org/wiki/DVRM ' . Permissions_VERSION . '] ('
. Permissions_YYYY_MM_DD_TIME . ')' ) ,
'author'
=> '[http://www.meurrens.org/ Marc Meurrens, Brussels (be)]' ,
'url'
=> 'http://www.mediawiki.org/wiki/Extension:Permissions' ,
'description' => 'Adds a [[Special:Permissions]] page to display a chart of which permissions are given to which groups.',
);
 
 
// !FUNCTION : wfSpecialPermissions()
/**
 * global entry point function 
 *
 * @version 1.5.104.4
 * @requires MediaWiki mw 1.5 , beta 4
 * @since 1.5.104.2 (2005-08-03) 
 */
function wfSpecialPermissions()
{
        // !STEP-1 OF wfSpecialPermissions() : complete the messages that will be used :
        global $wgMessageCache ;
        $wgMessageCache->addMessages(array(
        'permissions' => 'Permissions' ,
        ));
 
        // !STEP-2  OF wfSpecialPermissions()  : hooks for logs : none...
 
        // !STEP-3  OF wfSpecialPermissions() : include what should be included :
        global $IP ; // for include's or require's
        /**
     *
     */
        require_once( $IP . "/includes/SpecialPage.php") ;
 
        // !STEP-4  OF wfSpecialPermissions() : inner class definition(s) :
        // !CLASS: Permissions extends SpecialPage // !INNER-CLASS
        /**
     *
     */
        class Permissions extends SpecialPage
        {
                // !IV's : none
 
                // !CT
                /**
             * constructor
             */
                function Permissions()
                {
                        SpecialPage::SpecialPage('Permissions') ;
                }
 
                // !IM's : instance methods
                // !IM : execute() // !OVRDN
                /**
             * ovrdn of the abstract execute() function :
             * manage the output, relies on 2 static functions :
             * the big BuildHtmlTable() and the small BuildHtmlLink()
             *
         * @uses Global_DOC::$wg_zPermissionsWithConvenienceLinks
         * @uses Global_DOC::$wgOut
         * @uses OutputPage::addHTML()
             */
                function execute($user)
                {
                        global $wgOut , $wg_zPermissionsWithConvenienceLinks, $wgUser ;
                        $wg_zPermissionsWithConvenienceLinks = isSet($wg_zPermissionsWithConvenienceLinks) ?
                        $wg_zPermissionsWithConvenienceLinks : Permissions_CONVENIENCE_LINKS ;

			if (!isset($user))
				$user = $wgUser;
			else
				$user = User::newFromName($user); 
			$first = true;
			$rights = '';
			foreach ($user->getRights() as $right) {
				if ($first)
					$first = false;
				else
					$rights .= ', ';
				$rights .= $right;
			}
			$wgOut->addWikiText("'''".$user->getRealName() . "'s''' current permissions are ($rights)\n\n");

                        $szhOut = Permissions::BuildHtmlTable() ;
                        // !TODO : rely on $wgValidSpecialPagesFr to translate...
                        if($wg_zPermissionsWithConvenienceLinks)
                        {
                                $szhOut .= Permissions::BuildHtmlLink() ;
                        }
                        $wgOut->addHTML( $szhOut );
                }
 
                // !SF's : begin static functions :
                /**#@+
                * @static
                */
 
                // the small workhorse :
                // !SF : function BuildHtmlLink()
                /**
             * @return htmlstring
             */
                function BuildHtmlLink()
                {
                        $szUrl = Permissions_URL_SPECIAL ;
                        return Permissions::Wiki_2_Html( "
 * [[Special:Permissions|Permissions]] <small>[{$szUrl}Permissions (help)]</small>          
 * [[Special:Listusers|Listusers]] <small>[{$szUrl}Listusers (help)]</small>                
 * ([[Special:Userrights|Userrights]]) <small>[{$szUrl}Userrights (help)]</small>
 * ([[Special:Renameuser|Renameuser]]) <small>[{$szUrl}Renameuser (help)]</small>           
                " ) ;
                }
 
                // the big workhorse :
                // !SF : function BuildHtmlTable()
                /**
        *
    * @return htmlstring $szhOut
    * @version 1.5.104.7 (mediawiki 1.5 , beta 4 , minor revision 7)
    * @since 1.5.104.6 (2005-08-03) 
    * @uses Global_DOC::$wgGroupPermissions
    * @uses Global_DOC::$wg_szGroup_2_szGroupMeaning
    * @uses Global_DOC::$wg_szRight_2_szRightMeaning
        */
                function BuildHtmlTable()
                {
                        // !STEP-1 OF BuildHtmlTable() : translate
                        $szhOut = '' ;
                        $szhYes = htmlspecialchars( Permissions::Translate( 'val_yes' ) );
 
                        // !STEP-2 OF BuildHtmlTable()  : init
                        global $wgGroupPermissions , $wgOut
                        , $wg_szGroup_2_szhGroupMeaning , $wg_szRight_2_szhRightMeaning
                        , $wg_szGroup_2_szwGroupMeaning , $wg_szRight_2_szwRightMeaning
                        // * @since 1.5.104.7 : zShow Groups/Rights on meta
                        , $wg_zShowRightsOnMeta , $wg_zShowGroupsOnMeta ;
 
                        // default values and config :
 
                        $wg_zShowRightsOnMeta = isSet($wg_zShowRightsOnMeta) ?
                        $wg_zShowRightsOnMeta : Permissions_SHOW_RIGHTS_ON_META ;
                        $wg_zShowGroupsOnMeta = isSet($wg_zShowGroupsOnMeta) ?
                        $wg_zShowGroupsOnMeta : Permissions_SHOW_GROUPS_ON_META ;
 
                        // !STEP-3 OF BuildHtmlTable()  : build the 2 sets
                        // $wgGroupPermissions , in our notation, should write :
                        // $wg_szGroup_2_szRight_2_zOk
 
                        reset($wgGroupPermissions) ;
                        $szGroup_2_iPower = array() ;
                        $szRight_2_rGranted = array() ;
                        foreach($wgGroupPermissions as $szGroup => $szRight_2_zOk)
                        {
                                $szGroup_2_iPower[$szGroup]   = count($szRight_2_zOk)  ;
                                reset($szRight_2_zOk) ;
                                foreach($szRight_2_zOk as $szRight => $zOk)
                                {
                                        $c="";
                        if (isset ($szRight_2_rGranted[$szRight])) $c=$szRight_2_rGranted[$szRight];
 
                                        $szRight_2_rGranted[$szRight] = $c. ($szGroup != 'bureaucrat') ? 1 : 0.9  ;
                                        // a trick to reduce the influence of less interesting rights
                                }
                        }
 
                        // !STEP-4 OF BuildHtmlTable()  : sort the 2 sets
                        // a few tricks to make sure of the order for some special features :
                        $szGroup_2_iPower['*'] = -2;
                        $szGroup_2_iPower['user'] = -1;
                        $szGroup_2_iPower['bureaucrat'] = 1789 ;
                        $szGroup_2_iPower['bot'] = 1968 ;
                        $szRight_2_rGranted['createaccount'] = 9999 ;
                        $szRight_2_rGranted['bot'] = -46 ;
                        // sort groups by increasing power :
                        asort($szGroup_2_iPower) ;
                        // sort rights by decreasing use :
                        arsort($szRight_2_rGranted) ;
 
                        // !STEP-5 OF BuildHtmlTable() : it's now time to prepare the HTML output
 
                        // equally divide HTML table :
                        $uW = floor(80 / count($szGroup_2_iPower) ) ;
                        $szStyle = Permissions_TH_STYLE ;
                        $szhOut .= "\n<p><table ".Permissions_TABLE_STYLE."><thead><tr><td></td>\n" ;
                        // !STEP-5-1 OF BuildHtmlTable() : HTML thead stuff
                        $szUrlGroup = Permissions_URL_GROUP ;
                        $szUrlRight = Permissions_URL_RIGHT ;
                        reset($szGroup_2_iPower) ;
                        foreach($szGroup_2_iPower as $szGroup => $iPower)
                        {
                                $szGroup = ($szGroup == '*') ? 'anonymous' : $szGroup ; // explicit anonymous
                                // aliasing mechanism :
                                if( $wg_szGroup_2_szwGroupMeaning[$szGroup] ) // WIKI has priority over HTML
                                {
                                        $szh = Permissions::Wiki_2_Html( $wg_szGroup_2_szwGroupMeaning[$szGroup] ) ;
                                }
                                elseif( $wg_szGroup_2_szhGroupMeaning[$szGroup] )
                                {
                                        $szh = $wg_szGroup_2_szhGroupMeaning[$szGroup];
                                }
                                elseif( $wg_zShowGroupsOnMeta )
                                {
                                        $szh = Permissions::Wiki_2_Html(
                                        "[{$szUrlGroup}{$szGroup} {$szGroup}]"
                                        ) ;
                                }
                                else
                                {
                                        $szh = $szGroup ;
                                }
                                // build the cell in thead :
                                $szhOut .= "  <th {$szStyle} width='{$uW}%'>{$szh}</th>\n" ;
                        }
                        $szhOut .= "</tr></thead><tbody>\n" ;
                        // !STEP-5-2 OF BuildHtmlTable() : HTML tbody stuff
                        arsort($szRight_2_rGranted) ;
                        foreach($szRight_2_rGranted as $szRight => $rGranted)
                        {
                                // alias mechanism :
                                if( $wg_szRight_2_szwRightMeaning[$szRight] ) // WIKI has priority over HTML
                                {
                                        $szh = Permissions::Wiki_2_Html( $wg_szRight_2_szwRightMeaning[$szRight] );
                                }
                                elseif( $wg_szRight_2_szhRightMeaning[$szRight] )
                                {
                                        $szh = $wg_szRight_2_szhRightMeaning[$szRight];
                                }
                                elseif( $wg_zShowRightsOnMeta )
                                {
                                        $szh = Permissions::Wiki_2_Html(
                                        "[{$szUrlRight}{$szRight} {$szRight}]"
                                        ) ;
                                }
                                else
                                {
                                        $szh = $szRight ;
                                }
                                // left cell :
                                $szhOut .= " <tr><td {$szStyle} ><b>{$szh}</b></td>" ;
                                // complete row :
                                reset($szGroup_2_iPower) ;
                                foreach($szGroup_2_iPower as $szGroup => $iPower)
                                {
                                        $c="";
                                        if(isset($wgGroupPermissions[$szGroup][$szRight])) $c=$wgGroupPermissions[$szGroup][$szRight];
                                        $szhOut .= ( "\n  <th>".( ( $c ) ? $szhYes : ' ' )."</th>" ) ;
                                }
                                $szhOut .= " </tr>\n" ;
                        }
                        $szhOut .= "</tbody></table><p>\n" ;
 
                        // !STEP-6 OF BuildHtmlTable() : returns the HTML string
                        return $szhOut ;
                }
 
                // the utilities :
                // could be private, but may be usefull elsewhere...
                // !SF : function Wiki_2_Html( $szwMessage )
                /**
     * @param wikistring $szwMessage
     * @return htmlstring $szhMessage
     * @uses parse()
     * @uses getText()
     * @version 1.5.104.6 
     * @requires (MediaWiki 1.5 , beta 4 , minor revision 6)
     * @since 1.5.104.6 (2005-08-03) 
     * @internal rather rely on standard stuff when integrating the patch in the whole project
     */
                function Wiki_2_Html( $szwMessage )
                {
                        global $wgParser, $wgTitle, $wgOut ;
 
                        $parserOutput = $wgParser->parse(
                        $szwMessage
                        , $wgTitle
                        , $wgOut->parserOptions()
                        , true
                        ) ;
 
                        return $parserOutput->getText()  ;
                }
 
                // !SF : function Translate($szOriginal)
                /**
     * a simplified version of MediaWiki_I18N::translate()
     * (does NOT support interpolation of variables)
     *
     * placed here to make this file standalone
     * (we just need to translate 'Yes' into 'Oui', 'Si', 'Ya', etc 
     *
     * @param string $szOriginal
     * @return string $szTranslated
     * @version 1.5.104.7
     * @internal rather rely on standard stuff when integrating the patch in the whole project
     */ 
                function Translate($szOriginal)
                {
			if ($szOriginal == 'val_yes')
				return "yes";
                }
 
                // !SF : end static functions :
                /**#@+-*/
 
        }  // !END_OF_CLASS : Permissions
 
        // !STEP-5 OF wfSpecialPermissions() : register, make sure this special page is known
        SpecialPage::addPage ( new Permissions() ) ;
 
} // !END-FUNCTION : wfSpecialPermissions()
// !EOF : includes/SpecialPermissions.php
?>

Your account will be renamed[edit]

03:39, 18 March 2015 (UTC)

Renamed[edit]

07:49, 22 April 2015 (UTC)