Example #1
0
 /**
  * Check if menu items are visible with extended checking
  * @param $a menu item array
  * @return boolean
  */
 protected function _isVisible($a)
 {
     if ($a['name'] == 'studio' && !isAdmin()) {
         return false;
     }
     return parent::_isVisible($a);
 }
Example #2
0
 /**
  * Check if menu items is visible.
  * @param $a menu item array
  * @return boolean
  */
 protected function _isVisible($a)
 {
     if (!parent::_isVisible($a)) {
         return false;
     }
     $sCheckFuncName = '';
     $aCheckFuncParams = array();
     switch ($a['name']) {
         case 'item-edit':
             $sCheckFuncName = 'isEditAllowed';
             if (!empty($this->_aCmt)) {
                 $aCheckFuncParams = array($this->_aCmt);
             }
             break;
         case 'item-delete':
             $sCheckFuncName = 'isRemoveAllowed';
             if (!empty($this->_aCmt)) {
                 $aCheckFuncParams = array($this->_aCmt);
             }
             break;
         case 'item-vote':
             $sCheckFuncName = 'isVoteAllowed';
             if (!empty($this->_aCmt)) {
                 $aCheckFuncParams = array($this->_aCmt);
             }
             break;
         case 'item-reply':
             $sCheckFuncName = 'isPostReplyAllowed';
             break;
     }
     if (!$sCheckFuncName || !method_exists($this->_oCmts, $sCheckFuncName)) {
         return true;
     }
     return call_user_func_array(array($this->_oCmts, $sCheckFuncName), $aCheckFuncParams);
 }
 /**
  * Get menu code.
  * @return string
  */
 public function getCode()
 {
     $sCode = parent::getCode();
     if ($sCode !== false) {
         $sCode = $this->_oTemplate->parseHtmlByContent($sCode, array('id' => $this->_aObject['menu_id']));
     }
     return $sCode;
 }
Example #4
0
 protected function _getMenuItem($a)
 {
     $a = parent::_getMenuItem($a);
     if ('add-content' == $a['name'] || 'search' == $a['name']) {
         $a['class_add'] .= ' bx-def-media-phone-hide';
     }
     return $a;
 }
Example #5
0
 public function getCode()
 {
     bx_import('BxTemplSearch');
     $oSearch = new BxTemplSearch();
     $oSearch->setLiveSearch(true);
     $aVars = array('menu' => parent::getCode(), 'search' => $oSearch->getForm(BX_DB_CONTENT_ONLY) . $oSearch->getResultsContainer());
     return $this->_oTemplate->parseHtmlByName('menu_site.html', $aVars);
 }
 public function __construct($aObject, $oTemplate = false)
 {
     parent::__construct($aObject, $oTemplate);
     $this->_oModule = BxDolModule::getInstance($this->MODULE);
     $iContentId = 0;
     if (bx_get('content_id') !== false) {
         $iContentId = (int) bx_get('content_id');
     }
     $this->addMarkers(array('js_object' => $this->_oModule->_oConfig->getJsObject('manage_tools'), 'content_id' => $iContentId));
 }
 protected function _getTemplateVars()
 {
     $aVars = parent::_getTemplateVars();
     $aVars['bx_repeat:menu_items'] = array(true);
     $aVars['profile_display_name'] = BxDolProfile::getInstance()->getDisplayName();
     $aVars['url_switch_profile'] = BxDolPermalinks::getInstance()->permalink('page.php?i=account-profile-switcher');
     $aVars['menu_account'] = BxDolMenu::getObjectInstance('sys_account')->getCode();
     $aVars['menu_notifications'] = BxDolMenu::getObjectInstance('sys_account_notifications')->getCode();
     return $aVars;
 }
 /**
  * Entry actions block
  */
 public function serviceEntityActions($iContentId = 0)
 {
     if (!$iContentId) {
         $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
     }
     if (!$iContentId) {
         return false;
     }
     bx_import('BxTemplMenu');
     $oMenu = BxTemplMenu::getObjectInstance($this->_oConfig->CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY']);
     return $oMenu ? $oMenu->getCode() : false;
 }
Example #9
0
/**
 * page code function
 */
function PageCompMainCode()
{
    ob_start();
    echo 'sample text sample textsample textsample textsample text sample text sample text <br >';
    echo 'sample text sample textsample textsample textsample text sample text sample text <br >';
    $sContent = ob_get_clean();
    $s = '';
    //$s .= DesignBoxContent("Design box - BX_DB_CONTENT_ONLY", $sContent . ' (BX_DB_CONTENT_ONLY)', BX_DB_CONTENT_ONLY, 'aaa', 'bbb');
    //$s .= '<hr class="bx-def-hr" />';
    $s .= DesignBoxContent("Design box - BX_DB_DEF-" . BX_DB_DEF, $sContent . ' BX_DB_DEF-' . BX_DB_DEF . ' / menu - string', BX_DB_DEF, 'sys_site');
    bx_import('BxTemplMenu');
    $oMenuSite = BxTemplMenu::getObjectInstance('sys_toolbar_member');
    $s .= DesignBoxContent("Design box - BX_DB_DEF-" . BX_DB_DEF, $sContent . ' BX_DB_DEF-' . BX_DB_DEF . ' / menu - object', BX_DB_DEF, $oMenuSite);
    $s .= DesignBoxContent("Design box - BX_DB_NO_CAPTION-" . BX_DB_DEF, $sContent . ' (BX_DB_NO_CAPTION-' . BX_DB_DEF . ')', BX_DB_NO_CAPTION, 'aaa', 'bbb');
    $s .= DesignBoxContent("Design box - BX_DB_PADDING_CONTENT_ONLY-" . BX_DB_DEF, $sContent . ' (BX_DB_PADDING_CONTENT_ONLY-' . BX_DB_DEF . ')', BX_DB_PADDING_CONTENT_ONLY, 'aaa', 'bbb');
    $s .= DesignBoxContent("Design box - BX_DB_PADDING_DEF-" . BX_DB_DEF, $sContent . ' BX_DB_PADDING_DEF-' . BX_DB_DEF . ' / menu - array', BX_DB_PADDING_DEF, array(array('name' => 'one', 'title' => 'One', 'onclick' => "alert('one')"), array('name' => 'two', 'title' => 'Two', 'onclick' => "alert('two')"), array('name' => 'three', 'title' => 'Three', 'onclick' => "alert('three')")));
    $s .= DesignBoxContent("Design box - BX_DB_PADDING_NO_CAPTION-" . BX_DB_DEF, $sContent . ' (BX_DB_PADDING_NO_CAPTION-' . BX_DB_DEF . ')', BX_DB_PADDING_NO_CAPTION, 'aaa', 'bbb');
    return $s;
}
 /**
  * Check if menu items is visible.
  * @param $a menu item array
  * @return boolean
  */
 protected function _isVisible($a)
 {
     if (!parent::_isVisible($a)) {
         return false;
     }
     $sCheckFuncName = '';
     $aCheckFuncParams = array();
     switch ($a['name']) {
         case 'item-delete':
             $sCheckFuncName = 'isAllowedDelete';
             if (!empty($this->_aEvent)) {
                 $aCheckFuncParams = array($this->_aEvent);
             }
             break;
     }
     if (!$sCheckFuncName || !method_exists($this->_oModule, $sCheckFuncName)) {
         return true;
     }
     return call_user_func_array(array($this->_oModule, $sCheckFuncName), $aCheckFuncParams) === true;
 }
Example #11
0
 public function getMenuItems()
 {
     $a = parent::getMenuItems();
     if (!isLogged()) {
         return $a;
     }
     foreach ($a as $k => $r) {
         if ('account' != $r['name']) {
             continue;
         }
         bx_import('BxDolProfile');
         $oProfile = BxDolProfile::getInstance(bx_get_logged_profile_id());
         $sUrlIcon = $oProfile->getThumb();
         if (!$sUrlIcon) {
             break;
         }
         $a[$k]['bx_if:image'] = array('condition' => true, 'content' => array('icon_url' => $sUrlIcon));
         $a[$k]['bx_if:icon']['condition'] = false;
     }
     return $a;
 }
Example #12
0
 protected function _isVisible($a)
 {
     if (!parent::_isVisible($a)) {
         return false;
     }
     $bResult = true;
     switch ($a['name']) {
         case 'switch_language':
             $aLanguages = BxDolLanguagesQuery::getInstance()->getLanguages(false, true);
             if (count($aLanguages) <= 1) {
                 $bResult = false;
             }
             break;
         case 'switch_template':
             $aTemplates = get_templates_array(true, true);
             if (count($aTemplates) <= 1) {
                 $bResult = false;
             }
             break;
     }
     return $bResult;
 }
 /**
  * Check if menu items is visible.
  * @param $a menu item array
  * @return boolean
  */
 protected function _isVisible($a)
 {
     if (!parent::_isVisible($a)) {
         return false;
     }
     $aEvent = $this->_oModule->_oDb->getEvents(array('browse' => 'id', 'value' => $this->_iEvent));
     if (empty($aEvent) || !is_array($aEvent)) {
         return false;
     }
     $sCheckFuncName = '';
     $aCheckFuncParams = array();
     switch ($a['name']) {
         case 'item-delete':
             $sCheckFuncName = 'isAllowedDelete';
             $aCheckFuncParams = array($aEvent);
             break;
     }
     if (!$sCheckFuncName || !method_exists($this->_oModule, $sCheckFuncName)) {
         return true;
     }
     return call_user_func_array(array($this->_oModule, $sCheckFuncName), $aCheckFuncParams) === true;
 }
Example #14
0
 protected function _getMenuItem($aItem)
 {
     if (isset($aItem['active']) && !$aItem['active']) {
         return false;
     }
     if (isset($aItem['visible_for_levels']) && !$this->_isVisible($aItem)) {
         return false;
     }
     $sMethod = '_getMenuItem' . str_replace(' ', '', ucwords(str_replace('-', ' ', $aItem['name'])));
     if (!method_exists($this, $sMethod)) {
         $aItem = parent::_getMenuItem($aItem);
         if ($aItem === false) {
             return false;
         }
         $sItem = $this->_oTemplate->parseHtmlByName('menu_custom_item.html', $aItem);
     } else {
         $sItem = $this->{$sMethod}($aItem);
     }
     if (empty($sItem)) {
         return false;
     }
     return array('class' => $this->_isSelected($aItem) ? 'bx-menu-tab-active' : '', 'item' => $sItem);
 }
 function showBlockActionsMenu($sCaption, $bNoDB = false)
 {
     global $logged;
     global $p_arr;
     $oTemplMenu = new BxTemplMenu($this->oTemplConfig);
     if (!$logged['member'] or !$p_arr) {
         return '';
     }
     $memberID = (int) $_COOKIE['memberID'];
     $profileID = (int) $p_arr['ID'];
     if ($memberID == $profileID) {
         return '';
     }
     /* * * * Ray IM Integration * * * */
     $check_res_im = checkAction($memberID, ACTION_ID_USE_RAY_IM);
     if (getParam('enable_ray') == 'on' and get_user_online_status($profileID) and $check_res_im[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) {
         $sSndPassword = getPassword($memberID);
         $IMNow = $oTemplMenu->getActionsMenuItem('action_im.gif', _t('_ChatNow', $p_arr['NickName']), "javascript:void(0);", '', '', "openRayWidget( 'im', 'user', '{$memberID}', '{$sSndPassword}', '{$profileID}' );");
     } else {
         $IMNow = '';
     }
     /* * * * Ray IM Integration [END]* * * */
     $ret = '<div class="menuBlock">';
     $ret .= '<div class="menu_item_block">';
     $ret .= '<div class="menu_item_block_left">';
     $ret .= $oTemplMenu->getActionsMenuItem('action_send.gif', _t('_SendLetter'), "compose.php?ID={$profileID}");
     $ret .= $oTemplMenu->getActionsMenuItem('action_fave.gif', _t('_Fave'), "javascript:void(0);", '', '', "window.open( 'list_pop.php?action=hot&amp;ID={$profileID}',    '', 'width={$this->oTemplConfig->popUpWindowWidth},height={$this->oTemplConfig->popUpWindowHeight},menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no' );");
     $ret .= $oTemplMenu->getActionsMenuItem('action_friends.gif', _t('_Befriend'), "javascript:void(0);", '', '', "window.open( 'list_pop.php?action=friend&amp;ID={$profileID}', '', 'width={$this->oTemplConfig->popUpWindowWidth},height={$this->oTemplConfig->popUpWindowHeight},menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no' );");
     $ret .= $oTemplMenu->getActionsMenuItem('action_greet.gif', _t('_Greet'), "javascript:void(0);", '', '', "window.open( 'greet.php?sendto={$profileID}',                  '', 'width={$this->oTemplConfig->popUpWindowWidth},height={$this->oTemplConfig->popUpWindowHeight},menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no' );");
     $ret .= $IMNow;
     if (!$this->oTemplConfig->bAnonymousMode) {
         $ret .= $oTemplMenu->getActionsMenuItem('action_email.gif', _t('_Get E-mail'), "javascript:void(0);", '', '', "window.open( 'freemail.php?ID={$profileID}', '', 'width={$this->oTemplConfig->popUpWindowWidth},height={$this->oTemplConfig->popUpWindowHeight},menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no' );");
     }
     $ret .= '</div>';
     $ret .= '<div class="menu_item_block_right">';
     $ret .= $oTemplMenu->getActionsMenuItem('action_photos.gif', $this->getLinkStat('prPhoto', _t('_ProfilePhotos'), $profileID), "photos_gallery.php?ID={$profileID}");
     $ret .= $oTemplMenu->getActionsMenuItem('action_videos.gif', $this->getLinkStat('prVideo', _t('_ProfileVideos'), $profileID), "javascript:void(0);", '', '', "openRayWidget( 'video', 'player', '{$profileID}' );");
     //				$ret .= $oTemplMenu -> getActionsMenuItem( 'action_videos.gif', _t('_ProfileVideos'),   "javascript:void(0);", '', '', "openRayWidget( 'video', 'player', '$profileID' );" );
     $ret .= $oTemplMenu->getActionsMenuItem('action_music.gif', $this->getLinkStat('prMusic', _t('_ProfileMusic'), $profileID), "javascript:void(0);", '', '', "openRayWidget( 'mp3', 'player', '{$profileID}', '" . getPassword($memberID) . "', '{$memberID}');");
     $ret .= $oTemplMenu->getActionsMenuItem('action_share.gif', _t('_Share'), "javascript:void(0);", '', '', "return launchTellFriendProfile({$profileID});");
     $ret .= $oTemplMenu->getActionsMenuItem('action_report.gif', _t('_Report'), "javascript:void(0);", '', '', "window.open( 'list_pop.php?action=spam&amp;ID={$profileID}',   '', 'width={$this->oTemplConfig->popUpWindowWidth},height={$this->oTemplConfig->popUpWindowHeight},menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no' );");
     $ret .= $oTemplMenu->getActionsMenuItem('action_block.gif', _t('_Block'), "javascript:void(0);", '', '', "window.open( 'list_pop.php?action=block&amp;ID={$profileID}',  '', 'width={$this->oTemplConfig->popUpWindowWidth},height={$this->oTemplConfig->popUpWindowHeight},menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no' );");
     $ret .= '</div>';
     $ret .= '<div class="clear_both"></div>';
     $ret .= '</div>';
     $ret .= '</div>';
     if ($bNoDB) {
         return $ret;
     } else {
         echo DesignBoxContent(_t($sCaption), $ret, 1);
     }
 }
Example #16
0
 protected function _addJsCss()
 {
     parent::_addJsCss();
     $this->_oModule->_oTemplate->addJs('forms.js');
 }
 public function __construct($aObject, $oTemplate = false)
 {
     parent::__construct($aObject, $oTemplate);
     $this->_oModule = BxDolModule::getInstance($this->MODULE);
 }
Example #18
0
 public function __construct($aObject, $oTemplate)
 {
     parent::__construct($aObject, $oTemplate);
 }
Example #19
0
 function designBoxMenu($mixedMenu, $aButtons = array())
 {
     $sCode = '';
     $aButtonMenu = false;
     if ($mixedMenu) {
         $sMenu = '';
         if (is_string($mixedMenu)) {
             $oMenu = BxTemplMenu::getObjectInstance($mixedMenu);
             $sMenu = $oMenu ? $oMenu->getCode() : $mixedMenu;
         } elseif (is_object($mixedMenu) && is_a($mixedMenu, 'BxTemplMenu')) {
             $sMenu = $mixedMenu->getCode();
         } elseif (is_array($mixedMenu)) {
             if (isset($mixedMenu['template']) && isset($mixedMenu['menu_items'])) {
                 $aMenu = $mixedMenu;
             } else {
                 $aMenu = array('template' => 'menu_vertical.html', 'menu_items' => $mixedMenu);
             }
             $oMenu = new BxTemplMenu($aMenu, $this->_oTemplate);
             $sMenu = $oMenu->getCode();
         }
         if ($sMenu) {
             $sId = 'bx-menu-db-' . time() . rand(0, PHP_INT_MAX);
             $sCode .= $this->slideBox($sId, '<div class="bx-def-padding">' . $sMenu . '</div>', true);
             $aButtonMenu = array('icon-a' => $this->_sDesignBoxIcon, 'onclick' => "bx_menu_slide('#" . $sId . "', this)");
         }
     }
     if ($aButtons) {
         $sCode .= '<div class="bx-db-menu"><div class="bx-db-menu-tab bx-db-menu-tab-btn">';
         foreach ($aButtons as $aButton) {
             if (isset($aButton['menu']) && $aButton['menu']) {
                 if (!$aButtonMenu) {
                     continue;
                 }
                 $aButton = $aButtonMenu;
             }
             $aAttrs = array();
             if (!empty($aButton['onclick'])) {
                 $aAttrs['onclick'] = $aButton['onclick'];
             }
             if (!empty($aButton['class'])) {
                 $aAttrs['class'] = $aButton['class'];
             }
             $sAttrs = bx_convert_array2attrs($aAttrs, 'bx-def-margin-sec-left');
             $sCode .= '<a href="javascript:void(0);" ' . $sAttrs . '>';
             $sCode .= !empty($aButton['icon']) ? '<i class="sys-icon ' . $aButton['icon'] . ' bx-def-font-h2"></i>' : '';
             $sCode .= !empty($aButton['icon-a']) ? '<i class="sys-icon-a" data-rotate="down" data-icon="' . $aButton['icon-a'] . '"></i>' : '';
             $sCode .= !empty($aButton['title']) ? $aButton['title'] : '';
             $sCode .= '</a>';
         }
         $sCode .= '</div></div>';
     }
     return $sCode;
 }
 public function getMenuItems()
 {
     $this->loadData();
     return parent::getMenuItems();
 }
Example #21
0
 /**
  * My entries actions block
  */
 public function serviceMyEntriesActions($iProfileId = 0)
 {
     if (!$iProfileId) {
         $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
     }
     if (!$iProfileId || $iProfileId != $this->_iProfileId) {
         return false;
     }
     $oMenu = BxTemplMenu::getObjectInstance($this->_oConfig->CNF['OBJECT_MENU_ACTIONS_MY_ENTRIES']);
     return $oMenu ? $oMenu->getCode() : false;
 }
Example #22
0
 /**
  * Get content for 'menu' block type.
  * @return string
  */
 protected function _getBlockMenu($aBlock)
 {
     bx_import('BxTemplMenu');
     $oMenu = BxTemplMenu::getObjectInstance($aBlock['content']);
     return $oMenu ? $oMenu->getCode() : '';
 }
Example #23
0
 public function getCode()
 {
     $s = parent::getCode();
     return '<div id="bx-homepage-menu-' . $this->_sObject . '">' . $s . '</div>';
 }
 /**
  * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
  */
 public function checkAllowedViewMoreMenu(&$aDataEntry, $isPerformAction = false)
 {
     $oMenu = BxTemplMenu::getObjectInstance($this->_oConfig->CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE']);
     if (!$oMenu || !$oMenu->getCode()) {
         return _t('_sys_txt_access_denied');
     }
     return CHECK_ACTION_RESULT_ALLOWED;
 }
Example #25
0
 public function getCode()
 {
     $s = parent::getCode();
     return '<div id="bx-sliding-menu-' . $this->_sObject . '" class="bx-sliding-menu-main bx-def-z-index-nav bx-def-color-bg-block bx-def-border-bottom" style="display:none;"><div class="bx-sliding-menu-cont">' . $s . '</div></div>';
 }
function getAllMenus()
{
    global $aTopMenu;
    global $aMenuInfo;
    global $oTemplConfig;
    global $site;
    if (!$aMenuInfo) {
        getMenuInfo();
    }
    $aSiteUrl = parse_url($site['url']);
    $sSelfFile = htmlspecialchars_adv(substr($_SERVER['PHP_SELF'], strlen($aSiteUrl['path'])));
    $oTemplMenu = new BxTemplMenu($oTemplConfig);
    $ret = '';
    $aTTopMenu = $aTopMenu;
    foreach ($aTTopMenu as $iTItemID => $aTItem) {
        if ($aTItem['Type'] != 'top' && $aTItem['Type'] != 'system') {
            continue;
        }
        if (strpos($aTItem['Visible'], $aMenuInfo['visible']) === false) {
            continue;
        }
        if (strlen($aTItem['Check'])) {
            $sCheck = $aTItem['Check'];
            $sCheck = str_replace('\\$', '$', $sCheck);
            $func = create_function('', $sCheck);
            if (!$func()) {
                continue;
            }
        }
        if ($aMenuInfo['currentTop'] == $iTItemID && $sSelfFile != 'index.php') {
            $display = 'block';
        } else {
            $display = 'none';
        }
        $sCaption = _t($aTItem['Caption']);
        $sCaption = str_replace("{memberNick}", $aMenuInfo['memberNick'], $sCaption);
        $sCaption = str_replace("{profileNick}", $aMenuInfo['profileNick'], $sCaption);
        //generate
        $ret .= '
			<div class="hiddenMenu" style="display:' . $display . ';" id="hiddenMenu_' . $iTItemID . '"
			  onmouseover="holdHiddenMenu = ' . $iTItemID . ';"
			  onmouseout="holdHiddenMenu = currentTopItem; hideHiddenMenu( ' . $iTItemID . ' )">
				<div class="hiddenMenuBgCont">
					<div class="hiddenMenuCont">
						<div class="topPageHeader">' . $sCaption . '</div>' . $oTemplMenu->getCustomMenu($iTItemID) . '
					</div>
				</div>
				<div class="clear_both"></div>
			</div>';
    }
    return $ret;
}
/**
 * Put top code for the page
 **/
function PageCode($admintmpl = 0)
{
    global $dir;
    global $site;
    global $_page;
    global $_page_comp;
    global $logged;
    global $langHTMLCharset;
    global $tmpl;
    global $ADMIN;
    global $tmi_letters;
    global $dbh_letters;
    global $max_thumb_height;
    global $max_thumb_width;
    global $_page_cont;
    $ni = $_page['name_index'];
    global $oTemplConfig;
    $oTemplMenu = new BxTemplMenu($oTemplConfig);
    $free_mode = getParam("free_mode") == "on" ? 1 : 0;
    // reading templates
    if (!$admintmpl) {
        $fn = "{$dir['root']}templates/tmpl_{$tmpl}/page_{$ni}.html";
        if (!file_exists($fn)) {
            $fn = "{$dir['root']}templates/tmpl_{$tmpl}/default.html";
        }
    } else {
        $fn = "{$dir['root']}admin/tmpl_admin.html";
    }
    $templ = file_get_contents($fn);
    // process includes (multi-level)
    do {
        $templ1 = $templ;
        $templ = preg_replace_callback("/__include (.*)__/", "TmplInclude", $templ1);
        $templ = preg_replace_callback("/__includebase (.*)__/", "TmplIncludeBase", $templ);
    } while ($templ1 != $templ);
    //insert to your template page key:    __t: lang_key__     and you will get translated string
    $templ = preg_replace_callback("/__t: (_.+)__/", create_function('$matches', 'return _t($matches[1]);'), $templ);
    PageStaticComponents();
    // lang block
    if ((int) getParam('lang_enable')) {
        ob_start();
        lang_select_txt();
        $_page_cont[0]['switch_lang_block'] = ob_get_clean();
    } else {
        $_page_cont[0]['switch_lang_block'] = '';
    }
    // charset
    $_page_cont[0]['page_charset'] = $langHTMLCharset;
    //change templates
    if ('on' == getParam("enable_template")) {
        $_page_cont[0]['switch_skin_block'] = templates_select_txt();
    } else {
        $_page_cont[0]['switch_skin_block'] = '';
    }
    //Path to css
    if (strlen($_page['css_name']) > 0) {
        $filename = $dir['root'] . $site['css_dir'] . $_page['css_name'];
        if (file_exists($filename) && is_file($filename)) {
            $_page_cont[0]['styles'] = '<link href="' . $site['css_dir'] . $_page['css_name'] . '" rel="stylesheet" type="text/css" />';
        } else {
            $_page_cont[0]['styles'] = '';
        }
    } else {
        $_page_cont[0]['styles'] = '';
    }
    //Path to js
    if (strlen($_page['js_name']) > 0) {
        $filename = $dir['root'] . 'inc/js/' . $_page['js_name'];
        if (file_exists($filename) && is_file($filename)) {
            $langDelete = _t('_delete');
            $langLoading = _t('_loading ...');
            $langDeleteMessage = _t('_poll successfully deleted');
            $langMakeIt = _t('_make it');
            $lang_you_should_specify_member = _t('_You should specify at least one member');
            if ($site['js_init']) {
                $_page_cont[0]['java_script'] = $site['js_init'];
            }
            $_page_cont[0]['java_script'] .= <<<EOJ
<script type="text/javascript" language="javascript">
\tvar site_url = '{$site['url']}';
\tvar lang_delete = '{$langDelete}';
\tvar lang_loading = '{$langLoading}';
\tvar lang_delete_message = '{$langDeleteMessage}';
\tvar lang_make_it = '{$langMakeIt}';
\tvar lang_you_should_specify_member = '{$lang_you_should_specify_member}';
\t
\tvar iQSearchWindowWidth  = {$oTemplConfig->iQSearchWindowWidth};
\tvar iQSearchWindowHeight = {$oTemplConfig->iQSearchWindowHeight};
</script>
<script src="{$site['url']}inc/js/{$_page['js_name']}" type="text/javascript" language="javascript"></script>
EOJ;
        } else {
            $_page_cont[0]['java_script'] = '';
        }
    } else {
        $_page_cont[0]['java_script'] = '';
    }
    $_page_cont[0]['css_dir'] = $site['css_dir'];
    $_page_cont[0]['plugins'] = $site['plugins'];
    $_page_cont[0]['thumb_width'] = $max_thumb_width;
    $_page_cont[0]['thumb_height'] = $max_thumb_height;
    $_page_cont[0]['site_url'] = $site['url'];
    $_page_cont[0]['images'] = $site['images'];
    $_page_cont[0]['icons'] = $site['icons'];
    $_page_cont[0]['zodiac'] = $site['zodiac'];
    $_page_cont[0]['bottom_text'] = _t("_bottom_text", date("Y"));
    $_page_cont[0]['copyright'] = _t("_copyright", date("Y")) . getVersionComment();
    // please do not delete version for debug possibilities
    $_page_cont[0]['powered'] = getParam('enable_boonex_footers') ? _t("_powered_by_Dolphin") : '';
    $_page_cont[0]['main_logo'] = getMainLogo();
    //place meta data on site pages
    $_page_cont[0]['meta_keywords'] = process_line_output(getParam("MetaKeyWords"));
    $_page_cont[0]['meta_description'] = process_line_output(getParam("MetaDescription"));
    if (strlen($_page['extra_js'])) {
        $_page_cont[0]['extra_js'] = $_page['extra_js'];
    } else {
        $_page_cont[0]['extra_js'] = '';
    }
    if (strlen($_page['extra_css'])) {
        $_page_cont[0]['extra_css'] = $_page['extra_css'];
    } else {
        $_page_cont[0]['extra_css'] = '';
    }
    // top menu items
    $_page_cont[0]['top_menu'] = $oTemplMenu->getTopMenu();
    $_page_cont[0]['hidden_menu'] = getAllMenus();
    $_page_cont[0]['custom_menu'] = $oTemplMenu->getCustomMenu();
    $_page_cont[0]['TOP_Home'] = '<a class="menu_item_link" href="' . $site['url'] . 'index.php">' . _t("_Home") . '</a>';
    $_page_cont[0]['BMI_Home'] = '<a class="bottommenu"     href="' . $site['url'] . 'index.php">' . _t("_Home") . '</a>';
    $_page_cont[0]['TOP_About'] = '<a class="menu_item_link" href="' . $site['url'] . 'about_us.php">' . _t("_About Us") . '</a>';
    $_page_cont[0]['BMI_About'] = '<a class="bottommenu"     href="' . $site['url'] . 'about_us.php">' . _t("_About Us") . '</a>';
    $_page_cont[0]['TOP_Privacy'] = '<a class="menu_item_link" href="' . $site['url'] . 'privacy.php">' . _t("_Privacy") . '</a>';
    $_page_cont[0]['BMI_Privacy'] = '<a class="bottommenu"     href="' . $site['url'] . 'privacy.php">' . _t("_Privacy") . '</a>';
    $_page_cont[0]['TOP_Termsofuse'] = '<a class="menu_item_link" href="' . $site['url'] . 'terms_of_use.php">' . _t("_Terms_of_use") . '</a>';
    $_page_cont[0]['BMI_Termsofuse'] = '<a class="bottommenu"     href="' . $site['url'] . 'terms_of_use.php">' . _t("_Terms_of_use") . '</a>';
    $_page_cont[0]['TOP_Services'] = '<a class="menu_item_link" href="' . $site['url'] . 'services.php">' . _t("_Services") . '</a>';
    $_page_cont[0]['BMI_Services'] = '<a class="bottommenu"     href="' . $site['url'] . 'services.php">' . _t("_Services") . '</a>';
    $_page_cont[0]['TOP_FAQ'] = '<a class="menu_item_link" href="' . $site['url'] . 'faq.php">' . _t("_FAQ") . '</a>';
    $_page_cont[0]['BMI_FAQ'] = '<a class="bottommenu"     href="' . $site['url'] . 'faq.php">' . _t("_FAQ") . '</a>';
    $_page_cont[0]['TOP_Articles'] = '<a class="menu_item_link" href="' . $site['url'] . 'articles.php">' . _t("_Articles") . '</a>';
    $_page_cont[0]['BMI_Articles'] = '<a class="bottommenu"     href="' . $site['url'] . 'articles.php">' . _t("_Articles") . '</a>';
    $_page_cont[0]['TOP_Stories'] = '<a class="menu_item_link" href="' . $site['url'] . 'stories.php">' . _t("_Stories2") . '</a>';
    $_page_cont[0]['BMI_Stories'] = '<a class="bottommenu"     href="' . $site['url'] . 'stories.php">' . _t("_Stories2") . '</a>';
    $_page_cont[0]['TOP_Links'] = '<a class="menu_item_link" href="' . $site['url'] . 'links.php">' . _t("_Links") . '</a>';
    $_page_cont[0]['BMI_Links'] = '<a class="bottommenu"     href="' . $site['url'] . 'links.php">' . _t("_Links") . '</a>';
    $_page_cont[0]['TOP_News'] = '<a class="menu_item_link" href="' . $site['url'] . 'news.php">' . _t("_News") . '</a>';
    $_page_cont[0]['BMI_News'] = '<a class="bottommenu"     href="' . $site['url'] . 'news.php">' . _t("_News") . '</a>';
    $_page_cont[0]['TOP_Aff'] = getParam("enable_aff") == 'on' ? '<a class="menu_item_link" href="' . $site['url'] . 'affiliates.php">' . _t("_Affiliates") . '</a>' : '';
    $_page_cont[0]['BMI_Aff'] = getParam("enable_aff") == 'on' ? '<a class="bottommenu"     href="' . $site['url'] . 'affiliates.php">' . _t("_Affiliates") . '</a>' : '';
    $_page_cont[0]['TOP_Invitefriend'] = '<a class="menu_item_link" href="javascript:void(0);" onclick="return launchTellFriend();">' . _t("_Invite a friend") . '</a>';
    $_page_cont[0]['BMI_Invitefriend'] = '<a class="bottommenu"     href="javascript:void(0);" onclick="return launchTellFriend();">' . _t("_Invite a friend") . '</a>';
    $_page_cont[0]['TOP_Contacts'] = '<a class="menu_item_link" href="' . $site['url'] . 'contact.php">' . _t("_Contacts") . '</a>';
    $_page_cont[0]['BMI_Contacts'] = '<a class="bottommenu"     href="' . $site['url'] . 'contact.php">' . _t("_Contacts") . '</a>';
    $_page_cont[0]['TOP_Browse'] = '<a class="menu_item_link" href="' . $site['url'] . 'browse.php">' . _t("_Browse Profiles") . '</a>';
    $_page_cont[0]['BMI_Browse'] = '<a class="bottommenu"     href="' . $site['url'] . 'browse.php">' . _t("_Browse Profiles") . '</a>';
    $_page_cont[0]['TOP_Feedback'] = '<a class="menu_item_link" href="' . $site['url'] . 'story.php">' . _t("_Add story") . '</a>';
    $_page_cont[0]['BMI_Feedback'] = '<a class="bottommenu"     href="' . $site['url'] . 'story.php">' . _t("_Add story") . '</a>';
    $_page_cont[0]['TOP_ContactUs'] = '<a class="menu_item_link" href="' . $site['url'] . 'contact.php">' . _t("_contact_us") . '</a>';
    $_page_cont[0]['BMI_ContactUs'] = '<a class="bottommenu"     href="' . $site['url'] . 'contact.php">' . _t("_contact_us") . '</a>';
    $_page_cont[0]['TOP_Bookmark'] = '<a class="menu_item_link" href="javascript:void(0);" onclick="addBookmark();">' . _t("_Bookmark") . '</a>';
    $_page_cont[0]['BMI_Bookmark'] = '<a class="bottommenu"     href="javascript:void(0);" onclick="addBookmark();">' . _t("_Bookmark") . '</a>';
    $_page_cont[0]['hello_member'] = HelloMemberSection();
    // member/visitor menu
    if ($logged['admin']) {
        $_page_cont[0]['menu_right'] = $oTemplMenu->loggedAdminMenu();
    } elseif ($logged['aff']) {
        $_page_cont[0]['menu_right'] = $oTemplMenu->loggedAffMenu();
    } elseif ($logged['moderator']) {
        $_page_cont[0]['menu_right'] = $oTemplMenu->loggedModeratorMenu();
    } elseif ($logged['member']) {
        $_page_cont[0]['menu_right'] = $oTemplMenu->loggedMemberMenu();
    } else {
        $_page_cont[0]['menu_right'] = $oTemplMenu->visitorMenu();
    }
    /*if ( !strlen($_page_cont[$ni]['actions_menu']) )
    		$_page_cont[0]['actions_menu'] = $oTemplMenu -> actionsMenu();*/
    if (!strlen($_page_cont[$ni]['add_to_header'])) {
        $_page_cont[0]['add_to_header'] = '';
    }
    $check_res = checkAction((int) $_COOKIE['memberID'], ACTION_ID_USE_IM);
    $enable_im = getParam("enable_im");
    if ($enable_im && $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED && !$ADMIN) {
        $_page_cont[0]['IM_title'] = _t("_IM title");
        $_page_cont[0]['IM'] = RetIM();
    } else {
        $_page_cont[0]['IM_title'] = "";
        $_page_cont[0]['IM'] = "";
    }
    $enable_shoutBox = 'on' == getParam("enable_shoutBox") ? 1 : 0;
    if ($enable_shoutBox) {
        $_page_cont[0]['shout_box'] = loadShoutbox();
    } else {
        $_page_cont[0]['shout_box'] = '';
    }
    $_page_cont[0]['top_page_head'] = getTopPageHead();
    // page header
    $_page_cont[0]['page_header'] = $_page['header'];
    $_page_cont[0]['page_header_text'] = $_page['header_text'];
    // banner rotation/shifting system
    if (strstr($templ, "__banner_top__")) {
        $_page_cont[0]['banner_top'] = banner_put_nv(1);
    }
    if (strstr($templ, "__banner_left__")) {
        $_page_cont[0]['banner_left'] = banner_put_nv(2);
    }
    if (strstr($templ, "__banner_right__")) {
        $_page_cont[0]['banner_right'] = banner_put_nv(3);
    }
    if (strstr($templ, "__banner_bottom__")) {
        $_page_cont[0]['banner_bottom'] = banner_put_nv(4);
    }
    //end of banner rotation/shifting system
    //--- Ray IM Integration ---//
    global $sRayHomeDir;
    $_page_cont[0]['ray_invite_js'] = "\r\n\t\t<script type=\"text/javascript\" language=\"javascript\">\r\n\t\t\tvar sRayUrl = '" . $site['url'] . $sRayHomeDir . "';\r\n\t\t</script>\r\n\t\t<script src=\"" . $site['url'] . "ray/modules/global/js/integration.js\" type=\"text/javascript\" language=\"javascript\"></script>";
    $_page_cont[0]['ray_invite_swf'] = "";
    $iId = (int) $_COOKIE['memberID'];
    $sPassword = getPassword($iId);
    $bEnableRay = getParam('enable_ray') == 'on';
    $check_res = checkAction($iId, ACTION_ID_USE_RAY_IM);
    if ($bEnableRay && $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) {
        $_page_cont[0]['ray_invite_swf'] = getApplicationContent("im", "invite", array('id' => $iId, 'password' => $sPassword), true);
    }
    //--- Ray IM Integration ---//
    foreach ($_page_cont[0] as $key => $value) {
        $templ = str_replace("__{$key}__", $value, $templ);
    }
    if (is_array($_page_cont[$ni])) {
        foreach ($_page_cont[$ni] as $key => $value) {
            $templ = str_replace("__{$key}__", $value, $templ);
        }
    }
    header('Content-type: text/html; charset=utf-8');
    echo $templ;
}
    function TmplKeysReplace($m)
    {
        global $site;
        global $dir;
        global $logged;
        global $aPageContCache;
        global $_page_cont;
        global $oTemplConfig;
        global $_page;
        global $oTemplConfig;
        if (!isset($aPageContCache)) {
            $aPageContCache = array();
        }
        //if already generated it, return it.
        if (isset($aPageContCache[$m[1]])) {
            return $aPageContCache[$m[1]];
        }
        //if it already exists, return it
        if (isset($_page_cont[0]) and array_key_exists($m[1], $_page_cont[0])) {
            return $_page_cont[0][$m[1]];
        }
        $ni = $_page['name_index'];
        //if page generated it, return it
        if ($ni and isset($_page_cont[$ni]) and array_key_exists($m[1], $_page_cont[$ni])) {
            return $_page_cont[$ni][$m[1]];
        }
        //echoDbg( $m );
        $sRet = '';
        // now switch what we have
        switch ($m[1]) {
            case 'page_charset':
                $sRet = 'UTF-8';
                break;
                // it will be removed soon
            // it will be removed soon
            case 'site_url':
                $sRet = $site['url'];
                break;
            case 'plugins':
                $sRet = $site['plugins'];
                break;
            case 'images':
                $sRet = $site['images'];
                break;
            case 'css_dir':
                $sRet = $site['css_dir'];
                break;
            case 'icons':
                $sRet = $site['icons'];
                break;
            case 'zodiac':
                $sRet = $site['zodiac'];
                break;
            case 'switch_lang_block':
                $sRet = getLangSwitcher();
                break;
            case 'main_logo':
                $sRet = getMainLogo();
                break;
            case 'hello_member':
                $sRet = HelloMemberSection();
                break;
            case 'thumb_width':
                $sRet = getParam('max_thumb_width');
                break;
            case 'thumb_height':
                $sRet = getParam('max_thumb_height');
                break;
            case 'main_div_width':
                $sRet = getParam('main_div_width');
                break;
            case 'switch_skin_block':
                $sRet = getParam("enable_template") ? templates_select_txt() : '';
                break;
            case 'meta_keywords':
                $sRet = process_line_output(getParam("MetaKeyWords"));
                break;
            case 'meta_description':
                $sRet = process_line_output(getParam("MetaDescription"));
                break;
            case 'top_menu':
                $oMenu = new BxTemplMenu();
                $sRet = $oMenu->getCode();
                break;
            case 'extra_js':
                $sRet = $_page['extra_js'];
                break;
            case 'extra_css':
                $sRet = $_page['extra_css'];
                break;
            case 'page_header':
                $sRet = $_page['header'];
                break;
            case 'page_header_text':
                $sRet = $_page['header_text'];
                break;
            case 'banner_top':
                $sRet = banner_put_nv(1);
                break;
            case 'banner_left':
                $sRet = banner_put_nv(2);
                break;
            case 'banner_right':
                $sRet = banner_put_nv(3);
                break;
            case 'banner_bottom':
                $sRet = banner_put_nv(4);
                break;
            case 'bottom_text':
                $sRet = _t('_bottom_text', date('Y'));
                break;
            case 'copyright':
                $sRet = _t('_copyright', date('Y')) . getVersionComment();
                break;
                // please do not delete version for debug possibilities
                //Path to css
            // please do not delete version for debug possibilities
            //Path to css
            case 'styles':
                if (strlen($_page['css_name'])) {
                    $sFile = $dir['root'] . $site['css_dir'] . $_page['css_name'];
                    if (file_exists($sFile) && is_file($sFile)) {
                        $sRet = '
							<link href="' . $site['url'] . $site['css_dir'] . $_page['css_name'] . '" rel="stylesheet" type="text/css" />';
                    }
                }
                break;
                //Path to js
            //Path to js
            case 'java_script':
                if (strlen($_page['js_name'])) {
                    $sFile = $dir['root'] . 'inc/js/' . $_page['js_name'];
                    if (file_exists($sFile) && is_file($sFile)) {
                        $langDelete = _t('_delete');
                        $langLoading = _t('_loading ...');
                        $langDeleteMessage = _t('_poll successfully deleted');
                        $langMakeIt = _t('_make it');
                        $lang_you_should_specify_member = _t('_You should specify at least one member');
                        if ($site['js_init']) {
                            $sRet = $site['js_init'];
                        }
                        $sRet .= <<<EOJ
\t<script type="text/javascript" language="javascript">
\t\t\t\t\tvar site_url = '{$site['url']}';
\t\t\t\t\tvar lang_delete = '{$langDelete}';
\t\t\t\t\tvar lang_loading = '{$langLoading}';
\t\t\t\t\tvar lang_delete_message = '{$langDeleteMessage}';
\t\t\t\t\tvar lang_make_it = '{$langMakeIt}';
\t\t\t\t\tvar lang_you_should_specify_member = '{$lang_you_should_specify_member}';
\t\t\t\t\t
\t\t\t\t\tvar iQSearchWindowWidth  = {$oTemplConfig->iQSearchWindowWidth};
\t\t\t\t\tvar iQSearchWindowHeight = {$oTemplConfig->iQSearchWindowHeight};
\t</script>
\t<script src="{$site['url']}inc/js/{$_page['js_name']}" type="text/javascript" language="javascript"></script>
EOJ;
                    }
                }
                break;
                //--- Ray IM Integration ---//
            //--- Ray IM Integration ---//
            case 'ray_invite_js':
                $sRet = getRayIntegrationJS();
                break;
            case 'ray_invite_swf':
                if ($logged['member']) {
                    $iId = (int) $_COOKIE['memberID'];
                    $sPassword = getPassword($iId);
                    $bEnableRay = getParam('enable_ray');
                    $aCheckRes = checkAction($iId, ACTION_ID_USE_RAY_IM);
                    if ($bEnableRay && $aCheckRes[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) {
                        $sRet = getApplicationContent('im', 'invite', array('id' => $iId, 'password' => $sPassword), true);
                    }
                }
                break;
                //--- Ray IM Integration ---//
            //--- Ray IM Integration ---//
            default:
                if (substr($m[1], 0, 4) == 'TOP_' or substr($m[1], 0, 4) == 'BMI_') {
                    // insert top and bottom links
                    global $aMainLinks;
                    $sPre = substr($m[1], 0, 4);
                    $sLinkName = substr($m[1], 4);
                    if (isset($aMainLinks[$sLinkName])) {
                        $aLink = $aMainLinks[$sLinkName];
                        $bShow = true;
                        if (isset($aLink['Check'])) {
                            $sFunc = create_function('', $aLink['Check']);
                            $bShow = $sFunc();
                        }
                        if ($bShow) {
                            $sClass = $sPre == 'TOP_' ? 'menu_item_link' : 'bottommenu';
                            $sOnclick = isset($aLink['onclick']) ? 'onclick="' . $aLink['onclick'] . '"' : '';
                            $sTitle = _t($aLink['Title']);
                            $sRet = <<<BLAH
\t\t\t\t\t\t\t\t<a href="{$site['url']}{$aLink['href']}" class="{$sClass}" {$sOnclick}>{$sTitle}</a>
BLAH;
                        }
                    } else {
                        $sRet = $m[0];
                    }
                    //return found string back
                } elseif (($sTemplAdd = TemplPageAddComponent($m[1])) !== false) {
                    $sRet = $sTemplAdd;
                } else {
                    $sRet = $m[0];
                }
                //return found string back
        }
        $aPageContCache[$m[1]] = $sRet;
        return $sRet;
    }