Wikinaut has uploaded a new change for review.

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


Change subject: (bug 45323) allow selective deletion of trusted sites in OpenID 
Preferences
......................................................................

(bug 45323) allow selective deletion of trusted sites in OpenID Preferences

version 3.04 20130310

Change-Id: Ife58ad1900135291dd4116966a4799704ab6fcbd
---
M CHANGES
M OpenID.hooks.php
M OpenID.i18n.php
M OpenID.php
M README.OpenID-mediawiki-extension
M SpecialOpenIDServer.body.php
6 files changed, 91 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OpenID 
refs/changes/32/53032/3

diff --git a/CHANGES b/CHANGES
index 8bb91d1..7e7aa7e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
 CHANGES
 =======
 
+3.04  20130310  fix bug45323 add deletion of trusted sites to OpenID 
Preferences
 3.03  20130310  fix bug45928 change deprecated wgAllowRealName to 
wgHiddenPrefs checks
 3.02  20130309  when used as Provider, show the own OpenID in OpenID 
preference tab
                 fix bug 45322 show own OpenID as subtitle on own userpage 
(user option)
diff --git a/OpenID.hooks.php b/OpenID.hooks.php
index 1607dea..53c629c 100644
--- a/OpenID.hooks.php
+++ b/OpenID.hooks.php
@@ -195,11 +195,19 @@
                $rows = '';
 
                foreach ( $trusted_sites as $key => $value ) {
+                       $deleleTrustedSeiteTitle = SpecialPage::getTitleFor( 
'OpenIDServer', 'DeleteTrustedSite' );
                        if ( $key !== "" ) {
                                $rows .= Xml::tags( 'tr', array(),
                                        Xml::tags( 'td',
                                                array(),
                                                Xml::element( 'a', array( 
'href' => $key ), $key )
+                                       ) .
+                                       Xml::tags( 'td',
+                                               array(),
+                                               Linker::link( 
$deleleTrustedSeiteTitle, wfMessage( 
'openid-trusted-sites-delete-link-action-text' )->text(),
+                                                       array(),
+                                                       array( 'url' => $key )
+                                               )
                                        )
                                ) . "\n";
                        }
@@ -209,7 +217,10 @@
                        Xml::tags( 'tr', array(),
                                Xml::element( 'th',
                                        array(),
-                                       wfMessage( 
'openid-trusted-sites-table-header' )->text() )
+                                       wfMessage( 
'openid-trusted-sites-table-header-column-url' )->text() ) .
+                               Xml::element( 'th',
+                                       array(),
+                                       wfMessage( 
'openid-trusted-sites-table-header-column-action' )->text() )
                        ) . "\n" .
                        $rows
                );
diff --git a/OpenID.i18n.php b/OpenID.i18n.php
index 2c06c2f..4955b8d 100644
--- a/OpenID.i18n.php
+++ b/OpenID.i18n.php
@@ -136,7 +136,14 @@
        'openid-urls-delete' => 'Delete',
        'openid-add-url' => 'Add a new OpenID to your account',
        'openid-trusted-sites-label' => 'Sites you trust and where you have 
used your OpenID for logging in:',
-       'openid-trusted-sites-table-header' => 'Trusted sites',
+       'openid-trusted-sites-table-header-column-url' => 'Trusted sites',
+       'openid-trusted-sites-table-header-column-action' => 'Action',
+       'openid-trusted-sites-delete-link-action-text' => 'Delete',
+       'openid-trusted-sites-delete-confirmation-page-title' => 'Site trust 
deletion',
+       'openid-trusted-sites-delete-confirmation-question' => 'By clicking the 
"{{int:openid-trusted-sites-delete-confirmation-button-text}}" button, you will 
remove $1 from the list of sites you trust.',
+       'openid-trusted-sites-delete-confirmation-button-text' => 'Confirm',
+       'openid-trusted-sites-delete-confirmation-success-text' => '$1 was 
successfully removed from the list of sites you trust.',
+
        'openid-local-identity' => 'Your OpenID:',
 
        'openid-login-or-create-account' => 'Log in or create a new account',
@@ -243,8 +250,18 @@
 Used in the same way as {{msg-mw|prefs-registration-date-time}}.',
        'openid-urls-delete' => '{{Identical|Delete}}',
        'openid-trusted-sites-label' => 'Sites you trust and where you have 
used your OpenID for logging in: (preference label)',
-       'openid-trusted-sites-table-header' => 'Trusted sites (table header).
+       'openid-trusted-sites-table-header-column-url' => 'Trusted sites (table 
header, url column).
 {{Identical|Trusted site}}',
+       'openid-trusted-sites-table-header-column-action' => 'Trusted sites 
(table header, action column).
+{{Identical|Action}}',
+       'openid-trusted-sites-delete-link-action-text' => 
'{{Identical|Delete}}',
+       'openid-trusted-sites-delete-confirmation-page-title' => 'The page 
title for "Site trust deletion"',
+       'openid-trusted-sites-delete-confirmation-question' => 'The question of 
By clicking the "{{int:openid-trusted-sites-delete-confirmation-button-text}}" 
button, you will remove $1 from the list of sites you trust.
+* $1 is the url of the removed site',
+       'openid-trusted-sites-delete-confirmation-button-text' => 
'{{Identical|Confirm}}',
+       'openid-trusted-sites-delete-confirmation-success-text' => 'A 
confirmation text which is shown, when the user has successfully removed a site 
from the list of trusted site.
+* $1 is the url of the removed site',
+
        'openid-local-identity' => 'Your OpenID when used a identity to other 
sites (preference label)',
        'specialpages-group-openid' => 'Display group name for OpenID-extension 
related special pages for [[Special:SpecialPages]].',
        'right-openid-converter-access' => 
'{{doc-right|openid-converter-access}}
@@ -690,7 +707,7 @@
        'openid-urls-delete' => 'Desaniciar',
        'openid-add-url' => 'Amestar una OpenID nueva a la so cuenta',
        'openid-trusted-sites-label' => "Sitios nos que tien enfotu y onde yá 
utilizó la so OpenID p'aniciar sesión:",
-       'openid-trusted-sites-table-header' => 'Sitios enfotaos',
+       'openid-trusted-sites-table-header-column-url' => 'Sitios enfotaos',
        'openid-login-or-create-account' => 'Entrar o crear una cuenta nueva',
        'openid-provider-label-openid' => 'Escribi la URL de la to OpenID',
        'openid-provider-label-google' => 'Aniciar sesión usando la to cuenta 
de Google',
@@ -1494,7 +1511,7 @@
        'openid-urls-delete' => 'Löschen',
        'openid-add-url' => 'Eine neue OpenID deinem Benutzerkonto hinzufügen',
        'openid-trusted-sites-label' => 'Websites, denen du vertraust, und bei 
denen du mit deiner OpenID bekannt bist:',
-       'openid-trusted-sites-table-header' => 'Websites, denen du vertraust',
+       'openid-trusted-sites-table-header-column-url' => 'Websites, denen du 
vertraust',
        'openid-login-or-create-account' => 'Anmelden oder ein neues 
Benutzerkonto erstellen',
        'openid-provider-label-openid' => 'Gib deine OpenID-URL an',
        'openid-provider-label-google' => 'Mit deinem Google-Benutzerkonto 
anmelden',
@@ -1689,7 +1706,7 @@
        'openid-urls-delete' => 'Lašowaś',
        'openid-add-url' => 'Nowy OpenID twójomu kontoju pśidaś',
        'openid-trusted-sites-label' => 'Sedła, kótarymž dowěriš a źož sy swój 
OpenID za pśizjawjenje wužył:',
-       'openid-trusted-sites-table-header' => 'Dowěry gódne sedła',
+       'openid-trusted-sites-table-header-column-url' => 'Dowěry gódne sedła',
        'openid-login-or-create-account' => 'Pśizjawiś abo nowe konto załožyś',
        'openid-provider-label-openid' => 'Zapódaj swój URL OpenID',
        'openid-provider-label-google' => 'Z pomocu twójogo konta Google se 
pśizjawiś',
@@ -2309,7 +2326,7 @@
        'openid-urls-delete' => 'Supprimer',
        'openid-add-url' => 'Ajouter un nouvel OpenID à  votre compte',
        'openid-trusted-sites-label' => 'Sites en qui vous avez confiance et où 
vous avez utilisé votre OpenID pour vous connecter:',
-       'openid-trusted-sites-table-header' => 'Sites de confiance',
+       'openid-trusted-sites-table-header-column-url' => 'Sites de confiance',
        'openid-login-or-create-account' => 'Se connecter ou créer un nouveau 
compte',
        'openid-provider-label-openid' => 'Entrez votre URL OpenID',
        'openid-provider-label-google' => 'Vous connecter en utilisant votre 
compte Google',
@@ -2533,7 +2550,7 @@
        'openid-urls-delete' => 'Borrar',
        'openid-add-url' => 'Engadir un novo OpenID á súa conta',
        'openid-trusted-sites-label' => 'Sitios nos que confía e nos que 
utilizou o seu OpenID para identificarse:',
-       'openid-trusted-sites-table-header' => 'Sitios de confianza',
+       'openid-trusted-sites-table-header-column-url' => 'Sitios de confianza',
        'openid-login-or-create-account' => 'Acceder ou crear unha conta nova',
        'openid-provider-label-openid' => 'Insira o enderezo URL do seu OpenID',
        'openid-provider-label-google' => 'Acceder usando a súa conta do 
Google',
@@ -3056,7 +3073,7 @@
        'openid-urls-delete' => 'Wušmórnyć',
        'openid-add-url' => 'Nowy OpenID twojemu kontu přidać',
        'openid-trusted-sites-label' => 'Sydła, kotrymž dowěrješ a hdźež sy 
swój OpenID za přizjewjenje wužił:',
-       'openid-trusted-sites-table-header' => 'Dowěryhódne sydła',
+       'openid-trusted-sites-table-header-column-url' => 'Dowěryhódne sydła',
        'openid-login-or-create-account' => 'Přizjewić abo nowe konto załožić',
        'openid-provider-label-openid' => 'Zapodaj swój URL OpenID',
        'openid-provider-label-google' => 'Z pomocu twojeho konta Google so 
přizjewić',
@@ -3629,7 +3646,7 @@
        'openid-urls-registration' => '登録日時',
        'openid-urls-delete' => '削除',
        'openid-add-url' => '自分のアカウントに新しい OpenID を追加',
-       'openid-trusted-sites-table-header' => '信頼済みサイト',
+       'openid-trusted-sites-table-header-column-url' => '信頼済みサイト',
        'openid-login-or-create-account' => 'ログインまたは新規アカウント作成',
        'openid-provider-label-openid' => 'あなたの OpenID URL を入力します',
        'openid-provider-label-google' => 'あなたの Google アカウントを使用してログインする',
@@ -4174,7 +4191,7 @@
        'openid-urls-action' => 'Aktioun',
        'openid-urls-delete' => 'Läschen',
        'openid-add-url' => 'Eng nei OpenID bäi Äre Benotzerkont derbäisetzen',
-       'openid-trusted-sites-table-header' => 'Siten, deenen Dir traut',
+       'openid-trusted-sites-table-header-column-url' => 'Siten, deenen Dir 
traut',
        'openid-login-or-create-account' => 'Loggt Iech an oder maacht en neie 
Benotzerkont op',
        'openid-provider-label-openid' => 'Gitt Är OpenID URL un',
        'openid-provider-label-google' => 'Loggt Iech mat Ärem 
Goggle-Benotzerkont an',
@@ -4339,7 +4356,7 @@
        'openid-urls-delete' => 'Избриши',
        'openid-add-url' => 'Додај нов OpenID кон сметката',
        'openid-trusted-sites-label' => 'Мрежните места на коишто им верувате и 
кајшто го имате користено вашиот OpenID за најава:',
-       'openid-trusted-sites-table-header' => 'Мрежни места од доверба',
+       'openid-trusted-sites-table-header-column-url' => 'Мрежни места од 
доверба',
        'openid-login-or-create-account' => 'Најавете се или создајте нова 
сметка',
        'openid-provider-label-openid' => 'Внесете ја вашата OpenID URL адреса',
        'openid-provider-label-google' => 'Најавете се со вашата сметка на 
Google',
diff --git a/OpenID.php b/OpenID.php
index 4e9bf3e..5cc2d51 100644
--- a/OpenID.php
+++ b/OpenID.php
@@ -29,7 +29,7 @@
        exit( 1 );
 }
 
-define( 'MEDIAWIKI_OPENID_VERSION', '3.03 20130310' );
+define( 'MEDIAWIKI_OPENID_VERSION', '3.04 20130310' );
 
 $path = dirname( __FILE__ );
 set_include_path( implode( PATH_SEPARATOR, array( $path ) ) . PATH_SEPARATOR . 
get_include_path() );
diff --git a/README.OpenID-mediawiki-extension 
b/README.OpenID-mediawiki-extension
index e8cdc56..34cc32f 100644
--- a/README.OpenID-mediawiki-extension
+++ b/README.OpenID-mediawiki-extension
@@ -1,5 +1,8 @@
 MediaWiki OpenID extension README.OpenID-mediawiki-extension file
 version 1.004 20120427
+
+### FIXME: UPDATE TO VERSION 3.x REQUIRED TG 20130310
+
 Homepage and manual http://www.mediawiki.org/wiki/Extension:OpenID
 
 Please check OpenID.setup.php for the current program version number
diff --git a/SpecialOpenIDServer.body.php b/SpecialOpenIDServer.body.php
index d513791..89060bd 100644
--- a/SpecialOpenIDServer.body.php
+++ b/SpecialOpenIDServer.body.php
@@ -138,6 +138,16 @@
                        }
                        break;
 
+               // request comes from OpenID preference page
+               // when user deletes a trusted site
+
+               case 'deletetrustedsite':
+
+                       $this->deleteTrustedSite();
+                       return;
+
+                       break;
+
                default:
 
                        if ( strlen( $par ) ) {
@@ -495,10 +505,9 @@
                }
        }
 
-       function SetUserTrust( &$user, $trust_root, $value ) {
+       function SetUserTrust( &$user, $trust_root, $value = NULL ) {
 
                $trust_array = $this->GetUserTrustArray( $user );
-
                if ( is_null( $value ) ) {
                        if ( array_key_exists( $trust_root, $trust_array ) ) {
                                unset( $trust_array[$trust_root] );
@@ -508,6 +517,7 @@
                }
 
                $this->SetUserTrustArray( $user, $trust_array );
+
        }
 
        static function GetUserTrustArray( $user ) {
@@ -558,6 +568,40 @@
                return in_array( $name, $fields );
        }
 
+
+       function deleteTrustedSite() {
+               global $wgUser, $wgOut, $wgRequest;
+
+               $trustedSiteToBeDeleted = $wgRequest->getVal( 'url' );
+               $wgOut->setPageTitle( wfMessage( 
'openid-trusted-sites-delete-confirmation-page-title' )->text() );
+
+               if ( $wgRequest->wasPosted()
+                       && $wgUser->matchEditToken( $wgRequest->getVal( 
'wpEditToken' ), $trustedSiteToBeDeleted ) ) {
+
+                       $this->SetUserTrust( $wgUser, $trustedSiteToBeDeleted, 
NULL );
+                       $wgUser->saveSettings();
+
+                       $wgOut->addWikiMsg( 
'openid-trusted-sites-delete-confirmation-success-text', 
$trustedSiteToBeDeleted );
+
+                       return;
+               }
+
+               $wgOut->addWikiMsg( 
'openid-trusted-sites-delete-confirmation-question', $trustedSiteToBeDeleted );
+
+               $wgOut->addHtml(
+                       Xml::openElement( 'form',
+                               array(
+                                       'action' => $this->getTitle( 
'DeleteTrustedSite' )->getLocalUrl(),
+                                       'method' => 'post'
+                               )
+                       ) .
+                       Xml::submitButton( wfMessage( 
'openid-trusted-sites-delete-confirmation-button-text' )->text() ) . "\n" .
+                       Html::Hidden( 'url', $trustedSiteToBeDeleted ) . "\n" .
+                       Html::Hidden( 'wpEditToken', $wgUser->editToken( 
$trustedSiteToBeDeleted ) ) . "\n" .
+                       Xml::closeElement( 'form' )
+               );
+       }
+
        function SregFromQuery( $query ) {
                $sreg = array( 'required' => array(), 'optional' => array(),
                                          'policy_url' => null );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ife58ad1900135291dd4116966a4799704ab6fcbd
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/OpenID
Gerrit-Branch: master
Gerrit-Owner: Wikinaut <[email protected]>

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

Reply via email to