Location: PHPKode > projects > PBBoard > PBBoard_v2.1.4/Upload/modules/online.module.php
<?php

(!defined('IN_PowerBB')) ? die() : '';

$CALL_SYSTEM				=	array();
$CALL_SYSTEM['SECTION'] 	= 	true;

/*$CALL_SYSTEM				=	array();
$CALL_SYSTEM['REQUEST'] 	= 	true;
$CALL_SYSTEM['MESSAGE'] 	= 	true;*/

include('common.php');

define('CLASS_NAME','PowerBBOnlineMOD');

class PowerBBOnlineMOD
{
	function run()
	{
		global $PowerBB;

		$this->_GetJumpSectionsList();

		$PowerBB->functions->ShowHeader($PowerBB->_CONF['template']['lang']['online_naw']);

		if ($PowerBB->_GET['show'])
		{
			$this->_Show();
		}
		else
		{
			$PowerBB->functions->error($PowerBB->_CONF['template']['lang']['path_not_true']);
		}

		$PowerBB->functions->GetFooter();
	}

	    /**
	 * Get the Jump Sections List
	 */
 function _GetJumpSectionsList()
    {
       global $PowerBB;

       //////////

       $SecArr                    =    array();
       $SecArr['get_from']             =    'db';

       $SecArr['proc']              =    array();
       $SecArr['proc']['*']           =    array('method'=>'clean','param'=>'html');

       $SecArr['order']             =    array();
       $SecArr['order']['field']       =    'sort';
       $SecArr['order']['type']       =    'ASC';

       $SecArr['where']             =    array();
       $SecArr['where'][0]['name']       =    'parent';
       $SecArr['where'][0]['oper']       =    '=';
       $SecArr['where'][0]['value']    =    '0';

       // Get main sections
       $catsy = $PowerBB->section->GetSectionsList($SecArr);

       // We will use forumsy_list to store list of forums which will view in main page
       $PowerBB->_CONF['template']['foreach']['forumsy_list'] = array();

       // Loop to read the information of main sections
       foreach ($catsy as $caty)
       {
          // Get the groups information to know view this section or not
          $groups = unserialize(base64_decode($caty['sectiongroup_cache']));

          if (is_array($groups[$PowerBB->_CONF['group_info']['id']]))
          {
             if ($groups[$PowerBB->_CONF['group_info']['id']]['view_section'])
             {
                $PowerBB->_CONF['template']['foreach']['forumsy_list'][$caty['id'] . '_m'] = $caty;
             }
          }

          unset($groups);

          if (!empty($caty['forums_cache']))
          {
             $forumsy = unserialize(base64_decode($caty['forums_cache']));

             foreach ($forumsy as $forumy)
             {
                if (is_array($forumy['groups'][$PowerBB->_CONF['group_info']['id']]))
                {
                    if ($forumy['groups'][$PowerBB->_CONF['group_info']['id']]['view_section'])
                    {
                       //////////

                       // Get the first-level sub forums as a _link_ and store it in $forumy['sub']

                       $forumy['is_sub']    =    0;
                       $forumy['sub']       =    '';

                       if (!empty($forumy['forums_cache']))
                       {
                          $subsy = unserialize(base64_decode($forumy['forums_cache']));

                          if (is_array($subsy))
                          {
                             foreach ($subsy as $suby)
                             {
                                if (is_array($suby['groups'][$PowerBB->_CONF['group_info']['id']]))
                                {
                                    if ($suby['groups'][$PowerBB->_CONF['group_info']['id']]['view_section'])
                                    {
                                       if (!$forumy['is_sub'])
                                       {
                                          $forumy['is_sub'] = 1;
                                       }

                                       $forumy['sub'] .= ('<option value="index.php?page=forum&show=1&id=' . $suby['id'] . '">---'  . $suby['title'] . '</option>');
                                    }
                                }
                             }
                          }
                       }


                       $PowerBB->_CONF['template']['foreach']['forumsy_list'][$forumy['id'] . '_f'] = $forumy;
                    }
                } // end if is_array
             } // end foreach ($forumsy)
          } // end !empty($forums_cache)
       } // end foreach ($catsy)

       //////////
   }

	function _Show()
	{
		global $PowerBB;

		if (!$PowerBB->_CONF['group_info']['onlinepage_allow'])
		{
          if (!$PowerBB->_CONF['member_permission'])
              {
              $PowerBB->template->display('login');
              $PowerBB->functions->error_stop();
			}
	        else
	        {
	        $PowerBB->functions->error($PowerBB->_CONF['template']['lang']['no_online']);
	        }
	     }

		$PowerBB->_GET['count'] = (!isset($PowerBB->_GET['count'])) ? 0 : $PowerBB->_GET['count'];
		$PowerBB->_GET['count'] = $PowerBB->functions->CleanVariable($PowerBB->_GET['count'],'intval');

      	$writer = $PowerBB->_CONF['rows']['member_row']['username'];
        $GetOnlineNum = $PowerBB->DB->sql_num_rows($PowerBB->DB->sql_query("SELECT * FROM " . $PowerBB->table['online'] . " WHERE id and hide_browse <>1"));
       	$PowerBB->template->assign('GetOnlineNum',$GetOnlineNum);

		$OnlineArr = array();
		$OnlineArr['order'] = array();
		$OnlineArr['order']['field'] = 'id';
		$OnlineArr['order']['type'] = 'DESC';
		// Pager setup
		$OnlineArr['pager'] 				= 	array();
		$OnlineArr['pager']['total']		= 	$GetOnlineNum;
		$OnlineArr['pager']['perpage']  	= 	$PowerBB->_CONF['info_row']['subject_perpage'];
		$OnlineArr['pager']['count'] 		= 	$PowerBB->_GET['count'];
		$OnlineArr['pager']['location'] 	= 	'index.php?page=online&show=1';
		$OnlineArr['pager']['var'] 		    = 	'count';

		// This member can't see hidden member
		if (!$PowerBB->_CONF['group_info']['show_hidden'])
		{
			$OnlineArr['where'][0] 			= 	array();
			$OnlineArr['where'][0]['name'] 	= 	'hide_browse';
			$OnlineArr['where'][0]['oper'] 	= 	'<>';
			$OnlineArr['where'][0]['value'] = 	'1';
		}

        $OnlineArr['proc']['last_move'] = array('method'=>'time','store'=>'last_move','type'=>$PowerBB->_CONF['info_row']['timesystem']);
        $OnlineArr['proc']['logged'] = array('method'=>'time','store'=>'logged','type'=>$PowerBB->_CONF['info_row']['timesystem']);
		$PowerBB->_CONF['template']['while']['Online'] = $PowerBB->online->GetOnlineList($OnlineArr);

            if ($GetOnlineNum > $PowerBB->_CONF['info_row']['subject_perpage'])
	        {
			$PowerBB->template->assign('pager',$PowerBB->pager->show());
	         }

		$PowerBB->template->display('online');

	}
}

?>
Return current item: PBBoard