From 8f416baead93a48e5799e44b8bd2e2c4859f4e04 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 14 Sep 2007 13:18:58 +0200 Subject: auf Version 1.11 aktualisiert; Login-Bug behoben --- includes/AjaxFunctions.php | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'includes/AjaxFunctions.php') 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 '' or '' on successful watch or unwatch, respectively, or '' on error (invalid XML in case we want to add HTML sometime) + * @return String '' or '' on successful watch or unwatch, + * respectively, followed by an HTML message to display in the alert box; or + * '' on error */ -function wfAjaxWatch($pageID = "", $watch = "") { - if(wfReadOnly()) - return ''; // 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 ''; + } - if(('w' !== $watch && 'u' !== $watch) || !is_numeric($pageID)) + if('w' !== $watch && 'u' !== $watch) { return ''; + } $watch = 'w' === $watch; - $pageID = intval($pageID); - $title = Title::newFromID($pageID); - if(!$title) + $title = Title::newFromText($pagename); + if(!$title) { + // Invalid title return ''; + } $article = new Article($title); $watching = $title->userIsWatching(); @@ -170,7 +177,10 @@ function wfAjaxWatch($pageID = "", $watch = "") { $dbw->commit(); } } - - return $watch ? '' : ''; + if( $watch ) { + return ''.wfMsgExt( 'addedwatchtext', array( 'parse' ), $title->getPrefixedText() ); + } else { + return ''.wfMsgExt( 'removedwatchtext', array( 'parse' ), $title->getPrefixedText() ); + } } -?> + -- cgit v1.2.2