Beispiel #1
0
 /**
  * Function will generate compose message block ;
  *
  * @return        : Html presentation data ;
  */
 function getBlockCode_ComposeMessage()
 {
     global $oSysTemplate, $site, $oTemplConfig, $_page;
     $_page['js_name'] = array('mail_box.js', BX_DOL_URL_PLUGINS . 'jquery/jquery.autocomplete.js');
     // init some needed variables ;
     $sOutputHtml = null;
     // check bloked;
     if (isBlocked($this->aMailBoxSettings['recipient_id'], $this->aMailBoxSettings['member_id'])) {
         return MsgBox(_t('_FAILED_TO_SEND_MESSAGE_BLOCK'));
     }
     // if isset recipient ID ;
     $aMemberInfo = $this->aMailBoxSettings['recipient_id'] ? getProfileInfo($this->aMailBoxSettings['recipient_id']) : null;
     $aLanguageKeys = array('cancel' => _t('_Cancel'), 'send' => _t('_Send'), 'send_copy' => _t('_Send copy to personal email', isset($aMemberInfo['NickName']) ? $aMemberInfo['NickName'] : null), 'send_copy_my' => _t('_Send copy to my personal email'), 'notify' => _t('_Notify by e-mail', isset($aMemberInfo['NickName']) ? $aMemberInfo['NickName'] : null), 'error_message' => _t('_please_fill_next_fields_first'), 'subject' => _t('_Subject'), 'message_to' => _t('_SEND_MSG_TO'));
     // ** generate recipient's information ;
     $sMemberIcon = get_member_thumbnail($this->aMailBoxSettings['recipient_id'], 'none');
     $sRecipientName = !empty($aMemberInfo) ? $aMemberInfo['NickName'] : null;
     $sMemberLocation = !empty($aMemberInfo) ? getProfileLink($aMemberInfo['ID']) : null;
     $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['send'], 'attrs' => array('onclick' => 'if(typeof oMailBoxComposeMessage != \'undefined\') oMailBoxComposeMessage.sendMessage()')), 1 => array('type' => 'button', 'value' => $aLanguageKeys['cancel'], 'attrs' => array('onclick' => 'if(typeof oMailBoxComposeMessage != \'undefined\') oMailBoxComposeMessage.cancelCompose()')))));
     $oForm = new BxTemplFormView($aForm);
     $sMessageBoxActions = $oForm->getCode();
     $aTemplateKeys = array('plugins_dir' => BX_DOL_URL_PLUGINS, 'error_message' => $aLanguageKeys['error_message'], 'current_page' => 'mail.php', 'recipient_id' => $aMemberInfo['ID'], 'member_thumbnail' => $sMemberIcon, 'member_location' => $sMemberLocation, 'recipient_name' => $sRecipientName, 'subject' => $aLanguageKeys['subject'], 'send_copy_my' => $aLanguageKeys['send_copy_my'], 'send_copy_to' => $aLanguageKeys['send_copy'], 'notify' => $aLanguageKeys['notify'], 'message_to' => $aLanguageKeys['message_to'], 'compose_actions_buttons' => $sMessageBoxActions);
     $sOutputHtml = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['message_compose'], $aTemplateKeys);
     // generate the page toggle ellements ;
     $aToggleItems = array('inbox' => _t('_Inbox'), 'outbox' => _t('_Outbox'), 'trash' => _t('_Trash'), 'compose' => _t('_Compose'));
     $sRequest = 'mail.php?';
     foreach ($aToggleItems as $sKey => $sValue) {
         $aTopToggleEllements[$sValue] = array('href' => $sRequest . 'mode=' . $sKey, 'dynamic' => false, 'active' => $this->aMailBoxSettings['mailbox_mode'] == $sKey);
     }
     return array($oTemplConfig->sTinyMceEditorJS . $sOutputHtml, $aTopToggleEllements);
 }
Beispiel #2
0
 function _isCommentPostAllowed($bPerform = false)
 {
     if (isAdmin()) {
         return true;
     }
     $iAuthorId = $this->_getAuthorId();
     if ($iAuthorId == 0 && getParam('wall_enable_guest_comments') == 'on') {
         return true;
     }
     if (isBlocked($this->_iOwnerId, $iAuthorId)) {
         return false;
     }
     $aCheckResult = checkAction($iAuthorId, ACTION_ID_TIMELINE_POST_COMMENT, $bPerform);
     return $aCheckResult[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED;
 }
 /**
  * Function will generate messenger's input field ;
  * Will generate messenger's part that allow logged member to send message ;
  *
  * @param  : $iViewedMemberId (integer) - Viewed member's Id ;
  * @return : (text) - Html presentation data ;
  */
 function serviceGetMessengerField($iViewedMemberId)
 {
     if (!$this->iLoggedMemberId || !get_user_online_status($iViewedMemberId) || $this->iLoggedMemberId == $iViewedMemberId || isBlocked($iViewedMemberId, $this->iLoggedMemberId)) {
         return '';
     }
     $sOutputCode = '';
     if ($this->isMessengerAlowed($iViewedMemberId) && $this->isMessengerAlowed($this->iLoggedMemberId)) {
         $aTemplateKeys = array('message' => _t('_simple_messenger_chat_now') . '...', 'res_id' => $iViewedMemberId);
         $sOutputCode = $this->_oTemplate->parseHtmlByName('send_message_field.html', $aTemplateKeys);
     }
     return $sOutputCode;
 }
 function showBlockCmts()
 {
     if (!$this->oCmtsView->isEnabled() || isBlocked($this->_iProfileID, getLoggedId())) {
         return '';
     }
     return $this->oCmtsView->getCommentsFirst();
 }
Beispiel #5
0
/**
 * Send virtual kiss
 */
function MemberSendVKiss($member, $recipient, $isCheckVisitorGreeting = true)
{
    global $logged;
    // Check if recipient is active
    if ('Active' != $recipient['Status']) {
        return 7;
    }
    // block members
    if ($recipient['ID'] && $member['ID'] && isBlocked((int) $recipient['ID'], (int) $member['ID'])) {
        return 24;
    }
    // Get sender info
    $sender = getProfileInfo($member['ID']);
    // Send email notification
    $rEmailTemplate = new BxDolEmailTemplates();
    if ($logged['member'] || !$isCheckVisitorGreeting) {
        $aTemplate = $rEmailTemplate->getTemplate('t_VKiss', $_COOKIE['memberID']);
    } else {
        $aTemplate = $rEmailTemplate->getTemplate('t_VKiss_visitor');
    }
    $sConfCode = urlencode(base64_encode(base64_encode(crypt($recipient['ID'], CRYPT_EXT_DES ? "vkiss_sec" : "vk"))));
    // parse the email template ;
    $sProfileLink = $sender ? '<a href="' . getProfileLink($member['ID']) . '">' . getNickName($sender['ID']) . '</a>' : '<b>' . _t("_Visitor") . '</b>';
    $sKissLink = $sender ? '<a href="' . BX_DOL_URL_ROOT . 'greet.php?fullpage=1&sendto=' . $member['ID'] . '&from=' . $recipient['ID'] . '&ConfCode=' . $sConfCode . '">' . BX_DOL_URL_ROOT . 'greet.php?sendto=' . $member['ID'] . '&from=' . $recipient['ID'] . '&ConfCode=' . $sConfCode . '</a>' : '<a href="' . BX_DOL_URL_ROOT . 'communicator.php">' . BX_DOL_URL_ROOT . 'communicator.php</a>';
    $aRepl = array('<ConfCode>' => $sConfCode, '<ProfileReference>' => $sProfileLink, '<VKissLink>' => $sKissLink, '<RealName>' => getNickName($recipient['ID']), '<SiteName>' => BX_DOL_URL_ROOT);
    $aTemplate['Body'] = str_replace(array_keys($aRepl), array_values($aRepl), $aTemplate['Body']);
    $mail_ret = sendMail($recipient['Email'], $aTemplate['Subject'], $aTemplate['Body'], $recipient['ID']);
    // Send message into the member's site personal mailbox;
    $aTemplate['Subject'] = process_db_input($aTemplate['Subject'], BX_TAGS_NO_ACTION);
    $aTemplate['Body'] = process_db_input($aTemplate['Body'], BX_TAGS_NO_ACTION);
    $sender['ID'] = !$sender['ID'] ? 0 : $sender['ID'];
    $sQuery = "\n        INSERT INTO\n            `sys_messages`\n        SET\n            `Date` = NOW(),\n            `Sender` = '{$sender['ID']}',\n            `Recipient` = '{$recipient['ID']}',\n            `Subject` = '{$aTemplate['Subject']}',\n            `Text`  = '{$aTemplate['Body']}',\n            `New` = '1',\n            `Type` = 'greeting'\n    ";
    db_res($sQuery);
    if (!$mail_ret) {
        return 10;
    }
    // Insert kiss into database
    $kiss_arr = db_arr("SELECT `ID` FROM `sys_greetings` WHERE `ID` = {$member['ID']} AND `Profile` = {$recipient['ID']} LIMIT 1", 0);
    if (!$kiss_arr) {
        $result = db_res("INSERT INTO `sys_greetings` ( `ID`, `Profile`, `Number`, `When`, `New` ) VALUES ( {$member['ID']}, {$recipient['ID']}, 1, NOW(), '1' )", 0);
    } else {
        $result = db_res("UPDATE `sys_greetings` SET `Number` = `Number` + 1, `New` = '1' WHERE `ID` = {$member['ID']} AND `Profile` = {$recipient['ID']}", 0);
    }
    if (!$result) {
        return 1;
    }
    // If success then perform actions
    checkAction($member['ID'], ACTION_ID_SEND_VKISS, true);
    $oAlert = new BxDolAlerts('greeting', 'add', 0, $member['ID'], array('Recipient' => $recipient['ID']));
    $oAlert->alert();
    return 0;
}
Beispiel #6
0
function MemberFreeEmail($recipientID, $profile)
{
    global $site;
    $anon_mode = getParam('anon_mode');
    $recipientID = (int) $recipientID;
    $aRecipientArr = db_arr("SELECT `Email` FROM `Profiles` WHERE `ID` = '{$recipientID}' AND `Status` = 'Active'", 0);
    if (isBlocked($profile['ID'], $recipientID)) {
        return 25;
    }
    if (!db_arr("SELECT `ID` FROM `Profiles` WHERE `ID` = '{$profile['ID']}' AND `Status` = 'Active'", 0)) {
        return 7;
    }
    if ($anon_mode) {
        return 20;
    }
    $rEmailTemplate = new BxDolEmailTemplates();
    $aTemplate = $rEmailTemplate->getTemplate('t_FreeEmail', $recipientID);
    if ($recipientID) {
        $recipient = $aRecipientArr['Email'];
    } else {
        if ($_GET['Email']) {
            $recipient = $_GET['Email'];
        } else {
            return 45;
        }
    }
    $contact_info = "Email: {$profile['Email']}";
    if (strlen($profile['Phone'])) {
        $contact_info .= "\nPhone: {$profile['Phone']}";
    }
    if (strlen($profile['HomeAddress'])) {
        $contact_info .= "\nHomeAddress: {$profile['HomeAddress']}";
    }
    if (strlen($profile['HomePage'])) {
        $contact_info .= "\nHomePage: {$profile['HomePage']}";
    }
    if (strlen($profile['IcqUIN'])) {
        $contact_info .= "\nICQ: {$profile['IcqUIN']}";
    }
    $aPlus = array();
    $aPlus['profileContactInfo'] = $contact_info;
    $aPlus['profileNickName'] = getNickName($profile['ID']);
    $aPlus['profileID'] = $profile['ID'];
    $mail_ret = sendMail($aRecipientArr['Email'], $aTemplate['Subject'], $aTemplate['Body'], $recipientID, $aPlus, 'html', false, true);
    if ($mail_ret) {
        checkAction($memberID, ACTION_ID_GET_EMAIL, true);
    } else {
        return 10;
    }
    return 0;
}
Beispiel #7
0
 function serviceGetActionLink($iMemberId, $iProfileId)
 {
     $aResult = checkAction($iMemberId, ACTION_ID_USE_MESSENGER);
     if ($iMemberId > 0 && get_user_online_status($iProfileId) && $aResult[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED && $iMemberId != $iProfileId && !isBlocked($iProfileId, $iMemberId)) {
         $sResult = _t('_messenger_actions_item');
     } else {
         $sResult = '';
     }
     return $sResult;
 }
<?php

/**This page wil return a json encoded list of instagram pictures containing username, profilepicture, text and the image (in standard resolution). Unless the user is blocked **/
require_once 'emoji/emoji.php';
require_once 'configuration.php';
require_once 'getBlocked.php';
$json = file_get_contents('https://api.instagram.com/v1/tags/' . $hashtag . '/media/recent?client_id=' . $instagram_client_id);
$obj = json_decode($json, true);
foreach ($obj['data'] as $instagram) {
    if (!isBlocked($instagram['user']['username'])) {
        $instagramList[] = array("user" => $instagram['user']['username'], "profile_picture" => $instagram['user']['profile_picture'], "text" => emoji_unified_to_html($instagram['caption']['text']), "image" => $instagram['images']['standard_resolution']['url']);
        if (sizeof($instagramList) == $maxAmount) {
            break;
        }
    }
}
echo json_encode($instagramList);
Beispiel #9
0
/**
 * Put to friends list
 *
 * @param $iProfileId integer
 * @param $iMemberId integer
 * @return text - html presentation data
 */
function PageListFriend($iProfileId, $iMemberId = 0)
{
    $sOutputCode = '';
    $iProfileId = (int) $iProfileId;
    $iMemberId = (int) $iMemberId;
    if (!$iMemberId || !getProfileInfo($iMemberId)) {
        return MsgBox(_t('_Failed to apply changes'));
    }
    // block members
    if (isBlocked($iMemberId, $iProfileId)) {
        return MsgBox(_t('_You have blocked by this profile'));
    }
    //check friends pair
    $aFriendsInfo = db_assoc_arr("SELECT * FROM `sys_friend_list`\n        WHERE (`ID`='{$iProfileId}' AND `Profile`='{$iMemberId}')\n            OR (`ID`='{$iMemberId}' AND `Profile` = '{$iProfileId}')");
    //-- process friend request --//
    if ($aFriendsInfo) {
        if (isset($aFriendsInfo['Check']) && $aFriendsInfo['Check'] == 1) {
            $sOutputCode = MsgBox(_t('_already_in_friend_list'));
        } else {
            if (isset($aFriendsInfo['ID'], $aFriendsInfo['Check'])) {
                if ($iProfileId == $aFriendsInfo['ID'] && $aFriendsInfo['Check'] == 0) {
                    $sOutputCode = MsgBox(_t('_pending_friend_request'));
                } else {
                    //make paier as friends
                    $sQuery = "UPDATE `sys_friend_list` SET `Check` = '1'\n                    WHERE `ID` = '{$iMemberId}' AND `Profile` = '{$iProfileId}';";
                    if (db_res($sQuery, 0)) {
                        $sOutputCode = MsgBox(_t('_User was added to friend list'));
                        //send system alert
                        bx_import('BxDolAlerts');
                        $oZ = new BxDolAlerts('friend', 'accept', $iMemberId, $iProfileId);
                        $oZ->alert();
                    } else {
                        $sOutputCode = MsgBox(_t('_Failed to apply changes'));
                    }
                }
            } else {
                $sOutputCode = MsgBox(_t('_Failed to apply changes'));
            }
        }
    } else {
        //create new friends request
        $sQuery = "INSERT INTO `sys_friend_list` SET\n            `ID` = '{$iProfileId}', `Profile` = '{$iMemberId}', `Check` = '0'";
        if (db_res($sQuery, 0)) {
            $sOutputCode = MsgBox(_t('_User was invited to friend list'));
            //send system alert
            bx_import('BxDolAlerts');
            $oZ = new BxDolAlerts('friend', 'request', $iMemberId, $iProfileId);
            $oZ->alert();
            // send email notification
            $oEmailTemplate = new BxDolEmailTemplates();
            $aTemplate = $oEmailTemplate->getTemplate('t_FriendRequest', $iMemberId);
            $aRecipient = getProfileInfo($iMemberId);
            $aPlus = array('Recipient' => getNickName($aRecipient['ID']), 'SenderLink' => getProfileLink($iProfileId), 'Sender' => getNickName($iProfileId), 'RequestLink' => BX_DOL_URL_ROOT . 'communicator.php?communicator_mode=friends_requests');
            sendMail($aRecipient['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
        } else {
            $sOutputCode = MsgBox(_t('_Failed to apply changes'));
        }
    }
    //--
    return $sOutputCode;
}
<?php 
/**This page wil return a json encoded list of tweets with a picture containing username, profilepicture, text and the image (in standard resolution). Unless the user is blocked **/
require_once 'emoji/emoji.php';
require_once 'configuration.php';
require_once 'getBlocked.php';
require_once 'twitter-api-php-master/TwitterAPIExchange.php';
$settings = array('oauth_access_token' => $twitter_oauth_access_token, 'oauth_access_token_secret' => $twitter_oauth_access_token_secret, 'consumer_key' => $twitter_consumer_key, 'consumer_secret' => $twitter_consumer_secret);
$url = "https://api.twitter.com/1.1/search/tweets.json";
$requestMethod = "GET";
$getfield = '?q=%23' . $hashtag . '%20-RT&result_type=recent&count=100';
$twitter = new TwitterAPIExchange($settings);
$string = json_decode($twitter->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest(), $assoc = TRUE);
if ($string["errors"][0]["message"] != "") {
    echo "<h3>Sorry, there was a problem.</h3><p>Twitter returned the following error message:</p><p><em>" . $string[errors][0]["message"] . "</em></p>";
    exit;
}
$image_tweets = array();
foreach ($string["statuses"] as $tweet) {
    if (!isBlocked($tweet["user"]["name"])) {
        $image = $tweet["entities"]["media"][0]["media_url"];
        if (strlen($image) > 0) {
            $image_tweets[] = array("user" => $tweet["user"]["name"], "profile_picture" => $tweet["user"]["profile_image_url"], "text" => emoji_unified_to_html($tweet["text"]), "image" => $image);
        }
        if (sizeof($image_tweets) == $maxAmount) {
            break;
        }
    }
}
echo json_encode($image_tweets);