Example #1
0
$for = mysql_real_escape_string($for_stripped);
if ($_SESSION['username'] == $to) {
    if ($fromMarklet) {
        $message = '<div class="LV_invalid">You cannot send love to yourself.</div>';
    } else {
        die("Love sent: self");
    }
}
$rc = sendlove_toanother($_SESSION['userid'], $_SESSION['username'], $_SESSION['nickname'], $isSuper, $to, $for, (int) $_POST["priv"] > 0);
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
    echo json_encode(array('response' => $rc));
    exit;
    // The following section is not executed due the preceeding speedup workaround. - GJ - Aug 12, 2011
    // return a json array containing updated Love counts for dynamic page update
    $front = new Frontend();
    $loveData = array('response' => $rc, 'data' => array('loveNotifications' => $front->getLoveNotification(), 'loveTotal' => $front->totalLove(), 'loveMost' => $front->mostLoved()));
    echo json_encode($loveData);
} else {
    if ($fromMarklet) {
        if ($message == '') {
            if ($rc == 'outside') {
                $message = '<div class="LV_invalid">This user is not registered.</div>';
            } else {
                $message = '<div class="LV_valid">Love sent successfully</div>';
            }
        }
        $front = Frontend::getInstance();
        include "view/tofor/love/m_sendlove.php";
    } else {
        echo "Love sent: " . $rc;
    }