summaryrefslogtreecommitdiff
path: root/includes/AjaxFunctions.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-09-14 13:18:58 +0200
committerPierre Schmitz <pierre@archlinux.de>2007-09-14 13:18:58 +0200
commit8f416baead93a48e5799e44b8bd2e2c4859f4e04 (patch)
treecd47ac55eb80a39e3225e8b4f3161b88ea16c2cf /includes/AjaxFunctions.php
parentd7d08bd1a17618c7d77a6b9b2989e9f7293d6ed6 (diff)
auf Version 1.11 aktualisiert; Login-Bug behoben
Diffstat (limited to 'includes/AjaxFunctions.php')
-rw-r--r--includes/AjaxFunctions.php34
1 files changed, 22 insertions, 12 deletions
diff --git a/includes/AjaxFunctions.php b/includes/AjaxFunctions.php
index 86f853db..4fb76dcc 100644
--- a/includes/AjaxFunctions.php
+++ b/includes/AjaxFunctions.php
@@ -136,22 +136,29 @@ function wfSajaxSearch( $term ) {
/**
* Called for AJAX watch/unwatch requests.
- * @param $pageID Integer ID of the page to be watched/unwatched
+ * @param $pagename Prefixed title string for page to watch/unwatch
* @param $watch String 'w' to watch, 'u' to unwatch
- * @return String '<w#>' or '<u#>' on successful watch or unwatch, respectively, or '<err#>' on error (invalid XML in case we want to add HTML sometime)
+ * @return String '<w#>' or '<u#>' on successful watch or unwatch,
+ * respectively, followed by an HTML message to display in the alert box; or
+ * '<err#>' on error
*/
-function wfAjaxWatch($pageID = "", $watch = "") {
- if(wfReadOnly())
- return '<err#>'; // redirect to action=(un)watch, which will display the database lock message
+function wfAjaxWatch($pagename = "", $watch = "") {
+ if(wfReadOnly()) {
+ // redirect to action=(un)watch, which will display the database lock
+ // message
+ return '<err#>';
+ }
- if(('w' !== $watch && 'u' !== $watch) || !is_numeric($pageID))
+ if('w' !== $watch && 'u' !== $watch) {
return '<err#>';
+ }
$watch = 'w' === $watch;
- $pageID = intval($pageID);
- $title = Title::newFromID($pageID);
- if(!$title)
+ $title = Title::newFromText($pagename);
+ if(!$title) {
+ // Invalid title
return '<err#>';
+ }
$article = new Article($title);
$watching = $title->userIsWatching();
@@ -170,7 +177,10 @@ function wfAjaxWatch($pageID = "", $watch = "") {
$dbw->commit();
}
}
-
- return $watch ? '<w#>' : '<u#>';
+ if( $watch ) {
+ return '<w#>'.wfMsgExt( 'addedwatchtext', array( 'parse' ), $title->getPrefixedText() );
+ } else {
+ return '<u#>'.wfMsgExt( 'removedwatchtext', array( 'parse' ), $title->getPrefixedText() );
+ }
}
-?>
+