function getListTemplate($sCurrent)
 {
     $sOutputCode = "";
     $aTemplates = get_templates_array();
     if (count($aTemplates) < 2) {
         return $sOutputCode;
     }
     $sGetTransfer = bx_encode_url_params($_GET, array('skin'));
     $aTmplVars = array();
     foreach ($aTemplates as $sName => $sTitle) {
         $aTmplVars[] = array('bx_if:show_icon' => array('condition' => false, 'content' => array()), 'class' => $sName == $sCurrent ? 'sys-bm-sub-item-selected' : '', 'link' => bx_html_attribute($_SERVER['PHP_SELF']) . '?' . $sGetTransfer . 'skin=' . $sName, 'onclick' => '', 'title' => $sTitle);
     }
     $sOutputCode .= $GLOBALS['oSysTemplate']->parseHtmlByName('extra_bottom_menu_sub_items.html', array('name_method' => 'Template', 'name_block' => 'template', 'bx_repeat:items' => $aTmplVars));
     return PopupBox('sys-bm-switcher-template', _t('_sys_bm_popup_cpt_design'), $sOutputCode);
 }
 public function performActionEdit()
 {
     $oTemplate = BxDolStudioTemplate::getInstance();
     $aIds = bx_get('ids');
     if (!$aIds || !is_array($aIds)) {
         $iId = (int) bx_get('id');
         if (!$iId) {
             $this->_echoResultJson(array());
             exit;
         }
         $aIds = array($iId);
     }
     $iId = $aIds[0];
     $sAction = 'edit';
     $aLanguages = array();
     $iLanguages = $this->oDb->getLanguagesBy(array('type' => 'all_key_id'), $aLanguages);
     $aKey = $this->oDb->getKeyFullInfo($iId);
     $aForm = array('form_attrs' => array('id' => 'adm-lang-edit-key-form', 'action' => BX_DOL_URL_ROOT . 'grid.php?' . bx_encode_url_params($_GET, array('ids', '_r')), 'method' => 'post'), 'params' => array('db' => array('table' => 'sys_localization_keys', 'key' => 'ID', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('id' => array('type' => 'hidden', 'name' => 'id', 'value' => $iId, 'db' => array('pass' => 'Int'))));
     foreach ($aLanguages as $aLanguage) {
         $sName = 'language_' . $aLanguage['id'];
         $aForm['inputs'][$sName] = array('type' => 'textarea', 'name' => $sName, 'caption' => $aLanguage['title'], 'value' => isset($aKey['strings'][$aLanguage['name']]) ? $aKey['strings'][$aLanguage['name']]['string'] : '', 'db' => array('pass' => 'XssHtml'));
     }
     $aForm['inputs'] = array_merge($aForm['inputs'], array('languages' => array('type' => 'hidden', 'name' => 'languages', 'value' => implode(',', array_keys($aLanguages)), 'db' => array('pass' => 'Xss')), 'controls' => array('name' => 'controls', 'type' => 'input_set', array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_adm_pgt_btn_nkp_save')), array('type' => 'reset', 'name' => 'close', 'value' => _t('_adm_pgt_btn_nkp_close'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
     $oForm = new BxTemplStudioFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $mixedResult = $this->edit($oForm);
         if (is_int($mixedResult)) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $mixedResult);
         } else {
             $aRes = array('msg' => $mixedResult);
         }
         $this->_echoResultJson($aRes, true);
     } else {
         $sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-lang-edit-key-popup', _t('_adm_pgt_txt_nkp_edit_popup', $aKey['key']), $this->_oTemplate->parseHtmlByName('pgt_new_key.html', array('form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
         $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
Example #3
0
function templates_select_txt()
{
    $templ_choices = get_templates_array();
    $current_template = strlen($_GET['skin']) ? $_GET['skin'] : $_COOKIE['skin'];
    foreach ($templ_choices as $tmpl_key => $tmpl_value) {
        if ($current_template == $tmpl_key) {
            $ReturnResult .= $tmpl_value . ' | ';
        } else {
            $sGetTransfer = bx_encode_url_params($_GET, array('skin'));
            $ReturnResult .= '<a href="' . bx_html_attribute($_SERVER['PHP_SELF']) . '?' . $sGetTransfer . 'skin=' . $tmpl_key . '">' . $tmpl_value . '</a> | ';
        }
    }
    return $ReturnResult;
}
 /**
  * @description : function will generate friends list ;
  * @return		: array ;
  */
 function getBlockCode_Friends()
 {
     // init some variables ;
     $sOutputHtml = '';
     $sEmpty = '';
     $iIndex = '';
     $aUsedTemplates = array('browse_searched_block.html');
     // lang keys ;
     $sPhotoCaption = _t('_With photos only');
     $sOnlineCaption = _t('_online only');
     // collect the SQL parameters ;
     $aWhereParam = array();
     if ($this->aDisplayParameters['photos']) {
         $aWhereParam[] = 'p.`Avatar` <> 0';
     }
     if ($this->aDisplayParameters['online']) {
         $aWhereParam[] = "(p.`DateLastNav` > SUBDATE(NOW(), INTERVAL " . $this->iMemberOnlineTime . " MINUTE)) ";
     }
     $sWhereParam = null;
     foreach ($aWhereParam as $sValue) {
         if ($sValue) {
             $sWhereParam .= ' AND ' . $sValue;
         }
     }
     $iTotalNum = getFriendNumber($this->iProfileID, 1, 0, $sWhereParam);
     if (!$iTotalNum) {
         $sEmpty = MsgBox(_t('_Empty'));
     }
     $iPerPage = $this->aDisplayParameters['per_page'];
     $iCurPage = $this->aDisplayParameters['page'];
     $sLimitFrom = ($iCurPage - 1) * $iPerPage;
     $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}";
     // switch member's template ;
     $sTemplateName = $this->aDisplayParameters['mode'] == 'extended' ? 'search_profiles_ext.html' : 'search_profiles_sim.html';
     // select the sorting parameters ;
     $sSortParam = 'activity_desc';
     if (isset($this->aDisplayParameters['sort'])) {
         switch ($this->aDisplayParameters['sort']) {
             case 'activity':
                 $sSortParam = 'activity_desc';
                 break;
             case 'date_reg':
                 $sSortParam = 'date_reg_desc';
                 break;
             case 'rate':
                 $sSortParam = 'rate';
                 break;
             default:
                 $this->aDisplayParameters['sort'] = 'activity';
                 break;
         }
     } else {
         $this->aDisplayParameters['sort'] = 'activity';
     }
     $aAllFriends = getMyFriendsEx($this->iProfileID, $sWhereParam, $sSortParam, $sqlLimit);
     $aExtendedCss = array('ext_css_class' => $this->aDisplayParameters['mode'] == 'extended' ? 'search_filled_block' : '');
     foreach ($aAllFriends as $iFriendID => $aFriendsPrm) {
         $aMemberInfo = getProfileInfo($iFriendID);
         if ($aMemberInfo['Couple']) {
             $aCoupleInfo = getProfileInfo($aMemberInfo['Couple']);
             $sOutputHtml .= $this->oSearchProfileTmpl->PrintSearhResult($aMemberInfo, $aCoupleInfo, $iIndex % 2 ? $aExtendedCss : array(), $sTemplateName);
         } else {
             $sOutputHtml .= $this->oSearchProfileTmpl->PrintSearhResult($aMemberInfo, array(), $iIndex % 2 ? $aExtendedCss : array(), $sTemplateName);
         }
         $iIndex++;
     }
     $sOutputHtml .= '<div class="clear_both"></div>';
     // work with link pagination ;
     $aGetParams = array('mode', 'iUser', 'photos_only', 'online_only');
     $sRequest = BX_DOL_URL_ROOT . 'viewFriends.php?';
     $sRequest .= bx_encode_url_params($_GET, array(), $aGetParams) . 'page={page}&per_page={per_page}&sort={sorting}';
     // gen pagination block ;
     $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $iTotalNum, 'per_page' => $iPerPage, 'page' => $iCurPage, 'sorting' => $this->aDisplayParameters['sort']));
     $sPagination = $oPaginate->getPaginate();
     // ** GENERATE HEADER PART ;
     // gen per page block ;
     $sPerPageBlock = $oPaginate->getPages($iPerPage);
     // fill array with sorting params ;
     $aSortingParam = array('activity' => _t('_Latest activity'), 'date_reg' => _t('_FieldCaption_DateReg_View'), 'rate' => _t('_Rate'));
     // gen sorting block ( type of : drop down ) ;
     $sSortBlock = $oPaginate->getSorting($aSortingParam);
     $sRequest = str_replace('{page}', '1', $sRequest);
     $sRequest = str_replace('{per_page}', $iPerPage, $sRequest);
     $sRequest = str_replace('{sorting}', $this->aDisplayParameters['sort'], $sRequest);
     // init some visible parameters ;
     $sPhotosChecked = $this->aDisplayParameters['photos'] ? 'checked="checked"' : null;
     $sOnlineChecked = $this->aDisplayParameters['online'] ? 'checked="checked"' : null;
     // link for photos section ;
     $sPhotoLocation = $this->getCutParam('photos_only', $sRequest);
     // link for online section ;
     $sOnlineLocation = $this->getCutParam('online_only', $sRequest);
     // link for `mode switcher` ;
     $sModeLocation = $this->getCutParam('mode', $sRequest);
     $sModeLocation = $this->getCutParam('per_page', $sModeLocation);
     bx_import('BxDolMemberInfo');
     $oMemberInfo = BxDolMemberInfo::getObjectInstance(getParam('sys_member_info_thumb'));
     $sTopControls = $GLOBALS['oSysTemplate']->parseHtmlByName('browse_sb_top_controls.html', array('sort_block' => $sSortBlock, 'bx_if:show_with_photos' => array('condition' => $oMemberInfo->isAvatarSearchAllowed(), 'content' => array('photo_checked' => $sPhotosChecked, 'photo_location' => $sPhotoLocation, 'photo_caption' => $sPhotoCaption)), 'online_checked' => $sOnlineChecked, 'online_location' => $sOnlineLocation, 'online_caption' => $sOnlineCaption, 'per_page_block' => $sPerPageBlock));
     // build template ;
     $sOutputHtml = $GLOBALS['oSysTemplate']->parseHtmlByName($aUsedTemplates[0], array('top_controls' => $sTopControls, 'bx_if:show_sim_css' => array('condition' => $this->aDisplayParameters['mode'] != 'extended', 'content' => array()), 'bx_if:show_ext_css' => array('condition' => $this->aDisplayParameters['mode'] == 'extended', 'content' => array()), 'searched_data' => $sOutputHtml, 'pagination' => $sPagination));
     // build the toggle block ;
     $aToggleItems = array('' => _t('_Simple'), 'extended' => _t('_Extended'));
     foreach ($aToggleItems as $sKey => $sValue) {
         $aToggleEllements[$sValue] = array('href' => $sModeLocation . '&mode=' . $sKey, 'dynamic' => true, 'active' => $this->aDisplayParameters['mode'] == $sKey);
     }
     return array($sOutputHtml . $sEmpty, $aToggleEllements, array(), true);
 }
 /**
  * redirect to the correct url after switching skin ot language
  * only correct modules urls are supported
  */
 function redirectIfNecessary($aSkip = array())
 {
     $sCurrentUrl = $_SERVER['PHP_SELF'] . '?' . bx_encode_url_params($_GET, $aSkip);
     if (!preg_match('/modules\\/index.php\\?r=(\\w+)(.*)/', $sCurrentUrl, $m)) {
         return false;
     }
     $sStandardLink = 'modules/?r=' . $m[1] . '/';
     $sPermalink = $this->permalink($sStandardLink);
     if (false !== strpos($sCurrentUrl, $sPermalink)) {
         return false;
     }
     header("HTTP/1.1 301 Moved Permanently");
     header('Location:' . BX_DOL_URL_ROOT . $sPermalink . rtrim(trim(urldecode($m[2]), '/'), '&'));
     send_headers_page_changed();
     return true;
 }
Example #6
0
 * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
 * CC-BY License - http://creativecommons.org/licenses/by/3.0/
 */
define('BX_PROFILE_PAGE', 1);
require_once 'inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
bx_import('BxTemplProfileView');
bx_import('BxDolInstallerUtils');
$profileID = getID($_GET['ID']);
$memberID = getLoggedId();
$sCodeLang = 'lang';
$sCodeTempl = $GLOBALS['oSysTemplate']->getCodeKey();
if (isset($_GET[$sCodeLang]) || isset($_GET[$sCodeTempl])) {
    $sCurrentUrl = $_SERVER['PHP_SELF'] . '?' . bx_encode_url_params($_GET, array($sCodeLang, $sCodeTempl));
    $aMatch = array();
    if (preg_match('/profile.php\\?ID=([a-zA-Z0-9_-]+)(.*)/', $sCurrentUrl, $aMatch)) {
        header("HTTP/1.1 301 Moved Permanently");
        header('Location:' . getProfileLink($profileID));
        send_headers_page_changed();
    }
}
// check profile membership, status, privacy and if it is exists
bx_check_profile_visibility($profileID, $memberID);
// make profile view alert and record profile view event
if ($profileID != $memberID) {
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php';
    $oAlert = new BxDolAlerts('profile', 'view', $profileID, $memberID);
    $oAlert->alert();
    bx_import('BxDolViews');
Example #7
0
 /**
  * Profile block with events user joined
  * @param $iProfileId profile id
  * @return html to display on homepage in a block
  */
 function serviceProfileBlockJoined($iProfileId)
 {
     $iProfileId = (int) $iProfileId;
     $aProfile = getProfileInfo($iProfileId);
     bx_import('PageMain', $this->_aModule);
     $o = new BxEventsPageMain($this);
     $o->sUrlStart = $_SERVER['PHP_SELF'] . '?' . bx_encode_url_params($_GET, array('page'));
     return $o->ajaxBrowse('joined', $this->_oDb->getParam('bx_events_perpage_profile'), array(), process_db_input($aProfile['NickName'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), true, false);
 }
Example #8
0
 function __construct($oModule)
 {
     $aCustomForm = array('form_attrs' => array('id' => 'bx-oauth-add', 'name' => 'bx-oauth-add', 'action' => BX_DOL_URL_ROOT . 'grid.php?' . bx_encode_url_params($_GET, array('ids', '_r')), 'method' => 'post'), 'params' => array('db' => array('table' => 'bx_oauth_clients', 'key' => 'id', 'submit_name' => 'client_add')), 'inputs' => array('title' => array('type' => 'text', 'name' => 'title', 'caption' => _t('_Title'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('_sys_adm_form_err_required_field')), 'db' => array('pass' => 'Xss')), 'redirect_uri' => array('type' => 'text', 'name' => 'redirect_uri', 'caption' => _t('_bx_oauth_client_url'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('_sys_adm_form_err_required_field')), 'db' => array('pass' => 'Xss')), 'Submit' => array('type' => 'input_set', 0 => array('type' => 'submit', 'name' => 'client_add', 'value' => _t('_Submit')), 1 => array('type' => 'reset', 'name' => 'close', 'value' => _t('Close'), 'attrs' => array('onclick' => "\$('.bx-popup-active').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
     parent::__construct($aCustomForm);
 }
Example #9
0
 function genMoreLanguagesElement()
 {
     $aExistedLanguages = getLangsArr();
     if (count($aExistedLanguages) <= 1) {
         return;
     }
     $sCurLanguage = strlen($_GET['lang']) ? $_GET['lang'] : $_COOKIE['lang'];
     $sLanguageElement = '';
     foreach ($aExistedLanguages as $sLanguageID => $sLanguageVal) {
         $sIActiveClass = $sCurLanguage == $sLanguageID ? ' active' : '';
         $sLanguageUrl = '';
         if ($sCurLanguage == $sLanguageID) {
             $sLanguageUrl = 'javascript: void(0)';
         } else {
             $sGetTransfer = bx_encode_url_params($_GET, array('lang'));
             $sLanguageUrl = bx_html_attribute($_SERVER['PHP_SELF']) . '?' . $sGetTransfer . 'lang=' . $sLanguageID;
         }
         $sLanguageElement .= '<li><a href="' . $sLanguageUrl . '" value="' . $sLanguageVal . '" class="button more_ntop_element' . $sIActiveClass . '">' . $sLanguageVal . '</a>';
     }
     if ($sLanguageElement == '') {
         return;
     }
     return array('icon_url' => getTemplateIcon('tm_item_languages.png'), 'element_content' => $sLanguageElement);
 }
Example #10
0
 /**
  * 'add' action handler
  */
 public function performActionAdd()
 {
     $sAction = 'add';
     $aForm = array('form_attrs' => array('id' => 'sample-add-form', 'action' => 'grid.php?' . bx_encode_url_params($_GET, array('ids', '_r')), 'method' => 'post'), 'params' => array('db' => array('table' => 'sample_grid_data', 'key' => 'ID', 'submit_name' => 'do_submit')), 'inputs' => array('NickName' => array('type' => 'text', 'name' => 'NickName', 'caption' => _t('Username'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 150), 'error' => _t('Username is required')), 'db' => array('pass' => 'Xss')), 'Email' => array('type' => 'text', 'name' => 'Email', 'caption' => _t('Email'), 'required' => true, 'checker' => array('func' => 'email', 'error' => _t('_Incorrect Email')), 'db' => array('pass' => 'Xss')), 'City' => array('type' => 'text', 'name' => 'City', 'caption' => _t('City'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 150), 'error' => _t('City is required')), 'db' => array('pass' => 'Xss')), 'submit' => array('type' => 'input_set', 0 => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit')), 1 => array('type' => 'reset', 'name' => 'close', 'value' => _t('Close'), 'attrs' => array('onclick' => "\$('.bx-popup-active').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         // if form is submitted and all fields are valid
         $iNewId = $oForm->insert(array(), true);
         // insert record to database
         if ($iNewId) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $iNewId);
         } else {
             $aRes = array('msg' => "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
         // we need to use 'transBox' function to properly display 'popup'
         $s = BxTemplFunctions::getInstance()->transBox('', '
             <div class="bx-def-padding bx-def-color-bg-block" style="width:300px;">' . $oForm->getCode() . '</div>
             <script>
                 $(document).ready(function () {
                     $("#sample-add-form").ajaxForm({
                         dataType: "json",
                         beforeSubmit: function (formData, jqForm, options) {
                             bx_loading($("#' . $aForm['form_attrs']['id'] . '"), true);
                         },
                         success: function (data) {
                             $(".bx-popup-active").dolPopupHide();
                             glGrids.' . $this->_sObject . '.processJson(data, "' . $sAction . '");
                         }
                     });
                 });
             </script>');
         $this->_echoResultJson(array('popup' => array('html' => $s, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }