Esempio n. 1
0
 protected function fetch_rollback_token($title, $user = NULL)
 {
     $query = new API_Module_Query_With_Modules($this->exchanger, $this->info, $this->hooks, $this->settings->get("setparams"));
     // how the hell to get it web-wise?
     $query->set_titles($title);
     $query->set_property_param("revisions", 'token', "rollback");
     $query->xfer();
     if (isset($query->data['query']['pages'])) {
         $page = reset($query->data['query']['pages']);
         if (isset($page['rollbacktoken'])) {
             return $page['rollbacktoken'];
         }
     }
     $this->log("Could not fetch rollback token - rollback may be impossible", LL_WARNING);
     return NULL;
 }
Esempio n. 2
0
 protected function fetch_userrights_token($user)
 {
     if ($this->info->wiki_version_number() < 12400) {
         $query = new API_Module_Query_With_Modules($this->exchanger, $this->info, $this->hooks, $this->settings->get("setparams"));
         $query->set_list_param("users", 'user', $user);
         $query->set_list_param("users", 'token', "userrights");
         $query->xfer();
         if (isset($query->data['query']['users'])) {
             $user = reset($query->data['query']['users']);
             if (isset($user['userrightstoken'])) {
                 return $user['userrightstoken'];
             }
         }
     } else {
         if ($this->fetch_standard_tokens()) {
             if (isset($this->tokens['userrights'])) {
                 return $this->tokens['userrights'];
             }
         }
     }
     $this->log("Could not fetch userrights token - changing user rights may be impossible", LL_WARNING);
     return false;
 }