Cheetah
All Classes Namespaces Files Functions Variables Pages
member_menu_queries.php
Go to the documentation of this file.
1 <?php
2 
8 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
9 header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . " GMT"); // always modified
10 header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1
11 header('Pragma: no-cache'); // HTTP/1.0
12 header('Content-Type: text/html; charset=utf-8');
13 
14 require_once( 'inc/header.inc.php' );
15 require_once( CH_DIRECTORY_PATH_INC . 'design.inc.php' );
16 
17 ch_import('ChTemplMemberMenu');
18 ch_import('ChWsbPageView');
19 
21 
22 // return member's extra menu sub block ;
23 if ( isset($_GET['action']) ) {
24 
25  // read data from cache file ;
26  $oCache = $oMemberMenu->getCacheObject();
27  $aMenuStructure = $oCache
28  ->getData($GLOBALS['MySQL']->genDbCacheKey($oMemberMenu -> sMenuCacheFile));
29 
30  // if cache file defined;
31  if ($aMenuStructure) {
32 
34  $iMenuId = ( isset($_GET['menu_id']) )
35  ? (int) $_GET['menu_id']
36  : 0 ;
37 
38  $sOutputHtml = null;
39  switch( $_GET['action'] ) {
40 
41  case 'get_menu_content' :
42  if ($iMemberId && $iMenuId) {
43 
44  // define the menu's sub menu code ;
45  $sSubMenuCode = null;
46  $aLinkedItems = array();
47  foreach($aMenuStructure as $sKey => $aItems) {
48  if(!isset($aMenuStructure[$sKey][$iMenuId]) )
49  continue;
50 
51  $sSubMenuCode = $aMenuStructure[$sKey][$iMenuId]['PopupMenu'];
52  if($aMenuStructure[$sKey][$iMenuId]['linked_items'])
53  $aLinkedItems = $aMenuStructure[$sKey][$iMenuId]['linked_items'];
54  break;
55  }
56 
57  if ($sSubMenuCode) {
58  header("Content-Type: text/html; charset=utf-8");
59  $sOutputHtml = $oMemberMenu -> getSubMenuContent ($iMemberId, $sSubMenuCode, $aLinkedItems);
60  }
61  }
62  break;
63 
64  case 'get_bubbles_values' :
65  $sBubbles = ( isset($_GET['bubbles']) ) ? $_GET['bubbles'] : null;
66  if ( $sBubbles && $iMemberId ) {
67 
69  if($aMemberInfo['UserStatus'] != 'offline') {
70  // update the date of last navigate;
72  }
73 
74  $aBubbles = array();
75  $aBubblesItems = explode(',', $sBubbles);
76 
77  if ( $aBubblesItems && is_array($aBubblesItems) ) {
78  $bClearCache = false;
79  foreach( $aBubblesItems as $sValue) {
80  $aItem = explode(':', $sValue);
81 
82  $sBubbleCode = null;
83  foreach($aMenuStructure as $sKey => $aItems) {
84  foreach($aItems as $iKey => $aSubItems) {
85  if( $aSubItems['Name'] == $aItem[0]) {
86  $sBubbleCode = $aSubItems['Bubble'];
87  break;
88  }
89  }
90 
91  if ($sBubbleCode) {
92  break;
93  }
94  }
95 
96  if ($sBubbleCode) {
97  $sCode = str_replace('{iOldCount}', (int)$aItem[1], $sBubbleCode);
98  $sCode = str_replace('{ID}', (int)$iMemberId, $sCode);
99 
100  eval($sCode);
101  $aBubbles[$aItem[0]] = array (
102  'count' => $aRetEval['count'],
103  'messages' => $aRetEval['messages'],
104  'onlclick_script' => ( isset($aRetEval['onlclick_script'])
105  && $aRetEval['onlclick_script']) ? $aRetEval['onlclick_script'] : '',
106  );
107 
108  if($aItem[1] != $aRetEval['count']) {
109  $bClearCache = true;
110  }
111  }
112  }
113 
114  //clear cache
115  if($bClearCache) {
116  $oMemberMenu -> deleteMemberMenuKeyFile($iMemberId);
117  }
118 
119  header('Content-Type: text/plain; charset=utf-8');
120  $sOutputHtml = json_encode($aBubbles);
121  }
122  }
123  break;
124  }
125 
127  }
128 }
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
ChTemplMemberMenu
Definition: ChTemplMemberMenu.php:14
$iMemberId
$iMemberId
Definition: profile.php:91
$sOutputHtml
$sOutputHtml
Definition: browse.php:86
$sCode
$sCode
Definition: explanation.php:19
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
php
update_date_lastnav
update_date_lastnav($iId)
Definition: admin.inc.php:307
$aMemberInfo
$aMemberInfo
Definition: profile_info.php:34
$oCache
$oCache
Definition: prof.inc.php:10
exit
exit
Definition: cart.php:21
$_GET
$_GET['debug']
Definition: index.php:67
$oMemberMenu
$oMemberMenu
Definition: member_menu_queries.php:20
getLoggedId
getLoggedId()
Definition: profiles.inc.php:32
getProfileInfo
getProfileInfo($iProfileID=0, $checkActiveStatus=false, $forceCache=false)
Definition: profiles.inc.php:249
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10