function fromemail_sendllove_toanother($fromEmail, $toArg, $forArg, $priv) { $res = mysql_query("select * from " . USERS . " where username='******'"); $user_row = $res ? mysql_fetch_assoc($res) : null; if (empty($user_row)) { return; } $userid = $user_row['id']; $username = $user_row['username']; $nickname = $user_row['nickname']; $features = intval($user_row['features']) & FEATURE_USER_MASK; $isSuper = isEnabled(FEATURE_SUPER_ADMIN); return sendlove_toanother($userid, $username, $nickname, $isSuper, $toArg, $forArg, $priv); }
echo json_encode(array('error' => 1, 'messages' => 'invalid request')); die; } } // params are: $userid, $username, $isSuper, $nickname, $to, $for, $priv $isSuper = isSuperAdmin(); $for_stripped = smart_strip_tags($_POST['for1']); $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>';