Esempio n. 1
0
                Safe::header('Status: 400 Bad Request', TRUE, 400);
                die(i18n::s('Request is invalid.'));
            }
            break;
        case 'hello':
            if (!isset($_REQUEST['message'])) {
                Safe::header('Status: 400 Bad Request', TRUE, 400);
                die(i18n::s('Request is invalid.'));
            }
            break;
        default:
            Safe::header('Status: 400 Bad Request', TRUE, 400);
            die(i18n::s('Request is invalid.'));
    }
    // save in the database
    Notifications::post($fields);
    // thread update will trigger screen repaint through separate pending call of this script
    die('OK');
    // look for some notification
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
    // change session data to extend life of related file
    if (!isset($_SESSION['heartbit'])) {
        $_SESSION['heartbit'] = 0;
    }
    $_SESSION['heartbit']++;
    // refresh the watchdog
    $_SESSION['watchdog'] = time();
    // update surfer presence
    $query = "UPDATE " . SQL::table_name('users') . " SET click_date='" . gmstrftime('%Y-%m-%d %H:%M:%S') . "'" . " WHERE (id = " . SQL::escape(Surfer::get_id()) . ")";
    SQL::query($query, FALSE, $context['users_connection']);
    // assign article for more time