예제 #1
0
/**
* Send notification mails to all users @ingroup pages
*
* This page is normally requested by Cron jobs. Read more at http://www.streber-pm.org/2211
*/
function triggerSendNotifications()
{
    require_once confGet('DIR_STREBER') . 'std/mail.inc.php';
    log_message('triggerSendNotifications()');
    list($num_notifications_sent, $num_warnings) = Notifier::sendNotifications();
    echo sprintf("Notifications sent: %s\nWarnings: %s\n", $num_notifications_sent, $num_warnings);
    if ($num_warnings) {
        echo "# Please check errors.log.php for details\n";
    }
}
예제 #2
0
/**
* Logout the current user and remove cookies @ingroup pages
*/
function logout()
{
    global $PH;
    global $auth;
    ### kill cookie ###
    $auth->removeUserCookie();
    $PH->cur_page_md5 = NULL;
    /**
     * keep date of last logout
     * NOTE: the cur_user-object might be no longer up to date (think about person submit).
     * so we get the latest version from the database to update the last_login-field
     */
    if ($cur_user = Person::getById($auth->cur_user->id)) {
        $cur_user->cookie_string = $auth->cur_user->calcCookieString();
        $cur_user->last_logout = getGMTString();
        $cur_user->update();
    }
    ### go to login-page ####
    $PH->messages[] = "Logged out";
    $PH->show('loginForm');
    #header("location:index.php");
    if ($auth->cur_user) {
        $nickname = $auth->cur_user->nickname;
    } else {
        $nickname = '_nobody_';
    }
    log_message("'" . $nickname . "' logged out from:" . getServerVar("REMOTE_ADDR", true), LOG_MESSAGE_LOGOUT);
    require_once confGet('DIR_STREBER') . 'std/mail.inc.php';
    Notifier::sendNotifications();
}