set() static public method

static public set ( $email = null, $name = null, $url = null, $cookiename = 'gb-author' )
Example #1
0
}
# adjust date with clients local timezone
$date = new GBDateTime(null, 0);
if ($input['client-timezone-offset'] !== false && ($tzoffset = intval($input['client-timezone-offset'])) !== false && ($tzoffset < 43200 || $tzoffset > -43200)) {
    $date->offset = $tzoffset;
}
# author-url -> author-uri if set
if ($input['author-url'] !== false) {
    $input['author-uri'] = gb_cfilter::apply('sanitize-url', $input['author-url']);
}
# if we are logged in, use the canonical email
if (gb::$authorized) {
    $input['author-email'] = gb::$authorized->email;
}
# set author cookie
gb_author_cookie::set($input['author-email'], $input['author-name'], $input['author-uri']);
# create comment object
$comment = new GBComment(array('date' => $date->__toString(), 'ipAddress' => $_SERVER['REMOTE_ADDR'], 'email' => $input['author-email'], 'uri' => $input['author-uri'], 'name' => $input['author-name'], 'body' => $input['reply-message'], 'approved' => false, 'post' => $post));
# always approve admin comments
if (gb::$authorized) {
    $comment->approved = true;
}
# apply filters
$comment = gb_cfilter::apply('pre-comment', $comment);
# aquire referrer
$referrer = gb::referrer_url();
# append to comment db
if ($comment) {
    try {
        $cdb = $post->getCommentsDB();
        $added = $cdb->append($comment, $input['reply-to'] ? $input['reply-to'] : null);
Example #2
0
<?php

require '../_base.php';
gb::verify();
$authed = gb::authenticate(false);
if ($authed) {
    gb::log('client authorized: ' . $authed);
    gb_author_cookie::set($authed->email, $authed->name, gb::$site_url);
    gb::event('client-authorized', $authed);
    $url = isset($_REQUEST['referrer']) && $_REQUEST['referrer'] ? $_REQUEST['referrer'] : gb_admin::$url;
    header('HTTP/1.1 303 See Other');
    header('Location: ' . $url);
    exit('<html><body>See Other <a href="' . $url . '"></a></body></html>');
}
if (isset($_POST['chap-username'])) {
    if ($authed === CHAP::BAD_USER) {
        gb::$errors[] = 'No such user';
    } elseif ($authed === CHAP::BAD_RESPONSE) {
        gb::$errors[] = 'Bad password';
    } else {
        gb::$errors[] = 'Unknown error';
    }
}
$auth = gb::authenticator();
include '../_header.php';
?>
<script type="text/javascript" src="<?php 
echo gb_admin::$url;
?>
res/sha1-min.js"></script>
<script type="text/javascript">