Exemplo n.º 1
0
/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $_page;
    //define ajax mode
    $bAjxMod = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ? true : false;
    $member['ID'] = getLoggedId();
    if (!isset($_POST['ID'])) {
        return _t_err("_No member specified");
    }
    $ID = getID($_POST['ID'], 0);
    if (!$ID) {
        return _t_err("_PROFILE_NOT_AVAILABLE");
    }
    $profile = getProfileInfo($ID);
    // Check if member can get email ADD CART CHECK HERE
    $check_res = checkAction($member['ID'], ACTION_ID_GET_EMAIL);
    if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) {
        if ($bAjxMod) {
            showAjaxModeResult($check_res[CHECK_ACTION_MESSAGE], $ID);
        }
        return '<div class="soundPop">' . $check_res[CHECK_ACTION_MESSAGE] . '</div>';
    }
    // Check if profile found
    if (!$profile) {
        $ret = _t_err("_PROFILE_NOT_AVAILABLE");
        return $ret;
    }
    $action_result = "";
    $get_result = MemberFreeEmail($member['ID'], $profile);
    switch ($get_result) {
        case 7:
            $action_result = _t_err("_PROFILE_NOT_AVAILABLE");
            break;
        case 13:
            $action_result = _t_err("_YOUR PROFILE_IS_NOT_ACTIVE");
            break;
        case 20:
            $action_result = _t_err("_FREEMAIL_NOT_ALLOWED");
            break;
        case 21:
            $action_result = _t_err("_FREEMAIL_ALREADY_SENT", $ID);
            break;
        case 25:
            $action_result = _t_err("_FREEMAIL_BLOCK", $ID);
            break;
        case 44:
            $action_result = _t_err("_FREEMAIL_NOT_KISSED", $ID);
            break;
        case 45:
            $action_result = _t_err("_FREEMAIL_ERROR");
            break;
        default:
            $action_result = _t("_FREEMAIL_SENT", $profile['NickName']);
            break;
    }
    if ($get_result) {
        $_page['header_text'] = _t("_Contact information not sent");
    } else {
        $_page['header_text'] = _t("_Contact information sent");
    }
    $ret = '<div class="soundPop">' . $action_result . '</div>' . "\n";
    if ($bAjxMod) {
        showAjaxModeResult($action_result, $ID);
    }
    return $ret;
}
/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $_page;
    $member['ID'] = (int) $_COOKIE['memberID'];
    if (!$_REQUEST['ID']) {
        return _t_err("_No member specified");
    }
    $ID = getID($_REQUEST['ID'], 0);
    if (!$ID) {
        return _t_err("_PROFILE_NOT_AVAILABLE");
    }
    $profile = getProfileInfo($ID);
    //db_arr( "SELECT * FROM `Profiles` WHERE `ID` = '$ID' LIMIT 1;" );
    // Check if member can get email ADD CART CHECK HERE
    $check_res = checkAction($member['ID'], ACTION_ID_GET_EMAIL);
    if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) {
        $ret = '<div class="soundPop">' . $check_res[CHECK_ACTION_MESSAGE] . '</div>';
        return $ret;
    }
    // Check if profile found
    if (!$profile) {
        $ret = _t_err("_PROFILE_NOT_AVAILABLE");
        return $ret;
    }
    $action_result = "";
    $get_result = MemberFreeEmail($member['ID'], $profile);
    switch ($get_result) {
        case 7:
            $action_result = _t_err("_PROFILE_NOT_AVAILABLE");
            break;
        case 13:
            $action_result = _t_err("_YOUR PROFILE_IS_NOT_ACTIVE");
            break;
        case 20:
            $action_result = _t_err("_FREEMAIL_NOT_ALLOWED");
            break;
        case 21:
            $action_result = _t_err("_FREEMAIL_ALREADY_SENT", $ID);
            break;
        case 25:
            $action_result = _t_err("_FREEMAIL_BLOCK", $ID);
            break;
        case 44:
            $action_result = _t_err("_FREEMAIL_NOT_KISSED", $ID);
            break;
        case 45:
            $action_result = _t_err("_FREEMAIL_ERROR");
            break;
        default:
            $action_result = _t("_FREEMAIL_SENT", $profile['NickName']);
            break;
    }
    if ($get_result) {
        $_page['header_text'] = _t("_Contact information not sent");
    } else {
        $_page['header_text'] = _t("_Contact information sent");
    }
    /*
    	if ( $get_result != 0 && $get_result != 25 )
    		$send_form = send_form();
    	else
    		$send_form = "";
    */
    $ret = '<div class="soundPop">' . $action_result . '</div>' . "\n";
    return $ret;
}