Ejemplo n.º 1
0
/**
* page code function
*/
function PageCompPageMainCode()
{
    global $site;
    $ret = '';
    $en_inbox_notify = getParam("enable_inbox_notify");
    $en_dest_choice = getParam("enable_msg_dest_choice");
    $free_mode = getParam("free_mode");
    $member['ID'] = (int) $_COOKIE['memberID'];
    $member['Password'] = $_COOKIE['memberPassword'];
    $recipientID = getID($_REQUEST['ID'], 0);
    $recipient = getProfileInfo($recipientID);
    $contact_allowed = contact_allowed($member['ID'], $recipientID);
    // Check if credits could be used for message sending
    $could_use_credits = false;
    // Check if member can send messages
    $check_res = checkAction($member['ID'], ACTION_ID_SEND_MESSAGE);
    if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED && !$could_use_credits && !$contact_allowed) {
        $ret = '
			<table width="100%" cellpadding="4" cellspacing="4" border="0">
				<tr>
					<td align="center">' . $check_res[CHECK_ACTION_MESSAGE] . '</td>
				</tr>
			</table>';
        return $ret;
    }
    // Set if credits should be used anyway
    $must_use_credits = $could_use_credits && $check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED;
    //ob_start();
    $ret = '';
    if ($_POST['action'] == "send" && strlen($_POST['text'])) {
        $action_result = "";
        // Check if recipient found
        if (!$recipient) {
            $ret = "\r\n\t\t\t\t<table width=\"100%\" cellpadding=\"4\" cellspacing=\"4\" align=\"center\">\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td align=center>" . _t("_COMPOSE_REJECT_MEMBER_NOT_FOUND") . "</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\n";
            return $ret;
        }
        // Perform sending
        $send_result = MemberSendMessage($member, $recipient, $must_use_credits);
        switch ($send_result) {
            case 1:
                $action_result .= _t_err("_FAILED_TO_SEND_MESSAGE");
                $hide_form = '0';
                break;
            case 3:
                $action_result .= _t_err("_You have to wait for PERIOD minutes before you can write another message!", 1);
                $hide_form = '1';
                break;
            case 5:
                $action_result .= _t_err("_FAILED_TO_SEND_MESSAGE_BLOCK");
                $hide_form = '0';
                break;
            case 10:
                $action_result .= _t_err("_FAILED_TO_SEND_MESSAGE_NOT_ACTIVE");
                $hide_form = '0';
                break;
            case 21:
                $action_result .= _t_err("_FAILED_TO_SEND_MESSAGE_NO_CREDITS");
                $hide_form = '0';
                break;
            default:
                $action_result .= _t_action("_MESSAGE_SENT");
                $hide_form = '1';
                break;
        }
    }
    $ret .= '<div class="com_box"">';
    if (strlen($action_result)) {
        $ret .= $action_result;
    }
    if ($recipient && $hide_form != '1') {
        $ret .= '<div class="clear_both"></div>';
        $ret .= ProfileDetails($recipient['ID']);
        $ret .= '<div class="clear_both"></div>';
    }
    if ('1' != $hide_form) {
        $sSubject = isset($_REQUEST['subject']) ? 'Re: ' . process_db_input($_REQUEST['subject']) : '';
        ob_start();
        ?>
		<script type="text/javascript">
			<!--
			function changeDest(control)
			{
				if ( control.value == 'lovemail' )
				{
					z = document.getElementById("id0004");
					z.disabled = false;
				}
				else
				{
					xxx = document.getElementById("id0004");
					xxx.disabled = true;
				}
			}
			
			function checkForm()
			{
				var el;
				var hasErr = false;
				var fild = "";
				el = document.getElementById("inpSubj");
				if( el.value.length < 3 )
				{
					el.style.backgroundColor = "pink";
					el.style.border = "1px solid silver";
					hasErr = true;
					fild += " <?php 
        echo _t('_Subject');
        ?>
";
				}
				else
					el.style.backgroundColor = "#fff";
				
				if (hasErr)
				{
					alert( "<?php 
        echo _t('_please_fill_next_fields_first');
        ?>
!" + fild )
					return false;
				}
				else
				{
					return true;
				}
				return false;
			}
			//-->
		</script>
		
		<form name="compose_form" method="post"
		  action="<?php 
        echo $_SERVER['PHP_SELF'] . ($recipient ? "?ID={$recipient['ID']}" : "");
        ?>
" onsubmit="return checkForm();">
			<table class="composeTable">
				<tr>
		<?php 
        if (!$recipient) {
            ?>
					<td class="form_label"><?php 
            echo _t("_SEND_MSG_TO");
            ?>
</td>
					<td class="form_value">
						<input class="inpMessageTo" type="text" name="ID" />
					</td>
				</tr>
				<tr>
			<?php 
        }
        ?>
					<td class="form_label"><?php 
        echo _t('_Subject');
        ?>
:</td>
					<td class="form_value">
						<input class="inpSubj" id="inpSubj" name="mes_subject" type="text" value="<?php 
        echo $sSubject;
        ?>
" />
					</td>
				</tr>
				<tr>
					<td class="form_label"><?php 
        echo _t("_Message text");
        ?>
:</td>
					<td class="form_value">
						<textarea class="blogText" id="blogText" name="text"></textarea>
					</td>
				</tr>
		<?php 
        if ($_POST['notify'] == 'on') {
            $notify_sel = "checked";
        } else {
            $notify_sel = "";
        }
        switch ($_POST['sendto']) {
            case 'email':
                $email_sel = ' checked="checked" ';
                $lovemail_sel = "";
                $both_sel = "";
                break;
            case 'lovemail':
                $email_sel = "";
                $lovemail_sel = ' checked="checked"';
                $both_sel = "";
                break;
            default:
                $email_sel = "";
                $lovemail_sel = "";
                $both_sel = ' checked="checked"';
                break;
        }
        if ('on' == $en_dest_choice) {
            $javascript = $en_inbox_notify ? "" : "onClick=\"javascript: changeDest(this);\"";
            $notify_dis = "";
            if (!$lovemail_sel && $en_dest_choice) {
                $notify_sel = "";
                $notify_dis = ' disabled="disabled"';
            }
            ?>
				<tr>
					<td>&nbsp;</td>
					<td nowrap="nowrap">
						<input type="radio" id="id0001" name="sendto" value="email"  <?php 
            echo $javascript . $email_sel;
            ?>
 />
						<label for="id0001"><?php 
            echo _t("_Send to e-mail");
            ?>
</label>
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td>
						<input type="radio" id="id0002" name="sendto" value="lovemail" <?php 
            echo $javascript . $lovemail_sel;
            ?>
 />
						<label for="id0002"><?php 
            echo _t("_Send to communicator");
            ?>
</label>
						
						<input type="checkbox" id="id0004" name="notify" <?php 
            echo $notify_sel . $notify_dis;
            ?>
 />
						<label for="id0004"><?php 
            echo _t("_Notify by e-mail");
            ?>
</label>
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td nowrap="nowrap" colspan="3" align="left" style="padding-left:5px;">
						<input type="radio" id="id0003" name="sendto" value="both" <?php 
            echo $javascript . $both_sel;
            ?>
 />
						<label for=id0003> <?php 
            echo _t("_both2");
            ?>
</label>
					</td>
				</tr>
			<?php 
        } else {
            ?>
				<input type="hidden" name="sendto" value="lovemail" />
			<?php 
        }
        ?>
				<tr>
					<td colspan="2" class="form_colspan">
						<input class="button" type="submit" value=" <?php 
        echo _t("_Send");
        ?>
" />
					</td>
				</tr>
			</table>
			<input type="hidden" name="action" value="send" />
		</form>
		
		<?php 
        $ret .= ob_get_clean();
    } else {
        $ret .= '<div style="margin:15px 0px; text-align:center;">' . _t('_to_compose_new_message', $recipient['NickName'], $recipient['ID'], $site['url']) . '</div>';
    }
    $ret .= '</div>';
    return $ret;
}
Ejemplo n.º 2
0
$profileID = getID($_REQUEST['ID']);
if ($logged['member']) {
    $memberID = (int) $_COOKIE['memberID'];
} else {
    $memberID = 0;
}
if (!$profileID) {
    $_page['header'] = "{$site['title']} " . _t("_Member Profile");
    $_page['header_text'] = _t("_View profile");
    $_page['name_index'] = 0;
    $_page_cont[0]['page_main_code'] = MsgBox(_t("_Profile NA"));
    PageCode();
    exit;
}
// Check if member can view profile
$contact_allowed = contact_allowed($memberID, $profileID);
$check_res = checkAction($memberID, ACTION_ID_VIEW_PROFILES, true, $profileID);
if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED && !$logged['admin'] && !$logged['moderator'] && $memberID != $profileID && !$contact_allowed) {
    $_page['header'] = "{$site['title']} " . _t("_Member Profile");
    $_page['header_text'] = "{$site['title']} " . _t("_Member Profile");
    $_page['name_index'] = 0;
    $_page_cont[0]['page_main_code'] = '<center>' . $check_res[CHECK_ACTION_MESSAGE] . '</center><br />';
    PageCode();
    exit;
}
$oProfile = new BxTemplProfileView($profileID);
$_page['extra_js'] = $oTemplConfig->sTinyMceEditorMiniJS . $oProfile->oVotingView->getExtraJs() . $oProfile->oCmtsView->getExtraJs() . '<script type="text/javascript">urlIconLoading = "' . getTemplateIcon('loading.gif') . '";</script>';
$_page['extra_css'] = $oProfile->genProfileCSS($profileID) . $oProfile->oCmtsView->getExtraCss();
$p_arr = $oProfile->_aProfile;
if (!($p_arr['ID'] && ($logged['admin'] || $logged['moderator'] || $oProfile->owner || ($p_arr['Status'] = 'Active')))) {
    $_page['header'] = "{$site['title']} " . _t("_Member Profile");
Ejemplo n.º 3
0
/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $_page;
    global $oTemplConfig;
    $ret = "";
    $member['ID'] = (int) $_COOKIE['memberID'];
    $member['Password'] = $_COOKIE['memberPassword'];
    $recipientID = getID($_REQUEST['sendto'], 0);
    $recipient = getProfileInfo($recipientID);
    //db_arr( "SELECT `ID`, `Status`, `Email` FROM `Profiles` WHERE `ID` = '" . $recipientID . "' LIMIT 1;" );
    $contact_allowed = contact_allowed($member['ID'], $recipientID);
    if ($_REQUEST['ConfCode'] && $_REQUEST['from'] && strcmp($_REQUEST['ConfCode'], base64_encode(base64_encode(crypt($_REQUEST['from'], "vkiss_secret_string")))) == 0) {
        $member['ID'] = (int) $_REQUEST['from'];
    }
    //
    // Check if member can send messages
    $check_res = checkAction($member['ID'], ACTION_ID_SEND_VKISS);
    if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED && !$contact_allowed) {
        $_page['header_text'] = _t("_Send virtual kiss3");
        $ret = "\n\t\t\t<table width=\"100%\" cellpadding=\"4\" cellspacing=\"4\" border=\"0\">\n\t\t\t\t<tr>\n\t\t\t\t\t<td align=center class=text2>" . $check_res[CHECK_ACTION_MESSAGE] . "</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n";
        return $ret;
    }
    $action_result = "";
    // Check if recipient found
    if (!$recipient) {
        $_page['header_text'] = _t("_Send virtual kiss3");
        $ret = "\n\t\t\t<table width=\"100%\" cellpadding=\"4\" cellspacing=\"4\">\n\t\t\t\t<tr>\n\t\t\t\t\t<td align=center class=text2>\n\t\t\t\t\t\t<form method=\"GET\" action=\"{$_SERVER['PHP_SELF']}\">\n\t\t\t\t\t\t\t<input class=no size=15 type=\"text\" name=\"sendto\">&nbsp;<input class=no type=\"submit\" value=\"" . _t("_Send kiss") . "!\">\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n";
        return $ret;
    }
    // Perform sending
    $send_result = MemberSendVKiss($member, $recipient);
    switch ($send_result) {
        case 1:
            $action_result .= _t_err("_VKISS_BAD");
            break;
        case 7:
            $action_result .= _t_err("_VKISS_BAD_COUSE_B");
            break;
        case 10:
            $action_result .= _t_err("_VKISS_BAD_COUSE_C");
            break;
        case 13:
            $action_result .= _t_err("_VKISS_BAD_COUSE_A3");
            break;
        case 23:
            $action_result .= _t_err("_VKISS_BAD_COUSE_X");
            break;
        case 24:
            $action_result .= _t_err("_VKISS_BAD_COUSE_Y");
            break;
        default:
            $action_result .= _t("_VKISS_OK");
            break;
    }
    if ($send_result == 0) {
        $_page['header_text'] = _t("_Send virtual kiss2");
    } else {
        $_page['header_text'] = _t("_Send virtual kiss3");
    }
    $ret = "\n\t\t<table width=\"100%\" cellpadding=\"4\" cellspacing=\"4\">\n\t\t\t<tr>\n\t\t\t\t<td align=center class=text2>\n\t\t\t\t\t{$action_result}<br />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n";
    return DesignBoxContent(_t("_Send virtual kiss"), $ret, $oTemplConfig->PageVkiss_db_num);
}