Ejemplo 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;
}
Ejemplo n.º 2
0
function PageCompPageMainCodeWithForm()
{
    global $oTemplConfig;
    global $site;
    $sActionText = '';
    if (isset($_POST['do_submit'])) {
        if (!isset($_POST['securityImageValue']) || !isset($_COOKIE['strSec']) || md5($_POST['securityImageValue']) != $_COOKIE['strSec']) {
            $sActionText = _t_err('_SIMG_ERR');
        } else {
            $sSenderName = process_db_input($_POST['name']);
            $sSenderEmail = process_db_input($_POST['email']);
            $sLetterSubject = process_db_input($_POST['subject']);
            $sLetterBody = process_db_input($_POST['body']);
            $sLetterBody = $sLetterBody . "\r\n" . '============' . "\r\n" . _t('_from') . ' ' . $sSenderName . "\r\n" . 'with email ' . $sSenderEmail;
            if (sendMail($site['email'], $sLetterSubject, $sLetterBody)) {
                $sActionText = _t_action('_ADM_PROFILE_SEND_MSG');
            } else {
                $sActionText = _t_err('_Email sent failed');
            }
        }
    }
    ob_start();
    echo $sActionText;
    ?>
	<form action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
" method="post">
		<table class="messageBlock">
			<tr>
				<td class="contact_label"><?php 
    echo _t('_Your name');
    ?>
:</td>
				<td class="contact_value"><input type="text" name="name" value="" class="inputText" /></td>
			</tr>
			<tr>
				<td class="contact_label"><?php 
    echo _t('_Your email');
    ?>
:</td>
				<td class="contact_value"><input type="text" name="email" value="" class="inputText"  onkeyup="if( emailCheck( this.value ) ) this.form.do_submit.disabled=false; else this.form.do_submit.disabled=true;" /></td>
			</tr>
			<tr>
				<td class="contact_label"><?php 
    echo _t('_message_subject');
    ?>
:</td>
				<td class="contact_value"><input type="text" name="subject" value="" class="inputText" /></td>
			</tr>
			<tr>
				<td class="contact_label"><?php 
    echo _t('_Message text');
    ?>
:</td>
				<td class="contact_value"><textarea name="body" class="inputTextarea"></textarea></td>
			</tr>
			<tr>
				<td class="contact_label"><?php 
    echo _t("_Enter what you see:");
    ?>
</div>
				<td class="contact_value">
					<img alt="Security Image" src="<?php 
    echo $site['url'];
    ?>
simg/simg.php" /><br />
					<input name="securityImageValue" type="text" size="15" />
				</td>
			</tr>
			<tr>
				<td colspan="2" class="contact_submit"><input type="submit" name="do_submit" value="<?php 
    echo _t('_Submit');
    ?>
" disabled="disabled"/></td>
			</tr>
		</table>
	</form>
	<?php 
    $ret = ob_get_clean();
    return DesignBoxContent(_t("_CONTACT_H1"), $ret, $oTemplConfig->PageCompThird_db_num);
}
function AddRecord()
{
    global $record_maxlength;
    global $period;
    global $record_limit;
    global $logged;
    $ret = "";
    $record_text = addslashes(clear_xss(process_pass_data($_POST['newrecord'])));
    $record_sender = strlen($_COOKIE['memberID']) ? (int) $_COOKIE['memberID'] : "";
    $record_recipient = (int) $_REQUEST['owner'];
    $ip = getenv('HTTP_CLIENT_IP') ? getenv('HTTP_CLIENT_IP') : getenv('REMOTE_ADDR');
    if (!$record_recipient) {
        return $ret;
    }
    // Test if IP is defined
    if (!$ip) {
        $ret .= "<br />\r\n\t\t\t<table width=\"100%\" cellpadding=\"1\" cellspacing=\"1\" border=\"0\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=\"text\" align=\"center\">\r\n\t\t\t\t\t\t<br />" . _t_err("_sorry, i can not define you ip adress. IT'S TIME TO COME OUT !") . "<br />\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table>\n";
        return $ret;
    }
    // Test if last message is old enough
    $last_count = db_arr("SELECT COUNT( * ) AS `last_count` FROM `Guestbook` WHERE `IP` = '{$ip}' AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`Date`) < {$period}*60)");
    if ($last_count['last_count'] != 0) {
        $ret .= "<br />\r\n\t\t\t<table width=\"100%\" cellpadding=\"1\" cellspacing=\"1\" border=\"0\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=\"text\" align=\"center\">\r\n\t\t\t\t\t\t<br />" . _t_err("_You have to wait for PERIOD minutes before you can write another message!", $period) . "<br />\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table>\n";
        return $ret;
    }
    // Restrict with total records count
    $total_count = db_arr("SELECT COUNT(*) AS `total_count` FROM `Guestbook` WHERE `Recipient` = '{$record_recipient}'");
    if ($total_count['total_count'] - 1 > $record_limit) {
        $del_res = db_res("SELECT `ID` FROM `Guestbook` WHERE `Recipient` = '{$record_recipient}' ORDER BY `Date` ASC LIMIT " . ($total_count['total_count'] - $record_limit + 1));
        while ($del_arr = mysql_fetch_array($del_res)) {
            db_res("DELETE FROM `Guestbook` WHERE `ID` = {$del_arr['ID']}");
        }
    }
    // Perform insertion
    db_res("INSERT INTO `Guestbook` SET `Date` = NOW(), `IP` = '{$ip}', `Sender` = '{$record_sender}', `Recipient` = '{$record_recipient}', `Text` = '{$record_text}', `New` = '1'");
    return $ret;
}
 /**
  * Parsing uploaded files, store its with temp names, fill data into SQL tables
  *
  * @param $iMemberID	current member ID
  * @return Text presentation of data (enum ID`s)
  */
 function parseUploadedFiles($iMemberID)
 {
     global $dir;
     $sCurrentTime = time();
     if ($_FILES) {
         $iIDs = '';
         for ($i = 0; $i < count($_FILES['userfile']['tmp_name']); $i++) {
             if ($_FILES['userfile']['error'][$i]) {
                 continue;
             }
             if ($_FILES['userfile']['size'][$i] > $this->iMaxUplFileSize) {
                 //if size more than 1mb
                 print _t_err('_WARNING_MAX_SIZE_FILE', $_FILES['userfile']['name'][$i]);
                 continue;
             }
             list($width, $height, $type, $attr) = getimagesize($_FILES['userfile']['tmp_name'][$i]);
             if ($type != 1 and $type != 2 and $type != 3) {
                 continue;
             }
             $sBaseName = $iMemberID . '_' . $sCurrentTime . '_' . ($i + 1);
             $sExt = strrchr($_FILES['userfile']['name'][$i], '.');
             $sExt = strtolower(trim($sExt));
             $vResizeRes = imageResize($_FILES['userfile']['tmp_name'][$i], "{$dir['root']}{$this->sUploadDir}img_{$sBaseName}{$sExt}", $this->iImgSize, $this->iImgSize);
             $vThumbResizeRes = imageResize($_FILES['userfile']['tmp_name'][$i], "{$dir['root']}{$this->sUploadDir}thumb_{$sBaseName}{$sExt}", $this->iThumbSize, $this->iThumbSize);
             $vBigThumbResizeRes = imageResize($_FILES['userfile']['tmp_name'][$i], "{$dir['root']}{$this->sUploadDir}big_thumb_{$sBaseName}{$sExt}", $this->iBigThumbSize, $this->iBigThumbSize);
             $vIconResizeRes = imageResize($_FILES['userfile']['tmp_name'][$i], "{$dir['root']}{$this->sUploadDir}icon_{$sBaseName}{$sExt}", $this->iIconSize, $this->iIconSize);
             if ($vResizeRes || $vThumbResizeRes || $vBigThumbResizeRes || $vIconResizeRes) {
                 print _t_err("_ERROR_WHILE_PROCESSING");
                 continue;
             }
             $vSqlRes = $this->InsertCAM($iMemberID, $sBaseName, $sExt);
             if ($vSqlRes) {
                 $iIDs .= mysql_insert_id() . ',';
             }
         }
         return $iIDs;
     }
 }
Ejemplo n.º 5
0
     case 'archives_paginate':
         $sOutputHtml = $oMailBox->genArchiveMessages();
         break;
         // will return message's replay window;
     // will return message's replay window;
     case 'reply_message':
         if ($iMessageID and $vRecipientID) {
             $vRecipientID = (int) $vRecipientID;
             $sOutputHtml = $oMailBox->genReplayMessage($vRecipientID, $iMessageID);
         }
         break;
     case 'compose_mail':
         if ($sMessageSubject and $sMessageBody and $vRecipientID) {
             $sOutputHtml = $oMailBox->sendMessage($sMessageSubject, $sMessageBody, $vRecipientID, $aComposeSettings);
         } else {
             $sOutputHtml = _t_err('_please_fill_next_fields_first');
         }
         break;
     case 'auto_complete':
         if ($sAutoCompleteQ) {
             $sOutputHtml = $oMailBox->getAutoCompleteList($sAutoCompleteQ);
         }
         break;
     case 'get_thumbnail':
         $iRecipientID = getId($vRecipientID);
         if ($iRecipientID) {
             $sOutputHtml = get_member_thumbnail($iRecipientID, 'none');
         }
         break;
 }
 // try to define the callback function name ;
Ejemplo n.º 6
0
 /**
  * Parsing uploaded files, store its with temp names, fill data into SQL tables
  *
  * @param $iMemberID	current member ID
  * @return Text presentation of data (enum ID`s)
  */
 function parseUploadedFiles()
 {
     $sCurrentTime = time();
     if ($_FILES) {
         $aIDs = array();
         for ($i = 0; $i < count($_FILES['userfile']['tmp_name']); $i++) {
             if ($_FILES['userfile']['error'][$i]) {
                 continue;
             }
             if ($_FILES['userfile']['size'][$i] > $this->iMaxUplFileSize) {
                 echo _t_err('_bx_ads_Warn_max_file_size', $_FILES['userfile']['name'][$i]);
                 continue;
             }
             list($width, $height, $type, $attr) = getimagesize($_FILES['userfile']['tmp_name'][$i]);
             if ($type != 1 && $type != 2 && $type != 3) {
                 continue;
             }
             $sBaseName = $this->_iVisitorID . '_' . $sCurrentTime . '_' . ($i + 1);
             $sExt = strrchr($_FILES['userfile']['name'][$i], '.');
             $sExt = strtolower(trim($sExt));
             $sImg = BX_DIRECTORY_PATH_ROOT . "{$this->sUploadDir}img_{$sBaseName}{$sExt}";
             $sImgThumb = BX_DIRECTORY_PATH_ROOT . "{$this->sUploadDir}thumb_{$sBaseName}{$sExt}";
             $sImgThumbBig = BX_DIRECTORY_PATH_ROOT . "{$this->sUploadDir}big_thumb_{$sBaseName}{$sExt}";
             $sImgIcon = BX_DIRECTORY_PATH_ROOT . "{$this->sUploadDir}icon_{$sBaseName}{$sExt}";
             $vResizeRes = imageResize($_FILES['userfile']['tmp_name'][$i], $sImg, $this->iImgSize, $this->iImgSize);
             $vThumbResizeRes = imageResize($_FILES['userfile']['tmp_name'][$i], $sImgThumb, $this->iThumbSize, $this->iThumbSize);
             $vBigThumbResizeRes = imageResize($_FILES['userfile']['tmp_name'][$i], $sImgThumbBig, $this->iBigThumbSize, $this->iBigThumbSize);
             $vIconResizeRes = imageResize($_FILES['userfile']['tmp_name'][$i], $sImgIcon, $this->iIconSize, $this->iIconSize);
             if ($vResizeRes || $vThumbResizeRes || $vBigThumbResizeRes || $vIconResizeRes) {
                 echo _t_err("_ERROR_WHILE_PROCESSING");
                 continue;
             }
             $iImgId = $this->_oDb->insertMedia($this->_iVisitorID, $sBaseName, $sExt);
             if (!$iImgId) {
                 @unlink($sImg);
                 @unlink($sImgThumb);
                 @unlink($sImgThumbBig);
                 @unlink($sImgIcon);
                 continue;
             }
             $aIDs[] = $iImgId;
         }
         return implode(',', $aIDs);
     }
 }
Ejemplo n.º 7
0
function MemberPrintPoll($ID)
{
    $queryQuestion = "SELECT `Question` FROM `polls_q` WHERE `Active` = 'on' AND `ID` = {$ID}";
    $queryAnswers = "SELECT `IDanswer`, `Answer`, `Votes` FROM `polls_a` WHERE `ID` = {$ID}";
    $aQuestion = db_arr($queryQuestion);
    $rAnswers = db_res($queryAnswers);
    if (!$aQuestion or !mysql_num_rows($rAnswers)) {
        return _t_err("_Poll not available");
    }
    $aVotes = db_arr("SELECT SUM(`Votes`) FROM `polls_a` WHERE `ID` = {$ID}");
    $iTotalVotes = (int) $aVotes[0];
    ob_start();
    ?>
	<div class="tableVote_wrapper">
		<form method="post" name="FormVote" action="poll.php">
			<input type="hidden" name="ID" value="<?php 
    echo $ID;
    ?>
" />
			<table class="tableVote">
				<tr><th colspan="2"><?php 
    echo process_line_output($aQuestion['Question']);
    ?>
</th>
				</tr>
	<?php 
    $j = 1;
    while ($aAnswer = mysql_fetch_array($rAnswers)) {
        if ($j % 2 == 0) {
            $add = '2';
        } else {
            $add = '1';
        }
        ?>
				<tr>
					<td>
						<input type="radio" onclick="javascript: this.form.submit()" name="vote"
						  value="<?php 
        echo $aAnswer['IDanswer'];
        ?>
" ID="l<?php 
        echo $aAnswer['IDanswer'];
        ?>
" />
						<label for="l<?php 
        echo $aAnswer['IDanswer'];
        ?>
"><?php 
        echo process_line_output($aAnswer['Answer']);
        ?>
</label>
					</td>
					<td><?php 
        echo DesignProgressPos(_t("_votes") . ": " . $aAnswer['Votes'], 100, $iTotalVotes, $aAnswer['Votes'], $add);
        ?>
</td>
				</tr>
		<?php 
        $j++;
    }
    ?>
			</table>
		</form>
	</div>
	<?php 
    return ob_get_clean();
}
Ejemplo n.º 8
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);
}
    /**
     * Generate a Form to Editing/Adding of Category of Blog
     *
     * @param $categoryID - category ID
     * @return HTML presentation of data
     */
    function GenEditCategoryForm($iCategoryID = '')
    {
        global $aBlogConfig;
        global $aBreadCramp;
        global $site;
        $this->CheckLogged();
        $iCheckedMemberID = $this->aBlogConf['visitorID'];
        $sRestrictRes = $this->CheckRestrictionToUse($iCheckedMemberID);
        if ($sRestrictRes != '') {
            return $sRestrictRes;
        }
        $sBlogsSQL = "\n\t\t\tSELECT `Blogs`. *\n\t\t\tFROM `Blogs` \n\t\t\tWHERE `Blogs`.`OwnerID` = {$this->aBlogConf['visitorID']}\n\t\t\tLIMIT 1\n\t\t";
        $aBlogsRes = db_arr($sBlogsSQL);
        if (mysql_affected_rows() == 0) {
            return $this->GenCreateBlogForm();
        }
        $sRetHtml = '';
        if ($this->aBlogConf['visitorID'] == $aBlogsRes['OwnerID'] || $this->bAdminMode == true) {
            if ($_REQUEST['action'] == 'edit_category') {
                $sCategorySQL = "\n\t\t\t\t\tSELECT * \n\t\t\t\t\tFROM `BlogCategories`\n\t\t\t\t\tWHERE `CategoryID` = {$iCategoryID}\n\t\t\t\t\tLIMIT 1\n\t\t\t\t";
                $aCategory = db_arr($sCategorySQL);
                $categCaption = $aCategory['CategoryName'];
                $categImg = $aCategory['CategoryPhoto'];
            } else {
                $categCaption = '';
                $categDesc = '';
                $categImg = '';
            }
            $sCategoryCaptionC = _t('_category_caption');
            $sPleaseFillFieldsC = _t('_please_fill_next_fields_first');
            $sRetHtml .= <<<EOF
<script type="text/javascript">
\tfunction checkForm() {
\t\tvar el;
\t\tvar hasErr = false;
\t\tvar fild = "";

\t\tel = document.getElementById("caption");
\t\tif( el.value.length < 3 ) {
\t\t\tel.style.backgroundColor = "pink";
\t\t\tel.style.border = "1px solid silver";
\t\t\thasErr = true;
\t\t\tfild += "{$sCategoryCaptionC}";
\t\t} else {
\t\t\tel.style.backgroundColor = "#fff";
\t\t}

\t\tif (hasErr) {
\t\t\talert( "{$sPleaseFillFieldsC}!" + fild )
\t\t\treturn false;
\t\t} else {
\t\t\treturn true;
\t\t}
\t\treturn false;
\t}
</script>
EOF;
            $sCategoryCaptionC = _t('_category_caption');
            $sCharactersLeftC = _t('_characters_left');
            //$sCategoryDescriptionC = _t('_category_description');
            $sAssociatedImageC = _t('_associated_image');
            $sApplyChangesC = _t('apply changes');
            $sAddCategoryC = _t('_add_category');
            $sEditCategoryC = _t('_edit_category');
            $sBlogPhoto = '';
            if ($categImg) {
                $sBlogPhoto = <<<EOF
<div class="blogPhoto">
\t\t<img src="{$site['blogImage']}big_{$categImg}" alt="" />
</div>
EOF;
            }
            $sEditCategory = '';
            if ('edit_category' == $_REQUEST['action']) {
                $sEditCategory = <<<EOF
<input type="submit" value="{$sApplyChangesC}" />
<input type="hidden" name="action" value="editcategory" />
<input type="hidden" name="categoryID" value="{$iCategoryID}" />
<input type="hidden" name="categoryPhoto" value="{$categImg}" />
EOF;
            } else {
                $sEditCategory = <<<EOF
<input type="submit" value="{$sAddCategoryC}" />
<input type="hidden" name="action" value="addcategory" />
EOF;
            }
            $iMemberID = (int) process_db_input($_REQUEST['ownerID']);
            $aUser = array('Permalink' => getNickName($iMemberID), 'Link' => $iMemberID);
            $sBlogOwnerLink = $this->genBlogLink('show_member_blog', $aUser);
            $sCategImg = '<img src="' . $site['icons'] . 'folder.png" style="position:static;" />';
            $sCategInput = '<input type="" name="categoryCaption" id="caption" value="' . $categCaption . '" class="categoryCaption1" onkeydown="return charCounter(\'caption\', ' . $this->aBlogConf['categoryCaptionMaxLenght'] . ', \'captCounter\');" />';
            $sCategInputImg = $this->GenCenteredActionsBlock($sCategImg, $sCategInput);
            $sRetHtml .= <<<EOF
<div>
\t<form action="{$sBlogOwnerLink}" enctype="multipart/form-data" method="post" onsubmit="return checkForm();">
\t\t<div class="margin_bottom_10">
\t\t\t{$sCategoryCaptionC} (<span id="captCounter">{$this->aBlogConf['categoryCaptionMaxLenght']}</span>{$sCharactersLeftC})
\t\t</div>
\t\t<div class="margin_bottom_10">
\t\t\t{$sCategInputImg}
\t\t</div>
\t\t<div class="assocImageBlock">
\t\t\t<div style="margin-bottom:5px;">
\t\t\t\t{$sAssociatedImageC}
\t\t\t</div>
\t\t\t{$sBlogPhoto}
\t\t\t<div class="margin_bottom_10">
\t\t\t\t<input type="file" name="CategPic" />
\t\t\t</div>
\t\t\t<div class="clear_both"></div>
\t\t</div>
\t\t{$sEditCategory}
\t\t<input type="hidden" name="ownerID" value="{$iMemberID}" />
\t</form>
</div>
EOF;
        } else {
            $ret .= _t_err('_you_have_no_permiss_to_edit');
            $sRetHtml = $ret;
        }
        return DesignBoxContent($sEditCategoryC, $sRetHtml, 1);
    }
             continue;
         }
         $fname = get_input_name($arrpd);
         $funcbody = $arrpd['check'];
         $func = create_function('$arg0', $funcbody);
         if (!$func($p_arr_new[$fname])) {
             $result_text .= _t_err($arrpd['because']);
         }
     }
 } else {
     if (!conf_nick($_POST['NickName']) && $p_arr['NickName'] != $p_arr_new['NickName']) {
         $result_text .= _t_err("_this_nick_already_used");
     }
     //$result_text .= report_err( _t("This Nickname already used !!"));
     if ($_POST['Password1'] != $_POST['Password2']) {
         $result_text .= _t_err('_PWD_INVALID3');
     }
 }
 if (!strlen($result_text)) {
     // check for modification (change status)
     if (!$autoApproval_ifProfile && $MEMBER && !$NEW_TO_ADD && $p_arr['Status'] != "Unconfirmed" && $p_arr['Status'] != "Approval") {
         $respd = db_res("SELECT * FROM `ProfilesDesc` WHERE `visible` & {$db_vsbl} AND `editable` & {$db_editbl} AND ( FIND_IN_SET('0', `show_on_page`) OR FIND_IN_SET('" . (int) $_page['name_index'] . "', `show_on_page`)) AND `to_db` = 1 ORDER BY `order` ASC");
         while ($arrpd = mysql_fetch_array($respd)) {
             $fname = get_input_name($arrpd);
             $dbname = get_field_name($arrpd);
             if ($dbname == 'Password') {
                 continue;
             }
             switch ($arrpd['type']) {
                 case 'a':
                 case 'c':
 /**
  * Adding a Comment to Post
  *
  * @return MsgBox result
  */
 function ActionAddBlogComment()
 {
     $this->CheckLogged();
     $blogID = (int) $_POST['CommPostID'];
     $senderID = $this->aBlogConf['visitorID'];
     $commentText = $this->process_html_db_input($_POST['message']);
     $replyTo = (int) $_POST['replyTo'];
     $ip = getVisitorIP();
     // ( getenv('HTTP_CLIENT_IP') ? getenv('HTTP_CLIENT_IP') : getenv('REMOTE_ADDR') );
     if (!$ip) {
         $ret = _t_err("_sorry, i can not define you ip adress. IT'S TIME TO COME OUT !");
         return $ret;
     }
     if (0 >= $senderID) {
         return _t_err('_im_textLogin');
     }
     if (0 >= $blogID) {
         return '';
     }
     $last_count = db_arr("SELECT COUNT( * ) AS `last_count` FROM `BlogPostComments` WHERE `IP` = '{$ip}' AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`Date`) < 1*60)");
     if ($last_count['last_count'] != 0) {
         $ret = _t("_You have to wait for PERIOD minutes before you can write another message!", 1);
         return MsgBox($ret);
     }
     $addCommentQuery = "\n\t\t\tINSERT INTO `BlogPostComments`\n\t\t\tSET\n\t\t\t\t`PostID` = '{$blogID}',\n\t\t\t\t`SenderID` = '{$senderID}',\n\t\t\t\t`CommentText` = '{$commentText}',\n\t\t\t\t`ReplyTo` = '{$replyTo}',\n\t\t\t\t`IP` = '{$ip}',\n\t\t\t\t`Date` = NOW()\n\t\t";
     //echo $addCommentQuery;
     if (db_res($addCommentQuery)) {
         $ret = _t('_comment_added_successfully');
     } else {
         $ret = _t('_failed_to_add_comment');
     }
     return MsgBox($ret);
 }
/**
 * page code function
 */
function ThisPageMainCode()
{
    global $logged;
    global $member;
    // create poll section -------------------------------------------------------------------
    $ret .= '<div class="createPollSection">';
    $query = "SELECT COUNT(id_poll) FROM ProfilesPolls WHERE id_profile = '{$member['ID']}'";
    $ras_arr = db_arr($query);
    $polls_num = db_arr($query);
    $profile_poll_num = getParam("profile_poll_num");
    if ($profile_poll_num && $polls_num[0] < $profile_poll_num) {
        // limit number of polls
        $ret .= ShowPollCreationForm();
    } else {
        $ret .= _t('_max_poll_reached');
    }
    $ret .= '</div>';
    // show polls section --------------------------------------------------------------------
    $ret .= '<div class="pollContainer" id="pol_container">';
    $ret .= '<div class="clear_both"></div>';
    $query = "SELECT id_poll, poll_status FROM ProfilesPolls WHERE id_profile = '{$member['ID']}'";
    $polls_num = db_res($query);
    while ($poll_arr = mysql_fetch_array($polls_num)) {
        $uID = $poll_arr['id_poll'];
        $ret .= '<div id="pol_container_pol_' . $uID . '" class="controlsDiv">';
        $ret .= ShowPoll($uID);
        $ret .= '<div class="innerControlBlock">';
        //$ret .= '<div class="controlsHeader">' . _t('_controls') . ':</div>';
        $sCurStatus = '';
        $sCTStatus = '';
        $status_change_to = '';
        if ('active' == $poll_arr['poll_status']) {
            $sCurStatus = _t('_Active');
            $sCTStatus = _t('_Disabled');
            $status_change_to = 'disabled';
        } else {
            $sCurStatus = _t('_Disabled');
            $sCTStatus = _t('_Active');
            $status_change_to = 'active';
        }
        $ret .= "<span id=\"poll_status_{$uID}\" style=\"padding: 0px 2px;\"></span>";
        $ret .= '<span class="deleteDiv"><a href="#" onclick=" if ( window.confirm(\'' . _t('_are you sure?') . '\') ) { send_data( \'\', \'delete\', \'\', \'' . $uID . '\' ); del_question_bar( document.getElementById(\'pol_container\'), document.getElementById(\'pol_container_pol_' . $uID . '\') ); } return false;">' . _t('_delete') . '</a></span>';
        $ret .= '<script language="javascript">
			poll_status_show( \'' . $uID . '\', \'poll_status_' . $uID . '\', \'' . $poll_arr['poll_status'] . '\', \'' . $status_change_to . '\', \'' . $sCurStatus . '\', \'' . $sCTStatus . '\' );
	    	    </script>';
        $ret .= '</div>';
        $ret .= '</div>';
    }
    // if no polls
    if (!$uID) {
        $ret .= _t_err('_no poll');
    }
    $ret .= '<div class="clear_both"></div>';
    $ret .= '</div>';
    return $ret;
}
Ejemplo n.º 13
0
function addComment($profileID)
{
    global $logged;
    global $oProfile;
    if ($logged['member']) {
        $record_sender = (int) $_COOKIE['memberID'];
    } else {
        return;
    }
    $period = 1;
    // time period before user can add another record (in minutes)
    $record_maxlength = 1600;
    // max length of record
    // Test if IP is defined
    $ip = getVisitorIP();
    if ($ip == '0.0.0.0') {
        return _t_err("_sorry, i can not define you ip adress. IT'S TIME TO COME OUT !");
    }
    // get record text
    $record_text = addslashes(clear_xss(trim(process_pass_data($_POST['commenttext']))));
    if (strlen($record_text) < 2) {
        return _t_err("_enter_message_text");
    }
    // Test if last message is old enough
    $last_count = db_value("SELECT COUNT(*) FROM `ProfilesComments` WHERE `IP` = '{$ip}' AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`Date`) < {$period}*60)");
    if ($last_count != 0) {
        return _t_err("_You have to wait for PERIOD minutes before you can write another message!", $period);
    }
    $replyTO = (int) $_POST['replyTO'];
    // Perform insertion
    $query = "\n\t\tINSERT INTO `ProfilesComments` SET\n\t\t\t`Date` = NOW(),\n\t\t\t`IP` = '{$ip}',\n\t\t\t`Sender` = {$record_sender},\n\t\t\t`Recipient` = {$oProfile->_iProfileID},\n\t\t\t`Text` = '{$record_text}',\n\t\t\t`New` = '1',\n\t\t\t`ReplyTO` = {$replyTO}\n\t\t";
    db_res($query);
}
Ejemplo n.º 14
0
/**
 * 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;
}
Ejemplo n.º 15
0
/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $site;
    global $dir;
    global $tmpl;
    global $ADMIN;
    global $max_l;
    global $max_h;
    global $short_date_format;
    $max_l = getParam("max_story_text");
    $max_h = getParam("max_story_header");
    ob_start();
    if (!$max_l) {
        $max_l = 4096;
    }
    if (!$max_h) {
        $max_h = 32;
    }
    $action_result = "";
    if ($_POST['action'] == 'new') {
        if (strlen($_POST['header'])) {
            if (MemberAddStory()) {
                $action_result .= _t("_STORY_ADDED");
            } else {
                $action_result .= _t_err("_STORY_ADDED_FAILED");
            }
        } else {
            $action_result .= _t_err("_STORY_EMPTY_HEADER");
        }
    }
    if ($_POST['action'] == 'edit' && (int) $_POST['edit_id'] != 0) {
        if (strlen($_POST['header'])) {
            if (MemberEditStory()) {
                $action_result .= _t("_STORY_UPDATED");
            } else {
                $action_result .= _t_err("_STORY_UPDATED_FAILED");
            }
        } else {
            $action_result .= _t_err("_STORY_EMPTY_HEADER");
        }
    }
    if ($_POST['do_delete'] and $_POST['select_story'] and is_array($_POST['select_story'])) {
        $sqlAdd = $ADMIN ? '' : "AND `Sender`=" . (int) $_COOKIE['memberID'];
        foreach ($_POST['select_story'] as $iStoryID) {
            $iStoryID = (int) $iStoryID;
            if (!$iStoryID) {
                continue;
            }
            $sQuery = "DELETE FROM `Stories` WHERE `ID`={$iStoryID} {$sqlAdd}";
            db_res($sQuery);
        }
    }
    if ($ADMIN and $_POST['do_activate'] and $_POST['select_story'] and is_array($_POST['select_story'])) {
        foreach ($_POST['select_story'] as $iStoryID) {
            $iStoryID = (int) $iStoryID;
            if (!$iStoryID) {
                continue;
            }
            $sQuery = "UPDATE `Stories` SET `active`='on' WHERE `ID`={$iStoryID}";
            db_res($sQuery);
        }
    }
    if ($ADMIN and $_POST['do_deactivate'] and $_POST['select_story'] and is_array($_POST['select_story'])) {
        foreach ($_POST['select_story'] as $iStoryID) {
            $iStoryID = (int) $iStoryID;
            if (!$iStoryID) {
                continue;
            }
            $sQuery = "UPDATE `Stories` SET `active`='' WHERE `ID`={$iStoryID}";
            db_res($sQuery);
        }
    }
    if (!$ADMIN) {
        echo "<table width=\"100%\" cellpadding=4 cellspacing=4><td align=center class=text2>\n";
    } else {
        echo "<div style=\"padding: 10px 10px 10px 10px;\">";
    }
    if (strlen($action_result)) {
        echo "<br /><center><div>{$action_result}</div></center><br />\n";
    }
    echo MemberPrintStories();
    if (!$ADMIN || (int) $_GET['edit_id'] != 0) {
        if ((int) $_GET['edit_id'] != 0) {
            $story_arr = db_arr("SELECT * FROM `Stories` WHERE `ID` = " . (int) $_GET['edit_id']);
        }
        $actions = '';
        if ((int) $_GET['edit_id']) {
            $actions .= '<input type="hidden" name="action"  value="edit" />';
            $actions .= '<input type="hidden" name="sender"  value="' . $story_arr['Sender'] . '" />';
            $actions .= '<input type="hidden" name="edit_id" value="' . $story_arr['ID'] . '" />';
            $actions .= '<input class="no" type="submit" value="' . _t('_Update story') . '" />';
        } else {
            $actions .= '<input type="hidden" name="action" value="new" />';
            $actions .= '<input class="no" type="submit" value="' . _t("_Add story") . '" />';
        }
        $aReplace = array();
        $aReplace['icons'] = $site['icons'];
        $aReplace['header_l'] = _t("_Header");
        $aReplace['text_l'] = _t("_Text");
        $aReplace['form_action'] = $_SERVER['PHP_SELF'];
        $aReplace['story_header'] = htmlspecialchars($story_arr['Header']);
        $aReplace['story_text'] = htmlspecialchars($story_arr['Text']);
        $aReplace['actions'] = $actions;
        $sForm = file_get_contents("{$dir['root']}templates/tmpl_{$tmpl}/story_edit.html");
        foreach ($aReplace as $key => $val) {
            $sForm = str_replace("__{$key}__", $val, $sForm);
        }
        echo $sForm;
    }
    if (!$ADMIN) {
        echo "</td></table>\n";
    } else {
        echo "</div>\n";
    }
    $ret = ob_get_clean();
    return $ret;
}
Ejemplo n.º 16
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.º 17
0
/**
 * page code function
 */
function getMainCode()
{
    global $_page;
    $member['ID'] = getLoggedId();
    $member['Password'] = getLoggedPassword;
    if (false != bx_get('ConfCode') && false != bx_get('sendto')) {
        $recipientID = (int) bx_get('sendto');
    } else {
        //check post value
        $recipientID = isset($_POST['sendto']) ? $_POST['sendto'] : -1;
    }
    $recipient = getProfileInfo($recipientID);
    $isCheckVisitorGreeting = true;
    if (!$recipient || $recipientID == $member['ID']) {
        return MsgBox(_t('_Error Occured'));
    }
    ob_start();
    ?>
    <table width="100%" cellpadding="4" cellspacing="4" border="0">
        <tr>
            <td align="center" class="text2">__content__<br /></td>
        </tr>
    </table>
    <?php 
    $sResTmpl = ob_get_clean();
    $ret = '';
    $sKissKey = '_Send virtual kiss';
    $sJQueryJS = genAjaxyPopupJS($recipientID);
    $_page['header'] = _t($sKissKey);
    if ($_GET['ConfCode'] && $_GET['from'] && strcmp($_GET['ConfCode'], base64_encode(base64_encode(crypt($_GET['from'], CRYPT_EXT_DES ? "vkiss_sec" : "vk")))) === 0) {
        $member['ID'] = (int) $_GET['from'];
        $isCheckVisitorGreeting = false;
    }
    //
    // 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) {
        $_page['header_text'] = _t($sKissKey . '3');
        $ret = $GLOBALS['oSysTemplate']->parseHtmlByContent($sResTmpl, array('content' => $check_res[CHECK_ACTION_MESSAGE]));
        return $ret . $sJQueryJS;
    }
    $action_result = "";
    // Perform sending
    $send_result = MemberSendVKiss($member, $recipient, $isCheckVisitorGreeting);
    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($sKissKey . '2');
    } else {
        $_page['header_text'] = _t($sKissKey . '3');
    }
    $ret = $GLOBALS['oSysTemplate']->parseHtmlByContent($sResTmpl, array('content' => $action_result));
    return $ret . $sJQueryJS;
}
function upload_photo($pic_index)
{
    global $pics;
    global $site;
    global $p_arr;
    global $gl_pic;
    global $dir;
    global $pictures_text;
    global $COMPOSITE;
    global $ADMIN;
    $autoApproval_ifPhoto = isAutoApproval('photo');
    $up_name = "file_{$pic_index}";
    $pic_addon_field = "Pic_{$pic_index}_addon";
    $temp_filename = tempnam(rtrim($dir['tmp'], '/'), $p_arr['ID']);
    unlink($temp_filename);
    $pic_name = $pics[$pic_index]['name'];
    $pic_tmp = $_FILES[$up_name]['tmp_name'];
    $ext = strrchr($_FILES[$up_name]['name'], '.');
    if ($pics[$pic_index]['exist']) {
        unlink("{$pic_name}.jpg");
    }
    $scan = getimagesize($_FILES[$up_name]['tmp_name']);
    if (1 != $scan[2] && 2 != $scan[2] && 3 != $scan[2] && 6 != $scan[2]) {
        return 0;
    }
    if (move_uploaded_file($pic_tmp, "{$temp_filename}{$ext}")) {
        if (imageResize("{$temp_filename}{$ext}", "{$temp_filename}.jpg", $gl_pic['pic']['width'], $gl_pic['pic']['height'], true)) {
            echo _t("_FAILED_TO_UPLOAD_PIC", $_FILES[$up_name]['name'], "undef");
            return 0;
        }
        if (strtolower($ext) != '.jpg') {
            unlink("{$temp_filename}{$ext}");
        }
        if (getParam('enable_watermark') == 'on') {
            $transparent1 = getParam('transparent1');
            $water_mark = $dir['profileImage'] . getParam('Water_Mark');
            if (strlen(getParam('Water_Mark')) && file_exists($water_mark)) {
                applyWatermark("{$temp_filename}.jpg", "{$temp_filename}.jpg", $water_mark, $transparent1);
            }
        }
        srand(time());
        $p_arr[$pic_addon_field] = rand(10000, 99999);
        $pics[$pic_index]['name'] = "{$dir['profileImage']}{$p_arr['ID']}_{$pic_index}_" . $p_arr[$pic_addon_field];
        $pic_name = $pics[$pic_index]['name'];
        if (!rename("{$temp_filename}.jpg", "{$pic_name}.jpg")) {
            echo _t("_FAILED_TO_UPLOAD_PIC", $_FILES[$up_name]['name'], "fail to rename");
            return 0;
        }
        db_res("UPDATE `Profiles` SET {$pic_addon_field} = '" . $p_arr[$pic_addon_field] . "' WHERE ID = {$p_arr['ID']}");
        chmod("{$pic_name}.jpg", 0644);
        $pictures_text = _t_action('_Successfully uploaded');
        $pics[$pic_index]['exist'] = true;
        if ($p_arr['Status'] == 'Active' && !$autoApproval_ifPhoto && !$ADMIN) {
            $update_res = db_res("UPDATE `Profiles` SET `Status` = 'Approval' WHERE `ID` = {$p_arr['ID']}");
            $p_arr['Status'] = 'Approval';
            modules_block($p_arr['ID']);
        }
        createUserDataFile($p_arr['ID']);
        return 1;
    } else {
        echo _t_err("_FAILED_TO_UPLOAD_PIC", $_FILES[$up_name]['name'], "undef");
    }
    return 0;
}
Ejemplo n.º 19
0
             $sOutputHtml = $oMailBox->genReplayMessage($vRecipientID, $iMessageID);
         }
         break;
     case 'compose_mail':
         $sErrorMessage = '';
         //check message's options
         if (!$sMessageSubject) {
             $sErrorMessage = '_Mailbox title empty';
         }
         if (!$sMessageBody) {
             $sErrorMessage = '_Mailbox description empty';
         }
         if (!$vRecipientID) {
             $sErrorMessage = '_Mailbox recipient empty';
         }
         $sOutputHtml = !$sErrorMessage ? $oMailBox->sendMessage($sMessageSubject, $sMessageBody, $vRecipientID, $aComposeSettings) : _t_err($sErrorMessage);
         break;
     case 'auto_complete':
         if ($sAutoCompleteQ) {
             $sOutputHtml = $oMailBox->getAutoCompleteList($sAutoCompleteQ);
         }
         break;
     case 'get_thumbnail':
         $iRecipientID = getId($vRecipientID);
         if ($iRecipientID) {
             $sOutputHtml = get_member_thumbnail($iRecipientID, 'none');
         }
         break;
 }
 // try to define the callback function name ;
 if (isset($_GET['callback_function']) and in_array($_GET['callback_function'], $aCallbackFunctions)) {
Ejemplo n.º 20
0
function PageListSpam($sourceID, $targetID)
{
    global $site;
    $reporterID = $sourceID;
    $spamerID = $targetID;
    $aReporter = getProfileInfo($reporterID);
    // db_arr("SELECT `NickName` FROM `Profiles` WHERE `ID` = '$reporterID';", 0);
    $aSpamer = getProfileInfo($spamerID);
    //db_arr("SELECT `NickName` FROM `Profiles` WHERE `ID` = '$spamerID';", 0);
    $message = getParam("t_SpamReport");
    $subject = getParam('t_SpamReport_subject');
    $aPlus = array();
    $aPlus['reporterID'] = $reporterID;
    $aPlus['reporterNick'] = $aReporter['NickName'];
    $aPlus['spamerID'] = $spamerID;
    $aPlus['spamerNick'] = $aSpamer['NickName'];
    $mail_result = sendMail($site['email'], $subject, $message, '', $aPlus);
    if ($mail_result) {
        $ret = _t_action('_Report about spam was sent');
    } else {
        $ret = _t_err('_Report about spam failed to sent');
    }
    return $ret;
}