function displayList($aParams) { $sSampleType = $aParams['sample_type']; $iViewerType = $aParams['viewer_type']; $iStart = isset($aParams['start']) ? (int) $aParams['start'] : -1; $iPerPage = isset($aParams['count']) ? (int) $aParams['count'] : -1; $bShowEmpty = isset($aParams['show_empty']) ? $aParams['show_empty'] : true; $sModuleUri = $this->_oConfig->getUri(); $aEntries = $this->_oDb->getEntries($aParams); if (empty($aEntries)) { return $bShowEmpty ? MsgBox(_t('_' . $sModuleUri . '_msg_no_results')) : ""; } $sBaseUri = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri(); $sJsMainObject = $this->_oConfig->getJsObject(); $sList = ''; foreach ($aEntries as $aEntry) { $sList .= $this->displayItem($aParams, $aEntry); } $sPaginate = ''; if (!in_array($sSampleType, array('id', 'uri', 'view', 'search_unit'))) { if (!empty($sSampleType)) { $this->_updatePaginate($aParams); } $sPaginate = $this->oPaginate->getPaginate($iStart, $iPerPage); } return $this->parseHtmlByName('list.html', array('sample' => $sSampleType, 'list' => $sList, 'paginate' => $sPaginate, 'loading' => LoadingBox($sModuleUri . '-' . $sSampleType . '-loading'))); }
/** * page code function */ function PageCompMainCode() { ob_start(); $oAccount = BxDolAccount::getInstance(); $aAccountInfo = $oAccount ? $oAccount->getInfo() : false; if (!$aAccountInfo) { return DesignBoxContent("Send Email example", 'Please login first', BX_DB_PADDING_DEF); } echo "<h2>Account info</h2>"; echo "Email: " . $aAccountInfo['email'] . '<br />'; echo "Email Confirmed: " . ($aAccountInfo['email_confirmed'] ? 'yes' : 'no') . '<br />'; echo "Receive site updates: " . ($aAccountInfo['receive_updates'] ? 'yes' : 'no') . '<br />'; echo "Receive site newsletters: " . ($aAccountInfo['receive_news'] ? 'yes' : 'no') . '<br />'; echo "Site emails are sent from: " . getParam('site_email_notify') . '<br />'; $a = array('sys' => array('title' => "Send me system email", 'type' => BX_EMAIL_SYSTEM, 'subj' => 'System Email', 'body' => 'This is system email <br /> {unsubscribe}'), 'notif' => array('title' => "Send me notification", 'type' => BX_EMAIL_NOTIFY, 'subj' => 'Notification Email', 'body' => 'This is notification email<br /> {unsubscribe}'), 'mass' => array('title' => "Send me bulk email", 'type' => BX_EMAIL_MASS, 'subj' => 'Bulk Email', 'body' => 'This is bulk email<br /> {unsubscribe}')); $sSendMail = bx_get('send'); if ($sSendMail && isset($a[$sSendMail])) { echo "<h2>Send Email Result</h2>"; $r = $a[$sSendMail]; if (sendMail($aAccountInfo['email'], $r['subj'], $r['body'], 0, array(), $r['type'])) { echo MsgBox($r['subj'] . ' - successfully sent'); } else { echo MsgBox($r['subj'] . ' - sent failed'); } } echo "<h2>Send email</h2>"; foreach ($a as $k => $r) { echo '<a href="samples/email.php?send=' . $k . '">' . $r['title'] . '</a><br />'; } return DesignBoxContent("Send Email Example", ob_get_clean(), BX_DB_PADDING_DEF); }
/** * SERVICE METHODS * * Get View block for a separate page. Will return a block with "Empty" message if nothing found. */ public function serviceGetBlockView($sType = '', $iStart = -1, $iPerPage = -1, $aModules = array()) { $aBrowseTypes = array(BX_BASE_MOD_NTFS_TYPE_CONNECTIONS, BX_BASE_MOD_NTFS_TYPE_OBJECT_OWNER); if (empty($sType)) { $mType = bx_get('type'); if ($mType !== false && in_array($mType, $aBrowseTypes)) { $sType = $mType; } if (empty($sType)) { $sType = BX_NTFS_TYPE_DEFAULT; } } $iOwnerId = $this->getUserId(); if (!$iOwnerId) { return array('content' => MsgBox(_t('_bx_ntfs_txt_msg_no_results'))); } $aParams = $this->_prepareParams($sType, $iOwnerId, $iStart, $iPerPage, $aModules); $sContent = $this->_oTemplate->getViewBlock($aParams); $aParams['browse'] = 'first'; $aEvent = $this->_oDb->getEvents($aParams); if (!empty($aEvent)) { $this->_oDb->markAsRead($iOwnerId, $aEvent['id']); } $sModule = $this->_oConfig->getName(); $sJsObject = $this->_oConfig->getJsObject('view'); $aMenu = array(); foreach ($aBrowseTypes as $sBrowseType) { $aMenu[] = array('id' => $sModule . '-' . $sBrowseType, 'name' => $sModule . '-' . $sBrowseType, 'class' => '', 'title' => '_bx_ntfs_menu_item_title_' . $sBrowseType, 'target' => '_self', 'onclick' => 'javascript:' . $sJsObject . '.changeType(this, \'' . $sBrowseType . '\');'); } $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id' => $sModule . '-browse-types', 'menu_items' => $aMenu), $this->_oTemplate); $oMenu->setSelected($sModule, $sModule . '-' . $sType); return array('content' => $sContent, 'menu' => $oMenu); }
function actionAdministration() { if (!$this->isAdmin()) { $this->_oTemplate->displayAccessDenied(); return; } $this->_oTemplate->pageStart(); $iId = $this->_oDb->getSettingsCategory(); if (empty($iId)) { echo MsgBox(_t('_sys_request_page_not_found_cpt')); $this->_oTemplate->pageCodeAdmin(_t('_bx_profiler_administration')); return; } bx_import('BxDolAdminSettings'); $mixedResult = ''; if (isset($_POST['save']) && isset($_POST['cat'])) { $oSettings = new BxDolAdminSettings($iId); $mixedResult = $oSettings->saveChanges($_POST); } $oSettings = new BxDolAdminSettings($iId); $sResult = $oSettings->getForm(); if ($mixedResult !== true && !empty($mixedResult)) { $sResult = $mixedResult . $sResult; } $aVars = array('content' => $sResult); echo $this->_oTemplate->adminBlock($this->_oTemplate->parseHtmlByName('default_padding', $aVars), _t('_bx_profiler_administration')); $this->_oTemplate->addCssAdmin('main.css'); $this->_oTemplate->addCssAdmin('forms_adv.css'); $this->_oTemplate->pageCodeAdmin(_t('_bx_profiler_administration')); }
function getPostForm($iUnitID = 0) { $sAddNewC = _t('_bx_quotes_add_new'); $sAction = 'add'; $sQText = $sQText = ''; if ($iUnitID) { $aQinfo = $this->_oDb->getQuote($iUnitID); $sQText = $aQinfo['Text']; $sQAuthor = $aQinfo['Author']; $sAction = 'edit'; } $aForm = array('form_attrs' => array('name' => 'create_quotes_form', 'action' => BX_DOL_URL_ROOT . 'modules/?r=quotes/administration/', 'method' => 'post'), 'params' => array('db' => array('table' => 'bx_quotes_units', 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('action' => array('type' => 'hidden', 'name' => 'action', 'value' => $sAction), 'Text' => array('type' => 'textarea', 'name' => 'Text', 'caption' => _t('_bx_quotes_text'), 'required' => true, 'value' => $sQText, 'checker' => array('func' => 'length', 'params' => array(3, 1024), 'error' => _t('_bx_quotes_text_err', 1024)), 'db' => array('pass' => 'Xss')), 'Author' => array('type' => 'text', 'name' => 'Author', 'caption' => _t('_bx_quotes_author'), 'required' => true, 'value' => $sQAuthor, 'checker' => array('func' => 'length', 'params' => array(3, 128), 'error' => _t('_bx_quotes_author_err', 128)), 'db' => array('pass' => 'Xss')), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => _t('_Submit')))); if ($iUnitID) { $aForm['inputs']['hidden_unitid'] = array('type' => 'hidden', 'name' => 'ID', 'value' => $iUnitID); } $sCode = ''; $oForm = new BxTemplFormView($aForm); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { $sCode = MsgBox(_t('_bx_quotes_fail'), 1); $aValsAdd = array(); $iLastId = -1; if ($iUnitID > 0) { $oForm->update($iUnitID, $aValsAdd); $iLastId = $iUnitID; $sCode = MsgBox(_t('_bx_quotes_edited_success'), 1); } else { $iLastId = $oForm->insert($aValsAdd); $sCode = MsgBox(_t('_bx_quotes_success'), 1); } } return DesignBoxAdmin($sAddNewC, $sCode . $oForm->getCode(), '', '', 11); }
function getFormCode() { $oForm = new BxTemplFormView($this->aForm); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { $aValsAdd = array('Date' => time(), 'Uri' => $oForm->generateUri(), 'Status' => 'active', 'Owner' => $this->iOwnerId); if ($this->iAlbumId > 0 && $this->aInfo['Owner'] == $this->iOwnerId) { $aValsAdd = array('Date' => time()); if (!$oForm->update($this->iAlbumId, $aValsAdd)) { return MsgBox(_t('_sys_album_save_error')); } else { return MsgBox(_t('_sys_album_save_succ')); } } else { $iAlbumId = $oForm->insert($aValsAdd); if (!$iAlbumId) { return MsgBox(_t('_sys_album_save_error')); } else { return MsgBox(_t('_sys_album_save_succ')); } } } else { return $oForm->getCode(); } }
function getBlockCode_Favorited($aParams = array()) { $sEmpty = MsgBox(_t('_Empty')); if ($this->iOwnerId == 0) { return $sEmpty; } $sUnitCssClass = isset($aParams['unit_css_class']) ? $aParams['unit_css_class'] : '.sys_file_search_unit'; $oSearch = $this->getSearchObject(); $oSearch->clearFilters(array('activeStatus', 'allow_view', 'album_status', 'albumType', 'ownerStatus'), array('albumsObjects', 'albums', 'icon')); if (isset($oSearch->aAddPartsConfig['favorite']) && !empty($oSearch->aAddPartsConfig['favorite'])) { $oSearch->aCurrent['join']['favorite'] = $oSearch->aAddPartsConfig['favorite']; $oSearch->aCurrent['restriction']['fav'] = array('value' => $this->iOwnerId, 'field' => $oSearch->aAddPartsConfig['favorite']['userField'], 'operator' => '=', 'table' => $oSearch->aAddPartsConfig['favorite']['table']); } $oSearch->aCurrent['paginate']['perPage'] = (int) $this->oConfig->getGlParam('number_top'); $sCode = $oSearch->displayResultBlock(); if (!empty($sUnitCssClass)) { $sCode = $GLOBALS['oFunctions']->centerContent($sCode, $sUnitCssClass); } if ($oSearch->aCurrent['paginate']['totalNum'] > 0) { $oSearch->aConstants['linksTempl']['favorited'] = 'browse/favorited'; $aBottomMenu = $oSearch->getBottomMenu('favorited', 0, ''); return array($sCode, array(), $aBottomMenu, false); } else { return array($sEmpty, array(), array(), ''); } }
function actionAuth() { $oRequest = OAuth2\Request::createFromGlobals(); $oResponse = new OAuth2\Response(); // validate the authorize request if (!$this->_oServer->validateAuthorizeRequest($oRequest, $oResponse)) { require_once BX_DIRECTORY_PATH_INC . 'design.inc.php'; $o = json_decode($oResponse->getResponseBody()); $this->_oTemplate->getPage(false, MsgBox($o->error_description)); } if (!isLogged()) { require_once BX_DIRECTORY_PATH_INC . 'design.inc.php'; $sForceRelocate = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'auth/?client_id=' . bx_get('client_id') . '&response_type=' . bx_get('response_type') . '&state=' . bx_get('state') . '&redirect_uri=' . bx_get('redirect_uri'); bx_login_form(false, false, $sForceRelocate); return; } $aProfiles = BxDolAccount::getInstance()->getProfiles(); if (!($iProfileId = $this->_oDb->getSavedProfile($aProfiles)) && empty($_POST)) { $oPage = BxDolPage::getObjectInstanceByURI('oauth-authorization'); $this->_oTemplate->getPage(false, $oPage->getCode()); return; } if (!$iProfileId) { $iProfileId = bx_get('profile_id'); } $this->_oServer->handleAuthorizeRequest($oRequest, $oResponse, (bool) $iProfileId, $iProfileId); $oResponse->send(); }
function displayOrders($sType, $aParams) { if (empty($aParams['per_page'])) { $aParams['per_page'] = $this->_oConfig->getPerPage('orders'); } $sJsObject = $this->_oConfig->getJsObject('orders'); $sMethodNameInfo = 'get' . ucfirst($sType) . 'Orders'; $aOrders = $this->_oDb->{$sMethodNameInfo}($aParams); if (empty($aOrders)) { return MsgBox(_t('_payment_txt_empty')); } $aAdministrator = $this->_oDb->getVendorInfoProfile(BX_PMT_ADMINISTRATOR_ID); //--- Get Orders ---// $aResultOrders = array(); foreach ($aOrders as $aOrder) { if (empty($aOrder['user_id']) || empty($aOrder['user_name'])) { $aOrder['user_name'] = $aAdministrator['profile_name']; $aOrder['user_url'] = $aAdministrator['profile_url']; } else { $aOrder['user_name'] = getNickName($aOrder['user_id']); $aOrder['user_url'] = getProfileLink($aOrder['user_id']); } $aResultOrders[] = array_merge($aOrder, array('type' => $sType, 'bx_if:show_link' => array('condition' => !empty($aOrder['user_url']), 'content' => array('user_name' => $aOrder['user_name'], 'user_url' => $aOrder['user_url'])), 'bx_if:show_text' => array('condition' => empty($aOrder['user_url']), 'content' => array('user_name' => $aOrder['user_name'])), 'bx_if:pending' => array('condition' => $sType == BX_PMT_ORDERS_TYPE_PENDING, 'content' => array('id' => $aOrder['id'], 'order' => $aOrder['order'])), 'bx_if:processed' => array('condition' => $sType == BX_PMT_ORDERS_TYPE_PROCESSED || $sType == BX_PMT_ORDERS_TYPE_HISTORY, 'content' => array('order' => $aOrder['order'])), 'products' => $aOrder['products'], 'items' => $aOrder['items'], 'js_object' => $sJsObject)); } //--- Get Paginate Panel ---// $sPaginatePanel = ""; $sMethodNameCount = 'get' . ucfirst($sType) . 'OrdersCount'; if (($iCount = $this->_oDb->{$sMethodNameCount}($aParams)) > $aParams['per_page']) { $oPaginate = new BxDolPaginate(array('page_url' => 'javascript:void(0);', 'start' => $aParams['start'], 'count' => $iCount, 'per_page' => $aParams['per_page'], 'per_page_step' => 2, 'per_page_interval' => 3, 'page_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . ($sType == BX_PMT_ORDERS_TYPE_HISTORY ? 'history' : 'orders') . '/', 'on_change_page' => $sJsObject . ".changePage('" . $sType . "', {start}, {per_page}, " . $aParams['seller_id'] . ")")); $sPaginatePanel = $oPaginate->getPaginate(); } return $this->parseHtmlByName($sType . '_orders.html', array('bx_repeat:orders' => $aResultOrders, 'paginate_panel' => $sPaginatePanel)); }
function PageCompPageMainCodeWithForm() { global $oTemplConfig, $site; $aForm = array('form_attrs' => array('id' => 'post_us_form', 'action' => BX_DOL_URL_ROOT . 'contact.php', 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array('name' => array('type' => 'text', 'name' => 'name', 'caption' => _t('_Your name'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 150), 'error' => _t('_Name is required'))), 'email' => array('type' => 'text', 'name' => 'email', 'caption' => _t('_Your email'), 'required' => true, 'checker' => array('func' => 'email', 'error' => _t('_Incorrect Email'))), 'message_subject' => array('type' => 'text', 'name' => 'subject', 'caption' => _t('_message_subject'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(5, 300), 'error' => _t('_ps_ferr_incorrect_length'))), 'message_text' => array('type' => 'textarea', 'name' => 'body', 'caption' => _t('_Message text'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(10, 5000), 'error' => _t('_ps_ferr_incorrect_length'))), 'captcha' => array('type' => 'captcha', 'caption' => _t('_Enter what you see'), 'name' => 'securityImageValue', 'required' => true, 'checker' => array('func' => 'captcha', 'error' => _t('_Incorrect Captcha'))), 'submit' => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit')))); $oForm = new BxTemplFormView($aForm); $sForm = $oForm->getCode(); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { $sSenderName = process_pass_data($_POST['name'], BX_TAGS_STRIP); $sSenderEmail = process_pass_data($_POST['email'], BX_TAGS_STRIP); $sLetterSubject = process_pass_data($_POST['subject'], BX_TAGS_STRIP); $sLetterBody = process_pass_data($_POST['body'], BX_TAGS_STRIP); $sLetterBody = $sLetterBody . "\r\n" . '============' . "\r\n" . _t('_from') . ' ' . $sSenderName . "\r\n" . 'with email ' . $sSenderEmail; if (sendMail($site['email'], $sLetterSubject, $sLetterBody)) { $sActionKey = '_ADM_PROFILE_SEND_MSG'; } else { $sActionKey = '_Email sent failed'; } $sActionText = MsgBox(_t($sActionKey)); $sForm = $sActionText . $sForm; } else { $sForm = $oForm->getCode(); } return DesignBoxContent(_t('_CONTACT_H1'), $sForm, $oTemplConfig->PageCompThird_db_num); }
/** * page code function */ function PageCompMainCode() { global $oTemplConfig; global $logged; $iId = (int) $_COOKIE['memberID']; if ($iId > 0) { $sPassword = getPassword($iId); $bEnableRay = getParam('enable_ray') == 'on'; $check_res = checkAction($iId, ACTION_ID_USE_RAY_CHAT); if ($bEnableRay && $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) { $ret .= getApplicationContent('chat', 'user', array('id' => $iId, 'password' => $sPassword)); } else { // $ret .= ' // <center> // <table width=100% height=100% cellpadding=0 cellspacing=0> // <td align=center valign=center> // <table width="90%" height="70" cellpadding="5" cellspacing="1" class="table"> // <tr> // <td class="panel" width="100%" align="center" valign="middle"> // <div align="center" class="small">' . $check_res[CHECK_ACTION_MESSAGE] . '</div> // </td> // </tr> // </table> // </td> // </table> // </center>'; $ret .= MsgBox($check_res[CHECK_ACTION_MESSAGE]); } return DesignBoxContent(_t("_RAY_CHAT"), $ret, $oTemplConfig->PageCompThird_db_num); } else { return DesignBoxContent(_t('_LOGIN_ERROR'), MsgBox(_t('_Please login before using Ray chat')), 1); } }
function _getList($mixedResult, $bActive = false) { $aForm = array('form_attrs' => array('id' => 'adm-email-templates', 'action' => $GLOBALS['site']['url_admin'] . 'email_templates.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_email_templates', 'key' => 'ID', 'uri' => '', 'uri_title' => '', 'submit_name' => 'adm-emial-templates-save')), 'inputs' => array()); $aLanguages = $GLOBALS['MySQL']->getAll("SELECT `ID` AS `id`, `Title` AS `title` FROM `sys_localization_languages`"); $aLanguageChooser = array(array('key' => 0, 'value' => 'default')); foreach ($aLanguages as $aLanguage) { $aLanguageChooser[] = array('key' => $aLanguage['id'], 'value' => $aLanguage['title']); } $sLanguageCpt = _t('_adm_txt_email_language'); $sSubjectCpt = _t('_adm_txt_email_subject'); $sBodyCpt = _t('_adm_txt_email_body'); $aEmails = $GLOBALS['MySQL']->getAll("SELECT `ID` AS `id`, `Name` AS `name`, `Subject` AS `subject`, `Body` AS `body`, `Desc` AS `description` FROM `sys_email_templates` WHERE `LangID`='0' ORDER BY `ID`"); foreach ($aEmails as $aEmail) { $aForm['inputs'] = array_merge($aForm['inputs'], array($aEmail['name'] . '_Beg' => array('type' => 'block_header', 'caption' => $aEmail['description'], 'collapsable' => true, 'collapsed' => true), $aEmail['name'] . '_Language' => array('type' => 'select', 'name' => $aEmail['name'] . '_Language', 'caption' => $sLanguageCpt, 'value' => 0, 'values' => $aLanguageChooser, 'db' => array('pass' => 'Int'), 'attrs' => array('onchange' => "javascript:getTranslations(this)")), $aEmail['name'] . '_Subject' => array('type' => 'text', 'name' => $aEmail['name'] . '_Subject', 'caption' => $sSubjectCpt, 'value' => $aEmail['subject'], 'db' => array('pass' => 'Xss')), $aEmail['name'] . '_Body' => array('type' => 'textarea', 'name' => $aEmail['name'] . '_Body', 'caption' => $sBodyCpt, 'value' => $aEmail['body'], 'db' => array('pass' => 'XssHtml')), $aEmail['name'] . '_End' => array('type' => 'block_end'))); } $aForm['inputs']['adm-emial-templates-save'] = array('type' => 'submit', 'name' => 'adm-emial-templates-save', 'value' => _t('_adm_btn_email_save')); $oForm = new BxTemplFormView($aForm); $oForm->initChecker(); $sResult = ""; if ($oForm->isSubmittedAndValid()) { $iResult = 0; foreach ($aEmails as $aEmail) { $iEmailId = (int) $GLOBALS['MySQL']->getOne("SELECT `ID` FROM `sys_email_templates` WHERE `Name`='" . process_db_input($aEmail['name']) . "' AND `LangID`='" . (int) $_POST[$aEmail['name'] . '_Language'] . "' LIMIT 1"); if ($iEmailId != 0) { $iResult += (int) $GLOBALS['MySQL']->query("UPDATE `sys_email_templates` SET `Subject`='" . process_db_input($_POST[$aEmail['name'] . '_Subject']) . "', `Body`='" . process_db_input($_POST[$aEmail['name'] . '_Body']) . "' WHERE `ID`='" . $iEmailId . "'"); } else { $iResult += (int) $GLOBALS['MySQL']->query("INSERT INTO `sys_email_templates` SET `Name`='" . process_db_input($aEmail['name']) . "', `Subject`='" . process_db_input($_POST[$aEmail['name'] . '_Subject']) . "', `Body`='" . process_db_input($_POST[$aEmail['name'] . '_Body']) . "', `LangID`='" . (int) $_POST[$aEmail['name'] . '_Language'] . "'"); } } $bActive = true; $sResult .= MsgBox(_t($iResult > 0 ? "_adm_txt_email_success_save" : "_adm_txt_email_nothing_changed"), 3); } $sResult .= $oForm->getCode(); return $GLOBALS['oAdmTemplate']->parseHtmlByName('email_templates_list.html', array('display' => $bActive ? 'block' : 'none', 'content' => stripslashes($sResult), 'loading' => LoadingBox('adm-email-loading'))); }
/** * page code function */ function PageCompPageMainCode($iID, $sConfCode) { global $site; $ID = (int) $iID; $ConfCode = clear_xss($sConfCode); $p_arr = getProfileInfo($ID); if (!$p_arr) { $_page['header'] = _t("_Error"); $_page['header_text'] = _t("_Profile Not found"); return MsgBox(_t('_Profile Not found Ex')); } $aCode = array('message_status' => '', 'message_info' => '', 'bx_if:form' => array('condition' => false, 'content' => array('form' => '')), 'bx_if:next' => array('condtion' => false, 'content' => array('next_url' => ''))); if ($p_arr['Status'] == 'Unconfirmed') { $ConfCodeReal = base64_encode(base64_encode(crypt($p_arr[Email], CRYPT_EXT_DES ? "secret_co" : "se"))); if (strcmp($ConfCode, $ConfCodeReal) != 0) { $aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'profile_activate.php', 'method' => 'post', 'name' => 'form_change_status'), 'inputs' => array('conf_id' => array('type' => 'hidden', 'name' => 'ConfID', 'value' => $ID), 'conf_code' => array('type' => 'text', 'name' => 'ConfCode', 'value' => '', 'caption' => _t("_Confirmation code")), 'submit' => array('type' => 'submit', 'name' => 'submit', 'value' => _t("_Submit")))); $oForm = new BxTemplFormView($aForm); $aCode['message_status'] = _t("_Profile activation failed"); $aCode['message_info'] = _t("_EMAIL_CONF_FAILED_EX"); $aCode['bx_if:form']['condition'] = true; $aCode['bx_if:form']['content']['form'] = $oForm->getCode(); } else { $aCode['bx_if:next']['condition'] = true; $aCode['bx_if:next']['content']['next_url'] = BX_DOL_URL_ROOT . 'member.php'; $send_act_mail = false; if (getParam('autoApproval_ifJoin') == 'on' && !(getParam('sys_dnsbl_enable') && 'approval' == getParam('sys_dnsbl_behaviour') && bx_is_ip_dns_blacklisted('', 'join'))) { $status = 'Active'; $send_act_mail = true; $aCode['message_info'] = _t("_PROFILE_CONFIRM"); } else { $status = 'Approval'; $aCode['message_info'] = _t("_EMAIL_CONF_SUCCEEDED", $site['title']); } $update = bx_admin_profile_change_status($ID, $status, $send_act_mail); // Promotional membership if (getParam('enable_promotion_membership') == 'on') { $memership_days = getParam('promotion_membership_days'); setMembership($p_arr['ID'], MEMBERSHIP_ID_PROMOTION, $memership_days, true); } // check couple profile; if ($p_arr['Couple']) { $update = bx_admin_profile_change_status($p_arr['Couple'], $status); //Promotional membership if (getParam('enable_promotion_membership') == 'on') { $memership_days = getParam('promotion_membership_days'); setMembership($p_arr['Couple'], MEMBERSHIP_ID_PROMOTION, $memership_days, true); } } if (getParam('newusernotify')) { $oEmailTemplates = new BxDolEmailTemplates(); $aTemplate = $oEmailTemplates->getTemplate('t_UserConfirmed', $p_arr['ID']); sendMail($site['email_notify'], $aTemplate['Subject'], $aTemplate['Body'], $p_arr['ID']); } } } else { $aCode['message_info'] = _t('_ALREADY_ACTIVATED'); } return $GLOBALS['oSysTemplate']->parseHtmlByName('profile_activate.html', $aCode); }
function displayResultBlock() { $sResult = parent::displayResultBlock(); if (empty($sResult)) { $sResult = MsgBox(_t('_Empty')); } return $sResult; }
protected function onDataDeleteAfter($iContentId, $aContentInfo, $oProfile) { // delete profile if (!$oProfile->delete($aContentInfo['profile_id'])) { return MsgBox(_t('_sys_txt_error_entry_delete')); } return ''; }
function getMySubscriptions() { $aUserInfo = getProfileInfo(); $aSubscriptions = $this->_oDb->getSubscriptionsByUser((int) $aUserInfo['ID']); if (empty($aSubscriptions)) { return MsgBox(_t('_Empty')); } $aForm = array('form_attrs' => array('id' => 'sbs-subscriptions-form', 'name' => 'sbs-subscriptions-form', 'action' => bx_html_attribute($_SERVER['PHP_SELF']), 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array(), 'inputs' => array()); $sUnit = ''; $bCollapsed = true; foreach ($aSubscriptions as $aSubscription) { if ($sUnit != $aSubscription['unit']) { if (!empty($sUnit)) { $aForm['inputs'][$sUnit . '_end'] = array('type' => 'block_end'); } $aForm['inputs'][$aSubscription['unit'] . '_begin'] = array('type' => 'block_header', 'caption' => _t('_sbs_txt_title_' . $aSubscription['unit']), 'collapsable' => true, 'collapsed' => $bCollapsed); $sUnit = $aSubscription['unit']; $bCollapsed = true; } $oFunction = create_function('$arg1, $arg2, $arg3', $aSubscription['params']); $aParams = $oFunction($aSubscription['unit'], $aSubscription['action'], $aSubscription['object_id']); $sName = 'sbs-subscription_' . $aSubscription['entry_id']; $aForm['inputs'][$sName] = array('type' => 'custom', 'name' => $sName, 'content' => '<a href="' . $aParams['template']['ViewLink'] . '">' . $aParams['template']['Subscription'] . '</a> <a href="javascript:void(0)" onclick="return unsubscribeConfirm(\'' . $this->_getUnsubscribeLink((int) $aSubscription['entry_id']) . '\');">' . _t('_sys_btn_sbs_unsubscribe') . '</a>', 'colspan' => true); } //'' . . '' $aForm['inputs'][$sUnit . '_end'] = array('type' => 'block_end'); $oForm = new BxTemplFormView($aForm); $sContent = $oForm->getCode(); $GLOBALS['oSysTemplate']->addJsTranslation('_sbs_wrn_unsubscribe'); ob_start(); ?> <script language="javascript" type="text/javascript"> <!-- function unsubscribeConfirm(sUrl){ if(confirm(_t('_sbs_wrn_unsubscribe'))) { $.get( sUrl + '&js=1', {}, function(oData){ alert(oData.message); if(oData.code == 0) window.location.href = window.location.href; }, 'json' ); return true; } else return false; } --> </script> <?php $sContent .= ob_get_clean(); return $sContent; }
function PageCodeSubscribers($oSubscription) { $iStart = bx_get('start') !== false ? (int) bx_get('start') : 0; $iPerPage = 20; $oPaginate = new BxDolPaginate(array('start' => $iStart, 'per_page' => $iPerPage, 'count' => $oSubscription->getSubscribersCount(), 'page_url' => $GLOBALS['site']['url_admin'] . 'manage_subscribers.php?start={start}')); $sControls = BxTemplSearchResult::showAdminActionsPanel('adm-ms-form', array('adm-ms-delete' => _t('_adm_btn_ms_delete')), 'members'); $aSubscribers = $oSubscription->getSubscribers(BX_DOL_SBS_TYPE_VISITOR, $iStart, $iPerPage); return $GLOBALS['oAdmTemplate']->parseHtmlByName('manage_subscribers.html', array('bx_repeat:items' => is_array($aSubscribers) && !empty($aSubscribers) ? $aSubscribers : MsgBox(_t('_Empty')), 'paginate' => $oPaginate->getPaginate(), 'controls' => $sControls)); }
function serviceChatBlock() { if (!getParam('bx_chat_plus_url')) { return array(MsgBox(_t('_bx_chat_plus_not_configured'))); } $this->_oTemplate->addCss('main.css'); $s = $this->_oTemplate->parseHtmlByName('chat_block.html', array('chat_url' => getParam('bx_chat_plus_url'))); return array($s, array(_t('_bx_chat_plus_open_in_separate_window') => array('href' => getParam('bx_chat_plus_url'), 'target' => '_blank', 'active' => true)), false, false, 'getChatBlockMenu'); }
function displayResultBlock() { $sResult = parent::displayResultBlock(); $sModuleUri = $this->_oModule->_oConfig->getUri(); if ($this->aCurrent['paginate']['totalNum'] == 0) { $sResult = MsgBox(_t('_' . $sModuleUri . '_msg_no_results')); } return $sResult; }
function setSettings($aData) { $iId = (int) $this->_oDb->getOne("SELECT `ID` FROM `sys_options_cats` WHERE `name`='Timeline'"); if (empty($iId)) { return MsgBox(_t('_wall_msg_no_results')); } $oSettings = new BxDolAdminSettings($iId); return $oSettings->saveChanges($_POST); }
function displayResultBlock() { $sResult = parent::displayResultBlock(); $sModuleUri = $this->_oModule->_oConfig->getUri(); if ($this->aCurrent['paginate']['totalNum'] == 0) { $sResult = MsgBox(_t('_' . $sModuleUri . '_msg_no_results')); } return $this->_oModule->_oTemplate->parseHtmlByName('default_margin.html', array('content' => $sResult)); }
function savepages() { global $nc; runTweak('on-save-pages'); $pagesdata = serialize($nc); if (!put2file(PAGES_DETAILS_FILE, $pagesdata)) { MsgBox(lt("file writing error"), 'redbox'); } }
function getCode() { if (!empty($this->_sOwner)) { $aOwner = $this->_oWall->_oDb->getUser($this->_sOwner, 'username'); if ((int) $aOwner['id'] == 0) { return MsgBox(_t('_wall_msg_page_not_found')); } } return parent::getCode(); }
function getBlockCode_ViewAll() { bx_sites_import('SearchResult'); $oSearchResult = new BxSitesSearchResult('home'); if ($s = $oSearchResult->displayResultBlock(true, true)) { return array($s, array(_t('RSS') => array('href' => $this->_oConfig->getBaseUri() . 'browse/all?rss=1', 'target' => '_blank', 'icon' => 'rss')), array(), true); } else { return MsgBox(_t('_Empty')); } }
/** * page code function */ function PageCompPageMainCode() { if ($_POST['DELETE']) { profile_delete(getLoggedId()); bx_logout(); return MsgBox(_t("_DELETE_SUCCESS")); } $aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'unregister.php', 'method' => 'post', 'name' => 'form_unregister'), 'inputs' => array('delete' => array('type' => 'hidden', 'name' => 'DELETE', 'value' => '1'), 'info' => array('type' => 'custom', 'content' => _t("_DELETE_TEXT"), 'colspan' => true), 'submit' => array('type' => 'submit', 'name' => 'submit', 'value' => _t("_Delete account")))); $oForm = new BxTemplFormView($aForm); return $oForm->getCode(); }
function displayList($aParams) { $sSampleType = $aParams['sample_type']; $iViewerType = $aParams['viewer_type']; $iStart = isset($aParams['start']) ? (int) $aParams['start'] : -1; $iPerPage = isset($aParams['count']) ? (int) $aParams['count'] : -1; $bShowEmpty = isset($aParams['show_empty']) ? $aParams['show_empty'] : true; $bAdminPanel = $iViewerType == BX_TD_VIEWER_TYPE_ADMIN && (isset($aParams['admin_panel']) && $aParams['admin_panel'] || $sSampleType == 'admin'); $sModuleUri = $this->_oConfig->getUri(); $aEntries = $this->_oDb->getEntries($aParams); if (empty($aEntries)) { return $bShowEmpty ? MsgBox(_t('_' . $sModuleUri . '_msg_no_results')) : ""; } $oTags = new BxDolTags(); $oCategories = new BxDolCategories(); //--- Language translations ---// $sLKLinkPublish = _t('_' . $sModuleUri . '_lcaption_publish'); $sLKLinkEdit = _t('_' . $sModuleUri . '_lcaption_edit'); $sLKLinkDelete = _t('_' . $sModuleUri . '_lcaption_delete'); $sBaseUri = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri(); $sJsMainObject = $this->_oConfig->getJsObject(); $aResult['sample'] = $sSampleType; $aResult['bx_repeat:entries'] = array(); foreach ($aEntries as $aEntry) { $sVotes = ""; if ($this->_oConfig->isVotesEnabled()) { $oVotes = $this->_oModule->_createObjectVoting($aEntry['id']); $sVotes = $oVotes->getJustVotingElement(0, $aEntry['id']); } $aTags = $oTags->explodeTags($aEntry['tags']); $aCategories = $oCategories->explodeTags($aEntry['categories']); $aTagItems = array(); foreach ($aTags as $sTag) { $sTag = trim($sTag); $aTagItems[] = array('href' => $sBaseUri . 'tag/' . title2uri($sTag), 'title' => $sTag); } $aCategoryItems = array(); foreach ($aCategories as $sCategory) { $sCategory = trim($sCategory); $aCategoryItems[] = array('href' => $sBaseUri . 'category/' . title2uri($sCategory), 'title' => $sCategory); } $aResult['bx_repeat:entries'][] = array('id' => $this->_oConfig->getSystemPrefix() . $aEntry['id'], 'caption' => str_replace("\$", "$", $aEntry['caption']), 'class' => !in_array($sSampleType, array('view')) ? ' ' . $this->sCssPrefix . '-text-snippet' : '', 'date' => getLocaleDate($aEntry['when_uts'], BX_DOL_LOCALE_DATE), 'comments' => (int) $aEntry['cmts_count'], 'bx_repeat:categories' => $aCategoryItems, 'bx_repeat:tags' => $aTagItems, 'content' => str_replace("\$", "$", $aEntry['content']), 'link' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aEntry['uri'], 'voting' => $sVotes, 'bx_if:checkbox' => array('condition' => $bAdminPanel, 'content' => array('id' => $aEntry['id'])), 'bx_if:status' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN, 'content' => array('status' => _t('_' . $sModuleUri . '_status_' . $aEntry['status']))), 'bx_if:featured' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN && (int) $aEntry['featured'] == 1, 'content' => array()), 'bx_if:edit_link' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN, 'content' => array('edit_link_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'admin/' . $aEntry['uri'], 'edit_link_caption' => $sLKLinkEdit))); } $aResult['paginate'] = ''; if (!in_array($sSampleType, array('id', 'uri', 'view', 'search_unit'))) { if (!empty($sSampleType)) { $this->_updatePaginate($aParams); } $aResult['paginate'] = $this->oPaginate->getPaginate($iStart, $iPerPage); } $aResult['loading'] = LoadingBox($sModuleUri . '-' . $sSampleType . '-loading'); $sRes = $this->parseHtmlByName('list.html', $aResult); return $sRes; }
function getAvailableLevelsBlock() { if (!$this->isLogged()) { return MsgBox(_t('_membership_err_required_login')); } $aMembership = $this->_oDb->getMembershipsBy(array('type' => 'price_all')); if (empty($aMembership)) { return MsgBox(_t('_membership_txt_empty')); } return $this->_oTemplate->displayAvailableLevels($aMembership); }
function getBlockCode_Add() { if (!$this->_oMain->isAllowedAdd()) { return MsgBox(_t('_Access denied')); } ob_start(); $this->_oMain->_addForm(BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'browse/my'); $aVars = array('form' => ob_get_clean()); $this->_oTemplate->addCss('forms_extra.css'); return $this->_oTemplate->parseHtmlByName('my_events_create_event', $aVars); }
function savepages() { global $NANO; runTweak('on-save-pages'); $pagesdata = serialize($NANO); if (!put2file(PAGES_DETAILS_FILE, $pagesdata)) { MsgBox(lt("File writing error"), 'redbox'); return false; } return true; }
function getBlockCode_ViewRate() { bx_sites_import('SearchResult'); $oSearchResult = new BxSitesSearchResult('hon_rate'); $oSearchResult->sUnitName = 'hon'; $oSearchResult->sUnitTemplate = 'block_hon'; if ($s = $oSearchResult->displayResultBlock()) { return $s; } else { return MsgBox(_t('_Empty')); } }