Index: trunk/extensions/ContributionReporting/ContributionReporting.php |
— | — | @@ -2,51 +2,62 @@ |
3 | 3 | |
4 | 4 | # Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly. |
5 | 5 | if (!defined('MEDIAWIKI')) { |
6 | | - echo <<<EOT |
| 6 | + echo <<<EOT |
7 | 7 | To install my extension, put the following line in LocalSettings.php: |
8 | 8 | require_once( "\$IP/extensions/ContributionReporting/ContributionReporting.php" ); |
9 | 9 | EOT; |
10 | | - exit( 1 ); |
| 10 | + exit( 1 ); |
11 | 11 | } |
12 | | - |
| 12 | + |
| 13 | +// Override these with appropriate DB settings for the CiviCRM database... |
| 14 | +$wgContributionReportingDBserver = $wgDBserver; |
| 15 | +$wgContributionReportingDBuser = $wgDBuser; |
| 16 | +$wgContributionReportingDBpassword = $wgDBpassword; |
| 17 | +$wgContributionReportingDBname = $wgDBname; |
| 18 | + |
13 | 19 | $dir = dirname(__FILE__) . '/'; |
14 | | - |
15 | | -$wgHooks['LanguageGetSpecialPageAliases'][] = 'contributionReportingLocalizedPageName'; # Add any aliases for the special page. |
16 | 20 | |
| 21 | +// Add any aliases for the special page. |
| 22 | +$wgHooks['LanguageGetSpecialPageAliases'][] = 'contributionReportingLocalizedPageName'; |
| 23 | + |
17 | 24 | $wgExtensionMessagesFiles['ContributionHistory'] = $dir . 'ContributionHistory.i18n.php'; |
18 | | -$wgAutoloadClasses['ContributionHistory'] = $dir . 'ContributionHistory_body.php'; # Tell MediaWiki to load the extension body. |
19 | | -$wgSpecialPages['ContributionHistory'] = 'ContributionHistory'; # Let MediaWiki know about your new special page. |
| 25 | +$wgAutoloadClasses['ContributionHistory'] = $dir . 'ContributionHistory_body.php'; |
| 26 | +$wgSpecialPages['ContributionHistory'] = 'ContributionHistory'; |
20 | 27 | |
21 | 28 | $wgExtensionMessagesFiles['ContributionTotal'] = $dir . 'ContributionTotal.i18n.php'; |
22 | | -$wgAutoloadClasses['ContributionTotal'] = $dir . 'ContributionTotal_body.php'; # Tell MediaWiki to load the extension body. |
23 | | -$wgSpecialPages['ContributionTotal'] = 'ContributionTotal'; # Let MediaWiki know about your new special page. |
| 29 | +$wgAutoloadClasses['ContributionTotal'] = $dir . 'ContributionTotal_body.php'; |
| 30 | +$wgSpecialPages['ContributionTotal'] = 'ContributionTotal'; |
24 | 31 | |
25 | 32 | function contributionReportingLocalizedPageName(&$specialPageArray, $code) { |
26 | | - # The localized title of the special page is among the messages of the extension: |
27 | | - wfLoadExtensionMessages('ContributionHistory'); |
28 | | - $text = wfMsg('contributionhistory'); |
29 | | - |
30 | | - # Convert from title in text form to DBKey and put it into the alias array: |
31 | | - $title = Title::newFromText($text); |
32 | | - $specialPageArray['ContributionHistory'][] = $title->getDBKey(); |
33 | | - |
34 | | - wfLoadExtensionMessages('ContributionTotal'); |
35 | | - $text = wfMsg('contributiontotal'); |
36 | | - $title = Title::newFromText($text); |
37 | | - $specialPageArray['ContributionTotal'][] = $title->getDBKey(); |
38 | | - |
39 | | - return true; |
| 33 | + # The localized title of the special page is among the messages of the extension: |
| 34 | + wfLoadExtensionMessages('ContributionHistory'); |
| 35 | + $text = wfMsg('contributionhistory'); |
| 36 | + |
| 37 | + # Convert from title in text form to DBKey and put it into the alias array: |
| 38 | + $title = Title::newFromText($text); |
| 39 | + $specialPageArray['ContributionHistory'][] = $title->getDBKey(); |
| 40 | + |
| 41 | + wfLoadExtensionMessages('ContributionTotal'); |
| 42 | + $text = wfMsg('contributiontotal'); |
| 43 | + $title = Title::newFromText($text); |
| 44 | + $specialPageArray['ContributionTotal'][] = $title->getDBKey(); |
| 45 | + |
| 46 | + return true; |
40 | 47 | } |
41 | 48 | |
42 | 49 | function contributionReportingConnection() { |
43 | | - global $wgContributionReportingDBserver, $wgContributionReportingDBname; |
44 | | - global $wgContributionReportingDBuser, $wgContributionReportingDBpassword; |
45 | | - |
46 | | - static $db; |
47 | | - |
48 | | - if (!$db) { |
49 | | - $db = new DatabaseMysql($wgContributionReportingDBserver, $wgContributionReportingDBuser, $wgContributionReportingDBpassword, $wgContributionReportingDBname); |
50 | | - } |
51 | | - |
52 | | - return $db; |
| 50 | + global $wgContributionReportingDBserver, $wgContributionReportingDBname; |
| 51 | + global $wgContributionReportingDBuser, $wgContributionReportingDBpassword; |
| 52 | + |
| 53 | + static $db; |
| 54 | + |
| 55 | + if (!$db) { |
| 56 | + $db = new DatabaseMysql( |
| 57 | + $wgContributionReportingDBserver, |
| 58 | + $wgContributionReportingDBuser, |
| 59 | + $wgContributionReportingDBpassword, |
| 60 | + $wgContributionReportingDBname ); |
| 61 | + } |
| 62 | + |
| 63 | + return $db; |
53 | 64 | } |