Exemple #1
0
 /**
  * If the token is invalid, then all tokens for the given username will be invalidated.
  */
 function validate($uid, $token, $redirect = false)
 {
     // Select the right token
     $rset = $this->db->select(null, 'sitebar_token', array('uid' => $uid, '^1' => 'AND', 'token' => $token, '^2' => 'AND expires>=' . time()));
     $tokenRec = $this->db->fetchRecord($rset);
     if ($tokenRec) {
         $user = $this->um->getUser($uid);
         switch ($tokenRec['type']) {
             case 'verify':
                 // Delete all existing tokens for this user now
                 $this->invalidateTokens($uid);
                 $this->db->update('sitebar_user', array('verified' => 1), array('uid' => $user['uid']));
                 if ($this->um->getParam('config', 'users_must_verify_email')) {
                     $paraName = 'usermanager::signup_info_verified';
                     $paraAtt = array($user['username'], SB_Page::absBaseUrl());
                     if ($this->um->getParam('config', 'users_must_be_approved') && !$user['approved']) {
                         $paraName = 'usermanager::signup_approval_verified';
                         $paraAtt[] = $this->um->getApproveUserUrl($user['username']);
                         $paraAtt[] = $this->um->getRejectUserUrl($user['username']);
                         $paraAtt[] = $this->um->getPendingUsersUrl();
                     }
                     $this->um->mailToAdmins('SiteBar: New SiteBar User Verified E-mail', $paraName, $paraAtt);
                 }
                 if ($redirect) {
                     // No & - it does not go to HTML, it is HTTP redirect
                     SB_redirect('command.php?command=Email+Verified&do=yes&uid=' . $uid);
                 }
                 break;
             case 'reset':
                 if ($redirect) {
                     // No & - it does not go to HTML, it is HTTP redirect
                     SB_redirect('command.php?command=New+Password&uid=' . $uid . '&token=' . $token);
                 }
                 break;
         }
         return true;
     }
     if ($redirect) {
         // No & - it does not go to HTML, it is HTTP redirect
         SB_redirect('command.php?command=Invalid+Token&do=yes');
     }
     return false;
 }
Exemple #2
0
$metaClose = false;
$metaTag = '<meta name="viewport" content="width=320, user-scalable=no">' . "\n";
if ($cw->close && $isIIS && in_array($cw->command, $cw->um->inPlaceCommands())) {
    $metaClose = true;
    $metaTag .= '<meta http-equiv="refresh" content="0;url=index.php' . $cw->getParams() . "\">\n";
}
// On command success when auto close is required and we do not use IIS with
// in place commands.
if ($cw->close && !$cw->fields && !$metaClose) {
    // When in place just reload
    if ($cw->inPlace()) {
        $ref = $cw->getReferer();
        if (strlen($ref)) {
            header('Location: ' . $ref);
        }
        SB_redirect('index.php' . $cw->getParams(false));
    } else {
        $cw->onLoad = 'window.close()';
    }
}
/**
 * I do not need instance, I just need to call static functions.
 * As of PHP 4.3.1 it will generate strange warning in case
 * bookmarkmanager issued an error() on import(). I cannot see
 * any relevance because SB_Page does not inherit from SB_ErrorHandler.
 * But it is indeed related to SB_ErrorHandler (when removing & from
 * declaration of getErrors() it works, but errors cannot be
 * reported then. Too curious for reporting and PHP 5 adds
 * static members what should solve the problem in future.
 */
$page = new SB_Page();