Cheetah
All Classes Namespaces Files Functions Variables Pages
ChWsbPageView.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbPrivacy');
9 ch_import('ChWsbPageViewAdmin'); // for caching abilities
10 
99 {
101  var $aPage; //--- cache of this page
102  var $sCode = '';
103  var $sWhoViews = 'non';
104  var $iMemberID = 0;
105  var $bAjaxMode = false;
106 
107  var $aColumnsWidth = array ();
108 
109  var $sTableName = 'sys_page_compose';
111 
112  var $oCacher = null;
113 
115  {
116  $this -> sCacheFile = 'sys_page_compose.inc';
117  $this -> sPageName = $sPageName;
118 
119  if( !$this -> load() )
120  return false;
121 
122  $this -> getViewerInfo();
123 
124  $this -> checkAjaxMode();
125 
126  $oZ = new ChWsbAlerts('system', 'page_init', 0, 0, array(
127  'page_name' => $this -> sPageName,
128  'page_data' => &$this -> aPage,
129  ));
130  $oZ->alert();
131  }
132 
133  function checkAjaxMode()
134  {
135  if( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) and $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' )
136  $this -> bAjaxMode = true;
137  }
138 
139  function createCache()
140  {
141  if ($this->oCacher == null)
142  $this->oCacher = new ChWsbPageViewCacher($this->sTableName, $this->sCacheFile);
143  return $this->oCacher->createCache();
144  }
145 
146  function load()
147  {
148  $oCache = $GLOBALS['MySQL']->getDbCacheObject();
149  $aCache = $oCache->getData($GLOBALS['MySQL']->genDbCacheKey($this->sCacheFile));
150  if (null === $aCache) {
151  if (!$this->createCache() ) {
152  echo '<br /><b>Warning</b> PageView cache not found';
153  return false;
154  }
155  $aCache = $oCache->getData($GLOBALS['MySQL']->genDbCacheKey($this->sCacheFile));
156  }
157 
158  if( !$aCache ) {
159  echo '<br /><b>Warning!</b> PageView cache cannot be evaluated. Please recompile.';
160  return false;
161  }
162 
163  if( !array_key_exists( $this -> sPageName, $aCache ) ) {
164  //echo '<br /><b>Warning!</b> The page not found in PageView cache.';
165  return false;
166  }
167 
168  $this -> aPage = $aCache[ $this->sPageName ];
169 
170  if (ChWsbRequest::serviceExists('pageac', 'page_blocks_filter')) {
171  ChWsbService::call('pageac', 'page_blocks_filter', array(&$this));
172  }
173 
174  return true;
175  }
176 
177  function isLoaded()
178  {
179  return (isset($this->aPage) && !empty($this->aPage));
180  }
181 
182  function getPageTitle()
183  {
184  return $this->aPage['Title'];
185  }
186 
187  function getPageWidth()
188  {
189  return $this->aPage['Width'];
190  }
191 
192  function getPageClass()
193  {
194  return 'sys_page_' . $this->sPageName;
195  }
196 
197  function getViewerInfo()
198  {
199  if (isMember()) {
200  $this -> sWhoViews = 'memb';
201  $this -> iMemberID = (int)$_COOKIE['memberID'];
202  }
203  }
204 
205  function forcePageWidth($iWidth)
206  {
207  $this->aPage['Width'] = $iWidth;
208  }
209 
210  function gen()
211  {
213 
214  if(!$this->aPage)
215  return false;
216 
217  $this -> genColumnsHeader();
218 
219  $oSysTemplate->setPageWidth($this -> aPage['Width']);
220  $oSysTemplate->addJs('view_edit.js');
221 
222  if(isset($this->aPage['Columns']) && !empty($this->aPage['Columns'])){
223  foreach(array_keys($this->aPage['Columns']) as $iColumn)
224  $this->genColumn($iColumn);
225  }
226  else
227  $this->genPageEmpty();
228 
229  $this->genColumnsFooter();
230  }
231 
232  function genPageEmpty()
233  {
234  $this->genColumnsHeader();
235  $this->genColumnHeader(1, 100);
236  $this->sCode .= MsgBox(_t('_Empty'));
237  $this->genColumnFooter(1);
238  $this->genColumnsFooter();
239  }
240 
241  function genOnlyBlock( $iBlockID, $sDynamicType = 'tab' )
242  {
243  if( !$iBlockID )
244  return false;
245 
246  // search block
247  foreach( array_keys( $this -> aPage['Columns'] ) as $iColumn ) {
248  $aColumn = $this -> aPage['Columns'][ $iColumn ];
249  if( !$aColumn )
250  return false;
251 
252  if (isset($aColumn['Blocks'][$iBlockID])) {
253  $this -> genBlock( $iBlockID, $aColumn['Blocks'][$iBlockID], false, $sDynamicType );
254  return true;
255  }
256  }
257 
258  return false;
259  }
260 
261  function getCode()
262  {
263  if( !($this -> bAjaxMode and (int)$_REQUEST['pageBlock']) )
264  $this -> gen();
265  else {
266  $this -> genOnlyBlock( (int)$_REQUEST['pageBlock'], $_REQUEST['dynamic'] );
267 
268  $oZ = new ChWsbAlerts('system', 'page_output_block', 0, 0, array(
269  'page_name' => $this -> sPageName,
270  'page_data' => &$this -> aPage,
271  'block_id' => (int)$_REQUEST['pageBlock'],
272  'block_code' => &$this -> sCode,
273  ));
274  $oZ->alert();
275 
276  header( 'Content-type:text/html;charset=utf-8' );
277  echo $this -> sCode;
278  exit;
279  }
280 
281  $oZ = new ChWsbAlerts('system', 'page_output', 0, 0, array(
282  'page_name' => $this -> sPageName,
283  'page_data' => &$this -> aPage,
284  'page_code' => &$this -> sCode,
285  ));
286  $oZ->alert();
287 
288  return $this -> sCode;
289  }
290 
291  //for customizability
292  function genColumnsHeader()
293  {
294  $this -> sCode .= '<div class="sys_page ' . $this->getPageClass() . ' clearfix">';
295  }
296 
297  //for customizability
298  function genColumnsFooter()
299  {
300  $this -> sCode .= '</div>';
301  }
302 
303  function genColumn( $iColumn )
304  {
305  $aColumn = $this -> aPage['Columns'][ $iColumn ];
306  if( !$aColumn )
307  return false;
308 
309  $bShowDebugBlockInfo = !empty($_REQUEST['debug_mode']);
310 
311  $this -> genColumnHeader( $iColumn, $aColumn['Width'] );
312  foreach( $aColumn['Blocks'] as $iBlockID => $aBlock ) {
313  if ($bShowDebugBlockInfo)
314  $iCurTime = getmicrotime();
315 
316  $this -> genBlock( $iBlockID, $aBlock );
317 
318  if ($bShowDebugBlockInfo) {
319  $iCurTime2 = getmicrotime();
320  $iGenTime = $iCurTime2 - $iCurTime;
321  $this -> sCode .= "<!-- {$aBlock['Func']}:{$iGenTime} -->";
322  }
323  }
324 
325  $this -> genColumnFooter( $iColumn );
326  }
327 
328  function getBlockCode_Topest($iColumn)
329  {
330  return '';
331  }
332 
333  function genColumnHeader( $iColumn, $fColumnWidth )
334  {
335  $iPageWidth = (int)$this->aPage['Width'];
336  $iColumnsCount = count($this -> aPage['Columns']);
337 
338  $bColumnFull = ($fColumnWidth == 100);
339 
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));
342 
343  $sAddClass = ' page_column_';
344  if($bColumnFull)
345  $sAddClass .= 'full';
346  else if(($iColumn == 1) || $bLastColumnWasFull)
347  $sAddClass .= 'first';
348  else if($iColumn == $iColumnsCount || ($bNextColumnIsFull))
349  $sAddClass .= 'last';
350  else
351  $sAddClass .= 'middle';
352 
353  if(preg_replace('/\d+/', '', $this->aPage['Width']) == 'px' && $GLOBALS['oTemplConfig']->PageComposeColumnCalculation == 'px') {
354  $iPageContentWidth = $iPageWidth - (int)$GLOBALS['oTemplConfig']->iPageGap;
355 
356  $fColumnWidth = (int)round($iPageContentWidth * $fColumnWidth / 100);
357  $sColumnWidth = $fColumnWidth . 'px';
358  } else {
359  $sColumnWidth = $fColumnWidth . '%';
360  }
361 
362  $sAddClassWidth = $sAddClass . '_width_' . str_replace('.', '_', $fColumnWidth);
363  $GLOBALS['oSysTemplate']->addCssStyle('.' . trim($this->getPageClass()) . ' .' . trim ($sAddClassWidth), array(
364  'width' => $sColumnWidth
365  ));
366 
367  $this -> sCode .= '<div class="page_column' . $sAddClass . $sAddClassWidth . '" id="page_column_' . $iColumn . '">';
368  $this -> sCode .= $this->getBlockCode_Topest($iColumn);
369  }
370 
371  function genColumnFooter( $iColumn )
372  {
373  $this -> sCode .= '</div>';
374  }
375 
376  /*
377  Note: if bStatic == false, it is popup
378  */
379  function genBlock( $iBlockID, $aBlock, $bStatic = true, $sDynamicType = 'tab' )
380  {
381  if( !$this -> isBlockVisible( $aBlock['Visible'] ) )
382  return false;
383 
384  if (isset($GLOBALS['ch_profiler'])) $GLOBALS['ch_profiler']->beginPageBlock(_t($aBlock['Caption']), $iBlockID);
385 
386  if ($aBlock['Cache'] > 0 && getParam('sys_pb_cache_enable') == 'on') {
387  $oCache = $this->getBlocksCacheObject ();
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;
392  return;
393  }
394  }
395 
396  $sBlockFunction = 'getBlockCode_' . $aBlock['Func'];
397 
398  if(substr($aBlock['Func'], 0, 7) == 'Custom_') {
399  $sBlockFunction = 'getBlockCode_Custom';
400  }
401 
402  $mBlockCode = '';
403  if( method_exists( $this, $sBlockFunction ) ) {
404  $mBlockCode = $this -> $sBlockFunction( $iBlockID, $aBlock['Content'] );
405  }
406 
407  // $sBlockFunction can return simple string or array with few values:
408  // 0 - content, 1 - array of caption links, 2 - bottom links, 3 - caption addon (array or string)
409 
410  $sTopCode = '';
411  $sBottomCode = '';
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;
420  } else
421  $sBlockCode = false;
422 
423  $sBlock = '';
424 
425  if ($sBlockCode) {
426 
427  $sCodeDB = DesignBoxContent( $sCaptionCode, $sBlockCode, $aBlock['DesignBox'], $sTopCode, $sBottomCode);
428 
429  if ($bStatic) {
430  $sBlock .= '<div class="page_block_container ch-def-margin-sec-leftright" id="page_block_' . $iBlockID . '">' . $sCodeDB . '</div>';
431  } else {
432  if ($sDynamicType == 'tab')
433  $sBlock .= $sCodeDB;
434  elseif ($sDynamicType == 'popup')
435  $sBlock .= $GLOBALS['oFunctions']->transBox($sCodeDB, true);
436  }
437  }
438 
439  $this->sCode .= $sBlock;
440 
441  if ($aBlock['Cache'] > 0 && getParam('sys_pb_cache_enable') == 'on') {
442  $oCache = $this->getBlocksCacheObject ();
443  $oCache->setData($this->genBlocksCacheKey ($iBlockID.$bStatic.$sDynamicType.isMember()), $sBlock, $aBlock['Cache']);
444  }
445 
446  if (isset($GLOBALS['ch_profiler'])) $GLOBALS['ch_profiler']->endPageBlock($iBlockID, $sBlockCode ? false : true, false );
447 
448  if (!$sBlockCode)
449  return false;
450  }
451 
452  function _getBlockCaptionCode($iBlockID, $aBlock, $aBlockCode, $bStatic = true, $sDynamicType = 'tab')
453  {
454  $sCode = "";
455 
456  if(is_array($aBlockCode) && isset($aBlockCode[3]) && (is_array($aBlockCode[3]) || (is_string($aBlockCode[3]) && $aBlockCode[3]))) {
457  // if array is passed, pass it to the original caption translation
458  if(is_array($aBlockCode[3]))
459  $sCode = _t($aBlock['Caption'], $aBlockCode[3][0], $aBlockCode[3][1], $aBlockCode[3][2]);
460  // if string is passed, replace the caption
461  else if(is_string($aBlockCode[3]) && $aBlockCode[3])
462  $sCode = _t($aBlockCode[3]);
463  }
464  // else pass the original caption
465  else
466  $sCode = _t($aBlock['Caption']);
467 
468  return $sCode;
469  }
470  function _getBlockTopCode($iBlockID, $aBlock, $aBlockCode, $bStatic = true, $sDynamicType = 'tab')
471  {
472  $sCaptionMenuFunc = !isset($aBlockCode[4]) ? 'getBlockCaptionItemCode' : $aBlockCode[4];
473 
474  $sCode = "";
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]);
479 
480  return $sCode;
481  }
482 
483  function _getBlockBottomCode($iBlockID, $aBlock, $aBlockCode, $bStatic = true, $sDynamicType = 'tab')
484  {
485  $sCode = "";
486  if(!empty($aBlockCode[2]) && is_array($aBlockCode[2]))
487  $sCode = $this->getBlockBottomCode($iBlockID, $aBlockCode[2]);
488  else
489  $sCode = empty($aBlockCode[2]) ? '' : $aBlockCode[2];
490 
491  return str_replace('{id}', $iBlockID, $sCode);
492  }
493 
494  function isBlockVisible( $sVisible )
495  {
496  if( strpos( $sVisible, $this -> sWhoViews ) === false )
497  return false;
498  else
499  return true;
500  }
501 
502  public static function getBlockCaptionItemCode( $iBlockID, $aLinks )
503  {
504  if(empty($aLinks))
505  return '';
506 
507  $sActive = "";
508  $aItems = array();
509  foreach( $aLinks as $sTitle => $aLink ) {
510  $bActive = (bool)$aLink['active'];
512  if($bActive)
513  $sActive = $sTitle;
514 
515  $isTextIcon = (isset($aLink['icon']) && false === strpos($aLink['icon'], '.'));
516 
517  $sClass = !empty($aLink['class']) ? $aLink['class'] : 'top_members_menu';
518  $sClass .= isset($aLink['icon']) && !$isTextIcon ? ' with_icon' : '';
519 
520  $sOnclick = '';
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;"';
527 
528  $aItems[] = array(
529  'ch_if:item_act' => array(
530  'condition' => $bActive,
531  'content' => array(
532  'ch_if:icon_act' => array(
533  'condition' => isset($aLink['icon']) && !$isTextIcon,
534  'content' => array(
535  'class' => $sClass,
536  'src' => empty($aLink['icon']) ? '' : $aLink['icon'],
537  )
538  ),
539  'ch_if:texticon_act' => array(
540  'condition' => isset($aLink['icon']) && $isTextIcon,
541  'content' => array(
542  'class' => $sClass,
543  'icon' => isset($aLink['icon']) ? $aLink['icon'] : '',
544  )
545  ),
546  'title' => $sTitle
547  )
548  ),
549  'ch_if:item_pas' => array(
550  'condition' => !$bActive,
551  'content' => array(
552  'ch_if:icon_pas' => array(
553  'condition' => isset($aLink['icon']) && !$isTextIcon,
554  'content' => array(
555  'class' => $sClass,
556  'src' => empty($aLink['icon']) ? '' : $aLink['icon']
557  )
558  ),
559  'ch_if:texticon_pas' => array(
560  'condition' => isset($aLink['icon']) && $isTextIcon,
561  'content' => array(
562  'class' => $sClass,
563  'icon' => empty($aLink['icon']) ? '' : $aLink['icon']
564  )
565  ),
566  'id' => (!empty($aLink['id']) ? 'id="' . $aLink['id'] . '"' : ''),
567  'href' => htmlspecialchars_adv($aLink['href']),
568  'class' => $sClass,
569  'target' => (!empty($aLink['target']) ? ' target="' . $aLink['target'] . '"' : ''),
570  'on_click' => $sOnclick,
571  'title' => $sTitle
572  )
573  )
574  );
575  }
576 
577  return $GLOBALS['oSysTemplate']->parseHtmlByName('designbox_menu.html', array(
578  'id' => $iBlockID,
579  'title' => $sActive,
580  'popup' => $GLOBALS['oFunctions']->transBox($GLOBALS['oSysTemplate']->parseHtmlByName('designbox_menu_items_1.html', array(
581  'ch_repeat:items' => $aItems
582  )))
583  ));
584  }
585 
586  public static function getBlockCaptionMenu( $iBlockID, $aLinks )
587  {
588  if(empty($aLinks))
589  return '';
590 
591  $sActive = '';
592  $aItems = array();
593  foreach ( $aLinks as $sId => $aLink ) {
594  $bActive = isset($aLink['active']) && $aLink['active'] == 1;
595  $sTitle = htmlspecialchars_adv(_t($aLink['title']));
596  if($bActive)
597  $sActive = $sTitle;
598 
599  $isTextIcon = (isset($aLink['icon']) && (false === strpos($aLink['icon'], '.')));
600 
601  if (isset($aLink['icon']) && !$isTextIcon)
602  $aLink['class'] = isset($aLink['class']) ? $aLink['class'] . ' with_icon' : 'with_icon';
603 
604  $sHidden = ' style="display:none"';
605  $sClass = isset($aLink['class']) ? ' class="' . $aLink['class'] . '"' : '';
606 
607  $aItems[] = array(
608  'id' => $sId,
609  'show_active' => !$bActive ? $sHidden : '',
610  'show_passive' => $bActive ? $sHidden : '',
611  'ch_if:icon_act' => array(
612  'condition' => isset($aLink['icon']) && !$isTextIcon,
613  'content' => array(
614  'class' => $sClass,
615  'src' => isset($aLink['icon']) ? $aLink['icon'] : '',
616  )
617  ),
618  'ch_if:texticon_act' => array(
619  'condition' => isset($aLink['icon']) && $isTextIcon,
620  'content' => array(
621  'class' => $sClass,
622  'icon' => isset($aLink['icon']) ? $aLink['icon'] : '',
623  )
624  ),
625  'ch_if:icon_pas' => array(
626  'condition' => isset($aLink['icon']) && !$isTextIcon,
627  'content' => array(
628  'class' => $sClass,
629  'src' => isset($aLink['icon']) ? $aLink['icon'] : '',
630  )
631  ),
632  'ch_if:texticon_pas' => array(
633  'condition' => isset($aLink['icon']) && $isTextIcon,
634  'content' => array(
635  'class' => $sClass,
636  'icon' => isset($aLink['icon']) ? $aLink['icon'] : '',
637  )
638  ),
639  'class' => $sClass,
640  'title' => $sTitle,
641  'href' => (isset($aLink['href']) ? 'href="' . htmlspecialchars_adv($aLink['href']) . '"' : ''),
642  'target' => (isset($aLink['target']) ? 'target="' . $aLink['target'] . '"' : ''),
643  'on_click' => (isset($aLink['onclick']) ? 'onclick="' . $aLink['onclick'] . '"' : '')
644  );
645  }
646 
647  return $GLOBALS['oSysTemplate']->parseHtmlByName('designbox_menu.html', array(
648  'id' => '' . $iBlockID,
649  'title' => $sActive,
650  'popup' => $GLOBALS['oFunctions']->transBox($GLOBALS['oSysTemplate']->parseHtmlByName('designbox_menu_items_2.html', array(
651  'ch_repeat:items' => $aItems
652  )))
653  ));
654  }
655 
656  function getBlockBottomCode( $iBlockID, $aLinks )
657  {
658  if (empty($aLinks))
659  return;
660 
661  $sCode = '
662  <div class="dbBottomMenu">';
663 
664  foreach( $aLinks as $sTitle => $aLink ) {
666  $sClass = $aLink['class'] ? $aLink['class'] : 'moreMembers';
667 
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']}" />
671 EOF;
672 
673  if( $aLink['active'] ) {
674  $sCode .= <<<BLAH
675  {$sPossibleIcon}<span class="{$sClass}">{$sTitle}</span>
676 BLAH;
677  } else {
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'];
681  $sCode .= <<<BLAH
682  {$sPossibleIcon}<a href="{$sHref}" class="{$sClass}" {$sTarget} {$sOnclick}>{$sTitle}</a>
683 BLAH;
684  }
685  }
686 
687  $sCode .= '
688  </div>';
689 
690  return $sCode;
691  }
692 
693  /* * * * Page Blocks * * * */
694 
699  {
700  return getSiteStatUser();
701  }
702 
703  function getBlockCode_Custom( $iBlockID, $sContent )
704  {
705  ob_start();
706  $aResult = eval($sContent);
707  $sContent = '<div class="boxContent ch-def-bc-margin">' . ob_get_clean() . '</div>';
708  return !empty($aResult) ? $aResult : $sContent;
709  }
710 
711  function getBlockCode_Echo( $iBlockID, $sContent )
712  {
713  return '<div class="dbContentHtml">' . $sContent . '</div>';
714  }
715 
716  function getBlockCode_TrueText( $iBlockID, $sContent )
717  {
718  $sContent = htmlentities($sContent);
719  return '<pre style="white-space: break-spaces;">' . $sContent . '</pre>';
720  }
721 
722  // This is actually a HTML block without the editor. (RAW HTML Block)
723  // I could not rename the function as it would break sites
724  // that are using the block before i added the new True Text block above.
725  function getBlockCode_Text($iBlockID, $sContent)
726  {
727  return $this->getBlockCode_Echo($iBlockID, $sContent);
728  }
729 
730  function getBlockCode_XML( $iBlockID, $sContent )
731  {
732  $sApplication = ChWsbService::call('open_social', 'gen_application', array($sContent));
733  return <<<EOF
734 <div class="dbContent ch-def-bc-margin">
735  <div style="margin:5px;">{$sApplication}</div>
736 </div>
737 EOF;
738  }
739 
740  function getBlockCode_PHP( $iBlockID, $sContent )
741  {
742  ob_start();
743  $aResult = eval($sContent);
744  $sContent = ob_get_clean();
745  return !empty($aResult) ? $aResult : $sContent;
746  }
747 
748  function getBlockCode_Code( $iBlockID, $sContent )
749  {
750  return $this->getBlockCode_PHP( $iBlockID, $sContent );
751  }
752 
753  function getBlockCode_RSS( $iBlockID, $sContent )
754  {
755  $iNum = 0;
756  if($sContent) {
757  list( $sUrl, $iNum ) = explode( '#', $sContent );
758  $iNum = (int)$iNum;
759  }
760 
761  $iAddID = 0;
762  if (isset( $this -> oProfileGen -> _iProfileID))
763  $iAddID = $this -> oProfileGen -> _iProfileID;
764  elseif (isMember())
765  $iAddID = (int)$_COOKIE['memberID'];
766 
767  return '<div class="RSSAggrCont" rssid="' . $iBlockID . '" rssnum="' . $iNum . '" member="' . $iAddID . '">' . $GLOBALS['oFunctions']->loadingBoxInline() . '</div>';
768  }
769 
770 
771  function getBlockCode_LoginSection($iBlockID, $sParams = '')
772  {
773  $sDolUrl = CH_WSB_URL_ROOT;
774  $sAdminUrl = CH_WSB_URL_ADMIN;
775 
776  $sAdminPanelC = _t('_Admin Panel');
777  $sLogoutC = _t('_Log Out');
778  $sControlPanelC = _t('_Control Panel');
779  $sHelloMemberC = _t( '_Hello member', getNickName( $this -> iMemberID ) );
780 
781  $ret = '';
782  if (isAdmin()) {
783  $ret .= <<<EOF
784 <div class="logged_section_block">
785  <span><a href="{$sAdminUrl}index.php" class="logout">{$sAdminPanelC}</a></span>
786  <span> |&nbsp;| </span>
787  <span><a href="{$sDolUrl}logout.php?action=admin_logout" class="logout">{$sLogoutC}</a></span>
788 </div>
789 EOF;
790  } elseif (isMember()) {
791  $sMemberIcon = get_member_icon( $memberID, 'left' );
792 
793  $ret .= <<<EOF
794 <div class="logged_member_block">
795  {$sMemberIcon}
796  <div class="hello_member ch-def-margin-sec-left">
797  {$sHelloMemberC}<br />
798  <a href="{$sDolUrl}member.php" class="logout">{$sControlPanelC}</a>&nbsp;
799  <a href="{$sDolUrl}logout.php?action=member_logout" class="logout">{$sLogoutC}</a>
800  </div>
801 </div>
802 EOF;
803  } else {
804  return getMemberLoginFormCode('login_box_form', $sParams);
805  }
806 
807  return '<div class="dbContent ch-def-bc-margin">'.$ret.'</div>';
808  }
809 
810  function GenFormWrap($sMainContent, $sPage, $sFunctionName, $iMaxThumbWidth, $iThumbsCnt)
811  {
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;" : '';
818 
819  return <<<EOF
820 <div class="block_rel_100 ch-def-bc-margin">
821  <div class="centered_div" style="{$sWidthCent}">
822  {$sMainContent}
823  </div>
824  <div class="clear_both"></div>
825 </div>
826 EOF;
827  }
828 
830  {
831  if ($this->oCacher == null)
832  $this->oCacher = new ChWsbPageViewCacher($this->sTableName, $this->sCacheFile);
833  return $this->oCacher->getBlocksCacheObject ();
834  }
835 
837  {
838  if ($this->oCacher == null)
839  $this->oCacher = new ChWsbPageViewCacher($this->sTableName, $this->sCacheFile);
840  return $this->oCacher->genBlocksCacheKey ($sId);
841  }
842 }
ChWsbPageView\createCache
createCache()
Definition: ChWsbPageView.php:139
header
</code > Be careful enabling this directive if you have a redirector script that does not use the< code > Location</code > HTTP header
Definition: URI.MungeResources.txt:10
ChWsbPageView\genColumnsFooter
genColumnsFooter()
Definition: ChWsbPageView.php:298
ChWsbPageView\getBlockCaptionItemCode
static getBlockCaptionItemCode( $iBlockID, $aLinks)
Definition: ChWsbPageView.php:502
ChWsbPageView\checkAjaxMode
checkAjaxMode()
Definition: ChWsbPageView.php:133
ChWsbPageView\getBlocksCacheObject
getBlocksCacheObject()
Definition: ChWsbPageView.php:829
ChWsbPageView\getBlockCode_Code
getBlockCode_Code( $iBlockID, $sContent)
Definition: ChWsbPageView.php:748
ChWsbPageView\genColumnsHeader
genColumnsHeader()
Definition: ChWsbPageView.php:292
ChWsbPageView\GenFormWrap
GenFormWrap($sMainContent, $sPage, $sFunctionName, $iMaxThumbWidth, $iThumbsCnt)
Definition: ChWsbPageView.php:810
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
$_ni
$_ni
Definition: about_us.php:23
ChWsbPageView
Definition: ChWsbPageView.php:99
ChWsbRequest\serviceExists
static serviceExists($mixedModule, $sMethod, $sClass="Module")
Definition: ChWsbRequest.php:70
ChWsbPageView\getBlockCode_RSS
getBlockCode_RSS( $iBlockID, $sContent)
Definition: ChWsbPageView.php:753
get_member_icon
get_member_icon($ID, $float='none', $bGenProfLink=false)
Definition: design.inc.php:170
ChWsbPageView\load
load()
Definition: ChWsbPageView.php:146
ChWsbPageView\getViewerInfo
getViewerInfo()
Definition: ChWsbPageView.php:197
$_page
$_page['name_index']
Definition: about_us.php:13
$ret
$ret
Definition: index.php:39
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
$aResult
$aResult
Definition: index.php:19
$_page_cont
$_page_cont[$_ni]['page_main_code']
Definition: about_us.php:24
ChWsbPageView\getBlockCaptionMenu
static getBlockCaptionMenu( $iBlockID, $aLinks)
Definition: ChWsbPageView.php:586
ChWsbPageView\$oCacher
$oCacher
Definition: ChWsbPageView.php:112
ChWsbPageView\__construct
__construct( $sPageName)
Definition: ChWsbPageView.php:114
ChWsbPageView\$bAjaxMode
$bAjaxMode
Definition: ChWsbPageView.php:105
ChWsbPageView\getPageTitle
getPageTitle()
Definition: ChWsbPageView.php:182
$sUrl
$sUrl
Definition: cart.php:15
php
getmicrotime
getmicrotime()
Definition: utils.inc.php:1135
$oZ
$oZ
Definition: db.php:20
ChWsbPageView\isBlockVisible
isBlockVisible( $sVisible)
Definition: ChWsbPageView.php:494
ChWsbPageView\getCode
getCode()
Definition: ChWsbPageView.php:261
ChWsbPageView\isLoaded
isLoaded()
Definition: ChWsbPageView.php:177
ChWsbPageView\getBlockCode_TrueText
getBlockCode_TrueText( $iBlockID, $sContent)
Definition: ChWsbPageView.php:716
ChWsbPageView\$iMemberID
$iMemberID
Definition: ChWsbPageView.php:104
ChWsbPageView\gen
gen()
Definition: ChWsbPageView.php:210
isAdmin
isAdmin()
Definition: index.php:649
ChWsbPageViewCacher
Definition: ChWsbPageViewAdmin.php:944
$oCache
$oCache
Definition: prof.inc.php:10
$memberID
$memberID
Definition: profile.php:20
a
Filter ExtractStyleBlocks Scope FilterParam ExtractStyleBlocksScope DESCRIPTION< p > If you would like users to be able to define external but only allow them to specify CSS declarations for a specific node and prevent them from fiddling with other use this directive It accepts any valid CSS and will prepend this to any CSS declaration extracted from the document For if this directive is set to< code > selector< code > a
Definition: Filter.ExtractStyleBlocks.Scope.txt:15
getSiteStatUser
getSiteStatUser()
Definition: design.inc.php:226
ChWsbAlerts
Definition: ChWsbAlerts.php:39
db_arr
db_arr($query, $bindings=[])
Definition: db.inc.php:76
exit
exit
Definition: cart.php:21
and
and
Definition: license.txt:18
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
ChWsbPageView\getPageClass
getPageClass()
Definition: ChWsbPageView.php:192
$sTitle
$sTitle
Definition: actions.inc.php:13
ChWsbPageView\getBlockCode_Custom
getBlockCode_Custom( $iBlockID, $sContent)
Definition: ChWsbPageView.php:703
ChWsbPageView\getBlockCode_Text
getBlockCode_Text($iBlockID, $sContent)
Definition: ChWsbPageView.php:725
ChWsbPageView\_getBlockTopCode
_getBlockTopCode($iBlockID, $aBlock, $aBlockCode, $bStatic=true, $sDynamicType='tab')
Definition: ChWsbPageView.php:470
getNickName
getNickName( $ID='')
Definition: profiles.inc.php:461
htmlspecialchars_adv
htmlspecialchars_adv($string)
Definition: utils.inc.php:302
$_REQUEST
$_REQUEST['action']
Definition: cmd.php:11
ChWsbPageView\getBlockCode_MemberStat
getBlockCode_MemberStat()
Definition: ChWsbPageView.php:698
ChWsbPageView\getBlockBottomCode
getBlockBottomCode( $iBlockID, $aLinks)
Definition: ChWsbPageView.php:656
src
img src
Definition: URI.MungeResources.txt:8
ChWsbPageView\$sTableName
$sTableName
Definition: ChWsbPageView.php:109
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
$sContent
$sContent
Definition: bottom_menu_compose.php:169
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
ChWsbPageView\genBlocksCacheKey
genBlocksCacheKey($sId)
Definition: ChWsbPageView.php:836
getBlockWidth
getBlockWidth($iAllWidth, $iUnitWidth, $iNumElements)
Definition: design.inc.php:266
ChWsbPageView\genColumnHeader
genColumnHeader( $iColumn, $fColumnWidth)
Definition: ChWsbPageView.php:333
getMemberLoginFormCode
getMemberLoginFormCode($sID='member_login_form', $sParams='')
Definition: design.inc.php:317
ChWsbPageView\genBlock
genBlock( $iBlockID, $aBlock, $bStatic=true, $sDynamicType='tab')
Definition: ChWsbPageView.php:379
ChWsbPageView\getBlockCode_LoginSection
getBlockCode_LoginSection($iBlockID, $sParams='')
Definition: ChWsbPageView.php:771
ChWsbPageView\$sPageName
$sPageName
Definition: ChWsbPageView.php:100
ChWsbPageView\forcePageWidth
forcePageWidth($iWidth)
Definition: ChWsbPageView.php:205
ChWsbPageView\genOnlyBlock
genOnlyBlock( $iBlockID, $sDynamicType='tab')
Definition: ChWsbPageView.php:241
ChWsbPageView\getBlockCode_Echo
getBlockCode_Echo( $iBlockID, $sContent)
Definition: ChWsbPageView.php:711
ChWsbPageView\genColumn
genColumn( $iColumn)
Definition: ChWsbPageView.php:303
$sId
$sId
Definition: actions.inc.php:8
ChWsbPageView\getPageWidth
getPageWidth()
Definition: ChWsbPageView.php:187
ChWsbPageView\$aColumnsWidth
$aColumnsWidth
Definition: ChWsbPageView.php:107
ChWsbPageView\$sWhoViews
$sWhoViews
Definition: ChWsbPageView.php:103
ChWsbPageView\getBlockCode_XML
getBlockCode_XML( $iBlockID, $sContent)
Definition: ChWsbPageView.php:730
ChWsbPageView\$aPage
$aPage
Definition: ChWsbPageView.php:101
DesignBoxContent
DesignBoxContent($title, $content, $db_num=0, $caption_item='', $bottom_item='')
Definition: design.inc.php:78
$oSysTemplate
$oSysTemplate
Definition: params.inc.php:22
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
ChWsbService\call
static call($mixed, $sMethod, $aParams=array(), $sClass='Module')
Definition: ChWsbService.php:32
ChWsbPageView\getBlockCode_PHP
getBlockCode_PHP( $iBlockID, $sContent)
Definition: ChWsbPageView.php:740
ChWsbPageView\genColumnFooter
genColumnFooter( $iColumn)
Definition: ChWsbPageView.php:371
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
ChWsbPageView\_getBlockBottomCode
_getBlockBottomCode($iBlockID, $aBlock, $aBlockCode, $bStatic=true, $sDynamicType='tab')
Definition: ChWsbPageView.php:483
$sAdminUrl
$sAdminUrl
Definition: nav_menu_compose.php:125
ChWsbPageView\$sCode
$sCode
Definition: ChWsbPageView.php:102
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
isMember
isMember($iId=0)
Definition: profiles.inc.php:44
ChWsbPageView\_getBlockCaptionCode
_getBlockCaptionCode($iBlockID, $aBlock, $aBlockCode, $bStatic=true, $sDynamicType='tab')
Definition: ChWsbPageView.php:452
ChWsbPageView\getBlockCode_Topest
getBlockCode_Topest($iColumn)
Definition: ChWsbPageView.php:328
ChWsbPageView\$sCacheFile
$sCacheFile
Definition: ChWsbPageView.php:110
ChWsbPageView\genPageEmpty
genPageEmpty()
Definition: ChWsbPageView.php:232