Index: tags/extensions/ApprovedRevs/REL_0_2/maintenance/approveAllPages.php |
— | — | @@ -0,0 +1,72 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * This script approves the current revision of all pages that are in an |
| 6 | + * approvable namespace, and do not already have an approved revision. |
| 7 | + * |
| 8 | + * Usage: |
| 9 | + * no parameters |
| 10 | + * |
| 11 | + * This program is free software; you can redistribute it and/or modify |
| 12 | + * it under the terms of the GNU General Public License as published by |
| 13 | + * the Free Software Foundation; either version 2 of the License, or |
| 14 | + * (at your option) any later version. |
| 15 | + * |
| 16 | + * This program is distributed in the hope that it will be useful, |
| 17 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | + * GNU General Public License for more details. |
| 20 | + * |
| 21 | + * You should have received a copy of the GNU General Public License along |
| 22 | + * with this program; if not, write to the Free Software Foundation, Inc., |
| 23 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 24 | + * http://www.gnu.org/copyleft/gpl.html |
| 25 | + * |
| 26 | + * @author Jeroen De Dauw |
| 27 | + * @author Yaron Koren |
| 28 | + * @ingroup Maintenance |
| 29 | + */ |
| 30 | + |
| 31 | +require_once( dirname( __FILE__ ) . '/../../../maintenance/Maintenance.php' ); |
| 32 | + |
| 33 | +class ApproveAllPages extends Maintenance { |
| 34 | + |
| 35 | + public function __construct() { |
| 36 | + parent::__construct(); |
| 37 | + |
| 38 | + $this->mDescription = "Approve the current revision of all pages that do not yet have an approved revision."; |
| 39 | + } |
| 40 | + |
| 41 | + public function execute() { |
| 42 | + global $wgTitle; |
| 43 | + |
| 44 | + $dbr = wfGetDB( DB_SLAVE ); |
| 45 | + |
| 46 | + $pages = $dbr->select( |
| 47 | + 'page', |
| 48 | + array( |
| 49 | + 'page_id', |
| 50 | + 'page_latest' |
| 51 | + ) |
| 52 | + ); |
| 53 | + |
| 54 | + while ( $page = $pages->fetchObject() ) { |
| 55 | + $title = Title::newFromID( $page->page_id ); |
| 56 | + // some extensions, like Semantic Forms, need $wgTitle |
| 57 | + // set as well |
| 58 | + $wgTitle = $title; |
| 59 | + if ( ! ApprovedRevs::hasUnsupportedNamespace( $title ) && |
| 60 | + ! ApprovedRevs::hasApprovedRevision( $title ) ) { |
| 61 | + ApprovedRevs::setApprovedRevID( $title, $page->page_latest ); |
| 62 | + $this->output( wfTimestamp( TS_DB ) . ' Approved the last revision of page "' . $title->getFullText() . '".' ); |
| 63 | + } |
| 64 | + } |
| 65 | + |
| 66 | + |
| 67 | + $this->output( "\n Finished setting all current revisions to approved. \n" ); |
| 68 | + } |
| 69 | + |
| 70 | +} |
| 71 | + |
| 72 | +$maintClass = "ApproveAllPages"; |
| 73 | +require_once( DO_MAINTENANCE ); |
Property changes on: tags/extensions/ApprovedRevs/REL_0_2/maintenance/approveAllPages.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 74 | + native |
Index: tags/extensions/ApprovedRevs/REL_0_2/ApprovedRevs_body.php |
— | — | @@ -0,0 +1,136 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Main class for the Approved Revs extension. |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + * |
| 9 | + * @author Yaron Koren |
| 10 | + */ |
| 11 | + |
| 12 | +class ApprovedRevs { |
| 13 | + /** |
| 14 | + * Gets the approved revision ID for this page, or null if there isn't |
| 15 | + * one. |
| 16 | + */ |
| 17 | + public static function getApprovedRevID( $title ) { |
| 18 | + if ( self::hasUnsupportedNamespace( $title ) ) { |
| 19 | + return null; |
| 20 | + } |
| 21 | + $dbr = wfGetDB( DB_SLAVE ); |
| 22 | + $page_id = $title->getArticleId(); |
| 23 | + $rev_id = $dbr->selectField( 'approved_revs', 'rev_id', array( 'page_id' => $page_id ) ); |
| 24 | + return $rev_id; |
| 25 | + } |
| 26 | + |
| 27 | + /** |
| 28 | + * Returns whether or not this page has a revision ID. |
| 29 | + */ |
| 30 | + public static function hasApprovedRevision( $title ) { |
| 31 | + $revision_id = self::getApprovedRevID( $title ); |
| 32 | + return ( ! empty( $revision_id ) ); |
| 33 | + } |
| 34 | + |
| 35 | + /** |
| 36 | + * Returns the content of the approved revision of this page, or null |
| 37 | + * if there isn't one. |
| 38 | + */ |
| 39 | + public static function getApprovedContent( $title ) { |
| 40 | + $revision_id = ApprovedRevs::getApprovedRevID( $title ); |
| 41 | + if ( empty( $revision_id ) ) { |
| 42 | + return null; |
| 43 | + } |
| 44 | + $article = new Article( $title, $revision_id ); |
| 45 | + return( $article->getContent() ); |
| 46 | + } |
| 47 | + |
| 48 | + /** |
| 49 | + * Returns whether this page is in a namespace that the Approved Revs |
| 50 | + * extension doesn't support. |
| 51 | + */ |
| 52 | + public static function hasUnsupportedNamespace( $title ) { |
| 53 | + global $egApprovedRevsExcludedNamespaces; |
| 54 | + $unsupported_namespaces = $egApprovedRevsExcludedNamespaces; |
| 55 | + $unsupported_namespaces[] = NS_FILE; |
| 56 | + $unsupported_namespaces[] = NS_CATEGORY; |
| 57 | + $unsupported_namespaces[] = NS_MEDIAWIKI; |
| 58 | + return( in_array( $title->getNamespace(), $unsupported_namespaces ) ); |
| 59 | + } |
| 60 | + |
| 61 | + /** |
| 62 | + * Sets a certain revision as the approved one for this page in the |
| 63 | + * approved_revs DB table; calls a "links update" on this revision |
| 64 | + * so that category information can be stored correctly, as well as |
| 65 | + * info for extensions such as Semantic MediaWiki; and logs the action. |
| 66 | + */ |
| 67 | + public static function setApprovedRevID( $title, $rev_id ) { |
| 68 | + $dbr = wfGetDB( DB_MASTER ); |
| 69 | + $page_id = $title->getArticleId(); |
| 70 | + $old_rev_id = $dbr->selectField( 'approved_revs', 'rev_id', array( 'page_id' => $page_id ) ); |
| 71 | + if ( $old_rev_id ) { |
| 72 | + $dbr->update( 'approved_revs', array( 'rev_id' => $rev_id ), array( 'page_id' => $page_id ) ); |
| 73 | + } else { |
| 74 | + $dbr->insert( 'approved_revs', array( 'page_id' => $page_id, 'rev_id' => $rev_id ) ); |
| 75 | + } |
| 76 | + |
| 77 | + $parser = new Parser(); |
| 78 | + $parser->setTitle( $title ); |
| 79 | + $article = new Article( $title, $rev_id ); |
| 80 | + $text = $article->getContent(); |
| 81 | + $options = new ParserOptions(); |
| 82 | + $parser->parse( $text, $title, $options, true, true, $rev_id ); |
| 83 | + $u = new LinksUpdate( $title, $parser->getOutput() ); |
| 84 | + $u->doUpdate(); |
| 85 | + |
| 86 | + $log = new LogPage( 'approval' ); |
| 87 | + $rev_url = $title->getFullURL( array( 'old_id' => $rev_id ) ); |
| 88 | + $rev_link = Xml::element( |
| 89 | + 'a', |
| 90 | + array( 'href' => $rev_url ), |
| 91 | + $rev_id |
| 92 | + ); |
| 93 | + $logParams = array( $rev_link ); |
| 94 | + $log->addEntry( |
| 95 | + 'approve', |
| 96 | + $title, |
| 97 | + '', |
| 98 | + $logParams |
| 99 | + ); |
| 100 | + |
| 101 | + wfRunHooks( 'ApprovedRevsRevisionApproved', array( $parser, $title, $rev_id ) ); |
| 102 | + } |
| 103 | + |
| 104 | + public static function deleteRevisionApproval( $title ) { |
| 105 | + $dbr = wfGetDB( DB_MASTER ); |
| 106 | + $page_id = $title->getArticleId(); |
| 107 | + $dbr->delete( 'approved_revs', array( 'page_id' => $page_id ) ); |
| 108 | + } |
| 109 | + |
| 110 | + /** |
| 111 | + * Unsets the approved revision for this page in the approved_revs DB |
| 112 | + * table; calls a "links update" on this page so that category |
| 113 | + * information can be stored correctly, as well as info for |
| 114 | + * extensions such as Semantic MediaWiki; and logs the action. |
| 115 | + */ |
| 116 | + public static function unsetApproval( $title ) { |
| 117 | + self::deleteRevisionApproval( $title ); |
| 118 | + |
| 119 | + $parser = new Parser(); |
| 120 | + $parser->setTitle( $title ); |
| 121 | + $article = new Article( $title ); |
| 122 | + $text = $article->getContent(); |
| 123 | + $options = new ParserOptions(); |
| 124 | + $parser->parse( $text, $title, $options ); |
| 125 | + $u = new LinksUpdate( $title, $parser->getOutput() ); |
| 126 | + $u->doUpdate(); |
| 127 | + |
| 128 | + $log = new LogPage( 'approval' ); |
| 129 | + $log->addEntry( |
| 130 | + 'unapprove', |
| 131 | + $title, |
| 132 | + '' |
| 133 | + ); |
| 134 | + |
| 135 | + wfRunHooks( 'ApprovedRevsRevisionUnapproved', array( $parser, $title ) ); |
| 136 | + } |
| 137 | +} |
Property changes on: tags/extensions/ApprovedRevs/REL_0_2/ApprovedRevs_body.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 138 | + native |
Index: tags/extensions/ApprovedRevs/REL_0_2/ApprovedRevs.i18n.php |
— | — | @@ -0,0 +1,347 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalization file for the Approved Revs extension. |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | +*/ |
| 9 | + |
| 10 | +$messages = array(); |
| 11 | + |
| 12 | +/** English |
| 13 | + * @author Yaron Koren |
| 14 | + */ |
| 15 | +$messages['en'] = array( |
| 16 | + // user messages |
| 17 | + 'approvedrevs-desc' => 'Set a single revision of a page as approved', |
| 18 | + 'approvedrevs-logname' => 'Revision approval log', |
| 19 | + 'approvedrevs-logdesc' => 'This is the log of revisions that have been approved.', |
| 20 | + 'approvedrevs-approve' => 'approve', |
| 21 | + 'approvedrevs-unapprove' => 'unapprove', |
| 22 | + 'approvedrevs-approvesuccess' => 'This revision of the page has been set as the approved version.', |
| 23 | + 'approvedrevs-unapprovesuccess' => 'There is no longer an approved version for this page. |
| 24 | +Instead, the most recent revision will be shown.', |
| 25 | + 'approvedrevs-approveaction' => 'set $2 as the approved revision for "[[$1]]"', |
| 26 | + 'approvedrevs-unapproveaction' => 'unset approved revision for "[[$1]]"', |
| 27 | + 'approvedrevs-notlatest' => 'This is the approved revision of this page; it is not the most recent.', |
| 28 | + 'approvedrevs-approvedandlatest' => 'This is the approved revision of this page, as well as being the most recent.', |
| 29 | + 'approvedrevs-viewlatest' => 'View most recent revision.', |
| 30 | + 'approvedpages' => 'Approved pages', |
| 31 | + 'approvedrevs-approvedpages-docu' => 'The following are the pages in the wiki that have an approved revision.', |
| 32 | + 'right-approverevisions' => 'Set a certain revision of a wiki page as approved', |
| 33 | + 'right-viewlinktolatest' => 'View explanatory text at the top of pages that have an approved revision', |
| 34 | +); |
| 35 | + |
| 36 | +/** Message documentation (Message documentation) |
| 37 | + * @author EugeneZelenko |
| 38 | + */ |
| 39 | +$messages['qqq'] = array( |
| 40 | + 'approvedrevs-approve' => '{{Identical|Approve}}', |
| 41 | +); |
| 42 | + |
| 43 | +/** Afrikaans (Afrikaans) |
| 44 | + * @author Naudefj |
| 45 | + */ |
| 46 | +$messages['af'] = array( |
| 47 | + 'approvedrevs-approve' => 'keur goed', |
| 48 | + 'approvedrevs-viewlatest' => 'Wys mees onlangse hersiening.', |
| 49 | + 'approvedpages' => 'Goedgekeurde bladsye', |
| 50 | +); |
| 51 | + |
| 52 | +/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
| 53 | + * @author EugeneZelenko |
| 54 | + * @author Jim-by |
| 55 | + * @author Wizardist |
| 56 | + */ |
| 57 | +$messages['be-tarask'] = array( |
| 58 | + 'approvedrevs-desc' => 'Зацьвердзіць адну вэрсію старонкі', |
| 59 | + 'approvedrevs-logname' => 'Журнал зацьверджаньня вэрсіяў', |
| 60 | + 'approvedrevs-logdesc' => 'Гэта журнал зацьверджаных вэрсіяў.', |
| 61 | + 'approvedrevs-approve' => 'зацьвердзіць', |
| 62 | + 'approvedrevs-unapprove' => 'адхіліць', |
| 63 | + 'approvedrevs-approvesuccess' => 'Гэтая вэрсія старонкі была зацьверджаная.', |
| 64 | + 'approvedrevs-unapprovesuccess' => 'Болей не існуе зацьверджанай вэрсіі гэтай старонкі. |
| 65 | +Замест яе будзе паказаная апошняя вэрсія.', |
| 66 | + 'approvedrevs-approveaction' => 'зацьвердзіць $2 як зацьверджаную вэрсію старонкі «[[$1]]»', |
| 67 | + 'approvedrevs-unapproveaction' => 'зьняць зацьверджаньне з вэрсіі старонкі «[[$1]]»', |
| 68 | + 'approvedrevs-notlatest' => 'Гэта зацьверджаная вэрсія гэтай старонкі; гэта не апошняя вэрсія.', |
| 69 | + 'approvedrevs-approvedandlatest' => 'Гэта зацьверджаная вэрсія гэтай старонкі, адначасова яна зьяўляецца апошняй вэрсіяй.', |
| 70 | + 'approvedrevs-viewlatest' => 'Паказаць апошнюю вэрсію.', |
| 71 | + 'approvedpages' => 'Зацьверджаныя старонкі', |
| 72 | + 'approvedrevs-approvedpages-docu' => 'Ніжэй пададзеныя старонкі {{GRAMMAR:родны|{{SITENAME}}}}, якія маюць зацьверджаныя вэрсіі.', |
| 73 | + 'right-approverevisions' => 'зацьверджаньне вызначаных вэрсіяў вікі-старонак', |
| 74 | + 'right-viewlinktolatest' => 'прагляд тлумачальнага тэксту ў версе старонак, якія маюць зацьверджаныя вэрсіі', |
| 75 | +); |
| 76 | + |
| 77 | +/** Breton (Brezhoneg) |
| 78 | + * @author Y-M D |
| 79 | + */ |
| 80 | +$messages['br'] = array( |
| 81 | + 'approvedrevs-desc' => 'Merkañ un adweladenn hepken eus ur bajenn evel aprouet', |
| 82 | + 'approvedrevs-logname' => 'Marilh aprouadennoù an adweladennoù', |
| 83 | + 'approvedrevs-logdesc' => 'Marilh an adweladennoù bet merket evel aprouet eo.', |
| 84 | + 'approvedrevs-approve' => 'aprouiñ', |
| 85 | + 'approvedrevs-unapprove' => 'Dizaprouiñ', |
| 86 | + 'approvedrevs-approvesuccess' => 'An adweladenn-mañ eus ar bajenn a zo bet merket evel ar stumm aprouet.', |
| 87 | + 'approvedrevs-unapprovesuccess' => "N'eus stumm aprouet ebet ken eus ar bajenn-mañ. |
| 88 | +E plas e vo lakaet an adweladenn nevesañ.", |
| 89 | + 'approvedrevs-approveaction' => 'en deus merket $2 evel adweladenn aprouet "[[$1]]"', |
| 90 | + 'approvedrevs-unapproveaction' => 'en deus nullet merkadur un adweladenn aprouet evit "[[$1]]"', |
| 91 | + 'approvedrevs-notlatest' => "Adweladenn aprouet ar bajenn-mañ eo ; n'eo ket an hini nevesañ.", |
| 92 | + 'approvedrevs-approvedandlatest' => 'Adweladenn aprouet ar bajenn-mañ eo, hag ivez an hini nevesañ.', |
| 93 | + 'approvedrevs-viewlatest' => 'Gwelet an adweladenn nevesañ.', |
| 94 | + 'approvedpages' => 'Pajennoù aprouet', |
| 95 | + 'approvedrevs-approvedpages-docu' => 'Setu ar pajennoù wiki hag o deus un adweladenn aprouet.', |
| 96 | + 'right-approverevisions' => 'Merkañ un adweladenn bennak eus ur bajenn wiki evel aprouet', |
| 97 | + 'right-viewlinktolatest' => 'Gwelet an destenn displegañ e penn uhelañ ar pajennoù hag o deus un adweladenn aprouet', |
| 98 | +); |
| 99 | + |
| 100 | +/** Finnish (Suomi) |
| 101 | + * @author Centerlink |
| 102 | + * @author Crt |
| 103 | + * @author Nike |
| 104 | + */ |
| 105 | +$messages['fi'] = array( |
| 106 | + 'approvedrevs-desc' => 'Aseta yksittäinen sivuversio hyväksytyksi', |
| 107 | + 'approvedrevs-logname' => 'Versiohyväksynnän loki', |
| 108 | + 'approvedrevs-logdesc' => 'Tämä on hyväksyttyjen versioiden loki.', |
| 109 | + 'approvedrevs-approve' => 'hyväksy', |
| 110 | + 'approvedrevs-unapprove' => 'älä hyväksy', |
| 111 | + 'approvedrevs-approvesuccess' => 'Tämä sivuversio on asetettu hyväksytyksi versioksi.', |
| 112 | + 'approvedrevs-unapprovesuccess' => 'Tästä sivusta ei ole enää hyväksyttyä versiota. |
| 113 | +Sen sijaan, viimeisin versio näytetään.', |
| 114 | + 'approvedrevs-notlatest' => 'Tämä on tämän sivun hyväksytty versio; se ei ole viimeisin.', |
| 115 | + 'approvedrevs-approvedandlatest' => 'Tämä on tämän sivun hyväksytty ja samalla viimeisin versio.', |
| 116 | + 'approvedrevs-viewlatest' => 'Näytä viimeisin versio.', |
| 117 | + 'approvedpages' => 'Hyväksytyt sivut', |
| 118 | + 'approvedrevs-approvedpages-docu' => 'Seuraavat ovat wikisivuja, joilla on hyväksytty versio.', |
| 119 | + 'right-approverevisions' => 'Asettaa wikisivun tietty versio hyväksytyksi', |
| 120 | + 'right-viewlinktolatest' => 'Nähdä selittävä teksti niiden sivujen yläosassa, joilla on hyväksytty versio', |
| 121 | +); |
| 122 | + |
| 123 | +/** French (Français) |
| 124 | + * @author Peter17 |
| 125 | + */ |
| 126 | +$messages['fr'] = array( |
| 127 | + 'approvedrevs-desc' => 'Marquer une seule révision d’une page comme approuvée', |
| 128 | + 'approvedrevs-logname' => 'Journal des approbations de révisions', |
| 129 | + 'approvedrevs-logdesc' => 'Ceci est le journal des révisions qui ont été marquées comme approuvées.', |
| 130 | + 'approvedrevs-approve' => 'approuver', |
| 131 | + 'approvedrevs-unapprove' => 'désapprouver', |
| 132 | + 'approvedrevs-approvesuccess' => 'Cette révision de la page a été marquée comme étant la version approuvée.', |
| 133 | + 'approvedrevs-unapprovesuccess' => 'Il n’y a plus de version approuvée de cette page. |
| 134 | +Au lieu de cela, la révision la plus récente sera affichée.', |
| 135 | + 'approvedrevs-approveaction' => 'a marqué $2 comme la révision approuvée de « [[$1]] »', |
| 136 | + 'approvedrevs-unapproveaction' => 'a annulé le marquage d’une révision approuvée pour « [[$1]] »', |
| 137 | + 'approvedrevs-notlatest' => 'Ceci est la révision approuvée de cette page. Ce n’est pas la plus récente.', |
| 138 | + 'approvedrevs-approvedandlatest' => 'Ceci est la révision approuvée de la page, et aussi la plus récente.', |
| 139 | + 'approvedrevs-viewlatest' => 'Voir la révision la plus récente.', |
| 140 | + 'approvedpages' => 'Pages approuvées', |
| 141 | + 'approvedrevs-approvedpages-docu' => 'Voici les pages du wiki qui ont une révision approuvée.', |
| 142 | + 'right-approverevisions' => 'Marquer une révision précise d’une page comme approuvée', |
| 143 | + 'right-viewlinktolatest' => 'Voir le texte explicatif en haut des pages qui ont une révision approuvée', |
| 144 | +); |
| 145 | + |
| 146 | +/** Swiss German (Alemannisch) |
| 147 | + * @author Als-Holder |
| 148 | + */ |
| 149 | +$messages['gsw'] = array( |
| 150 | + 'approvedrevs-desc' => 'E Version vun eree Syte as „aagluegt“ markiere', |
| 151 | + 'approvedrevs-logname' => 'Versions-Markierigs-Logbuech', |
| 152 | + 'approvedrevs-logdesc' => 'Des isch s Logbuech vu dr aagluegte Version', |
| 153 | + 'approvedrevs-approve' => "As ''aagluegt'' markiere", |
| 154 | + 'approvedrevs-unapprove' => 'nit frejgee', |
| 155 | + 'approvedrevs-approvesuccess' => 'Die Version vu dr Syte isch as „aagluegti Version“ gsetzt wore.', |
| 156 | + 'approvedrevs-unapprovesuccess' => 'S git kei aaglkeugti Version me vu däre Syte. |
| 157 | +Statt däm wird di nejscht Version aazeigt.', |
| 158 | + 'approvedrevs-approveaction' => '$2 as aaglugti Version fir „[[$1]]“ setze', |
| 159 | + 'approvedrevs-unapproveaction' => 'd Markierig as aagluegti Version fir „[[$1]]“ uuseneh', |
| 160 | + 'approvedrevs-notlatest' => 'Des isch di aagluegt Version vu däre Syte; s isch nit di nejscht Version.', |
| 161 | + 'approvedrevs-approvedandlatest' => 'Des isch di aagluegt Version vu däre Syte un au di nejscht.', |
| 162 | + 'approvedrevs-viewlatest' => 'Di nejscht Version aaluege.', |
| 163 | + 'approvedpages' => 'Aagluegti Syte', |
| 164 | + 'approvedrevs-approvedpages-docu' => 'Des sin d Syte, wu s e aagluegti Version het.', |
| 165 | + 'right-approverevisions' => 'E sicheri Version vun ere Wikisyte as aagluegt markiere', |
| 166 | + 'right-viewlinktolatest' => 'Dr Erklerigstext aaluege obe uf Syte, wu s e aagluegti Version git', |
| 167 | +); |
| 168 | + |
| 169 | +/** Upper Sorbian (Hornjoserbsce) |
| 170 | + * @author Michawiki |
| 171 | + */ |
| 172 | +$messages['hsb'] = array( |
| 173 | + 'approvedrevs-desc' => 'Jednotliwu wersiju strony jako schwalenu stajić', |
| 174 | + 'approvedrevs-logname' => 'Protokol schwalenja wersijow', |
| 175 | + 'approvedrevs-logdesc' => 'To je protokol wersije, kotrež buchu schwalene.', |
| 176 | + 'approvedrevs-approve' => 'schwalić', |
| 177 | + 'approvedrevs-unapprove' => 'zakazać', |
| 178 | + 'approvedrevs-approvesuccess' => 'Tuta wersija strony je so jako schwalena wersija stajiła.', |
| 179 | + 'approvedrevs-unapprovesuccess' => 'Schwalena wersija za tutu stronu wjace njeje. |
| 180 | +Město toho so najnowša wersija pokaza.', |
| 181 | + 'approvedrevs-approveaction' => 'je $2 jako schwalenu wersiju za "[[$1]]" nastajił', |
| 182 | + 'approvedrevs-unapproveaction' => 'je status schwalena wersija za "[[$1]]" wotstronił', |
| 183 | + 'approvedrevs-notlatest' => 'To je schwalena wersija tuteje strony; njeje najnowša.', |
| 184 | + 'approvedrevs-approvedandlatest' => 'To je schwalena wersija tuteje strony, kotraž je tež najnowša.', |
| 185 | + 'approvedrevs-viewlatest' => 'Najnowšu wersiju pokazać', |
| 186 | + 'approvedpages' => 'Schwalene wersije', |
| 187 | + 'approvedrevs-approvedpages-docu' => 'Slědowace strony we wikiju maja schwalenu wersiju.', |
| 188 | + 'right-approverevisions' => 'Wěstu wersiju wikistrony jako schwalenu nastajić', |
| 189 | + 'right-viewlinktolatest' => 'Rozłožowacy tekst horjeka na stronach pokazać, kotrež maja schwalenu wersiju.', |
| 190 | +); |
| 191 | + |
| 192 | +/** Interlingua (Interlingua) |
| 193 | + * @author McDutchie |
| 194 | + */ |
| 195 | +$messages['ia'] = array( |
| 196 | + 'approvedrevs-desc' => 'Marcar un sol version de un pagina como approbate', |
| 197 | + 'approvedrevs-logname' => 'Registro de approbation de versiones', |
| 198 | + 'approvedrevs-logdesc' => 'Isto es le registro del versiones que ha essite approbate.', |
| 199 | + 'approvedrevs-approve' => 'approbar', |
| 200 | + 'approvedrevs-unapprove' => 'disapprobar', |
| 201 | + 'approvedrevs-approvesuccess' => 'Iste version del pagina ha essite marcate como le version approbate.', |
| 202 | + 'approvedrevs-unapprovesuccess' => 'Il non ha plus un version approbate de iste pagina. |
| 203 | +In loco de isto, le version le plus recente essera monstrate.', |
| 204 | + 'approvedrevs-approveaction' => 'marcava $2 como le version approbate de "[[$1]]"', |
| 205 | + 'approvedrevs-unapproveaction' => 'dismarcava le version approbate de "[[$1]]"', |
| 206 | + 'approvedrevs-notlatest' => 'Isto es le version approbate de iste pagina; non es le plus recente.', |
| 207 | + 'approvedrevs-approvedandlatest' => 'Isto es le version approbate de iste pagina, e tamben le plus recente.', |
| 208 | + 'approvedrevs-viewlatest' => 'Vider le version le plus recente.', |
| 209 | + 'approvedpages' => 'Paginas approbate', |
| 210 | + 'approvedrevs-approvedpages-docu' => 'Le sequente paginas in le wiki ha un version approbate.', |
| 211 | + 'right-approverevisions' => 'Marcar un certe version de un pagina wiki como approbate', |
| 212 | + 'right-viewlinktolatest' => 'Vider le texto explicative in alto del paginas que ha un version approbate', |
| 213 | +); |
| 214 | + |
| 215 | +/** Luxembourgish (Lëtzebuergesch) |
| 216 | + * @author Robby |
| 217 | + */ |
| 218 | +$messages['lb'] = array( |
| 219 | + 'approvedrevs-desc' => 'Eng eenzel Versioun vun enger Säit als nogekuckt markéieren', |
| 220 | + 'approvedrevs-logname' => 'Logbuch vun den nogekuckt Säiten déi fräigi sinn', |
| 221 | + 'approvedrevs-logdesc' => "Dëst ass d'Logbuch vun de Versiounen déi nogekuckt sinn.", |
| 222 | + 'approvedrevs-approve' => 'zoustëmmen', |
| 223 | + 'approvedrevs-approvesuccess' => 'Dës Versioun vun der Säit gouf als nogekuckte Versioun fräiginn.', |
| 224 | + 'approvedrevs-unapprovesuccess' => 'Et gëtt vun dëser Säit keng nogekuckte Versioun méi. |
| 225 | +Dofir gëtt déi rezentst Versioun gewisen.', |
| 226 | + 'approvedrevs-viewlatest' => 'Déi rezentst Versioun weisen.', |
| 227 | + 'approvedpages' => 'Nogekuckte Säiten', |
| 228 | + 'approvedrevs-approvedpages-docu' => 'Dës Säiten an der Wiki hunn eng nogekuckte Versioun.', |
| 229 | + 'right-approverevisions' => 'Eng bestëmmte Versioun vun enger Säit als nogekuckt markéieren', |
| 230 | +); |
| 231 | + |
| 232 | +/** Macedonian (Македонски) |
| 233 | + * @author Bjankuloski06 |
| 234 | + */ |
| 235 | +$messages['mk'] = array( |
| 236 | + 'approvedrevs-desc' => 'Поставање на една единствена ревизија на страницата како одобрена', |
| 237 | + 'approvedrevs-logname' => 'Дневник на одобрени ревизии', |
| 238 | + 'approvedrevs-logdesc' => 'Ова е дневникот на одобрени ревизии.', |
| 239 | + 'approvedrevs-approve' => 'одобри', |
| 240 | + 'approvedrevs-unapprove' => 'неодобрена', |
| 241 | + 'approvedrevs-approvesuccess' => 'Оваа ревизија на страницата е поставена како одобрена.', |
| 242 | + 'approvedrevs-unapprovesuccess' => 'Оваа страница повеќе нема одобрена верзија. |
| 243 | +Наместо тоа ќе се прикажува најновата верзија.', |
| 244 | + 'approvedrevs-approveaction' => 'постави ја $2 за одобрена верзија на „[[$1]]“', |
| 245 | + 'approvedrevs-unapproveaction' => 'отстрани одобрена верзија на „[[$1]]“', |
| 246 | + 'approvedrevs-notlatest' => 'Ова е одобрената ревизија на страницава, но не е најновата.', |
| 247 | + 'approvedrevs-approvedandlatest' => 'Ова е одобрената ревизија на страницава, а воедно и најновата.', |
| 248 | + 'approvedrevs-viewlatest' => 'Види најнова ревизија.', |
| 249 | + 'approvedpages' => 'Одобрени страници', |
| 250 | + 'approvedrevs-approvedpages-docu' => 'Ова се страници на викито што имаат одобрена ревизија.', |
| 251 | + 'right-approverevisions' => 'Поставете извесна ревизија на вики-страница како одобрена', |
| 252 | + 'right-viewlinktolatest' => 'Погледајте го објаснувањето на врвот од страниците што имаат одобрена верзија', |
| 253 | +); |
| 254 | + |
| 255 | +/** Dutch (Nederlands) |
| 256 | + * @author Siebrand |
| 257 | + */ |
| 258 | +$messages['nl'] = array( |
| 259 | + 'approvedrevs-desc' => 'Een versie van een pagina als goedgekeurd instellen', |
| 260 | + 'approvedrevs-logname' => 'Logboek versiegoedkeuring', |
| 261 | + 'approvedrevs-logdesc' => 'Dit is het logboek met de versies die zijn goedgekeurd.', |
| 262 | + 'approvedrevs-approve' => 'goedkeuren', |
| 263 | + 'approvedrevs-unapprove' => 'afkeuren', |
| 264 | + 'approvedrevs-approvesuccess' => 'Deze versie van de pagina is ingesteld als de goedgekeurde versie.', |
| 265 | + 'approvedrevs-unapprovesuccess' => 'Deze pagina heeft niet langer een goedgekeurde versie. |
| 266 | +Daarom wordt de laatste versie weergegeven.', |
| 267 | + 'approvedrevs-approveaction' => 'heeft $2 ingesteld als de goedgekeurde versie voor "[[$1]]"', |
| 268 | + 'approvedrevs-unapproveaction' => 'heeft de goedgekeurde versie verwijderd voor "[[$1]]"', |
| 269 | + 'approvedrevs-notlatest' => 'Dit is de goedgekeurde versie van deze pagina. |
| 270 | +Het is niet de meeste recente versie.', |
| 271 | + 'approvedrevs-approvedandlatest' => 'Dit is de goedgekeurde versie van deze pagina. Er is geen nieuwere versie.', |
| 272 | + 'approvedrevs-viewlatest' => 'Laatste versie bekijken', |
| 273 | + 'approvedpages' => "Goedgekeurde pagina's", |
| 274 | + 'approvedrevs-approvedpages-docu' => "De volgende pagina's in de wiki hebben een goedgekeurde versie.", |
| 275 | + 'right-approverevisions' => 'Een versie van een wikipagina markeren als goedgekeurd.', |
| 276 | + 'right-viewlinktolatest' => "De verklarende tekst bovenaan pagina's zien die die een goedgekeurde versie hebben", |
| 277 | +); |
| 278 | + |
| 279 | +/** Portuguese (Português) |
| 280 | + * @author Alchimista |
| 281 | + * @author Hamilton Abreu |
| 282 | + */ |
| 283 | +$messages['pt'] = array( |
| 284 | + 'approvedrevs-desc' => 'Marcar como aprovada uma das revisões de uma página', |
| 285 | + 'approvedrevs-logname' => 'Registo de revisões aprovadas', |
| 286 | + 'approvedrevs-logdesc' => 'Este é o registo das revisões que foram aprovadas.', |
| 287 | + 'approvedrevs-approve' => 'aprovar', |
| 288 | + 'approvedrevs-unapprove' => 'reprovar', |
| 289 | + 'approvedrevs-approvesuccess' => 'Esta revisão da página foi definida como a versão aprovada.', |
| 290 | + 'approvedrevs-unapprovesuccess' => 'Deixou de existir uma versão aprovada para esta página. |
| 291 | +Em vez dela, será apresentada a revisão mais recente.', |
| 292 | + 'approvedrevs-approveaction' => 'definir $2 como a revisão aprovada de "[[$1]]"', |
| 293 | + 'approvedrevs-unapproveaction' => 'desfazer a definição da revisão aprovada de "[[$1]]"', |
| 294 | + 'approvedrevs-notlatest' => 'Esta é a revisão aprovada desta página; não é a revisão mais recente.', |
| 295 | + 'approvedrevs-approvedandlatest' => 'Esta é a revisão aprovada desta página e também a revisão mais recente.', |
| 296 | + 'approvedrevs-viewlatest' => 'Ver a revisão mais recente.', |
| 297 | + 'approvedpages' => 'Páginas aprovadas', |
| 298 | + 'approvedrevs-approvedpages-docu' => 'As seguintes páginas desta wiki têm uma revisão aprovada.', |
| 299 | + 'right-approverevisions' => 'Definir como aprovada uma revisão específica de uma página da wiki', |
| 300 | + 'right-viewlinktolatest' => 'Ver um texto explicativo no topo das páginas que têm uma revisão aprovada', |
| 301 | +); |
| 302 | + |
| 303 | +/** Russian (Русский) |
| 304 | + * @author Александр Сигачёв |
| 305 | + */ |
| 306 | +$messages['ru'] = array( |
| 307 | + 'approvedrevs-desc' => 'Установка одной из версий страниц как подтверждённой', |
| 308 | + 'approvedrevs-logname' => 'Журнал подтверждения версий', |
| 309 | + 'approvedrevs-logdesc' => 'Это журнал версий страниц, которые были подтверждены.', |
| 310 | + 'approvedrevs-approve' => 'подтвердить', |
| 311 | + 'approvedrevs-unapprove' => 'снять подтверждение', |
| 312 | + 'approvedrevs-approvesuccess' => 'Это версия страницы была отмечена как подтверждённая.', |
| 313 | + 'approvedrevs-unapprovesuccess' => 'Не существует подтверждённой версии этой страницы. |
| 314 | +Вместо неё будет показана последняя версия.', |
| 315 | + 'approvedrevs-approveaction' => 'установить $2 как подтверждённую версию «[[$1]]»', |
| 316 | + 'approvedrevs-unapproveaction' => 'снять утверждённую версию для «[[$1]]»', |
| 317 | + 'approvedrevs-notlatest' => 'Это утверждённая версия страницы. Существуют более свежие версии.', |
| 318 | + 'approvedrevs-approvedandlatest' => 'Это утверждённая версия страницы. Она же является наиболее свежей версией.', |
| 319 | + 'approvedrevs-viewlatest' => 'Просмотреть самую свежую версию.', |
| 320 | + 'approvedpages' => 'Подтверждённые страницы', |
| 321 | + 'approvedrevs-approvedpages-docu' => 'Ниже показан список вики-страниц, имеющих подтверждённые версии.', |
| 322 | + 'right-approverevisions' => 'отметка определённых версий вики-страниц как подтверждённых', |
| 323 | + 'right-viewlinktolatest' => 'просмотр пояснительного текста в верхней части страниц, имеющих утверждённые версии', |
| 324 | +); |
| 325 | + |
| 326 | +/** Turkish (Türkçe) |
| 327 | + * @author Srhat |
| 328 | + */ |
| 329 | +$messages['tr'] = array( |
| 330 | + 'approvedrevs-desc' => 'Bir sayfanın belirli bir revizyonunu onaylanmış olarak ayarla', |
| 331 | + 'approvedrevs-logname' => 'Revizyon onay günlüğü', |
| 332 | + 'approvedrevs-logdesc' => 'Bu liste onaylanmış revizyon günlüğüdür.', |
| 333 | + 'approvedrevs-approve' => 'onayla', |
| 334 | + 'approvedrevs-unapprove' => 'onayı kaldır', |
| 335 | + 'approvedrevs-approvesuccess' => 'Sayfaya ait bu revizyon onaylanmış revizyon olarak ayarlandı.', |
| 336 | + 'approvedrevs-unapprovesuccess' => 'Bu sayfanın artık onaylanmış sürümü yok. |
| 337 | +Onun yerine, en son revizyon gösterilecektir.', |
| 338 | + 'approvedrevs-approveaction' => '$2 revizyonunu "[[$1]]" sayfasının onaylanmış revizyonu olarak ayarladı', |
| 339 | + 'approvedrevs-unapproveaction' => '"[[$1]]" sayfasının onaylanmış revizyonunun onayını kaldırdı.', |
| 340 | + 'approvedrevs-notlatest' => 'Bu sayfanın onaylanmış revizyonudur; en son revizyon değildir.', |
| 341 | + 'approvedrevs-approvedandlatest' => 'Bu revizyon, sayfanın hem onaylanmış hem de en son revizyonudur.', |
| 342 | + 'approvedrevs-viewlatest' => 'En son revizyonu görüntüle', |
| 343 | + 'approvedpages' => 'Onaylanmış sayfalar', |
| 344 | + 'approvedrevs-approvedpages-docu' => 'Aşağıdakiler, onaylanmış revizyonu bulunan viki sayfalardır.', |
| 345 | + 'right-approverevisions' => 'Bir viki sayfasının belirli bir revizyonunu onaylanmış olarak ayarla', |
| 346 | + 'right-viewlinktolatest' => 'Onaylanmış revizyonu bulunan sayfaların başındaki açıklayıcı metni görüntüle', |
| 347 | +); |
| 348 | + |
Property changes on: tags/extensions/ApprovedRevs/REL_0_2/ApprovedRevs.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 349 | + native |
Index: tags/extensions/ApprovedRevs/REL_0_2/ApprovedRevs.php |
— | — | @@ -0,0 +1,64 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die(); |
| 5 | + |
| 6 | +/** |
| 7 | + * @file |
| 8 | + * @ingroup Extensions |
| 9 | + * |
| 10 | + * @author Yaron Koren |
| 11 | + */ |
| 12 | + |
| 13 | +define( 'APPROVED_REVS_VERSION', '0.2' ); |
| 14 | + |
| 15 | +// credits |
| 16 | +$wgExtensionCredits['other'][] = array( |
| 17 | + 'path' => __FILE__, |
| 18 | + 'name' => 'Approved Revs', |
| 19 | + 'version' => APPROVED_REVS_VERSION, |
| 20 | + 'author' => 'Yaron Koren', |
| 21 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Approved_Revs', |
| 22 | + 'descriptionmsg' => 'approvedrevs-desc' |
| 23 | +); |
| 24 | + |
| 25 | +// global variables |
| 26 | +$egApprovedRevsIP = dirname( __FILE__ ) . '/'; |
| 27 | +$egApprovedRevsExcludedNamespaces = array(); |
| 28 | + |
| 29 | +// internationalization |
| 30 | +$wgExtensionMessagesFiles['ApprovedRevs'] = $egApprovedRevsIP . 'ApprovedRevs.i18n.php'; |
| 31 | +$wgExtensionAliasesFiles['ApprovedRevs'] = $egApprovedRevsIP . 'ApprovedRevs.alias.php'; |
| 32 | + |
| 33 | +// register all classes |
| 34 | +$wgAutoloadClasses['ApprovedRevs'] = $egApprovedRevsIP . 'ApprovedRevs_body.php'; |
| 35 | +$wgAutoloadClasses['ApprovedRevsHooks'] = $egApprovedRevsIP . 'ApprovedRevs.hooks.php'; |
| 36 | +$wgSpecialPages['ApprovedPages'] = 'ARApprovedPages'; |
| 37 | +$wgAutoloadClasses['ARApprovedPages'] = $egApprovedRevsIP . 'AR_ApprovedPages.php'; |
| 38 | +$wgSpecialPageGroups['ApprovedPages'] = 'pages'; |
| 39 | + |
| 40 | +// hooks |
| 41 | +$wgHooks['ParserBeforeInternalParse'][] = 'ApprovedRevsHooks::setApprovedRevForParsing'; |
| 42 | +$wgHooks['ArticleFromTitle'][] = 'ApprovedRevsHooks::showApprovedRevision'; |
| 43 | +$wgHooks['DisplayOldSubtitle'][] = 'ApprovedRevsHooks::setSubtitle'; |
| 44 | +$wgHooks['SkinTemplateNavigation'][] = 'ApprovedRevsHooks::changeEditLink'; |
| 45 | +$wgHooks['PageHistoryBeforeList'][] = 'ApprovedRevsHooks::storeApprovedRevisionForHistoryPage'; |
| 46 | +$wgHooks['PageHistoryLineEnding'][] = 'ApprovedRevsHooks::addApprovalLink'; |
| 47 | +$wgHooks['UnknownAction'][] = 'ApprovedRevsHooks::setAsApproved'; |
| 48 | +$wgHooks['UnknownAction'][] = 'ApprovedRevsHooks::unsetAsApproved'; |
| 49 | +$wgHooks['BeforeParserFetchTemplateAndtitle'][] = 'ApprovedRevsHooks::setTranscludedPageRev'; |
| 50 | +$wgHooks['ArticleDeleteComplete'][] = 'ApprovedRevsHooks::deleteRevisionApproval'; |
| 51 | +$wgHooks['AdminLinks'][] = 'ApprovedRevsHooks::addToAdminLinks'; |
| 52 | +$wgHooks['LoadExtensionSchemaUpdates'][] = 'ApprovedRevsHooks::describeDBSchema'; |
| 53 | + |
| 54 | +// logging |
| 55 | +$wgLogTypes['approval'] = 'approval'; |
| 56 | +$wgLogNames['approval'] = 'approvedrevs-logname'; |
| 57 | +$wgLogHeaders['approval'] = 'approvedrevs-logdesc'; |
| 58 | +$wgLogActions['approval/approve'] = 'approvedrevs-approveaction'; |
| 59 | +$wgLogActions['approval/unapprove'] = 'approvedrevs-unapproveaction'; |
| 60 | + |
| 61 | +// user rights |
| 62 | +$wgAvailableRights[] = 'approverevisions'; |
| 63 | +$wgGroupPermissions['sysop']['approverevisions'] = true; |
| 64 | +$wgAvailableRights[] = 'viewlinktolatest'; |
| 65 | +$wgGroupPermissions['*']['viewlinktolatest'] = true; |
Property changes on: tags/extensions/ApprovedRevs/REL_0_2/ApprovedRevs.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 66 | + native |
Index: tags/extensions/ApprovedRevs/REL_0_2/AR_ApprovedPages.php |
— | — | @@ -0,0 +1,66 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Special page that lists all pages that have an approved revision. |
| 5 | + * |
| 6 | + * @author Yaron Koren |
| 7 | + */ |
| 8 | + |
| 9 | +if ( !defined( 'MEDIAWIKI' ) ) die(); |
| 10 | + |
| 11 | +class ARApprovedPages extends SpecialPage { |
| 12 | + |
| 13 | + /** |
| 14 | + * Constructor |
| 15 | + */ |
| 16 | + function ARApprovedPages() { |
| 17 | + SpecialPage::SpecialPage( 'ApprovedPages' ); |
| 18 | + wfLoadExtensionMessages( 'ApprovedRevs' ); |
| 19 | + } |
| 20 | + |
| 21 | + function execute( $query ) { |
| 22 | + $this->setHeaders(); |
| 23 | + list( $limit, $offset ) = wfCheckLimits(); |
| 24 | + $rep = new ARApprovedPagesPage(); |
| 25 | + return $rep->doQuery( $offset, $limit ); |
| 26 | + } |
| 27 | +} |
| 28 | + |
| 29 | +class ARApprovedPagesPage extends QueryPage { |
| 30 | + function getName() { |
| 31 | + return "ApprovedPages"; |
| 32 | + } |
| 33 | + |
| 34 | + function isExpensive() { return false; } |
| 35 | + |
| 36 | + function isSyndicated() { return false; } |
| 37 | + |
| 38 | + function getPageHeader() { |
| 39 | + $header = Xml::element( 'p', null, wfMsg( 'approvedrevs-approvedpages-docu' ) ) . "<br />\n"; |
| 40 | + return $header; |
| 41 | + } |
| 42 | + |
| 43 | + function getPageFooter() { |
| 44 | + } |
| 45 | + |
| 46 | + function getSQL() { |
| 47 | + $dbr = wfGetDB( DB_SLAVE ); |
| 48 | + $approved_revs = $dbr->tableName( 'approved_revs' ); |
| 49 | + $page = $dbr->tableName( 'page' ); |
| 50 | + // QueryPage uses the value from this SQL in an ORDER clause, |
| 51 | + // so return page_title as title. |
| 52 | + return "SELECT 'Page' AS type, |
| 53 | + p.page_title AS title, |
| 54 | + p.page_id AS value |
| 55 | + FROM $approved_revs ar JOIN $page p |
| 56 | + ON ar.page_id = p.page_id"; |
| 57 | + } |
| 58 | + |
| 59 | + function sortDescending() { |
| 60 | + return false; |
| 61 | + } |
| 62 | + |
| 63 | + function formatResult( $skin, $result ) { |
| 64 | + $title = Title::newFromId( $result->value ); |
| 65 | + return $skin->makeLinkObj( $title ); |
| 66 | + } |
| 67 | +} |
\ No newline at end of file |
Property changes on: tags/extensions/ApprovedRevs/REL_0_2/AR_ApprovedPages.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 68 | + native |
Index: tags/extensions/ApprovedRevs/REL_0_2/ApprovedRevs.hooks.php |
— | — | @@ -0,0 +1,303 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +if ( ! defined( 'MEDIAWIKI' ) ) die(); |
| 5 | + |
| 6 | +/** |
| 7 | + * Functions for the Approved Revs extension called by hooks in the MediaWiki |
| 8 | + * code. |
| 9 | + * |
| 10 | + * @file |
| 11 | + * @ingroup Extensions |
| 12 | + * |
| 13 | + * @author Yaron Koren |
| 14 | + */ |
| 15 | + |
| 16 | +class ApprovedRevsHooks { |
| 17 | + |
| 18 | + static public function setApprovedRevForParsing( &$parser, &$text, &$stripState ) { |
| 19 | + global $wgRequest; |
| 20 | + $action = $wgRequest->getVal( 'action' ); |
| 21 | + if ( $action == 'submit' ) { |
| 22 | + $title = $parser->getTitle(); |
| 23 | + $approvedText = ApprovedRevs::getApprovedContent( $title ); |
| 24 | + if ( ! is_null( $approvedText ) ) { |
| 25 | + $text = $approvedText; |
| 26 | + } |
| 27 | + } |
| 28 | + return true; |
| 29 | + } |
| 30 | + |
| 31 | + /** |
| 32 | + * Return the approved revision of the page, if there is one, and if |
| 33 | + * the page is simply being viewed, and if no specific revision has |
| 34 | + * been requested. |
| 35 | + */ |
| 36 | + static function showApprovedRevision( &$title, &$article ) { |
| 37 | + // if a revision ID is set, exit |
| 38 | + if ( $title->mArticleID > -1 ) { |
| 39 | + return true; |
| 40 | + } |
| 41 | + // if it's any action other than viewing, exit |
| 42 | + global $wgRequest; |
| 43 | + if ( $wgRequest->getCheck( 'action' ) && |
| 44 | + $wgRequest->getVal( 'action' ) != 'view' && |
| 45 | + $wgRequest->getVal( 'action' ) != 'purge' && |
| 46 | + $wgRequest->getVal( 'action' ) != 'render' ) { |
| 47 | + return true; |
| 48 | + } |
| 49 | + |
| 50 | + $revisionID = ApprovedRevs::getApprovedRevID( $title ); |
| 51 | + if ( ! empty( $revisionID ) ) { |
| 52 | + $article = new Article( $title, $revisionID ); |
| 53 | + } |
| 54 | + return true; |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * If user is viewing the page via its main URL, and what they're |
| 59 | + * seeing is the approved revision of the page, remove the standard |
| 60 | + * subtitle shown for all non-latest revisions, and replace it with |
| 61 | + * either nothing or a message explaining the situation, depending |
| 62 | + * on the user's rights |
| 63 | + */ |
| 64 | + static function setSubtitle( &$article, &$revisionID ) { |
| 65 | + if ( ! ApprovedRevs::hasApprovedRevision( $article->getTitle() ) ) { |
| 66 | + return true; |
| 67 | + } |
| 68 | + |
| 69 | + global $wgRequest; |
| 70 | + if ( $wgRequest->getCheck( 'oldid' ) ) { |
| 71 | + return true; |
| 72 | + } |
| 73 | + |
| 74 | + if ( ! $article->getTitle()->userCan( 'viewlinktolatest' ) ) { |
| 75 | + return false; |
| 76 | + } |
| 77 | + |
| 78 | + wfLoadExtensionMessages( 'ApprovedRevs' ); |
| 79 | + if ( $revisionID == $article->getLatest() ) { |
| 80 | + $text = wfMsg( 'approvedrevs-approvedandlatest' ); |
| 81 | + } else { |
| 82 | + $text = wfMsg( 'approvedrevs-notlatest' ); |
| 83 | + global $wgUser; |
| 84 | + $sk = $wgUser->getSkin(); |
| 85 | + $curRevLink = $sk->link( |
| 86 | + $article->getTitle(), |
| 87 | + wfMsgHtml( 'approvedrevs-viewlatest' ), |
| 88 | + array(), |
| 89 | + array( 'oldid' => $article->getLatest() ), |
| 90 | + array( 'known', 'noclasses' ) |
| 91 | + ); |
| 92 | + $text .= ' ' . $curRevLink; |
| 93 | + } |
| 94 | + global $wgOut; |
| 95 | + $wgOut->setSubtitle( $text ); |
| 96 | + return false; |
| 97 | + } |
| 98 | + |
| 99 | + /** |
| 100 | + * If user is looking at a revision through a main 'view' URL (no |
| 101 | + * revision specified), have the 'edit' tab link to the basic |
| 102 | + * 'action=edit' URL (i.e., the latest revision), no matter which |
| 103 | + * revision they're actually on. |
| 104 | + */ |
| 105 | + static function changeEditLink( &$skin, &$contentActions ) { |
| 106 | + global $wgRequest; |
| 107 | + if ( $wgRequest->getCheck( 'oldid' ) ) { |
| 108 | + return true; |
| 109 | + } |
| 110 | + if ( ApprovedRevs::hasApprovedRevision( $skin->getTitle() ) ) { |
| 111 | + // the URL is the same regardless of whether the tab |
| 112 | + // is 'edit' or 'view source', but the "action" is |
| 113 | + // different |
| 114 | + if ( array_key_exists( 'edit', $contentActions['views'] ) ) { |
| 115 | + $contentActions['views']['edit']['href'] = $skin->getTitle()->getLocalUrl( array( 'action' => 'edit' ) ); |
| 116 | + } |
| 117 | + if ( array_key_exists( 'viewsource', $contentActions['views'] ) ) { |
| 118 | + $contentActions['views']['viewsource']['href'] = $skin->getTitle()->getLocalUrl( array( 'action' => 'edit' ) ); |
| 119 | + } |
| 120 | + } |
| 121 | + return true; |
| 122 | + } |
| 123 | + |
| 124 | + /** |
| 125 | + * Store the approved revision ID, if any, directly in the object |
| 126 | + * for this article - this is called so that a query to the database |
| 127 | + * can be made just once for every view of a history page, instead |
| 128 | + * of for every row. |
| 129 | + */ |
| 130 | + static function storeApprovedRevisionForHistoryPage( &$article ) { |
| 131 | + // this will be null if there's no ID |
| 132 | + $approvedRevID = ApprovedRevs::getApprovedRevID( $article->getTitle() ); |
| 133 | + $article->approvedRevID = $approvedRevID; |
| 134 | + // also load extension messages, while we're at it |
| 135 | + wfLoadExtensionMessages( 'ApprovedRevs' ); |
| 136 | + return true; |
| 137 | + } |
| 138 | + |
| 139 | + /** |
| 140 | + * If the user is allowed to make revision approvals, add either an |
| 141 | + * 'approve' or 'unapprove' link to the end of this row in the page |
| 142 | + * history, depending on whether or not this is already the approved |
| 143 | + * revision. If it's the approved revision also add on a "star" |
| 144 | + * icon, regardless of the user. |
| 145 | + */ |
| 146 | + static function addApprovalLink( $historyPage, &$row , &$s ) { |
| 147 | + $title = $historyPage->getTitle(); |
| 148 | + if ( ApprovedRevs::hasUnsupportedNamespace( $title ) ) { |
| 149 | + return true; |
| 150 | + } |
| 151 | + |
| 152 | + $article = $historyPage->getArticle(); |
| 153 | + // use the rev ID field in the $article object, which was |
| 154 | + // stored earlier |
| 155 | + $approvedRevID = $article->approvedRevID; |
| 156 | + if ( $row->rev_id == $approvedRevID ) { |
| 157 | + $s .= '★ '; |
| 158 | + } |
| 159 | + if ( $title->userCan( 'approverevisions' ) ) { |
| 160 | + if ( $row->rev_id == $approvedRevID ) { |
| 161 | + $url = $title->getLocalUrl( |
| 162 | + array( 'action' => 'unapprove' ) |
| 163 | + ); |
| 164 | + $msg = wfMsg( 'approvedrevs-unapprove' ); |
| 165 | + } else { |
| 166 | + $url = $title->getLocalUrl( |
| 167 | + array( 'action' => 'approve', 'oldid' => $row->rev_id ) |
| 168 | + ); |
| 169 | + $msg = wfMsg( 'approvedrevs-approve' ); |
| 170 | + } |
| 171 | + $s .= '(' . Xml::element( |
| 172 | + 'a', |
| 173 | + array( 'href' => $url ), |
| 174 | + $msg |
| 175 | + ) . ')'; |
| 176 | + } |
| 177 | + return true; |
| 178 | + } |
| 179 | + |
| 180 | + /** |
| 181 | + * Handle the 'approve' action, defined for ApprovedRevs - |
| 182 | + * mark the revision as approved, log it, and show a message to |
| 183 | + * the user. |
| 184 | + */ |
| 185 | + static function setAsApproved( $action, $article ) { |
| 186 | + // return "true" if the call failed (meaning, pass on handling |
| 187 | + // of the hook to others), and "false" otherwise |
| 188 | + if ( $action != 'approve' ) { |
| 189 | + return true; |
| 190 | + } |
| 191 | + $title = $article->getTitle(); |
| 192 | + if ( ApprovedRevs::hasUnsupportedNamespace( $title ) ) { |
| 193 | + return true; |
| 194 | + } |
| 195 | + if ( ! $title->userCan( 'approverevisions' ) ) { |
| 196 | + return true; |
| 197 | + } |
| 198 | + global $wgRequest; |
| 199 | + if ( ! $wgRequest->getCheck( 'oldid' ) ) { |
| 200 | + return true; |
| 201 | + } |
| 202 | + $revision_id = $wgRequest->getVal( 'oldid' ); |
| 203 | + ApprovedRevs::setApprovedRevID( $title, $revision_id ); |
| 204 | + |
| 205 | + global $wgOut; |
| 206 | + $wgOut->addHTML( ' ' . Xml::element( |
| 207 | + 'div', |
| 208 | + array( 'class' => 'successbox' ), |
| 209 | + wfMsg( 'approvedrevs-approvesuccess' ) |
| 210 | + ) . "\n" ); |
| 211 | + $wgOut->addHTML( ' ' . Xml::element( |
| 212 | + 'p', |
| 213 | + array( 'style' => 'clear: both' ) |
| 214 | + ) . "\n" ); |
| 215 | + |
| 216 | + // show the revision, instead of the history page |
| 217 | + $article->doPurge(); |
| 218 | + $article->view(); |
| 219 | + return false; |
| 220 | + } |
| 221 | + |
| 222 | + /** |
| 223 | + * Handle the 'unapprove' action, defined for ApprovedRevs - |
| 224 | + * unset the previously-approved revision, log the change, and show |
| 225 | + * a message to the user. |
| 226 | + */ |
| 227 | + static function unsetAsApproved( $action, $article ) { |
| 228 | + // return "true" if the call failed (meaning, pass on handling |
| 229 | + // of the hook to others), and "false" otherwise |
| 230 | + if ( $action != 'unapprove' ) { |
| 231 | + return true; |
| 232 | + } |
| 233 | + $title = $article->getTitle(); |
| 234 | + if ( ! $title->userCan( 'approverevisions' ) ) { |
| 235 | + return true; |
| 236 | + } |
| 237 | + |
| 238 | + ApprovedRevs::unsetApproval( $title ); |
| 239 | + |
| 240 | + global $wgOut; |
| 241 | + $wgOut->addHTML( ' ' . Xml::element( |
| 242 | + 'div', |
| 243 | + array( 'class' => 'successbox' ), |
| 244 | + wfMsg( 'approvedrevs-unapprovesuccess' ) |
| 245 | + ) . "\n" ); |
| 246 | + $wgOut->addHTML( ' ' . Xml::element( |
| 247 | + 'p', |
| 248 | + array( 'style' => 'clear: both' ) |
| 249 | + ) . "\n" ); |
| 250 | + |
| 251 | + // show the revision, instead of the history page |
| 252 | + $article->doPurge(); |
| 253 | + $article->view(); |
| 254 | + return false; |
| 255 | + } |
| 256 | + |
| 257 | + /** |
| 258 | + * Use the approved revision, if it exists, for templates and other |
| 259 | + * transcluded pages. |
| 260 | + */ |
| 261 | + static function setTranscludedPageRev( $parser, &$title, &$skip, &$id ) { |
| 262 | + $revision_id = ApprovedRevs::getApprovedRevID( $title ); |
| 263 | + if ( ! is_null( $revision_id ) ) { |
| 264 | + $id = $revision_id; |
| 265 | + } |
| 266 | + return true; |
| 267 | + } |
| 268 | + |
| 269 | + /** |
| 270 | + * Deletes the approval record in the database if the page itself is |
| 271 | + * deleted. |
| 272 | + */ |
| 273 | + static function deleteRevisionApproval( &$article, &$user, $reason, $id ) { |
| 274 | + ApprovedRevs::deleteRevisionApproval( $article->getTitle() ); |
| 275 | + return true; |
| 276 | + } |
| 277 | + |
| 278 | + /** |
| 279 | + * Adds a link to 'Special:ApprovedPages' to the the page |
| 280 | + * 'Special:AdminLinks', defined by the Admin Links extension. |
| 281 | + */ |
| 282 | + function addToAdminLinks( &$admin_links_tree ) { |
| 283 | + $general_section = $admin_links_tree->getSection( wfMsg( 'adminlinks_general' ) ); |
| 284 | + $extensions_row = $general_section->getRow( 'extensions' ); |
| 285 | + if ( is_null( $extensions_row ) ) { |
| 286 | + $extensions_row = new ALRow( 'extensions' ); |
| 287 | + $general_section->addRow( $extensions_row ); |
| 288 | + } |
| 289 | + $extensions_row->addItem( ALItem::newFromSpecialPage( 'ApprovedPages' ) ); |
| 290 | + return true; |
| 291 | + } |
| 292 | + |
| 293 | + public static function describeDBSchema() { |
| 294 | + global $wgExtNewTables, $wgDBtype; |
| 295 | + |
| 296 | + $dir = dirname( __FILE__ ); |
| 297 | + |
| 298 | + // DB updates |
| 299 | + //if ( $wgDBtype == 'mysql' ) { |
| 300 | + $wgExtNewTables[] = array( 'approved_revs', "$dir/ApprovedRevs.sql" ); |
| 301 | + //} |
| 302 | + return true; |
| 303 | + } |
| 304 | +} |
Property changes on: tags/extensions/ApprovedRevs/REL_0_2/ApprovedRevs.hooks.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 305 | + native |
Index: tags/extensions/ApprovedRevs/REL_0_2/README |
— | — | @@ -0,0 +1,35 @@ |
| 2 | +Approved Revs Extension |
| 3 | + |
| 4 | + Version 0.2 |
| 5 | + Yaron Koren |
| 6 | + |
| 7 | +This is free software licensed under the GNU General Public License. Please |
| 8 | +see http://www.gnu.org/copyleft/gpl.html for further details, including the |
| 9 | +full text and terms of the license. |
| 10 | + |
| 11 | +== Overview == |
| 12 | + |
| 13 | +Approved Revs is an extension to MediaWiki that lets administrators mark a |
| 14 | +certain revision of a page as "approved". The approved revision is the one |
| 15 | +displayed when users view the page at its main URL. |
| 16 | + |
| 17 | +For more information, see the extension homepage at: |
| 18 | +http://www.mediawiki.org/wiki/Extension:Approved_Revs |
| 19 | + |
| 20 | +== Requirements == |
| 21 | + |
| 22 | +This version of the Approved Revs extension requires MediaWiki 1.11 or |
| 23 | +higher. |
| 24 | + |
| 25 | +== Installation == |
| 26 | + |
| 27 | +To install the extension, place the entire 'ApprovedRevs' directory |
| 28 | +within your MediaWiki 'extensions' directory, then add the following |
| 29 | +line to your 'LocalSettings.php' file: |
| 30 | + |
| 31 | + require_once( "$IP/extensions/ApprovedRevs/ApprovedRevs.php" ); |
| 32 | + |
| 33 | +== Contact == |
| 34 | + |
| 35 | +Comments, questions, suggestions and bug reports should be sent to Yaron |
| 36 | +Koren, at yaron57@gmail.com. |
Property changes on: tags/extensions/ApprovedRevs/REL_0_2/README |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 37 | + native |
Index: tags/extensions/ApprovedRevs/REL_0_2/ApprovedRevs.alias.php |
— | — | @@ -0,0 +1,13 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Aliases for special pages of Approved Revs extension. |
| 5 | + * |
| 6 | + */ |
| 7 | + |
| 8 | +$aliases = array(); |
| 9 | + |
| 10 | +/** English |
| 11 | + */ |
| 12 | +$aliases['en'] = array( |
| 13 | + 'ApprovedPages' => array( 'ApprovedPages' ), |
| 14 | +); |
\ No newline at end of file |
Property changes on: tags/extensions/ApprovedRevs/REL_0_2/ApprovedRevs.alias.php |
___________________________________________________________________ |
Added: svn:keywords |
1 | 15 | + Id |
Added: svn:eol-style |
2 | 16 | + native |
Index: tags/extensions/ApprovedRevs/REL_0_2/ApprovedRevs.sql |
— | — | @@ -0,0 +1,6 @@ |
| 2 | +CREATE TABLE /*_*/approved_revs ( |
| 3 | + page_id int(8) default NULL, |
| 4 | + rev_id int(8) default NULL |
| 5 | +) /*$wgDBTableOptions*/; |
| 6 | + |
| 7 | +CREATE UNIQUE INDEX approved_revs_page_id ON /*_*/approved_revs (page_id); |
Property changes on: tags/extensions/ApprovedRevs/REL_0_2/ApprovedRevs.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 8 | + native |