/** * Get token to watch (or unwatch) a page for a user * * @param Title $title Title object of page to watch * @param User $user User for whom the action is going to be performed * @param string $action Optionally override the action to 'unwatch' * @return string Token * @since 1.18 */ public static function getWatchToken(Title $title, User $user, $action = 'watch') { if ($action != 'unwatch') { $action = 'watch'; } // Match ApiWatch and ResourceLoaderUserTokensModule return $user->getEditToken($action); }
/** * Get token to watch (or unwatch) a page for a user * * @param Title $title Title object of page to watch * @param User $user User for whom the action is going to be performed * @param string $action Optionally override the action to 'unwatch' * @return string Token * @since 1.18 */ public static function getWatchToken(Title $title, User $user, $action = 'watch') { if ($action != 'unwatch') { $action = 'watch'; } $salt = array($action, $title->getPrefixedDBkey()); // This token stronger salted and not compatible with ApiWatch // It's title/action specific because index.php is GET and API is POST return $user->getEditToken($salt); }
/** * Return the link to the original image */ private function getHTMLLinkToOriginalManuscriptImage(User $user) { $paths = $this->paths; $edit_token = $user->getEditToken(); if (!$paths->originalImagesFullPathIsConstructableFromScan()) { return "<b>" . $this->getMessage('newmanuscripthooks-errorimage') . "</b>"; } $web_link = $paths->getWebLinkOriginalImagesPath(); $html = ""; $html .= "<td>"; $html .= "<form class='manuscriptpage-form' action='" . $web_link . "' method='post' target='_blank'>"; $html .= "<input class='button-transparent' type='submit' name='editlink' value='" . $this->getMessage('newmanuscripthooks-originalimage') . "'>"; $html .= "<input type='hidden' name='wpEditToken' value='{$edit_token}'>"; $html .= "</form>"; $html .= "</td>"; return $html; }