Index: trunk/extensions/Interact/SpecialInteract.php |
— | — | @@ -1,67 +0,0 @@ |
2 | | -<?php |
3 | | -if (!defined('MEDIAWIKI')) die(); |
4 | | - |
5 | | -/** Register the extension */ |
6 | | -$wgExtensionCredits['specialpage'][] = array( |
7 | | - 'path' => __FILE__, |
8 | | - 'name' => 'Interact', |
9 | | - 'description' => 'Add Special:Interact that let you know who you talked with.', |
10 | | - 'author' => 'Ashar Voultoiz', |
11 | | -); |
12 | | - |
13 | | -/** This is a querypage */ |
14 | | -global $IP; |
15 | | -require_once($IP.'/includes/QueryPage.php'); |
16 | | - |
17 | | - |
18 | | -/** The class itself, it inherits from QueryPage, less stuff to handle. */ |
19 | | -class InteractPage extends QueryPage { |
20 | | - function getName() { |
21 | | - return 'InteractPage'; |
22 | | - } |
23 | | - |
24 | | - function isSyndicated() { return false; } |
25 | | - |
26 | | - function sortDescending() { return false; } |
27 | | - |
28 | | - function getSQL() { |
29 | | - $db = wfGetDB( DB_SLAVE ); |
30 | | - $page = $db->tableName( 'page' ); |
31 | | - $revision = $db->tableName( 'revision' ); |
32 | | - |
33 | | -$username = 'Hashar'; |
34 | | -return "SELECT |
35 | | -'Interact' as type, |
36 | | -".NS_USER." as namespace, |
37 | | -rev_user_text as title, |
38 | | -page_title as value |
39 | | - |
40 | | -FROM $page, $revision |
41 | | -WHERE page_namespace = ".NS_USER_TALK." |
42 | | - AND page_title = '$username' |
43 | | - AND rev_page = page_id |
44 | | -"; |
45 | | - } |
46 | | - |
47 | | - |
48 | | - function formatResult( $skin, $result) { |
49 | | - $title = Title::makeTitle( $result->namespace, $result->title ); |
50 | | - $link = $skin->makeKnownLinkObj( $title ); |
51 | | - return "$link"; |
52 | | - } |
53 | | -} |
54 | | - |
55 | | -/** Entry point */ |
56 | | -function wfSpecialInteract() { |
57 | | - list($limit, $offset) = wfCheckLimits(); |
58 | | - $interactpage = new InteractPage(); |
59 | | - $interactpage->doQuery( $offset, $limit ); |
60 | | -} |
61 | | - |
62 | | -/** Register the special page as a querypage */ |
63 | | -global $wgQueryPages; |
64 | | -$wgQueryPages[] = array('InteractPage', 'Interact'); |
65 | | - |
66 | | -require_once($IP.'/includes/SpecialPage.php'); |
67 | | -SpecialPage::addPage( new SpecialPage('Interact') ); |
68 | | - |
Index: trunk/extensions/Interact/Interact.php |
— | — | @@ -0,0 +1,67 @@ |
| 2 | +<?php |
| 3 | +if (!defined('MEDIAWIKI')) die(); |
| 4 | + |
| 5 | +/** Register the extension */ |
| 6 | +$wgExtensionCredits['specialpage'][] = array( |
| 7 | + 'path' => __FILE__, |
| 8 | + 'name' => 'Interact', |
| 9 | + 'description' => 'Add Special:Interact that let you know who you talked with.', |
| 10 | + 'author' => 'Ashar Voultoiz', |
| 11 | +); |
| 12 | + |
| 13 | +/** This is a querypage */ |
| 14 | +global $IP; |
| 15 | +require_once($IP.'/includes/QueryPage.php'); |
| 16 | + |
| 17 | + |
| 18 | +/** The class itself, it inherits from QueryPage, less stuff to handle. */ |
| 19 | +class InteractPage extends QueryPage { |
| 20 | + function getName() { |
| 21 | + return 'InteractPage'; |
| 22 | + } |
| 23 | + |
| 24 | + function isSyndicated() { return false; } |
| 25 | + |
| 26 | + function sortDescending() { return false; } |
| 27 | + |
| 28 | + function getSQL() { |
| 29 | + $db = wfGetDB( DB_SLAVE ); |
| 30 | + $page = $db->tableName( 'page' ); |
| 31 | + $revision = $db->tableName( 'revision' ); |
| 32 | + |
| 33 | +$username = 'Hashar'; |
| 34 | +return "SELECT |
| 35 | +'Interact' as type, |
| 36 | +".NS_USER." as namespace, |
| 37 | +rev_user_text as title, |
| 38 | +page_title as value |
| 39 | + |
| 40 | +FROM $page, $revision |
| 41 | +WHERE page_namespace = ".NS_USER_TALK." |
| 42 | + AND page_title = '$username' |
| 43 | + AND rev_page = page_id |
| 44 | +"; |
| 45 | + } |
| 46 | + |
| 47 | + |
| 48 | + function formatResult( $skin, $result) { |
| 49 | + $title = Title::makeTitle( $result->namespace, $result->title ); |
| 50 | + $link = $skin->makeKnownLinkObj( $title ); |
| 51 | + return "$link"; |
| 52 | + } |
| 53 | +} |
| 54 | + |
| 55 | +/** Entry point */ |
| 56 | +function wfSpecialInteract() { |
| 57 | + list($limit, $offset) = wfCheckLimits(); |
| 58 | + $interactpage = new InteractPage(); |
| 59 | + $interactpage->doQuery( $offset, $limit ); |
| 60 | +} |
| 61 | + |
| 62 | +/** Register the special page as a querypage */ |
| 63 | +global $wgQueryPages; |
| 64 | +$wgQueryPages[] = array('InteractPage', 'Interact'); |
| 65 | + |
| 66 | +require_once($IP.'/includes/SpecialPage.php'); |
| 67 | +SpecialPage::addPage( new SpecialPage('Interact') ); |
| 68 | + |
Property changes on: trunk/extensions/Interact/Interact.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 69 | + native |
Name: svn:keywords |
2 | 70 | + Author Date Id Revision |