GBT248 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/131262

Change subject: minor changes * fixed german translation file * cosmetics to 
the code to avoid codestyle errors
......................................................................

minor changes
* fixed german translation file
* cosmetics to the code to avoid codestyle errors

Change-Id: If5a4c053df1eaf6f76f1a17531ec87ddf19feff7
---
M AccessControl.php
M changelog.txt
M i18n/de.json
3 files changed, 52 insertions(+), 44 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AccessControl 
refs/changes/62/131262/1

diff --git a/AccessControl.php b/AccessControl.php
index 9c90714..ae577d7 100644
--- a/AccessControl.php
+++ b/AccessControl.php
@@ -23,7 +23,7 @@
        'name'                  => 'AccessControlExtension',
        'author'                => array( 'Aleš Kapica' ),
        'url'                   => 
'http://www.mediawiki.org/wiki/Extension:AccessControl',
-       'version'               => '2.4.0',
+       'version'               => '2.4.1',
        'description'           => 'Access control based on users lists. 
Administrator rights need not be for it.',
        'descriptionmsg'        => 'accesscontrol-desc',
 );
@@ -62,9 +62,9 @@
        return displayGroups();
 }
 
-function accessControl( $obsahtagu ){
+function accessControl( $tagContent ){
        $accessgroup = Array( Array(), Array() );
-       $listaccesslist = explode( ",", $obsahtagu );
+       $listaccesslist = explode( ",", $tagContent );
        foreach ( $listaccesslist as $accesslist ) {
                if ( strpos( $accesslist, "(ro)" ) !== false ) {
                        $accesslist = trim( str_replace( "(ro)", "", 
$accesslist ) );
@@ -73,7 +73,7 @@
                        $accessgroup[1] = array_merge( $accessgroup[1], 
$group[1] );
                } else {
                        $accesslist = trim( $accesslist );
-                       $group = makeGroupArray ($accesslist );
+                       $group = makeGroupArray ( $accesslist );
                        $accessgroup[0] = array_merge( $accessgroup[0], 
$group[0] );
                        $accessgroup[1] = array_merge( $accessgroup[1], 
$group[1] );
                }
@@ -98,7 +98,7 @@
                                break;
                }
        }
-       return array( $userswrite , $usersreadonly );
+       return array( $userswrite, $usersreadonly );
 }
 
 function displayGroups() {
@@ -133,7 +133,7 @@
        $gt = $Title->makeTitle( 10, $template );
        if ( method_exists( 'WikiPage', 'getContent' ) ) {
                $contentPage = new WikiPage( $gt );
-               //return $contentPage->getContent()->getNativeData();
+               return $contentPage->getContent()->getNativeData();
        } else {
                // create Article and get the content
                $contentPage = new Article( $gt, 0 );
@@ -141,12 +141,13 @@
        }
 }
 
-function getUsersFromPages( $skupina ) {
+function getUsersFromPages( $group ) {
        /* Extracts the allowed users from the userspace access list */
        $allowedAccess = Array();
        $allow = Array();
        $Title = new Title();
-       $gt = $Title->makeTitle( 0, $skupina );
+// Remark: position to add code to use namespace from mediawiki
+       $gt = $Title->makeTitle( 0, $group );
        if ( method_exists( 'WikiPage', 'getContent' ) ) {
                $groupPage = new WikiPage( $gt );
                $allowedUsers = $groupPage->getContent()->getNativeData();
@@ -206,13 +207,13 @@
                    $skok = $start + 2;
                    $templatepage = substr( $string, $skok, $end - $skok );
                    if ( substr( $templatepage, 0, 1 ) == '{' ) {
-                       // The check of included code
+                               // The check of included code
                                $rights = fromTemplates( $templatepage );
                    } elseif ( substr( $templatepage, 0, 1 ) == ':' ) {
-                       // The check of included page
-                       $rights = allRightTags( getContentPage( 0, substr( 
$templatepage, 1 ) ) );
-                   } elseif (ctype_alnum(substr( $templatepage, 0, 1 ) )) {
-                       // The check of included template
+                               // The check of included page
+                               $rights = allRightTags( getContentPage( 0, 
substr( $templatepage, 1 ) ) );
+                   } elseif ( ctype_alnum( substr( $templatepage, 0, 1 ) )) {
+                               // The check of included template
                                if ( strpos( $templatepage, '|' ) > 0) {
                                    $templatename = substr( $templatepage, 0, 
strpos( $templatepage, '|' ) );
                                    $rights = allRightTags( getContentPage( 10, 
$templatename ) );
@@ -220,43 +221,43 @@
                                    $rights = allRightTags( getContentPage( 10, 
$templatepage ) );
                                }
                    } else {
-                       // echo "The end of work with code of article";
+                               // echo "The end of work with code of article";
                    }
                    if ( is_array( $rights ) ) {
-                       if ( $wgUser->mId === 0 ) {
-                           /* Redirection unknown users */
-                           $wgActions['view'] = false;
-                           doRedirect('accesscontrol-move-anonymous');
-                           } else {
-                               if ( in_array( 'sysop', $wgUser->mGroups, true 
) ) {
-                                       if ( isset( $wgAdminCanReadAll ) ) {
-                                               if ( $wgAdminCanReadAll ) {
-                                                       return true;
+                               if ( $wgUser->mId === 0 ) {
+                                   /* Redirection unknown users */
+                                   $wgActions['view'] = false;
+                                   doRedirect('accesscontrol-move-anonymous');
+                               } else {
+                                       if ( in_array( 'sysop', 
$wgUser->mGroups, true ) ) {
+                                               if ( isset( $wgAdminCanReadAll 
) ) {
+                                                       if ( $wgAdminCanReadAll 
) {
+                                                               return true;
                                                        }
                                                }
                                        }
-                               $users = accessControl( $rights['groups'] );
-                               if ( ! in_array( $wgUser->mName, $users[0], 
true ) ) {
-                                       $wgActions['edit']           = false;
-                                       $wgActions['history']        = false;
-                                       $wgActions['submit']         = false;
-                                       $wgActions['info']           = false;
-                                       $wgActions['raw']            = false;
-                                       $wgActions['delete']         = false;
-                                       $wgActions['revert']         = false;
-                                       $wgActions['revisiondelete'] = false;
-                                       $wgActions['rollback']       = false;
-                                       $wgActions['markpatrolled']  = false;
-                                       if ( ! in_array( $wgUser->mName, 
$users[1], true ) ) {
-                                               $wgActions['view']   = false;
-                                               return doRedirect( 
'accesscontrol-move-users' );
+                                       $users = accessControl( 
$rights['groups'] );
+                                       if ( ! in_array( $wgUser->mName, 
$users[0], true ) ) {
+                                               $wgActions['edit']           = 
false;
+                                               $wgActions['history']        = 
false;
+                                               $wgActions['submit']         = 
false;
+                                               $wgActions['info']           = 
false;
+                                               $wgActions['raw']            = 
false;
+                                               $wgActions['delete']         = 
false;
+                                               $wgActions['revert']         = 
false;
+                                               $wgActions['revisiondelete'] = 
false;
+                                               $wgActions['rollback']       = 
false;
+                                               $wgActions['markpatrolled']  = 
false;
+                                               if ( ! in_array( 
$wgUser->mName, $users[1], true ) ) {
+                                                       $wgActions['view']   = 
false;
+                                                       return doRedirect( 
'accesscontrol-move-users' );
                                                }
                                        }
                                }
                        }
                }
-           }
-    }
+       }
+}
 
 
 function allRightTags( $string ) {
@@ -281,7 +282,7 @@
        }
 
        // The control of included pages and templates on appearing of 
accesscontrol tag
-       fromTemplates($string);
+       fromTemplates( $string );
        $start = strpos( $string, $starttag );
        if ( $start !== false ) {
                $start += strlen( $starttag );
@@ -325,7 +326,7 @@
                $wgActions['revisiondelete'] = false;
                $wgActions['rollback']       = false;
                $wgActions['markpatrolled']  = false;
-               }
+       }
 
        $rights = allRightTags( getContentPage( $title->getNamespace(), 
$title->mDbkeyform ) );
        if ( is_array( $rights ) ) {
diff --git a/changelog.txt b/changelog.txt
index a7ef858..651c8f3 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,10 @@
+version 2.4.1
+* minor fix in german translationfile
+* cosmetic fixes to avoid code style errors
+
+version 2.4.0
+* Migrate to JSON i18n
+
 verison 2.3
 * Fixed function doRedirect() and fromTemplates()
 * Removed unused messages from localization file
diff --git a/i18n/de.json b/i18n/de.json
index 60935c1..6cffa06 100644
--- a/i18n/de.json
+++ b/i18n/de.json
@@ -5,5 +5,5 @@
         ]
     },
     "accesscontrol-desc": "Ermöglicht auf Benutzergruppen bezogene 
Seitenzugriffsbeschränkungen",
-    "accesscontrol-info": "Dies ist eine geschützt Seite."
-}
\ No newline at end of file
+    "accesscontrol-info": "Dies ist eine geschützte Seite."
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/131262
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If5a4c053df1eaf6f76f1a17531ec87ddf19feff7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AccessControl
Gerrit-Branch: master
Gerrit-Owner: GBT248 <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to