Beispiel #1
0
 public static function coreDisconnectFromFB($user = null)
 {
     global $wgRequest, $wgUser, $wgAuth;
     if ($user == null) {
         $user = $wgUser;
     }
     $statusError = array('status' => "error", "msg" => wfMsg('fbconnect-unknown-error'));
     if (!$user instanceof User) {
         return $statusError;
     }
     if ($user->getId() == 0) {
         return $statusError;
     }
     $dbw = wfGetDB(DB_MASTER, array(), FBConnectDB::sharedDB());
     $dbw->begin();
     $rows = FBConnectDB::removeFacebookID($user);
     // Remind password attemp
     $params = new FauxRequest(array('wpName' => $user->getName()));
     $result = array();
     $loginForm = new LoginForm($params);
     if ($wgUser->getOption("fbFromExist")) {
         $res = $loginForm->mailPasswordInternal($user, true, 'fbconnect-passwordremindertitle-exist', 'fbconnect-passwordremindertext-exist');
     } else {
         $res = $loginForm->mailPasswordInternal($user, true, 'fbconnect-passwordremindertitle', 'fbconnect-passwordremindertext');
     }
     if (WikiError::isError($res)) {
         return $statusError;
     }
     return array('status' => "ok");
 }