Index: trunk/extensions/ArticleToCategory2/ArticleToCategory2.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | === MediaWiki Extension: Add Article to Category 2 === |
5 | 5 | * @file |
6 | 6 | * @ingroup Extensions |
7 | | - * @version 0.2 |
| 7 | + * @version 1.0 |
8 | 8 | * @author Liang Chen <anything@liang-chen.com> (original code) |
9 | 9 | * @author Julien Devincre (exclude categories) |
10 | 10 | * @author Cynthia Mattingly - Marketing Factory Consulting (i18n, adding category) |
— | — | @@ -33,22 +33,26 @@ |
34 | 34 | echo <<<HEREDOC |
35 | 35 | To install the ArticleToCategory2 extension, put the following line in LocalSettings.php:<P> |
36 | 36 | require_once( "\$IP/extensions/ArticleToCategory2/ArticleToCategory2.php" );<br> |
37 | | -\$wgarticletocategory2ConfigAddcat=false;<br> |
38 | 37 | \$wgarticletocategory2ConfigBlacklist=false;<br> |
| 38 | +\$wgGroupPermissions['*']['ArticleToCategory2'] = true;<br> |
| 39 | +\$wgGroupPermissions['*']['ArticleToCategory2AddCat'] = false;<br> |
| 40 | + |
39 | 41 | HEREDOC; |
40 | 42 | exit( 1 ); |
41 | 43 | } |
42 | 44 | |
43 | | -/* Set default values on configutation variables */ |
44 | | -$wgarticletocategory2ConfigAddcat=false; |
| 45 | +/** Set default values on configutation variables **/ |
45 | 46 | $wgarticletocategory2ConfigBlacklist=false; |
46 | | - |
| 47 | +/* Set default 'true' for add article to category */ |
| 48 | +$wgGroupPermissions['*']['ArticleToCategory2'] = true; |
| 49 | +/* Set default 'false' for add category to category */ |
| 50 | +$wgGroupPermissions['*']['ArticleToCategory2AddCat'] = false; |
47 | 51 | |
48 | 52 | $wgExtensionCredits['other'][] = array( |
49 | 53 | 'path' => __FILE__, |
50 | 54 | 'name' => 'Add Article to Category 2', |
51 | 55 | 'descriptionmsg' => 'articletocategory2-desc', |
52 | | - 'version' => '0.2', |
| 56 | + 'version' => '1.0', |
53 | 57 | 'author' => array( |
54 | 58 | '[http://www.mediawiki.org/wiki/User:BiGreat Liang Chen \'BiGreat\'] (original code)', |
55 | 59 | 'Julien Devincre (exclude categories)', |
— | — | @@ -132,18 +136,12 @@ |
133 | 137 | ******************************/ |
134 | 138 | function wfCategoryChange( $catpage ) { |
135 | 139 | global $wgarticletocategory2ConfigBlacklist, $wgarticletocategory2ConfigAddcat, |
136 | | - $wgOut, $wgScript, $wgContLang; |
| 140 | + $wgOut, $wgScript, $wgContLang, $wgUser; |
137 | 141 | |
138 | | - wfLoadExtensionMessages( 'ArticleToCategory2' ); |
139 | | - |
140 | | - $boxtext = wfMsg( 'articletocategory2-create-article-under-category-text' ); |
141 | | - $btext = wfMsg( 'articletocategory2-create-article-under-category-button' ); |
142 | | - $boxtext2 = wfMsg( 'articletocategory2-create-category-under-category-text' ); |
143 | | - $btext2 = wfMsg( 'articletocategory2-create-category-under-category-button' ); |
144 | | - |
145 | 142 | $action = htmlspecialchars( $wgScript ); |
146 | 143 | if ( !$catpage->mTitle->quickUserCan( 'edit' ) |
147 | | - || !$catpage->mTitle->quickUserCan( 'create') ) |
| 144 | + || !$catpage->mTitle->quickUserCan( 'create') |
| 145 | + || !$wgUser->isAllowed( 'ArticleToCategory2') ) |
148 | 146 | { |
149 | 147 | return true; |
150 | 148 | } |
— | — | @@ -155,6 +153,13 @@ |
156 | 154 | } |
157 | 155 | } |
158 | 156 | } |
| 157 | + wfLoadExtensionMessages( 'ArticleToCategory2' ); |
| 158 | + |
| 159 | + $boxtext = wfMsg( 'articletocategory2-create-article-under-category-text' ); |
| 160 | + $btext = wfMsg( 'articletocategory2-create-article-under-category-button' ); |
| 161 | + $boxtext2 = wfMsg( 'articletocategory2-create-category-under-category-text' ); |
| 162 | + $btext2 = wfMsg( 'articletocategory2-create-category-under-category-button' ); |
| 163 | + |
159 | 164 | $cattitle = $wgContLang->getNsText( NS_CATEGORY ); |
160 | 165 | |
161 | 166 | /*** javascript blocks ***/ |
— | — | @@ -217,7 +222,7 @@ |
218 | 223 | FORMEND; |
219 | 224 | /*** javascript blocks end ***/ |
220 | 225 | $wgOut->addHTML( $formstart ); |
221 | | - if ( $wgarticletocategory2ConfigAddcat ) { |
| 226 | + if ( $wgUser->isAllowed( 'ArticleToCategory2AddCat' ) ) { |
222 | 227 | $wgOut->addHTML( $formcategory ); |
223 | 228 | } |
224 | 229 | $wgOut->addHTML( $formend ); |