<?xml version="1.0" encoding="utf-8"?>
<hookexport>
  <hookdata>
    <config>
      <hook_name>Shoutbox: Active Users</hook_name>
      <hook_desc>This adds a list of active users in the shoutbox on your board index</hook_desc>
      <hook_author>Pete Treanor</hook_author>
      <hook_email/>
      <hook_website>http://www.ipbshoutbox.com</hook_website>
      <hook_update_check/>
      <hook_version_human>1.4.1</hook_version_human>
      <hook_version_long>14100</hook_version_long>
      <hook_requirements><![CDATA[a:3:{s:21:"required_applications";a:2:{s:4:"core";a:3:{s:8:"app_name";s:6:"System";s:11:"min_version";i:32000;s:11:"max_version";i:0;}s:8:"shoutbox";a:3:{s:8:"app_name";s:8:"Shoutbox";s:11:"min_version";i:12000;s:11:"max_version";i:0;}}s:20:"hook_php_version_min";s:0:"";s:20:"hook_php_version_max";s:0:"";}]]></hook_requirements>
      <hook_extra_data><![CDATA[a:3:{s:7:"display";a:2:{s:8:"settings";s:34:"Setting groups: Hook: Active Users";s:9:"templates";s:0:"";}s:8:"database";a:0:{}s:13:"settingGroups";a:1:{s:0:"";s:20:"shoutbox_hook_active";}}]]></hook_extra_data>
      <hook_key>ipshoutbox_active_users</hook_key>
      <hook_global_caches/>
    </config>
  </hookdata>
  <hookfiles>
    <file>
      <hook_file_real>shoutboxActiveUsers.php</hook_file_real>
      <hook_type>templateHooks</hook_type>
      <hook_classname>shoutboxActiveUsers</hook_classname>
      <hook_data><![CDATA[a:8:{s:12:"dataLocation";s:0:"";s:14:"libApplication";s:0:"";s:15:"classToOverload";s:0:"";s:9:"skinGroup";s:11:"skin_boards";s:12:"skinFunction";s:18:"boardIndexTemplate";s:4:"type";s:2:"if";s:2:"id";s:11:"activeNames";s:8:"position";s:10:"post.endif";}]]></hook_data>
      <hooks_source><![CDATA[<?php

class shoutboxActiveUsers
{
	protected $registry;
	protected $settings;
	protected $memberData;

	public function __construct()
	{
        /* Make registry objects */
		$this->registry   =  ipsRegistry::instance();
		$this->settings   =& $this->registry->fetchSettings();
		$this->memberData =& $this->registry->member()->fetchMemberData();
	}

	public function getOutput()
	{
		if ( $this->settings['shoutbox_active_groups'] == "" )
		{
			return;
		}

		if ( $this->settings['shoutbox_online'] && in_array( $this->memberData['member_group_id'], explode( ",", $this->settings['shoutbox_active_groups'] ) ) )
		{
			/* Our library is loaded? */
			if( !class_exists('app_class_shoutbox') OR !$this->registry->isClassLoaded('shoutboxLibrary') )
			{
				require_once( IPSLib::getAppDir('shoutbox').'/app_class_shoutbox.php' );
				$app_class_shoutbox = new app_class_shoutbox( ipsRegistry::instance() );
			}

			$this->registry->getClass('shoutboxLibrary')->global_on = true;
			$this->registry->getClass('shoutboxLibrary')->_startup();

			/* Which hook? - Added in 1.1.1 */
			if ( $this->settings['shoutbox_active_hook'] == 's' )
			{
				$hook = 'hookActiveUsersSidebar';
			}
			else
			{
				$hook = 'hookActiveUsers';
			}

			return $this->registry->output->getTemplate('shoutbox_hooks')->$hook( $this->registry->getClass('shoutboxLibrary')->getMembersViewing(false) );
		}

		return '';
	}
}]]></hooks_source>
    </file>
  </hookfiles>
  <hookextras_settings>
    <setting>
      <conf_is_title>1</conf_is_title>
      <conf_title_title>Hook: Active Users</conf_title_title>
      <conf_title_desc/>
      <conf_title_noshow>1</conf_title_noshow>
      <conf_title_keyword>shoutbox_hook_active</conf_title_keyword>
      <conf_title_app>forums</conf_title_app>
      <conf_title_tab>Shoutbox</conf_title_tab>
    </setting>
    <setting>
      <conf_id>812</conf_id>
      <conf_title>Enable Ajax Update?</conf_title>
      <conf_description><![CDATA[If set to <strong>YES</strong> active users in the shoutbox are updated live with ajax. <strong style="color:blue"><br />Don't enable this setting on busy boards!</strong>]]></conf_description>
      <conf_group>78</conf_group>
      <conf_type>yes_no</conf_type>
      <conf_key>shoutbox_active_ajax</conf_key>
      <conf_value/>
      <conf_default>0</conf_default>
      <conf_extra/>
      <conf_evalphp/>
      <conf_protected>1</conf_protected>
      <conf_position>3</conf_position>
      <conf_start_group/>
      <conf_add_cache>1</conf_add_cache>
      <conf_keywords/>
      <conf_title_keyword>shoutbox_hook_active</conf_title_keyword>
      <conf_is_title>0</conf_is_title>
    </setting>
    <setting>
      <conf_id>813</conf_id>
      <conf_title>Allowed groups...</conf_title>
      <conf_description><![CDATA[When the "Active Users" hook is enabled it will show a list of active users in the shoutbox on board index for the selected groups.]]></conf_description>
      <conf_group>78</conf_group>
      <conf_type>multi</conf_type>
      <conf_key>shoutbox_active_groups</conf_key>
      <conf_value/>
      <conf_default/>
      <conf_extra>#show_groups#</conf_extra>
      <conf_evalphp><![CDATA[if ( $save == 1)
{
	if ( is_array($_POST['shoutbox_active_groups']) )
	{
		$_POST['shoutbox_active_groups'] = ','.implode(",",$_POST['shoutbox_active_groups']).',';
	}
	else
	{
		$_POST['shoutbox_active_groups'] = "";
	}

	$key = 'shoutbox_active_groups';
}
if ( $show == 1 )
{
$key = 'shoutbox_active_groups[]';
}]]></conf_evalphp>
      <conf_protected>1</conf_protected>
      <conf_position>2</conf_position>
      <conf_start_group/>
      <conf_add_cache>1</conf_add_cache>
      <conf_keywords/>
      <conf_title_keyword>shoutbox_hook_active</conf_title_keyword>
      <conf_is_title>0</conf_is_title>
    </setting>
    <setting>
      <conf_id>814</conf_id>
      <conf_title>Hook to enable?</conf_title>
      <conf_description><![CDATA[Select which one of the hooks you want to enable<br /><strong style="color:red">NOTE: Each time you change this setting you need to recache the skin sets in Look & Feel > Template Tools</strong>]]></conf_description>
      <conf_group>78</conf_group>
      <conf_type>dropdown</conf_type>
      <conf_key>shoutbox_active_hook</conf_key>
      <conf_value/>
      <conf_default>b</conf_default>
      <conf_extra>b=Board Statistics&#13;
s=Sidebar (Board Index Only)</conf_extra>
      <conf_evalphp><![CDATA[if ( $save == 1 )
{
	if ( $_POST['shoutbox_active_hook'] == 's' )
	{
		$newHookData = 'a:6:{s:15:"classToOverload";s:0:"";s:9:"skinGroup";s:11:"skin_boards";s:12:"skinFunction";s:18:"boardIndexTemplate";s:4:"type";s:7:"foreach";s:2:"id";s:11:"side_blocks";s:8:"position";s:9:"outer.pre";}';
	}
	else
	{
		$newHookData = 'a:6:{s:15:"classToOverload";s:0:"";s:9:"skinGroup";s:11:"skin_boards";s:12:"skinFunction";s:18:"boardIndexTemplate";s:4:"type";s:2:"if";s:2:"id";s:11:"activeNames";s:8:"position";s:10:"post.endif";}';
	}

	$this->DB->update( 'core_hooks_files', array( 'hook_data' => $newHookData ), "hook_classname='shoutboxActiveUsers'" );

	$this->cache->rebuildCache( 'hooks', 'global' );
}]]></conf_evalphp>
      <conf_protected>1</conf_protected>
      <conf_position>1</conf_position>
      <conf_start_group>Active User Settings</conf_start_group>
      <conf_add_cache>1</conf_add_cache>
      <conf_keywords/>
      <conf_title_keyword>shoutbox_hook_active</conf_title_keyword>
      <conf_is_title>0</conf_is_title>
    </setting>
  </hookextras_settings>
  <hookextras_language/>
  <hookextras_modules/>
  <hookextras_help/>
  <hookextras_templates/>
  <hookextras_css/>
  <hookextras_replacements/>
  <hookextras_tasks/>
  <hookextras_database_create/>
  <hookextras_database_alter/>
  <hookextras_database_update/>
  <hookextras_database_insert/>
</hookexport>
