116 $this -> sCacheFile =
'sys_page_compose.inc';
119 if( !$this ->
load() )
127 'page_name' => $this -> sPageName,
128 'page_data' => &$this -> aPage,
135 if( isset( $_SERVER[
'HTTP_X_REQUESTED_WITH'] )
and $_SERVER[
'HTTP_X_REQUESTED_WITH'] ==
'XMLHttpRequest' )
136 $this -> bAjaxMode =
true;
141 if ($this->oCacher ==
null)
143 return $this->oCacher->createCache();
149 $aCache =
$oCache->getData(
$GLOBALS[
'MySQL']->genDbCacheKey($this->sCacheFile));
150 if (
null === $aCache) {
152 echo
'<br /><b>Warning</b> PageView cache not found';
155 $aCache =
$oCache->getData(
$GLOBALS[
'MySQL']->genDbCacheKey($this->sCacheFile));
159 echo
'<br /><b>Warning!</b> PageView cache cannot be evaluated. Please recompile.';
163 if( !array_key_exists( $this -> sPageName, $aCache ) ) {
179 return (isset($this->aPage) && !
empty($this->aPage));
184 return $this->aPage[
'Title'];
189 return $this->aPage[
'Width'];
200 $this -> sWhoViews =
'memb';
201 $this -> iMemberID = (int)$_COOKIE[
'memberID'];
207 $this->aPage[
'Width'] = $iWidth;
222 if(isset($this->aPage[
'Columns']) && !
empty($this->aPage[
'Columns'])){
223 foreach(array_keys($this->aPage[
'Columns'])
as $iColumn)
236 $this->sCode .=
MsgBox(
_t(
'_Empty'));
247 foreach( array_keys( $this -> aPage[
'Columns'] )
as $iColumn ) {
248 $aColumn = $this -> aPage[
'Columns'][ $iColumn ];
252 if (isset($aColumn[
'Blocks'][$iBlockID])) {
253 $this ->
genBlock( $iBlockID, $aColumn[
'Blocks'][$iBlockID],
false, $sDynamicType );
263 if( !($this -> bAjaxMode
and (
int)
$_REQUEST[
'pageBlock']) )
269 'page_name' => $this -> sPageName,
270 'page_data' => &$this -> aPage,
271 'block_id' => (
int)
$_REQUEST[
'pageBlock'],
272 'block_code' => &$this -> sCode,
276 header(
'Content-type:text/html;charset=utf-8' );
282 'page_name' => $this -> sPageName,
283 'page_data' => &$this -> aPage,
284 'page_code' => &$this -> sCode,
288 return $this -> sCode;
294 $this -> sCode .=
'<div class="sys_page ' . $this->
getPageClass() .
' clearfix">';
300 $this -> sCode .=
'</div>';
305 $aColumn = $this -> aPage[
'Columns'][ $iColumn ];
312 foreach( $aColumn[
'Blocks']
as $iBlockID => $aBlock ) {
313 if ($bShowDebugBlockInfo)
316 $this ->
genBlock( $iBlockID, $aBlock );
318 if ($bShowDebugBlockInfo) {
320 $iGenTime = $iCurTime2 - $iCurTime;
321 $this -> sCode .=
"<!-- {$aBlock['Func']}:{$iGenTime} -->";
335 $iPageWidth = (int)$this->aPage[
'Width'];
336 $iColumnsCount = count($this -> aPage[
'Columns']);
338 $bColumnFull = ($fColumnWidth == 100);
340 $bLastColumnWasFull = (isset($this->aPage[
'Columns'][$iColumn - 1]) && ($this->aPage[
'Columns'][$iColumn - 1][
'Width'] == 100));
341 $bNextColumnIsFull = (isset($this->aPage[
'Columns'][$iColumn + 1]) && ($this->aPage[
'Columns'][$iColumn + 1][
'Width'] == 100));
343 $sAddClass =
' page_column_';
345 $sAddClass .=
'full';
346 else if(($iColumn == 1) || $bLastColumnWasFull)
347 $sAddClass .=
'first';
348 else if($iColumn == $iColumnsCount || ($bNextColumnIsFull))
349 $sAddClass .=
'last';
351 $sAddClass .=
'middle';
353 if(preg_replace(
'/\d+/',
'', $this->aPage[
'Width']) ==
'px' &&
$GLOBALS[
'oTemplConfig']->PageComposeColumnCalculation ==
'px') {
354 $iPageContentWidth = $iPageWidth - (int)
$GLOBALS[
'oTemplConfig']->iPageGap;
356 $fColumnWidth = (int)round($iPageContentWidth * $fColumnWidth / 100);
357 $sColumnWidth = $fColumnWidth .
'px';
359 $sColumnWidth = $fColumnWidth .
'%';
362 $sAddClassWidth = $sAddClass .
'_width_' . str_replace(
'.',
'_', $fColumnWidth);
363 $GLOBALS[
'oSysTemplate']->addCssStyle(
'.' . trim($this->
getPageClass()) .
' .' . trim ($sAddClassWidth), array(
364 'width' => $sColumnWidth
367 $this -> sCode .=
'<div class="page_column' . $sAddClass . $sAddClassWidth .
'" id="page_column_' . $iColumn .
'">';
373 $this -> sCode .=
'</div>';
379 function genBlock( $iBlockID, $aBlock, $bStatic =
true, $sDynamicType =
'tab' )
384 if (isset(
$GLOBALS[
'ch_profiler']))
$GLOBALS[
'ch_profiler']->beginPageBlock(
_t($aBlock[
'Caption']), $iBlockID);
386 if ($aBlock[
'Cache'] > 0 &&
getParam(
'sys_pb_cache_enable') ==
'on') {
388 $sBlock =
$oCache->getData($this->
genBlocksCacheKey ($iBlockID.$bStatic.$sDynamicType.isMember()), $aBlock[
'Cache']);
389 if ($sBlock !==
null) {
390 if (isset(
$GLOBALS[
'ch_profiler']))
$GLOBALS[
'ch_profiler']->endPageBlock($iBlockID, $sBlock ?
false :
true,
true);
391 $this->sCode .= $sBlock;
396 $sBlockFunction =
'getBlockCode_' . $aBlock[
'Func'];
398 if(substr($aBlock[
'Func'], 0, 7) ==
'Custom_') {
399 $sBlockFunction =
'getBlockCode_Custom';
403 if( method_exists( $this, $sBlockFunction ) ) {
404 $mBlockCode = $this -> $sBlockFunction( $iBlockID, $aBlock[
'Content'] );
412 if( is_array( $mBlockCode ) ) {
413 $sCaptionCode = $this->
_getBlockCaptionCode($iBlockID, $aBlock, $mBlockCode, $bStatic, $sDynamicType);
414 $sTopCode = $this->
_getBlockTopCode($iBlockID, $aBlock, $mBlockCode, $bStatic, $sDynamicType);
415 $sBlockCode = !isset($mBlockCode[3]) || (isset($mBlockCode[3]) && $mBlockCode[3] ===
false) ?
'<div class="dbContent ch-def-bc-margin">' . $mBlockCode[0] .
'</div>' : $mBlockCode[0];
416 $sBottomCode = $this->
_getBlockBottomCode($iBlockID, $aBlock, $mBlockCode, $bStatic, $sDynamicType);
417 }
else if(is_string($mBlockCode)) {
418 $sCaptionCode = $this->
_getBlockCaptionCode($iBlockID, $aBlock, $mBlockCode, $bStatic, $sDynamicType);
419 $sBlockCode = $mBlockCode;
427 $sCodeDB =
DesignBoxContent( $sCaptionCode, $sBlockCode, $aBlock[
'DesignBox'], $sTopCode, $sBottomCode);
430 $sBlock .=
'<div class="page_block_container ch-def-margin-sec-leftright" id="page_block_' . $iBlockID .
'">' . $sCodeDB .
'</div>';
432 if ($sDynamicType ==
'tab')
434 elseif ($sDynamicType ==
'popup')
435 $sBlock .=
$GLOBALS[
'oFunctions']->transBox($sCodeDB,
true);
439 $this->sCode .= $sBlock;
441 if ($aBlock[
'Cache'] > 0 &&
getParam(
'sys_pb_cache_enable') ==
'on') {
443 $oCache->setData($this->
genBlocksCacheKey ($iBlockID.$bStatic.$sDynamicType.isMember()), $sBlock, $aBlock[
'Cache']);
446 if (isset(
$GLOBALS[
'ch_profiler']))
$GLOBALS[
'ch_profiler']->endPageBlock($iBlockID, $sBlockCode ?
false :
true,
false );
456 if(is_array($aBlockCode) && isset($aBlockCode[3]) && (is_array($aBlockCode[3]) || (is_string($aBlockCode[3]) && $aBlockCode[3]))) {
458 if(is_array($aBlockCode[3]))
459 $sCode =
_t($aBlock[
'Caption'], $aBlockCode[3][0], $aBlockCode[3][1], $aBlockCode[3][2]);
461 else if(is_string($aBlockCode[3]) && $aBlockCode[3])
470 function _getBlockTopCode($iBlockID, $aBlock, $aBlockCode, $bStatic =
true, $sDynamicType =
'tab')
472 $sCaptionMenuFunc = !isset($aBlockCode[4]) ?
'getBlockCaptionItemCode' : $aBlockCode[4];
475 if(!$bStatic && $sDynamicType ==
'popup')
476 $sCode =
'<div class="dbTopMenu"><i class="login_ajx_close sys-icon times"></i></div>';
477 else if(isset($aBlockCode[1]) && is_array($aBlockCode[1]))
478 $sCode = $this -> $sCaptionMenuFunc($iBlockID, $aBlockCode[1]);
486 if(!
empty($aBlockCode[2]) && is_array($aBlockCode[2]))
489 $sCode =
empty($aBlockCode[2]) ?
'' : $aBlockCode[2];
491 return str_replace(
'{id}', $iBlockID,
$sCode);
496 if( strpos( $sVisible, $this -> sWhoViews ) ===
false )
509 foreach( $aLinks
as $sTitle => $aLink ) {
510 $bActive = (bool)$aLink[
'active'];
515 $isTextIcon = (isset($aLink[
'icon']) &&
false === strpos($aLink[
'icon'],
'.'));
517 $sClass = !
empty($aLink[
'class']) ? $aLink[
'class'] :
'top_members_menu';
518 $sClass .= isset($aLink[
'icon']) && !$isTextIcon ?
' with_icon' :
'';
521 if(!
empty($aLink[
'onclick']))
522 $sOnclick =
'onclick="' . $aLink[
'onclick'] .
'"';
523 else if($aLink[
'dynamic'])
524 $sOnclick =
'onclick="return !loadDynamicBlock(' . $iBlockID .
', this.href);"';
525 else if($aLink[
'dynamicPopup'])
526 $sOnclick =
'onclick="loadDynamicPopupBlock(' . $iBlockID .
', this.href); return false;"';
529 'ch_if:item_act' => array(
530 'condition' => $bActive,
532 'ch_if:icon_act' => array(
533 'condition' => isset($aLink[
'icon']) && !$isTextIcon,
536 'src' =>
empty($aLink[
'icon']) ?
'' : $aLink[
'icon'],
539 'ch_if:texticon_act' => array(
540 'condition' => isset($aLink[
'icon']) && $isTextIcon,
543 'icon' => isset($aLink[
'icon']) ? $aLink[
'icon'] :
'',
549 'ch_if:item_pas' => array(
550 'condition' => !$bActive,
552 'ch_if:icon_pas' => array(
553 'condition' => isset($aLink[
'icon']) && !$isTextIcon,
556 'src' =>
empty($aLink[
'icon']) ?
'' : $aLink[
'icon']
559 'ch_if:texticon_pas' => array(
560 'condition' => isset($aLink[
'icon']) && $isTextIcon,
563 'icon' =>
empty($aLink[
'icon']) ?
'' : $aLink[
'icon']
566 'id' => (!
empty($aLink[
'id']) ?
'id="' . $aLink[
'id'] .
'"' :
''),
569 'target' => (!
empty($aLink[
'target']) ?
' target="' . $aLink[
'target'] .
'"' :
''),
570 'on_click' => $sOnclick,
577 return $GLOBALS[
'oSysTemplate']->parseHtmlByName(
'designbox_menu.html', array(
580 'popup' =>
$GLOBALS[
'oFunctions']->transBox(
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'designbox_menu_items_1.html', array(
581 'ch_repeat:items' => $aItems
593 foreach ( $aLinks
as $sId => $aLink ) {
594 $bActive = isset($aLink[
'active']) && $aLink[
'active'] == 1;
599 $isTextIcon = (isset($aLink[
'icon']) && (
false === strpos($aLink[
'icon'],
'.')));
601 if (isset($aLink[
'icon']) && !$isTextIcon)
602 $aLink[
'class'] = isset($aLink[
'class']) ? $aLink[
'class'] .
' with_icon' :
'with_icon';
604 $sHidden =
' style="display:none"';
605 $sClass = isset($aLink[
'class']) ?
' class="' . $aLink[
'class'] .
'"' :
'';
609 'show_active' => !$bActive ? $sHidden :
'',
610 'show_passive' => $bActive ? $sHidden :
'',
611 'ch_if:icon_act' => array(
612 'condition' => isset($aLink[
'icon']) && !$isTextIcon,
615 'src' => isset($aLink[
'icon']) ? $aLink[
'icon'] :
'',
618 'ch_if:texticon_act' => array(
619 'condition' => isset($aLink[
'icon']) && $isTextIcon,
622 'icon' => isset($aLink[
'icon']) ? $aLink[
'icon'] :
'',
625 'ch_if:icon_pas' => array(
626 'condition' => isset($aLink[
'icon']) && !$isTextIcon,
629 'src' => isset($aLink[
'icon']) ? $aLink[
'icon'] :
'',
632 'ch_if:texticon_pas' => array(
633 'condition' => isset($aLink[
'icon']) && $isTextIcon,
636 'icon' => isset($aLink[
'icon']) ? $aLink[
'icon'] :
'',
642 'target' => (isset($aLink[
'target']) ?
'target="' . $aLink[
'target'] .
'"' :
''),
643 'on_click' => (isset($aLink[
'onclick']) ?
'onclick="' . $aLink[
'onclick'] .
'"' :
'')
647 return $GLOBALS[
'oSysTemplate']->parseHtmlByName(
'designbox_menu.html', array(
648 'id' =>
'' . $iBlockID,
650 'popup' =>
$GLOBALS[
'oFunctions']->transBox(
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'designbox_menu_items_2.html', array(
651 'ch_repeat:items' => $aItems
662 <div class="dbBottomMenu">';
664 foreach( $aLinks
as $sTitle => $aLink ) {
666 $sClass = $aLink[
'class'] ? $aLink[
'class'] :
'moreMembers';
668 $sPossibleIconClass = (isset($aLink[
'icon_class']) && $aLink[
'icon_class']==
'left') ?
'left' :
'right';
669 $sPossibleIcon = (isset($aLink[
'icon'])==
false) ?
'' : <<<EOF
670 <img
class=
"bot_icon_{$sPossibleIconClass}" alt=
"" src=
"{$aLink['icon']}" />
673 if( $aLink[
'active'] ) {
675 {$sPossibleIcon}<span
class=
"{$sClass}">{
$sTitle}</span>
678 $sTarget = $aLink[
'target'] ? (
'target="' . $aLink[
'target'] .
'"' ) :
'';
679 $sOnclick = $aLink[
'dynamic'] ? (
'onclick="return !loadDynamicBlock(' . $iBlockID .
', '. (isset($aLink[
'static']) &&
false == $aLink[
'static'] ?
"'{$aLink['href']}'" :
'this.href') .
');"' ) :
'';
680 $sHref = isset($aLink[
'static']) &&
false == $aLink[
'static'] ?
'javascript:void(0);' : $aLink[
'href'];
682 {$sPossibleIcon}<
a href=
"{$sHref}" class=
"{$sClass}" {$sTarget} {$sOnclick}>{
$sTitle}</
a>
707 $sContent =
'<div class="boxContent ch-def-bc-margin">' . ob_get_clean() .
'</div>';
713 return '<div class="dbContentHtml">' .
$sContent .
'</div>';
719 return '<pre style="white-space: break-spaces;">' .
$sContent .
'</pre>';
734 <div
class=
"dbContent ch-def-bc-margin">
735 <div style=
"margin:5px;">{$sApplication}</div>
762 if (isset( $this -> oProfileGen -> _iProfileID))
763 $iAddID = $this -> oProfileGen -> _iProfileID;
765 $iAddID = (int)$_COOKIE[
'memberID'];
767 return '<div class="RSSAggrCont" rssid="' . $iBlockID .
'" rssnum="' . $iNum .
'" member="' . $iAddID .
'">' .
$GLOBALS[
'oFunctions']->loadingBoxInline() .
'</div>';
773 $sDolUrl = CH_WSB_URL_ROOT;
776 $sAdminPanelC =
_t(
'_Admin Panel');
777 $sLogoutC =
_t(
'_Log Out');
778 $sControlPanelC =
_t(
'_Control Panel');
779 $sHelloMemberC =
_t(
'_Hello member',
getNickName( $this -> iMemberID ) );
784 <div
class=
"logged_section_block">
785 <span><
a href=
"{$sAdminUrl}index.php" class=
"logout">{$sAdminPanelC}</
a></span>
786 <span> | | </span>
787 <span><
a href=
"{$sDolUrl}logout.php?action=admin_logout" class=
"logout">{$sLogoutC}</
a></span>
794 <div
class=
"logged_member_block">
796 <div
class=
"hello_member ch-def-margin-sec-left">
797 {$sHelloMemberC}<br />
798 <
a href=
"{$sDolUrl}member.php" class=
"logout">{$sControlPanelC}</
a>
799 <
a href=
"{$sDolUrl}logout.php?action=member_logout" class=
"logout">{$sLogoutC}</
a>
807 return '<div class="dbContent ch-def-bc-margin">'.$ret.
'</div>';
810 function GenFormWrap($sMainContent, $sPage, $sFunctionName, $iMaxThumbWidth, $iThumbsCnt)
812 $sBlockWidthSQL =
"SELECT `PageWidth`, `ColWidth` FROM `sys_page_compose` WHERE `Page`='{$sPage}' AND (`Func`='{$sFunctionName}' OR `Caption`='{$sFunctionName}')";
813 $aBlockWidthInfo =
db_arr($sBlockWidthSQL);
814 $aBlockWidth = (int)((
int)($aBlockWidthInfo[
'PageWidth'] - 20) * (
int)$aBlockWidthInfo[
'ColWidth'] / 100) - 14;
815 $iDestWidth = $iThumbsCnt * $iMaxThumbWidth;
816 $iDestWidth =
getBlockWidth($aBlockWidth, $iMaxThumbWidth, $iThumbsCnt);
817 $sWidthCent = ($iDestWidth>0) ?
"width:{$iDestWidth}px;" :
'';
820 <div
class=
"block_rel_100 ch-def-bc-margin">
821 <div
class=
"centered_div" style=
"{$sWidthCent}">
824 <div
class=
"clear_both"></div>
831 if ($this->oCacher ==
null)
833 return $this->oCacher->getBlocksCacheObject ();
838 if ($this->oCacher ==
null)
840 return $this->oCacher->genBlocksCacheKey (
$sId);