Example #1
0
 /**
  * Check the user's security level on page load, and bounce accordingly
  * 
  * @deprecated
  */
 public function checksecurity()
 {
     global $secure, $smarty;
     if (User::getCurrent()->getStoredOnWikiName() == "##OAUTH##" && User::getCurrent()->getOAuthAccessToken() == null) {
         reattachOAuthAccount(User::getCurrent());
     }
     if (User::getCurrent()->isOAuthLinked()) {
         try {
             // test retrieval of the identity
             User::getCurrent()->getOAuthIdentity();
         } catch (TransactionException $ex) {
             User::getCurrent()->setOAuthAccessToken(null);
             User::getCurrent()->setOAuthAccessSecret(null);
             User::getCurrent()->save();
             reattachOAuthAccount(User::getCurrent());
         }
     } else {
         global $enforceOAuth;
         if ($enforceOAuth) {
             reattachOAuthAccount(User::getCurrent());
         }
     }
     if (User::getCurrent()->isNew()) {
         BootstrapSkin::displayAlertBox("I'm sorry, but, your account has not been approved by a site administrator yet. Please stand by.", "alert-error", "New account", true, false);
         BootstrapSkin::displayInternalFooter();
         die;
     } elseif (User::getCurrent()->isSuspended()) {
         $database = gGetDb();
         $suspendstatement = $database->prepare("SELECT log_cmt FROM acc_log WHERE log_action = 'Suspended' AND log_pend = :userid ORDER BY log_time DESC LIMIT 1;");
         $suspendstatement->bindValue(":userid", User::getCurrent()->getId());
         $suspendstatement->execute();
         $suspendreason = $suspendstatement->fetchColumn();
         $suspendstatement->closeCursor();
         $smarty->assign("suspendreason", $suspendreason);
         $smarty->display("login/suspended.tpl");
         BootstrapSkin::displayInternalFooter();
         die;
     } elseif (User::getCurrent()->isDeclined()) {
         $database = gGetDb();
         $suspendstatement = $database->prepare("SELECT log_cmt FROM acc_log WHERE log_action = 'Declined' AND log_pend = :userid ORDER BY log_time DESC LIMIT 1;");
         $suspendstatement->bindValue(":userid", User::getCurrent()->getId());
         $suspendstatement->execute();
         $suspendreason = $suspendstatement->fetchColumn();
         $suspendstatement->closeCursor();
         $smarty->assign("suspendreason", $suspendreason);
         $smarty->display("login/declined.tpl");
         BootstrapSkin::displayInternalFooter();
         die;
     } elseif (!User::getCurrent()->isCommunityUser() && (User::getCurrent()->isUser() || User::getCurrent()->isAdmin())) {
         $secure = 1;
     } else {
         //die("Not logged in!");
     }
 }
Example #2
0
        $suspendstatement->closeCursor();
        BootstrapSkin::displayInternalHeader();
        $smarty->assign("suspendreason", $suspendreason);
        $smarty->display("login/suspended.tpl");
        BootstrapSkin::displayInternalFooter();
        die;
    }
    if (!$user->isIdentified() && $forceIdentification == 1) {
        header("Location: {$baseurl}/acc.php?error=noid");
        die;
    }
    // At this point, we've tested that the user is OK, so we set the login cookies.
    $_SESSION['user'] = $user->getUsername();
    $_SESSION['userID'] = $user->getId();
    if ($user->getOAuthAccessToken() == null && $user->getStoredOnWikiName() == "##OAUTH##") {
        reattachOAuthAccount($user);
    }
    header("Location: {$baseurl}/acc.php");
} elseif ($action == "messagemgmt") {
    global $smarty;
    if (isset($_GET['view'])) {
        $message = InterfaceMessage::getById($_GET['view'], gGetDb());
        if ($message == false) {
            BootstrapSkin::displayAlertBox("Unable to find specified message", "alert-error", "Error", true, false);
            BootstrapSkin::displayInternalFooter();
            die;
        }
        $smarty->assign("message", $message);
        $smarty->assign("readonly", true);
        $smarty->display("message-management/editform.tpl");
        BootstrapSkin::displayInternalFooter();