protected function setUp()
 {
     bx_import('BxDolModule');
     $oModule = BxDolModule::getInstance('bx_antispam');
     $this->_oDNSBlacklists = bx_instance('BxAntispamDNSBlacklists', array(), $oModule->_aModule);
     $this->_oDNSURIBlacklists = bx_instance('BxAntispamDNSURIBlacklists', array(), $oModule->_aModule);
 }
 protected function _performAction($sAction, $sDisplay, $iId = 0)
 {
     bx_import('BxDolForm');
     $oForm = BxDolForm::getObjectInstance('bx_antispam_ip_table_form', $sDisplay);
     // get form instance for specified form object and display
     if (!$oForm) {
         $this->_echoResultJson(array('msg' => _t('_sys_txt_error_occured')), true);
         exit;
     }
     $oForm->addMarkers(array('grid_object' => $this->_sObject, 'grid_action' => $sAction));
     $aIpTableDirective = array();
     if ($iId) {
         bx_import('BxDolModule');
         $oModule = BxDolModule::getInstance('bx_antispam');
         $oAntispamIp = bx_instance('BxAntispamIP', array(), $oModule->_aModule);
         $aIpTableDirective = $oAntispamIp->getIpTableDirective($iId);
         $aIpTableDirective['From'] = long2ip($aIpTableDirective['From']);
         $aIpTableDirective['To'] = long2ip($aIpTableDirective['To']);
     }
     $oForm->initChecker($aIpTableDirective);
     if ($oForm->isSubmittedAndValid()) {
         // if form is submitted and all fields are valid
         $aCustomValues = array('From' => sprintf("%u", ip2long($oForm->getCleanValue('From'))), 'To' => sprintf("%u", ip2long($oForm->getCleanValue('To'))));
         if ($iId) {
             if ($oForm->update($iId, $aCustomValues)) {
                 // update record
                 $iRecentId = $iId;
             }
         } else {
             $iRecentId = $oForm->insert($aCustomValues, true);
             // insert new record
         }
         if ($iRecentId) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $iRecentId);
         } else {
             $aRes = array('msg' => _t('_sys_txt_error_occured'));
         }
         // if record adding failed, display error message
         $this->_echoResultJson($aRes, true);
     } else {
         // if form is not submitted or some fields are invalid, display popup with form
         bx_import('BxTemplFunctions');
         $s = BxTemplFunctions::getInstance()->popupBox($oForm->getId() . '_form', _t('_bx_antispam_form_ip_table_add'), $oForm->getCode() . '
             <script>
                 $(document).ready(function () {
                     $("#' . $oForm->getId() . '").ajaxForm({
                         dataType: "json",
                         beforeSubmit: function (formData, jqForm, options) {
                             bx_loading($("#' . $oForm->getId() . '"), true);
                         },
                         success: function (data) {
                             $(".bx-popup-applied:visible").dolPopupHide();
                             glGrids.' . $this->_sObject . '.processJson(data, "' . $sAction . '");
                         }
                     });
                 });
             </script>');
         $this->_echoResultJson(array('popup' => array('html' => $s, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
 public function processing()
 {
     $oController = new BxDolUpgradeController();
     if ($oController->setMaintenanceMode(true)) {
         // if upgrade was successful
         if (($sFolder = $oController->getAvailableUpgrade()) && $oController->runUpgrade($sFolder)) {
             // write upgrade log
             $oController->writeLog();
             // send email notification
             bx_import('BxDolLanguages');
             sendMailTemplateSystem('t_UpgradeSuccess', array('new_version' => bx_get_ver(true), 'conclusion' => $oController->getConclusion() ? _t('_sys_upgrade_conclusion', $oController->getConclusion()) : ''));
             // if next upgrade is available (in case of bulk upgrade) then schedule to run it upon next cron run
             $sUpgradeDir = pathinfo(__FILE__, PATHINFO_DIRNAME);
             if ($oController->getAvailableUpgrade()) {
                 $oUpgrader = bx_instance('BxDolUpgrader');
                 $oUpgrader->setTransientUpgradeCronJob($sUpgradeDir);
             } elseif (0 === strpos($sUpgradeDir, BX_DIRECTORY_PATH_TMP)) {
                 @bx_rrmdir($sUpgradeDir);
             }
         }
         $oController->setMaintenanceMode(false);
     }
     // if something went grong during upgrade
     if ($sErrorMsg = $oController->getErrorMsg()) {
         // write upgrade log
         $oController->writeLog();
         // send email notification
         sendMailTemplateSystem('t_UpgradeFailed', array('error_msg' => $sErrorMsg));
         // disable auto-upgrade if it is failed
         setParam('sys_autoupdate_system', '');
     }
 }
 function __construct($aConfig)
 {
     parent::__construct();
     $this->oDb = bx_instance('BxDolStudioInstallerQuery');
     $this->_aConfig = $aConfig;
     $this->_sBasePath = BX_DIRECTORY_PATH_MODULES;
     $this->_sHomePath = $this->_sBasePath . $aConfig['home_dir'];
     $this->_sModulePath = $this->_sBasePath . $aConfig['home_dir'];
     $this->_bUseFtp = BX_FORCE_USE_FTP_FILE_TRANSFER;
     $this->_aActions = array('perform_install' => array('title' => '', 'success' => _t('_adm_msg_modules_success_install'), 'failed' => ''), 'perform_uninstall' => array('title' => '', 'success' => _t('_adm_msg_modules_success_uninstall'), 'failed' => ''), 'perform_enable' => array('title' => '', 'success' => _t('_adm_msg_modules_success_enable'), 'failed' => ''), 'perform_disable' => array('title' => '', 'success' => _t('_adm_msg_modules_success_disable'), 'failed' => ''), 'check_script_version' => array('title' => _t('_adm_txt_modules_check_script_version')), 'check_dependencies' => array('title' => _t('_adm_txt_modules_check_dependencies')), 'show_introduction' => array('title' => _t('_adm_txt_modules_show_introduction')), 'move_sources' => array('title' => _t('_adm_txt_modules_move_sources')), 'execute_sql' => array('title' => _t('_adm_txt_modules_execute_sql')), 'install_language' => array('title' => _t('_adm_txt_modules_install_language')), 'update_languages' => array('title' => _t('_adm_txt_modules_update_languages')), 'update_relations' => array('title' => _t('_adm_txt_modules_update_relations')), 'process_connections' => array('title' => _t('_adm_txt_modules_process_connections')), 'process_deleted_profiles' => array('title' => _t('_adm_txt_modules_process_deleted_profiles')), 'process_menu_triggers' => array('title' => _t('_adm_txt_modules_process_menu_triggers')), 'process_page_triggers' => array('title' => _t('_adm_txt_modules_process_page_triggers')), 'process_storages' => array('title' => _t('_adm_txt_modules_process_storages')), 'register_transcoders' => array('title' => _t('_adm_txt_modules_register_transcoders')), 'unregister_transcoders' => array('title' => _t('_adm_txt_modules_unregister_transcoders')), 'clear_db_cache' => array('title' => _t('_adm_txt_modules_clear_db_cache')), 'show_conclusion' => array('title' => _t('_adm_txt_modules_show_conclusion')));
     $this->_aNonHashableFiles = array('install', 'updates');
 }
 public function processing()
 {
     if ('on' != getParam('sys_autoupdate_system')) {
         return;
     }
     $o = bx_instance('BxDolUpgrader');
     if (!$o->prepare()) {
         sendMailTemplateSystem('t_UpgradeFailed', array('error_msg' => $o->getError()));
         setParam('sys_autoupdate_system', '');
         // disable auto-update if it is failed
     }
 }
 public function hashSystemFiles()
 {
     $aFiles = $this->getSystemFilesHash();
     if (!$aFiles) {
         return false;
     }
     $oDb = bx_instance('BxDolStudioInstallerQuery');
     foreach ($aFiles as $aFile) {
         $oDb->insertModuleTrack(BX_SYSTEM_MODULE_ID, $aFile);
     }
     return true;
 }
 function getBlockCode_Calendar($iBlockID, $sContent)
 {
     $aDateParams = array(0, 0);
     $sDate = bx_get('date');
     if ($sDate) {
         $aDateParams = explode('/', $sDate);
     }
     bx_import('Calendar', $this->oMain->_aModule);
     $oCalendar = bx_instance($this->oMain->_aModule['class_prefix'] . 'Calendar', array((int) $aDateParams[0], (int) $aDateParams[1], $this->oDb, $this->oConfig, $this->oTemplate));
     $oCalendar->setBlockId($iBlockID);
     $oCalendar->setDynamicUrl($this->oConfig->getBaseUri() . 'home/');
     return $oCalendar->display(true);
 }
function getMemberMenuAdsList($iID)
{
    $oMemberMenu = bx_instance('BxDolMemberMenu');
    $oModuleDb = new BxDolModuleDb();
    $aModule = $oModuleDb->getModuleByUri('ads');
    $oAds = new BxAdsModule($aModule);
    $sAdsMainLink = $oAds->bUseFriendlyLinks ? BX_DOL_URL_ROOT . 'ads/my_page/' : "{$oAds->sCurrBrowsedFile}?action=my_page";
    $iMyAdsCnt = $oAds->_oDb->getMemberAdsCnt($iID);
    // language keys;
    $aLanguageKeys = array('ads' => _t('_bx_ads_Ads'));
    // fill all necessary data;
    $aLinkInfo = array('item_img_src' => $oAds->_oTemplate->getIconUrl('ads.png'), 'item_img_alt' => $aLanguageKeys['ads'], 'item_link' => $sAdsMainLink, 'item_onclick' => null, 'item_title' => $aLanguageKeys['ads'], 'extra_info' => $iMyAdsCnt);
    return $oMemberMenu->getGetExtraMenuLink($aLinkInfo);
}
 public function update($aParams)
 {
     $bHtmlResponce = isset($aParams['html_response']) && (bool) $aParams['html_response'];
     $oDb = bx_instance('BxDolStudioInstallerQuery');
     $aResult = array('operation_title' => _t('_adm_txt_modules_operation_update', $this->_aConfig['title'], $this->_aConfig['version_from'], $this->_aConfig['version_to']));
     //--- Check for module to update ---//
     $aModuleInfo = $oDb->getModulesBy(array('type' => 'path_and_uri', 'path' => $this->_aConfig['module_dir'], 'uri' => $this->_aConfig['module_uri']));
     if (!$aModuleInfo) {
         return array_merge($aResult, array('message' => $this->_displayResult('check_module_exists', false, '_adm_err_modules_module_not_found', $bHtmlResponce), 'result' => false));
     }
     if (isset($aParams['updated_module_name']) && strcmp($aParams['updated_module_name'], $aModuleInfo['name']) != 0) {
         return array_merge($aResult, array('message' => $this->_displayResult('check_module_matches', false, '_adm_err_modules_module_not_match', $bHtmlResponce), 'result' => false));
     }
     //--- Check Dolphin version compatibility ---//
     if (!$this->_isCompatibleWith()) {
         return array('message' => $this->_displayResult('check_script_version', false, _t('_adm_err_modules_wrong_version_script_update', $aModuleInfo['title']), $bHtmlResponce), 'result' => false);
     }
     //--- Check version ---//
     if (version_compare($aModuleInfo['version'], $this->_aConfig['version_from']) != 0) {
         return array_merge($aResult, array('message' => $this->_displayResult('check_module_version', false, '_adm_err_modules_wrong_version', $bHtmlResponce), 'result' => false));
     }
     //--- Check hash ---//
     $aFiles = array();
     $this->hashFiles(BX_DIRECTORY_PATH_ROOT . 'modules/' . $this->_aConfig['module_dir'], $aFiles);
     list($aFilesChanged, $fChangedPercent) = $this->hashCheck($aFiles, $aModuleInfo['id']);
     $bAutoupdateForceModifiedFiles = getParam('sys_autoupdate_force_modified_files') == 'on';
     if (!empty($aFilesChanged) && !$bAutoupdateForceModifiedFiles) {
         return array_merge($aResult, array('message' => $this->_displayResult('check_module_hash', false, '_adm_err_modules_module_was_modified', $bHtmlResponce), 'result' => false));
     } else {
         if ($fChangedPercent > BX_FORCE_AUTOUPDATE_MAX_CHANGED_FILES_PERCENT && $bAutoupdateForceModifiedFiles) {
             return array_merge($aResult, array('message' => $this->_displayResult('check_module_hash', false, _t('_sys_upgrade_files_checksum_failed_too_many', round($fChangedPercent * 100)), $bHtmlResponce), 'result' => false));
         }
     }
     //--- Perform action and check results ---//
     $aResult = array_merge($aResult, $this->_perform('install', $aParams));
     if ($aResult['result']) {
         $oDb->updateModule(array('version' => $this->_aConfig['version_to']), array('id' => $aModuleInfo['id']));
         $oDb->deleteModuleTrackFiles($aModuleInfo['id']);
         $aFiles = array();
         $this->hashFiles(BX_DIRECTORY_PATH_ROOT . 'modules/' . $this->_aConfig['module_dir'], $aFiles);
         foreach ($aFiles as $aFile) {
             $oDb->insertModuleTrack($aModuleInfo['id'], $aFile);
         }
         //--- Remove update pckage ---//
         $this->delete($aParams);
     }
     return $aResult;
 }
 function actionFinish()
 {
     require_once BX_INSTALL_PATH_HEADER;
     $oHasher = bx_instance('BxDolInstallerHasher');
     $oHasher->hashSystemFiles();
     $this->_oView->pageStart();
     $sPathToPhp = "/replace/it/with/path/to/php/binary";
     $a = array('/usr/local/bin/php', '/usr/bin/php', '/opt/local/bin/php');
     foreach ($a as $sPath) {
         if (file_exists($sPath)) {
             $sPathToPhp = $sPath;
         }
     }
     $this->_oView->out('finish.php', compact('sPathToPhp'));
     $this->_oView->setToolbarItem('question', 'http://www.boonex.com/trac/dolphin/wiki/DetailedInstall#InstallScript-Step5-CronJobs', _t('_sys_inst_help_finish'), '_blank');
     $this->_oView->pageEnd($this->_getTitle());
 }
 public function update($aParams)
 {
     $oDb = bx_instance('BxDolStudioInstallerQuery');
     $aResult = array('operation_title' => _t('_adm_txt_modules_operation_update', $this->_aConfig['title'], $this->_aConfig['version_from'], $this->_aConfig['version_to']));
     //--- Check for module to update ---//
     $sQuery = $oDb->prepare("SELECT `id`, `version` FROM `sys_modules` WHERE `path`=? AND `uri`=? LIMIT 1", $this->_aConfig['module_dir'], $this->_aConfig['module_uri']);
     $aModuleInfo = $oDb->getRow($sQuery);
     if (!$aModuleInfo) {
         return array_merge($aResult, array('message' => $this->_displayResult('check_module_exists', false, '_adm_err_modules_module_not_found'), 'result' => false));
     }
     //--- Check version ---//
     if ($aModuleInfo['version'] != $this->_aConfig['version_from']) {
         return array_merge($aResult, array('message' => $this->_displayResult('check_module_version', false, '_adm_err_modules_wrong_version'), 'result' => false));
     }
     //--- Check hash ---//
     $aFiles = array();
     $this->hashFiles(BX_DIRECTORY_PATH_ROOT . 'modules/' . $this->_aConfig['module_dir'], $aFiles);
     list($aFilesChanged, $fChangedPercent) = $this->hashCheck($aFiles, $aModuleInfo['id']);
     $bAutoupdateForceModifiedFiles = getParam('sys_autoupdate_force_modified_files') == 'on';
     if (!empty($aFilesChanged) && !$bAutoupdateForceModifiedFiles) {
         return array_merge($aResult, array('message' => $this->_displayResult('check_module_hash', false, '_adm_err_modules_module_was_modified'), 'result' => false));
     } else {
         if ($fChangedPercent > BX_FORCE_AUTOUPDATE_MAX_CHANGED_FILES_PERCENT && $bAutoupdateForceModifiedFiles) {
             return array_merge($aResult, array('message' => $this->_displayResult('check_module_hash', false, _t('_sys_upgrade_files_checksum_failed_too_many', round($fChangedPercent * 100))), 'result' => false));
         }
     }
     //--- Perform action and check results ---//
     $aResult = array_merge($aResult, $this->_perform('install', 'Update'));
     if ($aResult['result']) {
         $sQuery = $oDb->prepare("UPDATE `sys_modules` SET `version`=? WHERE `id`=?", $this->_aConfig['version_to'], $aModuleInfo['id']);
         $oDb->query($sQuery);
         $oDb->deleteModuleTrackFiles($aModuleInfo['id']);
         $aFiles = array();
         $this->hashFiles(BX_DIRECTORY_PATH_ROOT . 'modules/' . $this->_aConfig['module_dir'], $aFiles);
         foreach ($aFiles as $aFile) {
             $oDb->insertModuleTrack($aModuleInfo['id'], $aFile);
         }
         //--- Remove update pckage ---//
         $this->delete();
     }
     return $aResult;
 }
Beispiel #12
0
 public function actionResetHash($sType)
 {
     $oDb = bx_instance('BxDolStudioInstallerQuery');
     $sResult = '';
     switch ($sType) {
         case 'system':
             $oHasher = bx_instance('BxDolInstallerHasher');
             $oDb->deleteModuleTrackFiles(BX_SYSTEM_MODULE_ID);
             $sResult = _t('_bx_dev_hash_' . ($oHasher->hashSystemFiles() ? 'msg' : 'err') . '_reset_hash_system');
             break;
         case 'modules':
             bx_import('BxDolInstallerUtils');
             bx_import('BxDolModuleQuery');
             $aModules = BxDolModuleQuery::getInstance()->getModules();
             $aTmplVarsModules = array();
             foreach ($aModules as $aModule) {
                 if ($aModule['name'] == 'system') {
                     continue;
                 }
                 $aConfig = BxDolInstallerUtils::getModuleConfig($aModule);
                 $sPathInstaller = BX_DIRECTORY_PATH_MODULES . $aModule['path'] . 'install/installer.php';
                 if (empty($aConfig) || !file_exists($sPathInstaller)) {
                     continue;
                 }
                 require_once $sPathInstaller;
                 $sClassName = $aConfig['class_prefix'] . 'Installer';
                 $oInstaller = new $sClassName($aConfig);
                 $oDb->deleteModuleTrackFiles($aModule['id']);
                 $aFiles = array();
                 $oInstaller->hashFiles(BX_DIRECTORY_PATH_ROOT . 'modules/' . $aModule['path'], $aFiles);
                 foreach ($aFiles as $aFile) {
                     $oDb->insertModuleTrack($aModule['id'], $aFile);
                 }
                 $aTmplVarsModules[] = array('module' => $aModule['title'], 'files' => count($aFiles));
             }
             $sResult = $this->_oTemplate->parseHtmlByName('hash_modules.html', array('bx_repeat:modules' => $aTmplVarsModules));
             break;
     }
     echo $sResult;
     exit;
 }
 function finalizeCheckout(&$aData)
 {
     $this->_logInfo(__METHOD__, $aData);
     $iPending = (int) $aData['pendingid'];
     $aPending = $this->_oDb->getPending(array('type' => 'id', 'id' => $iPending));
     if (!empty($aPending['order']) || !empty($aPending['error_code']) || !empty($aPending['error_msg']) || (int) $aPending['processed'] != 0) {
         return array('code' => 0, 'message' => _t($this->_sLangsPrefix . 'err_already_processed'));
     }
     $sToken = process_db_input($aData['token'], BX_TAGS_STRIP);
     $sPayerId = process_db_input($aData['payerid'], BX_TAGS_STRIP);
     $sPayerName = process_db_input($aData['payername'], BX_TAGS_STRIP);
     $sPayerEmail = process_db_input($aData['payeremail'], BX_TAGS_STRIP);
     $sAmt = process_db_input($aData['amt'], BX_TAGS_STRIP);
     $this->_doExpressCheckout($sToken, $sPayerId, $sAmt);
     $aResponsePay = $this->_executeCall();
     if ($aResponsePay === false) {
         return array('code' => 0, 'message' => _t($this->_sLangsPrefix . 'err_unknown'));
     }
     $this->_logInfo(__METHOD__, $aResponsePay);
     $iResponseCode = (int) $aResponsePay['RESULT'];
     $sResponseMessage = process_db_input($aResponsePay['RESPMSG'], BX_TAGS_STRIP);
     $bPaymentAccepted = $iResponseCode == 0;
     $aResult = array('code' => $bPaymentAccepted ? 1 : 0, 'message' => $bPaymentAccepted ? _t($this->_sLangsPrefix . 'msg_accepted') : $sResponseMessage, 'pending_id' => $iPending, 'payer_name' => $sPayerName, 'payer_email' => $sPayerEmail);
     //--- Update pending transaction ---//
     $this->_oDb->updatePending($iPending, array('order' => process_db_input($aResponsePay['PPREF'], BX_TAGS_STRIP), 'order_ref' => process_db_input($aResponsePay['PNREF'], BX_TAGS_STRIP), 'error_code' => $aResult['code'], 'error_msg' => $sResponseMessage));
     //--- Establish subscription ---//
     if ($bPaymentAccepted && !empty($aResponsePay['BAID'])) {
         $sBaid = process_db_input($aResponsePay['BAID'], BX_TAGS_STRIP);
         $oMain = bx_instance($this->_oConfig->getClassPrefix() . 'Module');
         $aCartInfo = $oMain->_oCart->getInfo((int) $aPending['client_id'], (int) $aPending['seller_id'], $aPending['items']);
         $this->_createRecurringBillingProfile($iPending, $aCartInfo, $sBaid);
         $aResponseSubscribe = $this->_executeCall();
         if ($aResponseSubscribe !== false && (int) $aResponseSubscribe['RESULT'] == 0) {
             $this->_logInfo(__METHOD__, $aResponseSubscribe);
             $aResult['message'] = _t($this->_sLangsPrefix . 'msg_accepted_subscribed');
             $this->_oDb->updatePending($iPending, array('order_profile' => process_db_input($aResponseSubscribe['PROFILEID'], BX_TAGS_STRIP)));
         }
     }
     return $aResult;
 }
/**
 * Gets user's information from database by user's id
 * @param $sId - user ID
 * @return $aInfo - user info
 */
function getUserInfo($sId, $bNick = false)
{
    global $sWomanImageUrl;
    global $sManImageUrl;
    global $sProfileUrl;
    global $sRootURL;
    //get info by ID on these fields
    $sNick = "";
    $sSex = "";
    $sAge = "0";
    $sDesc = "";
    $sPhoto = "";
    $sProfile = "";
    //You should change this query to retrieve user's data correctly
    $sWherePart = ($bNick ? "`NickName`" : "`ID`") . " = '" . $sId . "'";
    $aUser = getArray("SELECT * FROM `Profiles` WHERE " . $sWherePart . " LIMIT 1");
    /**
     * Define photo.
     * If this user has a photo you should define it's uri here.
     * Otherwise a "no_photo" image is used.
     */
    $oBaseFunctions = bx_instance("BxBaseFunctions");
    $sSex = !empty($aUser['Sex']) ? $aUser['Sex'] : "male";
    $sPhoto = $oBaseFunctions->getMemberAvatar($sId);
    if (empty($sPhoto)) {
        $sPhoto = $sSex == "male" ? $sManImageUrl : $sWomanImageUrl;
    }
    $sNick = $aUser['NickName'];
    $sAge = isset($aUser['DateOfBirth']) ? getAge($aUser['DateOfBirth']) : "25";
    $sDesc = isset($aUser['DescriptionMe']) ? strip_tags($aUser['DescriptionMe']) : "";
    $sProfile = getParam('enable_modrewrite') == "on" ? $sRootURL . $sNick : $sProfileUrl . "?ID=" . $sId;
    /**
     * Return user info.
     * NOTE. Do not change the return statement order.
     */
    return array("id" => (int) $aUser["ID"], "nick" => $sNick, "sex" => $sSex, "age" => $sAge, "desc" => $sDesc, "photo" => $sPhoto, "profile" => $sProfile);
}
 /**
  * '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);
 }
Beispiel #16
0
 function getDbCacheObject()
 {
     if ($this->_oDbCacheObject != null) {
         return $this->_oDbCacheObject;
     } else {
         $sEngine = $this->getParam('sys_db_cache_engine');
         $this->_oDbCacheObject = bx_instance('BxDolCache' . $sEngine);
         if (!$this->_oDbCacheObject->isAvailable()) {
             $this->_oDbCacheObject = bx_instance('BxDolCacheFile');
         }
         return $this->_oDbCacheObject;
     }
 }
 /** 
  * Check module's files hashes. For system files use @see BxDolInstallerHasher class.
  * @param $aFiles current files checksums 
  * @param $iModuleId module id
  * @return empty array on success, or array of files which checksum was changed 
  */
 public function hashCheck($aFiles, $iModuleId)
 {
     $oDb = bx_instance('BxDolStudioInstallerQuery');
     $aFilesOrig = $oDb->getModuleTrackFiles($iModuleId);
     $aFailesChanged = array();
     foreach ($aFiles as $aFile) {
         if (!isset($aFilesOrig[$aFile['file']]) || $aFilesOrig[$aFile['file']]['hash'] != $aFile['hash']) {
             $aFailesChanged[] = $aFile['file'];
         }
     }
     $fChangedPercent = 0;
     if (count($aFilesOrig) != 0) {
         $fChangedPercent = count($aFailesChanged) / count($aFilesOrig);
     }
     return array($aFailesChanged, $fChangedPercent);
 }
Beispiel #18
0
/**
 *  spam checking function
 *  @param $s content to check for spam
 *  @param $isStripSlashes slashes parameter:
 *          BX_SLASHES_AUTO - automatically detect magic_quotes_gpc setting
 *          BX_SLASHES_NO_ACTION - do not perform any action with slashes
 *  @return true if spam detected
 */
function bx_is_spam($val, $isStripSlashes = BX_SLASHES_AUTO)
{
    if (defined('BX_DOL_CRON_EXECUTE')) {
        return false;
    }
    if (isAdmin()) {
        return false;
    }
    if (bx_is_ip_whitelisted()) {
        return false;
    }
    if (get_magic_quotes_gpc() && $isStripSlashes == BX_SLASHES_AUTO) {
        $val = stripslashes($val);
    }
    $bRet = false;
    if ('on' == getParam('sys_uridnsbl_enable')) {
        $oBxDolDNSURIBlacklists = bx_instance('BxDolDNSURIBlacklists');
        if ($oBxDolDNSURIBlacklists->isSpam($val)) {
            $oBxDolDNSURIBlacklists->onPositiveDetection($val);
            $bRet = true;
        }
    }
    if ('on' == getParam('sys_akismet_enable')) {
        $oBxDolAkismet = bx_instance('BxDolAkismet');
        if ($oBxDolAkismet->isSpam($val)) {
            $oBxDolAkismet->onPositiveDetection($val);
            $bRet = true;
        }
    }
    if ($bRet && 'on' == getParam('sys_antispam_report')) {
        bx_import('BxDolEmailTemplates');
        $oEmailTemplates = new BxDolEmailTemplates();
        $aTemplate = $oEmailTemplates->getTemplate('t_SpamReportAuto', 0);
        $iProfileId = getLoggedId();
        $aPlus = array('SpammerUrl' => getProfileLink($iProfileId), 'SpammerNickName' => getNickName($iProfileId), 'Page' => htmlspecialchars_adv($_SERVER['PHP_SELF']), 'Get' => print_r($_GET, true), 'SpamContent' => htmlspecialchars_adv($val));
        sendMail($GLOBALS['site']['email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
    }
    if ($bRet && 'on' == getParam('sys_antispam_block')) {
        return true;
    }
    return false;
}
 private function getVersionUpgradeAvailable()
 {
     $oUpgrader = bx_instance('BxDolUpgrader');
     $aUpdateInfo = $oUpgrader->getVersionUpdateInfo();
     $mixedVersion = $oUpgrader->isNewVersionAvailable($aUpdateInfo) ? $aUpdateInfo['latest_version'] : false;
     $bUpgrade = $oUpgrader->isUpgradeAvailable($aUpdateInfo);
     return array($mixedVersion, $bUpgrade);
 }
 function actionView($sName)
 {
     $sUri = $this->_oConfig->getUri();
     $oPage = bx_instance($this->_oConfig->getClassPrefix() . 'PageView', array($sName, $this), $this->_aModule);
     $aParams = array('index' => 1, 'js' => array('main.js'), 'css' => array('view.css', 'cmts.css'), 'content' => array('page_main_code' => $this->_oTemplate->getViewJs(true) . $oPage->getCode()));
     $this->_oTemplate->getPageCode($aParams);
 }
Beispiel #21
0
 /**
  * Get member menu item - add content
  *
  * @return html with generated menu item
  */
 function serviceGetMemberMenuItemAddContent()
 {
     if (!$this->isAllowedPostAdd()) {
         return '';
     }
     $oMemberMenu = bx_instance('BxDolMemberMenu');
     $aLinkInfo = array('item_img_src' => 'book', 'item_img_alt' => _t('_bx_blog_post'), 'item_link' => BX_DOL_URL_ROOT . (getParam('permalinks_blogs') == 'on' ? 'blogs/my_page/add/' : 'modules/boonex/blogs/blogs.php?action=my_page&mode=add'), 'item_title' => _t('_bx_blog_post'));
     return $oMemberMenu->getGetExtraMenuLink($aLinkInfo);
 }
Beispiel #22
0
 /**
  * Get cache object for templates
  * @return cache class instance
  */
 function getTemplatesCacheObject()
 {
     $sCacheEngine = getParam('sys_template_cache_engine');
     $oCacheEngine = bx_instance('BxDolCache' . $sCacheEngine);
     if (!$oCacheEngine->isAvailable()) {
         $oCacheEngine = bx_instance('BxDolCacheFileHtml');
     }
     return $oCacheEngine;
 }
 function serviceGetMemberMenuItemAddContent($sIcon = 'square-o')
 {
     if (!$this->isAllowedAdd()) {
         return '';
     }
     $oMemberMenu = bx_instance('BxDolMemberMenu');
     $aLinkInfo = array('item_img_src' => $sIcon, 'item_img_alt' => _t('_' . $this->_oConfig->getMainPrefix()), 'item_link' => 'javascript:void(0);', 'item_onclick' => "showPopupAnyHtml('" . BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . "upload');", 'item_title' => _t('_' . $this->_oConfig->getMainPrefix()));
     return $oMemberMenu->getGetExtraMenuLink($aLinkInfo);
 }
Beispiel #24
0
    function getBlockCode_AccountControl()
    {
        global $oTemplConfig, $site, $aPreValues;
        //--- Load cache of sys_account_custom_stat_elements ---//
        $aAccountCustomStatElements = $GLOBALS['MySQL']->fromCache('sys_account_custom_stat_elements', 'getAllWithKey', 'SELECT * FROM `sys_account_custom_stat_elements`', 'ID');
        //--- Load cache of sys_stat_member ---//
        $aPQStatisticsElements = $GLOBALS['MySQL']->fromCache('sys_stat_member', 'getAllWithKey', 'SELECT * FROM `sys_stat_member`', 'Type');
        //--- end of loading caches ---//
        //Labels
        $sUsernameC = _t('_NickName');
        $sProfileStatusC = _t('_Profile status');
        $sPresenceC = _t('_Presence');
        $sMembershipC = _t('_Membership2');
        $sLastLoginC = _t('_Last login');
        $sRegistrationC = _t('_Registration');
        $sEmailC = _t('_Email');
        $sGreetedC = _t('_greeted');
        $sGreetedMeC = _t('_Greeted me');
        $sBlockedC = _t('_blocked');
        $sViewedMeC = _t('_Viewed me');
        $sMembersC = ' ' . _t('_Members');
        $sEditProfileInfoC = _t('_Edit profile info');
        $sProfileC = _t('_Profile');
        $sAccountInfoC = _t('_Account Info');
        $sActivityC = _t('_Tracker');
        $sCustomC = _t('_Custom');
        $sMaleIcon = getTemplateIcon('male.png');
        $sFemaleIcon = getTemplateIcon('female.png');
        // Values
        $sUsername = $this->aMemberInfo['NickName'];
        $sUserLink = getProfileLink($this->aMemberInfo['ID']);
        $sOwnerThumb = get_member_thumbnail($this->aMemberInfo['ID'], 'none', true);
        $iYears = age($this->aMemberInfo['DateOfBirth']);
        $sYearsOld = _t('_y/o', $iYears);
        $sProfileIcon = $this->aMemberInfo['Sex'] == 'male' ? $sMaleIcon : $sFemaleIcon;
        $sCustomElements = '';
        $sCountryName = empty($this->aMemberInfo['Country']) ? '' : _t($aPreValues['Country'][$this->aMemberInfo['Country']]['LKey']);
        $sCityName = $this->aMemberInfo['City'];
        $sCountryPic = $this->aMemberInfo['Country'] == '' ? '' : ' <img alt="' . $this->aMemberInfo['Country'] . '" src="' . ($site['flags'] . strtolower($this->aMemberInfo['Country'])) . '.gif"/>';
        $sProfileStatus = _t("__{$this->aMemberInfo['Status']}");
        $sProfileStatusMess = '';
        switch ($this->aMemberInfo['Status']) {
            case 'Unconfirmed':
                $sProfileStatusMess = _t("_ATT_UNCONFIRMED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
                break;
            case 'Approval':
                $sProfileStatusMess = _t("_ATT_APPROVAL", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
                break;
            case 'Active':
                $sProfileStatusMess = _t("_ATT_ACTIVE", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
                break;
            case 'Rejected':
                $sProfileStatusMess = _t("_ATT_REJECTED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
                break;
            case 'Suspended':
                $sProfileStatusMess = _t("_ATT_SUSPENDED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
                break;
        }
        $sMembership = '';
        $sMembStatus = GetMembershipStatus($this->aMemberInfo['ID']);
        $sMembership = <<<EOF
\t<tr class="account_control_tr">
\t\t<td valign=top class="account_control_left">{$sMembershipC}:</td>
\t\t<td valign=top class="account_control_right">
\t\t\t{$sMembStatus}
\t\t</td>
\t</tr>
EOF;
        $oForm = bx_instance('BxDolFormCheckerHelper');
        if (!$this->aMemberInfo['DateLastLogin'] || $this->aMemberInfo['DateLastLogin'] == "0000-00-00 00:00:00") {
            $sLastLogin = '******';
        } else {
            $sLastLoginTS = $oForm->_passDateTime($this->aMemberInfo['DateLastLogin']);
            $sLastLogin = getLocaleDate($sLastLoginTS, BX_DOL_LOCALE_DATE);
        }
        if (!$this->aMemberInfo['DateReg'] || $this->aMemberInfo['DateReg'] == "0000-00-00 00:00:00") {
            $sRegistration = 'never';
        } else {
            $sRegistrationTS = $oForm->_passDateTime($this->aMemberInfo['DateReg']);
            $sRegistration = getLocaleDate($sRegistrationTS, BX_DOL_LOCALE_DATE);
        }
        $sEmail = $this->aMemberInfo['Email'];
        $this->aMemberInfo = getProfileInfo($this->aMemberInfo['ID']);
        //my greeted contacts
        $sMGCSQL = $aPQStatisticsElements['mgc']['SQL'];
        $sMGCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMGCSQL);
        $iGreetedContactsCnt = (int) db_value($sMGCSQL);
        //my greeted me contacts
        $sMGMCSQL = $aPQStatisticsElements['mgmc']['SQL'];
        $sMGMCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMGMCSQL);
        $iGreetedMeContactsCnt = (int) db_value($sMGMCSQL);
        //my blocked contacts
        $sMBCSQL = $aPQStatisticsElements['mbc']['SQL'];
        $sMBCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMBCSQL);
        $iBlockedContactsCnt = (int) db_value($sMBCSQL);
        $iViewedMeContactsCnt = (int) $this->aMemberInfo['Views'];
        $bModuleExists = false;
        $aCustomElements = array();
        $aCustomElements['header5'] = array('type' => 'block_header', 'caption' => $sCustomC, 'collapsable' => true);
        foreach ($aAccountCustomStatElements as $iID => $aMemberStats) {
            $sUnparsedLabel = $aMemberStats['Label'];
            $sUnparsedValue = $aMemberStats['Value'];
            $sLabel = _t($sUnparsedLabel);
            $sUnparsedValue = str_replace('__site_url__', $site['url'], $sUnparsedValue);
            //step 1 - replacements of keys
            $sLblTmpl = '__l_';
            $sTmpl = '__';
            while ($iStartPos = strpos($sUnparsedValue, $sLblTmpl)) {
                $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1);
                if ($iEndPos > $iStartPos) {
                    $sSubstr = substr($sUnparsedValue, $iStartPos + strlen($sLblTmpl), $iEndPos - $iStartPos - strlen($sLblTmpl));
                    $sKeyValue = strtolower(_t('_' . $sSubstr));
                    $sUnparsedValue = str_replace($sLblTmpl . $sSubstr . $sTmpl, $sKeyValue, $sUnparsedValue);
                } else {
                    break;
                }
            }
            //step 2 - replacements of Stat keys
            while (($iStartPos = strpos($sUnparsedValue, $sTmpl, 0)) >= 0) {
                $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1);
                if ($iEndPos > $iStartPos) {
                    $iCustomCnt = 0;
                    $sSubstr = process_db_input(substr($sUnparsedValue, $iStartPos + strlen($sTmpl), $iEndPos - $iStartPos - strlen($sTmpl)), BX_TAGS_STRIP);
                    if ($sSubstr) {
                        $sCustomSQL = $aPQStatisticsElements[$sSubstr]['SQL'];
                        $sCustomSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sCustomSQL);
                        $sCustomSQL = str_replace('__profile_media_define_photo__', _t('_ProfilePhotos'), $sCustomSQL);
                        $sCustomSQL = str_replace('__profile_media_define_music__', _t('_ProfileMusic'), $sCustomSQL);
                        $sCustomSQL = str_replace('__profile_media_define_video__', _t('_ProfileVideos'), $sCustomSQL);
                        $sCustomSQL = str_replace('__member_nick__', process_db_input($this->aMemberInfo['NickName'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), $sCustomSQL);
                        $iCustomCnt = $sCustomSQL != '' ? (int) db_value($sCustomSQL) : '';
                    }
                    $sUnparsedValue = str_replace($sTmpl . $sSubstr . $sTmpl, $iCustomCnt, $sUnparsedValue);
                } else {
                    break;
                }
            }
            $sCustomElements .= <<<EOF
\t<tr class="account_control_tr">
\t    <td class="account_control_left">{$sLabel}: </td>
\t    <td class="account_control_right">
\t\t\t{$sUnparsedValue}
\t\t</td>
\t</tr>
EOF;
            $sTrimmedLabel = trim($sUnparsedLabel, '_');
            $aCustomElements[$sTrimmedLabel] = array('type' => 'custom', 'name' => $sTrimmedLabel, 'content' => '<b>' . $sLabel . ':</b> ' . $sUnparsedValue, 'colspan' => true);
            if (!$bModuleExists) {
                $bModuleExists = true;
            }
        }
        $aCustomElements['header5_end'] = array('type' => 'block_end');
        $sProfileInfoCont = <<<EOF
<div class="infoMain">
\t<div class="memberPic" style="margin-left:0px;padding:0px;text-align:center;width:70px;">
\t\t{$sOwnerThumb}
\t</div>
\t<div class="infoText">
\t\t<div class="infoUnit">
\t\t\t<img src="{$sProfileIcon}" />
\t\t\t{$sYearsOld}
\t\t</div>
\t\t<div class="infoUnit">
\t\t\t{$sCountryPic} {$sCountryName}, {$sCityName}
\t\t</div>
\t\t<div class="infoUnit">
\t\t\t<a href="{$site['url']}pedit.php?ID={$this->aMemberInfo['ID']}">{$sEditProfileInfoC}</a>
\t\t</div>
\t</div>
</div>
<div class="clear_both"></div>
EOF;
        require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolUserStatusView.php';
        $oStatusView = new BxDolUserStatusView();
        $sUserStatus = '';
        if ($oStatusView->aStatuses) {
            foreach ($oStatusView->aStatuses as $sKey => $aItems) {
                $sTitle = _t($aItems['title']);
                $sOnclick = strtolower($this->aMemberInfo['UserStatus']) == strtolower($sKey) ? "" : "onclick=\"if (typeof oBxUserStatus != 'undefined' ) { oBxUserStatus.setUserStatus('{$sKey}', \$(this).parents('ul:first')); \$('#user_status_ac .block_collapse_btn').attr('src', aDolImages['collapse_closed']); \$('#user_status_ac').parent().toggleClass('collapsed').next('tbody').fadeOut(400); location.reload(); }return false\"";
                $aTemplateKeys = array('bx_if:item_img' => array('condition' => true, 'content' => array('item_img_src' => $GLOBALS['oFunctions']->getTemplateIcon($aItems['icon']), 'item_img_alt' => $sTitle, 'item_img_width' => 16, 'item_img_height' => 16)), 'item_link' => 'javascript:void(0)', 'item_onclick' => $sOnclick, 'item_title' => $sTitle, 'extra_info' => null);
                $sUserStatus .= $GLOBALS['oSysTemplate']->parseHtmlByName('account_control_member_status.html', $aTemplateKeys);
            }
        }
        $aForm = array('form_attrs' => array('action' => '', 'method' => 'post'), 'params' => array('remove_form' => true), 'inputs' => array('header1' => array('type' => 'block_header', 'caption' => $sProfileC, 'collapsable' => true), 'Info' => array('type' => 'custom', 'name' => 'Info', 'content' => $sProfileInfoCont, 'colspan' => true), 'header1_end' => array('type' => 'block_end'), 'header2' => array('type' => 'block_header', 'caption' => $sPresenceC, 'collapsable' => true, 'collapsed' => true, 'attrs' => array('id' => 'user_status_ac')), 'UserStatus' => array('type' => 'custom', 'name' => 'Info', 'content' => $sUserStatus, 'colspan' => true), 'header2_end' => array('type' => 'block_end'), 'header3' => array('type' => 'block_header', 'caption' => $sAccountInfoC, 'collapsable' => true), 'Username' => array('type' => 'custom', 'name' => 'Username', 'content' => '<b>' . $sUsernameC . ':</b> <a href="' . $sUserLink . '" >' . $sUsername . '</a>', 'colspan' => true), 'Email' => array('type' => 'custom', 'name' => 'Email', 'content' => '<b>' . $sEmailC . ':</b> ' . $sEmail, 'colspan' => true), 'Status' => array('type' => 'custom', 'name' => 'Status', 'content' => '<b>' . $sProfileStatusC . ':</b> ' . $sProfileStatus . ' ' . $sProfileStatusMess, 'colspan' => true), 'Membership' => array('type' => 'custom', 'name' => 'Membership', 'content' => '<b>' . $sMembershipC . ':</b> ' . $sMembStatus, 'colspan' => true), 'LastLogin' => array('type' => 'custom', 'name' => 'LastLogin', 'content' => '<b>' . $sLastLoginC . ':</b> ' . $sLastLogin, 'colspan' => true), 'Registration' => array('type' => 'custom', 'name' => 'Registration', 'content' => '<b>' . $sRegistrationC . ':</b> ' . $sRegistration, 'colspan' => true), 'header3_end' => array('type' => 'block_end'), 'header4' => array('type' => 'block_header', 'caption' => $sActivityC, 'collapsable' => true), 'ViewedMe' => array('type' => 'custom', 'name' => 'ViewedMe', 'content' => '<b>' . $sViewedMeC . ':</b> ' . _t('_N times', $iViewedMeContactsCnt), 'colspan' => true), 'Blocked' => array('type' => 'custom', 'name' => 'Blocked', 'content' => '<b>' . $sBlockedC . ':</b> ' . $iBlockedContactsCnt . $sMembersC, 'colspan' => true), 'Greeted' => array('type' => 'custom', 'name' => 'Greeted', 'content' => '<b>' . $sGreetedC . ':</b> ' . _t('_N times', $iGreetedContactsCnt), 'colspan' => true), 'GreetedMe' => array('type' => 'custom', 'name' => 'GreetedMe', 'content' => '<b>' . $sGreetedMeC . ':</b> ' . $iGreetedMeContactsCnt . $sMembersC, 'colspan' => true), 'header4_end' => array('type' => 'block_end')));
        //custom
        if ($bModuleExists) {
            $aForm['inputs'] = array_merge($aForm['inputs'], $aCustomElements);
        }
        $oForm = new BxTemplFormView($aForm);
        return '<div class="dbContent">' . $oForm->getCode() . '</div>';
    }
Beispiel #25
0
    function GenCacheEnginesTable()
    {
        $sRet = '<table width="100%" cellspacing="1" cellpadding="0" class="install_table">';
        $sRet .= '
<tr class="head troubled">
    <td></td>
    <td class="center_aligned">' . _t('_sys_adm_installed') . '</td>
    <td class="center_aligned">' . _t('_sys_adm_cache_support') . '</td>
</tr>';
        $aEngines = array('File', 'Memcache', 'APC', 'XCache');
        foreach ($aEngines as $sEngine) {
            $oCacheObject = @bx_instance('BxDolCache' . $sEngine);
            $sRet .= '
<tr class="head troubled">
    <td class="left_aligned">' . $sEngine . '</td>
    <td class="center_aligned">' . (@$oCacheObject->isInstalled() ? '<font color="green">' . _t('_Yes') . '</font>' : '<font color="red">' . _t('_No') . '</font>') . '</td>
    <td class="center_aligned">' . (@$oCacheObject->isAvailable() ? '<font color="green">' . _t('_Yes') . '</font>' : '<font color="red">' . _t('_No') . '</font>') . '</td>
</tr>';
        }
        $sRet .= '</table>';
        return $sRet;
    }
Beispiel #26
0
 function _serviceGetMemberMenuItem($sTitle, $sAlt, $sIcon, $isExtraCount = true, $sLinkAppend = '')
 {
     if (!$this->_iProfileId) {
         return '';
     }
     $oMemberMenu = bx_instance('BxDolMemberMenu');
     $aLinkInfo = array('item_img_src' => $sIcon, 'item_img_alt' => $sAlt, 'item_link' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'browse/my/' . $sLinkAppend, 'item_title' => $sTitle, 'extra_info' => $isExtraCount ? $this->_oDb->getCountByAuthorAndStatus($this->_iProfileId, 'approved') + $this->_oDb->getCountByAuthorAndStatus($this->_iProfileId, 'pending') : '');
     return $oMemberMenu->getGetExtraMenuLink($aLinkInfo);
 }
Beispiel #27
0
 function serviceGetMemberMenuItem()
 {
     $oMemberMenu = bx_instance('BxDolMemberMenu');
     $aLanguageKeys = array('wall' => _t('_wall_pc_view'));
     // fill all necessary data;
     $aLinkInfo = array('item_img_src' => 'time', 'item_img_alt' => $aLanguageKeys['wall'], 'item_link' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri(), 'item_onclick' => null, 'item_title' => $aLanguageKeys['wall'], 'extra_info' => null);
     return $oMemberMenu->getGetExtraMenuLink($aLinkInfo);
 }
 function getBlockCode_AccountControl()
 {
     global $oTemplConfig, $aPreValues;
     //Labels
     $sProfileStatusC = _t('_Profile status');
     $sPresenceC = _t('_Presence');
     $sMembershipC = _t('_Membership2');
     $sLastLoginC = _t('_Last login');
     $sRegistrationC = _t('_Registration');
     $sEmailC = _t('_Email');
     $sMembersC = ' ' . _t('_Members');
     $sProfileC = _t('_Profile');
     $sContentC = _t('_Content');
     //--- General Info block ---//
     $sProfileStatus = _t("__{$this->aMemberInfo['Status']}");
     $sProfileStatusMess = '';
     switch ($this->aMemberInfo['Status']) {
         case 'Unconfirmed':
             $sProfileStatusMess = _t("_ATT_UNCONFIRMED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
             break;
         case 'Approval':
             $sProfileStatusMess = _t("_ATT_APPROVAL", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
             break;
         case 'Active':
             $sProfileStatusMess = _t("_ATT_ACTIVE", $this->aMemberInfo['ID'], $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
             break;
         case 'Rejected':
             $sProfileStatusMess = _t("_ATT_REJECTED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
             break;
         case 'Suspended':
             $sProfileStatusMess = _t("_ATT_SUSPENDED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
             break;
     }
     $oForm = bx_instance('BxDolFormCheckerHelper');
     $sMembStatus = GetMembershipStatus($this->aMemberInfo['ID']);
     $sLastLogin = '******';
     if (!empty($this->aMemberInfo['DateLastLogin']) && $this->aMemberInfo['DateLastLogin'] != "0000-00-00 00:00:00") {
         $sLastLoginTS = $oForm->_passDateTime($this->aMemberInfo['DateLastLogin']);
         $sLastLogin = getLocaleDate($sLastLoginTS, BX_DOL_LOCALE_DATE);
     }
     $sRegistration = 'never';
     if (!empty($this->aMemberInfo['DateReg']) && $this->aMemberInfo['DateReg'] != "0000-00-00 00:00:00") {
         $sRegistrationTS = $oForm->_passDateTime($this->aMemberInfo['DateReg']);
         $sRegistration = getLocaleDate($sRegistrationTS, BX_DOL_LOCALE_DATE);
     }
     //--- Presence block ---//
     require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolUserStatusView.php';
     $oStatusView = new BxDolUserStatusView();
     $sUserStatus = $oStatusView->getMemberMenuStatuses();
     //--- Content block ---//
     $aAccountCustomStatElements = $GLOBALS['MySQL']->fromCache('sys_account_custom_stat_elements', 'getAllWithKey', 'SELECT * FROM `sys_account_custom_stat_elements`', 'ID');
     $aPQStatisticsElements = $GLOBALS['MySQL']->fromCache('sys_stat_member', 'getAllWithKey', 'SELECT * FROM `sys_stat_member`', 'Type');
     $aCustomElements = array();
     foreach ($aAccountCustomStatElements as $iID => $aMemberStats) {
         $sUnparsedLabel = $aMemberStats['Label'];
         $sUnparsedValue = $aMemberStats['Value'];
         $sLabel = _t($sUnparsedLabel);
         $sUnparsedValue = str_replace('__site_url__', BX_DOL_URL_ROOT, $sUnparsedValue);
         //step 1 - replacements of keys
         $sLblTmpl = '__l_';
         $sTmpl = '__';
         while (($iStartPos = strpos($sUnparsedValue, $sLblTmpl)) !== false) {
             $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1);
             if ($iEndPos <= $iStartPos) {
                 break;
             }
             $sSubstr = substr($sUnparsedValue, $iStartPos + strlen($sLblTmpl), $iEndPos - $iStartPos - strlen($sLblTmpl));
             $sKeyValue = mb_strtolower(_t('_' . $sSubstr));
             $sUnparsedValue = str_replace($sLblTmpl . $sSubstr . $sTmpl, $sKeyValue, $sUnparsedValue);
         }
         //step 2 - replacements of Stat keys
         while (($iStartPos = strpos($sUnparsedValue, $sTmpl, 0)) !== false) {
             $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1);
             if ($iEndPos <= $iStartPos) {
                 break;
             }
             $iCustomCnt = 0;
             $sSubstr = process_db_input(substr($sUnparsedValue, $iStartPos + strlen($sTmpl), $iEndPos - $iStartPos - strlen($sTmpl)), BX_TAGS_STRIP);
             if ($sSubstr) {
                 $sCustomSQL = $aPQStatisticsElements[$sSubstr]['SQL'];
                 $sCustomSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sCustomSQL);
                 $sCustomSQL = str_replace('__profile_media_define_photo__', _t('_ProfilePhotos'), $sCustomSQL);
                 $sCustomSQL = str_replace('__profile_media_define_music__', _t('_ProfileMusic'), $sCustomSQL);
                 $sCustomSQL = str_replace('__profile_media_define_video__', _t('_ProfileVideos'), $sCustomSQL);
                 $sCustomSQL = str_replace('__member_nick__', process_db_input($this->aMemberInfo['NickName'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), $sCustomSQL);
                 $iCustomCnt = $sCustomSQL != '' ? (int) db_value($sCustomSQL) : '';
             }
             $sUnparsedValue = str_replace($sTmpl . $sSubstr . $sTmpl, $iCustomCnt, $sUnparsedValue);
         }
         $sTrimmedLabel = trim($sUnparsedLabel, '_');
         $aCustomElements[$sTrimmedLabel] = array('type' => 'custom', 'name' => $sTrimmedLabel, 'content' => '<b>' . $sLabel . ':</b> ' . $sUnparsedValue, 'colspan' => true);
     }
     $aForm = array('form_attrs' => array('action' => '', 'method' => 'post'), 'params' => array('remove_form' => true), 'inputs' => array('header1' => array('type' => 'block_header', 'caption' => $sProfileC, 'collapsable' => true), 'Info' => array('type' => 'custom', 'name' => 'Info', 'content' => get_member_thumbnail($this->aMemberInfo['ID'], 'none', true), 'colspan' => true), 'Status' => array('type' => 'custom', 'name' => 'Status', 'content' => '<b>' . $sProfileStatusC . ':</b> ' . $sProfileStatus . '<br />' . $sProfileStatusMess, 'colspan' => true), 'Email' => array('type' => 'custom', 'name' => 'Email', 'content' => '<b>' . $sEmailC . ':</b> ' . $this->aMemberInfo['Email'] . '<br />' . _t('_sys_txt_ac_manage_subscriptions'), 'colspan' => true), 'Membership' => array('type' => 'custom', 'name' => 'Membership', 'content' => '<b>' . $sMembershipC . ':</b> ' . $sMembStatus, 'colspan' => true), 'LastLogin' => array('type' => 'custom', 'name' => 'LastLogin', 'content' => '<b>' . $sLastLoginC . ':</b> ' . $sLastLogin, 'colspan' => true), 'Registration' => array('type' => 'custom', 'name' => 'Registration', 'content' => '<b>' . $sRegistrationC . ':</b> ' . $sRegistration, 'colspan' => true), 'header1_end' => array('type' => 'block_end'), 'header2' => array('type' => 'block_header', 'caption' => $sPresenceC, 'collapsable' => true, 'collapsed' => true, 'attrs' => array('id' => 'user_status_ac')), 'UserStatus' => array('type' => 'custom', 'name' => 'Info', 'content' => $sUserStatus, 'colspan' => true), 'header2_end' => array('type' => 'block_end')));
     //custom
     if (!empty($aCustomElements)) {
         $aForm['inputs'] = array_merge($aForm['inputs'], array('header5' => array('type' => 'block_header', 'caption' => $sContentC, 'collapsable' => true, 'collapsed' => true)), $aCustomElements, array('header5_end' => array('type' => 'block_end')));
     }
     $oForm = new BxTemplFormView($aForm);
     $sContent = $GLOBALS['oSysTemplate']->parseHtmlByName('member_account_control.html', array('content' => $oForm->getCode()));
     return array($sContent, array(), array(), false);
 }
 function getMemberThumbnail($iId, $sFloat = 'none', $bGenProfLink = false, $sForceSex = 'visitor', $isAutoCouple = true, $sType = 'medium', $aOnline = array(), $sTmplSfx = '')
 {
     $aProfile = getProfileInfo($iId);
     if (!$aProfile) {
         return '';
     }
     $bOnline = 0;
     $bCouple = (int) $aProfile['Couple'] > 0 && $isAutoCouple ? true : false;
     $bThumb1 = $bThumb2 = false;
     $sThumbUrl = $sThumbTwiceUrl = $sThumbUrlCouple = $sThumbTwiceUrlCouple = '';
     $sThumbSetting = getParam($sType == 'small' ? 'sys_member_info_thumb_icon' : 'sys_member_info_thumb');
     bx_import('BxDolMemberInfo');
     $o = BxDolMemberInfo::getObjectInstance($sThumbSetting);
     $sThumbUrl = $o ? $o->get($aProfile) : '';
     if (!empty($sThumbUrl)) {
         $o = BxDolMemberInfo::getObjectInstance($sThumbSetting . '_2x');
         $sThumbTwiceUrl = $o ? $o->get($aProfile) : '';
         if (!$sThumbTwiceUrl) {
             $sThumbTwiceUrl = $sThumbUrl;
         }
     }
     $bThumb1 = !empty($sThumbUrl) && !empty($sThumbTwiceUrl);
     $sLink = '';
     $sUserTitle = '';
     $sUserInfo = '';
     $oUserStatusView = bx_instance('BxDolUserStatusView');
     $sStatusIcon = $oUserStatusView->getStatusIcon($iId, 'icon8');
     if ($iId > 0) {
         $sLink = getProfileLink($iId);
         $sUserTitle = $this->getUserTitle($iId);
         $sUserInfo = $this->getUserInfo($iId);
         if (empty($aOnline) || 0 != (int) $aOnline['is_online']) {
             $bOnline = 1;
         }
     }
     if (!$bGenProfLink) {
         if ($sForceSex != 'visitor') {
             $sUserTitle = _t('_Vacant');
             $sLink = 'javascript:void(0)';
         }
     }
     if ($bCouple) {
         $aProfileCouple = getProfileInfo($aProfile['Couple']);
         $o = BxDolMemberInfo::getObjectInstance($sThumbSetting);
         $sThumbUrlCouple = $o ? $o->get($aProfileCouple) : '';
         if (!empty($sThumbUrlCouple)) {
             $o = BxDolMemberInfo::getObjectInstance($sThumbSetting . '_2x');
             $sThumbTwiceUrl = $o ? $o->get($aProfileCouple) : '';
             if (!$sThumbTwiceUrlCouple) {
                 $sThumbTwiceUrlCouple = $sThumbUrlCouple;
             }
         }
         $bThumb2 = !empty($sThumbUrlCouple) && !empty($sThumbTwiceUrlCouple);
     }
     return $GLOBALS['oSysTemplate']->parseHtmlByName($bCouple ? 'thumbnail_couple' . $sTmplSfx . '.html' : 'thumbnail_single' . $sTmplSfx . '.html', array('iProfId' => $iId ? $iId : 0, 'sys_thb_float' => $sFloat, 'classes_add' => ($bGenProfLink ? ' thumbnail_block_with_info' : '') . ($sType != 'medium' ? ' thumbnail_block_icon' : ''), 'sys_status_icon' => $sStatusIcon, 'sys_status_title' => $oUserStatusView->getStatus($iId), 'usr_profile_url' => $sLink, 'bx_if:show_thumbnail_image1' => array('condition' => $bThumb1, 'content' => array('usr_thumb_url0' => $sThumbUrl, 'usr_thumb_url0_2x' => $sThumbTwiceUrl)), 'bx_if:show_thumbnail_image2' => array('condition' => $bThumb2, 'content' => array('usr_thumb_url1' => $sThumbUrlCouple, 'usr_thumb_url1_2x' => $sThumbTwiceUrlCouple)), 'bx_if:show_thumbnail_letter1' => array('condition' => !$bThumb1, 'content' => array('letter' => mb_substr($sUserTitle, 0, 1))), 'bx_if:show_thumbnail_letter2' => array('condition' => !$bThumb2, 'content' => array('letter' => mb_substr($sUserTitle, 0, 1))), 'usr_thumb_title0' => $sUserTitle, 'bx_if:profileLink' => array('condition' => $bGenProfLink, 'content' => array('user_title' => $sUserTitle, 'user_info' => $sUserInfo, 'usr_profile_url' => $sLink))));
 }
 public function onPositiveDetection($sExtraData = '')
 {
     $o = bx_instance('BxDolDNSBlacklists');
     $o->onPositiveDetection(getVisitorIP(false), $sExtraData, 'stopforumspam');
 }