r98772 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98771‎ | r98772 | r98773 >
Date:15:26, 3 October 2011
Author:fptc
Status:deferred (Comments)
Tags:
Comment:
Fixing i18n topics of r98627
Modified paths:
  • /trunk/extensions/FreqPatternTagCloud/FreqPatternTagCloud.body.php (modified) (history)
  • /trunk/extensions/FreqPatternTagCloud/FreqPatternTagCloud.i18n.php (modified) (history)
  • /trunk/extensions/FreqPatternTagCloud/FreqPatternTagCloudMaintenance.php (modified) (history)
  • /trunk/extensions/FreqPatternTagCloud/includes/FrequentPattern.php (modified) (history)
  • /trunk/extensions/FreqPatternTagCloud/includes/Proposal.php (modified) (history)
  • /trunk/extensions/FreqPatternTagCloud/includes/Search.php (modified) (history)
  • /trunk/extensions/FreqPatternTagCloud/includes/TagCloud.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FreqPatternTagCloud/FreqPatternTagCloud.body.php
@@ -56,7 +56,6 @@
5757 global $wgFreqPatternTagCloudMaxFontSize, $wgFreqPatternTagCloudMinFontSize, $wgRequest, $wgOut, $searchAttribut, $wgScriptPath;
5858
5959 include_once("includes/FrequentPattern.php");
60 -
6160 /*
6261 FrequentPattern::deleteAllRules();
6362 FrequentPattern::computeAllRules();
@@ -103,8 +102,8 @@
104103 }
105104
106105 // Category
107 - if (strpos(wfMsg("categoryname"), $currentAttributeValue) !== false) {
108 - $attributes[] = sprintf('"%s"', wfMsg("categoryname"));
 106+ if (strpos(wfMsg("fptc-categoryname"), $currentAttributeValue) !== false) {
 107+ $attributes[] = sprintf('"%s"', wfMsg("fptc-categoryname"));
109108 }
110109
111110 $res->free();
@@ -133,7 +132,7 @@
134133 AND vals.smw_title LIKE '%".mysql_real_escape_string($currentSearchValue)."%'
135134 ORDER BY vals.smw_title
136135 LIMIT 20) UNION (
137 - SELECT smw_title AS val, '".wfMsg("categoryname")."' AS att
 136+ SELECT smw_title AS val, '".wfMsg("fptc-categoryname")."' AS att
138137 FROM ".$dbr->tableName("smw_ids")."
139138 WHERE smw_title LIKE '%".mysql_real_escape_string($currentSearchValue)."%'
140139 AND smw_namespace = 14
@@ -150,7 +149,7 @@
151150 continue;
152151 } else {
153152 foreach ($conclusions as $conclusion) {
154 - $suggestions[] = sprintf('{ "label": "%s", "category": "'.addcslashes(wfMsg("searchSuggestionValue"), '"').'" }', addcslashes($conclusion, '"'), addcslashes($row['val'], '"'));
 153+ $suggestions[] = sprintf('{ "label": "%s", "category": "'.addcslashes(wfMsg("fptc-search-suggestion-value"), '"').'" }', addcslashes($conclusion, '"'), addcslashes($row['val'], '"'));
155154 }
156155 }
157156 }
@@ -196,11 +195,11 @@
197196 // Add input field
198197 if ($wgUser->isAllowed("protect")) {
199198 $refreshData = sprintf('<div id="fptc_refresh">%s</div>',
200 - $wgOut->parseInline(sprintf('[[:%s:%s|%s]]', self::SPECIALPAGE_PREFIX, self::MAINTENANCE_SPECIALPAGE, wfMsg("refreshFrequentPatterns"))));
 199+ $wgOut->parseInline(sprintf('[[:%s:%s|%s]]', self::SPECIALPAGE_PREFIX, self::MAINTENANCE_SPECIALPAGE, wfMsg("fptc-refresh-frequent-patterns"))));
201200 } else {
202201 $refreshData = "";
203202 }
204 - $wgOut->addHTML($refreshData.wfMsg("formAttributeName").': <input type="text" name="fptc_attributeName" id="fptc_attributeName" value="'.$defaultAttribute.'"><input type="submit" value="'.wfMsg("formSubmitButton").'" onClick="fptc_relocate();">
 203+ $wgOut->addHTML($refreshData.wfMsg("fptc-form-attribute-name").': <input type="text" name="fptc_attributeName" id="fptc_attributeName" value="'.$defaultAttribute.'"><input type="submit" value="'.wfMsg("fptc-form-submit-button").'" onClick="fptc_relocate();">
205204 ');
206205
207206 $wgOut->addHTML("<br><br>");
@@ -221,10 +220,10 @@
222221 // Context menu
223222 $wgOut->addHTML('<ul id="fptc_contextMenu" class="contextMenu">
224223 <li class="browse">
225 - <a href="#browse">'.wfMsg("contextMenu_Browse").'</a>
 224+ <a href="#browse">'.wfMsg("fptc-context-menu-browse").'</a>
226225 </li>
227226 <li class="suggestions separator">
228 - '.wfMsg("contextMenu_SimilarTags").':
 227+ '.wfMsg("fptc-context-menu-similar-tags").':
229228 </li>
230229 </ul>');
231230
@@ -237,7 +236,7 @@
238237 } catch (InvalidAttributeException $e) {
239238 if ($attribute) {
240239 // Attribute not found -> show error
241 - $wgOut->addHTML('<span style="color:red; font-weight:bold;">'.wfMsg("invalidAttribute").'</span>');
 240+ $wgOut->addHTML('<span style="color:red; font-weight:bold;">'.wfMsg("fptc-invalid-attribute").'</span>');
242241 }
243242 }
244243 }
@@ -254,7 +253,7 @@
255254
256255 $wgOut->addHTML(sprintf('<div class="fptc_tag" style="font-size:%dpx;">%s</div>',
257256 $this->fontSizeMin + ($this->fontSizeMax - $this->fontSizeMin) * $tag->getRate(),
258 - $attribute == wfMsg("categoryname")
 257+ $attribute == wfMsg("fptc-categoryname")
259258 ? $wgOut->parseInline(sprintf("[[:%s:%s|%s]]", self::CATEGORY_PAGE, $tag->getValue(), $tag->getValue()))
260259 : $wgOut->parseInline(sprintf("[[:%s:%s/%s/%s|%s]]", self::SPECIALPAGE_PREFIX, self::ATTRIBUTE_VALUE_INDEX_SPECIALPAGE, $attribute, $tag->getValue(), $tag->getValue()))));
261260 }
@@ -279,7 +278,8 @@
280279 try {
281280 // Only if suggestions found
282281 if ($proposal->getProposal()) {
283 - $wgOut->addHTML(wfMsg("suggestion"));
 282+ $wgOut->addHTML(wfMsg("fptc-suggestion"));
 283+ $wgOut->addHTML(" ");
284284 }
285285 $w=1;
286286 foreach ($proposal->getProposal() as $possibleAttribute) {
@@ -292,7 +292,7 @@
293293 }
294294
295295 } catch (InvalidAttributeException $e) {
296 - $wgOut->addHTML(wfMsg("noSuggestion"));
 296+ $wgOut->addHTML(wfMsg("fptc-no-suggestion"));
297297 }
298298 if ($proposal->getProposal()) {
299299 $wgOut->addHTML("<br><br>");
Index: trunk/extensions/FreqPatternTagCloud/FreqPatternTagCloud.i18n.php
@@ -12,39 +12,58 @@
1313 $messages = array();
1414
1515 $messages['en'] = array(
16 - "categoryname" => "Category",
17 - "contextMenu_Browse" => "Browse Pages With This Value",
18 - "contextMenu_SimilarTags" => "Similar Tags",
19 - "formAttributeName" => "Property",
20 - "formSubmitButton" => "Submit",
2116 "freqpatterntagcloud" => "Frequent Pattern Tag Cloud",
2217 "freqpatterntagcloudmaintenance" => "Frequent Pattern Tag Cloud Maintenance",
23 - "invalidAttribute" => "The entered property is invalid.",
24 - "insufficientRightsForMaintenance" => "You have to log in as system administrator to view this page.",
25 - "refreshFrequentPatterns" => "Refresh Data",
26 - "refreshedFrequentPatterns" => "Frequent pattern rules refreshed.",
27 - "searchAttributeName" => "Search property",
28 - "searchButton" => "Search",
29 - "searchSuggestionValue" => "Similar to \"%s\":",
30 - "suggestion" => "Do you mean: ",
31 - "noSuggestion" => "No suggestions found"
 18+ "fptc-categoryname" => "Category",
 19+ "fptc-context-menu-browse" => "Browse pages with this value",
 20+ "fptc-context-menu-similar-tags" => "Similar tags",
 21+ "fptc-form-attribute-name" => "Property",
 22+ "fptc-form-submit-button" => "Submit",
 23+ "fptc-invalid-attribute" => "The entered property is invalid.",
 24+ "fptc-insufficient-rights-for-maintenance" => "You have to log in as system administrator to view this page.",
 25+ "fptc-refresh-frequent-patterns" => "Refresh data",
 26+ "fptc-refreshed-frequent-patterns" => "Frequent pattern rules refreshed.",
 27+ "fptc-search-attribute-name" => "Search property",
 28+ "fptc-search-button" => "Search",
 29+ "fptc-search-suggestion-value" => "Similar to \"%s\":",
 30+ "fptc-suggestion" => "Do you mean:",
 31+ "fptc-no-suggestion" => "No suggestions found"
3232 );
3333
3434 $messages['de'] = array(
35 - "categoryname" => "Kategorie",
36 - "contextMenu_Browse" => "Durchsuche Seiten mit diesem Wert",
37 - "contextMenu_SimilarTags" => "&Auml;hnliche Tags",
38 - "formAttributeName" => "Attribut",
39 - "formSubmitButton" => "Eingabe",
4035 "freqpatterntagcloud" => "Frequent Pattern Tag Cloud",
4136 "freqpatterntagcloudmaintenance" => "Frequent Pattern Tag Cloud Maintenance",
42 - "invalidAttribute" => "Das eingegebene Attribut ist ung&uuml;ltig.",
43 - "insufficientRightsForMaintenance" => "Um diese Seite sehen zu k&ouml;nnen m&uuml;ssen Sie als Systemadministrator angemeldet sein.",
44 - "refreshFrequentPatterns" => "Aktualisierung der Daten",
45 - "refreshedFrequentPatterns" => "Regeln f&uuml;r frequent pattern neu generiert.",
46 - "searchAttributeName" => "Suche nach Attribut",
47 - "searchButton" => "Suche",
48 - "searchSuggestionValue" => "&Auml;hnlich zu \"%s\":",
49 - "suggestion" => "Meinten Sie: ",
50 - "noSuggestion" => "Keine Vorschl&auml;ge gefunden"
 37+ "fptc-categoryname" => "Kategorie",
 38+ "fptc-context-menu-browse" => "Durchsuche Seiten mit diesem Wert",
 39+ "fptc-context-menu-similar-tags" => "�hnliche Tags",
 40+ "fptc-form-attribute-name" => "Attribut",
 41+ "fptc-form-submit-button" => "Eingabe",
 42+ "fptc-invalid-attribute" => "Das eingegebene Attribut ist ung&uuml;ltig.",
 43+ "fptc-insufficient-rights-for-maintenance" => "Um diese Seite sehen zu k&ouml;nnen m&uuml;ssen Sie als Systemadministrator angemeldet sein.",
 44+ "fptc-refresh-frequent-patterns" => "Aktualisierung der Daten",
 45+ "fptc-refreshed-frequent-patterns" => "Regeln f&uuml;r frequent pattern neu generiert.",
 46+ "fptc-search-attribute-name" => "Suche nach Attribut",
 47+ "fptc-search-button" => "Suche",
 48+ "fptc-search-suggestion-value" => "&Auml;hnlich zu \"%s\":",
 49+ "fptc-suggestion" => "Meinten Sie:",
 50+ "fptc-no-suggestion" => "Keine Vorschl&auml;ge gefunden"
 51+ );
 52+
 53+$messages['qqq'] = array(
 54+ "freqpatterntagcloud" => "This message is the page title of the frequent-pattern-tag-cloud-specialpage and must not be translated.",
 55+ "freqpatterntagcloudmaintenance" => "This message is the page title of the frequent-pattern-tag-cloud-maintenace-specialpage and must not be translated.",
 56+ "fptc-categoryname" => "This message is the name of the category-attribut which is used in SemantikMediaWiki (e.g. category:example)",
 57+ "fptc-context-menu-browse" => "This message is used as a title in context menu of the tag cloud tags",
 58+ "fptc-context-menu-similar-tags" => "This message is used as a title in context menu of the tag cloud tags",
 59+ "fptc-form-attribute-name" => "This message describes the input box on the frequent-pattern-tag-cloud-specialpage",
 60+ "fptc-form-submit-button" => "This message is the text of the button which submits the value in the input box on the frequent-pattern-tag-cloud-specialpage",
 61+ "fptc-invalid-attribute" => "This message appears if the value in the input box on the frequent-pattern-tag-cloud-specialpage is invalid",
 62+ "fptc-insufficient-rights-for-maintenance" => "This message appears when calling the frequent-pattern-tag-cloud-maintenace-specialpage and the user is not a administrator.",
 63+ "fptc-refresh-frequent-patterns" => "This message is the text of the button to refresh the frequent patterns on the frequent-pattern-tag-cloud-maintenace-specialpage",
 64+ "fptc-refreshed-frequent-patterns" => "This message appears after successful update of the frequent patterns.",
 65+ "fptc-search-attribute-name" => "This message describes the search input box.",
 66+ "fptc-search-button" => "This message is the text of the button search",
 67+ "fptc-search-suggestion-value" => "This mesage is the title of the search suggestions (parameter %s = suggestion, do not translate)",
 68+ "fptc-suggestion" => "This message appears after submitting an invalid value in the input box on the frequent-pattern-tag-cloud-specialpage",
 69+ "fptc-no-suggestion" => "This message appears if no suggestions can be found."
5170 );
\ No newline at end of file
Index: trunk/extensions/FreqPatternTagCloud/includes/Proposal.php
@@ -54,8 +54,8 @@
5555 }
5656
5757 // Category
58 - if (strpos(wfMsg("categoryname"), $attribute) !== false) {
59 - $attributes[] = sprintf("%s", wfMsg("categoryname"));
 58+ if (strpos(wfMsg("fptc-categoryname"), $attribute) !== false) {
 59+ $attributes[] = sprintf("%s", wfMsg("fptc-categoryname"));
6060 }
6161
6262 $res->free();
@@ -88,8 +88,8 @@
8989 }
9090
9191 // Category
92 - if (strpos(wfMsg("categoryname"), $attribute) === 0) {
93 - $attributes_1[] = sprintf("%s", wfMsg("categoryname"));
 92+ if (strpos(wfMsg("fptc-categoryname"), $attribute) === 0) {
 93+ $attributes_1[] = sprintf("%s", wfMsg("fptc-categoryname"));
9494 }
9595
9696 // Search with regexp for related attributes with the same ending
@@ -106,8 +106,8 @@
107107 }
108108
109109 // Category
110 - if (strpos(wfMsg("categoryname"), $attribute) === strlen(wfMsg("categoryname")) - strlen($attribute)) {
111 - $attributes_2[] = sprintf("%s", wfMsg("categoryname"));
 110+ if (strpos(wfMsg("fptc-categoryname"), $attribute) === strlen(wfMsg("fptc-categoryname")) - strlen($attribute)) {
 111+ $attributes_2[] = sprintf("%s", wfMsg("fptc-categoryname"));
112112 }
113113
114114 // Merge both arrays for one return
@@ -151,8 +151,8 @@
152152 }
153153
154154 // Category
155 - if (strpos(wfMsg("categoryname"), $beginAttribut) === 0 || strpos(wfMsg("categoryname"), $endAttribut) === strlen(wfMsg("categoryname")) - strlen($endAttribut) || strpos(wfMsg("categoryname"), $attribute) !== false) {
156 - $attributes[] = sprintf("%s", wfMsg("categoryname"));
 155+ if (strpos(wfMsg("fptc-categoryname"), $beginAttribut) === 0 || strpos(wfMsg("fptc-categoryname"), $endAttribut) === strlen(wfMsg("fptc-categoryname")) - strlen($endAttribut) || strpos(wfMsg("fptc-categoryname"), $attribute) !== false) {
 156+ $attributes[] = sprintf("%s", wfMsg("fptc-categoryname"));
157157 }
158158
159159 $res->free();
Index: trunk/extensions/FreqPatternTagCloud/includes/TagCloud.php
@@ -53,7 +53,7 @@
5454 */
5555 private function checkAttribute($attribute) {
5656 // Category
57 - if (wfMsg("categoryname") == $attribute) {
 57+ if (wfMsg("fptc-categoryname") == $attribute) {
5858 return true;
5959 }
6060
Index: trunk/extensions/FreqPatternTagCloud/includes/Search.php
@@ -40,7 +40,7 @@
4141 */
4242 private function attributeAvailable($attribute) {
4343 // Category
44 - if (wfMsg("categoryname") == $attribute) {
 44+ if (wfMsg("fptc-categoryname") == $attribute) {
4545 return true;
4646 }
4747
Index: trunk/extensions/FreqPatternTagCloud/includes/FrequentPattern.php
@@ -153,7 +153,7 @@
154154 $dbr =& wfGetDB( DB_SLAVE );
155155
156156 // Get id of attribute
157 - if (wfMsg("categoryname") == $attribute) {
 157+ if (wfMsg("fptc-categoryname") == $attribute) {
158158 $res = $dbr->query("SELECT 0");
159159 } else {
160160 $res = $dbr->query("SELECT smw_id
@@ -167,7 +167,7 @@
168168 $res->free();
169169
170170 // Get id of assumption
171 - if (wfMsg("categoryname") == $attribute) {
 171+ if (wfMsg("fptc-categoryname") == $attribute) {
172172 $res = $dbr->query("SELECT smw_id
173173 FROM ".$dbr->tableName("smw_ids")."
174174 WHERE smw_title = '".mysql_real_escape_string($assumption)."'
Index: trunk/extensions/FreqPatternTagCloud/FreqPatternTagCloudMaintenance.php
@@ -35,7 +35,7 @@
3636
3737 if (!$wgUser->isAllowed("protect")) {
3838 // No admin
39 - $wgOut->addWikiText(wfMsg("insufficientRightsForMaintenance"));
 39+ $wgOut->addWikiText(wfMsg("fptc-insufficient-rights-for-maintenance"));
4040 } else {
4141 // Check if this call is the first
4242 try {
@@ -52,7 +52,7 @@
5353 FrequentPattern::computeAllRules();
5454
5555 // Notify user
56 - $wgOut->addWikiText(wfMsg("refreshedFrequentPatterns"));
 56+ $wgOut->addWikiText(wfMsg("fptc-refreshed-frequent-patterns"));
5757 }
5858 }
5959

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r98627Fixing topics of rev. 96192fptc21:18, 1 October 2011

Comments

#Comment by Siebrand (talk | contribs)   16:51, 3 October 2011
SELECT smw_title AS val, '".wfMsg("fptc-categoryname")."' AS att

This is an SQL injection vulnerability for any MediaWiki user (sysop by default) that is allowed to change MediaWiki:fptc-categoryname.

#Comment by FrequentPatternTagCloud (talk | contribs)   12:03, 20 October 2011

Fixed sql injection issue

Status & tagging log