Index: trunk/extensions/TodoTasks/SpecialTaskList_body.php |
— | — | @@ -32,44 +32,45 @@ |
33 | 33 | return true; |
34 | 34 | } |
35 | 35 | |
36 | | -function getUserIDFromUserText($user) { |
37 | | - $dbr = wfGetDB( DB_SLAVE ); |
38 | | - $userid = 0; |
39 | | - |
40 | | - if (preg_match('/^\s*(.*?)\s*$/', $user, $matches)) |
41 | | - $user = $matches[1]; |
42 | | - |
43 | | - $u = User::newFromName($user); |
44 | | - if ($u) { |
45 | | - $userid = $u->idForName(); // valid userName |
46 | | - } |
47 | | - if (!$userid) { // if not a valid userName, try as a userRealName |
48 | | - $userid = $dbr->selectField( 'user', 'user_id', array( 'user_real_name' => $user ), 'renderTodo' ); |
49 | | - if (!$userid) { // if not valid userRealName, try case insensitive userRealName |
50 | | - $sql = "SELECT user_id FROM ". $dbr->tableName('user') ." WHERE UPPER(user_real_name) LIKE '%" . strtoupper($user) |
51 | | -. "%'"; |
52 | | - $res = $dbr->query( $sql, __METHOD__ ); |
53 | | - if ($dbr->numRows($res)) { |
54 | | - $row = $dbr->fetchRow($res); |
55 | | - $userid = $row[0]; |
56 | | - } |
57 | | - $dbr->freeResult($res); |
58 | | - if (!$userid) { // if not case insensitive userRealName, try case insensitive lastname |
59 | | - list ($first, $last) = preg_split('/\s+/', $user); |
60 | | - if ($last != '') { |
61 | | - $sql = "SELECT user_id FROM ". $dbr->tableName('user') ." WHERE UPPER(user_real_name) LIKE '%" . |
62 | | -strtoupper($last) . "%'"; |
63 | | - $res = $dbr->query( $sql, __METHOD__ ); |
64 | | - if ($dbr->numRows($res)) { |
65 | | - $row = $dbr->fetchRow($res); |
66 | | - $userid = $row[0]; |
| 36 | +# only create the following function if it was not already installed with the User Contact Links extension |
| 37 | +if (!function_exists('getUserIDFromUserText')) { |
| 38 | + function getUserIDFromUserText($user) { |
| 39 | + $dbr = wfGetDB( DB_SLAVE ); |
| 40 | + $userid = 0; |
| 41 | + |
| 42 | + if (preg_match('/^\s*(.*?)\s*$/', $user, $matches)) |
| 43 | + $user = $matches[1]; |
| 44 | + |
| 45 | + $u = User::newFromName($user); |
| 46 | + if ($u) { |
| 47 | + $userid = $u->idForName(); // valid userName |
| 48 | + } |
| 49 | + if (!$userid) { // if not a valid userName, try as a userRealName |
| 50 | + $userid = $dbr->selectField( 'user', 'user_id', array( 'user_real_name' => $user ), 'renderTodo' ); |
| 51 | + if (!$userid) { // if not valid userRealName, try case insensitive userRealName |
| 52 | + $sql = "SELECT user_id FROM ". $dbr->tableName('user') ." WHERE UPPER(user_real_name) LIKE '%" . strtoupper($user) . "%'"; |
| 53 | + $res = $dbr->query( $sql, __METHOD__ ); |
| 54 | + if ($dbr->numRows($res)) { |
| 55 | + $row = $dbr->fetchRow($res); |
| 56 | + $userid = $row[0]; |
| 57 | + } |
| 58 | + $dbr->freeResult($res); |
| 59 | + if (!$userid) { // if not case insensitive userRealName, try case insensitive lastname |
| 60 | + list ($first, $last) = preg_split('/\s+/', $user); |
| 61 | + if ($last != '') { |
| 62 | + $sql = "SELECT user_id FROM ". $dbr->tableName('user') ." WHERE UPPER(user_real_name) LIKE '%" . strtoupper($last) . "%'"; |
| 63 | + $res = $dbr->query( $sql, __METHOD__ ); |
| 64 | + if ($dbr->numRows($res)) { |
| 65 | + $row = $dbr->fetchRow($res); |
| 66 | + $userid = $row[0]; |
| 67 | + } |
| 68 | + $dbr->freeResult($res); |
67 | 69 | } |
68 | | - $dbr->freeResult($res); |
69 | 70 | } |
70 | 71 | } |
71 | 72 | } |
| 73 | + return $userid; |
72 | 74 | } |
73 | | - return $userid; |
74 | 75 | } |
75 | 76 | |
76 | 77 | function getValidProjects() { |
Index: trunk/extensions/TodoTasks/SpecialTaskList.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | |
20 | 20 | if (!defined('MEDIAWIKI')) die(); |
21 | 21 | |
22 | | -$wgTodoTasksExtensionVersion = '0.9.0'; |
| 22 | +$wgTodoTasksExtensionVersion = '0.9.1'; |
23 | 23 | |
24 | 24 | $wgExtensionCredits['parserhook'][] = array( |
25 | 25 | 'version' => $wgTodoTasksExtensionVersion, |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | 'description' => 'Adds a special page for reviewing tasks assignments' |
39 | 39 | ); |
40 | 40 | |
41 | | -$wgUseProjects = false; |
| 41 | +$wgUseProjects = true; |
42 | 42 | |
43 | 43 | $wgAutoloadClasses['TaskList'] = dirname(__FILE__) . '/SpecialTaskList_body.php'; |
44 | 44 | $wgSpecialPages['TaskList'] = 'TaskList'; |