Index: trunk/extensions/Configure/Configure.settings-ext.txt |
— | — | @@ -284,6 +284,12 @@ |
285 | 285 | empty[] = wgCollectionMWServeCert: null, wgLicenseName: null, wgLicenseURL: null |
286 | 286 | url = http://www.mediawiki.org/wiki/Extension:Collection |
287 | 287 | |
| 288 | +Commentbox |
| 289 | +settings[] = wgCommentboxNamespaces: array |
| 290 | +settings[] = wgCommentboxRows: int, wgCommentboxColumns: int |
| 291 | +array[] = wgCommentboxNamespaces: ns-simple |
| 292 | +url = http://www.mediawiki.org/wiki/Extension:Commentbox |
| 293 | + |
288 | 294 | CommentPages |
289 | 295 | settings[] = wgCommentPagesNS: int |
290 | 296 | url = http://www.mediawiki.org/wiki/Extension:CommentPages |
Index: trunk/extensions/Commentbox/Commentbox.i18n.php |
— | — | @@ -5,8 +5,6 @@ |
6 | 6 | * @addtogroup Extensions |
7 | 7 | */ |
8 | 8 | |
9 | | -if (!defined('MEDIAWIKI')) die(); |
10 | | - |
11 | 9 | $messages = array(); |
12 | 10 | |
13 | 11 | $messages['en'] = array( |
— | — | @@ -16,7 +14,7 @@ |
17 | 15 | You have a comment on this page? Add it here or <span class="plainlinks">[{{fullurl:{{FULLPAGENAME}}|action=edit}} edit the page directly]</span>.', |
18 | 16 | 'commentbox-savebutton' => 'Save comment', |
19 | 17 | 'commentbox-name' => 'Name:', |
20 | | - 'commentbox-name-explanation' => '<small>(Tip: If you [[Special:Userlogin|log in]], you won\'t have to fill in your name here manually)</small>', |
| 18 | + 'commentbox-name-explanation' => '<small>(Tip: If you [[Special:Userlogin|log in]], you will not have to fill in your name here manually)</small>', |
21 | 19 | 'commentbox-log' => 'New Comments', |
22 | 20 | 'commentbox-first-comment-heading' => '== Comments ==', |
23 | 21 | 'commentbox-regex' => '/\n==\s*Comments\s*==\s*\n/i', # should match the above heading |
— | — | @@ -26,6 +24,10 @@ |
27 | 25 | 'commentbox-error-empty-comment' => 'Empty comments are not allowed!', |
28 | 26 | ); |
29 | 27 | |
| 28 | +$messages['qqq'] = array( |
| 29 | + 'commentbox-regex' => 'Regular expression that should match {{msg-mw|commentbox-first-comment-heading}}', |
| 30 | +); |
| 31 | + |
30 | 32 | $messages['de'] = array( |
31 | 33 | 'commentbox-desc' => 'Fügt in bestimmte Seiten ein Kommentarfeld ein', |
32 | 34 | 'commentbox-prefill' => '', |
— | — | @@ -42,4 +44,3 @@ |
43 | 45 | 'commentbox-error-namespace' => 'Kommentare sind in diesem Namensraum nicht erlaubt!', |
44 | 46 | 'commentbox-error-empty-comment' => 'Leere Kommentare sind nicht erlaubt!', |
45 | 47 | ); |
46 | | - |
Property changes on: trunk/extensions/Commentbox/Commentbox.i18n.php |
___________________________________________________________________ |
Name: svn:eol-style |
47 | 48 | + native |
Index: trunk/extensions/Commentbox/SpecialAddComment_body.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * @addtogroup Extensions |
7 | 7 | */ |
8 | 8 | |
9 | | -if (!defined('MEDIAWIKI')) die(); |
| 9 | +if ( !defined( 'MEDIAWIKI' ) ) die(); |
10 | 10 | |
11 | 11 | class SpecialAddComment extends UnlistedSpecialPage { |
12 | 12 | public function __construct() { |
— | — | @@ -14,14 +14,14 @@ |
15 | 15 | |
16 | 16 | public function execute( $par ) { |
17 | 17 | global $wgUser, $wgRequest, $wgOut, $wgCommentboxNamespaces; |
18 | | - if( !$wgRequest->wasPosted() ) { |
| 18 | + if ( !$wgRequest->wasPosted() ) { |
19 | 19 | $wgOut->redirect( Title::newMainPage()->getFullURL() ); |
20 | 20 | return; |
21 | 21 | } |
22 | 22 | $this->setHeaders(); |
23 | 23 | wfLoadExtensionMessages( 'Commentbox' ); |
24 | 24 | |
25 | | - if( !$this->userCanExecute( $wgUser ) ){ |
| 25 | + if ( !$this->userCanExecute( $wgUser ) ) { |
26 | 26 | $this->displayRestrictionError(); |
27 | 27 | return; |
28 | 28 | } |
— | — | @@ -29,23 +29,23 @@ |
30 | 30 | $Author = $wgRequest->getText( 'wpAuthor', '' ); |
31 | 31 | $Comment = $wgRequest->getText( 'wpComment', '' ); |
32 | 32 | $title = Title::newFromText( $Pagename ); |
33 | | - if( $title == NULL || !$title->exists() ) { |
| 33 | + if ( $title == NULL || !$title->exists() ) { |
34 | 34 | $this->fail( 'commentbox-error-page-nonexistent' ); |
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | | - if( !array_key_exists( $title->getNamespace(), $wgCommentboxNamespaces ) |
| 38 | + if ( !array_key_exists( $title->getNamespace(), $wgCommentboxNamespaces ) |
39 | 39 | || !$wgCommentboxNamespaces[ $title->getNamespace() ] ) { |
40 | 40 | $this->fail( 'commentbox-error-namespace', $title ); |
41 | 41 | return; |
42 | 42 | } |
43 | 43 | |
44 | | - if( $Comment == '' || $Comment == wfMsgNoTrans( 'commentbox-prefill' ) ) { |
| 44 | + if ( $Comment == '' || $Comment == wfMsgNoTrans( 'commentbox-prefill' ) ) { |
45 | 45 | $this->fail( 'commentbox-error-empty-comment', $title ); |
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | | - if( !$title->userCan( 'edit' ) ) { |
| 49 | + if ( !$title->userCan( 'edit' ) ) { |
50 | 50 | $this->displayRestrictionError(); |
51 | 51 | return; |
52 | 52 | } |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | // TODO: Integrate with SpamBlacklist etc. |
55 | 55 | // Currently, no http/https-links are allowed at all |
56 | 56 | $matches = array(); |
57 | | - if( preg_match( '@https?://[-.\w]+@', $Comment, $matches ) || |
| 57 | + if ( preg_match( '@https?://[-.\w]+@', $Comment, $matches ) || |
58 | 58 | preg_match( '@https?://[-.\w]+@', $Author, $matches ) ) { |
59 | 59 | $wgOut->setPageTitle( wfMsg( 'spamprotectiontitle' ) ); |
60 | 60 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
— | — | @@ -68,37 +68,37 @@ |
69 | 69 | $article = new Article( $title ); |
70 | 70 | $text = $article->getContent(); |
71 | 71 | $subject = ''; |
72 | | - if( !preg_match( wfMsgForContentNoTrans( 'commentbox-regex' ), $text ) ) |
73 | | - $subject = wfMsgForContent( 'commentbox-first-comment-heading' )."\n"; |
| 72 | + if ( !preg_match( wfMsgForContentNoTrans( 'commentbox-regex' ), $text ) ) |
| 73 | + $subject = wfMsgForContent( 'commentbox-first-comment-heading' ) . "\n"; |
74 | 74 | $sig = $wgUser->isLoggedIn() ? "-- ~~~~" : "-- $Author ~~~~~"; |
75 | 75 | // Append <br/> after each newline, except if the user started a new paragraph |
76 | 76 | $Comment = preg_replace( '/(?<!\n)\n(?!\n)/', "<br/>\n", $Comment ); |
77 | | - $text .= "\n\n".$subject.$Comment."\n<br/>".$sig; |
| 77 | + $text .= "\n\n" . $subject . $Comment . "\n<br/>" . $sig; |
78 | 78 | try { |
79 | | - $req = new FauxRequest(array( |
| 79 | + $req = new FauxRequest( array( |
80 | 80 | 'action' => 'edit', |
81 | 81 | 'title' => $title->getPrefixedText(), |
82 | 82 | 'text' => $text, |
83 | 83 | 'summary' => wfMsgForContent( 'commentbox-log' ), |
84 | 84 | 'token' => $wgUser->editToken(), |
85 | | - ), true); |
86 | | - $api = new ApiMain($req, true); |
| 85 | + ), true ); |
| 86 | + $api = new ApiMain( $req, true ); |
87 | 87 | $api->execute(); |
88 | | - wfDebug("Completed API-Save\n"); |
| 88 | + wfDebug( "Completed API-Save\n" ); |
89 | 89 | // we only reach this point if Api doesn't throw an exception |
90 | 90 | $data = $api->getResultData(); |
91 | | - if ($data['edit']['result'] == 'Failure') { |
| 91 | + if ( $data['edit']['result'] == 'Failure' ) { |
92 | 92 | $spamurl = $data['edit']['spamblacklist']; |
93 | | - if ($spamurl != '') |
94 | | - throw new Exception("Die Seite enthaelt die Spam-Url ``{$spamurl}''"); |
| 93 | + if ( $spamurl != '' ) |
| 94 | + throw new Exception( "Die Seite enthaelt die Spam-Url ``{$spamurl}''" ); |
95 | 95 | else |
96 | | - throw new Exception("Unbekannter Fehler"); |
| 96 | + throw new Exception( "Unbekannter Fehler" ); |
97 | 97 | } |
98 | | - } catch (Exception $e) { |
| 98 | + } catch ( Exception $e ) { |
99 | 99 | global $wgOut; |
100 | 100 | $wgOut->setPageTitle( wfMsg( 'commentbox-errorpage-title' ) ); |
101 | | - $wgOut->addHTML("<div class='errorbox'>". htmlspecialchars($e->getMessage()). "</div><br clear='both' />" ); |
102 | | - if( $title != NULL ) |
| 101 | + $wgOut->addHTML( "<div class='errorbox'>" . htmlspecialchars( $e->getMessage() ) . "</div><br clear='both' />" ); |
| 102 | + if ( $title != NULL ) |
103 | 103 | $wgOut->returnToMain( false, $title ); |
104 | 104 | return; |
105 | 105 | } |
— | — | @@ -110,8 +110,8 @@ |
111 | 111 | function fail( $str, $title = NULL ) { |
112 | 112 | global $wgOut; |
113 | 113 | $wgOut->setPageTitle( wfMsg( 'commentbox-errorpage-title' ) ); |
114 | | - $wgOut->addWikiText("<div class='errorbox'>". wfMsg( $str ). "</div><br clear='both' />" ); |
115 | | - if( $title != NULL ) |
| 114 | + $wgOut->addWikiText( "<div class='errorbox'>" . wfMsg( $str ) . "</div><br clear='both' />" ); |
| 115 | + if ( $title != NULL ) |
116 | 116 | $wgOut->returnToMain( false, $title ); |
117 | 117 | return; |
118 | 118 | } |
Property changes on: trunk/extensions/Commentbox/SpecialAddComment_body.php |
___________________________________________________________________ |
Name: svn:eol-style |
119 | 119 | + native |
Index: trunk/extensions/Commentbox/Commentbox.php |
— | — | @@ -9,13 +9,13 @@ |
10 | 10 | * @author Thomas Bleher <ThomasBleher@gmx.de> |
11 | 11 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
12 | 12 | */ |
13 | | -if (!defined('MEDIAWIKI')) die(); |
| 13 | +if ( !defined( 'MEDIAWIKI' ) ) die(); |
14 | 14 | |
15 | 15 | $wgExtensionCredits['other'][] = array( |
16 | 16 | 'name' => 'Commentbox', |
17 | 17 | 'path' => __FILE__, |
18 | 18 | 'author' => '[http://spiele.j-crew.de Thomas Bleher]', |
19 | | - 'version' => '0.1', |
| 19 | + 'version' => '0.2', |
20 | 20 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Commentbox', |
21 | 21 | 'description' => 'Adds a commentbox to certain pages', |
22 | 22 | 'descriptionmsg' => 'commentbox-desc', |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | $wgCommentboxRows = 5; |
30 | 30 | $wgCommentboxColumns = 80; |
31 | 31 | |
32 | | -$wgExtensionMessagesFiles['Commentbox'] = dirname(__FILE__) . '/Commentbox.i18n.php'; |
| 32 | +$wgExtensionMessagesFiles['Commentbox'] = dirname( __FILE__ ) . '/Commentbox.i18n.php'; |
33 | 33 | $wgSpecialPages['AddComment'] = 'SpecialAddComment'; |
34 | 34 | $wgAutoloadClasses['SpecialAddComment'] = dirname( __FILE__ ) . '/SpecialAddComment_body.php'; |
35 | 35 | $wgHooks['OutputPageBeforeHTML'][] = 'wfExtensionCommentbox_Add'; |
— | — | @@ -38,23 +38,23 @@ |
39 | 39 | $wgCommentboxNamespaces, $wgCommentboxRows, |
40 | 40 | $wgCommentboxColumns; |
41 | 41 | |
42 | | - if( !$wgTitle->exists() ) |
| 42 | + if ( !$wgTitle->exists() ) |
43 | 43 | return true; |
44 | 44 | |
45 | | - if( !$wgTitle->userCan('edit', true) ) |
| 45 | + if ( !$wgTitle->userCan( 'edit', true ) ) |
46 | 46 | return true; |
47 | | - if( !array_key_exists( $wgTitle->getNamespace(), $wgCommentboxNamespaces ) |
| 47 | + if ( !array_key_exists( $wgTitle->getNamespace(), $wgCommentboxNamespaces ) |
48 | 48 | || !$wgCommentboxNamespaces[ $wgTitle->getNamespace() ] ) |
49 | 49 | return true; |
50 | | - if( !( $action == 'view' || $action == 'purge' || $action == 'submit' ) ) |
| 50 | + if ( !( $action == 'view' || $action == 'purge' || $action == 'submit' ) ) |
51 | 51 | return true; |
52 | | - if( $wgRequest->getCheck( 'wpPreview' ) |
| 52 | + if ( $wgRequest->getCheck( 'wpPreview' ) |
53 | 53 | || $wgRequest->getCheck( 'wpLivePreview' ) |
54 | 54 | || $wgRequest->getCheck( 'wpDiff' ) ) |
55 | 55 | return true; |
56 | | - if( !is_null( $wgRequest->getVal( 'preview' ) ) ) |
| 56 | + if ( !is_null( $wgRequest->getVal( 'preview' ) ) ) |
57 | 57 | return true; |
58 | | - if( !is_null( $wgRequest->getVal( 'diff' ) ) ) |
| 58 | + if ( !is_null( $wgRequest->getVal( 'diff' ) ) ) |
59 | 59 | return true; |
60 | 60 | |
61 | 61 | $newaction = Title::newFromText( 'AddComment', NS_SPECIAL )->escapeFullURL(); |
Property changes on: trunk/extensions/Commentbox/Commentbox.php |
___________________________________________________________________ |
Name: svn:eol-style |
62 | 62 | + native |
Index: trunk/extensions/Translate/groups/mediawiki-defines.txt |
— | — | @@ -184,6 +184,9 @@ |
185 | 185 | descmsg = coll-desc |
186 | 186 | ignored = coll-template_blacklist_title, coll-license_url |
187 | 187 | |
| 188 | +Commentbox |
| 189 | +ignored = commentbox-prefill |
| 190 | + |
188 | 191 | Comment Pages |
189 | 192 | ignored = commenttab-editintro, commenttab-preload |
190 | 193 | |