Example #1
0
function zhaohuRsvp()
{
    $guid = (int) get_input("guid");
    $user_guid = (int) get_input("user", elgg_get_logged_in_user_guid());
    $rel = get_input("type");
    $k = get_input("k");
    $zhaohu = get_entity($guid);
    if (!empty($k)) {
        $rightK = md5($zhaohu->time_created . get_site_secret() . $user_guid);
        DoRsvp($guid, $user_guid, $rel);
        // 		if( $rightK == $k)
        // 			DoRsvp($guid, $user_guid, $rel);
        // 		else
        // 			register_error(elgg_echo("zhaohu:rsvp:error") . elgg_echo("zhaohu:sorry"));
        // 		elgg_log("ZHError ,zhaohuRsvp, the provided key $K is invalid, zhaohu_id $guid, user_id "
        // 			.elgg_get_logged_in_user_guid(), "ERROR");
    } else {
        register_error(elgg_echo("zhaohu:rsvp:error") . elgg_echo("zhaohu:sorry"));
        elgg_log("ZHError ,zhaohuRsvp, missing the key, zhaohu_id {$guid}, user_id " . elgg_get_logged_in_user_guid(), "ERROR");
    }
    forward($zhaohu->getURL());
}
Example #2
0
    $payment_status = $_POST['payment_status'];
    //$payment_amount = $_POST['mc_gross'];
    //$payment_currency = $_POST['mc_currency'];
    //$txn_id = $_POST['txn_id'];
    $receiver_email = $_POST['receiver_email'];
    //$payer_email = $_POST['payer_email'];
    $custom = $_POST['custom'];
    if (DEBUG == true) {
        error_log(date('[Y-m-d H:i e] ') . "Verified IPN: {$req} " . PHP_EOL, 3, LOG_FILE);
    }
    if ($payment_status == 'Completed' && $receiver_email == "*****@*****.**" && $custom) {
        $customArr = explode('-', $custom, 2);
        if (count($customArr) == 2) {
            $user_guid = $customArr[0];
            $event_guid = $customArr[1];
            DoRsvp($event_guid, $user_guid, ZHAOHU_MANAGER_RELATION_ATTENDING);
            error_log(date('[Y-m-d H:i e]') . "User {$user_guid} joined event {$event_guid} via paypal" . PHP_EOL, 3, LOG_FILE);
        } else {
            error_log(date('[Y-m-d H:i e]') . "ZHError custom {$custom} is invalid format" . PHP_EOL, 3, LOG_FILE);
        }
    }
} else {
    if (strcmp($res, "INVALID") == 0) {
        // log for manual investigation
        // Add business logic here which deals with invalid IPN messages
        if (DEBUG == true) {
            error_log(date('[Y-m-d H:i e] ') . "Invalid IPN: {$req}" . PHP_EOL, 3, LOG_FILE);
            echo "The response from IPN was: <b>" . $res . "</b>";
        }
    }
}
Example #3
0
<?php

$guid = (int) get_input("guid");
$user_guid = get_input("user", elgg_get_logged_in_user_guid());
$rel = get_input("type");
$user = get_entity($user_guid);
$zhaohu = get_entity($guid);
$group = $zhaohu->getContainerEntity();
if (empty($group) || !$group instanceof ElggGroup) {
    register_error(elgg_echo("zhaohu:rsvp:error") . elgg_echo("zhaohu:sorry"));
    elgg_log("ZHError ,zhaohu:rsvp, invalid group, zhaohu_id {$guid} , user_id {$user_guid}, logged_user_id " . elgg_get_logged_in_user_guid(), "ERROR");
    forward(REFERER);
}
if ($zhaohu->isPast()) {
    register_error(elgg_echo("zhaohu:rsvp:past"));
    forward(REFERER);
}
if (!$group->isMember($user)) {
    //register_error(elgg_echo("zhaohu:rsvp:notmember"));
    if (groups_join_group($group, $user)) {
        updateNearbyGroupCache($user, $group, 0);
        add_entity_relationship($user->guid, 'notifyemail', $group->guid);
        $subject = elgg_echo('zhgroups:join:subject', array($user->name, $group->name));
        $body = '<div style="color:#333;font-size:16px;">' . elgg_echo('zhgroups:join:body', array($group->getOwnerEntity()->name, $user->getURL(), $user->name, $group->getURL(), $group->name, $user->getURL(), $user->name)) . '</div>';
        zhgroups_send_email_to_user($group, $group->getOwnerEntity(), $subject, $body, true, true);
        //system_message(elgg_echo("groups:joined"));
    }
}
DoRsvp($guid, $user_guid, $rel);
forward(REFERER);