<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="vsavisitorslastx" active="1">
	<title>الاعضاء الذين زاروا المنتدى خلال X ساعة</title>
	<description>تعريب منتديات كحلك</description>
	<version>3.0.2</version>
	<url>http://www.k7lk.com/vb/</url>
	<versioncheckurl>http://www.k7lk.com/vb/</versioncheckurl>
	<dependencies>
	</dependencies>
	<codes>
		<code version="3.0">
			<installcode><![CDATA[
		$vbulletin->db->hide_errors();
		$vbulletin->db->query_write(" 
			CREATE TABLE IF NOT EXISTS `". TABLE_PREFIX ."vsavilxh_guests` (
		    `id` INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
		    `userip` VARCHAR(20) NOT NULL,
			`dateline` INT(10) NOT NULL)
	    ");
		$vbulletin->db->show_errors();]]></installcode>
			<uninstallcode><![CDATA[$vbulletin->db->hide_errors();
		$vbulletin->db->query_write("DROP TABLE IF EXISTS `" . TABLE_PREFIX . "vsavilxh_guests` ");
		$vbulletin->db->show_errors();]]></uninstallcode>
		</code>
	</codes>
	<templates>
		<template name="vsa_lastxhoursvisitors" templatetype="template" date="1263924743" username="Valter" version="3.0.2"><![CDATA[
		<div id="vsa_vilxh" class="wgo_subblock">
			<h3><img src="{vb:stylevar imgdir_misc}/users_online.png" alt="{vb:raw vilxh_stats1}" />{vb:raw vilxh_stats1}</h3>
			<div>
				<p>{vb:raw vilxh_stats2} <span class="shade">{vb:raw vilxh_stats3}</span></p>
				<ol class="commalist" id="vilxh_users_area">
					{vb:raw vilxh_userlist_init}
					<vb:if condition="(($vboptions[vsa_visitorslastx_cutoff]>0) AND ($vilxh_total_members > $vboptions[vsa_visitorslastx_cutoff]))">
						<div id="vilxh_users_more" class="shade" style="display:inline;float:{vb:stylevar right}">
							{vb:rawphrase vsavilxh_showing_x, {vb:raw vboptions.vsa_visitorslastx_cutoff}, {vb:raw vilxh_total_members}, {vb:raw vboptions.vsa_visitorslastx_xhours}} | <a href="javascript:void(0);" onclick="Vilxh_getUsers();" style="text-decoration:none">{vb:rawphrase vsavilxh_show_all}</a>
						</div>
						<div id="vilxh_users_loading" class="shade" style="display:none;float:{vb:stylevar right}">
							{vb:rawphrase vsavilxh_loading}
						</div>
					</vb:if>
				</ol>
			</div>
			<script language="JavaScript" type="text/javascript">
			<!--
				function Vilxh_getUsers()
				{
					document.getElementById("vilxh_users_more").style.display = "none";
					document.getElementById("vilxh_users_loading").style.display = "inline";
					vilxh_users = new vB_AJAX_Handler(true);
					vilxh_users.onreadystatechange(Vilxh_updateUsers);
					vilxh_users.send('misc.php?show=vilxh_users');
				}

				function Vilxh_updateUsers()
				{
					if (vilxh_users)
					{
						if (vilxh_users.handler.readyState == 4 && vilxh_users.handler.status == 200 && vilxh_users.handler.responseText)
						{
							vilxh_usersDiv = fetch_object("vilxh_users_area");
							vilxh_usersDiv.innerHTML = vilxh_users.handler.responseText;
						}
					}
				}
			-->
			</script>
		</div>
		<vb:if condition="$vboptions['vsa_visitorslastx_showgroups'] AND $vilxh_legend">
			<div id="vsa_vilxh_legend" class="wgo_subblock" style="text-align:center">
				{vb:raw vilxh_legend}
			</div>
		</vb:if>]]></template>
	</templates>
	<stylevardfns>
	</stylevardfns>
	<stylevars>
	</stylevars>
	<plugins>
		<plugin active="1" executionorder="5">
			<title>VSa - VILXH - TC</title>
			<hookname>cache_templates</hookname>
			<phpcode><![CDATA[
		if ($vbulletin->options['vsa_visitorslastx_enable'] AND (THIS_SCRIPT=='index'))
		{
			$cache[] = 'vsa_lastxhoursvisitors';
		}]]></phpcode>
		</plugin>
		<plugin active="1" executionorder="5">
			<title>VSa - VILXH - MN</title>
			<hookname>forumhome_complete</hookname>
			<phpcode><![CDATA[
		if ($vbulletin->options['vsa_visitorslastx_enable'] AND !is_member_of($vbulletin->userinfo, split(',', $vbulletin->options['vsa_visitorslastx_exclgroups'])))
		{
			$vbulletin->db->hide_errors();
			$vilxh_timecut = TIMENOW - ($vbulletin->options['vsa_visitorslastx_xhours'] * 3600); 

			$vilxh_getvisitors = $vbulletin->db->query_read("
				SELECT userid, username, usergroupid, displaygroupid, lastactivity, IF(user.options & " . $vbulletin->bf_misc_useroptions['invisible'] . ", 1, 0) AS invisible
				FROM " . TABLE_PREFIX . "user AS user
				WHERE lastactivity > $vilxh_timecut
				ORDER BY username ASC
			");
			$vilxh_total_members = $vbulletin->db->num_rows($vilxh_getvisitors);
			$vbulletin->options['yestoday'] = 1;
			while($vilxh_visitor = $vbulletin->db->fetch_array($vilxh_getvisitors))
			{
				if ($vbulletin->options['vsa_visitorslastx_cutoff']>0)
				{
					$vilxh_id += 1;
					if ($vilxh_id > $vbulletin->options['vsa_visitorslastx_cutoff'])
					{
						continue;
					}
				}

				$vilxh_markinv = '';
				$vilxh_visible = true;
				if ($vilxh_visitor[invisible])
				{
					$vilxh_visible = false;
					if (($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehidden']) OR $vilxh_visitor[userid] == $vbulletin->userinfo['userid'])
					{
						$vilxh_markinv = '*';
						$vilxh_visible = true;
					}
				}

				$vilxh_visitor[musername] = fetch_musername($vilxh_visitor);
				$vilxh_lastactivity = vbdate($vbulletin->options['dateformat'], $vilxh_visitor[lastactivity], 1).', '.vbdate('H:i', $vilxh_visitor[lastactivity]);

				if ($vilxh_visible)
				{
					$vilxh_userlist .= ', <a href="member.php?'.$vilxh_visitor[userid].'-'.$vilxh_visitor[username].'" title="'.$vilxh_lastactivity.'">'.$vilxh_visitor[musername].'</a>'.$vilxh_markinv;
				}
				else
				{
					if ($vbulletin->options['vsa_visitorslastx_invisible']!='')
					{
						$vilxh_userlist .= ', '.$vbulletin->options['vsa_visitorslastx_invisible'];
					}
				}
			}
			$vilxh_userlist_init = substr($vilxh_userlist, 2);
			unset($vilxh_getvisitors, $vilxh_visitor);

			$vbulletin->options['yestoday'] = $vbulletin->options['yestoday'];

			if ($vbulletin->options['vsa_visitorslastx_showguests'])
			{
				$vilxh_getguests = $vbulletin->db->query_read("
					SELECT userip, dateline
					FROM " . TABLE_PREFIX . "vsavilxh_guests AS vsavilxh_guests
					WHERE dateline > $vilxh_timecut
				");
				$vilxh_total_guests = $vbulletin->db->num_rows($vilxh_getguests);
				unset($vilxh_getguests);

				if ($vbulletin->options['vsa_visitorslastx_fakeguests']!='')
				{
					$vilxh_total_guests += $vbulletin->options['vsa_visitorslastx_fakeguests'];
				}

				$vilxh_total = $vilxh_total_members + $vilxh_total_guests;
			}
			else
			{
				$vilxh_total = $vilxh_total_members;
			}

			foreach (explode(',',$vbulletin->options['vsa_visitorslastx_groups_legend']) AS $vilxh_getgroup)
			{
				$vilxh_group = $vbulletin->usergroupcache[$vilxh_getgroup];
				if ($vilxh_group[opentag])
				{
					$vilxh_legend .= ' - '.$vilxh_group[opentag].$vilxh_group[title].$vilxh_group[closetag];
				}
			}
			unset($vilxh_getgroup);
			$vilxh_legend = substr($vilxh_legend, 3);

			if ($vbulletin->options['vsa_visitorslastx_showguests'])
			{
				$vilxh_stats1 = construct_phrase($vbphrase['vsavilxh_usersvisited'], $vbulletin->options['vsa_visitorslastx_xhours']);
				$vilxh_stats2 = construct_phrase($vbphrase['vsavilxh_visitstotal'], $vilxh_total);
				$vilxh_stats3 = construct_phrase($vbphrase['vsavilxh_visitsstatus'], $vilxh_total_members, $vilxh_total_guests);
			}
			else
			{
				$vilxh_stats = construct_phrase($vbphrase['vsavilxh_visitsinfo_members'], $vbulletin->options['vsa_visitorslastx_xhours'], $vilxh_total);
			}

			$templater = vB_Template::create('vsa_lastxhoursvisitors');
			$templater->register('vilxh_stats1', $vilxh_stats1);
			$templater->register('vilxh_stats2', $vilxh_stats2);
			$templater->register('vilxh_stats3', $vilxh_stats3);
			$templater->register('vilxh_userlist_init', $vilxh_userlist_init);
			$templater->register('vilxh_total_members', $vilxh_total_members);
			$templater->register('vilxh_legend', $vilxh_legend);
			$tvsa_vilxh = $templater->render();

			$template_hook['forumhome_wgo_pos2'] .= $tvsa_vilxh;
			$vbulletin->db->show_errors();
		}]]></phpcode>
		</plugin>
		<plugin active="1" executionorder="5">
			<title>VSa - VILXH - CG</title>
			<hookname>global_start</hookname>
			<phpcode><![CDATA[
		if ($vbulletin->options['vsa_visitorslastx_enable'] AND $vbulletin->options['vsa_visitorslastx_showguests'] AND !$vbulletin->userinfo['userid'])
		{
			$vbulletin->db->hide_errors();
			$vilxh_checkguest = $vbulletin->db->query_read("
				SELECT userip
				FROM " . TABLE_PREFIX . "vsavilxh_guests AS vsavilxh_guests
				WHERE userip = '".$_SERVER['REMOTE_ADDR']."'
			");
			if ($vbulletin->db->num_rows($vilxh_checkguest))
			{
				$vbulletin->db->query_write("
					UPDATE " . TABLE_PREFIX . "vsavilxh_guests
					SET dateline = '".TIMENOW."'
					WHERE userip = '".$_SERVER['REMOTE_ADDR']."'
				");
			}
			else
			{
				$vbulletin->db->query_write("
					INSERT INTO `". TABLE_PREFIX ."vsavilxh_guests`
					(userip, dateline)
					VALUES ('".$_SERVER['REMOTE_ADDR']."', '".TIMENOW."')
				");
			}
			unset($vilxh_checkguest);

			$vilxh_timecut = TIMENOW - ($vbulletin->options['vsa_visitorslastx_xhours'] * 3600);
			$vbulletin->db->query_write(" DELETE FROM " . TABLE_PREFIX . "vsavilxh_guests WHERE dateline < '".$vilxh_timecut."' ");
			$vbulletin->db->show_errors();
		}]]></phpcode>
		</plugin>
		<plugin active="1" executionorder="5">
			<title>VSa - VILXH - UU</title>
			<hookname>login_redirect</hookname>
			<phpcode><![CDATA[
		if ($vbulletin->options['vsa_visitorslastx_enable'] AND $vbulletin->options['vsa_visitorslastx_showguests'])
		{
			$GLOBALS['vbulletin']->db->query_write(" DELETE FROM " . TABLE_PREFIX . "vsavilxh_guests WHERE userip = '".$_SERVER['REMOTE_ADDR']."' ");
		}]]></phpcode>
		</plugin>
		<plugin active="1" executionorder="5">
			<title>VSa - VILXH - SA</title>
			<hookname>misc_start</hookname>
			<phpcode><![CDATA[
		if (($_REQUEST['show']=='vilxh_users') AND $vbulletin->options['vsa_visitorslastx_enable'] AND ($vbulletin->options['vsa_visitorslastx_cutoff']>0) AND !is_member_of($vbulletin->userinfo, split(',', $vbulletin->options['vsa_visitorslastx_exclgroups'])))
		{
			$vbulletin->db->hide_errors();
			$vilxh_timecut = TIMENOW - ($vbulletin->options['vsa_visitorslastx_xhours'] * 3600); 
			$vilxh_getvisitors = $vbulletin->db->query_read("
				SELECT userid, username, usergroupid, displaygroupid, lastactivity, IF(user.options & " . $vbulletin->bf_misc_useroptions['invisible'] . ", 1, 0) AS invisible
				FROM " . TABLE_PREFIX . "user AS user
				WHERE lastactivity > $vilxh_timecut
				ORDER BY username ASC
			");
			$vilxh_total_members = $vbulletin->db->num_rows($vilxh_getvisitors);
			$vbulletin->options['yestoday'] = 1;
			while($vilxh_visitor = $vbulletin->db->fetch_array($vilxh_getvisitors))
			{
				$vilxh_markinv = '';
				$vilxh_visible = true;
				if ($vilxh_visitor[invisible])
				{
					$vilxh_visible = false;
					if (($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehidden']) OR $vilxh_visitor[userid] == $vbulletin->userinfo['userid'])
					{
						$vilxh_markinv = '*';
						$vilxh_visible = true;
					}
				}

				$vilxh_visitor[musername] = fetch_musername($vilxh_visitor);
				$vilxh_lastactivity = vbdate($vbulletin->options['dateformat'], $vilxh_visitor[lastactivity], 1).', '.vbdate('H:i', $vilxh_visitor[lastactivity]);

				if ($vilxh_visible)
				{
					$vilxh_userlist .= ', <a href="member.php?'.$vilxh_visitor[userid].'-'.$vilxh_visitor[username].'" title="'.$vilxh_lastactivity.'">'.$vilxh_visitor[musername].'</a>'.$vilxh_markinv;
				}
				else
				{
					if ($vbulletin->options['vsa_visitorslastx_invisible']!='')
					{
						$vilxh_userlist .= ', '.$vbulletin->options['vsa_visitorslastx_invisible'];
					}
				}
			}
			$vilxh_userlist = substr($vilxh_userlist, 2);
			unset($vilxh_getvisitors, $vilxh_visitor);
			$vbulletin->db->show_errors();
			print_output($vilxh_userlist);
			exit;
		}]]></phpcode>
		</plugin>
		<plugin active="1" executionorder="5">
			<title><![CDATA[Valter's Hacks Template Group]]></title>
			<hookname>template_groups</hookname>
			<phpcode><![CDATA[$only['vsa_'] = 'Valter';
		]]></phpcode>
		</plugin>
	</plugins>
	<phrases>
		<phrasetype name="GLOBAL" fieldname="global">
			<phrase name="vsavilxh_loading" date="0" username="" version=""><![CDATA[Cargando...]]></phrase>
			<phrase name="vsavilxh_show_all" date="0" username="" version=""><![CDATA[Mostrar todo]]></phrase>
			<phrase name="vsavilxh_showing_x" date="0" username="" version=""><![CDATA[Mostrando {1} de un total de {2} miembros que han visitado el foro en las ْltimas {3} horas]]></phrase>
			<phrase name="vsavilxh_usersvisited" date="0" username="" version=""><![CDATA[احصائيات المنتدى خلال {1} ساعة]]></phrase>
			<phrase name="vsavilxh_visitsinfo_members" date="0" username="" version=""><![CDATA[Miembros activos en las ْltimas {1} horas: {2}]]></phrase>
			<phrase name="vsavilxh_visitsstatus" date="0" username="" version=""><![CDATA[{1} عضو {2} زوار المنتدى]]></phrase>
			<phrase name="vsavilxh_visitstotal" date="0" username="" version=""><![CDATA[{1} احصائيات المنتدى]]></phrase>
		</phrasetype>
		<phrasetype name="vBulletin Settings" fieldname="vbsettings">
			<phrase name="setting_vsa_visitorslastx_cutoff_desc" date="0" username="" version=""><![CDATA[اظهار النتائج (0 لإظهار كافة)<br />ملاحظة : قائمة كاملة متوفرة بالاجاكس]]></phrase>
			<phrase name="setting_vsa_visitorslastx_enable_desc" date="0" username="" version=""><![CDATA[تنشيط المنتج]]></phrase>
			<phrase name="setting_vsa_visitorslastx_enable_title" date="0" username="" version=""><![CDATA[الخيارات الرئيسية]]></phrase>
			<phrase name="setting_vsa_visitorslastx_exclgroups_desc" date="0" username="" version=""><![CDATA[ويمكن لمجموعات المستخدم لا ترى VILXH مربع (فصل قائمة معرفات مع فاصلة)
]]></phrase>
			<phrase name="setting_vsa_visitorslastx_exclgroups_title" date="0" username="" version=""><![CDATA[خيارات أخرى
]]></phrase>
			<phrase name="setting_vsa_visitorslastx_fakeguests_desc" date="0" username="" version=""><![CDATA[كاذبة    هذا الهاك مقدم من منتديات امواج قام باعرابة طائر الغرام  aadir المستخدمين (يترك فارغا لتعطيل هذه الميزة)
]]></phrase>
			<phrase name="setting_vsa_visitorslastx_groups_legend_desc" date="0" username="" version=""><![CDATA[مجموعات المستخدم تظهر (للفصل بين قائمة معرفات مع فاصلة)
]]></phrase>
			<phrase name="setting_vsa_visitorslastx_invisible_desc" date="0" username="" version=""><![CDATA[كما عرض أعضاء غير مرئية (يترك فارغا لمدة لا تظهر على القائمة)
]]></phrase>
			<phrase name="setting_vsa_visitorslastx_showgroups_desc" date="0" username="" version=""><![CDATA[تفعيل]]></phrase>
			<phrase name="setting_vsa_visitorslastx_showgroups_title" date="0" username="" version=""><![CDATA[مجموعات المستخدمين]]></phrase>
			<phrase name="setting_vsa_visitorslastx_showguests_desc" date="0" username="" version=""><![CDATA[عرض عدد غير المسجلين الذين زاروا المنتدى في الساعات ]]></phrase>
			<phrase name="setting_vsa_visitorslastx_xhours_desc" date="0" username="" version=""><![CDATA[ الاحصائيات فى اخر ساعة   ]]></phrase>
			<phrase name="settinggroup_VisitorsLastX" date="0" username="" version=""><![CDATA[xهاك الزوار والاعضاء فى اخر ساعة]]></phrase>
		</phrasetype>
	</phrases>
	<options>
		<settinggroup name="VisitorsLastX" displayorder="65535">
			<setting varname="vsa_visitorslastx_enable" displayorder="5">
				<datatype>number</datatype>
				<optioncode>yesno</optioncode>
				<defaultvalue>1</defaultvalue>
			</setting>
			<setting varname="vsa_visitorslastx_xhours" displayorder="10">
				<datatype>number</datatype>
				<defaultvalue>24</defaultvalue>
			</setting>
			<setting varname="vsa_visitorslastx_cutoff" displayorder="15">
				<datatype>number</datatype>
				<defaultvalue>300</defaultvalue>
			</setting>
			<setting varname="vsa_visitorslastx_invisible" displayorder="20">
				<datatype>free</datatype>
				<defaultvalue><![CDATA[<i>Invisible</i>]]></defaultvalue>
			</setting>
			<setting varname="vsa_visitorslastx_showguests" displayorder="25">
				<datatype>number</datatype>
				<optioncode>yesno</optioncode>
				<defaultvalue>1</defaultvalue>
			</setting>
			<setting varname="vsa_visitorslastx_showgroups" displayorder="30">
				<datatype>number</datatype>
				<optioncode>yesno</optioncode>
				<defaultvalue>1</defaultvalue>
			</setting>
			<setting varname="vsa_visitorslastx_groups_legend" displayorder="35">
				<datatype>free</datatype>
				<defaultvalue>2,3,4,5,6,7,8</defaultvalue>
			</setting>
			<setting varname="vsa_visitorslastx_exclgroups" displayorder="40">
				<datatype>free</datatype>
			</setting>
			<setting varname="vsa_visitorslastx_fakeguests" displayorder="45">
				<datatype>free</datatype>
			</setting>
		</settinggroup>
	</options>
	<helptopics>
	</helptopics>
	<cronentries>
	</cronentries>
	<faqentries>
	</faqentries>
</product>
